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