Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nursix/eden-asp
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Apr 11, 2022
2 parents 94c017f + 975dedc commit ca098fc
Show file tree
Hide file tree
Showing 26 changed files with 1,432 additions and 261 deletions.
49 changes: 49 additions & 0 deletions controllers/cms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,8 @@ def read_newsletter():

s3.hide_last_update = True

formkeys_mark = "_formkey[newsletter/mark]"

def prep(r):

s3.crud_strings["cms_newsletter"]["title_list"] = T("Newsletter Inbox")
Expand Down Expand Up @@ -1198,6 +1200,10 @@ def prep(r):
component = r.component
if not component:
if r.record:
# If a newsletter is opened interactively, mark it as read
if r.method in ("read", "update", None) and r.interactive:
s3db.cms_mark_newsletter(r.id)

table = resource.table

field = table.message
Expand All @@ -1212,6 +1218,19 @@ def prep(r):
represent = details.contact_represent,
)
contact = S3SQLVirtualField("contact", label=T("Contact"))

elif r.method == "mark":
# Mark all unread newsletters as read
key = r.post_vars.get("_formkey")
keys = session.get(formkeys_mark)
if keys and key in keys:
keys.remove(key)
unread = s3db.cms_unread_newsletters(count=False, cached=False)
s3db.cms_mark_newsletter(unread)
redirect(r.url(method=""))
else:
r.error(400, "invalid request", next=r.url(method=""))

else:
contact = None

Expand Down Expand Up @@ -1246,6 +1265,7 @@ def prep(r):
"subject",
#"message",
"date_sent",
(T("Status"), "read_status"),
]

resource.configure(crud_form = crud_form,
Expand All @@ -1265,6 +1285,35 @@ def prep(r):
return True
s3.prep = prep

def postp(r, output):

if not r.record and not r.method and isinstance(output, dict):

if "buttons" in output:
buttons = output["buttons"]
else:
buttons = output["buttons"] = {}
add = buttons.get("add_btn")

if s3db.cms_unread_newsletters():
# Add button to mark all unread newsletters as read
import uuid
key = str(uuid.uuid4())
keys = session.get(formkeys_mark)
session[formkeys_mark] = [key] if not keys else [key] + keys[:9]

mark = FORM(BUTTON(T("Mark all as read"),
_type="submit",
_class="action-btn",
),
_action = r.url(method="mark"),
hidden = {"_formkey": key},
)
buttons["add_btn"] = TAG[""](mark, add) if add else mark

return output
s3.postp = postp

return crud_controller("cms", "newsletter", rheader=s3db.cms_rheader)

# END =========================================================================
37 changes: 37 additions & 0 deletions languages/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@
'Add Document': 'Dokument hinzufügen',
'Add Donor': 'Spender hinzufügen',
'Add Entry': 'Eintrag hinzufügen',
'Add Facility Type': 'Einrichtungstyp hinzufügen',
'Add Facility': 'Einrichtung hinzufügen',
'Add Family Member': 'Familienmitglied hinzufügen',
'Add Flood Report': 'Flut Bericht hinzufügen',
'Add Group Member': 'Gruppenmitglied hinzufügen',
Expand Down Expand Up @@ -467,8 +469,10 @@
'All Test Stations': 'Alle Teststellen',
'All data provided by the Sahana Software Foundation from this site is licenced under a Creative Commons Attribution licence. However, not all data originates here. Please consult the source field of each entry.': 'Alle von der Sahana Software Foundation bereitgestellten Daten dieser Seite sind unter der Creative Commons Attribution licence lizenziert. Es stammen jedoch nicht alle Daten von hier. Bitte beachten Sie das Quellen-Feld des jeweiligen Eintrags.',
'All selected': 'Alle ausgewählt',
'All up to now': 'Alles bis jetzt',
'All##filter_options': 'Alle',
'All': 'Alle',
'Allocatable Capacity': 'Frei belegbare Kapazität',
'Allocate Group': 'Gruppe zuweisen',
'Allowance Information added': 'Information zum Taschengeld hinzugefügt',
'Allowance Information deleted': 'Information zum Taschengeld gelöscht',
Expand Down Expand Up @@ -1411,7 +1415,9 @@
'Current Population (Adults)': 'Aktuelle Belegung (Erwachsene)',
'Current Population (Children)': 'Aktuelle Belegung (Kinder)',
'Current Population (Minors)': 'Aktuelle Belegung (Minderjährige)',
'Current Population (Registered)': 'Belegung (registriert)',
'Current Population (Total)': 'Aktuelle Belegung (Gesamt)',
'Current Population (Unregistered)': 'Belegung (nicht registriert)',
'Current Population Availability (Day and Night)': 'Aktuelle maximale Belegungszahl (Tag und Nacht)',
'Current Population##shelter': 'Aktuelle Belegung',
'Current Population': 'Aktuelle Belegungzahl',
Expand Down Expand Up @@ -2309,10 +2315,14 @@
'Facility Layout Plan': 'Raumkonzept',
'Facility Operations': 'Einrichtungsmanagement',
'Facility Status': 'Status der Einrichtung',
'Facility Type added': 'Einrichtungstyp hinzugefügt',
'Facility Type deleted': 'Einrichtungstyp gelöscht',
'Facility Type updated': 'Einrichtungstyp aktualisiert',
'Facility Type': 'Einrichtungstyp',
'Facility Types': 'Einrichtungstypen',
'Facility added to public registry': 'Einrichtung ins öffentliche Verzeichnis aufgenommen',
'Facility added': 'Einrichtung hinzugefügt',
'Facility deleted': 'Einrichtung gelöscht',
'Facility or Location': 'Einrichtung oder Standort',
'Facility removed from public registry pending review': 'Einrichtung aus dem öffentlichen Verzeichnis entfernt, Prüfung ausstehend',
'Facility removed': 'Einrichtung entfernt',
Expand Down Expand Up @@ -2435,6 +2445,7 @@
'Found': 'Gefunden',
'Foundations': 'Stiftungen',
'France': 'Frankreich',
'Free Capacity': 'Freie Kapazität',
'Free for domestic animals': 'Haustiere zugelassen',
'Free places': 'Freie Plätze',
'Freezing Drizzle': 'Gefrierender Nieselregen',
Expand Down Expand Up @@ -3055,9 +3066,12 @@
'Last Check-in': 'Letzter Check-in',
'Last Check-out': 'Letzter Check-out',
'Last Downloaded': 'Zuletzt heruntergeladen',
'Last Month': 'Vorigen Monat',
'Last Name': 'Nachname',
'Last Pull': 'Letzter Pull',
'Last Push': 'Letzter Push',
'Last Week': 'Vorige Woche',
'Last Year': 'Voriges Jahr',
'Last known location': 'Letzte bekannte Position',
'Last seen on': 'Zuletzt gesehen am',
'Last synchronization time': 'Zeitpunkt der letzte Synchronisierung',
Expand Down Expand Up @@ -3200,6 +3214,7 @@
'List Event Types': 'Liste der Ereignistypen',
'List Events': 'Liste Ereignisse',
'List Facilities': 'Liste Einrichtungen',
'List Facility Types': 'Liste Einrichtungstypen',
'List Family Members': 'Liste Familienmitglieder',
'List Feature Layers': 'Liste Objekt-Layer',
'List Flood Reports': 'Liste Flutberichte',
Expand Down Expand Up @@ -3486,6 +3501,7 @@
'Map': 'Karte',
'Marine Security': 'Hafensicherheit',
'Marital Status': 'Familienstand',
'Mark all as read': 'Alle als gelesen markieren',
'Mark as duplicate': 'Als Duplikat markieren',
'Marker Details': 'Details zum Marker/Symbol',
'Marker added': 'Marker/Symbol hinzugefügt',
Expand All @@ -3509,6 +3525,7 @@
'Mauritania': 'Mauretanien',
'Max %(number)s allowed': 'Maximal %(number)s erlaubt',
'Max Height': 'Max Höhe',
'Maximum Capacity': 'Maximale Kapazität',
'Maximum Extent': 'Maximale Ausdehnung',
'Maximum Location Latitude': 'Maximale Geographische Breite des Gebietes',
'Maximum Location Longitude': 'Maximale Geographische Länge des Gebietes',
Expand Down Expand Up @@ -3801,6 +3818,8 @@
'No Events currently registered': 'Zurzeit sind keine Ereignisse registriert',
'No Facilities currently registered in this event': 'Für dieses Ereignis ist zurzeit keine Einrichtung registriert',
'No Facilities currently registered in this scenario': 'Für dieses Szenario ist zurzeit keine Einrichtung registriert.',
'No Facilities currently registered': 'Zurzeit keine Einrichtungen registriert',
'No Facility Types currently defined': 'Zurzeit keine Einrichtungstypen definiert',
'No Family Members currently registered': 'Zurzeit keine Familienmitglieder registriert',
'No Feature Layers currently defined': 'Zurzeit sind keine Objekt-Layer definiert',
'No Flood Reports currently registered': 'Zurzeit sind keine Flutberichte registriert',
Expand Down Expand Up @@ -3906,6 +3925,7 @@
'No Shipment Items': 'Keine Lieferartikel',
'No Solutions currently defined': 'Zurzeit sind keine Lösungen definiert',
'No Staff Types currently registered': 'Zurzeit sind keine Mitarbeitertypen registriert',
'No Status History currently registered': 'Zurzeit keine Statushistorie registriert',
'No Stock currently registered in this Warehouse': 'Zurzeit keine Bestände für dieses Warenlager registriert',
'No Subscription available': 'Keine Abonnements verfügbar',
'No Subsectors currently registered': 'Zurzeit sind keine Teilbereiche registriert',
Expand Down Expand Up @@ -4115,6 +4135,8 @@
'Obsolete': 'Hinfällig',
'Obstetrics/Gynecology': 'Geburtshilfe/Gynäkologie',
'Occasion': 'Anlass',
'Occupancy % (Average)': 'Belegung % (Durchschnitt)',
'Occupancy %': 'Belegung %',
'Occupation / Speciality': 'Tätigkeit / Fachrichtung',
'Occupation Type': 'Berufsgruppe',
'Occupation Types': 'Berufsgruppen',
Expand Down Expand Up @@ -4705,6 +4727,8 @@
'Received/Incoming Shipments': 'Erhaltene/Einkommende Lieferungen',
'Receiving Inventory': 'Entgegennehmendes Lager',
'Receiving and Sending Items': 'Erhalten und Versenden von Artikeln',
'Reception Center Types': 'Erstaufnahmetypen',
'Reception Centers': 'Erstaufnahme',
'Recipient Details': 'Details zum Empfänger',
'Recipient added': 'Empfänger hinzugefügt',
'Recipient already registered': 'Empfänger bereits registriert',
Expand Down Expand Up @@ -5929,10 +5953,12 @@
'The list of Catalogs are maintained by the Administrators.': 'Die Liste der Kataloge wird vom Administrator verwaltet.',
'The map will be displayed initially with this latitude at the center.': 'Die Karte wird zunächst auf diese Geographische Breite zentriert.',
'The map will be displayed initially with this longitude at the center.': 'Die Karte wird zunächst auf diese Geographische Länge zentriert.',
'The maximum (total) capacity as number of people': 'Die maximale Kapazität als Anzahl Personen',
'The minimum number of features to form a cluster.': 'Die minimale Anzahl von Objekten, die als Cluster angezeigt werden.',
'The name to be used when calling for or directly addressing the person (optional).': 'Der zu verwendende Name beim Anfragen oder direkten Ansprechen der Person (optional).',
'The next screen will allow you to detail the number of people here & their needs.': 'Der nächste Bildschirm erlaubt es, nähere Angaben zur Anzahl Menschen hier & ihrer Bedürfnisse zu machen.',
'The number of Units of Measure of the Alternative Items which is equal to One Unit of Measure of the Item': 'Die Anzahl der Maßeinheiten eines alternativen Artikels, welcher einer Maßeinheit von diesem Artikel entspricht',
'The number of free places currently allocatable': 'Die Anzahl aktuell belegbarer freier Plätze',
'The number of pixels apart that features need to be before they are clustered.': 'Mindestanzahl erforderlicher Pixel, damit sie nicht in Clustern zusammengefasst dargestellt werden.',
'The number of tiles around the visible map to download. Zero means that the 1st page loads faster, higher numbers mean subsequent panning is faster.': 'Die Anzahl der Teilbilder rund um den sichtbaren Kartenausschnitt die heruntergeladen werden. Null bedeutet, dass die erste Seite schneller geladen wird, höhere Zahlen bedeuten dass nachfolgendes Schwenken schneller ist.',
'The organisation requesting the delegation': 'Die Organisation die die Delegierung angefragt hat',
Expand Down Expand Up @@ -5964,6 +5990,7 @@
'Theme updated': 'Thema aktualisiert',
'Theme': 'Thema',
'Themes': 'Themen',
'There are <b>%(number)s</b> new newsletters.': 'Es gibt <b>%(number)s</b> neue(s) Rundschreiben.',
'There are already user accounts registered for this organization': 'Für diese Organisation sind bereits Benutzerkonten registriert',
'There are errors in the form, please check your input': 'Formular enthält Fehler - bitte die Eingaben überprüfen',
'There are errors': 'Es sind Fehler aufgetreten',
Expand All @@ -5977,7 +6004,10 @@
'These need to be added in Decimal Degrees.': 'Diese müssen in Dezimalgrad hinzugefügt werden.',
'They': 'Sie',
'This Group has no Members yet': 'Diese Gruppe hat noch keine Mitglieder',
'This Month': 'Diesen Monat',
'This Team has no Members yet': 'Dieses Team hat noch keine Mitglieder',
'This Week': 'Diese Woche',
'This Year': 'Dieses Jahr',
'This appears to be a duplicate of': 'Dies scheint ein Duplikat zu sein von',
'This appointment is mandatory before transfer': 'Dieser Termin ist zwingend erforderlich vor Transfer',
'This appointment requires the presence of the person concerned': 'Dieser Termin erfordert die Anwesenheit der betroffenen Person',
Expand Down Expand Up @@ -6024,6 +6054,7 @@
'Tile Mapping Service': 'TileMapService',
'Tilt-up concrete': 'Konkrete Neigung',
'Timber frame': 'Holzrahmen',
'Time Frame': 'Zeitrahmen',
'Time In': 'Eingangszeit',
'Time Out': 'Ausgangszeit',
'Time Question': 'Zeit Frage',
Expand Down Expand Up @@ -6163,6 +6194,7 @@
'Twitter Search Results': 'Twitter Suchergebnisse',
'Twitter Search': 'Twitter Suche',
'Twitter Settings': 'Einstellungen für Twitter',
'Type Details': 'Details zum Typ',
'Type of Assistance': 'Art der Unterstützung',
'Type of Construction': 'Bautyp',
'Type of Eligibility': 'Art des Anspruchs',
Expand Down Expand Up @@ -6559,9 +6591,11 @@
'checked-in': 'eingecheckt',
'checked-out': 'ausgecheckt',
'click for more details': 'hier klicken, um mehr Details zu erhalten',
'closed': 'geschlossen',
'cohabiting': 'zusammenlebend',
'complete': 'vollständig',
'consider': 'Berücksichtigen',
'cumulative': 'kumulativ',
'curly': 'lockig',
'currently registered': 'derzeitig registriert',
'daily': 'täglich',
Expand Down Expand Up @@ -6677,6 +6711,7 @@
'on': 'an',
'once': 'einmal',
'open defecation': 'Verrichtung der Bedürfnisse im Freien',
'operating': 'in Betrieb',
'optional': 'optional',
'or Drop here': 'oder hier ablegen',
'or drop here': "oder hier per Drag'n Drop ablegen",
Expand All @@ -6686,6 +6721,7 @@
'paid': 'bezahlt',
'pending': 'anstehend',
'people': 'Personen',
'per interval': 'pro Intervall',
'per': 'nach',
'piece': 'Stück',
'pit latrine': 'Grubenlatrine',
Expand Down Expand Up @@ -6720,6 +6756,7 @@
'specify': 'genauer beschreiben',
'staff members': 'Mitarbeiter',
'staff': 'Personal',
'standby': 'in Bereitschaft',
'state location': 'Beschaffenheit des Standort',
'state': 'Zustand',
'straight': 'gerade',
Expand Down
11 changes: 7 additions & 4 deletions models/00_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ def s3_clear_session():

if "s3" in session:
s3 = session.s3
opts = ["hrm", "report_options", "deduplicate"]
for o in opts:
if o in s3:
del s3[o]
for keyword in ("hrm",
"report_options",
"deduplicate",
"unread_newsletters",
):
if keyword in s3:
del s3[keyword]

# -----------------------------------------------------------------------------
def s3_auth_on_login(form):
Expand Down
Loading

0 comments on commit ca098fc

Please sign in to comment.