1/* 2 widgetParent.js 3 Description: Methods for widgets that are called by Online and Desktop 4*/ 5 6// 7// WidgetMaster is for widgets to extend and saves us from writing duplicate code for each 8// 9function WidgetMaster(widgetId, widgetParams, articleContext) { 10 11 this.widgetId = widgetId; 12 this.widgetParams = widgetParams; 13 this.articleContext = articleContext; 14} 15 16// method to provide wrapper div for dynamic css_style, css_id, css_class [AVT-4216] 17WidgetMaster.prototype.renderWrapperContainer = function (parentElement) { 18 19 this.wrapperContainer = document.createElement("div"); 20 if (this.widgetParams["css_id"]) { 21 this.wrapperContainer.id = this.widgetParams["css_id"]; 22 } 23 if (this.widgetParams["css_class"]) { 24 this.wrapperContainer.setAttribute("class", this.widgetParams["css_class"]); 25 } 26 if (this.widgetParams["css_style"]) { 27 this.wrapperContainer.setAttribute("style", this.widgetParams["css_style"]); 28 } 29 parentElement.appendChild(this.wrapperContainer); 30 31 return this.wrapperContainer; 32}; 33 34WidgetMaster.prototype.getAvailability = function (currentResult) { 35 var avail = {}; 36 var status = currentResult.get("availability_status"); 37 38 switch (status) { 39 case AvailablilityStatusExcellent: 40 avail.indicator = "excellent"; 41 avail.image = "availability-excellent.png"; 42 avail.text = this.articleContext.searchLabels.avail_excellent; 43 break; 44 case AvailablilityStatusGood: 45 avail.indicator = "good"; 46 avail.image = "availability-good.png"; 47 avail.text = this.articleContext.searchLabels.avail_good; 48 break; 49 case AvailablilityStatusLimited: 50 avail.indicator = "limited"; 51 avail.image = "availability-limited.png"; 52 avail.text = this.articleContext.searchLabels.avail_limited; 53 break; 54 case AvailablilityStatusUnavailable: 55 avail.indicator = "unavailable"; 56 avail.image = "availability-unavailable.png"; 57 avail.text = this.articleContext.searchLabels.unavailable_message; 58 break; 59 case AvailablilityStatusSoldOut: 60 avail.indicator = "soldout"; 61 avail.image = "availability-sold-out.png"; 62 avail.text = this.articleContext.searchLabels.avail_sold_out; 63 break; 64 default: 65 avail.indicator = "unknown"; 66 } 67 68 return avail; 69}; 70 71/* 72 * 73 * Widget Prep Functions 74 * 75 */ 76 77function tsGetWindowSize() 78{ 79 var res = new Array(); 80 if( typeof( window.innerWidth ) == 'number' ) 81 { 82 //Non-IE 83 res[0] = window.innerWidth; 84 res[1] = window.innerHeight; 85 } 86 else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 87 { 88 //IE 6+ in 'standards compliant mode' 89 res[0] = document.documentElement.clientWidth; 90 res[1] = document.documentElement.clientHeight; 91 } 92 else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 93 { 94 //IE 4 compatible 95 res[0] = document.body.clientWidth; 96 res[1] = document.body.clientHeight; 97 } 98 return res; 99} 100 101function tsGetScrollXY() 102{ 103 var scrOfX = 0, scrOfY = 0; 104 if( typeof( window.pageYOffset ) == 'number' ) 105 { 106 //Netscape compliant 107 scrOfY = window.pageYOffset; 108 scrOfX = window.pageXOffset; 109 } 110 else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 111 { 112 //DOM compliant 113 scrOfY = document.body.scrollTop; 114 scrOfX = document.body.scrollLeft; 115 } 116 else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 117 { 118 //IE6 standards compliant mode 119 scrOfY = document.documentElement.scrollTop; 120 scrOfX = document.documentElement.scrollLeft; 121 } 122 return [ scrOfX, scrOfY ]; 123} 124 125function tsGetCoordinates( x, y, h, w ) 126{ 127 var winInfo = tsGetWindowSize(); 128 var scrInfo = tsGetScrollXY(); 129 130 // shift position according to scrolling 131 x += scrInfo[0]; 132 y += scrInfo[1]; 133 134 if( x + w + 10 > ( winInfo[0] + scrInfo[0] ) ) 135 x = ( winInfo[0] + scrInfo[0] ) - w - 10; 136 137 if( y + h + 10 > ( winInfo[1] + scrInfo[1] ) ) 138 y = ( winInfo[1] + scrInfo[1] ) - h - 10; 139 140 return [ x, y ]; 141} 142 143function tsOpenAddFriend() 144{ 145 var x = 150; 146 var y = 100; 147 var h = 725; 148 var w = 700; 149 150 var sTokenName = arguments[0]; 151 var sToken = arguments[1]; 152 153 var url = CommonPath + "/Widgets/addFriend.asp?" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 154 openWidget( "addFriend", url, { h: h, w: w, x: x, y: y } ); 155} 156 157// calendar opener 158var tsCalTargets = new Array(); 159var tsCalForm = ""; 160var tsCalCallback = null; 161var cur_sTokenName = null; 162 163function tsOpenCalendar(_event, targets, form, showtime, callback_or_stokname, stoken) 164{ 165 // open this where the mouse is 166 var x = 0; 167 var y = 0; 168 169 if( arguments.length < 4 ) 170 { 171 return; 172 } 173 174 evt = _event; 175 tsCalTargets = targets.split( "," ); 176 tsCalForm = form; 177 timeShow = showtime; 178 179 //Start of DESKTOP specific 180 if(arguments.length == 5) 181 tsCalCallback = callback_or_stokname; // TODO: $$$ this needs to be fixed !!! 182 //End of DESKTOP specific 183 184 //Start of ONLINE specific 185 if (arguments.length == 6) 186 { 187 sTokenName = callback_or_stokname; 188 if(!sToken) 189 sToken = (articleContext && articleContext.sToken) ? articleContext.sToken: stoken; 190 } 191 //End of ONLINE specific 192
193 var h = 350; 194 var w = 350; 195 196 if( timeShow != "" && timeShow == "false" ) 197 { 198 h = 300; 199 w = 300; 200 } 201 202 if( evt ) 203 { 204 x = evt.clientX; 205 y = evt.clientY; 206 } 207 else 208 { 209 x = parseInt( document.body.clientWidth / 2 - w / 2 ); 210 y = parseInt( document.body.clientHeight / 2 - h / 2); 211 } 212 213 winInfo = tsGetCoordinates( x, y, h, w ); 214 x = winInfo[0]; 215 y = winInfo[1]; 216 217 var url = CommonPath + "/Widgets/"; 218 var query = "?tsFocusForm=" + encodeURIComponent(tsCalForm) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 219 var paramCalendar = null; 220 221 if( timeShow != "" ) 222 { 223 query += "&tsShowTime=" + encodeURIComponent( timeShow ); 224 } 225 226 // add all target primitives to the URL so we can read localized dates in the calendar 227 for(var i = 0; i < tsCalTargets.length; i++) { 228 var input = document.getElementById(tsCalTargets[i]); 229 230 if(input) { 231 if(input.name.length > 7 && input.name.substr(0, 7) == "BOset::") { 232 // show localized calendar if we saw at least one primitive (i.e. BOset::) 233 query += "&" + encodeURIComponent(input.name) + "=" + encodeURIComponent(input.value); 234 paramCalendar = false; 235 } 236 else if(paramCalendar == null) { 237 // this may be either BOparam:: or a new criteria value with an arbitrary name 238 paramCalendar = true; 239 } 240 } 241 } 242 243 url += (paramCalendar ? "paramCalendar.asp" : "calendar.asp") + query; 244 245 openWidget( "calendar", url, { h: h, w: w, x: x, y: y } ); 246} 247 248function tsApplyCalendar(formattedDate) 249{ 250 for( var x = 0; x < tsCalTargets.length; x++ ) 251 { 252 document.getElementById( tsCalTargets[x] ).value = formattedDate; 253 } 254 255 if( tsCalCallback != null ) 256 tsCalCallback(); 257} 258 259// for duration primitives 260var tsDurTargets = new Array(); 261var tsDurForm = ""; 262function tsOpenDuration(evt, tsDurTargetsIn, tsDurForm, sTokenName, stoken) 263{ 264 tsDurTargets = tsDurTargetsIn.split( "," ); 265 266 // open this where the mouse is 267 var x = 0; 268 var y = 0; 269 var h = 290; 270 var w = 175; 271 272 if( evt ) 273 { 274 x = evt.clientX; 275 y = evt.clientY; 276 } 277 else 278 { 279 x = parseInt( document.body.clientWidth / 2 - w / 2 ); 280 y = parseInt( document.body.clientHeight / 2 - h / 2); 281 } 282 283 winInfo = tsGetCoordinates( x, y, h, w ); 284 x = winInfo[0]; 285 y = winInfo[1]; 286 287 var url = CommonPath + "/Widgets/duration.asp?tsFocusForm=" + encodeURIComponent( tsDurForm ) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(stoken); 288 289 if( tsDurTargets.length == 1 ) 290 { 291 if( document.getElementById( tsDurTargets[0] ) && document.getElementById( tsDurTargets[0] ).value != "" ) 292 { 293 url += "&tsCurrentValue=" + encodeURIComponent( document.getElementById( tsDurTargets[0] ).value ); 294 } 295 } 296 297 openWidget( "duration", url, { h: h, w: w, x: x, y: y } ); 298} 299 300function tsApplyDuration( duration ) 301{ 302 for( var x = 0; x < tsDurTargets.length; x++ ) 303 { 304 document.getElementById( tsDurTargets[x] ).value = duration; 305 } 306} 307 308var tsPerfSelectCallback = null; 309function tsOpenPerformanceSelector( series, callback ) 310{ 311 if( callback ) 312 tsPerfSelectCallback = callback; 313 else 314 tsPerfSelectCallback = null; 315 316 var url = CommonPath + "/Widgets/perfselect.asp?" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 317 for( x = 0; x < series.length; x++ ) 318 { 319 url += "&BOset::WOSperformances::Query::Clause::1::value=" + encodeURIComponent(series[x]); 320 } 321 322 openWidget( "performanceselect", url, { h: 406, w: 300 } ); 323} 324 325function tsApplyPerformanceSelector(perfs, seriesFields) 326{ 327 closeWidget( "performanceselect" ); 328 if( tsPerfSelectCallback ) 329 tsPerfSelectCallback(perfs, seriesFields); 330} 331 332function tsOpenColour( evt, ID ) 333{ 334 335 var h = 300; 336 var w = 420; 337 338 if( evt ) 339 { 340 x = evt.clientX; 341 y = evt.clientY; 342 } 343 else 344 { 345 x = parseInt( document.body.clientWidth / 2 - w / 2 ); 346 y = parseInt( document.body.clientHeight / 2 - h / 2); 347 } 348 349 winInfo = tsGetCoordinates( x, y, h, w ); 350 x = winInfo[0]; 351 y = winInfo[1]; 352 353 var url = CommonPath + "/Widgets/colour.asp?FocusID=" + encodeURIComponent( ID ); 354 url += "&FocusColour=" + encodeURIComponent( document.getElementById( ID ).value ) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 355 356 openWidget( "colour", url, { h: h, w: w, x: x, y: y } ); 357 358} 359 360function tsScreenSummary( objectHandle, objectType, objectMethod ) 361{ 362 scrHt = screen.availHeight;
363 scrWd = screen.availWidth; 364 if( scrHt > 768 ) { 365 scrHt = 768; 366 } 367 if( scrWd > 1024 ) { 368 scrWd = 1024; 369 } 370 var x = 0; 371 var y = 0; 372 if( x + scrWd > screen.availWidth ) { 373 x = x - ( screen.availWidth - x + scrWd ); 374 } 375 if( y + scrHt > screen.availHeight ) { 376 y = y - ( screen.availHeight - y + scrHt ); 377 } 378 379 var url = CommonPath + "/Widgets/summary_result.asp?objectHandle=" + encodeURIComponent(objectHandle); 380 url += "&objectType=" + encodeURIComponent(objectType) + "&objectMethod=" + encodeURIComponent(objectMethod) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 381 382 winArgs = "height=" + scrHt + ",width=" + scrWd + ",scrollbars=1,resizable=1,toolbar=yes,top=" + y + ",left=" + x + ",status=1,dependent=1"; 383 winName = window.open( url, "Reports", winArgs ); 384 if( window.opener ) 385 { 386 window.opener.openWindows[ "Reports" ] = winName; 387 } 388 winName.focus(); 389} 390 391 392function tsUploadSummary( objectHandle, objectType, objectMethod, template, templates, downloadFileName, protocol, username, password, URI ) 393{ 394 // close the widget 395 closeWidget( "summarywidget" ); 396 // process the download into an hidden iframe 397 var url = CommonPath + "/Widgets/summary_result.asp?objectHandle=" + encodeURIComponent(objectHandle); 398 url += "&objectType=" + encodeURIComponent(objectType) + "&objectMethod=" + encodeURIComponent(objectMethod); 399 url += "&templates=" + encodeURIComponent(templates) + "&template=" + encodeURIComponent(template); 400 url += "&downloadFileName=" + encodeURIComponent(downloadFileName) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 401 402 url += "&target=" + encodeURIComponent(protocol.toLowerCase()); 403 url += "&username=" + encodeURIComponent(username); 404 url += "&password=" + encodeURIComponent(password); 405 url += "&url=" + encodeURIComponent(URI); 406 407 408 if (document.getElementById( "BOcustBio::Request::from_customer::0" ) != undefined) 409 url += "&from_customer=" + encodeURIComponent(document.getElementById( "BOcustBio::Request::from_customer::0" ).value); 410 widget = document.createElement( "iframe" ); 411 widget.style.borderWidth = "0"; 412 widget.style.height = "0px"; 413 widget.style.width = "0px"; 414 document.body.appendChild( widget ); 415 widget.src = url; 416 417} 418 419function tsDownloadSummary( objectHandle, objectType, objectMethod, template, templates, downloadFileName ) 420{ 421 // close the widget 422 closeWidget( "summarywidget" ); 423 // process the download into an hidden iframe 424 var url = CommonPath + "/Widgets/summary_result.asp?objectHandle=" + encodeURIComponent(objectHandle); 425 url += "&objectType=" + encodeURIComponent(objectType) + "&objectMethod=" + encodeURIComponent(objectMethod) + "&target=download"; 426 url += "&templates=" + encodeURIComponent(templates) + "&template=" + encodeURIComponent(template) + "&downloadFileName=" + encodeURIComponent(downloadFileName) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 427 428 if (document.getElementById( "BOcustBio::Request::from_customer::0" ) != undefined) 429 url += "&from_customer=" + encodeURIComponent(document.getElementById( "BOcustBio::Request::from_customer::0" ).value); 430 widget = document.createElement( "iframe" ); 431 widget.style.borderWidth = "0"; 432 widget.style.height = "0px"; 433 widget.style.width = "0px"; 434 document.body.appendChild( widget ); 435 widget.src = url; 436 437} 438 439function tsUploadExtract( objectHandle, objectType, objectMethod, template, templates, downloadFileName, protocol, username, password, URI ) 440{ 441 // close the widget 442 closeWidget( "extractwidget" ); 443 444 var url = CommonPath + "/Widgets/extract_result.asp?objectHandle=" + encodeURIComponent(objectHandle); 445 url += "&objectType=" + encodeURIComponent(objectType) + "&objectMethod=" + encodeURIComponent(objectMethod); 446 url += "&templates=" + encodeURIComponent(templates) + "&template=" + encodeURIComponent(template) + "&downloadFileName=" + encodeURIComponent(downloadFileName) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 447 448 url += "&target=" + encodeURIComponent(protocol.toLowerCase()); 449 url += "&username=" + encodeURIComponent(username); 450 url += "&password=" + encodeURIComponent(password); 451 url += "&url=" + encodeURIComponent(URI); 452 453 widget = document.createElement( "iframe" ); 454 widget.style.borderWidth = "0"; 455 widget.style.height = "0px"; 456 widget.style.width = "0px"; 457 document.body.appendChild( widget ); 458 widget.src = url; 459 460} 461 462function tsDownloadExtract( objectHandle, objectType, objectMethod, template, templates, downloadFileName, tracking, generateCorrespondence, warning, srcForm, menuName, showTemplate, corrHandle, corrWork, corrObj ) 463{ 464 // close the widget 465 closeWidget( "extractwidget" ); 466 // process the download into an hidden iframe 467 var url = CommonPath + "/Widgets/extract_result.asp?objectHandle=" + encodeURIComponent(objectHandle); 468 url += "&objectType=" + encodeURIComponent(objectType) + "&objectMethod=" + encodeURIComponent(objectMethod) + "&target=download"; 469 url += "&templates=" + encodeURIComponent(templates) + "&template=" + encodeURIComponent(template) + "&downloadFileName=" + encodeURIComponent(downloadFileName) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 470 url += "&tracking=" + encodeURIComponent(tracking) + "&generateCorrespondence=" + encodeURIComponent(generateCorrespondence) + "&warning=" + encodeURIComponent(warning); 471 url += "&srcForm=" + encodeURIComponent(srcForm) + "&menuName=" + encodeURIComponent(menuName) + "&showTemplate=" + encodeURIComponent(showTemplate); 472 if(corrHandle!=undefined) 473 url += "&correspondenceObjectHandle="+encodeURIComponent(corrHandle); 474 if(corrWork!=undefined) 475 url += "&correspondenceObjectMethod="+encodeURIComponent(corrWork); 476 if(corrObj!=undefined) 477 url += "&correspondenceObjectType="+encodeURIComponent(corrObj); 478 479 widget = document.createElement( "iframe" ); 480 widget.style.borderWidth = "0"; 481 widget.style.height = "0px"; 482 widget.style.width = "0px"; 483 document.body.appendChild( widget ); 484 widget.src = url; 485 486} 487 488function tsOpenExtract( titleKey, objectHandle, objectType, objectMethod, template, showTemplate, templates, downloadFileName, srcForm, menuName, warning, sTokenName, sToken ) 489{ 490 var sendForm = srcForm ? document.forms[ srcForm ] : document.forms[0]; 491 var btnName = menuName ? menuName : "tsExtract"; 492 493 // hold onto original target and action 494 var srcTarget = sendForm.target; 495 var srcAction = sendForm.action; 496 var oHdl = document.createElement( "INPUT" ); 497 var oMth = document.createElement( "INPUT" ); 498 var oTyp = document.createElement( "INPUT" ); 499 500 501 502 503 var oKey = document.createElement( "INPUT" ); 504 var oForm = document.createElement( "INPUT" ); 505 var oMenuName = document.createElement( "INPUT" ); 506 var oTmp = document.createElement( "INPUT" ); 507 var oFname = document.createElement("INPUT"); 508 var oTemplate = document.createElement("INPUT"); 509 var oShowTemplate = document.createElement("INPUT"); 510 var oFormat = document.createElement( "INPUT" ); 511 var oGenCorrespondence = document.createElement( "INPUT" ); 512 var oTracking = document.createElement( "INPUT" ); 513 var oWarning = document.createElement( "INPUT" ); 514 515 var hasCorrespondenceCode = false;
516 if (document.getElementsByName('BOset::' + objectHandle + '::Correspondence::code').length > 0 && 517 document.getElementsByName('BOset::' + objectHandle + '::Correspondence::code')[0].value != "") 518 { 519 hasCorrespondenceCode = true; 520 } 521 522 var useMessageBOForExtract = (objectType == "TScustomerCO" && objectMethod == "extract" && hasCorrespondenceCode == true); 523 524 525 if (useMessageBOForExtract) 526 { 527 var corrObjHndl = document.createElement( "INPUT" ); 528 var corrObjMth = document.createElement( "INPUT" ); 529 var corrObjTyp = document.createElement( "INPUT" ); 530 531 corrObjHndl.type = "hidden"; 532 corrObjHndl.name = "correspondenceObjectHandle"; 533 corrObjHndl.id = "correspondenceObjectHandle"; 534 corrObjHndl.value = "BOmessageExtract"; 535 536 corrObjMth.type = "hidden"; 537 corrObjMth.name = "correspondenceObjectMethod"; 538 corrObjMth.id = "correspondenceObjectMethod"; 539 corrObjMth.value = "extractCorrespondence"; 540 541 corrObjTyp.type = "hidden"; 542 corrObjTyp.name = "correspondenceObjectType"; 543 corrObjTyp.id = "correspondenceObjectType"; 544 corrObjTyp.value = "TSmessageBO"; 545 546 sendForm.appendChild( corrObjHndl ); 547 sendForm.appendChild( corrObjMth ); 548 sendForm.appendChild( corrObjTyp ); 549 } 550 551 oHdl.type = "hidden"; 552 oHdl.name = "objectHandle"; 553 oHdl.id = "objectHandle"; 554 oHdl.value = objectHandle; 555 556 557 oMth.type = "hidden"; 558 oMth.name = "objectMethod"; 559 oMth.id = "objectMethod"; 560 oMth.value = objectMethod; 561 562 563 oTyp.type = "hidden"; 564 oTyp.name = "objectType"; 565 oTyp.id = "objectType"; 566 oTyp.value = objectType; 567 568 569 oKey.type = "hidden"; 570 oKey.name = "titleKey"; 571 oKey.id = "titleKey"; 572 oKey.value = titleKey; 573 574 oForm.type = "hidden"; 575 oForm.name = "srcForm"; 576 oForm.id = "srcForm"; 577 oForm.value = srcForm; 578 579 oMenuName.type = "hidden"; 580 oMenuName.name = "menuName"; 581 oMenuName.id = "menuName"; 582 oMenuName.value = menuName; 583 584 oShowTemplate.type = "hidden"; 585 oShowTemplate.name = "showTemplate"; 586 oShowTemplate.id = "showTemplate"; 587 oShowTemplate.value = showTemplate; 588 589 oGenCorrespondence.type = "hidden"; 590 oGenCorrespondence.name = "generateCorrespondence"; 591 oGenCorrespondence.id = "generateCorrespondence"; 592 593 oTracking.type = "hidden"; 594 oTracking.name = "tracking"; 595 oTracking.id = "tracking"; 596 597 oWarning.type = "hidden"; 598 oWarning.name = "warning"; 599 oWarning.id = "warning"; 600 oWarning.value = warning; 601 602 603 var tracking; 604 var generateCorrespondence; 605 606 if (document.getElementById('BOparam::' + objectHandle + '::extract::tracking') != undefined) 607 oTracking.value = document.getElementById('BOparam::' + objectHandle + '::extract::tracking').value; 608 609 if (document.getElementById('BOparam::' + objectHandle + '::extract::generateCorrespondence::0') != undefined) 610 oGenCorrespondence.value = document.getElementById('BOparam::' + objectHandle + '::extract::generateCorrespondence::0').value; 611 612 if( !showTemplate ) 613 { 614 oTmp.type = "hidden"; 615 oTmp.name = "noTemplate"; 616 oTmp.id = "noTemplate"; 617 oTmp.value = 1; 618 619 oTemplate.type = "hidden"; 620 oTemplate.name = "template"; 621 oTemplate.id = "template"; 622 oTemplate.value = template; 623 } 624 625 oFname.type = "hidden"; 626 oFname.name = "downloadFileName"; 627 oFname.value = downloadFileName; 628 oFname.id = "downloadFileName"; 629 630 oFormat.type = "hidden"; 631 oFormat.name = "templates"; 632 oFormat.value = templates; 633 oFormat.id = "templates"; 634 635 sendForm.appendChild( oHdl ); 636 sendForm.appendChild( oMth ); 637 sendForm.appendChild( oTyp ); 638 sendForm.appendChild( oKey ); 639 sendForm.appendChild( oForm ); 640 sendForm.appendChild( oMenuName ); 641 sendForm.appendChild( oFname ); 642 sendForm.appendChild( oFormat ); 643 sendForm.appendChild( oTracking ); 644 sendForm.appendChild( oWarning ); 645 sendForm.appendChild( oGenCorrespondence ); 646 sendForm.appendChild( oShowTemplate ); 647 if( !showTemplate ) 648 { 649 sendForm.appendChild( oTmp ); 650 sendForm.appendChild( oTemplate ); 651 } 652 if( (titleKey == "" && templates == "") || (titleKey == "Screen" && templates != "") ) 653 { 654 // close the widget 655 closeWidget( "extractwidget" ); 656 657 var url = CommonPath + "/Widgets/extract_result.asp"; 658 scrHt = screen.availHeight;
659 scrWd = screen.availWidth; 660 if( scrHt > 768 ) { 661 scrHt = 768; 662 } 663 if( scrWd > 1024 ) { 664 scrWd = 1024; 665 } 666 var x = 0; 667 var y = 0; 668 if( x + scrWd > screen.availWidth ) { 669 x = x - ( screen.availWidth - x + scrWd ); 670 } 671 if( y + scrHt > screen.availHeight ) { 672 y = y - ( screen.availHeight - y + scrHt ); 673 } 674 675 winArgs = "height=" + scrHt + ",width=" + scrWd + ",scrollbars=1,resizable=1,toolbar=yes,top=" + y + ",left=" + x + ",status=1,dependent=1"; 676 winName = window.open( "", "Extracts", winArgs ); 677 if( window.opener ) 678 window.opener.openWindows[ "Extracts" ] = winName; 679 680 sendForm.target = "Extracts"; 681 sendForm.action = url; 682 sendForm.submit(); 683 684 winName.focus(); 685 686 } 687 else 688 { 689 tsShowButtonMenu( document.getElementById( btnName + "Menu" ), btnName ); 690 var url = CommonPath + "/Widgets/extract.asp"; 691 692 sendForm.target = "extractwidget"; 693 sendForm.action = url; 694 sendForm.submit(); 695 // display our widget 696 openWidgets[ "extractwidget" ] = true; 697 var widget = document.getElementById( "Widget::extractwidget" ); 698 var shadow = document.getElementById( "Shadow::extractwidget" ); 699 shadow.style.zIndex = widgetIdx++; 700 widget.style.zIndex = widgetIdx++; 701 702 var left = document.body.clientWidth / 2 - 150 + document.body.scrollLeft; 703 var top = document.body.clientHeight / 2 - 150 + document.body.scrollTop; 704 705 widget.style.left = left; 706 widget.style.top = top; 707 708 shadow.style.left = left + 10; 709 shadow.style.top = top + 10; 710 711 shadow.style.display = "inline"; 712 widget.style.display = "block"; 713 } 714 715 try 716 { 717 var elem=document.getElementById('objectHandle'); 718 elem.parentNode.removeChild(elem) 719 elem=document.getElementById('objectMethod'); 720 elem.parentNode.removeChild(elem) 721 elem=document.getElementById('objectType'); 722 elem.parentNode.removeChild(elem) 723 elem=document.getElementById('titleKey'); 724 elem.parentNode.removeChild(elem) 725 elem=document.getElementById('downloadFileName'); 726 elem.parentNode.removeChild(elem) 727 elem=document.getElementById('templates'); 728 elem.parentNode.removeChild(elem) 729 elem=document.getElementById('generateCorrespondence'); 730 elem.parentNode.removeChild(elem) 731 elem=document.getElementById('tracking'); 732 elem.parentNode.removeChild(elem) 733 elem=document.getElementById('srcForm'); 734 elem.parentNode.removeChild(elem) 735 elem=document.getElementById('menuName'); 736 elem.parentNode.removeChild(elem) 737 elem=document.getElementById('showTemplate'); 738 elem.parentNode.removeChild(elem) 739 elem=document.getElementById('warning'); 740 elem.parentNode.removeChild(elem) 741 742 if( !showTemplate ) 743 { 744 elem=document.getElementById('noTemplate'); 745 elem.parentNode.removeChild(elem) 746 elem=document.getElementById('template'); 747 elem.parentNode.removeChild(elem) 748 } 749 750 elem = document.getElementById('correspondenceObjectHandle'); 751 if(elem!=undefined) 752 elem.parentNode.removeChild(elem); 753 754 elem = document.getElementById('correspondenceObjectMethod'); 755 if (elem != undefined) 756 elem.parentNode.removeChild(elem); 757 758 elem = document.getElementById('correspondenceObjectType'); 759 if (elem != undefined) 760 elem.parentNode.removeChild(elem); 761 762 } 763 catch( e ) 764 { 765 // nada 766 } 767 768 sendForm.target = srcTarget; 769 sendForm.action = srcAction; 770 771} 772 773function tsOpenSummary( titleKey, objectHandle, objectType, objectMethod, template, showTemplate, templates, downloadFileName, srcForm, menuName, warning, sTokenName, sToken, fromWidget ) 774{ 775 var sendForm = srcForm ? document.forms[ srcForm ] : document.forms[0]; 776 var btnName = menuName ? menuName : "tsSummary"; 777 if (fromWidget == undefined) fromWidget = false; 778 // hold onto original target and action 779 var srcTarget = sendForm.target; 780 var srcAction = sendForm.action; 781 782 if (document.getElementById("objectHandle") && !fromWidget) 783 { 784 document.getElementById("objectHandle").value = objectHandle; 785 } 786 else 787 { 788 var oHdl = document.createElement( "input" ); 789 oHdl.type = "hidden"; 790 oHdl.name = "objectHandle"; 791 oHdl.id = "objectHandle"; 792 oHdl.value = objectHandle; 793 sendForm.appendChild(oHdl); 794 } 795 796 if (document.getElementById("objectSrcForm") && !fromWidget) 797 { 798 document.getElementById("objectSrcForm").value = srcForm; 799 } 800 else 801 { 802 var oSrcForm = document.createElement( "input" ); 803 oSrcForm.type = "hidden"; 804 oSrcForm.name = "objectSrcForm"; 805 oSrcForm.id = "objectSrcForm"; 806 oSrcForm.value = srcForm; 807 sendForm.appendChild( oSrcForm ); 808 } 809 810 if (document.getElementById("objectMethod") && !fromWidget) 811 { 812 document.getElementById("objectMethod").value = objectMethod; 813 } 814 else 815 { 816 var oMth = document.createElement( "input" ); 817 oMth.type = "hidden"; 818 oMth.name = "objectMethod"; 819 oMth.id = "objectMethod"; 820 oMth.value = objectMethod; 821 sendForm.appendChild( oMth ); 822 } 823 824 if (document.getElementById("objectType") && !fromWidget) 825 { 826 document.getElementById("objectType").value = objectType; 827 } 828 else 829 { 830 var oTyp = document.createElement( "input" ); 831 oTyp.type = "hidden"; 832 oTyp.name = "objectType"; 833 oTyp.id = "objectType"; 834 oTyp.value = objectType; 835 sendForm.appendChild( oTyp ); 836 } 837 838 if (document.getElementById("titleKey") && !fromWidget) 839 { 840 document.getElementById("titleKey").value = titleKey; 841 } 842 else 843 { 844 var oKey = document.createElement( "input" ); 845 oKey.type = "hidden"; 846 oKey.name = "titleKey"; 847 oKey.id = "titleKey"; 848 oKey.value = titleKey; 849 sendForm.appendChild( oKey ); 850 } 851 852 if (document.getElementById("downloadFileName") && !fromWidget) 853 { 854 document.getElementById("downloadFileName").value = downloadFileName; 855 } 856 else 857 { 858 var oFname = document.createElement( "input" ); 859 oFname.type = "hidden"; 860 oFname.name = "downloadFileName"; 861 oFname.id = "downloadFileName"; 862 oFname.value = downloadFileName; 863 sendForm.appendChild( oFname ); 864 } 865 866 if (document.getElementById("templates") && !fromWidget) 867 { 868 document.getElementById("templates").value = templates; 869 } 870 else 871 { 872 var oFormat = document.createElement( "input" ); 873 oFormat.type = "hidden"; 874 oFormat.name = "templates"; 875 oFormat.id = "templates"; 876 oFormat.value = templates;
877 sendForm.appendChild( oFormat ); 878 } 879 880 if( !showTemplate ) 881 { 882 if (document.getElementById("noTemplate") && !fromWidget) 883 { 884 document.getElementById("noTemplate").value = 1; 885 } 886 else 887 { 888 var oTmp = document.createElement( "input" ); 889 oTmp.type = "hidden"; 890 oTmp.name = "noTemplate"; 891 oTmp.id = "noTemplate"; 892 oTmp.value = 1; 893 sendForm.appendChild( oTmp ); 894 } 895 896 if (document.getElementById("template") && !fromWidget) 897 { 898 document.getElementById("template").value = template; 899 } 900 else 901 { 902 var oTemplate = document.createElement( "input" ); 903 oTemplate.type = "hidden"; 904 oTemplate.name = "template"; 905 oTemplate.id = "template"; 906 oTemplate.value = template; 907 sendForm.appendChild( oTemplate ); 908 } 909 } 910 911 912 913 914 915 if( (titleKey == "" && templates == "") || (titleKey == "Screen" && templates != "") ) 916 { 917 // close the widget 918 closeWidget( "summarywidget" ); 919 920 var url; 921 if (document.getElementById( "BOcustBio::Request::from_customer::0" ) != undefined) 922 url = CommonPath + "/Widgets/summary_result.asp?from_customer=" + encodeURIComponent(document.getElementById( "BOcustBio::Request::from_customer::0" ).value); 923 else 924 url = CommonPath + "/Widgets/summary_result.asp"; 925 926 scrHt = screen.availHeight; 927 scrWd = screen.availWidth; 928 if( scrHt > 768 ) { 929 scrHt = 768; 930 } 931 if( scrWd > 1024 ) { 932 scrWd = 1024; 933 } 934 var x = 0; 935 var y = 0; 936 if( x + scrWd > screen.availWidth ) { 937 x = x - ( screen.availWidth - x + scrWd ); 938 } 939 if( y + scrHt > screen.availHeight ) { 940 y = y - ( screen.availHeight - y + scrHt ); 941 } 942 943 winArgs = "height=" + scrHt + ",width=" + scrWd + ",scrollbars=1,resizable=1,toolbar=yes,top=" + y + ",left=" + x + ",status=1,dependent=1"; 944 winName = window.open( "", "Reports", winArgs ); 945 if( window.opener ) 946 window.opener.openWindows[ "Reports" ] = winName; 947 948 sendForm.target = "Reports"; 949 sendForm.action = url; 950 sendForm.submit(); 951 952 winName.focus(); 953 954 } 955 else 956 { 957 958 tsShowButtonMenu( document.getElementById( btnName + "Menu" ), btnName ); 959 var url; 960 if (document.getElementById( "BOcustBio::Request::from_customer::0" ) != undefined) 961 url = CommonPath + "/Widgets/summary.asp?from_customer=" + document.getElementById( "BOcustBio::Request::from_customer::0" ).value + "&"; 962 else 963 url = CommonPath + "/Widgets/summary.asp?"; 964 965 url += oSrcForm.name + "=" + oSrcForm.value 966 967 sendForm.target = "summarywidget"; 968 sendForm.action = url; 969 sendForm.submit(); 970 971 // display our widget 972 openWidgets[ "summarywidget" ] = true; 973 var widget = document.getElementById( "Widget::summarywidget" ); 974 var shadow = document.getElementById( "Shadow::summarywidget" ); 975 976 shadow.style.zIndex = widgetIdx++; 977 widget.style.zIndex = widgetIdx++; 978 979 var left = document.body.clientWidth / 2 - 150 + document.body.scrollLeft; 980 var top = document.body.clientHeight / 2 - 150 + document.body.scrollTop; 981 982 widget.style.left = left; 983 widget.style.top = top; 984 985 shadow.style.left = left + 10; 986 shadow.style.top = top + 10; 987 988 shadow.style.display = "inline"; 989 widget.style.display = "block"; 990 } 991 992 var parentElem = oMth.parentElement; 993 994 var elem=document.getElementById('objectHandle'); 995 elem.parentNode.removeChild(elem) 996 elem=document.getElementById('objectMethod'); 997 elem.parentNode.removeChild(elem) 998 elem=document.getElementById('objectSrcForm'); 999 elem.parentNode.removeChild(elem) 1000 elem=document.getElementById('objectType'); 1001 elem.parentNode.removeChild(elem) 1002 elem=document.getElementById('titleKey'); 1003 elem.parentNode.removeChild(elem) 1004 elem=document.getElementById('downloadFileName'); 1005 elem.parentNode.removeChild(elem) 1006 elem=document.getElementById('templates'); 1007 elem.parentNode.removeChild(elem) 1008 1009 if( !showTemplate ) 1010 { 1011 elem=document.getElementById('noTemplate'); 1012 elem.parentNode.removeChild(elem) 1013 elem=document.getElementById('template'); 1014 elem.parentNode.removeChild(elem) 1015 } 1016 1017 sendForm.target = srcTarget; 1018 sendForm.action = srcAction; 1019} 1020 1021function DoAction( inValue ) 1022{ 1023 try 1024 { 1025 window.event.cancelBubble = true; 1026 }
1027 catch( e ) 1028 { 1029 // ignore, mozilla seems to not like this 1030 } 1031 1032 switch( inValue ) 1033 { 1034 case "logout" : 1035 LogOut(); 1036 break; 1037 case "password" : 1038 openWidget( "password", CommonPath + "/Widgets/changePass.asp", { h: 225, w: 400 } ); 1039 break; 1040 case "override" : 1041 openWidget( "override", CommonPath + "/Widgets/initOverride.asp", { h: 225, w: 400 } ); 1042 break; 1043 case "role" : 1044 openWidget( "role", CommonPath + "/Widgets/changeRole.asp", { h: 255, w: 450 } ); 1045 break; 1046 case "myaudienceview" : 1047 if( window.WindowPop != undefined ) 1048 { 1049 WindowPop( 'myaudienceview' ); 1050 } 1051 else 1052 { 1053 tabWindowPop( 'myaudienceview' ); 1054 } 1055 break; 1056 case "about" : 1057 openWidget( "version", CommonPath + "/Widgets/version.asp", { h: 500, w: 700 } ); 1058 break; 1059 default : 1060 break; } 1061} 1062 1063// calls the event for the key being pressed 1064function GetKey( evt ) 1065{ 1066 key = 0; 1067 1068 try 1069 { 1070 if( window.event.srcElement.type != undefined ) 1071 { 1072 return; 1073 } 1074 } 1075 catch( e ) 1076 { 1077 //alert('widgetParent.js : evt.target : ' + evt.target); 1078 if(evt){ 1079 if( evt.target.type != undefined ) 1080 { 1081 return; 1082 } 1083 } 1084 } 1085 1086 try 1087 { 1088 key = window.event.keyCode; 1089 } 1090 catch( e ) 1091 { 1092 try 1093 { 1094 // mozilla event handler 1095 key = evt.which; 1096 } 1097 catch( e ) 1098 { 1099 // nada 1100 return; 1101 } 1102 } 1103 switch( key ) 1104 { 1105 case 65: 1106 DoAction( "about" ); 1107 break; 1108 case 76: 1109 DoAction( "logout" ); 1110 break; 1111 case 77: 1112 DoAction( "myaudienceview" ); 1113 break; 1114 case 79: 1115 DoAction( "override" ); 1116 break; 1117 case 80: 1118 DoAction( "password" ); 1119 break; 1120 case 83: 1121 DoAction( "role" ); 1122 break; 1123 default: 1124 break; 1125 } 1126} 1127 1128// Widget functions 1129var tsConfirmFunction = null; 1130var tsExtractWarning = null; 1131var tsExtractParameters = new Array(); 1132var openWidgets = new Array(); 1133var widgetIdx = 10000; // Start with a large z-index incase parent screen has any non-zero z-index controls 1134 1135var avAlertMessage = ""; 1136 1137function getAVAlertMessage() 1138{ 1139 return avAlertMessage; 1140} 1141 1142function AValert( msg ) 1143{ 1144 avAlertMessage = msg; 1145 var url = CommonPath + "/Widgets/alert.asp?" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1146 openWidget("alert", url, { h: 220, w: 300, message: msg }); 1147} 1148 1149function AVconfirm( msg, func) 1150{ 1151 tsConfirmFunction = func; 1152 var url = CommonPath + "/Widgets/confirm.asp?message=" + encodeURIComponent(msg) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1153 openWidget( "confirm", url, { h: 220, w: 300 } ); 1154} 1155 1156function AVExtractConfirm( msg, titleKey, objectHandle, objectType, objectMethod, template, showTemplate, templates, downloadFileName, srcForm, menuName, warning, sTokenName, sToken ) 1157{ 1158 tsExtractParameters[0] = titleKey; 1159 tsExtractParameters[1] = objectHandle; 1160 tsExtractParameters[2] = objectType; 1161 tsExtractParameters[3] = objectMethod; 1162 tsExtractParameters[4] = template; 1163 tsExtractParameters[5] = showTemplate; 1164 tsExtractParameters[6] = templates; 1165 tsExtractParameters[7] = downloadFileName; 1166 tsExtractParameters[8] = srcForm; 1167 tsExtractParameters[9] = menuName; 1168 tsExtractParameters[10] = warning; 1169 tsExtractParameters[11] = sTokenName; 1170 tsExtractParameters[12] = sToken; 1171 tsConfirmFunction = AVExtractRetry; 1172 var url = CommonPath + "/Widgets/confirm.asp?message=" + encodeURIComponent(msg) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1173 openWidget( "confirm", url, { h: 220, w: 300 } ); 1174} 1175 1176function AVExtractRetry( val ) 1177{ 1178 if (val == true) 1179 tsOpenExtract(tsExtractParameters[0], 1180 tsExtractParameters[1], 1181 tsExtractParameters[2], 1182 tsExtractParameters[3], 1183 tsExtractParameters[4], 1184 tsExtractParameters[5], 1185 tsExtractParameters[6], 1186 tsExtractParameters[7], 1187 tsExtractParameters[8], 1188 tsExtractParameters[9], 1189 tsExtractParameters[10], 1190 tsExtractParameters[11], 1191 tsExtractParameters[12]); 1192} 1193 1194function confirmWidget( val ) 1195{ 1196 closeWidget( "confirm" ); 1197 tsConfirmFunction( val ) 1198} 1199 1200function AVinvoice( invoice, mkey, key, sTokenName, sToken ) 1201{ 1202 tsShowButtonMenu( document.getElementById( mkey ), key ); 1203 1204 openWidget( "invoice", CommonPath + "/Widgets/invoice.asp?" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken) + "&BOparam::BOorder::invoice::target=" + encodeURIComponent(invoice), { h: 225, w: 450 } ); 1205} 1206 1207// Mass add result nodes in basic form 1208function AVBIResult( hdl, bo_type ) 1209{ 1210 var url = CommonPath + "/Widgets/bi_results.asp?handle=" + encodeURIComponent(hdl) + "&type=" + encodeURIComponent(bo_type) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1211 openWidget( "bi_result", url, { h: 499, w: 800 } ); 1212} 1213 1214// Edit a BI Node or add a new one 1215function AVBIEdit( hdl, bo_type, path, ctrlId, cursorPos ) 1216{ 1217 var url = CommonPath + "/Widgets/bi_edit.asp?handle=" + encodeURIComponent(hdl) + "&type=" + encodeURIComponent(bo_type) + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1218 if( path != null ) 1219 url += "&path=" + encodeURIComponent(path); 1220 if (ctrlId != null) 1221 url += "&ctrlId=" + encodeURIComponent(ctrlId); 1222 if (cursorPos != null) 1223 url += "&cursorPos=" + encodeURIComponent(cursorPos); 1224 1225 openWidget( "bi_edit", url, { h: 505, w: 450 } ); 1226} 1227 1228function AVBIClose( handle, delList ) 1229{ 1230 for( name in delList ) 1231 { 1232 cBox = document.getElementById( "Enable::Terminate::" + handle + "::Query::ResultMember::" + delList[name] ); 1233 if( cBox ) 1234 cBox.checked = true; 1235 } 1236 document.forms[0].submit(); 1237} 1238 1239function OpenGUIDWidget( imgID, hdl, url ) 1240{ 1241 var args = new Array(); 1242 if( arguments.length == 4 ) 1243 { 1244 args = arguments[3]; 1245 } 1246 var img = document.getElementById( imgID ); 1247 var fieldName = imgID.substr( imgID.indexOf( "::" ) + 2 ); 1248 1249 if( img.lastHandle != hdl ) 1250 { 1251 // toggle menu highlights 1252 var oldpick = document.getElementById( "MenuItem::" + fieldName + "::" + img.lastHandle ); 1253 if( oldpick ) 1254 oldpick.className = "dr_menuitem"; 1255 1256 var newpick = document.getElementById( "MenuItem::" + fieldName + "::" + hdl ); 1257 if( newpick ) 1258 newpick.className = "dr_menuitem_select"; 1259 1260 } 1261 1262 if( args[ "type" ] != undefined ) 1263 { 1264 1265 // reset the desired icon behaviour 1266 img.setAttribute("lastType", args[ "type" ]); 1267 img.setAttribute("lastHandle", hdl); 1268 img.setAttribute("lastURL", url); 1269 } 1270 else 1271 { 1272 // we've clicked the icon, is it still the same type? 1273 var attr = img.getAttribute("lastHandle"); 1274 if( hdl != attr ) 1275 { 1276 hdl = img.getAttribute("lastHandle"); 1277 url = img.getAttribute("lastURL"); 1278 } 1279 } 1280 1281 if( img.style.cursor == "not-allowed" ) 1282 { 1283 // activate the icon for general use 1284 img.style.cursor = ""; 1285 tsSetEventListener(img, "mousedown", GUIDiconDown); 1286 tsSetEventListener(img, "mouseout", GUIDiconUp); 1287 tsSetEventListener(img, "mouseup", GUIDiconUp); 1288 tsSetEventListener(img, "click", GUIDiconSelect); 1289 } 1290 1291 if( document.getElementById( "menu::" + fieldName ).style.display != "none" ) 1292 tsShowButtonMenu( document.getElementById( fieldName + "::Menu" ), fieldName ); 1293 1294 if (hdl != "") { 1295 1296 var urlTokens = url.split("&"); 1297 1298 if (urlTokens[2].match(sTokenName)) 1299 url = urlTokens[0] + "&" + urlTokens[1] + "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1300 1301 openWidget( hdl, url, args ); 1302} 1303 1304else { 1305 var contextType = document.createElement("INPUT"); 1306 1307 var tokens = url.split("="); 1308 1309 contextType.name = tokens[0]; 1310 1311 contextType.value = tokens[1]; 1312 1313 document.forms[0].appendChild(contextType); 1314 1315 document.forms[0].submit(); 1316} 1317} 1318 1319// helper for dynamic guid pickers 1320function GUIDiconUp( event ) 1321{ 1322 if( event.srcElement ) 1323 event.srcElement.className = 'iconup'; 1324 else 1325 event.target.className = 'iconup'; 1326} 1327 1328// helper for dynamic guid pickers 1329function GUIDiconDown( event ) 1330{ 1331 if( event.srcElement ) 1332 event.srcElement.className = 'icondown'; 1333 else 1334 event.target.className = 'icondown'; 1335} 1336 1337// helper for dynamic guid pickers 1338function GUIDiconSelect( event ) 1339{ 1340 var obj = event.srcElement ? event.srcElement : event.target; 1341 OpenGUIDWidget( obj.id, obj.lastHandle, obj.lastURL, { h: 700, w: 800 } ); 1342} 1343//End of DESKTOP specific only 1344 1345// big list widget 1346function openListWidget( elem, handle, botype, prim, basename ) 1347{ 1348 url = CommonPath + "/Widgets/biglist.asp?handle=" + encodeURIComponent( handle ); 1349 url += "&botype=" + encodeURIComponent( botype ) + "&element=" + encodeURIComponent( elem ); 1350 url += "&primitive=" + encodeURIComponent( prim ); 1351 url += "&basename=" + encodeURIComponent( basename ); 1352 url += "&" + encodeURIComponent(sTokenName) + "=" + encodeURIComponent(sToken); 1353 1354 if( arguments.length == 6 ) 1355 url += "&nomulti=" + encodeURIComponent(arguments[5]); 1356 1357 openWidget( prim, url, { h: 600, w: 600 } ); 1358} 1359 1360function openWidget( hdl, url, args ) 1361{ 1362 if (event && event.target) 1363 { 1364 modalOpener = event.target; 1365 } 1366 else 1367 { 1368 modalOpener = false;
1369 } 1370 //Temporary fix for sToken renderer issue. If the URL is not encoded, encode the sToken to open widgets 1371 if (arguments.length >= 4 && !arguments[3]) { 1372 var tokenIndex = url.indexOf("sToken"); 1373 var sTokenVal = encodeURIComponent(url.substring(tokenIndex + 7)); 1374 url = url.substring(0,tokenIndex+7) + sTokenVal; 1375 } 1376 var widget, shadow; 1377 1378 if( openWidgets[ hdl ] == undefined ) 1379 { 1380 widget = document.createElement( "iframe" ); 1381 shadow = document.createElement( "div" ); 1382 widget.id = "Widget::" + hdl; 1383 widget.name = "Widget::" + hdl; 1384 widget.className = "widget"; 1385 widget.scrolling = "no"; 1386 widget.border = 0; 1387 widget.frameborder = 0; 1388 widget.style.visibility = "hidden"; 1389 widget.src = url; 1390 shadow.id = "Shadow::" + hdl; 1391 shadow.className = "drop"; 1392 shadow.style.visibility = "hidden"; 1393 openWidgets[ hdl ] = true; 1394 1395 document.getElementsByTagName( "body" )[0].appendChild( shadow ); 1396 document.getElementsByTagName( "body" )[0].appendChild( widget ); 1397 1398 } 1399 else 1400 { 1401 widget = document.getElementById( "Widget::" + hdl ); 1402 widget.src = url; 1403 shadow = document.getElementById( "Shadow::" + hdl ); 1404 } 1405 1406 var ht = "300px"; 1407 var hdiv = 150; 1408 if( args[ "h" ] != undefined ) 1409 { 1410 ht = args[ "h" ] + "px"; 1411 hdiv = Math.round( args[ "h" ] / 2 ); 1412 } 1413 1414 var wt = "300px"; 1415 var wdiv = 150; 1416 if( args[ "w" ] != undefined ) 1417 { 1418 wt = args[ "w" ] + "px"; 1419 wdiv = Math.round( args[ "w" ] / 2 ); 1420 } 1421 1422 widget.style.height = ht; 1423 widget.style.width = wt; 1424 1425 // set base values for x & y location of widget parent 1426 var left = 0; 1427 var top = 0; 1428 var left_unit = "px"; 1429 // set the widget pop-up to always be 20% from the top of the viewport 1430 var top = 15; 1431 var top_unit = "px"; 1432 1433 if( args[ "x" ] == undefined ) 1434 { 1435 left = document.body.clientWidth / 2 - wdiv + document.body.scrollLeft; 1436 } 1437 else 1438 { 1439 left = args[ "x" ]; 1440 } 1441 1442 if( args[ "y" ] == undefined ) 1443 { 1444 top = document.body.clientHeight / 2 - hdiv + document.body.scrollTop; 1445 } 1446 else 1447 { 1448 top = args[ "y" ]; 1449 } 1450 1451 // Ensure the left of the dialog is displayed in the client area. 1452 if (left < document.body.scrollLeft) 1453 { 1454 left = document.body.scrollLeft; 1455 } 1456 1457 if (args["y"] != undefined) 1458 { 1459 top = args["y"]; 1460 top_unit = "px"; 1461 } 1462 1463 widget.style.left = left + left_unit; 1464 widget.style.top = top + top_unit; 1465 1466 widget.style.visibility = "visible"; 1467 shadow.style.visibility = "visible"; 1468 1469 shadow.style.zIndex = widgetIdx++; 1470 widget.style.zIndex = widgetIdx++; 1471 1472//Start ONLINE 1473 shadow.style.position = "fixed"; 1474 widget.style.position = "absolute"; 1475//End ONLINE 1476 1477 return true; 1478} 1479 1480function openFormWidget( hdl ) 1481{ 1482 var widget, shadow; 1483 if( openWidgets[ hdl ] == undefined ) 1484 { 1485 shadow = document.createElement( "div" ); 1486 1487 // Fix for IE bug when trying to dynamically post a form to an iframe created in DOM 1488 var widget = document.createElement( "span" ); 1489 widget.innerHTML = "<iframe id='Widget::" + hdl + "' name='Widget::" + hdl + "' class='widget' width='100%' height='92%' scrolling='no' style='visibility: hidden' frameBorder='0'>"; 1490 1491 shadow.id = "Shadow::" + hdl; 1492 shadow.className = "drop"; 1493 shadow.style.visibility = "hidden"; 1494 openWidgets[ hdl ] = true; 1495 document.getElementsByTagName( "body" )[0].appendChild( shadow ); 1496 document.getElementsByTagName( "body" )[0].appendChild( widget ); 1497 } 1498 else 1499 { 1500 shadow = document.getElementById( "Shadow::" + hdl ); 1501 } 1502 widget = document.getElementById( "Widget::" + hdl ); 1503 1504 var args = new Array(); 1505 if( arguments.length == 2 ) 1506 { 1507 args = arguments[1]; 1508 } 1509 var ht = "300px"; 1510 var hdiv = 150; 1511 if( args[ "h" ] != undefined ) 1512 { 1513 ht = args[ "h" ] + "px"; 1514 hdiv = Math.round( args[ "h" ] / 2 ); 1515 } 1516 1517 var wt = "300px"; 1518 var wdiv = 150; 1519 if( args[ "w" ] != undefined ) 1520 { 1521 wt = args[ "w" ] + "px"; 1522 wdiv = Math.round( args[ "w" ] / 2 ); 1523 } 1524 1525 widget.style.height = ht; 1526 widget.style.width = wt; 1527 1528 // center this on the window for now 1529 var left = 0; 1530 var top = 0; 1531 1532 if( args[ "x" ] == undefined ) 1533 { 1534 left = document.body.clientWidth / 2 - wdiv + document.body.scrollLeft; 1535 } 1536 else 1537 { 1538 left = args[ "x" ]; 1539 } 1540 1541 if( args[ "y" ] == undefined ) 1542 { 1543 top = document.body.clientHeight / 2 - hdiv + document.body.scrollTop; 1544 } 1545 else 1546 { 1547 top = args[ "y" ]; 1548 } 1549 1550 widget.style.left = left; 1551 widget.style.top = top; 1552 1553 shadow.style.zIndex = widgetIdx++; 1554 widget.style.zIndex = widgetIdx++; 1555 1556 widget.style.visibility = "visible"; 1557 shadow.style.visibility = "visible"; 1558 1559 return true; 1560} 1561//End of DESKTOP specific only 1562 1563function closeWidget( hdl, inMsg ) 1564{ 1565 var elemW = document.getElementById( "Widget::" + hdl );
1566 var elemS = document.getElementById( "Shadow::" + hdl ); 1567 1568 if(elemW && elemS) 1569 { 1570 if( hdl == "summarywidget" || hdl == "extractwidget") 1571 { 1572 elemW.style.display = "none"; 1573 elemS.style.display = "none"; 1574 } 1575 else 1576 { 1577 elemW.style.visibility = "hidden"; 1578 elemS.style.visibility = "hidden"; 1579 } 1580 1581 if( inMsg != null && inMsg != "" ) 1582 { 1583 AValert( inMsg ); 1584 } 1585 } 1586} 1587 1588/* 1589* doAction :: applicable only for search based widget [upsell Feature, add-on Feature] 1590* 1591* index -> actionIndex :: to conclude what action to be taken; based on the parent page 1592* id -> context_id (not the article_id) :: some situation, we need to pass the 1593* context_id to the parent page in order to make it work; 1594* doAction is based on CancelCall 1595*/ 1596function doAction(index, id) { 1597 //alert('doAction : index : ' + index + ', id: ' + id); 1598 1599 switch (index) 1600 { 1601 case 0: //misc item : upsell cancel call 1602 submitMiscItems(id); 1603 break; 1604 case 1: //gifts : upsell cancel call 1605 submitGifts(id); 1606 break; 1607 case 2: //bundles : upsell cancel call 1608 plainSubmit(id); 1609 break; 1610 case 4: //Performances: seatSearch.asp : direct link submit 1611 tsSelectDirectLink(urlToBeSubmitted); 1612 break; 1613 case 5: //Performances: seatSearch.asp : Map Select Button Click 1614 tsSelectMapDefault(); 1615 break; 1616 case 6: //Performances: seatSearch.asp : Best Available Button Click 1617 tsSelectBestAvailableDefault(); 1618 break; 1619 case 7: //Stored Value Items: 1620 addSelectedValueItem(); 1621 break; 1622 default: //default applicable for links in orderSummary.asp ; applicable for all 1623 // do nothing 1624 } 1625} 1626 1627/* 1628function doActionOld(index, id) { 1629 1630 alert('doAction : index : ' +index+', id: '+id ); 1631 switch(index) 1632 { 1633 case 0: //direct link selection from seatSearch.asp 1634 SubmitForm(urlToBeSubmitted); 1635 break; 1636 case 1: //'Map Select' from seatSearch.asp [caller id 8 : upsell call] 1637 tsSelectMapWhenWidgetCancelled(8, id); 1638 break; 1639 case 2: //direct link selection from bundleSelect.asp 1640 submitFormWhenWidgetsCancelled(id); 1641 break; 1642 case 3: //direct link selection from miscItemSearch.asp 1643 submitLocalForm(id); //context_id is getting passed 1644 break; 1645 case 4: //addToOrder button click from giftSearch.asp [upsell final call] 1646 tsAddToOrderDefault(id); //context_id is getting passed 1647 break; 1648 case 5: //'Map Select' from seatSearch.asp [caller id 16 : addon call] 1649 tsSelectMapWhenWidgetCancelled(16); 1650 break; 1651 case 6: //'Best Available' from seatSearch.asp [caller id 8 : upsell call] 1652 tsSelectBestAvailableWhenWidgetsCancelled(8); 1653 break; 1654 case 7: //'Best Available' from seatSearch.asp [caller id 16 : addon call] 1655 tsSelectBestAvailableWhenWidgetsCancelled(16); 1656 break; 1657 case 8: //'Direct Link' clicking when the user cancel the widget from seatSearch.asp [caller id 8: upsell call] 1658 tsSelectDirectLinkWhenWidgetsCancelled(urlToBeSubmitted, performanceIdToBeSubmitted, 8); 1659 break; 1660 case 9: //'Direct Link' clicking when the user cancel the widget [caller id 16: addon call] 1661 tsSelectDirectLinkWhenWidgetsCancelled(urlToBeSubmitted, performanceIdToBeSubmitted, 16); 1662 break; 1663 case 10: //direct link selection from miscItemSearch.asp [caller id 8 : upsell call] 1664 //alert('arguments[2] : ' + arguments[2]); 1665 submitLocalForm(id, 8, arguments[2]); //context_id is getting passed 1666 break; 1667 case 11: //direct link selection from miscItemSearch.asp [caller id 16: addon call] 1668 submitLocalForm(id, 16, ''); //context_id is getting passed ; empty must be provided 1669 break; 1670 case 12: //radio buttno submit from giftsSearch.asp [caller id 8 : upsell call] 1671 //alert('arguments[2] : ' + arguments[2]); 1672 submitLocalForm(id, 8, arguments[2]); //context_id is getting passed 1673 break; 1674 case 13: //radio buttno submit from giftsSearch.asp [caller id 16 : upsell call] 1675 submitLocalForm(id, 16, ''); //context_id is getting passed 1676 break; 1677 case 14: //addToOrder button click from giftSearch.asp [caller id 8 : upsell call] 1678 submitLocalForm(id, 8, arguments[2]); //context_id is getting passed 1679 break; 1680 case 15: //addToOrder button click from giftSearch.asp [ call] 1681 tsAddToOrderDefault(); 1682 break; 1683 case 16: //Direct Link click from bundleSelect.asp [ caller id 8: upsell call ] 1684 //alert('16 here'); 1685 submitBundles(id, 8, arguments[2]); 1686 break; 1687 case 17: //Direct Link click from bundleSelect.asp [ caller id 16: addon call ] 1688 submitBundles(id, 16 ); 1689 break; 1690 default: //default applicable for links in orderSummary.asp 1691 // do nothing 1692 } 1693} 1694*/ 1695 1696function resizeWidget( hdl, ht, wd ) 1697{ 1698 var widget = document.getElementById( "Widget::" + hdl ); 1699 1700 if( widget ) 1701 { 1702 widget.style.height = ht + "px"; 1703 widget.style.width = wd + "px"; 1704 } 1705} 1706 1707function applyWidget( hdl, inMsg, frmIdx ) 1708{ 1709 closeWidget( hdl, inMsg ); 1710 1711 var formTarget = 0; 1712 if( frmIdx != null ) 1713 { 1714 formTarget = frmIdx; 1715 } 1716 1717 var notifyElem = document.createElement( "INPUT" ); 1718 notifyElem.type = "hidden"; 1719 notifyElem.name = "tsAttachNotify"; 1720 notifyElem.value = "1"; 1721 document.forms[ formTarget ].appendChild( notifyElem ); 1722 1723 if( ++submitCount == 1 ) 1724 document.forms[ formTarget ].submit(); 1725} 1726 1727 1728/* 1729 * Widget drag functions 1730 */ 1731 1732var widgetdragger = null; 1733 1734var widgetdragX = 0; 1735var widgetdragY = 0; 1736var widgetstartX = 0; 1737var widgetstartY = 0; 1738 1739function startWidgetDrag( hdl, mouseX, mouseY ) 1740{ 1741 widgetdragger = document.getElementById( 'Widget::' + hdl ); 1742 1743 widgetdragger.style.zIndex = widgetIdx++; 1744 1745 widgetdragX = parseInt( widgetdragger.style.left ); 1746 widgetdragY = parseInt( widgetdragger.style.top ); 1747 widgetstartX = mouseX; 1748 widgetstartY = mouseY; 1749} 1750 1751function stopWidgetDrag() 1752{ 1753 widgetdragger = null; 1754} 1755 1756function moveWidget( offsetX, offsetY ) 1757{ 1758 if( ( widgetdragX + offsetX < 0 ) || ( widgetdragY + offsetY ) < 0 ) 1759 { 1760 return; 1761 } 1762 1763 if( widgetdragger != null ) 1764 { 1765 try 1766 { 1767 widgetdragger.style.left = ( widgetdragX + offsetX ) + "px"; 1768 widgetdragger.style.top = ( widgetdragY + offsetY ) + "px"; 1769 } 1770 catch( e ) 1771 { 1772 } 1773 } 1774}
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.