Commit 9936258c authored by Ivan Tyagov's avatar Ivan Tyagov

Use only one script to get active knowledge pad for context everywhere.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42614 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5d2f1798
......@@ -41,8 +41,7 @@
tal:define="global mode python: options.get(\'mode\', request.get(\'gadget_mode\', \'erp5_front\'));\n
global default_pad_group python: options.get(\'default_pad_group\', request.get(\'gadget_default_pad_group\', \'\'));\n
kw python: dict(mode=mode, default_pad_group=default_pad_group);\n
knowledge_pads python: here.ERP5Site_getKnowledgePadListForUser(**kw);\n
struct python: here.ERP5Site_getActiveKnowledgePadForUser(knowledge_pads, **kw);\n
struct python: here.ERP5Site_getActiveKnowledgePadForUser(**kw);\n
global active_knowledge_pad python: struct[0];\n
global knowledge_pads python: struct[1];\n
global columns python: options.get(\'columns\', 3);\n
......
......@@ -56,6 +56,8 @@ MARKER = (\'\', None,)\n
visible_state_list = [\'visible\', \'public\']\n
isAnon = context.portal_membership.isAnonymousUser()\n
\n
knowledge_pads = context.ERP5Site_getKnowledgePadListForUser(mode=mode,\n
default_pad_group=default_pad_group)\n
if isAnon and len(knowledge_pads)>=1:\n
# for anonymous we return the first one found \n
return knowledge_pads[0], knowledge_pads\n
......@@ -108,7 +110,7 @@ return None, knowledge_pads\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>knowledge_pads = [], mode = None, default_pad_group=None</string> </value>
<value> <string>mode = None, default_pad_group=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -55,11 +55,9 @@ portal = context.getPortalObject()\n
\n
if active_knowledge_pad is None and js_call:\n
# only for asynchronous checks\n
kw = dict(mode=mode, \n
default_pad_group=default_pad_group)\n
knowledge_pads = context.ERP5Site_getKnowledgePadListForUser(**kw)\n
active_knowledge_pad, knowledge_pads = context.ERP5Site_getActiveKnowledgePadForUser(\n
knowledge_pads, **kw)\n
mode=mode, \n
default_pad_group=default_pad_group)\n
\n
if active_knowledge_pad is None:\n
# no pad but it may be reindexed in an activity now, check by tag\n
......
685
\ No newline at end of file
686
\ No newline at end of file
......@@ -53,9 +53,7 @@
<value> <string>"""\n
Add (if not present) gadgets to current knowledge pad.\n
"""\n
\n
all_pads = [x for x in context.ERP5Site_getKnowledgePadListForUser(mode, default_pad_group)]\n
active_pad, all_pads = context.ERP5Site_getActiveKnowledgePadForUser(all_pads, mode, default_pad_group)\n
active_pad, all_pads = context.ERP5Site_getActiveKnowledgePadForUser(mode, default_pad_group)\n
\n
active_pad = active_pad.getObject()\n
gadget_list = active_pad.contentValues(filter={\'portal_type\': \'Knowledge Box\'})\n
......
26
\ No newline at end of file
28
\ 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