Commit 1c9bdc1b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

2009-01-15 kazuhiko

* improve Glossary to Field/Workflow comparison dialogues.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25138 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent df4a6936
...@@ -61,6 +61,7 @@ portal_catalog = context.portal_catalog\n ...@@ -61,6 +61,7 @@ portal_catalog = context.portal_catalog\n
portal_skins = context.portal_skins\n portal_skins = context.portal_skins\n
\n \n
def get_term_list(business_field, reference):\n def get_term_list(business_field, reference):\n
reference = reference.rsplit(\'_title\', 1)[0]\n
term_list = portal_catalog(portal_type=\'Glossary Term\',\n term_list = portal_catalog(portal_type=\'Glossary Term\',\n
validation_state=\'validated\',\n validation_state=\'validated\',\n
language_id=\'en\',\n language_id=\'en\',\n
...@@ -90,11 +91,15 @@ business_field_list = [i for i in business_field_list if i]\n ...@@ -90,11 +91,15 @@ business_field_list = [i for i in business_field_list if i]\n
\n \n
line_list = []\n line_list = []\n
c = 0\n c = 0\n
item_dict = {}\n
for business_field in business_field_list:\n for business_field in business_field_list:\n
for field, reference in get_field_and_reference_list(business_field):\n for field, reference in get_field_and_reference_list(business_field):\n
term_list = get_term_list(business_field, reference)\n term_list = get_term_list(business_field, reference)\n
if not term_list:\n #if not term_list:\n
# continue\n
if item_dict.has_key(field):\n
continue\n continue\n
item_dict[field] = True\n
\n \n
field_path = \'%s/%s/%s\' % (field.aq_parent.aq_parent.getId(),\n field_path = \'%s/%s/%s\' % (field.aq_parent.aq_parent.getId(),\n
field.aq_parent.getId(),\n field.aq_parent.getId(),\n
...@@ -128,6 +133,7 @@ for business_field in business_field_list:\n ...@@ -128,6 +133,7 @@ for business_field in business_field_list:\n
line.setUid(field_path)\n line.setUid(field_path)\n
line_list.append(line)\n line_list.append(line)\n
\n \n
line_list.sort(key=lambda x:x.field_path)\n
return line_list\n return line_list\n
</string> </value> </string> </value>
</item> </item>
...@@ -182,16 +188,18 @@ return line_list\n ...@@ -182,16 +188,18 @@ return line_list\n
<string>i</string> <string>i</string>
<string>line_list</string> <string>line_list</string>
<string>c</string> <string>c</string>
<string>item_dict</string>
<string>business_field</string> <string>business_field</string>
<string>field</string> <string>field</string>
<string>reference</string> <string>reference</string>
<string>term_list</string> <string>term_list</string>
<string>True</string>
<string>_write_</string>
<string>field_path</string> <string>field_path</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>field_title</string> <string>field_title</string>
<string>field_description</string> <string>field_description</string>
<string>field_note_list</string> <string>field_note_list</string>
<string>True</string>
<string>None</string> <string>None</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
......
...@@ -63,6 +63,7 @@ portal_workflow = context.portal_workflow\n ...@@ -63,6 +63,7 @@ portal_workflow = context.portal_workflow\n
portal_templates = context.portal_templates\n portal_templates = context.portal_templates\n
\n \n
def get_term_list(business_field, reference):\n def get_term_list(business_field, reference):\n
reference = reference.rsplit(\'_action\', 1)[0]\n
term_list = portal_catalog(portal_type=\'Glossary Term\',\n term_list = portal_catalog(portal_type=\'Glossary Term\',\n
validation_state=\'validated\',\n validation_state=\'validated\',\n
language_id=\'en\',\n language_id=\'en\',\n
...@@ -92,11 +93,15 @@ business_field_list = [i for i in business_field_list if i]\n ...@@ -92,11 +93,15 @@ business_field_list = [i for i in business_field_list if i]\n
\n \n
line_list = []\n line_list = []\n
c = 0\n c = 0\n
item_dict = {}\n
for business_field in business_field_list:\n for business_field in business_field_list:\n
for wf_item, reference, type in get_obj_and_reference_list(business_field):\n for wf_item, reference, type in get_obj_and_reference_list(business_field):\n
term_list = get_term_list(business_field, reference)\n term_list = get_term_list(business_field, reference)\n
if not term_list:\n #if not term_list:\n
# continue\n
if item_dict.has_key(wf_item):\n
continue\n continue\n
item_dict[wf_item] = True\n
\n \n
c += 1\n c += 1\n
if type == \'workflow\':\n if type == \'workflow\':\n
...@@ -113,6 +118,12 @@ for business_field in business_field_list:\n ...@@ -113,6 +118,12 @@ for business_field in business_field_list:\n
wf_item_title = wf_item.actbox_name\n wf_item_title = wf_item.actbox_name\n
wf_item_description = wf_item.description\n wf_item_description = wf_item.description\n
\n \n
if type == \'transition\' and wf_item_path.endswith(\'_action\'):\n
if len(term_list) == 1 and \\\n
term_list[0].getTitle() + \' Action\' == wf_item_title and \\\n
term_list[0].getDescription() == wf_item_description:\n
continue\n
else:\n
if len(term_list) == 1 and \\\n if len(term_list) == 1 and \\\n
term_list[0].getTitle() == wf_item_title and \\\n term_list[0].getTitle() == wf_item_title and \\\n
term_list[0].getDescription() == wf_item_description:\n term_list[0].getDescription() == wf_item_description:\n
...@@ -130,6 +141,7 @@ for business_field in business_field_list:\n ...@@ -130,6 +141,7 @@ for business_field in business_field_list:\n
line.setUid(wf_item_path)\n line.setUid(wf_item_path)\n
line_list.append(line)\n line_list.append(line)\n
\n \n
line_list.sort(key=lambda x:x.wf_item_path)\n
return line_list\n return line_list\n
</string> </value> </string> </value>
</item> </item>
...@@ -186,11 +198,14 @@ return line_list\n ...@@ -186,11 +198,14 @@ return line_list\n
<string>i</string> <string>i</string>
<string>line_list</string> <string>line_list</string>
<string>c</string> <string>c</string>
<string>item_dict</string>
<string>business_field</string> <string>business_field</string>
<string>wf_item</string> <string>wf_item</string>
<string>reference</string> <string>reference</string>
<string>type</string> <string>type</string>
<string>term_list</string> <string>term_list</string>
<string>True</string>
<string>_write_</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>wf_item_path</string> <string>wf_item_path</string>
<string>wf_item_title</string> <string>wf_item_title</string>
......
...@@ -82,8 +82,11 @@ for i in kw.keys():\n ...@@ -82,8 +82,11 @@ for i in kw.keys():\n
else: # wf_item.meta_type == "Workflow Transition"\n else: # wf_item.meta_type == "Workflow Transition"\n
guard = getattr(wf_item, \'guard\', None)\n guard = getattr(wf_item, \'guard\', None)\n
if not is_action:\n if not is_action:\n
title = term.getTitle()\n
if wf_item_path.endswith(\'_action\'):\n
title += \' Action\'\n
wf_item.setProperties(\n wf_item.setProperties(\n
term.getTitle(),\n title,\n
wf_item.new_state_id,\n wf_item.new_state_id,\n
description=term.getDescription(),\n description=term.getDescription(),\n
\n \n
...@@ -175,6 +178,8 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag ...@@ -175,6 +178,8 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag
<string>getattr</string> <string>getattr</string>
<string>None</string> <string>None</string>
<string>guard</string> <string>guard</string>
<string>title</string>
<string>_inplacevar_</string>
<string>portal_status_message</string> <string>portal_status_message</string>
</tuple> </tuple>
</value> </value>
......
431 432
\ No newline at end of file \ No newline at end of file
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