1
|
from qommon.publisher import get_publisher_class, get_request
|
2
|
from qommon.misc import get_cfg
|
3
|
|
4
|
import modules.admin
|
5
|
import modules.backoffice
|
6
|
import modules.links_ui
|
7
|
import modules.announces_ui
|
8
|
import modules.events_ui
|
9
|
import modules.forms_ui
|
10
|
import modules.payments_ui
|
11
|
import modules.strongbox_ui
|
12
|
import modules.formpage
|
13
|
import modules.template
|
14
|
import modules.root
|
15
|
import modules.form
|
16
|
import modules.payments
|
17
|
import modules.connectors
|
18
|
import modules.abelium_domino_ui
|
19
|
import modules.abelium_domino_vars
|
20
|
import modules.abelium_domino_synchro
|
21
|
|
22
|
get_publisher_class().register_translation_domain('auquotidien')
|
23
|
get_publisher_class().default_configuration_path = 'au-quotidien-wcs-settings.xml'
|
24
|
|
25
|
def check_visibility(target):
|
26
|
user = get_request().user
|
27
|
if not user:
|
28
|
return False
|
29
|
admin_role = get_cfg('aq-permissions', {}).get(target.strip('/'), None)
|
30
|
if not admin_role:
|
31
|
return False
|
32
|
if not (user.is_admin or admin_role in (user.roles or [])):
|
33
|
return False
|
34
|
return True
|
35
|
|
36
|
rdb = get_publisher_class().backoffice_directory_class
|
37
|
|
38
|
rdb.items = []
|
39
|
rdb.register_menu_item('home', _('Pending Forms'))
|
40
|
|
41
|
rdb.register_menu_item('forms', None)
|
42
|
rdb.register_directory('forms', modules.forms_ui.FormsDirectory())
|
43
|
rdb.register_menu_item('forms/', _('Forms Management'), check_visibility)
|
44
|
|
45
|
rdb.register_directory('announces', modules.announces_ui.AnnouncesDirectory())
|
46
|
rdb.register_menu_item('announces/', _('Announces'), check_visibility)
|
47
|
|
48
|
rdb.register_directory('links', modules.links_ui.LinksDirectory())
|
49
|
rdb.register_menu_item('links/', _('Links'), check_visibility)
|
50
|
|
51
|
rdb.register_directory('events', modules.events_ui.EventsDirectory())
|
52
|
rdb.register_menu_item('events/', _('Events'), check_visibility)
|
53
|
|
54
|
rdb.register_directory('payments', modules.payments_ui.PaymentsDirectory())
|
55
|
rdb.register_menu_item('payments/', _('Payments'), check_visibility)
|
56
|
|
57
|
rdb.register_directory('strongbox', modules.strongbox_ui.StrongboxDirectory())
|
58
|
rdb.register_menu_item('strongbox/', _('Strong Box'), check_visibility)
|
59
|
|
60
|
import wcs.fields
|
61
|
wcs.fields.FileField.widget_class = modules.form.FileWithPreviewAndStrongboxWidget
|
62
|
|
63
|
import wcs.admin.settings
|
64
|
wcs.admin.settings.SettingsDirectory.domino = modules.abelium_domino_ui.AbeliumDominoDirectory()
|
65
|
wcs.admin.settings.SettingsDirectory._q_exports.append('domino')
|
66
|
|
67
|
|