app/soc/modules/ghop/callback.py
author Madhusudan C.S <madhusudancs@gmail.com>
Sat, 22 Aug 2009 03:56:14 +0530
changeset 2783 339696f3f5cf
parent 2397 d943fa182fae
child 2784 801eee4eda9a
permissions -rw-r--r--
Extended program configuration create/edit views specifically to support GHOP. Added the first views for GHOP, which are inherited from soc program views. Added new param keys, module_package. url_name key now specifies this is view is from a Melange GHOP module. Also added the view to GHOP module's callback.py. The program Logic class's timeline_logic variable is tied to corresponding timeline logic within the constructor.
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
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    24
from soc.modules.ghop.views.models import program
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    25
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    26
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    27
class Callback(object):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
  """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
    29
  """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    30
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    31
  API_VERSION = 1
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
  def __init__(self, core):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    34
    """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
    35
    """
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
    self.core = core
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
  def registerWithSitemap(self):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    40
    """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
    41
    """
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
    self.core.requireUniqueService('registerWithSitemap')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    44
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    45
    self.core.registerSitemapEntry(program.view.getDjangoURLPatterns())
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    46
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    47
  def registerWithSidebar(self):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    48
    """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
    49
    """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    50
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    51
    # 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
    52
    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
    53
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    54
    self.core.registerSidebarEntry(program.view.getSidebarMenus)
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    55