Commit 0c884976 authored by Gabriel Monnerat's avatar Gabriel Monnerat

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
parent 1ec46634
...@@ -50,14 +50,19 @@ ...@@ -50,14 +50,19 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 \n
if depth == 0:\n if depth == 0:\n
url = \'publication_section\'\n url = \'publication_section\'\n
context.log(script.id, \'parent = %r, context = %r, url = %r, depth = %r\' % (parent, context, url, depth))\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 = parent.generateTempDomain(id=\'all_document_list\')\n
domain.edit(title=\'All Documents\',\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 domain_list.append(domain)\n
\n \n
category_list = context.portal_categories.getCategoryValue(url).contentValues()\n category_list = context.portal_categories.getCategoryValue(url).contentValues()\n
...@@ -73,8 +78,25 @@ if depth == 0:\n ...@@ -73,8 +78,25 @@ if depth == 0:\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_list.append(domain)\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 \n
return domain_list\n return domain_list\n
</string> </value> </string> </value>
...@@ -125,6 +147,9 @@ return domain_list\n ...@@ -125,6 +147,9 @@ return domain_list\n
<string>category_list</string> <string>category_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>category</string> <string>category</string>
<string>webpage_subdomain</string>
<string>webtable_subdomain</string>
<string>webillustration_subdomain</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -50,7 +50,13 @@ ...@@ -50,7 +50,13 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 validation_state=["draft"])\n
</string> </value> </string> </value>
</item> </item>
......
<?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>
<?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>
<?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>
...@@ -66,7 +66,7 @@ if uid_list is not None:\n ...@@ -66,7 +66,7 @@ if uid_list is not None:\n
object.setPublicationSection("trash")\n object.setPublicationSection("trash")\n
object.delete()\n object.delete()\n
\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> </string> </value>
</item> </item>
<item> <item>
......
2010-12-07 gabriel
* Added feature to be possible filter the Listbox according to the Portal Type
2010-12-06 gabriel 2010-12-06 gabriel
* refactor the script WebSection_deleteObjectList to remove completely the objects with state 'deleted'. * refactor the script WebSection_deleteObjectList to remove completely the objects with state 'deleted'.
......
104 105
\ 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