1
2
3
4
5
6
7
8
9
10
| //>>built
| define(["dojo","dijit","dojox","dojo/require!dojox/flash,dojox/storage/manager,dojox/storage/Provider"],function(d,h,c){d.provide("dojox.storage.FlashStorageProvider");d.require("dojox.flash");d.require("dojox.storage.manager");d.require("dojox.storage.Provider");d.declare("dojox.storage.FlashStorageProvider",c.storage.Provider,{initialized:!1,_available:null,_statusHandler:null,_flashReady:!1,_pageReady:!1,initialize:function(){if(1!=d.config.disableFlashStorage){c.flash.addLoadedListener(d.hitch(this,
| function(){(this._flashReady=!0,this._pageReady)&&this._loaded()}));var a=d.moduleUrl("dojox","storage/Storage.swf").toString();c.flash.setSwf(a,!1);d.connect(d,"loaded",this,function(){this._pageReady=!0;this._flashReady&&this._pageReady&&this._loaded()})}},setFlushDelay:function(a){if(null===a||"undefined"===typeof a||isNaN(a))throw Error("Invalid argunment: "+a);c.flash.comm.setFlushDelay(String(a))},getFlushDelay:function(){return Number(c.flash.comm.getFlushDelay())},flush:function(a){if(null==
| a||"undefined"==typeof a)a=c.storage.DEFAULT_NAMESPACE;c.flash.comm.flush(a)},isAvailable:function(){return this._available=!d.config.disableFlashStorage},put:function(a,b,g,e){if(!this.isValidKey(a))throw Error("Invalid key given: "+a);e||(e=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(e))throw Error("Invalid namespace given: "+e);this._statusHandler=g;b=d.isString(b)?"string:"+b:d.toJson(b);c.flash.comm.put(a,b,e)},putMultiple:function(a,b,g,e){if(!this.isValidKeyArray(a)||!b instanceof Array||
| a.length!=b.length)throw Error("Invalid arguments: keys \x3d ["+a+"], values \x3d ["+b+"]");e||(e=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(e))throw Error("Invalid namespace given: "+e);this._statusHandler=g;a=a.join(",");g=[];for(var f=0;f<b.length;f++)d.isString(b[f])?b[f]="string:"+b[f]:b[f]=d.toJson(b[f]),g[f]=b[f].length;b=b.join("");g=g.join(",");c.flash.comm.putMultiple(a,b,g,e)},get:function(a,b){if(!this.isValidKey(a))throw Error("Invalid key given: "+a);b||(b=c.storage.DEFAULT_NAMESPACE);
| if(!this.isValidKey(b))throw Error("Invalid namespace given: "+b);a=c.flash.comm.get(a,b);return""==a?null:this._destringify(a)},getMultiple:function(a,b){if(!this.isValidKeyArray(a))throw new ("Invalid key array given: "+a);b||(b=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(b))throw Error("Invalid namespace given: "+b);a=a.join(",");b=c.flash.comm.getMultiple(a,b);b=eval("("+b+")");for(a=0;a<b.length;a++)b[a]=""==b[a]?null:this._destringify(b[a]);return b},_destringify:function(a){return a=d.isString(a)&&
| /^string:/.test(a)?a.substring(7):d.fromJson(a)},getKeys:function(a){a||(a=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(a))throw Error("Invalid namespace given: "+a);a=c.flash.comm.getKeys(a);if(null==a||"null"==a)a="";a=a.split(",");a.sort();return a},getNamespaces:function(){var a=c.flash.comm.getNamespaces();if(null==a||"null"==a)a=c.storage.DEFAULT_NAMESPACE;a=a.split(",");a.sort();return a},clear:function(a){a||(a=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(a))throw Error("Invalid namespace given: "+
| a);c.flash.comm.clear(a)},remove:function(a,b){b||(b=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(b))throw Error("Invalid namespace given: "+b);c.flash.comm.remove(a,b)},removeMultiple:function(a,b){this.isValidKeyArray(a)||d.raise("Invalid key array given: "+a);b||(b=c.storage.DEFAULT_NAMESPACE);if(!this.isValidKey(b))throw Error("Invalid namespace given: "+b);a=a.join(",");c.flash.comm.removeMultiple(a,b)},isPermanent:function(){return!0},getMaximumSize:function(){return c.storage.SIZE_NO_LIMIT},
| hasSettingsUI:function(){return!0},showSettingsUI:function(){c.flash.comm.showSettings();c.flash.obj.setVisible(!0);c.flash.obj.center()},hideSettingsUI:function(){c.flash.obj.setVisible(!1);d.isFunction(c.storage.onHideSettingsUI)&&c.storage.onHideSettingsUI.call(null)},getResourceList:function(){return[]},_loaded:function(){this._allNamespaces=this.getNamespaces();this.initialized=!0;c.storage.manager.loaded()},_onStatus:function(a,b,d){var e=c.storage,f=c.flash.obj;a==e.PENDING?(f.center(),f.setVisible(!0)):
| f.setVisible(!1);e._statusHandler&&e._statusHandler.call(null,a,b,null,d)}});c.storage.manager.register("dojox.storage.FlashStorageProvider",new c.storage.FlashStorageProvider)});
|
|