# -*- coding: utf-8 -*- # # File: TeleServices.py # # Copyright (c) 2007 by CommunesPlone # Generator: ArchGenXML Version 1.5.3 dev/svn # http://plone.org/products/archgenxml # # GNU General Public License (GPL) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # __author__ = """Gauthier BASTIEN , Stephan GEULETTE """ __docformat__ = 'plaintext' from Products.CMFCore.utils import getToolByName from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition from Products.ExternalMethod.ExternalMethod import ExternalMethod from Products.TeleServices.config import * ##code-section create-workflow-module-header #fill in your manual code here ##/code-section create-workflow-module-header productname = 'TeleServices' def setupdemandtypeterm_workflow(self, workflow): """Define the demandtypeterm_workflow workflow. """ workflow.setProperties(title='demandtypeterm_workflow') ##code-section create-workflow-setup-method-header #fill in your manual code here ##/code-section create-workflow-setup-method-header for s in ['disabled', 'info_only', 'on_line']: workflow.states.addState(s) for t in ['put_on_line', 'enable', 'for_info_only', 'disable']: workflow.transitions.addTransition(t) for v in ['review_history', 'comments', 'time', 'actor', 'action']: workflow.variables.addVariable(v) workflow.addManagedPermission('Modify portal content') workflow.addManagedPermission('Access contents information') workflow.addManagedPermission('View') for l in []: if not l in workflow.worklists.objectValues(): workflow.worklists.addWorklist(l) ## Initial State workflow.states.setInitialState('on_line') ## States initialization stateDef = workflow.states['disabled'] stateDef.setProperties(title="""disabled""", description="""""", transitions=['enable']) stateDef.setPermission('Modify portal content', 0, ['Owner', 'Manager']) stateDef.setPermission('Access contents information', 0, ['Member', 'Manager']) stateDef.setPermission('View', 0, ['Member', 'Manager']) stateDef = workflow.states['info_only'] stateDef.setProperties(title="""info_only""", description="""""", transitions=['disable', 'put_on_line']) stateDef.setPermission('View', 0, ['Member', 'Manager']) stateDef.setPermission('Access contents information', 0, ['Member', 'Manager']) stateDef.setPermission('Modify portal content', 0, ['Owner', 'Manager']) stateDef = workflow.states['on_line'] stateDef.setProperties(title="""on_line""", description="""""", transitions=['for_info_only']) stateDef.setPermission('Access contents information', 0, ['Member', 'Manager']) stateDef.setPermission('View', 0, ['Member', 'Manager']) stateDef.setPermission('Modify portal content', 0, ['Owner', 'Manager']) ## Transitions initialization transitionDef = workflow.transitions['put_on_line'] transitionDef.setProperties(title="""put_on_line""", new_state_id="""on_line""", trigger_type=1, script_name="""""", after_script_name="""""", actbox_name="""put_on_line""", actbox_url="""""", actbox_category="""workflow""", props={'guard_permissions': 'TeleServices: Manage TeleServices'}, ) transitionDef = workflow.transitions['enable'] transitionDef.setProperties(title="""enable""", new_state_id="""info_only""", trigger_type=1, script_name="""""", after_script_name="""""", actbox_name="""enable""", actbox_url="""""", actbox_category="""workflow""", props={'guard_permissions': 'TeleServices: Manage TeleServices'}, ) transitionDef = workflow.transitions['for_info_only'] transitionDef.setProperties(title="""for_info_only""", new_state_id="""info_only""", trigger_type=1, script_name="""""", after_script_name="""""", actbox_name="""for_info_only""", actbox_url="""""", actbox_category="""workflow""", props={'guard_permissions': 'TeleServices: Manage TeleServices'}, ) transitionDef = workflow.transitions['disable'] transitionDef.setProperties(title="""disable""", new_state_id="""disabled""", trigger_type=1, script_name="""""", after_script_name="""""", actbox_name="""disable""", actbox_url="""""", actbox_category="""workflow""", props={'guard_permissions': 'TeleServices: Manage TeleServices'}, ) ## State Variable workflow.variables.setStateVar('review_state') ## Variables initialization variableDef = workflow.variables['review_history'] variableDef.setProperties(description="""Provides access to workflow history""", default_value="""""", default_expr="""state_change/getHistory""", for_catalog=0, for_status=0, update_always=0, props={'guard_permissions': 'Request review; Review portal content'}) variableDef = workflow.variables['comments'] variableDef.setProperties(description="""Comments about the last transition""", default_value="""""", default_expr="""python:state_change.kwargs.get('comment', '')""", for_catalog=0, for_status=1, update_always=1, props=None) variableDef = workflow.variables['time'] variableDef.setProperties(description="""Time of the last transition""", default_value="""""", default_expr="""state_change/getDateTime""", for_catalog=0, for_status=1, update_always=1, props=None) variableDef = workflow.variables['actor'] variableDef.setProperties(description="""The ID of the user who performed the last transition""", default_value="""""", default_expr="""user/getId""", for_catalog=0, for_status=1, update_always=1, props=None) variableDef = workflow.variables['action'] variableDef.setProperties(description="""The last transition""", default_value="""""", default_expr="""transition/getId|nothing""", for_catalog=0, for_status=1, update_always=1, props=None) ## Worklists Initialization # WARNING: below protected section is deprecated. # Add a tagged value 'worklist' with the worklist name to your state(s) instead. ##code-section create-workflow-setup-method-footer #fill in your manual code here ##/code-section create-workflow-setup-method-footer def createdemandtypeterm_workflow(self, id): """Create the workflow for TeleServices. """ ob = DCWorkflowDefinition(id) setupdemandtypeterm_workflow(self, ob) return ob #addWorkflowFactory(createdemandtypeterm_workflow, # id='demandtypeterm_workflow', # title='demandtypeterm_workflow') ##code-section create-workflow-module-footer #fill in your manual code here ##/code-section create-workflow-module-footer