From 4506e246851a75673d5fafeb5bc142ba04c4adbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Thu, 28 Sep 2006 19:40:45 +0000 Subject: [PATCH] tidied up interaction workflows (bugfixes, logical naming) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10419 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../interactions/Nonregistered_file_edit.xml | 94 ++++++++++ .../interactions/Registered_file_edit.xml | 99 +++++++++++ .../scripts/CheckKnownType.xml | 164 ++++++++++++++++++ .../scripts/CheckUnKnownType.xml | 162 +++++++++++++++++ .../scripts/ClearCacheUponUpload.xml | 4 +- .../interactions/OOo_edit.xml | 4 +- .../scripts/OOo_edit.xml | 17 +- bt5/erp5_dms/bt/revision | 2 +- 8 files changed, 525 insertions(+), 21 deletions(-) create mode 100644 bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Nonregistered_file_edit.xml create mode 100644 bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Registered_file_edit.xml create mode 100644 bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckKnownType.xml create mode 100644 bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckUnKnownType.xml diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Nonregistered_file_edit.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Nonregistered_file_edit.xml new file mode 100644 index 0000000000..109863567c --- /dev/null +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Nonregistered_file_edit.xml @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.ERP5.Interaction</string> + <string>InteractionDefinition</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Nonregistered_file_edit</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>_edit</string> + </list> + </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <list> + <string>DMS File</string> + </list> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <list> + <string>CheckUnKnownType</string> + </list> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Registered_file_edit.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Registered_file_edit.xml new file mode 100644 index 0000000000..23231d6a10 --- /dev/null +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/interactions/Registered_file_edit.xml @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.ERP5.Interaction</string> + <string>InteractionDefinition</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Registered_file_edit</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>_edit</string> + </list> + </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <list> + <string>Graphic</string> + <string>ImageDocument</string> + <string>PdfDocument</string> + <string>Presentation</string> + <string>Spreadsheet</string> + <string>Text</string> + </list> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <list> + <string>CheckKnownType</string> + </list> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckKnownType.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckKnownType.xml new file mode 100644 index 0000000000..006d79f40b --- /dev/null +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckKnownType.xml @@ -0,0 +1,164 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>ob=state_change.object\n +kw=ob.REQUEST\n +f=kw.get(\'my_file\',None)\n +\n +if f is not None and f:\n + # if file uploaded, then:\n + fname=f.filename\n + # we check for appropriate file type (by extension, using content_type_registry)\n + # we accept or suggest appropriate portal type\n + ctype=context.content_type_registry.findTypeName(fname,None,None)\n + if ctype is None:\n + raise Exception(\'This file should be created as DMS File\')\n + if ctype!=ob.getPortalType():\n + raise Exception(\'This file should be created as \'+ctype)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>state_change</string> + <string>_getattr_</string> + <string>ob</string> + <string>kw</string> + <string>None</string> + <string>f</string> + <string>fname</string> + <string>context</string> + <string>ctype</string> + <string>Exception</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>CheckKnownType</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckUnKnownType.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckUnKnownType.xml new file mode 100644 index 0000000000..01f1961b0c --- /dev/null +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/CheckUnKnownType.xml @@ -0,0 +1,162 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>ob=state_change.object\n +kw=ob.REQUEST\n +f=kw.get(\'my_file\',None)\n +\n +if f is not None and f:\n + # if file uploaded, then:\n + fname=f.filename\n + # we check for appropriate file type (by extension, using content_type_registry)\n + # we allow only not known types\n + ctype=context.content_type_registry.findTypeName(fname,None,None)\n + if ctype is not None:\n + raise Exception(\'This file should be created as \'+ctype)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>state_change</string> + <string>_getattr_</string> + <string>ob</string> + <string>kw</string> + <string>None</string> + <string>f</string> + <string>fname</string> + <string>context</string> + <string>ctype</string> + <string>Exception</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>CheckUnKnownType</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/ClearCacheUponUpload.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/ClearCacheUponUpload.xml index a4ccf62d59..2ff05b9a45 100644 --- a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/ClearCacheUponUpload.xml +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/dms_file_interaction_workflow/scripts/ClearCacheUponUpload.xml @@ -76,7 +76,8 @@ ob.log(\'f\',f)\n \n if f is not None and f:\n # if file uploaded, then:\n - ob.clearCache()\n + if hasattr(ob,\'clearCache\'): # e.g. DMS File doesnt have it\n + ob.clearCache()\n </string> </value> </item> <item> @@ -125,6 +126,7 @@ if f is not None and f:\n <string>kw</string> <string>None</string> <string>f</string> + <string>hasattr</string> </tuple> </value> </item> diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/interactions/OOo_edit.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/interactions/OOo_edit.xml index 039a370353..efbae781f2 100644 --- a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/interactions/OOo_edit.xml +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/interactions/OOo_edit.xml @@ -33,9 +33,7 @@ <item> <key> <string>activate_script_name</string> </key> <value> - <list> - <string>Convert_after</string> - </list> + <tuple/> </value> </item> <item> diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/OOo_edit.xml b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/OOo_edit.xml index 35fca3775e..f5b56c1cf8 100644 --- a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/OOo_edit.xml +++ b/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/OOo_edit.xml @@ -70,7 +70,7 @@ <key> <string>_body</string> </key> <value> <string>ob=state_change.object\n kw=ob.REQUEST\n -metafields=(\'title\',\'subject\',\'keywords\',\'description\',\'reference\',\'version\',\'language\')\n +metafields=(\'title\',\'subject\',\'description\',\'reference\',\'version\',\'language\')\n f=kw.get(\'my_file\',None)\n \n # edit metadata (only if we have OOo file)\n @@ -83,17 +83,6 @@ if ob.hasOOfile():\n if newmeta:\n # edit metadata via server\n ob.editMetadata(newmeta)\n -if f is not None and f:\n - # if file uploaded, then:\n - context.log(f)\n - fname=f.filename\n - # we check for appropriate file type (by extension, using content_type_registry)\n - ctype=context.content_type_registry.findTypeName(fname,None,None)\n - if ctype is None:\n - raise Exception(\'File type of \'+fname+\' is not registered\')\n - if ctype!=ob.getPortalType():\n - raise Exception(\'This file should be created as \'+ctype)\n - ob.reset()\n </string> </value> </item> <item> @@ -149,10 +138,6 @@ if f is not None and f:\n <string>keymf</string> <string>_getitem_</string> <string>_write_</string> - <string>context</string> - <string>fname</string> - <string>ctype</string> - <string>Exception</string> </tuple> </value> </item> diff --git a/bt5/erp5_dms/bt/revision b/bt5/erp5_dms/bt/revision index b7c52fb181..cc4f7f3feb 100644 --- a/bt5/erp5_dms/bt/revision +++ b/bt5/erp5_dms/bt/revision @@ -1 +1 @@ -212 \ No newline at end of file +218 \ No newline at end of file -- 2.30.9