diff --git a/core-js/src/main/javascript/Utils.js b/core-js/src/main/javascript/Utils.js index b0ec160d..daf5591b 100644 --- a/core-js/src/main/javascript/Utils.js +++ b/core-js/src/main/javascript/Utils.js @@ -1,64 +1,61 @@ - /* - * 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.Utils = { - -}; - - -core.Utils.innerXML = function(/*Node*/node) { - // summary: - // Implementation of MS's innerXML function. - if ($defined(node.innerXML)) { - return node.innerXML; - // string - } else if ($defined(node.xml)) { - return node.xml; - // string - } else if ($defined(XMLSerializer)) { - return (new XMLSerializer()).serializeToString(node); - // string - } -}; - -core.Utils.createDocument = function() { - // summary: - // cross-browser implementation of creating an XML document object. - var doc = null; - var _document = window.document; - if ($defined(window.ActiveXObject)) { - var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ]; - for (var i = 0; i < prefixes.length; i++) { - try { - doc = new ActiveXObject(prefixes[i] + ".XMLDOM"); - } catch(e) { /* squelch */ - } - - - if ($defined(doc)) { - break; - } - } - } else if ((_document.implementation) && - (_document.implementation.createDocument)) { - doc = _document.implementation.createDocument("", "", null); - } - - return doc; - // DOMDocument +/* + * 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.Utils = { + +}; + + +core.Utils.innerXML = function (node) { + // summary: + // Implementation of MS's innerXML function. + if ($defined(node.innerXML)) { + return node.innerXML; + // string + } else if ($defined(node.xml)) { + return node.xml; + // string + } else if ($defined(XMLSerializer)) { + return (new XMLSerializer()).serializeToString(node); + // string + } +}; + +/** + * Cross-browser implementation of creating an XML document object. + */ +core.Utils.createDocument = function () { + var doc = null; + if ($defined(window.ActiveXObject)) { + //http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx + var progIDs = [ 'Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.3.0']; + for (var i = 0; i < progIDs.length; i++) { + try { + doc = new ActiveXObject(progIDs[i]); + break; + } + catch (ex) { + } + } + } else if (window.document.implementation && window.document.implementation.createDocument) { + doc = window.document.implementation.createDocument("", "", null); + } + $asser(doc, "Parser could not be instantiated"); + + return doc; }; \ No newline at end of file diff --git a/mindplot/src/main/javascript/NoteIcon.js b/mindplot/src/main/javascript/NoteIcon.js index 9c39c07f..b6ae4562 100644 --- a/mindplot/src/main/javascript/NoteIcon.js +++ b/mindplot/src/main/javascript/NoteIcon.js @@ -47,7 +47,7 @@ mindplot.NoteIcon = new Class({ var result = new Element('div'); result.setStyles({padding:'5px'}); - var title = new Element('div', {text:'Note'}); + var title = new Element('div', {text:$msg('NOTE')}); title.setStyles({ 'font-weight':'bold', color:'black', diff --git a/mindplot/src/main/javascript/widget/FloatingTip.js b/mindplot/src/main/javascript/widget/FloatingTip.js index 574a307e..87d1483b 100644 --- a/mindplot/src/main/javascript/widget/FloatingTip.js +++ b/mindplot/src/main/javascript/widget/FloatingTip.js @@ -17,37 +17,37 @@ */ mindplot.widget.FloatingTip = new Class({ - Implements: [Options, Events], + Implements:[Options, Events], - options: { - position: 'top', - center: true, - content: 'title', - html: false, - balloon: true, - arrowSize: 6, - arrowOffset: 6, - distance: 7, - motion: 40, - motionOnShow: true, - motionOnHide: true, - showOn: 'mouseenter', - hideOn: 'mouseleave', - showDelay: 500, - hideDelay: 250, - className: 'floating-tip', - offset: {x: 0, y: 0}, - preventHideOnOver: true, - fx: { 'duration': 'short' } + options:{ + position:'top', + center:true, + content:'title', + html:false, + balloon:true, + arrowSize:6, + arrowOffset:6, + distance:7, + motion:40, + motionOnShow:true, + motionOnHide:true, + showOn:'mouseenter', + hideOn:'mouseleave', + showDelay:500, + hideDelay:250, + className:'floating-tip', + offset:{x:0, y:0}, + preventHideOnOver:true, + fx:{ 'duration':'short' } }, - initialize: function(element, options) { + initialize:function (element, options) { this.setOptions(options); - this.boundShow = function() { + this.boundShow = function () { this.show(element); }.bind(this); - this.boundHide = function() { + this.boundHide = function () { this.hide(element); }.bind(this); @@ -56,7 +56,7 @@ mindplot.widget.FloatingTip = new Class({ this.attach(element); }, - attach: function(element) { + attach:function (element) { if (element.retrieve('hasEvents') !== null) { return; } @@ -65,11 +65,13 @@ mindplot.widget.FloatingTip = new Class({ element.store('hasEvents', true); }, - show: function(element) { + show:function (element) { var old = element.retrieve('floatingtip'); - if (old) if (old.getStyle('opacity') == 1) { - clearTimeout(old.retrieve('timeout')); - return this; + if (old){ + if (old.getStyle('opacity') == 1) { + clearTimeout(old.retrieve('timeout')); + return this; + } } var tip = this._create(element); if (tip == null) @@ -87,7 +89,7 @@ mindplot.widget.FloatingTip = new Class({ return this; }, - hide: function(element) { + hide:function (element) { var tip = element.retrieve('floatingtip'); if (!tip) { if (this.options.position == 'inside') { @@ -96,7 +98,8 @@ mindplot.widget.FloatingTip = new Class({ tip = element.retrieve('floatingtip'); } catch (x) { } - if (!tip) return this; + if (!tip) + return this; } else { return this; } @@ -106,7 +109,7 @@ mindplot.widget.FloatingTip = new Class({ return this; }, - _create: function(elem) { + _create:function (elem) { var o = this.options; var oc = o.content; @@ -114,13 +117,14 @@ mindplot.widget.FloatingTip = new Class({ if (oc == 'title') { oc = 'floatingtitle'; - if (!elem.get('floatingtitle')) elem.setProperty('floatingtitle', elem.get('title')); + if (!elem.get('floatingtitle')) + elem.setProperty('floatingtitle', elem.get('title')); elem.set('title', ''); } var cnt = (typeof(oc) == 'string' ? elem.get(oc) : oc(elem)); var cwr = new Element('div').addClass(o.className).setStyle('margin', 0); - var tip = new Element('div').addClass(o.className + '-wrapper').setStyles({ 'margin': 0, 'padding': 0, 'z-index': cwr.getStyle('z-index') }).adopt(cwr); + var tip = new Element('div').addClass(o.className + '-wrapper').setStyles({ 'margin':0, 'padding':0, 'z-index':cwr.getStyle('z-index') }).adopt(cwr); if (cnt) { if (o.html) @@ -132,12 +136,12 @@ mindplot.widget.FloatingTip = new Class({ } var body = document.id(document.body); - tip.setStyles({ 'position': 'absolute', 'opacity': 0, 'top': 0, 'left': 0 }).inject(body); + tip.setStyles({ 'position':'absolute', 'opacity':0, 'top':0, 'left':0 }).inject(body); if (o.balloon && !Browser.ie6) { - var trg = new Element('div').addClass(o.className + '-triangle').setStyles({ 'margin': 0, 'padding': 0 }); - var trgSt = { 'border-color': cwr.getStyle('background-color'), 'border-width': o.arrowSize, 'border-style': 'solid','width': 0, 'height': 0 }; + var trg = new Element('div').addClass(o.className + '-triangle').setStyles({ 'margin':0, 'padding':0 }); + var trgSt = { 'border-color':cwr.getStyle('background-color'), 'border-width':o.arrowSize, 'border-style':'solid', 'width':0, 'height':0 }; switch (opos) { case 'inside': @@ -191,12 +195,12 @@ mindplot.widget.FloatingTip = new Class({ trgC.height = !$defined(trgC.height) ? 0 : trgC.height; trgC.width = !$defined(trgC.width) ? 0 : trgC.width; - var pos = { x: trgC.left + o.offset.x, y: trgC.top + o.offset.y }; + var pos = { x:trgC.left + o.offset.x, y:trgC.top + o.offset.y }; if (opos == 'inside') { - tip.setStyles({ 'width': tip.getStyle('width'), 'height': tip.getStyle('height') }); + tip.setStyles({ 'width':tip.getStyle('width'), 'height':tip.getStyle('height') }); elem.setStyle('position', 'relative').adopt(tip); - pos = { x: o.offset.x, y: o.offset.y }; + pos = { x:o.offset.x, y:o.offset.y }; } else { switch (opos) { case 'top': @@ -232,19 +236,19 @@ mindplot.widget.FloatingTip = new Class({ } tip.set('morph', o.fx).store('position', pos); - tip.setStyles({ 'top': pos.y, 'left': pos.x }); + tip.setStyles({ 'top':pos.y, 'left':pos.x }); return tip; }, - _animate: function(tip, d) { + _animate:function (tip, d) { clearTimeout(tip.retrieve('timeout')); - tip.store('timeout', (function(t) { + tip.store('timeout', (function (t) { var o = this.options, din = (d == 'in'); - var m = { 'opacity': din ? 1 : 0 }; + var m = { 'opacity':din ? 1 : 0 }; if ((o.motionOnShow && din) || (o.motionOnHide && !din)) { var pos = t.retrieve('position'); @@ -267,7 +271,7 @@ mindplot.widget.FloatingTip = new Class({ } t.morph(m); - if (!din) t.get('morph').chain(function() { + if (!din) t.get('morph').chain(function () { this.dispose(); }.bind(t)); diff --git a/mindplot/src/main/javascript/widget/LinkIconTooltip.js b/mindplot/src/main/javascript/widget/LinkIconTooltip.js index 5a774045..8ca0141a 100644 --- a/mindplot/src/main/javascript/widget/LinkIconTooltip.js +++ b/mindplot/src/main/javascript/widget/LinkIconTooltip.js @@ -17,70 +17,70 @@ */ mindplot.widget.LinkIconTooltip = new Class({ - Extends: mindplot.widget.FloatingTip, + Extends:mindplot.widget.FloatingTip, - initialize : function(linkIcon) { + initialize:function (linkIcon) { $assert(linkIcon, "linkIcon can not be null"); this.parent(linkIcon.getImage()._peer._native, { // Content can also be a function of the target element! - content: this._buildContent.pass(linkIcon, this), - html: true, - position: 'bottom', - arrowOffset : 10, - center: true, - arrowSize: 15, - offset : {x:10,y:20}, - className: 'linkTip' + content:this._buildContent.pass(linkIcon, this), + html:true, + position:'bottom', + arrowOffset:10, + center:true, + arrowSize:15, + offset:{x:10, y:20}, + className:'linkTip' }); }, - _buildContent : function(linkIcon) { + _buildContent:function (linkIcon) { var result = new Element('div'); result.setStyles({ padding:'5px', width:'100%' }); - var title = new Element('div', {text:'Link'}); + var title = new Element('div', {text:$msg('LINK')}); title.setStyles({ 'font-weight':'bold', color:'black', 'padding-bottom':'5px', - width: '100px' + width:'100px' }); title.inject(result); - var text = new Element('div', {text: "URL: " + linkIcon.getModel().getUrl()}); + var text = new Element('div', {text:"URL: " + linkIcon.getModel().getUrl()}); text.setStyles({ - 'white-space': 'pre-wrap', - 'word-wrap': 'break-word' + 'white-space':'pre-wrap', + 'word-wrap':'break-word' } ); text.inject(result); var imgContainer = new Element('div'); imgContainer.setStyles({ - width: '100%', - textAlign: 'right', + width:'100%', + textAlign:'right', 'padding-bottom':'5px', - 'padding-top': '5px' + 'padding-top':'5px' }); var img = new Element('img', { - src: 'http://open.thumbshots.org/image.pxf?url=' + linkIcon.getModel().getUrl(), - img : linkIcon.getModel().getUrl(), - alt : linkIcon.getModel().getUrl() + src:'http://open.thumbshots.org/image.pxf?url=' + linkIcon.getModel().getUrl(), + img:linkIcon.getModel().getUrl(), + alt:linkIcon.getModel().getUrl() } ); img.setStyles({ - padding: '5px' + padding:'5px' } ); var link = new Element('a', { - href : linkIcon.getModel().getUrl(), - alt : 'Open in new window ...', - target : '_blank' + href:linkIcon.getModel().getUrl(), + alt:'Open in new window ...', + target:'_blank' }); img.inject(link); diff --git a/mindplot/src/main/resources/messages_en.properties b/mindplot/src/main/resources/messages_en.properties index 15538fe6..b4bccfac 100644 --- a/mindplot/src/main/resources/messages_en.properties +++ b/mindplot/src/main/resources/messages_en.properties @@ -54,4 +54,5 @@ WRITE_YOUR_TEXT_HERE=Write your note here ... REMOVE=Remove ACCEPT=Accept CANCEL=Cancel +LINK=Link diff --git a/mindplot/src/main/resources/messages_es.properties b/mindplot/src/main/resources/messages_es.properties index 0132ff78..c7c78122 100644 --- a/mindplot/src/main/resources/messages_es.properties +++ b/mindplot/src/main/resources/messages_es.properties @@ -54,4 +54,5 @@ SELECTION_COPIED_TO_CLIPBOARD=Tópicos copiados al clipboard WRITE_YOUR_TEXT_HERE=Escribe tu nota aquí ... REMOVE=Borrar ACCEPT=Aceptar -CANCEL=Cancelar \ No newline at end of file +CANCEL=Cancelar +LINK=Enlace \ No newline at end of file diff --git a/mindplot/src/main/resources/messages_fr.properties b/mindplot/src/main/resources/messages_fr.properties index 857e5f27..48f53b3d 100644 --- a/mindplot/src/main/resources/messages_fr.properties +++ b/mindplot/src/main/resources/messages_fr.properties @@ -58,3 +58,4 @@ ACCEPT=Accepter CANCEL=Annuler REMOVE=Supprimer WRITE_YOUR_TEXT_HERE=Écrivez votre texte ici ... +LINK=Lien