Skip to content

Commit

Permalink
Fix Office CSV import
Browse files Browse the repository at this point in the history
Event Incident Report: Allow being added direct from Map
Magnu: Tweaks
French l10n improvements
  • Loading branch information
flavour committed Dec 9, 2014
1 parent 1203ab0 commit 58de46b
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 22 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nursix-1.1.0-devel-1652-gb0ea9ac (2014-12-09 14:12:10)
1203ab0 (2014-12-09 16:04:37)
30 changes: 30 additions & 0 deletions controllers/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,36 @@ def incident_report():
RESTful CRUD controller
"""

def prep(r):
if r.http == "GET":
if r.method in ("create", "create.popup"):
# Lat/Lon from Feature?
# @ToDo: S3PoIWidget() instead to pickup the passed Lat/Lon/WKT
field = r.table.location_id
lat = get_vars.get("lat", None)
if lat is not None:
lon = get_vars.get("lon", None)
if lon is not None:
form_vars = Storage(lat = float(lat),
lon = float(lon),
)
form = Storage(vars=form_vars)
s3db.gis_location_onvalidation(form)
id = s3db.gis_location.insert(**form_vars)
field.default = id
# WKT from Feature?
wkt = get_vars.get("wkt", None)
if wkt is not None:
form_vars = Storage(wkt = wkt,
)
form = Storage(vars = form_vars)
s3db.gis_location_onvalidation(form)
id = s3db.gis_location.insert(**form_vars)
field.default = id

return True
s3.prep = prep

return s3_rest_controller()

# -----------------------------------------------------------------------------
Expand Down
20 changes: 11 additions & 9 deletions languages/fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,7 @@
'Incident Reporting': "Rapport d'incident",
'Incident Reporting System': "Système de rapport d'incidents",
'Incident Reports': "Rapport d'incident",
'Incident Type': "Type d'incident",
'Incident updated': 'Incident mis à jour',
'Include any special requirements such as equipment which they need to bring.': "Inclure tout besoin spécial comme de l'équipement à apporter",
"includes a GroundOverlay or ScreenOverlay which aren't supported in OpenLayers yet, so it may not work properly.": "Inclut un GroundOverlay ou ScreenOverlay qui ne sont pas encore pris en charge par OpenLayers, de sorte qu'il peuvent ne pas fonctionner correctement.",
Expand Down Expand Up @@ -2741,7 +2742,7 @@
'Loading Locations...': 'Chargement des emplacements...',
'Local Name': 'Nom local',
'Local Names': 'Noms locaux',
'Location': 'emplacement',
'Location': 'Emplacement',
'Location 1': 'Emplacement 1',
'Location 2': 'Emplacement 2',
'Location added': 'Emplacement ajouté',
Expand Down Expand Up @@ -3850,12 +3851,13 @@
'Report Type': 'Type du rapport',
'Report Types Include': "L'inclusion dans les types de rapport",
'Report updated': 'Rapport mis à jour',
'reported': 'Signalé',
'Reporter': 'Journaliste',
'Reporter Name': 'Nom journaliste',
'Reported By': 'Rapporté par',
'reported': 'rapporté',
'Reporter': 'Rapporteur',
'Reporter Name': 'Nom de Rapporteur',
'Reporting on the projects in the region': 'Rapports sur les projets dans la région',
'Reports': 'reports',
'reports successfully imported.': 'Rapports importé avec succès.',
'Reports': 'Rapports',
'reports successfully imported.': 'rapports importé avec succès.',
'representation of the Polygon/Line.': 'Représentation du polygone /ligne.',
'Request': 'Requête',
'Request added': 'Demande ajouté',
Expand Down Expand Up @@ -4870,7 +4872,7 @@
'Timeline Report': 'Chronologie Rapport',
'times and it is still not working. We give in. Sorry.': 'fois et cela ne marche toujours pas. Nous abandonnons. Désolé.',
'Timestamps can be correlated with the timestamps on the photos to locate them on the map.': 'Les horodatages peuvent être corrélés avec les horodatages des photos pour les localiser sur la carte.',
'Title': 'titre',
'Title': 'Titre',
'Title to show for the Web Map Service panel in the Tools panel.': 'Titre à afficher pour le panneau du service cartographie Web dans le panneau des outils.',
'To': 'Vers',
'To %(site)s': 'Vers %(site)s',
Expand Down Expand Up @@ -4973,7 +4975,7 @@
'tweepy module not available within the running Python - this needs installing for non-Tropo Twitter support!': "tweepy Module non disponibles dans l'exécution Python-il faut installer pour le support Twitter non Tropo!",
'Twitter ID or #hashtag': 'ID Twitter ou #hashtag',
'Twitter Settings': 'Paramètres Twitter',
'Type': 'type',
'Type': 'Type',
'Type of cause': 'Type de cause',
'Type of Construction': 'Type de construction',
'Type of water source before the disaster': "Type de source d'eau avant la catastrophe",
Expand Down Expand Up @@ -5002,7 +5004,7 @@
'Units': 'Unités',
'Units of Measure': 'Unités de mesure',
'Unknown': 'Inconnu',
'unknown': 'Inconnu',
'unknown': 'inconnu',
'Unknown Peer': 'Homologue inconnu',
'Unknown type of facility': "Type inconnu d'installation",
'Unreinforced masonry': 'Maçonnerie non-renforcé',
Expand Down
2 changes: 1 addition & 1 deletion modules/s3db/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ def model(self):
#self.event_incident_id(ondelete = "CASCADE"),
s3_datetime(),
Field("name", notnull=True,
label = T("Name"),
label = T("Title"),
),
self.event_incident_type_id(),
self.gis_location_id(),
Expand Down
2 changes: 2 additions & 0 deletions private/templates/Magnu/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
settings.gis.countries = ("CF",) # Initially, will change
# Uncomment to display the Map Legend as a floating DIV
settings.gis.legend = "float"
# Uncomment to Disable the Postcode selector in the LocationSelector
settings.gis.postcode_selector = False # @ToDo: Vary by country (include in the gis_config!)

# L10n settings
# Languages used in the deployment (used for Language Toolbar & GIS Locations)
Expand Down
2 changes: 1 addition & 1 deletion private/templates/Magnu/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def menu_modules(cls):
MM("Contacts", c="pr", f="person", args="summary"),
MM("Demographics", c="stats", f="demographic_data", args="summary"),
MM("Health", c="hms", f="hospital", args="summary"),
MM("Incidents", c="event", f="ireport", args="summary"),
MM("Incidents", c="event", f="incident_report", args="summary"),
MM("Offices", c="org", f="office", args="summary"),
MM("Organisations", c="org", f="organisation", args="summary"),
MM("Projects", c="project", f="project", args="summary"),
Expand Down
2 changes: 2 additions & 0 deletions private/templates/default/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@
# restricted to MapAdmins.
# Uncomment to disable that LatLons are within boundaries of their parent
#settings.gis.check_within_parent_boundaries = False
# Uncomment to Disable the Postcode selector in the LocationSelector
#settings.gis.postcode_selector = False

# Enable this for a UN-style deployment
#settings.ui.cluster = True
Expand Down
3 changes: 2 additions & 1 deletion static/formats/s3csv/labels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@

<column name="OfficeName">
<match>|Name|name|Office|office|</match>
<label>Name</label>
<label>name</label>
<label>Office</label>
<label>office</label>
</column>

<column name="Country">
Expand Down
25 changes: 16 additions & 9 deletions static/formats/s3csv/org/office.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<xsl:variable name="OfficeName">
<xsl:call-template name="ResolveColumnHeader">
<xsl:with-param name="colname">Name</xsl:with-param>
<xsl:with-param name="colname">OfficeName</xsl:with-param>
</xsl:call-template>
</xsl:variable>

Expand Down Expand Up @@ -218,18 +218,20 @@
<xsl:variable name="OrgName" select="col[@field='Organisation']/text()"/>
<xsl:variable name="BranchName" select="col[@field='Branch']/text()"/>
<xsl:variable name="ContactFirstName" select="col[@field='Contact First Name']/text()"/>
<xsl:variable name="officename">
<xsl:call-template name="GetColumnValue">
<xsl:with-param name="colhdrs" select="$OfficeName"/>
</xsl:call-template>
</xsl:variable>

<resource name="org_office">
<xsl:attribute name="tuid">
<xsl:value-of select="$OfficeName"/>
</xsl:attribute>

<!-- Link to Location -->
<!-- Currently this needs to be a specific location for S3LocationSelectorWidget,
S3LocationSelectorWidget2 doesn't have this limitation -->
<reference field="location_id" resource="gis_location">
<xsl:attribute name="tuid">
<xsl:value-of select="$OfficeName"/>
<xsl:value-of select="concat($OrgName, $officename)"/>
</xsl:attribute>
</reference>

Expand All @@ -256,7 +258,7 @@
</xsl:if>

<!-- Office data -->
<data field="name"><xsl:value-of select="$OfficeName"/></data>
<data field="name"><xsl:value-of select="$officename"/></data>
<data field="phone1"><xsl:value-of select="col[@field='Phone1']"/></data>
<data field="phone2"><xsl:value-of select="col[@field='Phone2']"/></data>
<data field="email"><xsl:value-of select="col[@field='Email']"/></data>
Expand Down Expand Up @@ -757,7 +759,6 @@
<!-- ****************************************************************** -->
<xsl:template name="Locations">

<xsl:variable name="OfficeName" select="col[@field='Name']/text()"/>
<xsl:variable name="Building" select="col[@field='Building']/text()"/>
<xsl:variable name="l0" select="col[@field='Country']/text()"/>
<xsl:variable name="l1" select="col[@field='L1']/text()"/>
Expand All @@ -780,6 +781,12 @@
<xsl:with-param name="colhdrs" select="$Postcode"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="OrgName" select="col[@field='Organisation']/text()"/>
<xsl:variable name="officename">
<xsl:call-template name="GetColumnValue">
<xsl:with-param name="colhdrs" select="$OfficeName"/>
</xsl:call-template>
</xsl:variable>


<!-- Country Code = UUID of the L0 Location -->
Expand Down Expand Up @@ -813,7 +820,7 @@
<!-- Office Location -->
<resource name="gis_location">
<xsl:attribute name="tuid">
<xsl:value-of select="$OfficeName"/>
<xsl:value-of select="concat($OrgName, $officename)"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="$l5!=''">
Expand Down Expand Up @@ -864,7 +871,7 @@
<data field="name"><xsl:value-of select="$Building"/></data>
</xsl:when>
<xsl:otherwise>
<data field="name"><xsl:value-of select="$OfficeName"/></data>
<data field="name"><xsl:value-of select="$officename"/></data>
</xsl:otherwise>
</xsl:choose>
<data field="addr_street"><xsl:value-of select="col[@field='Address']"/></data>
Expand Down

0 comments on commit 58de46b

Please sign in to comment.