1172 lines
41 KiB
JavaScript
1172 lines
41 KiB
JavaScript
/*
|
|
The following errors were found when attempting to minify this file:
|
|
- Line 401: Parse error. missing ) after formal parameters
|
|
*/
|
|
window.pageHandleResponsive = true;
|
|
|
|
$.when(window.Pages.rwdReady).done(function () {
|
|
var $divCalendarContent = $('#CalendarContent');
|
|
var $divFeatured = $('#featured');
|
|
var $divAboveContent = $('#aboveContent');
|
|
var $divAboveFooter = $('#aboveFooter');
|
|
cpMedia.register('#CalendarContent:media(this-min-width:760px)', {
|
|
setup: function () {
|
|
$divCalendarContent.addClass('maxWidth760px');
|
|
window.cpMedia.diag('$(element).addClass("maxWidth760px"); #CalendarContent:media(this-min-width:760px)');
|
|
$('div.eventHeader').hide();
|
|
$('div.weekEventDetails').hide();
|
|
$divFeatured.insertBefore($divAboveFooter);
|
|
window.cpMedia.diag('feature bar setup');
|
|
},
|
|
match: function (e, element) {
|
|
$(element).removeClass('maxWidth760px');
|
|
window.cpMedia.diag('$(element).removeClass("maxWidth760px"); #CalendarContent:media(this-min-width:760px)');
|
|
$divFeatured.insertBefore($divAboveContent);
|
|
$('div.eventHeader').show();
|
|
$('div.weekEventDetails').show();
|
|
window.cpMedia.diag('feature bar moved above content');
|
|
},
|
|
unmatch: function (e, element) {
|
|
$(element).addClass('maxWidth760px');
|
|
window.cpMedia.diag('$(element).addClass("maxWidth760px"); #CalendarContent:media(this-min-width:760px)');
|
|
$('div.eventHeader').hide();
|
|
$('div.weekEventDetails').hide();
|
|
$divFeatured.insertBefore($divAboveFooter);
|
|
window.cpMedia.diag('feature bar moved above footer');
|
|
}
|
|
});
|
|
|
|
//Calendar select dropdown.
|
|
var $divCalendarSelectors = $('#calendarSelectors');
|
|
var $divCategories = $divCalendarSelectors.children('div');
|
|
var $listItems = $divCategories.find('li');
|
|
cpMedia
|
|
.register('#CalendarContent:media(this-max-width:300px)', {
|
|
match: function (e, element) {
|
|
$(element).addClass('maxWidth300px');
|
|
window.cpMedia.diag('$(element).addClass("maxWidth300px"); #CalendarContent:media(this-max-width:300px)');
|
|
rebalanceCategories($divCategories, $listItems, 1);
|
|
window.cpMedia.diag('rebalancing "Select Calendar" 1 column');
|
|
},
|
|
unmatch: function (e, element) {
|
|
$(element).removeClass('maxWidth300px');
|
|
window.cpMedia.diag('$(element).removeClass("maxWidth300px"); #CalendarContent:media(this-max-width:300px)');
|
|
}
|
|
}).register('#CalendarContent:media(this-above-width:300px and this-max-width:400px)', {
|
|
match: function () {
|
|
rebalanceCategories($divCategories, $listItems, 2);
|
|
window.cpMedia.diag('rebalancing "Select Calendar" 2 columns');
|
|
}
|
|
}).register('#CalendarContent:media(this-above-width:400px and this-max-width:530px)', {
|
|
match: function () {
|
|
rebalanceCategories($divCategories, $listItems, 3);
|
|
window.cpMedia.diag('rebalancing "Select Calendar" 3 columns');
|
|
}
|
|
}).register('#CalendarContent:media(this-above-width:530px)', {
|
|
match: function () {
|
|
rebalanceCategories($divCategories, $listItems, 4);
|
|
window.cpMedia.diag('rebalancing "Select Calendar" 4 columns');
|
|
}
|
|
});
|
|
|
|
|
|
//jump to list
|
|
var $jumpList = $('#jumpList');
|
|
var $jumpSelect = $('#jumpSelect');
|
|
if ($jumpList.length == 1 && $jumpSelect.length == 1) {
|
|
$jumpSelect.change(function () {
|
|
document.location.href = $(this).val();
|
|
});
|
|
}
|
|
cpMedia.register('#CalendarContent:media(this-max-width:530px)', {
|
|
match: function (e, element) {
|
|
$(element).addClass('maxWidth530px');
|
|
window.cpMedia.diag('$(element).addClass("maxWidth530px"); #CalendarContent:media(this-max-width:530px)');
|
|
$jumpSelect.show();
|
|
$jumpList.hide();
|
|
window.cpMedia.diag('jumpSelect show');
|
|
},
|
|
unmatch: function (e, element) {
|
|
$(element).removeClass('maxWidth530px');
|
|
window.cpMedia.diag('$(element).removeClass("maxWidth530px"); #CalendarContent:media(this-max-width:530px)');
|
|
$jumpSelect.hide();
|
|
$jumpList.show();
|
|
window.cpMedia.diag('jumpSelect hide');
|
|
}
|
|
});
|
|
|
|
//event detail & month view
|
|
var $divDetailTitle = $('#divDetailTitle');
|
|
var $divAboveDetails = $('#divAboveDetails');
|
|
var $divBelowDetails = $('#divBelowDetails');
|
|
cpMedia.register('#CalendarContent:media(this-min-width:650px)', {
|
|
setup: function () {
|
|
$divCalendarContent.addClass('maxWidth650px');
|
|
$divDetailTitle.insertBefore($divAboveDetails);
|
|
},
|
|
match: function (e, element) {
|
|
$(element).removeClass('maxWidth650px');
|
|
$divDetailTitle.insertBefore($divBelowDetails);
|
|
var url = window.location.href.toLowerCase();
|
|
if (url.indexOf("preview=yes") <= -1 && url.indexOf("print=yes") <= -1) {
|
|
$('table.monthGrid').find('div.monthItem.rwdHidden').hide();
|
|
$('table.monthGrid').find('div.monthShowMore').show();
|
|
}
|
|
},
|
|
unmatch: function (e, element) {
|
|
$(element).addClass('maxWidth650px');
|
|
$divDetailTitle.insertBefore($divAboveDetails);
|
|
}
|
|
});
|
|
|
|
toggleClassMedia('maxWidth220px', '#CalendarContent:media(this-max-width:220px)');
|
|
toggleClassMedia('maxWidth400px', '#CalendarContent:media(this-max-width:400px)');
|
|
toggleClassMedia('maxWidth500px', '#CalendarContent:media(this-max-width:500px)');
|
|
toggleClassMedia('maxWidth900px', '#CalendarContent:media(this-max-width:900px)');
|
|
});
|
|
|
|
function rebalanceCategories($divCategories, $listItems, numColumns) {
|
|
var columns = balanceListInColumns($listItems, numColumns);
|
|
$divCategories.empty();
|
|
for (var i = 0; i < columns.length; i++) {
|
|
var $ol = $('<ol></ol>');
|
|
$ol.append(columns[i]);
|
|
$divCategories.append($ol);
|
|
}
|
|
}
|
|
|
|
function balanceListInColumns(itemList, numColumns) {
|
|
numColumns = parseInt(numColumns, 10);
|
|
if (isNaN(numColumns) || numColumns <= 0)
|
|
throw 'numColumns must be > 0';
|
|
if (!itemList.length)
|
|
throw 'itemList must be an array';
|
|
var columns = [];
|
|
if (itemList.length > 0) {
|
|
var div = Math.floor(itemList.length / numColumns);
|
|
var rem = itemList.length % numColumns;
|
|
var numberPerColumn = [];
|
|
var i, j = 0;
|
|
for (i = 0; i < numColumns; i++) {
|
|
numberPerColumn[i] = div;
|
|
if ((i + 1) <= rem) {
|
|
numberPerColumn[i]++;
|
|
}
|
|
}
|
|
for (i = 0; i < numberPerColumn.length; i++) {
|
|
columns[i] = [];
|
|
for (var k = 0; k < numberPerColumn[i]; k++) {
|
|
columns[i][k] = itemList[j++];
|
|
}
|
|
}
|
|
}
|
|
return columns;
|
|
};
|
|
function gotoArchives(catID, itemID, notifyMe, action) {
|
|
var frmAF = document.aspnetForm;
|
|
var qs = window.location.search;
|
|
var actionTaken = '' ;
|
|
if (action)
|
|
actionTaken = action + '?ARC=Y' + (qs == null || qs == '' ? '' : '&' + qs.substr(1));
|
|
else
|
|
actionTaken = window.location.protocol + "//" + window.location.host + window.location.pathname +
|
|
'?ARC=Y' + (qs == null || qs == '' ? '' : '&' + qs.substr(1));
|
|
|
|
frmAF.action = actionTaken;
|
|
frmAF.strPage.value = "Archive";
|
|
frmAF.intArchMainCatID.value = catID;
|
|
frmAF.intArchMainItemID.value = itemID;
|
|
frmAF.ysnNotifyMe.value = (notifyMe ? 1 : 0);
|
|
frmAF.submit();
|
|
}
|
|
|
|
function archivedSort(reqSort) {
|
|
var frmAF = document.aspnetForm;
|
|
var lastSort = frmAF.txtArchSort.value;
|
|
var lastSortDir = frmAF.txtArchAsc.value;
|
|
|
|
frmAF.txtArchAsc.value = (lastSort != reqSort ? 1 : (lastSortDir == 1 ? 0 : 1));
|
|
frmAF.txtArchSort.value = reqSort;
|
|
asyncPostBack('sort', 'Archive');
|
|
}
|
|
|
|
function archVariablesInit(onlyThisCat, onlyThisItem) {
|
|
var frmAF = document.aspnetForm;
|
|
frmAF.strPage.value = 'Archive';
|
|
frmAF.intArchMainCatID.value = onlyThisCat;
|
|
frmAF.intArchMainItemID.value = onlyThisItem;
|
|
};
|
|
var perfEntries = performance.getEntriesByType("navigation");
|
|
if (perfEntries[0].type === "back_forward") {
|
|
location.reload(true);
|
|
}
|
|
|
|
var focusElement = null;
|
|
var numCheckable = 0, numChecked = 0, idcounter = '';
|
|
var commonLocalisation = null;
|
|
|
|
$(document).ready(function() {
|
|
$("p.icalevent-desc").urlToLink({ target: '_blank' });
|
|
});
|
|
|
|
function inviteFriends(eventId) {
|
|
document.cookie = "emailpageUrlReferrer=" + location.href;
|
|
window.location.href = "/EmailPage";
|
|
}
|
|
|
|
function eventDetails(id, thisDay, thisMonth, thisYear, calType, modal) {
|
|
if (modal)
|
|
closeModalDialog('editItemBehavior');
|
|
if (event.currentTarget.href && window.FeatureToggles.isActive("CMS.Calendar.LinkToWebAddressAdjustmentsAndNotifications")) {
|
|
if (event.currentTarget.target == '_blank')
|
|
window.open(event.currentTarget.href, '_blank');
|
|
else
|
|
window.location.href = event.currentTarget.href;
|
|
}
|
|
else {
|
|
document.aspnetForm.action = '/Calendar.aspx?EID=' + id + '&month=' + thisMonth + '&year=' + thisYear + '&day=' + thisDay + '&calType=' + calType;
|
|
document.aspnetForm.submit();
|
|
}
|
|
}
|
|
|
|
function expandCollapseEventMoreDetails(eventID, detailsText) {
|
|
if (document.getElementById(eventID).style.display == 'none') {
|
|
document.getElementById('evnt' + eventID).setAttribute('title', 'Collapse ' + detailsText);
|
|
document.getElementById(eventID).style.display = 'block';
|
|
document.getElementById('a_' + eventID).innerHTML = '▼ ' + detailsText;
|
|
}
|
|
else {
|
|
document.getElementById('evnt' + eventID).setAttribute('title', 'Expand ' + detailsText);
|
|
document.getElementById(eventID).style.display = 'none';
|
|
document.getElementById('a_' + eventID).innerHTML = '► ' + detailsText;
|
|
}
|
|
}
|
|
|
|
function removeDefaultStartEndDate(elem) {
|
|
|
|
if (elem.value == 'dd/mm/yyyy')
|
|
elem.value = '';
|
|
else if (elem.value == '')
|
|
elem.value = 'dd/mm/yyyy';
|
|
}
|
|
|
|
function removeDefaultStartDate(elem) {
|
|
if (elem.value == 'Start Date')
|
|
elem.value = '';
|
|
else if (elem.value == '')
|
|
elem.value = 'Start Date';
|
|
}
|
|
|
|
function removeDefaultEndDate(elem) {
|
|
if (elem.value == 'End Date')
|
|
elem.value = '';
|
|
else if (elem.value == '')
|
|
elem.value = 'End Date';
|
|
}
|
|
|
|
function removeDefaultSearchTerm(elem) {
|
|
if (elem.value == 'Search')
|
|
elem.value = '';
|
|
else if (elem.value == '')
|
|
elem.value = 'Search';
|
|
}
|
|
|
|
function changeView(view, thisDay, thisMonth, thisYear, CID, keywords, startDate, endDate) {
|
|
//optional params
|
|
keywords = typeof keywords !== 'undefined' ? keywords : '';
|
|
startDate = typeof startDate !== 'undefined' ? startDate : '';
|
|
endDate = typeof endDate !== 'undefined' ? endDate : '';
|
|
document.aspnetForm.calendarView.value = view;
|
|
document.aspnetForm.action = '/calendar.aspx?' + (thisMonth ? 'month=' + thisMonth + '&' : '') + (thisYear ? 'year=' + thisYear + '&' : '') + (thisDay && view == 'week' ? 'day=' + thisDay + '&' : '') + (CID ? 'CID=' + CID + '&' : '') + 'Keywords=' + keywords + '&startDate=' + startDate + '&enddate=' + endDate + '&';
|
|
document.aspnetForm.submit();
|
|
}
|
|
|
|
function printView(view) {
|
|
var action = document.aspnetForm.action;
|
|
var mode = window.getPrintPreviewType();
|
|
var printStr = 'PREVIEW=YES';
|
|
if (mode == 1)
|
|
printStr = 'PRINT=YES';
|
|
if ((action.indexOf('?view=') == -1) && (action.indexOf('&view=') == -1))
|
|
action = action + (action.indexOf("?") == -1 ? '?' : '&') + "view=" + view;
|
|
if (action.indexOf(printStr) == -1)
|
|
action = action + (action.indexOf("?") == -1 ? '?' : '&') + printStr;
|
|
window.open(action, "");
|
|
}
|
|
|
|
function checkAllCalendars(value) {
|
|
var arrCheckboxes = document.getElementsByName("chkCalendarID");
|
|
for (var cv = 0; cv < arrCheckboxes.length; cv++)
|
|
arrCheckboxes[cv].checked = value;
|
|
|
|
numChecked = (value ? arrCheckboxes.length : 0);
|
|
}
|
|
|
|
function boxChanged(wasChecked) {
|
|
if (wasChecked)
|
|
++numChecked;
|
|
else
|
|
--numChecked;
|
|
document.getElementById('allCalendars').checked = (numChecked == numCheckable);
|
|
}
|
|
|
|
function searchTextHook(ev) {
|
|
ev = (window.event ? window.event : ev);
|
|
if (ev.keyCode == 10 || ev.keyCode == 13)
|
|
calendarSearch();
|
|
}
|
|
|
|
function calendarSearch() {
|
|
var frm = document.aspnetForm;
|
|
var startDate = window.FeatureToggles.isActive("CMS.JqueryUpgrade.UpgradeTo224") ? frm.startDateFromAmsul.value : frm.startDate.value;
|
|
var enddate = window.FeatureToggles.isActive("CMS.JqueryUpgrade.UpgradeTo224") ? frm.endDateFromAmsul.value : frm.enddate.value;
|
|
var searchTerm = frm.searchTerm.value;
|
|
var CID = '';
|
|
|
|
var objDate = new dateValidator();
|
|
if (startDate == 'Start Date')
|
|
startDate = '';
|
|
if (enddate == 'End Date')
|
|
enddate = '';
|
|
if (searchTerm == 'Search')
|
|
searchTerm = '';
|
|
if (startDate != '' || enddate != '') {
|
|
objDate.setStartDate(startDate);
|
|
objDate.setEndDate(enddate);
|
|
if (!objDate.dateOrderValidateNew()) {
|
|
if (objDate.error) alert(objDate.error);
|
|
else alert("Error in date format");
|
|
return false;
|
|
}
|
|
}
|
|
var arrCheckboxes = document.getElementsByName("chkCalendarID");
|
|
for (var cv = 0; cv < arrCheckboxes.length; cv++) {
|
|
if (arrCheckboxes[cv].checked)
|
|
CID = CID + arrCheckboxes[cv].value + ",";
|
|
}
|
|
|
|
if (startDate + enddate + searchTerm == "") {
|
|
frm.action = '/calendar.aspx?CID=' + CID;
|
|
}
|
|
else {
|
|
frm.calendarView.value = 'list';
|
|
frm.action = '/calendar.aspx?Keywords=' + encodeURIComponent(searchTerm) + '&startDate=' + startDate + '&enddate=' + enddate + '&CID=' + CID;
|
|
}
|
|
|
|
var pastEventsCheckbox = document.getElementById("showPastEvents");
|
|
if (pastEventsCheckbox) {
|
|
frm.action = frm.action.substr(0, frm.action.length - 1);
|
|
frm.action += '&showPastEvents=' + pastEventsCheckbox.checked;
|
|
}
|
|
|
|
frm.submit();
|
|
}
|
|
|
|
function checkShowPastEvents(value) {
|
|
var pastEventsCheckbox = document.getElementById("showPastEvents");
|
|
if (pastEventsCheckbox && pastEventsCheckbox.length > 0)
|
|
pastEventsCheckbox.checked = value;
|
|
}
|
|
|
|
function eventDetail(id, thisDay, thisMonth, thisYear, calType) {
|
|
var $divWeekEventDetails = $('div.weekEventDetails');
|
|
if ($divWeekEventDetails.length == 1 && !$divWeekEventDetails.is(':visible') && thisDay && thisMonth && thisYear) {
|
|
eventDetails(id, thisDay, thisMonth, thisYear, calType);
|
|
} else {
|
|
document.aspnetForm.calendarView.value = 'week';
|
|
document.aspnetForm.eventID.value = id;
|
|
redrawContentCalendar();
|
|
}
|
|
}
|
|
|
|
function facilityDetail(id) {
|
|
document.aspnetForm.action = '/facilities.aspx?Page=resvdetail&FRID=' + id;
|
|
document.aspnetForm.submit();
|
|
}
|
|
|
|
function facility2012Detail(id) {
|
|
window.location.href = '/Facilities/Facility/Details/' + id;
|
|
}
|
|
|
|
function showMore(id, showMoreId, day) {
|
|
var elemStyle = document.getElementById(id).style;
|
|
if (elemStyle.display == 'none') {
|
|
elemStyle.display = 'block';
|
|
document.aspnetForm.showMoreDay.value = day;
|
|
document.getElementById(showMoreId).innerHTML = '<span class="label">Show Less </span><svg class="icon"><use href="#iconChevronUp"></use></svg>';
|
|
}
|
|
else {
|
|
elemStyle.display = 'none';
|
|
document.aspnetForm.showMoreDay.value = '';
|
|
document.getElementById(showMoreId).innerHTML = '<span class="label">Show More </span><svg class="icon"><use href="#iconChevronDown"></use></svg>';
|
|
}
|
|
}
|
|
|
|
function switchWeek(action, id = null) {
|
|
document.aspnetForm.calendarView.value = 'week';
|
|
document.aspnetForm.eventID.value = 0;
|
|
document.aspnetForm.action = action;
|
|
setFocus(id);
|
|
redrawContentCalendar();
|
|
}
|
|
|
|
var observer = new MutationObserver(function () {
|
|
if (focusElement) {
|
|
document.getElementById(focusElement).focus();
|
|
focusElement = null;
|
|
observer.disconnect();
|
|
}
|
|
});
|
|
|
|
function setFocus(elemId) {
|
|
if (elemId) {
|
|
focusElement = elemId;
|
|
observer.observe(document.getElementById("CalendarContent"), { childList: true, subtree: true });
|
|
}
|
|
}
|
|
|
|
function changeDate(year, month, view, CID, id = null) {
|
|
var frm = document.aspnetForm;
|
|
frm.calendarView.value = view;
|
|
|
|
var nid = GetQueryStringParameter('NID');
|
|
var fid = GetQueryStringParameter('FID');
|
|
|
|
setFocus(id);
|
|
|
|
frm.action = '/calendar.aspx?month=' + month + '&year=' + year + (CID ? '&CID=' + CID : '') + (nid != '' ? '&NID=' + nid : '') + (fid != '' ? '&FID=' + fid : '');
|
|
redrawContentCalendar();
|
|
}
|
|
|
|
function displayPopUp(id) {
|
|
var elemStyle = document.getElementById(id).style;
|
|
if (elemStyle.display == 'none') {
|
|
elemStyle.display = 'block';
|
|
}
|
|
else {
|
|
elemStyle.display = 'none';
|
|
}
|
|
}
|
|
|
|
function changeDay(date, CID) {
|
|
var month = date.substring(0, date.indexOf('/'));
|
|
date = date.substring(date.indexOf('/') + 1);
|
|
var day = date.substring(0, date.indexOf('/'));
|
|
var year = date.substring(date.indexOf('/') + 1);
|
|
var url = '/common/modules/Calendar/ShowAllEvents.aspx?day=' + day + '&year=' + year + '&month=' + month + (CID ? '&CID=' + CID + '&' : '');
|
|
openCpModal({
|
|
title: 'More Events',
|
|
className: "modalContainer modalContainerCP showMoreEvents",
|
|
isFrontEnd: true,
|
|
useIframe: false,
|
|
showLoading: true,
|
|
async: false,
|
|
verticalCenter: true,
|
|
url: url
|
|
});
|
|
|
|
$('p.icalDescription').urlToLink({ target: '_blank' });
|
|
}
|
|
|
|
function showAllEvents(day, month, year, state, CID) {
|
|
openCpModal({
|
|
title: 'More Events',
|
|
className: "modalContainer modalContainerCP showMoreEvents",
|
|
isFrontEnd: true,
|
|
useIframe: false,
|
|
showLoading: true,
|
|
async: false,
|
|
verticalCenter: true,
|
|
url: '/common/modules/Calendar/ShowAllEvents.aspx?day=' + day + '&year=' + year + '&month=' + month + '&state=' + state + (CID ? '&CID=' + CID + '&' : '')
|
|
});
|
|
|
|
$('p.icalDescription').urlToLink({ target: '_blank' });
|
|
}
|
|
|
|
function expandAll(month, year, action, CID) {
|
|
if (action === 'expand') {
|
|
document.aspnetForm.action = '/calendar.aspx?month=' + month + '&year=' + year + '&mode=expandAll' + (CID ? '&CID=' + CID + '&' : '');
|
|
} else {
|
|
document.aspnetForm.action = '/calendar.aspx?month=' + month + '&year=' + year + '&mode=collapseAll' + (CID ? '&CID=' + CID + '&' : '');
|
|
}
|
|
document.aspnetForm.calendarView.value = 'month';
|
|
redrawContentCalendar();
|
|
return false;
|
|
}
|
|
|
|
function refreshPage(date, state) {
|
|
var frm = document.aspnetForm;
|
|
var datecopy = date;
|
|
var month = datecopy.substring(0, datecopy.indexOf('/'));
|
|
datecopy = datecopy.substring(datecopy.indexOf('/') + 1);
|
|
var day = datecopy.substring(0, datecopy.indexOf('/'));
|
|
datecopy = datecopy.substring(datecopy.indexOf('/') + 1);
|
|
var year = datecopy.substring(datecopy.indexOf('/'));
|
|
if (state === 'expanded')
|
|
frm.action = '/calendar.aspx?day=' + day + '&month=' + month + '&year=' + year;
|
|
else
|
|
frm.action = '/calendar.aspx?day=' + day + '&month=' + month + '&year=' + year + '&mode=collapseAll';
|
|
frm.calendarView.value = 'month';
|
|
frm.submit();
|
|
}
|
|
|
|
// LIVE EDIT STUFF:
|
|
try {
|
|
Sys.Application.add_load(loadOrAjaxUpdate);
|
|
}
|
|
catch (ex) { }
|
|
|
|
if (!window.CalendarKAMMenu) {
|
|
CalendarKAMMenu = function () { };
|
|
window.CalendarKAMMenu = CalendarKAMMenu;
|
|
}
|
|
|
|
function raiseAsyncPostbackCalendar(updatePanelID, closePopUp, actionTaken) {
|
|
if (closePopUp) {
|
|
closeModalDialog('editItemBehavior');
|
|
closeModalDialog();
|
|
}
|
|
|
|
if (actionTaken != undefined)
|
|
blockMenuSpawn = true;
|
|
if (CalendarKAMMenu.dayCounter)
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
else
|
|
CalendarItemHideMenu(1);
|
|
CalendarCategoryHideMenu();
|
|
if (actionTaken)
|
|
__doPostBack(updatePanelID, actionTaken);
|
|
else
|
|
__doPostBack(updatePanelID, "calendar");
|
|
}
|
|
|
|
function CalendarEventModifyDelete(calendarID, action, updatePanelID, eventID) {
|
|
var ysnArchShowForce = -1, doSubmit = true;
|
|
var frmCalendar = document.aspnetForm;
|
|
|
|
switch (action) {
|
|
case "Link":
|
|
{
|
|
doSubmit = false;
|
|
showCopyLinkWindowUsingRelatedLink('/calendar.aspx?EID=' + eventID);
|
|
break;
|
|
}
|
|
case "Publish":
|
|
case "Unpublish":
|
|
case "Reject":
|
|
case "Submit":
|
|
frmCalendar.strActionFE.value = "CalendarItem" + action;
|
|
break;
|
|
case "Delete":
|
|
{
|
|
if (confirm("Are you sure you want to delete this item?")) {
|
|
frmCalendar.strActionFE.value = "CalendarItemDelete";
|
|
}
|
|
else
|
|
doSubmit = false;
|
|
break;
|
|
}
|
|
case 'archivePublic':
|
|
ysnArchShowForce = 1;
|
|
case 'archiveHidden':
|
|
if (ysnArchShowForce < 0) ysnArchShowForce = 0;
|
|
if (!(confirm('Are you sure you want to archive this item?'))) {
|
|
ysnArchShowForce = -1;
|
|
return;
|
|
}
|
|
frmCalendar.strActionFE.value = 'CalendarItemArchive';
|
|
frmCalendar.ysnArchShowForceFE.value = ysnArchShowForce;
|
|
break;
|
|
default:
|
|
{
|
|
doSubmit = false;
|
|
break;
|
|
}
|
|
}
|
|
if (doSubmit) {
|
|
frmCalendar.ysnSaveFE.value = 1;
|
|
frmCalendar.lngCalendarEventID.value = eventID;
|
|
raiseAsyncPostbackCalendar(updatePanelID, 0);
|
|
}
|
|
}
|
|
|
|
function openEditWindowCalendar(calendarID, eventID, isCopy, order, updatePanelID, isSubmit) {
|
|
|
|
if (isSubmit) {
|
|
openCpModal({
|
|
title: 'Event Submission',
|
|
className: 'submitEvent',
|
|
isFrontEnd: true,
|
|
useIframe: true,
|
|
draggable: true,
|
|
url: '/common/modules/Calendar/calendarLiveEdit.aspx?calendarID=' + calendarID + '&eventID=' + eventID + '&order=' + order + '&updatePanelID=' + updatePanelID + '&submit=1'
|
|
});
|
|
$('#iframeModal').focus();
|
|
} else {
|
|
behavior = $find('editItemBehavior');
|
|
if (behavior) {
|
|
var ifr = document.getElementById('liveEditDialog');
|
|
setModalClass('liveEdit calendar', behavior);
|
|
|
|
var url = '/common/modules/Calendar/calendarLiveEdit.aspx?calendarID=' + calendarID + '&eventID=' + eventID + '&order=' + order + '&updatePanelID=' + updatePanelID;
|
|
|
|
if (isCopy)
|
|
ifr.src = url + '&strPage=itemCopy';
|
|
else
|
|
ifr.src = url + '&strPage=itemForm';
|
|
|
|
ifr.style.display = 'block';
|
|
behavior.show();
|
|
}
|
|
}
|
|
}
|
|
|
|
function CalendarItemMouseOver(sender, event, itemID, dayCounter) {
|
|
if (blockMenuSpawn)
|
|
return;
|
|
|
|
var controlID;
|
|
CalendarKAMMenu.eventID = itemID;
|
|
////58 is moduleId Please follow the format LiveEditControlModuleID_ItemId
|
|
controlID = 'LiveEditControl58_' + itemID + '_' + dayCounter;
|
|
var liveEditControl = $get(controlID);
|
|
var showLiveEditControls = getCookieValue('showLiveEditControls') == "true";
|
|
// Make sure previous KAMs are hidden if they need to be.
|
|
if (!showLiveEditControls) {
|
|
if (previousKAMControl)
|
|
previousKAMControl.style.display = 'none';
|
|
previousKAMControl = liveEditControl;
|
|
}
|
|
|
|
// Change z-index, for proper display.
|
|
var parentContainer = resolveLiveEditContainer(liveEditControl);
|
|
parentContainer.style.zIndex = 2;
|
|
if (document.getElementById('parentdiv' + itemID + '_' + dayCounter))
|
|
document.getElementById('parentdiv' + itemID + '_' + dayCounter).style.zIndex = 5;
|
|
|
|
// Move action category menu to container for category.
|
|
liveEditControl.appendChild(CalendarKAMMenu.elemItemMenu);
|
|
|
|
// Show tool-tip (if they are not disabled).
|
|
CalendarShowTooltip(controlID);
|
|
|
|
// Show KAM.
|
|
liveEditControl.style.display = 'block';
|
|
}
|
|
|
|
function CalendarShowTooltip(controlID) {
|
|
var liveEditControl = $get(controlID);
|
|
liveEditControl.appendChild(CalendarKAMMenu.elemTooltip);
|
|
|
|
if (CalendarKAMMenu.elemTooltip) {
|
|
if (showToolTip)
|
|
CalendarKAMMenu.elemTooltip.style.display = 'block';
|
|
else
|
|
CalendarKAMMenu.elemTooltip.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function CalendarItemMouseOut(sender, event, itemID, dayCounter) {
|
|
// Ignore when mouse leaves child controls within the live edit control.
|
|
event = (window.event ? window.event : event);
|
|
var toElement = (event.toElement ? event.toElement : event.relatedTarget);
|
|
|
|
if (!elemInsideOrEq(sender, toElement)) {
|
|
CalendarItemHideMenu(dayCounter);
|
|
}
|
|
}
|
|
|
|
|
|
function CalendarCategoryMouseOver(sender, event, categoryID, fromCalendarScreen) {
|
|
if (blockMenuSpawn)
|
|
return;
|
|
|
|
CalendarKAMMenu.calendarID = categoryID;
|
|
var controlID;
|
|
if (!fromCalendarScreen)
|
|
controlID = 'LiveEditControl_' + categoryID;
|
|
else
|
|
controlID = 'LiveEditControlCalendar_' + categoryID;
|
|
var liveEditControl = $get(controlID);
|
|
|
|
var showLiveEditControls = getCookieValue('showLiveEditControls') == "true";
|
|
// Make sure previous KAMs are hidden if they need to be.
|
|
if (!showLiveEditControls) {
|
|
if (previousKAMControl)
|
|
previousKAMControl.style.display = 'none';
|
|
previousKAMControl = liveEditControl;
|
|
}
|
|
|
|
// Move action category menu to container for category.
|
|
liveEditControl.appendChild(CalendarKAMMenu.elemCatMenu);
|
|
|
|
// Change z-index, for proper display.
|
|
var parentContainer = resolveLiveEditContainer(liveEditControl);
|
|
parentContainer.style.zIndex = 1;
|
|
|
|
// Show tool-tip (if they are not disabled).
|
|
CalendarShowTooltip(controlID);
|
|
|
|
// Show KAM.
|
|
liveEditControl.style.display = 'block';
|
|
}
|
|
|
|
// Summons action menu for a category.
|
|
function CalendarActionsCategory(calendarID, catElemID, updatePanelID, status, rights, fromCalendarScreen) {
|
|
CalendarKAMMenu.updatePanelID = updatePanelID;
|
|
CalendarKAMMenu.eventID = 0;
|
|
CalendarKAMMenu.calendarID = calendarID;
|
|
CalendarKAMMenu.counter = 0;
|
|
CalendarKAMMenu.status = status;
|
|
CalendarKAMMenu.rights = rights;
|
|
if (!fromCalendarScreen)
|
|
liveEditCommonCategory(
|
|
$get(catElemID),
|
|
CalendarKAMMenu.elemTooltip,
|
|
CalendarKAMMenu.elemCatMenu,
|
|
$get('LiveEditControl_' + calendarID), 'CalendarCategoryLiveEditMoreActions');
|
|
else
|
|
liveEditCommonCategory(
|
|
$get(catElemID),
|
|
CalendarKAMMenu.elemTooltip,
|
|
CalendarKAMMenu.elemCatMenu,
|
|
$get('LiveEditControlAlbum_' + calendarID), 'CalendarCategoryLiveEditMoreActions');
|
|
}
|
|
|
|
function CalendarCategoryMouseOut(sender, event) {
|
|
// Ignore when mouse leaves child controls within the live edit control.
|
|
event = (window.event ? window.event : event);
|
|
var toElement = (event.toElement ? event.toElement : event.relatedTarget);
|
|
var showLiveEditControls = getCookieValue('showLiveEditControls') == "true";
|
|
|
|
if (!elemInsideOrEq(sender, toElement))
|
|
CalendarCategoryHideMenu();
|
|
if (showLiveEditControls) {
|
|
var categoryID = CalendarKAMMenu.calendarID;
|
|
var controlID = 'LiveEditControl_' + categoryID;
|
|
$get(controlID).style.display = 'block';
|
|
}
|
|
}
|
|
|
|
function CalendarCategoryHideMenu() {
|
|
var categoryID = CalendarKAMMenu.calendarID;
|
|
var controlID = 'LiveEditControl_' + categoryID;
|
|
var controlIDAlbum = 'LiveEditControlAlbum_' + categoryID;
|
|
|
|
var liveEditControl = $get(controlID);
|
|
var liveEditControlAlbum = $get(controlIDAlbum);
|
|
|
|
if (!liveEditControl && !liveEditControlAlbum)
|
|
return;
|
|
|
|
// Change z-index, for proper display.
|
|
var parentContainer;
|
|
if (liveEditControl)
|
|
parentContainer = resolveLiveEditContainer(liveEditControl);
|
|
else
|
|
parentContainer = resolveLiveEditContainer(liveEditControlAlbum);
|
|
parentContainer.style.zIndex = 0;
|
|
|
|
// Hide action menu for category.
|
|
CalendarKAMMenu.elemCatMenu.style.display = 'none';
|
|
|
|
if (CalendarKAMMenu.elemCatMenu.parentNode) {
|
|
CalendarKAMMenu.elemCatMenu.parentNode.removeChild(CalendarKAMMenu.elemCatMenu);
|
|
CalendarKAMMenu.elemLiveEditBullpen.appendChild(CalendarKAMMenu.elemCatMenu);
|
|
}
|
|
|
|
// Hide any possibly visible tool-tip.
|
|
CalendarHideTooltip();
|
|
|
|
// Hide KAM unless KAMs are set to always show.
|
|
if (!showLiveEditControls) {
|
|
if (liveEditControlAlbum)
|
|
liveEditControlAlbum.style.display = 'none';
|
|
if (liveEditControl)
|
|
liveEditControl.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function CalendarItemHideMenu(dayCounter) {
|
|
var itemID = CalendarKAMMenu.eventID;
|
|
//58 is moduleId Please follow the format LiveEditControlModuleID_ItemId
|
|
var controlID = 'LiveEditControl58_' + itemID + '_' + dayCounter;
|
|
var liveEditControl = $get(controlID);
|
|
var showLiveEditControls = getCookieValue('showLiveEditControls') == "true";
|
|
|
|
if (!liveEditControl)
|
|
return;
|
|
|
|
// Change z-index, for proper display.
|
|
var parentContainer = resolveLiveEditContainer(liveEditControl);
|
|
parentContainer.style.zIndex = 0;
|
|
if (document.getElementById('parentdiv' + itemID + '_' + dayCounter))
|
|
document.getElementById('parentdiv' + itemID + '_' + dayCounter).style.zIndex = 1;
|
|
|
|
// Hide action menu for item.
|
|
CalendarKAMMenu.elemItemMenu.style.display = 'none';
|
|
|
|
if (CalendarKAMMenu.elemItemMenu.parentNode) {
|
|
CalendarKAMMenu.elemItemMenu.parentNode.removeChild(CalendarKAMMenu.elemItemMenu);
|
|
CalendarKAMMenu.elemLiveEditBullpen.appendChild(CalendarKAMMenu.elemItemMenu);
|
|
}
|
|
|
|
// Hide any possibly visible tool-tip.
|
|
CalendarHideTooltip();
|
|
|
|
// Hide KAM unless KAMs are set to always show.
|
|
if (!showLiveEditControls) {
|
|
liveEditControl.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
// Hides tool-tip text for a category.
|
|
function CalendarHideTooltip() {
|
|
if (CalendarKAMMenu.elemTooltip.parentNode)
|
|
CalendarKAMMenu.elemTooltip.parentNode.removeChild(CalendarKAMMenu.elemTooltip);
|
|
CalendarKAMMenu.elemTooltip.style.display = 'none';
|
|
}
|
|
|
|
function openSeriesModal(action, callback) {
|
|
openCpModal({
|
|
type: 'GET',
|
|
cache: true,
|
|
useIframe: false,
|
|
isFrontEnd: false,
|
|
draggable: true,
|
|
title: action + ' Recurring Event',
|
|
className: 'relatedDocuments',
|
|
url: '/Admin/Calendar/Modals/LiveEditAction?selectedAction=' + action,
|
|
onLoadComplete: function (data) {
|
|
$('a.button[data-action="cancel"]')
|
|
.click(function (e) {
|
|
e.preventDefault();
|
|
closeCpModal();
|
|
});
|
|
$('a.button[data-action="single"]')
|
|
.click(function (e) {
|
|
e.preventDefault();
|
|
callback();
|
|
closeCpModal();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function CalendarActionsInit() {
|
|
// Set up state variables (they change per item).
|
|
CalendarKAMMenu.updatePanelID = '';
|
|
CalendarKAMMenu.eventID = 0;
|
|
CalendarKAMMenu.calendarID = 0;
|
|
CalendarKAMMenu.counter = 0;
|
|
CalendarKAMMenu.order = 0;
|
|
CalendarKAMMenu.status = 0;
|
|
CalendarKAMMenu.rights = 0;
|
|
CalendarKAMMenu.dayCounter = 0;
|
|
CalendarKAMMenu.isRecurring = false;
|
|
|
|
// Get invisible bullpen (where hidden stuff is stored).
|
|
CalendarKAMMenu.elemLiveEditBullpen = $get('CalendarLiveEditBullpen');
|
|
|
|
// Set up KAM tooltip.
|
|
CalendarKAMMenu.elemTooltip = $get('CalendarLiveEditToolTip');
|
|
if (!showToolTip)
|
|
CalendarKAMMenu.elemTooltip.style.display = 'none';
|
|
|
|
// Set up category action menu.
|
|
CalendarKAMMenu.elemCatMenu = $get('CalendarCategoryLiveEditMoreActions');
|
|
|
|
CalendarKAMMenu.elemCatActionNew = $get('CalendarCategoryNewItem');
|
|
hookAnchorClick(CalendarKAMMenu.elemCatActionNew,
|
|
function (sender, eventArgs) {
|
|
CalendarCategoryHideMenu();
|
|
var updatePanel = (CalendarKAMMenu.updatePanelID + '').trim();
|
|
|
|
if (updatePanel == 'feature' || updatePanel == '')
|
|
openEditWindowCalendar(0, 0, 1, 0, 'feature');
|
|
else
|
|
openEditWindowCalendar(CalendarKAMMenu.calendarID, 0, 0, 0, CalendarKAMMenu.updatePanelID);
|
|
});
|
|
|
|
// Set up item action menu.
|
|
CalendarKAMMenu.elemItemMenu = $get('CalendarItemLiveEditMoreActions');
|
|
CalendarKAMMenu.elemItemActionModify = $get('CalendarItemModify');
|
|
CalendarKAMMenu.elemItemActionCommands = $get('CalendarItemCommands');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionModify,
|
|
function (sender, eventArgs) {
|
|
document.forms.aspnetForm.strActionFE.value = "";
|
|
if (!CalendarKAMMenu.elemItemActionModify.inactive) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Modify', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
openEditWindowCalendar(CalendarKAMMenu.calendarID, CalendarKAMMenu.eventID, 0, -1, CalendarKAMMenu.updatePanelID);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
openEditWindowCalendar(CalendarKAMMenu.calendarID, CalendarKAMMenu.eventID, 0, -1, CalendarKAMMenu.updatePanelID);
|
|
}
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionCopyLink = $get('CalendarItemCopyLink');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionCopyLink,
|
|
function (sender, eventArgs) {
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Link', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionUnpublish = $get('CalendarItemUnpublish');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionUnpublish,
|
|
function (sender, eventArgs) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Unpublish', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Unpublish', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Unpublish', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionPublish = $get('CalendarItemPublish');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionPublish,
|
|
function (sender, eventArgs) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Publish', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
var title = $('#eventTitle_' + CalendarKAMMenu.eventID).text();
|
|
title = title.replace(/^\[[A-Z]*\] /g, ''); //get rid of status at the beginning of title.
|
|
SetFieldForRssBehavior({ add: true, categoryId: CalendarKAMMenu.calendarID });
|
|
saveAndSendBE(CalendarKAMMenu.calendarID, CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID, title);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
var title = $('#eventTitle_' + CalendarKAMMenu.eventID).text();
|
|
title = title.replace(/^\[[A-Z]*\] /g, ''); //get rid of status at the beginning of title.
|
|
SetFieldForRssBehavior({ add: true, categoryId: CalendarKAMMenu.calendarID });
|
|
saveAndSendBE(CalendarKAMMenu.calendarID, CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID, title);
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionSubmit = $get('CalendarItemSubmit');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionSubmit,
|
|
function (sender, eventArgs) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Submit', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Submit', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Submit', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionCopy = $get('CalendarItemCopy');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionCopy,
|
|
function (sender, eventArgs) {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
|
|
if (CalendarKAMMenu.counter > 0)
|
|
openEditWindowCalendar(CalendarKAMMenu.calendarID, CalendarKAMMenu.eventID, 1, -1, CalendarKAMMenu.updatePanelID);
|
|
else
|
|
openEditWindowCalendar(CalendarKAMMenu.calendarID, CalendarKAMMenu.eventID, 1, -1, 'search');
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionArchive = $get('CalendarItemArchive');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionArchive,
|
|
function (sender, eventArgs) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Archive', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'archiveHidden', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'archiveHidden', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionDelete = $get('CalendarItemDelete');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionDelete,
|
|
function (sender, eventArgs) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Delete', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Delete', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Delete', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionNewAnchor = $get('CalendarItemNewItemAnchor');
|
|
CalendarKAMMenu.elemItemActionNew = $get('CalendarItemNewItem');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionNew,
|
|
function (sender, eventArgs) {
|
|
if (!CalendarKAMMenu.elemItemActionNew.inactive) {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
openEditWindowCalendar(CalendarKAMMenu.calendarID, 0, 0, CalendarKAMMenu.order, CalendarKAMMenu.updatePanelID);
|
|
}
|
|
});
|
|
|
|
CalendarKAMMenu.elemItemActionReject = $get('CalendarItemReject');
|
|
hookAnchorClick(CalendarKAMMenu.elemItemActionReject,
|
|
function (sender, eventArgs) {
|
|
if (CalendarKAMMenu.isRecurring) {
|
|
openSeriesModal('Decline', function () {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Reject', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
});
|
|
}
|
|
else {
|
|
CalendarItemHideMenu(CalendarKAMMenu.dayCounter);
|
|
CalendarEventModifyDelete(CalendarKAMMenu.calendarID, 'Reject', CalendarKAMMenu.updatePanelID, CalendarKAMMenu.eventID);
|
|
}
|
|
});
|
|
}
|
|
|
|
// Called when Notify Me pop-up is closed on the Front End.
|
|
function notifyMePopUpCallBack(frmMain, argument) {
|
|
var array = argument.split('_');
|
|
var comingFrom = array[0];
|
|
switch (comingFrom) {
|
|
case "LiveEdit":
|
|
CalendarEventModifyDelete(array[1], 'Publish', array[2], array[3]);
|
|
break;
|
|
default:
|
|
alert('Not callback provided to handle notifyme');
|
|
}
|
|
closeModalDialog('editItemBehavior');
|
|
}
|
|
|
|
function saveAndSendBE(catId, updatePanelID, eventID, title) {
|
|
var ifrID = document.getElementById('liveEditDialog');
|
|
var behaviorID = $find('editItemBehavior');
|
|
var argument = "LiveEdit_" + catId + "_" + updatePanelID + "_" + eventID;
|
|
if (behaviorID) {
|
|
setModalClass('notifyMe', behaviorID);
|
|
ifrID.src = '/common/admin/sendEmailBE.aspx?formName=aspnetForm&catId=' + catId + '&title=' + title + '&from=calendar&moduleName=calendar&comingFrom=' + argument + '&status=calendar';
|
|
ifrID.style.display = 'block';
|
|
behaviorID.show();
|
|
}
|
|
}
|
|
|
|
// Summons action menu for an item.
|
|
function CalendarActionItems(eventID, updatePanelID, calendarID, order, counter, status, rights, lastItem, dayCounter, isRecurring) {
|
|
|
|
CalendarKAMMenu.updatePanelID = updatePanelID;
|
|
CalendarKAMMenu.calendarID = calendarID;
|
|
CalendarKAMMenu.eventID = eventID;
|
|
CalendarKAMMenu.counter = counter;
|
|
CalendarKAMMenu.order = order;
|
|
CalendarKAMMenu.status = status;
|
|
CalendarKAMMenu.rights = rights;
|
|
CalendarKAMMenu.lastItem = lastItem;
|
|
CalendarKAMMenu.dayCounter = dayCounter;
|
|
CalendarKAMMenu.isRecurring = isRecurring;
|
|
|
|
// Determine if modify is available.
|
|
if (rights >= PUBLISHER || rights == AUTHOR && status < MIN_PUBLISHED) {
|
|
CalendarKAMMenu.elemItemActionModify.className = 'big modify';
|
|
CalendarKAMMenu.elemItemActionModify.title = '';
|
|
CalendarKAMMenu.elemItemActionModify.inactive = false;
|
|
}
|
|
else {
|
|
CalendarKAMMenu.elemItemActionModify.className = 'big modify inactive';
|
|
CalendarKAMMenu.elemItemActionModify.title = 'You do not have rights to modify this item.'
|
|
CalendarKAMMenu.elemItemActionModify.inactive = true;
|
|
}
|
|
|
|
// Determine visiblity of submit/reject/publish/unpublish.
|
|
CalendarKAMMenu.elemItemActionSubmit.style.display = 'none';
|
|
CalendarKAMMenu.elemItemActionReject.style.display = 'none';
|
|
CalendarKAMMenu.elemItemActionPublish.style.display = 'none';
|
|
CalendarKAMMenu.elemItemActionUnpublish.style.display = 'none';
|
|
|
|
if (rights > AUTHOR) {
|
|
if (status > MAX_DRAFT)
|
|
CalendarKAMMenu.elemItemActionUnpublish.style.display = '';
|
|
else
|
|
CalendarKAMMenu.elemItemActionPublish.style.display = '';
|
|
|
|
if (status == SUBMITTED)
|
|
CalendarKAMMenu.elemItemActionReject.style.display = '';
|
|
}
|
|
else if (status != SUBMITTED && status <= MAX_DRAFT)
|
|
CalendarKAMMenu.elemItemActionSubmit.style.display = '';
|
|
|
|
// Determine visiblity of delete/archive.
|
|
CalendarKAMMenu.elemItemActionArchive.style.display = 'none';
|
|
CalendarKAMMenu.elemItemActionDelete.style.display = 'none';
|
|
|
|
if (rights > AUTHOR) {
|
|
// Only publisher or higher can delete.
|
|
if (status > MAX_DRAFT)
|
|
CalendarKAMMenu.elemItemActionArchive.style.display = '';
|
|
else
|
|
CalendarKAMMenu.elemItemActionDelete.style.display = '';
|
|
}
|
|
else if (status <= MAX_DRAFT)
|
|
CalendarKAMMenu.elemItemActionDelete.style.display = '';
|
|
|
|
// Determine visiblity/behavior of new.
|
|
if (counter > 0) {
|
|
if (rights >= AUTHOR) {
|
|
CalendarKAMMenu.elemItemActionNew.style.display = '';
|
|
CalendarKAMMenu.elemItemActionNewAnchor.title = '';
|
|
CalendarKAMMenu.elemItemActionNewAnchor.className = 'addItem';
|
|
CalendarKAMMenu.elemItemActionNew.inactive = false;
|
|
}
|
|
else
|
|
CalendarKAMMenu.elemItemActionNew.style.display = 'none';
|
|
}
|
|
else if (counter > -2) {
|
|
CalendarKAMMenu.elemItemActionNew.style.display = '';
|
|
CalendarKAMMenu.elemItemActionNewAnchor.title = 'You cannot add item on search screen.';
|
|
CalendarKAMMenu.elemItemActionNewAnchor.className = 'addItem inactive';
|
|
CalendarKAMMenu.elemItemActionNew.inactive = true;
|
|
}
|
|
else
|
|
CalendarKAMMenu.elemItemActionNew.style.display = 'none';
|
|
|
|
// Apply even/odd classes.
|
|
var listItems = CalendarKAMMenu.elemItemActionCommands.firstChild;
|
|
var lc = 0;
|
|
|
|
while (listItems != null) {
|
|
if (listItems.nodeType == 1 && listItems.style.display != 'none')
|
|
listItems.className = (((++lc) % 2) == 0 ? 'even' : '');
|
|
listItems = listItems.nextSibling;
|
|
}
|
|
|
|
if ($get('item' + eventID) != null && $get('item' + eventID).style.zIndex == 4) {
|
|
$get('LiveEditControl58_' + eventID + '_' + CalendarKAMMenu.dayCounter).style.zIndex = 0;
|
|
var list = $('.CalendarItem');
|
|
for (var i = 0; i < list.length; i++) {
|
|
list[i].style.zIndex = 0;
|
|
}
|
|
}
|
|
else {
|
|
$get('LiveEditControl58_' + eventID + '_' + CalendarKAMMenu.dayCounter).style.zIndex = 4;
|
|
if ($get('item' + eventID) != null)
|
|
$get('item' + eventID).style.zIndex = 4;
|
|
}
|
|
|
|
// Show menu.
|
|
liveEditCommonItem(
|
|
CalendarKAMMenu.elemTooltip,
|
|
CalendarKAMMenu.elemItemMenu,
|
|
$get('LiveEditControl58_' + eventID + '_' + CalendarKAMMenu.dayCounter), 'CalendarItemLiveEditMoreActions', false); ////58 is moduleId Please follow the format LiveEditControlModuleID_ItemId
|
|
|
|
}
|
|
;
|
|
|