diff --git a/app/assets/javascripts/Jit/graphsettings-event-handlers.js b/app/assets/javascripts/Jit/graphsettings-event-handlers.js index 8fb448b8..771dc1bb 100644 --- a/app/assets/javascripts/Jit/graphsettings-event-handlers.js +++ b/app/assets/javascripts/Jit/graphsettings-event-handlers.js @@ -338,36 +338,41 @@ function selectNodeOnClickHandler(node, e) { } //selectNodeOnRightClickHandler function canvasDoubleClickHandler(canvasLoc,e) { + //grab the location and timestamp of the click var storedTime = MetamapsModel.lastCanvasClick; var now = Date.now(); //not compatible with IE8 FYI MetamapsModel.lastCanvasClick = now; - if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) { - //pop up node creation :) - $('#topic_grabTopic').val("null"); - $('#topic_addSynapse').val("false"); - $('#new_topic').css('left', e.clientX + "px"); - $('#new_topic').css('top', e.clientY + "px"); - $('#topic_x').val(canvasLoc.x); - $('#topic_y').val(canvasLoc.y); - $('#new_topic').fadeIn('fast'); - $('#topic_name').focus(); - } else { - $('#new_topic').fadeOut('fast'); - $('#new_synapse').fadeOut('fast'); - // reset the draw synapse positions to false - MetamapsModel.synapseStartCoord = false; - MetamapsModel.synapseEndCoord = false; - // set all node dimensions back to normal - Mconsole.graph.eachNode(function (n) { - n.setData('dim', 25, 'current'); - }); - tempInit = false; - tempNode = null; - tempNode2 = null; - Mconsole.plot(); - } + // if on a public map, disable topic creation + if (userid && (mapperm || !mapid) ) { + if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) { + //pop up node creation :) + $('#topic_grabTopic').val("null"); + $('#topic_addSynapse').val("false"); + $('#new_topic').css('left', e.clientX + "px"); + $('#new_topic').css('top', e.clientY + "px"); + $('#topic_x').val(canvasLoc.x); + $('#topic_y').val(canvasLoc.y); + $('#new_topic').fadeIn('fast'); + $('#topic_name').typeahead('setQuery','').focus(); + return; + } + } + + $('#new_topic').fadeOut('fast'); + $('#new_synapse').fadeOut('fast'); + // reset the draw synapse positions to false + MetamapsModel.synapseStartCoord = false; + MetamapsModel.synapseEndCoord = false; + // set all node dimensions back to normal + Mconsole.graph.eachNode(function (n) { + n.setData('dim', 25, 'current'); + }); + tempInit = false; + tempNode = null; + tempNode2 = null; + Mconsole.plot(); }//canvasDoubleClickHandler function handleSelectionBeforeDragging(node, e) { @@ -459,6 +464,10 @@ function onDragMoveTopicHandler(node, eventInfo, e) { } // if it's a right click or holding down alt, start synapse creation ->third option is for firefox else if ((e.button == 2 || (e.button == 0 && e.altKey) || e.buttons == 2) && userid != null) { + + // if on a public map, disable synapse creation + if (mapid && !mapperm) return; + if (tempInit == false) { tempNode = node; tempInit = true; diff --git a/app/assets/javascripts/Jit/jit2.0.0.js b/app/assets/javascripts/Jit/jit2.0.0.js index 0fdcb15c..7a078b96 100644 --- a/app/assets/javascripts/Jit/jit2.0.0.js +++ b/app/assets/javascripts/Jit/jit2.0.0.js @@ -8328,7 +8328,7 @@ Layouts.ForceDirected = new Class({ return; } } - incremental.onStep(Math.round(i /(times -1) * 100)); + incremental.onStep(Math.round((i)/(times -1) * 100)); setTimeout(iter, 1); })(); } else { diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 981cc711..d841635c 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -15,20 +15,22 @@
<% end %> -
-
-
Save To New Map
+
+
+
Save To New Map
+
+
-
-
-
-
-
Start Realtime Collaboration
-
-
- -
-
+ <% if @map.permission == "commons" || @map.user == user %> +
+
+
Start Realtime Collaboration
+
+
+ +
+
+ <% end %> <% end %>
@@ -57,8 +59,10 @@
<% if authenticated? %> - <%= render :partial => 'newtopic' %> - <%= render :partial => 'newsynapse' %> + <% if @map.permission == "commons" || @map.user == user %> + <%= render :partial => 'newtopic' %> + <%= render :partial => 'newsynapse' %> + <% end %> <%= render :partial => 'main/metacodeoptions' %> <% # for saving layouts %>