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 May 10, 2021
2 parents 1ad24d5 + 88d7a40 commit 2db108f
Show file tree
Hide file tree
Showing 38 changed files with 1,554 additions and 305 deletions.
2 changes: 1 addition & 1 deletion controllers/cr.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def shelter_registration():
msg_record_created = T("Registration added"),
msg_record_modified = T("Registration updated"),
msg_record_deleted = T("Registration entry deleted"),
msg_list_empty = T("No people currently registered in this shelter")
msg_list_empty = T("No people currently registered in shelters")
)

output = s3_rest_controller()
Expand Down
4 changes: 3 additions & 1 deletion languages/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
'Address Type': 'Typ der Adresse',
'Address added': 'Adresse hinzugefügt',
'Address deleted': 'Adresse gelöscht',
'Address is Required!': 'Adresse ist erforderlich!',
'Address updated': 'Adresse aktualisiert',
'Address': 'Adresse',
'Addresses': 'Adressen',
Expand Down Expand Up @@ -1009,6 +1010,7 @@
'Come back later.': 'Kommen Sie doch später noch einmal wieder :-( ',
'Comments permitted?': 'Kommentare zugelassen?',
'Comments': 'Kommentare',
'Commercial Providers': 'Kommerzielle Anbieter',
'Commercial/Offices': 'Kommerziell / Büros',
'Commit Date': 'Datum der Einstellung',
'Commit Status': 'Zusagestatus',
Expand Down Expand Up @@ -4210,7 +4212,7 @@
'Positions': 'Positionen',
'Positive': 'Positiv',
'Possible Deployment Sites': 'Mögliche Einsatzstellen',
'Postcode is Required!': 'Postleitzahl ist Erforderlich!',
'Postcode is Required!': 'Postleitzahl ist erforderlich!',
'Postcode': 'PLZ',
'Posted on': 'Geposted auf',
'Posts can be either full pages, embedded within other pages or part of a series (for use as news items or blog posts)': 'Posts können entweder komplette Seiten, die in anderen Seiten eingebettet wurden oder Teile einer Serie sein (z.B. zur Nutzung als Newseintrag oder Blog Post)',
Expand Down
14 changes: 7 additions & 7 deletions modules/s3/s3gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def __init__(self):
#messages.centroid_error = str(A("Shapely", _href="http://pypi.python.org/pypi/Shapely/", _target="_blank")) + " library not found, so can't find centroid!"
messages.centroid_error = "Shapely library not functional, so can't find centroid! Install Geos & Shapely for Line/Polygon support"
messages.unknown_type = "Unknown Type!"
messages.invalid_wkt_point = "Invalid WKT: must be like POINT(3 4)"
messages.invalid_wkt_point = "Invalid WKT: must be like POINT (3 4)"
messages.invalid_wkt = "Invalid WKT: see http://en.wikipedia.org/wiki/Well-known_text"
messages.lon_empty = "Invalid: Longitude can't be empty if Latitude specified!"
messages.lat_empty = "Invalid: Latitude can't be empty if Longitude specified!"
Expand Down Expand Up @@ -740,7 +740,7 @@ def geocode_r(lat, lon):
query = (table.level != None) & \
(table.deleted != True)
if current.deployment_settings.get_gis_spatialdb():
point = "POINT(%s %s)" % (lon, lat)
point = "POINT (%s %s)" % (lon, lat)
query &= (table.the_geom.st_intersects(point))
rows = current.db(query).select(table.id,
table.level,
Expand Down Expand Up @@ -4608,9 +4608,9 @@ def latlon_to_wkt(lat, lon):
Convert a LatLon to a WKT string
>>> s3gis.latlon_to_wkt(6, 80)
'POINT(80 6)'
'POINT (80 6)'
"""
WKT = "POINT(%f %f)" % (lon, lat)
WKT = "POINT (%f %f)" % (lon, lat)
return WKT

# -------------------------------------------------------------------------
Expand All @@ -4626,7 +4626,7 @@ def parse_location(wkt, lon=None, lat=None):
if not wkt:
if not lon is not None and lat is not None:
raise RuntimeError("Need wkt or lon+lat to parse a location")
wkt = "POINT(%f %f)" % (lon, lat)
wkt = "POINT (%f %f)" % (lon, lat)
geom_type = GEOM_TYPES["point"]
bbox = (lon, lat, lon, lat)
else:
Expand Down Expand Up @@ -5830,7 +5830,7 @@ def wkt_centroid(form):
elif lon is None or lon == "":
form.errors["lon"] = current.messages.lon_empty
else:
form_vars.wkt = "POINT(%(lon)s %(lat)s)" % form_vars
form_vars.wkt = "POINT (%(lon)s %(lat)s)" % form_vars
radius = form_vars.get("radius", None)
if radius:
bbox = GIS.get_bounds_from_radius(lat, lon, radius)
Expand Down Expand Up @@ -5945,7 +5945,7 @@ def wkt_centroid(form):
elif lon is None or lon == "":
form.errors["lon"] = current.messages.lon_empty
else:
form_vars.wkt = "POINT(%(lon)s %(lat)s)" % form_vars
form_vars.wkt = "POINT (%(lon)s %(lat)s)" % form_vars
if "lon_min" not in form_vars or form_vars.lon_min is None:
form_vars.lon_min = lon
if "lon_max" not in form_vars or form_vars.lon_max is None:
Expand Down
19 changes: 16 additions & 3 deletions modules/s3/s3widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5090,6 +5090,7 @@ class S3LocationSelector(S3Selector):
- Needs more testing
* Should support use in an InlineComponent with multiple=True
* Should support multiple on a page
* Option to allow having Lx mandatory *except* when a specific location is defined (e.g. Polygon spanning 2 countries)
"""

keys = ("L0", "L1", "L2", "L3", "L4", "L5",
Expand All @@ -5101,6 +5102,7 @@ def __init__(self,
hide_lx = True,
reverse_lx = False,
show_address = False,
address_required = None,
show_postcode = None,
postcode_required = None,
postcode_to_address = None,
Expand Down Expand Up @@ -5138,6 +5140,7 @@ def __init__(self,
address line
@param show_address: show a field for street address.
If the parameter is set to a string then this is used as the label.
@param address_required: address field is mandatory
@param show_postcode: show a field for postcode
@param postcode_required: postcode field is mandatory
@param postcode_to_address: service to use to lookup a list of addresses from the postcode
Expand Down Expand Up @@ -5174,6 +5177,7 @@ def __init__(self,
self.hide_lx = hide_lx
self.reverse_lx = reverse_lx
self.show_address = show_address
self.address_required = address_required
self.show_postcode = show_postcode
self.postcode_required = postcode_required
self.postcode_to_address = postcode_to_address or \
Expand Down Expand Up @@ -5438,6 +5442,7 @@ def __call__(self, field, value, **attributes):
address,
label,
hidden = not address,
required = self.address_required,
)

# Postcode INPUT
Expand Down Expand Up @@ -6148,12 +6153,16 @@ def _input(self,
_placeholder = label
else:
_placeholder = None

widget = INPUT(_name = name,
_id = input_id,
_class = _class,
_placeholder = _placeholder,
value = s3_str(value),
)
if required:
# Enable client-side validation:
widget.add_class("required")

return (_label, widget, input_id, hidden)

Expand Down Expand Up @@ -6791,9 +6800,14 @@ def validate(self, value, requires=None):
errors[level] = current.T("Location Hierarchy is Required!")
break

# Address Required?
address = values_get("address")
if self.address_required and not address:
errors["address"] = current.T("Address is Required!")

# Postcode Required?
postcode = values_get("postcode")
if not postcode and self.postcode_required:
if self.postcode_required and not postcode:
errors["postcode"] = current.T("Postcode is Required!")

if errors:
Expand All @@ -6817,7 +6831,6 @@ def validate(self, value, requires=None):
else:
# Read other details
parent = values_get("parent")
address = values_get("address")

if parent or address or postcode or \
wkt is not None or \
Expand Down Expand Up @@ -6982,7 +6995,7 @@ def validate(self, value, requires=None):
level = location.level
if level:
# Accept all levels above and including the lowest selectable level
for i in xrange(5,-1,-1):
for i in xrange(5, -1, -1):
if "L%s" % i in levels:
accepted_levels = set("L%s" % l for l in xrange(i, -1, -1))
break
Expand Down
8 changes: 8 additions & 0 deletions modules/s3cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,14 @@ def get_L10n_religions(self):
"other": T("other")
})

def get_L10n_ethnicity(self):
"""
Ethnicities used in Person Registry
- defaults to free-text
- dropdown options can be configured in Template (e.g. Locale)
"""
return self.L10n.get("ethnicity", None)

def get_L10n_date_format(self):
"""
Lookup the Date Format - either by locale or by global setting
Expand Down
20 changes: 11 additions & 9 deletions modules/s3db/cr.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def model(self):

messages = current.messages
NONE = messages["NONE"]
OBSOLETE = messages.OBSOLETE

add_components = self.add_components
configure = self.configure
Expand Down Expand Up @@ -142,10 +141,10 @@ def model(self):
requires = IS_EMPTY_OR(
IS_ONE_OF(db, "cr_shelter_type.id",
represent)),
comment=S3PopupLink(c = "cr",
f = "shelter_type",
label = ADD_SHELTER_TYPE,
),
comment = S3PopupLink(c = "cr",
f = "shelter_type",
label = ADD_SHELTER_TYPE,
),
)

# -------------------------------------------------------------------------
Expand Down Expand Up @@ -341,7 +340,7 @@ def model(self):
Field("obsolete", "boolean",
default = False,
label = T("Obsolete"),
represent = lambda opt: OBSOLETE if opt else NONE,
represent = lambda opt: messages.OBSOLETE if opt else NONE,
readable = False,
writable = False,
),
Expand Down Expand Up @@ -891,13 +890,16 @@ def cr_shelter_onaccept(form):
# Update Affiliation, record ownership and component ownership
s3db.org_update_affiliations("cr_shelter", form_vars)

# @ToDo: Create a cr_shelter_status record

if current.response.s3.bulk:
# Import
return

if current.deployment_settings.get_cr_shelter_population_dynamic():
# Update population and available capacity
cr_update_shelter_population(shelter_id)

# @ToDo: Create a cr_shelter_status record


# Create an org_site_event record
stable = s3db.cr_shelter
shelter = current.db(stable.id == shelter_id).select(stable.site_id,
Expand Down
2 changes: 1 addition & 1 deletion modules/s3db/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4364,7 +4364,7 @@ def gis_layer_shapefile_onaccept(form):
if geom_type == wkbPoint:
lon = geom.GetX()
lat = geom.GetY()
wkt = "POINT(%f %f)" % (lon, lat)
wkt = "POINT (%f %f)" % (lon, lat)
else:
wkt = geom.ExportToWkt()
centroid = geom.Centroid()
Expand Down
Loading

0 comments on commit 2db108f

Please sign in to comment.