mirror of https://github.com/MISP/MISP
chg: migrate /templates/view/:id to view factory
parent
2e8e013cd0
commit
d55a689ce3
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
if (!empty($data['TemplateTag'])) {
|
||||
foreach ($data['TemplateTag'] as $tag) {
|
||||
?>
|
||||
<span class="tagComplete" style="background-color:<?php echo h($tag['Tag']['colour']); ?>;color:<?php echo $this->TextColour->getTextColour($tag['Tag']['colour']); ?>"><?php echo h($tag['Tag']['name']); ?></span>
|
||||
<?php
|
||||
}
|
||||
} else echo ' ';
|
|
@ -0,0 +1,7 @@
|
|||
<div id="templateElements" class="view">
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
updateIndex(<?php echo $templateId ?>, 'template');
|
||||
});
|
||||
</script>
|
||||
</div>
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'templates', 'menuItem' => 'add'));
|
||||
|
||||
$edit = $this->request->params['action'] === 'edit' ? true : false;
|
||||
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', [
|
||||
'menuList' => 'templates',
|
||||
'menuItem' => $edit ? 'edit' : 'add'
|
||||
]);
|
||||
|
||||
echo $this->element('genericElements/Form/genericForm', [
|
||||
'data' => [
|
||||
'title' => $edit ? __('Edit Template') : __('Create Template'),
|
||||
|
|
|
@ -1,56 +1,41 @@
|
|||
<div class="templates view">
|
||||
<h2><?php echo __('Template');?></h2>
|
||||
<dl>
|
||||
<dt><?php echo __('Id'); ?></dt>
|
||||
<dd>
|
||||
<?php echo h($template['Template']['id']); ?>
|
||||
|
||||
</dd>
|
||||
<dt><?php echo __('Name'); ?></dt>
|
||||
<dd>
|
||||
<?php echo h($template['Template']['name']); ?>
|
||||
|
||||
</dd>
|
||||
<dt><?php echo __('Description'); ?></dt>
|
||||
<dd>
|
||||
<?php echo h($template['Template']['description']); ?>
|
||||
|
||||
</dd>
|
||||
<dt><?php echo __('Tags'); ?></dt>
|
||||
<dd>
|
||||
<table>
|
||||
<tr id = "tags">
|
||||
<?php
|
||||
if (!empty($template['TemplateTag'])) {
|
||||
foreach ($template['TemplateTag'] as $tag) {
|
||||
echo $this->element('ajaxTemplateTag', array('tag' => $tag, 'editable' => 'no'));
|
||||
}
|
||||
} else echo ' ';
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
<dt><?php echo __('Organisation'); ?></dt>
|
||||
<dd>
|
||||
<?php echo h($template['Template']['org']); ?>
|
||||
|
||||
</dd>
|
||||
<dt><?php echo __('Shareable'); ?></dt>
|
||||
<dd>
|
||||
<?php
|
||||
if ($template['Template']['share']) echo __('Yes');
|
||||
else echo __('No');
|
||||
?>
|
||||
</dd>
|
||||
</dl>
|
||||
<div id="templateElements">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'templates', 'menuItem' => 'view', 'mayModify' => $mayModify));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready( function () {
|
||||
updateIndex(<?php echo $template['Template']['id']?>, 'template');
|
||||
});
|
||||
</script>
|
||||
|
||||
$this->set('menuData', ['menuList' => 'templates', 'menuItem' => 'view', 'mayModify' => $mayModify]);
|
||||
|
||||
echo $this->element(
|
||||
'genericElements/SingleViews/single_view',
|
||||
[
|
||||
'title' => 'Template',
|
||||
'data' => $template,
|
||||
'fields' => [
|
||||
[
|
||||
'key' => __('Id'),
|
||||
'path' => 'Template.id'
|
||||
],
|
||||
[
|
||||
'key' => __('Name'),
|
||||
'path' => 'Template.name'
|
||||
],
|
||||
[
|
||||
'key' => __('Description'),
|
||||
'path' => 'Template.description'
|
||||
],
|
||||
[
|
||||
'key' => __('Tags'),
|
||||
'path' => 'TemplateTag',
|
||||
'type' => 'tags'
|
||||
],
|
||||
[
|
||||
'key' => __('Organisation'),
|
||||
'path' => 'Template.org',
|
||||
],
|
||||
[
|
||||
'key' => __('Shareable'),
|
||||
'path' => 'Template.share',
|
||||
'type' => 'boolean'
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
echo $this->element('templateElements/templateElements', ['templateId' => $template['Template']['id']]);
|
||||
|
|
Loading…
Reference in New Issue