diff --git a/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php b/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php index becf11a28..0fd988d99 100644 --- a/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php +++ b/datamodels/2.x/combodo-data-feature-removal/dictionaries/en.dict.combodo-data-feature-removal.php @@ -39,6 +39,7 @@ Dict::Add('EN US', 'English', 'English', [ 'UI:Button:PlanDeletion' => 'Prepare deletion plan', 'UI:Button:DoDeletion' => 'Delete data', 'UI:Button:BackToMain' => 'Back to Feature Removal', + 'UI:Button:Setup' => 'Back to setup', 'UI:Action:ForceUninstall' => 'Force uninstall', 'UI:Action:MoreInfo' => 'More information', @@ -52,4 +53,4 @@ Dict::Add('EN US', 'English', 'English', [ 'DataFeatureRemoval:Column:DeletedCount' => 'Deleted entries', 'DataFeatureRemoval:Column:UpdatedCount' => 'Updated entries', - ]); +]); diff --git a/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php b/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php index 9f5e55029..84139f0e1 100644 --- a/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php +++ b/datamodels/2.x/combodo-data-feature-removal/dictionaries/fr.dict.combodo-data-feature-removal.php @@ -39,6 +39,7 @@ Dict::Add('FR FR', 'French', 'Français', [ 'UI:Button:PlanDeletion' => 'Prepare deletion plan', 'UI:Button:DoDeletion' => 'Delete data', 'UI:Button:BackToMain' => 'Back to Feature Removal', + 'UI:Button:Setup' => 'Back to setup', 'UI:Action:ForceUninstall' => 'Force uninstall', 'UI:Action:MoreInfo' => 'More information', @@ -46,8 +47,8 @@ Dict::Add('FR FR', 'French', 'Français', [ 'DataFeatureRemoval:Table:Empty' => 'No data to remove', 'DataFeatureRemoval:Column:Class' => 'Class', - 'DataFeatureRemoval:Column:DeleteCount' => 'Delete count', - 'DataFeatureRemoval:Column:UpdateCount' => 'Update count', + 'DataFeatureRemoval:Column:DeleteCount' => 'Entries to delete', + 'DataFeatureRemoval:Column:UpdateCount' => 'Entries to update', 'DataFeatureRemoval:Column:Issue' => 'Issue', 'DataFeatureRemoval:Column:DeletedCount' => 'Deleted entries', diff --git a/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php b/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php index 36c9055fe..395137f68 100644 --- a/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php +++ b/datamodels/2.x/combodo-data-feature-removal/src/Controller/DataFeatureRemovalController.php @@ -33,6 +33,7 @@ class DataFeatureRemovalController extends Controller { $aParams = []; + $this->ReadRemovedExtensions(); $this->AddAnalyzeParams(); $aParams['sTransactionId'] = utils::GetNewTransactionId(); $aParams['aExtensions'] = $this->GetExtensionsTable(); @@ -40,6 +41,7 @@ class DataFeatureRemovalController extends Controller $aParams['aClasses'] = array_keys($this->aCountClassesToCleanup); $aParams['DataFeatureRemovalErrorMessage'] = $sErrorMessage; $aParams['bHasData'] = count($aParams['aClasses']) > 0; + $aParams['sSetupUrl'] = utils::GetAbsoluteUrlAppRoot().'setup'; $this->AddLinkedStylesheet(utils::GetAbsoluteUrlModulesRoot().DataFeatureRemovalHelper::MODULE_NAME.'/assets/css/DataFeatureRemoval.css'); $this->AddLinkedScript(utils::GetAbsoluteUrlModulesRoot().DataFeatureRemovalHelper::MODULE_NAME.'/assets/js/DataFeatureRemoval.js'); @@ -73,22 +75,7 @@ HTML, public function OperationAnalyze(): void { - $this->ValidateTransactionId(); - $aSelectedExtensionsFromUI = utils::ReadPostedParam('aExtensions', []); - $this->aSelectedExtensionsForCheck = []; - foreach ($aSelectedExtensionsFromUI as $sCode => $aData) { - $sValue = $aData['enable'] ?? 'off'; - if (($sValue) === 'on') { - $this->aSelectedExtensionsForCheck[] = $sCode; - } - } - - // Add source removed to check - foreach (DataFeatureRemoverExtensionService::GetInstance()->ReadItopExtensions() as $sCode => $oExtension) { - if ($oExtension->bRemovedFromDisk) { - $this->aSelectedExtensionsForCheck[] = $sCode; - } - } + $this->ReadRemovedExtensions(); $this->m_sOperation = 'Main'; @@ -249,4 +236,30 @@ HTML, throw new DataFeatureRemovalException(Dict::S("iTopUpdate:Error:InvalidToken")); } } + + /** + * @return void + */ + public function ReadRemovedExtensions(): void + { + if (count($this->aSelectedExtensionsForCheck) > 0) { + return; + } + + $aSelectedExtensionsFromUI = utils::ReadPostedParam('aExtensions', []); + IssueLog::Error(__METHOD__, null, $aSelectedExtensionsFromUI); + foreach ($aSelectedExtensionsFromUI as $sCode => $aData) { + $sValue = $aData['enable'] ?? 'off'; + if (($sValue) === 'on') { + $this->aSelectedExtensionsForCheck[] = $sCode; + } + } + + // Add source removed to check + foreach (DataFeatureRemoverExtensionService::GetInstance()->ReadItopExtensions() as $sCode => $oExtension) { + if ($oExtension->bRemovedFromDisk) { + $this->aSelectedExtensionsForCheck[] = $sCode; + } + } + } } diff --git a/datamodels/2.x/combodo-data-feature-removal/templates/Main.html.twig b/datamodels/2.x/combodo-data-feature-removal/templates/Main.html.twig index a8057d739..89c6fa579 100644 --- a/datamodels/2.x/combodo-data-feature-removal/templates/Main.html.twig +++ b/datamodels/2.x/combodo-data-feature-removal/templates/Main.html.twig @@ -24,4 +24,12 @@ {% include 'Features.html.twig' %} {% include 'ExtensionRemovalData.html.twig' %} + + {% if not bHasData %} + {% UIToolbar ForButton {} %} + + {% UIButton ForPrimaryAction {sLabel:'UI:Button:Setup'|dict_s, sName:'btn_setup', sId:'btn_setup', bIsSubmit:false} %} + + {% EndUIToolbar %} + {% endif %} {% EndUIPanel %} diff --git a/setup/wizardcontroller.class.inc.php b/setup/wizardcontroller.class.inc.php index 0eb73c597..6eb2076e8 100644 --- a/setup/wizardcontroller.class.inc.php +++ b/setup/wizardcontroller.class.inc.php @@ -16,7 +16,6 @@ // // You should have received a copy of the GNU Affero General Public License // along with iTop. If not, see -use Combodo\iTop\Application\WebPage\WebPage; require_once(APPROOT.'setup/setuputils.class.inc.php'); require_once(APPROOT.'setup/parameters.class.inc.php'); @@ -243,6 +242,7 @@ HTML; } $oPage->add(''); $oPage->add(""); + $oStep->PostFormDisplay($oPage); $oPage->add(''); // The div may become visible in case of error // Hack to have the "Next >>" button, be the default button, since the first submit button in the form is the default one diff --git a/setup/wizardsteps/WizStepDataAudit.php b/setup/wizardsteps/WizStepDataAudit.php index a7f6d2b60..e2fb7e2a2 100644 --- a/setup/wizardsteps/WizStepDataAudit.php +++ b/setup/wizardsteps/WizStepDataAudit.php @@ -17,6 +17,7 @@ * * You should have received a copy of the GNU Affero General Public License */ + use Combodo\iTop\Application\WebPage\WebPage; require_once(APPROOT.'setup/sequencers/DataAuditSequencer.php'); @@ -51,7 +52,6 @@ class WizStepDataAudit extends WizStepInstall } else { return false; } - } public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState @@ -76,8 +76,6 @@ class WizStepDataAudit extends WizStepInstall $sAuthentToken = $this->oWizard->GetParameter('authent', ''); $oPage->add(''); - $sApplicationUrl = $this->oWizard->GetParameter('application_url').'pages/exec.php?exec_module=combodo-data-feature-removal&exec_page=index.php'; - $oPage->add(''); if (!$this->CheckDependencies()) { $oPage->error($this->sDependencyIssue); $oPage->add_ready_script(<<oWizard->GetParameter('removed_extensions', "[]"), true); + $aHiddenRemovedExtensionInputs = ""; + $i = 0; + foreach ($aRemovedExtensions as $sExtCode => $sExtLabel) { + $aHiddenRemovedExtensionInputs .= << +INPUT; + } + + $oPage->add( + << + + $aHiddenRemovedExtensionInputs + +HTML + ); } protected function AddProgressErrorScript($oPage, $aRes) @@ -101,8 +127,9 @@ JS); <<'); - $('.ibo-setup--wizard--buttons-container tr td:nth-child(2)').after(''); - + $('.ibo-setup--wizard--buttons-container tr td:nth-child(2)').after(''); + $('#goto-data-feature-removal').on("click", function() { $('#data-feature-removal').submit();}) + $("#wiz_form").data("installation_status", "cleanup_needed"); $('#btn_next').hide(); EOF diff --git a/setup/wizardsteps/WizardStep.php b/setup/wizardsteps/WizardStep.php index dd34d10a9..2e3f2cf2f 100644 --- a/setup/wizardsteps/WizardStep.php +++ b/setup/wizardsteps/WizardStep.php @@ -66,6 +66,16 @@ abstract class WizardStep protected $bDependencyCheck = null; protected $sDependencyIssue = null; + /** + * Add post display stuff to the setup screen + * @param \SetupPage $oPage + * + * @return void + */ + public function PostFormDisplay(SetupPage $oPage) + { + } + protected function CheckDependencies() { if (is_null($this->bDependencyCheck)) {