author | Madhusudan.C.S <madhusudancs@gmail.com> |
Sat, 22 Aug 2009 04:00:56 +0530 | |
changeset 2785 | bb6064b9fc9d |
parent 2784 | 801eee4eda9a |
permissions | -rw-r--r-- |
2784
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
# |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2009 the Melange authors. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
# |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
# |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
# |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
"""GHOP specific views for Timeline. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
""" |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
'"Madhusudan.C.S" <madhusudancs@gmail.com>' |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
] |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
from soc.logic import dicts |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
from soc.views.helper import decorators |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
27 |
from soc.views.helper import dynaform |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
from soc.views.helper import params as params_helper |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
from soc.views.models import timeline |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
30 |
from soc.views.sitemap import sidebar |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
import soc.cache.logic |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
from soc.modules.ghop.logic.models import program as ghop_program_logic |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
import soc.modules.ghop.logic.models.timeline |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
class View(timeline.View): |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
"""View methods for the GHOP Timeline model. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
""" |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
def __init__(self, params=None): |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
"""Defines the fields and methods required for the program View class |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
to provide the user with list, public, create, edit and delete views. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
Params: |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
params: a dict with params for this View |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
""" |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
new_params = {} |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
new_params['logic'] = soc.modules.ghop.logic.models.timeline.logic |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
53 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
54 |
new_params['name'] = "GHOP Timeline" |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
new_params['module_name'] = "timeline" |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
56 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
new_params['module_package'] = 'soc.modules.ghop.views.models' |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
new_params['url_name'] = 'ghop/timeline' |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
59 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
60 |
params = dicts.merge(params, new_params, sub_merge=True) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
61 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
62 |
super(View, self).__init__(params=params) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
63 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
def edit(self, request, access_type, |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
page_name=None, params=None, seed=None, **kwargs): |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
"""See base.View.edit. |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
67 |
""" |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
68 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
69 |
params = dicts.merge(params, self._params) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
70 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
71 |
key_fields = ghop_program_logic.logic.getKeyFieldsFromFields(kwargs) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
72 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
73 |
program = ghop_program_logic.logic.getFromKeyFields(key_fields) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
74 |
if program: |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
75 |
params['logic'] = ghop_program_logic.logic.timeline_logic |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
76 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
77 |
timeline_model = ghop_program_logic.logic.timeline_logic |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
78 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
79 |
return super(View, self).edit(request, access_type, page_name=page_name, |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
80 |
params=params, seed=seed, **kwargs) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
81 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
82 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
83 |
view = View() |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
84 |
|
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
85 |
admin = decorators.view(view.admin) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
86 |
create = decorators.view(view.create) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
87 |
delete = decorators.view(view.delete) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
88 |
edit = decorators.view(view.edit) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
89 |
list = decorators.view(view.list) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
90 |
public = decorators.view(view.public) |
801eee4eda9a
Added timeline view for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
91 |
export = decorators.view(view.export) |