Fix: Missing translation for menu editor

This commit is contained in:
Laurent Destailleur 2010-07-01 22:42:42 +00:00
parent dd464ca055
commit 685942b5b3
2 changed files with 71 additions and 27 deletions

View File

@ -1,6 +1,49 @@
/* ----------------------------------------------------- <?php
/* Copyright (C) 20010 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.
*/
/**
* \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 // Tests pour navigateurs
var OPE = (window.opera) ? true : false; var OPE = (window.opera) ? true : false;
var IE = (document.all && !OPE) ? 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') // Presentation de l'arbre au depart : deployee ('yes') ou fermee ('no')
extend = "no"; extend = "no";
// Textes du lien plier / deplier // Textes du lien plier / deplier
plier_text = 'Replier tout'; plier_text = '<?php echo $langs->transnoentities("UndoExpandAll"); ?>';
plier_title = 'Replier tous les noeuds de l\'arbre' plier_title = 'Replier tous les noeuds de l\'arbre'
deplier_text = 'Deplier tout'; deplier_text = '<?php echo $langs->transnoentities("ExpandAll"); ?>';
deplier_title = 'Deplier tous les noeuds de l\'arbre' deplier_title = 'Deplier tous les noeuds de l\'arbre'
// Recuperation de tous les arbres de la page // Recuperation de tous les arbres de la page
uls = getElBy('ul','class','arbre'); uls = getElBy('ul','class','arbre');
@ -25,7 +68,7 @@ function arbre() {
processULEL(ul); processULEL(ul);
plier(ul,'replier'); plier(ul,'replier');
} }
} }
// ------------------------------------------------------- // -------------------------------------------------------
@ -151,7 +194,7 @@ function getElBy(tag,attr,val) {
var dbEl = document.getElementsByTagName(tag); var dbEl = document.getElementsByTagName(tag);
for (e=0; e<dbEl.length; e++) { for (e=0; e<dbEl.length; e++) {
if (attr == 'class') {if (dbEl[e].className==val) {dbRes.push(dbEl[e]);}} if (attr == 'class') {if (dbEl[e].className==val) {dbRes.push(dbEl[e]);}}
else {if (dbEl[e].getAttribute(attr)==val) {dbRes.push(dbEl[e]);}} else {if (dbEl[e].getAttribute(attr)==val) {dbRes.push(dbEl[e]);}}
} }
return dbRes; return dbRes;
} }

View File

@ -41,7 +41,7 @@
*/ */
function is_in_subtree($fulltree,$parentid,$childid) function is_in_subtree($fulltree,$parentid,$childid)
{ {
if ($parentid == $childid) return 1; if ($parentid == $childid) return 1;
// Get fullpath of parent // Get fullpath of parent
$fullpathparent=''; $fullpathparent='';
@ -54,21 +54,21 @@ function is_in_subtree($fulltree,$parentid,$childid)
break; break;
} }
} }
//print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'<br>'; //print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'<br>';
foreach($fulltree as $record) foreach($fulltree as $record)
{ {
if ($record['id'] == $childid) if ($record['id'] == $childid)
{ {
//print $record['fullpath'].'_'.' - '.$fullpathparent.'_'; //print $record['fullpath'].'_'.' - '.$fullpathparent.'_';
if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_')) if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_'))
{ {
//print 'DEL='.$childid; //print 'DEL='.$childid;
return 1; return 1;
} }
} }
} }
return 0; return 0;
} }
@ -83,7 +83,7 @@ function is_in_subtree($fulltree,$parentid,$childid)
function tree_showpad(&$fulltree,$key,$selected=0) function tree_showpad(&$fulltree,$key,$selected=0)
{ {
$pos=1; $pos=1;
// Loop on each pos, because we will output an img for each pos // Loop on each pos, because we will output an img for each pos
while ($pos <= $fulltree[$key]['level'] && $fulltree[$key]['level'] > 0) while ($pos <= $fulltree[$key]['level'] && $fulltree[$key]['level'] > 0)
{ {
@ -104,23 +104,23 @@ function tree_showpad(&$fulltree,$key,$selected=0)
$nbofdirinsub++; $nbofdirinsub++;
$nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc'];
$nbofhigherlevelafter++; $nbofhigherlevelafter++;
} }
if ($fulltree[$key2]['level'] == $pos) if ($fulltree[$key2]['level'] == $pos)
{ {
$atleastonofthislevelafter=1; $atleastonofthislevelafter=1;
} }
if ($fulltree[$key2]['level'] <= $pos) if ($fulltree[$key2]['level'] <= $pos)
{ {
break; break;
} }
} }
if ($key2 == $key) if ($key2 == $key)
{ {
$found=1; $found=1;
} }
} }
//print $atleastonofthislevelafter; //print $atleastonofthislevelafter;
if ($atleastonofthislevelafter) if ($atleastonofthislevelafter)
{ {
if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif');
@ -133,7 +133,7 @@ function tree_showpad(&$fulltree,$key,$selected=0)
} }
$pos++; $pos++;
} }
return array($atleastonofthislevelafter,$nbofhigherlevelafter,$nbofdirinsub,$nbofdocinsub); return array($atleastonofthislevelafter,$nbofhigherlevelafter,$nbofdirinsub,$nbofdocinsub);
} }
@ -146,11 +146,12 @@ function tree_showpad(&$fulltree,$key,$selected=0)
*/ */
function tree_addjs() function tree_addjs()
{ {
print '<script src="'.DOL_URL_ROOT.'/admin/menus/menu.js" type="text/javascript"></script>'; global $langs;
print '<script src="'.DOL_URL_ROOT.'/admin/menus/menu.js.php?lang='.$langs->defaultlang.'" type="text/javascript"></script>';
} }
/* cette fonction g<EFBFBD>re le d<EFBFBD>callage des <EFBFBD>l<EFBFBD>ments /* cette fonction gere le decallage des elements
suivant leur position dans l'arborescence suivant leur position dans l'arborescence
*/ */
function tree_showline($tab,$rang) function tree_showline($tab,$rang)
@ -166,14 +167,14 @@ function tree_showline($tab,$rang)
} }
elseif($rang > $rangLast) elseif($rang > $rangLast)
{ {
print '<li><ul>'; print '<li><ul>';
} }
elseif($rang < $rangLast) elseif($rang < $rangLast)
{ {
print '<script type="text/javascript">imgDel('.$idLast.')</script>'; print '<script type="text/javascript">imgDel('.$idLast.')</script>';
for($i=$rang; $i < $rangLast; $i++) for($i=$rang; $i < $rangLast; $i++)
{ {
print '</ul></li>'; print '</ul></li>';
@ -186,13 +187,13 @@ function tree_showline($tab,$rang)
{ {
if($rang > $rangLast) if($rang > $rangLast)
{ {
print '<li><ul>'; print '<li><ul>';
} }
elseif($rang < $rangLast) elseif($rang < $rangLast)
{ {
for($i=$rang; $i < $rangLast; $i++) for($i=$rang; $i < $rangLast; $i++)
{ {
print '</ul></li>'; print '</ul></li>';
@ -224,7 +225,7 @@ function tree_showline($tab,$rang)
$pere :index de l'<EFBFBD>l<EFBFBD>ment courant $pere :index de l'<EFBFBD>l<EFBFBD>ment courant
$rang :d<EFBFBD>callage de l'<EFBFBD>l<EFBFBD>ment $rang :d<EFBFBD>callage de l'<EFBFBD>l<EFBFBD>ment
*/ */
function tree_recur($tab,$pere,$rang) function tree_recur($tab,$pere,$rang)
{ {
if ($pere == 0) print '<ul class="arbre">'; if ($pere == 0) print '<ul class="arbre">';
@ -238,14 +239,14 @@ function tree_recur($tab,$pere,$rang)
{ {
//on l'affiche avec le d<>callage courrant //on l'affiche avec le d<>callage courrant
tree_showline($tab[$x],$rang); tree_showline($tab[$x],$rang);
/*et on recherche ses fils /*et on recherche ses fils
en rappelant la fonction recur() en rappelant la fonction recur()
(+ incr<EFBFBD>mentation du d<EFBFBD>callage)*/ (+ incr<EFBFBD>mentation du d<EFBFBD>callage)*/
tree_recur($tab,$tab[$x][0],$rang+1); tree_recur($tab,$tab[$x][0],$rang+1);
} }
} }
if ($pere == 0) print '</ul>'; if ($pere == 0) print '</ul>';
} }