mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 12:30:44 +02:00
Implement LocalStorage manager ...
This commit is contained in:
parent
410d3553b1
commit
a33daf4563
@ -108,7 +108,7 @@
|
||||
files="XMLMindmapSerializerFactory.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="DwrPersistenceManager.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="FilePersistenceManager.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="BubbleTip.js"/>
|
||||
@ -151,22 +151,22 @@
|
||||
files="commands/AddRelationshipCommand.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="commands/MoveControlPointCommand.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="commands/freeMind/DragTopicCommand.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="commands/freeMind/ReconnectTopicCommand.js"/>
|
||||
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||
<!--files="commands/freeMind/DragTopicCommand.js"/>-->
|
||||
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||
<!--files="commands/freeMind/ReconnectTopicCommand.js"/>-->
|
||||
|
||||
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="layout/boards/Board.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="layout/boards/freemind/Board.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="layout/boards/freemind/Entry.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="layout/boards/freemind/CentralTopicBoard.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="layout/boards/freemind/MainTopicBoard.js"/>
|
||||
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||
<!--files="layout/boards/freemind/Board.js"/>-->
|
||||
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||
<!--files="layout/boards/freemind/Entry.js"/>-->
|
||||
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||
<!--files="layout/boards/freemind/CentralTopicBoard.js"/>-->
|
||||
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||
<!--files="layout/boards/freemind/MainTopicBoard.js"/>-->
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="layout/BaseLayoutManager.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
|
@ -41,7 +41,7 @@ mindplot.DwrPersitenceManager = new Class({
|
||||
)
|
||||
},
|
||||
|
||||
load : function(mapId) {
|
||||
loadMapDom : function(mapId) {
|
||||
$assert(mapId, "mapId can not be null");
|
||||
throw "This must be implemented";
|
||||
|
||||
|
@ -16,31 +16,38 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
mindplot.FilePersitenceManager = new Class({
|
||||
mindplot.LocalStorageManager = new Class({
|
||||
Extends:mindplot.PersitenceManager,
|
||||
initialize: function() {
|
||||
this.parent();
|
||||
},
|
||||
|
||||
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||
console.log(mapXml);
|
||||
localStorage.setItem(mapId + "-xml", mapXml);
|
||||
events.onSuccess();
|
||||
},
|
||||
|
||||
load : function(mapId) {
|
||||
$assert(mapId, "mapId can not be null");
|
||||
loadMapDom : function(mapId) {
|
||||
var xml = localStorage.getItem(mapId + "-xml");
|
||||
if (xml == null) {
|
||||
// Let's try to open one from the local directory ...
|
||||
var xmlRequest = new Request({
|
||||
url: '../maps/' + mapId + '.xml',
|
||||
method: 'get',
|
||||
async: false,
|
||||
onSuccess: function(responseText) {
|
||||
xml = responseText;
|
||||
}
|
||||
});
|
||||
xmlRequest.send();
|
||||
|
||||
var domDocument;
|
||||
var xmlRequest = new Request({
|
||||
url: '../maps/' + mapId + '.xml',
|
||||
method: 'get',
|
||||
async: false,
|
||||
onSuccess: function(responseText, responseXML) {
|
||||
domDocument = responseXML;
|
||||
// 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>';
|
||||
}
|
||||
});
|
||||
xmlRequest.send();
|
||||
return this.loadFromDom(mapId, domDocument);
|
||||
|
||||
}
|
||||
return core.Utils.createDocumentFromText(xml);
|
||||
}
|
||||
}
|
||||
);
|
@ -42,6 +42,12 @@ mindplot.PersitenceManager = new Class({
|
||||
},
|
||||
|
||||
load: function(mapId) {
|
||||
$assert(mapId, "mapId can not be null");
|
||||
var domDocument = this.loadMapDom(mapId);
|
||||
return this.loadFromDom(mapId, domDocument);
|
||||
},
|
||||
|
||||
loadMapDom: function(mapId) {
|
||||
throw "Method must be implemented";
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user