Changeset 12215
- Timestamp:
- 13 Dec 2014, 17:21:27 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12214 r12215 811 811 pnav = 4 812 812 813 form_fields = grok.AutoFields(ICustomerDocument) 814 813 815 @property 814 816 def selectable_doctypes(self): -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/documentaddform.pt
r12090 r12215 18 18 </tr> 19 19 </tbody> 20 <tal:widgets content="structure provider:widgets" /> 20 21 </table> 21 22 <div tal:condition="view/availableActions"> -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12214 r12215 828 828 self.browser.getControl("Add document").click() 829 829 self.browser.getControl(name="doctype").value = ['CustomerPDFDocument'] 830 self.browser.getControl(name="form.title").value = 'My PDF Document' 830 831 self.browser.getControl("Add document").click() 831 832 self.assertTrue('PDF Document added.' in self.browser.contents) … … 899 900 self.browser.getControl("Add document").click() 900 901 self.browser.getControl(name="doctype").value = ['CustomerSampleDocument'] 902 self.browser.getControl(name="form.title").value = 'My Sample Document' 901 903 self.browser.getControl("Add document").click() 902 904 self.assertTrue('Sample Document added.' in self.browser.contents) … … 1037 1039 self.browser.getControl("Add document").click() 1038 1040 self.browser.getControl(name="doctype").value = ['CustomerPDFDocument'] 1041 self.browser.getControl(name="form.title").value = 'My PDF Document' 1039 1042 self.browser.getControl("Add document").click() 1040 1043 self.browser.open(self.documents_path + '/d102/manage') -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/browser.py
r12214 r12215 24 24 from urllib import urlencode 25 25 from datetime import datetime 26 from hurry.workflow.interfaces import ( 27 IWorkflowInfo, IWorkflowState, InvalidTransitionError) 26 28 from zope.event import notify 27 29 from zope.i18n import translate … … 116 118 pnav = 2 117 119 120 form_fields = grok.AutoFields(IPublicDocument) 121 118 122 @property 119 123 def selectable_doctypes(self): … … 149 153 grok.name('index') 150 154 grok.require('waeup.viewDocuments') 151 #grok.template('basepage')155 grok.template('documentpage') 152 156 pnav = 2 153 157 … … 198 202 def delLocalRoles(self, **data): 199 203 return del_local_roles(self,2,**data) 204 205 206 class DocumentTriggerTransitionFormPage(IkobaEditFormPage): 207 """ View to trigger public document transitions 208 """ 209 grok.context(IPublicDocument) 210 grok.name('trigtrans') 211 grok.require('waeup.triggerTransition') 212 grok.template('trigtrans') 213 label = _('Trigger document transition') 214 pnav = 2 215 216 def update(self): 217 return super(IkobaEditFormPage, self).update() 218 219 def getTransitions(self): 220 """Return a list of dicts of allowed transition ids and titles. 221 222 Each list entry provides keys ``name`` and ``title`` for 223 internal name and (human readable) title of a single 224 transition. 225 """ 226 wf_info = IWorkflowInfo(self.context) 227 allowed_transitions = [t for t in wf_info.getManualTransitions()] 228 return [dict(name='', title=_('No transition'))] +[ 229 dict(name=x, title=y) for x, y in allowed_transitions] 230 231 @action(_('Save'), style='primary') 232 def save(self, **data): 233 form = self.request.form 234 if 'transition' in form and form['transition']: 235 transition_id = form['transition'] 236 wf_info = IWorkflowInfo(self.context) 237 try: 238 wf_info.fireTransition(transition_id) 239 except InvalidTransitionError, error: 240 self.flash(error, type="warning") 241 return -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/browser_templates/documentaddform.pt
r12214 r12215 17 17 </td> 18 18 </tr> 19 <tal:widgets content="structure provider:widgets" /> 19 20 </tbody> 20 21 </table> -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/viewlets.py
r12206 r12215 27 27 28 28 from waeup.ikoba.documents.interfaces import ( 29 IDocumentsContainer, I Document)29 IDocumentsContainer, IPublicDocument) 30 30 from waeup.ikoba.documents.browser import ( 31 31 DocumentsContainerManageFormPage, DocumentsContainerPage, … … 64 64 class DocumentViewActionButton(ManageActionButton): 65 65 grok.order(1) 66 grok.context(I Document)66 grok.context(IPublicDocument) 67 67 grok.view(DocumentManageFormPage) 68 68 grok.require('waeup.manageDocuments') … … 74 74 class DocumentManageActionButton(ManageActionButton): 75 75 grok.order(1) 76 grok.context(I Document)76 grok.context(IPublicDocument) 77 77 grok.view(DocumentDisplayFormPage) 78 78 grok.require('waeup.manageDocuments') 79 79 text = _('Manage') 80 80 target = 'manage' 81 82 83 class DocumentTrigTransActionButton(ManageActionButton): 84 grok.order(2) 85 grok.context(IPublicDocument) 86 grok.view(DocumentDisplayFormPage) 87 grok.require('waeup.manageDocuments') 88 icon = 'actionicon_trigtrans.png' 89 text = _(u'Transition') 90 target = 'trigtrans' 91 92 -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py
r12213 r12215 40 40 msg = _('Document created'), 41 41 destination = CREATED), 42 43 Transition( 44 transition_id = 'publish', 45 title = _('Publish document'), 46 source = CREATED, 47 condition = NullCondition, 48 msg = _('Document published'), 49 destination = PUBLISHED), 42 50 ) 43 51
Note: See TracChangeset for help on using the changeset viewer.