mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
reimplementing persistence managers
This commit is contained in:
parent
da9f861333
commit
42d22ffcb4
@ -35,25 +35,21 @@ mindplot.LocalStorageManager = new Class({
|
|||||||
loadMapDom:function (mapId) {
|
loadMapDom:function (mapId) {
|
||||||
var xml = localStorage.getItem(mapId + "-xml");
|
var xml = localStorage.getItem(mapId + "-xml");
|
||||||
if (xml == null || this.forceLoad) {
|
if (xml == null || this.forceLoad) {
|
||||||
var xmlRequest = new Request({
|
$.ajax({
|
||||||
url:this.documentUrl.replace("{id}", mapId),
|
url:this.documentUrl.replace("{id}", mapId),
|
||||||
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
||||||
method:'get',
|
method:'get',
|
||||||
async:false,
|
async:false,
|
||||||
onSuccess:function (responseText) {
|
success:function (responseText) {
|
||||||
xml = responseText;
|
xml = responseText;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xmlRequest.send();
|
|
||||||
|
|
||||||
// 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) {
|
||||||
throw new Error("Map could not be loaded");
|
throw new Error("Map could not be loaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return xml;
|
||||||
var parser = new DOMParser();
|
|
||||||
return parser.parseFromString(xml, "text/xml");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unlockMap:function (mindmap) {
|
unlockMap:function (mindmap) {
|
||||||
|
@ -165,24 +165,22 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
loadMapDom:function (mapId) {
|
loadMapDom:function (mapId) {
|
||||||
// Let's try to open one from the local directory ...
|
// Let's try to open one from the local directory ...
|
||||||
var xml;
|
var xml;
|
||||||
var xmlRequest = new Request({
|
$.ajax({
|
||||||
url:this.documentUrl.replace("{id}", mapId) + "/xml",
|
url:this.documentUrl.replace("{id}", mapId) + "/xml",
|
||||||
method:'get',
|
method:'get',
|
||||||
async:false,
|
async:false,
|
||||||
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
||||||
onSuccess:function (responseText) {
|
success:function (responseText) {
|
||||||
xml = responseText;
|
xml = responseText;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xmlRequest.send();
|
|
||||||
|
|
||||||
// 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) {
|
||||||
throw new Error("Map could not be loaded");
|
throw new Error("Map could not be loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
var parser = new DOMParser();
|
return xml;
|
||||||
return parser.parseFromString(xml, "text/xml");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user