From 0c884976c3f11d31ea9da73f1e947aac12ba2230 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Tue, 7 Dec 2010 08:53:38 +0000 Subject: [PATCH] 2010-12-07 gabriel * Added feature to be possible filter the Listbox according to the Portal Type git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41189 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../WebPageModule_generateDomain.xml | 31 ++++- .../WebPageModule_getDocumentListFiltered.xml | 8 +- ...eModule_getWebIllustrationListFiltered.xml | 127 ++++++++++++++++++ .../WebPageModule_getWebPageListFiltered.xml | 127 ++++++++++++++++++ .../WebPageModule_getWebTableListFiltered.xml | 127 ++++++++++++++++++ .../WebSection_deleteObjectList.xml | 2 +- bt5/erp5_web_ung_theme/bt/change_log | 3 + bt5/erp5_web_ung_theme/bt/revision | 2 +- 8 files changed, 421 insertions(+), 6 deletions(-) create mode 100644 bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebIllustrationListFiltered.xml create mode 100644 bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebPageListFiltered.xml create mode 100644 bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebTableListFiltered.xml 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 a8702015e1..6681e3a63b 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 @@ -50,14 +50,19 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>domain_list = []\n + <value> <string>"""\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 +"""\n +domain_list = []\n \n if depth == 0:\n url = \'publication_section\'\n context.log(script.id, \'parent = %r, context = %r, url = %r, depth = %r\' % (parent, context, url, depth))\n domain = parent.generateTempDomain(id=\'all_document_list\')\n domain.edit(title=\'All Documents\',\n - list_method=\'WebPageModule_getDocumentListFiltered\',)\n + list_method=\'WebPageModule_getDocumentListFiltered\',\n + domain_generator_method_id = script.id)\n domain_list.append(domain)\n \n category_list = context.portal_categories.getCategoryValue(url).contentValues()\n @@ -73,8 +78,25 @@ if depth == 0:\n \n domain = parent.generateTempDomain(id=\'webpage_module_list\')\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_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 +\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 +\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 \n return domain_list\n </string> </value> @@ -125,6 +147,9 @@ return domain_list\n <string>category_list</string> <string>_getiter_</string> <string>category</string> + <string>webpage_subdomain</string> + <string>webtable_subdomain</string> + <string>webillustration_subdomain</string> </tuple> </value> </item> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getDocumentListFiltered.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getDocumentListFiltered.xml index aaeadea8ad..b78e28e676 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getDocumentListFiltered.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getDocumentListFiltered.xml @@ -50,7 +50,13 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>return context.portal_catalog(portal_type=["Web Page", "Web Illustration", "Web Table"], \n + <value> <string>"""\n + This script is used by domain to filter all objects from Web Page Module except objects \n + with validation state == \'deleted\'.\n +"""\n +# XXX - the query should returns all object except validation_state == "deleted". \n +# Try use Query or ComplexQuery object for it\n +return context.portal_catalog(portal_type=["Web Page", "Web Illustration", "Web Table"], \n validation_state=["draft"])\n </string> </value> </item> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebIllustrationListFiltered.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebIllustrationListFiltered.xml new file mode 100644 index 0000000000..3280212cef --- /dev/null +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebIllustrationListFiltered.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </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>"""\n + This script is used by domain to filter all Web Illustration objects except objects \n + with validation state == \'deleted\'.\n +"""\n +# XXX - the query should returns Web Illustration objects except validation_state == "deleted". \n +# Try use Query or ComplexQuery object for it\n +return context.portal_catalog(portal_type=["Web Illustration"], \n + validation_state=["draft"])\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>_getattr_</string> + <string>context</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_getWebIllustrationListFiltered</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebPageListFiltered.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebPageListFiltered.xml new file mode 100644 index 0000000000..48ee59fce8 --- /dev/null +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebPageListFiltered.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </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>"""\n + This script is used by domain to filter all Web Page objects except objects \n + with validation state == \'deleted\'.\n +"""\n +# XXX - the query should returns Web Page objects except validation_state == "deleted". \n +# Try use Query or ComplexQuery object for it\n +return context.portal_catalog(portal_type=["Web Page"], \n + validation_state=["draft"])\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>_getattr_</string> + <string>context</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_getWebPageListFiltered</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebTableListFiltered.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebTableListFiltered.xml new file mode 100644 index 0000000000..4b894c56b2 --- /dev/null +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebPageModule_getWebTableListFiltered.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </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>"""\n + This script is used by domain to filter all Web Table objects except objects \n + with validation state == \'deleted\'.\n +"""\n +# XXX - the query should returns Web Table objects except validation_state == "deleted". \n +# Try use Query or ComplexQuery object for it\n +return context.portal_catalog(portal_type=["Web Table"], \n + validation_state=["draft"])\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>_getattr_</string> + <string>context</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_getWebTableListFiltered</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml index 8654851768..7ed1ad5b5b 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml @@ -66,7 +66,7 @@ if uid_list is not None:\n object.setPublicationSection("trash")\n object.delete()\n \n -return context.ERP5Site_redirect(website_url, keep_items={"reset": 1})\n +return context.ERP5Site_redirect(context.REQUEST.get("HTTP_REFERER"))\n </string> </value> </item> <item> diff --git a/bt5/erp5_web_ung_theme/bt/change_log b/bt5/erp5_web_ung_theme/bt/change_log index 89fca7a87b..f20d52c5f4 100644 --- a/bt5/erp5_web_ung_theme/bt/change_log +++ b/bt5/erp5_web_ung_theme/bt/change_log @@ -1,3 +1,6 @@ +2010-12-07 gabriel +* Added feature to be possible filter the Listbox according to the Portal Type + 2010-12-06 gabriel * refactor the script WebSection_deleteObjectList to remove completely the objects with state 'deleted'. diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision index dec4c59e4a..ffda4e73f0 100644 --- a/bt5/erp5_web_ung_theme/bt/revision +++ b/bt5/erp5_web_ung_theme/bt/revision @@ -1 +1 @@ -104 \ No newline at end of file +105 \ No newline at end of file -- 2.30.9