diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php
index 73c8b74f150..44dcc88fba2 100644
--- a/htdocs/admin/menus/edit.php
+++ b/htdocs/admin/menus/edit.php
@@ -56,6 +56,11 @@ if (isset($_GET["action"]) && $_GET["action"] == 'update')
$sql.=" WHERE m.rowid = ".$_POST['menuId'];
$db->query($sql);
}
+ else
+ {
+ header("location: index.php?menu_handler=".$menu_handler);
+ exit;
+ }
if($_GET['return'])
{
@@ -121,6 +126,16 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add')
dolibarr_print_error($db);
}
+ if ($rowid == $_POST['menuId'])
+ {
+ $mesg='
'.'FailedToInsertParentdoesNotExist sql='.$sql.'
';
+ $_GET["action"] = 'create';
+ $error++;
+ }
+ }
+
+ if (! $error)
+ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(rowid,menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, `right`, target, user, `order`)";
$sql.=" VALUES(".$rowid.",'".$_POST['handler']."','".$_POST['type']."','".$_POST['mainmenu']."','".$_POST['leftmenu']."',".$_POST['menuId'].",'".$_POST['url']."','".$_POST['titre']."','".$_POST['level']."','".$_POST['langs']."','".$_POST['right']."','".$_POST['target']."',".$_POST['user'].",0)";
@@ -128,7 +143,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add')
$result=$db->query($sql);
if ($result > 0)
{
- dolibarr_syslog("location: edit.php?action=edit&menuId=".$rowid);
+ dolibarr_syslog("location: edit.php?action=edit&menuId=".$rowid);
header("location: edit.php?action=edit&menuId=".$rowid);
exit;
}
@@ -252,16 +267,11 @@ if (isset($_GET["action"]) && $_GET["action"] == 'create')
print '';
// Id
- if($_GET['menuId'] == 0)
- {
- $parent_rowid = $_GET['menuId'];
- $parent_level = -2;
- }
- else
+ $parent_rowid = $_GET['menuId'];
+ if ($_GET['menuId'])
{
$sql = "SELECT m.rowid, m.mainmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId'];
$res = $db->query($sql);
-
if ($res)
{
@@ -279,7 +289,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'create')
print '| '.$langs->trans('MenuIdParent').' | ';
//$menu_handler
//print ' | ';
- print ' | ';
+ print ' | ';
print ''.$langs->trans('DetailMenuIdParent').' |
';
//Handler
@@ -320,7 +330,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'create')
print '';
print ''.$langs->trans('DetailTarget').' | ';
//Right
- print '| '.$langs->trans('Right').' | | '.$langs->trans('DetailRight').' |
';
+ print '| '.$langs->trans('Rights').' | | '.$langs->trans('DetailRight').' |
';
//Mainmenu = group
//print '| '.$langs->trans('Group').' | | '.$langs->trans('DetailMainmenu').' |
';
@@ -488,7 +498,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
print '';
print '';
print '';
- print ' | ';
+ print ' | ';
print '';
print '';
@@ -523,7 +533,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
print '';
print '';
print '';
- print ' | ';
+ print ' | ';
print '';
print '';
diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php
index fa5cbe4e1a2..79e69dbcf26 100644
--- a/htdocs/admin/menus/index.php
+++ b/htdocs/admin/menus/index.php
@@ -31,7 +31,9 @@ require("./pre.inc.php");
if (! $user->admin)
accessforbidden();
-
+
+$dirtop = "../../includes/menus/barre_top";
+$dirleft = "../../includes/menus/barre_left";
$menu_handler_top=$conf->global->MAIN_MENU_BARRETOP;
$menu_handler_left=$conf->global->MAIN_MENU_BARRELEFT;
@@ -42,6 +44,9 @@ $menu_handler_left=eregi_replace('_frontoffice\.php','',$menu_handler_left);
$menu_handler=$menu_handler_left;
+if ($_REQUEST["menu_handler"]) $menu_handler=$_REQUEST["menu_handler"];
+
+
/*
* Actions
*/
@@ -178,6 +183,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
/*
* Affichage page
*/
+$html=new Form($db);
llxHeader();
@@ -209,18 +215,21 @@ if ($_GET["action"] == 'delete')
$obj = $db->fetch_object($result);
$html = new Form($db);
- $html->form_confirm("index.php?menuId=".$_GET['menuId'],$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete");
+ $html->form_confirm("index.php?menu_handler=".$menu_handler."&menuId=".$_GET['menuId'],$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete");
print "
\n";
}
+print '';
+print '
';
print '';
-print '';
-print '| '.$langs->trans("MenuHandler").': '.$menu_handler.' | ';
-print '
';
-
print '';
print '| '.$langs->trans("TreeMenuPersonalized").' | ';
print '
';
@@ -244,7 +253,7 @@ if ($conf->use_javascript)
*/
function affiche($tab,$rang)
{
- global $rangLast, $idLast;
+ global $rangLast, $idLast, $menu_handler;
if ($conf->use_javascript)
{
@@ -291,11 +300,12 @@ function affiche($tab,$rang)
}
print '';
- print ''.$tab[2].'';
- print '';
- print '';
- print '';
- print '';
+ print '';
+ print ''.$tab[2].'';
+ print '';
+ print '';
+ print '';
+ print '';
print '';
echo "\n";
@@ -311,24 +321,23 @@ function affiche($tab,$rang)
*/
function recur($tab,$pere,$rang) {
- //ballayage du tableau
- for ($x=0;$x 10) return; // Protection contre boucle infinie
+
+ //ballayage du tableau
+ for ($x=0;$ximgDel('.$idLast.')';
print '';
-
-
print '';
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index f3de0678119..db1d1a96d13 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -366,6 +366,7 @@ NoEMail=No EMail
Owner=Owner
DetectedVersion=Detected version
FollowingConstantsWillBeSubstituted=Following constants will be substitute with corresponding value.
+Refresh=Refresh
# Countries
CountryFR=France
CountryBE=Belgium
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index 0fe32862658..8cd05e20da8 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -370,6 +370,7 @@ NoEMail=Pas d'email
Owner=Propriétaire
DetectedVersion=Version détectée
FollowingConstantsWillBeSubstituted=Les constantes suivantes seront substituées par leur valeur correspondante.
+Refresh=Rafraichir
# Countries
CountryFR=France
CountryBE=Belgique