var lightBoxVersion = "2.0";
var ahLightbox;
function toolTip(id) {
AUI().ready(
'aui-tooltip',
'aui-io-plugin',
'aui-datatype',
function(A) {
var boxes = A.all('.component-boundary-acn');
if (boxes.size() === 0) {
boxes = A.all('.portlet-boundary');
}
if (boxes.size() > 0) {
boxes.each(function(box) {
var toolTipItem = box.one('#' + id);
if (A.DataType.Boolean.parse(toolTipItem)) {
var ttX = toolTipItem.getX()
+ toolTipItem.get('offsetWidth');
var ttY = toolTipItem.getY()
+ toolTipItem.get('offsetHeight');
var boxX = box.getX() + box.get('offsetWidth');
var boxY = box.getY() + box.get('offsetHeight');
boxY = (boxY * 4) / 5;
boxX = (boxX * 4) / 5;
var tt = null;
var wgt = null;
if (ttY > boxY) {
tt = 'b';
wgt = 'b';
} else if (ttY < boxY) {
tt = 't';
wgt = 't';
} else {
tt = 't';
wgt = 't';
}
if (ttX > boxX) {
tt = tt + 'r';
wgt = wgt + 'l';
} else if (ttX < boxX) {
tt = tt + 'l';
wgt = wgt + 'r';
} else {
tt = tt + 'c';
wgt = wgt + 'c';
}
var tooltip = new A.Tooltip({
trigger : '#' + id,
align : {
points : [ tt, wgt ]
},
hideOnDocumentClick : false,
destroy: {destroyAllNodes: true},
hideAll:true,
constrain: true,
destroyed: true,
zIndex : 2006,
cancelHideOnInteraction: false,
alignOn: [{ node : A.one('window'), eventName: 'resize'}],
bodyContent : document.getElementById(id
+ "hidden").innerHTML
}).render();
var boundingBox = tooltip.get('boundingBox');
A.on('mouseleave', function(event) {
boundingBox.setStyle('opacity', 0);
boundingBox.setStyle('top', '-100px');
boundingBox.setStyle('left', '-100px');
}, '.aui-tooltip .aui-state-default');
}
});
}
});
}
function toolTip(id, linkPosition, tooltipPosition) {
AUI()
.ready(
'aui-tooltip',
'aui-io-plugin',
'aui-datatype',
'event',
'event-move',
'event-touch',
function(A) {
var boxes = A.all('.component-boundary-acn');
if (boxes.size() === 0) {
boxes = A.all('.portlet-boundary');
}
if(window.ahlightboxTooltip){
boxes = A.all('.aui-ah-lightbox');
}
if (boxes.size() > 0) {
boxes
.each(function(box) {
var toolTipItem = box.one('#' + id);
if (A.DataType.Boolean
.parse(toolTipItem)) {
var tt = linkPosition;
var wgt = tooltipPosition;
if (linkPosition == ""
|| tooltipPosition == "") {
var ttX = toolTipItem.getX()
+ toolTipItem
.get('offsetWidth');
var ttY = toolTipItem.getY()
+ toolTipItem
.get('offsetHeight');
var boxX = box.getX()
+ box
.get('offsetWidth');
var boxY = box.getY()
+ box
.get('offsetHeight');
boxY = (boxY * 4) / 5;
boxX = (boxX * 4) / 5;
if (ttY > boxY) {
tt = 'b';
wgt = 'b';
} else if (ttY < boxY) {
tt = 't';
wgt = 't';
} else {
tt = 't';
wgt = 't';
}
if (ttX > boxX) {
tt = tt + 'r';
wgt = wgt + 'l';
} else if (ttX < boxX) {
tt = tt + 'l';
wgt = wgt + 'r';
} else {
tt = tt + 'c';
wgt = wgt + 'c';
}
}
var tooltip = new A.Tooltip(
{
trigger : '#' + id,
align : {
points : [ tt, wgt ]
},
hideOnDocumentClick : true,
destroy: {destroyAllNodes: true},
hideAll:true,
constrain: true,
destroyed: true,
zIndex : 2006,
cancelHideOnInteraction: false,
alignOn: [{ node : A.one('window'), eventName: 'resize'}],
bodyContent : document
.getElementById(id
+ "hidden").innerHTML
});
tooltip.set('alignOn', [
{
node : A.one('window'),
eventName: 'resize'
}
]);
/* For device when you click somewhere on the page the to hide tooltip */
if(A.one('#' + id)) {
A.one('#' + id).on(['touchend','click','mouseover'], function(event) {
tooltip.render();
tooltip.on("mouseleave", function(e) {
setTimeout(function(){
A.OverlayContextPanelManager.hideAll();
}, 100);
});
// PBPI-2925 add tooltip overlay for devices---Started
if(Modernizr.touch){
tooltip.after("render", function(e) {
A.later(500, window, function(){
if(!A.one('.ah-tooltip-overlay')){
obj = A.Node.create('
');
A.one('body').append(obj);
};
A.on(['scroll','touchend','click'], function(e) {
if(A.one('.ah-tooltip-overlay') && !A.one('.ah-tooltip-overlay').hasClass('.aui-helper-hidden')){
A.one('.ah-tooltip-overlay').remove();
A.OverlayContextPanelManager.hideAll();
}
},'.ah-tooltip-overlay');
}, [], false);
});
};
});
};
// PBPI-2925 add tooltip overlay for devices--End
/* PBPI-2382 - Hide Tooltip under Lightbox with touch OR scroll events */
if(A.one('.aui-ah-lightbox')){
A.all('.aui-ah-lightbox,.aui-overlay').on(['scroll','touchmove','touchend','click'], function() {
A.OverlayContextPanelManager.hideAll();
});
}
var isDevice = navigator.userAgent
.match(/(iPhone)|(iPod)|(iPad)/i);
if (isDevice) {
/*
* For iOS when you click
* somewhere on the page the
* mouseout will be fired.
*/
A.one('html').on('click', function() {
return true;
});
A.all('#main-content').on('click', function() {
return true;
});
}
var boundingBox = tooltip
.get('boundingBox');
A
.on(
'mouseleave',
function(event) {
boundingBox
.setStyle(
'opacity',
0);
boundingBox
.setStyle(
'top',
'-1000px');
boundingBox
.setStyle(
'left',
'-1000px');
},
'.aui-tooltip .aui-state-default');
}
});
}
});
}
//PBPI-1498:to support width attribute in tooltip tag
function toolTip(id, linkPosition, tooltipPosition,width) {
AUI()
.ready(
'aui-tooltip',
'aui-io-plugin',
'aui-datatype',
'event',
'event-move',
'event-touch',
function(A) {
var boxes = A.all('.component-boundary-acn');
if (boxes.size() === 0) {
boxes = A.all('.portlet-boundary');
}
if(window.ahlightboxTooltip){
boxes = A.all('.aui-ah-lightbox');
}
if (boxes.size() > 0) {
boxes
.each(function(box) {
var toolTipItem = box.one('#' + id);
if (A.DataType.Boolean
.parse(toolTipItem)) {
var tt = linkPosition;
var wgt = tooltipPosition;
if (linkPosition == ""
|| tooltipPosition == "") {
var ttX = toolTipItem.getX()
+ toolTipItem
.get('offsetWidth');
var ttY = toolTipItem.getY()
+ toolTipItem
.get('offsetHeight');
var boxX = box.getX()
+ box
.get('offsetWidth');
var boxY = box.getY()
+ box
.get('offsetHeight');
boxY = (boxY * 4) / 5;
boxX = (boxX * 4) / 5;
if (ttY > boxY) {
tt = 'b';
wgt = 'b';
} else if (ttY < boxY) {
tt = 't';
wgt = 't';
} else {
tt = 't';
wgt = 't';
}
if (ttX > boxX) {
tt = tt + 'r';
wgt = wgt + 'l';
} else if (ttX < boxX) {
tt = tt + 'l';
wgt = wgt + 'r';
} else {
tt = tt + 'c';
wgt = wgt + 'c';
}
}
var tooltip = new A.Tooltip(
{
trigger : '#' + id,
align : {
points : [ tt, wgt ]
},
hideOnDocumentClick : true,
destroy: {destroyAllNodes: true},
hideAll:true,
constrain: true,
destroyed: true,
cancelHideOnInteraction: false,
zIndex : 2006,
showDelay: 500, // PBPI-1511 (0.5 delay)
alignOn: [{ node : A.one('window'), eventName: 'resize'}],
width:width,
bodyContent : document
.getElementById(id
+ "hidden").innerHTML
});
// PBPI-1511 (0.5 delay) - start
A.all('#' + id).on('mouseover', function(){
tooltip.enable();
});
A.all('#' + id).on('mouseleave', function(){
tooltip.disable();
});
// PBPI-1511 (0.5 delay) - end
tooltip.set('alignOn', [
{
node : A.one('window'),
eventName: 'resize'
}
]);
/* For device when you click somewhere on the page the to hide tooltip */
if(A.one('#' + id)) {
A.one('#' + id).on(['touchend','click','mouseover'], function(event) {
tooltip.render();
tooltip.on("mouseleave", function(e) {
setTimeout(function(){
A.OverlayContextPanelManager.hideAll();
}, 100);
});
// PBPI-2925 add tooltip overlay for devices--started
if(Modernizr.touch){
tooltip.after("render", function(e) {
A.later(500, window, function(){
if(!A.one('.ah-tooltip-overlay')){
obj = A.Node.create('');
A.one('body').append(obj);
};
A.on(['scroll','touchend','click'], function(e) {
if(A.one('.ah-tooltip-overlay') && !A.one('.ah-tooltip-overlay').hasClass('.aui-helper-hidden')){
A.one('.ah-tooltip-overlay').remove();
A.OverlayContextPanelManager.hideAll();
}
},'.ah-tooltip-overlay');
}, [], false);
});
};
});
};
// PBPI-2925 add tooltip overlay for devices--End
/* PBPI-2382 - Hide Tooltip under Lightbox with touch OR scroll events */
if(A.one('.aui-ah-lightbox')){
A.all('.aui-ah-lightbox,.aui-overlay').on(['scroll','touchmove','touchend','click'], function() {
A.OverlayContextPanelManager.hideAll();
});
}
var isDevice = navigator.userAgent
.match(/(iPhone)|(iPod)|(iPad)/i);
if (isDevice) {
/*
* For iOS when you click
* somewhere on the page the
* mouseout will be fired.
*/
A.one('html').on('click', function() {
return true;
});
A.all('#main-content').on('click', function() {
return true;
});
}
var boundingBox = tooltip
.get('boundingBox');
A
.on(
'mouseleave',
function(event) {
boundingBox
.setStyle(
'opacity',
0);
boundingBox
.setStyle(
'top',
'-1000px');
boundingBox
.setStyle(
'left',
'-1000px');
},
'.aui-tooltip .aui-state-default');
}
});
}
});
}
/* START :: PFO-14314 : Fix Accessibility and Typography changes for Tooltip and Popover */
function toolTip(id, linkPosition, tooltipPosition,width,cssClass) {
AUI()
.ready(
'aui-tooltip',
'aui-io-plugin',
'aui-datatype',
'event',
'event-move',
'event-touch',
function(A) {
var boxes = A.all('.component-boundary-acn');
if (boxes.size() === 0) {
boxes = A.all('.portlet-boundary');
}
if(window.ahlightboxTooltip){
boxes = A.all('.aui-ah-lightbox');
}
if (boxes.size() > 0) {
boxes
.each(function(box) {
var toolTipItem = box.one('#' + id);
if (A.DataType.Boolean
.parse(toolTipItem)) {
var tt = linkPosition;
var wgt = tooltipPosition;
if (linkPosition == ""
|| tooltipPosition == "") {
var ttX = toolTipItem.getX()
+ toolTipItem
.get('offsetWidth');
var ttY = toolTipItem.getY()
+ toolTipItem
.get('offsetHeight');
var boxX = box.getX()
+ box
.get('offsetWidth');
var boxY = box.getY()
+ box
.get('offsetHeight');
boxY = (boxY * 4) / 5;
boxX = (boxX * 4) / 5;
if (ttY > boxY) {
tt = 'b';
wgt = 'b';
} else if (ttY < boxY) {
tt = 't';
wgt = 't';
} else {
tt = 't';
wgt = 't';
}
if (ttX > boxX) {
tt = tt + 'r';
wgt = wgt + 'l';
} else if (ttX < boxX) {
tt = tt + 'l';
wgt = wgt + 'r';
} else {
tt = tt + 'c';
wgt = wgt + 'c';
}
}
var tooltip = new A.Tooltip(
{
trigger : '#' + id,
align : {
points : [ tt, wgt ]
},
hideOnDocumentClick : true,
destroy: {destroyAllNodes: true},
hideAll:true,
constrain: true,
destroyed: true,
cancelHideOnInteraction: false,
zIndex : 2006,
showDelay: 500, // PBPI-1511 (0.5 delay)
alignOn: [{ node : A.one('window'), eventName: 'resize'}],
width:width,
bodyContent : document
.getElementById(id
+ "hidden").innerHTML,
cssClass : cssClass
});
// PBPI-1511 (0.5 delay) - start
A.all('#' + id).on('mouseover', function(){
tooltip.enable();
});
A.all('#' + id).on('mouseleave', function(){
tooltip.disable();
});
// PBPI-1511 (0.5 delay) - end
/*
* START : PFO-14314
* Fix accessibility gaps for Tooltip and Popover
*/
A.all('#'+id).setAttribute('tabindex', '0').setAttribute('aria-describedby', tooltip.get('boundingBox').getAttribute('id'));
//A.all('#'+id+'hidden').setAttribute('class', 'visuallyhidden').removeAttribute('style')
//if(A.all('#'+id+'hidden a')) {
// A.all('#'+id+'hidden a').setAttribute('tabindex', '-1');
//}
/* Fix for PBPI-4313 : Accessibiltiy Plus - Focus not moved to tooltip content :: Starts */
var curElement = "";
var setTooltipContentFocusSequence = function() {
if(tooltip.get('contentBox').getAttribute('id')){
var tipContentboxId = '#'+tooltip.get('contentBox').getAttribute('id');
A.one(tipContentboxId).setAttribute('tabindex', '0');
setTimeout( function(){
A.one(tipContentboxId).focus();
A.one(tipContentboxId).setStyle('outline', 'none');
}, 0);
if(A.one('.aui-overlay-content')) {
A.one('.aui-overlay-content').append('');
}
if(A.one('.ah-tooltip-hidden-endLink')) {
A.one('.ah-tooltip-hidden-endLink').on('focus', function(node){
A.OverlayContextPanelManager.hideAll();
setTimeout( function(){
A.one('#'+id).focus();
}, 200);
});
}
}
};
// Show Tooltip on Keypress
A.all('#' + id).on('key', function(e) {
var tipBoundingboxId = '#'+tooltip.get('boundingBox').getAttribute('id');
if(e.target) {
curElement = e.target;
}
if(tipBoundingboxId){
if(A.all(tipBoundingboxId).hasClass('aui-tooltip-hidden')) {
// Show if Hidden
this.simulate('mouseover');
// Set focus sequence on tooltip content box overlay
setTooltipContentFocusSequence();
} else {
// Hide if visible
A.OverlayContextPanelManager.hideAll();
}
}
}, 'down:13'); // Enter Keycode: 13
// Hide Tooltip on Escape Key Press
A.one("document").on('keydown', function(e) {
if ( e.keyCode === 27 ) {
A.OverlayContextPanelManager.hideAll();
setTimeout( function(){
if(curElement != ""){
A.one(curElement).focus();
}
}, 200);
} else {
if(e.shiftKey && e.keyCode === 9) {
if(e._currentTarget) {
curElement = e._currentTarget;
}
}
}
});
/* Fix for PBPI-4313 : Accessibiltiy Plus - Focus not moved to tooltip content :: Ends */
// Show Tooltip on Focus
/*
A.one('#' + id).on('focus', function(e) {
A.OverlayContextPanelManager.hideAll();
this.simulate('mouseover');
});
*/
// Hide Tooltip on Escape or Tab key press
/*
A.all('#' + id).on('key', function(e) {
A.OverlayContextPanelManager.hideAll();
}, 'down:27,9'); // Escape Keycode: 27, Tab Keycode : 9
*/
/*
* END : PFO-14314
* Fix accessibility gaps for Tooltip and Popover
*/
tooltip.set('alignOn', [
{
node : A.one('window'),
eventName: 'resize'
}
]);
/* For device when you click somewhere on the page the to hide tooltip */
if(A.one('#' + id)) {
A.one('#' + id).on(['touchend','click','mouseover'], function(event) {
tooltip.render();
A.one(tooltip.get('boundingBox')).setAttribute('role','tooltip'); // PFO-14314 : Changed role="dialog" to role="tooltip"
A.one(tooltip.get('boundingBox')).setAttribute('data-trigger','hover'); //DLC-123
tooltip.on("mouseleave", function(e) {
setTimeout(function(){
A.OverlayContextPanelManager.hideAll();
}, 100);
});
// PBPI-2925 add tooltip overlay for devices--started
if(Modernizr.touch){
tooltip.after("render", function(e) {
A.later(500, window, function(){
if(!A.one('.ah-tooltip-overlay')){
obj = A.Node.create('');
A.one('body').append(obj);
};
A.on(['scroll','touchend','click'], function(e) {
if(A.one('.ah-tooltip-overlay') && !A.one('.ah-tooltip-overlay').hasClass('.aui-helper-hidden')){
A.one('.ah-tooltip-overlay').remove();
A.OverlayContextPanelManager.hideAll();
}
},'.ah-tooltip-overlay');
}, [], false);
});
};
});
};
// PBPI-2925 add tooltip overlay for devices--End
/* PBPI-2382 - Hide Tooltip under Lightbox with touch OR scroll events */
if(A.one('.aui-ah-lightbox')){
A.all('.aui-ah-lightbox,.aui-overlay').on(['scroll','touchmove','touchend','click'], function() {
A.OverlayContextPanelManager.hideAll();
});
}
var isDevice = navigator.userAgent
.match(/(iPhone)|(iPod)|(iPad)/i);
if (isDevice) {
/*
* For iOS when you click
* somewhere on the page the
* mouseout will be fired.
*/
A.one('html').on('click', function() {
return true;
});
A.all('#main-content').on('click', function() {
return true;
});
}
var boundingBox = tooltip
.get('boundingBox');
A
.on(
'mouseleave',
function(event) {
boundingBox
.setStyle(
'opacity',
0);
boundingBox
.setStyle(
'top',
'-1000px');
boundingBox
.setStyle(
'left',
'-1000px');
},
'.aui-tooltip .aui-state-default');
}
});
}
});
}
/* END :: PFO-14314 : Fix Accessibility and Typography changes for Tooltip and Popover */
var feedbackresourceURL;
AUI().use('liferay-portlet-url', function(A){
feedbackresourceURL = Liferay.PortletURL.createResourceURL();
var portletId = 'viewfeedbackportlet_WAR_ahcommunityportlet';
feedbackresourceURL.setPortletId(portletId);
feedbackresourceURL.setPlid(themeDisplay.getPlid());
});
function feedback(target) {
AUI()
.use(
'aui-io-request',
'liferay-portlet-url',
function(A) {
var qryParams = '&pageName=' + feedbackViewPage
+ '&Version=' + feedbackVersion + '&uuid='
+ target + '&groupId='
+ themeDisplay.getScopeGroupId()
+ '&languageId=' + themeDisplay.getLanguageId()
+ '&time1=' + new Date().getTime() + '&time2='
+ new Date().getTime() + '&height='
+ window.screen.height + '&width='
+ window.screen.width + '&prev='
+ escape(window.document.referrer);
var exceptionURL = "http://ccc01.opinionlab.com/comment_card.asp?"
+ "referer=http://test.hewitt.hro//Portal/19941/unknown/other/en_US/Base Theme"
+ qryParams;
var urlS = feedbackresourceURL + qryParams;
A.io
.request(
urlS,
{
cache : true,
sync : true,
dataType : 'json',
timeout : 1000,
method : 'get',
on : {
success : function(data) {
try {
window
.open(
this
.get('responseData').feedbackURL,
'feedbackWindow',
'width=500, height=300, left=400, top=200, menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
} catch (e) {
window
.open(
exceptionURL,
'feedbackWindow',
'height=300,width=500,toolbar=no,location=no,menubar=no,status=no,resizable=yes,scrollbars=auto');
}
},
failure : function() {
}
}
});
});
}
//PBPI-3103 PCA 2741 - Global Lightbox print issue.
function printLgtBx(id) {
AUI().use('node', function(A){
var lightbox=A.one('#' + id + '_ahLightbox .aui-ah-lightbox-bd'),
lightbox_content=lightbox.html();
if(!A.one('html').hasClass('no-touch')){
var beforePrint = function() {
A.all('#main-content').addClass('ah-print-no');
A.one('.aui-ah-lightbox').addClass('ah-print-no');
A.one('.ah-lightbox-overlaymask').addClass('ah-print-no');
lightBoxPrintObj = A.Node.create(''+lightbox_content+'
');
A.one('body').append(lightBoxPrintObj);
};
var afterPrint = function() {
A.all('#main-content').removeClass('ah-print-no');
A.one('.aui-ah-lightbox').removeClass('ah-print-no');
A.one('.ah-lightbox-overlaymask').removeClass('ah-print-no');
A.one('.ah-print-light-box').remove();
lightbox_content = '';
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
window.print();
}else{
A.all('#main-content').addClass('ah-print-no');
A.one('.aui-ah-lightbox').addClass('ah-print-no');
A.one('.ah-lightbox-overlaymask').addClass('ah-print-no');
lightBoxPrintObj = A.Node.create(''+lightbox_content+'
');
A.one('body').append(lightBoxPrintObj);
window.print();
A.all('#main-content').removeClass('ah-print-no');
A.one('.aui-ah-lightbox').removeClass('ah-print-no');
A.one('.ah-lightbox-overlaymask').removeClass('ah-print-no');
A.one('.ah-print-light-box').remove();
lightbox_content = '';
}
});
}
function printLghtBxIframe(instance) {
var divObj = document.getElementById(ahLightbox.get('id'));
var elIFrame = divObj.getElementsByTagName("iframe")[0];
var docObj = elIFrame.contentDocument || elIFrame.contentWindow.document;
var printed = false;
try {
printed = docObj.execCommand('print', false, null);
} catch (e) {
}
if (!printed) {
var elIFrameWin;
if (elIFrame.contentWindow) {
elIFrameWin = elIFrame.contentWindow;
} else if (elIFrame.contentDocument) {
elIFrameWin = elIFrame.contentDocument.defaultView;
}
elIFrameWin.print();
}
}
function printLgtBxURI(uri) {
var disp_setting = "toolbar=no,location=no,directories=yes,menubar=no,width=900, height=700, left=-100, top=25,scrollbars=yes";
var docprint = window.open(uri, '', disp_setting);
if (AUI().UA.webkit) {
docprint.print();
// PBPI-2633
// docprint.close();
}
else if(AUI().UA.ie){
docprint.print();
}
else {
docprint.onload = function() {
docprint.print();
docprint.close();
}
}
}
function printLightBx(id, print, uri, iframe) {
if (print == 'true' && (uri == 'null' || uri == '')) {
printLgtBx(id);
} else if (print == 'true' && (uri != 'null' || uri != '')) {
if (iframe != 'true') {
////PBPI-3103 PCA 2741 - Global Lightbox print issue.
// Call id function only, it will work for URI scenario also
//printLgtBxURI(uri);
printLgtBx(id);
} else {
printLghtBxIframe(id);
}
}
}
function showLightbox(uri, id, title, height, width, target, print, iframe,
copyRightText, fdBck, prnt, auiButtonText, isCpyRigthText, showHeader) {
var loadingText="";
showLightbox(uri, id, title, height, width, target, print, iframe,
copyRightText, fdBck, prnt, auiButtonText, isCpyRigthText, showHeader,loadingText);
}
function showLightbox(uri, id, title, height, width, target, print, iframe,
copyRightText, fdBck, prnt, auiButtonText, isCpyRigthText, showHeader, loadingText) {
try{
var alightSecureSessionToken;
if(domStorgeFallbackFn && typeof domStorgeFallbackFn.getItem === 'function'){
alightSecureSessionToken = domStorgeFallbackFn.getItem("alightSecureSessionToken") || domStorgeFallbackFn.getItem("alightPersonSessionToken");
}
if(alightSecureSessionToken != null || alightSecureSessionToken != undefined){
if(uri.includes("video?videoId")){
try{
var url = Liferay.PortletURL.createRenderURL();
url.setPortletId('Video_WAR_ahcontentportlet_INSTANCE_'.concat(new Date().getTime()));
url.setWindowState('exclusive');
url = url.toString();
uri = url+'&'+uri.substring(uri.indexOf('?')+1,uri.length);
}catch(err){}
}
}
}catch(e){}
var footerbuttons = [];
var headerDisplay = true;
var isPrintVisible = (print.toLowerCase() == 'true' ? true : false);
var isFeedBackVisible = (target == "" ? false : true);
var QualtricsFeedbackEnabled = true;
var cpyRghtTxt = copyRightText;
if (isCpyRigthText != 'true') {
cpyRghtTxt = '';
}
if (showHeader == undefined || showHeader == 'false') {
headerDisplay = false;
}
if ((auiButtonText != undefined) && !(auiButtonText == 'null')
&& !(auiButtonText == '')) {
var buttArr = auiButtonText.split("@");
for ( var i = 0; i < buttArr.length; i++) {
var splitArr = buttArr[i].split('#');
var funHandler = new Function(splitArr[1]);
var evnt = {
click : funHandler
};
var buttTitle = '';
if (splitArr[2] != null) {
buttTitle = splitArr[2];
}
var ftButton = {
label : splitArr[0],
classNames : 'aui-button ah-button-small ah-button-positive',
isVisible : true,
id : 'footerBTN' + splitArr[0],
events : evnt,
title : buttTitle
};
footerbuttons.push(ftButton);
}
}
if (title == 'null') {
title = '';
}
var prntText = "Print";
var fdbckText = "Feedback";
if (prnt != '') {
prntText = prnt;
}
if (fdBck != '') {
fdbckText = fdBck;
}
var body = "";
// Dont display the body text if uri is given
if (uri == 'null' || uri == '') {
body = document.getElementById(id).innerHTML;
}
if (loadingText == 'null') {
loadingText = '';
}
// Commented below code as per PCA-788
// comment as per PFO-2725
/*
* var headbuttons = [ { label : prntText, classNames : 'aui-button
* ah-button-small ah-button-negative', isLink : true, isVisible :
* isPrintVisible, id : 'prntBTN', events : { click : function(e) {
* printLightBx(id, print, uri, iframe); } } }, { label : fdbckText,
* classNames : 'aui-button ah-button-small ah-button-neutral', isLink :
* true, isVisible : isFeedBackVisible, id : 'feedbackBTN', events : { click :
* function(e) { feedback(target); } } } ];
*/
window.ahlightboxTooltip = false;
AUI().ready("ah-lightbox", function(A) {
ahLightbox = new A.AHLightbox({
////PBPI-3103 PCA 2741 - Global Lightbox print issue.
//This id will be used while printing
id : id + '_ahLightbox',
title : title,
width : width,
uri : uri,
footerText : cpyRghtTxt,
draggable : false,
resizable : false,
footerContent : '',
iframe : iframe,
close : true,
header : headerDisplay,
loadingMessage : loadingText,
bodyContent : body,
buttonsLinks : {
// comment as per PFO-2725
// header : headbuttons,
// Add below header as per PCA-788
header : getheadButtons(),
footer : footerbuttons
}
}).render();
//PBPI-1498-Apply fixed suggested by UI team for tooltip issue
ahLightbox.on('render', function(event){
if(A.one("#" + id)){
lightBoxid = A.one("#" + id);
toolTipNodeList = lightBoxid.all(".ah-tooltip");
if(toolTipNodeList.size() > 0){
toolTipNodeList.each(function (node,index) {
window.ahlightboxTooltip = true;
var id = this.getAttribute('id');
window["initToolTip" + id]();
});
};
};
});
ahLightbox.on('close', function(event){
window.ahlightboxTooltip = false;
// PFO-17301 : On popup clos focus should be on 'Read footnotes' link : Starts
if(A.one("#readFnLink")){
setTimeout(function() {
A.one("#readFnLink").focus();
},0);
}
// PFO-17301 : On popup clos focus should be on 'Read footnotes' link : Ends
});
});
// PCA-788
var showPageUtilityLightBox = function(utilityName, isAddedToFav) {
pageUtilityBarModelWindow(utilityName, ahLightbox, id, isAddedToFav);
}
var getheadButtons = function() {
var headbuttons = [];
var pageUtilityLinksJson = getPageUtilityLinksForModelWindow(id);
var i = -1;
if (pageUtilityLinksJson) {
if (pageUtilityLinksJson.print) {
headbuttons[++i] = {
label : pageUtilityLinksJson.print.label,
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : isPrintVisible,
id : 'printBtn',
events : {
click : function(e) {
printLightBx(id, print, uri, iframe);
}
}
};
}
if (pageUtilityLinksJson.share) {
headbuttons[++i] = {
label : pageUtilityLinksJson.share.label,
title : getShareMessageTitle(),
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : false,
id : 'shareBtn',
events : {
click : function(e) {
showPageUtilityLightBox("share", "");
}
}
};
}
if (pageUtilityLinksJson.fav) {
headbuttons[++i] = {
label : pageUtilityLinksJson.fav.label,
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : false,
id : 'favBtn',
events : {
click : function(e) {
showPageUtilityLightBox("fav",
pageUtilityLinksJson.fav.addedToFav);
}
}
};
}
} else {
headbuttons[++i] = {
label : prntText,
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : isPrintVisible,
id : 'prntBTN',
events : {
click : function(e) {
printLightBx(id, print, uri, iframe);
}
}
};
}
if (QualtricsFeedbackEnabled) {
headbuttons[++i] = {
label : fdbckText,
title : getFeedbackMessageTitle(),
classNames : 'aui-button ah-button-small ah-button-neutral',
isLink : true,
isVisible : isFeedBackVisible,
id : 'feedbackBTN',
events : {
click : function() {
window.open('https://alight.az1.qualtrics.com/jfe/form/SV_0GjRjxBTmnNrN2d', 'feedbackSurvey', 'width=575, height=331, left=400, top=200, scrollbars=yes, menubar=no, toolbar=no, resizable=yes');
}
}
};
} else {
headbuttons[++i] = {
label : fdbckText,
title : getFeedbackMessageTitle(),
classNames : 'aui-button ah-button-small ah-button-neutral',
isLink : true,
isVisible : isFeedBackVisible,
id : 'feedbackBTN',
events : {
click : function(e) {
feedback(target);
}
}
};
}
return headbuttons;
}
}
//Maestro:VS72786
function showLightboxForTag(uri, id, title, height, width, target, print, iframe,
copyRightText, fdBck, prnt, auiButtonText, isCpyRigthText, showHeader, loadingText, doesLightboxOverridePageutility, cssClass) {
try{
var alightSecureSessionToken;
if(domStorgeFallbackFn && typeof domStorgeFallbackFn.getItem === 'function'){
alightSecureSessionToken = domStorgeFallbackFn.getItem("alightSecureSessionToken") || domStorgeFallbackFn.getItem("alightPersonSessionToken");
}
if(alightSecureSessionToken != null || alightSecureSessionToken != undefined){
if(uri.includes("video?videoId")){
try{
var url = Liferay.PortletURL.createRenderURL();
url.setPortletId('Video_WAR_ahcontentportlet_INSTANCE_'.concat(new Date().getTime()));
url.setWindowState('exclusive');
url = url.toString();
uri = url+'&'+uri.substring(uri.indexOf('?')+1,uri.length);
}catch(err){}
}
}
}catch(e){}
var footerbuttons = [];
var headerDisplay = true;
var isPrintVisible = (print.toLowerCase() == 'true' ? true : false);
var isFeedBackVisible = (target == "" ? false : true);
var QualtricsFeedbackEnabled = true;
var cpyRghtTxt = copyRightText;
//Maestro:VS72786
var doesLightboxOverridePageutilityFlag = (doesLightboxOverridePageutility.toLowerCase() == 'true' ? true : false);
if (isCpyRigthText != 'true') {
cpyRghtTxt = '';
}
if (showHeader == undefined || showHeader == 'false') {
headerDisplay = false;
}
if ((auiButtonText != undefined) && !(auiButtonText == 'null')
&& !(auiButtonText == '')) {
var buttArr = auiButtonText.split("@");
for ( var i = 0; i < buttArr.length; i++) {
var splitArr = buttArr[i].split('#');
var funHandler = new Function(splitArr[1]);
var evnt = {
click : funHandler
};
var buttTitle = '';
if (splitArr[2] != null) {
buttTitle = splitArr[2];
}
var ftButton = {
label : splitArr[0],
classNames : 'aui-button ah-button-small ah-button-positive',
isVisible : true,
id : 'footerBTN' + splitArr[0],
events : evnt,
title : buttTitle
};
footerbuttons.push(ftButton);
}
}
if (title == 'null') {
title = '';
}
var prntText = "Print";
var fdbckText = "Feedback";
if (prnt != '') {
prntText = prnt;
}
if (fdBck != '') {
fdbckText = fdBck;
}
var body = "";
// Dont display the body text if uri is given
if (uri == 'null' || uri == '') {
body = document.getElementById(id).innerHTML;
}
if (loadingText == 'null') {
loadingText = '';
}
// Commented below code as per PCA-788
// comment as per PFO-2725
/*
* var headbuttons = [ { label : prntText, classNames : 'aui-button
* ah-button-small ah-button-negative', isLink : true, isVisible :
* isPrintVisible, id : 'prntBTN', events : { click : function(e) {
* printLightBx(id, print, uri, iframe); } } }, { label : fdbckText,
* classNames : 'aui-button ah-button-small ah-button-neutral', isLink :
* true, isVisible : isFeedBackVisible, id : 'feedbackBTN', events : { click :
* function(e) { feedback(target); } } } ];
*/
window.ahlightboxTooltip = false;
AUI().ready("ah-lightbox", function(A) {
ahLightbox = new A.AHLightbox({
//PBPI-3103 PCA-2741 - This id will be used while printing
id : id + '_ahLightbox',
title : title,
width : width,
uri : uri,
footerText : cpyRghtTxt,
draggable : false,
resizable : false,
footerContent : '',
iframe : iframe,
close : true,
header : headerDisplay,
loadingMessage : loadingText,
bodyContent : body,
buttonsLinks : {
// comment as per PFO-2725
// header : headbuttons,
// Add below header as per PCA-788
header : getheadButtons(),
footer : footerbuttons
},
cssClass : cssClass
}).render();
//PBPI-1498-Apply fixed suggested by UI team for tooltip issue
ahLightbox.on('render', function(event){
if(A.one("#" + id)){
lightBoxid = A.one("#" + id);
toolTipNodeList = lightBoxid.all(".ah-tooltip");
if(toolTipNodeList.size() > 0){
toolTipNodeList.each(function (node,index) {
window.ahlightboxTooltip = true;
var id = this.getAttribute('id');
window["initToolTip" + id]();
});
};
};
});
ahLightbox.on('close', function(event){
window.ahlightboxTooltip = false;
// PFO-13898 start
if(A.one("#" + id)){
setTimeout(function() {
A.one("#" + id + "_LBSimulatorLink").focus();
},0);
}
// PFO-13898 end
});
});
// PCA-788
var showPageUtilityLightBox = function(utilityName, isAddedToFav) {
pageUtilityBarModelWindow(utilityName, ahLightbox, id, isAddedToFav);
}
var getheadButtons = function() {
var headbuttons = [];
var pageUtilityLinksJson = getPageUtilityLinksForModelWindow(id);
var i = -1;
//Maestro:VS72786
if (doesLightboxOverridePageutilityFlag==false && pageUtilityLinksJson) {
if (pageUtilityLinksJson.print) {
headbuttons[++i] = {
label : pageUtilityLinksJson.print.label,
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : isPrintVisible,
id : 'printBtn',
events : {
click : function(e) {
printLightBx(id, print, uri, iframe);
}
}
};
}
if (pageUtilityLinksJson.share) {
headbuttons[++i] = {
label : pageUtilityLinksJson.share.label,
title : getShareMessageTitle(),
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : false,
id : 'shareBtn',
events : {
click : function(e) {
showPageUtilityLightBox("share", "");
}
}
};
}
if (pageUtilityLinksJson.fav) {
headbuttons[++i] = {
label : pageUtilityLinksJson.fav.label,
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : false,
id : 'favBtn',
events : {
click : function(e) {
showPageUtilityLightBox("fav",
pageUtilityLinksJson.fav.addedToFav);
}
}
};
}
} else {
headbuttons[++i] = {
label : prntText,
classNames : 'aui-button ah-button-small ah-button-negative',
isLink : true,
isVisible : isPrintVisible,
id : 'prntBTN',
events : {
click : function(e) {
printLightBx(id, print, uri, iframe);
}
}
};
}
if (QualtricsFeedbackEnabled) {
headbuttons[++i] = {
label : fdbckText,
title : getFeedbackMessageTitle(),
classNames : 'aui-button ah-button-small ah-button-neutral',
isLink : true,
isVisible : isFeedBackVisible,
id : 'feedbackBTN',
events : {
click : function() {
window.open('https://alight.az1.qualtrics.com/jfe/form/SV_0GjRjxBTmnNrN2d', 'feedbackSurvey', 'width=575, height=331, left=400, top=200, scrollbars=yes, menubar=no, toolbar=no, resizable=yes');
}
}
};
} else {
headbuttons[++i] = {
label : fdbckText,
title : getFeedbackMessageTitle(),
classNames : 'aui-button ah-button-small ah-button-neutral',
isLink : true,
isVisible : isFeedBackVisible,
id : 'feedbackBTN',
events : {
click : function(e) {
feedback(target);
}
}
};
}
return headbuttons;
}
}
function getPageUtilityLinksForModelWindow(id) {
var linkName = "";
try {
linkName = pageUtilityAddToFavJsOnObj.linkName;
} catch (err) {
}
if(linkName!= "" && linkName.indexOf("RemoteContentPageLink?articleId=")>=0) {
linkName="";
}
var data;
try {
AUI().use(
'aui-io-request',
function(A) {
A.io.request(pageUtilitySecWindowAndModelLinksUrl
+ "&linkId=" + linkName + "$$" + id, {
method : 'POST',
dataType : 'json',
data : {
postKey : ''
},
sync : true,
cache : false,
on : {
success : function() {
// var data =
// A.JSON.parse(this.get('responseData'));
data = this.get('responseData');
},
failure : function() {
}
}
});
});
} catch (err) {
// console.log("pageUtilitySecWindowAndModelLinksUrl not found."+err);
}
return data;
}
function showIntranetAlert(msg, intranetAlertHeaderText, buttonText) {
AUI().use('ah-lightbox', function(A){
var ahLightbox = null;
ahLightbox = new A.AHLightbox({
destroyOnClose : true,
resizable : false,
draggable : false,
footerText : '',
footerContent : '',
bodyContent : '' + intranetAlertHeaderText + '
' + msg + '
',
width : '64%',
header : false,
buttonsLinks : {
footer : [ {
isVisible : true,
label : buttonText,
classNames : 'aui-button ah-button-small ah-button-positive',
id : 'Ok',
events : {
click : function(e) {
ahLightbox.close();
}
}
}]
}
}).render();
});
}
function doExternalLinkLogging(loggingURL) {
var A = AUI();
A.use('aui-io-request', function(A) {
A.io.request(loggingURL, {
cache : true,
sync : true,
timeout : 1000,
method : 'GET',
dataType : 'html',
data : {},
sync : false,
on : {
success : function() {
},
failure : function() {
}
}
});
});
}
function processUrlForIntranet(href) {
var A = AUI();
var resourceURL = Liferay.PortletURL.createResourceURL();
resourceURL.setPortletId('ahheader_WAR_ahheaderportlet');
resourceURL.setResourceId('checkIntranet');
var checkIntranetUrl = resourceURL.toString();
A.use('aui-io-request', function(A) {
A.io.request(checkIntranetUrl, {
method : 'POST',
cache: false,
dataType : 'text/plain',
data : {
postKey : ""
},
sync : false,
on : {
success : function() {
if (this.get('responseData') == 'true') {
//PFO-3516
//document.location.href = href;
window.open(href, "", "menubar=yes, resizable=yes, scrollbars=yes, status=yes, titlebar=yes, toolbar=yes");
} else {
var showIntranetAlertAssets = this.get('responseData').split("::");
showIntranetAlert(unescape(showIntranetAlertAssets[1]),unescape(showIntranetAlertAssets[0]),unescape(showIntranetAlertAssets[2]));
}
},
failure : function() {
}
}
});
});
}
AUI().ready("node", "event", function(A){
if((A.one('.aui-ah-lightbox')) &&(A.one('.aui-tooltip '))){
A.one('.aui-ah-lightbox').setStyle('zIndex','2005');
}});