2013-01-11 18:49:59 -05:00
<%#
# @file
# Code to display a map
2013-01-23 13:55:50 -05:00
# /maps/:id
2013-01-11 18:49:59 -05:00
#%>
2013-01-06 18:40:48 -05:00
<div class="headertop">
2013-01-25 22:50:23 -05:00
<% if false %>
2013-01-25 00:47:32 -05:00
<button onclick="if (!goRealtime) { this.innerHTML = 'Stop Realtime'; } else if (goRealtime) { this.innerHTML = 'Start Realtime'; } goRealtime = !goRealtime;">Start Realtime</button>
2013-01-25 22:50:23 -05:00
<% end %>
2013-01-07 00:17:39 -05:00
<button onclick="hideSelectedEdges();hideSelectedNodes();">Hide Selected</button>
2013-03-22 02:37:56 -04:00
<button onclick="enterKeyHandler();">Keep Selected</button>
2013-01-06 18:40:48 -05:00
<% if authenticated? %>
2013-01-25 00:47:32 -05:00
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
<button onclick="removeSelectedEdges();removeSelectedNodes();">Remove Selected From Map</button>
<% end %>
2013-01-07 00:17:39 -05:00
<button onclick="var r=confirm('Are you sure you want to permanently delete selected objects?!'); if (r == true) {deleteSelectedEdges();deleteSelectedNodes();}">Permanently Delete Selected</button>
2013-01-06 18:40:48 -05:00
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
<%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
<%= form.hidden_field "coordinates", :value => "" %>
<%= form.submit "Save Layout", class: "saveLayout", id: "saveLayout" %>
<% end %>
<% end %>
<button onclick="saveToMap();">Save to New Map</button>
<% end %>
<button onclick='clearCanvas();'>Clear Canvas</button>
</div>
<div class="clearfloat"></div>
<h1 class="index">
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
Editing Map:
<% else %>
Viewing Map:
<% end %>
<%= @map.name %>
2013-01-07 23:40:58 -05:00
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
<%= link_to "[edit]", edit_map_path(@map) %>
<% end %>
2013-01-06 18:40:48 -05:00
</h1>
2012-10-26 06:04:52 -04:00
2013-01-04 21:39:16 -05:00
<div class="maps onMap" id="container">
2012-10-26 06:04:52 -04:00
<div id="center-container">
<div id="infovis"></div>
</div>
2013-03-17 05:18:30 -04:00
<div class="showcard" id="showcard"></div>
2012-10-26 06:04:52 -04:00
</div>
<div class="clearfloat"></div>
2013-01-04 21:39:16 -05:00
<% if authenticated? %>
<%= render :partial => 'newtopic' %>
<%= render :partial => 'newsynapse' %>
2013-01-06 18:40:48 -05:00
<%= render :partial => 'maps/new' %>
2013-01-04 21:39:16 -05:00
<% end %>
2013-01-07 23:40:58 -05:00
2013-01-25 22:50:23 -05:00
<% if false %>
2013-01-23 13:55:50 -05:00
<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %>
2013-01-07 23:40:58 -05:00
<%= form.hidden_field :time, :value => Time.now.to_i %>
<%= form.hidden_field :ids, :value => 0 %>
2013-01-04 21:39:16 -05:00
<% end %>
2013-01-25 22:50:23 -05:00
<% end %>
2013-01-07 23:40:58 -05:00
2013-01-04 21:39:16 -05:00
<script>
var dragged = 0;
mapid = <%= @map.id %>;
2013-01-25 00:47:32 -05:00
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
mapperm = true;
<% end %>
2013-01-25 22:50:23 -05:00
/*var int = setInterval(function(){
2013-01-04 21:39:16 -05:00
if (goRealtime) {
$('#MapRealtime').submit();
}
2013-01-25 22:50:23 -05:00
},4000);*/
2013-01-04 21:39:16 -05:00
</script>
2012-10-26 06:04:52 -04:00
<script>
2012-12-15 02:39:14 -05:00
viewMode = "graph";
2012-10-26 06:04:52 -04:00
json = <%= @mapjson %>;
if (json.length > 0) {
$(document).ready(function() {
2012-12-03 18:40:14 -05:00
<% if (@map.arranged) %>
2012-12-14 13:31:39 -05:00
initialize("arranged");
2012-12-03 18:40:14 -05:00
<% else %>
2012-12-14 13:31:39 -05:00
initialize("chaotic");
2012-12-03 18:40:14 -05:00
<% end %>
2012-10-26 06:04:52 -04:00
});
}
2012-12-25 18:29:20 -05:00
else {
$(document).ready(function() {
initialize("chaotic", true);
});
}
2013-01-06 18:40:48 -05:00
</script>
<%= render :partial => 'main/find' %>
<%= render :partial => 'main/analyze' %>
2013-01-11 18:49:59 -05:00
<%= render :partial => 'main/organize' %>