Merge remote-tracking branch 'origin/support/3.2' into develop

This commit is contained in:
Eric Espie
2024-03-27 11:30:02 +01:00
23 changed files with 125 additions and 47 deletions

View File

@@ -480,7 +480,7 @@ abstract class Dashboard
CombodoTooltip.InitTooltipFromMarkup($("#attr_auto_reload_sec"));
$("#attr_auto_reload_sec").prop('disabled', !$('#attr_auto_reload').is(':checked'));
$('#attr_auto_reload').change( function(ev) {
$('#attr_auto_reload').on('change', function(ev) {
$("#attr_auto_reload_sec").prop('disabled', !$(this).is(':checked'));
} );

View File

@@ -293,7 +293,7 @@ $("#attr_auto_reload_sec").attr('data-tooltip-content', '$sRateTitle');
CombodoTooltip.InitTooltipFromMarkup($("#attr_auto_reload_sec"));
$("#attr_auto_reload_sec").prop('disabled', !$('#attr_auto_reload').is(':checked'));
$('#attr_auto_reload').change( function(ev) {
$('#attr_auto_reload').on('change', function(ev) {
$("#attr_auto_reload_sec").prop('disabled', !$(this).is(':checked'));
} );

View File

@@ -734,7 +734,7 @@ HTML
],
});
$('#fs_{$this->iId}').on('submit.uiAutocomplete', oACWidget_{$this->iId}.DoSearchObjects);
$('#dc_{$this->iId}').resize(oACWidget_{$this->iId}.UpdateSizes);
$('#dc_{$this->iId}').on('resize', oACWidget_{$this->iId}.UpdateSizes);
JS
);
}

View File

@@ -99,7 +99,7 @@ HTML
});
$('#dlg_{$this->m_iInputId}').dialog('option', {title:'$sTitle'});
$('#SearchFormToAdd_{$this->m_iInputId} form').on('submit.uilinksWizard', oForeignKeysWidget{$this->m_iInputId}.SearchObjectsToAdd);
$('#SearchFormToAdd_{$this->m_iInputId}').resize(oForeignKeysWidget{$this->m_iInputId}.UpdateSizes);
$('#SearchFormToAdd_{$this->m_iInputId}').on('resize', oForeignKeysWidget{$this->m_iInputId}.UpdateSizes);
JS
);
}

View File

@@ -26,7 +26,6 @@
namespace Combodo\iTop;
use DOMComment;
use DOMDocument;
use DOMFormatException;
use DOMNode;
@@ -35,9 +34,7 @@ use DOMXPath;
use Exception;
use IssueLog;
use LogAPI;
use MFDocument;
use MFElement;
use ModelFactory;
use utils;
/**
@@ -246,6 +243,56 @@ class DesignElement extends \DOMElement
return '';
}
/**
* Compatibility with PHP8.0
*
* @return \DOMElement|null
*
* @since 3.1.2
*/
public function GetFirstElementChild()
{
if (property_exists($this, 'firstElementChild')) {
return $this->firstElementChild;
}
$oChildNode = $this->firstChild;
while (!is_null($oChildNode)) {
if ($oChildNode instanceof \DOMElement) {
return $oChildNode;
}
$oChildNode = $oChildNode->nextSibling;
}
return null;
}
/**
* Compatibility with PHP8.0
*
* @return \DOMElement|null
*
* @since 3.1.2
*/
public function GetNextElementSibling()
{
if (property_exists($this, 'nextElementSibling')) {
return $this->nextElementSibling;
}
$oSibling = $this->nextSibling;
while (!is_null($oSibling)) {
if ($oSibling instanceof \DOMElement) {
return $oSibling;
}
$oSibling = $oSibling->nextSibling;
}
return null;
}
/**
* Returns the node directly under the given node
* @param $sTagName

View File

@@ -267,6 +267,23 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt
}
}
/**
*
* @see ObjectFormManager::FinalizeAttachments() for the portal version
*
* @param $oObject
* @param $oChange
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DeleteException
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
protected static function UpdateAttachments($oObject, $oChange = null)
{
self::$m_bIsModified = false;

View File

@@ -276,7 +276,7 @@ abstract class AbstractAttachmentsRenderer
e.stopPropagation();
})
$(document).bind('dragover', function (e) {
$(document).on('dragover', function (e) {
var bFiles = false;
if (e.dataTransfer && e.dataTransfer.types)
{
@@ -317,7 +317,7 @@ abstract class AbstractAttachmentsRenderer
window.dropZoneCnt++;
});
$(document).bind('dragend dragleave drop', function(event){
$(document).on('dragend dragleave drop', function(event){
window.dropZoneCnt--;
if(window.dropZone && window.dropZoneCnt === 0){
window.dropZone.removeClass('ibo-drag-in');

View File

@@ -45,6 +45,7 @@ class UpdateController extends Controller
$aParams['sFileUploadMaxSize'] = utils::BytesToFriendlyFormat($aParams['iFileUploadMaxSize']);
$aParams['sPostMaxSize'] = ini_get('post_max_size');
$aParams['sUploadMaxSize'] = ini_get('upload_max_filesize');
$aParams['bDontUpgradeIfIntegrityFailed'] = !utils::IsDevelopmentEnvironment();
$oFilter = DBObjectSearch::FromOQL('SELECT ModuleInstallation WHERE parent_id=0 AND name!="datamodel"');
$oSet = new DBObjectSet($oFilter, ['installed' => false]); // Most recent first
$aParams['oSet'] = $oSet;
@@ -129,7 +130,6 @@ class UpdateController extends Controller
$sTransactionId = utils::GetNewTransactionId();
$aParams['sTransactionId'] = $sTransactionId;
$this->AddSaas('css/backoffice/main.scss');
$this->m_sOperation = 'ConfirmUpdate';
$this->DisplaySetupPage($aParams);
}
@@ -158,7 +158,6 @@ class UpdateController extends Controller
'sAjaxURL' => utils::GetAbsoluteUrlAppRoot().'/pages/UI.php',
];
$this->AddLinkedScript(utils::GetAbsoluteUrlAppRoot().'setup/jquery.progression.js');
$this->AddSaas('css/backoffice/main.scss');
$this->AddSaas('env-'.utils::GetCurrentEnvironment().'/itop-core-update/css/itop-core-update.scss');
$this->m_sOperation = 'UpdateCoreFiles';
$this->DisplaySetupPage($aParams);

View File

@@ -28,10 +28,17 @@ $.ajax({
$("#file-container").removeClass("ibo-is-hidden");
$("#check-in-progress").addClass("ibo-is-hidden");
} else {
$("#check-update").prop("disabled", true);
$("#file").prop("disabled", true);
$('#form-update-outer').slideUp(600);
oRequirements.addClass("ibo-is-failure");
{% if bDontUpgradeIfIntegrityFailed %}
$("#check-update").prop("disabled", true);
$("#file").prop("disabled", true);
$('#form-update-outer').slideUp(600);
{% else %}
$("#check-update").prop("disabled", false);
$("#file").prop("disabled", false);
$("#file-container").removeClass("ibo-is-hidden");
$("#check-in-progress").addClass("ibo-is-hidden");
{% endif %}
}
}
});
@@ -55,7 +62,7 @@ var oGetDBDiskSpace = $.ajax({
method: "POST",
url: "{{ sAjaxURL|raw }}",
data: {
route: "core_update_ajax.get_d_b_disk_space",
route: "core_update_ajax.get_db_disk_space",
maintenance: true
},
dataType: "json",

View File

@@ -1463,6 +1463,8 @@ class ObjectFormManager extends FormManager
// Remove attachments that are no longer attached to the current object
if (in_array($oAttachment->GetKey(), $aRemovedAttachmentsIds))
{
$aData = ['attachment' => $oAttachment];
$this->oObject->FireEvent(EVENT_REMOVE_ATTACHMENT_FROM_OBJECT, $aData);
$oAttachment->DBDelete();
$aActions[] = self::GetAttachmentActionChangeOp($oAttachment, false);
}
@@ -1487,6 +1489,8 @@ class ObjectFormManager extends FormManager
$oAttachment->Set('temp_id', '');
$oAttachment->DBUpdate();
$aActions[] = self::GetAttachmentActionChangeOp($oAttachment, true);
$aData = ['attachment' => $oAttachment];
$this->oObject->FireEvent(EVENT_ADD_ATTACHMENT_TO_OBJECT, $aData);
}
}

View File

@@ -291,7 +291,7 @@ $(function()
},
// Dirty means: at least one change has not been committed yet
is_dirty: function () {
if ($('#dashboard_editor .ui-layout-east .itop-property-field-modified').size() > 0) {
if ($('#dashboard_editor .ui-layout-east .itop-property-field-modified').length > 0) {
return true;
} else {
return false;

View File

@@ -20,7 +20,7 @@ $(function()
this.element
.addClass('itop-dashlet')
.bind('click.itop-dashlet', function(event) { me._on_click(event); } );
.on('click.itop-dashlet', function(event) { me._on_click(event); } );
this._update();
},

View File

@@ -433,7 +433,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
me.UpdateSizes();
me.UpdateButtons();
me.ajax_request = null;
$('#count_'+me.id+'_results').change(function () {
$('#count_'+me.id+'_results').on('change', function () {
me.UpdateButtons();
});
if (me.bDoSearch) {
@@ -600,12 +600,16 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
};
this.Clear = function () {
$('#'+me.id).val('');
$('#label_'+me.id).val('');
$('#label_'+me.id).data('selected_value', '');
$('#'+me.id).trigger('validate');
$('#'+me.id).trigger('extkeychange');
$('#'+me.id).trigger('change');
if (me.bSelectMode) {
$('#'+me.id)[0].selectize.clear();
} else {
$('#'+me.id).val('');
$('#label_'+me.id).val('');
$('#label_'+me.id).data('selected_value', '');
$('#'+me.id).trigger('validate');
$('#'+me.id).trigger('extkeychange');
$('#'+me.id).trigger('change');
}
};
// Workaround for a ui.jquery limitation: if the content of

View File

@@ -53,7 +53,7 @@ $(function()
});
this.element.after(this.oButton);
this.element.addClass( "itop-icon-select" ).button();
this.element.bind( "reverted.itop-icon-select", function(ev, data) {
this.element.on( "reverted.itop-icon-select", function(ev, data) {
var idx = me._find_item(data.previous_value);
if (idx != null)
{
@@ -68,7 +68,7 @@ $(function()
this.oButton.after(this.oUploadBtn);
}
var id = this.element.attr('id');
$('#event_bus').bind('tabshow.itop-icon-select'+id, function(event) {
$('#event_bus').on('tabshow.itop-icon-select'+id, function(event) {
// Compute the offsetX the first time the 'element' becomes visible...
var bVisible = me.element.parent().is(':visible');
if ((me.options.offsetX == null) && (bVisible))
@@ -216,7 +216,7 @@ $(function()
var me = this;
this.oUploadDlg = $('<div><p>'+this.options.labels['pick_icon_file']+'</p><p><input type="file" accept="image/*" name="file" id="file"/></p></div>');
this.element.after(this.oUploadDlg);
$('input[type=file]').bind('change', function() { me._do_upload(); });
$('input[type=file]').on('change', function() { me._do_upload(); });
this.oUploadDlg.dialog({
width: 400,
modal: true,

View File

@@ -68,7 +68,7 @@ $(function()
.after(this.inputToBeRemoved)
.after(this.indicator);
this.element.find('.selectList'+this.id).bind('change', function () {
this.element.find('.selectList'+this.id).on('change', function () {
me._updateButtons();
});
@@ -206,7 +206,7 @@ $(function()
me._onSearchToAdd();
return false;
});
$('#SearchFormToAdd_'+me.id).resize(function () {
$('#SearchFormToAdd_'+me.id).on('resize', function () {
me._onSearchDlgUpdateSize();
});
@@ -249,7 +249,7 @@ $(function()
}
else
{
$('#count_'+me.id).change(function() {
$('#count_'+me.id).on('change', function() {
var c = this.value;
me._onUpdateDlgButtons(c);
});
@@ -298,7 +298,7 @@ $(function()
$.post(this.options.submit_to, oParams, function(data) {
$('#SearchResultsToAdd_'+me.id).html(data);
$('#count_'+me.id).change(function() {
$('#count_'+me.id).on('change', function() {
var c = this.value;
me._onUpdateDlgButtons(c);
});

View File

@@ -162,7 +162,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
if (me.bDoSearch) {
me.SearchObjectsToAdd();
} else {
$('#count_'+me.id).change(function () {
$('#count_'+me.id).on('change', function () {
let c = this.value;
me.UpdateButtons(c);
});
@@ -174,7 +174,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
};
this.SearchObjectsToAdd = function () {
$('#count_'+me.id).change(function () {
$('#count_'+me.id).on('change', function () {
let c = this.value;
me.UpdateButtons(c);
});

View File

@@ -206,7 +206,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
$('#fr_'+me.id+' input:radio').on('click', function() { me.UpdateButtons(); });
me.UpdateButtons();
me.ajax_request = null;
$('#count_'+me.id).change(function(){
$('#count_'+me.id).on('change', function(){
me.UpdateButtons();
});
me.UpdateSizes();

View File

@@ -34,11 +34,11 @@ $(function () {
this._flatten_fields(this.options.fields);
this.sId = this.element.attr('id');
this.element.addClass('itop-tabularfieldsselector');
this.element.parent().bind('form-part-activate', function () {
this.element.parent().on('form-part-activate', function () {
me._update_from_holder();
me._update_preview();
});
this.element.parent().bind('validate', function () {
this.element.parent().on('validate', function () {
me.validate();
});

View File

@@ -195,7 +195,7 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext, sTableId, sEx
oDiv.empty();
oDiv.append(data);
oDiv.unblock();
oDiv.parent().resize(); // Inform the parent that the form has just been (potentially) resized
oDiv.parent().trigger('resize'); // Inform the parent that the form has just been (potentially) resized
oDiv.find('form.search_form_handler').triggerHandler('itop.search.form.reloaded');
}
);

View File

@@ -848,7 +848,7 @@ class ModelFactory
// Do not continue deeper
$oTargetNode = null;
} else {
if (!$bSpecifiedMerge && $sMode === self::LOAD_DELTA_MODE_STRICT && ($sSearchId !== '' || is_null($oSourceNode->firstElementChild))) {
if (!$bSpecifiedMerge && $sMode === self::LOAD_DELTA_MODE_STRICT && ($sSearchId !== '' || is_null($oSourceNode->GetFirstElementChild()))) {
$iLine = ModelFactory::GetXMLLineNumber($oSourceNode);
$sItopNodePath = DesignDocument::GetItopNodePath($oSourceNode);
throw new MFException($sItopNodePath.' at line '.$iLine.': could not be found or marked as removed (strict mode)',
@@ -889,7 +889,7 @@ class ModelFactory
$oTargetParentNode->insertBefore($oCommentNode, $oTargetNode);
}
// Continue deeper
for ($oSourceChild = $oSourceNode->firstElementChild; !is_null($oSourceChild); $oSourceChild = $oSourceChild->nextElementSibling) {
for ($oSourceChild = $oSourceNode->GetFirstElementChild(); !is_null($oSourceChild); $oSourceChild = $oSourceChild->GetNextElementSibling()) {
$this->LoadFlattenDelta($oSourceChild, $oTargetDocument, $oTargetNode, $sMode);
}
$oTargetNode = null;
@@ -898,7 +898,7 @@ class ModelFactory
}
if ($oTargetNode) {
if (is_null($oSourceNode->firstElementChild) && $oTargetParentNode instanceof MFElement) {
if (is_null($oSourceNode->GetFirstElementChild()) && $oTargetParentNode instanceof MFElement) {
// Leaf node
if ($sMode === self::LOAD_DELTA_MODE_STRICT && !$oSourceNode->hasAttribute('_rename_from') && trim($oSourceNode->GetText('')) !== '') {
$iLine = ModelFactory::GetXMLLineNumber($oSourceNode);
@@ -916,7 +916,7 @@ class ModelFactory
}
}
} else {
for ($oSourceChild = $oSourceNode->firstElementChild; !is_null($oSourceChild); $oSourceChild = $oSourceChild->nextElementSibling) {
for ($oSourceChild = $oSourceNode->GetFirstElementChild(); !is_null($oSourceChild); $oSourceChild = $oSourceChild->GetNextElementSibling()) {
// Continue deeper
$this->LoadFlattenDelta($oSourceChild, $oTargetDocument, $oTargetNode, $sMode);
}
@@ -1042,7 +1042,7 @@ class ModelFactory
}
if (!$bIsRoot) {
// Hard deletion is necessary
$oClassNode->remove();
$oClassNode->parentNode->removeChild($oClassNode);
}
}
@@ -1574,7 +1574,7 @@ EOF
public function GetClass($sClassName, $bIncludeMetas = false)
{
// Check if class among XML classes
/** @var \MFElemen|null $oClassNode */
/** @var \MFElement|null $oClassNode */
$oClassNode = $this->GetNodes("/itop_design/classes/class[@id='$sClassName']")->item(0);
// If not, check if class among exposed meta classes (PHP classes)

View File

@@ -29,7 +29,7 @@ $('#dlg_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').dialog({
});
$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }} form').bind('submit.uilinksWizard', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.SearchObjectsToAdd);
$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').resize(oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.UpdateSizes);
$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }} form').on('submit.uilinksWizard', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.SearchObjectsToAdd);
$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').on('resize', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.UpdateSizes);
{% endapply %}

View File

@@ -374,7 +374,7 @@ $('body').on('open_creation_modal.object.itop','#{{ oUIBlock.GetId() }}', functi
{% endif %}
{% if oUIBlock.GetOption('sCountSelector') is not empty %}
$('#{{ sListId }} [name="selectionCount"]').bind('change', function () {
$('#{{ sListId }} [name="selectionCount"]').on('change', function () {
$('{{ oUIBlock.GetOption('sCountSelector') }}').val($('#{{ sListId }} [name="selectionCount"]').val());
$('{{ oUIBlock.GetOption('sCountSelector') }}').trigger('change');
});

View File

@@ -19,7 +19,7 @@
{% endif %}
<span class="ibo-object-details--object-class" data-role="ibo-object-details--object-class">
{% if is_backoffice_menu_enabled('DataModelMenu') %}
<a href="{{ get_absolute_url_app_root() }}pages/schema.php?operation=details_class&class={{ oUIBlock.GetClassName() }}" target="_blank" data-tooltip-content="{{ 'UI:Layout:ObjectDetails:DatamodelSchemaLink:Tooltip' | dict_s }} <i class='fas fa-external-link-alt'></i>" data-tooltip-html-enabled="true">{{ oUIBlock.GetClassLabel() }}</a>
<a href="{{ get_absolute_url_app_root() }}pages/schema.php?operation=details_class&class={{ oUIBlock.GetClassName() }}" target="_blank" data-tooltip-content="{{ 'UI:Layout:ObjectDetails:DatamodelSchemaLink:Tooltip' | dict_s }}" data-tooltip-html-enabled="true">{{ oUIBlock.GetClassLabel() }}</a>
{% else %}
{{ oUIBlock.GetClassLabel() }}
{% endif %}