Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nursix/eden
Browse files Browse the repository at this point in the history
Conflicts:
	private/eden_deploy
  • Loading branch information
nursix committed Mar 13, 2020
2 parents cc76136 + b8b6e20 commit b59e607
Show file tree
Hide file tree
Showing 333 changed files with 23,639 additions and 16,659 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DRKCM-1.6.0 (2020-02-08 16:02:27)
DRKCM-1.6.1 (2020-03-13 22:03:30)
82 changes: 51 additions & 31 deletions controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
def index():
""" Module's Home Page """

module_name = settings.modules["admin"].name_nice
module_name = settings.modules["admin"].get("name_nice")
response.title = module_name

return {"module_name": module_name}
return {"module_name": module_name,
}

# =============================================================================
@auth.s3_requires_membership(1)
Expand Down Expand Up @@ -927,12 +928,14 @@ def postp(r, output):
from s3.s3translate import TranslateAPI, Strings
if form.accepts(request.vars, session):
modlist = []
form_request_vars_get = form.request_vars.get
# If only one module is selected
if isinstance(form.request_vars.module_list, str):
modlist.append(form.request_vars.module_list)
module_list = form_request_vars_get("module_list")
if isinstance(module_list, str):
modlist.append(module_list)
# If multiple modules are selected
else:
modlist = form.request_vars.module_list
modlist = module_list

# If no module is selected
if modlist is None:
Expand All @@ -944,17 +947,17 @@ def postp(r, output):
all_template_flag = 1
A = TranslateAPI()
modlist = A.get_modules()
if "core" in form.request_vars.module_list:
if "core" in module_list:
modlist.append("core")

# Obtaining the language file from the language code
code = form.request_vars.new_code
code = form_request_vars_get("new_code")
if code == "":
code = form.request_vars.code
code = form_request_vars_get("code")
code += ".py"

# Obtaining the type of file to export to
filetype = form.request_vars.filetype
filetype = form_request_vars_get("filetype")

# Generate the file to download
X = Strings()
Expand Down Expand Up @@ -988,29 +991,31 @@ def postp(r, output):
modules = settings.modules
while num < max_rows:
check = "yes"
mod_name = modules[modlist[num]].name_nice
mod_name = "%s (%s)" %(mod_name, modlist[num])
module = modlist[num]
mod_name = modules[module].get("name_nice") or module
mod_name = "%s (%s)" % (mod_name, module)
row = TR(TD(num + 1),
TD(INPUT(_type="checkbox",
_name="module_list",
_value=modlist[num],
TD(INPUT(_type = "checkbox",
_name = "module_list",
_value = module,
_checked = check,
_class="translate-select-module",
_class = "translate-select-module",
)),
TD(mod_name),
)

for c in range(1, NO_OF_COLUMNS):
cmax_rows = num + (c * max_rows)
if cmax_rows < modcount:
mod_name = modules[modlist[cmax_rows]].name_nice
mod_name = "%s (%s)" % (mod_name, modlist[cmax_rows])
module = modlist[cmax_rows]
mod_name = modules[module].get("name_nice") or module
mod_name = "%s (%s)" % (mod_name, module)
row.append(TD(cmax_rows + 1))
row.append(TD(INPUT(_type="checkbox",
_name="module_list",
_value=modlist[cmax_rows],
row.append(TD(INPUT(_type = "checkbox",
_name = "module_list",
_value = module,
_checked = check,
_class="translate-select-module",
_class = "translate-select-module",
)))
row.append(TD(mod_name))
num += 1
Expand All @@ -1019,9 +1024,9 @@ def postp(r, output):
div = DIV(table, BR())

# Toogle box to select/de-select all modules
row = TR(TD(INPUT(_type="checkbox",
_class="translate-select-all-modules",
_checked=check,
row = TR(TD(INPUT(_type = "checkbox",
_class = "translate-select-all-modules",
_checked = check,
),
),
TD(T("Select all modules")),
Expand All @@ -1032,27 +1037,42 @@ def postp(r, output):
div.append(BR())

# Checkbox for inclusion of core files
row = TR(TD(INPUT(_type="checkbox", _name="module_list",
_value="core", _checked="yes")),
row = TR(TD(INPUT(_type = "checkbox",
_name = "module_list",
_value = "core",
_checked = "yes",
),
),
TD(T("Include core files")),
)
div.append(row)
div.append(BR())

# Checkbox for inclusion of templates
row = TR(TD(INPUT(_type="checkbox", _name="module_list",
_value="all")),
row = TR(TD(INPUT(_type = "checkbox",
_name = "module_list",
_value = "all",
),
),
TD(T("Select all templates (All modules included)")),
)
div.append(row)
div.append(BR())

# Provide option to choose export format
row = TR(TD("%s:" % T("Export as")),
TD(INPUT(_type="radio", _name="filetype",
_value="xls", _checked="checked")),
TD(INPUT(_type = "radio",
_name = "filetype",
_value = "xls",
_checked = "checked",
),
),
TD(".xls (Excel)"),
TD(INPUT(_type="radio", _name="filetype", _value="po")),
TD(INPUT(_type = "radio",
_name = "filetype",
_value = "po",
),
),
TD(".po (Pootle)"),
BR(),
BR(),
Expand Down
1 change: 0 additions & 1 deletion controllers/assess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

module = request.controller
resourcename = request.function

if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
Expand Down
8 changes: 5 additions & 3 deletions controllers/assess2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"""

module = request.controller
resourcename = request.function

if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)

resourcename = request.function

# -----------------------------------------------------------------------------
# Define the Model
# @ToDo: Move to modules/s3db/assess.py
Expand Down Expand Up @@ -1925,9 +1926,10 @@ def impact_type_comment():
def index():
""" Module's Home Page """

module_name = settings.modules[module].name_nice
module_name = settings.modules[module].get("name_nice")
response.title = module_name
return dict(module_name=module_name)
return {"module_name": module_name,
}

# -----------------------------------------------------------------------------
def create():
Expand Down
3 changes: 1 addition & 2 deletions controllers/br.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

module = request.controller
resourcename = request.function

if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
Expand All @@ -25,7 +24,7 @@ def index_alt():
# Just redirect to list of current cases
s3_redirect_default(URL(f="person", vars={"closed": "0"}))

return {"module_name": settings.modules["br"].name_nice}
return {"module_name": settings.modules["br"].get("name_nice")}

# =============================================================================
# Case File and Component Tabs
Expand Down
17 changes: 9 additions & 8 deletions controllers/budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"""

module = request.controller
resourcename = request.function

# NB Requires 'project' module too
if not settings.has_module(module):
Expand All @@ -23,9 +22,10 @@
def index():
""" Module's Home Page """

module_name = settings.modules[module].name_nice
module_name = settings.modules[module].get("name_nice")
response.title = module_name
return dict(module_name=module_name)
return {"module_name": module_name,
}

# =============================================================================
def budget():
Expand All @@ -40,7 +40,7 @@ def prep(r):
return True
s3.prep = prep

return s3_rest_controller(rheader=s3db.budget_rheader)
return s3_rest_controller(rheader = s3db.budget_rheader)

# =============================================================================
def allocation():
Expand All @@ -60,7 +60,7 @@ def location():

# @todo: link to gis_location

return s3_rest_controller(main="code")
return s3_rest_controller(main = "code")

# =============================================================================
def item():
Expand All @@ -83,8 +83,9 @@ def kit():
s3db.configure("budget_kit",
update_next=URL(f="kit_item", args=request.args[1]))

return s3_rest_controller(rheader=s3db.budget_rheader,
main="code")
return s3_rest_controller(main = "code",
rheader = s3db.budget_rheader,
)

# =============================================================================
def bundle():
Expand All @@ -94,7 +95,7 @@ def bundle():
s3db.configure("budget_bundle",
update_next=URL(f="bundle_kit_item", args=request.args[1]))

return s3_rest_controller(rheader=s3db.budget_rheader)
return s3_rest_controller(rheader = s3db.budget_rheader)

# =============================================================================
def staff():
Expand Down
18 changes: 11 additions & 7 deletions controllers/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ def uuid8anum():

# Set as default search method
s3db.configure(tablename,
search_method=building_nzseel1_search)
search_method = building_nzseel1_search,
)
# -------------------------------------------------------------------------

# NZSEE Level 2 (~ATC-20 Rapid Evaluation) Safety Assessment Form
Expand Down Expand Up @@ -548,7 +549,8 @@ def uuid8anum():

# Set as default search method
s3db.configure(tablename,
search_method=building_nzseel2_search)
search_method = building_nzseel2_search,
)


# -----------------------------------------------------------------------------
Expand All @@ -558,14 +560,16 @@ def index():

""" Module's Home Page """

module_name = settings.modules[module].name_nice
module_name = settings.modules[module].get("name_nice")
response.title = module_name
return dict(module_name=module_name)
return {"module_name": module_name,
}

# NZSEE Level 1 (~ATC-20 Rapid Evaluation) Safety Assessment Form -------------
# -----------------------------------------------------------------------------
def nzseel1():

"""
NZSEE Level 1 (~ATC-20 Rapid Evaluation) Safety Assessment Form
RESTful CRUD controller
@ToDo: Action Button to create a new L2 Assessment from an L1
"""
Expand All @@ -579,7 +583,7 @@ def nzseel1():
# Subheadings in forms:
s3db.configure(tablename,
deletable=False,
create_next = URL(module,resourcename, args="[id]"),
create_next = URL(module, resourcename, args="[id]"),
subheadings = {"name": ".", # Description in ATC-20
"collapse": "%s / %s" % (T("Overall Hazards"), T("Damage")),
"posting": ".",
Expand Down
13 changes: 4 additions & 9 deletions controllers/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

module = request.controller
resourcename = request.function

if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
Expand All @@ -21,10 +20,7 @@ def _map_plugin(**client_config):

# -----------------------------------------------------------------------------
def index():
try:
module_name = settings.modules[module].name_nice
except:
module_name = T("Climate")
module_name = settings.modules[module].get("name_nice", T("Climate"))

# Include an embedded Overview Map on the index page
config = gis.get_config()
Expand Down Expand Up @@ -70,10 +66,9 @@ def index():
)

response.title = module_name
return dict(
module_name=module_name,
map=gis_map
)
return {"module_name": module_name,
"map": gis_map,
}

# -----------------------------------------------------------------------------
def climate_overlay_data():
Expand Down
5 changes: 2 additions & 3 deletions controllers/cms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""

module = request.controller
resourcename = request.function

if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
Expand Down Expand Up @@ -110,7 +109,7 @@ def post():
#s3.filter = (table.series_id == None)

# Custom Method to add Comments
s3db.set_method(module, resourcename,
s3db.set_method("cms", "post",
method = "discuss",
action = discuss)

Expand Down Expand Up @@ -245,7 +244,7 @@ def prep(r):
for module in _modules:
if module in ("appadmin", "errors", "ocr"):
continue
modules[module] = _modules[module].name_nice
modules[module] = _modules[module].get("name_nice")
s3db.cms_post_module.field.requires = \
IS_IN_SET_LAZY(lambda: sort_dict_by_values(modules))

Expand Down
2 changes: 1 addition & 1 deletion controllers/dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def index():
""" Module's Home Page """

module_name = settings.modules[module].name_nice
module_name = settings.modules[module].get("name_nice")
response.title = module_name
return {"module_name": module_name,
}
Expand Down
Loading

0 comments on commit b59e607

Please sign in to comment.