app/soc/modules/ghop/views/models/timeline.py
changeset 2890 515ea474e0a2
child 2893 1adc6a815c71
equal deleted inserted replaced
2889:5c0728efdefb 2890:515ea474e0a2
       
     1 #!/usr/bin/python2.5
       
     2 #
       
     3 # Copyright 2009 the Melange authors.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 #
       
     9 #   http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 
       
    17 """GHOP specific views for Timeline.
       
    18 """
       
    19 
       
    20 __authors__ = [
       
    21     '"Madhusudan.C.S" <madhusudancs@gmail.com>',
       
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>',
       
    23   ]
       
    24 
       
    25 
       
    26 from soc.logic import dicts
       
    27 
       
    28 from soc.modules.ghop.logic.models import program as ghop_program_logic
       
    29 from soc.modules.ghop.logic.models import timeline as ghop_timeline_logic
       
    30 from soc.modules.ghop.views.helper import access as ghop_access
       
    31 
       
    32 import soc.modules.ghop.logic.models.timeline
       
    33 
       
    34 
       
    35 class View(timeline.View):
       
    36   """View methods for the GHOP Timeline model.
       
    37   """
       
    38 
       
    39   def __init__(self, params=None):
       
    40     """Defines the fields and methods required for the program View class
       
    41     to provide the user with list, public, create, edit and delete views.
       
    42 
       
    43     Params:
       
    44       params: a dict with params for this View
       
    45     """
       
    46 
       
    47     rights = ghop_access.GHOPChecker(params)
       
    48     rights['edit'] = [('checkCanEditTimeline',
       
    49                        [ghop_program_logic.logic, ghop_timeline_logic.logic])]
       
    50 
       
    51     new_params = {}
       
    52     new_params['logic'] = soc.modules.ghop.logic.models.timeline.logic
       
    53     new_params['rights'] = rights
       
    54 
       
    55     new_params['name'] = "GHOP Timeline"
       
    56     new_params['module_name'] = "timeline"
       
    57 
       
    58     new_params['module_package'] = 'soc.modules.ghop.views.models'
       
    59     new_params['url_name'] = 'ghop/timeline'
       
    60 
       
    61     params = dicts.merge(params, new_params, sub_merge=True)
       
    62 
       
    63     super(View, self).__init__(params=params)
       
    64 
       
    65 
       
    66 view = View()
       
    67 
       
    68 edit = decorators.view(view.edit)
       
    69 public = decorators.view(view.public)