Commit 6f2e1bc6 authored by Bartek Górny's avatar Bartek Górny

option "search only my documents" in advanced search (rotten implementation, though)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10424 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 390dc7c8
...@@ -79,9 +79,14 @@ for k,v in args.items():\n ...@@ -79,9 +79,14 @@ for k,v in args.items():\n
cats.append(\'/\'.join((k,v)))\n cats.append(\'/\'.join((k,v)))\n
if cats!=[]:\n if cats!=[]:\n
args[\'category\']=cats\n args[\'category\']=cats\n
context.log(\'args\',args)\n
kw.update(args)\n kw.update(args)\n
\n \n
# a hack because SQLCatalog wants table.key now \n
# dunno if it is a bug or a feature\n
if kw.has_key(\'SearchableText\'):\n
kw[\'full_text.SearchableText\']=kw[\'SearchableText\']\n
kw.pop(\'SearchableText\')\n
\n
cf=kw.get(\'creation_from\')\n cf=kw.get(\'creation_from\')\n
ct=kw.get(\'creation_to\')\n ct=kw.get(\'creation_to\')\n
mf=kw.get(\'modification_from\')\n mf=kw.get(\'modification_from\')\n
...@@ -98,8 +103,18 @@ if mt:\n ...@@ -98,8 +103,18 @@ if mt:\n
wheres.append(\'modification_date<"\'+str(mt)+\'"\')\n wheres.append(\'modification_date<"\'+str(mt)+\'"\')\n
if wheres!=[]:\n if wheres!=[]:\n
kw[\'where_expression\']=\' AND \'.join(wheres)\n kw[\'where_expression\']=\' AND \'.join(wheres)\n
context.log(\'wheres\',kw.get(\'where_expression\',\'x\'))\n \n
return context.portal_catalog(**kw)\n res=context.portal_catalog(**kw)\n
\n
if kw.get(\'mine\')==1: # user wants only his documents\n
from AccessControl import getSecurityManager\n
sm=getSecurityManager()\n
u=sm.getUser()\n
# now we need to filter by owner\n
# some day we will do it in catalog\n
res=[r for r in res if u.allowed(r,(\'Owner\',))]\n
\n
return res\n
]]></string> </value> ]]></string> </value>
...@@ -154,6 +169,7 @@ return context.portal_catalog(**kw)\n ...@@ -154,6 +169,7 @@ return context.portal_catalog(**kw)\n
<string>_getiter_</string> <string>_getiter_</string>
<string>k</string> <string>k</string>
<string>v</string> <string>v</string>
<string>_getitem_</string>
<string>cf</string> <string>cf</string>
<string>ct</string> <string>ct</string>
<string>mf</string> <string>mf</string>
...@@ -161,6 +177,14 @@ return context.portal_catalog(**kw)\n ...@@ -161,6 +177,14 @@ return context.portal_catalog(**kw)\n
<string>wheres</string> <string>wheres</string>
<string>str</string> <string>str</string>
<string>_apply_</string> <string>_apply_</string>
<string>res</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>sm</string>
<string>u</string>
<string>append</string>
<string>$append0</string>
<string>r</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<list> <list>
<string>SearchableText</string> <string>SearchableText</string>
<string>search_mode</string> <string>search_mode</string>
<string>mine</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>CheckBoxField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mine</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Only my documents</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
219 221
\ No newline at end of file \ No newline at end of file
None
\ 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