mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 05:58:46 +02:00
Merge remote-tracking branch 'origin/support/3.0' into develop
# Conflicts: # application/cmdbabstract.class.inc.php
This commit is contained in:
@@ -5195,10 +5195,13 @@ EOF
|
||||
$sStatus = $bResult ? Dict::S('UI:BulkModifyStatusModified') : Dict::S('UI:BulkModifyStatusSkipped');
|
||||
}
|
||||
|
||||
$aErrorsToDisplay = array_map(function($sError) {
|
||||
return utils::HtmlEntities($sError);
|
||||
}, $aErrors);
|
||||
$aRows[] = array(
|
||||
'object' => $oObj->GetHyperlink(),
|
||||
'status' => $sStatus,
|
||||
'errors' => '<p>'.($bResult ? '' : implode('</p><p>', $aErrors)).'</p>',
|
||||
'errors' => '<p>'.($bResult ? '' : implode('</p><p>', $aErrorsToDisplay)).'</p>',
|
||||
);
|
||||
if ($bResult && (!$bPreview)) {
|
||||
$oObj->DBUpdate();
|
||||
|
||||
@@ -1930,7 +1930,7 @@ abstract class DBObject implements iDisplay
|
||||
/** @var \AttributeExternalKey $oAtt */
|
||||
$sTargetClass = $oAtt->GetTargetClass();
|
||||
if (false === MetaModel::IsObjectInDB($sTargetClass, $toCheck)) {
|
||||
return "Target object not found (".utils::HtmlEntities($sTargetClass).".::".utils::HtmlEntities($toCheck).")";
|
||||
return "Target object not found (".$sTargetClass.".::".$toCheck.")";
|
||||
}
|
||||
}
|
||||
if ($oAtt->IsHierarchicalKey())
|
||||
@@ -1939,7 +1939,7 @@ abstract class DBObject implements iDisplay
|
||||
$aValues = $oAtt->GetAllowedValues(array('this' => $this));
|
||||
if (!array_key_exists($toCheck, $aValues))
|
||||
{
|
||||
return "Value not allowed [". utils::HtmlEntities($toCheck)."]";
|
||||
return "Value not allowed [$toCheck]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1953,7 +1953,7 @@ abstract class DBObject implements iDisplay
|
||||
$oTag->SetValues(explode(' ', $toCheck));
|
||||
} catch (Exception $e)
|
||||
{
|
||||
return "Tag value [". utils::HtmlEntities($toCheck)."] is not a valid tag list";
|
||||
return "Tag value '$toCheck' is not a valid tag list";
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1981,7 +1981,7 @@ abstract class DBObject implements iDisplay
|
||||
$oTag->SetValues($aValues);
|
||||
} catch (Exception $e)
|
||||
{
|
||||
return "Set value[". utils::HtmlEntities($toCheck)."] is not a valid set";
|
||||
return "Set value '$toCheck' is not a valid set";
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2001,7 +2001,7 @@ abstract class DBObject implements iDisplay
|
||||
{
|
||||
if (!array_key_exists($toCheck, $aValues))
|
||||
{
|
||||
return "Value not allowed [". utils::HtmlEntities($toCheck)."]";
|
||||
return "Value not allowed [$toCheck]";
|
||||
}
|
||||
}
|
||||
if (!is_null($iMaxSize = $oAtt->GetMaxSize()))
|
||||
@@ -2014,7 +2014,7 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
if (!$oAtt->CheckFormat($toCheck))
|
||||
{
|
||||
return "Wrong format [". utils::HtmlEntities($toCheck)."]";
|
||||
return "Wrong format [$toCheck]";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -35,8 +35,7 @@ $(function()
|
||||
{
|
||||
var me = this;
|
||||
|
||||
this.element
|
||||
.append('<div class="last-error"></div>')
|
||||
this.element.append('<div class="last-error"></div>')
|
||||
.addClass('console_form_handler');
|
||||
|
||||
this.options.oWizardHelper = window[this.options.wizard_helper_var_name];
|
||||
@@ -48,13 +47,13 @@ $(function()
|
||||
// revert other modifications here
|
||||
_destroy: function()
|
||||
{
|
||||
this.element
|
||||
.removeClass('console_form_handler');
|
||||
this.element.removeClass('console_form_handler');
|
||||
this._super();
|
||||
},
|
||||
_onUpdateFields: function(event, data)
|
||||
{
|
||||
var me = this;
|
||||
me._updatePreviousValues();
|
||||
var sFormPath = data.form_path;
|
||||
var sUpdateUrl = GetAbsoluteUrlAppRoot()+'pages/ajax.render.php';
|
||||
|
||||
@@ -64,7 +63,6 @@ $(function()
|
||||
{
|
||||
operation: 'custom_fields_update',
|
||||
attcode: this.options.custom_field_attcode,
|
||||
//current_values: this.getCurrentValues(),
|
||||
requested_fields: data.requested_fields,
|
||||
form_path: sFormPath,
|
||||
json_obj: this.options.oWizardHelper.UpdateWizardToJSON()
|
||||
@@ -85,6 +83,7 @@ $(function()
|
||||
me.element.find('.last-error').text(data.error);
|
||||
}
|
||||
me._onUpdateAlways(data, sFormPath);
|
||||
me.element.find('[data-field-id="previous_values"]').find('input[type="hidden"]').val('{}');
|
||||
});
|
||||
},
|
||||
// On initialization or update
|
||||
|
||||
@@ -92,12 +92,24 @@ $(function()
|
||||
{
|
||||
return this.options.field_set.triggerHandler('get_current_values');
|
||||
},
|
||||
|
||||
//since 3.0.2 3.1.0
|
||||
_updatePreviousValues: function()
|
||||
{
|
||||
let me = this;
|
||||
if(this.element.find('[data-attribute-previous-value]').length>0) {
|
||||
let aPreviousValues = {};
|
||||
$(this.element.find('[data-attribute-previous-value]')).each(function (idx, elt) {
|
||||
aPreviousValues[$(elt).data('field-id')] = $(elt).data('attribute-previous-value');
|
||||
});
|
||||
me.element.find('[data-field-id="previous_values"]').find('input[type="hidden"]').val(JSON.stringify(aPreviousValues));
|
||||
}
|
||||
},
|
||||
// Events callback
|
||||
// - Update fields depending on the update ones
|
||||
_onUpdateFields: function(oEvent, oData)
|
||||
{
|
||||
var me = this;
|
||||
me._updatePreviousValues();
|
||||
var sFormPath = oData.form_path;
|
||||
|
||||
// Data checks
|
||||
|
||||
@@ -1481,7 +1481,10 @@ EOF
|
||||
}
|
||||
else
|
||||
{
|
||||
$sError = '<p>'.implode('</p></p>',$aErrors)."</p>\n";
|
||||
$aErrorsToDisplay = array_map(function($sError) {
|
||||
return utils::HtmlEntities($sError);
|
||||
}, $aErrors);
|
||||
$sError = '<p>'.implode('</p></p>',$aErrorsToDisplay)."</p>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,6 +25,7 @@ use AttributeDuration;
|
||||
use Combodo\iTop\Application\Helper\WebResourcesHelper;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Field\FieldUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\HtmlFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\SelectUIBlockFactory;
|
||||
@@ -110,15 +111,17 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
|
||||
|
||||
$bRichEditor = ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML);
|
||||
|
||||
$oText = new TextArea("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId(),40,8);
|
||||
$oText->AddCSSClass('ibo-input-field-wrapper ibo-input');
|
||||
$oValue->AddSubBlock($oText);
|
||||
|
||||
if ($this->oField->GetReadOnly())
|
||||
{
|
||||
$oText->SetIsDisabled(true);
|
||||
$oValue->AddSubBlock(UIContentBlockUIBlockFactory::MakeStandard())->AddSubBlock(HtmlFactory::MakeHtmlContent($this->oField->GetCurrentValue()));
|
||||
$oValue->AddSubBlock(InputUIBlockFactory::MakeForHidden("",$this->oField->GetCurrentValue(), $this->oField->GetGlobalId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
$oText = new TextArea("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId(),40,8);
|
||||
$oText->AddCSSClasses(['ibo-input-field-wrapper', 'ibo-input']);
|
||||
$oValue->AddSubBlock($oText);
|
||||
// Some additional stuff if we are displaying it with a rich editor
|
||||
if ($bRichEditor)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user