~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/web/extjs/build/data/HttpProxy-min.js

  • Committer: parra
  • Date: 2010-03-15 15:56:56 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1448
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.HttpProxy=function(conn){Ext.data.HttpProxy.superclass.constructor.call(this,conn);this.conn=conn;this.conn.url=null;this.useAjax=!conn||!conn.events;var actions=Ext.data.Api.actions
 
11
this.activeRequest={};for(var verb in actions){this.activeRequest[actions[verb]]=undefined;}};Ext.extend(Ext.data.HttpProxy,Ext.data.DataProxy,{getConnection:function(){return this.useAjax?Ext.Ajax:this.conn;},setUrl:function(url,makePermanent){this.conn.url=url;if(makePermanent===true){this.url=url;Ext.data.Api.prepare(this);}},doRequest:function(action,rs,params,reader,cb,scope,arg){var o={params:params||{},method:(this.api[action])?this.api[action]['method']:undefined,request:{callback:cb,scope:scope,arg:arg},reader:reader,callback:this.createCallback(action,rs),scope:this};if(this.conn.url===null){this.conn.url=this.buildUrl(action,rs);}
 
12
else if(this.restful===true&&rs instanceof Ext.data.Record&&!rs.phantom){this.conn.url+='/'+rs.id;}
 
13
if(this.useAjax){Ext.applyIf(o,this.conn);if(this.activeRequest[action]){}
 
14
this.activeRequest[action]=Ext.Ajax.request(o);}else{this.conn.request(o);}
 
15
this.conn.url=null;},createCallback:function(action,rs){return function(o,success,response){this.activeRequest[action]=undefined;if(!success){if(action===Ext.data.Api.actions.read){this.fireEvent("loadexception",this,o,response);}
 
16
this.fireEvent('exception',this,'response',action,o,response);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
 
17
if(action===Ext.data.Api.actions.read){this.onRead(action,o,response);}else{this.onWrite(action,o,response,rs);}}},onRead:function(action,o,response){var result;try{result=o.reader.read(response);}catch(e){this.fireEvent("loadexception",this,o,response,e);this.fireEvent('exception',this,'response',action,o,response,e);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
 
18
if(result.success===false){this.fireEvent('loadexception',this,o,response);var res=o.reader.readResponse(action,response);this.fireEvent('exception',this,'remote',action,o,res,null);}
 
19
else{this.fireEvent("load",this,o,o.request.arg);}
 
20
o.request.callback.call(o.request.scope,result,o.request.arg,result.success);},onWrite:function(action,o,response,rs){var reader=o.reader;var res;try{res=reader.readResponse(action,response);}catch(e){this.fireEvent('exception',this,'response',action,o,response,e);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
 
21
if(res[reader.meta.successProperty]===false){this.fireEvent('exception',this,'remote',action,o,res,rs);}else{this.fireEvent("write",this,action,res[reader.meta.root],res,rs,o.request.arg);}
 
22
o.request.callback.call(o.request.scope,res[reader.meta.root],res,res[reader.meta.successProperty]);},destroy:function(){if(!this.useAjax){this.conn.abort();}else if(this.activeRequest){var actions=Ext.data.Api.actions;for(var verb in actions){if(this.activeRequest[actions[verb]]){Ext.Ajax.abort(this.activeRequest[actions[verb]]);}}}
 
23
Ext.data.HttpProxy.superclass.destroy.call(this);}});
 
 
b'\\ No newline at end of file'