Commit 2bb876bd authored by Gabriel Monnerat's avatar Gabriel Monnerat

- refactor to return a empty list when the depth is equal 1.

- changed href to open the section "All Documents"

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41387 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent db526020
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
This script generates a sections list to filter the document on UNG Docs.\n This script generates a sections list to filter the document on UNG Docs.\n
XXX - The generation of domains should be more dynamic because some domains is create manually.\n XXX - The generation of domains should be more dynamic because some domains is create manually.\n
"""\n """\n
domain_list = []\n
\n \n
def appendTempDomain(id, title, property_dict):\n def appendTempDomain(id, title, property_dict):\n
domain = parent.generateTempDomain(id=id)\n domain = parent.generateTempDomain(id=id)\n
...@@ -65,54 +64,64 @@ def appendTempDomain(id, title, property_dict):\n ...@@ -65,54 +64,64 @@ def appendTempDomain(id, title, property_dict):\n
domain.setCriterion(key, value)\n domain.setCriterion(key, value)\n
domain_list.append(domain)\n domain_list.append(domain)\n
\n \n
if depth == 0:\n domain_list = []\n
domain = appendTempDomain(\'all_document_list\', \n \n
if depth == 1:\n
return domain_list\n
\n
domain = appendTempDomain(\'all_document_list\', \n
\'All Documents\', \n \'All Documents\', \n
dict(validation_state=[\'draft\']))\n dict(validation_state=[\'draft\']))\n
\n \n
domain = appendTempDomain(\'hidden_document_list\', \n domain = appendTempDomain(\'hidden_document_list\', \n
\'Hidden\', \n \'Hidden\', \n
dict(validation_state=[\'hidden\']))\n dict(validation_state=[\'hidden\']))\n
\n \n
domain = appendTempDomain(\'opened_document_list\', \n domain = appendTempDomain(\'opened_document_list\', \n
\'Opened by me\', \n \'Opened by me\', \n
dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n
\n \n
domain = appendTempDomain(\'owner_document_list\', \n domain = appendTempDomain(\'owner_document_list\', \n
\'Owned by me\',\n \'Owned by me\',\n
dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n
\n \n
domain = appendTempDomain(\'shared_document_list\', \n domain = appendTempDomain(\'shared_document_list\', \n
\'Shared by me\',\n \'Shared by me\',\n
dict(validation_state=[\'draft\']))\n dict(validation_state=[\'draft\']))\n
\n \n
domain = appendTempDomain(\'starred_document_list\',\n domain = appendTempDomain(\'starred_document_list\',\n
\'Starred\',\n \'Starred\',\n
dict(validation_state=[\'draft\']))\n dict(validation_state=[\'draft\']))\n
\n \n
domain = appendTempDomain(\'trash_document_list\',\n domain = appendTempDomain(\'trash_document_list\',\n
\'Trash\',\n \'Trash\',\n
dict(validation_state=[\'deleted\']))\n dict(validation_state=[\'deleted\']))\n
\n \n
domain = parent.generateTempDomain(id=\'webpage_module_list\')\n domain = parent.generateTempDomain(id=\'webpage_module_list\')\n
domain.edit(title=\'Document by Type\',\n domain.edit(title=\'Document by Type\',\n
list_method=\'WebPageModule_getDocumentListFiltered\',\n list_method=\'WebPageModule_getDocumentListFiltered\',\n
domain_generator_method_id = script.id)\n domain_generator_method_id = script.id)\n
domain_list.append(domain)\n domain_list.append(domain)\n
\n \n
# XXX - Review code to be more dynamic\n # XXX - Review code to be more dynamic\n
webpage_subdomain = domain.generateTempDomain(id=\'subWebPage\')\n webpage_subdomain = domain.generateTempDomain(id=\'subWebPage\')\n
webpage_subdomain.edit(title="Web Page",\n webpage_subdomain.edit(title="Web Page",\n
membership_criterion_base_category = ("webpage_module_list"),\n
membership_criterion_category = ("webpage_module_list"),\n
list_method=\'WebPageModule_getWebPageListFiltered\',\n list_method=\'WebPageModule_getWebPageListFiltered\',\n
domain_generator_method_id=script.id)\n domain_generator_method_id=script.id)\n
\n \n
webtable_subdomain = domain.generateTempDomain(id=\'subWebTable\')\n webtable_subdomain = domain.generateTempDomain(id=\'subWebTable\')\n
webtable_subdomain.edit(title="Web Table",\n webtable_subdomain.edit(title="Web Table",\n
membership_criterion_base_category = ("webpage_module_list"),\n
membership_criterion_category = ("webpage_module_list"),\n
list_method=\'WebPageModule_getWebTableListFiltered\',\n list_method=\'WebPageModule_getWebTableListFiltered\',\n
domain_generator_method_id=script.id)\n domain_generator_method_id=script.id)\n
\n \n
webillustration_subdomain = domain.generateTempDomain(id=\'subWebIllustraion\')\n webillustration_subdomain = domain.generateTempDomain(id=\'subWebIllustraion\')\n
webillustration_subdomain.edit(title="Web Illustration",\n webillustration_subdomain.edit(title="Web Illustration",\n
membership_criterion_base_category = ("webpage_module_list"),\n
membership_criterion_category = ("webpage_module_list"),\n
list_method=\'WebPageModule_getWebIllustrationListFiltered\',\n list_method=\'WebPageModule_getWebIllustrationListFiltered\',\n
domain_generator_method_id=script.id)\n domain_generator_method_id=script.id)\n
\n \n
......
...@@ -43,7 +43,10 @@ ...@@ -43,7 +43,10 @@
has_editor python: current_url != portal_path;">\n has_editor python: current_url != portal_path;">\n
<a class="domain_selected"></a>\n <a class="domain_selected"></a>\n
<tal:block tal:condition="python: not has_editor">\n <tal:block tal:condition="python: not has_editor">\n
<a tal:attributes="href python: request.get(\'URL\') + \'?reset:int=1\'">Refresh</a>\n <a tal:attributes="href python: request.get(\'URL\') + \'?domain_url=ung_domain/all_document_list&\' + \n
\'form_id=erp5_web_ung_layout&\' + \n
\'list_selection_name=ung_document_list_selection&\' + \n
\'domain_depth:int=0&reset:int=1\'">Refresh</a>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: has_editor">\n <tal:block tal:condition="python: has_editor">\n
<a tal:attributes="href python: request.get(\'URL\') + \'?editable_mode:int=1\'">Refresh</a>\n <a tal:attributes="href python: request.get(\'URL\') + \'?editable_mode:int=1\'">Refresh</a>\n
......
...@@ -40,7 +40,10 @@ ...@@ -40,7 +40,10 @@
enctype string:multipart/form-data;\n enctype string:multipart/form-data;\n
portal_path python:website.absolute_url();\n portal_path python:website.absolute_url();\n
has_editor python: here.absolute_url() != portal_path;">\n has_editor python: here.absolute_url() != portal_path;">\n
<a class="ung_docs" tal:attributes="href python: portal_path + \'?reset:int=1\'">\n <a class="ung_docs" tal:attributes="href python: portal_path + \'?domain_url=ung_domain/all_document_list&\' + \n
\'form_id=erp5_web_ung_layout&\' + \n
\'list_selection_name=ung_document_list_selection&\' + \n
\'domain_depth:int=0&reset:int=1\'">\n
<img src="ung_images/ung-logo.gif">\n <img src="ung_images/ung-logo.gif">\n
</a>\n </a>\n
<a id=\'loading_message\'>Loading...</a>\n <a id=\'loading_message\'>Loading...</a>\n
......
115 116
\ 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