From 685942b5b39e4cfe87f4d403ecc9c682d5fc0c62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Jul 2010 22:42:42 +0000 Subject: [PATCH] Fix: Missing translation for menu editor --- htdocs/admin/menus/{menu.js => menu.js.php} | 55 ++++++++++++++++++--- htdocs/lib/treeview.lib.php | 43 ++++++++-------- 2 files changed, 71 insertions(+), 27 deletions(-) rename htdocs/admin/menus/{menu.js => menu.js.php} (72%) diff --git a/htdocs/admin/menus/menu.js b/htdocs/admin/menus/menu.js.php similarity index 72% rename from htdocs/admin/menus/menu.js rename to htdocs/admin/menus/menu.js.php index bae81b926e6..e85fb6ac48f 100644 --- a/htdocs/admin/menus/menu.js +++ b/htdocs/admin/menus/menu.js.php @@ -1,6 +1,49 @@ -/* ----------------------------------------------------- + + * + * 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. + */ + +/** + * \file htdocs/admin/menus/menus.js.php + * \brief File for js menu + * \version $Id$ + */ + + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); +if (! defined('NOLOGIN')) define('NOLOGIN',1); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + + +require_once("../../master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); + +if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php +$langs->load("main",0,1); + +?> + --------------------------------------------------------- */ // Tests pour navigateurs var OPE = (window.opera) ? true : false; var IE = (document.all && !OPE) ? true : false; @@ -13,9 +56,9 @@ function arbre() { // Presentation de l'arbre au depart : deployee ('yes') ou fermee ('no') extend = "no"; // Textes du lien plier / deplier - plier_text = 'Replier tout'; + plier_text = 'transnoentities("UndoExpandAll"); ?>'; plier_title = 'Replier tous les noeuds de l\'arbre' - deplier_text = 'Deplier tout'; + deplier_text = 'transnoentities("ExpandAll"); ?>'; deplier_title = 'Deplier tous les noeuds de l\'arbre' // Recuperation de tous les arbres de la page uls = getElBy('ul','class','arbre'); @@ -25,7 +68,7 @@ function arbre() { processULEL(ul); plier(ul,'replier'); } - + } // ------------------------------------------------------- @@ -151,7 +194,7 @@ function getElBy(tag,attr,val) { var dbEl = document.getElementsByTagName(tag); for (e=0; e parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'
'; - + //print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'
'; + foreach($fulltree as $record) { if ($record['id'] == $childid) { //print $record['fullpath'].'_'.' - '.$fullpathparent.'_'; - if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_')) + if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_')) { //print 'DEL='.$childid; return 1; } } } - + return 0; } @@ -83,7 +83,7 @@ function is_in_subtree($fulltree,$parentid,$childid) function tree_showpad(&$fulltree,$key,$selected=0) { $pos=1; - + // Loop on each pos, because we will output an img for each pos while ($pos <= $fulltree[$key]['level'] && $fulltree[$key]['level'] > 0) { @@ -104,23 +104,23 @@ function tree_showpad(&$fulltree,$key,$selected=0) $nbofdirinsub++; $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; $nbofhigherlevelafter++; - } + } if ($fulltree[$key2]['level'] == $pos) { $atleastonofthislevelafter=1; - } + } if ($fulltree[$key2]['level'] <= $pos) { break; - } + } } - if ($key2 == $key) + if ($key2 == $key) { $found=1; } } //print $atleastonofthislevelafter; - + if ($atleastonofthislevelafter) { if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); @@ -133,7 +133,7 @@ function tree_showpad(&$fulltree,$key,$selected=0) } $pos++; } - + return array($atleastonofthislevelafter,$nbofhigherlevelafter,$nbofdirinsub,$nbofdocinsub); } @@ -146,11 +146,12 @@ function tree_showpad(&$fulltree,$key,$selected=0) */ function tree_addjs() { - print ''; + global $langs; + print ''; } -/* cette fonction g�re le d�callage des �l�ments +/* cette fonction gere le decallage des elements suivant leur position dans l'arborescence */ function tree_showline($tab,$rang) @@ -166,14 +167,14 @@ function tree_showline($tab,$rang) } elseif($rang > $rangLast) { - + print '
    • '; } elseif($rang < $rangLast) { print ''; - + for($i=$rang; $i < $rangLast; $i++) { print '
  • '; @@ -186,13 +187,13 @@ function tree_showline($tab,$rang) { if($rang > $rangLast) { - + print '
    • '; } elseif($rang < $rangLast) { - + for($i=$rang; $i < $rangLast; $i++) { print '
  • '; @@ -224,7 +225,7 @@ function tree_showline($tab,$rang) $pere :index de l'�l�ment courant $rang :d�callage de l'�l�ment */ -function tree_recur($tab,$pere,$rang) +function tree_recur($tab,$pere,$rang) { if ($pere == 0) print ''; }