src/pyams_content/shared/common/zmi/workflow.py
changeset 451 8467cbd639b5
parent 328 3ae323f42a24
child 527 5dd1aa8bedd9
equal deleted inserted replaced
450:9a6afbc6ab4f 451:8467cbd639b5
   152                 tztime(pub_info.publication_expiration_date).strftime('%d/%m/%y %H:%M')
   152                 tztime(pub_info.publication_expiration_date).strftime('%d/%m/%y %H:%M')
   153         if 'displayed_publication_date' in self.widgets:
   153         if 'displayed_publication_date' in self.widgets:
   154             self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
   154             self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
   155 
   155 
   156     def createAndAdd(self, data):
   156     def createAndAdd(self, data):
       
   157         data = data.get(self, data)
   157         pub_info = IWorkflowPublicationInfo(self.context)
   158         pub_info = IWorkflowPublicationInfo(self.context)
   158         pub_info.publication_effective_date = data.get('publication_effective_date')
   159         pub_info.publication_effective_date = data.get('publication_effective_date')
   159         pub_info.push_end_date = data.get('push_end_date')
   160         pub_info.push_end_date = data.get('push_end_date')
   160         pub_info.publication_expiration_date = data.get('publication_expiration_date')
   161         pub_info.publication_expiration_date = data.get('publication_expiration_date')
   161         if 'displayed_publication_date' in data:
   162         if 'displayed_publication_date' in data:
   348                 tztime(pub_info.publication_expiration_date).strftime('%d/%m/%y %H:%M')
   349                 tztime(pub_info.publication_expiration_date).strftime('%d/%m/%y %H:%M')
   349         if 'displayed_publication_date' in self.widgets:
   350         if 'displayed_publication_date' in self.widgets:
   350             self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
   351             self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
   351 
   352 
   352     def createAndAdd(self, data):
   353     def createAndAdd(self, data):
       
   354         data = data.get(self, data)
   353         pub_info = IWorkflowPublicationInfo(self.context)
   355         pub_info = IWorkflowPublicationInfo(self.context)
   354         pub_info.publication_effective_date = data.get('publication_effective_date')
   356         pub_info.publication_effective_date = data.get('publication_effective_date')
   355         pub_info.push_end_date = data.get('push_end_date')
   357         pub_info.push_end_date = data.get('push_end_date')
   356         pub_info.publication_expiration_date = data.get('publication_expiration_date')
   358         pub_info.publication_expiration_date = data.get('publication_expiration_date')
   357         if 'displayed_publication_date' in data:
   359         if 'displayed_publication_date' in data:
   702 
   704 
   703     buttons = button.Buttons(ISharedContentCloneButtons)
   705     buttons = button.Buttons(ISharedContentCloneButtons)
   704     ajax_handler = 'wf-clone.json'
   706     ajax_handler = 'wf-clone.json'
   705 
   707 
   706     def createAndAdd(self, data):
   708     def createAndAdd(self, data):
       
   709         data = data.get(self, data)
   707         info = IWorkflowInfo(self.context)
   710         info = IWorkflowInfo(self.context)
   708         return info.fire_transition_toward(DRAFT, comment=data.get('comment'))
   711         return info.fire_transition_toward(DRAFT, comment=data.get('comment'))
   709 
   712 
   710 
   713 
   711 @view_config(name='wf-clone.json', context=IWfSharedContent, request_type=IPyAMSLayer,
   714 @view_config(name='wf-clone.json', context=IWfSharedContent, request_type=IPyAMSLayer,
   778             state = IWorkflowState(self.context)
   781             state = IWorkflowState(self.context)
   779             if state.version_id == 1:  # remove the first and only version => remove all
   782             if state.version_id == 1:  # remove the first and only version => remove all
   780                 self.actions['action'].title = _("Delete definitively")
   783                 self.actions['action'].title = _("Delete definitively")
   781 
   784 
   782     def createAndAdd(self, data):
   785     def createAndAdd(self, data):
       
   786         data = data.get(self, data)
   783         state = IWorkflowState(self.context)
   787         state = IWorkflowState(self.context)
   784         if state.version_id == 1:  # remove the first and only version => remove all
   788         if state.version_id == 1:  # remove the first and only version => remove all
   785             content = get_parent(self.context, ISharedContent)
   789             content = get_parent(self.context, ISharedContent)
   786             self.__target = get_parent(content, IBaseSharedTool)
   790             self.__target = get_parent(content, IBaseSharedTool)
   787             del content.__parent__[content.__name__]
   791             del content.__parent__[content.__name__]