app/soc/modules/ghop/callback.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Sat, 22 Aug 2009 04:00:56 +0530
changeset 2785 bb6064b9fc9d
parent 2784 801eee4eda9a
child 2787 8408741aee63
permissions -rw-r--r--
Added Organization View for GHOP. Along with adding the View, the View is also registered with sitemap in the GHOP module's callback.py
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    23
2785
bb6064b9fc9d Added Organization View for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2784
diff changeset
    24
from soc.modules.ghop.views.models import organization
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    25
from soc.modules.ghop.views.models import program
2784
801eee4eda9a Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2783
diff changeset
    26
from soc.modules.ghop.views.models import timeline
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    27
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    28
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
class Callback(object):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    30
  """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
    31
  """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    32
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    33
  API_VERSION = 1
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    34
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    35
  def __init__(self, core):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    36
    """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
    37
    """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    38
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    39
    self.core = core
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    40
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
  def registerWithSitemap(self):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    42
    """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
    43
    """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    44
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    45
    self.core.requireUniqueService('registerWithSitemap')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    46
2785
bb6064b9fc9d Added Organization View for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2784
diff changeset
    47
    self.core.registerSitemapEntry(organization.view.getDjangoURLPatterns())
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    48
    self.core.registerSitemapEntry(program.view.getDjangoURLPatterns())
2784
801eee4eda9a Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2783
diff changeset
    49
    self.core.registerSitemapEntry(timeline.view.getDjangoURLPatterns())
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    50
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    51
  def registerWithSidebar(self):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    52
    """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
    53
    """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    54
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    55
    # 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
    56
    self.core.requireUniqueService('registerWithSidebar')
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    57
2785
bb6064b9fc9d Added Organization View for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2784
diff changeset
    58
    self.core.registerSidebarEntry(organization.view.getExtraMenus)
bb6064b9fc9d Added Organization View for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2784
diff changeset
    59
    self.core.registerSidebarEntry(organization.view.getSidebarMenus)
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    60
    self.core.registerSidebarEntry(program.view.getSidebarMenus)