author | Mario Ferraro <fadinlight@gmail.com> |
Sun, 15 Nov 2009 22:12:20 +0100 | |
changeset 3093 | d1be59b6b627 |
parent 2957 | f6515daaf000 |
permissions | -rw-r--r-- |
2397
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
# Copyright 2009 the Melange authors. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
# |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
# you may not use this file except in compliance with the License. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
# You may obtain a copy of the License at |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
# |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
# |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
# Unless required by applicable law or agreed to in writing, software |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
# See the License for the specific language governing permissions and |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
# limitations under the License. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
"""Module containing the GHOP Callback. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
""" |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
__authors__ = [ |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
'"Madhusudan C.S." <madhusudancs@gmail.com>', |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
] |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
|
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
23 |
from soc.modules.ghop.tasks import task_update |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
24 |
from soc.modules.ghop.views.models import mentor |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
25 |
from soc.modules.ghop.views.models import organization |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
26 |
from soc.modules.ghop.views.models import org_admin |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
27 |
from soc.modules.ghop.views.models import program |
2923
2d0b36ef4330
Enabled the GHOPStudent view in the GHOP module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2896
diff
changeset
|
28 |
from soc.modules.ghop.views.models import student |
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
29 |
from soc.modules.ghop.views.models import task |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
30 |
from soc.modules.ghop.views.models import task_subscription |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
31 |
from soc.modules.ghop.views.models import timeline |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
32 |
|
2397
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
class Callback(object): |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
"""Callback object that handles interaction between the core. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
""" |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
API_VERSION = 1 |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
def __init__(self, core): |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
"""Initializes a new Callback object for the specified core. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
""" |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
self.core = core |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
def registerWithSitemap(self): |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
"""Called by the server when sitemap entries should be registered. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
""" |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
self.core.requireUniqueService('registerWithSitemap') |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
|
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
52 |
# register the GHOP Views |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
53 |
self.core.registerSitemapEntry(mentor.view.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
54 |
self.core.registerSitemapEntry(organization.view.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
55 |
self.core.registerSitemapEntry(org_admin.view.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
56 |
self.core.registerSitemapEntry(program.view.getDjangoURLPatterns()) |
2923
2d0b36ef4330
Enabled the GHOPStudent view in the GHOP module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2896
diff
changeset
|
57 |
self.core.registerSitemapEntry(student.view.getDjangoURLPatterns()) |
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
58 |
self.core.registerSitemapEntry(task.view.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
59 |
self.core.registerSitemapEntry(task_subscription.view.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
60 |
self.core.registerSitemapEntry(timeline.view.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
61 |
|
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
62 |
# register GHOP GAE Tasks URL's |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
63 |
self.core.registerSitemapEntry(task_update.getDjangoURLPatterns()) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
64 |
|
2397
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
def registerWithSidebar(self): |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
"""Called by the server when sidebar entries should be registered. |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
67 |
""" |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
68 |
|
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
69 |
# require that we had the chance to register the urls we need with the sitemap |
d943fa182fae
Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff
changeset
|
70 |
self.core.requireUniqueService('registerWithSidebar') |
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
71 |
|
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
72 |
# register the GHOP menu entries |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
73 |
self.core.registerSidebarEntry(mentor.view.getSidebarMenus) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
74 |
self.core.registerSidebarEntry(organization.view.getExtraMenus) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
75 |
self.core.registerSidebarEntry(organization.view.getSidebarMenus) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
76 |
self.core.registerSidebarEntry(org_admin.view.getSidebarMenus) |
2935
0b8b82b6764e
Removed slots and apps_tasks_limit from extra_dynaexclude in params and added a getExtraMenus entry to callback for program.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2923
diff
changeset
|
77 |
self.core.registerSidebarEntry(program.view.getExtraMenus) |
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
78 |
self.core.registerSidebarEntry(program.view.getSidebarMenus) |
2923
2d0b36ef4330
Enabled the GHOPStudent view in the GHOP module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2896
diff
changeset
|
79 |
self.core.registerSidebarEntry(student.view.getSidebarMenus) |
2895
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
80 |
self.core.registerSidebarEntry(task.view.getSidebarMenus) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
81 |
self.core.registerSidebarEntry(task_subscription.view.getSidebarMenus) |
cad75f6ba411
Added the GHOP modules to the callback.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
2787
diff
changeset
|
82 |
self.core.registerSidebarEntry(timeline.view.getSidebarMenus) |
2935
0b8b82b6764e
Removed slots and apps_tasks_limit from extra_dynaexclude in params and added a getExtraMenus entry to callback for program.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2923
diff
changeset
|
83 |
|
2957
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
84 |
def registerRights(self): |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
85 |
"""Called by the server when the documetn rights should be registerd. |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
86 |
""" |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
87 |
|
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
88 |
ghop_program_membership = { |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
89 |
'admin': ['host'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
90 |
'restricted': ['host', 'ghop_org_admin'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
91 |
'member': ['host', 'ghop_org_admin', 'ghop_org_mentor', |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
92 |
'ghop_org_student'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
93 |
'list': ['host', 'ghop_org_admin', 'ghop_org_mentor'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
94 |
} |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
95 |
|
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
96 |
ghop_organization_membership = { |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
97 |
'admin': ['host', 'ghop_org_admin'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
98 |
'restricted': ['host', 'ghop_org_admin', 'ghop_org_mentor'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
99 |
'member': ['host', 'ghop_org_admin', 'ghop_org_mentor', |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
100 |
'ghop_org_student'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
101 |
'list': ['host', 'ghop_org_admin', 'ghop_org_mentor'], |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
102 |
} |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
103 |
|
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
104 |
self.core.registerRight('ghop_program', ghop_program_membership) |
f6515daaf000
Enable document system for GHOP
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
2935
diff
changeset
|
105 |
self.core.registerRight('ghop_org', ghop_organization_membership) |