New build scripts

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5282 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-03-04 19:05:34 +00:00
parent 04f9a2e7bc
commit 838e7d5381
845 changed files with 121780 additions and 183 deletions

View File

@@ -0,0 +1,146 @@
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
import DojoExternalInterface;
class Storage {
public static var SUCCESS = "success";
public static var FAILED = "failed";
public static var PENDING = "pending";
public var so;
public function Storage(){
//getURL("javascript:dojo.debug('FLASH:Storage constructor')");
DojoExternalInterface.initialize();
DojoExternalInterface.addCallback("put", this, put);
DojoExternalInterface.addCallback("get", this, get);
DojoExternalInterface.addCallback("showSettings", this, showSettings);
DojoExternalInterface.addCallback("clear", this, clear);
DojoExternalInterface.addCallback("getKeys", this, getKeys);
DojoExternalInterface.addCallback("remove", this, remove);
DojoExternalInterface.loaded();
// preload the System Settings finished button movie for offline
// access so it is in the cache
_root.createEmptyMovieClip("_settingsBackground", 1);
// getURL("javascript:alert('"+DojoExternalInterface.dojoPath+"');");
_root._settingsBackground.loadMovie(DojoExternalInterface.dojoPath + "storage_dialog.swf");
}
public function put(keyName, keyValue, namespace){
// Get the SharedObject for these values and save it
so = SharedObject.getLocal(namespace);
// prepare a storage status handler
var self = this;
so.onStatus = function(infoObject:Object){
//getURL("javascript:dojo.debug('FLASH: onStatus, infoObject="+infoObject.code+"')");
// delete the data value if the request was denied
if (infoObject.code == "SharedObject.Flush.Failed"){
delete self.so.data[keyName];
}
var statusResults;
if(infoObject.code == "SharedObject.Flush.Failed"){
statusResults = Storage.FAILED;
}else if(infoObject.code == "SharedObject.Flush.Pending"){
statusResults = Storage.PENDING;
}else if(infoObject.code == "SharedObject.Flush.Success"){
statusResults = Storage.SUCCESS;
}
//getURL("javascript:dojo.debug('FLASH: onStatus, statusResults="+statusResults+"')");
// give the status results to JavaScript
DojoExternalInterface.call("dojo.storage._onStatus", null, statusResults,
keyName);
}
// save the key and value
so.data[keyName] = keyValue;
var flushResults = so.flush();
// return results of this command to JavaScript
var statusResults;
if(flushResults == true){
statusResults = Storage.SUCCESS;
}else if(flushResults == "pending"){
statusResults = Storage.PENDING;
}else{
statusResults = Storage.FAILED;
}
DojoExternalInterface.call("dojo.storage._onStatus", null, statusResults,
keyName);
}
public function get(keyName, namespace){
// Get the SharedObject for these values and save it
so = SharedObject.getLocal(namespace);
var results = so.data[keyName];
return results;
}
public function showSettings(){
// Show the configuration options for the Flash player, opened to the
// section for local storage controls (pane 1)
System.showSettings(1);
// there is no way we can intercept when the Close button is pressed, allowing us
// to hide the Flash dialog. Instead, we need to load a movie in the
// background that we can show a close button on.
_root.createEmptyMovieClip("_settingsBackground", 1);
_root._settingsBackground.loadMovie(DojoExternalInterface.dojoPath + "storage_dialog.swf");
}
public function clear(namespace){
so = SharedObject.getLocal(namespace);
so.clear();
so.flush();
}
public function getKeys(namespace){
// Returns a list of the available keys in this namespace
// get the storage object
so = SharedObject.getLocal(namespace);
// get all of the keys
var results = new Array();
for(var i in so.data)
results.push(i);
// join the keys together in a comma seperated string
results = results.join(",");
return results;
}
public function remove(keyName, namespace){
// Removes a key
// get the storage object
so = SharedObject.getLocal(namespace);
// delete this value
delete so.data[keyName];
// save the changes
so.flush();
}
static function main(mc){
//getURL("javascript:dojo.debug('FLASH: storage loaded')");
_root.app = new Storage();
}
}

View File

@@ -0,0 +1,16 @@
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.kwCompoundRequire({
common: ["dojo.storage"],
browser: ["dojo.storage.browser"]
});
dojo.provide("dojo.storage.*");

View File

@@ -0,0 +1,363 @@
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.storage.browser");
dojo.require("dojo.storage");
dojo.require("dojo.flash");
dojo.require("dojo.json");
dojo.require("dojo.uri.*");
dojo.storage.browser.WhatWGStorageProvider = function(){
// summary:
// Storage provider that uses WHAT Working Group features in Firefox 2
// to achieve permanent storage.
// description:
// The WHAT WG storage API is documented at
// http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side
//
// You can disable this storage provider with the following djConfig
// variable:
// var djConfig = { disableWhatWGStorage: true };
//
// Authors of this storage provider-
// JB Boisseau, jb.boisseau@eutech-ssii.com
// Brad Neuberg, bkn3@columbia.edu
}
dojo.inherits(dojo.storage.browser.WhatWGStorageProvider, dojo.storage);
// instance methods and properties
dojo.lang.extend(dojo.storage.browser.WhatWGStorageProvider, {
namespace: "default",
initialized: false,
_domain: null,
_available: null,
_statusHandler: null,
initialize: function(){
if(djConfig["disableWhatWGStorage"] == true){
return;
}
// get current domain
this._domain = location.hostname;
// indicate that this storage provider is now loaded
this.initialized = true;
dojo.storage.manager.loaded();
},
isAvailable: function(){
try{
var myStorage = globalStorage[location.hostname];
}catch(e){
this._available = false;
return this._available;
}
this._available = true;
return this._available;
},
put: function(key, value, resultsHandler){
if(this.isValidKey(key) == false){
dojo.raise("Invalid key given: " + key);
}
this._statusHandler = resultsHandler;
// serialize the value;
// handle strings differently so they have better performance
if(dojo.lang.isString(value)){
value = "string:" + value;
}else{
value = dojo.json.serialize(value);
}
// register for successful storage events
window.addEventListener("storage", function(evt){
// indicate we succeeded
resultsHandler.call(null, dojo.storage.SUCCESS, key);
}, false);
// try to store the value
try{
var myStorage = globalStorage[this._domain];
myStorage.setItem(key,value);
}catch(e){
// indicate we failed
this._statusHandler.call(null, dojo.storage.FAILED,
key, e.toString());
}
},
get: function(key){
if(this.isValidKey(key) == false){
dojo.raise("Invalid key given: " + key);
}
var myStorage = globalStorage[this._domain];
var results = myStorage.getItem(key);
if(results == null){
return null;
}
results = results.value;
// destringify the content back into a
// real JavaScript object;
// handle strings differently so they have better performance
if(!dojo.lang.isUndefined(results) && results != null
&& /^string:/.test(results)){
results = results.substring("string:".length);
}else{
results = dojo.json.evalJson(results);
}
return results;
},
getKeys: function(){
var myStorage = globalStorage[this._domain];
var keysArray = new Array();
for(i=0; i<myStorage.length;i++){
keysArray[i] = myStorage.key(i);
}
return keysArray;
},
clear: function(){
var myStorage = globalStorage[this._domain];
var keys = new Array();
for(var i = 0; i < myStorage.length; i++){
keys[keys.length] = myStorage.key(i);
}
for(var i = 0; i < keys.length; i++){
myStorage.removeItem(keys[i]);
}
},
remove: function(key){
var myStorage = globalStorage[this._domain];
myStorage.removeItem(key);
},
isPermanent: function(){
return true;
},
getMaximumSize: function(){
return dojo.storage.SIZE_NO_LIMIT;
},
hasSettingsUI: function(){
return false;
},
showSettingsUI: function(){
dojo.raise(this.getType() + " does not support a storage settings user-interface");
},
hideSettingsUI: function(){
dojo.raise(this.getType() + " does not support a storage settings user-interface");
},
getType: function(){
return "dojo.storage.browser.WhatWGStorageProvider";
}
});
dojo.storage.browser.FlashStorageProvider = function(){
// summary: Storage provider that uses features in Flash to achieve permanent storage
// description:
// Authors of this storage provider-
// Brad Neuberg, bkn3@columbia.edu
}
dojo.inherits(dojo.storage.browser.FlashStorageProvider, dojo.storage);
// instance methods and properties
dojo.lang.extend(dojo.storage.browser.FlashStorageProvider, {
namespace: "default",
initialized: false,
_available: null,
_statusHandler: null,
initialize: function(){
if(djConfig["disableFlashStorage"] == true){
return;
}
// initialize our Flash
var loadedListener = function(){
dojo.storage._flashLoaded();
}
dojo.flash.addLoadedListener(loadedListener);
var swfloc6 = dojo.uri.dojoUri("Storage_version6.swf").toString();
var swfloc8 = dojo.uri.dojoUri("Storage_version8.swf").toString();
dojo.flash.setSwf({flash6: swfloc6, flash8: swfloc8, visible: false});
},
isAvailable: function(){
if(djConfig["disableFlashStorage"] == true){
this._available = false;
}else{
this._available = true;
}
return this._available;
},
put: function(key, value, resultsHandler){
if(this.isValidKey(key) == false){
dojo.raise("Invalid key given: " + key);
}
this._statusHandler = resultsHandler;
// serialize the value;
// handle strings differently so they have better performance
if(dojo.lang.isString(value)){
value = "string:" + value;
}else{
value = dojo.json.serialize(value);
}
dojo.flash.comm.put(key, value, this.namespace);
},
get: function(key){
if(this.isValidKey(key) == false){
dojo.raise("Invalid key given: " + key);
}
var results = dojo.flash.comm.get(key, this.namespace);
if(results == ""){
return null;
}
// destringify the content back into a
// real JavaScript object;
// handle strings differently so they have better performance
if(!dojo.lang.isUndefined(results) && results != null
&& /^string:/.test(results)){
results = results.substring("string:".length);
}else{
results = dojo.json.evalJson(results);
}
return results;
},
getKeys: function(){
var results = dojo.flash.comm.getKeys(this.namespace);
if(results == ""){
return [];
}
// the results are returned comma seperated; split them
return results.split(",");
},
clear: function(){
dojo.flash.comm.clear(this.namespace);
},
remove: function(key){
// summary:
// Note- This one method is not implemented on the
// FlashStorageProvider yet
dojo.unimplemented("dojo.storage.browser.FlashStorageProvider.remove");
},
isPermanent: function(){
return true;
},
getMaximumSize: function(){
return dojo.storage.SIZE_NO_LIMIT;
},
hasSettingsUI: function(){
return true;
},
showSettingsUI: function(){
dojo.flash.comm.showSettings();
dojo.flash.obj.setVisible(true);
dojo.flash.obj.center();
},
hideSettingsUI: function(){
// hide the dialog
dojo.flash.obj.setVisible(false);
// call anyone who wants to know the dialog is
// now hidden
if(dojo.storage.onHideSettingsUI != null &&
!dojo.lang.isUndefined(dojo.storage.onHideSettingsUI)){
dojo.storage.onHideSettingsUI.call(null);
}
},
getType: function(){
return "dojo.storage.browser.FlashStorageProvider";
},
/** Called when the Flash is finished loading. */
_flashLoaded: function(){
this._initialized = true;
// indicate that this storage provider is now loaded
dojo.storage.manager.loaded();
},
// Called if the storage system needs to tell us about the status
// of a put() request.
_onStatus: function(statusResult, key){
var ds = dojo.storage;
var dfo = dojo.flash.obj;
if(statusResult == ds.PENDING){
dfo.center();
dfo.setVisible(true);
}else{
dfo.setVisible(false);
}
if((!dj_undef("_statusHandler", ds))&&(ds._statusHandler != null)){
ds._statusHandler.call(null, statusResult, key);
}
}
});
// register the existence of our storage providers
dojo.storage.manager.register("dojo.storage.browser.WhatWGStorageProvider",
new dojo.storage.browser.WhatWGStorageProvider());
dojo.storage.manager.register("dojo.storage.browser.FlashStorageProvider",
new dojo.storage.browser.FlashStorageProvider());
// now that we are loaded and registered tell the storage manager to initialize
// itself
dojo.storage.manager.initialize();