Compare commits
No commits in common. "856e3070687b3840934aa3fc893c52d4e251b011" and "915f9ed243ae15ade0494af115a74da636427c92" have entirely different histories.
856e307068
...
915f9ed243
Binary file not shown.
Before Width: | Height: | Size: 1.2 MiB |
@ -6,7 +6,6 @@ from django.conf import settings
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from pages import access
|
||||
import pages.parameter
|
||||
from .help import actionbar as actionbar_add_help
|
||||
import mycreole
|
||||
import pages
|
||||
@ -23,11 +22,6 @@ INDEX_UID = 'index'
|
||||
NAVIGATION_ENTRY_UID = 'navigation-%s'
|
||||
|
||||
|
||||
def cms_mode_active(request):
|
||||
user_logged_in = request.user.is_authenticated
|
||||
return pages.parameter.get(pages.parameter.CMS_MODE) and not user_logged_in
|
||||
|
||||
|
||||
def context_adaption(context, request, **kwargs):
|
||||
caller_name = inspect.currentframe().f_back.f_code.co_name
|
||||
try:
|
||||
@ -62,26 +56,24 @@ def navigationbar(context, request, caller_name, **kwargs):
|
||||
|
||||
def menubar(context, request, caller_name, **kwargs):
|
||||
bar = context[context.MENUBAR]
|
||||
if not cms_mode_active(request):
|
||||
menubar_users(bar, request)
|
||||
add_help_menu(request, bar, "current_help_page" in kwargs)
|
||||
menubar_users(bar, request)
|
||||
add_help_menu(request, bar, "current_help_page" in kwargs)
|
||||
add_index_menu(request, bar, kwargs.get("rel_path", ''))
|
||||
finalise_bar(request, bar)
|
||||
|
||||
|
||||
def actionbar(context, request, caller_name, **kwargs):
|
||||
bar = context[context.ACTIONBAR]
|
||||
if not cms_mode_active(request):
|
||||
if caller_name == 'page':
|
||||
if access.write_page(request, kwargs["rel_path"]):
|
||||
add_edit_menu(request, bar, kwargs["rel_path"])
|
||||
if access.modify_attachment(request, kwargs["rel_path"]):
|
||||
add_manageupload_menu(request, bar, kwargs['upload_path'])
|
||||
if access.read_page(request, kwargs["rel_path"]):
|
||||
add_meta_menu(request, bar, kwargs["rel_path"])
|
||||
elif caller_name == 'helpview':
|
||||
actionbar_add_help(context, request, **kwargs)
|
||||
finalise_bar(request, bar)
|
||||
if caller_name == 'page':
|
||||
if access.write_page(request, kwargs["rel_path"]):
|
||||
add_edit_menu(request, bar, kwargs["rel_path"])
|
||||
if access.modify_attachment(request, kwargs["rel_path"]):
|
||||
add_manageupload_menu(request, bar, kwargs['upload_path'])
|
||||
if access.read_page(request, kwargs["rel_path"]):
|
||||
add_meta_menu(request, bar, kwargs["rel_path"])
|
||||
elif caller_name == 'helpview':
|
||||
actionbar_add_help(context, request, **kwargs)
|
||||
finalise_bar(request, bar)
|
||||
|
||||
|
||||
def add_back_menu(request, bar):
|
||||
|
@ -1,36 +0,0 @@
|
||||
import config
|
||||
from django.conf import settings
|
||||
import importlib
|
||||
import os
|
||||
|
||||
CMS_MODE = "CMS_MODE"
|
||||
|
||||
|
||||
def no_access(*args, **kwargs):
|
||||
return False
|
||||
|
||||
|
||||
DEFAULTS = {
|
||||
CMS_MODE: True,
|
||||
}
|
||||
|
||||
|
||||
def __get_object_by_name__(object_name):
|
||||
class_data = object_name.split(".")
|
||||
module_path = ".".join(class_data[:-1])
|
||||
class_str = class_data[-1]
|
||||
#
|
||||
module = importlib.import_module(module_path)
|
||||
return getattr(module, class_str)
|
||||
|
||||
|
||||
def get(key):
|
||||
# take data from config, settings or defaults
|
||||
try:
|
||||
data = getattr(config, key)
|
||||
except AttributeError:
|
||||
try:
|
||||
data = getattr(settings, key)
|
||||
except AttributeError:
|
||||
data = DEFAULTS.get(key)
|
||||
return data
|
@ -20,7 +20,6 @@ from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
import pages.views
|
||||
import users
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
@ -38,7 +37,6 @@ urlpatterns = [
|
||||
path('mycreole/', include('mycreole.urls')),
|
||||
# users
|
||||
path('users/', include('users.urls')),
|
||||
path('login/', users.views.login, name='users-login-root'),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
Loading…
x
Reference in New Issue
Block a user