new: [generic json template] added with JS based highlighting

bad_encoding_pymisp
iglocska 2023-06-07 14:25:54 +02:00
parent e48f76ce34
commit 55ab16b568
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,14 @@
<?php
$randomId = dechex(mt_rand());
echo sprintf(
'<pre id="%s">%s</pre>',
$randomId,
json_encode($json)
);
?>
<script type="text/javascript">
$(document).ready(function() {
$('#<?= $randomId ?>').html(syntaxHighlightJson(<?php echo json_encode($json); ?>, 4));
});
</script>

View File

@ -6,7 +6,7 @@
<h3 id="genericModalLabel"><?= h($title) ?></h3>
</div>
<div class="modal-body modal-body-long">
<p><?= empty($html) ? '' : $html ?><?= empty($text) ? '' : h($text) ?></p>
<p><?= empty($html) ? '' : $html ?><?= empty($text) ? '' : h($text) ?><?= empty($json) ? '' : $this->element('genericElements/json', ['json' => $json]) ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>