Commit 7e6f24cb authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

2009-01-16 kazuhiko

* add an update_portal_types_by_english_glossary action.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25149 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1de0c716
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>28.0</float> </value> <value> <float>29.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>update_portal_types_by_english_glossary</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>28.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Update PortalTypes by English Glossary</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="Expression" module="Products.CMFCore.Expression"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/GlossaryModule_viewPortalTypeAndTermComparisonDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
def setPortalTypeDescription(self, portal_type, description):
self.getPortalObject().portal_types[portal_type]._updateProperty(
'description', description)
def getPropertySheetList(self, portal_type): def getPropertySheetList(self, portal_type):
from Products.ERP5Type.DocumentationHelper.PortalTypeDocumentationHelper \ from Products.ERP5Type.DocumentationHelper.PortalTypeDocumentationHelper \
import PortalTypeDocumentationHelper import PortalTypeDocumentationHelper
......
<?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>from Products.ERP5Type.Document import newTempBase\n
\n
result = []\n
\n
portal_catalog = context.portal_catalog\n
portal_skins = context.portal_skins\n
\n
def get_term_list(reference):\n
reference = reference.rsplit(\' Module\', 1)[0]\n
term_list = portal_catalog(portal_type=\'Glossary Term\',\n
validation_state=\'validated\',\n
language_id=\'en\',\n
reference=reference)\n
return [i.getObject() for i in term_list]\n
\n
line_list = []\n
c = 0\n
portal_type_list = context.GlossaryModule_getAvailablePortalTypeList()\n
for reference in portal_type_list:\n
portal_type = context.getPortalObject().portal_types[reference]\n
term_list = get_term_list(reference)\n
#if not term_list:\n
# continue\n
\n
c += 1\n
field_description = portal_type.description\n
if len(term_list) == 1 and \\\n
term_list[0].getDescription() == field_description:\n
continue\n
\n
line = newTempBase(context, \'tmp_glossary_field_%s\' % c)\n
line.edit(field_path=reference,\n
field_edit_url = \'%s/manage_main\' % portal_type.absolute_url(),\n
field_description=field_description,\n
reference=reference,\n
term_list=term_list,\n
)\n
line.setUid(reference)\n
line_list.append(line)\n
\n
line_list.sort(key=lambda x:x.field_path)\n
return line_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>result</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_catalog</string>
<string>portal_skins</string>
<string>get_term_list</string>
<string>line_list</string>
<string>c</string>
<string>portal_type_list</string>
<string>_getiter_</string>
<string>reference</string>
<string>_getitem_</string>
<string>portal_type</string>
<string>term_list</string>
<string>_inplacevar_</string>
<string>field_description</string>
<string>len</string>
<string>line</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>GlossaryModule_getBusinessFieldPortalTypeList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>setPortalTypeDescription</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>Glossary</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>GlossaryModule_setPortalTypeDescription</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>prefix = \'field_listbox_term_\'\n
prefix_length = len(prefix)\n
portal_types = context.portal_types\n
portal_catalog = context.portal_catalog\n
\n
for i in kw.keys():\n
if not(i.startswith(prefix) and kw[i]):\n
continue\n
term_uid = int(kw[i])\n
term = portal_catalog(uid=term_uid)[0].getObject()\n
\n
field_path = i[prefix_length:]\n
context.GlossaryModule_setPortalTypeDescription(field_path, term.getDescription())\n
\n
portal_status_message = context.Base_translateString(\'Portal Types updated.\')\n
context.Base_redirect(keep_items={\'portal_status_message\':portal_status_message})\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>prefix</string>
<string>len</string>
<string>prefix_length</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_types</string>
<string>portal_catalog</string>
<string>_getiter_</string>
<string>i</string>
<string>_getitem_</string>
<string>int</string>
<string>term_uid</string>
<string>term</string>
<string>field_path</string>
<string>portal_status_message</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>GlossaryModule_updatePortalTypeByTerm</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>GlossaryModule_updatePortalTypeByTerm</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_term</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>GlossaryModule_viewPortalTypeAndTermComparisonDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>GlossaryModule_viewPortalTypeAndTermConparisonDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Update PortalTypes</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
432 433
\ No newline at end of file \ No newline at end of file
...@@ -19,6 +19,7 @@ Glossary Module | find_terms_from_portal_type ...@@ -19,6 +19,7 @@ Glossary Module | find_terms_from_portal_type
Glossary Module | find_terms_from_property_sheet Glossary Module | find_terms_from_property_sheet
Glossary Module | find_terms_from_workflow Glossary Module | find_terms_from_workflow
Glossary Module | update_fields_by_english_glossary Glossary Module | update_fields_by_english_glossary
Glossary Module | update_portal_types_by_english_glossary
Glossary Module | update_workflows_by_english_glossary Glossary Module | update_workflows_by_english_glossary
Glossary Module | view Glossary Module | view
Glossary Term | view Glossary Term | view
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment