diff --git a/mindplot/src/main/javascript/Beta2PelaMigrator.js b/mindplot/src/main/javascript/Beta2PelaMigrator.js
index 1f8b6eaa..b4e6abcf 100644
--- a/mindplot/src/main/javascript/Beta2PelaMigrator.js
+++ b/mindplot/src/main/javascript/Beta2PelaMigrator.js
@@ -25,9 +25,9 @@ mindplot.Beta2PelaMigrator = new Class({
return this._pelaSerializer.toXML(mindmap);
},
- loadFromDom : function(dom,mapId) {
- $assert($defined(mapId),"mapId can not be null");
- var mindmap = this._betaSerializer.loadFromDom(dom);
+ loadFromDom : function(dom, mapId) {
+ $assert($defined(mapId), "mapId can not be null");
+ var mindmap = this._betaSerializer.loadFromDom(dom, mapId);
mindmap.setVersion(mindplot.ModelCodeName.PELA);
return mindmap;
}
diff --git a/mindplot/src/main/javascript/DesignerActionRunner.js b/mindplot/src/main/javascript/DesignerActionRunner.js
index 18881bb9..fb836e28 100644
--- a/mindplot/src/main/javascript/DesignerActionRunner.js
+++ b/mindplot/src/main/javascript/DesignerActionRunner.js
@@ -50,6 +50,7 @@ mindplot.DesignerActionRunner = new Class({
markAsChangeBase: function() {
return this._undoManager.markAsChangeBase();
},
+
hasBeenChanged: function() {
return this._undoManager.hasBeenChanged();
}
diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js
index cd8d3213..809df18d 100644
--- a/mindplot/src/main/javascript/MindmapDesigner.js
+++ b/mindplot/src/main/javascript/MindmapDesigner.js
@@ -61,9 +61,9 @@ mindplot.MindmapDesigner = new Class({
// To prevent the user from leaving the page with changes ...
$(window).addEvent('beforeunload', function () {
-// if (this.needsSave()) {
-// this.save(null, false)
-// }
+ if (this.needsSave()) {
+ this.save(null, false);
+ }
}.bind(this));
},
@@ -360,19 +360,24 @@ mindplot.MindmapDesigner = new Class({
},
needsSave : function() {
- return this._actionRunner.hasBeenChanged();
+
+ //@Todo: Review all this ...
+// return this._actionDispatcher.hasBeenChanged();
+ return true;
},
save : function(onSavedHandler, saveHistory) {
- var persistantManager = mindplot.PersistanceManager;
- var mindmap = this._mindmap;
-
+ var mindmap = this.getMindmap();
var properties = {zoom:this.getModel().getZoom(), layoutManager:this._layoutManager.getClassName()};
+
+ var persistantManager = mindplot.PersistanceManager;
persistantManager.save(mindmap, properties, onSavedHandler, saveHistory);
this.fireEvent("save", {type:saveHistory});
// Refresh undo state...
- this._actionRunner.markAsChangeBase();
+ //@Todo: Review all this. It should not be here ...
+
+// this._actionDispatcher.markAsChangeBase();
},
diff --git a/mindplot/src/main/javascript/PersistanceManager.js b/mindplot/src/main/javascript/PersistanceManager.js
index 705079b9..6eae9330 100644
--- a/mindplot/src/main/javascript/PersistanceManager.js
+++ b/mindplot/src/main/javascript/PersistanceManager.js
@@ -1,73 +1,69 @@
/*
-* 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.
-*/
+ * 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.
+ */
mindplot.PersistanceManager = {};
-mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHandler,saveHistory)
-{
+mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHandler, saveHistory) {
$assert(mindmap, "mindmap can not be null");
$assert(editorProperties, "editorProperties can not be null");
var mapId = mindmap.getId();
+ $assert(mapId, "mapId can not be null");
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap(mindmap);
var xmlMap = serializer.toXML(mindmap);
var xmlMapStr = core.Utils.innerXML(xmlMap);
- var pref = JSON.toString(editorProperties);
- window.MapEditorService.saveMap(mapId, xmlMapStr, pref,saveHistory,
- {
- callback:function(response) {
+ var pref = JSON.encode(editorProperties);
- if (response.msgCode != "OK")
- {
- monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
+ window.MapEditorService.saveMap(mapId, xmlMapStr, pref, saveHistory,
+ {
+ callback:function(response) {
+
+ if (response.msgCode != "OK") {
+ monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
// wLogger.error(response.msgDetails);
- } else
- {
- // Execute on success handler ...
- if ($defined(onSavedHandler))
- {
- onSavedHandler();
+ } else {
+ // Execute on success handler ...
+ if ($defined(onSavedHandler)) {
+ onSavedHandler();
+ }
}
- }
- },
- errorHandler:function(message) {
- var monitor = core.Monitor.getInstance();
- monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
+ },
+ errorHandler:function(message) {
+ var monitor = core.Monitor.getInstance();
+ monitor.logError("Save could not be completed. Please,try again in a couple of minutes.");
// wLogger.error(message);
- },
- verb:"POST",
- async: false
- });
+ },
+ verb:"POST",
+ async: false
+ });
};
-mindplot.PersistanceManager.load = function(mapId)
-{
+mindplot.PersistanceManager.load = function(mapId) {
$assert(mapId, "mapId can not be null");
var result = {r:null};
window.MapEditorService.loadMap(mapId, {
callback:function(response) {
- if (response.msgCode == "OK")
- {
+ if (response.msgCode == "OK") {
// Explorer Hack with local files ...
var xmlContent = response.content;
var domDocument = core.Utils.createDocumentFromText(xmlContent);
@@ -76,8 +72,7 @@ mindplot.PersistanceManager.load = function(mapId)
mindmap.setId(mapId);
result.r = mindmap;
- } else
- {
+ } else {
// Handle error message ...
var msg = response.msgDetails;
var monitor = core.Monitor.getInstance();
diff --git a/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js b/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js
index c29c22b4..40b89886 100644
--- a/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js
+++ b/mindplot/src/main/javascript/XMLMindmapSerializer_Beta.js
@@ -157,8 +157,10 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
return noteDom;
},
- loadFromDom : function(dom) {
+ loadFromDom : function(dom, mapId) {
$assert(dom, "Dom can not be null");
+ $assert(mapId, "mapId can not be null");
+
var rootElem = dom.documentElement;
// Is a wisemap?.
@@ -175,6 +177,7 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
mindmap.addBranch(topic);
}
}
+ mindmap.setId(mapId);
return mindmap;
},
diff --git a/mindplot/src/main/javascript/XMLMindmapSerializer_Pela.js b/mindplot/src/main/javascript/XMLMindmapSerializer_Pela.js
index 09015b13..bdfb4aea 100644
--- a/mindplot/src/main/javascript/XMLMindmapSerializer_Pela.js
+++ b/mindplot/src/main/javascript/XMLMindmapSerializer_Pela.js
@@ -198,8 +198,10 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
return relationDom;
},
- loadFromDom : function(dom) {
- $assert(dom, "Dom can not be null");
+ loadFromDom : function(dom, mapId) {
+ $assert(dom, "dom can not be null");
+ $assert(mapId, "mapId can not be null");
+
var rootElem = dom.documentElement;
// Is a wisemap?.
@@ -230,6 +232,7 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
}
}
this._idsMap = null;
+ mindmap.setId(mapId);
return mindmap;
},
diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js
index 6511242c..a369222c 100644
--- a/mindplot/src/main/javascript/widget/Menu.js
+++ b/mindplot/src/main/javascript/widget/Menu.js
@@ -17,7 +17,7 @@
*/
mindplot.widget.Menu = new Class({
- initialize : function(designer, containerId) {
+ initialize : function(designer, containerId, readOnly) {
$assert(designer, "designer can not be null");
$assert(containerId, "containerId can not be null");
// @Todo: Remove hardcode ...
@@ -256,6 +256,89 @@ mindplot.widget.Menu = new Class({
}
});
+
+ var saveElem = $('saveButton');
+ if (saveElem) {
+ saveElem.addEvent('click', function() {
+
+ if (!readOnly) {
+ $('saveButton').setStyle('cursor', 'wait');
+ (function() {
+ designer.save(function() {
+// var monitor = core.Monitor.getInstance();
+// monitor.logMessage('Save completed successfully');
+
+ saveElem.setStyle('cursor', 'pointer');
+ }, true);
+ }).delay(1);
+ } else {
+ new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.
to create an account click here',
+ {
+ 'window': {theme:Windoo.Themes.wise,
+ title:''
+ }
+ });
+ }
+ });
+ }
+
+ var discartElem = $('discartElem');
+ if (discartElem) {
+ discartElem.addEvent('click', function() {
+
+ if (!readOnly) {
+ displayLoading();
+ window.document.location = "mymaps.htm";
+ } else {
+ displayLoading();
+ window.document.location = "home.htm";
+ }
+ });
+ }
+
+ if (readOnly) {
+ $('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.',
+ {
+ 'window': {theme:Windoo.Themes.wise,
+ title:''
+ }
+ });
+
+ });
+
+ $('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.',
+ {
+ 'window': {theme:Windoo.Themes.wise,
+ title:''
+ }
+ });
+
+ });
+
+ $('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.',
+ {
+ 'window': {theme:Windoo.Themes.wise,
+ title:''
+ }
+ });
+
+ });
+
+ $('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.',
+ {
+ 'window': {theme:Windoo.Themes.wise,
+ title:''
+ }
+ });
+
+ });
+
+ }
+
},
clear : function() {
diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml
index 024c84a4..83654bb0 100644
--- a/wise-webapp/pom.xml
+++ b/wise-webapp/pom.xml
@@ -399,7 +399,7 @@
help.js
- helpPanel.js
+ Panel.js
diff --git a/wise-webapp/src/main/webapp/js/helpPanel.js b/wise-webapp/src/main/webapp/js/Panel.js
similarity index 100%
rename from wise-webapp/src/main/webapp/js/helpPanel.js
rename to wise-webapp/src/main/webapp/js/Panel.js
diff --git a/wise-webapp/src/main/webapp/js/editor.js b/wise-webapp/src/main/webapp/js/editor.js
index ff585e92..e4e70f3d 100644
--- a/wise-webapp/src/main/webapp/js/editor.js
+++ b/wise-webapp/src/main/webapp/js/editor.js
@@ -183,86 +183,6 @@ function setUpToolbar(designer, isTryMode) {
});
}
- // Save event handler ....
- var saveButton = $('saveButton');
- saveButton.addEvent('click', function(event) {
-
- if (!isTryMode) {
- // @todo: This must be fixed ...
-// saveButton.setStyle('cursor', 'wait');
-// var saveFunc = function() {
-// designer.save(function() {
-// var monitor = core.Monitor.getInstance();
-// monitor.logMessage('Save completed successfully');
-// saveButton.setStyle('cursor', 'pointer');
-// }, true);
-// };
-// saveFunc.delay(1);
- } else {
- new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.
to create an account click here',
- {
- 'window': {theme:Windoo.Themes.wise,
- title:''
- }
- });
- }
- });
-
- var discardButton = $('discardButton');
- discardButton.addEvent('click', function(event) {
-
- if (!isTryMode) {
- displayLoading();
- window.document.location = "mymaps.htm";
- } else {
- displayLoading();
- window.document.location = "home.htm";
- }
- });
-
- if (isTryMode) {
- $('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.',
- {
- 'window': {theme:Windoo.Themes.wise,
- title:''
- }
- });
-
- });
-
- $('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.',
- {
- 'window': {theme:Windoo.Themes.wise,
- title:''
- }
- });
-
- });
-
- $('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.',
- {
- 'window': {theme:Windoo.Themes.wise,
- title:''
- }
- });
-
- });
-
- $('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.',
- {
- 'window': {theme:Windoo.Themes.wise,
- title:''
- }
- });
-
- });
-
- }
-
// Autosave ...
if (!isTryMode) {
(function() {
diff --git a/wise-webapp/src/main/webapp/js/transcorners.js b/wise-webapp/src/main/webapp/js/transcorners.js
deleted file mode 100644
index 11e25aea..00000000
--- a/wise-webapp/src/main/webapp/js/transcorners.js
+++ /dev/null
@@ -1,119 +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.
-*/
-
-/* transcorners : Yaroslaff Fedin (inviz.ru). updates : [url=http://forum.mootools.net/topic.php?id=1202]http://forum.mootools.net/topic.php?id=1202[/url] */
-
-var Transcorner = new Class({
- setOptions: function(options) {
- this.options = Object.extend({
- radius: 10,
- borderColor: null,
- backgroundColor: this.el.getStyle('background-color'),
- transition: this.fx,
- onComplete: Class.empty
- }, options || {});
- }
- ,initialize: function(el, sides, options) {
- this.el = $(el);
- if (!sides || $type(sides) == 'object') {
- options = sides || false;
- sides = 'top, bottom';
- }
- ;
- this.setOptions(options);
- sides.split(',').each(function(side) {
- side = side.clean().test(' ') ? side.clean().split(' ') : [side.trim()];
- this.assemble(side[0], side[1]);
- }, this);
-}
- ,fx: function(pos) {
- return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1);
-}
- ,assemble: function(vertical, horizontal) {
- var corner;
- var el = this.el;
- while ((el = el.getParent()) && el.getTag() != 'html' && [false, 'transparent'].test(corner = el.getStyle('background-color'))) {
- }
- ;
- var s = function(property, dontParse) {
- return !dontParse ? (parseInt(this.el.getStyle(property)) || 0) : this.el.getStyle(property);
- }.bind(this);
- var sides = {
- left:'right',
- right:'left'
- };
- var styles = {
- display: 'block',
- backgroundColor: corner,
- zIndex: 1,
- position: 'relative',
- zoom: 1
- };
- for (side in sides) {
- styles['margin-' + side] = "-" + (s('padding-' + side) + s('border-' + side + '-width')) + "px";
- }
- for (side in {top:1, bottom:1}) {
- styles['margin-' + side] = vertical == side ? "0" : (s('padding-' + vertical) - this.options.radius) + "px";
- }
- var handler = new Element("b").setStyles(styles).addClass('corner-container');
- this.options.borderColor = this.options.borderColor || (s('border-' + vertical + '-width') > 0 ? s('border-' + vertical + '-color', 1) : this.options.backgroundColor);
- this.el.setStyle('border-' + vertical, '0').setStyle('padding-' + vertical, '0');
- var stripes = [];
- var borders = {};
- var exMargin = 0;
- for (side in sides) {
- borders[side] = s('border-' + side + '-width', 1) + " " + s('border-' + side + '-style', 1) + " " + s('border-' + side + '-color', 1);
- }
- for (var i = 1; i < this.options.radius; i++) {
- margin = Math.round(this.options.transition((this.options.radius - i) / this.options.radius) * this.options.radius);
- var styles = {
- background: i == 1 ? this.options.borderColor : this.options.backgroundColor,
- display: 'block',
- height: '1px',
- overflow: 'hidden',
- zoom: 1
- };
- for (side in sides) {
- var check = horizontal == sides[side];
- styles['border-' + side] = check ? borders[side] : (((exMargin || margin) - margin) || 1) + 'px solid ' + this.options.borderColor;
- styles['margin-' + side] = check ? 0 : margin + 'px';
- }
- ;
- exMargin = margin;
- stripes.push(new Element("b").setStyles(styles).addClass('corner'));
- }
- ;
- if (vertical == 'top') {
- this.el.insertBefore(handler, this.el.firstChild);
- }
- else {
- handler.injectInside(this.el);
- stripes = stripes.reverse();
- }
- ;
- stripes.each(function(stripe) {
- stripe.injectInside(handler);
- });
- this.options.onComplete();
-}
-});
-Element.extend({
- makeRounded: function(side, options) {
- return new Transcorner(this, side, options);
- }
-});
\ No newline at end of file