# -*- coding: utf-8 -*-
#
# File: TicketSystem.py
#
# Copyright (c) 2007 by []
# Generator: ArchGenXML Version 1.5.2
# 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__ = """unknown <unknown>"""
__docformat__ = 'plaintext'
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowTool import addWorkflowFactory
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.ExternalMethod.ExternalMethod import ExternalMethod
from Products.TicketSystem.config import *
##code-section create-workflow-module-header #fill in your manual code here
##/code-section create-workflow-module-header
productname = 'TicketSystem'
def setupticketsystem_workflow(self, workflow):
"""Define the ticketsystem_workflow workflow.
"""
workflow.setProperties(title='ticketsystem_workflow')
##code-section create-workflow-setup-method-header #fill in your manual code here
##/code-section create-workflow-setup-method-header
for s in ['published']:
workflow.states.addState(s)
for t in []:
workflow.transitions.addTransition(t)
for v in ['review_history', 'comments', 'time', 'actor', 'action']:
workflow.variables.addVariable(v)
for l in []:
if not l in workflow.worklists.objectValues():
workflow.worklists.addWorklist(l)
## Initial State
workflow.states.setInitialState('published')
## States initialization
stateDef = workflow.states['published']
stateDef.setProperties(title="""published""",
description="""""",
transitions=[])
## Transitions initialization
## 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 createticketsystem_workflow(self, id):
"""Create the workflow for TicketSystem.
"""
ob = DCWorkflowDefinition(id)
setupticketsystem_workflow(self, ob)
return ob
addWorkflowFactory(createticketsystem_workflow,
id='ticketsystem_workflow',
title='ticketsystem_workflow')
##code-section create-workflow-module-footer #fill in your manual code here
##/code-section create-workflow-module-footer