Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 11 additions & 45 deletions controllers/fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,16 @@
def index():
""" Module Homepage """

module_name = settings.modules[module].name_nice
response.title = module_name

htable = s3db.fire_shift_staff
stable = s3db.fire_station
station_id = None
station_name = None

human_resource_id = auth.s3_logged_in_human_resource()
query = htable.human_resource_id == human_resource_id

left = htable.on(htable.station_id == stable.id)

row = db(query).select(htable.station_id,
stable.name,
left = left,
limitby = (0, 1),
).first()
if row:
station_id = row.fire_shift_staff.station_id
station_name = row.fire_station.name

# Note that this requires setting the Porto Incident Types in modules/s3db/irs.py
incidents = DIV(A(DIV(T("Fire"),
_style="background-color:red;",
_class="question-container fleft"),
_href=URL(c="irs", f="ireport", args=["create"],
vars={"type":"fire"})),
A(DIV(T("Rescue"),
_style="background-color:green;",
_class="question-container fleft"),
_href=URL(c="irs", f="ireport", args=["create"],
vars={"type":"rescue"})),
A(DIV(T("Hazmat"),
_style="background-color:yellow;",
_class="question-container fleft"),
_href=URL(c="irs", f="ireport", args=["create"],
vars={"type":"hazmat"})))

return dict(incidents = incidents,
station_id = station_id,
station_name = station_name,
module_name = module_name,
)
return s3db.cms_index(module, alt_function="index_alt")

# -----------------------------------------------------------------------------
def index_alt():
"""
Module homepage for non-Admin users when no CMS content found
"""

# Just redirect to the list of Fire stations
s3_redirect_default(URL(f="station"))

# -----------------------------------------------------------------------------
def zone():
Expand Down Expand Up @@ -155,7 +121,7 @@ def fire_rheader(r, tabs=[]):
(T("Staff"), "human_resource"),
#(T("Shifts"), "shift"),
(T("Roster"), "shift_staff"),
(T("Vehicle Deployments"), "vehicle_report"),
#(T("Vehicle Deployments"), "vehicle_report"),
]
rheader_tabs = s3_rheader_tabs(r, tabs)

Expand Down
13 changes: 7 additions & 6 deletions modules/s3db/fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def model(self):
comment = S3PopupLink(c = "fire",
f = "zone_type",
label = ADD_ZONE_TYPE,
title = T("Zone Type"),
tooltip = T("Select a Zone Type from the list or click 'Add Zone Type'"),
),
label=T("Type")),
Expand Down Expand Up @@ -194,7 +195,7 @@ def model(self):
),
Field("code", length=10, # Mayon compatibility
label = T("Code"),
represent = lambda v: v or NONE,
represent = lambda v: v or current.messages["NONE"],
requires = code_requires,
),
Field("facility_type", "integer",
Expand Down Expand Up @@ -361,10 +362,10 @@ def model(self):
msg_no_match = T("No Vehicles could be found"),
msg_list_empty = T("No Vehicles currently registered"))

self.set_method("fire", "station",
method = "vehicle_report",
action = self.vehicle_report,
)
#self.set_method("fire", "station",
# method = "vehicle_report",
# action = self.vehicle_report,
# )

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

rheader = attr.get("rheader", None)
Expand Down
7 changes: 3 additions & 4 deletions modules/s3menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,13 +937,12 @@ def fire():
),
M("Fire Zones", f="zone")(
M("Create", m="create"),
#M("Map", m="map"),
#M("Import", m="import"),
M("Map", m="map"),
M("Import", m="import"),
),
M("Zone Types", f="zone_type")(
M("Create", m="create"),
#M("Map", m="map"),
#M("Import", m="import"),
M("Import", m="import"),
),
M("Water Sources", f="water_source")(
M("Create", m="create"),
Expand Down