web/views/workflow.py
changeset 7992 4ff9f25cb06e
parent 7988 d72a2881d53c
child 8050 0f3a54c37b05
equal deleted inserted replaced
7991:dcc5a4d48122 7992:4ff9f25cb06e
   141               'WF from_state FS, WF to_state TS, WF comment C,'\
   141               'WF from_state FS, WF to_state TS, WF comment C,'\
   142               'WF creation_date D'
   142               'WF creation_date D'
   143         if self._cw.vreg.schema.eschema('CWUser').has_perm(self._cw, 'read'):
   143         if self._cw.vreg.schema.eschema('CWUser').has_perm(self._cw, 'read'):
   144             sel += ',U,C'
   144             sel += ',U,C'
   145             rql += ', WF owned_by U?'
   145             rql += ', WF owned_by U?'
   146             displaycols = range(5)
       
   147             headers = (_('from_state'), _('to_state'), _('comment'), _('date'),
   146             headers = (_('from_state'), _('to_state'), _('comment'), _('date'),
   148                        _('CWUser'))
   147                        _('CWUser'))
   149         else:
   148         else:
   150             sel += ',C'
   149             sel += ',C'
   151             displaycols = range(4)
       
   152             headers = (_('from_state'), _('to_state'), _('comment'), _('date'))
   150             headers = (_('from_state'), _('to_state'), _('comment'), _('date'))
   153         rql = '%s %s, X eid %%(x)s' % (sel, rql)
   151         rql = '%s %s, X eid %%(x)s' % (sel, rql)
   154         try:
   152         try:
   155             rset = self._cw.execute(rql, {'x': eid})
   153             rset = self._cw.execute(rql, {'x': eid})
   156         except Unauthorized:
   154         except Unauthorized:
   157             return
   155             return
   158         if rset:
   156         if rset:
   159             if title:
   157             if title:
   160                 title = _(title)
   158                 self.w(u'<h2>%s</h2>\n' % _(title))
   161             self.wview('table', rset, title=title, displayactions=False,
   159             self.wview('table', rset, headers=headers)
   162                        displaycols=displaycols, headers=headers)
       
   163 
   160 
   164 
   161 
   165 class WFHistoryVComponent(component.EntityCtxComponent):
   162 class WFHistoryVComponent(component.EntityCtxComponent):
   166     """display the workflow history for entities supporting it"""
   163     """display the workflow history for entities supporting it"""
   167     __regid__ = 'wfhistory'
   164     __regid__ = 'wfhistory'
   282         self.w(', '.join(v for v in html))
   279         self.w(', '.join(v for v in html))
   283         self.w(u'<h2>%s</h2>' % _("Transition_plural"))
   280         self.w(u'<h2>%s</h2>' % _("Transition_plural"))
   284         rset = self._cw.execute(
   281         rset = self._cw.execute(
   285             'Any T,T,DS,T,TT ORDERBY TN WHERE T transition_of WF, WF eid %(x)s,'
   282             'Any T,T,DS,T,TT ORDERBY TN WHERE T transition_of WF, WF eid %(x)s,'
   286             'T type TT, T name TN, T destination_state DS?', {'x': entity.eid})
   283             'T type TT, T name TN, T destination_state DS?', {'x': entity.eid})
   287         self.wview('editable-table', rset, 'null',
   284         self.wview('table', rset, 'null',
   288                    cellvids={ 1: 'trfromstates', 2: 'outofcontext', 3:'trsecurity',},
   285                    cellvids={ 1: 'trfromstates', 2: 'outofcontext', 3:'trsecurity',},
   289                    headers = (_('Transition'),  _('from_state'),
   286                    headers = (_('Transition'),  _('from_state'),
   290                               _('to_state'), _('permissions'), _('type') ),
   287                               _('to_state'), _('permissions'), _('type') ),
   291                    )
   288                    )
   292 
   289