1/* 2Infragistics Common Script 3Version <SUCCESSFUL_COMPONENT_VERSION> 4Copyright (c) 2001-2007 Infragistics, Inc. All Rights Reserved. 5 6The JavaScript functions in this file are intended for the internal use of the Intragistics Web Controls only. 7 8*/ 9//vs 071910 10function ig_WebControl(id) 11{ 12 if(arguments.length > 0){ 13 this.init(id); 14 } 15} 16ig_WebControl.prototype.init=function(id) 17{ 18 this._id=id; 19 var o=ig_all[id]; 20 if(o && o._deleteMe) 21 o._deleteMe(); 22 ig_all[id]=this; 23 this._posted=this._postRequest=0; 24 ig_shared._isPosted=false; 25 this.postField = ig_csom.getElementById(this.getClientID() + "_Data"); 26 this.clientState = ig_ClientState.createRootNode(); 27 this.rootNode = ig_ClientState.addNode(this.clientState, "XMLRootNode"); 28} 29 30ig_WebControl.prototype.constructor=ig_WebControl; 31ig_WebControl.prototype.getElement=function(){return this._element;} 32ig_WebControl.prototype.getID=function(){return this._id;} 33ig_WebControl.prototype.getUniqueID=function(){return this._uniqueID;} 34ig_WebControl.prototype.getClientID=function(){return this._clientID;} 35 36 37ig_WebControl.prototype.updateControlState = function(propName, propValue) { 38 if(this.controlState == null) 39 this.controlState = ig_ClientState.addNode(this.rootNode, "ControlState"); 40 41 ig_ClientState.setPropertyValue(this.controlState, propName, propValue); 42 if(this.postField != null) 43 this.postField.value = ig_ClientState.getText(this.clientState); 44} 45 46ig_WebControl.prototype.addStateItem = function(name, value) { 47 if(this.stateItems == null) 48 this.stateItems = ig_ClientState.addNode(this.rootNode, "StateItems"); 49 var stateItem = ig_ClientState.addNode(this.stateItems, "StateItem"); 50 this.updateStateItem(stateItem, name, value); 51 return stateItem; 52} 53 54ig_WebControl.prototype.updateStateItem = function(stateItem, propName, propValue) { 55 ig_ClientState.setPropertyValue(stateItem, propName, propValue); 56 if(this.postField != null) 57 this.postField.value = ig_ClientState.getText(this.clientState); 58} 59 60ig_WebControl.prototype.fireServerEvent = function(eventName, data) 61{ 62 if(ig_shared._isPosted) 63 return; 64 if(this._postRequest == -1) 65 { 66 this._postRequest = 0; 67 return; 68 } 69 this._postRequest = 0; 70 try 71 { 72 ig_shared._isPosted = true; 73 __doPostBack(this._uniqueID, eventName + ":" + data); 74 } 75 catch(e){} 76} 77 78ig_WebControl.prototype.removeEventListener = function(name, handler) 79{ 80 var i, evts = this._clientEvents ? this._clientEvents[name] : null; 81 if(evts != null) for(i = 0; i < evts.length; i++) 82 if(evts[i] != null && evts[i]._handler == handler) 83 { 84 delete evts[i]; 85 evts[i] = null; 86 return; 87 } 88} 89 90ig_WebControl.prototype.addEventListener = function(name, handler, obj, post) 91{ 92 if(typeof handler != "function") 93 return; 94 if(!this._clientEvents) this._clientEvents = new Object(); 95 var i, evts = this._clientEvents[name]; 96 if(evts == null) 97 evts = this._clientEvents[name] = new Array(); 98 var i0 = evts.length; 99 for(i = 0; i < evts.length; i++) 100 { 101 if(evts[i] == null) 102 i0 = i; 103 else if(evts[i]._handler == handler) 104 return; 105 } 106 var evt = new ig_EventObject(); 107 evt._object = obj; 108 evts[i0] = {_webcontrol:this, _eventName:name, _handler:handler, _autoPostBack:(post==true), _event:evt}; 109} 110 111ig_WebControl.prototype.fireEvent = function(name, evnt) 112{ 113 if(!name || this._isInitializing || !this._clientEvents) 114 return false; 115 this._postRequest = this._postAsync = 0; 116 var evt, evts = this._clientEvents[name]; 117 var cancel = false, postAsync = 0, post = 0, i = (evts == null) ? 0 : evts.length; 118 if(i == 0) 119 return false; 120 if(evnt == "check") 121 return true; 122 var args = this.fireEvent.arguments; 123 while(i-- > 0) 124 { 125 if(evts[i] == null) 126 continue; 127 evt = evts[i]._event; 128 evt.reset(); 129 evt.event=evnt; 130 evt.needPostBack=evts[i]._autoPostBack; 131 try 132 { 133 evts[i]._handler(this, evt, args[2], args[3], args[4], args[5], args[6], args[7]); 134 }catch(ex){continue;} 135 if(evt.cancelPostBack) 136 post = -1; 137 else if(post == 0) 138 { 139 if(evt.needPostBack) 140 post = 1; 141 else if(evt.needAsyncPostBack) 142 postAsync = 1; 143 } 144 if(evt.cancel) 145 cancel = true; 146 evt.event = null; 147 } 148 if(!cancel || post < 0) 149 this._postRequest = post; 150 if(!cancel && post == 0) 151 this._postAsync = postAsync; 152 return cancel; 153} 154ig_WebControl.prototype._decodeProps = function(props) 155{ 156 for(var i = 0; i < props.length; i++) 157 { 158 if(props[i] != null) 159 { 160 if(props[i].push != null) 161 this._decodeProps(props[i]); 162 if(typeof props[i]=="string") 163 { 164 /* SJZ /1/24/06 BR09289 - Need to use decodeURI so that Japanese Characters are handled correctly. 165 This also requires that the URLEncoding is done in UTF8 on the server */ 166 props[i] = decodeURI(props[i]); 167 /* SJZ 8/17/07 BR24424 - By having replace, outside of the unescape, we were actually replacing the converted 168 * "+"'s to spaces. This was a mistake, instead, we need to convert the "+"'s to spaces, before the unescape 169 * occcurs, so that we don't replace an actual "+" with a space*/ 170 props[i] = unescape(props[i].replace(/\+/g," ")); 171 props[i] = unescape(props[i]); 172 } 173 } 174 } 175} 176ig_WebControl.prototype._initControlProps = function(props) 177{ 178 this._decodeProps(props); 179 this._props = props[0]; 180 this._uniqueID = this._props[0]; 181 this._clientID = this._props[1]; 182 var i = props[1] ? props[1].length : 0; 183 while(i-- > 0) try 184 { 185 this.addEventListener(props[1][i][0], eval(props[1][i][1]), null, props[1][i][2]); 186 }catch(e) 187 {window.status = "Can't find " + props[1][i][1];} 188 this._objects = props[2]; 189 this._collections = props[3]; 190} 191 192//ig_initShared implements browser independent functionality 193function ig_initShared() 194{ 195 // Public Properties 196 this.ScriptVersion="5.3.20053.14"; 197 try{this.AgentName=navigator.userAgent.toLowerCase();}catch(e){this.AgentName="";} 198 this.MajorVersionNumber =parseInt(navigator.appVersion); 199 //this.AgentName=navigator.userAgent.toLowerCase(); 200 //this.MajorVersionNumber=parseInt(navigator.appVersion); 201 this.IsDom=document.getElementById?true:false; 202 this.IsNetscape62=this.AgentName.indexOf("netscape6")>=0; 203 var i=this.AgentName.indexOf("netscape/7."); 204 this.Netscape7=(i>0)?this.AgentName.charCodeAt(i+11)-48:-1; 205 this.IsNetscape=document.layers!=null; 206 this.IsNetscape6=(this.IsDom&&navigator.appName=="Netscape"); 207 this.IsSafari=this.AgentName.indexOf("safari")>=0; 208 this.IsFireFox=this.AgentName.indexOf("firefox")>=0; 209 this.IsFireFox10=this.AgentName.indexOf("firefox/1.0")>=0; 210 this.IsFireFox20=this.AgentName.indexOf("firefox/2.0")>=0; 211 this.IsFireFox15 = this.IsFireFox20 || this.AgentName.indexOf("firefox/1.5") >= 0; 212 this.IsFireFox30 = this.AgentName.indexOf("firefox/3.0") >= 0; 213 this.IsFireFox40 = this.AgentName.indexOf("firefox/4.0") >= 0; 214 this.IsOpera=this.AgentName.indexOf("opera")>=0; 215 this.IsMac=this.AgentName.indexOf("mac")>=0; 216 this.IsWin = this.AgentName.indexOf("win") >= 0; 217 this.IsIE = document.all != null && !this.IsOpera && !this.IsSafari; 218 if (this.IsIE) 219 { 220 this.MajorIEVersion = parseInt(this.AgentName.substr(this.AgentName.indexOf("msie ") + 5)); 221 this.IsIE4 = !this.IsDom; 222 this.IsIE4Plus = this.MajorVersionNumber >= 4; 223 this.IsIE5 = this.IsDom; 224 this.IsIE50 = this.IsIE5 && this.AgentName.indexOf("msie 5.0") > 0;
225 this.IsIEWin = this.IsWin; 226 this.IsIE55 = this.IsIEWin && this.AgentName.indexOf("msie 5.5") > 0; 227 this.IsIE6 = this.IsIEWin && this.AgentName.indexOf("msie 6.0") > 0; 228 this.IsIE7 = this.IsIEWin && this.AgentName.indexOf("msie 7.0") > 0; 229 this.IsIE8 = this.IsIEWin && this.AgentName.indexOf("msie 8.0") > 0; 230 this.IsIE9 = this.IsIEWin && this.AgentName.indexOf("msie 9.0") > 0; 231 this.IsIE7Compat = this.IsIE55 || this.IsIE6 || this.IsIE7; 232 // K.D. May 3rd, 2011 Bug #73212 We shouldn't include IE9 in the IE55Plus check 233 this.IsIE55Plus = this.IsIE7Compat || this.IsIE8; 234 this.IsIEStandards = !this.IsIE7Compat; 235 this.IsIE9Plus = this.MajorIEVersion >= 9; 236 } 237 this.IsStandardsMode=(document.compatMode=="CSS1Compat"); 238 this.attrID = "ig_mark"; 239 this._isPosted = false; 240 this.isFormPosted = function(){return this._isPosted;} 241 // Obtains an element object based on its Id 242 this.getElementById = function (tagName) 243 { 244 if(this.IsIE) 245 return document.all[tagName]; 246 else 247 return document.getElementById(tagName); 248 } 249 250 this.isArray = function(a) { 251 return a!=null && a.length!=null; 252 } 253 254 this.isEmpty = function(o) { 255 return !(this.isArray(o) && o.length>0); 256 } 257 258 this.notEmpty = function(o) { 259 return (this.isArray(o) && o.length>0); 260 } 261 //D.M. 8/15/2007 262 //Return an elements current styles. 263 this.getRuntimeStyle = function(elem) 264 { 265 if(!elem) 266 return null; 267 var s = elem.currentStyle; 268 if(s) 269 return s; 270 var win = document.defaultView; 271 if(!win) 272 win = window; 273 if(win.getComputedStyle) 274 s = win.getComputedStyle(elem, ''); 275 return s ? s : elem.style; 276 } 277 this.getStyleValue = function(style, prop, elem) 278 { 279 if(!style) 280 style = this.getRuntimeStyle(elem); 281 if(!style) 282 return null; 283 var val = style[prop]; 284 // M.H. March 28, 2011 Fix bug 69785 - Check if val is empty string. this.isEmpty check if val is array with at least 1 element. Note: in IE8 and previous versions style.getPropertyValue is undefined - in IE9 it is defined 285 if(!this.isEmpty(val) || !style.getPropertyValue || val != '') 286 return val; 287 return style.getPropertyValue(prop); 288 } 289 // Adds an event listener to an html element. 290 this.addEventListener=function(elem,evtName,fn,flag) 291 { 292 /* VS 07/17/2006 Atlas has a nasty feature: it adds its own attachEvent function to some elements. That func does not provide reference to browser-event. Also flag must be boolean. */ 293 try { if (elem.addEventListener && !this.IsIE9Plus) { elem.addEventListener(evtName, fn, flag == true); return; } } catch (ex) { } 294 try{if(elem.attachEvent){elem.attachEvent("on"+evtName,fn); return;}}catch(ex){} 295 eval("var old=elem.on"+evtName); 296 var sF=fn.toString(); 297 var i=sF.indexOf("(")+1; 298 try 299 { 300 if((typeof old =="function") && i>10) 301 { 302 old=old.toString(); 303 /* params of old function */ 304 var args=old.substring(old.indexOf("(")+1,old.indexOf(")")); 305 args=ig_shared.replace(args," ",""); 306 if(args.length>0) args=args.split(","); 307 /* body of old function */ 308 old=old.substring(old.indexOf("{")+1,old.lastIndexOf("}")); 309 /* name of new function with ( */ 310 sF=sF.substring(9,i); 311 if(old.indexOf(sF)>=0)return; 312 var s="fn=new Function("; 313 for(i=0;i<args.length;i++) 314 { 315 if(i>0)sF+=","; 316 s+="\""+args[i]+"\","; 317 sF+=args[i];
318 } 319 sF+=");"+old; 320 eval(s+"sF)"); 321 } 322 eval("elem.on"+evtName+"=fn"); 323 }catch(ex){} 324 } 325 326 /* Remove event listener from element */ 327 /* OK 12/29/08 5870 - removeEventListener requires 3 parameters in FF, added the flag parameter which is used for 328 the useCapture parameter in the removeEventListener of FF */ 329 this.removeEventListener = function(elem, evt, fn, flag) 330 { 331 try 332 { 333 if(elem && elem.removeEventListener)/* VS 09/21/2006 Atlas under Mozilla may add detachEvent member to element */ 334 { 335 elem.removeEventListener(evt, fn, flag == true); 336 return; 337 } 338 }catch(ex){} 339 try 340 { 341 if(elem && elem.detachEvent) 342 elem.detachEvent('on' + evt, fn); 343 }catch(ex){} 344 } 345 // Obtains the proper source element in relation to an event 346 this.getSourceElement = function (evnt, o) 347 { 348 if(evnt.target) // This does not appear to be working for Netscape 349 return evnt.target; 350 else 351 if(evnt.srcElement) 352 return evnt.srcElement; 353 else 354 return o; 355 } 356 357 this.getText = function (e){ 358 if(e==null)return ""; 359 var i,v=null,ii=(e.childNodes==null)?0:e.childNodes.length; 360 for(i=-1;i<ii;i++) 361 { 362 var ei=(i<0)?e:e.childNodes[i]; 363 if(ei.nodeName=="#text")v=(v==null)?ei.nodeValue:v+" "+ei.nodeValue; 364 } 365 if(v!=null)return v; 366 if((v=e.text)!=null)return v; 367 try{return e.innerText;}catch(ex){} 368 try{return e.innerHTML;}catch(ex){} 369 return ""; 370 } 371 372 this.setText = function (e, text) 373 { 374 if(e==null)return false; 375 if(text==null)text=""; 376 var i,ii=(e.childNodes==null)?0:e.childNodes.length; 377 for(i=-1;i<ii;i++) 378 { 379 var ei=(i<0)?e:e.childNodes[i]; 380 if(ei.nodeName=="#text") 381 { 382 if(text!=null){ei.nodeValue=text; text=null;} 383 else ei.nodeValue=""; 384 } 385 } 386 if(text!=null)try 387 { 388 if(e.text!=null)e.text=text; 389 else if(e.innerText!=null)e.innerText=text; 390 else e.innerHTML=text; 391 text=null; 392 }catch(ex){} 393 return text==null; 394 } 395 this.setEnabled = function (e, bEnabled) 396 { 397 if(this.IsIE) 398 e.disabled = !bEnabled; 399 } 400 this.getEnabled = function (e){ 401 if(this.IsIE) 402 return !e.disabled; 403 } 404 405 this.navigateUrl = function (targetUrl, targetFrame) 406 { 407 if(targetUrl == null || targetUrl.length == 0) 408 return; 409 var newUrl=targetUrl.toLowerCase(); 410 if(newUrl.indexOf("javascript:") == 0) 411 eval(targetUrl); 412 else 413 if(targetFrame != null && targetFrame!="") { 414 if(ig_shared.getElementById(targetFrame) != null) 415 ig_shared.getElementById(targetFrame).src = targetUrl; 416 else { 417 var oFrame = ig_searchFrames(top, targetFrame); 418 if(oFrame != null) 419 oFrame.location=targetUrl; 420 else 421 if(targetFrame == "_self" 422 || targetFrame == "_parent" 423 || targetFrame == "_media" 424 || targetFrame == "_top" 425 || targetFrame == "_blank" 426 || targetFrame == "_search") 427 window.open(targetUrl, targetFrame); 428 else 429 window.open(targetUrl); 430 } 431 } 432 else { 433 try { 434 location.href = targetUrl; 435 } 436 catch (x) { 437 } 438 } 439 } 440 441 function ig_searchFrames(frame, targetFrame) { 442 if(frame.frames[targetFrame] != null) 443 return frame.frames[targetFrame]; 444 var i; 445 for(i=0; i<frame.frames.length; i++) { 446 var subFrame = ig_searchFrames(frame.frames[i], targetFrame); 447 if(subFrame != null) 448 return subFrame; 449 } 450 return null; 451 } 452 453 this.findControl=function(startElement,idList,closestMatch){ 454 var item; 455 var searchString=""; 456 var i=0; 457 var partialId=idList.split(":"); 458 while(partialId[i+1]!=null&&partialId[i+1].length>0){ 459 searchString+=partialId[i]+".*"; 460 i++; 461 } 462 searchString+=partialId[i]+"$"; 463 var searchExp=new RegExp(searchString); 464 var curElement; 465 if(startElement != null) 466 curElement=startElement.firstChild; 467 else 468 curElement = window.document.firstChild; 469 while(curElement!=null){ 470 if(curElement.id!=null&&(curElement.id.search(searchExp))!=-1){ 471 ig_dispose(searchExp); 472 return curElement; 473 } 474 item=this.findControl(curElement,idList); 475 if(item!=null){ 476 ig_dispose(searchExp); 477 return item; 478 } 479 curElement=curElement.nextSibling; 480 } 481 ig_dispose(searchExp); 482 if(closestMatch) 483 return findClosestMatch(startElement,partialId); 484 else return null; 485 } 486 this.createTransparentPanel = function () 487 { 488 if (!this.IsIE) return null;
489 var transLayer = document.createElement("IFRAME"); 490 transLayer.style.zIndex = 1000; 491 transLayer.frameBorder = "no"; 492 transLayer.scrolling = "no"; 493 transLayer.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=0);"; 494 transLayer.style.visibility = 'hidden'; 495 transLayer.style.display = 'none'; 496 transLayer.style.position = "absolute"; 497 transLayer.src = 'javascript:("<html></html>")'; 498 var e = document.body.firstChild; 499 document.body.insertBefore(transLayer, e); 500 return new ig_TransparentPanel(transLayer); 501 } 502 /* Check if mouseout event should be ignored */ 503 /* evt: browser event */ 504 /* container: outer element to test for */ 505 /* elem(optional): element that define bounds */ 506 /* shift(optional): extra shift of bottom edge of elem (use 50 for inline table in Netscape). -1: disables "toElement" logic. */ 507 this.isInside=function(evt,container,elem,shift) 508 { 509 var to=evt.toElement; 510 if(to==null)to=evt.relatedTarget; 511 if(to!=null && shift!=-1) 512 { 513 while(to!=null) 514 { 515 if(to==container)return true; 516 to=to.parentNode; 517 } 518 return false; 519 } 520 if(elem==null)elem=container; if(shift==null)shift=0; 521 var z,x=-evt.clientX,y=-evt.clientY; 522 var w=elem.offsetWidth,h=elem.offsetHeight; 523 while(elem!=null) 524 { 525 if((z=elem.offsetLeft)!=null){x+=z; y+=elem.offsetTop;} 526 elem=elem.offsetParent; 527 } 528 return x<-1 && y<-1 && 1<x+w && 2+shift<y+h; 529 } 530 this.createHoverBehavior= function(objectToCallBackWith,element,mouseOverHandler,mouseOutHandler){ 531 element.__callBackObject=objectToCallBackWith; 532 element.__isEventReady=true; 533 objectToCallBackWith.__onFilteredMouseOver=mouseOverHandler; 534 objectToCallBackWith.__onFilteredMouseOut=mouseOutHandler; 535 this.addEventListener(element,"mouseover",ig_filterMouseOverEvents,false); 536 this.addEventListener(element,"mouseout",ig_filterMouseOutEvents,false); 537 } 538 /* it should be used by user class to obtain reference to CallBackManager */ 539 /* form - reference to the form (optional) */ 540 this.getCBManager = function(form) 541 { 542 if(!ig_all._ig_cbManager) 543 ig_all._ig_cbManager = new ig_callBackManager(form); 544 return ig_all._ig_cbManager; 545 } 546 /* That can be used by a control to process hidden CallBack events */ 547 /* Control may have following member functions: */ 548 /* onCBSubmit(id){} - it is called before hidden submit. The id - the id of source html-element. If function returns string 'cancelSubmit', then submit is canceled. If it returns 'cancelResponse', then response in not processed. */ 549 /* onCBBeforeResponse(){} - it is called before response (before change of innerHTML and javascript) */ 550 /* onCBAfterResponse(){} - it is called after response */ 551 /* These function will be called on appropriate events. */ 552 /* There is no guarantee that response after submit will ever happen. */ 553 /* params: */ 554 /* evalCtl - string which eval(evalCtl) returns reference to control */ 555 /* example: "igtbl_getGridById('UltraWebGrid1')" */ 556 /* elemID - id of html element which is rendered by control (located in callback panel) */ 557 /* it is optional if control is interested only in onCBSubmit() */ 558 this.addCBEventListener = function(evalCtl, elemID) 559 { 560 if(!this._cbListeners) 561 this._cbListeners = new Array(); 562 var i = -1; 563 while(++i < this._cbListeners.length) 564 if(this._cbListeners[i].evalCtl == evalCtl) 565 return; 566 this._cbListeners[i] = {evalCtl:evalCtl, elemID:elemID}; 567 } 568 /* That can be used to process the asynchronous submit events */ 569 /* fn - reference to function. If function returns string 'cancelSubmit', then submit is canceled. If it returns 'cancelResponse', then response in not processed. */ 570 /* function may have a parameter which contains the id of source html-element. */ 571 /* example: function mySubmit(id){if(id=='myButtonID')return 'cancelResponse';} ig_shared.addCBSubmitListener(mySubmit); */ 572 this.addCBSubmitListener = function(fn) 573 { 574 this.addCBEventListener(fn); 575 } 576 /* That can be used to process the asynchronous error events */ 577 /* fn - reference to function. */ 578 this.addCBErrorListener = function(fn) 579 { 580 var el = this._cbError; 581 if(!el) 582 el = this._cbError = new Array(); 583 el[el.length] = fn; 584 } 585 /* Find reference to form in current document */ 586 /* return reference to form or null */ 587 this.getForm = function() 588 { 589 var form = document.forms[0]; 590 if(!form && (form = document.form1) == null) 591 { 592 var i = -1, eds = document.getElementsByTagName('INPUT'); 593 while(!form && ++i < eds.length) 594 form = eds[i].form; 595 } 596 return form; 597 } 598 /* Find reference to element from its id */ 599 /* id - id of element */ 600 /* form - reference to form (optional) */ 601 /* return reference to element or null */ 602 this.getElement = function(id, form) 603 { 604 var e = document.getElementById(id); 605 if(e) 606 return e; 607 if(!form) 608 form = this.getForm(); 609 return form ? form[id] : null; 610 } 611 /* Set absolute position of the pan relative to elem */ 612 /* elem - html element which defines relative position (if null, then body is used) */ 613 /* pan - panel which absolute position will be set according to pos. All style attributes (display, position, zIndex, etc) are set here. */ 614 /* if(pan==null) then that function returns object which obj.x and obj.y contain coordinates of corner of elem */ 615 /* pos - location of pan relative to elem. See ig_Position object */ 616 /* ie - reference to transparent iframe or ig_TransparentPanel which should be positioned under pan */ 617 /* ed - optional left-top element located on the top of the pan: used by elementFromPoint for exact tune-up under IE */ 618 this.absPosition = function(elem, pan, pos, ie, ed) 619 { 620 var z, htm = null, e = elem, body = document.body; 621 var i = 1, ok = 0, y = 0, x = 0, pe = e; 622 var elemH = e ? e.offsetHeight : -1, elemW = e ? e.offsetWidth : 0; 623 while(e != null) 624 { 625 if(ok < 1 || e == body) 626 { 627 if((z = e.offsetLeft) != null) 628 x += z; 629 if((z = e.offsetTop) != null) 630 y += z; 631 } 632 if(e.nodeName == "HTML") 633 htm = body = e; 634 if(e == body) 635 break; 636 z = e.scrollLeft; 637 if(z == null || z == 0) 638 z = pe.scrollLeft; 639 if(z != null && z > 0) 640 x -= z; 641 z = e.scrollTop; 642 if(z == null || z == 0) 643 z = pe.scrollTop; 644 if(z != null && z > 0) 645 y -= z; 646 pe = e.parentNode; 647 e = e.offsetParent; 648 if(pe.tagName == "TR") 649 pe = e; 650 if(e == body && pe.tagName == "DIV") 651 { 652 e = pe; 653 ok++; 654 } 655 } 656 if(elem && document.elementFromPoint) 657 { 658 var xOld = x, yOld = y; 659 ok = true; 660 var x0 = body.scrollLeft, y0 = body.scrollTop; 661 while(++i < 16) 662 { 663 z = (i > 2) ? ((i & 2) - 1) * (i & 14) / 2 * 5 : 2; 664 e = document.elementFromPoint(x + z - x0, y + z - y0); 665 if(!e || e == ed || e == elem) 666 break; 667 } 668 if(i > 15 || !e) 669 ok = false; 670 x += z; 671 y += z; 672 i = z = 0; 673 while(ok && ++i < 22) 674 { 675 if(z == 0) x--; 676 else y--; 677 e = document.elementFromPoint(x - x0, y - y0); 678 if(!e || i > 20) 679 ok = false; 680 if(e != ed && e != elem) 681 if(z > 0) 682 break; 683 else 684 { 685 i = z = 1; 686 x++; 687 } 688 } 689 if(ok) 690 { 691 x--; 692 y--; 693 } 694 else 695 { 696 x = xOld; 697 y = yOld; 698 } 699 } 700 if(!pan) 701 return {x:x, y:y}; 702 var zIndex = 9999; 703 while(elem) 704 { 705 if(elem.nodeName == 'BODY' || elem.nodeName == 'FORM') 706 break;
707 z = this.getStyleValue(null, 'zIndex', elem); 708 if(z && z.substring) z = (z.length > 4 && z.charCodeAt(0) < 58) ? parseInt(z) : 0; 709 if(z && z >= zIndex) zIndex = z + 1; 710 elem = elem.parentNode; 711 } 712 ok = pan.style; 713 ok.position = 'absolute'; 714 ok.visibility = 'visible'; 715 ok.display = ''; 716 ok.zIndex = zIndex + 1; 717 ed = ed ? 0 : 20;/* reduction of window-size for possible scrollbars */ 718 var panH = pan.offsetHeight, panW = pan.offsetWidth; 719 var iH = body.clientHeight, iW = body.clientWidth, iL = body.scrollLeft, iT = body.scrollTop; 720 if(!iH || iH < 50) 721 { 722 iH = body.offsetHeight - ed; 723 iW = body.offsetWidth - ed; 724 } 725 z = body; 726 while(!htm && (z = z.parentNode) != null)/* find HTML element */ 727 if(z.nodeName == 'HTML') 728 htm = z; 729 if(htm)/* support for DOCTYPE=XHTML */ 730 { 731 z = htm.clientHeight; 732 i = htm.offsetHeight;/*alert("body.cH="+iH+" body.oH="+body.offsetHeight+" htm.cH="+z+" htm.oH="+i);*/ 733 if(z && z > 20 && !ig_shared.IsOpera)/* skip DOCTYPE=HTML(z==0), and Opera(z==i) */ 734 { 735 iH = z; 736 iW = htm.clientWidth; 737 iL = htm.scrollLeft; 738 iT = htm.scrollTop; 739 } 740 } 741 if(elemH < 0) 742 { 743 x = ++iL; 744 y = ++iT; 745 elemH = --iH; 746 elemW = --iW; 747 } 748 if(iH < 20) 749 iH = 20; 750 if(iW < 90) 751 iW = 90; 752 if(!pos) 753 pos = 0; 754 if(typeof pos == 'object') 755 { 756 if((z = pos.x) != null) 757 x += z; 758 if((z = pos.y) != null) 759 y += z; 760 pos = 0; 761 } 762 /* horizontal behind */ 763 if((pos & 4) != 0) 764 x += elemW; 765 /* horizontal infront */ 766 else if((pos & 3) == 3) 767 x -= panW; 768 /* horizontal center */ 769 else if((pos & 1) != 0) 770 x += (elemW >> 1) - (panW >> 1); 771 /* horizontal right */ 772 else if((pos & 2) != 0) 773 x += elemW - panW; 774 /* vertical center */ 775 if((pos & 8) != 0) 776 y += (elemH >> 1) - (panH >> 1); 777 /* vertical bottom */ 778 else if((pos & 16) != 0) 779 y += elemH - panH; 780 /* above */ 781 else if((pos & 32) != 0) 782 y -= panH; 783 /* below */ 784 else if((pos & 64) != 0) 785 y += elemH; 786 if(y + panH > iH + iT) 787 { 788 /* swap above */ 789 if((pos & 64) != 0 && y - iT - 3 > panH + elemH) 790 y -= panH + elemH; 791 else 792 y = iH + iT - panH; 793 } 794 if(y < iT) 795 y = iT; 796 if(x + panW > iW + iL) 797 { 798 /* swap infront */ 799 if((pos & 4) != 0 && x - iL - 3 > panW + elemW) 800 x -= panW + elemW; 801 else 802 x = iW + iL - panW; 803 } 804 if(x < iL) 805 x = iL; 806 if(ig_csom.IsMac) 807 { 808 x += ig_csom.IsIE ? 5 : 1; 809 y += ig_csom.IsIE ? 11 : 2; 810 } 811 ok.left = x + 'px'; 812 ok.top = y + 'px'; 813 if(ie && (z = ie.Element) != null) 814 ie = z; 815 if(!ie || (z = ie.style) == null) 816 return; 817 z.position = 'absolute'; 818 z.left = --x + 'px'; 819 z.top = --y + 'px'; 820 z.width = (panW + 2) + 'px'; 821 z.height = (panH + 2) + 'px'; 822 z.visibility = 'visible'; 823 z.display = ''; 824 z.zIndex = zIndex; 825 } 826 /* Check if string does not contains any js-statement related characters. Return false if "n" can not be the name of a function. */ 827 this.isName = function(n) 828 { 829 return n && n.indexOf('=') < 0 && n.indexOf(':') < 0 && n.indexOf('(') < 0 && n.indexOf(';') < 0 && n.indexOf(',') < 0 && n.indexOf('[') < 0 && n.indexOf('{') < 0 && n.indexOf('\"') < 0 && n.indexOf("'") < 0; 830 } 831 /* Replace all occurances of "s0" in "txt" by "s1" and return fixed string */ 832 this.replace = function(txt, s0, s1) 833 { 834 while(txt.indexOf(s0) >= 0) 835 txt = txt.replace(s0, s1); 836 return txt; 837 } 838 /* Set statement which will be evaluated after selected tab was changed */ 839 /* Example: ig_shared.addTabListener("ig_getWebControlById('WebAsyncRefreshPanel1')._resize()"); */ 840 this.addTabListener = function(fn) 841 { 842 var i, i1, tabs = this._tabListeners; 843 if(!tabs) 844 tabs = this._tabListeners = new Array(); 845 i = i1 = tabs.length; 846 while(i-- > 0) 847 { 848 if(!tabs[i]) i1 = i; 849 if(tabs[i] == fn) return; 850 } 851 tabs[i1] = fn; 852 } 853 /* Remove statement which was added by addTabListener */ 854 this.removeTabListener = function(fn) 855 { 856 var t, ok = false, tabs = this._tabListeners; 857 var i = tabs ? tabs.length : 0; 858 while(i-- > 0)if(tabs[i]) 859 { 860 if(tabs[i] == fn) tabs[i] = null; 861 else ok = true; 862 } 863 if(!ok) 864 this._tabListeners = null; 865 } 866 /* Notify listeners added by addTabListener. That is called by tab (or any interested party to ensure first paint of grid or chart). */ 867 this.fireTabChange = function() 868 { 869 var tabs = this._tabListeners; 870 var i = tabs ? tabs.length : 0; 871 while(i-- > 0)if(tabs[i]) 872 try{eval(tabs[i]);}catch(ex){} 873 } 874 // K.D. March 10, 2011 We need a toPixel function to handle issues with IE9 and Firefox 4 875 this.ToPixel = function (value) { 876 var units = ['px', 'em', '%', 'pt']; 877 for (var index = 0; index < units.length; index++) { 878 if (value.toString().indexOf(units[index]) >= 0) 879 return value; 880 } 881 return value.toString() + 'px'; 882 } 883 /* B.C May 5, 2011 This function return the first none text node from a node list. */ 884 this.getFirstNoneTextChild = function (nodesList) 885 { 886 var firstChild = nodesList.firstChild; 887 888 while(firstChild.nodeName == "#text") 889 { 890 firstChild = firstChild.nextSibling; 891 } 892 893 return firstChild; 894 } 895} 896function ig_delete(o){ig_dispose(o);} 897 898function ig_filterMouseOverEvents(evt){ 899 var element=ig_shared.getSourceElement(evt); 900 if(!element.__isEventReady){ 901 while(element!=null && !element.__isEventReady && element.tagName!="BODY")element=element.parentNode; 902 } 903 if(element && element.__isEventReady && (element._hasMouse||!ig_isMouseOverSourceAChild(evt,element))) 904 { 905 element._hasMouse=true; 906 element.__callBackObject.__onFilteredMouseOver(evt); 907 } 908} 909function ig_filterMouseOutEvents(evt){ 910 var element=ig_shared.getSourceElement(evt); 911 if(!element.__isEventReady){ 912 while(element!=null && !element.__isEventReady && element.tagName!="BODY")element=element.parentNode; 913 } 914 if(element&&element.__isEventReady&&!ig_isMouseOutSourceAChild(evt,element)) 915 { 916 element._hasMouse=false; 917 element.__callBackObject.__onFilteredMouseOut(evt); 918 } 919} 920 921function ig_isMouseOverSourceAChild(evt,element){ 922 var evnt=evt?evt:window.event; 923 if(evnt==null)return false; 924 var from=evnt.fromElement&&typeof evnt.fromElement!="undefined"?evnt.fromElement:evnt.relatedTarget; 925 if(from==element)return true; 926 if(from==null)return false; 927 return ig_isAChildOfB(from,element); 928} 929function ig_isMouseOutSourceAChild(evt,element){ 930 var evnt=window.event?window.event:evt; 931 if(!evnt)return false; 932 var to=evnt.toElement&&typeof evnt.toElement!="undefined"?evnt.toElement:evnt.relatedTarget; 933 if(to==element)return true; 934 if(to==null)return false; 935 return ig_isAChildOfB(to,element); 936} 937function ig_isAChildOfB(a,b){ 938 if(a==null||b==null)return false; 939 while(a!=null){ 940 a=a.parentNode; 941 if(a==b)return true; 942 } 943 return false; 944} 945function ig_getWebControlById(id) 946{ 947 var i,o=null; 948 if(!ig_shared.isEmpty(id))if((o=ig_all[id])==null)for(i in ig_all) 949 { 950 if((o=ig_all[i])!=null)if(o._id==id || o._clientID==id || o._uniqueID==id) 951 return o; 952 o=null; 953 } 954 return o; 955} 956if(typeof ig_all !="object") 957 var ig_all=new Object(); 958// cancel response of browser on event
959function ig_cancelEvent(e, type) 960{ 961 if(e == null) if((e = window.event) == null) return; 962 if(type && e.type != type) return; 963 if(e.stopPropagation != null) e.stopPropagation(); 964 if(e.preventDefault != null) e.preventDefault(); 965 e.cancelBubble = true; 966 e.returnValue = false; 967} 968function ig_TransparentPanel(transLayer){ 969 this.Element=transLayer; 970 this.show=function(){ 971 this.Element.style.visibility="visible"; 972 this.Element.style.display=""; 973 } 974 this.hide=function(){ 975 this.Element.style.visibility="hidden"; 976 this.Element.style.display="none"; 977 } 978 this.setPosition=function(top,left,width,height){ 979 this.Element.style.top=top; 980 this.Element.style.left=left; 981 this.Element.style.width=width; 982 this.Element.style.height=height; 983 } 984} 985if(typeof ig_shared !="object") 986 var ig_shared=new ig_initShared(); 987var ig_csom=ig_shared,ig=ig_shared; 988 989//Emulate 'apply' if it doesn't exist. 990if ((typeof Function != 'undefined')&& 991 (typeof Function.prototype != 'undefined')&& 992 (typeof Function.apply != 'function')) { 993 Function.prototype.apply = function(obj, args){ 994 var result, fn = 'ig_apply' 995 while(typeof obj[fn] != 'undefined') fn += fn; 996 obj[fn] = this; 997 var length=(((ig_shared.isArray(args))&&(typeof args == 'object'))?args.length:0); 998 switch(length){ 999 case 0: 1000 result = obj[fn](); 1001 break; 1002 default: 1003 for(var item=0, params=''; item<args.length;item++){ 1004 if(item!=0) params += ','; 1005 params += 'args[' + item +']'; 1006 } 1007 result = eval('obj.'+fn+'('+params+');'); 1008 break; 1009 } 1010 ig_dispose(obj[fn]); 1011 return result; 1012 }; 1013} 1014 1015function findClosestMatch(startElement,partialId){ 1016 var item; 1017 var searchString=""; 1018 var i=0; 1019 while(partialId[i+1]!=null&&partialId[i+1].length>0){ 1020 searchString+="("+partialId[i]+")?"; 1021 i++; 1022 } 1023 searchString+=partialId[i]+"$"; 1024 var searchExp=new RegExp(searchString); 1025 var curElement=startElement.firstChild; 1026 while(curElement!=null){ 1027 if(curElement.id!=null&&(curElement.id.search(searchExp))!=-1){ 1028 return curElement; 1029 } 1030 item=findClosestMatch(curElement,partialId); 1031 if(item!=null)return item; 1032 curElement=curElement.nextSibling; 1033 } 1034 return null; 1035} 1036 1037function ig_EventObject(){ 1038 this.event=null; 1039 this.cancel=false; 1040 this.cancelPostBack=false; 1041 this.needPostBack=false; 1042 this.reset=function() 1043 { 1044 this.event=null; 1045 this.needPostBack=false; 1046 this.cancel=false; 1047 this.cancelPostBack=false; 1048 this.needAsyncPostBack=false; 1049 } 1050} 1051/*** 1052* This Function should be called when an event needs to be fired. 1053* The Event should be created using the ig_EventObject function above. 1054* @param oControl - the javascript object representation of your control. 1055* @param eventName - the name of the function that should handle this event. 1056* Other parameters should be appended as needed when calling this function. 1057* The last parameter should always be the Event object created by the ig_EventObject function. 1058****/ 1059function ig_fireEvent(oControl,eventName) 1060{ 1061 var i, fn = eventName; 1062 if(!fn || !oControl) return false; 1063 if(ig_shared.isName(fn))/* VS 06/29/2006 support for explicit custom functions/statements */ 1064 { 1065 fn += "(oControl"; 1066 for(i = 2; i < ig_fireEvent.arguments.length; i++) 1067 fn += ", ig_fireEvent.arguments[" + i + "]"; 1068 fn += ");"; 1069 } 1070 try{eval(fn);} 1071 catch(i){window.status = "Can't eval " + fn; return false;} 1072 return true; 1073} 1074 1075function ig_dispose(obj) 1076{ 1077 // K.D. May 2nd, 2011 Bug #73059 IE9 should be excluded from this check otherwise causing browser to crash. 1078 if(ig_shared.IsIE && !ig_shared.IsIE9Plus && ig_shared.IsWin) 1079 for(var item in obj) 1080 { 1081 var t = typeof obj[item];/*VS 02/12/2007 BR19717: boolean, number, function*/ 1082 if(obj[item] && t != 'undefined' && !obj[item].tagName && !obj[item].disposing && t != 'boolean' && t != 'number' && t != 'string' && t != 'function') 1083 { 1084 try { 1085 obj[item].disposing=true; 1086 ig_dispose(obj[item]); 1087 } catch(e1) {;} 1088 } 1089 try{delete obj[item];}catch(e2){;} 1090 } 1091} 1092 1093function ig_initClientState(){ 1094 this.XmlDoc=document; 1095 this.createRootNode=function(){ 1096 if(!ig_shared.IsIE){ 1097 var str ='<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><ClientState id="vs"></ClientState></html>'; 1098 var p = new DOMParser(); 1099 var doc = p.parseFromString(str,"text/xml"); 1100 this.XmlDoc=doc; 1101 return doc.getElementById("vs"); 1102 } 1103 if(ig_shared.IsIE50)this.XmlDoc=ig_createActiveXFromProgIDs(["MSXML2.DOMDocument","Microsoft.XMLDOM"]);//~ AK 5/12/2006 new ActiveXObject("Microsoft.XMLDOM"); 1104 return this.createNode("ClientState"); 1105 } 1106 this.setPropertyValue=function(element,name,value){ 1107 if(element!=null)element.setAttribute(name,escape(value)); 1108 } 1109 this.getPropertyValue=function(element,name){ 1110 if(element==null)return ""; 1111 return unescape(element.getAttribute(name)); 1112 } 1113 this.addNode=function(element,nodeName){ 1114 var newNode=this.createNode(nodeName); 1115 if(element!=null)element.appendChild(newNode); 1116 return newNode; 1117 } 1118 this.removeNode=function(element,nodeName){ 1119 var nodeToRemove=this.findNode(element,nodeName); 1120 if(element!=null) 1121 return element.removeChild(nodeToRemove); 1122 return null; 1123 } 1124 this.createNode=function(nodeName){ 1125 return this.XmlDoc.createElement(nodeName); 1126 } 1127 this.findNode=function(element,node){ 1128 if(element==null)return null; 1129 var curElement=element.firstChild; 1130 while(curElement!=null){ 1131 if(curElement.nodeName==node || curElement==node){ 1132 return curElement; 1133 } 1134 var item=this.findNode(curElement,node); 1135 if(item!=null)return item; 1136 curElement=curElement.nextSibling; 1137 } 1138 return null; 1139 } 1140 this.getText=function(element){ 1141 if(element==null)return ""; 1142 if(ig_shared.IsIE55Plus)return escape(element.innerHTML);
1143 return escape(this.XmlToString(element)); 1144 } 1145 this.XmlToString=function(startElem){ 1146 var str=""; 1147 if(!startElem)return ""; 1148 var curElement=startElem.firstChild; 1149 while(curElement!=null){ 1150 str+="<"+curElement.tagName+" "; 1151 1152 for(var i=0; i<curElement.attributes.length;i++) 1153 { 1154 var attrib=curElement.attributes[i]; 1155 str+=attrib.nodeName+"=\""+attrib.nodeValue+"\" "; 1156 } 1157 1158 str+=">"; 1159 str+=this.XmlToString(curElement); 1160 str+="</"+curElement.tagName+">"; 1161 curElement=curElement.nextSibling; 1162 } 1163 return str; 1164 } 1165} 1166// 1167function ig_xmlNode(name) 1168{ 1169 this.lastChild = null; 1170 this.name = name; 1171 this.getText = function(){return escape(this.toString());} 1172 this.childNodes = new Array(); 1173 this.toString = function() 1174 { 1175 var i, s = (this.name == null) ? "" : "<" + this.name; 1176 if(this.props != null) for(i = 0; i < this.props.length; i++) 1177 s += " " + this.props[i].name + "=\"" + this.props[i].value + "\""; 1178 if(this.name != null) s += ">"; 1179 for(i = 0; i < this.childNodes.length; i++) 1180 s += this.childNodes[i].toString(); 1181 if(this.name != null) s += "</" + this.name + ">"; 1182 return s; 1183 } 1184 this.addNode = function(node, unique) 1185 { 1186 if(node == null) return null; 1187 if(unique == true) if((unique = this.findNode(node)) != null) return unique; 1188 if(node.name == null) node = new ig_xmlNode(node); 1189 node.parentNode = this; 1190 this.lastChild = node; 1191 return this.childNodes[this.childNodes.length] = node; 1192 } 1193 this.appendChild = this.addNode; 1194 this.setAttribute = function(name, value) 1195 { 1196 if(name == null) return; 1197 if(this.props == null) this.props = new Array(); 1198 var prop, i = this.props.length; 1199 value = (value == null) ? "" : value; 1200 while(i-- > 0) 1201 { 1202 prop = this.props[i]; 1203 if(prop.name == name){prop.value = value; return;} 1204 } 1205 prop = new Object(); 1206 prop.name = name; 1207 prop.value = value; 1208 this.props[this.props.length] = prop; 1209 } 1210 this.setPropertyValue = function(name, value){this.setAttribute(name, (value == null) ? value : escape(value));} 1211 this.findNode = function(node, descendants) 1212 { 1213 if(node != null) for(var i = 0; i < this.childNodes.length; i++) 1214 { 1215 var n = this.childNodes[i]; 1216 if(n != null) 1217 { 1218 if(n.name == node || n == node) 1219 { 1220 n.index = i; 1221 return n; 1222 } 1223 if(descendants == true && (n = n.findNode(node)) != null) return n; 1224 } 1225 } 1226 return null; 1227 } 1228 this.removeNode=function(n) 1229 { 1230 if((n=this.findNode(n))==null)return n; 1231 var i=-1,j=0,a=new Array(),a0=n.parentNode.childNodes; 1232 while(++i<a0.length)if(i!=n.index)a[j++]=a0[i]; 1233 n.parentNode.childNodes=a; 1234 this.lastChild = a.length <= 0 ? null : a[a.length-1] ; 1235 return n; 1236 } 1237 this.getPropertyValue = function(name) 1238 { 1239 var i = (this.props == null) ? 0 : this.props.length; 1240 while(i-- > 0) 1241 if(this.props[i].name == name) 1242 return unescape(this.props[i].value); 1243 return null; 1244 } 1245} 1246function ig_xmlNodeStatic() 1247{ 1248 this.createRootNode = function(){return new ig_xmlNode("Temp");} 1249 this.addNode = function(e, n){return (e == null) ? (new ig_xmlNode(n)) : e.addNode(n);} 1250 this.removeNode = function(e, n){return (e == null) ? e : e.removeNode(n);} 1251 this.findNode = function(e, n){return (e == null) ? e : e.findNode(n);} 1252 this.setPropertyValue = function(e, n, v){if(e != null)e.setPropertyValue(n, v);} 1253 this.getPropertyValue = function(e, n){return (e == null) ? "" : e.getPropertyValue(n);} 1254 this.getText = function(e) 1255 { 1256 var s = "", i = (e == null) ? 0 : e.childNodes.length; 1257 for(var j = 0; j < i; j++) s += e.childNodes[j].getText(); 1258 return s; 1259 } 1260} 1261 1262try{ig_shared.addEventListener(window, "load", ig_handleEvent);}catch(ex){} 1263try{ig_shared.addEventListener(window, "unload", ig_handleEvent);}catch(ex){} 1264try{ig_shared.addEventListener(window, "resize", ig_handleEvent);}catch(ex){} 1265function ig_findElemWithAttr(elem, attr) 1266{ 1267 while(elem != null) 1268 { 1269 try 1270 { 1271 if(elem.getAttribute != null && !ig_shared.isEmpty(elem.getAttribute(attr))) 1272 return elem; 1273 }catch(ex){} 1274 elem = elem.parentNode; 1275 } 1276 return null; 1277} 1278function ig_handleEvent(evt) 1279{ 1280 if(evt == null) if((evt = window.event) == null) return; 1281 var obj, attr = ig_shared.attrID, src = evt.target, type = evt.type;/* VS 09/21/2006 Atlas under Mozilla may add srcElement member to event object */ 1282 if(ig_shared.isEmpty(type)) return; 1283 var fn = "obj._on" + type.substring(0, 1).toUpperCase() + type.substring(1); 1284 if(!src) 1285 src = evt.srcElement; 1286 if(type == "load" || type == "unload" || type == "resize" || !src) 1287 { 1288 for(obj in ig_all) 1289 { 1290 if((obj = ig_all[obj]) == null) 1291 continue; 1292 eval("if(" + fn + "!=null){" + fn + "(src,evt); obj=null;}"); 1293 if(obj && obj._onHandleEvent) 1294 obj._onHandleEvent(src, evt); 1295 } 1296 if(type == "unload") 1297 { 1298 ig_dispose(ig_all); 1299 for(var id in ig_all) if(ig_all[id]) 1300 ig_all[id].base = null; 1301 } 1302 return; 1303 } 1304 var elem = ig_findElemWithAttr(src, attr); 1305 if(elem == null) 1306 elem = ig_findElemWithAttr(this, attr); 1307 if(elem != null && (obj = ig_getWebControlById(elem.getAttribute(attr))) != null) 1308 { 1309 eval("if(" + fn + "!=null){" + fn + "(src,evt); obj=null;}"); 1310 if(obj != null && obj._onHandleEvent != null) 1311 obj._onHandleEvent(src, evt); 1312 } 1313} 1314function ig_handleTimer(obj) 1315{ 1316 var i, a = -1, all = ig_shared._timers, fn = ig_shared._timerFn; 1317 /*get around special features of firefox*/ 1318 if(typeof obj == 'number')obj=null; 1319 if(obj) 1320 { 1321 if(!obj._onTimer) return; 1322 if(!all) ig_shared._timers = all = new Array(); 1323 var a = i = all.length; 1324 while(i-- > 0) { if(all[i] == obj) break; if(!all[i]._onTimer) a = i; } 1325 if(i < 0) all[a] = obj;
1326 if(!fn) ig_shared._timerFn = fn = window.setInterval(ig_handleTimer, 200); 1327 return; 1328 } 1329 if(!fn) return; 1330 for(i = 0; i < all.length; i++) if(all[i] && all[i]._onTimer) if(!all[i]._onTimer()) 1331 obj = true; 1332 if(obj) return; 1333 window.clearInterval(fn); 1334 delete ig_shared._timerFn; 1335} 1336 1337var ig_ClientState=null; 1338if(!ig_shared.IsIE55Plus||!ig_shared.IsWin) ig_ClientState = new ig_xmlNodeStatic(); 1339else ig_ClientState=new ig_initClientState(); 1340 1341var _asyncSmartCallbacks = new Array(); 1342var _inCallback = false; 1343 /* 1344 DK 1/19/2006 1345 BR19339: "XmlHTTPResponseHandler" event's gridResponse is not initialized in UltraWebGrid in FireFox. 1346 The waitResponse variable controls whether or not the request will be executed asyncronously (why it dupes the this._async you need to talk to someone else) 1347 Anyway it is important to know that FireFox 1.5.0.9 does not fire OnReadyStateChange if you are working synchronosly. So if you set 1348 waitResponse to true, you won't get your callbackfucntion called. 1349 */ 1350function ig_SmartCallback(clientContext, serverContext, callbackFunction, uniqueId, control, waitResponse) 1351{ 1352 var _callbackFunction; 1353 var _url = null; 1354 var _postdata = ""; 1355 var _async = true; 1356 this._registeredControls = new Array(); 1357 this._control = control; 1358 this._waitResponse=(waitResponse===true); 1359 this._progressIndicator = null; 1360 1361 this._registeredControls[0] = {clientContext:clientContext, serverContext:serverContext, callbackFunction:callbackFunction, uniqueId:uniqueId, control:control}; 1362 1363 if(typeof XMLHttpRequest != "undefined") { 1364 __xmlHttpRequest = new XMLHttpRequest(); 1365 } 1366 else if(typeof ActiveXObject != "undefined") 1367 { 1368 try{ 1369 __xmlHttpRequest = ig_createActiveXFromProgIDs(["MSXML2.XMLHTTP","Microsoft.XMLHTTP"]);//~ AK 5/12/2006 new ActiveXObject("Microsoft.XMLHTTP"); 1370 } 1371 catch(e) 1372 { 1373 } 1374 } 1375 1376 this.registerControl = function(clientContext, serverContext, callbackFunction, uniqueId, control) 1377 { 1378 this._registeredControls.push({clientContext:clientContext, serverContext:serverContext, callbackFunction:callbackFunction, uniqueId:uniqueId, control:control}); 1379 } 1380 1381 this._xmlHttpRequest = __xmlHttpRequest; 1382 1383 this.execute = function () 1384 { 1385 var exec = true; 1386 if(this.beforeCallback != null) 1387 exec = this.beforeCallback(); 1388 if(exec)try 1389 { 1390 if(this._progressIndicator != null) 1391 this._progressIndicator.display(); 1392 this.formatCallbackArguments(); 1393 this.registerSmartCallback(); 1394 this._xmlHttpRequest.open("POST", this.getUrl(), !this._waitResponse); 1395 this._xmlHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 1396 this._xmlHttpRequest.onreadystatechange = this._responseComplete; 1397 this._xmlHttpRequest.send(this.getCallbackArguments()); 1398 }catch(exec){} 1399 } 1400 1401 this.getCallbackArguments = function () { 1402 return this._callbackArguments; 1403 } 1404 this.setCallbackArguments = function (callbackArguments) { 1405 this._callbackArguments = callbackArguments; 1406 } 1407 1408 this.getUrl = function () { 1409 if(this._url == null) { 1410 return this.getForm().action; 1411 } 1412 return this._url; 1413 } 1414 1415 this.setUrl = function (url) { 1416 this._url = url; 1417 } 1418 1419 this.getForm = function () 1420 { 1421 var form; 1422 /* SJZ BR15574 - Since a customer can technically put another form on the page, only one form can 1423 * have a runat=server tag. Since that doesn't show up in the DOM we'll go on the assumption that they won't have the 1424 * attributes set below */ 1425 if(document.forms.length > 1) 1426 { 1427 for(var i = 0; i < document.forms.length; i++) 1428 { 1429 if(document.forms[i].method == "post" && document.forms[i].action != "") 1430 { 1431 form = document.forms[i]; 1432 break; 1433 } 1434 } 1435 if(form == null) 1436 form = document.forms[0]; 1437 } 1438 else 1439 form = document.forms[0]; 1440 if (!form) 1441 form = document.form1; 1442 return form; 1443 } 1444 1445 this.setProgressIndicator = function(value) 1446 { 1447 this._progressIndicator = value; 1448 } 1449 1450 this._responseComplete = function () 1451 { 1452 var proccessComplete = null; 1453 for (var i = 0; i < _asyncSmartCallbacks.length; i++) { 1454 smartCallback = _asyncSmartCallbacks[i]; 1455 if (smartCallback && smartCallback._xmlHttpRequest && (smartCallback._xmlHttpRequest.readyState == 4)) 1456 { 1457 //if(smartCallback && smartCallback._xmlHttpRequest.status == "500") 1458 // alert(smartCallback && smartCallback._xmlHttpRequest.responseText); 1459 _asyncSmartCallbacks[i] = null; 1460 smartCallback.processSmartCallback(); 1461 proccessComplete = smartCallback; 1462 } 1463 } 1464 if(proccessComplete != null) 1465 { 1466 if(proccessComplete.callbackFinished != null) 1467 proccessComplete.callbackFinished(); 1468 proccessComplete._control = null; 1469 proccessComplete._registeredControls = null; 1470 proccessComplete._progressIndicator = null; 1471 ig_dispose(proccessComplete); 1472 proccessComplete = null; 1473 } 1474 } 1475 1476 this.processSmartCallback = function () { 1477 var responseString = this._xmlHttpRequest.responseText; 1478 var startIndex = responseString.indexOf("_ig_start"); 1479 var endIndex = responseString.indexOf("_ig_end"); 1480 var length = endIndex; 1481 if(startIndex > -1 && endIndex > -1) { 1482 responseString = responseString.substring(startIndex + 9, length); 1483 var response = eval(responseString); 1484 var index; 1485 for(index = 0; index < response.length; index++) 1486 { 1487 controlResponse = response[index]; 1488 var header = controlResponse[0]; 1489 var payload = controlResponse[1].replace(/\ig_NL/g, "\n"); 1490 1491 for(var i = 0; i < this._registeredControls.length; i++) 1492 { 1493 if(this._registeredControls[i] != null && header == this._registeredControls[i].uniqueId) 1494 { 1495 if(payload.length > 0) 1496 { 1497 if(this._registeredControls[i].clientContext.requestType != null && this._registeredControls[i].clientContext.requestType == "styles") 1498 this._resolveStyles(payload); 1499 else if(this._registeredControls[i].callbackFunction != null) 1500 this._registeredControls[i].callbackFunction(payload, this._registeredControls[i].clientContext); 1501 else if(this._registeredControls[i].control.callbackRender != null) 1502 this._registeredControls[i].control.callbackRender(payload, this._registeredControls[i].clientContext); 1503 } 1504 this._registeredControls[i] = null; 1505 break; 1506 } 1507 } 1508 } 1509 } 1510 if(this._progressIndicator != null) 1511 this._progressIndicator.hide(); 1512 } 1513 /* SJZ 1/16/07 - SmartCallbacks never took into account styles before. To handle styles, the control needs to have a requestType of "styles" 1514 * On the server they can call the static method GetStyleArray, which creats a response that looks like the following: 1515 * ["key", [["className", "stylesForClass], ["className", "stylesForClass"]] 1516 * This method will automatically be called in smartCallback, if the requestType of the clientContext is "styles"*/ 1517 this._resolveStyles = function(response) 1518 { 1519 /* VS 12/05/2008 Bug 6359. IE6 gets suspended. */ 1520 if(ig_shared.IsIE6) 1521 return; 1522 /* VS 03/31/2009. remove tabs */ 1523 var json = eval(response.replace(/\^/g, "\"").replace(/\t/g, '')); 1524 var key = json[0]; 1525 var styleBlock = eval(json[1]); 1526 var iLen = styleBlock ? styleBlock.length : 0; 1527 if(iLen < 1) 1528 return; 1529 var styles = document.getElementsByTagName("style"); 1530 for(var i = 0; i < styles.length; i++) 1531 { 1532 var rules;
1533 if(ig_shared.IsIE) 1534 rules = styles[i].styleSheet.rules; 1535 else 1536 rules = styles[i].sheet.cssRules; 1537 /* D.M. TFS12566 2/2/2009 - Converted this loop to count backwards so that we do not inadvertently remove the wrong styles. */ 1538 var j, count = rules.length; 1539 for(j = count - 1; j >= 0; j--) 1540 { 1541 /* VS 10/14/2008 Bug 8646. Exception on access to selectorText */ 1542 var text = null; 1543 try{text = rules[j].selectorText;}catch(e){} 1544 /* VS 03/31/2009. Find matching new style */ 1545 var ok = (text && text.indexOf && text.indexOf(key) > -1) ? iLen : 0; 1546 while(ok-- > 0) 1547 if(styleBlock[ok] && styleBlock[ok][0] == text) 1548 break; 1549 /* VS 03/31/2009 Bug 15534. Do not remove old style if there is no matching new style. */ 1550 if(ok >= 0) try 1551 { 1552 if(ig_shared.IsIE) 1553 styles[i].styleSheet.removeRule(j); 1554 else 1555 styles[i].sheet.deleteRule(j); 1556 }catch(e){} 1557 } 1558 for(j = 0; j < iLen; j++) 1559 { 1560 if(styleBlock[j]) 1561 { 1562 if(ig_shared.IsIE) 1563 styles[i].styleSheet.addRule(styleBlock[j][0], styleBlock[j][1], 0); 1564 else 1565 styles[i].sheet.insertRule(styleBlock[j][0] + "{" + styleBlock[j][1] + "}", 0); 1566 } 1567 } 1568 } 1569 } 1570 1571 this.registerSmartCallback = function () { 1572 var index; 1573 for(index = 0; index < _asyncSmartCallbacks.length; index++) 1574 if(!_asyncSmartCallbacks[index]) 1575 break; 1576 _asyncSmartCallbacks[index] = this; 1577 return index; 1578 } 1579 1580 this.formatCallbackArguments = function () { 1581 1582 /* SJZ BR32682 5/8/08 - Added for Aikido support */ 1583 /* OK BR32814 5/13/08 - Added the try/catch around the __igSubmit, otherwise an exception was thrown during the check of the condition if __igSubmit was undifined */ 1584 /* VS 5/21/2008 typeof should be used for test of undefined objects/functions */ 1585 if(typeof __igSubmit == 'function') 1586 __igSubmit(); 1587 var form = this.getForm(); 1588 if(!form) return; 1589 var count = form.elements.length; 1590 var element; 1591 for (var i = 0; i < count; i++) { 1592 element = form.elements[i]; 1593 if (element.tagName.toLowerCase() == "input" && (element.type == "hidden" || element.type == 'password' || element.type == 'text' || ((element.type == "checkbox"|| element.type =='radio')&& element.checked))) 1594 this.addCallbackField(element.name, element.value); 1595 else if(element.tagName.toLowerCase() == "textarea") 1596 this.addCallbackField(element.name, element.value); 1597 else if(element.tagName.toLowerCase() == "select") 1598 { 1599 var o = element.options.length; 1600 while(o-- > 0) 1601 { 1602 if(element.options[o].selected) 1603 this.addCallbackField(element.name, element.options[o].value); 1604 } 1605 } 1606 1607 } 1608 1609 var args = _postdata + "__EVENTTARGET=&__EVENTARGUMENT=&" + 1610 "__CALLBACKID=" + 1611 this._registeredControls[0].uniqueId + 1612 //this.getServerId() + 1613 "&__CALLBACKPARAM="; 1614 var xml = '<SmartCallback>'; 1615 if(this._registeredControls!= null) { 1616 for(var i = 0; i < this._registeredControls.length; i++) 1617 { 1618 xml += "<Control"; 1619 var control = this._registeredControls[i]; 1620 1621 xml += " id='" + control.uniqueId + "'"; 1622 for(property in control.serverContext) 1623 { 1624 if(control.serverContext[property] != null) { 1625 var value = control.serverContext[property].toString(); 1626 while(value.indexOf("'") != -1) { 1627 value = value.replace("'", "^^"); 1628 } 1629 /* SJZ 11/13/06 - BR16915/BR16883 - Need to escape the value, so that special chars make it to the server*/ 1630 /* SJZ 8/10/07 - BR23207 - So, when using smartcallbacks, the callback information, is 1631 * converted to xml and sent to the server. This would be fine, except that we originally 1632 * only escaped the content once. We actually needed to escape the content twice, once so 1633 * that xml was escaped, and a second time, so that the values inside of the xml 1634 * were still escaped, so that they wouldn't give LoadXML a problem loading them. */ 1635 xml += " " + property + "='" + escape(escape(value)) + "'"; 1636 } 1637 } 1638 xml += "/>" 1639 } 1640 } 1641 xml += "</SmartCallback>"; 1642 xml = escape(xml); 1643 args += xml; 1644 this.setCallbackArguments(args); 1645 } 1646 1647 this.addCallbackField = function(name, value) { 1648 _postdata += name + "=" + this.encodeValue(value) + "&"; 1649 } 1650 1651 this.isAsynchronous = function () { 1652 return _async; 1653 } 1654 this.setAsynchronous = function (async) { 1655 _async = async; 1656 } 1657 1658 this.encodeValue = function(uri) { 1659 if(encodeURIComponent != null) 1660 return encodeURIComponent(uri); 1661 else 1662 return escape(parameter); 1663 } 1664} 1665 1666ig_createCallback = function(method, context ) { 1667 1668 return function() { 1669 method.apply(context, [null]); 1670 } 1671} 1672 1673ig_createDelegate = function (instance, method, args) 1674{ 1675 return function () 1676 { 1677 return method.apply(instance, args); 1678 } 1679} 1680 1681var ViewportOrientationEnum = new function() { 1682 this.Horizontal = 0; 1683 this.Vertical = 1; 1684} 1685 1686var AnimationDirectionEnum = new function() { 1687 this.Up = 1; 1688 this.Down = 2; 1689 this.Left = 3; 1690 this.Right = 4; 1691} 1692 1693var AnimationRateEnum = new function() { 1694 this.Static = 0; 1695 this.Accelerate = 1; 1696 this.Decelerate = 2; 1697 this.AccelDecel = 3; 1698 this.Linear = 4; 1699} 1700 1701ig_viewport = function() { 1702 1703 this.createViewport = function(elem, orientation) { 1704 if(this.elem) 1705 return; 1706 1707 this.elem = elem; 1708 this.orientation = orientation; 1709 1710 this.div = document.createElement("div"); 1711 this.div.style.position = "relative"; 1712 this.table = document.createElement("table"); 1713 var tr = document.createElement("tr"); 1714 var tbody = document.createElement("tbody"); 1715 this.td1 = document.createElement("td"); 1716 this.td2 = document.createElement("td"); 1717 this.div.style.overflow = "hidden"; 1718 this.div.style.width = elem.offsetWidth + "px"; 1719 this.div.style.height = elem.offsetHeight + "px"; 1720 this.table.cellSpacing = "0px"; 1721 this.table.cellPadding = "0px"; 1722 this.div.appendChild(this.table); 1723 this.table.appendChild(tbody); 1724 tbody.appendChild(tr); 1725 tr.appendChild(this.td1); 1726 1727 this.td1.style.verticalAlign = "top"; 1728 this.td2.style.verticalAlign = "top"; 1729 1730 /* SJZ 7/26/07 BR20546 - This needs to be done, so that the controls fill their container*/ 1731 this.table.style.height = "100%"; 1732 this.td1.style.height = "100%"; 1733 this.td2.style.height = "100%"; 1734 1735 if(this.orientation == ViewportOrientationEnum.Horizontal) { 1736 tr.appendChild(this.td2); 1737 } 1738 else { 1739 tr = document.createElement("tr"); 1740 tbody.appendChild(tr); 1741 tr.appendChild(this.td2); 1742 } 1743 elem.parentNode.insertBefore(this.div, elem); 1744 this.td1.appendChild(elem); 1745 1746 this.animate = new ig_SlideAnimation(); 1747 } 1748 this.transferPositionToDiv = function(elem, oldElem) 1749 { 1750 if(elem.style.position != "" && elem.style.position != "static") 1751 { 1752 this.div.style.position = elem.style.position; 1753 elem.style.position = "static"; 1754 if(oldElem) 1755 oldElem.style.position = "static"; 1756 } 1757 this.div.style.top = elem.style.top; 1758 this.div.style.left = elem.style.left; 1759 elem.style.top = ""; 1760 elem.style.left = ""; 1761 if(oldElem) { 1762 oldElem.style.top = ""; 1763 oldElem.style.left = ""; 1764 } 1765 } 1766 this.scroll = function(eCurrent, eNew, direction, rate) { 1767 this.direction = direction; 1768 this.animate.setElement(this.table); 1769 this.animate.setContainer(this.div); 1770 this.animate.setDirection(direction); 1771 this.animate.setRate(rate); 1772 1773 switch (this.direction) { 1774 case AnimationDirectionEnum.Down : 1775 case AnimationDirectionEnum.Right : 1776 if(this.td1.firstChild != null) 1777 this.td1.removeChild(this.td1.firstChild); 1778 this.td1.appendChild(eCurrent); 1779 if(this.td2.firstChild != null) 1780 this.td2.removeChild(this.td2.firstChild); 1781 this.td2.appendChild(eNew); 1782 this.animate.startPos = 0; 1783 this.animate.finishPos = this.td1.offsetWidth; 1784 break; 1785 1786 case AnimationDirectionEnum.Up : 1787 case AnimationDirectionEnum.Left : 1788 if(this.td1.firstChild != null) 1789 this.td1.removeChild(this.td1.firstChild); 1790 this.td1.appendChild(eNew); 1791 if(this.td2.firstChild != null) 1792 this.td2.removeChild(this.td2.firstChild); 1793 this.td2.appendChild(eCurrent); 1794 this.div.scrollLeft = this.td1.offsetWidth; 1795 this.animate.startPos = this.div.scrollLeft; 1796 this.animate.finishPos = 0; 1797 break; 1798 } 1799 1800 this.animate.play(); 1801 } 1802} 1803 1804 1805ig_WebAnimation = function() { 1806 1807 this.timerInterval = 30; 1808 this.startPos = 0; 1809 var _inProgress; 1810 this.eContainer = null; 1811 this.duration = null; 1812 this.cancel = false; 1813} 1814 1815ig_WebAnimation.prototype.getElement = function() { 1816 return this.element; 1817} 1818ig_WebAnimation.prototype.setElement = function(value) { 1819 this.element = value; 1820} 1821 ig_WebAnimation.prototype.getTimerInterval = function() { 1822 return timerInterval; 1823} 1824ig_WebAnimation.prototype.setTimerInterval = function(value) { 1825 timerInterval = value; 1826} 1827ig_WebAnimation.prototype.isInProgress = function() { 1828 return _inProgress; 1829} 1830 1831ig_WebAnimation.prototype.cancelAnimation = function() { 1832 clearTimeout(this.timerId); 1833 this.cancel = true; 1834} 1835 1836ig_WebAnimation.prototype.setContainer = function(container) { 1837 this.eContainer = container; 1838} 1839ig_WebAnimation.prototype.getContainer = function() { 1840 return this.eContainer; 1841} 1842 1843ig_WebAnimation.prototype.onBegin = function() { 1844} 1845ig_WebAnimation.prototype.onNext = function() { 1846} 1847ig_WebAnimation.prototype.onEnd = function() { 1848} 1849 1850ig_WebAnimation.prototype.play = function() { 1851 this.currentPos = this.startPos; 1852 this.cancel = false; 1853 this.begin(); 1854 if(!this.cancel) 1855 this.timerId = setInterval(ig_createCallback(this.tickHandler, this, null), this.timerInterval); 1856} 1857 1858ig_WebAnimation.prototype.tickHandler = function() { 1859 if(this.cancel || !this.next()) 1860 { 1861 clearTimeout(this.timerId); 1862 this.end(); 1863 } 1864} 1865ig_WebAnimation.prototype.getDuration = function() { 1866 return this.duration; 1867} 1868ig_WebAnimation.prototype.setDuration = function(value) { 1869 this.duration = value; 1870} 1871 1872ig_WebAnimation.prototype.calcDurationIncrement = function() 1873{ 1874 return this.distance /(this.duration / this.timerInterval); 1875} 1876 1877ig_WebAnimation.prototype.ensureContainer = function(e) { 1878 var parent = e.parentNode; 1879 if(parent.getAttribute("container") == '1') 1880 return; 1881 if(e.getAttribute("container") == '1') 1882 return; 1883 var eDiv = window.document.createElement("DIV"); 1884 eDiv.setAttribute("container", '1'); 1885 eDiv.cssText = 'overflow:hidden; position:absolute;z-index:12000;'; 1886 1887 parent.insertBefore(eDiv, e); 1888 parent.removeChild(e); 1889 eDiv.appendChild(e); 1890 1891} 1892 1893ig_WebAnimation.prototype.removeContainer = function() { 1894 var container = this._element; 1895 var child = container.firstChild; 1896 if(container.getAttribute("container") != '1'){ 1897 container = container.parentNode; 1898 if(container.getAttribute("container") != '1') 1899 return; 1900 } 1901 var parent = container.parentNode; 1902 container.removeChild(child); 1903 parent.removeChild(container); 1904 delete container; 1905 parent.appendChild(child); 1906 1907} 1908 1909ig_SlideAnimation.prototype = new ig_WebAnimation(); 1910 1911 1912function ig_SlideAnimation(direction, rate) 1913{ 1914 this.init(direction, rate); 1915 return this; 1916} 1917 1918ig_SlideAnimation.prototype.init = function(direction, rate) { 1919 if(direction) 1920 this.direction = direction; 1921 else
1922 this.direction = AnimationDirectionEnum.Right; 1923 if(rate) 1924 this.rate = rate; 1925 else 1926 this.rate = AnimationRateEnum.Linear; 1927} 1928 1929ig_SlideAnimation.prototype.getDirection = function() { 1930 return this.direction; 1931} 1932ig_SlideAnimation.prototype.setDirection = function(value) { 1933 this.direction = value; 1934} 1935ig_SlideAnimation.prototype.getRate = function() { 1936 return this.rate; 1937} 1938ig_SlideAnimation.prototype.setRate = function(value) { 1939 this.rate = value; 1940} 1941 1942ig_SlideAnimation.prototype.begin = function() { 1943 switch (this.direction) { 1944 case AnimationDirectionEnum.Up : 1945 case AnimationDirectionEnum.Down : 1946 this.distance = Math.abs(this.finishPos - this.startPos); 1947 break; 1948 case AnimationDirectionEnum.Right : 1949 case AnimationDirectionEnum.Left : 1950 this.distance = Math.abs(this.finishPos - this.startPos); 1951 break; 1952 } 1953 switch(this.rate) { 1954 case AnimationRateEnum.Accelerate : 1955 this.increment = 1; 1956 break; 1957 case AnimationRateEnum.Decelerate : 1958 this.increment = .5 * Math.abs(this.distance);; 1959 break; 1960 case AnimationRateEnum.AccelDecel : 1961 this.midPoint = this.distance / 2; 1962 this.accel = true; 1963 this.increment = 1; 1964 break; 1965 case AnimationRateEnum.Linear : 1966 1967 if(this.duration != null) 1968 this.increment = this.calcDurationIncrement(); 1969 else 1970 { 1971 if(this.increment == null) 1972 this.increment = 30; 1973 this._originalIncrement = this.increment; 1974 this.increment = 1; 1975 var totalCount = 0; 1976 var temp = 1; 1977 var distance = this.distance; 1978 while(temp * 2 < this._originalIncrement) 1979 { 1980 temp *=2; 1981 distance -= temp*2; 1982 totalCount++; 1983 } 1984 this._acelCount = totalCount; 1985 temp = this._originalIncrement; 1986 totalCount *= 2; 1987 totalCount += parseInt(distance / this._originalIncrement); 1988 this._decelCount = totalCount - this._acelCount; 1989 this._currentCount = 1; 1990 } 1991 1992 break; 1993 } 1994 this.onBegin(); 1995} 1996 1997ig_SlideAnimation.prototype.next = function() { 1998 switch (this.direction) { 1999 case AnimationDirectionEnum.Down : 2000 case AnimationDirectionEnum.Right : 2001 this.currentPos += this.increment; 2002 if(this.currentPos > this.finishPos) 2003 return false; 2004 if(this.direction == AnimationDirectionEnum.Right) 2005 this.getContainer().scrollLeft = this.currentPos; 2006 else 2007 this.getContainer().scrollTop = this.currentPos; 2008 break; 2009 case AnimationDirectionEnum.Up : 2010 case AnimationDirectionEnum.Left : 2011 this.currentPos -= this.increment; 2012 if(this.currentPos < this.finishPos) 2013 return false; 2014 if(this.direction == AnimationDirectionEnum.Left) 2015 this.getContainer().scrollLeft = this.currentPos; 2016 else 2017 this.getContainer().scrollTop = this.currentPos; 2018 break; 2019 } 2020 2021 switch(this.rate) { 2022 case AnimationRateEnum.Accelerate : 2023 this.increment *= 2; 2024 break; 2025 case AnimationRateEnum.Decelerate : 2026 this.increment = Math.max(2, this.increment / 2); 2027 break; 2028 case AnimationRateEnum.AccelDecel : 2029 if(this.accel) { 2030 if(this.direction == AnimationDirectionEnum.Right || this.direction == AnimationDirectionEnum.Down) { 2031 if(this.currentPos + this.increment >= this.midPoint) { 2032 this.accel = false; 2033 this.increment = this.midPoint / 2; 2034 } 2035 else 2036 this.increment *= 2; 2037 } 2038 else { 2039 if(this.currentPos - this.increment <= this.midPoint) { 2040 this.accel = false; 2041 this.increment = this.midPoint / 2; 2042 } 2043 else 2044 this.increment *= 2; 2045 } 2046 } 2047 else { 2048 this.increment = Math.max(2, this.increment / 2); 2049 } 2050 break; 2051 case AnimationRateEnum.Linear : 2052 2053 if(this.duration == null) 2054 { 2055 if(this._currentCount <= this._acelCount) 2056 this.increment *=2; 2057 else if(this._currentCount > this._decelCount) 2058 { 2059 this.increment = Math.pow(2,this._acelCount); 2060 if(this._acelCount > 3) 2061 this._acelCount--; 2062 } 2063 else 2064 this.increment = this._originalIncrement; 2065 2066 this._currentCount++; 2067 } 2068 2069 break; 2070 } 2071 2072 this.onNext(); 2073 return true; 2074} 2075 2076ig_SlideAnimation.prototype.end = function() { 2077 this.getContainer().scrollLeft = this.finishPos; 2078 if(this.rate == AnimationRateEnum.Linear && this.duration == null) 2079 { 2080 this._currentCount = 0; 2081 this.increment = this._originalIncrement; 2082 } 2083 this.onEnd(); 2084} 2085 2086ig_SlideRevealAnimation.prototype = new ig_SlideAnimation(); 2087 2088 2089function ig_SlideRevealAnimation(direction, rate) 2090{ 2091 this.init(direction, rate); 2092 return this; 2093} 2094 2095ig_SlideRevealAnimation.prototype.begin = function() { 2096 this.eContainer.style.overflow = "hidden"; 2097 this.element.style.position = "relative"; 2098 2099 this.distance = Math.abs(this.finishPos - this.startPos); 2100 this.currentPos = this.startPos; 2101 2102 switch (this.direction) { 2103 case AnimationDirectionEnum.Up : 2104 this.element.style.top = this.currentPos.toString(); 2105 break; 2106 case AnimationDirectionEnum.Down : 2107 this.element.style.display = ""; 2108 this.element.style.top = this.currentPos.toString(); 2109 break; 2110 case AnimationDirectionEnum.Right : 2111 this.element.style.display = ""; 2112 this.element.style.left = this.currentPos.toString(); 2113 break; 2114 case AnimationDirectionEnum.Left : 2115 this.element.style.left = this.currentPos.toString(); 2116 break; 2117 } 2118 switch(this.rate) { 2119 case AnimationRateEnum.Accelerate : 2120 this.increment = 1; 2121 break; 2122 case AnimationRateEnum.Decelerate : 2123 this.increment = .5 * Math.abs(this.distance);; 2124 break; 2125 case AnimationRateEnum.AccelDecel : 2126 this.midPoint = this.distance / 2; 2127 this.accel = true; 2128 this.increment = 1; 2129 break; 2130 case AnimationRateEnum.Linear : 2131 if(!this.increment) 2132 this.increment = 20; 2133 break; 2134 } 2135 this.onBegin(); 2136} 2137 2138ig_SlideRevealAnimation.prototype.next = function() { 2139 switch (this.direction) { 2140 case AnimationDirectionEnum.Down : 2141 case AnimationDirectionEnum.Right : 2142 this.currentPos += this.increment; 2143 if(this.currentPos > this.finishPos) 2144 return false; 2145 if(this.direction == AnimationDirectionEnum.Right) 2146 this.element.style.left = this.currentPos.toString(); 2147 else 2148 this.element.style.top = this.currentPos.toString(); 2149 break; 2150 case AnimationDirectionEnum.Up : 2151 case AnimationDirectionEnum.Left : 2152 this.currentPos -= this.increment; 2153 if(this.currentPos < this.finishPos) 2154 return false; 2155 if(this.direction == AnimationDirectionEnum.Left) 2156 this.element.style.left = this.currentPos.toString(); 2157 else 2158 this.element.style.top = this.currentPos.toString(); 2159 break; 2160 } 2161 switch(this.rate) { 2162 case AnimationRateEnum.Accelerate : 2163 this.increment *= 2; 2164 break; 2165 case AnimationRateEnum.Decelerate : 2166 this.increment = Math.max(2, this.increment / 2); 2167 break; 2168 case AnimationRateEnum.AccelDecel : 2169 if(this.accel) { 2170 if(this.direction == AnimationDirectionEnum.Right || this.direction == AnimationDirectionEnum.Down) { 2171 if(this.currentPos + this.increment >= this.midPoint) { 2172 this.accel = false; 2173 this.increment = this.midPoint / 2; 2174 } 2175 else 2176 this.increment *= 2; 2177 } 2178 else { 2179 if(this.currentPos - this.increment <= this.midPoint) { 2180 this.accel = false; 2181 this.increment = this.midPoint / 2; 2182 } 2183 else 2184 this.increment *= 2; 2185 } 2186 } 2187 else { 2188 this.increment = Math.max(2, this.increment / 2); 2189 } 2190 break; 2191 2192 } 2193 this.onNext(); 2194 return true; 2195} 2196 2197ig_SlideRevealAnimation.prototype.end = function() { 2198 if(this.cancel) 2199 return; 2200 if(this.direction == AnimationDirectionEnum.Left ||this.direction == AnimationDirectionEnum.Right) 2201 this.element.style.left = this.finishPos; 2202 else
2203 this.element.style.top = this.finishPos; 2204 this.onEnd(); 2205} 2206 2207// Reveal Animation 2208ig_RevealAnimation.prototype = new ig_WebAnimation(); 2209function ig_RevealAnimation(direction, rate) 2210{ 2211 this.init(direction, rate); 2212 return this; 2213} 2214 2215ig_RevealAnimation.prototype.init = function(direction, rate) { 2216 if(direction) 2217 this.direction = direction; 2218 else 2219 this.direction = AnimationDirectionEnum.Right; 2220 if(rate) 2221 this.rate = rate; 2222 else 2223 this.rate = AnimationRateEnum.Linear; 2224} 2225 2226ig_RevealAnimation.prototype.getDirection = function() { 2227 return this.direction; 2228} 2229ig_RevealAnimation.prototype.setDirection = function(value) { 2230 this.direction = value; 2231} 2232ig_RevealAnimation.prototype.getRate = function() { 2233 return this.rate; 2234} 2235ig_RevealAnimation.prototype.setRate = function(value) { 2236 this.rate = value; 2237} 2238 2239ig_RevealAnimation.prototype.begin = function() { 2240 this.element.style.overflow = "hidden"; 2241 this.distance = Math.abs(this.finishPos - this.startPos); 2242 switch (this.direction) { 2243 case AnimationDirectionEnum.Up : 2244 if(!this.startPos) 2245 this.startPos = this.element.scrollHeight; 2246 break; 2247 case AnimationDirectionEnum.Down : 2248 if(!this.startPos) 2249 this.startPos = 1; 2250 break; 2251 } 2252 switch(this.rate) { 2253 case AnimationRateEnum.Accelerate : 2254 this.increment = 1; 2255 break; 2256 case AnimationRateEnum.Decelerate : 2257 this.increment = .5 * Math.abs(this.distance);; 2258 break; 2259 case AnimationRateEnum.AccelDecel : 2260 this.midPoint = this.distance / 2; 2261 this.accel = true; 2262 this.increment = 1; 2263 break; 2264 case AnimationRateEnum.Linear : 2265 if(!this.increment) 2266 this.increment = 20; 2267 break; 2268 } 2269 this.onBegin(); 2270 this.currentPos = this.startPos; 2271} 2272 2273ig_RevealAnimation.prototype.next = function() { 2274 switch (this.direction) { 2275 case AnimationDirectionEnum.Down : 2276 this.currentPos += this.increment; 2277 if(this.currentPos > this.finishPos) 2278 return false; 2279 break; 2280 case AnimationDirectionEnum.Up : 2281 this.currentPos -= this.increment; 2282 if(this.currentPos < this.finishPos) 2283 return false; 2284 break; 2285 } 2286 this.element.style.height = this.currentPos; 2287 switch(this.rate) { 2288 case AnimationRateEnum.Accelerate : 2289 this.increment *= 2; 2290 break; 2291 case AnimationRateEnum.Decelerate : 2292 this.increment = Math.max(2, this.increment / 2); 2293 break; 2294 case AnimationRateEnum.AccelDecel : 2295 if(this.accel) { 2296 if(this.direction == AnimationDirectionEnum.Right || this.direction == AnimationDirectionEnum.Down) { 2297 if(this.currentPos + this.increment >= this.midPoint) { 2298 this.accel = false; 2299 this.increment = this.midPoint / 2; 2300 } 2301 else 2302 this.increment *= 2; 2303 } 2304 else { 2305 if(this.currentPos - this.increment <= this.midPoint) { 2306 this.accel = false; 2307 this.increment = this.midPoint / 2; 2308 } 2309 else 2310 this.increment *= 2; 2311 } 2312 } 2313 else { 2314 this.increment = Math.max(2, this.increment / 2); 2315 } 2316 break; 2317 2318 } 2319 this.onNext(); 2320 return true; 2321} 2322 2323ig_RevealAnimation.prototype.end = function() 2324{ 2325 switch (this.direction) 2326 { 2327 case AnimationDirectionEnum.Down: 2328 this.element.style.height = ""; 2329 //if (ig_csom.IsIE8) 2330 //{ 2331 // this.element._expanded = true; 2332 2333 // for (var i = 0, len = this.element.childNodes.length; i < len; i++) 2334 // { 2335 // var child = this.element.childNodes[i]; 2336 /* NG 27 Sept 2010 - Bug 48851 2337 * Check if the child element is a child node container since it is on the same level with the nodes; */ 2338 // var isSubNodeGroup = child.id && child.id.length > 2 && child.id.substring(0, 2) == "M_"; 2339 // if (!isSubNodeGroup || child._expanded) 2340 // child.style.display = ""; 2341 //} 2342 //} 2343 this.element._expanded = true; 2344 break; 2345 case AnimationDirectionEnum.Up: 2346 /*A.B. 18th March. 2010 - Fix for bug #27913 - NodeMargin is not working when collapsing the root node*/ 2347 /*if (ig_csom.IsIE8) 2348 { 2349 this.element.style.height = ""; 2350 this.element._expanded = false; 2351 2352 for (var i = 0; i < this.element.childNodes.length; i++) 2353 this.element.childNodes[i].style.display = "none"; 2354 } 2355 else*/ 2356 this.element.style.display = "none"; 2357 // K. D. Jan. 20th, 2011 Bug #62831 Removing the old fix, because it was causing other bugs and applying a new 2358 // more robust fix for #27913 2359 var node = this.element.previousSibling; 2360 if(node && node.style.margin) 2361 { 2362 var margin = node.style.margin; 2363 node.style.margin = margin; 2364 } 2365 2366 this.element._expanded = false; 2367 break; 2368 } 2369 this.element.style.overflow = ""; 2370 this.element.style.width = ""; 2371 this.onEnd(); 2372} 2373 2374var ig_Location = {TopLeft:0, TopCenter:1, TopRight:2, TopInfront:3, TopBehind:4, 2375 MiddleLeft:8, MiddleCenter:9, MiddleRight:10, MiddleInfront:11, MiddleBehind:12, 2376 BottomLeft:16, BottomCenter:17, BottomRight:18, BottomInfront:19, BottomBehind:20, 2377 AboveLeft:32, AboveCenter:33, AboveRight:34, AboveInfront:35, AboveBehind:36, 2378 BelowLeft:64, BelowCenter:65, BelowRight:66, BelowInfront:67, BelowBehind:68}; 2379 2380function ig_progressIndicator(imageUrl, relativeContainer) 2381{ 2382 this._img = imageUrl; 2383 this._rc = relativeContainer; 2384 this.setImageUrl = function(url) 2385 { 2386 /* Note: can not set src for old image, because, once IMG is created,- browser locks it size. */ 2387 if(this._elem) 2388 this._elem.parentNode.removeChild(this._elem); 2389 this._elem = null; 2390 this._img = url; 2391 } 2392 this.getImageUrl = function() 2393 { 2394 return this._img; 2395 } 2396 this.setTemplate = function(html) 2397 { 2398 var elem = this._elem; 2399 this._html = html; 2400 if(elem) 2401 { 2402 if(elem.tagName == 'DIV' && html) 2403 { 2404 elem.innerHTML = html; 2405 return; 2406 } 2407 elem.parentNode.removeChild(elem); 2408 this._elem = null; 2409 } 2410 } 2411 this.getTemplate = function() 2412 { 2413 return this._html; 2414 } 2415 this.setLocation = function(location) 2416 { 2417 this._location = location; 2418 } 2419 this.setCssStyle = function(css) 2420 { 2421 this._css = css; 2422 } 2423 this.setRelativeContainer = function(elem) 2424 { 2425 this._rc = elem; 2426 } 2427 this.display = function(rc, loc) 2428 { 2429 this.visible = true; 2430 var elem = this._elem; 2431 if(!rc) 2432 rc = this._rc; 2433 if(!elem) 2434 { 2435 var body = document.body, append = !ig_shared.IsIE || document.readyState == 'complete'; 2436 if(this._html) 2437 { 2438 elem = document.createElement('DIV'); 2439 if(append)/* VS 6/16/2006 insertBefore can not be used, because on 1st display the position of indicator is wrong */ 2440 body.appendChild(elem); 2441 else 2442 /* 2443 AK 6/1/2006 Have to append right after creation. 2444 AK 6/7/2006 BR13480 Also the image has to be inserted before the first element rather than appended. 2445 It will save us IE crash during load 2446 */ 2447 body.insertBefore(elem,body.firstChild); 2448 elem.innerHTML = this._html; 2449 } 2450 else 2451 { 2452 elem = document.createElement('IMG'); 2453 if(append)/* VS 6/16/2006 insertBefore can not be used, because on 1st display the position of indicator is wrong */ 2454 body.appendChild(elem); 2455 else 2456 /* 2457 AK 6/1/2006 Have to append right after creation. Otherwise the size of the image is incorrect. 2458 AK 6/7/2006 BR13480 Also the image has to be inserted before the first element rather than appended. 2459 It will save us IE crash during load 2460 */ 2461 body.insertBefore(elem,body.firstChild); 2462 var img = this._img; 2463 if(!img) 2464 img = (typeof ig_pi_imageUrl == 'string') ? ig_pi_imageUrl : '/ig_common/images/ig_progressIndicator.gif'; 2465 elem.src = img; 2466 } 2467 elem.unselectable = 'on'; 2468 this._elem = elem; 2469 } 2470 if(this._css) 2471 elem.className = this._css; 2472 if(loc == null) 2473 if((loc = this._location) == null) 2474 loc = ig_Location.BottomRight; 2475 ig_shared.absPosition(rc, elem, loc); 2476 } 2477 this.hide = function() 2478 { 2479 this.visible = false; 2480 if(this._elem) 2481 this._elem.style.display = 'none'; 2482 } 2483} 2484/* VS 04/21/2005 class used by UltraWebTab and WebCallBack panel for hidden callbacks */ 2485function ig_callBackManager(form) 2486{
2487 if(!form) if((form = ig_shared.getForm()) == null)/* window.alert('Error in CallBack. Form not found.'); */ 2488 return; 2489 this._onUnload = function() 2490 { 2491 var f = this._form; 2492 if(!f) 2493 return; 2494 this._form = this._submit = this._style = null; 2495 ig_shared.removeEventListener(f, 'submit', this._onFormSubmit); 2496 ig_shared.removeEventListener(f, 'click', this._onFormEvt); 2497 ig_shared.removeEventListener(f, 'mousedown', this._onFormEvt); 2498 ig_shared.removeEventListener(f, 'mouseup', this._onFormEvt); 2499 if(f._ig_cb_submit)/* restore submit redirections */ 2500 { 2501 f.submit = f._ig_cb_submit; 2502 f._ig_cb_submit = null; 2503 } 2504 if(this._onsubmit) 2505 f.onsubmit = this._onsubmit; 2506 } 2507 /* It should be used by UltraWebTab and WebCallBackPanel to enable hidden callback if submit was triggered by a child control in the html element. */ 2508 /* control - reference to object which contains the doResponse function. Object should be permanent,- stay between callbacks. */ 2509 /* id - UniqueID of control which is passed to server to identify origin of posted data */ 2510 /* elemID - the id of html element that contains children that can trigger local submit */ 2511 /* rc - reference to html element which is used as relativeContainer for progress indicator. To disable indicator,- use boolean false. In case of null,- the 'body' is used. */ 2512 /* link - id on linked panel which should be used to trigger postback */ 2513 /* ids - list of additional ids which will trigger async postback */ 2514 /* post - list of ids which will trigger full postback */ 2515 /* noResp - list of ids which will trigger postback without response */ 2516 /* returns reference to panel or null */ 2517 this.addPanel = function(control, id, elemID, rc, link, ids, post, noResp) 2518 { 2519 if(!this._form || !control) 2520 return; 2521 var i = -1; 2522 while(++i < this._panels.length) 2523 if(this._panels[i].elemID == elemID) 2524 break; 2525 return this._panels[i] = {control:control, id:id, elemID:elemID, rc:rc, link:link, ids:ids, post:post, noResp:noResp}; 2526 } 2527 /* It should be used by UltraWebTab and WebCallBackPanel to trigger callback. */ 2528 /* control - reference to object which contains the doResponse function */ 2529 /* id - UniqueID of control which is passed to server to identify origin of posted data */ 2530 /* rc - reference to html element (or array of them) which is used as relativeContainer(s) for progress indicator(s) */ 2531 /* flag - flag which is passed to getCBSubmitElems; used by UltraWebTab to identify unselected tab */ 2532 /* if(flag==-1) then callBack can be ignored if js files were not loaded yet (bugs in IE) */ 2533 /* returns true if flag==-1 and js files from previous callback were not loaded */ 2534 this.addCallBack = function(control, id, rc, flag) 2535 { 2536 var e, ee, j, form = this._form; 2537 if(!control || !form) 2538 return; 2539 if(!this._ok) 2540 { 2541 form.submit(); 2542 return; 2543 } 2544 if(!id)/* 1st param only: assume that is reference to panel */ 2545 { 2546 id = control.id;/* fill up other missing params */ 2547 rc = control.rc; 2548 control = control.control; 2549 } 2550 var i = null, args = this._submitElem; 2551 if(args) 2552 { 2553 args += '&'; 2554 this._submitElem = null; 2555 } 2556 else args = ''; 2557 if(this._wait) 2558 return true; 2559 if(this._jsSrcs.length > 0) 2560 { 2561 if(flag == -1) 2562 return true; 2563 this._killJsSrc(); 2564 } 2565 var id1 = this._elemID, id2 = this._evtElem; 2566 if(id2) 2567 id2 = id2.id; 2568 var triggers = [id2,this._subID,id1]; 2569 if(!id1) 2570 id1 = id2; 2571 /* fire before-submit event by control which triggered callback */ 2572 if(control.beforeCBSubmit)/* check if response was canceled by user of panel */ 2573 i = control.beforeCBSubmit(id1); 2574 var lsnrs = ig_shared._cbListeners; 2575 var elem, count = lsnrs ? lsnrs.length : 0; 2576 /* notify possible 3rd-party listeners about hidden submit event */ 2577 while(count-- > 0) 2578 { 2579 var fn = lsnrs[count]; 2580 if(fn) if((fn = fn.evalCtl) != null)try 2581 { 2582 if(typeof fn == 'function') 2583 fn = fn(id1); 2584 else if(fn) 2585 fn = eval(fn).onCBSubmit(id1); 2586 if(!i) 2587 i = fn; 2588 }catch(e){} 2589 } 2590 if(i == 'fullPostBack') 2591 { 2592 form.submit(); 2593 return; 2594 } 2595 if(i == 'cancelSubmit' || i === true) 2596 return; 2597 var resp = (i != 'cancelResponse'), request = null; 2598 try 2599 { 2600 if(this._ie) 2601 request = ig_createActiveXFromProgIDs(["MSXML2.XMLHTTP","Microsoft.XMLHTTP"]);//~ AK 5/12/2006 new ActiveXObject('Microsoft.XMLHTTP'); 2602 else 2603 request = new XMLHttpRequest(); 2604 }catch(e){} 2605 if(!request) 2606 return; 2607 if(resp)/* check if cancel-response is in list of ids build on server */ 2608 { 2609 id1 = this.__id(id1); 2610 id2 = this.__id(id2); 2611 ee = this._panels; 2612 i = ee.length; 2613 while(i-- > 0 && resp) 2614 { 2615 e = ee[i].noResp; 2616 j = e ? e.length : e; 2617 while(j-- > 0) if(e[j] == id1 || e[j] == id2) 2618 resp = false; 2619 } 2620 } 2621 this._wait = true; 2622 /* tagNames that should be processed */ 2623 var tags = ['INPUT', 'TEXTAREA', 'SELECT'], evs = ['__EVENTTARGET', '__EVENTARGUMENT']; 2624 /* check if control wants to submit only local fields */ 2625 /* note: if that method is implemented, then control should return array of */ 2626 /* container(s) and if its own ViewState field is not inside of those container(s) */ 2627 /* then that field as well */ 2628 var vs = control.getCBSubmitElems ? control.getCBSubmitElems(flag) : null; 2629 var elems = vs ? vs : form.elements; 2630 var count = j = elems.length; 2631 if(vs) 2632 { 2633 elems = new Array(); 2634 count = 0; 2635 while(j-- > 0) 2636 { 2637 e = vs[j]; 2638 for(var t = 0; t < 3; t++) try 2639 { 2640 if(e.tagName == tags[0]) 2641 {
2642 elems[count++] = e; 2643 break; 2644 } 2645 ee = e.getElementsByTagName(tags[t]); 2646 for(i = 0; i < ee.length; i++) 2647 elems[count++] = ee[i]; 2648 }catch(ex){} 2649 } 2650 vs = this._vs; 2651 for(i = 0; i < vs.length; i += 2) 2652 elems[count++] = form[vs[i]]; 2653 } 2654 while(count-- > 0) 2655 { 2656 if((elem = elems[count]) == null) 2657 continue; 2658 var val = null, name = elem.name; 2659 var tag = ig_csom.isEmpty(name) ? null : elem.tagName; 2660 i = 2; 2661 if(tag == tags[0]) 2662 { 2663 var type = elem.type; 2664 if(type == 'text' || type == 'password' || type == 'hidden' || ((type == 'checkbox' || type == 'radio') && elem.checked)) 2665 val = elem.value; 2666 } 2667 else if(tag == tags[1]) 2668 val = elem.value; 2669 else if(tag == tags[2]) 2670 { 2671 var o = elem.options; 2672 i = o ? o.length : 0; 2673 while(i-- > 0) if(o[i].selected) 2674 args += name + '=' + this._encode(o[i].value) + '&'; 2675 } 2676 if(val != null) 2677 { 2678 args += name + '=' + this._encode(val) + '&'; 2679 while(i-- > 0) if(name == evs[i]) 2680 { 2681 elem.value = '';/* clear event-fields */ 2682 evs[i] = null;/* set flag that '__EVENTTARGET' '__EVENTARGUMENT' were processed */ 2683 } 2684 } 2685 } 2686 i = 2; 2687 while(i-- > 0) if(evs[i]) 2688 args += evs[i] + '=&';/* ensure that '__EVENTTARGET' '__EVENTARGUMENT' are written */ 2689 var postKey = '_' + Math.random(), cb = -1; 2690 while(++cb < this._callBacks.length) 2691 if(!this._callBacks[cb]) 2692 break; 2693 args += '_IG_CALLBACK=' + this._encode(id + '#' + postKey); 2694 try 2695 { 2696 request.open('POST', form.action, true); 2697 try 2698 { 2699 if(this._ie || request.setRequestHeader) 2700 request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 2701 }catch(e){} 2702 if(resp)/* response was canceled, no need to process events */ 2703 { 2704 if(!(i = this._ie)) try 2705 { 2706 i = !request.addEventListener; 2707 } 2708 catch(e) 2709 { 2710 i = true; 2711 } 2712 if(i) 2713 request.onreadystatechange = this._responseEvt; 2714 else 2715 request.addEventListener('load', this._responseEvt, false); 2716 } 2717 request.send(args); 2718 ig_shared._isPosted = false; 2719 if(resp)/* response was canceled, no need to create callBack and show indicators */ 2720 { 2721 window.setTimeout("try{ig_all._ig_cbManager._timeOut('" + postKey + "');}catch(i){}", this._timeLimit + 1000);/* kill request with failed response */ 2722 cb = this._callBacks[cb] = {request:request, id:id, postKey:postKey, control:control, timer:control._timer, time:(new Date()).getTime(), triggers:triggers}; 2723 if(rc !== false) 2724 { 2725 cb.pis = new Array(); 2726 if(!rc || rc.nodeName) 2727 cb.pis[0] = this._showPI(rc, control); 2728 else for(i = 0; i < rc.length; i++) 2729 cb.pis[i] = this._showPI(rc[i], control); 2730 } 2731 } 2732 } 2733 catch(e){} 2734 this._wait = false; 2735 } 2736 /* response was not recieved: end progress indicator and fire error */ 2737 this._timeOut = function(key) 2738 { 2739 var cb, i = this._callBacks.length; 2740 while(i-- > 0) if((cb = this._callBacks[i]) != null) 2741 if(cb.postKey == key) 2742 break; 2743 if(i < 0) 2744 return; 2745 var j = cb.control; 2746 if(j && j.onError) 2747 j.onError(6);/* 2: server-response error, no update by response, 4: process-response-on-client error, no update by response */ 2748 j = cb.pis ? cb.pis.length : 0; 2749 while(j-- > 0) 2750 cb.pis[j].hide(); 2751 delete this._callBacks[i]; 2752 } 2753 /* displays progress indicator and returns it */ 2754 this._showPI = function(rc, ctl) 2755 { 2756 var pis = this._indicators; 2757 if(!pis) 2758 pis = this._indicators = new Array(); 2759 var pi = null, j = pis.length, i = -1; 2760 while(++i < j) 2761 { 2762 pi = pis[i];
2763 if(!pi.visible) 2764 break; 2765 } 2766 if(i == j) 2767 pi = pis[j] = new ig_progressIndicator(); 2768 if(ctl.fixPI) 2769 ctl.fixPI(pi); 2770 if(pi._rc) 2771 rc = null; 2772 pi.display(rc); 2773 return pi; 2774 } 2775 /* It should be used by UltraWebTab and WebCallBackPanel before rendering. */ 2776 /* It takes care about <style> objects and replacement flags */ 2777 /* It also fires BeforeResponse event */ 2778 /* txt - string which is intended to be set as innerHTML to an html element */ 2779 /* elem - element which innerHTML should be set to txt */ 2780 this.setHtml = function(txt, elem) 2781 { 2782 if(!txt || !elem) 2783 return null; 2784 var i = 0, css = ''; 2785 while(ig_shared.IsOpera)/* Opera fails to create STYLE when innerHTML is set */ 2786 { 2787 var i0 = txt.indexOf('<style ', i), i1 = txt.indexOf('<style>', i), i2 = txt.indexOf('<STYLE ', i), i3 = txt.indexOf('<STYLE>', i); 2788 if(i > i0 || (i1 >= i && i0 > i1)) 2789 i0 = i1; 2790 if(i > i0 || (i2 >= i && i0 > i2)) 2791 i0 = i2; 2792 if(i > i0 || (i3 >= i && i0 > i3)) 2793 i0 = i3; 2794 i1 = txt.indexOf('>', i0); 2795 if(i > i0 || i0 > i1) 2796 break; 2797 i2 = txt.indexOf('</style>', i0); 2798 i3 = txt.indexOf('</STYLE>', i0); 2799 if(i1 > i2 || (i3 > i1 && i2 > i3)) 2800 i2 = i3; 2801 if(i1 > i2) 2802 break; 2803 css += txt.substring(i1 + 1, i2); 2804 txt = txt.substring(0, i0) + txt.substring(i2 + 8); 2805 i = i0; 2806 } 2807 if(css.length > 5) 2808 this._setCss(null, css, elem.id + '_ig_css'); 2809 i = -3; 2810 while((i = txt.indexOf('<&>3', i += 3)) >= 0) 2811 txt = txt.replace('<&>3', '<&>'); 2812 i = 0; 2813 while(true) 2814 { 2815 var iLen = txt.length; 2816 var i1 = txt.indexOf('<script', i), i2 = txt.indexOf('<SCRIPT', i); 2817 if(i1 > i2 && i2 >= i) 2818 i1 = i2; 2819 if(i1 < i) 2820 break; 2821 var t = this._fixScript(txt, i1); 2822 if(t == null) 2823 i = i1 + 7; 2824 else 2825 txt = t; 2826 } 2827 this._fireBeforeResponse(elem); 2828 elem.innerHTML = txt; 2829 return txt; 2830 } 2831 /* remove <script> javascript block at index i and returnes text without that element */ 2832 /* it adds an item to this._scripts with content of <script> which will be run later */ 2833 /* txt - whole html text */ 2834 /* i - index of <script> block within txt */ 2835 /* if nothing was removed then null is returned */ 2836 this._fixScript = function(txt, i) 2837 { 2838 var i2 = txt.indexOf('>', i); 2839 if(i2 < i) 2840 return null; 2841 var i3 = txt.indexOf('</script>', i2), i4 = txt.indexOf('</SCRIPT>', i2); 2842 if(i3 > i4 && i4 > i) 2843 i3 = i4; 2844 var js = txt.substring(i, i2); 2845 if(js.toLowerCase().indexOf('javascript') < 0) 2846 return null; 2847 var first = js.indexOf('IG_FIRST') > 0; 2848 js = txt.substring(i2 + 1, i3); 2849 txt = txt.substring(0, i) + txt.substring(i3 + 9); 2850 if(js.length < 2) 2851 return txt; 2852 if(!this._scripts) 2853 this._scripts = new Array(); 2854 i = this._scripts.length; 2855 this._scripts[i] = js; 2856 if(first) 2857 { 2858 while(i-- > 0) 2859 this._scripts[i + 1] = this._scripts[i]; 2860 this._scripts[0] = js; 2861 } 2862 return txt; 2863 } 2864 /* Notify 3rd-party listeners about BeforeResponse event. */ 2865 /* That function also will fill-up this._cb.lsnrs array to speed-up fire afterResponse event */ 2866 /* elem - reference to container/panel html-element */ 2867 this._fireBeforeResponse = function(elem) 2868 { 2869 var el, ec, control, i = -1, lsnrs = ig_shared._cbListeners; 2870 if(lsnrs) while(++i < lsnrs.length) 2871 { 2872 if((el = lsnrs[i].elemID) == null) 2873 continue; 2874 if((el = ig_shared.getElement(el, this._form)) == null) 2875 continue; 2876 try 2877 { 2878 control = eval(ec = lsnrs[i].evalCtl); 2879 } 2880 catch(ex) 2881 { 2882 continue; 2883 } 2884 while((el = el.parentNode) != null) 2885 if(el == elem) 2886 { 2887 if(control.onCBBeforeResponse) 2888 control.onCBBeforeResponse(); 2889 var cb = this._cb; 2890 if(!cb || !control.onCBAfterResponse) 2891 continue; 2892 if(!cb.lsnrs) 2893 cb.lsnrs = new Array(); 2894 cb.lsnrs[cb.lsnrs.length] = ec; 2895 } 2896 } 2897 } 2898 this._form = form; 2899 /* max time to wait for response */ 2900 this._timeLimit = 20000; 2901 /* old values of inputs related to viewstate. it is used to restore state of page on error */ 2902 this._vs = ['__VIEWSTATE', null, '__EVENTVALIDATION', null]; 2903 /* separator used by server to in response stream */ 2904 this._sep = '<&>0'; 2905 /* shortcut */ 2906 this._sepLen = this._sep.length; 2907 this._setPan = function(p, se) 2908 { 2909 this._panelToSubmit = p; 2910 this._submitElem = se; 2911 if(p) this._panTime = (new Date()).getTime(); 2912 else this._evtElem = null; 2913 } 2914 this._getPan = function() 2915 { 2916 var t = this._panTime; 2917 if(!t || t + 500 < (new Date()).getTime())/* check if click-time expired */ 2918 this._submitElem = this._panelToSubmit = this._panTime = null; 2919 return this._panelToSubmit; 2920 } 2921 /* listener for __doPostBack */ 2922 this._doPostBack = function(target, arg) 2923 { 2924 var me = ig_all._ig_cbManager, evt = window.event; 2925 if(!me || me._wait) 2926 return ig_cancelEvent(evt, 'submit'); 2927 var pan = me._findPanel(target), form = me._form; 2928 if(!pan) 2929 { 2930 me._evtElem = null; 2931 me._oldPostBack(target, arg); 2932 return; 2933 } 2934 me._setPan(pan); 2935 var e = form ? form.__EVENTTARGET : null; 2936 if(e) 2937 e.value = target; 2938 e = form ? form.__EVENTARGUMENT : null; 2939 if(e) 2940 e.value = arg; 2941 me._elemID = target; 2942 me._onFormSubmit(); 2943 me._elemID = null; 2944 ig_cancelEvent(evt, 'submit'); 2945 } 2946 /* check if x matches with v. If x starts with *, then check if v ends up with x */ 2947 this._isMatch = function(x, v) 2948 { 2949 if(x == v) 2950 return true; 2951 var len = x ? x.length : 0; 2952 if(len-- < 2) 2953 return false; 2954 var wc0 = x.charCodeAt(0) == 42, wc1 = x.charCodeAt(len) == 42; 2955 if(wc1) x = x.substring(0, len); 2956 if(wc0) x = x.substring(1); 2957 var i = v.indexOf(x); 2958 if(wc0) 2959 { 2960 if(wc1) return i >= 0; 2961 i = v.lastIndexOf(x); 2962 return i >= 0 && i + len == v.length; 2963 } 2964 return wc1 && i == 0;
2965 } 2966 this.__id = function(id){return id ? id.replace(/\:/g, '_').replace(/\$/g, '_') : id;} 2967 /* find CallBack panel from element or its id */ 2968 this._findPanel = function(id, e) 2969 { 2970 var j, i, pans = this._panels.length, form = this._form; 2971 if(this._wait || pans < 1) 2972 return null; 2973 if(e) 2974 id = e.id; 2975 else if(!id) 2976 return null; 2977 var id0 = id; 2978 id = this.__id(id); 2979 if(!e && id)/* called by __doPostBack */ 2980 if((e = ig_shared.getElement(id, form)) == null) 2981 if((e = ig_shared.getElement(id + "_Data", form)) == null)/* for WebScheduleInfo */ 2982 if((e = ig_shared.getElement(id + "_hidden", form)) == null)/* for UltraListBar */ 2983 if((e = ig_shared.getElement(id.replace(/\_/g, 'x'), form)) != null)/* for UltraWebGrid */ 2984 if(id0 != id) if((e = ig_shared.getElement(id0, form)) == null) 2985 e = ig_shared.getElement(id0 + "_Data", form);/* for WebScheduleInfo */ 2986 id0 = id; 2987 while(e || id)/* go through all parents of source element */ 2988 { 2989 if(id || (e && e.id)) for(i = 0; i < pans; i++) 2990 { 2991 var p = this._panels[i]; 2992 if(e && p.elemID == e.id) 2993 { 2994 if(p.post) for(j = 0; j < p.post.length; j++)/* check for trigger of full postback */ 2995 if(this._isMatch(p.post[j], id0)) 2996 return null; 2997 return p; 2998 } 2999 if(p.ids && id) for(j = 0; j < p.ids.length; j++)/* check for trigger of async postback */ 3000 if(this._isMatch(p.ids[j], id0)) 3001 return p; 3002 if(p.noResp && id) for(j = 0; j < p.noResp.length; j++)/* check for trigger of no-response postback */ 3003 if(this._isMatch(p.noResp[j], id0)) 3004 return p; 3005 } 3006 id = null;/* disable validation for __doPostBack */ 3007 if(e) 3008 e = e.parentNode; 3009 } 3010 return null; 3011 } 3012 /* listener for form.click/mousedown/mouseup */ 3013 this._onFormEvt = function(evt) 3014 { 3015 if(!evt) 3016 if((evt = window.event) == null) 3017 return; 3018 var elem = evt.target;/* VS 09/21/2006 Atlas under Mozilla may add srcElement member to event object */ 3019 if(!elem) 3020 if((elem = evt.srcElement) == null) 3021 elem = this; 3022 var me = ig_all._ig_cbManager, type = null, tag = null, name = null; 3023 if(!me) 3024 return; 3025 /* elem.type and others can be 'unknown' with exceptions on access (for example with combination of GoogleMaps js objects) */ 3026 try 3027 { 3028 type = elem.type; 3029 tag = elem.tagName; 3030 name = elem.name; 3031 } 3032 catch(e){return;} 3033 me._evtElem = elem; 3034 me._evtTime = (new Date()).getTime(); 3035 if(evt.type != 'click' || elem.disabled) 3036 return; 3037 me._subID = me._submitElem = null; 3038 var pan = me._findPanel(null, elem); 3039 if(!pan) 3040 return; 3041 var val = null, x = evt.offsetX; 3042 if(type == 'image' && tag == 'INPUT') 3043 val = name + '.x=' + (x ? x : 1) + '&' + name + '.y=' + (x ? evt.offsetY : 1); 3044 else if(type == 'submit' && (tag == 'BUTTON' || tag == 'INPUT')) 3045 val = name + '=' + me._encode(elem.value); 3046 else 3047 return; 3048 me._setPan(pan, ig_csom.isEmpty(me._subID = name) ? null : val); 3049 } 3050 /* filter to pass value to server */ 3051 this._encode = function(val) 3052 { 3053 return (typeof encodeURIComponent == 'function') ? encodeURIComponent(val) : escape(val); 3054 } 3055 /* restore values of view-state fields from previous submit */ 3056 this._restore = function() 3057 { 3058 for(var i = 0; i < 3; i += 2) 3059 { 3060 var val = this._vs[i + 1], e = ig_shared.getElement(this._vs[i], this._form); 3061 if(e && val) 3062 e.value = val; 3063 } 3064 } 3065 /* listener for form.submit */ 3066 /* me - internal forced call from within this._submit() */ 3067 this._onFormSubmit = function(evt, me) 3068 { 3069 var my = me && me._vs; 3070 if(!my) 3071 { 3072 me = ig_all._ig_cbManager; 3073 if(!evt) 3074 evt = window.event; 3075 } 3076 if(me && me._wait) 3077 me = null; 3078 if(me && me._onsubmit && !my) 3079 { 3080 try 3081 { 3082 me._onsubTime = (new Date()).getTime(); 3083 if(me._onsubmit() === false) 3084 me = null; 3085 /* BR29255 WARP in SharePoint WebPart */ 3086 else if(window._spFormOnSubmitCalled === true) 3087 window._spFormOnSubmitCalled = false; 3088 }catch(ex) 3089 { 3090 me = null; 3091 } 3092 if(evt && evt.returnValue == false && evt.type == 'submit') 3093 me = null; 3094 } 3095 if(!me) 3096 return ig_cancelEvent(evt, 'submit');
3097 var form = me._form, pan = me._getPan(), pp = me._panels; 3098 if(!pan || !form || form.action != form._ig_cb_act) 3099 return true; 3100 ig_cancelEvent(evt, 'submit'); 3101 if(me._evtElem) 3102 { 3103 var click = '' + me._evtElem.onclick; 3104 if(click.indexOf('WebForm_DoPostBackWithOptions') > 0 && (!window.Page_Validators || window.Page_IsValid === false)) 3105 return true; 3106 } 3107 /* if link is defined, then use "main-parent-link" panel, but not "dependant" original one */ 3108 var p, rc = pan.rc, i = pp.length, id = pan.link; 3109 if(id) while(i-- > 0) 3110 if((p = pp[i]) != null) 3111 if(p.elemID == id || p.id == id) 3112 pan = p; 3113 if(pan) 3114 me.addCallBack(pan.control, pan.id, rc ? rc : pan.rc);/* keep original rc */ 3115 me._setPan(null); 3116 return false; 3117 } 3118 /* listener for responses */ 3119 this._responseEvt = function() 3120 { 3121 var me = ig_all._ig_cbManager; 3122 if(!me || me._wait) 3123 return; 3124 for(var i = 0; i < me._callBacks.length; i++) 3125 { 3126 var j = -1, cb = me._callBacks[i]; 3127 if(cb && me._doResponse(cb)) 3128 { 3129 if(cb.pis) 3130 j = cb.pis.length; 3131 while(j-- > 0) 3132 cb.pis[j].hide(); 3133 me._cb = me._scripts = null; 3134 delete me._callBacks[i]; 3135 if(!me._jsWait && cb.timer)/* situation when _addJS did not requested to wait for js file to load */ 3136 me._timer(cb.id, true); 3137 } 3138 } 3139 } 3140 /* [IE bugs] not finished attempt to defeat css architecture in IE (needs to be completed for priority) */ 3141 this._doCss = function(e, v) 3142 { 3143 e.cssText = v; 3144 var e1, ss = document.styleSheets; 3145 var i = ss.length; 3146 while(i-- > 0)/* try to find last good css */ 3147 { 3148 e1 = ss[i]; 3149 if(e1 == e)/* would be as expected and very nice, but IE :( */ 3150 return; 3151 if(!e1.readOnly && !e1.disabled && e1.type == 'text/css') 3152 break; 3153 } 3154 if(i < 0) 3155 return; 3156 /* to do: try to move rules from e to the e1 (last css) */ 3157 } 3158 /* called by _responseEvt to attempt process response for a CallBack object */ 3159 this._doResponse = function(cb) 3160 { 3161 var request = cb.request; 3162 if(!request || request.readyState != 4) 3163 return false; 3164 var txt = request.responseText, sep = this._sep, sepLen = this._sepLen; 3165 if(!txt) 3166 return (new Date()).getTime() - cb.time > this._timeLimit; 3167 this.serverError = null; 3168 var e, i, i0 = txt.indexOf(sep); 3169 var iID = txt.indexOf(sep, i0 + sepLen); 3170 var iKey = txt.indexOf(sep, iID + sepLen); 3171 if(i0 < 0 || iID < 0 || iKey < 0)/* if(i0 < 0 || iID < 0 || iKey < 0)alert("unknown response txt=" + txt); */ 3172 return false; 3173 this.triggers = cb.triggers; 3174 this._jsWait = false; 3175 var id = txt.substring(i0 + sepLen, iID), postKey = txt.substring(iID + sepLen, iKey); 3176 this._error = 0; 3177 if(postKey.indexOf('<error>') == 0) 3178 { 3179 i = this._panels.length; 3180 this.serverError = txt.split(this._sep)[3]; 3181 while(i-- > 0) 3182 { 3183 e = this._panels[i].control; 3184 if(e && e.onError)/* notify listeners about global error, 1: before full postback */ 3185 e.onError(1); 3186 } 3187 var lsnrs = ig_shared._cbError; 3188 i = lsnrs ? lsnrs.length : 0; 3189 /* notify possible 3rd-party listeners about error */ 3190 while(i-- > 0)try 3191 { 3192 lsnrs[i](cb.control,cb.triggers,this.serverError); 3193 }catch(e){} 3194 this._restore(); 3195 try 3196 { 3197 this._submit(9);/* real submit: no validations for clicked element */ 3198 }catch(e){} 3199 return true; 3200 } 3201 if(id == cb.id && postKey == cb.postKey) 3202 { 3203 if(this._cb)/* old CallBack object is in process */ 3204 { 3205 window.setTimeout("try{ig_all._ig_cbManager._responseEvt();}catch(i){}", 1);/* repeate/fake processing response */ 3206 return this._killCB++ > 20; 3207 } 3208 this._cb = cb;/* currently processed CallBack */ 3209 this._killCB = 0;/* reset counter for setTimeout(_responseEvt) */ 3210 txt = txt.substring(iKey + sepLen); 3211 var vals = txt.split(sep), old = this._vs; 3212 for(i = 2; i < vals.length - 1; i += 2)/* process __VIEWSTATE, etc. */ 3213 { 3214 var index = -1, v0 = vals[i], v1 = vals[i + 1]; 3215 if(v0 == old[2])/* __EVENTVALIDATION */ 3216 index = 2; 3217 else if(v0 == old[0])/* __VIEWSTATE */ 3218 index = 0; 3219 else if(v0 && v0.indexOf('<') != 0)/* panel with id */ 3220 continue; 3221 vals[i] = vals[i + 1] = null; 3222 if(index > -1)/* __EVENTVALIDATION or __VIEWSTATE */ 3223 { 3224 e = ig_shared.getElement(v0, this._form); 3225 if(e) 3226 { 3227 old[index + 1] = e.value; 3228 e.value = v1; 3229 } 3230 } 3231 else if(v0 == '<script>')/* possible custom SCRIPTs or js for MSValidators */ 3232 this._scripts = new Array(v1); 3233 else if(v0 == '<jssrc>')/* SCRIPTs with src rendered by server. Validate if page already has those scripts or not. */ 3234 { 3235 e = document.scripts; 3236 if(!e || e.length < 2) 3237 e = document.getElementsByTagName('SCRIPT'); 3238 if(!e) 3239 continue; 3240 var s, x = -1, src = '';/* put all known SCRIPT.src(s) in one string */ 3241 while(++x < e.length) if(e[x]) if((s = e[x].src) != null) 3242 src += s;
3243 v1 = v1.split('|');/* that is how src(s) were built on server */ 3244 this._scriptCount = 0; x = -1; 3245 while(++x < v1.length) 3246 { 3247 var v = s = v1[x].replace('&','&');/* embedded resource may contain &apm; instead of & */ 3248 var t = v.indexOf('&t='); 3249 if(t>0)v=v.substring(0,t);/* ignore timestamp for embedded resources */ 3250 for(t = 0; t < 2; t++)/* remove possible leading dots */ 3251 if(v.charCodeAt(0) < 47) 3252 v = v.substring(1); 3253 if(src.indexOf(v) < 0) 3254 this._addJS(this._runScript(s, true), s, cb);/* load SCRIPT from file and set flag to run init-scripts with delay: bug in IE */ 3255 } 3256 } 3257 else if(v0 == '<style>')/* STYLE blocks located in header of page */ 3258 this._setCss(this._style, v1); 3259 } 3260 var ctl = cb.control; 3261 /* notify control which triggered callback about response */ 3262 if(vals[0] == '<error>') 3263 { 3264 this.serverError = vals[1]; 3265 this._error = 2;/* 2: server-response error, no update by response */ 3266 } 3267 else if(ctl && ctl.doResponse) try 3268 { 3269 ctl.doResponse(vals, this); 3270 }catch(e){this._error |= 4;}/* 4: process-response-on-client error, no update by response */ 3271 cb._js = this._scripts; 3272 if(this._jsWait)/* do not wait more than 3 seconds: if IE fail
3272s in readystatechange event? */ 3273 window.setTimeout("try{ig_all._ig_cbManager._killJsSrc('" + id + "');}catch(i){}", 3000);/* max time to wait for script */ 3274 else/* Mozilla is friendly */ 3275 this._jsDelay(cb); 3276 if(this._error > 0 && ctl.onError) 3277 ctl.onError(this._error);/* notify listeners about process-response-on-client error: no update by response */ 3278 return true; 3279 } 3280/* alert("bad txt="+request.responseText+"\ncallBack.postKey="+cb.postKey+"\npostKey="+postKey); */ 3281 return false; 3282 } 3283 /* e - refence to STYLE element */ 3284 /* v - content for STYLE */ 3285 /* id - id of STYLE. If it null, then configure this._style, otherwise, it is setHtml under Opera */ 3286 /* bad - true means external call, like grid async postback */ 3287 this._setCss = function(e, v, id, bad) 3288 { 3289 try 3290 { 3291 if((!id || bad) && document.createStyleSheet)/* IE: have fun */ 3292 { 3293 var e0 = e ? e.owningElement : null;/* remove old/dynamic css from document.styleSheets */ 3294 e = e0 ? e0.parentElement : null;/* otherwise, styles will be accumulated, and at 31st IE will chock itself */ 3295 if(e && e.parentNode)/* it is not possible to set cssText to existing css, because in most cases IE crashes */ 3296 e.removeChild(e0); 3297 e0 = document.createStyleSheet(); 3298 if(!bad) this._style = e0; 3299 this._doCss(e0, v); 3300 return e0; 3301 } 3302 if(id)/* called by setHtml for Opera. Find STYLE from previous callback */ 3303 e = document.getElementById(id); 3304 if(!e) 3305 { 3306 e = document.createElement('STYLE'); 3307 e.type = 'text/css'; 3308 var h = document.getElementsByTagName('HEAD'); 3309 h = (h && h.length > 0) ? h[0] : document.body; 3310 h.appendChild(e); 3311 if(id)/* associate STYLE with panel-id to avoid creating new STYLE for every callback */ 3312 e.id = id; 3313 else if(!bad)/* called by this._doResponse: global STYLE shared by all panels. */ 3314 this._style = e; 3315 } 3316 e.innerHTML = v; 3317 return e; 3318 }catch(e) 3319 { 3320 this._error |= 32;/* 32: css style failure */ 3321 } 3322 } 3323 /* [IE bugs] Last part of this._doResponse. Used to fix bugs in IE: it fails to load/activate script from file when SCRIPT.src is set */ 3324 this._jsDelay = function(cb) 3325 { 3326 if(!cb) 3327 return; 3328 var i, ctl = cb.control, js = cb._js; 3329 cb.control = cb._js = null; 3330 if(js) for(i = 0; i < js.length; i++) 3331 this._runScript(js[i]); 3332 /* notify listeners about AfterResponse event */ 3333 /* this._cb.lsnrs was filled by _fireBeforeResponse */ 3334 if(cb.lsnrs) for(i = 0; i < cb.lsnrs.length; i++) try 3335 { 3336 eval(cb.lsnrs[i]).onCBAfterResponse(); 3337 }catch(ex){} 3338 cb.lsnrs = null; 3339 /* fire after-response event by control which triggered callback */ 3340 if(ctl && ctl.afterCBResponse) 3341 ctl.afterCBResponse(); 3342 } 3343 /* [IE bugs] add listener for readystatechange to load script */ 3344 /* se - script element */ 3345 /* src - src attribute (to validate if already exists) */ 3346 /* cb - reference to CallBack object which custom script blocks should be run when src got loaded */ 3347 this._addJS = function(se, src, cb) 3348 { 3349 if(!se) 3350 return; 3351 this._jsWait = true; 3352 var js = this._jsSrcs; 3353 var j = -1, jL = js.length; 3354 while(++j < jL) if(js[j].src == src)/* check if that src is already loading */ 3355 { 3356 js[j].cb[js[j].cb.length] = cb; 3357 return;/* a js with same src was already requested by another CallBack response */ 3358 } 3359 js[jL] = {se:se,src:src,cb:[cb]};/* container for data related to loading script */ 3360 ig_shared.addEventListener(se, 'readystatechange', this._removeJS); 3361 } 3362 /* [IE bugs] remove listener for readystatechange to load script from src */ 3363 /* when all scripts for a CallBack are done, then run custom scripts for that cb */ 3364 /* se - reference to script element or to readystatechange event */ 3365 this._removeJS = function(se) 3366 { 3367 var me = ig_all._ig_cbManager; 3368 if(!me || !se) 3369 return; 3370 var e = se.srcElement;/* check if it is event coming readystatechange event */ 3371 if(e) 3372 { 3373 if(e.readyState != 'loaded')/* check if script was loaded */ 3374 return; 3375 se = e;/* process loaded script element */ 3376 } 3377 ig_shared.removeEventListener(se, 'readystatechange', me._removeJS); 3378 var js = me._jsSrcs;/* all objects related to waiting for script-src-load-event */ 3379 var x, i, cbx, cb = null, j = -1, jL = js ? js.length : 0; 3380 while(++j < jL) if(js[j].se == se) 3381 { 3382 cb = js[j].cb;/* all CallBack objects which wait for src of this se to be loaded */ 3383 js[j].se = null;/* mark that object related to this src-script if done and it can be deleted */ 3384 } 3385 i = cb ? cb.length : 0; 3386 while(i-- > 0)/* go through all CallBack objects which waited for src of this script to be loaded */ 3387 { 3388 var cbi = cb[i];/* cbi: potential CallBack object to finish with */ 3389 j = jL; 3390 while(j-- > 0 && cbi) if(js[j].se)/* validate if cbi still waits for another script to be loaded */ 3391 { 3392 cbx = js[j].cb; 3393 x = cbx.length; 3394 while(x-- > 0) if(cbx[x] == cbi)/* failure: cbi still waits for another script to be loaded */ 3395 { 3396 cbi = null;/* cancel potential finish for this cbi: go to next CallBack */ 3397 break; 3398 } 3399 } 3400 if(!cbi)/* cbi was already done or it still waits for another script to be loaded */ 3401 continue; 3402 j = jL;/* cbi can be finished */ 3403 while(j-- > 0)/* delete all references to cbi from all items in _jsSrcs[].cb[] and check if whole _jsSrcs can be deleted */ 3404 { 3405 if(js[j].se)/* check if array of all wait-for-src objects can be deleted */ 3406 se = null;/* set a flag to cancel array-delete */ 3407 cbx = js[j].cb; 3408 x = cbx.length; 3409 while(x-- > 0) if(cbx[x] == cbi)/* find cbi in array of callbacks */ 3410 delete cbx[x];/* delete this cbi */ 3411 } 3412 if(se) 3413 { 3414 while(++j < jL)/* delete all members */ 3415 delete js[j]; 3416 me._jsSrcs = new Array();/* recreate storage: prepare to load new scripts */ 3417 } 3418 me._jsDelay(cbi);/* finish with cbi: run custom script blocks which will end-up with this CallBack */ 3419 if(cbi.timer)/* situation when end of cb was delayed and _responseEvt was not used to start timer */ 3420 me._timer(cbi.id, true); 3421 } 3422 }
3423 /* [IE bugs] timeout for a CallBack response with id: end waiting for readystatechange to load js from src */ 3424 this._killJsSrc = function(id) 3425 { 3426 var me = ig_all._ig_cbManager; 3427 var js = me ? me._jsSrcs : null; 3428 var j = js ? js.length : 0; 3429 while(j-- > 0)/* find all references to CallBack with id among items in me._jsSrcs[j].cb[i] */ 3430 { 3431 var x = -1, cbx = js[j].cb; 3432 while(++x < cbx.length) 3433 if(cbx[x] && (cbx[x].id == id || !id)) 3434 me._removeJS(js[j].se);/* fake readystatechange-loaded event */ 3435 } 3436 if(!id && this._jsSrcs.length > 0) 3437 this._jsSrcs = new Array(); 3438 } 3439 /* Initialize and process timer (async postback in endless loop) for a CallBackPanel with id */ 3440 /* id - the id of CB panel */ 3441 /* wait - flag to setTimeout, true: setTimeout, false: trigger async postback (process response from setTimeout) */ 3442 this._timer = function(id, wait) 3443 { 3444 var me = ig_all._ig_cbManager; 3445 var pan, cb = me ? me._callBacks : null; 3446 var i = cb ? cb.length : 0; 3447 while(i-- > 0) if(cb[i] && cb[i].id == id)/* ensure that there is no pending CallBack with id */ 3448 return; 3449 i = me._panels.length; 3450 while(i-- > 0)/* find panel with id */ 3451 { 3452 pan = me._panels[i]; 3453 if(pan.id == id) 3454 break; 3455 } 3456 if(i >= 0) 3457 i = pan.control._timer; 3458 if(!i || i < 1)/* check if timer for found panel is enabled */ 3459 return; 3460 if(!wait)/* if this call came from setTimeout(cs._timer(id)), then trigger async postback */ 3461 { 3462 pan.wait = false;/* set flag that setTimeout was processed */ 3463 if(!me.addCallBack(pan, null, null, -1))/* may fail if there are unloaded js file (bugs in IE) */ 3464 return; 3465 } 3466 if(!pan.wait)/* ensure that setTimeout was already set from another response-thread */ 3467 window.setTimeout("try{ig_all._ig_cbManager._timer('" + id + "');}catch(i){}", i); 3468 pan.wait = true;/* set flag to avoid settin timeout, when previous one was not processed yet */ 3469 } 3470 /* clean-up script-string and run script block */ 3471 this._runScript = function(js, src) 3472 { 3473 var e = document.getElementsByTagName('HEAD'); 3474 e = (e && e.length > 0) ? e[0] : document.body; 3475 if(js && js.length > 1) try 3476 { 3477 if(!src && ig_shared.IsIE && js.indexOf('var Page_Validators') < 0) 3478 { 3479 /* 3480 HE 2/21/2008 3481 BR26172: Webgrid inside of a WARP that refreshes constantly causes memory leakage. 3482 IE doesn't release <script> tags until the page is unloaded in case the script is still 3483 referenced by something. If we create a new script element, the number of elements (and amount 3484 of memory used) will increase quite rapidly on each partial postback. Using the eval() 3485 method to introduce the script to the page decreases the memory added. 3486 See the bug for more details about the problem. 3487 */ 3488 try 3489 { 3490 eval(js); 3491 return; 3492 } 3493 catch(ex){} 3494 } 3495 var se = document.createElement('SCRIPT'); 3496 se.type = 'text/javascript'; 3497 if(src) 3498 se.src = js; 3499 else 3500 se.text = js; 3501 e.appendChild(se); 3502 if(src && document.all) 3503 return se; 3504 } 3505 catch(ex) 3506 { 3507 this._error |= 16;/* 16: process-javascript-on-client error */ 3508 } 3509 } 3510 /* add WebCallBackPanel */ 3511 this.newPanel = function(id, uid, ids, prop, post, noResp) 3512 { 3513 var elem = document.getElementById(id); 3514 if(!elem) 3515 return; 3516 var o = ig_all[id]; 3517 if(o) 3518 ig_dispose(o); 3519 var pi = {loc:ig_Location.MiddleCenter}; 3520 pi.setImageUrl = function(v){this.url = v;} 3521 pi.getImageUrl = function(){return this.url;} 3522 pi.setTemplate = function(v){this.html = v;} 3523 pi.getTemplate = function(){return this.html;} 3524 pi.setLocation = function(v){this.loc = v;} 3525 pi.getLocation = function(){return this.loc;} 3526 pi.setRelativeContainer = function(v){this.rc = v;} 3527 pi.getRelativeContainer = function(){return this.rc;} 3528 o = ig_all[id] = {_id:id, _uniqueID:uid, _element:elem, _pi:pi, _evts:prop}; 3529 var t = o._timer = prop[5] ? prop[5] : 0; 3530 o.getTimer = function(){return this._timer;} 3531 o.setTimer = function(v,s){this._timer = v; if(v&&s)try{ig_all._ig_cbManager._timer(this._uniqueID);}catch(v){}} 3532 o.getID = function(){return this._id;} 3533 o.getUniqueID = function(){return this._uniqueID;} 3534 o.getElement = function(){return this._element;} 3535 o.getProgressIndicator = function(){return this._pi;} 3536 o.findControl = function(id){return ig_shared.findControl(this._element, id);} 3537 o._fire = function(evt, p3) 3538 { 3539 evt = this._evts ? this._evts[evt] : null; 3540 if(!evt) 3541 return false; 3542 var evtO = new ig_EventObject(); 3543 ig_fireEvent(this, ig_shared.replace(evt, """, "'"), evtO, p3); 3544 if(evtO.cancelResponse) 3545 return 'cancelResponse'; 3546 if(evtO.fullPostBack) 3547 return 'fullPostBack'; 3548 return evtO.cancel; 3549 } 3550 o.beforeCBSubmit = function(src){return this._fire(1, src);} 3551 o.afterCBResponse = function(){this._fire(3);} 3552 o.onError = function(flags){this._fire(4, flags);} 3553 o.doResponse = function(vals, man) 3554 { 3555 if(!this._fire(2)) for(var i = 0; i + 1 < vals.length; i += 2) 3556 { 3557 var e, v, v0 = vals[i], v1 = vals[i + 1];
3558 if(!v0) 3559 continue; 3560 if(v0.indexOf('-') == 0) 3561 { 3562 e = ig_shared.getElement(v = v0.substring(2), man._form); 3563 if(!e) 3564 e = ig_shared.getElement(man.__id(v), man._form); 3565 if(e) 3566 v0 = v0.charCodeAt(1); 3567 if(v0 == 51)/* '3' */ 3568 e.innerHTML = v1; 3569 else if(v1 == ' ') 3570 v1 = ''; 3571 if(v0 == 48)/* '0' */ 3572 e.value = v1; 3573 if(v0 == 49)/* '1' */ 3574 e.checked = v1.toLowerCase() == 'true'; 3575 if(v0 == 50)/* '2' */ 3576 e.selectedIndex = parseInt(v1); 3577 if(v0 == 52)/* '4' */ 3578 e.src = v1; 3579 continue; 3580 } 3581 e = ig_getWebControlById(v0); 3582 if(e) 3583 { 3584 man.setHtml(v1, e._element); 3585 continue; 3586 } 3587 try 3588 { 3589 var multi = v0.indexOf('+') == 0; 3590 e = eval(multi ? v0.substring(1) : v0); 3591 if(e && e.doResponse) 3592 { 3593 if(multi) 3594 { 3595 v1 = parseInt(v1); 3596 v0 = new Array(); 3597 while(v1-- > 0) 3598 { 3599 v0[v0.length] = vals[i += 2]; 3600 v0[v0.length] = vals[i + 1]; 3601 } 3602 } 3603 else 3604 v0 = [v0,v1]; 3605 e.doResponse(v0, man); 3606 } 3607 }catch(e){man._error |= 8;}/* 8: process-response-on-client error, no update of dependant panel by response */ 3608 } 3609 } 3610 o.fixPI = function(pi) 3611 { 3612 var p = this._pi; 3613 pi.setLocation(p.loc); 3614 if(pi._html != p.html) 3615 pi.setTemplate(p.html); 3616 if(pi._img != p.url) 3617 pi.setImageUrl(p.url); 3618 pi._rc = p.rc; 3619 } 3620 o.refresh = function() 3621 { 3622 try 3623 { 3624 ig_all._ig_cbManager.addCallBack(this, this._uniqueID, this._element, -1); 3625 }catch(e){} 3626 } 3627 var pan = this.addPanel(o, uid, id, elem, null, ids, post, noResp); 3628 o._fire(0); 3629 if(t > 0) 3630 { 3631 pan.wait = true; 3632 window.setTimeout("try{ig_all._ig_cbManager._timer('" + uid + "');}catch(i){}", t); 3633 } 3634 } 3635 /* redirection of form.submit() */ 3636 /* flag==9 - means internal submit: no validations/filtering */ 3637 this._submit = function(flag) 3638 { 3639 var me = ig_all._ig_cbManager; 3640 if(!me) 3641 return; 3642 var pan = me._getPan(), elem = me._evtElem, f = me._form; 3643 if(!pan && elem && flag != 9)/* submit was triggered by mouseup/mousedown/click for not INPUT */ 3644 { 3645 if((new Date()).getTime() < me._evtTime + ((elem.nodeName == 'A') ? 200 : 30))/* only at once after processed event */ 3646 me._setPan(pan = me._findPanel(null, elem));/* set also reference for me._onFormSubmit */ 3647 if(pan) 3648 if(!me._onFormSubmit(null, me)) 3649 return; 3650 me._setPan(null); 3651 } 3652 if(f && f._ig_cb_submit)try/* raise real form.submit() */ 3653 { 3654 pan = me._onsubTime; 3655 if(pan && (new Date()).getTime() - pan > 100) 3656 pan = null; 3657 if(me._onsubmit && !flag && !pan)try 3658 { 3659 if(me._onsubmit() === false) 3660 return; 3661 }catch(ex){} 3662 f._ig_cb_submit(); 3663 }catch(me){} 3664 } 3665 /* All CallBack objects created by this class. If everything is fine, then its length should not be larger than 1. */ 3666 this._callBacks = new Array(); 3667 /* All CallBack panels that expect automatic hidden postback of their content. */ 3668 /* Its length is defined by number of CallBack controls/objects on server */ 3669 this._panels = new Array(); 3670 /* [IE bugs] scripts that should be loaded from src. */ 3671 this._jsSrcs = new Array(); 3672 this._ie = typeof ActiveXObject != 'undefined'; 3673 this._ok = this._ie || typeof XMLHttpRequest != 'undefined'; 3674 if(!this._ok) 3675 return; 3676 form._ig_cb_act = form.action; 3677 this._onsubmit = form.onsubmit;/* redirect possible onsubmit to a member function */ 3678 form.onsubmit = null; 3679 form._ig_cb_submit = form.submit;/* filter submit. Note: if a control calls form.submit(), then listeners are not notified. */ 3680 form.submit = this._submit; 3681 ig_shared.addEventListener(form, 'submit', this._onFormSubmit, true);/* used when form notifies listeners about submit */ 3682 ig_shared.addEventListener(form, 'click', this._onFormEvt, true);/* used when submit is triggered by click */ 3683 ig_shared.addEventListener(form, 'mousedown', this._onFormEvt, true);/* used when submit is triggered by mousedown */ 3684 ig_shared.addEventListener(form, 'mouseup', this._onFormEvt, true);/* used when submit is triggered by mouseup */ 3685 this._oldPostBack = window.__doPostBack; 3686 if(this._oldPostBack) 3687 window.__doPostBack = this._doPostBack;/* used when submit is triggered by __doPosBack */ 3688} 3689/* AK 5/12/2006 Creates an ActiveX from a series of progIDs. If the first one fails, the second is tried etc.
3690 Used for compatibility with later versions of objects. */ 3691function ig_createActiveXFromProgIDs(progIDs) 3692{ 3693 var e; 3694 for(var i=0;i<progIDs.length;i++) 3695 { 3696 try 3697 { 3698 var activeX=new ActiveXObject(progIDs[i]); 3699 return activeX; 3700 } 3701 catch (e){;} 3702 } 3703 return null; 3704} 3705/* VS 11/21/2006 short-cut to access any object by id */ 3706function ig$(id) 3707{ 3708 var o = null; 3709 if(typeof ig_getWebControlById == "function") 3710 o = ig_getWebControlById(id); 3711 if(o) 3712 return o; 3713 if(typeof igedit_getById == "function") 3714 o = igedit_getById(id); 3715 if(o) 3716 return o; 3717 if(typeof igtab_getTabById == "function") 3718 o = igtab_getTabById(id); 3719 if(o) 3720 return o; 3721 if(typeof igcal_getCalendarById == "function") 3722 o = igcal_getCalendarById(id); 3723 if(o) 3724 return o; 3725 if(typeof igdrp_getComboById == "function") 3726 o = igdrp_getComboById(id); 3727 if(o) 3728 return o; 3729 if(typeof iged_getById == "function") 3730 o = iged_getById(id); 3731 if(o) 3732 return o; 3733 if(typeof iglbar_getListbarById == "function") 3734 o = iglbar_getListbarById(id); 3735 if(o) 3736 return o; 3737 if(typeof igcmbo_getComboById == "function") 3738 o = igcmbo_getComboById(id); 3739 if(o) 3740 return o; 3741 if(typeof igtbl_getGridById == "function") 3742 o = igtbl_getGridById(id); 3743 if(o) 3744 return o; 3745 if(typeof igtbar_getToolbarById == "function") 3746 o = igtbar_getToolbarById(id); 3747 if(o) 3748 return o; 3749 if(typeof igmenu_getMenuById == "function") 3750 o = igmenu_getMenuById(id); 3751 if(o) 3752 return o; 3753 if(typeof igtree_getTreeById == "function") 3754 o = igtree_getTreeById(id); 3755 return o; 3756} 3757 3758 3759var _bugE = null; 3760function _bug4(v) { _bug3(v); _bugE.style.background = 'yellow'; } 3761function _bug3(v) { _bug("<br />" + v, true, "400px"); } 3762function _bug2(v) { _bug(v, true, "400px"); } 3763function _bug1(v) { _bug(v, false, "400px"); } 3764function _bug(v, a, l, t) 3765{ 3766 if (!_bugE) 3767 { 3768 _bugE = document.createElement('DIV'); 3769 document.body.insertBefore(_bugE, document.body.firstChild); 3770 var s = _bugE.style; 3771 s.position = 'absolute'; 3772 s.zIndex = 10000; 3773 s.left = s.top = '0px'; 3774 s.border = '1px dotted red'; 3775 s.fontSize = '12px'; 3776 s.fontFamily = 'courier'; 3777 } 3778 if (l) _bugE.style.left = l; 3779 if (t) _bugE.style.top = t; 3780 _bugE.innerHTML = (a ? _bugE.innerHTML : '') + v; 3781} 3782 3783if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.