1/* 2JavaScript routines to resolve references for windows inside lightbox 3*/ 4 5getOpener = function(ignoreOpenerProperty) 6{ 7 if ((self != top) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 8 { 9 var win = top.commonspot.lightbox.getOpenerWindow(ignoreOpenerProperty); 10 if (win) 11 return win; 12 else 13 { 14 if (top.commonspot.lightbox.stack.length <= 1) 15 return top; 16 } 17 } 18 else 19 { 20 return self.opener; 21 } 22}; 23 24getOpenerWithIFrame = function(iFrameID) 25{ 26 var wnd = getOpener(); 27 var obj = wnd.document.getElementById(iFrameID); 28 if (obj) 29 { 30 return obj.contentWindow; 31 } 32 return getOpener(); 33}; 34 35getWindowWithFrame = function (FrameName) 36{ 37 var stackLen = 0; 38 var wn = null; 39 if ((self != top) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 40 stackLen = top.commonspot.lightbox.stack.length; 41 for (var i=stackLen-1; i>=0; i--) 42 { 43 wn = top.commonspot.lightbox.stack[i].getWindow(); 44 if (wn) 45 { 46 try 47 { 48 if (typeof wn.frames[FrameName] != 'undefined') 49 return wn.frames[FrameName].window 50 }catch(e){} 51 } 52 } 53 return wn; 54}; 55 56getRTEopener = function (FrameName) 57{ 58 alert('use getRTEObject instead.'); 59}; 60 61getRTEObject = function(FrameName, checkFrames, closeHigherWindows) 62{ 63 // Grab the window object out of the RTE's iframe 64 checkFrames = (typeof checkFrames == 'undefined') ? true : checkFrames; 65 FrameName = (typeof FrameName == 'undefined') ? 'WebEdit' : FrameName; 66 var fr = null; 67 var wn = null; 68 var rteObj = null; 69 var stackLen = 0; 70 var fWn = null; 71 if ((self != top) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 72 stackLen = top.commonspot.lightbox.stack.length; 73 for (var i=stackLen-1; i>=0; i--) 74 { 75 wn = top.commonspot.lightbox.stack[i].getWindow(); 76 if (wn) 77 { 78 if (checkFrames) 79 { 80 for (j=0; j<wn.frames.length; j++) 81 { 82 try 83 { 84 fWn = wn.frames[j]; 85 if (fWn) 86 { 87 // Debjani: 20 May 2024: Issue 25206: Changes to code to refer to an instance of RTE in ckeditor5 88 if (typeof fWn['RTEInstances'] != 'undefined') 89 { 90 rteObj = fWn['RTEInstances'][FrameName]; 91 break; 92 } 93 } 94 }catch(e){} 95 } 96 } 97 try 98 { 99 // Debjani: 20 May 2024: Issue 25206: Changes to code to refer to an instance of RTE in ckeditor5 100 if (typeof wn['RTEInstances'] != 'undefined') 101 { 102 rteObj = wn['RTEInstances'][FrameName]; 103 break; 104 } 105 }catch(e){} 106 } 107 } 108 if (!rteObj) 109 { 110 wn = top; 111 if (checkFrames) 112 { 113 for (j=0; j<wn.frames.length; j++) 114 { 115 try 116 { 117 fWn = wn.frames[j]; 118 // Debjani: 20 May 2024: Issue 25206: Changes to code to refer to an instance of RTE in ckeditor5 119 if (typeof fWn['RTEInstances'] != 'undefined') 120 { 121 rteObj = fWn['RTEInstances'][FrameName]; 122 break; 123 } 124 }catch(e){} 125 } 126 } 127 try 128 { 129 // Debjani: 20 May 2024: Issue 25206: Changes to code to refer to an instance of RTE in ckeditor5 130 if (typeof wn['RTEInstances'] != 'undefined') 131 rteObj = wn['RTEInstances'][FrameName]; 132 }catch(e){} 133 } 134 135 if (rteObj && closeHigherWindows && top.commonspot.lightbox) 136 top.commonspot.lightbox.closeChildDlgsFromPosition(i); 137 138 return rteObj; 139}; 140 141hasLightbox = function() 142{ 143 return ((top != self) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')); 144}; 145 146var cleanHTMLWnd; 147var spellcheckerWnd; 148getCleanHTMLTarget = function(dlgLoader) 149{ 150 var url = dlgLoader ? dlgLoader + '?CSRF_Token=' + top.commonspot.util.cookie.readCookie('CSRFTOKEN') + '&csModule=/commonspot/dhtmledit/clean_dhtml_fields' : '/commonspot/dhtmledit/clean_dhtml_fields.cfm'; 151 152 if((top != self) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 153 { 154 var frName; 155 for (var i=0; i<top.commonspot.lightbox.stack.length; i++) 156 { 157 frName = top.commonspot.lightbox.stack[i].getFrameName(); 158 if (frName == 'cleanHTML') 159 return frName; 160 } 161 var lightboxTarget = openEmptyLightBox(url, null, 'cleanHTML'); 162 return top.commonspot.lightbox.getFrameName(); 163 } 164 else 165 {
166 if (!cleanHTMLWnd || cleanHTMLWnd.closed) 167 cleanHTMLWnd = newWindow( 'cleanHTML', url); 168 return 'cleanHTML'; 169 } 170}; 171 172getSpellCheckTarget = function(dlgLoader) 173{ 174 var url = dlgLoader ? dlgLoader + '?CSRF_Token=' + top.commonspot.util.cookie.readCookie('CSRFTOKEN') + '&csModule=/commonspot/spellchk/introscreen' : '/commonspot/spellchk/introscreen.cfm'; 175 176 if((top != self) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 177 { 178 // Open an empty lightbox 179 var frName; 180 for (var i=0; i<top.commonspot.lightbox.stack.length; i++) 181 { 182 frName = top.commonspot.lightbox.stack[i].getFrameName(); 183 if (frName == 'spellchecker') 184 return frName; 185 } 186 var lightboxTarget = openEmptyLightBox(url, null, 'spellchecker'); 187 return top.commonspot.lightbox.getFrameName(); 188 } 189 else 190 { 191 if (!spellcheckerWnd || spellcheckerWnd.closed) 192 spellcheckerWnd = newWindow( 'spellchecker', url); 193 return 'spellchecker'; 194 } 195}; 196 197closeEmptyChildDialogs = function(frameNameList) 198{ 199 frameNameList = frameNameList ? frameNameList : 'cleanHTML,spellchecker'; 200 if ((top != self) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 201 { 202 var win; 203 for (var i=top.commonspot.lightbox.stack.length-1; i>=0; i--) 204 { 205 win = top.commonspot.lightbox.stack[i]; 206 frName = win.getFrameName(); 207 if (frameNameList.indexOf(frName) >= 0) 208 win.close(); 209 } 210 } 211}; 212 213closeCleanHTMLWindows = function() 214{ 215 closeEmptyChildDialogs('cleanHTML'); 216 /* 217 if (self.children) 218 { 219 for(i=0;i<self.children.length;i++) 220 self.children[i].close(); 221 } 222 */ 223}; 224 225getCSModuleField = function(thisForm) 226{ 227 var fld = null; 228 var update = 0; 229 if (typeof thisForm.CSMODULE != 'undefined') 230 { 231 fld = thisForm.CSMODULE; 232 update = 1; 233 } 234 else if (typeof thisForm.csModule != 'undefined') 235 fld = thisForm.csModule; 236 else if (typeof thisForm.csmodule != 'undefined') 237 { 238 fld = thisForm.csmodule; 239 update = 1; 240 } 241 if (update) 242 fld.setAttribute('name', 'csModule'); 243 return fld; 244}; 245 246closeSpellCheckWindows = function() 247{ 248 closeEmptyChildDialogs('spellchecker'); 249}; 250 251openEmptyLightBox = function(url, hideClose, name, customOverlayMsg) 252{ 253 var lightboxTarget; 254 url = url ? url : null; 255 hideClose = hideClose ? hideClose : null; 256 name = name ? name : null; 257 customOverlayMsg = customOverlayMsg ? customOverlayMsg : null; 258 // If we are inside a lightbox 259 if ((top != self) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 260 { 261 // Open an empty lightbox 262 top.commonspot.lightbox.openDialog(url, hideClose, name, customOverlayMsg, null, null, true); 263 264 lightboxTarget = top.commonspot.lightbox.getFrameName(); 265 // Form's target now must be the lightbox, not a new window 266 return lightboxTarget; 267 } 268}; 269 270// returns contentWindow of admin-frame 271getAdminWindow = function() 272{ 273 var win = null; 274 if ((top != self) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) 275 win = top.commonspot.lightbox.getAdminWindow(); 276 return win; 277}; 278 279 280 /** 281 * Generic alert to user. 282 * see commonspot.dialog.client.showHTMLDialog for supported options 283 * msg can be text, or can be an array, in which case it'll be rendered as an html list 284 */ 285if ((top != self) && (typeof(top.commonspot)!== 'undefined') && (typeof(top.commonspot.lightbox)!== 'undefined')) 286{ 287 if (typeof top.commonspot.dialog === 'undefined') 288 top.commonspot.dialog = {}; 289 if (typeof top.commonspot.dialog.client === 'undefined') 290 { 291 top.commonspot.dialog.client = {}; 292 293 top.commonspot.dialog.client.alert = function(msg, options) 294 { 295 var html; 296 if(msg.constructor == String) 297 html = msg; 298 else // assumed to be an array 299 { 300 if(msg.length === 1) 301 html = msg[0]; 302 else 303 { 304 html = "<ul>"; 305 for(var i = 0; i < msg.length; i++) 306 html += "<li>" + msg[i] + "</li>"; 307 html += "</ul>"; 308 } 309 } 310 html = html.replace(/\n/g, '<br />'); 311 top.commonspot.dialog.client.showHTMLDialog(html, options, 'alert'); 312 }; 313 314 /* 315 * create a lightboxed dlg containing the passed html 316 */ 317 top.commonspot.dialog.client.showHTMLDialog = function(html, options, dialogType) 318 { 319 options = options || {}; 320 var defaultOptions = 321 { 322 title: "CommonSpot Message", 323 subtitle: "", 324 helpId: "", 325 width: 500, 326 height: 600, 327 style: '', 328 useDefaultStyles: true, 329 maximize: false, 330 hideClose: false, 331 hideHelp: true, 332 hideReload: true 333 }; 334 top.commonspot.util.merge(options, defaultOptions); 335 336 dialogType = dialogType || 'dialog'; 337 338 var style = options.style; 339 if(options.useDefaultStyles) 340 style = top.commonspot.dialog.client.getHTMLDialogDefaultStyles() + style; 341 342 html = top.commonspot.dialog.client.getHTMLDialogHTML(html, style, options.title, options); 343 344 // openDialog(url, hideClose, name, customOverlayMsg, dialogType, opener, hideHelp) 345 var dlgObj = top.commonspot.lightbox.openDialog("about:blank", options.hideClose, null, top.commonspot.lightbox.NO_OVERLAY_MSG, dialogType, null, options.hideClose, options.hideReload); 346 var lightboxWindow = dlgObj.getWindow(); 347 lightboxWindow.document.write(html); 348 lightboxWindow.document.close(); 349 350 top.commonspot.lightbox.initCurrent 351 ( 352 options.width, 353 options.height, 354 { 355 title: options.title, subtitle: options.subtitle, helpId: options.helpId, 356 close: options.close, reload: options.reload, maximize: options.maximize 357 }, 358 '', 359 true 360 ); 361 362 var dt = lightboxWindow.document.getElementById("dialogContainer"); 363 var w = Math.max(dt.clientWidth + 30, 350); 364 var h = Math.max(dt.clientHeight, 70) - ((options.hideClose && !options.customButtons) ? 30 : 0); 365 top.commonspot.lightbox.resizeCurrent(w, h); 366 // first wanted this to autosize, to measure it, but now want it full width so close btn is far right 367 lightboxWindow.document.getElementById("dialogContainer").style.width = "100%"; 368 }; 369 370 top.commonspot.dialog.client.getHTMLDialogDefaultStyles = function() 371 { 372 var style = 373 'body {font-family: Verdana,Arial,Helvetica,sans-serif; margin: 0; overflow: scroll; text-decoration: none; font-size: 11px;}\n\ 374 a:active {text-decoration: underline;
374 color: #1D2661;}\n\ 375 a:hover {text-decoration: underline;color: #003366;}\n\ 376 a {color: #1D2661;text-decoration: underline;}\n\ 377 a:visited { text-decoration: underline;color: #1D2661;}\n\ 378 #content {margin: 15px 11px; overflow: auto; font-size: 11px;}\n\ 379 #innerdialogContainer {background-color:#F0F0F0;border-bottom:1px solid #999999;border-top:1px solid #999999;margin-top:10px;}\n\ 380 #htmlDlgTableCell h2 {font-size: 11px; margin: 15px 0 8px;}\n\ 381 #htmlDlgTableCell h2:first-child {margin-top: 0;}\n\ 382 #htmlDlgTableCell p {margin: 0 0 8px; padding: 0;}\n\ 383 #htmlDlgTableCell ul {margin: 0 0 1em 1em; padding: 0;}\n\ 384 #htmlDlgTableCell li {margin: 5px;}\n\ 385 #htmlDlgTableCell dl {margin: 0 0 1em;}\n\ 386 #htmlDlgTableCell dt {color: #013466; font-weight: bold; margin: 5px 0 0;}\n\ 387 #htmlDlgTableCell dd {margin: 0 0 0 1.5em;}\n\ 388 #dialogContainer #dialogFooter {display: block; font-weight: bold; height: 28px; line-height: 28px; margin: 5px 0 0; padding: 0 1px; text-align: right; font-size: 11px;}\n\ 389 #htmlDlgTableCell .dumpTable caption {font-size: 8pt; font-weight: bold;}\n\ 390 #htmlDlgTableCell .dumpTable td {border: 1px solid #ccc; font-size: 8pt; padding: 1px;}\n\ 391 '; 392 return style; 393 }; 394 395 top.commonspot.dialog.client.getHTMLDialogHTML = function(alertHTML, styleHTML, title, options) 396 { 397 var btnHTML = ''; 398 var linkID, linkClass, linkOnClick, linkObj, linkAccessKey, linkText; 399 var accessKeyHTML = ''; 400 btnHTML += options.hideClose ? '' : '<a id="closeButton" accesskey="C" href="javascript:;" onclick="top.commonspot.lightbox.closeCurrent()">Close</a>'; 401 if (options.customButtons) 402 { 403 for (var i=0; i<options.customButtons.length; i++) 404 { 405 linkObj = options.customButtons[i]; 406 linkID = linkObj.id ? linkObj.id : 'okButton'; 407 linkOnClick = linkObj.onclick ? linkObj.onclick : ''; 408 linkText = linkObj.linkText ? linkObj.linkText : ''; 409 if (linkObj.accessKey) 410 accessKeyHTML = ' accesskey="' + linkObj.accessKey + '"'; 411 if (linkOnClick != '' && linkID != '' && linkText != '') 412 btnHTML += '<a id="' + linkID + '"' + accessKeyHTML + ' href="javascript:;" onclick="' + linkOnClick + '">' + linkText + '</a>'; 413 } 414 } 415 var html = 416 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + 417 '<html>' + 418 '<head>' + 419 '<link href="/commonspot/dashboard/css/dialog.css" rel="stylesheet" type="text/css" id="dialogcss" />' + 420 '<style>' + styleHTML + '</style>' + 421 (title ? '<title>' + title + '</title>' : '') + 422 '</head>' + 423 '<body>' + 424 '<table id="dialogContainer">' + 425 '<tr><td>' + 426 '<table id="innerdialogContainer" width="100%">' + 427 '<tr>' + 428 '<td id="htmlDlgTableCell">' + 429 '<div id="content">' + alertHTML + '</div>' + 430 '</td>' + 431 '</tr>' + 432 '</table>' + 433 '</td></tr>' + 434 '<tr><td>' + 435 '<div id="dialogFooter">' + 436 btnHTML + 437 '</div>' + 438 '</td></tr>' + 439 '</table>' + 440 '</body>' + 441 '</html>'; 442 return html; 443 }; 444 } 445} 446 447function checkOrSelectLinkVisibleInDOMFromRowData(row, action) 448{ 449 return checkOrSelectLinkVisibleInDOMFromLinkData(row.linktype, row.url, row.linktargetid, action); 450} 451 452function checkOrSelectLinkVisibleInDOMFromLinkData(linkType, URL, linkTargetID, action) 453{ 454 if( parent.window.Dashboard ) 455 { 456 var win_obj = parent.window.Lview.frame.dom().contentWindow; 457 var doc_obj = win_obj.document; 458 } 459 else 460 { 461 var win_obj = getOpener(); 462 var doc_obj = win_obj.document; 463 } 464 465 var argText = ''; 466 467 var type = linkType; 468 if (URL == '' || type == 10) 469 { 470 argText = linkTargetID; 471 argText = argText.toString(); 472 } 473 else 474 { 475 argText = URL; 476 var argArray = argText.split(':'); 477 478 if( argArray.length == 2 && argArray[1].trim() == linkTargetID ) 479 { 480 argText = linkTargetID; 481 argText = argText.toString(); 482 } 483 } 484 485 var imageType = 0; 486 var attrib = 'href'; 487 488 if (type == 1 || type == 2 || type == 7 || type == 8 || type == 9 || type == 4 || type == 5 || type == 6 || type == 10 || type == 13) 489 { 490 var aDivs = doc_obj.getElementsByTagName("A"); 491 var iDivs = doc_obj.getElementsByTagName("IMG"); 492 } 493 494 if (type == 4 || type == 5 || type == 6) 495 imageType = 1; 496 497 if (type == 10) // Popup menu 498 { 499 argText = "CP_MENU:" + argText; 500 } 501 502 if (type == 1 || type == 13) // delete CS Page 503 { 504 var isNotNumeric = isNaN(argText); 505 if(! isNotNumeric) 506 { 507 argText = "CP___PAGEID_" + argText; 508 attrib = 'class'; 509 } 510 } 511 512 if( action != 'clear' ) // For select or count, clear the selections 513 { 514 //Reset all... OPTIMIZE this by storing dom id's 515 if( typeof aDivs != 'undefined' && aDivs.length > 0 ) 516 { 517 for ( i=0; i < aDivs.length; i++) 518 { 519 if ( aDivs[i].style ) 520 cs$(aDivs[i]).css({background : ''}); 521 } 522 } 523 524 if( typeof iDivs != 'undefined' && iDivs.length > 0 ) 525 { 526 for ( i=0; i < iDivs.length; i++) 527 { 528 if ( iDivs[i].style ) 529 iDivs[i].style.border=''; 530 } 531 } 532 } 533 534 if (imageType == 1) 535 { 536 aDivs = iDivs; 537 attrib = 'src'; 538 } 539 540 var selectCount = 0; 541 var linkFound = 0; 542 var thisHREF = ''; 543 544 if( typeof aDivs != 'undefined' && aDivs.length > 0 ) 545 { 546 for ( i=0; i < aDivs.length; i++ ) 547 { 548 thisHREF = aDivs[i].getAttribute(attrib); 549 /*console.log(aDivs[i]); 550 alert(argText);alert(thisHREF); 551 alert(argText.indexOf(thisHREF));*/ 552 if ((thisHREF != null) 553 && (thisHREF != 'javascript:;') 554 && ((thisHREF.search('^'+argText) > -1) 555 || (thisHREF.search('@'+argText) > -1) 556 || ((argText.indexOf(thisHREF) >= 0) && (thisHREF.slice(-1) != '/')) 557 || (thisHREF.indexOf(argText) == 0 && thisHREF.length == argText.length))) 558 { 559 if( action == 'check' ) // action = check, so we just need to see if we found it in dom or not and return 560 { 561 linkFound = 1; 562 break; 563 } 564 else if( action == 'count' ) // action = count, we need to get count 565 { 566 selectCount++; 567 } 568 else // action = select, we need to select the link here 569 { 570 var editBig = 0; 571 for ( x=0; x < aDivs[i].attributes.length; x++ ) 572 { 573 if (aDivs[i].attributes[x].value.search('edit-big') != -1) 574 { 575 editBig = 1; 576 break; 577 } 578 } 579 580 if (editBig == 0) 581 { 582 if (imageType == 0) 583 { 584 cs$(aDivs[i]).css({'background-color':'yellow','color':'black'});
585 } 586 else 587 { 588 cs$(aDivs[i]).css({border :'double yellow'}); 589 } 590 591 selectCount++; 592 } 593 else 594 { 595 x = i - 1; 596 if (x > -1) 597 { 598 cs$(aDivs[x]).css({'background-color':'yellow'}); 599 selectCount++; 600 } 601 } 602 603 //Scroll to the first item found 604 if (selectCount >= 1) 605 { 606 aDivs[i].scrollIntoView(false); 607 win_obj.scrollBy(-2000,0); 608 } 609 else 610 { 611 if (imageType == 0) 612 alert( 'Could not locate the link.\n\nThe link may not be visible due to scheduling or the containing element is no longer rendered.' ); 613 else 614 alert( 'Could not locate the image.\n\nThe image may not be visible due to scheduling or the containing element is no longer rendered.' ); 615 } 616 } 617 } 618 } 619 } 620 621 // If action is check then return the linkFound variable, if action si count, then return selectCount variable else do actions for select 622 if( action == 'check' ) 623 return linkFound; 624 else if( action == 'count' ) 625 return selectCount; 626 else 627 { 628 if(!window.parent.Dashboard) 629 win_obj.focus(); 630 else 631 CloseWindow(); 632 } 633}
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.