From 70ecd52f277f14aaf744ed98e094c72299bb818a Mon Sep 17 00:00:00 2001 From: Mayoro Diagne <mayoro@nexedi.com> Date: Mon, 5 Jul 2010 18:43:45 +0000 Subject: [PATCH] 2010-07-05 mayoro * remove proxy role manager for Script PDFType_viewDefaultForm to avoid displaying tab meta data * clean history displaying, remove duplicate lines for actions like approve and approve actions git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36878 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Document_getPropertyDictFromContent.xml | 199 ++++++++++++++++++ .../erp5_egov/PDFType_viewDefaultForm.xml | 4 +- .../EGov_getWorkflowHistoryItemList.xml | 19 +- bt5/erp5_egov/bt/change_log | 4 + bt5/erp5_egov/bt/revision | 2 +- 5 files changed, 219 insertions(+), 9 deletions(-) create mode 100644 bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/Document_getPropertyDictFromContent.xml diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/Document_getPropertyDictFromContent.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/Document_getPropertyDictFromContent.xml new file mode 100644 index 0000000000..8c8be1c57d --- /dev/null +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/Document_getPropertyDictFromContent.xml @@ -0,0 +1,199 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </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>"""\n +This script analyzes the document content (text_content) to find properties that might\n +be somehow encoded in the text. It is called by Document.getPropertyDictFromContent\n +method.\n +\n +To use, write your own method (probably External Method, since it is most likely\n +to use re) that would analyze text content of the doc\n +and return a dictionary of properties.\n +"""\n +\n +information = context.getContentInformation()\n +\n +result = {}\n +property_id_list = context.propertyIds()\n +for k, v in information.items(): \n + key = k.lower()\n + if v:\n + if isinstance(v, unicode): v = v.encode(\'utf-8\')\n + if key in property_id_list:\n + if key == \'reference\':\n + pass # XXX - We can not trust reference on getContentInformation\n + else:\n + result[key] = v\n + elif key == \'author\':\n + p = context.portal_catalog.getResultValue(title = v)\n + if p is not None:\n + result[\'contributor\'] = p.getRelativeUrl()\n + elif key == \'keywords\':\n + result[\'subject_list\'] = v.split()\n +\n +object = object or context\n +\n +#try:\n +# content = content or context.asText()\n +#except AttributeError:\n +# return result\n +\n +ptype = ptype or context.getPortalType()\n +\n +# Erase titles which are meaningless\n +title = result.get(\'title\', None)\n +if title:\n + if title.startswith(\'Microsoft Word\'):\n + # Probably a file generated from MS Word\n + del result[\'title\']\n + elif title==context.getId() and not context.title:\n + # this is not a true title, but just an id.\n + del result[\'title\']\n +\n +return result\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>object=None, content=None, ptype=None</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </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>3</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>object</string> + <string>content</string> + <string>ptype</string> + <string>_getattr_</string> + <string>context</string> + <string>information</string> + <string>result</string> + <string>property_id_list</string> + <string>_getiter_</string> + <string>k</string> + <string>v</string> + <string>key</string> + <string>isinstance</string> + <string>unicode</string> + <string>_write_</string> + <string>p</string> + <string>None</string> + <string>title</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + <none/> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Document_getPropertyDictFromContent</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFType_viewDefaultForm.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFType_viewDefaultForm.xml index cdc6192434..3ffe1ef1d6 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFType_viewDefaultForm.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFType_viewDefaultForm.xml @@ -69,9 +69,7 @@ <item> <key> <string>_proxy_roles</string> </key> <value> - <tuple> - <string>Manager</string> - </tuple> + <tuple/> </value> </item> <item> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/EGov_getWorkflowHistoryItemList.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/EGov_getWorkflowHistoryItemList.xml index 3bca3281d3..82d6c96f43 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/EGov_getWorkflowHistoryItemList.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/EGov_getWorkflowHistoryItemList.xml @@ -96,6 +96,7 @@ next_serial = None\n previous_obj = None\n \n for workflow_item in workflow_item_list:\n + same_action = 0\n # XXX removing str method generate a strange bug\n o = newTempBase(portal_object, str(i))\n i += 1\n @@ -132,7 +133,12 @@ for workflow_item in workflow_item_list:\n if value is marker:\n value = \'Does not exist\'\n o.setProperty(key, value)\n - \n + \n + if getattr(previous_obj, \'state\', None) is not None:\n + if previous_obj.state == o.state:\n + same_action = 1\n +\n +\n # record current serial as "next serial" for the previous revision\n if next_serial is not None:\n previous_obj.setProperty(\'next_serial\', o.serial)\n @@ -143,11 +149,13 @@ for workflow_item in workflow_item_list:\n group = person.Person_getPrimaryGroup()\n except AttributeError:\n group = None\n - if group and my_group : \n - if group.startswith(my_group) or action_name in [\'pending_action\', \'submit_draft_action\']:\n +\n + if not same_action:\n + if group and my_group : \n + if group.startswith(my_group) or action_name in [\'pending\', \'submit_draft\']:\n + result.append(o)\n + elif action_name in [\'pending\', \'submit_draft\']:\n result.append(o)\n - elif action_name in [\'pending_action\', \'submit_draft_action\']:\n - result.append(o)\n return result\n </string> </value> </item> @@ -238,6 +246,7 @@ return result\n <string>next_serial</string> <string>previous_obj</string> <string>workflow_item</string> + <string>same_action</string> <string>str</string> <string>o</string> <string>_inplacevar_</string> diff --git a/bt5/erp5_egov/bt/change_log b/bt5/erp5_egov/bt/change_log index a81cb94544..d80dc1b056 100644 --- a/bt5/erp5_egov/bt/change_log +++ b/bt5/erp5_egov/bt/change_log @@ -1,3 +1,7 @@ +2010-07-05 mayoro +* remove proxy role manager for Script PDFType_viewDefaultForm to avoid displaying tab meta data +* clean history displaying, remove duplicate lines for actions like approve and approve actions + 2010-07-03 mayoro * Add publication of web pages in SetUpEGovInstance diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision index 3ea66354ca..55b7e8800f 100644 --- a/bt5/erp5_egov/bt/revision +++ b/bt5/erp5_egov/bt/revision @@ -1 +1 @@ -679 \ No newline at end of file +680 \ No newline at end of file -- 2.30.9