From: Raymond I. <xw...@us...> - 2003-03-30 17:13:51
|
Update of /cvsroot/dynapi/dynapi3x/src/util In directory sc8-pr-cvs1:/tmp/cvs-serv11568/src/util Modified Files: datasource.js ioelement.js ioelement.soda.js Log Message: uploaded by raymond - includes kevin's patches Index: datasource.js =================================================================== RCS file: /cvsroot/dynapi/dynapi3x/src/util/datasource.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** datasource.js 10 Mar 2003 03:31:20 -0000 1.2 --- datasource.js 30 Mar 2003 17:13:15 -0000 1.3 *************** *** 13,17 **** this.EventObject(); ! this.clsid=IOElement.createGUID(); DataSource.all[this.clsid]=this; --- 13,17 ---- this.EventObject(); ! this.clsid=dynapi.functions.getGUID(); DataSource.all[this.clsid]=this; *************** *** 83,89 **** if(act=='fetchpage') this._ticket=this.webservice.call(act,[this.pageNumber,this.pageSize,params.pageType],fn,cargo); else this._ticket=this.webservice.call(act,[this.rowIndex,data],fn,cargo); ! }else if(this.webservice && this.wsSync) { // Web Service - Sync ! if(act=='fetcpage') r=this.webservice.call(act,[this.pageNumber,this.pageSize,params.pageType],false); else r=this.webservice.call(act,[this.rowIndex,data],false); if(r.error) this.invokeEvent('alert',null,'DataSource: '+r.error.text); --- 83,90 ---- if(act=='fetchpage') this._ticket=this.webservice.call(act,[this.pageNumber,this.pageSize,params.pageType],fn,cargo); else this._ticket=this.webservice.call(act,[this.rowIndex,data],fn,cargo); ! } ! else if(this.webservice && this.wsSync) { // Web Service - Sync ! if(act=='fetchpage') r=this.webservice.call(act,[this.pageNumber,this.pageSize,params.pageType],false); else r=this.webservice.call(act,[this.rowIndex,data],false); if(r.error) this.invokeEvent('alert',null,'DataSource: '+r.error.text); *************** *** 93,97 **** DataSource.fnProcessResponse(cargo,data); } ! }else { // HTTP GET & POST - Async fn=DataSource.fnGETPOSTResponse; --- 94,99 ---- DataSource.fnProcessResponse(cargo,data); } ! } ! else { // HTTP GET & POST - Async fn=DataSource.fnGETPOSTResponse; Index: ioelement.js =================================================================== RCS file: /cvsroot/dynapi/dynapi3x/src/util/ioelement.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ioelement.js 10 Mar 2003 03:31:20 -0000 1.2 --- ioelement.js 30 Mar 2003 17:13:16 -0000 1.3 *************** *** 37,41 **** if(useXFrames && dynapi.ua.ns4) { this._winXFrames=window.open("about:blank",null,'left=3000,top=3000,width=100,height=100,scrollbars=no,status=no,toolbar=no'); ! this._winXFrames.blur(); // hide the newly window } --- 37,45 ---- if(useXFrames && dynapi.ua.ns4) { this._winXFrames=window.open("about:blank",null,'left=3000,top=3000,width=100,height=100,scrollbars=no,status=no,toolbar=no'); ! this._winXFrames.blur(); // hide the new window ! var wxf=this._winXFrames; ! dynapi.onUnload(function() { // tidy up ! if(wxf.open && !wxf.closed) wxf.close(); ! }); } *************** *** 54,58 **** var t,r=['*'],html=[]; if (this._hidden) { ! if (this._winXFrames) html = ['<frame src="about:blank" name="',o._elmID,'" scrolling="none">']; else if (dynapi.ua.ns4) html = ['<ilayer name="',this._elmID,'" visibility="hide" width=0 height=0></ilayer>']; else html = ['<iframe name="',this._elmID,'" style="width:0px; height:0px; visibility:hidden"></iframe>']; --- 58,62 ---- var t,r=['*'],html=[]; if (this._hidden) { ! if (this._winXFrames) html = ['<frame src="about:blank" name="',this._elmID,'" scrolling="none">']; else if (dynapi.ua.ns4) html = ['<ilayer name="',this._elmID,'" visibility="hide" width=0 height=0></ilayer>']; else html = ['<iframe name="',this._elmID,'" style="width:0px; height:0px; visibility:hidden"></iframe>']; *************** *** 71,75 **** }else{ if (this._winXFrames) t = '<frame src="about:blank" name="',this._elmID,'" scrolling="none">'; ! else if (dynapi.ua.ns4) t = '<layer width='+this.w+' height='+this.h+' name="'+this._elmID+'" visibility="inherit"></ilayer>'; else t = '<iframe name="'+this._elmID+'" width='+this.w+' height='+this.h+' scrolling="no" frameborder="no" marginwidth=0 marginheight=0 style="overflow:hidden;"></iframe>'; this._elmThread=this._elmID; this._elmBusy[this._elmID]=false; --- 75,79 ---- }else{ if (this._winXFrames) t = '<frame src="about:blank" name="',this._elmID,'" scrolling="none">'; ! else if (dynapi.ua.ns4) t = '<ilayer width='+this.w+' height='+this.h+' name="'+this._elmID+'" visibility="inherit"></ilayer>'; else t = '<iframe name="'+this._elmID+'" width='+this.w+' height='+this.h+' scrolling="no" frameborder="no" marginwidth=0 marginheight=0 style="overflow:hidden;"></iframe>'; this._elmThread=this._elmID; this._elmBusy[this._elmID]=false; *************** *** 87,93 **** this._winXFrames.top.IOElement=IOElement; } ! }; IOElement.fnCreate = function() { ! if (this._SyncFn) window.setTimeout(o+'._initSync()',100); if (this.getScope()) { if (this._requestList.length>0) { --- 91,97 ---- this._winXFrames.top.IOElement=IOElement; } ! }; IOElement.fnCreate = function() { ! if (this._SyncFn) window.setTimeout(this+'._initSync()',100); if (this.getScope()) { if (this._requestList.length>0) { *************** *** 132,136 **** if(req){ this._elmBusy[req[4]]=false; ! delete(this._requests[id]); this._clearScope(); return true; --- 136,140 ---- if(req){ this._elmBusy[req[4]]=false; ! delete this._requests[id]; this._clearScope(); return true; *************** *** 217,221 **** url += (url.indexOf('?')==-1)? '?' : '&'; ! url += 'IORequestID='+id+'&IOElementID='+this.id+'&IOMethod='+method;; t=this+'._notify("'+id+'","'+url+'",false)'; --- 221,225 ---- url += (url.indexOf('?')==-1)? '?' : '&'; ! url += 'IORequestID='+id+'&IOElementID='+this.id+'&IOMethod='+method; t=this+'._notify("'+id+'","'+url+'",false)'; *************** *** 226,230 **** r[5] = window.setTimeout(t,this.failTime); ! if (method=="get" || (dynapi.ua.ns4 && !this._ns4Frames)) { if (data) { for (i in data) { --- 230,238 ---- r[5] = window.setTimeout(t,this.failTime); ! // reset document - this will help to prevent cross-domain access errors ! if (dynapi.ua.ns4) elm.src = 'about:blank'; ! else elm.document.location.href = 'about:blank'; ! ! if (method=="get" || (dynapi.ua.ns4 && !this._winXFrames)) { if (data) { for (i in data) { *************** *** 267,273 **** // begin transaction - data sent but awaiting reply // to-do work on a way to detech if caller is in the same domain as ! elm.document._tranState="begin"; ! if(!dynapi.ua.ns4) this._monitorTransactions(); ! this.invokeEvent("request"); } --- 275,282 ---- // begin transaction - data sent but awaiting reply // to-do work on a way to detech if caller is in the same domain as ! if(!dynapi.ua.ns4) { ! elm.document._tranState="begin"; ! this._monitorTransactions(); ! } this.invokeEvent("request"); } *************** *** 313,317 **** var s = (success!=null)? success : true; // delete transaction record ! delete(this._transactions[id]); if (!this._elmBusy[req[4]] && success) { dynapi.debug.print('IOElement Error: '+id+' '+this._elmID+' '+url); --- 322,326 ---- var s = (success!=null)? success : true; // delete transaction record ! delete this._transactions[id]; if (!this._elmBusy[req[4]] && success) { dynapi.debug.print('IOElement Error: '+id+' '+this._elmID+' '+url); *************** *** 336,340 **** } this._cargoID=''; ! if(s && id!=this._retryID) delete(this._requests[id]); else this._clearScope(); this._elmBusy[req[4]] = false; --- 345,349 ---- } this._cargoID=''; ! if(s && id!=this._retryID) delete this._requests[id]; else this._clearScope(); this._elmBusy[req[4]] = false; *************** *** 346,367 **** }; // Helper Methods ------------------------- - IOElement._Randomize = function(n) { - var t=new Date(); - return Math.round((Math.abs(Math.sin(t.getTime()))*(Math.random()*1000)))%n+1; - }; - IOElement._DecToHex = function(val){ - var lo=val%16; val-=lo; lo+=48; - if (lo>57) lo+=7; hi=val/16; hi+=48;if (hi>57) hi+=7; - return String.fromCharCode(hi,lo); - }; - IOElement.createGUID = function() { - var l,r,m,n,c=Math.random()+'' - c=c.substr(c.indexOf('.')+1); - m=(c.length-1)/2; - l=c.substr(0,m); r=c.substr(m); - n=this._Randomize(1000)+this._DecToHex(this._Randomize(255))+'-' - +l+'-'+this._DecToHex(this._Randomize(255))+this._DecToHex(this._Randomize(255))+'-'+r; - return n; - }; IOElement.getAbsoluteUrl=function(url, docUrl) { // inspired by afroAPI urlToAbs() if(url && url.indexOf('://')>0) return url; --- 355,358 ---- Index: ioelement.soda.js =================================================================== RCS file: /cvsroot/dynapi/dynapi3x/src/util/ioelement.soda.js,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ioelement.soda.js 10 Mar 2003 03:31:21 -0000 1.3 --- ioelement.soda.js 30 Mar 2003 17:13:16 -0000 1.4 *************** *** 5,9 **** The DynAPI Distribution is distributed under the terms of the GNU LGPL license. ! requires: dynapi.util.IOElement */ --- 5,9 ---- The DynAPI Distribution is distributed under the terms of the GNU LGPL license. ! requires: Math, IOElement */ *************** *** 23,27 **** o=this[name]={}; method=(method+'').toLowerCase(); ! o.sid=IOE.createGUID(); o._callback=fn; o._name=name; --- 23,27 ---- o=this[name]={}; method=(method+'').toLowerCase(); ! o.sid=dynapi.functions.getGUID(); o._callback=fn; o._name=name; *************** *** 87,91 **** var o,r,c,ws,et; ! if(!e||(e && !e.DynObject)) { // sync o=ws=this; --- 87,91 ---- var o,r,c,ws,et; ! if(!e||(e && e.constructor!=DynEvent)) { // sync o=ws=this; *************** *** 114,118 **** o.isConnected=s; } ! o._callback(ws,s,et); }; --- 114,118 ---- o.isConnected=s; } ! if (o._callback) o._callback(ws,s,et); }; |