New: Possibilit de choisir son gestionnaire pour le menu de gauche sur le mme principe que celui du haut.

Les gestionnaires sont  placer dans le rpertoire includes/menus/barre_left. Le gestionnaire par defaut ne fait
rien, ce qui quivaut  prendre la gestion courante des menus (bass sur les fichiers pre.inc.php)
This commit is contained in:
Laurent Destailleur 2005-01-01 19:48:22 +00:00
parent bd3e3f7768
commit ea351ec438
6 changed files with 186 additions and 57 deletions

View File

@ -20,7 +20,7 @@
* $Source$
*/
/*!
/**
\file htdocs/admin/ihm.php
\brief Page de configuration du de l'interface homme machine
\version $Revision$
@ -46,10 +46,12 @@ $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$lan
if ($_POST["action"] == 'update')
{
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"]);
dolibarr_set_const($db, "SIZE_LISTE_LIMIT", $_POST["size_liste_limit"]);
dolibarr_set_const($db, "MAIN_MENU_BARRETOP", $_POST["main_menu_barretop"]);
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"]);
dolibarr_set_const($db, "MAIN_MENU_BARRETOP", $_POST["main_menu_barretop"]);
dolibarr_set_const($db, "MAIN_MENU_BARRELEFT", $_POST["main_menu_barreleft"]);
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"]);
dolibarr_set_const($db, "SIZE_LISTE_LIMIT", $_POST["size_liste_limit"]);
dolibarr_set_const($db, "MAIN_MOTD", trim($_POST["main_motd"]));
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT",$_POST["main_searchform_contact"]);
@ -77,35 +79,18 @@ if ($_GET["action"] == 'edit')
{
print '<form method="post" action="ihm.php">';
clearstatcache();
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="impair"><td>'.$langs->trans("Skin").'</td>';
print '<td><select name="main_theme">';
clearstatcache();
$dir = "../theme/";
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if ($file == MAIN_THEME)
{
print '<option value="'.$file.'" selected>'.$file;
}
else
{
print '<option value="'.$file.'">'.$file;
}
}
}
print '</select>';
print '<input type="hidden" name="action" value="update">';
// Langue par defaut
print '<tr class="pair"><td width="50%">'.$langs->trans("DefaultLanguage").'</td><td>';
$html=new Form($db);
$html->select_lang(MAIN_LANG_DEFAULT,'main_lang_default');
print '</td></tr>';
print '<tr class="pair"><td width="50%">'.$langs->trans("MaxSizeList").'</td><td><input name="size_liste_limit" size="20" value="' . SIZE_LISTE_LIMIT . '"></td></tr>';
// Menu top
print '<tr class="impair"><td width="50%">'.$langs->trans("MenuTopManager").'</td>';
print '<td><select name="main_menu_barretop">';
$dir = "../includes/menus/barre_top/";
@ -129,10 +114,57 @@ if ($_GET["action"] == 'edit')
print '</select>';
print '</td></tr>';
print '<tr class="pair"><td width="50%">'.$langs->trans("DefaultLanguage").'</td><td>';
$html=new Form($db);
$html->select_lang(MAIN_LANG_DEFAULT,'main_lang_default');
// Menu left
print '<tr class="pair"><td width="50%">'.$langs->trans("MenuLeftManager").'</td>';
print '<td><select name="main_menu_barreleft">';
$dir = "../includes/menus/barre_left/";
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (is_file($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filelib=eregi_replace('\.php$','',$file);
if ($file == MAIN_MENU_BARRELEFT)
{
print '<option value="'.$file.'" selected>'.$filelib.'</option>';
}
else
{
print '<option value="'.$file.'">'.$filelib.'</option>';
}
}
}
print '</select>';
print '</td></tr>';
// Theme
print '<tr class="impair"><td>'.$langs->trans("Skin").'</td>';
print '<td><select name="main_theme">';
$dir = "../theme/";
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
if ($file == MAIN_THEME)
{
print '<option value="'.$file.'" selected>'.$file;
}
else
{
print '<option value="'.$file.'">'.$file;
}
}
}
print '</select>';
print '<input type="hidden" name="action" value="update">';
print '</td></tr>';
// Taille max des listes
print '<tr class="pair"><td width="50%">'.$langs->trans("MaxSizeList").'</td><td><input name="size_liste_limit" size="20" value="' . SIZE_LISTE_LIMIT . '"></td></tr>';
// Message of the day
print '<tr class="impair"><td width="50%">'.$langs->trans("MessageOfDay").'</td><td><textarea cols="40" rows="3" name="main_motd" size="20">' .stripslashes(MAIN_MOTD) . '</textarea></td></tr>';
print '</table><br>';
@ -160,13 +192,18 @@ else
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="impair"><td width="50%">'.$langs->trans("Skin").'</td><td>' . MAIN_THEME . '</td></tr>';
print '<tr class="pair"><td>'.$langs->trans("MaxSizeList").'</td><td>' . SIZE_LISTE_LIMIT . '</td></tr>';
print '<tr class="pair"><td width="50%">'.$langs->trans("DefaultLanguage").'</td><td>' . MAIN_LANG_DEFAULT . '</td></tr>';
print '<tr class="impair"><td width="50%">'.$langs->trans("MenuTopManager").'</td><td>';
$filelib=eregi_replace('\.php$','',MAIN_MENU_BARRETOP);
print $filelib;
print '</td></tr>';
print '<tr class="pair"><td width="50%">'.$langs->trans("DefaultLanguage").'</td><td>' . MAIN_LANG_DEFAULT . '</td></tr>';
print '<tr class="pair"><td width="50%">'.$langs->trans("MenuLeftManager").'</td><td>';
$filelib=eregi_replace('\.php$','',MAIN_MENU_BARRELEFT);
print $filelib;
print '</td></tr>';
print '<tr class="impair"><td width="50%">'.$langs->trans("Skin").'</td><td>' . MAIN_THEME . '</td></tr>';
print '<tr class="pair"><td>'.$langs->trans("MaxSizeList").'</td><td>' . SIZE_LISTE_LIMIT . '</td></tr>';
print '<tr class="impair"><td width="50%">'.$langs->trans("MessageOfDay").'</td><td>' . stripslashes(nl2br(MAIN_MOTD)) . '</td></tr>';

View File

@ -0,0 +1,34 @@
<?php
/* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
/**
\file htdocs/includes/menus/barre_left/default.php
\brief Gestionnaire du menu de gauche
\version $Revision$
*/
// Le gestionnaire par defaut ne fait rien: C'est donc le menu défini dans les
// fichiers pre.inc.php du répertoire de la page qui sont utilisés.
?>

View File

@ -0,0 +1,56 @@
<?php
/* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
/**
\file htdocs/includes/menus/barre_left/eldy.php
\brief Gestionnaire du menu de gauche
\version $Revision$
*/
// Ce gestionnaire de menu écrase le tableau $menu pour le définir selon
// ces propres règles prioritairement aux définitions des fichiers pre.inc.php
$newmenu = new Menu();
$newmenu->add(DOL_URL_ROOT."/comm/clients.php", $langs->trans("Customers"));
/*
$class="";
if ($_SESSION["topmenu"] && $_SESSION["topmenu"] == "commercial")
{
$class='class="tmenu" id="sel"';
}
elseif (ereg("^".DOL_URL_ROOT."\/fourn\/",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<a '.$class.' href="'.DOL_URL_ROOT.'/fourn/index.php"'.($target?" target=$target":"").'>'.$langs->trans("Fournisseur").'</a>';
*/
//$menu=$newmenu->liste;
?>

View File

@ -71,6 +71,7 @@ PermanentLeftSearchForm=Permanent search form on left menu
Skin=Skin theme
MaxSizeList=Max length for list
MenuTopManager=Top menu manager
MenuLeftManager=Left menu manager
MessageOfDay=Message of day
DefaultLanguage=Default language to use (language code)
SystemSuccessfulyUpdated=Your sustem has been updated successfully

View File

@ -71,6 +71,7 @@ PermanentLeftSearchForm=Zone de recherche permanente du menu de gauche
Skin=Thème visuel
MaxSizeList=Longueur maximale des listes
MenuTopManager=Gestionnaire du menu du haut
MenuLeftManager=Gestionnaire du menu de gauche
MessageOfDay=Message du jour
DefaultLanguage=Langue par défaut à utiliser (code langue)
SystemSuccessfulyUpdated=Votre système a été mis à jour avec succès

View File

@ -24,7 +24,7 @@
*
*/
/*!
/**
\file htdocs/master.inc.php
\brief Fichier de formatage générique des ecrans Dolibarr
\version $Revision$
@ -107,7 +107,7 @@ if (defined("MAIN_NOT_INSTALLED"))
}
/*!
/**
* \brief Affiche en-tête html + la barre de menu supérieure
* \param head lignes d'en-tete head
* \param title titre page web
@ -213,24 +213,32 @@ function top_menu($head, $title="", $target="")
}
/*!
/**
* \brief Affiche barre de menu gauche
* \param menu Objet du menu gauche
* \param help_url Url pour le lien aide ('' par defaut)
* \param form_search Formulaire de recherche permanant
* \param author Auteur de la page pour ajout en en-tete html
* \param form_search Formulaire de recherche permanant supplémentaire
*/
function left_menu($menu, $help_url='', $form_search='', $author='')
function left_menu($menu, $help_url='', $form_search='')
{
global $user, $conf, $langs;
if (! defined(MAIN_MENU_BARRELEFT))
{
define("MAIN_MENU_BARRELEFT","default.php");
}
// Si un gestionnaire de menu gauche est actif, on l'utilise:
// Ce gestionnnaire est libre d'écrasé ou non l'objet $menu qui détermine le menu à afficher.
require(DOL_DOCUMENT_ROOT ."/includes/menus/barre_left/".MAIN_MENU_BARRELEFT);
print '<div class="vmenuplusfiche" width="158">'."\n";
/*
* Colonne de gauche
*
*/
// Colonne de gauche
print "\n<!-- Debut left vertical menu -->\n";
print '<div class="vmenu">'."\n";
@ -253,9 +261,7 @@ function left_menu($menu, $help_url='', $form_search='', $author='')
print '</div>';
}
/*
* Affichage des zones de recherche permanantes
*/
// Affichage des zones de recherche permanantes
$addzonerecherche=0;
if ($conf->societe->enabled && defined("MAIN_SEARCHFORM_SOCIETE") && MAIN_SEARCHFORM_SOCIETE > 0) $addzonerecherche=1;
if ($conf->societe->enabled && defined("MAIN_SEARCHFORM_CONTACT") && MAIN_SEARCHFORM_CONTACT > 0) $addzonerecherche=1;
@ -286,19 +292,13 @@ function left_menu($menu, $help_url='', $form_search='', $author='')
print '</div>';
}
/*
* Zone de recherche supplémentaire
*/
// Zone de recherche supplémentaire
if (strlen($form_search) > 0)
{
print $form_search;
}
/*
* Lien vers l'aide en ligne
*/
// Lien vers l'aide en ligne
if (strlen($help_url) > 0)
{
@ -319,7 +319,7 @@ function left_menu($menu, $help_url='', $form_search='', $author='')
/*!
/**
* \brief Affiche une zone de recherche
* \param urlaction url du post
* \param urlobject url du lien sur titre de la zone de recherche
@ -340,7 +340,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$
}
/*!
/**
* \brief Impression du pied de page
* \param foot Non utilisé
*/