# HG changeset patch # User Lennard de Rijk # Date 1233504583 0 # Node ID 3116b927f4b9604073fed9ad3c94995279b9eb22 # Parent 7ec111a4d0f1dda0a1c8ead68a1179ee1cdc406a Added org_app view and templates. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed diff -r 7ec111a4d0f1 -r 3116b927f4b9 app/soc/templates/soc/org_app/list/row.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/org_app/list/row.html Sun Feb 01 16:09:43 2009 +0000 @@ -0,0 +1,9 @@ + +
{{ list.item.name }} +
+ + +
{{ list.item.last_modified_on }}
+ diff -r 7ec111a4d0f1 -r 3116b927f4b9 app/soc/templates/soc/org_app/public.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/org_app/public.html Sun Feb 01 16:09:43 2009 +0000 @@ -0,0 +1,36 @@ +{% extends "soc/base.html" %} +{% comment %} +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +{% endcomment %} +{% load forms_helpers %} + +{% block header_title %} +{{ page_name }} for {{ entity.name }} +{% endblock %} + +{% block body %} +

+ + {% readonly_field_as_twoline_table_row entity.fields.name.label entity.name %} + {% readonly_field_as_twoline_table_row entity.fields.applicant.label entity.applicant.link_id %} + {% readonly_field_as_twoline_table_row entity.fields.home_page.label entity.home_page %} + {% readonly_field_as_twoline_table_row entity.fields.email.label entity.email %} + {% readonly_field_as_twoline_table_row entity.fields.description.label entity.description %} + {% readonly_field_as_twoline_table_row entity.fields.why_applying.label entity.why_applying %} + {% readonly_field_as_twoline_table_row entity.fields.pub_mailing_list.label entity.pub_mailing_list %} + {% readonly_field_as_twoline_table_row entity.fields.irc_channel.label entity.irc_channel %} + {% readonly_field_as_twoline_table_row entity.fields.backup_admin.label entity.backup_admin.link_id %} + {% readonly_field_as_twoline_table_row entity.fields.member_criteria.label entity.member_criteria %} +
+

+{% endblock %} diff -r 7ec111a4d0f1 -r 3116b927f4b9 app/soc/templates/soc/org_app/review.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/org_app/review.html Sun Feb 01 16:09:43 2009 +0000 @@ -0,0 +1,61 @@ +{% extends "soc/base.html" %} +{% comment %} +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +{% endcomment %} +{% load forms_helpers %} + +{% block header_title %} +{{ page_name }} for {{ entity.name }} +{% endblock %} + +{% block body %} +

+ + {% readonly_field_as_twoline_table_row entity.fields.name.label entity.name %} + {% readonly_field_as_twoline_table_row entity.fields.applicant.label entity.applicant.link_id %} + {% readonly_field_as_twoline_table_row entity.fields.home_page.label entity.home_page %} + {% readonly_field_as_twoline_table_row entity.fields.email.label entity.email %} + {% readonly_field_as_twoline_table_row entity.fields.description.label entity.description %} + {% readonly_field_as_twoline_table_row entity.fields.why_applying.label entity.why_applying %} + {% readonly_field_as_twoline_table_row entity.fields.prior_participation.label entity.prior_participation %} + {% readonly_field_as_twoline_table_row entity.fields.prior_application.label entity.prior_application %} + {% readonly_field_as_twoline_table_row entity.fields.license_name.label entity.license_name %} + {% readonly_field_as_twoline_table_row entity.fields.pub_mailing_list.label entity.pub_mailing_list %} + {% readonly_field_as_twoline_table_row entity.fields.dev_mailing_list.label entity.dev_mailing_list %} + {% readonly_field_as_twoline_table_row entity.fields.irc_channel.label entity.irc_channel %} + {% readonly_field_as_twoline_table_row entity.fields.backup_admin.label entity.backup_admin.link_id %} + {% readonly_field_as_twoline_table_row entity.fields.member_criteria.label entity.member_criteria %} + {% readonly_field_as_twoline_table_row entity.fields.contrib_disappears.label entity.contrib_disappears %} + {% readonly_field_as_twoline_table_row entity.fields.member_disappears.label entity.member_disappears %} + {% readonly_field_as_twoline_table_row entity.fields.encourage_contribs.label entity.encourage_contribs %} + {% readonly_field_as_twoline_table_row entity.fields.continued_contribs.label entity.continued_contribs %} + {% readonly_field_as_twoline_table_row entity.fields.ideas.label entity.ideas %} + {% readonly_field_as_twoline_table_row entity.fields.contrib_template.label entity.contrib_template %} + + + {% readonly_field_as_table_row entity.fields.status.label entity.status %} + {% readonly_field_as_table_row "Created on" entity.created_on %} + {% readonly_field_as_table_row "Last Modified on" entity.last_modified_on %} +
+

+ + + + + + + + + + +{% endblock %} diff -r 7ec111a4d0f1 -r 3116b927f4b9 app/soc/views/models/org_app.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/views/models/org_app.py Sun Feb 01 16:09:43 2009 +0000 @@ -0,0 +1,93 @@ +#!/usr/bin/python2.5 +# +# Copyright 2008 the Melange authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Views for Organization App profiles. +""" + +__authors__ = [ + '"Lennard de Rijk" ', + ] + + +from django import forms + +from soc.logic import dicts +from soc.logic.models import org_app as org_app_logic +from soc.views.helper import access +from soc.views.models import group_app + +import soc.logic.dicts + + +class View(group_app.View): + """View methods for the Organization Application model. + """ + + def __init__(self, params=None): + """Defines the fields and methods required for the base View class + to provide the user with list, public, create, edit and delete views. + + Params: + params: a dict with params for this View + """ + + #TODO(ljvderijk) do the right rights check + rights = access.Checker(params) + rights['create'] = ['checkIsDeveloper'] + rights['delete'] = [('checkIsMyApplication', org_app_logic)] + rights['edit'] = [('checkIsMyApplication', org_app_logic)] + rights['list'] = ['checkIsDeveloper'] + rights['public'] = [('checkIsMyApplication', org_app_logic)] + rights['review'] = ['checkIsDeveloper'] + + new_params = {} + + new_params['rights'] = rights + new_params['logic'] = org_app_logic.logic + + new_params['sidebar_grouping'] = 'Organization' + + new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status', + 'created_on', 'last_modified_on'] + # TODO(ljvderijk) add cleaning method to ensure uniqueness + new_params['create_extra_dynafields'] = { + 'scope_path': forms.fields.CharField(widget=forms.HiddenInput, + required=True)} + + new_params['name'] = "Organization Application" + new_params['name_plural'] = "Organization Applications" + new_params['name_short'] = "Org App" + new_params['url_name'] = "org_app" + new_params['group_url_name'] = 'org' + + new_params['review_template'] = 'soc/org_app/review.html' + + params = dicts.merge(params, new_params) + + super(View, self).__init__(params=params) + + +view = View() + +create = view.create +delete = view.delete +edit = view.edit +list = view.list +public = view.public +export = view.export +review = view.review +review_overview = view.reviewOverview + diff -r 7ec111a4d0f1 -r 3116b927f4b9 app/soc/views/sitemap/build.py --- a/app/soc/views/sitemap/build.py Sun Feb 01 16:07:37 2009 +0000 +++ b/app/soc/views/sitemap/build.py Sun Feb 01 16:09:43 2009 +0000 @@ -34,6 +34,7 @@ from soc.views.models import notification from soc.views.models import organization from soc.views.models import org_admin +from soc.views.models import org_app from soc.views.models import program from soc.views.models import request from soc.views.models import site @@ -64,6 +65,7 @@ sidebar.addMenu(organization.view.getSidebarMenus) sidebar.addMenu(org_admin.view.getSidebarMenus) sidebar.addMenu(mentor.view.getSidebarMenus) +sidebar.addMenu(org_app.view.getSidebarMenus) sitemap.addPages(club.view.getDjangoURLPatterns()) sitemap.addPages(club_admin.view.getDjangoURLPatterns()) @@ -75,6 +77,7 @@ sitemap.addPages(notification.view.getDjangoURLPatterns()) sitemap.addPages(organization.view.getDjangoURLPatterns()) sitemap.addPages(org_admin.view.getDjangoURLPatterns()) +sitemap.addPages(org_app.view.getDjangoURLPatterns()) sitemap.addPages(program.view.getDjangoURLPatterns()) sitemap.addPages(request.view.getDjangoURLPatterns()) sitemap.addPages(site.view.getDjangoURLPatterns())