Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sahana/eden
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Dec 4, 2019
2 parents e91f2e9 + 6c53141 commit c56a18d
Show file tree
Hide file tree
Showing 41 changed files with 1,673 additions and 853 deletions.
2 changes: 0 additions & 2 deletions controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ def user():
# auth_membership = "user_id",
# )

s3_str = s3base.s3_str

list_fields = ["first_name",
"last_name",
"email",
Expand Down
4 changes: 1 addition & 3 deletions controllers/cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ def prep(r):
rows = db(query).select(itable.sender_name,
groupby=itable.sender_name)
sender_options = {}
from s3 import s3_str
for row in rows:
sender_name = row.sender_name
sender_options[sender_name] = s3_str(T(sender_name))
Expand Down Expand Up @@ -1134,6 +1133,7 @@ def prep(r):
r.resource.add_filter(FS("is_template") == True)

table = r.table
tablename = "cap_alert"

if r.representation == "xls":

Expand Down Expand Up @@ -1490,7 +1490,6 @@ def set_priority_js():
orderby = wptable.name,
)

from s3 import s3_str
priorities = [(s3_str(T(r.name)), r.urgency, r.severity, r.certainty, r.color_code)\
for r in rows]

Expand Down Expand Up @@ -1527,7 +1526,6 @@ def cap_AreaRowOptionsBuilder(alert_id, caller=None):
values = [row.id for row in rows]
count = len(values)
if count:
from s3 import s3_str
if count == 1:
query_ = (atable.id == values[0])
else:
Expand Down
33 changes: 20 additions & 13 deletions controllers/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def person():
settings.hrm.use_skills = True
settings.search.filter_manager = True

# Use Legacy table for unavailability
s3db.add_components("pr_person",
deploy_unavailability = "person_id",
)

return s3db.hrm_person_controller(replace_option = None,
csv_extra_fields = [
# CSV column headers, so no T()
Expand Down Expand Up @@ -945,22 +950,24 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [dict(label=s3_str(T("Enable")),
_class="action-btn",
url=URL(args=["[id]", "enable"]),
restrict = restrict_e),
dict(label=s3_str(T("Disable")),
_class="action-btn",
url = URL(args = ["[id]", "disable"]),
restrict = restrict_d),
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
"restrict": restrict_e,
},
{"label": s3_str(T("Disable")),
"_class": "action-btn",
"url": URL(args = ["[id]", "disable"]),
"restrict": restrict_d,
},
]
if not s3task._is_alive():
# No Scheduler Running
s3.actions += [dict(label=s3_str(T("Poll")),
_class="action-btn",
url = URL(args = ["[id]", "poll"]),
restrict = restrict_d)
s3.actions += [{"label": s3_str(T("Poll")),
"_class": "action-btn",
"url": URL(args = ["[id]", "poll"]),
"restrict": restrict_d,
},
]
return output
s3.postp = postp
Expand Down
2 changes: 1 addition & 1 deletion controllers/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3034,7 +3034,7 @@ def postp(r, output):
# Normal Action Buttons
s3_action_buttons(r, deletable=False)
# Custom Action Buttons
s3.actions += [{"label": s3base.s3_str(T("Show on Map")),
s3.actions += [{"label": s3_str(T("Show on Map")),
"_class": "action-btn",
"url": URL(f = "index",
vars = {"poi": "[id]"},
Expand Down
8 changes: 8 additions & 0 deletions controllers/hrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,14 @@ def disciplinary_action():

return s3_rest_controller()

# =============================================================================
# Shifts
# =============================================================================
def shift():
""" Shifts Controller """

return s3_rest_controller()

# =============================================================================
# Messaging
# =============================================================================
Expand Down
11 changes: 1 addition & 10 deletions controllers/msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def postp(r, output):
# Normal Action Buttons
s3_action_buttons(r)
# Custom Action Buttons
s3.actions += [{"label": s3base.s3_str(T("Mark Sender")),
s3.actions += [{"label": s3_str(T("Mark Sender")),
"url": URL(f = "mark_sender",
args = ["[id]"],
),
Expand Down Expand Up @@ -765,7 +765,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -829,7 +828,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -910,7 +908,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -981,7 +978,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -1064,7 +1060,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Subscribe")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -1140,7 +1135,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -1416,7 +1410,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down Expand Up @@ -1612,7 +1605,6 @@ def postp(r, output):
restrict_k = [str(record.id) for record in records]

# @ToDo: Make these S3Methods rather than additional controllers
from s3 import s3_str
s3.actions += [{"label": s3_str(T("Search")),
"_class": "action-btn",
"url": URL(args=["[id]", "poll"]),
Expand Down Expand Up @@ -1836,7 +1828,6 @@ def postp(r, output):
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]

from s3 import s3_str
s3.actions += [{"label": s3_str(T("Enable")),
"_class": "action-btn",
"url": URL(args=["[id]", "enable"]),
Expand Down
3 changes: 1 addition & 2 deletions controllers/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ def postp(r, output):
r.next = URL(args=[form_vars.id, "req_skill"])
else:
s3_action_buttons(r, deletable =False)
s3_str = s3base.s3_str
# Add delete button for those records which are not completed
# @ToDo: Handle icons
table = r.table
Expand Down Expand Up @@ -770,7 +769,7 @@ def postp(r, output):
#rows = db(query).select(table.id)
#restrict = [str(row.id) for row in rows]
#s3.actions.append(
# {"label": s3_str(T("View Items")),
## {"label": s3_str(T("View Items")),
# "url": URL(c = "req",
# f = "req",
# args = ["[id]", "req_item"],
Expand Down
3 changes: 0 additions & 3 deletions controllers/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def postp(r, output):
restrict_d = [str(row.id) for row in rows if row.task_id is None]
restrict_s = [str(row.id) for row in rows if row.task_id is not None]
restrict_c = [str(row.id) for row in rows if row.type in (3, 4)]
s3_str = s3base.s3_str
s3.actions += [{"url": URL(c = module,
f = "deployment",
args = [deployment_id, "instance", "[id]", "deploy"],
Expand Down Expand Up @@ -278,7 +277,6 @@ def postp(r, output):
)
restrict_e = [str(row.server_id) for row in rows if row.enabled is False]
restrict_d = [str(row.server_id) for row in rows if row.enabled is True]
s3_str = s3base.s3_str
s3.actions += [{"url": URL(args = ["[id]", "enable"]),
"_class": "action-btn",
"label": s3_str(T("Enable")),
Expand Down Expand Up @@ -363,7 +361,6 @@ def postp(r, output):
)
restrict_e = [str(row.id) for row in rows if not row.enabled]
restrict_d = [str(row.id) for row in rows if row.enabled]
s3_str = s3base.s3_str
s3.actions += [{"url": URL(args=["[id]", "enable"]),
"_class": "action-btn",
"label": s3_str(T("Enable")),
Expand Down
2 changes: 1 addition & 1 deletion controllers/sit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

module = request.controller
resourcename = request.function
#resourcename = request.function

if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
Expand Down
30 changes: 18 additions & 12 deletions controllers/stdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@ def postp(r, output):
# Normal Action Buttons
s3_action_buttons(r)
# Custom Action Buttons
s3.actions += [dict(label=s3base.s3_str(T("Certificate")),
_class="action-btn",
url=URL(f="tenure",
args=["[id]", "certificate"])),
s3.actions += [{"label": s3_str(T("Certificate")),
"_class": "action-btn",
"url": URL(f = "tenure",
args = ["[id]", "certificate"],
),
},
]

return output
Expand Down Expand Up @@ -258,10 +260,12 @@ def postp(r, output):
# Normal Action Buttons
s3_action_buttons(r)
# Custom Action Buttons
s3.actions += [dict(label=s3base.s3_str(T("Certificate")),
_class="action-btn",
url=URL(f="tenure",
args=["[id]", "certificate"])),
s3.actions += [{"label": s3_str(T("Certificate")),
"_class": "action-btn",
"url": URL(f = "tenure",
args = ["[id]", "certificate"],
),
},
]

return output
Expand All @@ -279,10 +283,12 @@ def postp(r, output):
# Normal Action Buttons
s3_action_buttons(r)
# Custom Action Buttons
s3.actions += [dict(label=s3base.s3_str(T("Certificate")),
_class="action-btn",
url=URL(f="tenure",
args=["[id]", "certificate"])),
s3.actions += [{"label": s3_str(T("Certificate")),
"_class": "action-btn",
"url": URL(f = "tenure",
args = ["[id]", "certificate"],
),
},
]

return output
Expand Down
2 changes: 1 addition & 1 deletion controllers/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def postp(r, output):
return output["item"]
if not r.component and method != "summary":
# Replace the Action buttons
s3.actions = [{"label": s3base.s3_str(messages.UPDATE),
s3.actions = [{"label": s3_str(messages.UPDATE),
"_class": "action-btn edit",
"url": URL(c="survey",
f="series",
Expand Down
2 changes: 1 addition & 1 deletion controllers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def prep(r):
def postp(r, output):
if r.interactive and r.id:
if r.component and r.component.alias == "job":
s3.actions = [{"label": s3base.s3_str(T("Reset")),
s3.actions = [{"label": s3_str(T("Reset")),
"url": URL(c = "sync",
f = "repository",
args = [str(r.id),
Expand Down
6 changes: 4 additions & 2 deletions models/00_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@
# CRUD
s3.crud = Storage()

# S3 Custom Validators and Widgets, imported here into the global
# namespace in order to access them without the s3base namespace prefix
# Frequently used S3 utilities, validators and widgets, imported here
# into the global namespace in order to access them without the s3base
# namespace prefix
s3_str = s3base.s3_str
s3_action_buttons = s3base.S3CRUD.action_buttons
s3_fullname = s3base.s3_fullname
s3_redirect_default = s3base.s3_redirect_default
Expand Down
2 changes: 1 addition & 1 deletion models/00_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
import s3db.po
import s3db.police
import s3db.pr
import s3db.sit
import s3db.proc
import s3db.project
import s3db.req
import s3db.s3
import s3db.security
import s3db.setup
import s3db.sit
import s3db.stats
import s3db.stdm
import s3db.supply
Expand Down
1 change: 0 additions & 1 deletion models/zzz_1st_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ def duration(msg, start):
try:
info(error)
except:
s3_str = s3base.s3_str
info("\n".join(s3_str(el) for el in error))

# Check to see if the "SITE_DEFAULT" gis_hierarchy was prepopulated.
Expand Down
6 changes: 3 additions & 3 deletions modules/s3/codecs/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

from gluon import current, HTTP

from s3compat import StringIO
from s3compat import BytesIO
from ..s3codec import S3Codec
from ..s3resource import S3Resource
from ..s3utils import s3_str
Expand Down Expand Up @@ -178,7 +178,7 @@ def encode(self, resource, **attr):
)

# Build the doc
output_stream = StringIO()
output_stream = BytesIO()
doc.build(flowables,
output_stream,
#canvasmaker=canvas.Canvas, # is default
Expand Down Expand Up @@ -715,7 +715,7 @@ def draw_image(self,
Helper function to draw an image
- requires PIL (required for ReportLab image handling anyway)
@param img: the image (filename or StringIO buffer)
@param img: the image (filename or BytesIO buffer)
@param x: drawing position
@param y: drawing position
@param width: the target width of the image (in points)
Expand Down
Loading

0 comments on commit c56a18d

Please sign in to comment.