diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index 7ad64b7f7..25072a552 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -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')); } ); diff --git a/application/shortcut.class.inc.php b/application/shortcut.class.inc.php index e442738b8..e84bb39c5 100644 --- a/application/shortcut.class.inc.php +++ b/application/shortcut.class.inc.php @@ -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')); } ); diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 3eb0131cd..de82c3d4e 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -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 ); } diff --git a/application/ui.searchformforeignkeys.class.inc.php b/application/ui.searchformforeignkeys.class.inc.php index b4ecbbca4..8bc9e7911 100644 --- a/application/ui.searchformforeignkeys.class.inc.php +++ b/application/ui.searchformforeignkeys.class.inc.php @@ -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 ); } diff --git a/core/designdocument.class.inc.php b/core/designdocument.class.inc.php index 211aca4a6..e609c92e5 100644 --- a/core/designdocument.class.inc.php +++ b/core/designdocument.class.inc.php @@ -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 diff --git a/datamodels/2.x/itop-attachments/main.itop-attachments.php b/datamodels/2.x/itop-attachments/main.itop-attachments.php index 94a1e7269..5d50785f2 100644 --- a/datamodels/2.x/itop-attachments/main.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/main.itop-attachments.php @@ -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; diff --git a/datamodels/2.x/itop-attachments/renderers.itop-attachments.php b/datamodels/2.x/itop-attachments/renderers.itop-attachments.php index 4407d68a8..e0ecd4625 100644 --- a/datamodels/2.x/itop-attachments/renderers.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/renderers.itop-attachments.php @@ -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'); diff --git a/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php b/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php index 6f6c08eb1..ac0b9a58e 100644 --- a/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php +++ b/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php @@ -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); diff --git a/datamodels/2.x/itop-core-update/templates/SelectUpdateFile.ready.js.twig b/datamodels/2.x/itop-core-update/templates/SelectUpdateFile.ready.js.twig index eb1789412..51d1cfdd7 100644 --- a/datamodels/2.x/itop-core-update/templates/SelectUpdateFile.ready.js.twig +++ b/datamodels/2.x/itop-core-update/templates/SelectUpdateFile.ready.js.twig @@ -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", diff --git a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php index 07aedd49a..05ca95762 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php @@ -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); } } diff --git a/js/dashboard.js b/js/dashboard.js index 2699e189e..c604d262a 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -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; diff --git a/js/dashlet.js b/js/dashlet.js index 5856f9e58..14f52f860 100644 --- a/js/dashlet.js +++ b/js/dashlet.js @@ -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(); }, diff --git a/js/extkeywidget.js b/js/extkeywidget.js index 9c792820b..98496b63b 100644 --- a/js/extkeywidget.js +++ b/js/extkeywidget.js @@ -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 diff --git a/js/icon_select.js b/js/icon_select.js index 0afd9bf48..ca8d6c15c 100644 --- a/js/icon_select.js +++ b/js/icon_select.js @@ -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 = $('
'+this.options.labels['pick_icon_file']+'