mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
- Fix Link node
- Finish local storage support
This commit is contained in:
parent
334206ab19
commit
bc87d0f311
@ -43,7 +43,7 @@ mindplot.LocalStorageManager = new Class({
|
|||||||
|
|
||||||
// If I could not load it from a file, hard code one.
|
// If I could not load it from a file, hard code one.
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
xml = '<map name="6" version="pela"><topic central="true" text="General Status" id="1"/></map>';
|
throw "Map could not be loaded";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ mindplot.Topic = new Class({
|
|||||||
//Links
|
//Links
|
||||||
var links = model.getLinks();
|
var links = model.getLinks();
|
||||||
for (var i = 0; i < links.length; i++) {
|
for (var i = 0; i < links.length; i++) {
|
||||||
this._link = new mindplot.LinkIcon(links[i], this, designer);
|
this._link = new mindplot.LinkIcon(this,links[i]);
|
||||||
result.addIcon(this._link);
|
result.addIcon(this._link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,11 +211,9 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
|
|
||||||
this._idsMap = new Hash();
|
this._idsMap = new Hash();
|
||||||
// Start the loading process ...
|
// Start the loading process ...
|
||||||
var mindmap = new mindplot.model.Mindmap();
|
|
||||||
|
|
||||||
var version = rootElem.getAttribute("version");
|
var version = rootElem.getAttribute("version");
|
||||||
mindmap.setVersion(version);
|
|
||||||
|
|
||||||
|
var mindmap = new mindplot.model.Mindmap(mapId, version);
|
||||||
var children = rootElem.childNodes;
|
var children = rootElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
@ -342,7 +340,7 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
|
|
||||||
_deserializeIcon : function(domElem, topic) {
|
_deserializeIcon : function(domElem, topic) {
|
||||||
var icon = domElem.getAttribute("id");
|
var icon = domElem.getAttribute("id");
|
||||||
icon = icon.replace("images/","icons/legacy/");
|
icon = icon.replace("images/", "icons/legacy/");
|
||||||
return topic.createIcon(icon);
|
return topic.createIcon(icon);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -352,11 +350,11 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
|
|
||||||
_deserializeNote : function(domElem, topic) {
|
_deserializeNote : function(domElem, topic) {
|
||||||
var value = domElem.getAttribute("text");
|
var value = domElem.getAttribute("text");
|
||||||
if(!$defined(value)){
|
if (!$defined(value)) {
|
||||||
var children = domElem.childNodes;
|
var children = domElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if(child.nodeType == Node.CDATA_SECTION_NODE){
|
if (child.nodeType == Node.CDATA_SECTION_NODE) {
|
||||||
value = child.nodeValue;
|
value = child.nodeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
mindplot.model.Mindmap = new Class({
|
mindplot.model.Mindmap = new Class({
|
||||||
Extends: mindplot.model.IMindmap,
|
Extends: mindplot.model.IMindmap,
|
||||||
initialize : function() {
|
initialize : function(id, version) {
|
||||||
|
$assert(id, "Id can not be null");
|
||||||
this._branches = [];
|
this._branches = [];
|
||||||
this._description = null;
|
this._description = null;
|
||||||
this._version = null;
|
|
||||||
this._relationships = [];
|
this._relationships = [];
|
||||||
|
this._version = $defined(version) ? version : 'pela';
|
||||||
|
this._id = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDescription : function() {
|
getDescription : function() {
|
||||||
@ -33,12 +35,12 @@ mindplot.model.Mindmap = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getId : function() {
|
getId : function() {
|
||||||
return this._iconType;
|
return this._id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
setId : function(id) {
|
setId : function(id) {
|
||||||
this._iconType = id;
|
this._id = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
getVersion : function() {
|
getVersion : function() {
|
||||||
@ -109,3 +111,10 @@ mindplot.model.Mindmap = new Class({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mindplot.model.Mindmap.buildEmpty = function(mapId) {
|
||||||
|
var result = new mindplot.model.Mindmap(mapId);
|
||||||
|
var node = result.createNode(mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE, 0);
|
||||||
|
result.addBranch(node);
|
||||||
|
return result;
|
||||||
|
};
|
@ -25,7 +25,7 @@
|
|||||||
$(document).fireEvent('loadcomplete', 'brix');
|
$(document).fireEvent('loadcomplete', 'brix');
|
||||||
};
|
};
|
||||||
|
|
||||||
var mapId = '10'; // @todo: Must be changed ...
|
var mapId = 'mapId'; // @todo: Must be changed ...
|
||||||
var brixReady = false;
|
var brixReady = false;
|
||||||
var mindReady = false;
|
var mindReady = false;
|
||||||
var collab = 'standalone';
|
var collab = 'standalone';
|
||||||
@ -58,7 +58,14 @@
|
|||||||
|
|
||||||
// Load map from XML ...
|
// Load map from XML ...
|
||||||
var persitence = mindplot.PersitenceManager.getInstance();
|
var persitence = mindplot.PersitenceManager.getInstance();
|
||||||
var mindmap = persitence.load("map2");
|
var mindmap;
|
||||||
|
try {
|
||||||
|
mindmap = persitence.load(mapId);
|
||||||
|
} catch(e) {
|
||||||
|
// If the map could not be loaded, create a new empty map...
|
||||||
|
mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
|
||||||
|
}
|
||||||
|
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
|
|
||||||
// If not problem has arisen, close the dialog ...
|
// If not problem has arisen, close the dialog ...
|
||||||
|
Loading…
Reference in New Issue
Block a user