fix: [UI] Object template pagination

pull/7007/head
Jakub Onderka 2021-02-14 10:24:28 +01:00
parent ab1808a1ed
commit 23aedd7411
2 changed files with 19 additions and 32 deletions

View File

@ -2,15 +2,13 @@
<ul>
<?php
$this->Paginator->options(array(
'update' => '#clusters_div',
'evalScripts' => true,
'before' => '$(".progress").show()',
'complete' => '$(".progress").hide()',
'data-paginator' => '#ajaxContent',
));
echo $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
echo $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
$paginator = $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
$paginator .= $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
$paginator .= $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $paginator;
?>
</ul>
</div>
@ -25,18 +23,17 @@
<th><?php echo __('Sane defaults');?></th>
<th><?php echo __('List of valid Values');?></th>
<th><?php echo __('Disable correlation');?></th>
<th class="actions"><?php echo __('Actions');?></th>
</tr>
<?php
$listItems = array('category', 'sane_default', 'values_list');
foreach ($list as $k => $item):
?>
<tr>
<td class="short bold"><?php echo h($item['ObjectTemplateElement']['object_relation']); ?>&nbsp;</td>
<td class="short"><?php echo h($item['ObjectTemplateElement']['type']); ?>&nbsp;</td>
<td class="short"><span class="icon-<?php echo $item['ObjectTemplateElement']['multiple'] ? 'ok' : 'remove'; ?>"></span></td>
<td class="short"><?php echo h($item['ObjectTemplateElement']['ui-priority']); ?>&nbsp;</td>
<td><?php echo h($item['ObjectTemplateElement']['description']); ?>&nbsp;</td>
<td class="short bold"><?php echo h($item['ObjectTemplateElement']['object_relation']); ?></td>
<td class="short"><?php echo h($item['ObjectTemplateElement']['type']); ?></td>
<td class="short"><span class="fa fa-<?php echo $item['ObjectTemplateElement']['multiple'] ? 'check' : 'times'; ?>"></span></td>
<td class="short"><?php echo h($item['ObjectTemplateElement']['ui-priority']); ?></td>
<td><?php echo h($item['ObjectTemplateElement']['description']); ?></td>
<?php
foreach ($listItems as $listItem):
?>
@ -44,7 +41,7 @@
<?php
if (!empty($item['ObjectTemplateElement'][$listItem])) {
foreach ($item['ObjectTemplateElement'][$listItem] as $value) {
echo h($value) . '</br>';
echo h($value) . '<br>';
}
}
?>
@ -52,10 +49,7 @@
<?php
endforeach;
?>
<td class="short"><span class="icon-<?php echo empty($item['ObjectTemplateElement']['disable_correlation']) ? 'remove': 'ok'; ?>">&nbsp;</td>
<td class="short action-links">
&nbsp;
</td>
<td class="short"><span class="fa fa-<?php echo empty($item['ObjectTemplateElement']['disable_correlation']) ? 'times': 'check'; ?>"></td>
</tr>
<?php
endforeach;
@ -68,16 +62,7 @@
</p>
<div class="pagination">
<ul>
<?php
echo $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
echo $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
?>
<?= $paginator ?>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
});
</script>
<?php echo $this->Js->writeBuffer(); ?>

View File

@ -1,12 +1,14 @@
<?php
$table_data = array();
$table_data[] = array('key' => __('Id'), 'value' => $template['ObjectTemplate']['id']);
$table_data[] = array('key' => __('ID'), 'value' => $template['ObjectTemplate']['id']);
$table_data[] = array('key' => __('Name'), 'value' => $template['ObjectTemplate']['name'] ? $template['ObjectTemplate']['name'] : $template['ObjectTemplate']['type']);
$table_data[] = array('key' => __('Organisation'), 'value' => $template['Organisation']['name']);
$table_data[] = array('key' => __('UUID'), 'value' => $template['ObjectTemplate']['uuid']);
$table_data[] = array('key' => __('Version'), 'value' => $template['ObjectTemplate']['version']);
$table_data[] = array('key' => __('Meta-category'), 'value' => $template['ObjectTemplate']['meta-category']);
$table_data[] = array('key' => __('Description'), 'value' => $template['ObjectTemplate']['description']);
if (!empty($template['ObjectTemplate']['description'])) {
$table_data[] = array('key' => __('Description'), 'value' => $template['ObjectTemplate']['description']);
}
if (!empty($template['ObjectTemplate']['requirements'])) {
$requirements_contents = array();
foreach ($template['ObjectTemplate']['requirements'] as $group => $requirements) {
@ -23,7 +25,7 @@
);
}
}
$table_data[] = array('key' => __('Requirements'), 'html' => implode('<br />', $requirements_contents));
$table_data[] = array('key' => __('Requirements'), 'html' => implode('<br>', $requirements_contents));
}
echo sprintf(
'<div class="roles view"><div class="row-fluid"><div class="span8" style="margin:0px;">%s</div></div>%s</div>%s',
@ -42,7 +44,7 @@
<?php
$startingTab = 'all';
?>
$(document).ready(function () {
$(function () {
objectTemplateViewContent('<?php echo $startingTab; ?>', '<?php echo h($id);?>');
});
</script>