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