this.bind=function()

in tapestry-framework/src/js/dojo-0.4.3-custom-4.1.6/src/io/ScriptSrcIO.js [73:174]


this.bind=function(_b){
var _c=_b.url;
var _d="";
if(_b["formNode"]){
var ta=_b.formNode.getAttribute("action");
if((ta)&&(!_b["url"])){
_c=ta;
}
var tp=_b.formNode.getAttribute("method");
if((tp)&&(!_b["method"])){
_b.method=tp;
}
_d+=dojo.io.encodeForm(_b.formNode,_b.encoding,_b["formFilter"]);
}
if(_c.indexOf("#")>-1){
dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",_c);
_c=_c.split("#")[0];
}
var _10=_c.split("?");
if(_10&&_10.length==2){
_c=_10[0];
_d+=(_d?"&":"")+_10[1];
}
if(_b["backButton"]||_b["back"]||_b["changeUrl"]){
dojo.undo.browser.addToHistory(_b);
}
var id=_b["apiId"]?_b["apiId"]:"id"+this._counter++;
var _12=_b["content"];
var _13=_b.jsonParamName;
if(_b.sendTransport||_13){
if(!_12){
_12={};
}
if(_b.sendTransport){
_12["dojo.transport"]="scriptsrc";
}
if(_13){
_12[_13]="dojo.io.ScriptSrcTransport._state."+id+".jsonpCall";
}
}
if(_b.postContent){
_d=_b.postContent;
}else{
if(_12){
_d+=((_d)?"&":"")+dojo.io.argsFromMap(_12,_b.encoding,_13);
}
}
if(_b["apiId"]){
_b["useRequestId"]=true;
}
var _14={"id":id,"idParam":"_dsrid="+id,"url":_c,"query":_d,"kwArgs":_b,"startTime":(new Date()).getTime(),"isFinishing":false};
if(!_c){
this._finish(_14,"error",{status:this.DsrStatusCodes.Error,statusText:"url.none"});
return;
}
if(_12&&_12[_13]){
_14.jsonp=_12[_13];
_14.jsonpCall=function(_15){
if(_15["Error"]||_15["error"]){
if(dojo["json"]&&dojo["json"]["serialize"]){
dojo.debug(dojo.json.serialize(_15));
}
dojo.io.ScriptSrcTransport._finish(this,"error",_15);
}else{
dojo.io.ScriptSrcTransport._finish(this,"load",_15);
}
};
}
if(_b["useRequestId"]||_b["checkString"]||_14["jsonp"]){
this._state[id]=_14;
}
if(_b["checkString"]){
_14.checkString=_b["checkString"];
}
_14.constantParams=(_b["constantParams"]==null?"":_b["constantParams"]);
if(_b["preventCache"]||(this.preventCache==true&&_b["preventCache"]!=false)){
_14.nocacheParam="dojo.preventCache="+new Date().valueOf();
}else{
_14.nocacheParam="";
}
var _16=_14.url.length+_14.query.length+_14.constantParams.length+_14.nocacheParam.length+this._extraPaddingLength;
if(_b["useRequestId"]){
_16+=_14.idParam.length;
}
if(!_b["checkString"]&&_b["useRequestId"]&&!_14["jsonp"]&&!_b["forceSingleRequest"]&&_16>this.maxUrlLength){
if(_c>this.maxUrlLength){
this._finish(_14,"error",{status:this.DsrStatusCodes.Error,statusText:"url.tooBig"});
return;
}else{
this._multiAttach(_14,1);
}
}else{
var _17=[_14.constantParams,_14.nocacheParam,_14.query];
if(_b["useRequestId"]&&!_14["jsonp"]){
_17.unshift(_14.idParam);
}
var _18=this._buildUrl(_14.url,_17);
_14.finalUrl=_18;
this._attach(_14.id,_18);
}
this.startWatchingInFlight();
};