From 42d22ffcb4e8577d6b2897a3214769a35e2079cc Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Sun, 16 Mar 2014 16:56:44 -0300 Subject: [PATCH] reimplementing persistence managers --- mindplot/src/main/javascript/LocalStorageManager.js | 10 +++------- mindplot/src/main/javascript/RestPersistenceManager.js | 8 +++----- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/mindplot/src/main/javascript/LocalStorageManager.js b/mindplot/src/main/javascript/LocalStorageManager.js index c2bb142f..f3318aed 100644 --- a/mindplot/src/main/javascript/LocalStorageManager.js +++ b/mindplot/src/main/javascript/LocalStorageManager.js @@ -35,25 +35,21 @@ mindplot.LocalStorageManager = new Class({ loadMapDom:function (mapId) { var xml = localStorage.getItem(mapId + "-xml"); if (xml == null || this.forceLoad) { - var xmlRequest = new Request({ + $.ajax({ url:this.documentUrl.replace("{id}", mapId), headers:{"Content-Type":"text/plain","Accept":"application/xml"}, method:'get', async:false, - onSuccess:function (responseText) { + success:function (responseText) { xml = responseText; } }); - xmlRequest.send(); - // If I could not load it from a file, hard code one. if (xml == null) { throw new Error("Map could not be loaded"); } } - - var parser = new DOMParser(); - return parser.parseFromString(xml, "text/xml"); + return xml; }, unlockMap:function (mindmap) { diff --git a/mindplot/src/main/javascript/RestPersistenceManager.js b/mindplot/src/main/javascript/RestPersistenceManager.js index 9a6228a1..4eda6de5 100644 --- a/mindplot/src/main/javascript/RestPersistenceManager.js +++ b/mindplot/src/main/javascript/RestPersistenceManager.js @@ -165,24 +165,22 @@ mindplot.RESTPersistenceManager = new Class({ loadMapDom:function (mapId) { // Let's try to open one from the local directory ... var xml; - var xmlRequest = new Request({ + $.ajax({ url:this.documentUrl.replace("{id}", mapId) + "/xml", method:'get', async:false, headers:{"Content-Type":"text/plain","Accept":"application/xml"}, - onSuccess:function (responseText) { + success:function (responseText) { xml = responseText; } }); - xmlRequest.send(); // If I could not load it from a file, hard code one. if (xml == null) { throw new Error("Map could not be loaded"); } - var parser = new DOMParser(); - return parser.parseFromString(xml, "text/xml"); + return xml; } } );