~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/ecosystem/extjs/build/data/ScriptTagProxy-min.js

  • Committer: parra
  • Date: 2010-03-15 02:39:02 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1433
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Ext JS Library 3.0 RC2
 
3
 * Copyright(c) 2006-2009, Ext JS, LLC.
 
4
 * licensing@extjs.com
 
5
 * 
 
6
 * http://extjs.com/license
 
7
 */
 
8
 
 
9
 
 
10
Ext.data.ScriptTagProxy=function(config){Ext.apply(this,config);Ext.data.ScriptTagProxy.superclass.constructor.call(this,config);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(action,rs,params,reader,callback,scope,arg){var p=Ext.urlEncode(Ext.apply(params,this.extraParams));var url=this.buildUrl(action,rs);if(!url){throw new Ext.data.Api.Error('invalid-url',url);}
 
11
url+=(url.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){url+="&_dc="+(new Date().getTime());}
 
12
var transId=++Ext.data.ScriptTagProxy.TRANS_ID;var trans={id:transId,action:action,cb:"stcCallback"+transId,scriptId:"stcScript"+transId,params:params,arg:arg,url:url,callback:callback,scope:scope,reader:reader};window[trans.cb]=this.createCallback(action,rs,trans);url+=String.format("&{0}={1}",this.callbackParam,trans.cb);if(this.autoAbort!==false){this.abort();}
 
13
trans.timeoutId=this.handleFailure.defer(this.timeout,this,[trans]);var script=document.createElement("script");script.setAttribute("src",url);script.setAttribute("type","text/javascript");script.setAttribute("id",trans.scriptId);this.head.appendChild(script);this.trans=trans;},createCallback:function(action,rs,trans){var self=this;return function(res){self.trans=false;self.destroyTrans(trans,true);if(action===Ext.data.Api.actions.read){self.onRead.call(self,action,trans,res);}else{self.onWrite.call(self,action,trans,res,rs);}}},onRead:function(action,trans,res){var result;try{result=trans.reader.readRecords(res);}catch(e){this.fireEvent("loadexception",this,trans,res,e);this.fireEvent('exception',this,'response',action,trans,res,e);trans.callback.call(trans.scope||window,null,trans.arg,false);return;}
 
14
if(result.success===false){this.fireEvent('loadexception',this,trans,res);this.fireEvent('exception',this,'remote',action,trans,res,null);}else{this.fireEvent("load",this,res,trans.arg);}
 
15
trans.callback.call(trans.scope||window,result,trans.arg,result.success);},onWrite:function(action,trans,res,rs){var reader=trans.reader;try{reader.readResponse(action,res);}catch(e){this.fireEvent('exception',this,'response',action,trans,res,e);trans.callback.call(trans.scope||window,null,res,false);return;}
 
16
if(!res[reader.meta.successProperty]===true){this.fireEvent('exception',this,'remote',action,trans,res,rs);trans.callback.call(trans.scope||window,null,res,false);return;}
 
17
this.fireEvent("write",this,action,res[reader.meta.root],res,rs,trans.arg);trans.callback.call(trans.scope||window,res[reader.meta.root],res,true);},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);}},destroyTrans:function(trans,isLoaded){this.head.removeChild(document.getElementById(trans.scriptId));clearTimeout(trans.timeoutId);if(isLoaded){window[trans.cb]=undefined;try{delete window[trans.cb];}catch(e){}}else{window[trans.cb]=function(){window[trans.cb]=undefined;try{delete window[trans.cb];}catch(e){}};}},handleFailure:function(trans){this.trans=false;this.destroyTrans(trans,false);if(trans.action===Ext.data.Api.actions.read){this.fireEvent("loadexception",this,null,trans.arg);}
 
18
this.fireEvent('exception',this,'response',trans.action,{response:null,options:trans.arg});trans.callback.call(trans.scope||window,null,trans.arg,false);},destroy:function(){this.abort();Ext.data.ScriptTagProxy.superclass.destroy.call(this);}});
 
 
b'\\ No newline at end of file'