rough in new events view

This commit is contained in:
Andrew Bauer 2020-08-15 15:27:58 -05:00
parent e5046803b0
commit 45fde13535
12 changed files with 2891 additions and 250 deletions

4
web/css/font-awesome.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
.archived {
background-color: #f8f8f8;;
background-color: #ffc107;;
}
#contentTable.major .colTime {

View File

@ -86,6 +86,8 @@ echo output_cache_busted_stylesheet_links(array(
'css/reset.css',
'css/overlay.css',
'css/bootstrap.min.css',
'css/bootstrap.min.css',
'css/bootstrap-table.min.css',
));
echo output_link_if_exists(array(
@ -130,6 +132,8 @@ if ( $css != 'base' )
<script src="skins/<?php echo $skin; ?>/js/jquery.js"></script>
<script src="skins/<?php echo $skin; ?>/js/jquery-ui-1.12.1/jquery-ui.js"></script>
<script src="skins/<?php echo $skin; ?>/js/bootstrap.min.js"></script>
<script src="skins/<?php echo $skin; ?>/js/bootstrap-table.min.js"></script>
<script src="skins/<?php echo $skin; ?>/js/bootstrap-table-cookie.min.js"></script>
<script src="skins/<?php echo $skin; ?>/js/chosen/chosen.jquery.min.js"></script>
<script src="skins/<?php echo $skin; ?>/js/dateTimePicker/jquery-ui-timepicker-addon.js"></script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -98,49 +98,40 @@ xhtmlHeaders(__FILE__, translate('Events') );
<div id="page">
<?php echo getNavBarHTML() ?>
<div id="header">
<div id="info">
<h2><?php echo sprintf($CLANG['EventCount'], $nEvents, zmVlang($VLANG['Event'], $nEvents)) ?></h2>
<a id="refreshLink" href="#"><?php echo translate('Refresh') ?></a>
</div>
<div id="pagination">
<?php
if ( $pagination ) {
?>
<h2 class="pagination hidden-xs"><?php echo $pagination ?></h2>
<?php
}
?>
<?php
if ( $pages > 1 ) {
if ( !empty($page) ) {
?>
<a href="?view=<?php echo $view ?>&amp;page=0<?php echo $filterQuery ?><?php echo $sortQuery.$limitQuery ?>"><?php echo translate('ViewAll') ?></a>
<?php
} else {
?>
<a href="?view=<?php echo $view ?>&amp;page=1<?php echo $filterQuery ?><?php echo $sortQuery.$limitQuery ?>"><?php echo translate('ViewPaged') ?></a>
<?php
}
}
?>
</div>
<div id="controls">
<a href="#" id="backLink"><?php echo translate('Back') ?></a>
<a id="timelineLink" href="?view=timeline<?php echo $filterQuery ?>"><?php echo translate('ShowTimeline') ?></a>
</div>
<a href="#" id="backLink"><?php echo translate('Back') ?></a>
</div>
<div id="content">
<form name="contentForm" id="contentForm" method="post" action="">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value=""/>
<input type="hidden" name="page" value="<?php echo $page ?>"/>
<?php echo $_REQUEST['filter']['fields'] ?>
<input type="hidden" name="sort_field" value="<?php echo validHtmlStr($_REQUEST['sort_field']) ?>"/>
<input type="hidden" name="sort_asc" value="<?php echo validHtmlStr($_REQUEST['sort_asc']) ?>"/>
<input type="hidden" name="limit" value="<?php echo $limit ?>"/>
<div class="table-responsive-sm">
<table id="contentTable" class="major">
<tbody>
<div id="toolbar">
<button id="viewBtn" class="btn btn-primary btn-sm" disabled><i class="fa fa-binoculars"></i> View</button>
<button id="archiveBtn" class="btn btn-primary btn-sm" disabled><i class="fa fa-archive"></i> Archive</button>
<button id="unarchiveBtn" class="btn btn-primary btn-sm" disabled><i class="fa fa-file-archive-o"></i> Unarchive</button>
<button id="editBtn" class="btn btn-primary btn-sm" disabled><i class="fa fa-pencil"></i> Edit</button>
<button id="exportBtn" class="btn btn-primary btn-sm" disabled><i class="fa fa-external-link"></i> Export</button>
<button id="downloadBtn" class="btn btn-primary btn-sm" disabled><i class="fa fa-download"></i> Download Video</button>
<button id="deleteBtn" class="btn btn-danger btn-sm" disabled><i class="fa fa-trash"></i> Delete</button>
</div>
<div class="table-responsive-sm p-3">
<table
id="eventTable"
data-toggle="table"
data-pagination="true"
data-search="true"
data-cookie="true"
data-cookie-id-table="zmEventTable"
data-click-to-select="true"
data-remember-order="true"
data-show-columns="true"
data-uncheckAll="true"
data-toolbar="#toolbar"
data-show-fullscreen="true"
data-click-to-select="true"
data-maintain-meta-data="true"
data-mobile-responsive="true"
class="table-sm table-borderless">
<thead>
<?php
$count = 0;
$disk_space_total = 0;
@ -156,51 +147,56 @@ while ( $event_row = dbFetchNext($results) ) {
if ( ($count++%ZM_WEB_EVENTS_PER_PAGE) == 0 ) {
?>
<tr>
<th class="colId"><a href="<?php echo sortHeader('Id') ?>"><?php echo translate('Id') ?><?php echo sortTag('Id') ?></a></th>
<th class="colName px-1"><a href="<?php echo sortHeader('Name') ?>"><?php echo translate('Name') ?><?php echo sortTag('Name') ?></a></th>
<th class="colMonitor px-1"><a href="<?php echo sortHeader('MonitorName') ?>"><?php echo translate('Monitor') ?><?php echo sortTag('MonitorName') ?></a></th>
<th class="colCause px-1"><a href="<?php echo sortHeader('Cause') ?>"><?php echo translate('Cause') ?><?php echo sortTag('Cause') ?></a></th>
<th class="colStartTime px-1"><a href="<?php echo sortHeader('StartTime') ?>"><?php echo translate('AttrStartTime') ?><?php echo sortTag('StartTime') ?></a></th>
<th class="colEndTime px-1"><a href="<?php echo sortHeader('EndTime') ?>"><?php echo translate('AttrEndTime') ?><?php echo sortTag('EndTime') ?></a></th>
<th class="colDuration px-1"><a href="<?php echo sortHeader('Length') ?>"><?php echo translate('Duration') ?><?php echo sortTag('Length') ?></a></th>
<th class="colFrames px-1"><a href="<?php echo sortHeader('Frames') ?>"><?php echo translate('Frames') ?><?php echo sortTag('Frames') ?></a></th>
<th class="colAlarmFrames px-1"><a href="<?php echo sortHeader('AlarmFrames') ?>"><?php echo translate('AlarmBrFrames') ?><?php echo sortTag('AlarmFrames') ?></a></th>
<th class="colTotScore px-1"><a href="<?php echo sortHeader('TotScore') ?>"><?php echo translate('TotalBrScore') ?><?php echo sortTag('TotScore') ?></a></th>
<th class="colAvgScore px-1"><a href="<?php echo sortHeader('AvgScore') ?>"><?php echo translate('AvgBrScore') ?><?php echo sortTag('AvgScore') ?></a></th>
<th class="colMaxScore px-1"><a href="<?php echo sortHeader('MaxScore') ?>"><?php echo translate('MaxBrScore') ?><?php echo sortTag('MaxScore') ?></a></th>
<th data-sortable="false" data-field="toggleCheck" data-field="state" data-checkbox="true" name="toggleCheck" value="1" data-checkbox-name="eids[]" data-on-click-this="updateFormCheckboxesByName"></th>
<th data-sortable="true" data-field="Id"><?php echo translate('Id') ?></th>
<th data-sortable="true" data-field="Name"><?php echo translate('Name') ?></th>
<th data-sortable="true" data-field="Archived"><?php echo translate('Archived') ?></th>
<th data-sortable="true" data-field="Monitor"><?php echo translate('Monitor') ?></th>
<th data-sortable="true" data-field="Cause"><?php echo translate('Cause') ?></th>
<th data-sortable="true" data-field="AttrStartTime"><?php echo translate('AttrStartTime') ?></th>
<th data-sortable="true" data-field="AttrEndTime"><?php echo translate('AttrEndTime') ?></th>
<th data-sortable="true" data-field="Duration"><?php echo translate('Duration') ?></th>
<th data-sortable="true" data-field="Frames"><?php echo translate('Frames') ?></th>
<th data-sortable="true" data-field="AlarmBrFrames"><?php echo translate('AlarmBrFrames') ?></th>
<th data-sortable="true" data-field="TotalBrScore"><?php echo translate('TotalBrScore') ?></th>
<th data-sortable="true" data-field="AvgBrScore"><?php echo translate('AvgBrScore') ?></th>
<th data-sortable="true" data-field="MaxBrScore"><?php echo translate('MaxBrScore') ?></th>
<?php
if ( count($storage_areas) > 1 ) {
?>
<th class="colStorage px-1"><?php echo translate('Storage') ?></th>
<th data-sortable="true" data-field="Storage"><?php echo translate('Storage') ?></th>
<?php
}
if ( ZM_WEB_EVENT_DISK_SPACE ) {
?>
<th class="colDiskSpace px-1"><a href="<?php echo sortHeader('DiskSpace') ?>"><?php echo translate('DiskSpace') ?><?php echo sortTag('DiskSpace') ?></a></th>
<th data-sortable="true" data-field="DiskSpace"><?php echo translate('DiskSpace') ?></th>
<?php
}
if ( ZM_WEB_LIST_THUMBS ) {
?>
<th class="colThumbnail px-1"><?php echo translate('Thumbnail') ?></th>
<th data-sortable="false" data-field="Thumbnail"><?php echo translate('Thumbnail') ?></th>
<?php
}
?>
<th class="colMark px-1"><input type="checkbox" name="toggleCheck" value="1" data-checkbox-name="eids[]" data-on-click-this="updateFormCheckboxesByName"/></th>
</tr>
</thead>
<tbody>
<?php
}
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
?>
<tr<?php if ($event->Archived()) echo ' class="archived"' ?>>
<td class="colId"><a href="?view=event&amp;eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&amp;page=1">'.$event->Id().($event->Archived()?'*':'') ?></a></td>
<td class="colName px-1"><a href="?view=event&amp;eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&amp;page=1">'.validHtmlStr($event->Name()).($event->Archived()?'*':'') ?></a><br/>
<tr<?php echo ( $event->Archived() ) ? ' class="archived"' : '' ?>>
<td data-checkbox="true"></td>
<td><a href="?view=event&amp;eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&amp;page=1">'.$event->Id() ?></a></td>
<td><a href="?view=event&amp;eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&amp;page=1">'.validHtmlStr($event->Name()).($event->Archived()?'*':'') ?></a><br/>
<?php
if ( $event->Emailed() )
echo 'Emailed ';
?>
</td>
<td class="colMonitorName px-1"><?php echo makePopupLink( '?view=monitor&amp;mid='.$event->MonitorId(), 'zmMonitor'.$event->MonitorId(), 'monitor', $event->MonitorName(), canEdit( 'Monitors' ) ) ?></td>
<td class="colCause px-1"><?php echo makePopupLink( '?view=eventdetail&amp;eid='.$event->Id(), 'zmEventDetail', 'eventdetail', validHtmlStr($event->Cause()), canEdit( 'Events' ), 'title="'.htmlspecialchars($event->Notes()).'"' ) ?>
<td><?php echo ( $event->Archived() ) ? 'Yes' : 'No' ?></td>
<td><?php echo makePopupLink( '?view=monitor&amp;mid='.$event->MonitorId(), 'zmMonitor'.$event->MonitorId(), 'monitor', $event->MonitorName(), canEdit( 'Monitors' ) ) ?></td>
<td><?php echo makePopupLink( '?view=eventdetail&amp;eid='.$event->Id(), 'zmEventDetail', 'eventdetail', validHtmlStr($event->Cause()), canEdit( 'Events' ), 'title="'.htmlspecialchars($event->Notes()).'"' ) ?>
<?php
# display notes as small text
if ( $event->Notes() ) {
@ -216,25 +212,25 @@ while ( $event_row = dbFetchNext($results) ) {
}
?>
</td>
<td class="colTime text-wrap px-1"><?php echo strftime(STRF_FMT_DATETIME_SHORTER, strtotime($event->StartTime())) ?></td>
<td class="colTime text-wrap px-1"><?php echo strftime(STRF_FMT_DATETIME_SHORTER, strtotime($event->EndTime()) ) ?></td>
<td class="colDuration px-1"><?php echo gmdate("H:i:s", $event->Length() ) ?></td>
<td class="colFrames px-1"><?php echo makePopupLink( '?view=frames&amp;eid='.$event->Id(), 'zmFrames',
<td><?php echo strftime(STRF_FMT_DATETIME_SHORTER, strtotime($event->StartTime())) ?></td>
<td><?php echo strftime(STRF_FMT_DATETIME_SHORTER, strtotime($event->EndTime()) ) ?></td>
<td><?php echo gmdate("H:i:s", $event->Length() ) ?></td>
<td><?php echo makePopupLink( '?view=frames&amp;eid='.$event->Id(), 'zmFrames',
( ZM_WEB_LIST_THUMBS ? array('frames', ZM_WEB_LIST_THUMB_WIDTH, ZM_WEB_LIST_THUMB_HEIGHT) : 'frames'),
$event->Frames() ) ?></td>
<td class="colAlarmFrames px-1"><?php echo makePopupLink( '?view=frames&amp;eid='.$event->Id(), 'zmFrames',
<td><?php echo makePopupLink( '?view=frames&amp;eid='.$event->Id(), 'zmFrames',
( ZM_WEB_LIST_THUMBS ? array('frames', ZM_WEB_LIST_THUMB_WIDTH, ZM_WEB_LIST_THUMB_HEIGHT) : 'frames'),
$event->AlarmFrames() ) ?></td>
<td class="colTotScore px-1"><?php echo $event->TotScore() ?></td>
<td class="colAvgScore px-1"><?php echo $event->AvgScore() ?></td>
<td class="colMaxScore px-1"><?php echo makePopupLink(
<td><?php echo $event->TotScore() ?></td>
<td><?php echo $event->AvgScore() ?></td>
<td><?php echo makePopupLink(
'?view=frame&amp;eid='.$event->Id().'&amp;fid=0', 'zmImage',
array('image', reScale($event->Width(), $scale), reScale($event->Height(), $scale)), $event->MaxScore()
); ?></td>
<?php
if ( count($storage_areas) > 1 ) {
?>
<td class="colStorage px-1">
<td>
<?php
if ( $event->StorageId() ) {
echo isset($StorageById[$event->StorageId()]) ? $StorageById[$event->StorageId()]->Name() : 'Unknown Storage Id: '.$event->StorageId();
@ -252,11 +248,11 @@ while ( $event_row = dbFetchNext($results) ) {
if ( ZM_WEB_EVENT_DISK_SPACE ) {
$disk_space_total += $event->DiskSpace();
?>
<td class="colDiskSpace px-1"><?php echo human_filesize($event->DiskSpace()) ?></td>
<td class="colDiskSpace"><?php echo human_filesize($event->DiskSpace()) ?></td>
<?php
}
if ( ZM_WEB_LIST_THUMBS ) {
echo '<td class="colThumbnail px-1 zoom">';
echo '<td class="colThumbnail zoom">';
$imgSrc = $event->getThumbnailSrc(array(),'&amp;');
$streamSrc = $event->getStreamSrc(array(
'mode'=>'jpeg', 'scale'=>$scale, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'replay'=>'single', 'rate'=>'400'), '&amp;');
@ -266,7 +262,6 @@ while ( $event_row = dbFetchNext($results) ) {
echo '</td>';
} // end if ZM_WEB_LIST_THUMBS
?>
<td class="colMark px-1"><input type="checkbox" name="eids[]" value="<?php echo $event->Id() ?>"/></td>
</tr>
<?php
}
@ -300,39 +295,7 @@ while ( $event_row = dbFetchNext($results) ) {
}
?>
</table>
</div>
<?php
if ( $pagination ) {
?>
<h3 class="pagination"><?php echo $pagination ?></h3>
<?php
}
?>
<div id="contentButtons">
<button type="button" name="viewBtn" value="View" data-on-click-this="viewEvents" disabled="disabled">
<?php echo translate('View') ?>
</button>
<button type="button" name="archiveBtn" value="Archive" data-on-click-this="archiveEvents" disabled="disabled">
<?php echo translate('Archive') ?>
</button>
<button type="button" name="unarchiveBtn" value="Unarchive" data-on-click-this="unarchiveEvents" disabled="disabled">
<?php echo translate('Unarchive') ?>
</button>
<button type="button" name="editBtn" value="Edit" data-on-click-this="editEvents" disabled="disabled">
<?php echo translate('Edit') ?>
</button>
<button type="button" name="exportBtn" value="Export" data-on-click-this="exportEvents" disabled="disabled">
<?php echo translate('Export') ?>
</button>
<button type="button" name="downloadBtn" value="DownloadVideo" data-on-click-this="downloadVideo" disabled="disabled">
<?php echo translate('DownloadVideo') ?>
</button>
<button type="button" name="deleteBtn" value="Delete" data-on-click-this="deleteEvents" disabled="disabled">
<?php echo translate('Delete') ?>
</button>
</div>
</form>
</div>
</div>
</div>
<script nonce="<?php echo $cspNonce;?>">
// These are defined in the .js.php but need to be updated down here.

View File

@ -5,156 +5,34 @@ function closeWindows() {
filterWindow.close();
}
function setButtonStates( element ) {
var form = element.form;
var checked = element.checked;
form.viewBtn.disabled = !(canViewEvents && checked);
form.editBtn.disabled = !(canEditEvents && checked);
form.archiveBtn.disabled = unarchivedEvents?!checked:true;
form.unarchiveBtn.disabled = !(canEditEvents && archivedEvents && checked);
form.downloadBtn.disabled = !(canViewEvents && checked);
form.exportBtn.disabled = !(canViewEvents && checked);
form.deleteBtn.disabled = !(canEditEvents && checked);
}
function configureButton(event) {
var element = event.target;
var form = element.form;
var checked = element.checked;
if ( !checked ) {
for (var i = 0, len=form.elements.length; i < len; i++) {
if ( form.elements[i].name.indexOf('eids') == 0) {
if ( form.elements[i].checked ) {
checked = true;
break;
}
}
}
}
if ( !element.checked ) {
form.toggleCheck.checked = false;
}
form.viewBtn.disabled = !(canViewEvents && checked);
form.editBtn.disabled = !(canEditEvents && checked);
form.archiveBtn.disabled = (!checked)||(!unarchivedEvents);
form.unarchiveBtn.disabled = !(canEditEvents && checked && archivedEvents);
form.downloadBtn.disabled = !(canViewEvents && checked);
form.exportBtn.disabled = !(canViewEvents && checked);
form.deleteBtn.disabled = !(canEditEvents && checked);
}
function deleteEvents( element ) {
if ( ! canEditEvents ) {
alert("You do not have permission to delete events.");
return;
}
var form = element.form;
var count = 0;
// This is slightly more efficient than a jquery selector because we stop after finding one.
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf('eids') == 0) {
if ( form.elements[i].checked ) {
count++;
break;
}
}
}
if ( count > 0 ) {
if ( confirm(confirmDeleteEventsString) ) {
form.elements['action'].value = 'delete';
form.submit();
}
}
}
function editEvents( element ) {
if ( ! canEditEvents ) {
alert("You do not have permission to delete events.");
return;
}
var form = element.form;
var eids = new Array();
for (var i = 0, len=form.elements.length; i < len; i++) {
if (form.elements[i].name.indexOf('eids') == 0) {
if ( form.elements[i].checked ) {
eids[eids.length] = 'eids[]='+form.elements[i].value;
}
}
}
createPopup('?view=eventdetail&'+eids.join('&'), 'zmEventDetail', 'eventdetail');
}
function downloadVideo( element ) {
var form = element.form;
var eids = new Array();
for (var i = 0, len=form.elements.length; i < len; i++) {
if (form.elements[i].name.indexOf('eids') == 0 ) {
if ( form.elements[i].checked ) {
eids[eids.length] = 'eids[]='+form.elements[i].value;
}
}
}
createPopup( '?view=download&'+eids.join('&'), 'zmDownload', 'download' );
}
function exportEvents( element ) {
var form = element.form;
console.log(form);
form.action = '?view=export';
form.elements['view'].value='export';
form.submit();
}
function viewEvents( element ) {
var form = element.form;
var events = new Array();
for (var i = 0, len=form.elements.length; i < len; i++) {
if ( form.elements[i].name.indexOf('eids') == 0 ) {
if ( form.elements[i].checked ) {
events[events.length] = form.elements[i].value;
}
}
}
if ( events.length > 0 ) {
var 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';
}
}
function archiveEvents(element) {
var form = element.form;
form.elements['action'].value = 'archive';
form.submit();
}
function unarchiveEvents(element) {
if ( ! canEditEvents ) {
alert("You do not have permission to delete events.");
return;
}
var form = element.form;
form.elements['action'].value = 'unarchive';
form.submit();
}
if ( openFilterWindow ) {
//opener.location.reload(true);
createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' );
location.replace( '?view='+currentView+'&page='+thisPage+filterQuery );
}
function thumbnail_onmouseover(event) {
var img = event.target;
img.src = '';
img.src = img.getAttribute('stream_src');
}
function thumbnail_onmouseout(event) {
var img = event.target;
img.src = '';
img.src = img.getAttribute('still_src');
}
function getIdSelections() {
var table = $j('#eventTable');
return $j.map(table.bootstrapTable('getSelections'), function (row) {
return row.Id.replace(/(<([^>]+)>)/gi, "") // strip the html from the element before sending
})
}
function getArchivedSelections() {
var table = $j('#eventTable');
var selection = $j.map(table.bootstrapTable('getSelections'), function (row) {
return row.Archived
})
return selection.includes("Yes")
}
function initPage() {
if ( window.history.length == 1 ) {
$j('#controls').children().eq(0).html('');
@ -163,9 +41,6 @@ function initPage() {
this.addEventListener('mouseover', thumbnail_onmouseover, false);
this.addEventListener('mouseout', thumbnail_onmouseout, false);
});
$j('input[name=eids\\[\\]]').each(function() {
this.addEventListener('click', configureButton, false);
});
document.getElementById("refreshLink").addEventListener("click", function onRefreshClick(evt) {
evt.preventDefault();
window.location.reload(true);
@ -174,6 +49,110 @@ function initPage() {
evt.preventDefault();
window.history.back();
});
// Manage the VIEW button
document.getElementById("viewBtn").addEventListener("click", function onViewClick(evt) {
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
var filter = '&filter[Query][terms][0][attr]=Id&filter[Query][terms][0][op]=%3D%5B%5D&filter[Query][terms][0][val]='+selections.join('%2C');
window.location.href = thisUrl+'?view=event&eid='+selections[0]+filter+sortQuery+'&page=1&play=1';
});
// Manage the ARCHIVE button
document.getElementById("archiveBtn").addEventListener("click", function onArchiveClick(evt) {
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
$j.getJSON(thisUrl + '?view=events&action=archive&eids_json='+JSON.stringify(selections));
window.location.reload(true);
});
// Manage the UNARCHIVE button
document.getElementById("unarchiveBtn").addEventListener("click", function onUnarchiveClick(evt) {
if ( ! canEditEvents ) {
alert("You do not have permission to Unarchive events.");
return;
}
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
$j.getJSON(thisUrl + '?view=events&action=unarchive&eids_json='+JSON.stringify(selections));
if ( openFilterWindow ) {
//opener.location.reload(true);
createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' );
location.replace( '?view='+currentView+'&page='+thisPage+filterQuery );
} else {
window.location.reload(true);
}
});
// Manage the EDIT button
document.getElementById("editBtn").addEventListener("click", function onEditClick(evt) {
if ( ! canEditEvents ) {
alert("You do not have permission to edit events.");
return;
}
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
createPopup('?view=eventdetail&eids[]='+selections.join('&eids[]='), 'zmEventDetail', 'eventdetail');
});
// Manage the EXPORT button
document.getElementById("exportBtn").addEventListener("click", function onExportClick(evt) {
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
window.location.assign('?view=export&eids[]='+selections.join('&eids[]='));
});
// Manage the DOWNLOAD VIDEO button
document.getElementById("downloadBtn").addEventListener("click", function onDownloadClick(evt) {
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
createPopup('?view=download&eids[]='+selections.join('&eids[]='), 'zmDownload', 'download');
});
// Manage the DELETE button
document.getElementById("deleteBtn").addEventListener("click", function onDeleteClick(evt) {
if ( ! canEditEvents ) {
alert("You do not have permission to delete events.");
return;
}
var table = $j('#eventTable');
var selections = getIdSelections();
evt.preventDefault();
$j.getJSON(thisUrl + '?view=events&action=delete&eids[]='+selections.join('&eids[]='));
window.location.reload(true);
});
}
$j(document).ready(initPage);
$j(document).ready(function() {
initPage();
var viewBtn = $j('#viewBtn');
var archiveBtn = $j('#archiveBtn');
var unarchiveBtn = $j('#unarchiveBtn');
var editBtn = $j('#editBtn');
var exportBtn = $j('#exportBtn');
var downloadBtn = $j('#downloadBtn');
var deleteBtn = $j('#deleteBtn');
var table = $j('#eventTable');
table.bootstrapTable('hideColumn', 'Archived')
table.on('check.bs.table uncheck.bs.table ' +
'check-all.bs.table uncheck-all.bs.table',
function () {
viewBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canViewEvents));
archiveBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canEditEvents));
unarchiveBtn.prop('disabled', !(getArchivedSelections()) && canEditEvents);
editBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canEditEvents));
exportBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canViewEvents));
downloadBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canViewEvents));
deleteBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canEditEvents));
})
});