Commit 4731a9d1 authored by Gabriel Monnerat's avatar Gabriel Monnerat

2010-01-05 gabriel

* Add Domains and clean up the code that generates domains

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42031 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c76aca9f
......@@ -52,7 +52,7 @@
</item>
<item>
<key> <string>last_id</string> </key>
<value> <string>13</string> </value>
<value> <string>28</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<string>Web Page</string>
<string>Web Table</string>
<string>Web Illustration</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>portal_type</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>all_documents</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>last_id</string> </key>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>All Documents</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<string>Web Illustration</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>portal_type</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>web_illustration_domain</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web Illustration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<string>Web Page</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>portal_type</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>web_page_subdomain</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web Page</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<string>Web Table</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>portal_type</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>web_table_subdomain</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web Table</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>validation_state</string> </key>
<value>
<list>
<string>hidden</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>validation_state</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hidden</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Hidden</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>owner</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: True</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Owner</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>recent</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Recent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>validation_state</string> </key>
<value>
<list>
<string>shared</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>validation_state</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>shared</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Shared by me</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain Generator" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>int_index</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>criterion_property_list</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>multimembership_criterion_base_category_list</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>string_index</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>test_method_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>test_tales_expression</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>membership_criterion_base_category_list</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>membership_criterion_category_list</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>membership_criterion_document_list</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>lines</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>starred</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>membership_criterion_base_category_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>membership_criterion_category_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>membership_criterion_document_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category_list</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain Generator</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: True</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Starred</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Domain" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<dictionary>
<item>
<key> <string>validation_state</string> </key>
<value>
<list>
<string>deleted</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple>
<string>validation_state</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>trash</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Domain</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Trash</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -55,6 +55,28 @@
XXX - The generation of domains should be more dynamic because some domains is create manually.\n
"""\n
\n
def getAvailableSubjectList(subject_list=()):\n
"""\n
Returns the list of available subjects for all documents\n
located in the current container (if defined) and which\n
already match all subjects of subject_list\n
"""\n
subject_list = ()\n
portal_type_list = ["Web Table", "Web Page", "Web Illustration"]\n
kw = dict(portal_type=portal_type_list,\n
subject="!=",)\n
subject_len = len(subject_list)\n
result_list = context.portal_catalog(**kw)\n
\n
subject_list = []\n
for keyword_list in filter(lambda x: x not in subject_list, \n
map(lambda r: r.subject, result_list)):\n
for keyword in keyword_list:\n
if keyword not in subject_list:\n
subject_list.append(keyword)\n
\n
return subject_list\n
\n
def appendTempDomain(id, \n
title,\n
property_dict,\n
......@@ -71,139 +93,37 @@ def appendTempDomain(id, \n
for key, value in property_dict.items():\n
domain.setCriterion(key, value)\n
\n
if parent.getId() == "ung_domain":\n
domain_list.append(domain)\n
return domain\n
\n
domain_list = []\n
validation_state_list = [\'draft\', \'published\', \'shared\']\n
\n
if depth == 1:\n
return domain_list\n
\n
appendTempDomain(\'all_document_list\', \n
\'All Documents\', \n
dict(validation_state=validation_state_list))\n
\n
appendTempDomain(\'hidden_document_list\', \n
\'Hidden\', \n
dict(validation_state=[\'hidden\']))\n
\n
appendTempDomain(\'opened_document_list\', \n
\'Opened by me\', \n
dict(local_roles=\'Owner\', validation_state=validation_state_list))\n
\n
appendTempDomain(\'owner_document_list\', \n
\'Owned by me\',\n
dict(local_roles=\'Owner\', validation_state=validation_state_list))\n
\n
appendTempDomain(\'shared_document_list\', \n
\'Shared by me\',\n
dict(validation_state=[\'shared\']))\n
\n
appendTempDomain(\'starred_document_list\',\n
\'Starred\',\n
dict(validation_state=validation_state_list))\n
subject_domain = appendTempDomain(\'by_subject\',\n
\'By Subject\',\n
dict(validation_state=validation_state_list))\n
\n
appendTempDomain(\'trash_document_list\',\n
\'Trash\',\n
dict(validation_state=[\'deleted\']))\n
domain_list.append(subject_domain)\n
\n
domain = appendTempDomain(\'webpage_module_list\',\n
\'Document by Type\',\n
dict(portal_type=["Web Page", "Web Illustration", "Web Table"],\n
validation_state=validation_state_list))\n
for subject in getAvailableSubjectList():\n
appendTempDomain("subject_" + subject,\n
subject.capitalize(),\n
dict(subject=subject),\n
subject_domain,\n
("by_subject",),\n
("by_subject",))\n
\n
appendTempDomain(\'subWebPage\',\n
\'Web Page\',\n
dict(validation_state=validation_state_list, portal_type=["Web Page"]),\n
domain,\n
("webpage_module_list",),\n
("webpage_module_list",))\n
\n
appendTempDomain(\'subWebTable\',\n
\'Web Table\',\n
dict(validation_state=validation_state_list, portal_type=["Web Table"]),\n
domain,\n
("webpage_module_list",),\n
("webpage_module_list",))\n
\n
appendTempDomain(\'subWebIllustration\',\n
\'Web Illustration\',\n
dict(validation_state=validation_state_list, portal_type=["Web Illustration"]),\n
domain,\n
("webpage_module_list",),\n
("webpage_module_list",))\n
\n
return domain_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>depth, parent, **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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>depth</string>
<string>parent</string>
<string>kw</string>
<string>domain_list</string>
<string>appendTempDomain</string>
<string>validation_state_list</string>
<string>dict</string>
<string>domain</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>WebPageModule_generateDomain</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -146,13 +146,16 @@ $(document).ready(function(){\n
event.preventDefault();\n
$("#upload_document").dialog("open");\n
});\n
if ($("div.gadget-column").length == 1) {\n
$("a.domain_selected").text($("a.tree-open").text());\n
$("tbody tr td.listbox-table-domain-tree-cell a").each(function(){\n
$("tbody tr td.listbox-table-domain-tree-cell a").each(function(){\n
if ($(this).text().length == 16){\n
$(this).css("padding-right", "101px")\n
}\n
});\n
if ($(this).text().length > 16){\n
$(this).css("padding-right", "35px")\n
}\n
});\n
if ($("div.gadget-column").length == 1) {\n
$("a.domain_selected").text($("a.tree-open").text());\n
$("a.tree-open, a.tree-closed").each(function(){\n
if ($(this).text() == "Starred" || $(this).text() == "Hidden")\n
$(this).html($(this).text() + createBlankSpace(11));\n
......
......@@ -835,7 +835,7 @@ table.listbox-table-domain-tree {\n
\n
td.listbox-table-domain-tree-cell a {\n
padding-bottom: 3px;\n
padding-right: 125.3px;\n
padding-right: 102px;\n
padding-top: 3px;\n
}\n
\n
......
2010-01-05 gabriel
* Add Domains and clean up the code that generates domains
2010-12-28 gabriel
* Added javascript code to be possible choose the theme to Spreadsheet editor and save it
......
148
\ No newline at end of file
149
\ 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