Qual: Uniformize code

This commit is contained in:
Laurent Destailleur 2009-07-27 22:48:05 +00:00
parent ec1d7c3d36
commit f210d6c889
13 changed files with 788 additions and 774 deletions

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/admin/system/pre.inc.php * \file htdocs/admin/system/pre.inc.php
* \brief Fichier gestionnaire menu page infos système * \brief Fichier gestionnaire menu page infos syst<EFBFBD>me
* \version $Id$ * \version $Id$
*/ */
@ -42,10 +42,10 @@ function llxHeader($head = "", $urlp = "")
// Dolibarr // Dolibarr
$menu->add(DOL_URL_ROOT."/admin/system/dolibarr.php", "Dolibarr"); $menu->add(DOL_URL_ROOT."/admin/system/dolibarr.php", "Dolibarr");
$menu->add_submenu(DOL_URL_ROOT."/admin/system/constall.php", $langs->trans("AllParameters")); $menu->add(DOL_URL_ROOT."/admin/system/constall.php", $langs->trans("AllParameters"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/system/modules.php", $langs->trans("Modules")); $menu->add(DOL_URL_ROOT."/admin/system/modules.php", $langs->trans("Modules"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/triggers.php", $langs->trans("Triggers")); $menu->add(DOL_URL_ROOT."/admin/triggers.php", $langs->trans("Triggers"),1);
$menu->add_submenu(DOL_URL_ROOT."/about.php", $langs->trans("About")); $menu->add(DOL_URL_ROOT."/about.php", $langs->trans("About"),1);
// OS // OS
$menu->add(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS")); $menu->add(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS"));
@ -61,8 +61,8 @@ function llxHeader($head = "", $urlp = "")
// Database // Database
$menu->add(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database")); $menu->add(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database"));
$menu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables")); $menu->add(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints")); $menu->add(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"),1);
left_menu($menu->liste); left_menu($menu->liste);
} }

View File

@ -35,13 +35,13 @@ function llxHeader($head = '', $title='', $help_url='')
$menu = new Menu(); $menu = new Menu();
$menu->add(DOL_URL_ROOT."/admin/tools/index.php", "SystemTools"); $menu->add(DOL_URL_ROOT."/admin/tools/index.php", $langs->trans("SystemTools"));
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup")); $menu->add(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore")); $menu->add(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade")); $menu->add(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade"),1);
if (function_exists('eaccelerator_info')) $menu->add_submenu(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator")); if (function_exists('eaccelerator_info')) $menu->add(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit")); $menu->add(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit"),1);
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge")); $menu->add(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1);
left_menu($menu->liste, $help_url); left_menu($menu->liste, $help_url);
} }

View File

@ -14,17 +14,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/ */
/** /**
\file htdocs/bookmarks/pre.inc.php \file htdocs/bookmarks/pre.inc.php
\ingroup bookmark \ingroup bookmark
\brief Fichier de gestion du menu gauche des bookmarks \brief Fichier de gestion du menu gauche des bookmarks
\version $Revision$ \version $Id$
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -42,9 +38,9 @@ function llxHeader($head = '', $title='', $help_url='')
// Bookmarks // Bookmarks
if ($conf->bookmark->enabled) if ($conf->bookmark->enabled)
{ {
if ($user->rights->bookmark->lire) $menu->add(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("Bookmarks")); if ($user->rights->bookmark->lire) $menu->add(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("Bookmarks"));
if ($user->rights->bookmark->creer) $menu->add_submenu(DOL_URL_ROOT."/bookmarks/fiche.php?action=create", $langs->trans("NewBookmark")); if ($user->rights->bookmark->creer) $menu->add(DOL_URL_ROOT."/bookmarks/fiche.php?action=create", $langs->trans("NewBookmark"),1);
if ($user->rights->bookmark->lire) $menu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List")); if ($user->rights->bookmark->lire) $menu->add(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"),1);
} }
left_menu($menu->liste); left_menu($menu->liste);

View File

@ -510,7 +510,7 @@ class Menubase
{ {
// print "x".$pere." ".$tab[$x][6]; // print "x".$pere." ".$tab[$x][6];
$this->newmenu->add_submenu((! eregi($tab[$x][2],"^(http:\/\/|https:\/\/)")) ? DOL_URL_ROOT . $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5]); $this->newmenu->add((! eregi($tab[$x][2],"^(http:\/\/|https:\/\/)")) ? DOL_URL_ROOT . $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5]);
$this->recur($tab, $tab[$x][0], $rang +1); $this->recur($tab, $tab[$x][0], $rang +1);
} }
} }

View File

@ -23,11 +23,11 @@
\version $Id$ \version $Id$
\remarks La construction d'un gestionnaire pour le menu de gauche est simple: \remarks La construction d'un gestionnaire pour le menu de gauche est simple:
\remarks A l'aide d'un objet $newmenu=new Menu() et des m<EFBFBD>thode add et add_submenu, \remarks A l'aide d'un objet $newmenu=new Menu() et de la methode add,
\remarks d<EFBFBD>finir la liste des entr<EFBFBD>es menu <EFBFBD> faire apparaitre. \remarks definir la liste des entrees menu a faire apparaitre.
\remarks En fin de code, mettre la ligne $menu=$newmenu->liste. \remarks En fin de code, mettre la ligne $menu=$newmenu->liste.
\remarks Ce qui est d<EFBFBD>fini dans un tel gestionnaire sera alors prioritaire sur \remarks Ce qui est defini dans un tel gestionnaire sera alors prioritaire sur
\remarks les d<EFBFBD>finitions de menu des fichiers pre.inc.php \remarks les definitions de menu des fichiers pre.inc.php
*/ */

View File

@ -23,11 +23,11 @@
\version $Id$ \version $Id$
\remarks La construction d'un gestionnaire pour le menu de gauche est simple: \remarks La construction d'un gestionnaire pour le menu de gauche est simple:
\remarks A l'aide d'un objet $newmenu=new Menu() et des m<EFBFBD>thode add et add_submenu, \remarks A l'aide d'un objet $newmenu=new Menu() et de la methode add,
\remarks d<EFBFBD>finir la liste des entr<EFBFBD>es menu <EFBFBD> faire apparaitre. \remarks definir la liste des entrees menu a faire apparaitre.
\remarks En fin de code, mettre la ligne $menu=$newmenu->liste. \remarks En fin de code, mettre la ligne $menu=$newmenu->liste.
\remarks Ce qui est d<EFBFBD>fini dans un tel gestionnaire sera alors prioritaire sur \remarks Ce qui est defini dans un tel gestionnaire sera alors prioritaire sur
\remarks les d<EFBFBD>finitions de menu des fichiers pre.inc.php \remarks les definitions de menu des fichiers pre.inc.php
*/ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ class MenuLeft {
var $require_top=array("empty"); // If this top menu handler must be used with a particular left menu handler var $require_top=array("empty"); // If this top menu handler must be used with a particular left menu handler
/** /**
* \brief Constructor * \brief Constructor
* \param db Dabatase handler * \param db Dabatase handler
@ -41,8 +41,8 @@ class MenuLeft {
$this->db=$db; $this->db=$db;
$this->menu_array=$menu_array; $this->menu_array=$menu_array;
} }
/** /**
* \brief Show menu * \brief Show menu
*/ */
@ -50,33 +50,33 @@ class MenuLeft {
{ {
global $user,$conf,$langs,$dolibarr_main_db_name; global $user,$conf,$langs,$dolibarr_main_db_name;
$newmenu = new Menu(); $newmenu = new Menu();
// Put here left menu entries // Put here left menu entries
// ***** START ***** // ***** START *****
$langs->load("admin"); // Load translation file admin.lang $langs->load("admin"); // Load translation file admin.lang
$newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup")); $newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/company.php", $langs->trans("MenuCompanySetup")); $newmenu->add(DOL_URL_ROOT."/admin/company.php", $langs->trans("MenuCompanySetup"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules")); $newmenu->add(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/menus.php", $langs->trans("Menus")); $newmenu->add(DOL_URL_ROOT."/admin/menus.php", $langs->trans("Menus"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup")); $newmenu->add(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes")); $newmenu->add(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/delais.php",$langs->trans("Alerts")); $newmenu->add(DOL_URL_ROOT."/admin/delais.php",$langs->trans("Alerts"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security")); $newmenu->add(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/mails.php", $langs->trans("EMails")); $newmenu->add(DOL_URL_ROOT."/admin/mails.php", $langs->trans("EMails"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/limits.php", $langs->trans("Limits")); $newmenu->add(DOL_URL_ROOT."/admin/limits.php", $langs->trans("Limits"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup")); $newmenu->add(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup"),1);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup")); $newmenu->add(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup"),1);
// ***** END ***** // ***** END *****
// do not change code after this // do not change code after this
// override menu_array by value array in $newmenu // override menu_array by value array in $newmenu
$this->menu_array=$newmenu->liste; $this->menu_array=$newmenu->liste;
$alt=0; $alt=0;
for ($i = 0 ; $i < sizeof($this->menu_array) ; $i++) for ($i = 0 ; $i < sizeof($this->menu_array) ; $i++)
{ {
$alt++; $alt++;
if ($this->menu_array[$i]['level']==0) { if ($this->menu_array[$i]['level']==0) {
@ -93,35 +93,35 @@ class MenuLeft {
if ($this->menu_array[$i]['level']==0) { if ($this->menu_array[$i]['level']==0) {
if ($this->menu_array[$i]['enabled']) if ($this->menu_array[$i]['enabled'])
print '<a class="vmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>'; print '<a class="vmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else else
print '<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>'; print '<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
} }
if ($this->menu_array[$i]['level']==1) { if ($this->menu_array[$i]['level']==1) {
if ($this->menu_array[$i]['enabled']) if ($this->menu_array[$i]['enabled'])
print '<a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>'; print '<a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else else
print '<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>'; print '<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
} }
if ($this->menu_array[$i]['level']==2) { if ($this->menu_array[$i]['level']==2) {
if ($this->menu_array[$i]['enabled']) if ($this->menu_array[$i]['enabled'])
print '&nbsp; &nbsp; <a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>'; print '&nbsp; &nbsp; <a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else else
print '&nbsp; &nbsp; <font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>'; print '&nbsp; &nbsp; <font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
} }
if ($this->menu_array[$i]['level']==3) { if ($this->menu_array[$i]['level']==3) {
if ($this->menu_array[$i]['enabled']) if ($this->menu_array[$i]['enabled'])
print '&nbsp; &nbsp; &nbsp; &nbsp; <a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>'; print '&nbsp; &nbsp; &nbsp; &nbsp; <a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else else
print '&nbsp; &nbsp; &nbsp; &nbsp; <font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>'; print '&nbsp; &nbsp; &nbsp; &nbsp; <font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
} }
if ($i == (sizeof($this->menu_array)-1) || $this->menu_array[$i+1]['level']==0) { if ($i == (sizeof($this->menu_array)-1) || $this->menu_array[$i+1]['level']==0) {
print "</div>\n"; print "</div>\n";
} }
} }
} }
} }
?> ?>

View File

@ -17,15 +17,15 @@
*/ */
/** \file htdocs/includes/menus/barre_left/rodolphe.php /** \file htdocs/includes/menus/barre_left/rodolphe.php
\brief Gestionnaire par d<EFBFBD>faut du menu de gauche \brief Gestionnaire du menu de gauche Rodolphe
\version $Id$ \version $Id$
\remarks La construction d'un gestionnaire pour le menu de gauche est simple: \remarks La construction d'un gestionnaire pour le menu de gauche est simple:
\remarks A l'aide d'un objet $newmenu=new Menu() et des m<EFBFBD>thode add et add_submenu, \remarks A l'aide d'un objet $newmenu=new Menu() et de la methode add,
\remarks d<EFBFBD>finir la liste des entr<EFBFBD>es menu <EFBFBD> faire apparaitre. \remarks definir la liste des entrees menu a faire apparaitre.
\remarks En fin de code, mettre la ligne $menu=$newmenu->liste. \remarks En fin de code, mettre la ligne $menu=$newmenu->liste.
\remarks Ce qui est d<EFBFBD>finir dans un tel gestionnaire sera alors prioritaire sur \remarks Ce qui est definir dans un tel gestionnaire sera alors prioritaire sur
\remarks les d<EFBFBD>finitions de menu des fichiers pre.inc.php \remarks les definitions de menu des fichiers pre.inc.php
*/ */
@ -39,7 +39,7 @@ class MenuLeft {
var $require_top=array(""); // Si doit etre en phase avec un gestionnaire de menu du haut particulier var $require_top=array(""); // Si doit etre en phase avec un gestionnaire de menu du haut particulier
/** /**
* \brief Constructeur * \brief Constructeur
* \param db Handler d'acc<EFBFBD>s base de donn<EFBFBD>e * \param db Handler d'acc<EFBFBD>s base de donn<EFBFBD>e
@ -50,8 +50,8 @@ class MenuLeft {
$this->db=$db; $this->db=$db;
$this->menu_array=$menu_array; $this->menu_array=$menu_array;
} }
/** /**
* \brief Affiche le menu * \brief Affiche le menu
*/ */
@ -91,9 +91,9 @@ class MenuLeft {
// On va le chercher en session si non d<>fini par le lien // On va le chercher en session si non d<>fini par le lien
$leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:'';
} }
$newmenu = new Menu(); $newmenu = new Menu();
if ($mainmenu) if ($mainmenu)
{ {
require_once(DOL_DOCUMENT_ROOT."/core/menubase.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/menubase.class.php");
@ -101,7 +101,7 @@ class MenuLeft {
$this->menuArbo = new Menubase($this->db,'rodolphe','left'); $this->menuArbo = new Menubase($this->db,'rodolphe','left');
$this->overwritemenufor = $this->menuArbo->listeMainmenu(); $this->overwritemenufor = $this->menuArbo->listeMainmenu();
$newmenu = $this->menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,0,'eldy'); $newmenu = $this->menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,0,'eldy');
/* /*
* Menu AUTRES (Pour les menus du haut qui ne serait pas g<EFBFBD>r<EFBFBD>s) * Menu AUTRES (Pour les menus du haut qui ne serait pas g<EFBFBD>r<EFBFBD>s)
*/ */
@ -115,7 +115,7 @@ class MenuLeft {
if ($mainmenu) { if ($mainmenu) {
$this->menu_array=$newmenu->liste; $this->menu_array=$newmenu->liste;
} }
// Affichage du menu // Affichage du menu
$alt=0; $alt=0;
if (! sizeof($this->menu_array)) if (! sizeof($this->menu_array))
@ -152,7 +152,7 @@ class MenuLeft {
$tabstring.='&nbsp; &nbsp;'; $tabstring.='&nbsp; &nbsp;';
} }
} }
// Menu niveau 0 // Menu niveau 0
if ($this->menu_array[$i]['level'] == 0) if ($this->menu_array[$i]['level'] == 0)
{ {
@ -195,11 +195,11 @@ class MenuLeft {
} }
} }
if ($contenu == 1) print '<div class="menu_fin"></div>'."\n"; if ($contenu == 1) print '<div class="menu_fin"></div>'."\n";
} }
} }
} }
?> ?>

View File

@ -162,8 +162,13 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
// Detection browser // Detection browser
if (isset($_SERVER["HTTP_USER_AGENT"])) if (isset($_SERVER["HTTP_USER_AGENT"]))
{ {
if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='firefox';
if (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; elseif (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='iceweasel';
elseif (eregi('safari',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='safari';
elseif (eregi('chrome',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='chrome';
elseif (eregi('opera',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='opera';
elseif (eregi('msie',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='ie';
if (in_array($conf->browser->name,array('firefox','iceweasel'))) $conf->browser->firefox=1;
} }
// Chargement des includes principaux de librairies communes // Chargement des includes principaux de librairies communes

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -18,27 +18,26 @@
*/ */
/** /**
\file htdocs/menu.class.php * \file htdocs/menu.class.php
\brief Fichier de la classe de gestion du menu gauche * \brief Fichier de la classe de gestion du menu gauche
\version $Id$ * \version $Id$
*/ */
/** /**
\class Menu * \class Menu
\brief Classe de gestion du menu gauche * \brief Classe de gestion du menu gauche
*/ */
class Menu { class Menu {
var $liste; var $liste;
/** /**
* \brief Constructeur classe menu * \brief Constructor for class menu
*/ */
function Menu() function Menu()
{ {
$this->liste = array(); $this->liste = array();
} }
/** /**
@ -50,7 +49,7 @@ class Menu {
} }
/** /**
* \brief Ajoute une entree de menu * \brief Add a menu entry
* \param url Url a suivre sur le clic * \param url Url a suivre sur le clic
* \param titre Libelle menu a afficher * \param titre Libelle menu a afficher
* \param level Niveau du menu a ajouter * \param level Niveau du menu a ajouter
@ -68,25 +67,24 @@ class Menu {
} }
/** /**
* \brief Supprime la derniere entree de menu * \brief Remove a menu entry
*/ */
function remove_last() function remove_last()
{ {
if (sizeof($this->liste) > 1) if (sizeof($this->liste) > 1) array_pop($this->liste);
array_pop($this->liste);
} }
/** /**
* \brief Ajoute une entree de menu de niveau inferieur * \brief Add a menu entry
* \param url Url a suivre sur le clic * \param url Url to follown on click
* \param titre Libelle menu a afficher * \param titre Menu label to show
* \param level Niveau du menu a ajouter * \param level Level of menu to show (0=First level, 1=Second...)
* \param enabled Menu actif ou non * \param enabled Menu active or not
* \param target Target lien * \param target Target lien
* \deprecated
*/ */
function add_submenu($url, $titre, $level=1, $enabled=1, $target='') function add_submenu($url, $titre, $level=1, $enabled=1, $target='')
{ {
$i = sizeof($this->liste) - 1;
$this->add($url, $titre, $level, $enabled, $target); $this->add($url, $titre, $level, $enabled, $target);
} }

View File

@ -21,9 +21,9 @@
*/ */
/** /**
\file htdocs/pre.inc.php * \file htdocs/pre.inc.php
\brief File to manage left menu for home page * \brief File to manage left menu for home page
\version $Id$ * \version $Id$
*/ */
require ("./main.inc.php"); require ("./main.inc.php");
@ -43,10 +43,10 @@ function llxHeader($head = '', $title='', $help_url='')
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
$menu->add_submenu(DOL_URL_ROOT."/soc.php?action=create", $langs->trans("MenuNewThirdParty")); $menu->add(DOL_URL_ROOT."/soc.php?action=create", $langs->trans("MenuNewThirdParty"),1);
} }
$menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts")); $menu->add(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"),1);
} }
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
@ -69,21 +69,6 @@ function llxHeader($head = '', $title='', $help_url='')
if ($conf->produit->enabled && $conf->service->enabled) { $chaine.="/"; } if ($conf->produit->enabled && $conf->service->enabled) { $chaine.="/"; }
if ($conf->service->enabled) { $chaine.= $langs->trans("Services"); } if ($conf->service->enabled) { $chaine.= $langs->trans("Services"); }
$menu->add(DOL_URL_ROOT."/product/index.php", "$chaine"); $menu->add(DOL_URL_ROOT."/product/index.php", "$chaine");
/*
if ($conf->boutique->enabled)
{
if ($conf->boutique->livre->enabled)
{
$menu->add_submenu(DOL_URL_ROOT."/boutique/livre/index.php", "Livres");
}
if ($conf->boutique->album->enabled)
{
$menu->add_submenu(DOL_URL_ROOT."/product/album/index.php", "Albums");
}
}
*/
} }
@ -129,8 +114,8 @@ function llxHeader($head = '', $title='', $help_url='')
if (! empty($conf->voyage->enabled) && $user->societe_id == 0) if (! empty($conf->voyage->enabled) && $user->societe_id == 0)
{ {
$menu->add(DOL_URL_ROOT."/compta/voyage/index.php","Voyages"); $menu->add(DOL_URL_ROOT."/compta/voyage/index.php","Voyages");
$menu->add_submenu(DOL_URL_ROOT."/compta/voyage/index.php","Voyages"); $menu->add(DOL_URL_ROOT."/compta/voyage/index.php","Voyages",1);
$menu->add_submenu(DOL_URL_ROOT."/compta/voyage/reduc.php","Reduc"); $menu->add(DOL_URL_ROOT."/compta/voyage/reduc.php","Reduc",1);
} }
if (! empty($conf->domaine->enabled)) if (! empty($conf->domaine->enabled))
@ -141,15 +126,15 @@ function llxHeader($head = '', $title='', $help_url='')
if (! empty($conf->export->enabled)) if (! empty($conf->export->enabled))
{ {
$langs->load("exports"); $langs->load("exports");
$menu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0, $user->rights->export->lire); $menu->add(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0,$user->rights->export->lire);
$menu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1, $user->rights->export->creer); $menu->add(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1,$user->rights->export->creer);
} }
if (! empty($conf->global->MAIN_MODULE_IMPORT)) if (! empty($conf->global->MAIN_MODULE_IMPORT))
{ {
$langs->load("exports"); $langs->load("exports");
$menu->add_submenu(DOL_URL_ROOT."/imports/index.php?leftmenu=import",$langs->trans("FormatedImport"),0, $user->rights->import->lire); $menu->add(DOL_URL_ROOT."/imports/index.php?leftmenu=import",$langs->trans("FormatedImport"),0,$user->rights->import->lire);
$menu->add_submenu(DOL_URL_ROOT."/imports/import.php?leftmenu=import",$langs->trans("NewImport"),1, $user->rights->import->creer); $menu->add(DOL_URL_ROOT."/imports/import.php?leftmenu=import",$langs->trans("NewImport"),1,$user->rights->import->creer);
} }
if ($user->rights->user->user->lire || $user->admin) if ($user->rights->user->user->lire || $user->admin)