/* ApplicationState is an object that represents the application state. It will be given to dojo.undo.browser to represent the current application state. */ //var pageLocation; var allowedBack = false; ApplicationState = function(stateData, outputDivId, backForwardOutputDivId, bookmarkValue){ this.stateData = stateData; this.outputDivId = outputDivId; this.backForwardOutputDivId = backForwardOutputDivId; this.changeUrl = bookmarkValue; //pageLocation = bookmarkValue; } ApplicationState.prototype.back = function(){ if( !allowedBack ){ alert("Use BACK button inside page (where applicable)!"); //this.showBackForwardMessage("BACK for State Data: " + this.stateData); //this.showStateData(); window.location = "#"; //pageLocation var appState = new ApplicationState("test", "output", "dataOutput"); dojo.undo.browser.addToHistory(appState); } else{ history.back(); history.back(); } } ApplicationState.prototype.forward = function(){ //this.showBackForwardMessage("FORWARD for State Data: " + this.stateData); //this.showStateData(); window.location = "#"; var appState = new ApplicationState("test", "output", "dataOutput"); dojo.undo.browser.addToHistory(appState); } ApplicationState.prototype.showStateData = function(){ dojo.byId(this.outputDivId).innerHTML += this.stateData + '
'; } ApplicationState.prototype.showBackForwardMessage = function(message){ dojo.byId(this.backForwardOutputDivId).innerHTML += message + '
'; }