Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 79343ed

Browse files
committed
Fire module refresh
- Remove/comment dependencies on IRS (index, vehicle_reports) - Fix error while adding fire station without a code - Allow import and display map of fire zones - Add title to Zone Types popup
1 parent 20c83a6 commit 79343ed

3 files changed

Lines changed: 21 additions & 55 deletions

File tree

controllers/fire.py

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,16 @@
1010
def index():
1111
""" Module Homepage """
1212

13-
module_name = settings.modules[module].name_nice
14-
response.title = module_name
15-
16-
htable = s3db.fire_shift_staff
17-
stable = s3db.fire_station
18-
station_id = None
19-
station_name = None
20-
21-
human_resource_id = auth.s3_logged_in_human_resource()
22-
query = htable.human_resource_id == human_resource_id
23-
24-
left = htable.on(htable.station_id == stable.id)
25-
26-
row = db(query).select(htable.station_id,
27-
stable.name,
28-
left = left,
29-
limitby = (0, 1),
30-
).first()
31-
if row:
32-
station_id = row.fire_shift_staff.station_id
33-
station_name = row.fire_station.name
34-
35-
# Note that this requires setting the Porto Incident Types in modules/s3db/irs.py
36-
incidents = DIV(A(DIV(T("Fire"),
37-
_style="background-color:red;",
38-
_class="question-container fleft"),
39-
_href=URL(c="irs", f="ireport", args=["create"],
40-
vars={"type":"fire"})),
41-
A(DIV(T("Rescue"),
42-
_style="background-color:green;",
43-
_class="question-container fleft"),
44-
_href=URL(c="irs", f="ireport", args=["create"],
45-
vars={"type":"rescue"})),
46-
A(DIV(T("Hazmat"),
47-
_style="background-color:yellow;",
48-
_class="question-container fleft"),
49-
_href=URL(c="irs", f="ireport", args=["create"],
50-
vars={"type":"hazmat"})))
51-
52-
return dict(incidents = incidents,
53-
station_id = station_id,
54-
station_name = station_name,
55-
module_name = module_name,
56-
)
13+
return s3db.cms_index(module, alt_function="index_alt")
14+
15+
# -----------------------------------------------------------------------------
16+
def index_alt():
17+
"""
18+
Module homepage for non-Admin users when no CMS content found
19+
"""
20+
21+
# Just redirect to the list of Fire stations
22+
s3_redirect_default(URL(f="station"))
5723

5824
# -----------------------------------------------------------------------------
5925
def zone():
@@ -155,7 +121,7 @@ def fire_rheader(r, tabs=[]):
155121
(T("Staff"), "human_resource"),
156122
#(T("Shifts"), "shift"),
157123
(T("Roster"), "shift_staff"),
158-
(T("Vehicle Deployments"), "vehicle_report"),
124+
#(T("Vehicle Deployments"), "vehicle_report"),
159125
]
160126
rheader_tabs = s3_rheader_tabs(r, tabs)
161127

modules/s3db/fire.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def model(self):
108108
comment = S3PopupLink(c = "fire",
109109
f = "zone_type",
110110
label = ADD_ZONE_TYPE,
111+
title = T("Zone Type"),
111112
tooltip = T("Select a Zone Type from the list or click 'Add Zone Type'"),
112113
),
113114
label=T("Type")),
@@ -194,7 +195,7 @@ def model(self):
194195
),
195196
Field("code", length=10, # Mayon compatibility
196197
label = T("Code"),
197-
represent = lambda v: v or NONE,
198+
represent = lambda v: v or current.messages["NONE"],
198199
requires = code_requires,
199200
),
200201
Field("facility_type", "integer",
@@ -361,10 +362,10 @@ def model(self):
361362
msg_no_match = T("No Vehicles could be found"),
362363
msg_list_empty = T("No Vehicles currently registered"))
363364

364-
self.set_method("fire", "station",
365-
method = "vehicle_report",
366-
action = self.vehicle_report,
367-
)
365+
#self.set_method("fire", "station",
366+
# method = "vehicle_report",
367+
# action = self.vehicle_report,
368+
# )
368369

369370
# =====================================================================
370371
# Water Sources
@@ -569,7 +570,7 @@ def fire_staff_on_duty(station_id=None):
569570
def vehicle_report(r, **attr):
570571
"""
571572
Custom method to provide a report on Vehicle Deployment Times
572-
- this is one of the main tools currently used to manage an Incident
573+
@ToDo: Currently unused, requires deprecated irs module. Reimplement based on event module.
573574
"""
574575

575576
rheader = attr.get("rheader", None)

modules/s3menus.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,13 +937,12 @@ def fire():
937937
),
938938
M("Fire Zones", f="zone")(
939939
M("Create", m="create"),
940-
#M("Map", m="map"),
941-
#M("Import", m="import"),
940+
M("Map", m="map"),
941+
M("Import", m="import"),
942942
),
943943
M("Zone Types", f="zone_type")(
944944
M("Create", m="create"),
945-
#M("Map", m="map"),
946-
#M("Import", m="import"),
945+
M("Import", m="import"),
947946
),
948947
M("Water Sources", f="water_source")(
949948
M("Create", m="create"),

0 commit comments

Comments
 (0)