Diff
Modified: branches/neiss/app/controllers/maps_controller.rb (2438 => 2439)
--- branches/neiss/app/controllers/maps_controller.rb 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/app/controllers/maps_controller.rb 2010-06-22 14:49:43 UTC (rev 2439)
@@ -239,7 +239,10 @@
# GET /maps/1/explore
def explore
respond_to do |format|
- format.html # explore.rhtml
+ format.html {
+ @extra_head_content = "<script src="" @map.api_key}\" type=\"text/_javascript_\"></script>"
+ # explore.rhtml
+ }
end
end
Modified: branches/neiss/app/views/layouts/_myexperiment.rhtml (2438 => 2439)
--- branches/neiss/app/views/layouts/_myexperiment.rhtml 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/app/views/layouts/_myexperiment.rhtml 2010-06-22 14:49:43 UTC (rev 2439)
@@ -21,6 +21,11 @@
<%= _javascript__include_tag "boxover.js" %>
<%= render :partial => "layouts/feed_link_tags" %>
+
+ <% if @extra_head_content %>
+ <%= @extra_head_content -%>
+ <% end %>
+
</head>
<body>
<div id="doc2" class="yui-t4">
Modified: branches/neiss/app/views/maps/edit.rhtml (2438 => 2439)
--- branches/neiss/app/views/maps/edit.rhtml 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/app/views/maps/edit.rhtml 2010-06-22 14:49:43 UTC (rev 2439)
@@ -26,6 +26,28 @@
<br/>
+ <p style="text-align: center;"><strong>Map descriptor: </strong><br /> <%= f.text_field :map_descriptor, :size => 60 %></p>
+
+ <br />
+
+ <p style="text-align: center;"><strong>API key: </strong><br /> <%= f.text_field :api_key, :size => 60 %></p>
+
+ <br />
+
+ <p style="text-align: center;"><strong>Copyright statement: </strong><br /> <%= f.text_field :copyright_statement, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Copyright URL </strong><br /> <%= f.text_field :copyright_url, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Copyright text: </strong><br />
+ <textarea cols="60" id="map_copyright_text" name="map[copyright_text]"><%= html_escape(@map.copyright_text) -%></textarea>
+ </p>
+
+ <br />
+
+ <p style="text-align: center;"><strong>Latitude: </strong><br /> <%= f.text_field :latitude, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Longitude: </strong><br /> <%= f.text_field :longitude, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Zoom level: </strong><br /> <%= f.text_field :zoom, :size => 60 %></p>
+
+ <br/>
+
<%= render :partial => "tags/tags_form", :locals => { :edit => true, :taggable => @map } %>
<%= render :partial => "contributions/credit_attribution_form", :locals => { :edit => true, :contributable => @map } %>
Modified: branches/neiss/app/views/maps/explore.rhtml (2438 => 2439)
--- branches/neiss/app/views/maps/explore.rhtml 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/app/views/maps/explore.rhtml 2010-06-22 14:49:43 UTC (rev 2439)
@@ -0,0 +1,61 @@
+<body
+
+<script type="text/_javascript_">
+ var surveyMap;
+ surveyMap = new GMap2(document.getElementById("map_canvas"));
+ surveyMap.setUIToDefault();
+
+function getOverlay(tileService, descriptor) {
+ //return the GOverlay object (e.g. GTileLayerOverlay) to put this object onto a GMap2
+ var copyrightCollection = new GCopyrightCollection("© ");
+
+ copyrightCollection.addCopyright(
+ new GCopyright("<%= @map.copyright_statement -%>",
+ new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)),
+ 0,
+ "<a href="" @map.copyright_url -%>\"><%= @map.copyright_text -%></a>")
+ );
+
+ var tileLayer = new GTileLayer(copyrightCollection);
+ tileLayer.tileRequestPattern = tileService.replace("\x7B0\x7D", descriptor); //{0} in hex escape characters
+ tileLayer.getOpacity = function() { return 1.0; }
+ tileLayer.getTileUrl = function(a, b) {
+ //converts tile x,y into keyhole string
+ var c = Math.pow(2, b);
+ var d = a.x;
+ var e = a.y;
+ var f = "t";
+ for (var g = 0; g < b; g++) {
+ c /= 2;
+ if (e < c) {
+ if (d < c) { f += "q" }
+ else { f += "r"; d -= c }
+ }
+ else {
+ if (d < c) { f += "t"; e -= c }
+ else { f += "s"; d -= c; e -= c }
+ }
+ }
+ return this.tileRequestPattern.replace("\x7B1\x7D", f); //{1} in hex escape characters
+ };
+ tileLayer.isPng = function() { return true; };
+ return new GTileLayerOverlay(tileLayer);
+}
+
+
+
+
+</script>
+
+ <div id="map_canvas" style="width: 500px; height: 500px;"></div>
+
+ <script type="text/_javascript_">var tileService = 'http://tilefish.casa.ucl.ac.uk/TileRequestHandler.ashx?u={0}&t={1}'; var descriptor = '<%= @map.map_descriptor -%>'; surveyMap.addOverlay(getOverlay(tileService, descriptor));</script>
+ <script type="text/_javascript_">surveyMap.setCenter(new GLatLng(<%= @map.latitude -%>, <%= @map.longitude -%>), <%= @map.zoom -%>);</script>
+
+</body>
+
+
+
+
+
+
Modified: branches/neiss/app/views/maps/new.rhtml (2438 => 2439)
--- branches/neiss/app/views/maps/new.rhtml 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/app/views/maps/new.rhtml 2010-06-22 14:49:43 UTC (rev 2439)
@@ -26,13 +26,26 @@
<br />
- <p style="text-align: center;">
- <strong>URL: </strong>
- <br/>
- <%= text_field_tag "map[url]", nil, :size => 60 %>
- </p>
-
+ <p style="text-align: center;"><strong>Map descriptor: </strong><br /> <%= text_field_tag "map[map_descriptor]", nil, :size => 60 %></p>
+
+ <br />
+
+ <p style="text-align: center;"><strong>API key: </strong><br /> <%= text_field_tag "map[api_key]", nil, :size => 60 %></p>
+
+ <br />
+
+ <p style="text-align: center;"><strong>Copyright statement: </strong><br /> <%= text_field_tag "map[copyright_statement]", nil, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Copyright URL </strong><br /> <%= text_field_tag "map[copyright_url]", nil, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Copyright text: </strong><br /> <textarea id="map[copyright_text]" name="map[copyright_text]" rows="10" style="width: 99%;"></textarea> </p>
+
+ <br />
+
+ <p style="text-align: center;"><strong>Latitude: </strong><br /> <%= text_field_tag "map[latitude]", nil, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Longitude: </strong><br /> <%= text_field_tag "map[longitude]", nil, :size => 60 %></p>
+ <p style="text-align: center;"><strong>Zoom level: </strong><br /> <%= text_field_tag "map[zoom]", nil, :size => 60 %></p>
+
<br/>
+
<%= render :partial => "tags/tags_form", :locals => { :edit => false, :taggable => @map } %>
<%= render :partial => "contributions/credit_attribution_form", :locals => { :edit => false, :contributable => @map } %>
Modified: branches/neiss/app/views/maps/show.rhtml (2438 => 2439)
--- branches/neiss/app/views/maps/show.rhtml 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/app/views/maps/show.rhtml 2010-06-22 14:49:43 UTC (rev 2439)
@@ -71,10 +71,51 @@
<br/>
<p>
- <b>URL:</b>
- <span class="title"><%=h @map.url %></span>
+ <b>Map descriptor:</b>
+ <span><%=h @map.map_descriptor %></span>
</p>
+
+ <br/>
+ <p>
+ <b>API key</b>
+ <span><%=h @map.api_key %></span>
+ </p>
+
+ <br/>
+
+ <p>
+ <b>Latitude</b>
+ <span><%=h @map.latitude %></span>
+ </p>
+
+ <p>
+ <b>Longitude</b>
+ <span><%=h @map.longitude %></span>
+ </p>
+
+ <p>
+ <b>Zoom level</b>
+ <span><%=h @map.zoom %></span>
+ </p>
+
+ <br/>
+
+ <p>
+ <b>Copyright statement</b>
+ <span><%=h @map.copyright_statement %></span>
+ </p>
+
+ <p>
+ <b>Copyright URL</b>
+ <span><%=h @map.copyright_url %></span>
+ </p>
+
+ <p>
+ <b>Copyright text</b>
+ <span><%=h @map.copyright_text %></span>
+ </p>
+
</div>
</div>
Modified: branches/neiss/config/schema.d/neiss.xml (2438 => 2439)
--- branches/neiss/config/schema.d/neiss.xml 2010-06-22 13:18:13 UTC (rev 2438)
+++ branches/neiss/config/schema.d/neiss.xml 2010-06-22 14:49:43 UTC (rev 2439)
@@ -6,9 +6,17 @@
<column type="integer" name="contributor_id"/>
<column type="string" name="contributor_type"/>
<column type="string" name="title"/>
- <column type="string" name="description"/>
- <column type="string" name="description_html"/>
+ <column type="text" name="description"/>
+ <column type="text" name="description_html"/>
<column type="string" name="url"/>
+ <column type="string" name="api_key"/>
+ <column type="text" name="copyright_statement"/>
+ <column type="string" name="copyright_url"/>
+ <column type="text" name="copyright_text"/>
+ <column type="string" name="map_descriptor"/>
+ <column type="float" name="latitude"/>
+ <column type="float" name="longitude"/>
+ <column type="integer" name="zoom"/>
<column type="integer" name="license_id"/>
<column type="datetime" name="created_at"/>
<column type="datetime" name="updated_at"/>
@@ -17,4 +25,3 @@
</schema>
-