mirror of https://github.com/MISP/MISP
new: [UI] Filter the object template index using the quick search
parent
80975bf7d3
commit
5b1697667f
|
@ -163,12 +163,22 @@ class ObjectTemplatesController extends AppController
|
||||||
|
|
||||||
public function index($all = false)
|
public function index($all = false)
|
||||||
{
|
{
|
||||||
|
$passedArgsArray = array();
|
||||||
|
$passedArgs = $this->passedArgs;
|
||||||
if (!$all || !$this->_isSiteAdmin()) {
|
if (!$all || !$this->_isSiteAdmin()) {
|
||||||
$this->paginate['conditions'][] = array('ObjectTemplate.active' => 1);
|
$this->paginate['conditions'][] = array('ObjectTemplate.active' => 1);
|
||||||
$this->set('all', false);
|
$this->set('all', false);
|
||||||
} else {
|
} else {
|
||||||
$this->set('all', true);
|
$this->set('all', true);
|
||||||
}
|
}
|
||||||
|
if (!empty($this->params['named']['searchall'])) {
|
||||||
|
$this->paginate['conditions']['AND']['OR'] = array(
|
||||||
|
'ObjectTemplate.uuid LIKE' => '%' . strtolower($this->params['named']['searchall']) . '%',
|
||||||
|
'LOWER(ObjectTemplate.name) LIKE' => '%' . strtolower($this->params['named']['searchall']) . '%',
|
||||||
|
'ObjectTemplate.meta-category LIKE' => '%' . strtolower($this->params['named']['searchall']) . '%',
|
||||||
|
'LOWER(ObjectTemplate.description) LIKE' => '%' . strtolower($this->params['named']['searchall']) . '%'
|
||||||
|
);
|
||||||
|
}
|
||||||
if ($this->_isRest()) {
|
if ($this->_isRest()) {
|
||||||
$rules = $this->paginate;
|
$rules = $this->paginate;
|
||||||
unset($rules['limit']);
|
unset($rules['limit']);
|
||||||
|
@ -180,6 +190,8 @@ class ObjectTemplatesController extends AppController
|
||||||
$objectTemplates = $this->paginate();
|
$objectTemplates = $this->paginate();
|
||||||
$this->set('list', $objectTemplates);
|
$this->set('list', $objectTemplates);
|
||||||
}
|
}
|
||||||
|
$this->set('passedArgs', json_encode($passedArgs));
|
||||||
|
$this->set('passedArgsArray', $passedArgsArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($type = false, $force = false)
|
public function update($type = false, $force = false)
|
||||||
|
|
|
@ -41,6 +41,12 @@
|
||||||
'active' => $all
|
'active' => $all
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'search',
|
||||||
|
'button' => __('Filter'),
|
||||||
|
'placeholder' => __('Enter value to search'),
|
||||||
|
'data' => '',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -141,5 +147,17 @@ endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#quickFilterButton').click(function() {
|
||||||
|
runIndexQuickFilter();
|
||||||
|
});
|
||||||
|
$('#quickFilterField').on('keypress', function (e) {
|
||||||
|
if(e.which === 13) {
|
||||||
|
runIndexQuickFilter();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'objectTemplates', 'menuItem' => 'index'));
|
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'objectTemplates', 'menuItem' => 'index'));
|
||||||
|
|
Loading…
Reference in New Issue