app/soc/logic/site/map.py
author Todd Larsen <tlarsen@google.com>
Thu, 16 Oct 2008 04:30:26 +0000
changeset 350 e8f14fde7f0e
parent 349 bb82a1a3339c
child 372 8595c1129c74
permissions -rw-r--r--
"new" is a little bit redundant in the short_name of sidebar menu items that already begin with "Create...", since that implies the result will be something new. Patch by: Todd Larsen Review by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
#
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
#
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    17
"""Site map information, used to generate sidebar menus, urlpatterns, etc.
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
"""
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
__authors__ = [
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    21
  '"Todd Larsen" <tlarsen@google.com>',
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
  ]
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    25
import copy
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    26
import re
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    27
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    28
from google.appengine.api import users
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    29
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    30
from django.conf.urls import defaults
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
from django.utils import datastructures
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
    33
from soc.logic import path_link_name
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    34
from soc.logic.site import page
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    35
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    36
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    37
# Home Page view
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    38
home = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    39
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    40
    r'^$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    41
    'soc.views.site.home.public'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    42
  'Google Open Source Programs',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    43
  # it should be obvious that every page comes from the home page
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    44
  in_breadcrumb=False)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    45
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    46
# User authentication view placeholders
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    47
# (these are not real Django views, but need to appear in menus, etc.)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    48
user_signin = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    49
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    50
    # not a real Django URL regex, just a unique placeholder
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    51
    users.create_login_url('/'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    52
    # no view, since App Engine handles this page
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    53
    # (this page will not be placed in urlpatterns)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    54
    None,
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    55
    # name is alternate string for view when it is not unique
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    56
    name='user-sign-in'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    57
  'User (sign in)',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    58
  link_url=users.create_login_url('/'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    59
  parent=home)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    60
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    61
user_signout = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    62
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    63
    # not a real Django URL regex, just a unique placeholder
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    64
    users.create_logout_url('/'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    65
    # no view, since App Engine handles this page
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    66
    # (this page will not be placed in urlpatterns)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    67
    None,
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    68
    # name is alternate string for view when it is not unique
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    69
    name='user-sign-out'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    70
  'User (sign out)',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    71
  link_url=users.create_logout_url('/'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    72
  parent=home)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    73
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    74
# User Profile views
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    75
user_create = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    76
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    77
    r'^user/profile$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    78
    'soc.views.user.profile.create'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    79
  'User: Create a New Profile',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    80
  short_name='Site-wide User Profile',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    81
  parent=user_signout)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    82
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    83
user_edit = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    84
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
    85
    r'^user/profile/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    86
    'soc.views.user.profile.edit'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    87
  'User: Modify Existing User Profile',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    88
  parent=user_signout)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    89
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    90
# Site Home Page views
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    91
site_home = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    92
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    93
    r'^site/home$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    94
    'soc.views.site.home.public'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    95
  'Google Open Source Programs',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    96
  # it should be obvious that every page comes from the home page
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    97
  in_breadcrumb=False)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
    98
347
52676c696cd4 First phase of making the / (site/home) view generic enough to use it for
Todd Larsen <tlarsen@google.com>
parents: 314
diff changeset
    99
site_settings_edit = page.Page(
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   100
  page.Url(
347
52676c696cd4 First phase of making the / (site/home) view generic enough to use it for
Todd Larsen <tlarsen@google.com>
parents: 314
diff changeset
   101
    r'^site/settings/edit$',
52676c696cd4 First phase of making the / (site/home) view generic enough to use it for
Todd Larsen <tlarsen@google.com>
parents: 314
diff changeset
   102
    'soc.views.site.settings.edit'),
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   103
  'Site: Settings',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   104
  short_name='Site Settings',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   105
  parent=home)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   106
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   107
# Site User Profile views
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   108
site_user_sub_menu = page.Page(
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   109
  page.Url(
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   110
    # not a real Django URL regex, just a unique placeholder
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   111
    # (this can be any unique string that re.compile() will not reject, but
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   112
    # that also contains characters that would be escaped, causing
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   113
    # soc.logic.site.page.Page.makeLinkUrl() to reject it and not make the
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   114
    # menu item into an <A HREF> link; this seems a bit hacky...)
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   115
    #
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   116
    # TODO(tlarsen): formalize this hack by subclassing Page (maybe calling
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   117
    #   it something like NonPage) to add a non-linkable form of page for
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   118
    #   use in dividers just like this
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   119
    # TODO(tlarsen): add an optional keyword parameter that can be used to
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   120
    #   control where the collapsible sub-menus are and whether they are
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   121
    #   collapsed or not by default in the sidebar menu 
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   122
    'site*user*sub*menu',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   123
    # no view, since this is just a link-less menu divider
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   124
    # (this page will not be placed in urlpatterns)
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   125
    None,
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   126
    # name is alternate string for view when it is not unique
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   127
    name='site-user-sub-menu'),
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   128
  '',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   129
  short_name='Site Users',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   130
  parent=site_settings_edit)
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   131
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   132
site_user_lookup = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   133
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   134
    r'^site/user/lookup$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   135
    'soc.views.site.user.profile.lookup'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   136
  'Site: Look Up an Existing User',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   137
  short_name='Look Up Site User',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   138
  parent=site_user_sub_menu)
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   139
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   140
site_user_create = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   141
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   142
    r'^site/user/profile$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   143
    'soc.views.site.user.profile.create'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   144
  'Site: Create New User Profile',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   145
  short_name='Create Site User',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   146
  parent=site_user_sub_menu)
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   147
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   148
site_user_edit = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   149
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
   150
    r'^site/user/profile/%s$' % path_link_name.LINKNAME_ARG_PATTERN,
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   151
    'soc.views.site.user.profile.edit'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   152
  'Site: Modify Existing User Profile',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   153
  short_name='Modify Site User',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   154
  parent=site_user_sub_menu)
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   155
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   156
site_user_list = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   157
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   158
    r'^site/user/list$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   159
    'soc.views.site.user.list.all'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   160
  'Site: List of Users',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   161
  short_name='List Site Users',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   162
  parent=site_user_sub_menu)
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   163
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   164
# Document views
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   165
docs_show = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   166
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
   167
    r'^docs/show/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   168
    'soc.views.docs.show.public'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   169
  'Show Document',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   170
  parent=home)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   171
 
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   172
# Site Document views
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   173
site_docs_sub_menu = page.Page(
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   174
  page.Url(
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   175
    # (see site_user_sub_menu above for how this works...) 
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   176
    'site*docs*sub*menu',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   177
    # no view, since this is just a link-less menu divider
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   178
    None,
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   179
    # name is alternate string for view when it is not unique
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   180
    name='site-docs-sub-menu'),
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   181
  '',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   182
  short_name='Site Documents',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   183
  parent=site_settings_edit)
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   184
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   185
site_docs_create = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   186
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   187
    r'^site/docs/edit$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   188
    'soc.views.site.docs.edit.create'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   189
  'Site: Create New Document',
350
e8f14fde7f0e "new" is a little bit redundant in the short_name of sidebar menu items that
Todd Larsen <tlarsen@google.com>
parents: 349
diff changeset
   190
  'Create Site Document',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   191
  parent=site_docs_sub_menu)
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   192
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   193
site_docs_edit = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   194
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
   195
    r'^site/docs/edit/%s$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   196
    'soc.views.site.docs.edit.edit'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   197
  'Site: Modify Existing Document',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   198
  short_name='Modify Site Document',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   199
  parent=site_docs_sub_menu)
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   200
314
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   201
site_docs_delete = page.Page(
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   202
  page.Url(
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   203
    r'^site/docs/%s/delete$' % path_link_name.PATH_LINKNAME_ARGS_PATTERN,
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   204
    'soc.views.site.docs.edit.delete'),
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   205
  'Site: Delete Existing Document',
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   206
  short_name='Delete Site Document',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   207
  parent=site_docs_sub_menu)
314
dfaf249c12b2 Rearrange imports in home.py so they apply to new discussed format (separate "from ..." and "import ..." blocks). Add Delete Document functionality.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 305
diff changeset
   208
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   209
site_docs_list = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   210
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   211
    r'^site/docs/list$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   212
    'soc.views.site.docs.list.all'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   213
  'Site: List of Documents',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   214
  short_name='List Site Documents',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   215
  parent=site_docs_sub_menu)
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   216
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   217
# Sponsor Group public view
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   218
sponsor_profile = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   219
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
   220
    r'^sponsor/profile/%s' % path_link_name.LINKNAME_ARG_PATTERN,
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   221
    'soc.views.sponsor.profile.public'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   222
  'Public Profile',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   223
  parent=home)
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   224
    
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   225
# Sponsor Group Site views
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   226
site_sponsor_sub_menu = page.Page(
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   227
  page.Url(
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   228
    # (see site_user_sub_menu above for how this works...) 
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   229
    'site*sponsor*sub*menu',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   230
    # no view, since this is just a link-less menu divider
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   231
    None,
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   232
    # name is alternate string for view when it is not unique
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   233
    name='site-sponsor-sub-menu'),
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   234
  '',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   235
  short_name='Site Sponsors',
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   236
  parent=site_settings_edit)
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   237
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   238
site_sponsor_create = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   239
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   240
    r'^site/sponsor/profile$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   241
    'soc.views.site.sponsor.profile.create'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   242
  'Site: Create New Sponsor',
350
e8f14fde7f0e "new" is a little bit redundant in the short_name of sidebar menu items that
Todd Larsen <tlarsen@google.com>
parents: 349
diff changeset
   243
  short_name='Create Site Sponsor',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   244
  parent=site_sponsor_sub_menu)
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   245
292
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   246
site_sponsor_delete = page.Page(
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   247
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
   248
    r'^site/sponsor/profile/%s/delete$' % path_link_name.LINKNAME_ARG_PATTERN,
292
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   249
    'soc.views.site.sponsor.profile.delete'),
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   250
  'Site: Delete Existing Sponsor',
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   251
  short_name='Delete Site Sponsor',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   252
  parent=site_sponsor_sub_menu)
292
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   253
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   254
site_sponsor_edit = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   255
  page.Url(
305
972d28056d9d Minor style and import fixes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 299
diff changeset
   256
    r'^site/sponsor/profile/%s' % path_link_name.LINKNAME_ARG_PATTERN,
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   257
    'soc.views.site.sponsor.profile.edit'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   258
  'Site: Modify Existing Sponsor',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   259
  short_name='Modify Site Sponsor',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   260
  parent=site_sponsor_sub_menu)
292
1cece5192e26 Enable recently commited delete Sponsor request handler (added to map.py) and Delete button in Sponsor edit view. Still missing "Are you sure ?" question box.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 282
diff changeset
   261
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   262
site_sponsor_list = page.Page(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   263
  page.Url(
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   264
    r'^site/sponsor/list$',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   265
    'soc.views.site.sponsor.list.all'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   266
  'Site: List of Sponsors',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   267
  short_name='List Site Sponsors',
349
bb82a1a3339c A quick-and-dirty way to create non-link sub-menu dividers, plus a TODO on
Todd Larsen <tlarsen@google.com>
parents: 347
diff changeset
   268
  parent=site_sponsor_sub_menu)
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   269
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   270
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   271
# these are not really used...
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents: 292
diff changeset
   272
#    (r'^org/profile/(?P<program>ghop[_0-9a-z]+)/(?P<link_name>[_0-9a-z]+)/$',
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   273
#     'soc.views.person.profile.edit',
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   274
#     {'template': 'ghop/person/profile/edit.html'}),
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents: 292
diff changeset
   275
#    (r'^org/profile/(?P<program>[_0-9a-z]+)/(?P<link_name>[_0-9a-z]+)/$',
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   276
#     'soc.views.person.profile.edit'),
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   277
192
f6bf679dab26 Simple MenuItem and Menu classes for keeping track of ordered menus.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   278
    
282
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   279
ROOT_PAGES = [
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   280
  # /, first level of the sidebar menu, excluded from breadcrumbs
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   281
  home,
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   282
  
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   283
  # alternate view of /, no menu presence
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   284
  site_home,
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   285
]
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   286
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   287
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   288
def getDjangoUrlPatterns(pages=ROOT_PAGES):
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   289
  """Returns Django urlpatterns derived from the site map Pages.
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   290
  
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   291
  Args:
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   292
    pages: a list of page.Page objects from which to generate urlpatterns
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   293
      (from them and from their child Pages); default is ROOT_PAGES
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   294
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   295
  Raises:
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   296
    KeyError if more than one Page has the same urlpattern.
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   297
    
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   298
    TODO(tlarsen): this probably does not work correctly, currently, since
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   299
    page.Page.makeDjangoUrls() returns a list, and this routine is
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   300
    combining lists from potentially multiple page hierarchies.  Each list
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   301
    might have a urlpattern that the other contains, but this won't be
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   302
    detected by the current code (will Django catch this?).  This really
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   303
    needs to be detected earlier via a global Page dictionary.
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   304
  """
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   305
  urlpatterns = ['']
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   306
  
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   307
  for page in pages:
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   308
    urlpatterns.extend(page.makeDjangoUrls())
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   309
600e0a9bfa06 A site layout ("site map") of the web application, including URL regular
Todd Larsen <tlarsen@google.com>
parents: 196
diff changeset
   310
  return defaults.patterns(*urlpatterns)