mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Implement LocalStorage manager ...
This commit is contained in:
parent
410d3553b1
commit
a33daf4563
@ -108,7 +108,7 @@
|
|||||||
files="XMLMindmapSerializerFactory.js"/>
|
files="XMLMindmapSerializerFactory.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.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="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="EditorProperties.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="BubbleTip.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="BubbleTip.js"/>
|
||||||
@ -151,22 +151,22 @@
|
|||||||
files="commands/AddRelationshipCommand.js"/>
|
files="commands/AddRelationshipCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="commands/MoveControlPointCommand.js"/>
|
files="commands/MoveControlPointCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||||
files="commands/freeMind/DragTopicCommand.js"/>
|
<!--files="commands/freeMind/DragTopicCommand.js"/>-->
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||||
files="commands/freeMind/ReconnectTopicCommand.js"/>
|
<!--files="commands/freeMind/ReconnectTopicCommand.js"/>-->
|
||||||
|
|
||||||
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="layout/boards/Board.js"/>
|
files="layout/boards/Board.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||||
files="layout/boards/freemind/Board.js"/>
|
<!--files="layout/boards/freemind/Board.js"/>-->
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||||
files="layout/boards/freemind/Entry.js"/>
|
<!--files="layout/boards/freemind/Entry.js"/>-->
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||||
files="layout/boards/freemind/CentralTopicBoard.js"/>
|
<!--files="layout/boards/freemind/CentralTopicBoard.js"/>-->
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<!--<filelist dir="${basedir}/src/main/javascript/"-->
|
||||||
files="layout/boards/freemind/MainTopicBoard.js"/>
|
<!--files="layout/boards/freemind/MainTopicBoard.js"/>-->
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="layout/BaseLayoutManager.js"/>
|
files="layout/BaseLayoutManager.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<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");
|
$assert(mapId, "mapId can not be null");
|
||||||
throw "This must be implemented";
|
throw "This must be implemented";
|
||||||
|
|
||||||
|
@ -16,31 +16,38 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.FilePersitenceManager = new Class({
|
mindplot.LocalStorageManager = new Class({
|
||||||
Extends:mindplot.PersitenceManager,
|
Extends:mindplot.PersitenceManager,
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||||
console.log(mapXml);
|
localStorage.setItem(mapId + "-xml", mapXml);
|
||||||
events.onSuccess();
|
events.onSuccess();
|
||||||
},
|
},
|
||||||
|
|
||||||
load : function(mapId) {
|
loadMapDom : function(mapId) {
|
||||||
$assert(mapId, "mapId can not be null");
|
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;
|
// If I could not load it from a file, hard code one.
|
||||||
var xmlRequest = new Request({
|
if (xml == null) {
|
||||||
url: '../maps/' + mapId + '.xml',
|
xml = '<map name="6" version="pela"><topic central="true" text="General Status" id="1"/></map>';
|
||||||
method: 'get',
|
|
||||||
async: false,
|
|
||||||
onSuccess: function(responseText, responseXML) {
|
|
||||||
domDocument = responseXML;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
xmlRequest.send();
|
}
|
||||||
return this.loadFromDom(mapId, domDocument);
|
return core.Utils.createDocumentFromText(xml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
@ -42,6 +42,12 @@ mindplot.PersitenceManager = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
load: function(mapId) {
|
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";
|
throw "Method must be implemented";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user