NEW Ihm admin - Add tabs

This commit is contained in:
Alexandre SPANGARO 2021-08-17 21:29:15 +02:00
parent 4b89a45ade
commit a7cb9b2143
2 changed files with 266 additions and 222 deletions

View File

@ -43,6 +43,13 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other'
$defaultlanguage = GETPOST('defaultlanguage', 'alphanohtml');
$defaulttemplate = GETPOST('defaulttemplate', 'alphanohtml');
$defaultlogin = GETPOST('defaultlogin', 'alphanohtml');
$defaultother = GETPOST('defaultother', 'alphanohtml');
if (!defined("MAIN_MOTD")) { if (!defined("MAIN_MOTD")) {
define("MAIN_MOTD", ""); define("MAIN_MOTD", "");
} }
@ -267,6 +274,8 @@ if ($action == 'update') {
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode;
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
@ -274,22 +283,40 @@ $formadmin = new FormAdmin($db);
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
print "<br>\n";
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($defaultlanguage) {
$param .= '&defaultlanguage='.urlencode($defaultlanguage);
}
if ($defaulttemplate) {
$param .= '&defaulttemplate='.urlencode($defaulttemplate);
}
if ($defaultlogin) {
$param .= '&defaultlogin='.urlencode($defaultlogin);
}
if ($defaultother) {
$param .= '&defaultother='.urlencode($defaultother);
}
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'?mode='.$mode.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="page_y" value="">';
clearstatcache(); clearstatcache();
print '<br>'; $head = ihm_prepare_head();
print dol_get_fiche_head($head, $mode, '', -1, '');
if ($mode == 'language') {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">'; print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th>'.img_picto('', 'language').' '.$langs->trans("Language").'</th><th></th>';
print '</tr>';
// Default language // Default language
print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
@ -307,30 +334,17 @@ print '</tr>';
print '</table>' . "\n"; print '</table>' . "\n";
print '</div>'; print '</div>';
}
print '<br>'; if ($mode == 'template') {
print '<div class="center">';
print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '<br><br>';
// Themes and themes options // Themes and themes options
showSkins(null, 1); showSkins(null, 1);
print '<br>'; }
print '<div class="center">';
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '<br><br>';
if ($mode == 'other') {
// Other // Other
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">'; print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("Miscellaneous").'</th>';
print '<th></th>';
print '<th width="20">&nbsp;</tg>';
print '</tr>';
// Disable javascript and ajax // Disable javascript and ajax
print '<tr class="oddeven"><td>' . $langs->trans("DisableJavascript") . '</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("DisableJavascript") . '</td><td>';
@ -451,22 +465,12 @@ print '</td></tr>'."\n";
print '</table>' . "\n"; print '</table>' . "\n";
print '</div>'; print '</div>';
}
print '<br>'; if ($mode == 'login') {
print '<div class="center">';
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '<br><br>';
// Other // Other
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">'; print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("LoginPage").'</th>';
print '<th></th>';
print '<th width="20">&nbsp;</th>';
print '</tr>';
// Hide helpcenter link on login page // Hide helpcenter link on login page
print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
@ -514,6 +518,7 @@ print '</td></tr>';
print '</table>' . "\n"; print '</table>' . "\n";
print '</div>'; print '</div>';
}
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';

View File

@ -636,7 +636,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
* @param int $nbofactivatedmodules Number f oactivated modules * @param int $nbofactivatedmodules Number if activated modules
* @param int $nboftotalmodules Nb of total modules * @param int $nboftotalmodules Nb of total modules
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
@ -679,6 +679,45 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
return $head; return $head;
} }
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to show
*/
function ihm_prepare_head()
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=language";
$head[$h][1] = $langs->trans("DefaultLanguage");
$head[$h][2] = 'language';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=template";
$head[$h][1] = $langs->trans("DefaultSkin");
$head[$h][2] = 'template';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login";
$head[$h][1] = $langs->trans("LoginPage");
$head[$h][2] = 'login';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=other";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'other';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin', 'remove');
return $head;
}
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs