From d0e5d9fd1bccbf1d9620af0033c3b38da1f0edd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 5 May 2014 12:08:19 +0200 Subject: [PATCH 1/2] Improved usability of install wizard --- htdocs/install/check.php | 166 ++++++++++++++++++++++---------- htdocs/langs/en_US/install.lang | 3 + 2 files changed, 117 insertions(+), 52 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index a2d64df5019..769331efa97 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -331,39 +331,45 @@ else print $langs->trans("InstallEasy")." "; print $langs->trans("ChooseYourSetupMode"); + print '

'; $foundrecommandedchoice=0; - - // Array of install choices - print ''; + $available_choices = array(); + $notavailable_choices = array(); // Show first install line - print ''; - print ''; + $choice .= ''; - print ''; + $choice .= ''; - print ''."\n"; + $choice .= ''; + $choice .= ''."\n"; + if ($allowinstall) { + $available_choices[] = $choice; + } else { + $notavailable_choices[] = $choice; + } // Show upgrade lines $allowupgrade=true; @@ -392,7 +398,11 @@ else $count=0; foreach ($migrationscript as $migarray) { + + $choice = ''; + $count++; + $recommended_choice = false; $version=DOL_VERSION; $versionfrom=$migarray['from']; $versionto=$migarray['to']; @@ -407,58 +417,110 @@ else { $newversionfrombis=' '.$langs->trans("or").' '.$versionto; } - print ''; - print ''; - print ''; + $choice .= ''; + $choice .= ''; + $choice .= ''; - print ''."\n"; + $choice .= ''; + $choice .= ''."\n"; + + if ($allowupgrade) { + $available_choices[] = $choice; + } else { + $notavailable_choices[] = $choice; + } } - print '
'.$langs->trans("FreshInstall").''; - print ''; - print $langs->trans("FreshInstallDesc"); + $choice = '
'.$langs->trans("FreshInstall").''; + $choice .= ''; + $choice .= $langs->trans("FreshInstallDesc"); if (empty($dolibarr_main_db_host)) // This means install process was not run { - print '
'; + $choice .= '
'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); - print '
'.$langs->trans("InstallChoiceSuggested").'
'; + $choice .= '
'.$langs->trans("InstallChoiceSuggested").'
'; // Ok '; $foundrecommandedchoice=1; // To show only once } - print '
'; + + $choice .= ''; if ($allowinstall) { - print ''.$langs->trans("Start").''; + $choice .= ''.$langs->trans("Start").''; } else { - print $langs->trans("InstallNotAllowed"); + $choice .= $langs->trans("InstallNotAllowed"); } - print '
'.$langs->trans("Upgrade").'
'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'
'; - print $langs->trans("UpgradeDesc"); - if ($ok) - { - if (count($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and last upgrade version is known - { - // Now we check if this is the first qualified choice - if ($allowupgrade && empty($foundrecommandedchoice) && - (versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$versionarray) < -2) - ) - { - print '
'; - //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); - print '
'.$langs->trans("InstallChoiceSuggested").'
'; - if ($count < count($migarray)) // There is other choices after - { - print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION); - } - print '
'; - // Ok '; - $foundrecommandedchoice=1; // To show only once - } - } - else { - // We can not recommand a choice. - // A version of install may be known, but we need last upgrade. - } - } - print '
'; + if ($ok) + { + if (count($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and last upgrade version is known + { + // Now we check if this is the first qualified choice + if ($allowupgrade && empty($foundrecommandedchoice) && + (versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$versionarray) < -2) + ) + { + $foundrecommandedchoice=1; // To show only once + $recommended_choice = true; + } + } + else { + // We can not recommand a choice. + // A version of install may be known, but we need last upgrade. + } + } + + $choice .= '
'.$langs->trans("Upgrade").'
'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'
'; + $choice .= $langs->trans("UpgradeDesc"); + + if ($recommended_choice) { + $choice .= '
'; + //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); + $choice .= '
'.$langs->trans("InstallChoiceSuggested").'
'; + if ($count < count($migarray)) // There is other choices after + { + print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION); + } + $choice .= '
'; + } + + $choice .= '
'; if ($allowupgrade) { // If it's not last updagre script, action = upgrade_tmp, if last action = upgrade - print ''.$langs->trans("Start").''; + $choice .= ''.$langs->trans("Start").''; } else { - print $langs->trans("NotAvailable"); + $choice .= $langs->trans("NotAvailable"); } - print '
'; - print "\n"; + // Array of install choices + print ''; + foreach ($available_choices as $choice) { + print $choice; + } + + print '
'; + + if (count($notavailable_choices)) { + + print '
'; + print '
'; + print ' '.$langs->trans('ShowNotAvailableOptions').''; + print '
'; + + print ''; + } + } } +print ''; pFooter(1); // 1 car ne doit jamais afficher bouton Suivant diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index d4da279f8cb..20abe7b9c70 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -206,3 +206,6 @@ MigrationProjectTaskTime=Update time spent in seconds MigrationActioncommElement=Update data on actions MigrationPaymentMode=Data migration for payment mode MigrationCategorieAssociation=Migration of categories + +ShowNotAvailableOptions=Show not available options +HideNotAvailableOptions=Hide not available options \ No newline at end of file From 8532f967af0b6c9662ff560cf6a60245a5143408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 5 May 2014 12:24:39 +0200 Subject: [PATCH 2/2] Missing Copyright info --- htdocs/install/check.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 769331efa97..7e2f57cfb02 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos GarcĂ­a * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by