From 2bb876bd23cd9685b38ef4473aa810937e236a39 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Mon, 13 Dec 2010 12:33:56 +0000 Subject: [PATCH] - 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 --- .../WebPageModule_generateDomain.xml | 91 ++++++++++--------- .../WebSection_viewFavoriteWidget.xml | 5 +- .../WebSection_viewSearchBar.xml | 5 +- bt5/erp5_web_ung_theme/bt/revision | 2 +- 4 files changed, 59 insertions(+), 44 deletions(-) diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml index c8a15909e8..6ba1c0bf59 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_generateDomain.xml @@ -54,7 +54,6 @@ 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 """\n -domain_list = []\n \n def appendTempDomain(id, title, property_dict):\n domain = parent.generateTempDomain(id=id)\n @@ -65,56 +64,66 @@ def appendTempDomain(id, title, property_dict):\n domain.setCriterion(key, value)\n domain_list.append(domain)\n \n -if depth == 0:\n - domain = appendTempDomain(\'all_document_list\', \n - \'All Documents\', \n - dict(validation_state=[\'draft\']))\n +domain_list = []\n +\n +if depth == 1:\n + return domain_list\n +\n +domain = appendTempDomain(\'all_document_list\', \n + \'All Documents\', \n + dict(validation_state=[\'draft\']))\n \n - domain = appendTempDomain(\'hidden_document_list\', \n - \'Hidden\', \n - dict(validation_state=[\'hidden\']))\n +domain = appendTempDomain(\'hidden_document_list\', \n + \'Hidden\', \n + dict(validation_state=[\'hidden\']))\n \n - domain = appendTempDomain(\'opened_document_list\', \n - \'Opened by me\', \n - dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n +domain = appendTempDomain(\'opened_document_list\', \n + \'Opened by me\', \n + dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n \n - domain = appendTempDomain(\'owner_document_list\', \n - \'Owned by me\',\n - dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n +domain = appendTempDomain(\'owner_document_list\', \n + \'Owned by me\',\n + dict(local_roles=\'Owner\', validation_state=[\'draft\']))\n \n - domain = appendTempDomain(\'shared_document_list\', \n - \'Shared by me\',\n - dict(validation_state=[\'draft\']))\n +domain = appendTempDomain(\'shared_document_list\', \n + \'Shared by me\',\n + dict(validation_state=[\'draft\']))\n \n - domain = appendTempDomain(\'starred_document_list\',\n - \'Starred\',\n - dict(validation_state=[\'draft\']))\n +domain = appendTempDomain(\'starred_document_list\',\n + \'Starred\',\n + dict(validation_state=[\'draft\']))\n \n - domain = appendTempDomain(\'trash_document_list\',\n - \'Trash\',\n - dict(validation_state=[\'deleted\']))\n +domain = appendTempDomain(\'trash_document_list\',\n + \'Trash\',\n + dict(validation_state=[\'deleted\']))\n \n - domain = parent.generateTempDomain(id=\'webpage_module_list\')\n - domain.edit(title=\'Document by Type\',\n - list_method=\'WebPageModule_getDocumentListFiltered\',\n - domain_generator_method_id = script.id)\n - domain_list.append(domain)\n +domain = parent.generateTempDomain(id=\'webpage_module_list\')\n +domain.edit(title=\'Document by Type\',\n + list_method=\'WebPageModule_getDocumentListFiltered\',\n + domain_generator_method_id = script.id)\n +domain_list.append(domain)\n \n - # XXX - Review code to be more dynamic\n - webpage_subdomain = domain.generateTempDomain(id=\'subWebPage\')\n - webpage_subdomain.edit(title="Web Page",\n - list_method=\'WebPageModule_getWebPageListFiltered\',\n - domain_generator_method_id=script.id)\n +# XXX - Review code to be more dynamic\n +webpage_subdomain = domain.generateTempDomain(id=\'subWebPage\')\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 + domain_generator_method_id=script.id)\n \n - webtable_subdomain = domain.generateTempDomain(id=\'subWebTable\')\n - webtable_subdomain.edit(title="Web Table",\n - list_method=\'WebPageModule_getWebTableListFiltered\',\n - domain_generator_method_id=script.id)\n +webtable_subdomain = domain.generateTempDomain(id=\'subWebTable\')\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 + domain_generator_method_id=script.id)\n \n - webillustration_subdomain = domain.generateTempDomain(id=\'subWebIllustraion\')\n - webillustration_subdomain.edit(title="Web Illustration",\n - list_method=\'WebPageModule_getWebIllustrationListFiltered\',\n - domain_generator_method_id=script.id)\n +webillustration_subdomain = domain.generateTempDomain(id=\'subWebIllustraion\')\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 + domain_generator_method_id=script.id)\n \n return domain_list\n </string> </value> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewFavoriteWidget.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewFavoriteWidget.xml index 3523e83e59..c55011d6f4 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewFavoriteWidget.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewFavoriteWidget.xml @@ -43,7 +43,10 @@ has_editor python: current_url != portal_path;">\n <a class="domain_selected"></a>\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 tal:condition="python: has_editor">\n <a tal:attributes="href python: request.get(\'URL\') + \'?editable_mode:int=1\'">Refresh</a>\n diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewSearchBar.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewSearchBar.xml index 4efc384c64..b40924e8f4 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewSearchBar.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewSearchBar.xml @@ -40,7 +40,10 @@ enctype string:multipart/form-data;\n portal_path python:website.absolute_url();\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 </a>\n <a id=\'loading_message\'>Loading...</a>\n diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision index 2702ba3d43..d2c5ed2124 100644 --- a/bt5/erp5_web_ung_theme/bt/revision +++ b/bt5/erp5_web_ung_theme/bt/revision @@ -1 +1 @@ -115 \ No newline at end of file +116 \ No newline at end of file -- 2.30.9