18 __authors__ = [ |
18 __authors__ = [ |
19 '"Madhusudan C.S." <madhusudancs@gmail.com>', |
19 '"Madhusudan C.S." <madhusudancs@gmail.com>', |
20 '"Lennard de Rijk" <ljvderijk@gmail.com>', |
20 '"Lennard de Rijk" <ljvderijk@gmail.com>', |
21 ] |
21 ] |
22 |
22 |
|
23 from soc.modules.ghop.tasks import task_update |
|
24 from soc.modules.ghop.views.models import mentor |
|
25 from soc.modules.ghop.views.models import organization |
|
26 from soc.modules.ghop.views.models import org_admin |
|
27 from soc.modules.ghop.views.models import program |
|
28 from soc.modules.ghop.views.models import task |
|
29 from soc.modules.ghop.views.models import task_subscription |
|
30 from soc.modules.ghop.views.models import timeline |
|
31 |
23 |
32 |
24 class Callback(object): |
33 class Callback(object): |
25 """Callback object that handles interaction between the core. |
34 """Callback object that handles interaction between the core. |
26 """ |
35 """ |
27 |
36 |
28 API_VERSION = 1 |
37 API_VERSION = 1 |
|
38 |
|
39 # TODO: set this to True if you want to enable the GHOP module |
|
40 ENABLE_MODULE = False |
29 |
41 |
30 def __init__(self, core): |
42 def __init__(self, core): |
31 """Initializes a new Callback object for the specified core. |
43 """Initializes a new Callback object for the specified core. |
32 """ |
44 """ |
33 |
45 |
37 """Called by the server when sitemap entries should be registered. |
49 """Called by the server when sitemap entries should be registered. |
38 """ |
50 """ |
39 |
51 |
40 self.core.requireUniqueService('registerWithSitemap') |
52 self.core.requireUniqueService('registerWithSitemap') |
41 |
53 |
|
54 if not self.ENABLE_MODULE: |
|
55 return |
|
56 |
|
57 # register the GHOP Views |
|
58 self.core.registerSitemapEntry(mentor.view.getDjangoURLPatterns()) |
|
59 self.core.registerSitemapEntry(organization.view.getDjangoURLPatterns()) |
|
60 self.core.registerSitemapEntry(org_admin.view.getDjangoURLPatterns()) |
|
61 self.core.registerSitemapEntry(program.view.getDjangoURLPatterns()) |
|
62 self.core.registerSitemapEntry(task.view.getDjangoURLPatterns()) |
|
63 self.core.registerSitemapEntry(task_subscription.view.getDjangoURLPatterns()) |
|
64 self.core.registerSitemapEntry(timeline.view.getDjangoURLPatterns()) |
|
65 |
|
66 # register GHOP GAE Tasks URL's |
|
67 self.core.registerSitemapEntry(task_update.getDjangoURLPatterns()) |
|
68 |
42 def registerWithSidebar(self): |
69 def registerWithSidebar(self): |
43 """Called by the server when sidebar entries should be registered. |
70 """Called by the server when sidebar entries should be registered. |
44 """ |
71 """ |
45 |
72 |
46 # require that we had the chance to register the urls we need with the sitemap |
73 # require that we had the chance to register the urls we need with the sitemap |
47 self.core.requireUniqueService('registerWithSidebar') |
74 self.core.requireUniqueService('registerWithSidebar') |
|
75 |
|
76 if not self.ENABLE_MODULE: |
|
77 return |
|
78 |
|
79 # register the GHOP menu entries |
|
80 self.core.registerSidebarEntry(mentor.view.getSidebarMenus) |
|
81 self.core.registerSidebarEntry(organization.view.getExtraMenus) |
|
82 self.core.registerSidebarEntry(organization.view.getSidebarMenus) |
|
83 self.core.registerSidebarEntry(org_admin.view.getSidebarMenus) |
|
84 self.core.registerSidebarEntry(program.view.getSidebarMenus) |
|
85 self.core.registerSidebarEntry(task.view.getSidebarMenus) |
|
86 self.core.registerSidebarEntry(task_subscription.view.getSidebarMenus) |
|
87 self.core.registerSidebarEntry(timeline.view.getSidebarMenus) |