web/views/workflow.py
changeset 8050 0f3a54c37b05
parent 7992 4ff9f25cb06e
child 8190 2a3c1b787688
child 8203 e0efa7583221
equal deleted inserted replaced
8049:a48301a44b50 8050:0f3a54c37b05
   134     title = _('Workflow history')
   134     title = _('Workflow history')
   135 
   135 
   136     def cell_call(self, row, col, view=None, title=title):
   136     def cell_call(self, row, col, view=None, title=title):
   137         _ = self._cw._
   137         _ = self._cw._
   138         eid = self.cw_rset[row][col]
   138         eid = self.cw_rset[row][col]
   139         sel = 'Any FS,TS,WF,D'
   139         sel = 'Any FS,TS,C,D'
   140         rql = ' ORDERBY D DESC WHERE WF wf_info_for X,'\
   140         rql = ' ORDERBY D DESC WHERE WF wf_info_for X,'\
   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,WF'
   145             rql += ', WF owned_by U?'
   145             rql += ', WF owned_by U?'
   146             headers = (_('from_state'), _('to_state'), _('comment'), _('date'),
   146             headers = (_('from_state'), _('to_state'), _('comment'), _('date'),
   147                        _('CWUser'))
   147                        _('CWUser'))
   148         else:
   148         else:
   149             sel += ',C'
   149             sel += ',WF'
   150             headers = (_('from_state'), _('to_state'), _('comment'), _('date'))
   150             headers = (_('from_state'), _('to_state'), _('comment'), _('date'))
   151         rql = '%s %s, X eid %%(x)s' % (sel, rql)
   151         rql = '%s %s, X eid %%(x)s' % (sel, rql)
   152         try:
   152         try:
   153             rset = self._cw.execute(rql, {'x': eid})
   153             rset = self._cw.execute(rql, {'x': eid})
   154         except Unauthorized:
   154         except Unauthorized:
   155             return
   155             return
   156         if rset:
   156         if rset:
   157             if title:
   157             if title:
   158                 self.w(u'<h2>%s</h2>\n' % _(title))
   158                 self.w(u'<h2>%s</h2>\n' % _(title))
   159             self.wview('table', rset, headers=headers)
   159             self.wview('table', rset, headers=headers,
       
   160                        cellvids={2: 'editable-final'})
   160 
   161 
   161 
   162 
   162 class WFHistoryVComponent(component.EntityCtxComponent):
   163 class WFHistoryVComponent(component.EntityCtxComponent):
   163     """display the workflow history for entities supporting it"""
   164     """display the workflow history for entities supporting it"""
   164     __regid__ = 'wfhistory'
   165     __regid__ = 'wfhistory'
   241 
   242 
   242 class WorkflowPrimaryView(TabbedPrimaryView):
   243 class WorkflowPrimaryView(TabbedPrimaryView):
   243     __select__ = is_instance('Workflow')
   244     __select__ = is_instance('Workflow')
   244     tabs = [  _('wf_tab_info'), _('wfgraph'),]
   245     tabs = [  _('wf_tab_info'), _('wfgraph'),]
   245     default_tab = 'wf_tab_info'
   246     default_tab = 'wf_tab_info'
   246 
       
   247 
       
   248 class CellView(EntityView):
       
   249     __regid__ = 'cell'
       
   250     __select__ = is_instance('TrInfo')
       
   251 
       
   252     def cell_call(self, row, col, cellvid=None):
       
   253         self.w(self.cw_rset.get_entity(row, col).view('reledit', rtype='comment'))
       
   254 
   247 
   255 
   248 
   256 class StateInContextView(EntityView):
   249 class StateInContextView(EntityView):
   257     """convenience trick, State's incontext view should not be clickable"""
   250     """convenience trick, State's incontext view should not be clickable"""
   258     __regid__ = 'incontext'
   251     __regid__ = 'incontext'