From ef1af9cc155e43747a7bf12179965b627e2432ca Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 9 Dec 2017 14:03:42 -0500 Subject: [PATCH] disable FilterComponent as it doesn't actually do anything. Add Groups join when needed --- .../app/Controller/Component/FilterComponent.php | 2 +- web/api/app/Controller/EventsController.php | 9 +++++---- web/api/app/Controller/MonitorsController.php | 14 ++++++-------- web/skins/classic/css/flat/control.css | 3 ++- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/web/api/app/Controller/Component/FilterComponent.php b/web/api/app/Controller/Component/FilterComponent.php index bf6e423f7..326c1ce45 100644 --- a/web/api/app/Controller/Component/FilterComponent.php +++ b/web/api/app/Controller/Component/FilterComponent.php @@ -21,7 +21,7 @@ class FilterComponent extends Component { $query = array($attribute => $array); array_push($conditions, $query); } else { - array_push($conditions, array($attribute => $value)); + $conditions[$attribute] = $value; } } diff --git a/web/api/app/Controller/EventsController.php b/web/api/app/Controller/EventsController.php index 27ee20e5d..0bd429139 100644 --- a/web/api/app/Controller/EventsController.php +++ b/web/api/app/Controller/EventsController.php @@ -41,8 +41,9 @@ class EventsController extends AppController { } if ($this->request->params['named']) { - $this->FilterComponent = $this->Components->load('Filter'); - $conditions = $this->FilterComponent->buildFilter($this->request->params['named']); + //$this->FilterComponent = $this->Components->load('Filter'); + //$conditions = $this->FilterComponent->buildFilter($this->request->params['named']); + $conditions = $this->request->params['named']; } else { $conditions = array(); } @@ -60,7 +61,7 @@ class EventsController extends AppController { 'order' => array('StartTime'), 'paramType' => 'querystring', ); - //if ( $this->request->params['GroupId'] ) { + if ( isset( $conditions['GroupId'] ) ) { $settings['joins'] = array( array( 'table' => 'Groups_Monitors', @@ -71,7 +72,7 @@ class EventsController extends AppController { ), ); $settings['contain'] = array('Group'); - //} + } $settings['conditions'] = array($conditions, $mon_options); // How many events to return diff --git a/web/api/app/Controller/MonitorsController.php b/web/api/app/Controller/MonitorsController.php index a49b022dc..af9cc8488 100644 --- a/web/api/app/Controller/MonitorsController.php +++ b/web/api/app/Controller/MonitorsController.php @@ -34,7 +34,8 @@ class MonitorsController extends AppController { if ($this->request->params['named']) { $this->FilterComponent = $this->Components->load('Filter'); - $conditions = $this->FilterComponent->buildFilter($this->request->params['named']); + //$conditions = $this->FilterComponent->buildFilter($this->request->params['named']); + $conditions = $this->request->params['named']; } else { $conditions = array(); } @@ -45,7 +46,7 @@ class MonitorsController extends AppController { } $find_array = array('conditions'=>$conditions,'contain'=>array('Group')); - //if ( $this->request->params['GroupId'] ) { + if ( isset( $conditions['GroupId'] ) ) { $find_array['joins'] = array( array( 'table' => 'Groups_Monitors', @@ -63,7 +64,7 @@ class MonitorsController extends AppController { //), //) ); - //} + } $monitors = $this->Monitor->find('all',$find_array); $this->set(array( 'monitors' => $monitors, @@ -84,12 +85,9 @@ class MonitorsController extends AppController { throw new NotFoundException(__('Invalid monitor')); } $allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY); - if (!empty($allowedMonitors)) - { + if (!empty($allowedMonitors)) { $restricted = array('Monitor.' . $this->Monitor->primaryKey => $allowedMonitors); - } - else - { + } else { $restricted = ''; } diff --git a/web/skins/classic/css/flat/control.css b/web/skins/classic/css/flat/control.css index 56fc0e41c..4a0f66761 100644 --- a/web/skins/classic/css/flat/control.css +++ b/web/skins/classic/css/flat/control.css @@ -2,6 +2,7 @@ vertical-align: top; margin: 10px auto 0; width: 500px; + min-height: 20px; } .ptzControls input.ptzTextBtn { @@ -75,7 +76,7 @@ width: 100px; } -.ptzControls .controlsPanel .pantiltPanel .pantiltControls .pantiltButtons { +.pantiltButtons { margin: 5px auto; border: 1px solid #006699; text-align: center;