mirror of https://github.com/MISP/MISP
fix: Fixes to issues introduced by the ajax JSON rework, fixes #2384
parent
fb57677690
commit
d8123b18d9
|
@ -46,7 +46,7 @@ class AppController extends Controller {
|
|||
|
||||
public $helpers = array('Utility');
|
||||
|
||||
private $__queryVersion = '16';
|
||||
private $__queryVersion = '17';
|
||||
public $pyMispVersion = '2.4.77';
|
||||
public $phpmin = '5.6.5';
|
||||
public $phprec = '7.0.16';
|
||||
|
|
|
@ -847,13 +847,13 @@ class AttributesController extends AppController {
|
|||
}
|
||||
if ($attribute['Attribute'][$changedKey] == $changedField) {
|
||||
$this->autoRender = false;
|
||||
return new CakeResponse(array('body'=> json_encode('nochange'), 'status'=>200, 'type' => 'json'));
|
||||
return new CakeResponse(array('body'=> json_encode(array('errors'=> array('value' => 'nochange'))), 'status'=>200, 'type' => 'json'));
|
||||
}
|
||||
$attribute['Attribute'][$changedKey] = $changedField;
|
||||
$changed = true;
|
||||
}
|
||||
if (!$changed) {
|
||||
return new CakeResponse(array('body'=> json_encode('nochange'), 'status'=>200, 'type' => 'json'));
|
||||
return new CakeResponse(array('body'=> json_encode(array('errors'=> array('value' => 'nochange'))), 'status'=>200, 'type' => 'json'));
|
||||
}
|
||||
$date = new DateTime();
|
||||
$attribute['Attribute']['timestamp'] = $date->getTimestamp();
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align:top">
|
||||
<button aria-label="Submit attribute element changes" title="Submit attribute element changes" class="btn btn-primary" onClick="CsubmitPopoverForm('<?php echo $id;?>', 'editAttributeElement', '<?php echo $template_id; ?>')">Submit</button>
|
||||
<button aria-label="Submit attribute element changes" title="Submit attribute element changes" class="btn btn-primary" onClick="return submitPopoverForm('<?php echo $id;?>', 'editAttributeElement', '<?php echo $template_id; ?>')">Submit</button>
|
||||
</td>
|
||||
<td style="width:540px;">
|
||||
<p style="color:red;font-weight:bold;display:none;text-align:center" id="warning-message">Warning: You are about to share data that is of a classified nature (Attribution / targeting data). Make sure that you are authorised to share this.</p>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align:top">
|
||||
<button title="Submit file element changes" id="submitButton" class="btn btn-primary" onClick="return event.preventDefault();submitPopoverForm('<?php echo $id;?>', 'editFileElement', '<?php echo $template_id; ?>');">Submit</button>
|
||||
<button title="Submit file element changes" id="submitButton" class="btn btn-primary" onClick="return submitPopoverForm('<?php echo $id;?>', 'editFileElement', '<?php echo $template_id; ?>');">Submit</button>
|
||||
</td>
|
||||
<td style="width:540px;">
|
||||
<p style="color:red;font-weight:bold;display:none;text-align:center" id="warning-message">Warning: You are about to share data that is of a classified nature (Attribution / targeting data). Make sure that you are authorised to share this.</p>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align:top">
|
||||
<button id="submitButton" title="Submit description changes" class="btn btn-primary" onClick="return event.preventDefault();submitPopoverForm('<?php echo $id;?>', 'editTextElement', '<?php echo $template_id; ?>')">Submit</button>
|
||||
<button id="submitButton" title="Submit description changes" class="btn btn-primary" onClick="return submitPopoverForm('<?php echo $id;?>', 'editTextElement', '<?php echo $template_id; ?>')">Submit</button>
|
||||
</td>
|
||||
<td style="width:540px;">
|
||||
<p style="color:red;font-weight:bold;display:none;text-align:center" id="warning-message">Warning: You are about to share data that is of a classified nature (Attribution / targeting data). Make sure that you are authorised to share this.</p>
|
||||
|
|
|
@ -170,7 +170,7 @@ function toggleSetting(e, setting, id) {
|
|||
},
|
||||
data: formData,
|
||||
success:function (data, textStatus) {
|
||||
var result = JSON.parse(data);
|
||||
var result = data;
|
||||
if (result.success) {
|
||||
var setting = false;
|
||||
if (result.success.indexOf(searchString) > -1) setting = true;
|
||||
|
@ -418,7 +418,7 @@ function addSighting(type, attribute_id, event_id, page) {
|
|||
cache: false,
|
||||
success:function (data, textStatus) {
|
||||
handleGenericAjaxResponse(data);
|
||||
var result = JSON.parse(data);
|
||||
var result = data;
|
||||
if (result.saved == true) {
|
||||
$('.sightingsCounter').each(function( counter ) {
|
||||
$(this).html(parseInt($(this).html()) + 1);
|
||||
|
@ -542,7 +542,7 @@ function quickSubmitAttributeTagForm(attribute_id, tag_id) {
|
|||
}
|
||||
|
||||
function handleAjaxEditResponse(data, name, type, id, field, event) {
|
||||
responseArray = JSON.parse(data);
|
||||
responseArray = data;
|
||||
if (type == 'Attribute') {
|
||||
if (responseArray.saved) {
|
||||
showMessage('success', responseArray.success);
|
||||
|
@ -913,7 +913,7 @@ function submitPopoverForm(context_id, referer, update_context_id) {
|
|||
};
|
||||
|
||||
function handleAjaxPopoverResponse(response, context_id, url, referer, context, contextNamingConvention) {
|
||||
responseArray = JSON.parse(response);
|
||||
responseArray = response;
|
||||
var message = null;
|
||||
if (responseArray.saved) {
|
||||
updateIndex(context_id, context);
|
||||
|
@ -2246,7 +2246,7 @@ function testConnection(id) {
|
|||
$("#connection_test_" + id).html('Internal error.');
|
||||
},
|
||||
success: function(response){
|
||||
var result = JSON.parse(response);
|
||||
var result = response;
|
||||
switch (result.status) {
|
||||
case 1:
|
||||
status_message = "OK";
|
||||
|
|
Loading…
Reference in New Issue