app/soc/modules/ghop/callback.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Sat, 22 Aug 2009 03:56:25 +0530
changeset 2784 801eee4eda9a
parent 2783 339696f3f5cf
child 2785 bb6064b9fc9d
permissions -rw-r--r--
Added timeline view for GHOP. Moved the method _createTimelineForType from Views to Logic for both core Program and GHOPProgram. Added default values parameter to apps_tasks_limit and slots in Program model. Registered timeline view for the sitemap in GHOP callback.py. Added timeline view module and class which overrides the edit method. Overriding the params['edit_form'] to accommodate dynainclude and dynaexclude fields.
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
2784
801eee4eda9a Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2783
diff changeset
    25
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
    26
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    27
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
class Callback(object):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
  """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
    30
  """
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
  API_VERSION = 1
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
  def __init__(self, core):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    35
    """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
    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
    self.core = core
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 registerWithSitemap(self):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
    """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
    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.requireUniqueService('registerWithSitemap')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    45
2783
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    46
    self.core.registerSitemapEntry(program.view.getDjangoURLPatterns())
2784
801eee4eda9a Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2783
diff changeset
    47
    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
    48
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    49
  def registerWithSidebar(self):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    50
    """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
    51
    """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    52
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    53
    # 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
    54
    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
    55
339696f3f5cf Extended program configuration create/edit views specifically to support GHOP.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2397
diff changeset
    56
    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
    57