2012-10-22 01:10:43 +00:00
|
|
|
// create filters for maps, and for card views
|
|
|
|
|
2013-01-01 22:45:35 +00:00
|
|
|
// keep an array of which metacodes are currently visible.
|
2012-10-22 01:10:43 +00:00
|
|
|
var categoryVisible = new Object();
|
|
|
|
|
|
|
|
categoryVisible['Group'] = true;
|
|
|
|
categoryVisible['Person'] = true;
|
|
|
|
categoryVisible['Bizarre'] = true;
|
|
|
|
categoryVisible['Catalyst'] = true;
|
|
|
|
categoryVisible['Closed'] = true;
|
|
|
|
categoryVisible['Experience'] = true;
|
|
|
|
categoryVisible['Future Dev'] = true;
|
|
|
|
categoryVisible['Idea'] = true;
|
|
|
|
categoryVisible['Implication'] = true;
|
|
|
|
categoryVisible['Insight'] = true;
|
|
|
|
categoryVisible['Intention'] = true;
|
|
|
|
categoryVisible['Knowledge'] = true;
|
|
|
|
categoryVisible['Location'] = true;
|
|
|
|
categoryVisible['Open Issue'] = true;
|
|
|
|
categoryVisible['Opinion'] = true;
|
|
|
|
categoryVisible['Opportunity'] = true;
|
|
|
|
categoryVisible['Platform'] = true;
|
|
|
|
categoryVisible['Problem'] = true;
|
|
|
|
categoryVisible['Question'] = true;
|
|
|
|
categoryVisible['Reference'] = true;
|
|
|
|
categoryVisible['Requirement'] = true;
|
|
|
|
categoryVisible['Resource'] = true;
|
|
|
|
categoryVisible['Role'] = true;
|
|
|
|
categoryVisible['Task'] = true;
|
|
|
|
categoryVisible['Tool'] = true;
|
|
|
|
categoryVisible['Trajectory'] = true;
|
|
|
|
categoryVisible['Action'] = true;
|
|
|
|
categoryVisible['Activity'] = true;
|
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
function switchVisible(category, duration) {
|
2012-10-22 01:10:43 +00:00
|
|
|
if (categoryVisible[category] == true) {
|
2012-12-14 18:31:39 +00:00
|
|
|
hideCategory(category, duration);
|
2012-10-22 01:10:43 +00:00
|
|
|
}
|
|
|
|
else if (categoryVisible[category] == false) {
|
2012-12-14 18:31:39 +00:00
|
|
|
showCategory(category, duration);
|
2012-10-22 01:10:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
function hideCategory(category, duration) {
|
2012-10-22 01:10:43 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2013-01-01 22:45:35 +00:00
|
|
|
if (n.getData('metacode') == category) {
|
2012-12-22 08:32:12 +00:00
|
|
|
n.setData('alpha', 0.4, 'end');
|
2012-10-22 01:10:43 +00:00
|
|
|
n.eachAdjacency(function(adj) {
|
2012-12-22 08:32:12 +00:00
|
|
|
adj.setData('alpha', 0.4, 'end');
|
2012-10-22 01:10:43 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-10-22 01:10:43 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
function showCategory(category, duration) {
|
2012-10-22 01:10:43 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2013-01-01 22:45:35 +00:00
|
|
|
if (n.getData('metacode') == category) {
|
2012-10-22 01:10:43 +00:00
|
|
|
n.setData('alpha', 1, 'end');
|
|
|
|
n.eachAdjacency(function(adj) {
|
|
|
|
adj.setData('alpha', 1, 'end');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-10-22 01:10:43 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
2012-11-23 19:00:00 +00:00
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Define the Find/Filters possibilities
|
|
|
|
|
|
|
|
var findTopics = ['name','metacode', 'mapper (by name)', 'map (by name)']
|
|
|
|
var findSynapses = ['topics (by name)', 'directionality', 'mapper (by name)', 'map (by name)']
|
|
|
|
var findMaps = ['name', 'topic (by name)', 'mapper (by name)', 'synapse (by topics)']
|
|
|
|
var findMappers = ['name', 'topic (by name)', 'map (by name)', 'synapse (by topics)']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// These functions toggle ALL nodes and synapses on the page
|
2012-12-14 18:31:39 +00:00
|
|
|
function hideAll(duration) {
|
2012-11-23 19:00:00 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2013-01-03 08:53:25 +00:00
|
|
|
if (!(n.getData('inCommons') || n.getData('onCanvas'))) {
|
|
|
|
n.setData('alpha', 0.4, 'end');
|
|
|
|
n.eachAdjacency(function(adj) {
|
|
|
|
adj.setData('alpha', 0.4, 'end');
|
|
|
|
});
|
|
|
|
}
|
2012-11-23 19:00:00 +00:00
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-11-23 19:00:00 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
2012-12-14 18:31:39 +00:00
|
|
|
function showAll(duration) {
|
2012-11-23 19:00:00 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2012-11-23 19:00:00 +00:00
|
|
|
n.setData('alpha', 1, 'end');
|
|
|
|
n.eachAdjacency(function(adj) {
|
2013-01-03 08:53:25 +00:00
|
|
|
adj.setData('alpha', 1, 'end');
|
2012-11-23 19:00:00 +00:00
|
|
|
});
|
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-11-23 19:00:00 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
2012-12-16 20:00:43 +00:00
|
|
|
|
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
/// Traverse the Graph and only show the searched for nodes
|
|
|
|
|
|
|
|
function onCanvasSearch(name,mapID,mapperID) {
|
|
|
|
|
|
|
|
Mconsole.graph.eachNode( function (n) {
|
|
|
|
if (name != null) {
|
2012-12-25 23:29:20 +00:00
|
|
|
if (n.name.indexOf(name) !== -1 && name != "") {
|
|
|
|
n.setData('onCanvas', true);
|
2013-01-01 22:45:35 +00:00
|
|
|
//$('.name.topic_' + n.id).css('display','block');
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-25 23:29:20 +00:00
|
|
|
n.setData('onCanvas', false);
|
2013-01-01 22:45:35 +00:00
|
|
|
//$('.name.topic_' + n.id).css('display','none');
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mapID != null) {
|
|
|
|
if (n.getData('inmaps').indexOf(parseInt(mapID)) !== -1) {
|
2012-12-25 23:29:20 +00:00
|
|
|
n.setData('onCanvas', true);
|
2013-01-01 22:45:35 +00:00
|
|
|
//$('.name.topic_' + n.id).css('display','block');
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-25 23:29:20 +00:00
|
|
|
n.setData('onCanvas', false);
|
2013-01-01 22:45:35 +00:00
|
|
|
//$('.name.topic_' + n.id).css('display','none');
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mapperID != null) {
|
|
|
|
if (n.getData('userid').toString() == mapperID) {
|
2012-12-25 23:29:20 +00:00
|
|
|
n.setData('onCanvas', true);
|
2013-01-01 22:45:35 +00:00
|
|
|
//$('.name.topic_' + n.id).css('display','block');
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-12-25 23:29:20 +00:00
|
|
|
n.setData('onCanvas', false);
|
2013-01-01 22:45:35 +00:00
|
|
|
//$('.name.topic_' + n.id).css('display','none');
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-25 23:29:20 +00:00
|
|
|
Mconsole.plot();
|
2012-12-22 08:32:12 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-25 23:29:20 +00:00
|
|
|
function clearCanvas() {
|
2013-01-03 08:53:25 +00:00
|
|
|
Mconsole.graph.eachNode( function(n) { Mconsole.graph.removeNode(n.id); Mconsole.labels.disposeLabel(n.id); });
|
2012-12-25 23:29:20 +00:00
|
|
|
Mconsole.plot();
|
|
|
|
}
|
2012-12-22 08:32:12 +00:00
|
|
|
|
2013-01-03 08:53:25 +00:00
|
|
|
function clearFoundData() {
|
|
|
|
Mconsole.graph.eachNode( function(n) {
|
|
|
|
if (n.getData('inCommons') === true) {
|
|
|
|
Mconsole.graph.removeNode(n.id);
|
|
|
|
Mconsole.labels.disposeLabel(n.id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Mconsole.plot();
|
|
|
|
}
|
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
////
|
|
|
|
////
|
|
|
|
////
|
|
|
|
//// Define all the dynamic interactions for the FIND/FILTER using Jquery
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
2012-12-16 20:00:43 +00:00
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
// this sets up the initial opening of the find box
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind').bind('click',function(){
|
|
|
|
if (!findOpen) openFind();
|
2012-12-16 20:00:43 +00:00
|
|
|
});
|
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
// this sets up the closing of the find box, and the toggling between open and closed.
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#closeFind').bind('click',function(){
|
|
|
|
if (findOpen) closeFind();
|
2012-12-16 20:00:43 +00:00
|
|
|
});
|
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
// this is where interactions within the find box begin
|
|
|
|
//
|
2013-01-03 03:48:08 +00:00
|
|
|
|
|
|
|
//on keyup, start the countdown
|
|
|
|
$('#topic_by_name_input').typing({
|
|
|
|
start: function (event, $elem) {
|
|
|
|
// grab the checkboxes to see if the search is on the canvas, in the commons, or both
|
|
|
|
firstVal = $("#onCanvas").attr('checked');
|
|
|
|
secondVal = $("#inCommons").attr('checked');
|
2013-01-03 23:21:46 +00:00
|
|
|
clearFoundData();
|
2013-01-03 03:48:08 +00:00
|
|
|
|
|
|
|
// only have the autocomplete enabled if they are searching in the commons
|
|
|
|
if (firstVal == "checked" && secondVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
//$('#topic_by_name_input').autocomplete( "option", "disabled", false );
|
|
|
|
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
2013-01-03 03:48:08 +00:00
|
|
|
}
|
|
|
|
else if (firstVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
setTimeout(function(){showAll();},0);
|
2013-01-03 03:48:08 +00:00
|
|
|
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
|
|
|
}
|
|
|
|
else if (secondVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
//setTimeout(function(){hideAll();},0);
|
|
|
|
//$('#topic_by_name_input').autocomplete( "option", "disabled", false );
|
|
|
|
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
2013-01-03 03:48:08 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-01-03 08:53:25 +00:00
|
|
|
alert('You either need to have searching On Your Canvas or In the Commons enabled');
|
2013-01-03 03:48:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
stop: function (event, $elem) {
|
|
|
|
// grab the checkboxes to see if the search is on the canvas, in the commons, or both
|
|
|
|
firstVal = $("#onCanvas").attr('checked');
|
|
|
|
secondVal = $("#inCommons").attr('checked');
|
|
|
|
|
|
|
|
var topicName = $('#topic_by_name_input').val();
|
|
|
|
// run a search on the canvas or in the commons or both
|
|
|
|
if (firstVal == "checked" && secondVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
setTimeout(function(){onCanvasSearch(topicName,null,null);},0);
|
|
|
|
$('#topicsByName').val(topicName);
|
|
|
|
$('#topicsByUser').val("");
|
|
|
|
$('#topicsByMap').val("");
|
|
|
|
$('#get_topics_form').submit();
|
2013-01-03 03:48:08 +00:00
|
|
|
}
|
|
|
|
else if (firstVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
setTimeout(function(){onCanvasSearch(topicName,null,null);},0);
|
2013-01-03 03:48:08 +00:00
|
|
|
}
|
|
|
|
else if (secondVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
$('#topicsByName').val(topicName);
|
|
|
|
$('#topicsByUser').val("");
|
|
|
|
$('#topicsByMap').val("");
|
|
|
|
$('#get_topics_form').submit();
|
2013-01-03 03:48:08 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
//do nothing
|
|
|
|
}
|
|
|
|
|
2013-01-03 08:53:25 +00:00
|
|
|
if (topicName == "") { clearFoundData(); }
|
2013-01-03 03:48:08 +00:00
|
|
|
},
|
|
|
|
delay: 2000
|
|
|
|
});
|
2012-12-22 08:32:12 +00:00
|
|
|
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind .select_content').change(function() {
|
2012-12-16 20:00:43 +00:00
|
|
|
firstVal = $(this).children("option[value='topics']").attr('selected');
|
|
|
|
secondVal = $(this).children("option[value='maps']").attr('selected');
|
|
|
|
thirdVal = $(this).children("option[value='mappers']").attr('selected');
|
|
|
|
if ( firstVal == 'selected') {
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind .select_type').children("option[value='metacode']").removeAttr('disabled');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='map (by name)']").removeAttr('disabled');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='mapper (by name)']").removeAttr('disabled');
|
2012-12-16 20:00:43 +00:00
|
|
|
$('.find').css('display','none');
|
|
|
|
$('.find_topic_by_name').css('display','block');
|
|
|
|
$('#topic_by_name_input').focus();
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ( secondVal == 'selected' ) {
|
2013-01-03 23:21:46 +00:00
|
|
|
if ( $("#sideOptionFind .select_type").val() != "name") {
|
|
|
|
$("#sideOptionFind .select_type").val('name');
|
|
|
|
$('#sideOptionFind').animate({
|
2012-12-22 08:32:12 +00:00
|
|
|
width: '305px',
|
2012-12-16 20:00:43 +00:00
|
|
|
height: '76px'
|
2012-12-22 08:32:12 +00:00
|
|
|
}, 300, function() {
|
2012-12-16 20:00:43 +00:00
|
|
|
// Animation complete.
|
|
|
|
});
|
|
|
|
}
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind .select_type').children("option[value='metacode']").attr('disabled','disabled');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='map (by name)']").attr('disabled','disabled');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='mapper (by name)']").attr('disabled','disabled');
|
2012-12-16 20:00:43 +00:00
|
|
|
$('.find').css('display','none');
|
|
|
|
$('.find_map_by_name').css('display','block');
|
|
|
|
$('#map_by_name_input').focus();
|
|
|
|
}
|
|
|
|
else if ( thirdVal == 'selected' ) {
|
2013-01-03 23:21:46 +00:00
|
|
|
$("#sideOptionFind .select_type").val('name');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='metacode']").attr('disabled','disabled');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='map (by name)']").attr('disabled','disabled');
|
|
|
|
$('#sideOptionFind .select_type').children("option[value='mapper (by name)']").attr('disabled','disabled');
|
2012-12-16 20:00:43 +00:00
|
|
|
$('.find').css('display','none');
|
|
|
|
$('.find_mapper_by_name').css('display','block');
|
|
|
|
$('#mapper_by_name_input').focus();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind .select_type').change(function() {
|
2012-12-16 20:00:43 +00:00
|
|
|
firstVal = $(this).children("option[value='name']").attr('selected');
|
|
|
|
secondVal = $(this).children("option[value='metacode']").attr('selected');
|
2012-12-22 08:32:12 +00:00
|
|
|
thirdVal = $(this).children("option[value='map (by name)']").attr('selected');
|
|
|
|
fourthVal = $(this).children("option[value='mapper (by name)']").attr('selected');
|
2012-12-16 20:00:43 +00:00
|
|
|
if ( firstVal === 'selected') {
|
2012-12-22 08:32:12 +00:00
|
|
|
$('.find').fadeOut('fast', function() {
|
2012-12-16 20:00:43 +00:00
|
|
|
showAll();
|
|
|
|
$('.find_topic_by_metacode ul li').not('#hideAll, #showAll').removeClass('toggledOff');
|
|
|
|
for (var catVis in categoryVisible) {
|
|
|
|
categoryVisible[catVis] = true;
|
|
|
|
}
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind').animate({
|
2012-12-22 08:32:12 +00:00
|
|
|
width: '305px',
|
2012-12-16 20:00:43 +00:00
|
|
|
height: '76px'
|
2012-12-22 08:32:12 +00:00
|
|
|
}, 300, function() {
|
|
|
|
$('.find_topic_by_name').css('display','block');
|
|
|
|
$('#topic_by_name_input').focus();
|
2012-12-16 20:00:43 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else if ( secondVal === 'selected' ) {
|
2012-12-22 08:32:12 +00:00
|
|
|
$('.find').fadeOut('fast', function() {
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind').animate({
|
2012-12-16 20:00:43 +00:00
|
|
|
width: '380px',
|
|
|
|
height: '463px'
|
2012-12-22 08:32:12 +00:00
|
|
|
}, 300, function() {
|
|
|
|
$('.find_topic_by_metacode').fadeIn('fast');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else if ( thirdVal === 'selected' ) {
|
|
|
|
$('.find').fadeOut('fast', function() {
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind').animate({
|
2012-12-22 08:32:12 +00:00
|
|
|
width: '305px',
|
|
|
|
height: '76px'
|
|
|
|
}, 300, function() {
|
|
|
|
$('.find_map_by_name').css('display','block');
|
|
|
|
$('#map_by_name_input').focus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else if ( fourthVal === 'selected' ) {
|
|
|
|
$('.find').fadeOut('fast', function() {
|
2013-01-03 23:21:46 +00:00
|
|
|
$('#sideOptionFind').animate({
|
2012-12-22 08:32:12 +00:00
|
|
|
width: '305px',
|
|
|
|
height: '76px'
|
|
|
|
}, 300, function() {
|
|
|
|
$('.find_mapper_by_name').css('display','block');
|
|
|
|
$('#mapper_by_name_input').focus();
|
|
|
|
});
|
2012-12-16 20:00:43 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.find_topic_by_name #topic_by_name_input').bind('railsAutocomplete.select', function(event, data){
|
|
|
|
/* Do something here */
|
2012-12-21 23:07:13 +00:00
|
|
|
if (data.item.id != undefined) {
|
2013-01-01 22:45:35 +00:00
|
|
|
window.open("/topics/" + data.item.id)
|
2012-12-16 20:00:43 +00:00
|
|
|
}
|
|
|
|
$('.find_topic_by_name #topic_by_name_input').val('');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.find_topic_by_name').bind('submit', function(event, data){
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.find_map_by_name #map_by_name_input').bind('railsAutocomplete.select', function(event, data){
|
2013-01-03 23:21:46 +00:00
|
|
|
firstVal = $('#sideOptionFind .select_content').children("option[value='topics']").attr('selected');
|
|
|
|
secondVal = $('#sideOptionFind .select_content').children("option[value='maps']").attr('selected');
|
|
|
|
thirdVal = $('#sideOptionFind .select_content').children("option[value='mappers']").attr('selected');
|
2012-12-22 08:32:12 +00:00
|
|
|
if ( firstVal == 'selected') {
|
2012-12-23 06:12:56 +00:00
|
|
|
// grab the checkboxes to see if the search is on the canvas, in the commons, or both
|
|
|
|
firstNewVal = $("#onCanvas").attr('checked');
|
|
|
|
secondNewVal = $("#inCommons").attr('checked');
|
|
|
|
|
|
|
|
// only have the autocomplete enabled if they are searching in the commons
|
|
|
|
|
|
|
|
if (firstNewVal == "checked" && secondNewVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
setTimeout(function(){onCanvasSearch(null,data.item.id,null);},0);
|
2012-12-23 06:12:56 +00:00
|
|
|
$('#topicsByMap').val(data.item.id);
|
|
|
|
$('#topicsByUser').val("");
|
2013-01-03 08:53:25 +00:00
|
|
|
$('#topicsByName').val("");
|
2012-12-23 06:12:56 +00:00
|
|
|
$('#get_topics_form').submit();
|
|
|
|
}
|
|
|
|
else if (firstNewVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
setTimeout(function(){onCanvasSearch(null,data.item.id,null);},0);
|
2012-12-23 06:12:56 +00:00
|
|
|
}
|
|
|
|
else if (secondNewVal == "checked"){
|
|
|
|
//hideAll();
|
|
|
|
$('#topicsByMap').val(data.item.id);
|
|
|
|
$('#topicsByUser').val("");
|
2013-01-03 08:53:25 +00:00
|
|
|
$('#topicsByName').val("");
|
2012-12-23 06:12:56 +00:00
|
|
|
$('#get_topics_form').submit();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
alert('You either need to have searching On Your Canvas or In the Commons enabled');
|
|
|
|
}
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
else if ( secondVal == 'selected' ) {
|
|
|
|
if (data.item.id != undefined) {
|
|
|
|
window.open("/maps/" + data.item.id);
|
|
|
|
}
|
|
|
|
$('.find_map_by_name #map_by_name_input').val('');
|
|
|
|
}
|
|
|
|
else if ( thirdVal == 'selected' ) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2012-12-16 20:00:43 +00:00
|
|
|
|
|
|
|
$('.find_map_by_name').bind('submit', function(event, data){
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.find_mapper_by_name #mapper_by_name_input').bind('railsAutocomplete.select', function(event, data){
|
2013-01-03 23:21:46 +00:00
|
|
|
firstVal = $('#sideOptionFind .select_content').children("option[value='topics']").attr('selected');
|
|
|
|
secondVal = $('#sideOptionFind .select_content').children("option[value='maps']").attr('selected');
|
|
|
|
thirdVal = $('#sideOptionFind .select_content').children("option[value='mappers']").attr('selected');
|
2012-12-22 08:32:12 +00:00
|
|
|
if ( firstVal == 'selected') {
|
2012-12-23 06:12:56 +00:00
|
|
|
// grab the checkboxes to see if the search is on the canvas, in the commons, or both
|
|
|
|
firstNewVal = $("#onCanvas").attr('checked');
|
|
|
|
secondNewVal = $("#inCommons").attr('checked');
|
|
|
|
|
|
|
|
// only have the autocomplete enabled if they are searching in the commons
|
|
|
|
|
2013-01-03 08:53:25 +00:00
|
|
|
if (firstNewVal == "checked" && secondNewVal == "checked"){
|
|
|
|
setTimeout(function(){onCanvasSearch(null,null,data.item.id.toString());},0);
|
2012-12-23 06:12:56 +00:00
|
|
|
$('#topicsByUser').val(data.item.id);
|
|
|
|
$('#topicsByMap').val("");
|
2013-01-03 08:53:25 +00:00
|
|
|
$('#topicsByName').val("");
|
2012-12-23 06:12:56 +00:00
|
|
|
$('#get_topics_form').submit();
|
|
|
|
}
|
|
|
|
else if (firstNewVal == "checked"){
|
2013-01-03 08:53:25 +00:00
|
|
|
setTimeout(function(){onCanvasSearch(null,null,data.item.id.toString());},0);
|
2012-12-23 06:12:56 +00:00
|
|
|
}
|
|
|
|
else if (secondNewVal == "checked"){
|
|
|
|
//hideAll();
|
|
|
|
$('#topicsByUser').val(data.item.id);
|
|
|
|
$('#topicsByMap').val("");
|
2013-01-03 08:53:25 +00:00
|
|
|
$('#topicsByName').val("");
|
2012-12-23 06:12:56 +00:00
|
|
|
$('#get_topics_form').submit();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
alert('You either need to have searching On Your Canvas or In the Commons enabled');
|
|
|
|
}
|
2012-12-22 08:32:12 +00:00
|
|
|
}
|
|
|
|
else if ( secondVal == 'selected' ) {
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ( thirdVal == 'selected' ) {
|
|
|
|
if (data.item.id != undefined) {
|
|
|
|
window.open("/users/" + data.item.id);
|
|
|
|
}
|
|
|
|
$('.find_mapper_by_name #mapper_by_name_input').val('');
|
|
|
|
}
|
2012-12-16 20:00:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('.find_mapper_by_name').bind('submit', function(event, data){
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
2013-01-01 22:45:35 +00:00
|
|
|
// toggle visibility of topics with metacodes based on status in the filters list
|
2012-12-16 20:00:43 +00:00
|
|
|
$('.find_topic_by_metacode ul li').click(function(event) {
|
|
|
|
obj = document.getElementById('container');
|
|
|
|
|
|
|
|
var switchAll = $(this).attr('id');
|
|
|
|
|
|
|
|
if ( switchAll === "showAll" || switchAll === "hideAll") {
|
|
|
|
if (switchAll == "showAll") {
|
2013-01-03 23:21:46 +00:00
|
|
|
showAll();
|
2012-12-16 20:00:43 +00:00
|
|
|
$('.find_topic_by_metacode ul li').not('#hideAll, #showAll').removeClass('toggledOff');
|
|
|
|
for (var catVis in categoryVisible) {
|
|
|
|
categoryVisible[catVis] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (switchAll == "hideAll") {
|
2013-01-03 23:21:46 +00:00
|
|
|
hideAll();
|
2012-12-16 20:00:43 +00:00
|
|
|
$('.find_topic_by_metacode ul li').not('#hideAll, #showAll').addClass('toggledOff');
|
|
|
|
for (var catVis in categoryVisible) {
|
|
|
|
categoryVisible[catVis] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var category = $(this).children('img').attr('alt');
|
2013-01-03 23:21:46 +00:00
|
|
|
switchVisible(category);
|
|
|
|
|
2012-12-25 23:29:20 +00:00
|
|
|
// toggle the image and the boolean array value
|
2012-12-16 20:00:43 +00:00
|
|
|
if (categoryVisible[category] == true) {
|
|
|
|
$(this).addClass('toggledOff');
|
|
|
|
categoryVisible[category] = false;
|
|
|
|
}
|
|
|
|
else if (categoryVisible[category] == false) {
|
|
|
|
$(this).removeClass('toggledOff');
|
|
|
|
categoryVisible[category] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2013-01-03 23:21:46 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function openFind() {
|
|
|
|
findOpen = true;
|
|
|
|
if (analyzeOpen) closeAnalyze();
|
|
|
|
if (organizeOpen) closeOrganize();
|
|
|
|
$('#sideOptionFind, #closeFind').css('z-index','10');
|
|
|
|
$('#sideOptionAnalyze').css('z-index','9');
|
|
|
|
$('#sideOptionOrganize').css('z-index','8');
|
|
|
|
firstVal = $('#sideOptionFind option[value="name"]').attr('selected');
|
|
|
|
secondVal = $('#sideOptionFind option[value="metacode"]').attr('selected');
|
|
|
|
thirdVal = $('#sideOptionFind option[value="map (by name)"]').attr('selected');
|
|
|
|
fourthVal = $('#sideOptionFind option[value="mapper (by name)"]').attr('selected');
|
|
|
|
if ( firstVal === 'selected' || thirdVal === 'selected' || fourthVal === 'selected' ) {
|
|
|
|
$('#sideOptionFind').animate({
|
|
|
|
width: '305px',
|
|
|
|
height: '76px'
|
|
|
|
}, 100, function() {
|
|
|
|
$('#topic_by_name_input').focus();
|
|
|
|
});
|
|
|
|
} else if ( secondVal === 'selected') {
|
|
|
|
$('#sideOptionFind').animate({
|
|
|
|
width: '380px',
|
|
|
|
height: '463px'
|
|
|
|
}, 100, function() {
|
|
|
|
// Animation complete.
|
|
|
|
});
|
|
|
|
} else if ( thirdVal === 'selected' ) {
|
|
|
|
$('#sideOptionFind').animate({
|
|
|
|
width: '305px',
|
|
|
|
height: '76px'
|
|
|
|
}, 100, function() {
|
|
|
|
$('#map_by_name_input').focus();
|
|
|
|
});
|
|
|
|
} else if ( fourthVal === 'selected' ) {
|
|
|
|
$('#sideOptionFind').animate({
|
|
|
|
width: '305px',
|
|
|
|
height: '76px'
|
|
|
|
}, 100, function() {
|
|
|
|
$('#mapper_by_name_input').focus();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
$('#closeFind, #findWhere').css('display','block');
|
|
|
|
$('#sideOptionFind').css('cursor','default');
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeFind() {
|
|
|
|
findOpen = false;
|
|
|
|
Mconsole.graph.eachNode( function (n) {
|
|
|
|
n.setData('inCommons', false);
|
|
|
|
n.setData('onCanvas', false);
|
|
|
|
});
|
|
|
|
Mconsole.plot();
|
|
|
|
$('#closeFind, #findWhere').css('display','none');
|
|
|
|
$('#sideOptionFind').css('cursor','pointer');
|
|
|
|
$('#sideOptionFind').animate({
|
|
|
|
width: '45px',
|
|
|
|
height: '32px'
|
|
|
|
}, 100);
|
|
|
|
}
|