Revision db8eb0b4
Added by Frédéric Péters over 9 years ago
extra/modules/backoffice.py | ||
---|---|---|
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 |
|
9 | 8 |
|
10 |
import wcs.backoffice.root
|
|
9 |
import wcs.backoffice.management
|
|
11 | 10 |
import wcs.root |
12 | 11 |
from wcs.categories import Category |
13 | 12 |
from wcs.formdef import FormDef |
14 | 13 |
|
15 |
from wcs.backoffice.root import FormsDirectory, WorkflowsDirectory |
|
16 |
|
|
17 | 14 |
from qommon import get_cfg, errors |
18 | 15 |
from qommon.form import * |
19 | 16 |
|
... | ... | |
27 | 24 |
return wcs.backoffice.root.RootDirectory._q_index(self) |
28 | 25 |
|
29 | 26 |
def home(self): |
30 |
return redirect('management') |
|
31 |
|
|
32 |
def _q_lookup(self, component): |
|
33 |
if component in [str(x[0]).strip('/') for x in self.menu_items]: |
|
34 |
if not is_accessible(component): |
|
35 |
raise errors.AccessForbiddenError() |
|
36 |
return getattr(self, component) |
|
37 |
return FormPage(component) |
|
38 |
|
|
39 |
class FormPage(wcs.backoffice.root.FormPage): |
|
40 |
def get_fields_from_query(self): |
|
41 |
field_ids = [x for x in get_request().form.keys()] |
|
42 |
fields = wcs.backoffice.root.FormPage.get_fields_from_query(self) |
|
43 |
if not field_ids: |
|
44 |
# do not display the user-label field by default, as it will most |
|
45 |
# most often be redundant (the formdata itself will have a name |
|
46 |
# field) |
|
47 |
return [x for x in fields if x.id != 'user-label'] |
|
48 |
return fields |
|
27 |
return redirect('management/') |
|
49 | 28 |
|
50 | 29 |
get_publisher_class().backoffice_directory_class = BackofficeRootDirectory |
51 |
|
Also available in: Unified diff
misc: adapt to wcs move of forms management to a subdirectory (#7151)