app/soc/modules/ghop/callback.py
changeset 2896 5a3c5a2f567f
parent 2895 cad75f6ba411
child 2923 2d0b36ef4330
equal deleted inserted replaced
2895:cad75f6ba411 2896:5a3c5a2f567f
    34   """Callback object that handles interaction between the core.
    34   """Callback object that handles interaction between the core.
    35   """
    35   """
    36 
    36 
    37   API_VERSION = 1
    37   API_VERSION = 1
    38 
    38 
    39   # TODO: set this to True if you want to enable the GHOP module
       
    40   ENABLE_MODULE = False
       
    41 
       
    42   def __init__(self, core):
    39   def __init__(self, core):
    43     """Initializes a new Callback object for the specified core.
    40     """Initializes a new Callback object for the specified core.
    44     """
    41     """
    45 
    42 
    46     self.core = core
    43     self.core = core
    48   def registerWithSitemap(self):
    45   def registerWithSitemap(self):
    49     """Called by the server when sitemap entries should be registered.
    46     """Called by the server when sitemap entries should be registered.
    50     """
    47     """
    51 
    48 
    52     self.core.requireUniqueService('registerWithSitemap')
    49     self.core.requireUniqueService('registerWithSitemap')
    53 
       
    54     if not self.ENABLE_MODULE:
       
    55       return
       
    56 
    50 
    57     # register the GHOP Views
    51     # register the GHOP Views
    58     self.core.registerSitemapEntry(mentor.view.getDjangoURLPatterns())
    52     self.core.registerSitemapEntry(mentor.view.getDjangoURLPatterns())
    59     self.core.registerSitemapEntry(organization.view.getDjangoURLPatterns())
    53     self.core.registerSitemapEntry(organization.view.getDjangoURLPatterns())
    60     self.core.registerSitemapEntry(org_admin.view.getDjangoURLPatterns())
    54     self.core.registerSitemapEntry(org_admin.view.getDjangoURLPatterns())
    71     """
    65     """
    72 
    66 
    73     # require that we had the chance to register the urls we need with the sitemap
    67     # require that we had the chance to register the urls we need with the sitemap
    74     self.core.requireUniqueService('registerWithSidebar')
    68     self.core.requireUniqueService('registerWithSidebar')
    75 
    69 
    76     if not self.ENABLE_MODULE:
       
    77       return
       
    78 
       
    79     # register the GHOP menu entries
    70     # register the GHOP menu entries
    80     self.core.registerSidebarEntry(mentor.view.getSidebarMenus)
    71     self.core.registerSidebarEntry(mentor.view.getSidebarMenus)
    81     self.core.registerSidebarEntry(organization.view.getExtraMenus)
    72     self.core.registerSidebarEntry(organization.view.getExtraMenus)
    82     self.core.registerSidebarEntry(organization.view.getSidebarMenus)
    73     self.core.registerSidebarEntry(organization.view.getSidebarMenus)
    83     self.core.registerSidebarEntry(org_admin.view.getSidebarMenus)
    74     self.core.registerSidebarEntry(org_admin.view.getSidebarMenus)