mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-12 07:10:07 +02: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 (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
|
||||
var links = model.getLinks();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -211,11 +211,9 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
||||
|
||||
this._idsMap = new Hash();
|
||||
// Start the loading process ...
|
||||
var mindmap = new mindplot.model.Mindmap();
|
||||
|
||||
var version = rootElem.getAttribute("version");
|
||||
mindmap.setVersion(version);
|
||||
|
||||
var mindmap = new mindplot.model.Mindmap(mapId, version);
|
||||
var children = rootElem.childNodes;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
|
@ -17,11 +17,13 @@
|
||||
*/
|
||||
mindplot.model.Mindmap = new Class({
|
||||
Extends: mindplot.model.IMindmap,
|
||||
initialize : function() {
|
||||
initialize : function(id, version) {
|
||||
$assert(id, "Id can not be null");
|
||||
this._branches = [];
|
||||
this._description = null;
|
||||
this._version = null;
|
||||
this._relationships = [];
|
||||
this._version = $defined(version) ? version : 'pela';
|
||||
this._id = id;
|
||||
},
|
||||
|
||||
getDescription : function() {
|
||||
@ -33,12 +35,12 @@ mindplot.model.Mindmap = new Class({
|
||||
},
|
||||
|
||||
getId : function() {
|
||||
return this._iconType;
|
||||
return this._id;
|
||||
},
|
||||
|
||||
|
||||
setId : function(id) {
|
||||
this._iconType = id;
|
||||
this._id = id;
|
||||
},
|
||||
|
||||
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');
|
||||
};
|
||||
|
||||
var mapId = '10'; // @todo: Must be changed ...
|
||||
var mapId = 'mapId'; // @todo: Must be changed ...
|
||||
var brixReady = false;
|
||||
var mindReady = false;
|
||||
var collab = 'standalone';
|
||||
@ -58,7 +58,14 @@
|
||||
|
||||
// Load map from XML ...
|
||||
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);
|
||||
|
||||
// If not problem has arisen, close the dialog ...
|
||||
|
Loading…
Reference in New Issue
Block a user