diff --git a/app/assets/images/48px-all.zip b/app/assets/images/48px-all.zip deleted file mode 100644 index f37c75b5..00000000 Binary files a/app/assets/images/48px-all.zip and /dev/null differ diff --git a/app/assets/images/96px-gen001.zip b/app/assets/images/96px-gen001.zip deleted file mode 100644 index 8d88a57c..00000000 Binary files a/app/assets/images/96px-gen001.zip and /dev/null differ diff --git a/app/assets/images/argument.png b/app/assets/images/argument.png new file mode 100644 index 00000000..431dec3b Binary files /dev/null and b/app/assets/images/argument.png differ diff --git a/app/assets/images/col2.png b/app/assets/images/col2.png deleted file mode 100644 index c0d3891b..00000000 Binary files a/app/assets/images/col2.png and /dev/null differ diff --git a/app/assets/images/con_icon.png b/app/assets/images/con_icon.png new file mode 100644 index 00000000..96b6716c Binary files /dev/null and b/app/assets/images/con_icon.png differ diff --git a/app/assets/images/decision.png b/app/assets/images/decision.png new file mode 100644 index 00000000..0eb24964 Binary files /dev/null and b/app/assets/images/decision.png differ diff --git a/app/assets/images/example.png b/app/assets/images/example.png new file mode 100644 index 00000000..cd536356 Binary files /dev/null and b/app/assets/images/example.png differ diff --git a/app/assets/images/experience.png b/app/assets/images/experience.png index decf6f47..b8c5bd44 100644 Binary files a/app/assets/images/experience.png and b/app/assets/images/experience.png differ diff --git a/app/assets/images/foresight.png b/app/assets/images/foresight.png new file mode 100644 index 00000000..24b0e2c8 Binary files /dev/null and b/app/assets/images/foresight.png differ diff --git a/app/assets/images/goodpractice.png b/app/assets/images/goodpractice.png new file mode 100644 index 00000000..ea13bf11 Binary files /dev/null and b/app/assets/images/goodpractice.png differ diff --git a/app/assets/images/gradient.png b/app/assets/images/gradient.png deleted file mode 100644 index e283966f..00000000 Binary files a/app/assets/images/gradient.png and /dev/null differ diff --git a/app/assets/images/idea.png b/app/assets/images/idea.png index e9e14533..492f2b50 100644 Binary files a/app/assets/images/idea.png and b/app/assets/images/idea.png differ diff --git a/app/assets/images/list.png b/app/assets/images/list.png new file mode 100644 index 00000000..5bcf6f46 Binary files /dev/null and b/app/assets/images/list.png differ diff --git a/app/assets/images/map.png b/app/assets/images/map.png new file mode 100644 index 00000000..589fa9ab Binary files /dev/null and b/app/assets/images/map.png differ diff --git a/app/assets/images/moviemap.png b/app/assets/images/moviemap.png new file mode 100644 index 00000000..435cb604 Binary files /dev/null and b/app/assets/images/moviemap.png differ diff --git a/app/assets/images/note.png b/app/assets/images/note.png new file mode 100644 index 00000000..901330e4 Binary files /dev/null and b/app/assets/images/note.png differ diff --git a/app/assets/images/old icons/action.png b/app/assets/images/old icons/action.png deleted file mode 100644 index 91b6755c..00000000 Binary files a/app/assets/images/old icons/action.png and /dev/null differ diff --git a/app/assets/images/old icons/group.png b/app/assets/images/old icons/group.png deleted file mode 100644 index 1557b554..00000000 Binary files a/app/assets/images/old icons/group.png and /dev/null differ diff --git a/app/assets/images/old icons/intention.png b/app/assets/images/old icons/intention.png deleted file mode 100644 index 9a177111..00000000 Binary files a/app/assets/images/old icons/intention.png and /dev/null differ diff --git a/app/assets/images/old icons/location.png b/app/assets/images/old icons/location.png deleted file mode 100644 index b3481869..00000000 Binary files a/app/assets/images/old icons/location.png and /dev/null differ diff --git a/app/assets/images/old icons/person.png b/app/assets/images/old icons/person.png deleted file mode 100644 index 96e76bcc..00000000 Binary files a/app/assets/images/old icons/person.png and /dev/null differ diff --git a/app/assets/images/old icons/resource.png b/app/assets/images/old icons/resource.png deleted file mode 100644 index ca1a288d..00000000 Binary files a/app/assets/images/old icons/resource.png and /dev/null differ diff --git a/app/assets/images/opinion.png b/app/assets/images/opinion.png index 07e20f76..55da079b 100644 Binary files a/app/assets/images/opinion.png and b/app/assets/images/opinion.png differ diff --git a/app/assets/images/pro.png b/app/assets/images/pro.png new file mode 100644 index 00000000..b16f5876 Binary files /dev/null and b/app/assets/images/pro.png differ diff --git a/app/assets/images/question.png b/app/assets/images/question.png index 03115a77..f169539f 100644 Binary files a/app/assets/images/question.png and b/app/assets/images/question.png differ diff --git a/app/assets/images/reference.png b/app/assets/images/reference.png index 67f23d87..a28dec05 100644 Binary files a/app/assets/images/reference.png and b/app/assets/images/reference.png differ diff --git a/app/assets/images/research.png b/app/assets/images/research.png new file mode 100644 index 00000000..92d032ae Binary files /dev/null and b/app/assets/images/research.png differ diff --git a/app/assets/images/spinner.gif b/app/assets/images/spinner.gif new file mode 100644 index 00000000..e17b93cd Binary files /dev/null and b/app/assets/images/spinner.gif differ diff --git a/app/assets/images/tool.png b/app/assets/images/tool.png index c4cac463..fad0d7a7 100644 Binary files a/app/assets/images/tool.png and b/app/assets/images/tool.png differ diff --git a/app/assets/images/wildcard.png b/app/assets/images/wildcard.png new file mode 100644 index 00000000..20e35b16 Binary files /dev/null and b/app/assets/images/wildcard.png differ diff --git a/app/assets/javascripts/Jit/filters.js b/app/assets/javascripts/Jit/filters.js index 7a843271..caa0f769 100644 --- a/app/assets/javascripts/Jit/filters.js +++ b/app/assets/javascripts/Jit/filters.js @@ -128,57 +128,44 @@ function onCanvasSearch(name,mapID,mapperID) { Mconsole.graph.eachNode( function (n) { if (name != null) { - if (n.name.indexOf(name) !== -1) { - n.setData('alpha', 1, 'end'); - n.eachAdjacency(function(adj) { - adj.setData('alpha', 0.4, 'end'); - }); + if (n.name.indexOf(name) !== -1 && name != "") { + n.setData('onCanvas', true); + //$('.name.item_' + n.id).css('display','block'); } else { - n.setData('alpha', 0.4, 'end'); - n.eachAdjacency(function(adj) { - adj.setData('alpha', 0.4, 'end'); - }); + n.setData('onCanvas', false); + //$('.name.item_' + n.id).css('display','none'); } } else if (mapID != null) { if (n.getData('inmaps').indexOf(parseInt(mapID)) !== -1) { - n.setData('alpha', 1, 'end'); - n.eachAdjacency(function(adj) { - adj.setData('alpha', 0.4, 'end'); - }); + n.setData('onCanvas', true); + //$('.name.item_' + n.id).css('display','block'); } else { - n.setData('alpha', 0.4, 'end'); - n.eachAdjacency(function(adj) { - adj.setData('alpha', 0.4, 'end'); - }); + n.setData('onCanvas', false); + //$('.name.item_' + n.id).css('display','none'); } } else if (mapperID != null) { if (n.getData('userid').toString() == mapperID) { - n.setData('alpha', 1, 'end'); - n.eachAdjacency(function(adj) { - adj.setData('alpha', 0.4, 'end'); - }); + n.setData('onCanvas', true); + //$('.name.item_' + n.id).css('display','block'); } else { - n.setData('alpha', 0.4, 'end'); - n.eachAdjacency(function(adj) { - adj.setData('alpha', 0.4, 'end'); - }); + n.setData('onCanvas', false); + //$('.name.item_' + n.id).css('display','none'); } } + Mconsole.plot(); }); - Mconsole.fx.animate({ - modes: ['node-property:alpha', - 'edge-property:alpha'], - duration: 500 - }); } - +function clearCanvas() { + Mconsole.graph.eachNode( function(n) { Mconsole.graph.removeNode(n.id); $('#'+n.id).remove(); }); + Mconsole.plot(); +} @@ -205,7 +192,9 @@ $(document).ready(function() { // this sets up the closing of the find box, and the toggling between open and closed. $('#closeFind').click(function(){ Mconsole.graph.eachNode( function (n) { - n.setData('isNew', false); + n.setData('inCommons', false); + n.setData('onCanvas', false); + //$('.name.item_' + n.id).css('display','block'); }); Mconsole.plot(); $('#closeFind, #findWhere').css('display','none'); @@ -544,7 +533,7 @@ $(document).ready(function() { // } // } // } - // toggle the image and the boolean array value + // toggle the image and the boolean array value if (categoryVisible[category] == true) { $(this).addClass('toggledOff'); categoryVisible[category] = false; diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js index 5573dbac..8dddd433 100644 --- a/app/assets/javascripts/Jit/graphsettings.js +++ b/app/assets/javascripts/Jit/graphsettings.js @@ -13,7 +13,7 @@ function graphSettings(type) { //Enable panning events only if we're dragging the empty //canvas (and not a node). panning: 'avoid nodes', - zooming: 10 //zoom speed. higher is more sensible + zooming: 15 //zoom speed. higher is more sensible }, // Change node and edge styles such as // color and width. @@ -30,7 +30,7 @@ function graphSettings(type) { overridable: true, color: '#222222', type: 'customEdge', - lineWidth: 1 + lineWidth: 2 }, //Native canvas text styling Label: { @@ -57,12 +57,13 @@ function graphSettings(type) { }, //Update node positions when dragged onDragMove: function (node, eventInfo, e) { - clickDragOnTopicForceDirected(node, eventInfo, e); + clickDragOnTopic(node, eventInfo, e); }, onDragEnd: function() { if (tempInit && tempNode2 == null) { $('#item_addSynapse').val("true"); $('#new_item').fadeIn('fast'); + addMetacode(); $('#item_name').focus(); } else if (tempInit && tempNode2 != null) { @@ -94,7 +95,7 @@ function graphSettings(type) { onClick: function (node, eventInfo, e) { //clicking on a node, or clicking on blank part of canvas? if (node.nodeFrom) { - selectEdgeOnClickHandler(node); + selectEdgeOnClickHandler(node); } else if (node && !node.nodeFrom) { selectNodeOnClickHandler(node); @@ -129,7 +130,7 @@ function graphSettings(type) { node.setData('dim', 25, 'current'); node.eachAdjacency(function (adj) { adj.setDataset('end', { - lineWidth: 0.5, + lineWidth: 2, color: '#222222' }); adj.setData('showDesc', false, 'current'); @@ -191,7 +192,7 @@ function graphSettings(type) { //Enable panning events only if we're dragging the empty //canvas (and not a node). panning: 'avoid nodes', - zooming: 10 //zoom speed. higher is more sensible + zooming: 15 //zoom speed. higher is more sensible }, // Change node and edge styles such as // color and width. @@ -208,7 +209,7 @@ function graphSettings(type) { overridable: true, color: '#222222', type: 'customEdge', - lineWidth: 1 + lineWidth: 2 }, //Native canvas text styling Label: { @@ -234,10 +235,16 @@ function graphSettings(type) { }, //Update node positions when dragged onDragMove: function (node, eventInfo, e) { - clickDragOnTopicRGraph(node, eventInfo, e); + clickDragOnTopic(node, eventInfo, e); }, onDragEnd: function() { - if (tempInit && tempNode2 != null) { + if (tempInit && tempNode2 == null) { + $('#item_addSynapse').val("true"); + $('#new_item').fadeIn('fast'); + addMetacode(); + $('#item_name').focus(); + } + else if (tempInit && tempNode2 != null) { $('#item_addSynapse').val("false"); $('#synapse_item1id').val(tempNode.id); $('#synapse_item2id').val(tempNode2.id); @@ -247,12 +254,6 @@ function graphSettings(type) { tempNode2 = null; tempInit = false; } - else { - tempNode = null; - tempNode2 = null; - tempInit = false; - Mconsole.plot(); - } }, onDragCancel: function() { tempNode = null; @@ -265,11 +266,12 @@ function graphSettings(type) { $jit.util.event.stop(e); //stop default touchmove event this.onDragMove(node, eventInfo, e); }, - //Add also a click handler to nodes + //Add also a click handler to nodes onClick: function (node, eventInfo, e) { //clicking on an edge, a node, or clicking on blank part of canvas? - if (node.nodeFrom) { - selectEdgeOnClickHandler(node); + if (eventInfo.getEdge() != false || node.nodeFrom) { + if (eventInfo.getEdge() != false) selectEdgeOnClickHandler(eventInfo.getEdge()); + else if (node.nodeFrom) selectEdgeOnClickHandler(node); } else if (node && !node.nodeFrom) { if (!Mconsole.busy) { @@ -311,7 +313,7 @@ function graphSettings(type) { node.setData('dim', 25, 'current'); node.eachAdjacency(function (adj) { adj.setDataset('end', { - lineWidth: 0.5, + lineWidth: 2, color: '#222222' }); adj.setData('showDesc', false, 'current'); @@ -390,6 +392,7 @@ midPoint.y - vect.y); var v1 = intermediatePoint.add(normal); var v2 = intermediatePoint.$add(normal.$scale(-1)); + //ctx.strokeStyle = 'black'; ctx.beginPath(); ctx.moveTo(from.x, from.y); ctx.lineTo(to.x, to.y); @@ -408,11 +411,20 @@ var nodeSettings = { var pos = node.pos.getc(true), dim = node.getData('dim'), cat = node.getData('itemcatname'), - isNew = node.getData('isNew'), + inCommons = node.getData('inCommons'), + onCanvas = node.getData('onCanvas'), ctx = canvas.getCtx(); - // if the topic is temporary draw a green circle around it - if (isNew) { + // if the topic is from the Commons draw a green circle around it + if (inCommons) { + ctx.beginPath(); + ctx.arc(pos.x, pos.y, dim+3, 0, 2 * Math.PI, false); + ctx.strokeStyle = '#67be5f'; // green + ctx.lineWidth = 2; + ctx.stroke(); + } + // if the topic is on the Canvas draw a white circle around it + if (onCanvas) { ctx.beginPath(); ctx.arc(pos.x, pos.y, dim+3, 0, 2 * Math.PI, false); ctx.strokeStyle = 'white'; @@ -456,7 +468,7 @@ var nodeSettings = { } //check for edge label in data - var desc = adj.getData("desc") + ' (' + adj.getData("userid") + ',' + adj.getData("id") + ')'; + var desc = adj.getData("desc") + ' (' + adj.getData("id") + ')'; var showDesc = adj.getData("showDesc"); if( desc != "" && showDesc ) { //now adjust the label placement @@ -469,7 +481,7 @@ var nodeSettings = { } }, 'contains' : function(adj, pos) { var from = adj.nodeFrom.pos.getc(true), - to = adj.nodeTo.pos.getc(true); + to = adj.nodeTo.pos.getc(true); return this.edgeHelper.line.contains(from, to, pos, adj.Edge.epsilon); } } @@ -499,7 +511,7 @@ function selectNodeOnClickHandler(node) { n.setData('dim', 25, 'current'); n.eachAdjacency(function (adj) { adj.setDataset('end', { - lineWidth: 0.5, + lineWidth: 2, color: '#222222' }); adj.setData('showDesc', false, 'current'); @@ -511,7 +523,7 @@ function selectNodeOnClickHandler(node) { node.eachAdjacency(function (adj) { adj.setDataset('end', { - lineWidth: 3, + lineWidth: 4, color: '#FFF' }); adj.setData('showDesc', true, 'current'); @@ -538,7 +550,7 @@ function canvasDoubleClickHandler(canvasLoc,e) { var storedTime = canvasDoubleClickHandlerObject.storedTime; var now = Date.now(); //not compatible with IE8 FYI - if (now - storedTime < TOLERANCE && (gType == "arranged" || gType == "chaotic")) { + if (now - storedTime < TOLERANCE) { //pop up node creation :) $('#item_grabItem').val("null"); $('#item_addSynapse').val("false"); @@ -547,12 +559,11 @@ function canvasDoubleClickHandler(canvasLoc,e) { $('#item_x').val(canvasLoc.x); $('#item_y').val(canvasLoc.y); $('#new_item').fadeIn('fast'); + addMetacode(); $('#item_name').focus(); } else { canvasDoubleClickHandlerObject.storedTime = now; - if (gType != "centered") { - $('#new_item').fadeOut('fast'); - } + $('#new_item').fadeOut('fast'); $('#new_synapse').fadeOut('fast'); tempInit = false; tempNode = null; @@ -562,18 +573,18 @@ function canvasDoubleClickHandler(canvasLoc,e) { }//canvasDoubleClickHandler // ForceDirected Mode: for the creation of new topics and synapses through clicking and draggin with right clicks off of topics -function clickDragOnTopicForceDirected(node, eventInfo, e) { +function clickDragOnTopic(node, eventInfo, e) { if (node && !node.nodeFrom) { $('#new_synapse').fadeOut('fast'); $('#new_item').fadeOut('fast'); var pos = eventInfo.getPos(); // if it's a left click, move the node - if (e.button == 0) { + if (e.button == 0 && !e.altKey ) { node.pos.setc(pos.x, pos.y); Mconsole.plot(); } // if it's a right click, start synapse creation - else if (e.button == 2) { + else if (e.button == 2 || (e.button == 0 && e.altKey)) { if (tempInit == false) { tempNode = node; tempInit = true; @@ -583,7 +594,7 @@ function clickDragOnTopicForceDirected(node, eventInfo, e) { if (temp != false && temp.id != node.id) { // this means a Node has been returned tempNode2 = temp; Mconsole.plot(); - renderMidArrow({ x: tempNode.pos.x, y: tempNode.pos.y }, { x: temp.pos.x, y: temp.pos.y }, 13, false, Mconsole.canvas); + renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: temp.pos.getc().x, y: temp.pos.getc().y }, 13, false, Mconsole.canvas); // before making the highlighted one bigger, make sure all the others are regular size Mconsole.graph.eachNode(function (n) { n.setData('dim', 25, 'current'); @@ -607,53 +618,6 @@ function clickDragOnTopicForceDirected(node, eventInfo, e) { $('#item_x').val(eventInfo.getPos().x); $('#item_y').val(eventInfo.getPos().y); Mconsole.plot(); - renderMidArrow({ x: tempNode.pos.x, y: tempNode.pos.y }, { x: pos.x, y: pos.y }, 13, false, Mconsole.canvas); - Mconsole.fx.plotNode(tempNode, Mconsole.canvas); - } - } - } -} - -// RGRAPH MODE: for the creation of synapses through clicking and draggin with right clicks off of topics -function clickDragOnTopicRGraph(node, eventInfo, e) { - if (node && !node.nodeFrom) { - $('#new_synapse').fadeOut('fast'); - var pos = eventInfo.getPos(); - - // if it's a left click, move the node - if (e.button == 0) { - node.pos.setc(pos.x, pos.y); - Mconsole.plot(); - } - // if it's a right click, start synapse creation - else if (e.button == 2) { - if (tempInit == false) { - tempNode = node; - tempInit = true; - } - // - temp = eventInfo.getNode(); - if (temp != false && temp.id != node.id) { // this means a Node has been returned - tempNode2 = temp; - Mconsole.plot(); - renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: temp.pos.getc().x, y: temp.pos.getc().y }, 13, false, Mconsole.canvas); - // before making the highlighted one bigger, make sure all the others are regular size - Mconsole.graph.eachNode(function (n) { - n.setData('dim', 25, 'current'); - }); - temp.setData('dim',35,'current'); - Mconsole.fx.plotNode(tempNode, Mconsole.canvas); - Mconsole.fx.plotNode(temp, Mconsole.canvas); - } else if (!temp) { - tempNode2 = null; - Mconsole.graph.eachNode(function (n) { - n.setData('dim', 25, 'current'); - }); - var myX = e.x - 110; - var myY = e.y - 30; - document.getElementById('new_synapse').style.left = myX + "px"; - document.getElementById('new_synapse').style.top = myY + "px"; - Mconsole.plot(); renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: pos.x, y: pos.y }, 13, false, Mconsole.canvas); Mconsole.fx.plotNode(tempNode, Mconsole.canvas); } diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d2332f6c..6069ec05 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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; +var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false; $(document).ready(function() { @@ -29,61 +29,61 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, return false; }); - /// this is for the topic creation autocomplete fielf + /// this is for the topic creation autocomplete field $('#item_name').bind('railsAutocomplete.select', function(event, data){ if (data.item.id != undefined) { $('#item_grabItem').val(data.item.id); - $('#new_item').submit(); } }); + $('.new_topic').bind('submit', function(event, data){ + event.preventDefault(); + }); + $(".focus .desc").mCustomScrollbar(); $(".scroll").mCustomScrollbar(); $('.nodemargin').css('padding-top',$('.focus').css('height')); // controls the sliding hover of the menus at the top - var sliding1 = false; - $(".accountWrap").hover( + var sliding1 = false; + var lT; + $(".logo").hover( function () { + clearTimeout(lT); if (! sliding1) { sliding1 = true; - $(".account").slideDown('slow', function() { - sliding1 = false; - }); + if (userid != null) { + $('.footer .menu').animate({ + height: '252px' + }, 300, function() { + sliding1 = false; + }); + } + else { + $('.footer .menu').animate({ + height: '140px' + }, 300, function() { + sliding1 = false; + }); + } } }, function () { - if (! sliding1) { - sliding1 = true; - $(".account").slideUp('slow', function() { - sliding1 = false; - }); - } + lT = setTimeout(function() { + if (! sliding1) { + sliding1 = true; + $('.footer .menu').animate({ + height: '0px' + }, 300, function() { + sliding1 = false; + }); + } + },800); } ); - var sliding2 = false; - $(".createWrap").hover( - function () { - if (! sliding2) { - sliding2 = true; - $(".create").slideDown('slow', function() { - sliding2 = false; - }); - } - }, - function () { - if (! sliding2) { - sliding2 = true; - $(".create").slideUp('slow', function() { - sliding2 = false; - }); - } - } - ); - - // this is to save the layout of maps + // this is to save the layout of maps when you're on a map page var coor = ""; $("#saveLayout").click(function(event) { event.preventDefault(); @@ -98,6 +98,40 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, } }); + }); + +// this is to save your console to a map +function saveToMap() { + var Coor = ""; + Mconsole.graph.eachNode(function(n) { + Coor = Coor + n.id + '/' + n.pos.x + '/' + n.pos.y + ','; + }); + Coor = Coor.slice(0, -1); + $('#map_topicsToMap').val(Coor); + $('#new_map').fadeIn('fast'); +} + +function addMetacode() { + // code from http://www.professorcloud.com/mainsite/carousel-integration.htm + if (!metacodeIMGinit) { + $("#metacodeImg").CloudCarousel( { + //reflHeight: 10, + //reflGap: 2, + titleBox: $('#metacodeImgTitle'), + //buttonLeft: $('#left-but'), + //buttonRight: $('#right-but'), + yRadius:40, + xPos: 150, + yPos: 40, + speed:0.15, + mouseWheel:true, + bringToFront: true + }); + metacodeIMGinit = true; + } +} + + diff --git a/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js b/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js new file mode 100644 index 00000000..1b33702e --- /dev/null +++ b/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js @@ -0,0 +1,362 @@ +////////////////////////////////////////////////////////////////////////////////// +// CloudCarousel V1.0.5 +// (c) 2011 by R Cecco. +// MIT License +// +// Reflection code based on plugin by Christophe Beyls +// +// Please retain this copyright header in all versions of the software +////////////////////////////////////////////////////////////////////////////////// + +(function($) { + + // START Reflection object. + // Creates a reflection for underneath an image. + // IE uses an image with IE specific filter properties, other browsers use the Canvas tag. + // The position and size of the reflection gets updated by updateAll() in Controller. + function Reflection(img, reflHeight, opacity) { + + var reflection, cntx, imageWidth = img.width, imageHeight = img.width, gradient, parent; + + parent = $(img.parentNode); + this.element = reflection = parent.append("").find(':last')[0]; + if ( !reflection.getContext && $.browser.msie) { + this.element = reflection = parent.append("").find(':last')[0]; + reflection.src = img.src; + reflection.style.filter = "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (opacity * 100) + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (reflHeight / imageHeight * 100) + ")"; + + } else { + cntx = reflection.getContext("2d"); + try { + + + $(reflection).attr({width: imageWidth, height: reflHeight}); + cntx.save(); + cntx.translate(0, imageHeight-1); + cntx.scale(1, -1); + cntx.drawImage(img, 0, 0, imageWidth, imageHeight); + cntx.restore(); + cntx.globalCompositeOperation = "destination-out"; + gradient = cntx.createLinearGradient(0, 0, 0, reflHeight); + gradient.addColorStop(0, "rgba(255, 255, 255, " + (1 - opacity) + ")"); + gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)"); + cntx.fillStyle = gradient; + cntx.fillRect(0, 0, imageWidth, reflHeight); + } catch(e) { + return; + } + } + // Store a copy of the alt and title attrs into the reflection + $(reflection).attr({ 'alt': $(img).attr('alt'), title: $(img).attr('title')} ); + + } //END Reflection object + + // START Item object. + // A wrapper object for items within the carousel. + var Item = function(imgIn, options) + { + this.orgWidth = imgIn.width; + this.orgHeight = imgIn.height; + this.image = imgIn; + this.reflection = null; + this.alt = imgIn.alt; + this.title = imgIn.title; + this.imageOK = false; + this.options = options; + + this.imageOK = true; + + if (this.options.reflHeight > 0) + { + this.reflection = new Reflection(this.image, this.options.reflHeight, this.options.reflOpacity); + } + $(this.image).css('position','absolute'); // Bizarre. This seems to reset image width to 0 on webkit! + };// END Item object + + + // Controller object. + // This handles moving all the items, dealing with mouse clicks etc. + var Controller = function(container, images, options) + { + var items = [], funcSin = Math.sin, funcCos = Math.cos, ctx=this; + this.controlTimer = 0; + this.stopped = false; + //this.imagesLoaded = 0; + this.container = container; + this.xRadius = options.xRadius; + this.yRadius = options.yRadius; + this.showFrontTextTimer = 0; + this.autoRotateTimer = 0; + if (options.xRadius === 0) + { + this.xRadius = ($(container).width()/2.3); + } + if (options.yRadius === 0) + { + this.yRadius = ($(container).height()/6); + } + + this.xCentre = options.xPos; + this.yCentre = options.yPos; + this.frontIndex = 0; // Index of the item at the front + + // Start with the first item at the front. + this.rotation = this.destRotation = Math.PI/2; + this.timeDelay = 1000/options.FPS; + + // Turn on the infoBox + if(options.altBox !== null) + { + $(options.altBox).css('display','block'); + $(options.titleBox).css('display','block'); + } + // Turn on relative position for container to allow absolutely positioned elements + // within it to work. + $(container).css({ position:'relative', overflow:'hidden'} ); + + $(options.buttonLeft).css('display','inline'); + $(options.buttonRight).css('display','inline'); + + // Setup the buttons. + $(options.buttonLeft).bind('mouseup',this,function(event){ + event.data.rotate(-1); + return false; + }); + $(options.buttonRight).bind('mouseup',this,function(event){ + event.data.rotate(1); + return false; + }); + + // You will need this plugin for the mousewheel to work: http://plugins.jquery.com/project/mousewheel + if (options.mouseWheel) + { + $(container).bind('mousewheel',this,function(event, delta) { + event.data.rotate(delta); + return false; + }); + } + $(container).bind('mouseover click',this,function(event){ + + clearInterval(event.data.autoRotateTimer); // Stop auto rotation if mouse over. + var text = $(event.target).attr('alt'); + // If we have moved over a carousel item, then show the alt and title text. + + if ( text !== undefined && text !== null ) + { + + clearTimeout(event.data.showFrontTextTimer); + $(options.altBox).html( ($(event.target).attr('alt') )); + $(options.titleBox).html( ($(event.target).attr('title') )); + if ( options.bringToFront && event.type == 'click' ) + { + + var idx = $(event.target).data('itemIndex'); + var frontIndex = event.data.frontIndex; + //var diff = idx - frontIndex; + var diff = (idx - frontIndex) % images.length; + if (Math.abs(diff) > images.length / 2) { + diff += (diff > 0 ? -images.length : images.length); + } + + event.data.rotate(-diff); + } + } + }); + // If we have moved out of a carousel item (or the container itself), + // restore the text of the front item in 1 second. + $(container).bind('mouseout',this,function(event){ + var context = event.data; + clearTimeout(context.showFrontTextTimer); + context.showFrontTextTimer = setTimeout( function(){context.showFrontText();},1000); + context.autoRotate(); // Start auto rotation. + }); + + // Prevent items from being selected as mouse is moved and clicked in the container. + $(container).bind('mousedown',this,function(event){ + + event.data.container.focus(); + return false; + }); + container.onselectstart = function () { return false; }; // For IE. + + this.innerWrapper = $(container).wrapInner('
').children()[0]; + + // Shows the text from the front most item. + this.showFrontText = function() + { + if ( items[this.frontIndex] === undefined ) { return; } // Images might not have loaded yet. + $(options.titleBox).html( $(items[this.frontIndex].image).attr('title')); + // METAMAPS CODE + $('#item_metacode').val( $(items[this.frontIndex].image).attr('title')); + // NOT METAMAPS CODE + $(options.altBox).html( $(items[this.frontIndex].image).attr('alt')); + }; + + this.go = function() + { + if(this.controlTimer !== 0) { return; } + var context = this; + this.controlTimer = setTimeout( function(){context.updateAll();},this.timeDelay); + }; + + this.stop = function() + { + clearTimeout(this.controlTimer); + this.controlTimer = 0; + }; + + + // Starts the rotation of the carousel. Direction is the number (+-) of carousel items to rotate by. + this.rotate = function(direction) + { + this.frontIndex -= direction; + this.frontIndex %= items.length; + this.destRotation += ( Math.PI / items.length ) * ( 2*direction ); + this.showFrontText(); + this.go(); + }; + + + this.autoRotate = function() + { + if ( options.autoRotate !== 'no' ) + { + var dir = (options.autoRotate === 'right')? 1 : -1; + this.autoRotateTimer = setInterval( function(){ctx.rotate(dir); }, options.autoRotateDelay ); + } + }; + + // This is the main loop function that moves everything. + this.updateAll = function() + { + var minScale = options.minScale; // This is the smallest scale applied to the furthest item. + var smallRange = (1-minScale) * 0.5; + var w,h,x,y,scale,item,sinVal; + + var change = (this.destRotation - this.rotation); + var absChange = Math.abs(change); + + this.rotation += change * options.speed; + if ( absChange < 0.001 ) { this.rotation = this.destRotation; } + var itemsLen = items.length; + var spacing = (Math.PI / itemsLen) * 2; + //var wrapStyle = null; + var radians = this.rotation; + var isMSIE = $.browser.msie; + + // Turn off display. This can reduce repaints/reflows when making style and position changes in the loop. + // See http://dev.opera.com/articles/view/efficient-javascript/?page=3 + this.innerWrapper.style.display = 'none'; + + var style; + var px = 'px', reflHeight; + var context = this; + for (var i = 0; i>0; // >>0 = Math.foor(). Firefox doesn't like fractional decimals in z-index. + if (item.reflection !== null) + { + reflHeight = options.reflHeight * scale; + style = item.reflection.element.style; + style.left = x + px; + style.top = y + h + options.reflGap * scale + px; + style.width = w + px; + if (isMSIE) + { + style.filter.finishy = (reflHeight / h * 100); + }else + { + style.height = reflHeight + px; + } + } + } + radians += spacing; + } + // Turn display back on. + this.innerWrapper.style.display = 'block'; + + // If we have a preceptable change in rotation then loop again next frame. + if ( absChange >= 0.001 ) + { + this.controlTimer = setTimeout( function(){context.updateAll();},this.timeDelay); + }else + { + // Otherwise just stop completely. + this.stop(); + } + }; // END updateAll + + // Create an Item object for each image +// func = function(){return;ctx.updateAll();} ; + + // Check if images have loaded. We need valid widths and heights for the reflections. + this.checkImagesLoaded = function() + { + var i; + for(i=0;i [ "id = ?", 5]) + @map = Map.first(:conditions => [ "id = ?", 5]) if @map - respond_with(@user, @session, location: user_map_url(@connor,@map)) do |format| + respond_with(@user, @session, location: map_url(@map)) do |format| end else respond_with(@user, @session, location: root_url) do |format| diff --git a/app/views/items/_new.html.erb b/app/views/items/_new.html.erb index 13f7595d..8b32e644 100644 --- a/app/views/items/_new.html.erb +++ b/app/views/items/_new.html.erb @@ -1,9 +1,15 @@
<%= form_for Item.new, url: items_url, remote: true do |form| %> +
ActionActivityBizarreCatalystClosedExperienceFuture DevGroupIdeaImplicationInsightIntentionKnowledgeLocationOpen IssueOpinionOpportunityPersonPlatformProblemQuestionReferenceRequirementResourceRoleTaskToolTrajectory
<%= form.autocomplete_field :name, autocomplete_item_name_items_path, :placeholder => "What is the name of your topic?" %> + <%= form.hidden_field :metacode, :value => "Action" %> <%= form.hidden_field :x, :value => 0 %> <%= form.hidden_field :y, :value => 0 %> <%= form.hidden_field :grabItem, :value => "null" %> <%= form.hidden_field :addSynapse, :value => false %> + +
+ +
<% end %>
diff --git a/app/views/items/create.js.erb b/app/views/items/create.js.erb index 011c4a36..681f4b41 100644 --- a/app/views/items/create.js.erb +++ b/app/views/items/create.js.erb @@ -26,9 +26,11 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) { temp.setData('dim', 40, 'end'); if (gType == "centered") { - temp.setPos(new $jit.Polar(5.54, 347.6), 'current'); - temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); - temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); + var tempPos = new $jit.Complex(x, y); + tempPos = tempPos.toPolar(); + temp.setPos(tempPos, 'current'); + temp.setPos(tempPos, 'start'); + temp.setPos(tempPos, 'end'); } else if (gType == "arranged" || gType == "chaotic") { temp.setData('xloc',0); @@ -48,7 +50,7 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) { modes: ['node-property:dim'], duration: 500, onComplete: function() { - renderMidArrow({ x: tempNode.pos.x, y: tempNode.pos.y }, { x: temp.pos.x, y: temp.pos.y }, 13, false, Mconsole.canvas); + renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: temp.pos.getc().x, y: temp.pos.getc().y }, 13, false, Mconsole.canvas); Mconsole.fx.plotNode(tempNode, Mconsole.canvas); Mconsole.fx.plotNode(temp, Mconsole.canvas); tempNode = null; diff --git a/app/views/items/index.html.erb b/app/views/items/index.html.erb index 9a1624ef..bae011cb 100644 --- a/app/views/items/index.html.erb +++ b/app/views/items/index.html.erb @@ -1,15 +1,11 @@ -

Topics

+

<% if @user %><%= @user.name %>'s<% end %> Topics

<% @items.each do |item| %> <%= render item %> <% end %> <% if @items.empty? %> -


Shucks, there are no topics.

+


Shucks, there are no topics. <% if authenticated? %><%= link_to "Create some if you want.", console_url %><% end %>

<% end %>
-
- -<% if authenticated? %> - <%= render :partial => 'items/new' %> -<% end %> \ No newline at end of file +
\ No newline at end of file diff --git a/app/views/items/show.html.erb b/app/views/items/show.html.erb index 999afcf3..73dffe6a 100644 --- a/app/views/items/show.html.erb +++ b/app/views/items/show.html.erb @@ -32,6 +32,7 @@ <% if authenticated? %> + <%= render :partial => 'items/new' %> <%= render :partial => 'synapses/new' %> <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3c8796f2..4e99c171 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,6 +7,11 @@ var userid = "<%= user.id %>"; var username = "<%= user.name %>"; + <% else %> + <% end %> <%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %> @@ -19,48 +24,41 @@ <%= content_tag :div, class: authenticated? ? "main authenticated" : "main unauthenticated" do %> -
- <% unless authenticated? %> - - <% end %> - <% if authenticated? %> - - <% end %> -
-
- -
+
<%= yield %>
<% end %> <%= render :partial => 'layouts/ga' if Rails.env.production? %> + \ No newline at end of file diff --git a/app/views/main/console.html.erb b/app/views/main/console.html.erb index b836913f..b42b8e8f 100644 --- a/app/views/main/console.html.erb +++ b/app/views/main/console.html.erb @@ -1,43 +1,8 @@ -<% if @map %> -
-
-

# of Topics: <%= @map.items.count %>

-

# of Synapses: <%= @map.synapses.count %>

-
-
-

<%= @map.name %>

-
-

<%= @map.desc %>

-
-
-
- -
-
-
- -
-
-
+
+ <% if authenticated? %><% end %> +
-
-
- - - -<% elsif authenticated? %> +
@@ -47,6 +12,7 @@ <% if authenticated? %> <%= render :partial => 'items/new' %> <%= render :partial => 'synapses/new' %> + <%= render :partial => 'maps/new' %> <% end %> - -<% else %> -


Shucks, there are no maps.

-<% end %> close
-

On my Canvas

-

In the Commons

+

On my Canvas

+

In the Commons

Find... @@ -132,4 +94,4 @@ <%= text_field_tag(:topics_by_user_id, "", :id => "topicsByUser", :class => "getTopicsInput") %> <%= text_field_tag(:topics_by_map_id, "", :id => "topicsByMap", :class => "getTopicsInput") %> <% end %> -
+

\ No newline at end of file diff --git a/app/views/main/search.js.erb b/app/views/main/search.js.erb index c9013123..6d3ab04c 100644 --- a/app/views/main/search.js.erb +++ b/app/views/main/search.js.erb @@ -3,8 +3,9 @@ $('.getTopicsInput').attr('value',''); var h = Mconsole.canvas.element.clientHeight / 2; var w = Mconsole.canvas.element.clientWidth / 2; -var myX = -w + 100; +var myX = -w + 400; var myY = -h + 100; +var even = true; <% @items.each do |item| %> if ($.isEmptyObject(Mconsole.graph.nodes)) { @@ -13,12 +14,13 @@ var myY = -h + 100; var temp = Mconsole.graph.getNode('<%= item.id %>'); temp.setData('dim', 1, 'start'); temp.setData('dim', 25, 'end'); - temp.setData('isNew',true); + temp.setData('inCommons',true); temp.setPos(new $jit.Complex(myX, myY), 'current'); temp.setPos(new $jit.Complex(myX, myY), 'start'); temp.setPos(new $jit.Complex(myX, myY), 'end'); Mconsole.fx.plotNode(temp, Mconsole.canvas); myX += 100; + even = !even; } else { var temp = Mconsole.graph.getNode('<%= item.id %>'); @@ -28,16 +30,25 @@ var myY = -h + 100; var temp = Mconsole.graph.getNode('<%= item.id %>'); temp.setData('dim', 1, 'start'); temp.setData('dim', 25, 'end'); - temp.setData('isNew',true); + temp.setData('inCommons',true); if (myX > (w-100)) { - myX = -w + 100; - myY += 100 + myX = -w + 400; + myY += 200; + even = true; + } + if (even) { + temp.setPos(new $jit.Complex(myX, myY), 'current'); + temp.setPos(new $jit.Complex(myX, myY), 'start'); + temp.setPos(new $jit.Complex(myX, myY), 'end'); + } + else if (!even) { + temp.setPos(new $jit.Complex(myX, myY+100), 'current'); + temp.setPos(new $jit.Complex(myX, myY+100), 'start'); + temp.setPos(new $jit.Complex(myX, myY+100), 'end'); } - temp.setPos(new $jit.Complex(myX, myY), 'current'); - temp.setPos(new $jit.Complex(myX, myY), 'start'); - temp.setPos(new $jit.Complex(myX, myY), 'end'); Mconsole.fx.plotNode(temp, Mconsole.canvas); myX += 100; + even = !even; } } <% end %> diff --git a/app/views/maps/_new.html.erb b/app/views/maps/_new.html.erb new file mode 100644 index 00000000..9b576219 --- /dev/null +++ b/app/views/maps/_new.html.erb @@ -0,0 +1,15 @@ +
+<%= form_for @map || Map.new, url: maps_url, remote: true do |form|%> +

Save to Map

+ + <%= form.text_field :name %> + + <%= form.text_area :desc, class: "description", :rows => 5 %> + + <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %> + <%= form.hidden_field :topicsToMap, :value => 0 %> + <%= form.submit "Save", class: "add" %> + +
+<% end %> +
\ No newline at end of file diff --git a/app/views/maps/_newtopic.html.erb b/app/views/maps/_newtopic.html.erb index 88ccc5eb..145c84b2 100644 --- a/app/views/maps/_newtopic.html.erb +++ b/app/views/maps/_newtopic.html.erb @@ -1,9 +1,16 @@
<%= form_for Item.new, url: items_url, remote: true do |form| %> +
ActionActivityBizarreCatalystClosedExperienceFuture DevGroupIdeaImplicationInsightIntentionKnowledgeLocationOpen IssueOpinionOpportunityPersonPlatformProblemQuestionReferenceRequirementResourceRoleTaskToolTrajectory
<%= form.autocomplete_field :name, autocomplete_item_name_items_path, :placeholder => "What is the name of your topic?" %> + <%= form.hidden_field :metacode, :value => "Action" %> <%= form.hidden_field :x, :value => 0 %> <%= form.hidden_field :y, :value => 0 %> <%= form.hidden_field :map, :value => @map.id %> <%= form.hidden_field :grabItem, :value => "null" %> + <%= form.hidden_field :addSynapse, :value => false %> + +
+ +
<% end %>
\ No newline at end of file diff --git a/app/views/maps/create.js.erb b/app/views/maps/create.js.erb new file mode 100644 index 00000000..1b72df5c --- /dev/null +++ b/app/views/maps/create.js.erb @@ -0,0 +1,13 @@ +$('#map_name').val(''); +$('#map_desc').val(''); +$('#map_permission').val('commons'); +$('#map_topicsToMap').val('0'); + +var tempForm = $('#new_map').html(); +$('#new_map').html("Success! Do you want to
' + "'>Go to your new map?
or
Stay on the Console?"); + +function closeIt() { + $('#new_map').fadeOut('fast', function(){ + $('#new_map').html(tempForm); + }); +} \ No newline at end of file diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb index 092b3438..db35d41a 100644 --- a/app/views/maps/index.html.erb +++ b/app/views/maps/index.html.erb @@ -1,11 +1,11 @@ -

Maps

+

<% if @user %><%= @user.name %>'s<% end %> Maps

<% @maps.each do |map| %> <%= render map %> <% end %> <% if @maps.empty? %> -


Shucks, there are no maps.

+


Shucks, there are no maps. <% if authenticated? %><%= link_to "Create one if you want.", new_map_url %><% end %>

<% end %>
\ No newline at end of file diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 7e469e62..9ca0a908 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -42,6 +42,11 @@ <% end %> }); } + else { + $(document).ready(function() { + initialize("chaotic", true); + }); + } <%= render :partial => 'newtopic' %> diff --git a/app/views/synapses/index.html.erb b/app/views/synapses/index.html.erb index 03a4b9e3..1f5fa883 100644 --- a/app/views/synapses/index.html.erb +++ b/app/views/synapses/index.html.erb @@ -1,3 +1,5 @@ +

<% if @user %><%= @user.name %>'s<% end %> Synapses

+
diff --git a/config/routes.rb b/config/routes.rb index f27f9961..6fac3130 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ ISSAD::Application.routes.draw do root to: 'main#console', via: :get - match 'metamap', to: 'main#metamap', via: :get, as: :metamap + match 'console', to: 'main#console', via: :get, as: :console match 'invite', to: 'main#invite', via: :get, as: :invite