added an attempt at real time updates on maps

This commit is contained in:
Connor Turland 2013-01-04 00:20:43 -05:00
parent 70ec0be568
commit 8180742ec4
120 changed files with 216 additions and 3 deletions

View file

@ -670,5 +670,10 @@ function onCreateLabelHandler(domElement, node) {
node.setData("metacode", metacode);
Mconsole.plot();
});
$(showCard).find('.best_in_place_name').bind("ajax:success", function() {
var name = $(this).html();
$(nameContainer).find('.label').html(name);
});
}//onCreateLabelHandler

View file

@ -21,7 +21,7 @@
// other options are 'graph'
var viewMode = "list";
var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false;
var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false;
$(document).ready(function() {

View file

@ -7,6 +7,9 @@
width:87px;
}
#MapRealtime {
display:none;
}
.map { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; }

View file

@ -138,6 +138,18 @@ class MapsController < ApplicationController
end
end
# GET maps/:id/realtime
def realtime
@current = current_user
@map = Map.find(params[:id])
@mapjson = @map.self_as_json(@current).html_safe
respond_to do |format|
format.js { respond_with(@mapjson) }
end
end
# DELETE maps/:id
def destroy
@map = Map.find(params[:id])

View file

@ -0,0 +1,55 @@
function arraysEqual(a1,a2) {
return JSON.stringify(a1)==JSON.stringify(a2);
}
newJSON = <%= @mapjson %>;
if (!arraysEqual(json,newJSON)) {
json = newJSON;
$.each(json, function(i,topic){
var temp = Mconsole.graph.getNode(topic.id);
// in this case the node wasn't on the page before, so we create it
if (temp == null) {
Mconsole.graph.addNode(topic);
var temp = Mconsole.graph.getNode(topic.id);
temp.setData('dim', 1, 'start');
temp.setData('dim', 25, 'end');
var newPos = new $jit.Complex();
newPos.x = temp.data.$xloc;
newPos.y = temp.data.$yloc;
temp.setPos(newPos, 'start');
temp.setPos(newPos, 'current');
temp.setPos(newPos, 'end');
Mconsole.fx.plotNode(temp, Mconsole.canvas);
Mconsole.labels.plotLabel(Mconsole.canvas, temp, Mconsole.config);
Mconsole.fx.animate({
modes: ['node-property:dim','edge-property:lineWidth'],
duration: 500
});
}
else { // in this case we found a topic so we have to update it
temp.data = topic.data;
var newPos = new $jit.Complex();
newPos.x = temp.data.$xloc;
newPos.y = temp.data.$yloc;
temp.setPos(newPos, 'end');
var label = Mconsole.labels.getLabel(topic.id);
$(label).find('.best_in_place_name').html(topic.name);
$(label).find('.label').html(topic.name);
$(label).find('.best_in_place_metacode').html(topic.data.$metacode);
$(label).find('img.icon').attr('alt', topic.data.$metacode);
$(label).find('img.icon').attr('src', imgArray[topic.data.$metacode].src);
$(label).find('.best_in_place_desc').html(topic.data.$desc);
$(label).find('.best_in_place_link').html(topic.data.$link);
$(label).find('.link').attr('href',topic.data.$link);
}
});
Mconsole.animate({
modes: ['linear'],
transition: $jit.Trans.Quad.easeInOut,
duration: 500
});
}

View file

@ -8,6 +8,7 @@
<%= form.submit "Save Layout", class: "saveLayout", id: "saveLayout" %>
<% end %>
<% end %>
<button onclick="if (!goRealtime) { this.innerHTML = 'Stop Realtime'} else if (goRealtime) { this.innerHTML = 'Start Realtime'} goRealtime = !goRealtime;">Start Realtime</button>
</div>
<div class="focusmiddle">
<h1 class="title"><%= @map.name %> <% if (@map.permission == "commons" && authenticated?) || @map.user == user %><%= link_to "[edit]", edit_map_path(@map) %><% end %></h1>
@ -49,5 +50,12 @@
}
</script>
<%= render :partial => 'newtopic' %>
<%= render :partial => 'newsynapse' %>
<% if authenticated? %>
<%= render :partial => 'newtopic' %>
<%= render :partial => 'newsynapse' %>
<% end %>
<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %>
<% end %>
<script>
var int = setInterval(function(){if (goRealtime) {$('#MapRealtime').submit(); console.log('realtime');}},5000);
</script>

View file

@ -9,6 +9,7 @@ ISSAD::Application.routes.draw do
match 'search', to: 'main#search', via: :get, as: :search
match 'maps/:id/savelayout', to: 'maps#savelayout', via: :put, as: :savelayout
match 'maps/:id/realtime', to: 'maps#realtime', via: :get, as: :realtime
resource :session

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
public/assets/action.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/activity.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/argument.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
public/assets/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/bizarre.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
public/assets/catalyst.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/closed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/con_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/decision.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/foresight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/futuredev.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
public/assets/go-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/group.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/idea.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
public/assets/insight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/intention.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/junto.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
public/assets/knowledge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/list.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
public/assets/location.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

@ -0,0 +1,55 @@
---
action.png: action-02bd981b8466a7b2cb167afffc284703.png
activity.png: activity-27aedb9b5baea69ea88f1f2b5303862c.png
argument.png: argument-4c3b1c568d758e134c36e4be294ed3a5.png
background.jpg: background-2fcc9f96ace4764a02278ada04bc0d9d.jpg
background2-for-repeating.jpg: background2-for-repeating-8d022369a362b364c9395039167f1ffd.jpg
background2.jpg: background2-c2b46d9ebc7d31aea8135e3c505aa1e9.jpg
bg.png: bg-eea3f1ec61623cbc3833f8fcbf114bf8.png
bizarre.png: bizarre-4154e4b7b2e0169cfc4af24c32119305.png
catalyst.png: catalyst-21e04cdb0f34140b3e00d0b98aca240c.png
closed.png: closed-11f6970ed42d52bc9352fa8860ab7479.png
con_icon.png: con_icon-d8aee295fac276c5de66ba835b251137.png
decision.png: decision-7cee13c9510c1119ba34c8bb654ffdde.png
example.png: example-fc70515d308ee9ef5b3b2b38d0eecb8e.png
experience.png: experience-79528f6bceb2a66a98bdbdff2c64dc02.png
foresight.png: foresight-0e62c71e1eb88a2b7ff4d20ba12f3f54.png
futuredev.png: futuredev-e3c62458cfd457b0501dddc6d9b2d8d4.png
go-arrow.png: go-arrow-1d87c9870031ea6b0179cd00ead5cbf1.png
goodpractice.png: goodpractice-928b04810ec395c188e90cc05f219387.png
group.png: group-70155e13e72ec389d64a4f80a8d62d24.png
idea.png: idea-5092d85514a1fdacec53760d7ecf63c4.png
implication.png: implication-652ece8bc0b1060dd5ca0756393cf21e.png
insight.png: insight-858ccca7357b37837a257e0202319b27.png
intention.png: intention-a487d116bfcf64c7ac559ef89ed61544.png
junto.png: junto-3bca283ec5fe80ef34d6a888b7c676b4.png
knowledge.png: knowledge-eb4b1dc4412b210c286b934737b04f80.png
list.png: list-c2cade39d3e1e606162d860d9eb58690.png
location.png: location-e1642892214a5cb4b2891f3837f437de.png
map.png: map-acf615128f2f9f581a225ed908fd5f3b.png
moviemap.png: moviemap-7b2052b46a57fd1554fdeaed5470ac87.png
note.png: note-607459da5972ee3b48469762ad879864.png
openissue.png: openissue-d9c50446b2dbd0587942ae298bda2a75.png
opinion.png: opinion-eabcaf3f05d2bf38dfd075e8449cea57.png
opportunity.png: opportunity-4fe7c2f4f5cbe678058c76924ec43a7f.png
person.png: person-2cb4eace780426c21c109ca6475431ce.png
platform.png: platform-29f4dc32fb5f2a9f369b92d2f51ba005.png
pro.png: pro-205bd7f40d88f6d13369780d0d115ebf.png
problem.png: problem-d660aa3522f737dfd25487937bed6db1.png
question.png: question-9ac8258ba7e5bcb83114651b43dcc92e.png
reference.png: reference-114b70ecccc3971ad9942f5fc8b5b654.png
requirement.png: requirement-d200e129a41fff36f64111f554abea72.png
research.png: research-0c10ce1c3fbdad073555b64ab85aef9d.png
resource.png: resource-4017b1e9535d80d205ceff916930cf5d.png
role.png: role-c474b1fcb4b4f836e7ca0db67e744dc3.png
spinner.gif: spinner-3dc049c5763846dcf9ff6cab669b2b87.gif
task.png: task-0ac599d122a709a5e73990f1745019e0.png
tool.png: tool-92f28a86b5ece18668698a0b9a19aca7.png
topbg.png: topbg-eb18f5cf8dcfaf7dfd7e47f503956a5d.png
topbg2.png: topbg2-f9640f6cb183bb610d0954c7759ecc23.png
trajectory.png: trajectory-a7c520e746d4c1ffe401805b3d0cb6cd.png
ui-bg_flat_75_ffffff_40x100.png: ui-bg_flat_75_ffffff_40x100-841636c8f8d33987bb8d2f31e8ef92ca.png
wildcard.png: wildcard-22dead854b0b5f4ec0aba7a05425839e.png
application.js: application-270ea179b1f63eeac66300ecb7d5fd38.js
scroll/mCSB_buttons.png: scroll/mCSB_buttons-6eb1e766df3b6b28f5cb2a218697658f.png
application.css: application-36fbfd1a7f25ac80214f83065ab39d70.css

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/moviemap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/note.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/openissue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/opinion.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
public/assets/person.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
public/assets/platform.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/pro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/assets/problem.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/question.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/assets/reference.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/assets/research.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
public/assets/resource.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Some files were not shown because too many files have changed in this diff Show more