Merge pull request #156 from WDKevin/modern
Delete multiple events at once
This commit is contained in:
commit
bd7cefcfda
|
@ -45,12 +45,7 @@ class AppController extends Controller {
|
|||
parent::beforeFilter();
|
||||
$this->loadModel('Config');
|
||||
$this->loadModel('AppModel');
|
||||
$this->Cookie->name = 'ZoneMinder';
|
||||
if (!$this->Cookie->read('zmBandwidth')) {
|
||||
$this->Cookie->write('zmBandwidth', 'low', false);
|
||||
}
|
||||
$this->set('zmBandwidth', $this->Cookie->read('zmBandwidth'));
|
||||
|
||||
$this->Cookie->name = 'ZoneMinder';
|
||||
|
||||
$configFile = "/usr/local/etc/zm.conf";
|
||||
$lines = file($configFile);
|
||||
|
@ -84,6 +79,14 @@ class AppController extends Controller {
|
|||
$this->set('zmVersion', $zmVersion);
|
||||
}
|
||||
|
||||
public function beforeRender() {
|
||||
parent::beforeRender();
|
||||
if (!$this->Cookie->read('zmBandwidth')) {
|
||||
$this->Cookie->write('zmBandwidth', 'low', false);
|
||||
}
|
||||
$this->set('zmBandwidth', $this->Cookie->read('zmBandwidth'));
|
||||
}
|
||||
|
||||
function extractNamedParams($mandatory, $optional = array()) {
|
||||
$params = $this->params['named'];
|
||||
|
||||
|
|
|
@ -2,17 +2,18 @@
|
|||
class BandwidthController extends AppController {
|
||||
|
||||
public function index() {
|
||||
$this->set('bandwidth', $this->Cookie->read('zmBandwidth'));
|
||||
|
||||
if (!empty($this->request->data)) {
|
||||
$bandwidth = $this->request->data['Bandwidth']['Bandwidth'];
|
||||
$this->Cookie->write('zmBandwidth', $bandwidth, false);
|
||||
if ($this->Cookie->read('zmBandwidth') == $bandwidth) {
|
||||
$this->set('bandwidth', $bandwidth);
|
||||
if ($this->Cookie->read('zmBandwidth') == $bandwidth) {
|
||||
$this->Session->setFlash('Successfully updated bandwidth');
|
||||
} else {
|
||||
$this->Session->setFlash('Failed to update bandwidth');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->set('bandwidth', $this->Cookie->read('zmBandwidth'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,13 @@ public function index() {
|
|||
return $this->redirect(array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function deleteSelected() {
|
||||
foreach($this->data['Events'] as $key => $value) {
|
||||
$this->Event->delete($value);
|
||||
}
|
||||
$this->redirect($this->referer());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
public function index() {
|
||||
$zmBandwidth = $this->Cookie->read('zmBandwidth');
|
||||
$this->set('width', Configure::read('ZM_WEB_LIST_THUMB_WIDTH'));
|
||||
$monitoroptions = array('fields' => array('Name', 'Id', 'Function', 'Enabled', 'Sequence'), 'order' => 'Sequence ASC', 'recursive' => -1);
|
||||
$monitoroptions = array('fields' => array('Name', 'Id', 'Function', 'Enabled', 'Sequence', 'Function'), 'order' => 'Sequence ASC', 'recursive' => -1);
|
||||
$this->set('monitors', $this->Monitor->find('all', $monitoroptions));
|
||||
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
||||
foreach ($monitors as $monitor => $mon) {
|
||||
|
|
|
@ -52,7 +52,8 @@ echo $this->Form->inputs(array(
|
|||
?>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php echo $this->Form->end(array('label' => 'Search', 'id' => 'EventsButtonSearch')); ?>
|
||||
<?php echo $this->Form->end(array('label' => 'Search', 'id' => 'EventsButtonSearch', 'class' => 'btn btn-default')); ?>
|
||||
<?php echo $this->Html->link('Delete Selected','#',array('class' => 'btn btn-default', 'onClick' => '$("#EventsDeleteSelectedForm").submit();')); ?>
|
||||
</div>
|
||||
|
||||
<?php $this->end(); ?>
|
||||
|
@ -61,13 +62,21 @@ echo $this->Form->inputs(array(
|
|||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||
</ul>
|
||||
|
||||
<?
|
||||
echo $this->Form->create('Events', array('action' => 'deleteSelected'));
|
||||
?>
|
||||
|
||||
<table class="table table-condensed table-striped" id="Events">
|
||||
<?php
|
||||
echo $this->Html->tableHeaders(array( 'Thumbnail', 'Id', 'Name', 'Monitor', 'Cause', 'Time', 'Duration', 'Alarm Frames', 'Total Score', 'Avg. Score', 'Max Score', '' ));
|
||||
echo $this->Html->tableHeaders(array('', 'Thumbnail', 'Id', 'Name', 'Monitor', 'Cause', 'Time', 'Duration', 'Alarm Frames', 'Total Score', 'Avg. Score', 'Max Score'));
|
||||
|
||||
foreach ($events as $key => $value) {
|
||||
echo $this->Html->tableCells(array(
|
||||
$this->Html->link($this->Html->image('/events/'.$thumbData[$key]['Path'], array(
|
||||
$this->Form->checkbox('delete.', array(
|
||||
'value' => $value['Event']['Id'],
|
||||
'hiddenField' => false
|
||||
)),
|
||||
$this->Html->link($this->Html->image('/events/'.$thumbData[$key]['Path'], array(
|
||||
'alt' => $thumbData[$key]['Frame']['FrameId'].'/'.$thumbData[$key]['Event']['MaxScore'],
|
||||
'width' => $thumbData[$key]['Width'],
|
||||
'height' => $thumbData[$key]['Height']
|
||||
|
@ -82,16 +91,16 @@ foreach ($events as $key => $value) {
|
|||
$value['Event']['AlarmFrames'],
|
||||
$value['Event']['TotScore'],
|
||||
$value['Event']['AvgScore'],
|
||||
$value['Event']['MaxScore'],
|
||||
$this->Form->postLink(
|
||||
'Delete',
|
||||
array('action' => 'delete', $value['Event']['Id']),
|
||||
array('confirm' => 'Are you sure?'))
|
||||
$value['Event']['MaxScore']
|
||||
));
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?
|
||||
echo $this->Form->end();
|
||||
?>
|
||||
|
||||
<ul class="pagination">
|
||||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||
</ul>
|
||||
</ul>
|
Loading…
Reference in New Issue