fix: [decaying] UI - Interface errors and sanitization

pull/5032/head
mokaddem 2019-08-28 12:09:32 +02:00
parent c333d23f2d
commit 0c880fe30a
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 6 additions and 5 deletions

View File

@ -114,7 +114,7 @@ $(document).ready(function() {
});
$('#select_model_to_simulate_infobox').popover({
title: function() {
return $('#select_model_to_simulate option:selected').text();
return $('<div>').text($('#select_model_to_simulate option:selected').text()).html();
},
content: function() {
return '<div>' + syntaxHighlightJson(models[$('#select_model_to_simulate').val()]) + '</div>';
@ -174,7 +174,8 @@ function doRestSearch(clicked, query) {
$trs.data('modelOverride', JSON.stringify(json.modelOverrides));
}
},
error:function() {
error:function(jqXHR, textStatus, errorThrown) {
$('#attributeTableContainer').text(textStatus + ': ' + errorThrown);
showMessage('fail', '<?php echo __('Failed to perform RestSearch') ?>');
},
type:'post',

View File

@ -120,7 +120,7 @@ foreach ($decayingModels as $item): ?>
$item['DecayingModel']['parameters']['base_score_config'] = new stdClass(); // force output to be {} instead of []
}
?>
<td data-toggle="json" ondblclick="document.location.href ='<?php echo $baseurl . '/decayingModel/view/' . h($item['DecayingModel']['id']); ?>'"><?php echo json_encode($item['DecayingModel']['parameters']); ?>&nbsp;</td>
<td data-toggle="json" ondblclick="document.location.href ='<?php echo $baseurl . '/decayingModel/view/' . h($item['DecayingModel']['id']); ?>'"><?php echo h(json_encode($item['DecayingModel']['parameters'])); ?>&nbsp;</td>
<td>
<?php echo h($item['DecayingModel']['formula']); ?>
<?php if (isset($available_formulas[$item['DecayingModel']['formula']]['description'])): ?>

View File

@ -33,12 +33,12 @@
);
$table_data[] = array(
'key' => __('Formula'),
'html' => $decaying_model['DecayingModel']['formula'] . (
'html' => h($decaying_model['DecayingModel']['formula']) . (
isset($available_formulas[$decaying_model['DecayingModel']['formula']]['description']) ? sprintf(' <i class="fas fa-question-circle" data-toggle="tooltip" title="%s"></i>', h($available_formulas[$decaying_model['DecayingModel']['formula']]['description'])) : ''
)
);
$table_data[] = array('key' => __('Parameters'), 'value' => json_encode($decaying_model['DecayingModel']['parameters']), 'class' => 'json-transform');
$table_data[] = array('key' => __('Reference(s)'), 'html' => implode('<br/>', (empty($decaying_model['DecayingModel']['ref']) ? array() : $decaying_model['DecayingModel']['ref'])));
$table_data[] = array('key' => __('Reference(s)'), 'html' => implode('<br/>', (empty($decaying_model['DecayingModel']['ref']) ? array() : h($decaying_model['DecayingModel']['ref']))));
$table_data[] = array('key' => __('Associated types'), 'value' => json_encode($decaying_model['DecayingModel']['attribute_types']), 'class' => 'json-transform');
?>
<div class='view'>