app/soc/views/sitemap/build.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 12 Feb 2009 00:04:32 +0000
changeset 1276 7f460f46a611
parent 1264 4d46b09f3751
child 1280 9a510b94cf22
permissions -rw-r--r--
Initial implementation of a ToS requirement in org_app If the _editContext method can be made generic enough, it should be easy to add ToSes to other forms. This solution should also be applied to user_self, as the current implementation is not very clean to say the least. Patch By: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
499
d22e4fe8e64b Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 494
diff changeset
    17
"""Module that constructs the sitemap.
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from django.conf.urls import defaults
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
779
81506d223cb0 Added support for creating clubs.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 768
diff changeset
    27
from soc.views.models import club
791
30da180c4bca Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents: 779
diff changeset
    28
from soc.views.models import club_app
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 791
diff changeset
    29
from soc.views.models import club_admin
980
3f3f7ec251bf Added Club Members to SoC.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 901
diff changeset
    30
from soc.views.models import club_member
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
from soc.views.models import document
665
ce9f11f7c4cf Fix import sorting in soc.views.sitemap.build module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 643
diff changeset
    32
from soc.views.models import host
1130
9bdbb18d622e Added view and templates for mentors.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1126
diff changeset
    33
from soc.views.models import mentor
726
ba3d399ec9be Added Notifications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 703
diff changeset
    34
from soc.views.models import notification
682
187f4d95fedb Added organizations
Sverre Rabbelier <srabbelier@gmail.com>
parents: 665
diff changeset
    35
from soc.views.models import organization
1126
4fc86db70a76 Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1002
diff changeset
    36
from soc.views.models import org_admin
1151
3116b927f4b9 Added org_app view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1130
diff changeset
    37
from soc.views.models import org_app
665
ce9f11f7c4cf Fix import sorting in soc.views.sitemap.build module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 643
diff changeset
    38
from soc.views.models import program
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
from soc.views.models import request
665
ce9f11f7c4cf Fix import sorting in soc.views.sitemap.build module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 643
diff changeset
    40
from soc.views.models import site
ce9f11f7c4cf Fix import sorting in soc.views.sitemap.build module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 643
diff changeset
    41
from soc.views.models import sponsor
768
002d3141ff99 Added logic and view classes for the Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents: 767
diff changeset
    42
from soc.views.models import timeline
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
from soc.views.models import user
590
37735d97b541 Created a seperate module for editSelf things
Sverre Rabbelier <srabbelier@gmail.com>
parents: 585
diff changeset
    44
from soc.views.models import user_self
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
from soc.views.sitemap import sidebar
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
from soc.views.sitemap import sitemap
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
703
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    50
sidebar.addMenu(user_self.view.getSidebarMenus)
779
81506d223cb0 Added support for creating clubs.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 768
diff changeset
    51
sidebar.addMenu(club.view.getSidebarMenus)
1002
11a2aff6c3ad Added sidebar support for group instances.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 980
diff changeset
    52
sidebar.addMenu(club.view.getExtraMenus)
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 791
diff changeset
    53
sidebar.addMenu(club_admin.view.getSidebarMenus)
980
3f3f7ec251bf Added Club Members to SoC.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 901
diff changeset
    54
sidebar.addMenu(club_member.view.getSidebarMenus)
791
30da180c4bca Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents: 779
diff changeset
    55
sidebar.addMenu(club_app.view.getSidebarMenus)
703
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    56
sidebar.addMenu(site.view.getSidebarMenus)
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    57
sidebar.addMenu(user.view.getSidebarMenus)
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    58
sidebar.addMenu(document.view.getSidebarMenus)
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    59
sidebar.addMenu(sponsor.view.getSidebarMenus)
1002
11a2aff6c3ad Added sidebar support for group instances.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 980
diff changeset
    60
sidebar.addMenu(sponsor.view.getExtraMenus)
703
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    61
sidebar.addMenu(host.view.getSidebarMenus)
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    62
sidebar.addMenu(request.view.getSidebarMenus)
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    63
sidebar.addMenu(program.view.getSidebarMenus)
700
8baf8367340d Dynamically add sidebar items for programs
Sverre Rabbelier <srabbelier@gmail.com>
parents: 682
diff changeset
    64
sidebar.addMenu(program.view.getExtraMenus)
703
c4f3997becd9 Rename getSidebarLinks to getSidebarMenus
Sverre Rabbelier <srabbelier@gmail.com>
parents: 700
diff changeset
    65
sidebar.addMenu(organization.view.getSidebarMenus)
1264
4d46b09f3751 Added organization entity sidebar entries.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1151
diff changeset
    66
sidebar.addMenu(organization.view.getExtraMenus)
1126
4fc86db70a76 Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1002
diff changeset
    67
sidebar.addMenu(org_admin.view.getSidebarMenus)
1130
9bdbb18d622e Added view and templates for mentors.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1126
diff changeset
    68
sidebar.addMenu(mentor.view.getSidebarMenus)
1151
3116b927f4b9 Added org_app view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1130
diff changeset
    69
sidebar.addMenu(org_app.view.getSidebarMenus)
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    70
779
81506d223cb0 Added support for creating clubs.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 768
diff changeset
    71
sitemap.addPages(club.view.getDjangoURLPatterns())
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 791
diff changeset
    72
sitemap.addPages(club_admin.view.getDjangoURLPatterns())
791
30da180c4bca Added the club_app view, logic and model
Sverre Rabbelier <srabbelier@gmail.com>
parents: 779
diff changeset
    73
sitemap.addPages(club_app.view.getDjangoURLPatterns())
980
3f3f7ec251bf Added Club Members to SoC.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 901
diff changeset
    74
sitemap.addPages(club_member.view.getDjangoURLPatterns())
767
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    75
sitemap.addPages(document.view.getDjangoURLPatterns())
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    76
sitemap.addPages(host.view.getDjangoURLPatterns())
1130
9bdbb18d622e Added view and templates for mentors.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1126
diff changeset
    77
sitemap.addPages(mentor.view.getDjangoURLPatterns())
726
ba3d399ec9be Added Notifications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 703
diff changeset
    78
sitemap.addPages(notification.view.getDjangoURLPatterns())
767
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    79
sitemap.addPages(organization.view.getDjangoURLPatterns())
1126
4fc86db70a76 Added organization view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1002
diff changeset
    80
sitemap.addPages(org_admin.view.getDjangoURLPatterns())
1151
3116b927f4b9 Added org_app view and templates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1130
diff changeset
    81
sitemap.addPages(org_app.view.getDjangoURLPatterns())
767
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    82
sitemap.addPages(program.view.getDjangoURLPatterns())
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    83
sitemap.addPages(request.view.getDjangoURLPatterns())
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    84
sitemap.addPages(site.view.getDjangoURLPatterns())
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    85
sitemap.addPages(sponsor.view.getDjangoURLPatterns())
768
002d3141ff99 Added logic and view classes for the Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents: 767
diff changeset
    86
sitemap.addPages(timeline.view.getDjangoURLPatterns())
767
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    87
sitemap.addPages(user_self.view.getDjangoURLPatterns())
ebd938bbd3d4 Sorted build.py's sitemap.addPages lines
Sverre Rabbelier <srabbelier@gmail.com>
parents: 726
diff changeset
    88
sitemap.addPages(user.view.getDjangoURLPatterns())
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    89
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
def getPatterns():
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    92
  return defaults.patterns(None, *sitemap.SITEMAP)