4
4
Global menus & breadcrumbs
7
# =============================================================================
8
# Language Menu (available in all screens)
9
#s3.menu_lang = [ T("Language"), True, "#"]
11
#for language in s3.l10n_languages.keys():
12
# _menu_lang.append([s3.l10n_languages[language], False, language])
13
#s3.menu_lang.append(_menu_lang)
15
# -----------------------------------------------------------------------------
16
# Help Menu (available in all screens)
17
#s3.menu_help = [ T("Help"), True, "#",
19
# [T("Contact us"), False,
20
# URL(c="default", f="contact")],
21
# [T("About"), False, URL(c="default", f="about")],
25
# -----------------------------------------------------------------------------
26
# Auth Menu (available in all screens)
29
if not auth.is_logged_in():
31
login_next = URL(args=request.args, vars=request.vars)
32
if request.controller == "default" and \
33
request.function == "user" and \
34
"_next" in request.get_vars:
35
login_next = request.get_vars["_next"]
37
self_registration = deployment_settings.get_security_self_registration()
40
s3.menu_auth = [[T("Register"),
41
URL(c="default", f="user/register")],
43
URL(c="default", f="user/login",
44
vars=dict(_next=login_next))],
46
URL(c="default", f="user/retrieve_password")]
7
if auth.permission.format in ("html"):
8
# =============================================================================
9
# Language Menu (available in all screens)
10
#s3.menu_lang = [ T("Language"), True, "#"]
12
#for language in s3.l10n_languages.keys():
13
# _menu_lang.append([s3.l10n_languages[language], False, language])
14
#s3.menu_lang.append(_menu_lang)
16
# -----------------------------------------------------------------------------
17
# Help Menu (available in all screens)
18
#s3.menu_help = [ T("Help"), True, "#",
20
# [T("Contact us"), False,
21
# URL(c="default", f="contact")],
22
# [T("About"), False, URL(c="default", f="about")],
26
# -----------------------------------------------------------------------------
27
# Auth Menu (available in all screens)
36
if not auth.is_logged_in():
38
login_next = URL(args=request.args, vars=request.vars)
39
if request.controller == "default" and \
40
request.function == "user" and \
41
"_next" in request.get_vars:
42
login_next = request.get_vars["_next"]
44
self_registration = deployment_settings.get_security_self_registration()
47
s3.menu_auth = [[T("Register"),
48
URL(c="default", f="user/register")],
50
URL(c="default", f="user/login",
51
vars=dict(_next=login_next))],
53
URL(c="default", f="user/retrieve_password")]
56
s3.menu_auth = [[T("Sign In"),
57
URL(c="default", f="user/login",
58
vars=dict(_next=login_next))],
60
URL(c="default", f="user/retrieve_password")]
49
s3.menu_auth = [[T("Sign In"),
50
URL(c="default", f="user/login",
51
vars=dict(_next=login_next))],
53
URL(c="default", f="user/retrieve_password")]
63
s3.menu_auth = [[T("Sign Out"), URL(c="default",
65
[T("Change Password"), URL(c="default",
66
f="user/change_password")],
56
s3.menu_auth = [[T("Sign Out"), URL(c="default",
58
[T("Change Password"), URL(c="default",
59
f="user/change_password")],
63
# -----------------------------------------------------------------------------
64
# Menu for Admin module
65
# (defined here as used in several different Controller files)
66
admin_menu_messaging = [
67
[T("Email Settings"), False,
68
URL(c="msg", f="email_settings", args=[1, "update"])],
69
[T("SMS Settings"), False,
70
URL(c="msg", f="setting", args=[1, "update"])],
71
[T("Twitter Settings"), False,
72
URL(c="msg", f="twitter_settings", args=[1, "update"])],
70
# -----------------------------------------------------------------------------
71
# Menu for Admin module
72
# (defined here as used in several different Controller files)
73
admin_menu_messaging = [
74
[T("Email Settings"), False,
75
URL(c="msg", f="email_settings", args=[1, "update"])],
76
[T("SMS Settings"), False,
77
URL(c="msg", f="setting", args=[1, "update"])],
78
[T("Twitter Settings"), False,
79
URL(c="msg", f="twitter_settings", args=[1, "update"])],
81
admin_menu_options = [
82
#[T("Settings"), False, URL(c="admin", f="settings"),
83
# admin_menu_messaging,
84
# # Hidden until useful again
85
# #[T("Edit Themes"), False, URL(c="admin", f="theme")]
87
[T("User Management"), False, URL(c="admin", f="user"), [
88
[T("Users"), False, URL(c="admin", f="user")],
89
[T("Roles"), False, URL(c="admin", f="role")],
90
[T("Organizations"), False, URL(c="admin", f="organisation")],
91
#[T("Roles"), False, URL(c="admin", f="group")],
92
#[T("Membership"), False, URL(c="admin", f="membership")],
94
[T("Database"), False, URL(c="appadmin", f="index"), [
95
# @ToDo: UI for the current Import approach (S3CSV)
96
[T("Import"), False, URL(c="admin", f="import_file")],
97
#[T("Import"), False, URL(c="admin", f="import_data")],
98
#[T("Export"), False, URL(c="admin", f="export_data")],
99
#[T("Import Jobs"), False, URL(c="admin", f="import_job")],
100
[T("Raw Database access"), False, URL(c="appadmin", f="index")]
102
# Hidden until ready for production
103
[T("Synchronization"), False, URL(c="sync", f="index"), [
104
[T("Settings"), False, aURL(p="update", c="sync", f="config",
105
args=["1", "update"])],
106
[T("Repositories"), False, URL(c="sync", f="repository")],
107
[T("Log"), False, URL(c="sync", f="log")],
109
#[T("Edit Application"), False,
110
# URL(a="admin", c="default", f="design", args=[request.application])],
111
[T("Tickets"), False, URL(c="admin", f="errors")],
112
[T("Portable App"), False, URL(c="admin", f="portable")],
74
admin_menu_options = [
75
#[T("Settings"), False, URL(c="admin", f="settings"),
76
# admin_menu_messaging,
77
# # Hidden until useful again
78
# #[T("Edit Themes"), False, URL(c="admin", f="theme")]
80
[T("User Management"), False, URL(c="admin", f="user"), [
81
[T("Users"), False, URL(c="admin", f="user")],
82
[T("Roles"), False, URL(c="admin", f="role")],
83
[T("Organizations"), False, URL(c="admin", f="organisation")],
84
#[T("Roles"), False, URL(c="admin", f="group")],
85
#[T("Membership"), False, URL(c="admin", f="membership")],
87
[T("Database"), False, URL(c="appadmin", f="index"), [
88
# @ToDo: UI for the current Import approach (S3CSV)
89
[T("Import"), False, URL(c="admin", f="import_file")],
90
#[T("Import"), False, URL(c="admin", f="import_data")],
91
#[T("Export"), False, URL(c="admin", f="export_data")],
92
#[T("Import Jobs"), False, URL(c="admin", f="import_job")],
93
[T("Raw Database access"), False, URL(c="appadmin", f="index")]
95
# Hidden until ready for production
96
[T("Synchronization"), False, URL(c="sync", f="index"), [
97
[T("Settings"), False, aURL(p="update", c="sync", f="config",
98
args=["1", "update"])],
99
[T("Repositories"), False, URL(c="sync", f="repository")],
100
[T("Log"), False, URL(c="sync", f="log")],
102
#[T("Edit Application"), False,
103
# URL(a="admin", c="default", f="design", args=[request.application])],
104
[T("Tickets"), False, URL(c="admin", f="errors")],
105
[T("Portable App"), False, URL(c="admin", f="portable")],
108
# -----------------------------------------------------------------------------
109
# Modules Menu (available in all Controllers)
110
# NB This is hardcoded for IFRC
113
#_module = deployment_settings.modules["default"]
114
#s3.menu_modules.append([_module.name_nice, False,
115
# URL(c="default", f="index")])
117
# Modules to hide due to insufficient permissions
118
#hidden_modules = auth.permission.hidden_modules()
120
# The Modules to display at the top level (in order)
121
#for module_type in [1, 2, 3, 4, 5, 6]:
122
# for module in deployment_settings.modules:
123
# if module in hidden_modules:
125
# _module = deployment_settings.modules[module]
126
# if (_module.module_type == module_type):
127
# if not _module.access:
128
# s3.menu_modules.append([_module.name_nice, False,
129
# aURL(c=module, f="index")])
132
# groups = re.split("\|", _module.access)[1:-1]
133
# for group in groups:
134
# if s3_has_role(group):
136
# if authorised == True:
137
# s3.menu_modules.append([_module.name_nice, False,
138
# URL(c=module, f="index")])
140
# Modules to display off the 'more' menu
141
#modules_submenu = []
142
#for module in deployment_settings.modules:
143
# if module in hidden_modules:
145
# _module = deployment_settings.modules[module]
146
# if (_module.module_type == 10):
147
# if not _module.access:
148
# modules_submenu.append([_module.name_nice, False,
149
# aURL(c=module, f="index")])
152
# groups = re.split("\|", _module.access)[1:-1]
153
# for group in groups:
154
# if s3_has_role(group):
156
# if authorised == True:
157
# modules_submenu.append([_module.name_nice, False,
158
# URL(c=module, f="index")])
160
# # Only show the 'more' menu if there are entries in the list
161
# module_more_menu = ([T("more"), False, "#"])
162
# module_more_menu.append(modules_submenu)
163
# s3.menu_modules.append(module_more_menu)
166
if s3_has_role(ADMIN):
167
_module = deployment_settings.modules["admin"]
168
s3.menu_admin = [_module.name_nice,
169
URL(c="admin", f="index"), [
170
# This menu isn't shown in IFRC Theme yet
171
#[T("Settings"), URL(c="admin", f="settings")],
172
[T("Users"), URL(c="admin", f="user")],
173
[T("Database"), URL(c="appadmin", f="index")],
174
[T("Import"), URL(c="admin", f="import_file")],
175
[T("Synchronization"), URL(c="sync", f="index")],
176
[T("Tickets"), URL(c="admin", f="errors")],
181
# -----------------------------------------------------------------------------
182
# Build overall menu out of components
183
#response.menu = s3.menu_modules
184
#response.menu.append(s3.menu_help)
185
#response.menu.append(s3.menu_auth)
186
response.menu = s3.menu_auth
187
#if deployment_settings.get_gis_menu():
188
# # Do not localize this string.
189
# s3.gis_menu_placeholder = "GIS menu placeholder"
190
# # Add a placeholder for the regions menu, which cannot be constructed
191
# # until the gis_config table is available. Put it near the language menu.
192
# response.menu.append(s3.gis_menu_placeholder)
194
response.menu.append(s3.menu_admin)
195
# this check is handled by s3tools for personal menu,
196
# language select isn't rendered like other menu items in ifrc
197
#if deployment_settings.get_L10n_display_toolbar():
198
# response.menu.append(s3.menu_lang)
200
# Menu helpers ================================================================
201
def s3_menu(controller, postp=None, prep=None):
203
appends controller specific options to global menu
204
picks up from 01_menu, called from controllers
206
@postp - additional postprocessor,
207
assuming postp acts on response.menu_options
208
@prep - pre-processor
209
@ToDo: FIXIT - alter here when you alter controller name
211
if controller in s3_menu_dict:
217
menu_config = s3_menu_dict[controller]
218
menu = menu_config["menu"]
221
if s3_has_role(AUTHENTICATED) and "on_auth" in menu_config:
222
menu.extend(menu_config["on_auth"])
224
if s3_has_role(ADMIN) and "on_admin" in menu_config:
225
menu.extend(menu_config["on_admin"])
227
if s3_has_role(EDITOR) and "on_editor" in menu_config:
228
menu.extend(menu_config["on_editor"])
231
conditions = [x for x in menu_config if re.match(r"condition[0-9]+", x)]
232
for condition in conditions:
233
if menu_config[condition]():
234
menu.extend(menu_config["conditional%s" % condition[9:]])
236
needle = request["wsgi"]["environ"]["PATH_INFO"]
237
for i in xrange(len(menu)):
238
if str(menu[i][2]) in needle:
240
if len(menu[i]) >= 4:
241
# if has submenus to it
242
for j in xrange(len(menu[i][3])):
243
if str(menu[i][3][j][2]) == needle:
244
menu[i][3][j][1] = True
248
response.menu_options = menu
253
# =============================================================================
254
# Role-dependent Menu options
255
# =============================================================================
256
if s3_has_role(ADMIN):
258
[T("Person"), False, aURL(f="person", args=None), [
259
[T("New"), False, aURL(p="create", f="person", args="create")],
260
[T("Search"), False, aURL(f="index")],
261
[T("List All"), False, aURL(f="person")],
263
[T("Groups"), False, aURL(f="group"), [
264
[T("New"), False, aURL(p="create", f="group", args="create")],
265
[T("List All"), False, aURL(f="group")],
271
# =============================================================================
272
# Settings-dependent Menu options
273
# =============================================================================
274
# CRUD strings for inv_recv
275
# (outside condtional model load since need to be visible to menus)
276
if deployment_settings.get_inv_shipment_name() == "order":
277
ADD_RECV = T("Add Order")
278
LIST_RECV = T("List Orders")
279
s3.crud_strings["inv_recv"] = Storage(
280
title_create = ADD_RECV,
281
title_display = T("Order Details"),
282
title_list = LIST_RECV,
283
title_update = T("Edit Order"),
284
title_search = T("Search Orders"),
285
subtitle_create = ADD_RECV,
286
subtitle_list = T("Orders"),
287
label_list_button = LIST_RECV,
288
label_create_button = ADD_RECV,
289
label_delete_button = T("Delete Order"),
290
msg_record_created = T("Order Created"),
291
msg_record_modified = T("Order updated"),
292
msg_record_deleted = T("Order canceled"),
293
msg_list_empty = T("No Orders registered")
296
ADD_RECV = T("Receive Shipment")
297
LIST_RECV = T("List Received Shipments")
298
s3.crud_strings["inv_recv"] = Storage(
299
title_create = ADD_RECV,
300
title_display = T("Received Shipment Details"),
301
title_list = LIST_RECV,
302
title_update = T("Edit Received Shipment"),
303
title_search = T("Search Received Shipments"),
304
subtitle_create = ADD_RECV,
305
subtitle_list = T("Received Shipments"),
306
label_list_button = LIST_RECV,
307
label_create_button = ADD_RECV,
308
label_delete_button = T("Delete Received Shipment"),
309
msg_record_created = T("Shipment Created"),
310
msg_record_modified = T("Received Shipment updated"),
311
msg_record_deleted = T("Received Shipment canceled"),
312
msg_list_empty = T("No Received Shipments")
315
if deployment_settings.get_project_community_activity():
316
list_activities_label = T("List All Communities")
317
import_activities_label = T("Import Project Communities")
319
list_activities_label = T("List All Activities")
320
import_activities_label = T("Import Project Activities")
322
if deployment_settings.get_project_drr():
325
[T("Projects"), False, aURL(f="project"),[
326
[T("Add New Project"), False, aURL(p="create", f="project", args="create")],
327
[T("List All Projects"), False, aURL(f="project")],
328
[list_activities_label, False, aURL(f="activity")],
329
[T("Search"), False, aURL(f="project", args="search")],
331
[T("Reports"), False, aURL(f="report"),[
332
[T("Who is doing What Where"), False, aURL(f="activity", args="report")],
334
False, aURL(f="beneficiary",
336
vars=Storage(rows="project_id",
337
cols="bnf_type$name",
340
[T("Funding"), False, aURL(f="organisation", args="report")],
342
[T("Import"), False, aURL(f="index"),[
343
[T("Import Projects"), False, aURL(p="create", f="project",
345
[T("Import Project Organisations"), False, aURL(p="create", f="organisation",
115
# -----------------------------------------------------------------------------
116
# Modules Menu (available in all Controllers)
117
# NB This is hardcoded for IFRC
120
#_module = deployment_settings.modules["default"]
121
#s3.menu_modules.append([_module.name_nice, False,
122
# URL(c="default", f="index")])
124
# Modules to hide due to insufficient permissions
125
#hidden_modules = auth.permission.hidden_modules()
127
# The Modules to display at the top level (in order)
128
#for module_type in [1, 2, 3, 4, 5, 6]:
129
# for module in deployment_settings.modules:
130
# if module in hidden_modules:
132
# _module = deployment_settings.modules[module]
133
# if (_module.module_type == module_type):
134
# if not _module.access:
135
# s3.menu_modules.append([_module.name_nice, False,
136
# aURL(c=module, f="index")])
139
# groups = re.split("\|", _module.access)[1:-1]
140
# for group in groups:
141
# if s3_has_role(group):
143
# if authorised == True:
144
# s3.menu_modules.append([_module.name_nice, False,
145
# URL(c=module, f="index")])
147
# Modules to display off the 'more' menu
148
#modules_submenu = []
149
#for module in deployment_settings.modules:
150
# if module in hidden_modules:
152
# _module = deployment_settings.modules[module]
153
# if (_module.module_type == 10):
154
# if not _module.access:
155
# modules_submenu.append([_module.name_nice, False,
156
# aURL(c=module, f="index")])
159
# groups = re.split("\|", _module.access)[1:-1]
160
# for group in groups:
161
# if s3_has_role(group):
163
# if authorised == True:
164
# modules_submenu.append([_module.name_nice, False,
165
# URL(c=module, f="index")])
167
# # Only show the 'more' menu if there are entries in the list
168
# module_more_menu = ([T("more"), False, "#"])
169
# module_more_menu.append(modules_submenu)
170
# s3.menu_modules.append(module_more_menu)
173
if s3_has_role(ADMIN):
174
_module = deployment_settings.modules["admin"]
175
s3.menu_admin = [_module.name_nice,
176
URL(c="admin", f="index"), [
177
# This menu isn't shown in IFRC Theme yet
178
#[T("Settings"), URL(c="admin", f="settings")],
179
[T("Users"), URL(c="admin", f="user")],
180
[T("Database"), URL(c="appadmin", f="index")],
181
[T("Import"), URL(c="admin", f="import_file")],
182
[T("Synchronization"), URL(c="sync", f="index")],
183
[T("Tickets"), URL(c="admin", f="errors")],
188
# -----------------------------------------------------------------------------
189
# Build overall menu out of components
190
#response.menu = s3.menu_modules
191
#response.menu.append(s3.menu_help)
192
#response.menu.append(s3.menu_auth)
193
response.menu = s3.menu_auth
194
#if deployment_settings.get_gis_menu():
195
# # Do not localize this string.
196
# s3.gis_menu_placeholder = "GIS menu placeholder"
197
# # Add a placeholder for the regions menu, which cannot be constructed
198
# # until the gis_config table is available. Put it near the language menu.
199
# response.menu.append(s3.gis_menu_placeholder)
201
response.menu.append(s3.menu_admin)
202
# this check is handled by s3tools for personal menu,
203
# language select isn't rendered like other menu items in ifrc
204
#if deployment_settings.get_L10n_display_toolbar():
205
# response.menu.append(s3.menu_lang)
207
# Menu helpers ================================================================
208
def s3_menu(controller, postp=None, prep=None):
210
appends controller specific options to global menu
211
picks up from 01_menu, called from controllers
213
@postp - additional postprocessor,
214
assuming postp acts on response.menu_options
215
@prep - pre-processor
216
@ToDo: FIXIT - alter here when you alter controller name
218
if controller in s3_menu_dict:
224
menu_config = s3_menu_dict[controller]
225
menu = menu_config["menu"]
228
if s3_has_role(AUTHENTICATED) and "on_auth" in menu_config:
229
menu.extend(menu_config["on_auth"])
231
if s3_has_role(ADMIN) and "on_admin" in menu_config:
232
menu.extend(menu_config["on_admin"])
234
if s3_has_role(EDITOR) and "on_editor" in menu_config:
235
menu.extend(menu_config["on_editor"])
238
conditions = [x for x in menu_config if re.match(r"condition[0-9]+", x)]
239
for condition in conditions:
240
if menu_config[condition]():
241
menu.extend(menu_config["conditional%s" % condition[9:]])
243
needle = request["wsgi"]["environ"]["PATH_INFO"]
244
for i in xrange(len(menu)):
245
if str(menu[i][2]) in needle:
247
if len(menu[i]) >= 4:
248
# if has submenus to it
249
for j in xrange(len(menu[i][3])):
250
if str(menu[i][3][j][2]) == needle:
251
menu[i][3][j][1] = True
255
response.menu_options = menu
260
# =============================================================================
261
# Role-dependent Menu options
262
# =============================================================================
263
if s3_has_role(ADMIN):
265
[T("Person"), False, aURL(f="person", args=None), [
266
[T("New"), False, aURL(p="create", f="person", args="create")],
267
[T("Search"), False, aURL(f="index")],
268
[T("List All"), False, aURL(f="person")],
270
[T("Groups"), False, aURL(f="group"), [
271
[T("New"), False, aURL(p="create", f="group", args="create")],
272
[T("List All"), False, aURL(f="group")],
278
# =============================================================================
279
# Settings-dependent Menu options
280
# =============================================================================
281
# CRUD strings for inv_recv
282
# (outside condtional model load since need to be visible to menus)
283
if deployment_settings.get_inv_shipment_name() == "order":
284
ADD_RECV = T("Add Order")
285
LIST_RECV = T("List Orders")
286
s3.crud_strings["inv_recv"] = Storage(
287
title_create = ADD_RECV,
288
title_display = T("Order Details"),
289
title_list = LIST_RECV,
290
title_update = T("Edit Order"),
291
title_search = T("Search Orders"),
292
subtitle_create = ADD_RECV,
293
subtitle_list = T("Orders"),
294
label_list_button = LIST_RECV,
295
label_create_button = ADD_RECV,
296
label_delete_button = T("Delete Order"),
297
msg_record_created = T("Order Created"),
298
msg_record_modified = T("Order updated"),
299
msg_record_deleted = T("Order canceled"),
300
msg_list_empty = T("No Orders registered")
303
ADD_RECV = T("Receive Shipment")
304
LIST_RECV = T("List Received Shipments")
305
s3.crud_strings["inv_recv"] = Storage(
306
title_create = ADD_RECV,
307
title_display = T("Received Shipment Details"),
308
title_list = LIST_RECV,
309
title_update = T("Edit Received Shipment"),
310
title_search = T("Search Received Shipments"),
311
subtitle_create = ADD_RECV,
312
subtitle_list = T("Received Shipments"),
313
label_list_button = LIST_RECV,
314
label_create_button = ADD_RECV,
315
label_delete_button = T("Delete Received Shipment"),
316
msg_record_created = T("Shipment Created"),
317
msg_record_modified = T("Received Shipment updated"),
318
msg_record_deleted = T("Received Shipment canceled"),
319
msg_list_empty = T("No Received Shipments")
322
if deployment_settings.get_project_community_activity():
323
list_activities_label = T("List All Communities")
324
import_activities_label = T("Import Project Communities")
326
list_activities_label = T("List All Activities")
327
import_activities_label = T("Import Project Activities")
329
if deployment_settings.get_project_drr():
332
[T("Projects"), False, aURL(f="project"),[
333
[T("Add New Project"), False, aURL(p="create", f="project", args="create")],
334
[T("List All Projects"), False, aURL(f="project")],
335
[list_activities_label, False, aURL(f="activity")],
336
[T("Search"), False, aURL(f="project", args="search")],
338
[T("Reports"), False, aURL(f="report"),[
339
[T("Who is doing What Where"), False, aURL(f="activity", args="report")],
341
False, aURL(f="beneficiary",
343
vars=Storage(rows="project_id",
344
cols="bnf_type$name",
347
[T("Funding"), False, aURL(f="organisation", args="report")],
349
[T("Import"), False, aURL(f="index"),[
350
[T("Import Projects"), False, aURL(p="create", f="project",
352
[T("Import Project Organisations"), False, aURL(p="create", f="organisation",
354
[import_activities_label, False, aURL(p="create", f="activity",
347
[import_activities_label, False, aURL(p="create", f="activity",
350
[T("Activity Types"), False, aURL(f="activity_type"),[
351
[T("Add New Activity Type"), False, aURL(p="create", f="activity_type", args="create")],
352
[T("List All Activity Types"), False, aURL(f="activity_type")],
353
#[T("Search"), False, aURL(f="activity_type", args="search")]
355
[T("Hazards"), False, aURL(f="hazard"),[
356
[T("Add New Hazard"), False, aURL(p="create", f="hazard", args="create")],
357
[T("List All Hazards"), False, aURL(f="hazard")],
359
[T("Project Themes"), False, aURL(f="theme"),[
360
[T("Add New Theme"), False, aURL(p="create", f="theme", args="create")],
361
[T("List All Themes"), False, aURL(f="theme")],
363
[T("Beneficiary Types"), False, aURL(f="beneficiary_type"),[
364
[T("Add New Type"), False, aURL(p="create", f="beneficiary_type", args="create")],
365
[T("List All Types"), False, aURL(f="beneficiary_type")],
369
elif s3_has_role("STAFF"):
372
[T("Projects"), False, aURL(f="project"),[
373
#[T("Add New Project"), False, aURL(p="create", f="project", args="create")],
374
[T("List Projects"), False, aURL(f="project")],
375
[T("Open Tasks for Project"), False, aURL(f="project", vars={"tasks":1})],
377
#[T("Tasks"), False, aURL(f="task"),[
378
#[T("Add New Task"), False, aURL(p="create", f="task", args="create")],
379
#[T("List All Tasks"), False, aURL(f="task")],
380
#[T("Search"), False, aURL(f="task", args="search")],
382
[T("Daily Work"), False, aURL(f="time"),[
383
[T("My Logged Hours"), False, aURL(f="time", vars={"mine":1})],
384
[T("Last Week's Work"),
385
False, aURL(f="time",
387
vars={"rows":"person_id",
392
[T("My Open Tasks"), False, aURL(f="task", vars={"mine":1})],
396
[T("Admin"), False, None,[
397
[T("Activity Types"), False, aURL(f="activity_type")],
398
[T("Organizations"), False, aURL(f="organisation")],
399
[T("Import Tasks"), False, aURL(p="create", f="task",
402
[T("Reports"), False, aURL(f="report"),[
403
[T("Activity Report"),
404
False, aURL(f="activity",
406
vars=Storage(rows="project_id",
410
[T("Project Time Report"),
411
False, aURL(f="time",
413
vars=Storage(rows="project",
423
[T("Projects"), False, aURL(f="project"),[
424
[T("List All Projects"), False, aURL(f="project")],
429
# -----------------------------------------------------------------------------
430
org_menu = [T("Organizations"), False, aURL(c="org", f="organisation"), [
431
[T("New"), False, aURL(p="create", c="org", f="organisation",
433
[T("List All"), False, aURL(c="org", f="organisation")],
434
[T("Search"), False, aURL(c="org", f="organisation",
436
#[T("Import"), False, aURL(p="create", c="org", f="organisation",
439
office_menu = [T("Offices"), False, aURL(c="org", f="office"), [
440
[T("New"), False, aURL(p="create", c="org", f="office",
442
[T("List All"), False, aURL(c="org", f="office")],
443
[T("Search"), False, aURL(c="org", f="office",
445
[T("Import"), False, aURL(p="create", c="org", f="office",
452
# NOTE: session.s3.hrm.mode is set by menu pre-processor in controller
454
"condition1": lambda: session.s3.hrm.mode is not None,
459
vars=dict(mode="personal"))
462
"condition2": lambda: (session.s3.hrm.mode is not None) and (session.s3.hrm.orgs or ADMIN in session.s3.roles),
463
"conditional2": [[T("Human Resources"),
467
"condition3": lambda: session.s3.hrm.mode is None,
469
[T("Staff"), False, aURL(c="hrm",
471
vars=dict(group="staff")), [
472
[T("New Staff Member"), False, aURL(p="create",
476
vars=dict(group="staff"))],
477
[T("List All"), False, aURL(c="hrm",
479
vars=dict(group="staff"))],
480
[T("Search"), False, aURL(c="hrm",
483
vars=dict(group="staff"))],
484
[T("Report Expiring Contracts"), False, aURL(c="hrm",
486
vars=dict(group="staff",
488
[T("Import"), False, aURL(p="create",
492
vars=dict(group="staff"))],
493
#[T("Dashboard"), False, aURL(f="index")],
495
[T("Volunteers"), False, aURL(c="hrm",
497
vars=dict(group="volunteer")), [
498
[T("New Volunteer"), False, aURL(p="create",
502
vars=dict(group="volunteer"))],
503
[T("List All"), False, aURL(c="hrm",
505
vars=dict(group="volunteer"))],
506
[T("Search"), False, aURL(c="hrm",
509
vars=dict(group="volunteer"))],
510
[T("Import"), False, aURL(p="create",
514
vars=dict(group="volunteer"))],
516
[T("Teams"), False, aURL(f="group"), [
517
[T("New Team"), False, aURL(c="hrm",
520
[T("List All"), False, aURL(c="hrm",
525
[T("Job Role Catalog"), False, aURL(c="hrm",
527
[T("New Job Role"), False, aURL(c="hrm",
357
[T("Activity Types"), False, aURL(f="activity_type"),[
358
[T("Add New Activity Type"), False, aURL(p="create", f="activity_type", args="create")],
359
[T("List All Activity Types"), False, aURL(f="activity_type")],
360
#[T("Search"), False, aURL(f="activity_type", args="search")]
362
[T("Hazards"), False, aURL(f="hazard"),[
363
[T("Add New Hazard"), False, aURL(p="create", f="hazard", args="create")],
364
[T("List All Hazards"), False, aURL(f="hazard")],
366
[T("Project Themes"), False, aURL(f="theme"),[
367
[T("Add New Theme"), False, aURL(p="create", f="theme", args="create")],
368
[T("List All Themes"), False, aURL(f="theme")],
370
[T("Beneficiary Types"), False, aURL(f="beneficiary_type"),[
371
[T("Add New Type"), False, aURL(p="create", f="beneficiary_type", args="create")],
372
[T("List All Types"), False, aURL(f="beneficiary_type")],
376
elif s3_has_role("STAFF"):
379
[T("Projects"), False, aURL(f="project"),[
380
#[T("Add New Project"), False, aURL(p="create", f="project", args="create")],
381
[T("List Projects"), False, aURL(f="project")],
382
[T("Open Tasks for Project"), False, aURL(f="project", vars={"tasks":1})],
384
#[T("Tasks"), False, aURL(f="task"),[
385
#[T("Add New Task"), False, aURL(p="create", f="task", args="create")],
386
#[T("List All Tasks"), False, aURL(f="task")],
387
#[T("Search"), False, aURL(f="task", args="search")],
389
[T("Daily Work"), False, aURL(f="time"),[
390
[T("My Logged Hours"), False, aURL(f="time", vars={"mine":1})],
391
[T("Last Week's Work"),
392
False, aURL(f="time",
394
vars={"rows":"person_id",
399
[T("My Open Tasks"), False, aURL(f="task", vars={"mine":1})],
403
[T("Admin"), False, None,[
404
[T("Activity Types"), False, aURL(f="activity_type")],
405
[T("Organizations"), False, aURL(f="organisation")],
406
[T("Import Tasks"), False, aURL(p="create", f="task",
409
[T("Reports"), False, aURL(f="report"),[
410
[T("Activity Report"),
411
False, aURL(f="activity",
413
vars=Storage(rows="project_id",
417
[T("Project Time Report"),
418
False, aURL(f="time",
420
vars=Storage(rows="project",
430
[T("Projects"), False, aURL(f="project"),[
431
[T("List All Projects"), False, aURL(f="project")],
436
# -----------------------------------------------------------------------------
437
org_menu = [T("Organizations"), False, aURL(c="org", f="organisation"), [
438
[T("New"), False, aURL(p="create", c="org", f="organisation",
440
[T("List All"), False, aURL(c="org", f="organisation")],
441
[T("Search"), False, aURL(c="org", f="organisation",
443
#[T("Import"), False, aURL(p="create", c="org", f="organisation",
446
office_menu = [T("Offices"), False, aURL(c="org", f="office"), [
447
[T("New"), False, aURL(p="create", c="org", f="office",
449
[T("List All"), False, aURL(c="org", f="office")],
450
[T("Search"), False, aURL(c="org", f="office",
452
[T("Import"), False, aURL(p="create", c="org", f="office",
459
# NOTE: session.s3.hrm.mode is set by menu pre-processor in controller
460
# so can't simply make an if/else here :/
462
"condition1": lambda: session.s3.hrm.mode is not None,
467
vars=dict(mode="personal"))
470
"condition2": lambda: (session.s3.hrm.mode is not None) and (session.s3.hrm.orgs or ADMIN in session.s3.roles),
471
"conditional2": [[T("Human Resources"),
475
"condition3": lambda: session.s3.hrm.mode is None,
477
[T("Staff"), False, aURL(c="hrm",
479
vars=dict(group="staff")), [
480
[T("New Staff Member"), False, aURL(p="create",
484
vars=dict(group="staff"))],
485
[T("List All"), False, aURL(c="hrm",
487
vars=dict(group="staff"))],
488
[T("Search"), False, aURL(c="hrm",
491
vars=dict(group="staff"))],
492
[T("Report Expiring Contracts"), False, aURL(c="hrm",
494
vars=dict(group="staff",
496
[T("Import"), False, aURL(p="create",
500
vars=dict(group="staff"))],
501
#[T("Dashboard"), False, aURL(f="index")],
503
[T("Volunteers"), False, aURL(c="hrm",
505
vars=dict(group="volunteer")), [
506
[T("New Volunteer"), False, aURL(p="create",
510
vars=dict(group="volunteer"))],
511
[T("List All"), False, aURL(c="hrm",
513
vars=dict(group="volunteer"))],
514
[T("Search"), False, aURL(c="hrm",
517
vars=dict(group="volunteer"))],
518
[T("Import"), False, aURL(p="create",
522
vars=dict(group="volunteer"))],
524
[T("Teams"), False, aURL(c="hrm",
526
[T("New Team"), False, aURL(c="hrm",
530
[T("List All"), False, aURL(c="hrm",
533
#[T("Skill Catalog"), False, URL(c="hrm",
535
# [T("New Skill"), False, aURL(p="create",
539
# [T("List All"), False, aURL(f="skill")],
540
# #[T("Skill Provisions"), False, aURL(f="skill_provision")],
542
[T("Training Events"), False, URL(c="hrm",
543
f="training_event"), [
544
[T("New Training Event"), False, aURL(p="create",
548
[T("List All"), False, aURL(c="hrm",
549
f="training_event")],
550
[T("Import Participant List"), False, aURL(p="create",
529
[T("List All"), False, aURL(c="hrm",
534
[T("Job Role Catalog"), False, aURL(c="hrm",
536
[T("New Job Role"), False, aURL(c="hrm",
539
[T("List All"), False, aURL(c="hrm",
542
#[T("Skill Catalog"), False, URL(c="hrm",
544
# [T("New Skill"), False, aURL(p="create",
548
# [T("List All"), False, aURL(f="skill")],
549
# #[T("Skill Provisions"), False, aURL(f="skill_provision")],
551
[T("Training Events"), False, URL(c="hrm",
552
f="training_event"), [
553
[T("New Training Event"), False, aURL(p="create",
557
[T("List All"), False, aURL(c="hrm",
558
f="training_event")],
559
[T("Import Participant List"), False, aURL(p="create",
563
[T("Training Report"), False, aURL(c="hrm",
566
vars=dict(rows="course_id",
569
aggregate="count"))],
571
[T("Training Course Catalog"), False, URL(c="hrm",
573
[T("New Training Course"), False, aURL(p="create",
554
[T("Training Report"), False, aURL(c="hrm",
557
vars=dict(rows="course_id",
560
aggregate="count"))],
562
[T("Training Course Catalog"), False, URL(c="hrm",
564
[T("New Training Course"), False, aURL(p="create",
568
[T("List All"), False, aURL(c="hrm",
570
#[T("Course Certificates"), False, aURL(c="hrm",
571
# f="course_certificate")],
573
# [T("Certificate Catalog"), False, URL(f="certificate"), [
574
# [T("New Certificate"), False, aURL(p="create",
577
# [T("List All"), False, aURL(f="certificate")],
578
# [T("Skill Equivalence"), False, aURL(f="certificate_skill")],
580
# Add the "personal" section to the menu (right)
581
[T("Personal Profile"), True, aURL(c="hrm",
583
vars=dict(mode="personal"))]
587
# =============================================================================
588
# Default Menu Configurations for Controllers
589
# =============================================================================
592
Key - controller name
594
- menu : default menu options
595
- on_admin : extensions for ADMIN role
596
- on_editor : extensions for EDITOR role
597
@NOTE: subject to change depending on changes in S3Menu / requirements
602
# -------------------------------------------------------------------------
605
#[T("Home"), False, aURL(c="asset", f="index")],
606
[T("Assets"), False, aURL(c="asset", f="asset"),
608
[T("New"), False, aURL(p="create", c="asset", f="asset",
610
[T("List All"), False, aURL(c="asset", f="asset")],
611
[T("Search"), False, aURL(c="asset", f="asset",
613
[T("Import"), False, aURL(p="create", c="asset", f="asset",
616
[T("Items"), False, aURL(c="asset", f="item"),
618
[T("New"), False, aURL(p="create", c="asset", f="item",
620
[T("List All"), False, aURL(c="asset", f="item")],
625
# CR / Shelter Registry Controller
626
# -------------------------------------------------------------------------
629
[ # @ToDo - Fix s3.crud_strings["cr_shelter"].subtitle_list
630
T("Camps") if deployment_settings.get_ui_camp() \
632
False, aURL(f="shelter"), [
633
[T("New"), False, aURL(p="create", f="shelter", args="create")],
634
[T("List All"), False, aURL(f="shelter")],
635
# @ToDo Search by type, services, location, available space
636
#[T("Search"), False, URL(f="shelter", args="search")],
642
T("Camp Types and Services") if deployment_settings.get_ui_camp() \
643
else T("Shelter Types and Services"),
646
[T("List / Add Services"), False, URL(f="shelter_service")],
647
[T("List / Add Types"), False, URL(f="shelter_type")],
654
# DOC / Document Library
655
# -------------------------------------------------------------------------
658
[T("Documents"), False, aURL(f="document"),[
659
[T("New"), False, aURL(p="create", f="document", args="create")],
660
[T("List All"), False, aURL(f="document")],
661
#[T("Search"), False, aURL(f="ireport", args="search")]
663
[T("Photos"), False, aURL(f="image"),[
664
[T("New"), False, aURL(p="create", f="image", args="create")],
665
[T("List All"), False, aURL(f="image")],
666
#[T("Bulk Uploader"), False, aURL(f="bulk_upload")]
667
#[T("Search"), False, aURL(f="ireport", args="search")]
671
# EVENT / Event Module
672
# -------------------------------------------------------------------------
675
[T("Scenarios"), False, aURL(c="scenario", f="scenario"), [
676
[T("New Scenario"), False, aURL(p="create", c="scenario",
679
[T("View All"), False, aURL(c="scenario", f="scenario")]
681
[T("Events"), False, aURL(c="event", f="event"), [
682
[T("New Event"), False, aURL(p="create", c="event", f="event",
684
[T("View All"), False, aURL(c="event", f="event")]
687
if deployment_settings.has_module("scenario") else \
689
[T("Events"), False, aURL(c="event", f="event"), [
690
[T("New Event"), False, aURL(p="create", c="event", f="event",
692
[T("View All"), False, aURL(c="event", f="event")]
577
[T("List All"), False, aURL(c="hrm",
579
#[T("Course Certificates"), False, aURL(c="hrm",
580
# f="course_certificate")],
582
# [T("Certificate Catalog"), False, URL(f="certificate"), [
583
# [T("New Certificate"), False, aURL(p="create",
586
# [T("List All"), False, aURL(f="certificate")],
587
# [T("Skill Equivalence"), False, aURL(f="certificate_skill")],
589
# Add the "personal" section to the menu (right)
590
[T("Personal Profile"), True, aURL(c="hrm",
592
vars=dict(mode="personal"))]
596
# =============================================================================
597
# Default Menu Configurations for Controllers
598
# =============================================================================
601
Key - controller name
603
- menu : default menu options
604
- on_admin : extensions for ADMIN role
605
- on_editor : extensions for EDITOR role
606
@NOTE: subject to change depending on changes in S3Menu / requirements
611
# -------------------------------------------------------------------------
614
#[T("Home"), False, aURL(c="asset", f="index")],
615
[T("Assets"), False, aURL(c="asset", f="asset"),
617
[T("New"), False, aURL(p="create", c="asset", f="asset",
619
[T("List All"), False, aURL(c="asset", f="asset")],
620
[T("Search"), False, aURL(c="asset", f="asset",
622
[T("Import"), False, aURL(p="create", c="asset", f="asset",
625
[T("Items"), False, aURL(c="asset", f="item"),
627
[T("New"), False, aURL(p="create", c="asset", f="item",
629
[T("List All"), False, aURL(c="asset", f="item")],
634
# CR / Shelter Registry Controller
635
# -------------------------------------------------------------------------
638
[ # @ToDo - Fix s3.crud_strings["cr_shelter"].subtitle_list
639
T("Camps") if deployment_settings.get_ui_camp() \
641
False, aURL(f="shelter"), [
642
[T("New"), False, aURL(p="create", f="shelter", args="create")],
643
[T("List All"), False, aURL(f="shelter")],
644
# @ToDo Search by type, services, location, available space
645
#[T("Search"), False, URL(f="shelter", args="search")],
651
T("Camp Types and Services") if deployment_settings.get_ui_camp() \
652
else T("Shelter Types and Services"),
655
[T("List / Add Services"), False, URL(f="shelter_service")],
656
[T("List / Add Types"), False, URL(f="shelter_type")],
663
# DOC / Document Library
664
# -------------------------------------------------------------------------
667
[T("Documents"), False, aURL(f="document"),[
668
[T("New"), False, aURL(p="create", f="document", args="create")],
669
[T("List All"), False, aURL(f="document")],
670
#[T("Search"), False, aURL(f="ireport", args="search")]
672
[T("Photos"), False, aURL(f="image"),[
673
[T("New"), False, aURL(p="create", f="image", args="create")],
674
[T("List All"), False, aURL(f="image")],
675
#[T("Bulk Uploader"), False, aURL(f="bulk_upload")]
676
#[T("Search"), False, aURL(f="ireport", args="search")]
680
# EVENT / Event Module
681
# -------------------------------------------------------------------------
684
[T("Scenarios"), False, aURL(c="scenario", f="scenario"), [
685
[T("New Scenario"), False, aURL(p="create", c="scenario",
688
[T("View All"), False, aURL(c="scenario", f="scenario")]
690
[T("Events"), False, aURL(c="event", f="event"), [
691
[T("New Event"), False, aURL(p="create", c="event", f="event",
693
[T("View All"), False, aURL(c="event", f="event")]
696
if deployment_settings.has_module("scenario") else \
698
[T("Events"), False, aURL(c="event", f="event"), [
699
[T("New Event"), False, aURL(p="create", c="event", f="event",
701
[T("View All"), False, aURL(c="event", f="event")]
706
# GIS / GIS Controllers
707
# -------------------------------------------------------------------------
710
#[T("Locations"), False, aURL(f="location"), [
711
# [T("New Location"), False, aURL(p="create", f="location",
713
# [T("New Location Group"), False, aURL(p="create", f="location",
715
# vars={"group": 1})],
716
# [T("List All"), False, aURL(f="location")],
717
# [T("Search"), False, aURL(f="location", args="search")],
718
# #[T("Geocode"), False, aURL(f="geocode_manual")],
720
#[T("Fullscreen Map"), False, aURL(f="map_viewing_client")],
721
## Currently not got geocoding support
722
##[T("Bulk Uploader"), False, aURL(c="doc", f="bulk_upload")]
725
#"condition1": lambda: not deployment_settings.get_security_map() or s3_has_role(MAP_ADMIN),
726
#"conditional1": [[T("Service Catalogue"), False, URL(f="map_service_catalogue")]]
729
# HMS / Hospital Status Assessment and Request Management System
730
# -------------------------------------------------------------------------
733
[T("Hospitals"), False, aURL(f="hospital", args="search"), [
734
[T("New"), False, aURL(p="create", f="hospital",
736
[T("Search"), False, aURL(f="hospital", args="search")],
737
[T("List All"), False, aURL(f="hospital")],
738
#["----", False, None],
739
#[T("Show Map"), False, URL(c="gis", f="map_viewing_client",
740
#vars={"kml_feed" : "%s/hms/hospital.kml" %
742
#"kml_name" : "Hospitals_"})],
744
[T("Help"), False, URL(f="index")]
749
# -------------------------------------------------------------------------
753
# -------------------------------------------------------------------------
756
#[T("Home"), False, aURL(c="inv", f="index")],
757
[T("Warehouses"), False, aURL(c="inv", f="warehouse"), [
758
[T("New"), False, aURL(p="create", c="inv",
761
[T("List All"), False, aURL(c="inv", f="warehouse")],
762
[T("Search"), False, aURL(c="inv", f="warehouse",
764
[T("Search Inventory Items"),
765
False, aURL(c="inv", f="inv_item",
767
[T("Import Warehouses"),
768
False, aURL(p="create", c="inv", f="warehouse",
770
vars={"extra_data":True})],
771
[T("Import Stock Levels"),
772
False, aURL(p="create", c="inv", f="inv_item",
775
[s3.crud_strings.inv_recv.subtitle_list, False, aURL(c="inv", f="recv"), [
776
[T("New"), False, aURL(p="create", c="inv",
779
[T("List All"), False, aURL(c="inv", f="recv")],
780
[s3.crud_strings.inv_recv.title_search, False, aURL(c="inv", f="recv",
783
[T("Sent Shipments"), False, aURL(c="inv", f="send"), [
784
[T("New"), False, aURL(p="create", c="inv",
787
[T("List All"), False, aURL(c="inv", f="send")],
789
[T("Items"), False, aURL(c="supply", f="item"), [
790
[T("New"), False, aURL(p="create", c="supply",
793
[T("List All"), False, aURL(c="supply", f="item")],
794
[T("Search"), False, aURL(c="supply", f="catalog_item",
801
# Catalog Items moved to be next to the Item Categories
802
#[T("Catalog Items"), False, aURL(c="supply", f="catalog_item"), [
803
# [T("New"), False, aURL(p="create", c="supply", f="catalog_item",
805
# [T("List All"), False, aURL(c="supply", f="catalog_item")],
806
# [T("Search"), False, aURL(c="supply", f="catalog_item",
810
[T("Catalogs"), False, aURL(c="supply", f="catalog"), [
811
[T("New"), False, aURL(p="create", c="supply",
814
[T("List All"), False, aURL(c="supply", f="catalog")],
815
#[T("Search"), False, aURL(c="supply", f="catalog",
697
# GIS / GIS Controllers
698
# -------------------------------------------------------------------------
701
#[T("Locations"), False, aURL(f="location"), [
702
# [T("New Location"), False, aURL(p="create", f="location",
704
# [T("New Location Group"), False, aURL(p="create", f="location",
706
# vars={"group": 1})],
707
# [T("List All"), False, aURL(f="location")],
708
# [T("Search"), False, aURL(f="location", args="search")],
709
# #[T("Geocode"), False, aURL(f="geocode_manual")],
711
#[T("Fullscreen Map"), False, aURL(f="map_viewing_client")],
712
## Currently not got geocoding support
713
##[T("Bulk Uploader"), False, aURL(c="doc", f="bulk_upload")]
716
#"condition1": lambda: not deployment_settings.get_security_map() or s3_has_role(MAP_ADMIN),
717
#"conditional1": [[T("Service Catalogue"), False, URL(f="map_service_catalogue")]]
720
# HMS / Hospital Status Assessment and Request Management System
721
# -------------------------------------------------------------------------
724
[T("Hospitals"), False, aURL(f="hospital", args="search"), [
725
[T("New"), False, aURL(p="create", f="hospital",
727
[T("Search"), False, aURL(f="hospital", args="search")],
728
[T("List All"), False, aURL(f="hospital")],
729
#["----", False, None],
730
#[T("Show Map"), False, URL(c="gis", f="map_viewing_client",
731
#vars={"kml_feed" : "%s/hms/hospital.kml" %
733
#"kml_name" : "Hospitals_"})],
735
[T("Help"), False, URL(f="index")]
740
# -------------------------------------------------------------------------
744
# -------------------------------------------------------------------------
747
#[T("Home"), False, aURL(c="inv", f="index")],
748
[T("Warehouses"), False, aURL(c="inv", f="warehouse"), [
749
[T("New"), False, aURL(p="create", c="inv",
821
"on_admin": [[T("Item Categories"), False, aURL(c="supply", f="item_category"), [
822
[T("New Item Category"), False, aURL(p="create",
826
[T("List All"), False, aURL(c="supply", f="item_category")]
830
# IRS / Incident Report System
831
# -------------------------------------------------------------------------
834
[T("Events"), False, aURL(f="ireport"),[
835
[T("New"), False, aURL(p="create", f="ireport", args="create")],
836
[T("List All"), False, aURL(f="ireport")],
837
#[T("Search"), False, aURL(f="ireport", args="search")]
841
"on_admin": [[T("Event Categories"), False, aURL(f="icategory"),[
842
[T("New"), False, aURL(p="create", f="icategory", args="create")],
843
[T("List All"), False, aURL(f="icategory")],
845
#["Ushahidi " + T("Import"), False, aURL(f="ireport", args="ushahidi")]
849
# SURVEY / Survey Controller
850
# -------------------------------------------------------------------------
853
[T("Assessment Templates"), False, aURL(f="template"), [
854
#[T("New"), False, aURL(p="create", f="template", args="create")],
855
[T("List All"), False, aURL(f="template")],
857
#[T("Section"), False, aURL(f="section"), [
858
# [T("New"), False, aURL(p="create", f="section", args="create")],
859
# [T("List All"), False, aURL(f="section")]]],
860
[T("Event Assessments"), False, aURL(f="series"), [
861
[T("New"), False, aURL(p="create", f="series", args="create")],
862
[T("List All"), False, aURL(f="series")],
866
[T("Administration"), False, aURL(f="complete"), [
867
#[T("New"), False, aURL(p="create", f="complete", args="create")],
868
#[T("List All"), False, aURL(f="complete")],
869
[T("Import Templates"), False, aURL(f="question_list",
871
[T("Import Completed Responses"), False, aURL(f="complete",
877
# MSG / Messaging Controller
878
# -------------------------------------------------------------------------
881
[T("Compose"), False, URL(c="msg", f="compose")],
882
[T("Distribution groups"), False, aURL(f="group"), [
883
[T("List/Add"), False, aURL(f="group")],
884
[T("Group Memberships"), False, aURL(f="group_membership")],
886
[T("Log"), False, aURL(f="log")],
887
[T("Outbox"), False, aURL(f="outbox")],
888
#[T("Search Twitter Tags"), False, aURL(f="twitter_search"),[
889
# [T("Queries"), False, aURL(f="twitter_search")],
890
# [T("Results"), False, aURL(f="twitter_search_results")]
892
#["CAP", False, aURL(f="tbc")]
896
[T("Administration"), False, URL(f="#"), admin_menu_messaging],
900
# ORG / Organization Registry
901
# -------------------------------------------------------------------------
904
# PATIENT / Patient Tracking Module
905
# -------------------------------------------------------------------------
907
"menu": [[T("Patients"),
908
False, URL(f="patient"),[
910
aURL(p="create", f="patient",
912
[T("List All"), False,
920
# PR / VITA Person Registry
921
# --------------------------------------------------------------------------
927
# -------------------------------------------------------------------------
930
[T("Home"), False, aURL(f="index")],
931
[T("Procurement Plans"), False, aURL(f="plan"),[
932
[T("New"), False, aURL(p="create", f="plan", args="create")],
933
[T("List All"), False, aURL(f="plan")],
934
#[T("Search"), False, aURL(f="plan", args="search")]
936
[T("Suppliers"), False, aURL(f="supplier"),[
937
[T("New"), False, aURL(p="create", f="supplier", args="create")],
938
[T("List All"), False, aURL(f="supplier")],
939
#[T("Search"), False, aURL(f="supplier", args="search")]
945
# PROJECT / Project Tracking & Management
946
# -------------------------------------------------------------------------
947
"project": project_menu,
949
# REQ / Request Management
950
# -------------------------------------------------------------------------
952
"menu": [[T("Requests"), False, aURL(c="req", f="req"), [
953
[T("New"), False, aURL(p="create", c="req", f="req",
955
[T("List All"), False, aURL(c="req", f="req")],
956
[T("List All Requested Items"), False, aURL(c="req", f="req_item")],
957
[T("List All Requested Skills"), False, aURL(c="req", f="req_skill")],
958
#[T("Search Requested Items"), False, aURL(c="req",
962
[T("Commitments"), False, aURL(c="req", f="commit"), [
963
[T("List All"), False, aURL(c="req", f="commit")]
969
# -------------------------------------------------------------------------
971
"menu": admin_menu_options
975
# -------------------------------------------------------------------------
978
#[T("Home"), False, aURL(c="vehicle", f="index")],
979
[T("Vehicles"), False, aURL(c="vehicle", f="vehicle"),
981
[T("New"), False, aURL(p="create", c="vehicle", f="vehicle",
752
[T("List All"), False, aURL(c="inv", f="warehouse")],
753
[T("Search"), False, aURL(c="inv", f="warehouse",
983
[T("List All"), False, aURL(c="vehicle", f="vehicle")],
984
[T("Search"), False, aURL(c="vehicle", f="vehicle",
755
[T("Search Inventory Items"),
756
False, aURL(c="inv", f="inv_item",
758
[T("Import Warehouses"),
759
False, aURL(p="create", c="inv", f="warehouse",
761
vars={"extra_data":True})],
762
[T("Import Stock Levels"),
763
False, aURL(p="create", c="inv", f="inv_item",
766
[s3.crud_strings.inv_recv.subtitle_list, False, aURL(c="inv", f="recv"), [
767
[T("New"), False, aURL(p="create", c="inv",
770
[T("List All"), False, aURL(c="inv", f="recv")],
771
[s3.crud_strings.inv_recv.title_search, False, aURL(c="inv", f="recv",
774
[T("Sent Shipments"), False, aURL(c="inv", f="send"), [
775
[T("New"), False, aURL(p="create", c="inv",
778
[T("List All"), False, aURL(c="inv", f="send")],
780
[T("Items"), False, aURL(c="supply", f="item"), [
781
[T("New"), False, aURL(p="create", c="supply",
784
[T("List All"), False, aURL(c="supply", f="item")],
785
[T("Search"), False, aURL(c="supply", f="catalog_item",
789
# Catalog Items moved to be next to the Item Categories
790
#[T("Catalog Items"), False, aURL(c="supply", f="catalog_item"), [
791
# [T("New"), False, aURL(p="create", c="supply", f="catalog_item",
793
# [T("List All"), False, aURL(c="supply", f="catalog_item")],
794
# [T("Search"), False, aURL(c="supply", f="catalog_item",
798
[T("Catalogs"), False, aURL(c="supply", f="catalog"), [
799
[T("New"), False, aURL(p="create", c="supply",
802
[T("List All"), False, aURL(c="supply", f="catalog")],
803
#[T("Search"), False, aURL(c="supply", f="catalog",
808
"on_admin": [[T("Item Categories"), False, aURL(c="supply", f="item_category"), [
809
[T("New Item Category"), False, aURL(p="create",
813
[T("List All"), False, aURL(c="supply", f="item_category")]
817
# IRS / Incident Report System
818
# -------------------------------------------------------------------------
821
[T("Events"), False, aURL(f="ireport"),[
822
[T("New"), False, aURL(p="create", f="ireport", args="create")],
823
[T("List All"), False, aURL(f="ireport")],
824
#[T("Search"), False, aURL(f="ireport", args="search")]
828
"on_admin": [[T("Event Categories"), False, aURL(f="icategory"),[
829
[T("New"), False, aURL(p="create", f="icategory", args="create")],
830
[T("List All"), False, aURL(f="icategory")],
832
#["Ushahidi " + T("Import"), False, aURL(f="ireport", args="ushahidi")]
836
# SURVEY / Survey Controller
837
# -------------------------------------------------------------------------
840
[T("Assessment Templates"), False, aURL(f="template"), [
841
#[T("New"), False, aURL(p="create", f="template", args="create")],
842
[T("List All"), False, aURL(f="template")],
844
#[T("Section"), False, aURL(f="section"), [
845
# [T("New"), False, aURL(p="create", f="section", args="create")],
846
# [T("List All"), False, aURL(f="section")]]],
847
[T("Event Assessments"), False, aURL(f="series"), [
848
[T("New"), False, aURL(p="create", f="series", args="create")],
849
[T("List All"), False, aURL(f="series")],
853
[T("Administration"), False, aURL(f="complete"), [
854
#[T("New"), False, aURL(p="create", f="complete", args="create")],
855
#[T("List All"), False, aURL(f="complete")],
856
[T("Import Templates"), False, aURL(f="question_list",
858
[T("Import Completed Responses"), False, aURL(f="complete",
864
# MSG / Messaging Controller
865
# -------------------------------------------------------------------------
868
[T("Compose"), False, URL(c="msg", f="compose")],
869
[T("Distribution groups"), False, aURL(f="group"), [
870
[T("List/Add"), False, aURL(f="group")],
871
[T("Group Memberships"), False, aURL(f="group_membership")],
873
[T("Log"), False, aURL(f="log")],
874
[T("Outbox"), False, aURL(f="outbox")],
875
#[T("Search Twitter Tags"), False, aURL(f="twitter_search"),[
876
# [T("Queries"), False, aURL(f="twitter_search")],
877
# [T("Results"), False, aURL(f="twitter_search_results")]
879
#["CAP", False, aURL(f="tbc")]
883
[T("Administration"), False, URL(f="#"), admin_menu_messaging],
887
# ORG / Organization Registry
888
# -------------------------------------------------------------------------
891
# PATIENT / Patient Tracking Module
892
# -------------------------------------------------------------------------
894
"menu": [[T("Patients"),
895
False, URL(f="patient"),[
897
aURL(p="create", f="patient",
899
[T("List All"), False,
907
# PR / VITA Person Registry
908
# --------------------------------------------------------------------------
914
# -------------------------------------------------------------------------
917
[T("Home"), False, aURL(f="index")],
918
[T("Procurement Plans"), False, aURL(f="plan"),[
919
[T("New"), False, aURL(p="create", f="plan", args="create")],
920
[T("List All"), False, aURL(f="plan")],
921
#[T("Search"), False, aURL(f="plan", args="search")]
923
[T("Suppliers"), False, aURL(f="supplier"),[
924
[T("New"), False, aURL(p="create", f="supplier", args="create")],
925
[T("List All"), False, aURL(f="supplier")],
926
#[T("Search"), False, aURL(f="supplier", args="search")]
932
# PROJECT / Project Tracking & Management
933
# -------------------------------------------------------------------------
934
"project": project_menu,
936
# REQ / Request Management
937
# -------------------------------------------------------------------------
939
"menu": [[T("Requests"), False, aURL(c="req", f="req"), [
940
[T("New"), False, aURL(p="create", c="req", f="req",
942
[T("List All"), False, aURL(c="req", f="req")],
943
[T("List All Requested Items"), False, aURL(c="req", f="req_item")],
944
[T("List All Requested Skills"), False, aURL(c="req", f="req_skill")],
945
#[T("Search Requested Items"), False, aURL(c="req",
949
[T("Commitments"), False, aURL(c="req", f="commit"), [
950
[T("List All"), False, aURL(c="req", f="commit")]
956
# -------------------------------------------------------------------------
958
"menu": admin_menu_options
962
# -------------------------------------------------------------------------
965
#[T("Home"), False, aURL(c="vehicle", f="index")],
966
[T("Vehicles"), False, aURL(c="vehicle", f="vehicle"),
968
[T("New"), False, aURL(p="create", c="vehicle", f="vehicle",
970
[T("List All"), False, aURL(c="vehicle", f="vehicle")],
971
[T("Search"), False, aURL(c="vehicle", f="vehicle",
978
# -------------------------------------------------------------------------
980
"menu": admin_menu_options
983
"menu": admin_menu_options
988
[T("Site"), False, aURL(c="default"),
990
[T("Sign in"), True, aURL(c="default", f="user", args="login")],
991
# -------------------------------------------------------------------------
993
"menu": admin_menu_options
996
"menu": admin_menu_options
1001
[T("Site"), False, aURL(c="default"),
1003
[T("Sign in"), True, aURL(c="default", f="user", args="login")],
997
# Duplicate menus - some controllers might re-use menu defined in certain models Eg. inv, supply
998
s3_menu_dict["supply"] = s3_menu_dict["inv"]
999
s3_menu_dict["scenario"] = s3_menu_dict["event"]
1001
# =============================================================================
1003
# =============================================================================
1004
def get_menu_label_and_state(menu_dict, # yikes
1010
""" Support Breadcrumbs """
1012
# Look at the menu for this Controller
1013
menu_spec = menu_dict[controller]["menu"]
1017
menu_spec = menu_dict[controller]["conditional1"]
1021
# Go through each entry in turn to find a match
1023
for menu_item in menu_spec:
1024
(label, active, url) = menu_item[:3]
1026
url_parts = url.split("/")[1:]
1027
# Check we're in the correct function
1028
url_app, url_controller, url_function = url_parts[:3]
1030
_url_args = url_parts[3:]
1032
url_args, url_vars = _url_args[len(_url_args) - 1].split("?")
1033
elif "?" in url_function:
1034
url_function, url_vars = url_function.split("?")
1010
# Duplicate menus - some controllers might re-use menu defined in certain models Eg. inv, supply
1011
s3_menu_dict["supply"] = s3_menu_dict["inv"]
1012
s3_menu_dict["scenario"] = s3_menu_dict["event"]
1014
# =============================================================================
1016
# =============================================================================
1017
def get_menu_label_and_state(menu_dict, # yikes
1023
""" Support Breadcrumbs """
1025
# Look at the menu for this Controller
1026
menu_spec = menu_dict[controller]["menu"]
1030
menu_spec = menu_dict[controller]["conditional1"]
1034
# Go through each entry in turn to find a match
1036
for menu_item in menu_spec:
1037
(label, active, url) = menu_item[:3]
1039
url_parts = url.split("/")[1:]
1040
# Check we're in the correct function
1041
url_app, url_controller, url_function = url_parts[:3]
1043
_url_args = url_parts[3:]
1045
url_args, url_vars = _url_args[len(_url_args) - 1].split("?")
1046
elif "?" in url_function:
1047
url_function, url_vars = url_function.split("?")
1053
url_args = url_parts[3:]
1037
1057
url_vars = None
1040
url_args = url_parts[3:]
1059
if url_function == function:
1060
if not args or url_args == args:
1061
if not vars or url_vars == vars:
1062
# We found the correct menu entry
1063
return label, active
1066
submenus = menu_item[3]
1068
# No Submenus defined for this main menu
1046
if url_function == function:
1047
if not args or url_args == args:
1048
if not vars or url_vars == vars:
1049
# We found the correct menu entry
1050
return label, active
1053
submenus = menu_item[3]
1055
# No Submenus defined for this main menu
1058
for submenu_item in submenus:
1060
(sub_label, sub_active, sub_url) = submenu_item[:3]
1062
sub_url_parts = sub_url.split("/")[1:]
1063
# Check we're in the correct function
1064
sub_url_app, sub_url_con, sub_url_func = sub_url_parts[:3]
1066
_sub_url_args = sub_url_parts[3:]
1067
if _sub_url_args and "?" in _sub_url_args:
1068
sub_url_args, sub_url_vars = _sub_url_args[len(_sub_url_args) - 1].split("?")
1069
elif "?" in sub_url_func:
1070
sub_url_func, sub_url_vars = sub_url_func.split("?")
1071
for submenu_item in submenus:
1073
(sub_label, sub_active, sub_url) = submenu_item[:3]
1075
sub_url_parts = sub_url.split("/")[1:]
1076
# Check we're in the correct function
1077
sub_url_app, sub_url_con, sub_url_func = sub_url_parts[:3]
1079
_sub_url_args = sub_url_parts[3:]
1080
if _sub_url_args and "?" in _sub_url_args:
1081
sub_url_args, sub_url_vars = _sub_url_args[len(_sub_url_args) - 1].split("?")
1082
elif "?" in sub_url_func:
1083
sub_url_func, sub_url_vars = sub_url_func.split("?")
1089
sub_url_args = sub_url_parts[3:]
1073
1093
sub_url_vars = None
1076
sub_url_args = sub_url_parts[3:]
1081
if sub_url_func == function:
1082
if not args or sub_url_args == args:
1083
if not vars or sub_url_vars == vars:
1084
# We found the correct menu entry
1085
return sub_label, sub_active
1089
# -----------------------------------------------------------------------------
1090
def define_breadcrumbs():
1091
breadcrumbs = [(deployment_settings.modules["default"].name_nice, True,
1092
"/%s" % request.application)]
1093
if request.controller != "default":
1095
controllerLabel = deployment_settings.modules[request.controller].name_nice
1097
controllerLabel = "."
1101
"/%s/%s" % (request.application, request.controller)
1104
if request.function != "index":
1106
(get_menu_label_and_state(s3_menu_dict,
1108
request.function) + \
1109
(URL(c=request.controller,
1110
f=request.function),)
1115
# Ignore this argument if it's the ID of a record
1116
int(request.args[0])
1094
if sub_url_func == function:
1095
if not args or sub_url_args == args:
1096
if not vars or sub_url_vars == vars:
1097
# We found the correct menu entry
1098
return sub_label, sub_active
1102
# -----------------------------------------------------------------------------
1103
def define_breadcrumbs():
1104
breadcrumbs = [(deployment_settings.modules["default"].name_nice, True,
1105
"/%s" % request.application)]
1106
if request.controller != "default":
1108
controllerLabel = deployment_settings.modules[request.controller].name_nice
1110
controllerLabel = "."
1114
"/%s/%s" % (request.application, request.controller)
1117
if request.function != "index":
1118
1118
breadcrumbs.append(
1119
1119
(get_menu_label_and_state(s3_menu_dict,
1120
1120
request.controller,
1121
request.function) + \
1124
1122
(URL(c=request.controller,
1126
args = request.args),)
1123
f=request.function),)
1131
breadcrumbs = define_breadcrumbs()
1128
# Ignore this argument if it's the ID of a record
1129
int(request.args[0])
1132
(get_menu_label_and_state(s3_menu_dict,
1137
(URL(c=request.controller,
1139
args = request.args),)
1144
breadcrumbs = define_breadcrumbs()
1147
s3_menu = lambda *args, **vars: None
1151
s3.menu_modules = []
1134
1155
# END =========================================================================