Fixes issue 129 - Bandwidth is now updated in the UI after changing it
This commit is contained in:
parent
bf8f799c4c
commit
d7fd5566a7
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue