1068 |
1068 |
|
1069 |
1069 |
return r.getvalue()
|
1070 |
1070 |
|
1071 |
|
def pending(self):
|
1072 |
|
self.check_access()
|
1073 |
|
get_logger().info('backoffice - form %s - pending' % self.formdef.name)
|
1074 |
|
get_response().breadcrumb.append( ('pending', _('Pending Forms')) )
|
1075 |
|
html_top('management', '%s - %s' % (_('Pending Forms'), self.formdef.name))
|
1076 |
|
r = TemplateIO(html=True)
|
1077 |
|
r += htmltext('<h2>%s - %s</h2>') % (self.formdef.name, _('Pending Forms'))
|
1078 |
|
|
1079 |
|
not_endpoint_status = [('wf-%s' % x.id, x.name) for x in \
|
1080 |
|
self.formdef.workflow.get_not_endpoint_status()]
|
1081 |
|
|
1082 |
|
nb_status = len(not_endpoint_status)
|
1083 |
|
column2 = nb_status/2
|
1084 |
|
r += htmltext('<div class="splitcontent-left">')
|
1085 |
|
for i, (status_id, status_label) in enumerate(not_endpoint_status):
|
1086 |
|
if i > 0 and i == column2:
|
1087 |
|
r += htmltext('</div>')
|
1088 |
|
r += htmltext('<div class="splitcontent-right">')
|
1089 |
|
status_forms = self.formdef.data_class().get_with_indexed_value(
|
1090 |
|
str('status'), status_id)
|
1091 |
|
if not status_forms:
|
1092 |
|
continue
|
1093 |
|
status_forms.sort(lambda x, y: cmp(getattr(x, str('receipt_time')),
|
1094 |
|
getattr(y, str('receipt_time'))))
|
1095 |
|
status_forms.reverse()
|
1096 |
|
r += htmltext('<div class="bo-block">')
|
1097 |
|
r += htmltext('<h3>%s</h3>') % _('Forms with status "%s"') % status_label
|
1098 |
|
|
1099 |
|
r += htmltext('<ul>')
|
1100 |
|
for f in status_forms:
|
1101 |
|
try:
|
1102 |
|
u = get_publisher().user_class.get(f.user_id)
|
1103 |
|
userlabel = u.display_name
|
1104 |
|
except KeyError:
|
1105 |
|
userlabel = _('unknown user')
|
1106 |
|
r += htmltext('<li><a href="%s/">%s, %s</a></li>') % (
|
1107 |
|
f.id,
|
1108 |
|
misc.localstrftime(f.receipt_time),
|
1109 |
|
userlabel)
|
1110 |
|
r += htmltext('</ul>')
|
1111 |
|
r += htmltext('</div>')
|
1112 |
|
r += htmltext('</div>')
|
1113 |
|
|
1114 |
|
r += htmltext('<p class="clear"><a href=".">%s</a></p>') % _('Back')
|
1115 |
|
return r.getvalue()
|
1116 |
|
|
1117 |
1071 |
def csv_tuple_heading(self, fields):
|
1118 |
1072 |
heading_fields = [] # '#id', _('time'), _('userlabel'), _('status')]
|
1119 |
1073 |
for field in fields:
|
1120 |
|
-
|