Mindplot don't need to be compiled.

This commit is contained in:
Paulo Veiga 2011-07-30 05:22:57 -03:00
parent 361892e004
commit 51be944cca
18 changed files with 257 additions and 376 deletions

View File

@ -1,86 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
core.Loader =
{
load: function(scriptPath, stylePath,jsFileName)
{
var headElement = document.getElementsByTagName('head');
var htmlDoc = headElement.item(0);
var baseUrl = this.baseUrl(jsFileName);
if (scriptPath && scriptPath.length > 0)
{
for (var i = 0; i < scriptPath.length; i++)
{
this.includeScriptNode(baseUrl + scriptPath[i]);
}
}
if (stylePath && stylePath.length > 0)
{
for (var i = 0; i < stylePath.length; i++)
{
this.includeStyleNode(baseUrl + stylePath[i]);
}
}
},
baseUrl: function(jsFileName)
{
var headElement = document.getElementsByTagName('head');
var htmlDoc = headElement.item(0);
var headChildren = htmlDoc.childNodes;
var result = null;
for (var i = 0; i < headChildren.length; i++)
{
var node = headChildren.item(i);
if (node.nodeName && node.nodeName.toLowerCase() == "script")
{
var libraryUrl = node.src;
if (libraryUrl.indexOf(jsFileName) != -1)
{
var index = libraryUrl.lastIndexOf("/");
index = libraryUrl.lastIndexOf("/", index - 1);
result = libraryUrl.substring(0, index);
}
}
}
if (result == null)
{
throw "Could not obtain the base url directory.";
}
return result;
},
includeScriptNode: function(filename) {
var html_doc = document.getElementsByTagName('head').item(0);
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', filename);
html_doc.appendChild(js);
return false;
},
includeStyleNode: function(filename) {
var html_doc = document.getElementsByTagName('head').item(0);
var js = document.createElement('link');
js.setAttribute('rel', 'stylesheet');
js.setAttribute('type', 'text/css');
js.setAttribute('href', filename);
html_doc.appendChild(js);
return false;
}
};

View File

@ -78,14 +78,6 @@ Math.sign = function(value) {
}; };
// Extensions ....
function $import(src) {
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src', src);
scriptElem.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
/** /**
* Retrieve the mouse position. * Retrieve the mouse position.
*/ */
@ -274,6 +266,7 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) {
core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn) { core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn) {
core.Utils.animateVisibility(elems, isVisible, doneFn); core.Utils.animateVisibility(elems, isVisible, doneFn);
}; };
core.Utils.setChildrenVisibilityAnimated = function(rootElem, isVisible) { core.Utils.setChildrenVisibilityAnimated = function(rootElem, isVisible) {
var children = core.Utils._addInnerChildrens(rootElem); var children = core.Utils._addInnerChildrens(rootElem);
core.Utils.animateVisibility(children, isVisible); core.Utils.animateVisibility(children, isVisible);

View File

@ -67,7 +67,6 @@
<filelist dir="${basedir}/src/main/javascript/" files="DragManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="DragManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="DragPivot.js"/> <filelist dir="${basedir}/src/main/javascript/" files="DragPivot.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="Board.js"/> <filelist dir="${basedir}/src/main/javascript/" files="Board.js"/>
<!--<filelist dir="${basedir}/src/main/javascript/" files="TopicBoard.js"/>-->
<filelist dir="${basedir}/src/main/javascript/" files="CentralTopicBoard.js"/> <filelist dir="${basedir}/src/main/javascript/" files="CentralTopicBoard.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="MainTopicBoard.js"/> <filelist dir="${basedir}/src/main/javascript/" files="MainTopicBoard.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="ConnectionLine.js"/> <filelist dir="${basedir}/src/main/javascript/" files="ConnectionLine.js"/>
@ -154,8 +153,6 @@
files="layout/FreeMindLayoutManager.js"/> files="layout/FreeMindLayoutManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="layout/LayoutManagerFactory.js"/> files="layout/LayoutManagerFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="footer.js"/> <filelist dir="${basedir}/src/main/javascript/" files="footer.js"/>
</concat> </concat>

View File

@ -19,7 +19,7 @@
mindplot.ActionIcon = new Class({ mindplot.ActionIcon = new Class({
Extends:mindplot.Icon, Extends:mindplot.Icon,
initialize: function(topic, url) { initialize: function(topic, url) {
mindplot.Icon.call(this, url); this.parent(url);
this._node = topic; this._node = topic;
}, },
getNode:function() { getNode:function() {

View File

@ -33,7 +33,7 @@ mindplot.CentralTopic = new Class({
setCursor : function(type) { setCursor : function(type) {
type = (type == 'move') ? 'default' : type; type = (type == 'move') ? 'default' : type;
mindplot.Topic.prototype.setCursor.call(this, type); this.parent(type);
}, },
isConnectedToCentralTopic : function() { isConnectedToCentralTopic : function() {

View File

@ -119,7 +119,7 @@ mindplot.MainTopic = new Class({
}, },
disconnect : function(workspace) { disconnect : function(workspace) {
mindplot.Topic.prototype.disconnect.call(this, workspace); this.parent(workspace);
var size = this.getSize(); var size = this.getSize();
var model = this.getModel(); var model = this.getModel();

View File

@ -21,7 +21,7 @@ mindplot.Note = new Class({
initialize : function(textModel, topic, designer) { initialize : function(textModel, topic, designer) {
var divContainer = designer.getWorkSpace().getScreenManager().getContainer(); var divContainer = designer.getWorkSpace().getScreenManager().getContainer();
var bubbleTip = mindplot.BubbleTip.getInstance(divContainer); var bubbleTip = mindplot.BubbleTip.getInstance(divContainer);
mindplot.Icon.call(this, mindplot.Note.IMAGE_URL); this.parent(mindplot.Note.IMAGE_URL);
this._noteModel = textModel; this._noteModel = textModel;
this._topic = topic; this._topic = topic;
this._designer = designer; this._designer = designer;

View File

@ -45,8 +45,7 @@ mindplot.RelationshipLine = new Class({
}, },
setStroke : function(color, style, opacity) { setStroke : function(color, style, opacity) {
// @Todo: How this is supported in mootools ? this.parent(color, style, opacity);
mindplot.ConnectionLine.prototype.setStroke.call(this, color, style, opacity);
this._startArrow.setStrokeColor(color); this._startArrow.setStrokeColor(color);
}, },
@ -126,7 +125,7 @@ mindplot.RelationshipLine = new Class({
workspace.appendChild(this._startArrow); workspace.appendChild(this._startArrow);
workspace.appendChild(this._endArrow); workspace.appendChild(this._endArrow);
mindplot.ConnectionLine.prototype.addToWorkspace.call(this, workspace); this.parent(workspace);
}, },
_initializeControlPointController : function(event, workspace) { _initializeControlPointController : function(event, workspace) {
@ -141,7 +140,7 @@ mindplot.RelationshipLine = new Class({
workspace.removeChild(this._startArrow); workspace.removeChild(this._startArrow);
workspace.removeChild(this._endArrow); workspace.removeChild(this._endArrow);
mindplot.ConnectionLine.prototype.removeFromWorkspace.call(this, workspace); this.parent(workspace);
}, },
getType : function() { getType : function() {
@ -195,13 +194,13 @@ mindplot.RelationshipLine = new Class({
}, },
setVisibility : function(value) { setVisibility : function(value) {
mindplot.ConnectionLine.prototype.setVisibility.call(this, value); this.parent(value);
this._endArrow.setVisibility(this._showEndArrow && value); this._endArrow.setVisibility(this._showEndArrow && value);
this._startArrow.setVisibility(this._showStartArrow && value); this._startArrow.setVisibility(this._showStartArrow && value);
}, },
setOpacity : function(opacity) { setOpacity : function(opacity) {
mindplot.ConnectionLine.prototype.setOpacity.call(this, opacity); this.parent(opacity);
if (this._showEndArrow) if (this._showEndArrow)
this._endArrow.setOpacity(opacity); this._endArrow.setOpacity(opacity);
if (this._showStartArrow) if (this._showStartArrow)

View File

@ -221,7 +221,6 @@ mindplot.TextEditor = new Class({
}; };
setTimeout(executor(this), 10); setTimeout(executor(this), 10);
//console.log('init done');
}, },
setStyle : function (fontStyle) { setStyle : function (fontStyle) {

View File

@ -1013,7 +1013,6 @@ mindplot.Topic = new Class({
var outerShape = this.getOuterShape(); var outerShape = this.getOuterShape();
var innerShape = this.getInnerShape(); var innerShape = this.getInnerShape();
var connector = this.getShrinkConnector();
outerShape.setSize(size.width + 4, size.height + 6); outerShape.setSize(size.width + 4, size.height + 6);
innerShape.setSize(size.width, size.height); innerShape.setSize(size.width, size.height);
@ -1177,7 +1176,7 @@ mindplot.Topic = new Class({
}, },
createDragNode : function() { createDragNode : function() {
var dragNode = mindplot.NodeGraph.prototype.createDragNode.call(this); this.parent();
// Is the node already connected ? // Is the node already connected ?
var targetTopic = this.getOutgoingConnectedTopic(); var targetTopic = this.getOutgoingConnectedTopic();

View File

@ -1,53 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//@Todo: Por que lo cambiaste a Board ?
mindplot.TopicBoard = new Class({
initialize: function() {
this._height = null;
},
_removeEntryByOrder : function(order, position) {
var board = this._getBoard(position);
var entry = board.lookupEntryByOrder(order);
$assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic();
board.update(entry);
},
removeTopicFromBoard : function(topic) {
var position = topic.getPosition();
var order = topic.getOrder();
this._removeEntryByOrder(order, position);
topic.setOrder(null);
},
positionateDragTopic :function(dragTopic) {
throw "this method must be overrided";
},
getHeight: function() {
var board = this._getBoard();
return board.getHeight();
}
}
);

View File

@ -15,8 +15,3 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
if($defined(afterMindpotLibraryLoading))
{
afterMindpotLibraryLoading();
}

View File

@ -23,8 +23,6 @@
<script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/IconPanel.js'></script> <script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/IconPanel.js'></script>
<script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/mooRainbow.js'></script> <script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/mooRainbow.js'></script>
<script type='text/javascript' src='../../../../../core-js/target/classes/core.js'></script> <script type='text/javascript' src='../../../../../core-js/target/classes/core.js'></script>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon"> <link rel="icon" href="../images/favicon.ico" type="image/x-icon">
@ -68,11 +66,11 @@
return false; return false;
}); });
// @Todo: This must be persited in the map properties ...
var mapId = '1'; var mapId = '1';
var mapXml = '<map name="38298" version="pela"><topic central="true" text="test" id="1"/></map>'; var mapXml = '<map name="38298" version="pela"><topic central="true" text="test" id="1"/></map>';
// @Todo: This must be persiste in the map properties ...
var editorProperties = {zoom:0.85,saveOnLoad:true}; var editorProperties = {zoom:0.85,saveOnLoad:true};
function printMap() { function printMap() {

View File

@ -16,9 +16,6 @@
* limitations under the License. * limitations under the License.
*/ */
$import("../../../../../mindplot/target/classes/mindplot.svg.js");
var designer = null; var designer = null;
// CSS helper functions // CSS helper functions
@ -370,7 +367,6 @@ function buildIconChooser() {
} }
function setCurrentColorPicker(colorPicker) { function setCurrentColorPicker(colorPicker) {
this.currentColorPicker = colorPicker; this.currentColorPicker = colorPicker;
} }
@ -530,3 +526,71 @@ function buildPanel(buttonElemId, elemLinksContainer, elemLinkIds, updateFunctio
$(elementId).addEvent('click', fontOnClick.bind($(elementId))); $(elementId).addEvent('click', fontOnClick.bind($(elementId)));
} }
} }
//######################### Libraries Loading ##################################
function JSPomLoader(pomUrl, callback) {
console.log("POM Load URL:" + pomUrl);
var jsUrls;
var request = new Request({
url: pomUrl,
method: 'get',
onRequest: function() {
console.log("loading ...");
},
onSuccess: function(responseText, responseXML) {
// Collect JS Urls ...
var concatRoot = responseXML.getElementsByTagName('concat');
var fileSetArray = Array.filter(concatRoot[0].childNodes, function(elem) {
return elem.nodeType == Node.ELEMENT_NODE
});
jsUrls = new Array();
Array.each(fileSetArray, function(elem) {
var jsUrl = elem.getAttribute("dir") + elem.getAttribute("files");
jsUrls.push(jsUrl.replace("${basedir}", pomUrl.substring(0, pomUrl.lastIndexOf('/'))));
}
);
// Load all JS dynamically ....
jsUrls = jsUrls.reverse();
function jsRecLoad(urls) {
if (urls.length == 0) {
if ($defined(callback))
callback();
} else {
var url = urls.pop();
console.log("load url:" + url);
Asset.javascript(url, {
onLoad: function() {
jsRecLoad(urls)
}
});
}
}
jsRecLoad(jsUrls);
},
onFailure: function() {
console.log('Sorry, your request failed :(');
}
});
request.send();
}
var localEnv = true;
if (localEnv) {
Asset.javascript("../../../../../web2d/target/classes/web2d.svg-min.js", {
onLoad: function() {
JSPomLoader('../../../../../mindplot/pom.xml', afterMindpotLibraryLoading)
}
});
} else {
Asset.javascript("../js/mindplot.svg.js", {
onLoad: function() {
afterMindpotLibraryLoading();
}
});
}

View File

@ -0,0 +1,16 @@
function jsapi(){var L='',ec='\n-',sb='" for "gwt:onLoadErrorFn"',qb='" for "gwt:onPropertyErrorFn"',Tb='"<script src=\\"',eb='"><\/script>',V='#',dc=');',Xb='-\n',fc='-><\/scr',Ub='.cache.js\\"><\/scr" + "ipt>"',X='/',Kb='15E29CA8DC1A1C8B011D7C585C4B973A',Lb='4EB28EA94ADC3D2A72B265B7E1F49499',Mb='5BEC632F6A7363F01782687E72EA6800',Nb='5FE13ACCADA904725EF2CCBB12308628',Ob='6C98EFA9BBD2AAF79BC20EE641A805FF',Pb='9681D35AB367AC97C6F502FCBD81A95B',Qb=':',kb='::',Vb='<scr',db='<script id="',nb='=',W='?',xb='ActiveXObject',pb='Bad handler "',yb='ChromeTab.ChromeFrame',Hb='Cross-site hosted mode not yet implemented. See issue ',Rb='DOMContentLoaded',fb='SCRIPT',cb='__gwt_marker_jsapi',gb='base',$='baseUrl',P='begin',O='bootstrap',wb='chromeframe',Z='clear.cache.gif',mb='content',cc='document.write(',U='end',$b='evtGroup: "loadExternalRefs", millis:(new Date()).getTime(),',ac='evtGroup: "moduleStartup", millis:(new Date()).getTime(),',Eb='gecko',Fb='gecko1_8',Q='gwt.codesvr=',R='gwt.hosted=',S='gwt.hybrid',rb='gwt:onLoadErrorFn',ob='gwt:onPropertyErrorFn',lb='gwt:property',Ib='http://code.google.com/p/google-web-toolkit/issues/detail?id=2079',Db='ie6',Cb='ie8',Bb='ie9',Y='img',gc='ipt>',Wb='ipt><!-',M='jsapi',ab='jsapi.nocache.js',jb='jsapi::',Sb='loadExternalRefs',hb='meta',Zb='moduleName:"jsapi", sessionId:window.__gwtStatsSessionId, subSystem:"startup",',T='moduleStartup',Ab='msie',ib='name',ub='opera',zb='safari',_='script',Jb='selectingPermutation',N='startup',_b='type: "end"});',bc='type: "moduleRequested"});',bb='undefined',Gb='unknown',tb='user.agent',vb='webkit',Yb='window.__gwtStatsEvent && window.__gwtStatsEvent({';var l=window,m=document,n=l.__gwtStatsEvent?function(a){return l.__gwtStatsEvent(a)}:null,o=l.__gwtStatsSessionId?l.__gwtStatsSessionId:null,p,q,r=L,s={},t=[],u=[],v=[],w=0,x,y;n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:P});if(!l.__gwt_stylesLoaded){l.__gwt_stylesLoaded={}}if(!l.__gwt_scriptsLoaded){l.__gwt_scriptsLoaded={}}function z(){var b=false;try{var c=l.location.search;return (c.indexOf(Q)!=-1||(c.indexOf(R)!=-1||l.external&&l.external.gwtOnLoad))&&c.indexOf(S)==-1}catch(a){}z=function(){return b};return b}
function A(){if(p&&q){p(x,M,r,w);n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:T,millis:(new Date).getTime(),type:U})}}
function B(){function e(a){var b=a.lastIndexOf(V);if(b==-1){b=a.length}var c=a.indexOf(W);if(c==-1){c=a.length}var d=a.lastIndexOf(X,Math.min(c,b));return d>=0?a.substring(0,d+1):L}
function f(a){if(a.match(/^\w+:\/\//)){}else{var b=m.createElement(Y);b.src=a+Z;a=e(b.src)}return a}
function g(){var a=D($);if(a!=null){return a}return L}
function h(){var a=m.getElementsByTagName(_);for(var b=0;b<a.length;++b){if(a[b].src.indexOf(ab)!=-1){return e(a[b].src)}}return L}
function i(){var a;if(typeof isBodyLoaded==bb||!isBodyLoaded()){var b=cb;var c;m.write(db+b+eb);c=m.getElementById(b);a=c&&c.previousSibling;while(a&&a.tagName!=fb){a=a.previousSibling}if(c){c.parentNode.removeChild(c)}if(a&&a.src){return e(a.src)}}return L}
function j(){var a=m.getElementsByTagName(gb);if(a.length>0){return a[a.length-1].href}return L}
var k=g();if(k==L){k=h()}if(k==L){k=i()}if(k==L){k=j()}if(k==L){k=e(m.location.href)}k=f(k);r=k;return k}
function C(){var b=document.getElementsByTagName(hb);for(var c=0,d=b.length;c<d;++c){var e=b[c],f=e.getAttribute(ib),g;if(f){f=f.replace(jb,L);if(f.indexOf(kb)>=0){continue}if(f==lb){g=e.getAttribute(mb);if(g){var h,i=g.indexOf(nb);if(i>=0){f=g.substring(0,i);h=g.substring(i+1)}else{f=g;h=L}s[f]=h}}else if(f==ob){g=e.getAttribute(mb);if(g){try{y=eval(g)}catch(a){alert(pb+g+qb)}}}else if(f==rb){g=e.getAttribute(mb);if(g){try{x=eval(g)}catch(a){alert(pb+g+sb)}}}}}}
function D(a){var b=s[a];return b==null?null:b}
function E(a,b){var c=v;for(var d=0,e=a.length-1;d<e;++d){c=c[a[d]]||(c[a[d]]=[])}c[a[e]]=b}
function F(a){var b=u[a](),c=t[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(y){y(a,d,b)}throw null}
u[tb]=function(){var c=navigator.userAgent.toLowerCase();var d=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return c.indexOf(ub)!=-1}())return ub;if(function(){return c.indexOf(vb)!=-1||function(){if(c.indexOf(wb)!=-1){return true}if(typeof window[xb]!=bb){try{var b=new ActiveXObject(yb);if(b){b.registerBhoIfNeeded();return true}}catch(a){}}return false}()}())return zb;if(function(){return c.indexOf(Ab)!=-1&&m.documentMode>=9}())return Bb;if(function(){return c.indexOf(Ab)!=-1&&m.documentMode>=8}())return Cb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(c);if(a&&a.length==3)return d(a)>=6000}())return Db;if(function(){return c.indexOf(Eb)!=-1}())return Fb;return Gb};t[tb]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};jsapi.onScriptLoad=function(a){jsapi.onScriptLoad=null;p=a;A()};if(z()){alert(Hb+Ib);return}C();B();n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:Jb});var G;try{E([Db],Kb);E([zb],Lb);E([ub],Mb);E([Fb],Nb);E([Cb],Ob);E([Bb],Pb);G=v[F(tb)];var H=G.indexOf(Qb);if(H!=-1){w=Number(G.substring(H+1));G=G.substring(0,H)}}catch(a){return}var I;function J(){if(!q){q=true;A();if(m.removeEventListener){m.removeEventListener(Rb,J,false)}if(I){clearInterval(I)}}}
if(m.addEventListener){m.addEventListener(Rb,function(){J()},false)}var I=setInterval(function(){if(/loaded|complete/.test(m.readyState)){J()}},50);n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:U});n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:Sb,millis:(new Date).getTime(),type:P});var K=Tb+r+G+Ub;m.write(Vb+Wb+Xb+Yb+Zb+$b+_b+Yb+Zb+ac+bc+cc+K+dc+ec+fc+gc)}
jsapi();

View File

@ -1,6 +1,6 @@
// MooTools: the javascript framework. // MooTools: the javascript framework.
// Load this file's selection again by visiting: http://mootools.net/more/a6e9cfc60901e7c04a3ebf1805354b50 // Load this file's selection again by visiting: http://mootools.net/more/979a28b1cc76ab15b6da1704eb6e4c2c
// Or build this file again with packager using: packager build More/More More/String.Extras More/URI More/URI.Relative More/Hash More/Hash.Extras More/Fx.Elements More/Fx.Accordion More/Fx.Move More/Fx.Reveal More/Fx.Scroll More/Fx.Slide More/Fx.SmoothScroll More/Fx.Sort More/Drag More/Drag.Move More/Color // Or build this file again with packager using: packager build More/More More/String.Extras More/URI More/URI.Relative More/Hash More/Hash.Extras More/Fx.Elements More/Fx.Accordion More/Fx.Move More/Fx.Reveal More/Fx.Scroll More/Fx.Slide More/Fx.SmoothScroll More/Fx.Sort More/Drag More/Drag.Move More/Assets More/Color More/Locale
/* /*
--- ---
copyrights: copyrights:
@ -215,16 +215,34 @@ if(c.getStyle("position")=="fixed"){var a=window.getScroll();b.left+=a.x;b.right
var b=this.mouse.now;return(b.x>d.left&&b.x<d.right&&b.y<d.bottom&&b.y>d.top);},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]); var b=this.mouse.now;return(b.x>d.left&&b.x<d.right&&b.y<d.bottom&&b.y>d.top);},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);
}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables(); }if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables();
}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a); }},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);
this.store("dragger",b);return b;}});(function(){var a=this.Color=new Type("Color",function(c,d){if(arguments.length>=3){d="rgb";c=Array.slice(arguments,0,3); this.store("dragger",b);return b;}});var Asset={javascript:function(f,c){if(!c){c={};}var a=new Element("script",{src:f,type:"text/javascript"}),g=c.document||document,b=0,d=c.onload||c.onLoad;
}else{if(typeof c=="string"){if(c.match(/rgb/)){c=c.rgbToHex().hexToRgb(true);}else{if(c.match(/hsb/)){c=c.hsbToRgb();}else{c=c.hexToRgb(true);}}}}d=d||"rgb"; var e=d?function(){if(++b==1){d.call(this);}}:function(){};delete c.onload;delete c.onLoad;delete c.document;return a.addEvents({load:e,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){e.call(this);
switch(d){case"hsb":var b=c;c=c.hsbToRgb();c.hsb=b;break;case"hex":c=c.hexToRgb(true);break;}c.rgb=c.slice(0,3);c.hsb=c.hsb||c.rgbToHsb();c.hex=c.rgbToHex(); }}}).set(c).inject(g.head);},css:function(d,a){if(!a){a={};}var b=new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:d});var c=a.onload||a.onLoad,e=a.document||document;
return Object.append(c,this);});a.implement({mix:function(){var b=Array.slice(arguments);var d=(typeOf(b.getLast())=="number")?b.pop():50;var c=this.slice(); delete a.onload;delete a.onLoad;delete a.document;if(c){b.addEvent("load",c);}return b.set(a).inject(e.head);},image:function(c,b){if(!b){b={};}var d=new Image(),a=document.id(d)||new Element("img");
b.each(function(e){e=new a(e);for(var f=0;f<3;f++){c[f]=Math.round((c[f]/100*(100-d))+(e[f]/100*d));}});return new a(c,"rgb");},invert:function(){return new a(this.map(function(b){return 255-b; ["load","abort","error"].each(function(e){var g="on"+e,f="on"+e.capitalize(),h=b[g]||b[f]||function(){};delete b[f];delete b[g];d[g]=function(){if(!d){return;
}));},setHue:function(b){return new a([b,this.hsb[1],this.hsb[2]],"hsb");},setSaturation:function(b){return new a([this.hsb[0],b,this.hsb[2]],"hsb");},setBrightness:function(b){return new a([this.hsb[0],this.hsb[1],b],"hsb"); }if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;h.delay(1,a,a);a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);
}return a.set(b);},images:function(c,b){c=Array.from(c);var d=function(){},a=0;b=Object.merge({onComplete:d,onProgress:d,onError:d,properties:{}},b);return new Elements(c.map(function(f,e){return Asset.image(f,Object.append(b.properties,{onload:function(){a++;
b.onProgress.call(this,a,e,f);if(a==c.length){b.onComplete();}},onerror:function(){a++;b.onError.call(this,a,e,f);if(a==c.length){b.onComplete();}}}));
}));}};(function(){var a=this.Color=new Type("Color",function(c,d){if(arguments.length>=3){d="rgb";c=Array.slice(arguments,0,3);}else{if(typeof c=="string"){if(c.match(/rgb/)){c=c.rgbToHex().hexToRgb(true);
}else{if(c.match(/hsb/)){c=c.hsbToRgb();}else{c=c.hexToRgb(true);}}}}d=d||"rgb";switch(d){case"hsb":var b=c;c=c.hsbToRgb();c.hsb=b;break;case"hex":c=c.hexToRgb(true);
break;}c.rgb=c.slice(0,3);c.hsb=c.hsb||c.rgbToHsb();c.hex=c.rgbToHex();return Object.append(c,this);});a.implement({mix:function(){var b=Array.slice(arguments);
var d=(typeOf(b.getLast())=="number")?b.pop():50;var c=this.slice();b.each(function(e){e=new a(e);for(var f=0;f<3;f++){c[f]=Math.round((c[f]/100*(100-d))+(e[f]/100*d));
}});return new a(c,"rgb");},invert:function(){return new a(this.map(function(b){return 255-b;}));},setHue:function(b){return new a([b,this.hsb[1],this.hsb[2]],"hsb");
},setSaturation:function(b){return new a([this.hsb[0],b,this.hsb[2]],"hsb");},setBrightness:function(b){return new a([this.hsb[0],this.hsb[1],b],"hsb");
}});this.$RGB=function(e,d,c){return new a([e,d,c],"rgb");};this.$HSB=function(e,d,c){return new a([e,d,c],"hsb");};this.$HEX=function(b){return new a(b,"hex"); }});this.$RGB=function(e,d,c){return new a([e,d,c],"rgb");};this.$HSB=function(e,d,c){return new a([e,d,c],"hsb");};this.$HEX=function(b){return new a(b,"hex");
};Array.implement({rgbToHsb:function(){var c=this[0],d=this[1],k=this[2],h=0;var j=Math.max(c,d,k),f=Math.min(c,d,k);var l=j-f;var i=j/255,g=(j!=0)?l/j:0; };Array.implement({rgbToHsb:function(){var c=this[0],d=this[1],k=this[2],h=0;var j=Math.max(c,d,k),f=Math.min(c,d,k);var l=j-f;var i=j/255,g=(j!=0)?l/j:0;
if(g!=0){var e=(j-c)/l;var b=(j-d)/l;var m=(j-k)/l;if(c==j){h=m-b;}else{if(d==j){h=2+e-m;}else{h=4+b-e;}}h/=6;if(h<0){h++;}}return[Math.round(h*360),Math.round(g*100),Math.round(i*100)]; if(g!=0){var e=(j-c)/l;var b=(j-d)/l;var m=(j-k)/l;if(c==j){h=m-b;}else{if(d==j){h=2+e-m;}else{h=4+b-e;}}h/=6;if(h<0){h++;}}return[Math.round(h*360),Math.round(g*100),Math.round(i*100)];
},hsbToRgb:function(){var d=Math.round(this[2]/100*255);if(this[1]==0){return[d,d,d];}else{var b=this[0]%360;var g=b%60;var h=Math.round((this[2]*(100-this[1]))/10000*255); },hsbToRgb:function(){var d=Math.round(this[2]/100*255);if(this[1]==0){return[d,d,d];}else{var b=this[0]%360;var g=b%60;var h=Math.round((this[2]*(100-this[1]))/10000*255);
var e=Math.round((this[2]*(6000-this[1]*g))/600000*255);var c=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(b/60)){case 0:return[d,c,h]; var e=Math.round((this[2]*(6000-this[1]*g))/600000*255);var c=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(b/60)){case 0:return[d,c,h];
case 1:return[e,d,h];case 2:return[h,d,c];case 3:return[h,e,d];case 4:return[c,h,d];case 5:return[d,h,e];}}return false;}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g); case 1:return[e,d,h];case 2:return[h,d,c];case 3:return[h,e,d];case 4:return[c,h,d];case 5:return[d,h,e];}}return false;}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g);
return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})(); return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})();(function(){var b=null,a={},e={};var d=function(g){if(instanceOf(g,f.Set)){return g;
}else{return a[g];}};var f=this.Locale={define:function(g,k,i,j){var h;if(instanceOf(g,f.Set)){h=g.name;if(h){a[h]=g;}}else{h=g;if(!a[h]){a[h]=new f.Set(h);
}g=a[h];}if(k){g.define(k,i,j);}if(k=="cascade"){return f.inherit(h,i);}if(!b){b=g;}return g;},use:function(g){g=d(g);if(g){b=g;this.fireEvent("change",g);
this.fireEvent("langChange",g.name);}return this;},getCurrent:function(){return b;},get:function(h,g){return(b)?b.get(h,g):"";},inherit:function(g,h,i){g=d(g);
if(g){g.inherit(h,i);}return this;},list:function(){return Object.keys(a);}};Object.append(f,new Events);f.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(g){this.name=g||"";
},define:function(j,h,i){var g=this.sets[j];if(!g){g={};}if(h){if(typeOf(h)=="object"){g=Object.merge(g,h);}else{g[h]=i;}}this.sets[j]=g;return this;},get:function(s,k,r){var q=Object.getFromPath(this.sets,s);
if(q!=null){var n=typeOf(q);if(n=="function"){q=q.apply(null,Array.from(k));}else{if(n=="object"){q=Object.clone(q);}}return q;}var j=s.indexOf("."),p=j<0?s:s.substr(0,j),m=(this.inherits.sets[p]||[]).combine(this.inherits.locales).include("en-US");
if(!r){r=[];}for(var h=0,g=m.length;h<g;h++){if(r.contains(m[h])){continue;}r.include(m[h]);var o=a[m[h]];if(!o){continue;}q=o.get(s,k,r);if(q!=null){return q;
}}return"";},inherit:function(h,i){h=Array.from(h);if(i&&!this.inherits.sets[i]){this.inherits.sets[i]=[];}var g=h.length;while(g--){(i?this.inherits.sets[i]:this.inherits.locales).unshift(h[g]);
}return this;}});var c=MooTools.lang={};Object.append(c,f,{setLanguage:f.use,getCurrentLanguage:function(){var g=f.getCurrent();return(g)?g.name:null;},set:function(){f.define.apply(this,arguments);
return this;},get:function(i,h,g){if(h){i+="."+h;}return f.get(i,g);}});})();

View File

@ -1,23 +1,26 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
Asset.javascript('../js/mindplot.svg.js', {
id: 'MindplotSVGLib',
$import("../js/mindplot.svg.js"); onLoad: function() {
afterMindpotLibraryLoading();
}
});
var designer = null; var designer = null;
/* JavaScript tabs changer */ /* JavaScript tabs changer */
@ -76,8 +79,7 @@ Tabs = {
if (div.className.match(/\btabContent\b/i)) { if (div.className.match(/\btabContent\b/i)) {
if (div.id == "_" + contentId) if (div.id == "_" + contentId)
div.style.display = "block"; div.style.display = "block";
else else {
{
divsToHide.push(div); divsToHide.push(div);
} }
} }
@ -102,8 +104,7 @@ Tabs = {
}, },
Init: function () { Init: function () {
if (!document.getElementsByTagName) if (!document.getElementsByTagName) {
{
return; return;
} }
@ -158,18 +159,15 @@ var contentId = window.location.hash || "#Introduction";
var iconPanel = null; var iconPanel = null;
function afterMindpotLibraryLoading() function afterMindpotLibraryLoading() {
{
buildMindmapDesigner(); buildMindmapDesigner();
if ($('helpButton') != null) if ($('helpButton') != null) {
{
var helpPanel = new Panel({panelButton:$('helpButton'), backgroundColor:'black'}); var helpPanel = new Panel({panelButton:$('helpButton'), backgroundColor:'black'});
helpPanel.setContent(Help.buildHelp(helpPanel)); helpPanel.setContent(Help.buildHelp(helpPanel));
} }
if ($('helpButtonFirstSteps') != null) if ($('helpButtonFirstSteps') != null) {
{
var firstStepsPanel = $('helpButtonFirstSteps') var firstStepsPanel = $('helpButtonFirstSteps')
firstStepsPanel.addEvent('click', function(event) { firstStepsPanel.addEvent('click', function(event) {
var firstStepWindow = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px"); var firstStepWindow = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
@ -179,8 +177,7 @@ function afterMindpotLibraryLoading()
}); });
} }
if ($('helpButtonKeyboard') != null) if ($('helpButtonKeyboard') != null) {
{
var keyboardPanel = $('helpButtonKeyboard') var keyboardPanel = $('helpButtonKeyboard')
keyboardPanel.addEvent('click', function(event) { keyboardPanel.addEvent('click', function(event) {
MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false) MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false)
@ -209,19 +206,15 @@ function afterMindpotLibraryLoading()
designer.redo(); designer.redo();
}); });
designer.addEventListener("change", function(event) { designer.addEventListener("change", function(event) {
if (event.undoSteps > 0) if (event.undoSteps > 0) {
{
$("undoEdition").setStyle("background-image", "url(../images/file_undo.png)"); $("undoEdition").setStyle("background-image", "url(../images/file_undo.png)");
} else } else {
{
$("undoEdition").setStyle("background-image", "url(../images/file_undo_dis.png)"); $("undoEdition").setStyle("background-image", "url(../images/file_undo_dis.png)");
} }
if (event.redoSteps > 0) if (event.redoSteps > 0) {
{
$("redoEdition").setStyle("background-image", "url(../images/file_redo.png)"); $("redoEdition").setStyle("background-image", "url(../images/file_redo.png)");
} else } else {
{
$("redoEdition").setStyle("background-image", "url(../images/file_redo_dis.png)"); $("redoEdition").setStyle("background-image", "url(../images/file_redo_dis.png)");
} }
@ -308,101 +301,87 @@ function afterMindpotLibraryLoading()
var saveButton = $('saveButton'); var saveButton = $('saveButton');
saveButton.addEvent('click', function(event) { saveButton.addEvent('click', function(event) {
if (!isTryMode) if (!isTryMode) {
{
saveButton.setStyle('cursor', 'wait'); saveButton.setStyle('cursor', 'wait');
var saveFunc = function() var saveFunc = function() {
{ designer.save(function() {
designer.save(function()
{
var monitor = core.Monitor.getInstance(); var monitor = core.Monitor.getInstance();
monitor.logMessage('Save completed successfully'); monitor.logMessage('Save completed successfully');
saveButton.setStyle('cursor', 'pointer'); saveButton.setStyle('cursor', 'pointer');
}, true); }, true);
} }
saveFunc.delay(1); saveFunc.delay(1);
} else } else {
{
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.<br/> to create an account click <a href="userRegistration.htm">here</a>', new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.<br/> to create an account click <a href="userRegistration.htm">here</a>',
{ {
'window': {theme:Windoo.Themes.wise, 'window': {theme:Windoo.Themes.wise,
title:'' title:''
} }
}); });
} }
}); });
var discardButton = $('discardButton'); var discardButton = $('discardButton');
discardButton.addEvent('click', function(event) { discardButton.addEvent('click', function(event) {
if (!isTryMode) if (!isTryMode) {
{
displayLoading(); displayLoading();
window.document.location = "mymaps.htm"; window.document.location = "mymaps.htm";
} else } else {
{
displayLoading(); displayLoading();
window.document.location = "home.htm"; window.document.location = "home.htm";
} }
}); });
if (isTryMode) if (isTryMode) {
{ $('tagIt').addEvent('click', function(event) {
$('tagIt').addEvent('click', function(event)
{
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.', new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
{ {
'window': {theme:Windoo.Themes.wise, 'window': {theme:Windoo.Themes.wise,
title:'' title:''
} }
}); });
}); });
$('shareIt').addEvent('click', function(event) $('shareIt').addEvent('click', function(event) {
{
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.', new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
{ {
'window': {theme:Windoo.Themes.wise, 'window': {theme:Windoo.Themes.wise,
title:'' title:''
} }
}); });
}); });
$('publishIt').addEvent('click', function(event) $('publishIt').addEvent('click', function(event) {
{
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.', new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
{ {
'window': {theme:Windoo.Themes.wise, 'window': {theme:Windoo.Themes.wise,
title:'' title:''
} }
}); });
}); });
$('history').addEvent('click', function(event) $('history').addEvent('click', function(event) {
{
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.', new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
{ {
'window': {theme:Windoo.Themes.wise, 'window': {theme:Windoo.Themes.wise,
title:'' title:''
} }
}); });
}); });
} }
// Autosave ... // Autosave ...
if (!isTryMode) if (!isTryMode) {
{
var autosave = function() { var autosave = function() {
if (designer.needsSave()) if (designer.needsSave()) {
{ designer.save(function() {
designer.save(function()
{
var monitor = core.Monitor.getInstance(); var monitor = core.Monitor.getInstance();
}, false); }, false);
} }
@ -410,10 +389,8 @@ function afterMindpotLibraryLoading()
autosave.periodical(30000); autosave.periodical(30000);
// To prevent the user from leaving the page with changes ... // To prevent the user from leaving the page with changes ...
window.onbeforeunload = function confirmExit() window.onbeforeunload = function confirmExit() {
{ if (designer.needsSave()) {
if (designer.needsSave())
{
designer.save(null, false) designer.save(null, false)
} }
} }
@ -424,10 +401,9 @@ function afterMindpotLibraryLoading()
fontSizePanel(); fontSizePanel();
// If not problem has occured, I close the dialod ... // If not problem has occured, I close the dialod ...
var closeDialog = function(){ var closeDialog = function() {
if(!window.hasUnexpectedErrors) if (!window.hasUnexpectedErrors) {
{
waitDialog.deactivate(); waitDialog.deactivate();
} }
}.delay(500); }.delay(500);
@ -436,15 +412,12 @@ function afterMindpotLibraryLoading()
function buildIconChooser() { function buildIconChooser() {
var content = new Element('div').setStyles({width:253,height:200,padding:5}); var content = new Element('div').setStyles({width:253,height:200,padding:5});
var count = 0; var count = 0;
for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1) for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1) {
{
var familyIcons = mindplot.ImageIcon.prototype.ICON_FAMILIES[i].icons; var familyIcons = mindplot.ImageIcon.prototype.ICON_FAMILIES[i].icons;
for (var j = 0; j < familyIcons.length; j = j + 1) for (var j = 0; j < familyIcons.length; j = j + 1) {
{
// Separate icons by line ... // Separate icons by line ...
var familyContent; var familyContent;
if ((count % 12) == 0) if ((count % 12) == 0) {
{
familyContent = new Element('div').inject(content); familyContent = new Element('div').inject(content);
} }
@ -466,18 +439,15 @@ function buildIconChooser() {
; ;
function setCurrentColorPicker(colorPicker) function setCurrentColorPicker(colorPicker) {
{
this.currentColorPicker = colorPicker; this.currentColorPicker = colorPicker;
} }
function removeCurrentColorPicker(colorPicker) function removeCurrentColorPicker(colorPicker) {
{
$clear(this.currentColorPicker); $clear(this.currentColorPicker);
} }
function buildMindmapDesigner() function buildMindmapDesigner() {
{
// Initialize message logger ... // Initialize message logger ...
var monitor = new core.Monitor($('msgLoggerContainer'), $('msgLogger')); var monitor = new core.Monitor($('msgLoggerContainer'), $('msgLogger'));
@ -506,8 +476,7 @@ function buildMindmapDesigner()
// Save map on load .... // Save map on load ....
if (editorProperties.saveOnLoad) if (editorProperties.saveOnLoad) {
{
var saveOnLoad = function() { var saveOnLoad = function() {
designer.save(function() { designer.save(function() {
}, false); }, false);
@ -517,8 +486,7 @@ function buildMindmapDesigner()
} }
; ;
function createColorPalette(container, onSelectFunction, event) function createColorPalette(container, onSelectFunction, event) {
{
cleanScreenEvent(); cleanScreenEvent();
_colorPalette = new core.ColorPicker(); _colorPalette = new core.ColorPicker();
_colorPalette.onSelect = function(color) { _colorPalette.onSelect = function(color) {
@ -534,10 +502,8 @@ function createColorPalette(container, onSelectFunction, event)
} }
; ;
function cleanScreenEvent() function cleanScreenEvent() {
{ if (this.currentColorPicker) {
if (this.currentColorPicker)
{
this.currentColorPicker.hide(); this.currentColorPicker.hide();
} }
$("fontFamilyPanel").setStyle('display', "none"); $("fontFamilyPanel").setStyle('display', "none");
@ -546,66 +512,53 @@ function cleanScreenEvent()
iconPanel.close(); iconPanel.close();
} }
function fontFamilyPanel() function fontFamilyPanel() {
{
var supportedFonts = ['times','arial','tahoma','verdana']; var supportedFonts = ['times','arial','tahoma','verdana'];
var updateFunction = function(value) var updateFunction = function(value) {
{
value = value.charAt(0).toUpperCase() + value.substring(1, value.length); value = value.charAt(0).toUpperCase() + value.substring(1, value.length);
designer.setFont2SelectedNode(value); designer.setFont2SelectedNode(value);
}; };
var onFocusValue = function(selectedNode) var onFocusValue = function(selectedNode) {
{
return selectedNode.getFontFamily(); return selectedNode.getFontFamily();
}; };
buildPanel('fontFamily', 'fontFamilyPanel', supportedFonts, updateFunction, onFocusValue); buildPanel('fontFamily', 'fontFamilyPanel', supportedFonts, updateFunction, onFocusValue);
} }
function shapeTypePanel() function shapeTypePanel() {
{
var shapeTypePanel = ['rectagle','rounded_rectagle','line','elipse']; var shapeTypePanel = ['rectagle','rounded_rectagle','line','elipse'];
var updateFunction = function(value) var updateFunction = function(value) {
{ designer.setShape2SelectedNode(value.replace('_', ' '));
designer.setShape2SelectedNode(value.replace('_',' '));
}; };
var onFocusValue = function(selectedNode) var onFocusValue = function(selectedNode) {
{
return selectedNode.getShapeType().replace(' ','_'); return selectedNode.getShapeType().replace(' ', '_');
}; };
buildPanel('topicShape', 'topicShapePanel', shapeTypePanel, updateFunction, onFocusValue); buildPanel('topicShape', 'topicShapePanel', shapeTypePanel, updateFunction, onFocusValue);
} }
function fontSizePanel() function fontSizePanel() {
{
var shapeTypePanel = ['small','normal','large','huge']; var shapeTypePanel = ['small','normal','large','huge'];
var map = {small:'6',normal:'8',large:'10',huge:'15'}; var map = {small:'6',normal:'8',large:'10',huge:'15'};
var updateFunction = function(value) var updateFunction = function(value) {
{
var nodes = designer.getSelectedNodes(); var nodes = designer.getSelectedNodes();
var value = map[value]; var value = map[value];
designer.setFontSize2SelectedNode(value); designer.setFontSize2SelectedNode(value);
}; };
var onFocusValue = function(selectedNode) var onFocusValue = function(selectedNode) {
{
var fontSize = selectedNode.getFontSize(); var fontSize = selectedNode.getFontSize();
var result = ""; var result = "";
if (fontSize <= 6) if (fontSize <= 6) {
{
result = 'small'; result = 'small';
} else if (fontSize <= 8) } else if (fontSize <= 8) {
{
result = 'normal'; result = 'normal';
} else if (fontSize <= 10) } else if (fontSize <= 10) {
{
result = 'large'; result = 'large';
} else if (fontSize >= 15) } else if (fontSize >= 15) {
{
result = 'huge'; result = 'huge';
} }
return result; return result;
@ -613,18 +566,15 @@ function fontSizePanel()
buildPanel('fontSize', 'fontSizePanel', shapeTypePanel, updateFunction, onFocusValue); buildPanel('fontSize', 'fontSizePanel', shapeTypePanel, updateFunction, onFocusValue);
} }
function buildPanel(buttonElemId, elemLinksContainer, elemLinkIds, updateFunction, onFocusValue) function buildPanel(buttonElemId, elemLinksContainer, elemLinkIds, updateFunction, onFocusValue) {
{
// Font family event handling .... // Font family event handling ....
$(buttonElemId).addEvent('click', function(event) $(buttonElemId).addEvent('click', function(event) {
{
var container = $(elemLinksContainer); var container = $(elemLinksContainer);
var isRendered = container.getStyle('display') == 'block'; var isRendered = container.getStyle('display') == 'block';
cleanScreenEvent(); cleanScreenEvent();
// Restore default css. // Restore default css.
for (var i = 0; i < elemLinkIds.length; i++) for (var i = 0; i < elemLinkIds.length; i++) {
{
var elementId = elemLinkIds[i]; var elementId = elemLinkIds[i];
$(elementId).className = 'toolbarPanelLink'; $(elementId).className = 'toolbarPanelLink';
} }
@ -632,8 +582,7 @@ function buildPanel(buttonElemId, elemLinksContainer, elemLinkIds, updateFunctio
// Select current element ... // Select current element ...
var nodes = designer.getSelectedNodes(); var nodes = designer.getSelectedNodes();
var lenght = nodes.length; var lenght = nodes.length;
if (lenght == 1) if (lenght == 1) {
{
var selectedNode = nodes[0]; var selectedNode = nodes[0];
var selectedElementId = onFocusValue(selectedNode); var selectedElementId = onFocusValue(selectedNode);
selectedElementId = selectedElementId.toLowerCase(); selectedElementId = selectedElementId.toLowerCase();
@ -644,23 +593,20 @@ function buildPanel(buttonElemId, elemLinksContainer, elemLinkIds, updateFunctio
container.setStyle('display', 'block'); container.setStyle('display', 'block');
var mouseCoords = core.Utils.getMousePosition(event); var mouseCoords = core.Utils.getMousePosition(event);
if (!isRendered) if (!isRendered) {
{
container.setStyle('left', (mouseCoords.x - 10) + "px"); container.setStyle('left', (mouseCoords.x - 10) + "px");
} }
}); });
var fontOnClick = function(event) var fontOnClick = function(event) {
{
var value = this.getAttribute('id'); var value = this.getAttribute('id');
updateFunction(value); updateFunction(value);
cleanScreenEvent(); cleanScreenEvent();
}; };
// Register event listeners on elements ... // Register event listeners on elements ...
for (var i = 0; i < elemLinkIds.length; i++) for (var i = 0; i < elemLinkIds.length; i++) {
{
var elementId = elemLinkIds[i]; var elementId = elemLinkIds[i];
$(elementId).addEvent('click', fontOnClick.bind($(elementId))); $(elementId).addEvent('click', fontOnClick.bind($(elementId)));
} }

View File

@ -1,30 +1,29 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
function afterCoreLoading() Asset.javascript('../js/mindplot.svg.js', {
{ id: 'MindplotSVGLib',
$import("../js/mindplot.svg-min.js"); onLoad: function() {
}; afterMindpotLibraryLoading();
}
});
afterCoreLoading(); function afterMindpotLibraryLoading() {
function afterMindpotLibraryLoading()
{
buildMindmapDesigner(); buildMindmapDesigner();
$('zoomIn').addEvent('click', function(event) { $('zoomIn').addEvent('click', function(event) {
@ -39,22 +38,19 @@ function afterMindpotLibraryLoading()
// If not problem has occured, I close the dialod ... // If not problem has occured, I close the dialod ...
var closeDialog = function() { var closeDialog = function() {
if (!window.hasUnexpectedErrors) if (!window.hasUnexpectedErrors) {
{
waitDialog.deactivate(); waitDialog.deactivate();
} }
}.delay(500); }.delay(500);
} }
function setCurrentColorPicker(colorPicker) function setCurrentColorPicker(colorPicker) {
{
this.currentColorPicker = colorPicker; this.currentColorPicker = colorPicker;
} }
function buildMindmapDesigner() function buildMindmapDesigner() {
{
var container = $('mindplot'); var container = $('mindplot');