Commit 06de7a8b authored by Jean-Paul Smets's avatar Jean-Paul Smets

Various bug fixes. Use of new document groups.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13353 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ac1c8b0
...@@ -97,14 +97,13 @@ else:\n ...@@ -97,14 +97,13 @@ else:\n
if params:\n if params:\n
sstr = params.get(\'SearchableText\')\n sstr = params.get(\'SearchableText\')\n
\n \n
context.log(sstr)\n
if not sstr: return []\n if not sstr: return []\n
\n \n
args = context.parseSearchString(sstr)\n args = context.parseSearchString(sstr)\n
\n \n
# if no portal type specified, take all\n # if no portal type specified, take all\n
if not args.has_key(\'portal_type\') or args[\'portal_type\'] == ():\n if not args.has_key(\'portal_type\') or args[\'portal_type\'] == ():\n
args[\'portal_type\'] = context.Base_getSearchableTypeList()\n args[\'portal_type\'] = context.getPortalDocumentTypeList()\n
\n \n
# process searching by category\n # process searching by category\n
cats = []\n cats = []\n
...@@ -145,7 +144,6 @@ if wheres != []:\n ...@@ -145,7 +144,6 @@ if wheres != []:\n
# now we search\n # now we search\n
# any language?\n # any language?\n
if args.get(\'language\') == \'0\': args.pop(\'language\')\n if args.get(\'language\') == \'0\': args.pop(\'language\')\n
context.log(\'SEARCH:\',args)\n
res = context.portal_catalog(**args)\n res = context.portal_catalog(**args)\n
\n \n
# user wants only his documents\n # user wants only his documents\n
......
...@@ -90,7 +90,7 @@ try:\n ...@@ -90,7 +90,7 @@ try:\n
except AttributeError:\n except AttributeError:\n
txt = \'\'\n txt = \'\'\n
\n \n
argument_names = (\'SearchableText\', \'SearchableText_any\', \'SearchableText_all\', \'SearchableText_phrase\')\n argument_names = (\'advanced_search_text\', \'title\', \'reference\', \'SearchableText\', \'SearchableText_any\', \'SearchableText_all\', \'SearchableText_phrase\')\n
\n \n
# a quick hack because sometimes we get a list\n # a quick hack because sometimes we get a list\n
params = [selection.params.get(name, \'\') for name in argument_names]\n params = [selection.params.get(name, \'\') for name in argument_names]\n
......
...@@ -90,8 +90,6 @@ if kw[\'portal_type\'] == \'\':\n ...@@ -90,8 +90,6 @@ if kw[\'portal_type\'] == \'\':\n
\n \n
doc = context.portal_contributions.newContent(file=file, **kw)\n doc = context.portal_contributions.newContent(file=file, **kw)\n
\n \n
context.log(doc.getId(), doc.getRelativeUrl())\n
\n
msg = translateString("${portal_type} created successfully.", mapping = {\'portal_type\':doc.getPortalType()})\n msg = translateString("${portal_type} created successfully.", mapping = {\'portal_type\':doc.getPortalType()})\n
return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':msg})\n return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':msg})\n
\n \n
......
...@@ -95,7 +95,10 @@ for i in range(1):\n ...@@ -95,7 +95,10 @@ for i in range(1):\n
z += 1\n z += 1\n
sub_field_list.append(new_dict)\n sub_field_list.append(new_dict)\n
\n \n
section_list = context.getFunctionList()\n # WARNING This code is very dangerous and ad hoc\n
# But it was the only way to make parallel list field\n
# work in this case \n
section_list = context.aq_parent.aq_parent.getFunctionList()\n
section_list.reverse()\n section_list.reverse()\n
for value in section_list:\n for value in section_list:\n
new_dict = default_sub_field_property_dict.copy()\n new_dict = default_sub_field_property_dict.copy()\n
......
...@@ -95,7 +95,10 @@ for i in range(1):\n ...@@ -95,7 +95,10 @@ for i in range(1):\n
z += 1\n z += 1\n
sub_field_list.append(new_dict)\n sub_field_list.append(new_dict)\n
\n \n
section_list = context.getGroupList()\n # WARNING This code is very dangerous and ad hoc\n
# But it was the only way to make parallel list field\n
# work in this case \n
section_list = context.aq_parent.aq_parent.getGroupList()\n
section_list.reverse()\n section_list.reverse()\n
for value in section_list:\n for value in section_list:\n
new_dict = default_sub_field_property_dict.copy()\n new_dict = default_sub_field_property_dict.copy()\n
......
...@@ -95,7 +95,10 @@ for i in range(1):\n ...@@ -95,7 +95,10 @@ for i in range(1):\n
z += 1\n z += 1\n
sub_field_list.append(new_dict)\n sub_field_list.append(new_dict)\n
\n \n
section_list = context.getSiteList()\n # WARNING This code is very dangerous and ad hoc\n
# But it was the only way to make parallel list field\n
# work in this case \n
section_list = context.aq_parent.aq_parent.getSiteList()\n
section_list.reverse()\n section_list.reverse()\n
for value in section_list:\n for value in section_list:\n
new_dict = default_sub_field_property_dict.copy()\n new_dict = default_sub_field_property_dict.copy()\n
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>bottom</string> </key>
<value> <value>
<list> <list>
<string>html_representation</string> <string>html_representation</string>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>my_title</string> <string>my_title</string>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
<list> <list>
<string>my_reference</string> <string>my_reference</string>
......
...@@ -68,7 +68,34 @@ ...@@ -68,7 +68,34 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>return context.getPortalDocumentTypeList() + (\'Conference\', \'Project\') # XXX-JPS What is this hardcoded stuff ?\n <value> <string>"""\n
This method returns the list of searchable types\n
from a document management point of view.\n
\n
The result is translated and cached.\n
\n
NOTE: some hardcoded values need to be moved\n
to preferences\n
"""\n
def getSearchableTypeList(language):\n
type_list = list(context.getPortalDocumentTypeList())\n
# We add here hardcoded types\n
types_tools = context.portal_types\n
type_ids = types_tools.objectIds()\n
if \'Query\' in type_ids:\n
type_list.append(\'Query\')\n
if \'Project\' in type_ids:\n
type_list.append(\'Project\')\n
if \'Conference\' in type_ids:\n
type_list.append(\'Conference\')\n
type_list.sort()\n
return type_list\n
\n
from Products.ERP5Type.Cache import CachingMethod\n
language = context.Localizer.get_selected_language()\n
method = CachingMethod(getSearchableTypeList, (\'WebSite_getSearchableTypeList\'))\n
\n
return method(language)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -117,8 +144,13 @@ ...@@ -117,8 +144,13 @@
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>getSearchableTypeList</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>language</string>
<string>method</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -135,7 +167,7 @@ ...@@ -135,7 +167,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Base_getSearchableTypeList</string> </value> <value> <string>ERP5Site_getSearchableDocumentTypeList</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -75,6 +75,7 @@ depending on whether refresh was successful.\n ...@@ -75,6 +75,7 @@ depending on whether refresh was successful.\n
This is called from interaction workflow, upon every edit\n This is called from interaction workflow, upon every edit\n
can be called regularly from portal_alarms, or something like that.\n can be called regularly from portal_alarms, or something like that.\n
"""\n """\n
context.resetTopObject()\n
\n \n
if context.getUrlProtocol() is None or context.getUrlString() is None:\n if context.getUrlProtocol() is None or context.getUrlString() is None:\n
context.log("Incomplete url in %s" % context.getRelativeUrl(),context.getQualifiedUrl())\n context.log("Incomplete url in %s" % context.getRelativeUrl(),context.getQualifiedUrl())\n
...@@ -83,9 +84,9 @@ else:\n ...@@ -83,9 +84,9 @@ else:\n
res = context.spiderSource()\n res = context.spiderSource()\n
\n \n
if res and context.getSimulationState() == \'draft\':\n if res and context.getSimulationState() == \'draft\':\n
context.getPortalObject().portal_workflow.doActionFor(context, \'publish_action\')\n context.publish()\n
if not res and context.getSimulationState() == \'public\':\n if not res and context.getSimulationState() == \'public\':\n
context.getPortalObject().portal_workflow.doActionFor(context, \'retract_action\')\n context.retract()\n
\n \n
context.reindexObject()\n context.reindexObject()\n
</string> </value> </string> </value>
...@@ -106,6 +107,15 @@ context.reindexObject()\n ...@@ -106,6 +107,15 @@ context.reindexObject()\n
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>*args,**kwargs</string> </value> <value> <string>*args,**kwargs</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
<value> <value>
......
...@@ -74,7 +74,8 @@ Public interface to ExternalDocument_spiderAndSetState script.\n ...@@ -74,7 +74,8 @@ Public interface to ExternalDocument_spiderAndSetState script.\n
\n \n
context.resetTopObject()\n context.resetTopObject()\n
context.ExternalDocument_spiderAndSetState()\n context.ExternalDocument_spiderAndSetState()\n
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'/view?portal_status_message=Done\')\n msg = context.Base_translateString(\'Done\')\n
return context.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -93,6 +94,14 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'/view?portal ...@@ -93,6 +94,14 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'/view?portal
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
<value> <value>
...@@ -119,6 +128,8 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'/view?portal ...@@ -119,6 +128,8 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'/view?portal
<tuple> <tuple>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>msg</string>
<string>dict</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>style_cache</string> </value>
</item>
<item> <item>
<key> <string>__ac_local_roles__</string> </key> <key> <string>__ac_local_roles__</string> </key>
<value> <value>
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>style_cache</string> </value>
</item>
<item> <item>
<key> <string>__ac_local_roles__</string> </key> <key> <string>__ac_local_roles__</string> </key>
<value> <value>
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>style_cache</string> </value>
</item>
<item> <item>
<key> <string>__ac_local_roles__</string> </key> <key> <string>__ac_local_roles__</string> </key>
<value> <value>
......
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