5 |
5 |
from quixote.html import TemplateIO, htmltext
|
6 |
6 |
|
7 |
7 |
from qommon.publisher import get_publisher_class
|
|
8 |
from qommon.admin.menu import is_accessible
|
8 |
9 |
|
9 |
10 |
import wcs.backoffice.root
|
10 |
11 |
import wcs.root
|
11 |
|
from wcs.admin.menu import *
|
12 |
12 |
from wcs.categories import Category
|
13 |
13 |
from wcs.formdef import FormDef
|
14 |
14 |
|
15 |
15 |
from wcs.backoffice.root import FormsDirectory, WorkflowsDirectory
|
16 |
16 |
|
17 |
|
from qommon import get_cfg
|
|
17 |
from qommon import get_cfg, errors
|
18 |
18 |
from qommon.form import *
|
19 |
19 |
|
20 |
20 |
class BackofficeRootDirectory(wcs.backoffice.root.RootDirectory):
|
21 |
21 |
_q_exports = ['', 'home', 'statistics']
|
22 |
22 |
|
23 |
|
menu_items = [
|
24 |
|
('home', N_('Pending Forms')),
|
25 |
|
('forms/', N_('Forms Workshop'), FormsDirectory.is_accessible),
|
26 |
|
('workflows/', N_('Workflows Workshop'), WorkflowsDirectory.is_accessible),
|
27 |
|
('/', N_('WCS Form Server'))]
|
28 |
|
|
29 |
23 |
def get_intro_text(self):
|
30 |
24 |
return _('Welcome on Au Quotidien back office interface')
|
31 |
25 |
|
... | ... | |
44 |
38 |
return r.getvalue()
|
45 |
39 |
|
46 |
40 |
def _q_lookup(self, component):
|
47 |
|
if component == 'forms':
|
48 |
|
return FormsDirectory()
|
49 |
|
if component == 'workflows':
|
50 |
|
return WorkflowsDirectory()
|
|
41 |
if component in [str(x[0]).strip('/') for x in self.menu_items]:
|
|
42 |
if not is_accessible(component):
|
|
43 |
raise errors.AccessForbiddenError()
|
|
44 |
return getattr(self, component)
|
51 |
45 |
return FormPage(component)
|
52 |
46 |
|
53 |
47 |
class FormPage(wcs.backoffice.root.FormPage):
|
backoffice: sync with wcs backoffice/admin unification (#6726)