Fixes issue 129 - Bandwidth is now updated in the UI after changing it
This commit is contained in:
parent
bf8f799c4c
commit
d7fd5566a7
|
@ -46,11 +46,6 @@ class AppController extends Controller {
|
|||
$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'));
|
||||
|
||||
|
||||
$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,16 +2,17 @@
|
|||
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);
|
||||
$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