# HG changeset patch
# User Lennard de Rijk
# Date 1233428134 0
# Node ID 4fc86db70a765b410cb656d869757c400433bb02
# Parent c6e8e3573fa29e55d5f191f0c478cebce4092017
Added organization view and templates.
Also added TODO's so it's clear what still needs to be done to make this work.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
diff -r c6e8e3573fa2 -r 4fc86db70a76 app/soc/templates/soc/organization/list/heading.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/organization/list/heading.html Sat Jan 31 18:55:34 2009 +0000
@@ -0,0 +1,6 @@
+
+ Name |
+ Program ID |
+ Link ID |
+ Short name |
+
diff -r c6e8e3573fa2 -r 4fc86db70a76 app/soc/templates/soc/organization/list/row.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/organization/list/row.html Sat Jan 31 18:55:34 2009 +0000
@@ -0,0 +1,10 @@
+
+
+ |
+ {{ list.item.scope.key.name }} |
+ {{ list.item.link_id }} |
+ {{ list.item.short_name }} |
+
diff -r c6e8e3573fa2 -r 4fc86db70a76 app/soc/templates/soc/organization/public.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/organization/public.html Sat Jan 31 18:55:34 2009 +0000
@@ -0,0 +1,40 @@
+{% 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_table_row entity.fields.name.label entity.name %}
+ {% readonly_field_as_table_row entity.fields.home_page.label entity.home_page %}
+ {% readonly_field_as_table_row entity.fields.description.label entity.description %}
+ {% readonly_field_as_table_row entity.fields.contact_street.label entity.contact_street %}
+ {% readonly_field_as_table_row entity.fields.contact_city.label entity.contact_city %}
+ {% readonly_field_as_table_row entity.fields.contact_state.label entity.contact_state %}
+ {% readonly_field_as_table_row entity.fields.contact_country.label entity.contact_country %}
+ {% readonly_field_as_table_row entity.fields.contact_postalcode.label entity.contact_postalcode %}
+ {% readonly_field_as_table_row entity.fields.phone.label entity.phone %}
+ {% readonly_field_as_table_row entity.fields.shipping_street.label entity.shipping_street %}
+ {% readonly_field_as_table_row entity.fields.shipping_city.label entity.shipping_city %}
+ {% readonly_field_as_table_row entity.fields.shipping_state.label entity.shipping_state %}
+ {% readonly_field_as_table_row entity.fields.shipping_country.label entity.shipping_country %}
+ {% readonly_field_as_table_row entity.fields.shipping_postalcode.label entity.shipping_postalcode %}
+
+
+{% endblock %}
diff -r c6e8e3573fa2 -r 4fc86db70a76 app/soc/views/models/organization.py
--- a/app/soc/views/models/organization.py Sat Jan 31 18:44:00 2009 +0000
+++ b/app/soc/views/models/organization.py Sat Jan 31 18:55:34 2009 +0000
@@ -19,6 +19,7 @@
__authors__ = [
'"Sverre Rabbelier" ',
+ '"Lennard de Rijk" ',
]
@@ -26,6 +27,7 @@
from soc.logic import cleaning
from soc.logic import dicts
+from soc.views.helper import access
from soc.views.helper import redirects
from soc.views.models import group
from soc.views.models import program as program_view
@@ -46,6 +48,18 @@
original_params: a dict with params for this View
"""
+ # TODO do the proper access checks
+ rights = access.Checker(params)
+ rights['create'] = ['checkIsDeveloper']
+ rights['edit'] = ['checkIsDeveloper']
+ rights['delete'] = ['checkIsDeveloper']
+ rights['home'] = ['allow']
+ rights['list'] = ['checkIsDeveloper']
+ rights['list_requests'] = ['checkIsDeveloper']
+ rights['list_roles'] = ['checkIsDeveloper']
+ # TODO(ljvderijk) implement Org application process
+ #rights['applicant'] = ['checkIsDeveloper']
+
new_params = {}
new_params['logic'] = soc.logic.models.organization.logic
@@ -54,7 +68,13 @@
new_params['name'] = "Organization"
new_params['url_name'] = "org"
+ new_params['sidebar_grouping'] = 'Organizations'
+ new_params['public_template'] = 'soc/organization/public.html'
+ new_params['list_row'] = 'soc/organization/list/row.html'
+ new_params['list_heading'] = 'soc/organization/list/heading.html'
+
+ #TODO(ljvderijk) add cleaning methods to not overwrite existing orgs
new_params['create_extra_dynafields'] = {
'scope_path': forms.CharField(widget=forms.HiddenInput,
required=True),
@@ -65,13 +85,19 @@
super(View, self).__init__(params=params)
+ # TODO(ljvderijk) define several menu items for organizations
+ #def _getExtraMenuItems(self, role_description, params=None):
+
view = View()
create = view.create
delete = view.delete
edit = view.edit
+home = view.home
list = view.list
+list_requests = view.listRequests
+list_roles = view.listRoles
public = view.public
export = view.export
pick = view.pick
diff -r c6e8e3573fa2 -r 4fc86db70a76 app/soc/views/sitemap/build.py
--- a/app/soc/views/sitemap/build.py Sat Jan 31 18:44:00 2009 +0000
+++ b/app/soc/views/sitemap/build.py Sat Jan 31 18:55:34 2009 +0000
@@ -32,6 +32,7 @@
from soc.views.models import host
from soc.views.models import notification
from soc.views.models import organization
+from soc.views.models import org_admin
from soc.views.models import program
from soc.views.models import request
from soc.views.models import site
@@ -60,6 +61,7 @@
sidebar.addMenu(program.view.getSidebarMenus)
sidebar.addMenu(program.view.getExtraMenus)
sidebar.addMenu(organization.view.getSidebarMenus)
+sidebar.addMenu(org_admin.view.getSidebarMenus)
sitemap.addPages(club.view.getDjangoURLPatterns())
sitemap.addPages(club_admin.view.getDjangoURLPatterns())
@@ -69,6 +71,7 @@
sitemap.addPages(host.view.getDjangoURLPatterns())
sitemap.addPages(notification.view.getDjangoURLPatterns())
sitemap.addPages(organization.view.getDjangoURLPatterns())
+sitemap.addPages(org_admin.view.getDjangoURLPatterns())
sitemap.addPages(program.view.getDjangoURLPatterns())
sitemap.addPages(request.view.getDjangoURLPatterns())
sitemap.addPages(site.view.getDjangoURLPatterns())