|
@@ -6,6 +6,7 @@ from django.conf import settings
|
6
|
6
|
from django.utils.translation import gettext as _
|
7
|
7
|
|
8
|
8
|
from pages import access
|
|
9
|
+import pages.parameter
|
9
|
10
|
from .help import actionbar as actionbar_add_help
|
10
|
11
|
import mycreole
|
11
|
12
|
import pages
|
|
@@ -22,6 +23,11 @@ INDEX_UID = 'index'
|
22
|
23
|
NAVIGATION_ENTRY_UID = 'navigation-%s'
|
23
|
24
|
|
24
|
25
|
|
|
26
|
+def cms_mode_active(request):
|
|
27
|
+ user_logged_in = request.user.is_authenticated
|
|
28
|
+ return pages.parameter.get(pages.parameter.CMS_MODE) and not user_logged_in
|
|
29
|
+
|
|
30
|
+
|
25
|
31
|
def context_adaption(context, request, **kwargs):
|
26
|
32
|
caller_name = inspect.currentframe().f_back.f_code.co_name
|
27
|
33
|
try:
|
|
@@ -56,24 +62,26 @@ def navigationbar(context, request, caller_name, **kwargs):
|
56
|
62
|
|
57
|
63
|
def menubar(context, request, caller_name, **kwargs):
|
58
|
64
|
bar = context[context.MENUBAR]
|
59
|
|
- menubar_users(bar, request)
|
60
|
|
- add_help_menu(request, bar, "current_help_page" in kwargs)
|
|
65
|
+ if not cms_mode_active(request):
|
|
66
|
+ menubar_users(bar, request)
|
|
67
|
+ add_help_menu(request, bar, "current_help_page" in kwargs)
|
61
|
68
|
add_index_menu(request, bar, kwargs.get("rel_path", ''))
|
62
|
69
|
finalise_bar(request, bar)
|
63
|
70
|
|
64
|
71
|
|
65
|
72
|
def actionbar(context, request, caller_name, **kwargs):
|
66
|
73
|
bar = context[context.ACTIONBAR]
|
67
|
|
- if caller_name == 'page':
|
68
|
|
- if access.write_page(request, kwargs["rel_path"]):
|
69
|
|
- add_edit_menu(request, bar, kwargs["rel_path"])
|
70
|
|
- if access.modify_attachment(request, kwargs["rel_path"]):
|
71
|
|
- add_manageupload_menu(request, bar, kwargs['upload_path'])
|
72
|
|
- if access.read_page(request, kwargs["rel_path"]):
|
73
|
|
- add_meta_menu(request, bar, kwargs["rel_path"])
|
74
|
|
- elif caller_name == 'helpview':
|
75
|
|
- actionbar_add_help(context, request, **kwargs)
|
76
|
|
- finalise_bar(request, bar)
|
|
74
|
+ if not cms_mode_active(request):
|
|
75
|
+ if caller_name == 'page':
|
|
76
|
+ if access.write_page(request, kwargs["rel_path"]):
|
|
77
|
+ add_edit_menu(request, bar, kwargs["rel_path"])
|
|
78
|
+ if access.modify_attachment(request, kwargs["rel_path"]):
|
|
79
|
+ add_manageupload_menu(request, bar, kwargs['upload_path'])
|
|
80
|
+ if access.read_page(request, kwargs["rel_path"]):
|
|
81
|
+ add_meta_menu(request, bar, kwargs["rel_path"])
|
|
82
|
+ elif caller_name == 'helpview':
|
|
83
|
+ actionbar_add_help(context, request, **kwargs)
|
|
84
|
+ finalise_bar(request, bar)
|
77
|
85
|
|
78
|
86
|
|
79
|
87
|
def add_back_menu(request, bar):
|