Mercurial > hg > MPIWGWeb
annotate MPIWGFeature.py @ 27:9a75eb1b31b3
more work on projects.
author | casties |
---|---|
date | Mon, 22 Apr 2013 21:01:00 +0200 |
parents | faa7c9e936a8 |
children | faaded775a8a |
rev | line source |
---|---|
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
1 from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
9 | 2 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
16 | 3 from OFS.Folder import Folder |
4 from AccessControl import ClassSecurityInfo | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
5 from Globals import package_home |
16 | 6 |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
7 import string |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
8 import re |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
9 import os |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
10 import logging |
16 | 11 import datetime |
12 | |
13 from SrvTxtUtils import getMonthName | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
14 from MPIWGHelper import * |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
15 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
16 class MPIWGFeature(Folder): |
16 | 17 """special object for feature texts on the MPIWG website. |
18 Has templates for English and German in Folders /en/ and /de/. | |
19 Feature teaser is /(en|de)/teaser.pt. Full page is /(en|de)/main.pt. | |
20 Full title is the title of /(en|de)/main.pt. | |
21 """ | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
22 |
20 | 23 meta_type = "MPIWGFeature" |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
24 |
20 | 25 manage_options = Folder.manage_options + ( |
26 {'label':'Change Weight', 'action':'changeWeightForm'}, | |
27 {'label':'Configure', 'action':'changeForm'}, | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
28 ) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
29 |
16 | 30 changeWeightForm = PageTemplateFile('zpt/feature/manage_change_weight', globals()) |
31 changeForm = PageTemplateFile('zpt/feature/manage_config', globals()) | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
32 |
20 | 33 def __init__(self, id, title=None, weight=0, date=None, title_en=None, title_de=None, author=None, author_id=None): |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
34 self.id = str(id) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
35 self.weight = weight |
20 | 36 self.author = author |
37 self.author_id = author_id | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
38 if title is None: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
39 self.title = id |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
40 else: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
41 self.title = title |
16 | 42 |
43 if date is None: | |
44 self.date = datetime.date.today() | |
45 else: | |
46 self.date = date | |
47 | |
48 # | |
21 | 49 # add language folder and sample templates |
16 | 50 # |
51 mainid = 'main.pt' | |
52 teaserid = 'teaser.pt' | |
53 # english | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
54 self.manage_addFolder('en') |
16 | 55 folder_en = getattr(self, 'en') |
56 folder_en[teaserid] = ZopePageTemplate(teaserid) | |
20 | 57 teaser_en = getattr(folder_en, teaserid) |
58 teaser_en.pt_edit(open(os.path.join(package_home(globals()), 'zpt/feature/default_template_teaser.zpt')).read(), 'text/html') | |
16 | 59 folder_en[mainid] = ZopePageTemplate(mainid) |
20 | 60 main_en = getattr(folder_en, mainid) |
61 main_en.pt_edit(open(os.path.join(package_home(globals()), 'zpt/feature/default_template_main.zpt')).read(), 'text/html') | |
16 | 62 if title_en is not None: |
63 main_en.title = title_en | |
64 # german | |
65 self.manage_addFolder('de') | |
66 folder_de = getattr(self, 'de') | |
67 folder_de[teaserid] = ZopePageTemplate(teaserid) | |
20 | 68 teaser_de = getattr(folder_de, teaserid) |
69 teaser_de.pt_edit(open(os.path.join(package_home(globals()), 'zpt/feature/default_template_teaser.zpt')).read(), 'text/html') | |
16 | 70 folder_de[mainid] = ZopePageTemplate(mainid) |
20 | 71 main_de = getattr(folder_de, mainid) |
72 main_de.pt_edit(open(os.path.join(package_home(globals()), 'zpt/feature/default_template_main.zpt')).read(), 'text/html') | |
16 | 73 if title_de is not None: |
74 main_de.title = title_de | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
75 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
76 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
77 def index_html(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
78 """default index page""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
79 return self.getMain() |
20 | 80 |
81 def getAuthor(self): | |
82 """returns the author name""" | |
83 return getattr(self, 'author', None) | |
84 | |
85 def getAuthorId(self): | |
86 """returns the author ID""" | |
87 return getattr(self, 'author_id', None) | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
88 |
16 | 89 def getFullTitle(self, lang=None): |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
90 """returns the full title (from main.pt)""" |
16 | 91 if lang is None: |
92 # get Language from MPIWGRoot | |
93 lang = self.getLang() | |
94 | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
95 dir = getattr(self, lang, self.en) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
96 pt = getattr(dir, 'main.pt') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
97 t = pt.title |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
98 if not t: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
99 t = self.title |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
100 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
101 return t |
5 | 102 |
16 | 103 def getDate(self): |
104 """returns the date as a date object""" | |
105 return getattr(self, 'date', None) | |
106 | |
107 def getDateString(self, lang=None): | |
108 """returns the date as a string""" | |
109 d = self.getDate() | |
110 if d is None: | |
111 return '???' | |
112 | |
113 if lang is None: | |
114 # get Language from MPIWGRoot | |
115 lang = self.getLang() | |
116 | |
117 if lang == 'iso': | |
118 return d.isoformat() | |
119 elif lang == 'en': | |
20 | 120 return "%s %s, %s" % (getMonthName(d.month, 'en'), d.day, d.year) |
16 | 121 elif lang == 'de': |
20 | 122 return "%s. %s %s" % (d.day, getMonthName(d.month, 'de'), d.year) |
16 | 123 |
124 return None | |
125 | |
5 | 126 def getUrl(self, baseUrl=None): |
127 """returns URL to this feature""" | |
128 if baseUrl is None: | |
129 return self.absolute_url() | |
130 | |
20 | 131 return '%s/%s' % (baseUrl, self.getId()) |
5 | 132 |
133 def getPath(self, page, relative=True): | |
134 """returns path to template page""" | |
135 # get Language from MPIWGRoot | |
136 lang = self.getLang() | |
137 dir = getattr(self, lang, self.en) | |
138 if relative: | |
20 | 139 return '%s/%s/%s' % (self.getId(), dir.getId(), page) |
5 | 140 |
18
3913a1c5c583
feature's getPath returns None if it can't find the template.
casties
parents:
17
diff
changeset
|
141 pt = getattr(dir, page, None) |
3913a1c5c583
feature's getPath returns None if it can't find the template.
casties
parents:
17
diff
changeset
|
142 if pt is not None: |
3913a1c5c583
feature's getPath returns None if it can't find the template.
casties
parents:
17
diff
changeset
|
143 return pt.absolute_url_path() |
3913a1c5c583
feature's getPath returns None if it can't find the template.
casties
parents:
17
diff
changeset
|
144 |
3913a1c5c583
feature's getPath returns None if it can't find the template.
casties
parents:
17
diff
changeset
|
145 return None |
5 | 146 |
147 def getTeaserPath(self): | |
148 """returns the path to the teaser template""" | |
149 return self.getPath('teaser.pt') | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
150 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
151 def getIntro(self, **args): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
152 """returns the intro as PageTemplate""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
153 # get Language from MPIWGRoot |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
154 lang = self.getLang() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
155 dir = getattr(self, lang, self.en) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
156 pt = getattr(dir, 'intro.pt') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
157 return pt(**args) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
158 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
159 def getMain(self, **args): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
160 """returns the main part as PageTemplate""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
161 # get Language from MPIWGRoot |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
162 lang = self.getLang() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
163 dir = getattr(self, lang, self.en) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
164 pt = getattr(dir, 'main.pt') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
165 return pt(**args) |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
166 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
167 def getFrontpageImg(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
168 """returns the image object for the frontpage""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
169 img = getattr(self, 'img-frontpage.jpg') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
170 return img |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
171 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
172 def getFrontpageImgUrl(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
173 """returns the URL of the image object for the frontpage""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
174 img = getattr(self, 'img-frontpage.jpg') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
175 return img.absolute_url() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
176 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
177 def getFrontpageThumb(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
178 """returns the image object for the frontpage thumbnail""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
179 img = getattr(self, 'img-frontthumb.jpg') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
180 return img |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
181 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
182 def getFrontpageThumbUrl(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
183 """returns the URL of the image object for the frontpage thumbnail""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
184 img = getattr(self, 'img-frontthumb.jpg') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
185 return img.absolute_url() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
186 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
187 def getThumbImg(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
188 """returns the image object for the sidebar thumbnail""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
189 img = getattr(self, 'img-thumb.jpg') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
190 return img |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
191 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
192 def getThumbImgUrl(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
193 """returns the URL of the image object for the sidebar thumbnail""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
194 img = getattr(self, 'img-thumb.jpg') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
195 return img.absolute_url() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
196 |
20 | 197 def changeWeight(self, weight, RESPONSE=None): |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
198 """change weight""" |
20 | 199 self.weight = weight |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
200 if RESPONSE is not None: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
201 RESPONSE.redirect('manage_main') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
202 |
20 | 203 def changeMPIWGFeature(self, title=None, weight=None, date=None, title_en=None, title_de=None, |
204 author=None, author_id=None, RESPONSE=None): | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
205 """change everything""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
206 if title is not None: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
207 self.title = title |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
208 if weight is not None: |
16 | 209 self.weight = weight |
20 | 210 if author is not None: |
211 self.author = author | |
212 if author_id is not None: | |
213 self.author_id = author_id | |
16 | 214 if date is not None: |
215 try: | |
216 self.date = datetime.datetime.strptime(date, '%Y-%m-%d').date() | |
217 except: | |
218 pass | |
219 | |
220 folder_en = self.get('en', None) | |
221 if folder_en is not None: | |
222 main_en = folder_en.get('main.pt', None) | |
223 if main_en is not None and title_en is not None: | |
224 main_en.title = title_en | |
225 | |
226 folder_de = self.get('de', None) | |
227 if folder_de is not None: | |
228 main_de = folder_de.get('main.pt', None) | |
229 if main_de is not None and title_de is not None: | |
230 main_de.title = title_de | |
231 | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
232 if RESPONSE is not None: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
233 RESPONSE.redirect('manage_main') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
234 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
235 def getBreadcrumbs(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
236 """return list of breadcrumbs from here to the root""" |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
237 crumbs = [(self.getFullTitle(), self.absolute_url(), self)] |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
238 parent = self.aq_parent |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
239 if hasattr(parent, 'getBreadcrumbs'): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
240 if self.title: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
241 return parent.getBreadcrumbs() + crumbs |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
242 else: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
243 # if there's no title, skip this level |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
244 return parent.getBreadcrumbs() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
245 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
246 return crumbs |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
247 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
248 getSection = getSection |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
249 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
250 getSubSection = getSubSection |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
251 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
252 |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
253 def manage_addMPIWGFeatureForm(self): |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
254 """Form for adding""" |
20 | 255 pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt/feature/manage_add_MPIWGFeature.zpt')).__of__(self) |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
256 return pt() |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
257 |
20 | 258 def manage_addMPIWGFeature(self, id, title=None, weight=0, title_en=None, title_de=None, author=None, author_id=None, RESPONSE=None): |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
259 "Add a MPIWG Feature object" |
20 | 260 newObj = MPIWGFeature(id, title=title, weight=weight, title_en=title_en, title_de=title_de, author=author, author_id=author_id) |
261 self.Destination()._setObject(id, newObj) | |
0
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
262 if RESPONSE is not None: |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
263 RESPONSE.redirect('manage_main') |
bca61e893fcc
first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff
changeset
|
264 |