Commit 9a32f14a authored by Ivan Tyagov's avatar Ivan Tyagov

Use preference API.

Do not show tab navigation when user is not actually allowed to switch between tabds (i.e. pads).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40948 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d7965fff
......@@ -50,12 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>user_pref = None\n
global_preference_list = context.portal_preferences.searchFolder(portal_type=\'Preference\',\n
preference_state=\'global\')\n
if len(global_preference_list):\n
user_pref = global_preference_list[0].getObject()\n
return user_pref\n
<value> <string>return context.portal_preferences.getActivePreference()\n
</string> </value>
</item>
<item>
......@@ -88,13 +83,8 @@ return user_pref\n
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>None</string>
<string>user_pref</string>
<string>_getattr_</string>
<string>context</string>
<string>global_preference_list</string>
<string>len</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -87,7 +87,6 @@ for knowledge_pad in knowledge_pads:\n
return knowledge_pad, knowledge_pads\n
elif publication_section == None and default_pad_group in MARKER and pad_state in visible_state_list:\n
# ERP5 Site front gadget \n
\n
return knowledge_pad, knowledge_pads \n
\n
\n
......
......@@ -50,7 +50,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>def filterKnowledgePadListForContext(results, mode, \n
<value> <string>request = context.REQUEST\n
isAnon = context.portal_membership.isAnonymousUser()\n
isAnonymousKnowledgePadUsed = request.get(\'is_anonymous_knowledge_pad_used\', 0);\n
\n
def filterKnowledgePadListForContext(results, mode, \n
default_pad_group):\n
# when we use URL as a way to determine site\'s language do not\n
# use (especially for Web Site\'s root) current context which is the language\n
......@@ -74,9 +78,7 @@
x.getGroup() == default_pad_group, results)\n
return results\n
\n
request = context.REQUEST\n
isAnon = context.portal_membership.isAnonymousUser()\n
isAnonymousKnowledgePadUsed = request.get(\'is_anonymous_knowledge_pad_used\', 0);\n
\n
kw = {\'portal_type\': \'Knowledge Pad\',\n
\'sort_on\': ((\'creation_date\', \'ascending\',),),\n
\'limit\': 50,}\n
......@@ -109,6 +111,7 @@ if active_pad is not None and active_pad.getValidationState() != \'deleted\':\n
results = filterKnowledgePadListForContext(results, mode, \n
default_pad_group)\n
\n
\n
if not len(results) and not isAnon:\n
# try getting default knowledge pads for user from global site preference\n
user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n
......@@ -163,12 +166,12 @@ return results\n
<tuple>
<string>mode</string>
<string>default_pad_group</string>
<string>filterKnowledgePadListForContext</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
<string>isAnon</string>
<string>isAnonymousKnowledgePadUsed</string>
<string>filterKnowledgePadListForContext</string>
<string>kw</string>
<string>_apply_</string>
<string>results</string>
......
......@@ -59,11 +59,9 @@
<tal:block tal:condition="python: not createDefaultPadForUser and \n
not waitForActivitiesOnServer and\n
active_knowledge_pad is not None">\n
\n
<!-- Pad navigation -->\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/navigation"/>\n
\n
<tal:block tal:condition="not: isAnon"> \n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/navigation"/>\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/knowledge_pad_security_check"/> \n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/disable_server_integration"/>\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/disable_server_integration"/> \n
......
633
\ No newline at end of file
634
\ 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