Nicer design for the WMS preview

This commit is contained in:
Adrià Mercader 2011-03-23 10:00:39 +00:00
parent 32a180f39c
commit 0cf2c7e7ac
5 changed files with 35 additions and 8 deletions

View File

@ -152,11 +152,10 @@ class ViewController(BaseController):
def map_view(self,id):
#check if package exists
pkg = Package.get(id)
if pkg is None:
c.pkg = Package.get(id)
if c.pkg is None:
abort(404, 'Package not found')
c.url = pkg.url
return render('ckanext/harvest/map.html')

View File

@ -1,5 +1,5 @@
MAP_VIEW="""
<div class="mapview">
<a href="/package/%(name)s/map">View in map</a>
<a href="/package/%(name)s/map">View available WMS layers &raquo;</a>
</div>
"""

View File

@ -144,7 +144,7 @@ CKAN.MapViewer = function($){
OpenLayers.ImgPath = "/ckanext/harvest/js/openlayers/img/";
OpenLayers.Lang.en.overlays = "Layers";
OpenLayers.Lang.en.overlays = "Available Layers:";
OpenLayers.Control.CustomMousePosition = OpenLayers.Class(OpenLayers.Control.MousePosition,{
formatOutput: function(lonLat) {

View File

@ -7,3 +7,13 @@
display: inline;
margin-left: 20px;
}
/* OpenLayers */
.dataLbl{
font-weight: bold;
margin-bottom: 20px;
}
.dataLayersDiv span{
margin-left: 10px;
}

View File

@ -3,7 +3,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<py:def function="page_title">WMS preview</py:def>
<py:def function="page_title">${c.pkg.title or c.pkg.name} - WMS preview</py:def>
<py:def function="optional_head">
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/mapviewer.css" />
@ -13,11 +13,28 @@
<div py:match="content">
<div class="map-view-content">
<h2>WMS preview</h2>
<h2 class="head">
${c.pkg.title}
</h2>
<!-- Source URL -->
<div class="url" py:if="c.pkg.url">
<p>
Source: <a href="${c.pkg.url}" target="_blank">${c.pkg.url}</a>
</p>
</div>
<p>
<a
href="${url(controller='package', action='read', id=c.pkg.name)}"
title="Package Details">
Package details</a>
</p>
<div class="package subsection">
<h3>WMS preview</h3>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
CKAN.MapViewer.setup("${c.url}");
CKAN.MapViewer.setup("${c.pkg.url}");
})
//]]>
</script>
@ -25,5 +42,6 @@
<div id="layers"></div>
</div>
</div>
</div>
<xi:include href="../../layout.html" />
</html>