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();
|
parent::beforeFilter();
|
||||||
$this->loadModel('Config');
|
$this->loadModel('Config');
|
||||||
$this->loadModel('AppModel');
|
$this->loadModel('AppModel');
|
||||||
$this->Cookie->name = 'ZoneMinder';
|
$this->Cookie->name = 'ZoneMinder';
|
||||||
if (!$this->Cookie->read('zmBandwidth')) {
|
|
||||||
$this->Cookie->write('zmBandwidth', 'low', false);
|
|
||||||
}
|
|
||||||
$this->set('zmBandwidth', $this->Cookie->read('zmBandwidth'));
|
|
||||||
|
|
||||||
|
|
||||||
$configFile = "/usr/local/etc/zm.conf";
|
$configFile = "/usr/local/etc/zm.conf";
|
||||||
$lines = file($configFile);
|
$lines = file($configFile);
|
||||||
|
@ -84,6 +79,14 @@ class AppController extends Controller {
|
||||||
$this->set('zmVersion', $zmVersion);
|
$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()) {
|
function extractNamedParams($mandatory, $optional = array()) {
|
||||||
$params = $this->params['named'];
|
$params = $this->params['named'];
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,18 @@
|
||||||
class BandwidthController extends AppController {
|
class BandwidthController extends AppController {
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
$this->set('bandwidth', $this->Cookie->read('zmBandwidth'));
|
|
||||||
|
|
||||||
if (!empty($this->request->data)) {
|
if (!empty($this->request->data)) {
|
||||||
$bandwidth = $this->request->data['Bandwidth']['Bandwidth'];
|
$bandwidth = $this->request->data['Bandwidth']['Bandwidth'];
|
||||||
$this->Cookie->write('zmBandwidth', $bandwidth, false);
|
$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');
|
$this->Session->setFlash('Successfully updated bandwidth');
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash('Failed to update bandwidth');
|
$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'));
|
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() {
|
public function index() {
|
||||||
$zmBandwidth = $this->Cookie->read('zmBandwidth');
|
$zmBandwidth = $this->Cookie->read('zmBandwidth');
|
||||||
$this->set('width', Configure::read('ZM_WEB_LIST_THUMB_WIDTH'));
|
$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));
|
$this->set('monitors', $this->Monitor->find('all', $monitoroptions));
|
||||||
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
||||||
foreach ($monitors as $monitor => $mon) {
|
foreach ($monitors as $monitor => $mon) {
|
||||||
|
|
|
@ -52,7 +52,8 @@ echo $this->Form->inputs(array(
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
<?php $this->end(); ?>
|
<?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')); ?>
|
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?
|
||||||
|
echo $this->Form->create('Events', array('action' => 'deleteSelected'));
|
||||||
|
?>
|
||||||
|
|
||||||
<table class="table table-condensed table-striped" id="Events">
|
<table class="table table-condensed table-striped" id="Events">
|
||||||
<?php
|
<?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) {
|
foreach ($events as $key => $value) {
|
||||||
echo $this->Html->tableCells(array(
|
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'],
|
'alt' => $thumbData[$key]['Frame']['FrameId'].'/'.$thumbData[$key]['Event']['MaxScore'],
|
||||||
'width' => $thumbData[$key]['Width'],
|
'width' => $thumbData[$key]['Width'],
|
||||||
'height' => $thumbData[$key]['Height']
|
'height' => $thumbData[$key]['Height']
|
||||||
|
@ -82,16 +91,16 @@ foreach ($events as $key => $value) {
|
||||||
$value['Event']['AlarmFrames'],
|
$value['Event']['AlarmFrames'],
|
||||||
$value['Event']['TotScore'],
|
$value['Event']['TotScore'],
|
||||||
$value['Event']['AvgScore'],
|
$value['Event']['AvgScore'],
|
||||||
$value['Event']['MaxScore'],
|
$value['Event']['MaxScore']
|
||||||
$this->Form->postLink(
|
|
||||||
'Delete',
|
|
||||||
array('action' => 'delete', $value['Event']['Id']),
|
|
||||||
array('confirm' => 'Are you sure?'))
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<?
|
||||||
|
echo $this->Form->end();
|
||||||
|
?>
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||||
</ul>
|
</ul>
|
Loading…
Reference in New Issue