/* JavaScript routines to resolve references for windows inside lightbox */ getOpener = function(ignoreOpenerProperty) { if ((self != top) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) { var win = top.commonspot.lightbox.getOpenerWindow(ignoreOpenerProperty); if (win) return win; else { if (top.commonspot.lightbox.stack.length <= 1) return top; } } else { return self.opener; } }; getOpenerWithIFrame = function(iFrameID) { var wnd = getOpener(); var obj = wnd.document.getElementById(iFrameID); if (obj) { return obj.contentWindow; } return getOpener(); }; getWindowWithFrame = function (FrameName) { var stackLen = 0; var wn = null; if ((self != top) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) stackLen = top.commonspot.lightbox.stack.length; for (var i=stackLen-1; i>=0; i--) { wn = top.commonspot.lightbox.stack[i].getWindow(); if (wn) { try { if (typeof wn.frames[FrameName] != 'undefined') return wn.frames[FrameName].window }catch(e){} } } return wn; }; getRTEopener = function (FrameName) { alert('use getRTEObject instead.'); }; getRTEObject = function(FrameName, checkFrames, closeHigherWindows) { // Grab the window object out of the RTE's iframe checkFrames = (typeof checkFrames == 'undefined') ? true : checkFrames; FrameName = (typeof FrameName == 'undefined') ? 'WebEdit' : FrameName; var fr = null; var wn = null; var rteObj = null; var stackLen = 0; var fWn = null; if ((self != top) && (typeof(top.commonspot)!= 'undefined') && (typeof(top.commonspot.lightbox)!= 'undefined')) stackLen = top.commonspot.lightbox.stack.length; for (var i=stackLen-1; i>=0; i--) { wn = top.commonspot.lightbox.stack[i].getWindow(); if (wn) { if (checkFrames) { for (j=0; j=0; i--) { win = top.commonspot.lightbox.stack[i]; frName = win.getFrameName(); if (frameNameList.indexOf(frName) >= 0) win.close(); } } }; closeCleanHTMLWindows = function() { closeEmptyChildDialogs('cleanHTML'); /* if (self.children) { for(i=0;i"; html += ""; } } html = html.replace(/\n/g, '
'); top.commonspot.dialog.client.showHTMLDialog(html, options, 'alert'); }; /* * create a lightboxed dlg containing the passed html */ top.commonspot.dialog.client.showHTMLDialog = function(html, options, dialogType) { options = options || {}; var defaultOptions = { title: "CommonSpot Message", subtitle: "", helpId: "", width: 500, height: 600, style: '', useDefaultStyles: true, maximize: false, hideClose: false, hideHelp: true, hideReload: true }; top.commonspot.util.merge(options, defaultOptions); dialogType = dialogType || 'dialog'; var style = options.style; if(options.useDefaultStyles) style = top.commonspot.dialog.client.getHTMLDialogDefaultStyles() + style; html = top.commonspot.dialog.client.getHTMLDialogHTML(html, style, options.title, options); // openDialog(url, hideClose, name, customOverlayMsg, dialogType, opener, hideHelp) var dlgObj = top.commonspot.lightbox.openDialog("about:blank", options.hideClose, null, top.commonspot.lightbox.NO_OVERLAY_MSG, dialogType, null, options.hideClose, options.hideReload); var lightboxWindow = dlgObj.getWindow(); lightboxWindow.document.write(html); lightboxWindow.document.close(); top.commonspot.lightbox.initCurrent ( options.width, options.height, { title: options.title, subtitle: options.subtitle, helpId: options.helpId, close: options.close, reload: options.reload, maximize: options.maximize }, '', true ); var dt = lightboxWindow.document.getElementById("dialogContainer"); var w = Math.max(dt.clientWidth + 30, 350); var h = Math.max(dt.clientHeight, 70) - ((options.hideClose && !options.customButtons) ? 30 : 0); top.commonspot.lightbox.resizeCurrent(w, h); // first wanted this to autosize, to measure it, but now want it full width so close btn is far right lightboxWindow.document.getElementById("dialogContainer").style.width = "100%"; }; top.commonspot.dialog.client.getHTMLDialogDefaultStyles = function() { var style = 'body {font-family: Verdana,Arial,Helvetica,sans-serif; margin: 0; overflow: scroll; text-decoration: none; font-size: 11px;}\n\ a:active {text-decoration: underline; color: #1D2661;}\n\ a:hover {text-decoration: underline;color: #003366;}\n\ a {color: #1D2661;text-decoration: underline;}\n\ a:visited { text-decoration: underline;color: #1D2661;}\n\ #content {margin: 15px 11px; overflow: auto; font-size: 11px;}\n\ #innerdialogContainer {background-color:#F0F0F0;border-bottom:1px solid #999999;border-top:1px solid #999999;margin-top:10px;}\n\ #htmlDlgTableCell h2 {font-size: 11px; margin: 15px 0 8px;}\n\ #htmlDlgTableCell h2:first-child {margin-top: 0;}\n\ #htmlDlgTableCell p {margin: 0 0 8px; padding: 0;}\n\ #htmlDlgTableCell ul {margin: 0 0 1em 1em; padding: 0;}\n\ #htmlDlgTableCell li {margin: 5px;}\n\ #htmlDlgTableCell dl {margin: 0 0 1em;}\n\ #htmlDlgTableCell dt {color: #013466; font-weight: bold; margin: 5px 0 0;}\n\ #htmlDlgTableCell dd {margin: 0 0 0 1.5em;}\n\ #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\ #htmlDlgTableCell .dumpTable caption {font-size: 8pt; font-weight: bold;}\n\ #htmlDlgTableCell .dumpTable td {border: 1px solid #ccc; font-size: 8pt; padding: 1px;}\n\ '; return style; }; top.commonspot.dialog.client.getHTMLDialogHTML = function(alertHTML, styleHTML, title, options) { var btnHTML = ''; var linkID, linkClass, linkOnClick, linkObj, linkAccessKey, linkText; var accessKeyHTML = ''; btnHTML += options.hideClose ? '' : 'Close'; if (options.customButtons) { for (var i=0; i' + linkText + ''; } } var html = '' + '' + '' + '' + '' + (title ? '' + title + '' : '') + '' + '' + '' + '' + '' + '
' + '' + '' + '' + '' + '
' + '
' + alertHTML + '
' + '
' + '
' + '
' + btnHTML + '
' + '
' + '' + ''; return html; }; } } function checkOrSelectLinkVisibleInDOMFromRowData(row, action) { return checkOrSelectLinkVisibleInDOMFromLinkData(row.linktype, row.url, row.linktargetid, action); } function checkOrSelectLinkVisibleInDOMFromLinkData(linkType, URL, linkTargetID, action) { if( parent.window.Dashboard ) { var win_obj = parent.window.Lview.frame.dom().contentWindow; var doc_obj = win_obj.document; } else { var win_obj = getOpener(); var doc_obj = win_obj.document; } var argText = ''; var type = linkType; if (URL == '' || type == 10) { argText = linkTargetID; argText = argText.toString(); } else { argText = URL; var argArray = argText.split(':'); if( argArray.length == 2 && argArray[1].trim() == linkTargetID ) { argText = linkTargetID; argText = argText.toString(); } } var imageType = 0; var attrib = 'href'; if (type == 1 || type == 2 || type == 7 || type == 8 || type == 9 || type == 4 || type == 5 || type == 6 || type == 10 || type == 13) { var aDivs = doc_obj.getElementsByTagName("A"); var iDivs = doc_obj.getElementsByTagName("IMG"); } if (type == 4 || type == 5 || type == 6) imageType = 1; if (type == 10) // Popup menu { argText = "CP_MENU:" + argText; } if (type == 1 || type == 13) // delete CS Page { var isNotNumeric = isNaN(argText); if(! isNotNumeric) { argText = "CP___PAGEID_" + argText; attrib = 'class'; } } if( action != 'clear' ) // For select or count, clear the selections { //Reset all... OPTIMIZE this by storing dom id's if( typeof aDivs != 'undefined' && aDivs.length > 0 ) { for ( i=0; i < aDivs.length; i++) { if ( aDivs[i].style ) cs$(aDivs[i]).css({background : ''}); } } if( typeof iDivs != 'undefined' && iDivs.length > 0 ) { for ( i=0; i < iDivs.length; i++) { if ( iDivs[i].style ) iDivs[i].style.border=''; } } } if (imageType == 1) { aDivs = iDivs; attrib = 'src'; } var selectCount = 0; var linkFound = 0; var thisHREF = ''; if( typeof aDivs != 'undefined' && aDivs.length > 0 ) { for ( i=0; i < aDivs.length; i++ ) { thisHREF = aDivs[i].getAttribute(attrib); /*console.log(aDivs[i]); alert(argText);alert(thisHREF); alert(argText.indexOf(thisHREF));*/ if ((thisHREF != null) && (thisHREF != 'javascript:;') && ((thisHREF.search('^'+argText) > -1) || (thisHREF.search('@'+argText) > -1) || ((argText.indexOf(thisHREF) >= 0) && (thisHREF.slice(-1) != '/')) || (thisHREF.indexOf(argText) == 0 && thisHREF.length == argText.length))) { if( action == 'check' ) // action = check, so we just need to see if we found it in dom or not and return { linkFound = 1; break; } else if( action == 'count' ) // action = count, we need to get count { selectCount++; } else // action = select, we need to select the link here { var editBig = 0; for ( x=0; x < aDivs[i].attributes.length; x++ ) { if (aDivs[i].attributes[x].value.search('edit-big') != -1) { editBig = 1; break; } } if (editBig == 0) { if (imageType == 0) { cs$(aDivs[i]).css({'background-color':'yellow','color':'black'}); } else { cs$(aDivs[i]).css({border :'double yellow'}); } selectCount++; } else { x = i - 1; if (x > -1) { cs$(aDivs[x]).css({'background-color':'yellow'}); selectCount++; } } //Scroll to the first item found if (selectCount >= 1) { aDivs[i].scrollIntoView(false); win_obj.scrollBy(-2000,0); } else { if (imageType == 0) alert( 'Could not locate the link.\n\nThe link may not be visible due to scheduling or the containing element is no longer rendered.' ); else alert( 'Could not locate the image.\n\nThe image may not be visible due to scheduling or the containing element is no longer rendered.' ); } } } } } // If action is check then return the linkFound variable, if action si count, then return selectCount variable else do actions for select if( action == 'check' ) return linkFound; else if( action == 'count' ) return selectCount; else { if(!window.parent.Dashboard) win_obj.focus(); else CloseWindow(); } }