| 1 | ################################################################################
|
|---|
| 2 | # ZMSWorkflowProviderAcquired.py
|
|---|
| 3 | #
|
|---|
| 4 | # This program is free software; you can redistribute it and/or
|
|---|
| 5 | # modify it under the terms of the GNU General Public License
|
|---|
| 6 | # as published by the Free Software Foundation; either version 2
|
|---|
| 7 | # of the License, or (at your option) any later version.
|
|---|
| 8 | #
|
|---|
| 9 | # This program is distributed in the hope that it will be useful,
|
|---|
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | # GNU General Public License for more details.
|
|---|
| 13 | #
|
|---|
| 14 | # You should have received a copy of the GNU General Public License
|
|---|
| 15 | # along with this program; if not, write to the Free Software
|
|---|
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 17 | ################################################################################
|
|---|
| 18 |
|
|---|
| 19 | # Imports.
|
|---|
| 20 | from App.special_dtml import HTMLFile
|
|---|
| 21 | import copy
|
|---|
| 22 | import urllib
|
|---|
| 23 | import zope.interface
|
|---|
| 24 | # Product Imports.
|
|---|
| 25 | import IZMSConfigurationProvider
|
|---|
| 26 | import IZMSWorkflowProvider
|
|---|
| 27 | import ZMSItem
|
|---|
| 28 | import _versionmanager
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | class ZMSWorkflowProviderAcquired(
|
|---|
| 32 | ZMSItem.ZMSItem):
|
|---|
| 33 | zope.interface.implements(
|
|---|
| 34 | IZMSConfigurationProvider.IZMSConfigurationProvider,
|
|---|
| 35 | IZMSWorkflowProvider.IZMSWorkflowProvider)
|
|---|
| 36 |
|
|---|
| 37 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 38 | Properties
|
|---|
| 39 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 40 | meta_type = 'ZMSWorkflowProviderAcquired'
|
|---|
| 41 | icon = "misc_/zms/ZMSWorkflowProvider.png"
|
|---|
| 42 |
|
|---|
| 43 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 44 | Management Options
|
|---|
| 45 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 46 | manage_options_default_action = '../manage_customize'
|
|---|
| 47 | def manage_options(self):
|
|---|
| 48 | return map( lambda x: self.operator_setitem( x, 'action', '../'+x['action']), copy.deepcopy(self.aq_parent.manage_options()))
|
|---|
| 49 |
|
|---|
| 50 | def manage_sub_options(self):
|
|---|
| 51 | return (
|
|---|
| 52 | {'label': 'TAB_WORKFLOW','action': 'manage_main'},
|
|---|
| 53 | )
|
|---|
| 54 |
|
|---|
| 55 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 56 | Management Interface
|
|---|
| 57 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 58 | manage = HTMLFile('dtml/ZMSWorkflowProvider/manage_main_acquired', globals())
|
|---|
| 59 | manage_main = HTMLFile('dtml/ZMSWorkflowProvider/manage_main_acquired', globals()) # -"-
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 63 | ZMSWorkflowProviderAcquired.__init__:
|
|---|
| 64 |
|
|---|
| 65 | Constructor.
|
|---|
| 66 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 67 | def __init__(self, autocommit=1, nodes=['{$}']):
|
|---|
| 68 | self.id = 'workflow_manager'
|
|---|
| 69 | self.autocommit = autocommit
|
|---|
| 70 | self.nodes = nodes
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 74 | ZMSWorkflowProviderAcquired.getAutocommit
|
|---|
| 75 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 76 | def getAutocommit(self):
|
|---|
| 77 | return getattr(self,'autocommit',1)
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 81 | ZMSWorkflowProviderAcquired.getNodes
|
|---|
| 82 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 83 | def getNodes(self):
|
|---|
| 84 | return getattr(self,'nodes',['{$}'])
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 88 | ZMSWorkflowProviderAcquired.doAutocommit:
|
|---|
| 89 |
|
|---|
| 90 | Auto-Commit ZMS-tree.
|
|---|
| 91 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 92 | def doAutocommit(self, lang, REQUEST):
|
|---|
| 93 | _versionmanager.doAutocommit(self,REQUEST)
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 97 | ZMSWorkflowProviderAcquired.writeProtocol
|
|---|
| 98 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 99 | def writeProtocol(self, entry):
|
|---|
| 100 | self.getPortalMaster().workflow_manager.writeProtocol(entry)
|
|---|
| 101 |
|
|---|
| 102 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 103 | @see IZMSWorkflowProvider.getActivities()
|
|---|
| 104 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 105 | def getActivities(self):
|
|---|
| 106 | return self.getPortalMaster().workflow_manager.getActivities()
|
|---|
| 107 |
|
|---|
| 108 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 109 | @see IZMSWorkflowProvider.getActitiesIds()
|
|---|
| 110 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 111 | def getActivityIds(self):
|
|---|
| 112 | return self.getPortalMaster().workflow_manager.getActivityIds()
|
|---|
| 113 |
|
|---|
| 114 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 115 | @see IZMSWorkflowProvider.getActivity()
|
|---|
| 116 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 117 | def getActivity(self, id):
|
|---|
| 118 | return self.getPortalMaster().workflow_manager.getActivity(id)
|
|---|
| 119 |
|
|---|
| 120 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 121 | @see IZMSWorkflowProvider.getTransitions()
|
|---|
| 122 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 123 | def getTransitions(self):
|
|---|
| 124 | return self.getPortalMaster().workflow_manager.getTransitions()
|
|---|
| 125 |
|
|---|
| 126 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 127 | ZMSWorkflowProviderAcquired.manage_changeWorkflow:
|
|---|
| 128 |
|
|---|
| 129 | Chang workflow.
|
|---|
| 130 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|---|
| 131 | def manage_changeWorkflow(self, lang, key='', btn='', REQUEST=None, RESPONSE=None):
|
|---|
| 132 | """ ZMSWorkflowProvider.manage_changeWorkflow """
|
|---|
| 133 | message = ''
|
|---|
| 134 |
|
|---|
| 135 | # Active.
|
|---|
| 136 | # -------
|
|---|
| 137 | if key == 'custom' and btn == self.getZMILangStr('BTN_SAVE'):
|
|---|
| 138 | # Autocommit & Nodes.
|
|---|
| 139 | old_autocommit = getattr(self,'autocommit',1)
|
|---|
| 140 | new_autocommit = REQUEST.get('workflow',0) == 0
|
|---|
| 141 | self.autocommit = new_autocommit
|
|---|
| 142 | self.nodes = self.string_list(REQUEST.get('nodes',''))
|
|---|
| 143 | if old_autocommit == 0 and new_autocommit == 1:
|
|---|
| 144 | self.doAutocommit(lang,REQUEST)
|
|---|
| 145 | message = self.getZMILangStr('MSG_CHANGED')
|
|---|
| 146 |
|
|---|
| 147 | # Return with message.
|
|---|
| 148 | message = urllib.quote(message)
|
|---|
| 149 | return RESPONSE.redirect('manage_main?lang=%s&manage_tabs_message=%s#_%s'%(lang,message,key))
|
|---|
| 150 |
|
|---|
| 151 | ################################################################################
|
|---|