Fix: Option to hide if no permission instead of grey was broken.

This commit is contained in:
Laurent Destailleur 2013-03-24 03:51:49 +01:00
parent 9391d0d2d6
commit a890c7b3ab
3 changed files with 83 additions and 57 deletions

View File

@ -84,9 +84,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
} }
else if ($showmode == 2) $classname='class="tmenu"'; else if ($showmode == 2) $classname='class="tmenu"';
print_start_menu_entry_auguria($idsel,$classname); print_start_menu_entry_auguria($idsel,$classname,$showmode);
print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget));
print_end_menu_entry_auguria(); print_end_menu_entry_auguria($showmode);
} }
print_end_menu_array_auguria(); print_end_menu_array_auguria();
@ -111,12 +111,16 @@ function print_start_menu_array_auguria()
* *
* @param string $idsel Text * @param string $idsel Text
* @param string $classname String to add a css class * @param string $classname String to add a css class
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @return void * @return void
*/ */
function print_start_menu_entry_auguria($idsel,$classname) function print_start_menu_entry_auguria($idsel,$classname,$showmode)
{ {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; if ($showmode)
print '<div class="tmenuleft"></div><div class="tmenucenter">'; {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft"></div><div class="tmenucenter">';
}
} }
/** /**
@ -160,12 +164,16 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
/** /**
* Output end menu entry * Output end menu entry
* *
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @return void * @return void
*/ */
function print_end_menu_entry_auguria() function print_end_menu_entry_auguria($showmode)
{ {
print '</div></li>'; if ($showmode)
print "\n"; {
print '</div></li>';
print "\n";
}
} }
/** /**

View File

@ -55,9 +55,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='home'; $idsel='home';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/index.php?mainmenu=home&amp;leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", ''); $menu->add('/index.php?mainmenu=home&amp;leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", '');
// Third parties // Third parties
@ -73,9 +73,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='companies'; $idsel='companies';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/societe/index.php?mainmenu=companies&amp;leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", ''); $menu->add('/societe/index.php?mainmenu=companies&amp;leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '');
} }
@ -102,9 +102,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
$chaine.=$langs->trans("Services"); $chaine.=$langs->trans("Services");
} }
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($chaine, $showmode, DOL_URL_ROOT.'/product/index.php?mainmenu=products&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($chaine, $showmode, DOL_URL_ROOT.'/product/index.php?mainmenu=products&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "products", ''); $menu->add('/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "products", '');
} }
@ -126,9 +126,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='commercial'; $idsel='commercial';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("Commercial"), $showmode, DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("Commercial"), $showmode, DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", ""); $menu->add('/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "");
} }
@ -146,9 +146,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='accountancy'; $idsel='accountancy';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("MenuFinancial"), $showmode, DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("MenuFinancial"), $showmode, DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", ''); $menu->add('/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", '');
} }
@ -167,9 +167,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='bank'; $idsel='bank';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("MenuBankCash"), $showmode, DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("MenuBankCash"), $showmode, DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", ''); $menu->add('/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '');
} }
@ -187,9 +187,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='project'; $idsel='project';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", ''); $menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", '');
} }
@ -207,9 +207,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='tools'; $idsel='tools';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("Tools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("Tools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", ''); $menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '');
} }
@ -227,9 +227,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='shop'; $idsel='shop';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("OSCommerce"), $showmode, DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("OSCommerce"), $showmode, DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/boutique/index.php?mainmenu=shop&amp;leftmenu=', $langs->trans("OSCommerce"), 0, $showmode, $atarget, "shop", ''); $menu->add('/boutique/index.php?mainmenu=shop&amp;leftmenu=', $langs->trans("OSCommerce"), 0, $showmode, $atarget, "shop", '');
} }
@ -245,9 +245,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='members'; $idsel='members';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("MenuMembers"), $showmode, DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("MenuMembers"), $showmode, DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", ''); $menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '');
} }
@ -289,9 +289,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
} }
else if ($showmode == 2) $classname='class="tmenu"'; else if ($showmode == 2) $classname='class="tmenu"';
if (empty($noout)) print_start_menu_entry($idsel,$classname); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); if (empty($noout)) print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget));
if (empty($noout)) print_end_menu_entry(); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), '');
} }
@ -315,19 +315,23 @@ function print_start_menu_array()
* *
* @param string $idsel Text * @param string $idsel Text
* @param string $classname String to add a css class * @param string $classname String to add a css class
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @return void * @return void
*/ */
function print_start_menu_entry($idsel,$classname) function print_start_menu_entry($idsel,$classname,$showmode)
{ {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; if ($showmode)
print '<div class="tmenuleft"></div><div class="tmenucenter">'; {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft"></div><div class="tmenucenter">';
}
} }
/** /**
* Output menu entry * Output menu entry
* *
* @param string $text Text * @param string $text Text
* @param int $showmode 1 = allowed or 2 = not allowed * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @param string $url Url * @param string $url Url
* @param string $id Id * @param string $id Id
* @param string $idsel Id sel * @param string $idsel Id sel
@ -364,11 +368,15 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
/** /**
* Output end menu entry * Output end menu entry
* *
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @return void * @return void
*/ */
function print_end_menu_entry() function print_end_menu_entry($showmode)
{ {
print '</div></li>'; if ($showmode)
{
print '</div></li>';
}
print "\n"; print "\n";
} }

View File

@ -76,12 +76,14 @@ class MenuManager
{ {
print_start_menu_array_empty(); print_start_menu_array_empty();
// Home
$showmode=1;
$idsel='home'; $idsel='home';
$classname='class="tmenusel"'; $classname='class="tmenusel"';
print_start_menu_entry_empty($idsel, $classname); print_start_menu_entry_empty($idsel, $classname, $showmode);
print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $this->atarget); print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $this->atarget);
print_end_menu_entry_empty(); print_end_menu_entry_empty($showmode);
print_end_menu_array_empty(); print_end_menu_array_empty();
} }
@ -190,12 +192,16 @@ function print_start_menu_array_empty()
* *
* @param string $idsel Text * @param string $idsel Text
* @param string $classname String to add a css class * @param string $classname String to add a css class
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @return void * @return void
*/ */
function print_start_menu_entry_empty($idsel,$classname) function print_start_menu_entry_empty($idsel,$classname,$showmode)
{ {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; if ($showmode)
print '<div class="tmenuleft"></div><div class="tmenucenter">'; {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft"></div><div class="tmenucenter">';
}
} }
/** /**
@ -235,12 +241,16 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
/** /**
* Output end menu entry * Output end menu entry
* *
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
* @return void * @return void
*/ */
function print_end_menu_entry_empty() function print_end_menu_entry_empty($showmode)
{ {
print '</div></li>'; if ($showmode)
print "\n"; {
print '</div></li>';
print "\n";
}
} }
/** /**