Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nursix/eden
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Mar 1, 2021
2 parents 2d8cbf1 + 306c6e6 commit 7b5b652
Show file tree
Hide file tree
Showing 12 changed files with 323 additions and 78 deletions.
5 changes: 5 additions & 0 deletions languages/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,9 @@
'Date for Follow-up': 'Wiedervorlage am',
'Date is required when marking the appointment as completed': 'Datumsangabe erforderlich wenn der Termin als beendet markiert werden soll',
'Date is required!': 'Datum ist erforderlich!',
'Date must be %(max)s or earlier!': 'Spätestes mögliches Datum ist %(max)s!',
'Date must be %(min)s or later!': 'Frühestes mögliches Datum ist %(min)s!',
'Date must be between %(min)s and %(max)s!': 'Datum muss zwischen %(min)s und %(max)s sein!',
'Date of AKN': 'AKN-Datum',
'Date of Birth': 'Geburtsdatum',
'Date of Entry Certificate': 'Datum des Ankunftsnachweises',
Expand Down Expand Up @@ -5140,6 +5143,8 @@
'Swaziland': 'Swasiland',
'Sweden': 'Schweden',
'Switch to 3D': 'In Google Earth anzeigen',
'Switch to list view': 'Zur Listenansicht wechseln',
'Switch to organizer': 'Zur Kalenderansicht wechseln',
'Switzerland': 'Schweiz',
'Symbology': 'Symbolisierung',
'Sync Conflicts': 'Synchronisierungskonflikte',
Expand Down
28 changes: 16 additions & 12 deletions modules/templates/RLP/cms_post.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
Name,Module,Resource,Body,Comments
Subject OrganisationDisabled,hrm,delegation,{system}: Volunteer Deployment of {volunteer_id} has been Approved,Rename into 'Subject Organisation' to activate notifications
Message Organisation,hrm,delegation,Volunteer {volunteer_id} {volunteer_name} has been Approved for a Deployment to {organisation} from {start} to {end}.,
Subject VolunteerDisabled,hrm,delegation,{system}: Your Deployment to {organisation} has been Approved,Rename into 'Subject Volunteer' to activate notifications
Message Volunteer,hrm,delegation,Your Deployment to {organisation} from {start} to {end} has been Approved.,
Subject OfficeDisabled,hrm,delegation,{system}: Volunteer Deployment of {volunteer_id} has been Approved,Rename into 'Subject Office' to activate notifications
Message Office,hrm,delegation,Volunteer {volunteer_id} {volunteer_name} has been Approved for a Deployment to {organisation} from {start} to {end}.,
WelcomeMessageDisabled,auth,user,"Welcome to the {system_name} Portal!
Name,Module,Resource,Comments,Body
Subject Organisation,hrm,delegation,Notification MSAGD=>Deploying Organisation,{system}: Volunteer Deployment of {volunteer_id} has been Approved
Message Organisation,hrm,delegation,Notification MSAGD=>Deploying Organisation,Volunteer {volunteer_id} {volunteer_name} has been Approved for a Deployment to {organisation} from {start} to {end}.
Subject Volunteer,hrm,delegation,Notification MSAGD=>Volunteer,{system}: Your Deployment to {organisation} has been Approved
Message Volunteer,hrm,delegation,Notification MSAGD=>Volunteer,Your Deployment to {organisation} from {start} to {end} has been Approved.
Subject Office,hrm,delegation,Notification MSAGD=>Volunteer Office,{system}: Volunteer Deployment of {volunteer_id} has been Approved
Message Office,hrm,delegation,Notification MSAGD=>Volunteer Office,Volunteer {volunteer_id} {volunteer_name} has been Approved for a Deployment to {organisation} from {start} to {end}.
Subject OrgToVolunteer,hrm,delegation,Notification Deploying Organisation=>Volunteer,{system}: Your Deployment to {organisation} has been Approved
Message OrgToVolunteer,hrm,delegation,Notification Deploying Organisation=>Volunteer,Your Deployment to {organisation} from {start} to {end} has been Approved.
WelcomeMessageDisabled,auth,user,Rename into ”WelcomeMessage” to activate welcome message,"Welcome to the {system_name} Portal!

You can edit your user profile at {profile}",Rename into ”WelcomeMessage” to activate welcome message
HoursMatrixIntro,pr,person_availability,"Bitte markieren Sie alle Zeiten zu denen Sie während der Woche grundsätzlich verfügbar sind. Die Spalten der untenstehenden Tabelle bilden Uhrzeiten ab. Klicken Sie auf die Kästchen um einzelne Stunden aus/abzuwählen, oder halten Sie die linke Maustaste gedrückt und fahren Sie über die Kästchen um mehrere nacheinander aus/abzuwählen.",
SelfRegistrationIntro,auth,user,"Bitte tragen Sie hier alle relevanten Informationen für einen Einsatz ein. Für die Suche nach geeigneten UnterstützerInnen ist vor allem die Angabe Ihres Wohnorts (PLZ und Wohnort), Ihrer Kontaktdaten (Telefon und E-Mail) und die Angabe Ihrer wöchentlichen Verfügbarkeit (Stunden/Woche) wichtig.",
AvailabilitySitesIntro,pr,person_availability_site,Bitte wählen Sie über die untenstehende Liste alle für Sie möglichen Einsatzorte (d.h. Gesundheitsämter oder/und Impfzentren (IZ)) aus (Mehrfachauswahl ist möglich).,
You can edit your user profile at {profile}"
HoursMatrixIntro,pr,person_availability,,"Bitte markieren Sie alle Zeiten zu denen Sie während der Woche grundsätzlich verfügbar sind. Die Spalten der untenstehenden Tabelle bilden Uhrzeiten ab. Klicken Sie auf die Kästchen um einzelne Stunden aus/abzuwählen, oder halten Sie die linke Maustaste gedrückt und fahren Sie über die Kästchen um mehrere nacheinander aus/abzuwählen."
SelfRegistrationIntro,auth,user,,"Bitte tragen Sie hier alle relevanten Informationen für einen Einsatz ein. Für die Suche nach geeigneten UnterstützerInnen ist vor allem die Angabe Ihres Wohnorts (PLZ und Wohnort), Ihrer Kontaktdaten (Telefon und E-Mail) und die Angabe Ihrer wöchentlichen Verfügbarkeit (Stunden/Woche) wichtig."
AvailabilitySitesIntro,pr,person_availability_site,,Bitte wählen Sie über die untenstehende Liste alle für Sie möglichen Einsatzorte (d.h. Gesundheitsämter oder/und Impfzentren (IZ)) aus (Mehrfachauswahl ist möglich).
DelegationOrganizerIntro,hrm,delegation,,Markieren Sie einen oder mehrere aufeinanderfolgende Tage um einen Einsatz anzulegen.
NotificationIntroOrg,hrm,delegation,,Wählen Sie welche Benachrichtigungen Sie senden wollen. Sie können die Mitteilung vor dem Versenden bearbeiten. Eine Kopie der Mitteilung wird an Sie selbst gesendet.
68 changes: 57 additions & 11 deletions modules/templates/RLP/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from collections import OrderedDict

from gluon import current, redirect, URL, DIV, TABLE, TAG, TR
from gluon import current, redirect, URL, A, DIV, TABLE, TAG, TR
from gluon.storage import Storage

from s3 import FS, IS_LOCATION, S3DateFilter, S3Represent, s3_fieldmethod, s3_fullname, s3_yes_no_represent
Expand Down Expand Up @@ -341,6 +341,7 @@ def customise_cms_post_resource(r, tablename):
"date",
"comments",
],
orderby = "cms_post.name",
)

settings.customise_cms_post_resource = customise_cms_post_resource
Expand Down Expand Up @@ -957,6 +958,7 @@ def postprocess_person_select(records, rfields=None, represent=False, as_rows=Fa
#"pr_person.fullname": (HIDDEN, HIDDEN),
"pr_person_details.alias": (HIDDEN, HIDDEN),
"pr_phone_contact.value": (None, HIDDEN),
"pr_phonenumber_contact.value": (None, HIDDEN),
"pr_email_contact.value": (None, HIDDEN),
}
for person_id in person_ids:
Expand Down Expand Up @@ -2321,15 +2323,19 @@ def customise_hrm_delegation_resource(r, tablename):
organisations = None

# Append inline-notifications
from s3 import S3WithIntro
from .notifications import InlineNotifications
crud_form.append(
InlineNotifications("notifications",
label = T("Notifications"),
person_id = volunteer_id,
recipients = ("volunteer",),
organisations = organisations,
reply_to_org = True,
))
S3WithIntro(
InlineNotifications("notifications",
label = T("Notifications"),
person_id = volunteer_id,
organisations = organisations,
reply_to = "user", #"org",
sender = "org",
),
intro = ("hrm", "delegation", "NotificationIntroOrg"),
))
s3db.configure("hrm_delegation", crud_form=crud_form)

# Enable site_id and filter to sites of org
Expand Down Expand Up @@ -2392,12 +2398,12 @@ def customise_hrm_delegation_controller(**attr):
insertable = False,
)

auth = current.auth
coordinator = auth.s3_has_role("COORDINATOR")

standard_prep = s3.prep
def custom_prep(r):

auth = current.auth
coordinator = auth.s3_has_role("COORDINATOR")

if not coordinator:
settings.ui.export_formats = ("pdf", "xls")
if r.representation not in ALLOWED_FORMATS:
Expand Down Expand Up @@ -2564,6 +2570,46 @@ def custom_prep(r):
return result
s3.prep = custom_prep

standard_postp = s3.postp
def custom_postp(r, output):

# Call standard postp
if callable(standard_postp):
output = standard_postp(r, output)

if r.controller == "vol" and volunteer_id and isinstance(output, dict):

method = r.method
if not method:
# Add switch to organizer
switch = A(T("Switch to organizer"),
_href = r.url(method="organize"),
_class = "action-btn",
)
add_btn = output.get("showadd_btn")
output["showadd_btn"] = TAG[""](add_btn, switch) if add_btn else switch

elif method == "organize":
# Add hint how to use the organizer
if not coordinator:
from .helpers import get_cms_intro
intro = get_cms_intro("hrm", "delegation",
"DelegationOrganizerIntro",
cmsxml = True,
)
if intro:
output["intro"] = intro
# Add switch to list view
output["switch"] = A(T("Switch to list view"),
_href = r.url(method=""),
_class = "action-btn",
)
# Use custom view
from s3 import S3CustomController
S3CustomController._view("RLP", "organize.html")
return output
s3.postp = custom_postp

# Custom rheaders
from .rheaders import rlp_vol_rheader, rlp_delegation_rheader
attr = dict(attr)
Expand Down
38 changes: 37 additions & 1 deletion modules/templates/RLP/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@license: MIT
"""

from gluon import current, A, URL
from gluon import current, A, URL, XML

from s3 import FS, S3DateFilter, S3OptionsFilter, S3Represent, s3_fullname

Expand Down Expand Up @@ -222,6 +222,42 @@ def rlp_update_pool(form, tablename=None):
current.auth.s3_set_record_owner(mtable, data["id"])
s3db.onaccept(mtable, data, method="create")

# =============================================================================
def get_cms_intro(module, resource, name, cmsxml=False):
"""
Get intro from CMS
@param module: the module prefix
@param resource: the resource name
@param name: the post name
@param cmsxml: whether to XML-escape the contents or not
@returns: the post contents, or None if not available
"""

# Get intro text from CMS
db = current.db
s3db = current.s3db

ctable = s3db.cms_post
ltable = s3db.cms_post_module
join = ltable.on((ltable.post_id == ctable.id) & \
(ltable.module == module) & \
(ltable.resource == resource) & \
(ltable.deleted == False))

query = (ctable.name == name) & \
(ctable.deleted == False)
row = db(query).select(ctable.body,
join = join,
cache = s3db.cache,
limitby = (0, 1),
).first()
if not row:
return None

return XML(row.body) if cmsxml else row.body

# =============================================================================
class RLPAvailabilityFilter(S3DateFilter):
"""
Expand Down
Loading

0 comments on commit 7b5b652

Please sign in to comment.