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)
|
||||
{
|
||||
$passedArgsArray = array();
|
||||
$passedArgs = $this->passedArgs;
|
||||
if (!$all || !$this->_isSiteAdmin()) {
|
||||
$this->paginate['conditions'][] = array('ObjectTemplate.active' => 1);
|
||||
$this->set('all', false);
|
||||
} else {
|
||||
$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()) {
|
||||
$rules = $this->paginate;
|
||||
unset($rules['limit']);
|
||||
|
@ -180,6 +190,8 @@ class ObjectTemplatesController extends AppController
|
|||
$objectTemplates = $this->paginate();
|
||||
$this->set('list', $objectTemplates);
|
||||
}
|
||||
$this->set('passedArgs', json_encode($passedArgs));
|
||||
$this->set('passedArgsArray', $passedArgsArray);
|
||||
}
|
||||
|
||||
public function update($type = false, $force = false)
|
||||
|
|
|
@ -41,6 +41,12 @@
|
|||
'active' => $all
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'search',
|
||||
'button' => __('Filter'),
|
||||
'placeholder' => __('Enter value to search'),
|
||||
'data' => '',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -141,5 +147,17 @@ endforeach; ?>
|
|||
</ul>
|
||||
</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
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'objectTemplates', 'menuItem' => 'index'));
|
||||
|
|
Loading…
Reference in New Issue