Merge pull request #154 from WDKevin/modern
Add support to change order of monitors
This commit is contained in:
commit
08e224f2af
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
class MonitorsController extends AppController {
|
class MonitorsController extends AppController {
|
||||||
public $helpers = array('LiveStream');
|
public $helpers = array('LiveStream', 'Js'=>array('Jquery'));
|
||||||
|
|
||||||
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'), 'recursive' => -1);
|
$monitoroptions = array('fields' => array('Name', 'Id', 'Function', 'Enabled', 'Sequence'), '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) {
|
||||||
|
@ -173,6 +173,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function reorder() {
|
||||||
|
foreach ($this->data['Monitor'] as $key => $value) {
|
||||||
|
$this->log($value);
|
||||||
|
$this->Monitor->id = $value;
|
||||||
|
$this->Monitor->saveField('Sequence', $key + 1);
|
||||||
|
}
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
|
@ -3,9 +3,10 @@
|
||||||
echo $this->Html->link( 'Add Monitor', array('controller' => 'monitors', 'action' => 'add'));
|
echo $this->Html->link( 'Add Monitor', array('controller' => 'monitors', 'action' => 'add'));
|
||||||
$this->end();
|
$this->end();
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
|
||||||
|
<div class="row" id="monitors">
|
||||||
<?php foreach ($monitors as $monitor => $mon): ?>
|
<?php foreach ($monitors as $monitor => $mon): ?>
|
||||||
<div class="col-sm-6 col-md-3">
|
<div class="col-sm-6 col-md-3" id="Monitor_<?= $mon['Monitor']['Sequence']; ?>">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<?php
|
<?php
|
||||||
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled'])
|
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled'])
|
||||||
|
@ -22,3 +23,8 @@
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php unset($monitor); ?>
|
<?php unset($monitor); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->Js->get('#monitors');
|
||||||
|
$this->Js->sortable(array('complete' => '$.post("/monitors/reorder", $("#monitors").sortable("serialize"))',));
|
||||||
|
?>
|
Loading…
Reference in New Issue