Merge pull request #1574 from marcosgdf/usability

Improved usability of install wizard
This commit is contained in:
Laurent Destailleur 2014-05-06 10:12:28 +02:00
commit 77e85fe821
2 changed files with 118 additions and 52 deletions

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -331,39 +332,45 @@ else
print $langs->trans("InstallEasy")." "; print $langs->trans("InstallEasy")." ";
print $langs->trans("ChooseYourSetupMode"); print $langs->trans("ChooseYourSetupMode");
print '<br /><br />';
$foundrecommandedchoice=0; $foundrecommandedchoice=0;
$available_choices = array();
// Array of install choices $notavailable_choices = array();
print '<table width="100%" class="listofchoices">';
// Show first install line // Show first install line
print '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("FreshInstall").'</b>'; $choice = '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("FreshInstall").'</b>';
print '</td>'; $choice .= '</td>';
print '<td class="listofchoices">'; $choice .= '<td class="listofchoices">';
print $langs->trans("FreshInstallDesc"); $choice .= $langs->trans("FreshInstallDesc");
if (empty($dolibarr_main_db_host)) // This means install process was not run if (empty($dolibarr_main_db_host)) // This means install process was not run
{ {
print '<br>'; $choice .= '<br>';
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
print '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div></center>'; $choice .= '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div></center>';
// <img src="../theme/eldy/img/tick.png" alt="Ok"> '; // <img src="../theme/eldy/img/tick.png" alt="Ok"> ';
$foundrecommandedchoice=1; // To show only once $foundrecommandedchoice=1; // To show only once
} }
print '</td>';
print '<td class="listofchoices" align="center">'; $choice .= '</td>';
$choice .= '<td class="listofchoices" align="center">';
if ($allowinstall) if ($allowinstall)
{ {
print '<a class="button" href="fileconf.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>'; $choice .= '<a class="button" href="fileconf.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
} }
else else
{ {
print $langs->trans("InstallNotAllowed"); $choice .= $langs->trans("InstallNotAllowed");
} }
print '</td>'; $choice .= '</td>';
print '</tr>'."\n"; $choice .= '</tr>'."\n";
if ($allowinstall) {
$available_choices[] = $choice;
} else {
$notavailable_choices[] = $choice;
}
// Show upgrade lines // Show upgrade lines
$allowupgrade=true; $allowupgrade=true;
@ -392,7 +399,11 @@ else
$count=0; $count=0;
foreach ($migrationscript as $migarray) foreach ($migrationscript as $migarray)
{ {
$choice = '';
$count++; $count++;
$recommended_choice = false;
$version=DOL_VERSION; $version=DOL_VERSION;
$versionfrom=$migarray['from']; $versionfrom=$migarray['from'];
$versionto=$migarray['to']; $versionto=$migarray['to'];
@ -407,58 +418,110 @@ else
{ {
$newversionfrombis=' '.$langs->trans("or").' '.$versionto; $newversionfrombis=' '.$langs->trans("or").' '.$versionto;
} }
print '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
print '<td class="listofchoices">';
print $langs->trans("UpgradeDesc");
if ($ok) if ($ok)
{ {
if (count($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and last upgrade version is known 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 // Now we check if this is the first qualified choice
if ($allowupgrade && empty($foundrecommandedchoice) && if ($allowupgrade && empty($foundrecommandedchoice) &&
(versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$versionarray) < -2) (versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$versionarray) < -2)
) )
{ {
print '<br>'; $foundrecommandedchoice=1; // To show only once
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); $recommended_choice = true;
print '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>'; }
if ($count < count($migarray)) // There is other choices after }
{ else {
print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION); // We can not recommand a choice.
} // A version of install may be known, but we need last upgrade.
print '</center>'; }
// <img src="../theme/eldy/img/tick.png" alt="Ok"> '; }
$foundrecommandedchoice=1; // To show only once
} $choice .= '<tr class="listofchoices" '.($recommended_choice ? 'style="background-color:lightyellow"' : '').'>';
} $choice .= '<td class="listofchoices nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
else { $choice .= '<td class="listofchoices">';
// We can not recommand a choice. $choice .= $langs->trans("UpgradeDesc");
// A version of install may be known, but we need last upgrade.
} if ($recommended_choice) {
} $choice .= '<br>';
print '</td>'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
print '<td class="listofchoices" align="center">'; $choice .= '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>';
if ($count < count($migarray)) // There is other choices after
{
print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION);
}
$choice .= '</center>';
}
$choice .= '</td>';
$choice .= '<td class="listofchoices" align="center">';
if ($allowupgrade) if ($allowupgrade)
{ {
// If it's not last updagre script, action = upgrade_tmp, if last action = upgrade // If it's not last updagre script, action = upgrade_tmp, if last action = upgrade
print '<a class="button" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&amp;selectlang='.$setuplang.'&amp;versionfrom='.$versionfrom.'&amp;versionto='.$versionto.'">'.$langs->trans("Start").'</a>'; $choice .= '<a class="button" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&amp;selectlang='.$setuplang.'&amp;versionfrom='.$versionfrom.'&amp;versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
} }
else else
{ {
print $langs->trans("NotAvailable"); $choice .= $langs->trans("NotAvailable");
} }
print '</td>'; $choice .= '</td>';
print '</tr>'."\n"; $choice .= '</tr>'."\n";
if ($allowupgrade) {
$available_choices[] = $choice;
} else {
$notavailable_choices[] = $choice;
}
} }
print '</table>'; // Array of install choices
print "\n"; print '<table width="100%" class="listofchoices">';
foreach ($available_choices as $choice) {
print $choice;
}
print '</table>';
if (count($notavailable_choices)) {
print '<br />';
print '<div id="AShowChoices">';
print '<img src="../theme/eldy/img/1downarrow.png"> <a href="#">'.$langs->trans('ShowNotAvailableOptions').'</a>';
print '</div>';
print '<div id="navail_choices" style="display:none">';
print '<br />';
print '<table width="100%" class="listofchoices">';
foreach ($notavailable_choices as $choice) {
print $choice;
}
print '</table>';
print '</div>';
}
} }
} }
print '<script type="text/javascript">
$("div#AShowChoices a").click(function() {
$("div#navail_choices").toggle();
if ($("div#navail_choices").css("display") == "none") {
$(this).text("'.$langs->trans('ShowNotAvailableOptions').'");
$(this).parent().children("img").attr("src", "../theme/eldy/img/1downarrow.png");
} else {
$(this).text("'.$langs->trans('HideNotAvailableOptions').'");
$(this).parent().children("img").attr("src", "../theme/eldy/img/1uparrow.png");
}
});
</script>';
pFooter(1); // 1 car ne doit jamais afficher bouton Suivant pFooter(1); // 1 car ne doit jamais afficher bouton Suivant

View File

@ -206,3 +206,6 @@ MigrationProjectTaskTime=Update time spent in seconds
MigrationActioncommElement=Update data on actions MigrationActioncommElement=Update data on actions
MigrationPaymentMode=Data migration for payment mode MigrationPaymentMode=Data migration for payment mode
MigrationCategorieAssociation=Migration of categories MigrationCategorieAssociation=Migration of categories
ShowNotAvailableOptions=Show not available options
HideNotAvailableOptions=Hide not available options