mirror of https://github.com/MISP/MISP
new: [UI] First version of the generic index list system
parent
0e4f66ee57
commit
f51eaa6c3c
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
echo h(Hash::extract($row, $field['data_path'])[0]);
|
||||
?>
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
$url_data = Hash::extract($row, $field['data_path']);
|
||||
$links = array();
|
||||
foreach ($url_data as $url) {
|
||||
$links[] = sprintf(
|
||||
'<a href="%s" title="%s">%s</a>',
|
||||
h($url['url']),
|
||||
h($url['name']),
|
||||
h($url['name'])
|
||||
);
|
||||
}
|
||||
echo implode('<br />', $links);
|
||||
?>
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
$headersHtml = '';
|
||||
foreach ($fields as $k => $header) {
|
||||
$header_data = '';
|
||||
if (!empty($header['sort'])) {
|
||||
if (!empty($header['name'])) {
|
||||
$header_data = $paginator->sort($header['sort'], $header['name']);
|
||||
} else {
|
||||
$header_data = $paginator->sort($header['sort']);
|
||||
}
|
||||
} else {
|
||||
$header_data = h($header['name']);
|
||||
}
|
||||
$headersHtml .= sprintf(
|
||||
'<th>%s</th>',
|
||||
$header_data
|
||||
);
|
||||
}
|
||||
echo $headersHtml;
|
||||
?>
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/*
|
||||
* echo $this->element('/genericElements/IndexTable/index_table', array(
|
||||
* 'top_bar' => (
|
||||
* // search/filter bar information compliant with ListTopBar
|
||||
* ),
|
||||
* 'data' => array(
|
||||
// the actual data to be used
|
||||
* ),
|
||||
* 'fields' => array(
|
||||
* // field list with information for the paginator, the elements used for the individual cells, etc
|
||||
* ),
|
||||
* 'title' => optional title,
|
||||
* 'description' => optional description
|
||||
* ));
|
||||
*
|
||||
*/
|
||||
if (!empty($data['title'])) {
|
||||
echo sprintf('<h2>%s</h2>', h($data['title']));
|
||||
}
|
||||
if (!empty($data['description'])) {
|
||||
echo sprintf('<p>%s</p>', h($data['description']));
|
||||
}
|
||||
echo $this->element('/genericElements/IndexTable/pagination', array('paginator' => $this->Paginator));
|
||||
if (!empty($data['top_bar'])) {
|
||||
echo $this->element('/genericElements/ListTopBar/scaffold', array('data' => $data['top_bar']));
|
||||
}
|
||||
$rows = '';
|
||||
foreach ($data['data'] as $k => $data_row) {
|
||||
$row_element = 'row';
|
||||
if (!empty($data['row_element'])) {
|
||||
$row_element = $data['row_element'];
|
||||
}
|
||||
$rows .= sprintf(
|
||||
'<tr>%s</tr>',
|
||||
$this->element('/genericElements/IndexTable/' . $row_element, array('k' => $k, 'row' => $data_row, 'fields' => $data['fields']))
|
||||
);
|
||||
}
|
||||
echo sprintf(
|
||||
'<table class="table table-striped table-hover table-condensed">%s%s</table>',
|
||||
$this->element('/genericElements/IndexTable/headers', array('fields' => $data['fields'], 'paginator' => $this->Paginator)),
|
||||
$rows
|
||||
);
|
||||
echo $this->element('/genericElements/IndexTable/pagination_counter', array('paginator' => $this->Paginator));
|
||||
echo $this->element('/genericElements/IndexTable/pagination', array('paginator' => $this->Paginator));
|
||||
?>
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
$paginator->options(array(
|
||||
'update' => '.span12',
|
||||
'evalScripts' => true,
|
||||
'before' => '$(".progress").show()',
|
||||
'complete' => '$(".progress").hide()',
|
||||
));
|
||||
sprintf(
|
||||
'<div class="pagination"><ul>%s%s%s</ul></div>',
|
||||
$paginator->prev('« ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span')),
|
||||
$paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span')),
|
||||
$paginator->next(__('next') . ' »', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'))
|
||||
);
|
||||
?>
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
echo sprintf(
|
||||
'<p>%s</p>',
|
||||
$paginator->counter(array(
|
||||
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
|
||||
))
|
||||
);
|
||||
?>
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
$rowHtml = '';
|
||||
foreach ($fields as $k => $field) {
|
||||
if (empty($field['element'])) {
|
||||
$valueField = $this->element('/genericElements/IndexTable/Fields/generic_field', array('field' => $field, 'row' => $row, 'data_path' => empty($field['data_path']) ? '' : $field['data_path']));
|
||||
} else {
|
||||
$valueField = $this->element('/genericElements/IndexTable/Fields/' . $field['element'], array('field' => $field, 'row' => $row, 'data_path' => empty($field['data_path']) ? '' : $field['data_path']));
|
||||
}
|
||||
$rowHtml .= sprintf(
|
||||
'<td%s%s%s%s%s>%s</td>',
|
||||
(empty($field['id'])) ? '' : sprintf('id="%s"', $field['id']),
|
||||
(empty($field['class'])) ? '' : sprintf(' class="%s"', $field['class']),
|
||||
(empty($field['style'])) ? '' : sprintf(' style="%s"', $field['style']),
|
||||
(empty($field['title'])) ? '' : sprintf(' title="%s"', $field['title']),
|
||||
(empty($field['ondblclick'])) ? '' : sprintf(' ondblclick="%s"', $field['ondblclick']),
|
||||
$valueField
|
||||
);
|
||||
}
|
||||
echo ($rowHtml);
|
||||
?>
|
|
@ -1,4 +1,16 @@
|
|||
<?php
|
||||
/*
|
||||
* Run a quick filter against the current API endpoint
|
||||
* Result is passed via URL parameters, by default using the searchall key
|
||||
* Valid parameters:
|
||||
* - data: data-* fields
|
||||
* - searchKey: data-search-key, specifying the key to be used (defaults to searchall)
|
||||
* - fa-icon: an icon to use for the lookup $button
|
||||
* - buttong: Text to use for the lookup button
|
||||
* - cancel: Button for quickly removing the filters
|
||||
* - placeholder: optional placeholder for the text field
|
||||
* - id: element ID for the input field - defaults to quickFilterField
|
||||
*/
|
||||
if (!isset($data['requirement']) || $data['requirement']) {
|
||||
$button = empty($data['button']) && empty($data['fa-icon']) ? '' : sprintf(
|
||||
'<button class=" btn btn-small btn-inverse" %s id="quickFilterButton">%s%s</button>',
|
||||
|
@ -10,10 +22,11 @@
|
|||
$button .= $this->element('/genericElements/ListTopBar/element_simple', array('data' => $data['cancel']));
|
||||
}
|
||||
$input = sprintf(
|
||||
'<input type="text" class="span3 input-small" placeholder="%s" aria-label="%s" style="padding: 2px 6px;" id="%s">',
|
||||
'<input type="text" class="span3 input-small" placeholder="%s" aria-label="%s" style="padding: 2px 6px;" id="%s" data-searchkey="%s">',
|
||||
empty($data['placeholder']) ? '' : h($data['placeholder']),
|
||||
empty($data['placeholder']) ? '' : h($data['placeholder']),
|
||||
empty($data['id']) ? 'quickFilterField' : h($data['id'])
|
||||
empty($data['id']) ? 'quickFilterField' : h($data['id']),
|
||||
empty($data['searchKey']) ? 'searchall' : h($data['searchKey'])
|
||||
);
|
||||
echo sprintf(
|
||||
'<div class="btn-group pull-right"><div class="input-append" style="margin-bottom:0px;">%s%s</div></div>',
|
||||
|
|
Loading…
Reference in New Issue