backoffice: sync with wcs backoffice/admin unification (#6726)
This commit is contained in:
parent
27ff9c6c06
commit
09e9187116
|
@ -6,7 +6,6 @@ from quixote.html import htmltext, TemplateIO
|
|||
|
||||
import wcs.admin.root
|
||||
import wcs.root
|
||||
from wcs.admin.menu import *
|
||||
from wcs.roles import get_user_roles
|
||||
|
||||
from qommon import errors, get_cfg
|
||||
|
@ -14,6 +13,7 @@ from qommon.form import *
|
|||
|
||||
from wcs.formdef import FormDef
|
||||
from wcs.categories import Category
|
||||
from qommon.backoffice.menu import html_top
|
||||
|
||||
from events import get_default_event_tags
|
||||
import re
|
||||
|
|
|
@ -5,27 +5,21 @@ from quixote.directory import Directory
|
|||
from quixote.html import TemplateIO, htmltext
|
||||
|
||||
from qommon.publisher import get_publisher_class
|
||||
from qommon.admin.menu import is_accessible
|
||||
|
||||
import wcs.backoffice.root
|
||||
import wcs.root
|
||||
from wcs.admin.menu import *
|
||||
from wcs.categories import Category
|
||||
from wcs.formdef import FormDef
|
||||
|
||||
from wcs.backoffice.root import FormsDirectory, WorkflowsDirectory
|
||||
|
||||
from qommon import get_cfg
|
||||
from qommon import get_cfg, errors
|
||||
from qommon.form import *
|
||||
|
||||
class BackofficeRootDirectory(wcs.backoffice.root.RootDirectory):
|
||||
_q_exports = ['', 'home', 'statistics']
|
||||
|
||||
menu_items = [
|
||||
('home', N_('Pending Forms')),
|
||||
('forms/', N_('Forms Workshop'), FormsDirectory.is_accessible),
|
||||
('workflows/', N_('Workflows Workshop'), WorkflowsDirectory.is_accessible),
|
||||
('/', N_('WCS Form Server'))]
|
||||
|
||||
def get_intro_text(self):
|
||||
return _('Welcome on Au Quotidien back office interface')
|
||||
|
||||
|
@ -44,10 +38,10 @@ class BackofficeRootDirectory(wcs.backoffice.root.RootDirectory):
|
|||
return r.getvalue()
|
||||
|
||||
def _q_lookup(self, component):
|
||||
if component == 'forms':
|
||||
return FormsDirectory()
|
||||
if component == 'workflows':
|
||||
return WorkflowsDirectory()
|
||||
if component in [str(x[0]).strip('/') for x in self.menu_items]:
|
||||
if not is_accessible(component):
|
||||
raise errors.AccessForbiddenError()
|
||||
return getattr(self, component)
|
||||
return FormPage(component)
|
||||
|
||||
class FormPage(wcs.backoffice.root.FormPage):
|
||||
|
|
Reference in New Issue