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-2012 Regis Houssin <regis.houssin@capnetworks.com>
* 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
* 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("ChooseYourSetupMode");
print '<br /><br />';
$foundrecommandedchoice=0;
// Array of install choices
print '<table width="100%" class="listofchoices">';
$available_choices = array();
$notavailable_choices = array();
// Show first install line
print '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("FreshInstall").'</b>';
print '</td>';
print '<td class="listofchoices">';
print $langs->trans("FreshInstallDesc");
$choice = '<tr class="listofchoices"><td class="listofchoices nowrap" align="center"><b>'.$langs->trans("FreshInstall").'</b>';
$choice .= '</td>';
$choice .= '<td class="listofchoices">';
$choice .= $langs->trans("FreshInstallDesc");
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 '<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"> ';
$foundrecommandedchoice=1; // To show only once
}
print '</td>';
print '<td class="listofchoices" align="center">';
$choice .= '</td>';
$choice .= '<td class="listofchoices" align="center">';
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
{
print $langs->trans("InstallNotAllowed");
$choice .= $langs->trans("InstallNotAllowed");
}
print '</td>';
print '</tr>'."\n";
$choice .= '</td>';
$choice .= '</tr>'."\n";
if ($allowinstall) {
$available_choices[] = $choice;
} else {
$notavailable_choices[] = $choice;
}
// Show upgrade lines
$allowupgrade=true;
@ -392,7 +399,11 @@ else
$count=0;
foreach ($migrationscript as $migarray)
{
$choice = '';
$count++;
$recommended_choice = false;
$version=DOL_VERSION;
$versionfrom=$migarray['from'];
$versionto=$migarray['to'];
@ -407,58 +418,110 @@ else
{
$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 (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 '<br>';
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
print '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>';
if ($count < count($migarray)) // There is other choices after
{
print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION);
}
print '</center>';
// <img src="../theme/eldy/img/tick.png" alt="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 '</td>';
print '<td class="listofchoices" align="center">';
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 .= '<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>';
$choice .= '<td class="listofchoices">';
$choice .= $langs->trans("UpgradeDesc");
if ($recommended_choice) {
$choice .= '<br>';
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
$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 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
{
print $langs->trans("NotAvailable");
$choice .= $langs->trans("NotAvailable");
}
print '</td>';
print '</tr>'."\n";
$choice .= '</td>';
$choice .= '</tr>'."\n";
if ($allowupgrade) {
$available_choices[] = $choice;
} else {
$notavailable_choices[] = $choice;
}
}
print '</table>';
print "\n";
// Array of install choices
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

View File

@ -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