change layout: now a link, no longer a tab

This commit is contained in:
Christopher Schmidt 2008-04-22 12:48:26 +00:00
parent 24c623fdf2
commit 25fa17d612
5 changed files with 19 additions and 24 deletions

View file

@ -15,11 +15,5 @@
<div id="status"></div> <div id="status"></div>
<div id="object"> <div id="object">
<h3>Recent Changes</h3>
<ul>
<% @nodes.each do |node| %>
<li><%= node.id %> @ <a href="#" onclick="setMapCenter(new OpenLayers.LonLat(<%= node.lon.to_s %>, <%= node.lat.to_s %>), 16); return false;"><%= node.lat.to_s %>,<%= node.lon.to_s %></a></li>
<% end %>
</ul>
</div> </div>
</div> </div>

View file

@ -22,6 +22,11 @@ page << <<EOJ
map.addControl(box); map.addControl(box);
map.events.register("moveend", map, validateLinks); map.events.register("moveend", map, validateLinks);
map.events.triggerEvent("moveend"); map.events.triggerEvent("moveend");
if (map.getZoom() >= 16) {
useMap();
} else {
$("status").innerHTML = "Zoom in or Select an area of the map to view.";
}
} }
function stopBrowse() { function stopBrowse() {
@ -49,7 +54,6 @@ page << <<EOJ
function useMap() { function useMap() {
var bounds = map.getExtent(); var bounds = map.getExtent();
setBounds(bounds);
getData(bounds); getData(bounds);
return false; return false;
} }
@ -57,13 +61,13 @@ page << <<EOJ
function endDrag(bbox) { function endDrag(bbox) {
var bounds = bbox.getBounds(); var bounds = bbox.getBounds();
setBounds(bounds);
box.deactivate(); box.deactivate();
getData(bounds); getData(bounds);
$("drag_box").innerHTML = "Manually select a different area"; $("drag_box").innerHTML = "Manually select a different area";
} }
function displayFeatureWarning() { function displayFeatureWarning() {
$("status").innerHTML = "";
var div = document.createElement("div"); var div = document.createElement("div");
var p = document.createElement("p"); var p = document.createElement("p");
p.appendChild(document.createTextNode("You have loaded an area which contains " + featureList.length + " features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below.")); p.appendChild(document.createTextNode("You have loaded an area which contains " + featureList.length + " features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."));
@ -121,9 +125,11 @@ page << <<EOJ
var url = "/api/0.5/map?bbox="+bounds.toBBOX(); var url = "/api/0.5/map?bbox="+bounds.toBBOX();
loadGML(url);
}
function loadGML(url) {
$("status").innerHTML = "Loading..."; $("status").innerHTML = "Loading...";
if (!gml) { if (!gml) {
var def = OpenLayers.Feature.Vector.style['default'];
var style = new OpenLayers.Style(); var style = new OpenLayers.Style();
style.addRules([new OpenLayers.Rule( style.addRules([new OpenLayers.Rule(
{'symbolizer': {'symbolizer':
@ -135,7 +141,7 @@ page << <<EOJ
gml = new OpenLayers.Layer.GML("Data",url, gml = new OpenLayers.Layer.GML("Data",url,
{format: OpenLayers.Format.OSM, formatOptions: {checkTags: true}, {format: OpenLayers.Format.OSM, formatOptions: {checkTags: true},
maxFeatures: 100, requestSuccess: customDataLoader, maxFeatures: 100, requestSuccess: customDataLoader,
styleMap: new OpenLayers.StyleMap({'default': style, 'select': {'strokeColor': '#0000ff'}}) styleMap: new OpenLayers.StyleMap({'default': style, 'select': {'strokeColor': '#0000ff', strokeWidth: 8}})
} }
); );
gml.events.register("loadend", gml, dataLoaded ); gml.events.register("loadend", gml, dataLoaded );
@ -153,7 +159,6 @@ page << <<EOJ
currentFeature = null; currentFeature = null;
} }
function dataLoaded() { function dataLoaded() {
$("status").innerHTML = "Loaded " + this.features.length + " features. (<a href='"+ this.url+"'>API</a>)"; $("status").innerHTML = "Loaded " + this.features.length + " features. (<a href='"+ this.url+"'>API</a>)";
@ -257,17 +262,6 @@ page << <<EOJ
currentFeature = feature; currentFeature = feature;
} }
function setBounds(bounds) {
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var decimals = Math.pow(10, Math.floor(map.getZoom() / 3));
bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326);
$("minlon").innerHTML = Math.round(bounds.left * decimals) / decimals;
$("minlat").innerHTML = Math.round(bounds.bottom * decimals) / decimals;
$("maxlon").innerHTML = Math.round(bounds.right * decimals) / decimals;
$("maxlat").innerHTML = Math.round(bounds.top * decimals) / decimals;
}
function validateLinks() { function validateLinks() {
var bounds = this.getExtent(); var bounds = this.getExtent();
bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326); bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326);

View file

@ -54,7 +54,6 @@
<% end %> <% end %>
<li><%= link_to 'GPS Traces', {:controller => 'trace', :action => 'list'}, {:id => 'traceanchor', :title => 'manage traces', :class => traceclass} %></li> <li><%= link_to 'GPS Traces', {:controller => 'trace', :action => 'list'}, {:id => 'traceanchor', :title => 'manage traces', :class => traceclass} %></li>
<li><%= link_to 'User Diaries', {:controller => 'diary_entry', :action => 'list'}, {:id => 'diaryanchor', :title => 'view user diaries', :class => diaryclass} %></li> <li><%= link_to 'User Diaries', {:controller => 'diary_entry', :action => 'list'}, {:id => 'diaryanchor', :title => 'view user diaries', :class => diaryclass} %></li>
<li><%= link_to_remote 'Browse', {:url => {:controller => 'browse', :action => 'start'}}, {:href => url_for( {:controller => 'browse', :action => 'index'}), :id => 'browseanchor', :title => 'browse data', :class => browseclass} %></li>
</ul> </ul>
</div> </div>

View file

@ -9,6 +9,7 @@
<%= render :partial => 'search' %> <%= render :partial => 'search' %>
<div id="map"> <div id="map">
<div id="datalink"><%= link_to_remote 'See Data', {:url => {:controller => 'browse', :action => 'start'}}, {:href => url_for( {:controller => 'browse', :action => 'index'}), :id => 'browseanchor', :title => 'browse data'} %></div>
<div id="permalink"><a href="/" id="permalinkanchor">Permalink</a></div> <div id="permalink"><a href="/" id="permalinkanchor">Permalink</a></div>
</div> </div>

View file

@ -1,4 +1,4 @@
a { a m
color: #0000ff; color: #0000ff;
text-decoration: none; text-decoration: none;
} }
@ -569,6 +569,13 @@ input[type="text"] {
font-weight: normal; font-weight: normal;
} }
#datalink {
z-index:10000;
position:absolute;
bottom:30px;
right:15px;
font-size:smaller;
}
#permalink { #permalink {
z-index:10000; z-index:10000;
position:absolute; position:absolute;