Skip to content

Commit

Permalink
Minify
Browse files Browse the repository at this point in the history
Progress with report.geojson: start work on the OpenLayers.Strategy
  • Loading branch information
flavour committed Aug 26, 2014
1 parent 4c6814e commit 9f0fb1a
Show file tree
Hide file tree
Showing 18 changed files with 183 additions and 152 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This software is distributed under the MIT License:
http://www.opensource.org/licenses/mit-license.php
Copyright:(c) 2009-2012 Sahana Software Foundation
Copyright:(c) 2009-2014 Sahana Software Foundation

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nursix-1.1.0-devel-1000-g81b3040 (2014-08-26 22:08:00)
4c6814e (2014-08-26 23:48:43)
14 changes: 11 additions & 3 deletions modules/s3/s3gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7769,8 +7769,13 @@ def as_dict(self):
else:
maxdepth = 0
show_ids = ""
url = "%s.geojson?layer=%i&components=None&maxdepth=%s%s" % \
(URL(self.controller, self.function), self.id, maxdepth, show_ids)
if self.aggregate:
url = "%s.geojson?" % URL(c=self.controller,
f=self.function,
args="report")
else:
url = "%s.geojson?layer=%i&components=None&maxdepth=%s%s" % \
(URL(self.controller, self.function), self.id, maxdepth, show_ids)
if self.filter:
url = "%s&%s" % (url, self.filter)
if self.trackable:
Expand Down Expand Up @@ -7812,7 +7817,10 @@ def as_dict(self):

# Attributes which are defaulted client-side if not set
self.setup_folder_visibility_and_opacity(output)
self.setup_clustering(output)
if self.aggregate:
output["report"] = 1
else:
self.setup_clustering(output)
if not popup_format:
output["no_popups"] = 1
style = self.style
Expand Down
11 changes: 3 additions & 8 deletions modules/s3/s3report.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ def geojson(self, r, **attr):
report_options = get_config("report_options", {})
defaults = report_options.get("defaults", {})

if not any (k in get_vars for k in ("rows", "fact")):
get_vars = defaults

# The rows dimension
level = get_vars.get("level", "L0")
# @ToDo: We can add sanity-checking using resource.parse_bbox_query() if-desired
Expand All @@ -272,7 +269,9 @@ def geojson(self, r, **attr):

# Build the Pivot Table
cols = None
layer = get_vars.get("fact", "count(id)")
layer = get_vars.get("fact",
defaults.get("fact",
"count(id)"))
m = layer_pattern.match(layer)
selector, method = m.group(2), m.group(1)
prefix = resource.prefix_selector
Expand All @@ -283,10 +282,6 @@ def geojson(self, r, **attr):
# Extract the Location Data
ids, location_data = pivottable.geojson(layer=layer, level=level)

# Debug
#output = json.dumps(location_data, separators=SEPARATORS)
#return output

# Set XSLT stylesheet
stylesheet = os.path.join(r.folder, r.XSLT_PATH, "geojson", "export.xsl")

Expand Down
16 changes: 14 additions & 2 deletions modules/s3db/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2774,6 +2774,14 @@ def model(self):
"%s: <a href='http://eden.sahanafoundation.org/wiki/S3XRC/RESTfulAPI/URLFormat#BasicQueryFormat' target='_blank'>Wiki</a>" % \
T("Uses the REST Query Format defined in"))),
),
Field("aggregate", "boolean",
default = False,
label = T("Aggregate"),
represent = s3_yes_no_represent,
comment = DIV(_class="tooltip",
_title="%s|%s" % (T("Aggregate"),
T("Instead of showing individual features, aggregate by Location Hierarchy"))),
),
# @ToDo: Deprecate (replaced by popup_format)
Field("popup_label",
label = T("Popup Label"),
Expand Down Expand Up @@ -2947,15 +2955,19 @@ def gis_layer_feature_deduplicate(item):
"""

if item.tablename == "gis_layer_feature":
# Match if controller, function & filter are identical
# Match if controller, function, filter, aggregate and polygons are identical
table = item.table
data = item.data
controller = data.controller
function = data.function
filter = data.filter
aggregate = data.aggregate
polygons = data.polygons
query = (table.controller.lower() == controller.lower()) & \
(table.function.lower() == function.lower()) & \
(table.filter == filter)
(table.filter == filter) & \
(table.aggregate == aggregate) & \
(table.polygons == polygons)
duplicate = current.db(query).select(table.id,
limitby=(0, 1)).first()
if duplicate:
Expand Down
31 changes: 16 additions & 15 deletions private/templates/IFRC/gis_layer_feature.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/formats/s3csv/gis/layer_feature.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Name,Description,Symbology,Marker,GPS Marker,Controller,Function,Popup Format,Popup Label,Popup Fields,Filter,Default,Individual,Polygons,Trackable,Site,Style,Opacity,Folder,Config,Visible,Enabled,Cluster Attribute,Cluster Distance,Cluster Threshold,Refresh
Name,Description,Symbology,Marker,GPS Marker,Controller,Function,Filter,Aggregate,Popup Format,Popup Label,Popup Fields,Default,Individual,Polygons,Trackable,Site,Style,Opacity,Folder,Config,Visible,Enabled,Cluster Attribute,Cluster Distance,Cluster Threshold,Refresh
6 changes: 5 additions & 1 deletion static/formats/s3csv/gis/layer_feature.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
GPS Marker...........string..........Layer Symbology GPS Marker
Controller...........string..........Layer Controller
Function.............string..........Layer Function
Filter...............string..........Layer Filter
Aggregate............string..........Layer Aggregate
Popup Format.........string..........Layer Popup Format
OR
Popup Label..........string..........Layer Popup Label
Popup Fields.........comma-sep list..Layer Popup Fields (Fields to build feature OnHover tooltip)
Attributes...........comma-sep list..Layer Attributes (Fields to put in feature attributes to be visible to Styler)
Filter...............string..........Layer Filter
Default..............boolean.........Layer Default
Individual...........boolean.........Layer Individual
Polygons.............boolean.........Layer Polygons
Expand Down Expand Up @@ -140,6 +141,9 @@
</xsl:attribute>
<data field="name"><xsl:value-of select="$Layer"/></data>
<data field="description"><xsl:value-of select="col[@field='Description']"/></data>
<xsl:if test="col[@field='Aggregate']">
<data field="aggregate"><xsl:value-of select="col[@field='Aggregate']"/></data>
</xsl:if>
<xsl:if test="col[@field='Default']">
<data field="style_default"><xsl:value-of select="col[@field='Default']"/></data>
</xsl:if>
Expand Down
20 changes: 10 additions & 10 deletions static/scripts/S3/S3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f0fb1a

Please sign in to comment.