Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ported the mobile client as per #404
- Loading branch information
Showing
7 changed files
with
334 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from geonode.contrib.worldmap.wm_extra import signals # NOQA |
27 changes: 27 additions & 0 deletions
27
geonode/contrib/worldmap/wm_extra/templates/wm_extra/maps/geo_mobile_header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<link rel="stylesheet" type="text/css" href="{{ GEONODE_CLIENT_LOCATION }}externals/openlayers/theme/default/style.css" /> | ||
<script src="{{ GEONODE_CLIENT_LOCATION }}script/OpenLayers.js"></script> | ||
<link rel="stylesheet" type="text/css" href="{{ GEONODE_CLIENT_LOCATION }}externals/geoext/resources/css/geoext-all.css" /> | ||
<script src="{{ GEONODE_CLIENT_LOCATION }}script/GeoExt.js"></script> | ||
<link rel="stylesheet" href="{{ GEONODE_CLIENT_LOCATION }}externals/gxp/theme/all.css" /> | ||
<script src="{{ GEONODE_CLIENT_LOCATION }}script/gxp.js"></script> | ||
<link rel="stylesheet" type="text/css" href="{{ GEONODE_CLIENT_LOCATION }}theme/app/geoexplorer.css" /> | ||
<link rel="stylesheet" type="text/css" href="{{ GEONODE_CLIENT_LOCATION }}theme/app/geoexplorer_mobile.css" /> | ||
<!--[if IE]><link rel="stylesheet" type="text/css" href="{{ GEONODE_CLIENT_LOCATION }}theme/app/ie.css"/><![endif]--> | ||
<script src="{{ GEONODE_CLIENT_LOCATION }}script/GeoExplorer.js"></script> | ||
<script type="text/javascript"> | ||
|
||
//Reset SLD defaults for symbolizer, because for some reason | ||
// it otherwise wreaks havoc with touch dragging | ||
|
||
OpenLayers.Renderer.defaultSymbolizer = { | ||
fillColor: "#000000", | ||
strokeColor: "#000000", | ||
strokeWidth: 2, | ||
fillOpacity: 1, | ||
strokeOpacity: 1, | ||
pointRadius: 0, | ||
labelAlign: 'cm' | ||
}; | ||
|
||
|
||
</script> |
53 changes: 53 additions & 0 deletions
53
geonode/contrib/worldmap/wm_extra/templates/wm_extra/maps/mobile.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{% load i18n %} | ||
<html> | ||
<head> | ||
|
||
<title>{% block title %}WorldMap{% endblock %}</title> | ||
<link rel="shortcut icon" href="{{ STATIC_URL }}theme/img/favicon.ico"/> | ||
{% block head %} | ||
|
||
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}theme/site.css" /> | ||
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}theme/site_mobile.css" /> | ||
|
||
{% comment %} | ||
<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script> | ||
<script type="text/javascript" src="{% url lang %}"></script> | ||
{% endcomment %} | ||
|
||
{% autoescape off %} | ||
{{ GOOGLE_ANALYTICS_CODE }} | ||
{% endautoescape %} | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=no" /> | ||
|
||
{% endblock %} | ||
</head> | ||
<body style="min-height:100px;min-width:100px;"> | ||
{% block body %} | ||
{% block header-wrapper %} | ||
<div id="header"> | ||
<div id="wmpower">{% trans "Powered by" %} <a href="/">{% trans "WorldMap" %}</a></div> | ||
|
||
<div class="wrapmap selfclear"> | ||
|
||
{% block logos %} | ||
|
||
{% endblock logos %} | ||
|
||
|
||
{% comment %} | ||
<div id="login-area"> | ||
{% if user.is_authenticated %} | ||
<a href="{% if user.get_profile %}{{ user.get_profile.get_absolute_url }}{% else %}{% url profiles_create_profile %}{% endif %}"><span style="font-weight:bold">{{user.username}}</span></a> | ||
{% else %} | ||
<!-- this should be updated to a url var --><a href="/accounts/login?next={{request.path}}">{% trans "Sign in" %}</a> | ||
{% endif %} | ||
</div> | ||
{% endcomment %} | ||
|
||
</div><!-- /.wrap --> | ||
</div><!-- /#header --> | ||
{% endblock header-wrapper %} | ||
{% endblock body %} | ||
</body> | ||
</html> |
200 changes: 200 additions & 0 deletions
200
geonode/contrib/worldmap/wm_extra/templates/wm_extra/maps/mobilemap.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
{% extends "wm_extra/maps/mobile.html" %} | ||
{% load i18n %} | ||
{% block title %} {% trans "Map Viewer" %} - {{ block.super }} {% endblock %} | ||
|
||
{% block head %} | ||
{% include "wm_extra/maps/ext_header.html" %} | ||
{% include "wm_extra/maps/app_header.html" %} | ||
{% include "wm_extra/maps/geo_mobile_header.html" %} | ||
{{ block.super }} | ||
{% if "gme-" in GOOGLE_API_KEY %} | ||
<script src="https://www.google.com/jsapi?client={{GOOGLE_API_KEY}}"></script> | ||
{% else %} | ||
<script src="https://www.google.com/jsapi?key={{GOOGLE_API_KEY}}"></script> | ||
{% endif %} | ||
|
||
|
||
<script type="text/javascript"> | ||
var originalConfigureLayerNode = GeoExt.WMSLegend.prototype.getLegendUrl; | ||
GeoExt.WMSLegend.prototype.getLegendUrl = function(layerName,layerNames) { | ||
var rec = this.layerRecord; | ||
var layer = rec.getLayer(); | ||
if (OpenLayers.Layer.WMS && layer instanceof OpenLayers.Layer.WMS && layer.getVisibility() === false) { | ||
return ""; | ||
} else { | ||
return originalConfigureLayerNode.apply(this, arguments); | ||
} | ||
}; | ||
|
||
var touchNav = new OpenLayers.Control.TouchNavigation({ | ||
id: "touchNavControl", | ||
dragPanOptions: { | ||
enableKinetic: false | ||
} | ||
}); | ||
|
||
/* | ||
* Deactivate navigation control when FeatureEditor's draw and select controls | ||
are active - conflicts with touch actions. | ||
*/ | ||
gxp.plugins.TouchFeatureEditor = Ext.extend(gxp.plugins.FeatureEditor, { | ||
addActions: function() { | ||
actions = gxp.plugins.FeatureEditor.prototype.addActions.apply(this, arguments); | ||
|
||
this.drawControl.events.register("activate", this.drawControl, function(evt){ | ||
touchNav.deactivate(); | ||
}); | ||
|
||
this.drawControl.events.register("deactivate", this.drawControl, function(evt){ | ||
touchNav.activate(); | ||
}); | ||
|
||
|
||
|
||
this.selectControl.events.register("activate", this.selectControl, function() { | ||
touchNav.deactivate(); | ||
}); | ||
this.selectControl.events.register("deactivate", this.selectControl, function() { | ||
touchNav.activate(); | ||
}); | ||
|
||
return actions; | ||
} | ||
}); | ||
|
||
/* | ||
* Deactivate navigation control when feature editing is occurring. | ||
*/ | ||
var featureEditStartEditing = gxp.FeatureEditPopup.prototype.startEditing; | ||
gxp.FeatureEditPopup.prototype.startEditing = function() { | ||
touchNav.deactivate(); | ||
featureEditStartEditing.apply(this, arguments); | ||
} | ||
|
||
var featureEditStopEditing = gxp.FeatureEditPopup.prototype.stopEditing; | ||
gxp.FeatureEditPopup.prototype.stopEditing = function() { | ||
featureEditStopEditing.apply(this, arguments); | ||
touchNav.activate(); | ||
} | ||
|
||
|
||
var app; | ||
Ext.onReady(function() { | ||
{% autoescape off %} | ||
|
||
/* | ||
* Don't use default symbolizer; causes difficulty in draggoing vertices | ||
*/ | ||
var featureManager = new gxp.plugins.FeatureManager({ | ||
ptype: "gxp_featuremanager", | ||
id: "feature_manager", | ||
paging: false, | ||
autoSetLayer: true, | ||
autoLoadFeatures: true, | ||
listeners: { | ||
'layerchange': function (mgr, layer, schema) { | ||
app.checkLayerPermissions(layer); | ||
} | ||
}, | ||
actionTarget: "main.tbar", | ||
toggleGroup: 'featureGroup', | ||
symbolizer: { | ||
"Point": { | ||
fillColor: "#EF9E0F", | ||
strokeColor: "#EF9E0F", | ||
strokeWidth: 2, | ||
fillOpacity: 1, | ||
strokeOpacity: 1, | ||
pointRadius: 5, | ||
labelAlign: 'cm' | ||
}, | ||
"Line": { | ||
strokeWidth: 4, | ||
strokeOpacity: 1, | ||
strokeColor: "#ff9933" | ||
}, | ||
"Polygon": { | ||
strokeWidth: 2, | ||
strokeOpacity: 1, | ||
strokeColor: "#ff6633", | ||
fillColor: "white", | ||
fillOpacity: 0.3 | ||
} | ||
} | ||
}); | ||
|
||
|
||
var featureEditor = new gxp.plugins.TouchFeatureEditor({ | ||
id: "gn_layer_editor", | ||
featureManager: "feature_manager", | ||
autoLoadFeature: true, | ||
actionTarget: "main.tbar", | ||
toggleGroup: 'featureGroup' | ||
}); | ||
|
||
|
||
|
||
|
||
var config = { | ||
useCapabilities: false, | ||
tools: [{ | ||
ptype: "gxp_geonodequerytool", | ||
id: "worldmap_query_tool", | ||
actionTarget: {target: "main.tbar"}, | ||
outputConfig: {autoHeight:true, autoWidth: true,panIn: false}, | ||
featurePanel: 'queryPanel', | ||
attributePanel: 'gridWinPanel', | ||
toggleGroup: 'featureGroup' | ||
},{ | ||
ptype: "gxp_geolocator", | ||
maxZoom: 15, | ||
actionTarget: "main.tbar" | ||
}{% if user.is_authenticated %}, | ||
featureManager, | ||
featureEditor{% endif %}], | ||
proxy: "/proxy/?url=", | ||
localGeoServerBaseUrl: "{{ GEOSERVER_BASE_URL }}", | ||
|
||
/* The URL to a REST map configuration service. This service | ||
* provides listing and, with an authenticated user, saving of | ||
* maps on the server for sharing and editing. | ||
*/ | ||
rest: "/maps/", | ||
createTools: function() { | ||
} | ||
}; | ||
Ext.apply(config, {{ config }}); | ||
|
||
|
||
|
||
config.map.controls = [ | ||
touchNav, | ||
new OpenLayers.Control.Zoom(), | ||
new OpenLayers.Control.Attribution()]; | ||
|
||
app = new GeoExplorer.ViewerMobile(config); | ||
{% endautoescape %} | ||
}); | ||
</script> | ||
<div style="display:none" id="mobile_intro"> | ||
{% blocktrans %} | ||
<h1>Mobile Map Tips</h1> | ||
<ul> | ||
<li>Click the <strong>Layers</strong> sidebar on the left to see a list of all the map's layers and legends</li> | ||
<li>Use the <strong>Identify</strong> <img style="vertical-align:middle" src="{{ GEONODE_CLIENT_LOCATION }}theme/app/img/silk/information.png" /> tool to retrieve information on active layers at any point where you click on the map</li> | ||
<li>Use the <strong>Geolocate</strong> <img style="vertical-align:middle" src="{{ GEONODE_CLIENT_LOCATION }}externals/gxp/theme/img/geolocate.png" /> tool to zoom to and display your location on the map</li> | ||
</ul> | ||
{% endblocktrans %} | ||
{% if user.is_authenticated %} | ||
{% blocktrans %} | ||
<h1>Feature Creation/Editing</h1> | ||
<ul> | ||
<li>Click on a layer in the layer panel to select it for feature creation/editing. You must have edit permission for the layer.</li> | ||
<li>The highlighted layer in the list is the target of edits when using the Edit feature <img style="vertical-align:middle" src="{{ GEONODE_CLIENT_LOCATION }}theme/app/img/silk/map_edit.png" /> tool or the New Feature <img style="vertical-align:middle" src="{{ GEONODE_CLIENT_LOCATION }}externals/gxp/theme/img/silk/pencil_add.png" /> tool.</li> | ||
<li>Map panning will be disabled when the 'Edit feature' <img style="vertical-align:middle" src="{{ GEONODE_CLIENT_LOCATION }}theme/app/img/silk/map_edit.png" /> tool is enabled or when drawing a new feature <img style="vertical-align:middle" src="{{ GEONODE_CLIENT_LOCATION }}externals/gxp/theme/img/silk/pencil_add.png" /> . Deactivate the tool to re-enable panning. | ||
</ul> | ||
{% endblocktrans %} | ||
{% endif %} | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters