0002-formdata-move-formdata-journal-methods-from-view-to-.patch
wcs/formdata.py | ||
---|---|---|
143 | 143 |
return self._formdata |
144 | 144 | |
145 | 145 |
def get_author_name(self): |
146 |
user_id = self.who |
|
146 | 147 |
if self.who == '_submitter': |
148 |
user_id = self.formdata.user_id |
|
149 |
try: |
|
150 |
return get_publisher().user_class.get(user_id).display_name |
|
151 |
except KeyError: |
|
152 |
return None |
|
153 | ||
154 |
def get_author_qualification(self): |
|
155 |
if self.who == '_submitter' and not self.formdata.is_submitter(get_request().user): |
|
147 | 156 |
return _('Original Submitter') |
148 |
else: |
|
149 |
return get_publisher().user_class.get(self.who).display_name |
|
157 |
return None |
|
150 | 158 | |
151 | 159 |
def add_part(self, part): |
152 | 160 |
if not self.parts: |
... | ... | |
196 | 204 |
del odict['_formdata'] |
197 | 205 |
return odict |
198 | 206 | |
207 |
def is_hidden(self): |
|
208 |
if self.status: |
|
209 |
wf_status = self.formdata.get_status(self.status) |
|
210 |
if wf_status and not wf_status.is_visible(self.formdata, get_request().user): |
|
211 |
return True |
|
212 |
return False |
|
213 | ||
199 | 214 | |
200 | 215 |
class FormData(StorableObject): |
201 | 216 |
_names = 'XX' |
wcs/forms/common.py | ||
---|---|---|
258 | 258 |
hidden = False |
259 | 259 |
previous_status = None |
260 | 260 |
for evo in self.filled.evolution: |
261 |
if evo.is_hidden(): |
|
262 |
continue |
|
261 | 263 |
status_css_class = '' |
262 | 264 |
if evo.status: |
263 | 265 |
wf_status = self.filled.get_status(evo.status) |
264 | 266 |
if wf_status: |
265 | 267 |
status_css_class = wf_status.extra_css_class |
266 |
if wf_status and not wf_status.is_visible(self.filled, get_request().user): |
|
267 |
hidden = True |
|
268 |
else: |
|
269 |
hidden = False |
|
270 |
if hidden: |
|
271 |
continue |
|
272 | 268 | |
273 | 269 |
evo_author = None |
274 | 270 |
evo_author_more = None |
... | ... | |
276 | 272 |
if evo.who: |
277 | 273 |
if evo.who == '_submitter': |
278 | 274 |
klass = 'msg-in' |
279 |
evo_author = _('Original Submitter') |
|
280 |
if get_request().user and self.filled.is_submitter(get_request().user): |
|
281 |
evo_author = get_request().user.display_name |
|
282 |
elif self.filled.user_id: |
|
283 |
try: |
|
284 |
evo_author = get_publisher().user_class.get(self.filled.user_id).display_name |
|
285 |
evo_author_more = _('(Original Submitter)') |
|
286 |
except KeyError: |
|
287 |
pass |
|
275 |
evo_author = evo.get_author_name() |
|
276 |
evo_author_more = evo.get_author_qualification() |
|
288 | 277 |
else: |
289 | 278 |
klass = 'msg-out' |
290 |
try: |
|
291 |
evo_author = evo.get_author_name() |
|
292 |
except KeyError: |
|
293 |
pass |
|
279 |
evo_author = evo.get_author_name() |
|
294 | 280 | |
295 | 281 |
status_block = TemplateIO(html=True) |
296 | 282 |
if evo.status: |
... | ... | |
305 | 291 |
if evo_author: |
306 | 292 |
parts += htmltext('<span class="user">%s') % evo_author |
307 | 293 |
if evo_author_more: |
308 |
parts += htmltext(' <span>%s</span>') % evo_author_more
|
|
294 |
parts += htmltext(' <span>(%s)</span>') % evo_author_more
|
|
309 | 295 |
parts += htmltext('</span>') |
310 | 296 |
if not evo.status: |
311 | 297 |
parts += htmltext('<span class="time">%s</span> ') % misc.localstrftime(evo.time) |
312 |
- |