2017-05-19 01:50:56 +08:00
|
|
|
function closeWindows() {
|
|
|
|
window.close();
|
|
|
|
// This is a hack. The only way to close an existing window is to try and open it!
|
|
|
|
var filterWindow = window.open( thisUrl+'?view=none', 'zmFilter', 'width=1,height=1' );
|
|
|
|
filterWindow.close();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function toggleCheckbox( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var checked = element.checked;
|
|
|
|
for (var i = 0; i < form.elements.length; i++)
|
|
|
|
if (form.elements[i].name.indexOf(name) == 0)
|
|
|
|
form.elements[i].checked = checked;
|
|
|
|
form.viewBtn.disabled = !checked;
|
|
|
|
form.editBtn.disabled = !checked;
|
|
|
|
form.archiveBtn.disabled = unarchivedEvents?!checked:true;
|
|
|
|
form.unarchiveBtn.disabled = archivedEvents?!checked:true;
|
2017-12-04 03:04:33 +08:00
|
|
|
form.downloadBtn.disabled = !checked;
|
2017-05-19 01:50:56 +08:00
|
|
|
form.exportBtn.disabled = !checked;
|
|
|
|
form.deleteBtn.disabled = !checked;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function configureButton( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var checked = element.checked;
|
|
|
|
if ( !checked ) {
|
|
|
|
for (var i = 0; i < form.elements.length; i++) {
|
|
|
|
if ( form.elements[i].name.indexOf(name) == 0) {
|
|
|
|
if ( form.elements[i].checked ) {
|
|
|
|
checked = true;
|
|
|
|
break;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
|
|
|
if ( !element.checked )
|
|
|
|
form.toggleCheck.checked = false;
|
|
|
|
form.viewBtn.disabled = !checked;
|
|
|
|
form.editBtn.disabled = !checked;
|
|
|
|
form.archiveBtn.disabled = (!checked)||(!unarchivedEvents);
|
|
|
|
form.unarchiveBtn.disabled = (!checked)||(!archivedEvents);
|
2017-12-04 03:04:33 +08:00
|
|
|
form.downloadBtn.disabled = !checked;
|
2017-05-19 01:50:56 +08:00
|
|
|
form.exportBtn.disabled = !checked;
|
|
|
|
form.deleteBtn.disabled = !checked;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function deleteEvents( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var count = 0;
|
|
|
|
for (var i = 0; i < form.elements.length; i++) {
|
|
|
|
if (form.elements[i].name.indexOf(name) == 0) {
|
|
|
|
if ( form.elements[i].checked ) {
|
|
|
|
count++;
|
|
|
|
break;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
|
|
|
if ( count > 0 ) {
|
|
|
|
if ( confirm( confirmDeleteEventsString ) ) {
|
|
|
|
form.action.value = 'delete';
|
|
|
|
form.submit();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function editEvents( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var eids = new Array();
|
|
|
|
for (var i = 0; i < form.elements.length; i++) {
|
|
|
|
if (form.elements[i].name.indexOf(name) == 0) {
|
|
|
|
if ( form.elements[i].checked ) {
|
|
|
|
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
|
|
|
createPopup( '?view=eventdetail&'+eids.join( '&' ), 'zmEventDetail', 'eventdetail' );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-12-04 03:04:33 +08:00
|
|
|
function downloadVideo( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var eids = new Array();
|
|
|
|
for (var i = 0; i < form.elements.length; i++) {
|
|
|
|
if (form.elements[i].name.indexOf(name) == 0) {
|
|
|
|
if ( form.elements[i].checked ) {
|
|
|
|
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
createPopup( '?view=download&'+eids.join( '&' ), 'zmDownload', 'download' );
|
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function exportEvents( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var eids = new Array();
|
|
|
|
for (var i = 0; i < form.elements.length; i++) {
|
|
|
|
if (form.elements[i].name.indexOf(name) == 0) {
|
|
|
|
if ( form.elements[i].checked ) {
|
|
|
|
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
|
|
|
createPopup( '?view=export&'+eids.join( '&' ), 'zmExport', 'export' );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function viewEvents( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
var events = new Array();
|
|
|
|
for (var i = 0; i < form.elements.length; i++) {
|
|
|
|
if ( form.elements[i].name.indexOf(name) == 0) {
|
|
|
|
if ( form.elements[i].checked ) {
|
|
|
|
events[events.length] = form.elements[i].value;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
|
|
|
if ( events.length > 0 ) {
|
2017-12-06 01:50:49 +08:00
|
|
|
let filter = '&filter[Query][terms][0][attr]=Id&filter[Query][terms][0][op]=%3D%5B%5D&filter[Query][terms][0][val]='+events.join('%2C');
|
|
|
|
window.location.href = thisUrl+'?view=event&eid='+events[0]+filter+sortQuery+'&page=1&play=1';
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function archiveEvents( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
form.action.value = 'archive';
|
|
|
|
form.submit();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function unarchiveEvents( element, name ) {
|
|
|
|
var form = element.form;
|
|
|
|
form.action.value = 'unarchive';
|
|
|
|
form.submit();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
if ( openFilterWindow ) {
|
|
|
|
//opener.location.reload(true);
|
|
|
|
createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' );
|
|
|
|
location.replace( '?view='+currentView+'&page='+thisPage+filterQuery );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-12-13 23:20:02 +08:00
|
|
|
|
|
|
|
function initPage () {
|
|
|
|
if (window.history.length == 1) {
|
|
|
|
$j('#controls').children().eq(0).html('<a href="#" onclick="window.close()">Close</a>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$j(document).ready(initPage);
|