disabled topic and synapse creation on public map that's not yours
This commit is contained in:
parent
d89dddb45c
commit
1c5a57d67c
3 changed files with 54 additions and 41 deletions
|
@ -338,11 +338,14 @@ function selectNodeOnClickHandler(node, e) {
|
||||||
} //selectNodeOnRightClickHandler
|
} //selectNodeOnRightClickHandler
|
||||||
|
|
||||||
function canvasDoubleClickHandler(canvasLoc,e) {
|
function canvasDoubleClickHandler(canvasLoc,e) {
|
||||||
|
|
||||||
//grab the location and timestamp of the click
|
//grab the location and timestamp of the click
|
||||||
var storedTime = MetamapsModel.lastCanvasClick;
|
var storedTime = MetamapsModel.lastCanvasClick;
|
||||||
var now = Date.now(); //not compatible with IE8 FYI
|
var now = Date.now(); //not compatible with IE8 FYI
|
||||||
MetamapsModel.lastCanvasClick = now;
|
MetamapsModel.lastCanvasClick = now;
|
||||||
|
|
||||||
|
// if on a public map, disable topic creation
|
||||||
|
if (userid && (mapperm || !mapid) ) {
|
||||||
if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) {
|
if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) {
|
||||||
//pop up node creation :)
|
//pop up node creation :)
|
||||||
$('#topic_grabTopic').val("null");
|
$('#topic_grabTopic').val("null");
|
||||||
|
@ -352,8 +355,11 @@ function canvasDoubleClickHandler(canvasLoc,e) {
|
||||||
$('#topic_x').val(canvasLoc.x);
|
$('#topic_x').val(canvasLoc.x);
|
||||||
$('#topic_y').val(canvasLoc.y);
|
$('#topic_y').val(canvasLoc.y);
|
||||||
$('#new_topic').fadeIn('fast');
|
$('#new_topic').fadeIn('fast');
|
||||||
$('#topic_name').focus();
|
$('#topic_name').typeahead('setQuery','').focus();
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#new_topic').fadeOut('fast');
|
$('#new_topic').fadeOut('fast');
|
||||||
$('#new_synapse').fadeOut('fast');
|
$('#new_synapse').fadeOut('fast');
|
||||||
// reset the draw synapse positions to false
|
// reset the draw synapse positions to false
|
||||||
|
@ -367,7 +373,6 @@ function canvasDoubleClickHandler(canvasLoc,e) {
|
||||||
tempNode = null;
|
tempNode = null;
|
||||||
tempNode2 = null;
|
tempNode2 = null;
|
||||||
Mconsole.plot();
|
Mconsole.plot();
|
||||||
}
|
|
||||||
}//canvasDoubleClickHandler
|
}//canvasDoubleClickHandler
|
||||||
|
|
||||||
function handleSelectionBeforeDragging(node, e) {
|
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
|
// 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) {
|
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) {
|
if (tempInit == false) {
|
||||||
tempNode = node;
|
tempNode = node;
|
||||||
tempInit = true;
|
tempInit = true;
|
||||||
|
|
|
@ -8328,7 +8328,7 @@ Layouts.ForceDirected = new Class({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
incremental.onStep(Math.round(i /(times -1) * 100));
|
incremental.onStep(Math.round((i)/(times -1) * 100));
|
||||||
setTimeout(iter, 1);
|
setTimeout(iter, 1);
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,20 +15,22 @@
|
||||||
<div class="sidebarSaveBox"></div>
|
<div class="sidebarSaveBox"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="sidebarFork">
|
<div class="sidebarFork">
|
||||||
<div class="sidebarForkIcon hoverForTip">
|
<div class="sidebarForkIcon hoverForTip">
|
||||||
<div class="tip">Save To New Map</div>
|
<div class="tip">Save To New Map</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebarForkBox"></div>
|
<div class="sidebarForkBox"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebarCollaborate">
|
<% if @map.permission == "commons" || @map.user == user %>
|
||||||
|
<div class="sidebarCollaborate">
|
||||||
<div class="sidebarCollaborateIcon hoverForTip">
|
<div class="sidebarCollaborateIcon hoverForTip">
|
||||||
<div class="tip">Start Realtime Collaboration</div>
|
<div class="tip">Start Realtime Collaboration</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebarCollaborateBox">
|
<div class="sidebarCollaborateBox">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="sidebarFilter <%= authenticated? ? 'loggedin' : 'loggedout' %>">
|
<div class="sidebarFilter <%= authenticated? ? 'loggedin' : 'loggedout' %>">
|
||||||
<div class="sidebarFilterIcon"></div>
|
<div class="sidebarFilterIcon"></div>
|
||||||
|
@ -57,8 +59,10 @@
|
||||||
<div class="clearfloat"></div>
|
<div class="clearfloat"></div>
|
||||||
|
|
||||||
<% if authenticated? %>
|
<% if authenticated? %>
|
||||||
|
<% if @map.permission == "commons" || @map.user == user %>
|
||||||
<%= render :partial => 'newtopic' %>
|
<%= render :partial => 'newtopic' %>
|
||||||
<%= render :partial => 'newsynapse' %>
|
<%= render :partial => 'newsynapse' %>
|
||||||
|
<% end %>
|
||||||
<%= render :partial => 'main/metacodeoptions' %>
|
<%= render :partial => 'main/metacodeoptions' %>
|
||||||
|
|
||||||
<% # for saving layouts %>
|
<% # for saving layouts %>
|
||||||
|
|
Loading…
Reference in a new issue