X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/pkgs/data-foundation.js
diff --git a/pkgs/data-foundation.js b/pkgs/data-foundation.js
deleted file mode 100644
index ad8855ad..00000000
--- a/pkgs/data-foundation.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-Ext.data.Api=(function(){var a={};return{actions:{create:"create",read:"read",update:"update",destroy:"destroy"},restActions:{create:"POST",read:"GET",update:"PUT",destroy:"DELETE"},isAction:function(b){return(Ext.data.Api.actions[b])?true:false},getVerb:function(b){if(a[b]){return a[b]}for(var c in this.actions){if(this.actions[c]===b){a[b]=c;break}}return(a[b]!==undefined)?a[b]:null},isValid:function(b){var e=[];var d=this.actions;for(var c in b){if(!(c in d)){e.push(c)}}return(!e.length)?true:e},hasUniqueUrl:function(c,f){var b=(c.api[f])?c.api[f].url:null;var e=true;for(var d in c.api){if((e=(d===f)?true:(c.api[d].url!=b)?true:false)===false){break}}return e},prepare:function(b){if(!b.api){b.api={}}for(var d in this.actions){var c=this.actions[d];b.api[c]=b.api[c]||b.url||b.directFn;if(typeof(b.api[c])=="string"){b.api[c]={url:b.api[c]}}}},restify:function(b){b.restful=true;for(var c in this.restActions){b.api[this.actions[c]].method=this.restActions[c]}b.onWrite=b.onWrite.createInterceptor(function(h,i,f,e){var d=i.reader;var g=new Ext.data.Response({action:h,raw:f});switch(f.status){case 200:return true;break;case 201:g.success=true;break;case 204:g.success=true;g.data=null;break;default:return true;break}if(g.success===true){this.fireEvent("write",this,h,g.data,g,e,i.request.arg)}else{this.fireEvent("exception",this,"remote",h,i,g,e)}i.request.callback.call(i.request.scope,g.data,g,g.success);return false},b)}}})();Ext.data.Response=function(b,a){Ext.apply(this,b,{raw:a})};Ext.data.Response.prototype={message:null,success:false,status:null,root:null,raw:null,getMessage:function(){return this.message},getSuccess:function(){return this.success},getStatus:function(){return this.status},getRoot:function(){return this.root},getRawResponse:function(){return this.raw}};Ext.data.Api.Error=Ext.extend(Ext.Error,{constructor:function(b,a){this.arg=a;Ext.Error.call(this,b)},name:"Ext.data.Api"});Ext.apply(Ext.data.Api.Error.prototype,{lang:{"action-url-undefined":"No fallback url defined for this action. When defining a DataProxy api, please be sure to define an url for each CRUD action in Ext.data.Api.actions or define a default url in addition to your api-configuration.",invalid:"received an invalid API-configuration. Please ensure your proxy API-configuration contains only the actions defined in Ext.data.Api.actions","invalid-url":"Invalid url. Please review your proxy configuration.",execute:'Attempted to execute an unknown action. Valid API actions are defined in Ext.data.Api.actions"'}});Ext.data.SortTypes={none:function(a){return a},stripTagsRE:/<\/?[^>]+>/gi,asText:function(a){return String(a).replace(this.stripTagsRE,"")},asUCText:function(a){return String(a).toUpperCase().replace(this.stripTagsRE,"")},asUCString:function(a){return String(a).toUpperCase()},asDate:function(a){if(!a){return 0}if(Ext.isDate(a)){return a.getTime()}return Date.parse(String(a))},asFloat:function(a){var b=parseFloat(String(a).replace(/,/g,""));return isNaN(b)?0:b},asInt:function(a){var b=parseInt(String(a).replace(/,/g,""),10);return isNaN(b)?0:b}};Ext.data.Record=function(a,b){this.id=(b||b===0)?b:Ext.data.Record.id(this);this.data=a||{}};Ext.data.Record.create=function(e){var c=Ext.extend(Ext.data.Record,{});var d=c.prototype;d.fields=new Ext.util.MixedCollection(false,function(f){return f.name});for(var b=0,a=e.length;b-1){a.join(null);this.data.removeAt(b);if(this.pruneModifiedRecords){this.modified.remove(a)}if(this.snapshot){this.snapshot.remove(a)}this.fireEvent("remove",this,a,b)}},removeAt:function(a){this.remove(this.getAt(a))},removeAll:function(){var a=[];this.each(function(b){a.push(b)});this.clearData();if(this.snapshot){this.snapshot.clear()}if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this,a)},onClear:function(b,a){Ext.each(a,function(d,c){this.destroyRecord(this,d,c)},this)},insert:function(c,b){b=[].concat(b);for(var d=0,a=b.length;d=0;b--){if(a[b].phantom===true){var d=a.splice(b,1).shift();if(d.isValid()){c.push(d)}}else{if(!a[b].isValid()){a.splice(b,1)}}}if(c.length){this.doTransaction("create",c)}if(a.length){this.doTransaction("update",a)}return true},doTransaction:function(d,b){function e(f){try{this.execute(d,f)}catch(g){this.handleException(g)}}if(this.batch===false){for(var c=0,a=b.length;c=0;b--){this.modified.splice(this.modified.indexOf(a[b]),1)}}else{this.modified.splice(this.modified.indexOf(a),1)}},reMap:function(b){if(Ext.isArray(b)){for(var d=0,a=b.length;d=0;c--){this.insert(b[c].lastIndex,b[c])}}},handleException:function(a){Ext.handleError(a)},reload:function(a){this.load(Ext.applyIf(a||{},this.lastOptions))},loadRecords:function(g,b,f){if(!g||f===false){if(f!==false){this.fireEvent("load",this,[],b)}if(b.callback){b.callback.call(b.scope||this,[],b,false,g)}return}var e=g.records,d=g.totalRecords||e.length;if(!b||b.add!==true){if(this.pruneModifiedRecords){this.modified=[]}for(var c=0,a=e.length;cg?1:(h=0;b--){if(Ext.isArray(c)){this.realize(a.splice(b,1).shift(),c.splice(b,1).shift())}else{this.realize(a.splice(b,1).shift(),c)}}}else{if(Ext.isArray(c)&&c.length==1){c=c.shift()}if(!this.isData(c)){throw new Ext.data.DataReader.Error("realize",a)}a.phantom=false;a._phid=a.id;a.id=this.getId(c);a.data=c;a.commit()}},update:function(a,c){if(Ext.isArray(a)){for(var b=a.length-1;b>=0;b--){if(Ext.isArray(c)){this.update(a.splice(b,1).shift(),c.splice(b,1).shift())}else{this.update(a.splice(b,1).shift(),c)}}}else{if(Ext.isArray(c)&&c.length==1){c=c.shift()}if(this.isData(c)){a.data=Ext.apply(a.data,c)}a.commit()}},isData:function(a){return(a&&Ext.isObject(a)&&!Ext.isEmpty(this.getId(a)))?true:false},onMetaChange:function(a){delete this.ef;this.meta=a;this.recordType=Ext.data.Record.create(a.fields);this.buildExtractors()}};Ext.data.DataReader.Error=Ext.extend(Ext.Error,{constructor:function(b,a){this.arg=a;Ext.Error.call(this,b)},name:"Ext.data.DataReader"});Ext.apply(Ext.data.DataReader.Error.prototype,{lang:{update:"#update received invalid data from server. Please see docs for DataReader#update and review your DataReader configuration.",realize:"#realize was called with invalid remote-data. Please see the docs for DataReader#realize and review your DataReader configuration.","invalid-response":"#readResponse received an invalid response from the server."}});Ext.data.Response=function(a){Ext.apply(this,a)};Ext.data.Response.prototype={action:undefined,success:undefined,message:undefined,data:undefined,raw:undefined,records:undefined};Ext.data.DataWriter=function(a){Ext.apply(this,a)};Ext.data.DataWriter.prototype={writeAllFields:false,listful:false,write:function(d,e,a){var c=[],b=d+"Record";if(Ext.isArray(a)){Ext.each(a,function(f){c.push(this[b](f))},this)}else{if(a instanceof Ext.data.Record){c=this[b](a)}}this.render(d,a,e,c)},render:Ext.emptyFn,updateRecord:Ext.emptyFn,createRecord:Ext.emptyFn,destroyRecord:Ext.emptyFn,toHash:function(e){var d=e.fields.map,c={},b=(this.writeAllFields===false&&e.phantom===false)?e.getChanges():e.data,a;Ext.iterate(b,function(g,f){if((a=d[g])){c[a.mapping?a.mapping:a.name]=f}});if(e.phantom){if(e.fields.containsKey(this.meta.idProperty)&&Ext.isEmpty(e.data[this.meta.idProperty])){delete c[this.meta.idProperty]}}else{c[this.meta.idProperty]=e.id}return c}};Ext.data.DataProxy=function(a){a=a||{};this.api=a.api;this.url=a.url;this.restful=a.restful;this.listeners=a.listeners;this.prettyUrls=a.prettyUrls;this.addEvents("exception","beforeload","load","loadexception","beforewrite","write");Ext.data.DataProxy.superclass.constructor.call(this);try{Ext.data.Api.prepare(this)}catch(b){if(b instanceof Ext.data.Api.Error){b.toConsole()}}Ext.data.DataProxy.relayEvents(this,["beforewrite","write","exception"])};Ext.extend(Ext.data.DataProxy,Ext.util.Observable,{restful:false,setApi:function(){if(arguments.length==1){var a=Ext.data.Api.isValid(arguments[0]);if(a===true){this.api=arguments[0]}else{throw new Ext.data.Api.Error("invalid",a)}}else{if(arguments.length==2){if(!Ext.data.Api.isAction(arguments[0])){throw new Ext.data.Api.Error("invalid",arguments[0])}this.api[arguments[0]]=arguments[1]}}Ext.data.Api.prepare(this)},isApiAction:function(a){return(this.api[a])?true:false},request:function(e,b,f,a,g,d,c){if(!this.api[e]&&!this.load){throw new Ext.data.DataProxy.Error("action-undefined",e)}f=f||{};if((e===Ext.data.Api.actions.read)?this.fireEvent("beforeload",this,f):this.fireEvent("beforewrite",this,e,b,f)!==false){this.doRequest.apply(this,arguments)}else{g.call(d||this,null,c,false)}},load:null,doRequest:function(e,b,f,a,g,d,c){this.load(f,a,g,d,c)},buildUrl:function(d,b){b=b||null;var c=(this.api[d])?this.api[d].url:this.url;if(!c){throw new Ext.data.Api.Error("invalid-url",d)}var e=null;var a=c.match(/(.*)(\.json|\.xml|\.html)$/);if(a){e=a[2];c=a[1]}if((this.prettyUrls===true||this.restful===true)&&b instanceof Ext.data.Record&&!b.phantom){c+="/"+b.id}if(e){c+=e}return c},destroy:function(){this.purgeListeners()}});Ext.apply(Ext.data.DataProxy,Ext.util.Observable.prototype);Ext.util.Observable.call(Ext.data.DataProxy);Ext.data.DataProxy.Error=Ext.extend(Ext.Error,{constructor:function(b,a){this.arg=a;Ext.Error.call(this,b)},name:"Ext.data.DataProxy"});Ext.apply(Ext.data.DataProxy.Error.prototype,{lang:{"action-undefined":"DataProxy attempted to execute an API-action but found an undefined url / function. Please review your Proxy url/api-configuration.","api-invalid":"Recieved an invalid API-configuration. Please ensure your proxy API-configuration contains only the actions from Ext.data.Api.actions."}});Ext.data.ScriptTagProxy=function(a){Ext.apply(this,a);Ext.data.ScriptTagProxy.superclass.constructor.call(this,a);this.head=document.getElementsByTagName("head")[0]};Ext.data.ScriptTagProxy.TRANS_ID=1000;Ext.extend(Ext.data.ScriptTagProxy,Ext.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,doRequest:function(e,f,d,g,i,j,k){var c=Ext.urlEncode(Ext.apply(d,this.extraParams));var b=this.buildUrl(e,f);if(!b){throw new Ext.data.Api.Error("invalid-url",b)}b=Ext.urlAppend(b,c);if(this.nocache){b=Ext.urlAppend(b,"_dc="+(new Date().getTime()))}var a=++Ext.data.ScriptTagProxy.TRANS_ID;var l={id:a,action:e,cb:"stcCallback"+a,scriptId:"stcScript"+a,params:d,arg:k,url:b,callback:i,scope:j,reader:g};window[l.cb]=this.createCallback(e,f,l);b+=String.format("&{0}={1}",this.callbackParam,l.cb);if(this.autoAbort!==false){this.abort()}l.timeoutId=this.handleFailure.defer(this.timeout,this,[l]);var h=document.createElement("script");h.setAttribute("src",b);h.setAttribute("type","text/javascript");h.setAttribute("id",l.scriptId);this.head.appendChild(h);this.trans=l},createCallback:function(d,b,c){var a=this;return function(e){a.trans=false;a.destroyTrans(c,true);if(d===Ext.data.Api.actions.read){a.onRead.call(a,d,c,e)}else{a.onWrite.call(a,d,c,e,b)}}},onRead:function(d,c,b){var a;try{a=c.reader.readRecords(b)}catch(f){this.fireEvent("loadexception",this,c,b,f);this.fireEvent("exception",this,"response",d,c,b,f);c.callback.call(c.scope||window,null,c.arg,false);return}if(a.success===false){this.fireEvent("loadexception",this,c,b);this.fireEvent("exception",this,"remote",d,c,b,null)}else{this.fireEvent("load",this,b,c.arg)}c.callback.call(c.scope||window,a,c.arg,a.success)},onWrite:function(g,f,c,b){var a=f.reader;try{var d=a.readResponse(g,c)}catch(h){this.fireEvent("exception",this,"response",g,f,d,h);f.callback.call(f.scope||window,null,d,false);return}if(!d.success===true){this.fireEvent("exception",this,"remote",g,f,d,b);f.callback.call(f.scope||window,null,d,false);return}this.fireEvent("write",this,g,d.data,d,b,f.arg);f.callback.call(f.scope||window,d.data,d,true)},isLoading:function(){return this.trans?true:false},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans)}},destroyTrans:function(b,a){this.head.removeChild(document.getElementById(b.scriptId));clearTimeout(b.timeoutId);if(a){window[b.cb]=undefined;try{delete window[b.cb]}catch(c){}}else{window[b.cb]=function(){window[b.cb]=undefined;try{delete window[b.cb]}catch(d){}}}},handleFailure:function(a){this.trans=false;this.destroyTrans(a,false);if(a.action===Ext.data.Api.actions.read){this.fireEvent("loadexception",this,null,a.arg)}this.fireEvent("exception",this,"response",a.action,{response:null,options:a.arg});a.callback.call(a.scope||window,null,a.arg,false)},destroy:function(){this.abort();Ext.data.ScriptTagProxy.superclass.destroy.call(this)}});Ext.data.HttpProxy=function(a){Ext.data.HttpProxy.superclass.constructor.call(this,a);this.conn=a;this.conn.url=null;this.useAjax=!a||!a.events;var c=Ext.data.Api.actions;this.activeRequest={};for(var b in c){this.activeRequest[c[b]]=undefined}};Ext.extend(Ext.data.HttpProxy,Ext.data.DataProxy,{getConnection:function(){return this.useAjax?Ext.Ajax:this.conn},setUrl:function(a,b){this.conn.url=a;if(b===true){this.url=a;this.api=null;Ext.data.Api.prepare(this)}},doRequest:function(f,d,h,c,b,e,a){var g={method:(this.api[f])?this.api[f]["method"]:undefined,request:{callback:b,scope:e,arg:a},reader:c,callback:this.createCallback(f,d),scope:this};if(h.jsonData){g.jsonData=h.jsonData}else{if(h.xmlData){g.xmlData=h.xmlData}else{g.params=h||{}}}if(this.conn.url===null){this.conn.url=this.buildUrl(f,d)}else{if(this.restful===true&&d instanceof Ext.data.Record&&!d.phantom){this.conn.url+="/"+d.id}}if(this.useAjax){Ext.applyIf(g,this.conn);if(this.activeRequest[f]){}this.activeRequest[f]=Ext.Ajax.request(g)}else{this.conn.request(g)}this.conn.url=null},createCallback:function(b,a){return function(e,d,c){this.activeRequest[b]=undefined;if(!d){if(b===Ext.data.Api.actions.read){this.fireEvent("loadexception",this,e,c)}this.fireEvent("exception",this,"response",b,e,c);e.request.callback.call(e.request.scope,null,e.request.arg,false);return}if(b===Ext.data.Api.actions.read){this.onRead(b,e,c)}else{this.onWrite(b,e,c,a)}}},onRead:function(d,g,b){var a;try{a=g.reader.read(b)}catch(f){this.fireEvent("loadexception",this,g,b,f);this.fireEvent("exception",this,"response",d,g,b,f);g.request.callback.call(g.request.scope,null,g.request.arg,false);return}if(a.success===false){this.fireEvent("loadexception",this,g,b);var c=g.reader.readResponse(d,b);this.fireEvent("exception",this,"remote",d,g,c,null)}else{this.fireEvent("load",this,g,g.request.arg)}g.request.callback.call(g.request.scope,a,g.request.arg,a.success)},onWrite:function(f,h,c,b){var a=h.reader;var d;try{d=a.readResponse(f,c)}catch(g){this.fireEvent("exception",this,"response",f,h,c,g);h.request.callback.call(h.request.scope,null,h.request.arg,false);return}if(d.success===false){this.fireEvent("exception",this,"remote",f,h,d,b)}else{this.fireEvent("write",this,f,d.data,d,b,h.request.arg)}h.request.callback.call(h.request.scope,d.data,d,d.success)},destroy:function(){if(!this.useAjax){this.conn.abort()}else{if(this.activeRequest){var b=Ext.data.Api.actions;for(var a in b){if(this.activeRequest[b[a]]){Ext.Ajax.abort(this.activeRequest[b[a]])}}}}Ext.data.HttpProxy.superclass.destroy.call(this)}});Ext.data.MemoryProxy=function(b){var a={};a[Ext.data.Api.actions.read]=true;Ext.data.MemoryProxy.superclass.constructor.call(this,{api:a});this.data=b};Ext.extend(Ext.data.MemoryProxy,Ext.data.DataProxy,{doRequest:function(b,c,a,d,g,h,i){a=a||{};var j;try{j=d.readRecords(this.data)}catch(f){this.fireEvent("loadexception",this,null,i,f);this.fireEvent("exception",this,"response",b,i,null,f);g.call(h,null,i,false);return}g.call(h,j,i,true)}});
\ No newline at end of file