[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: developer_tools/inc class.bolangfile.inc.php,1.8
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: developer_tools/inc class.bolangfile.inc.php,1.8.2.2,1.8.2.2.2.1 class.solangfile.inc.php,1.9.2.4.2.1,1.9.2.4.2.2 class.uilangfile.inc.php,1.10.2.1,1.10.2.1.2.1 header.inc.php,1.7.2.1,1.7.2.1.2.1 |
Date: |
Fri, 04 Apr 2003 22:24:43 -0500 |
Update of /cvsroot/phpgroupware/developer_tools/inc
In directory subversions:/tmp/cvs-serv32515/inc
Modified Files:
Tag: Version-0_9_16-branch
class.bolangfile.inc.php class.solangfile.inc.php
class.uilangfile.inc.php header.inc.php
Log Message:
changed the parser to recognice the functions to define 3-level prefs,
solved problems with [ + ] in message_id's,
removed every link to not-working parts,
renamed it to Translationtools
Index: class.bolangfile.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/class.bolangfile.inc.php,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.2.2.1
diff -C2 -r1.8.2.2 -r1.8.2.2.2.1
*** class.bolangfile.inc.php 2 Jul 2002 01:42:24 -0000 1.8.2.2
--- class.bolangfile.inc.php 5 Apr 2003 03:24:40 -0000 1.8.2.2.2.1
***************
*** 24,27 ****
--- 24,28 ----
var $missing_langarray = '';
var $target_langarray = '';
+ var $common_langarray = '';
var $src_file;
var $tgt_file;
***************
*** 98,108 ****
}
- function list_apps()
- {
- $apps = $this->so->list_apps();
- $this->total = $this->so->total;
- return $apps;
- }
-
function list_langs()
{
--- 99,102 ----
***************
*** 129,133 ****
if ($mess !='' &&
($this->missing_langarray[$mess]['message_id']))
{
! $this->source_langarray[$mess] = array(
'message_id' =>
$this->missing_langarray[$mess]['message_id'],
'content' =>
$this->missing_langarray[$mess]['content'],
--- 123,127 ----
if ($mess !='' &&
($this->missing_langarray[$mess]['message_id']))
{
! $this->source_langarray[$mess] = $m = array(
'message_id' =>
$this->missing_langarray[$mess]['message_id'],
'content' =>
$this->missing_langarray[$mess]['content'],
***************
*** 137,141 ****
@ksort($this->source_langarray);
reset($this->source_langarray);
!
}
/*echo '<HR>'.$mess.'<HR><pre>';
--- 131,142 ----
@ksort($this->source_langarray);
reset($this->source_langarray);
!
! if ($this->tgt_lang == 'en')
! {
! $this->target_langarray[$mess] = $m;
!
! @ksort($this->target_langarray);
! reset($this->target_langarray);
! }
}
/*echo '<HR>'.$mess.'<HR><pre>';
***************
*** 152,155 ****
--- 153,161 ----
//{
//$this->missing_langarray=array();
+
+ if (!is_array($this->common_langarray))
+ {
+ $this->common_langarray =
$this->so->add_app('phpgwapi',$userlang);
+ }
$plist = $this->so->missing_app($app,$userlang);
while (list($p,$loc) = each($plist))
***************
*** 157,161 ****
// if
((!$this->source_langarray[strtolower($p)])&&(!$this->source_langarray[$p]))
$_mess_id = strtolower(trim($p));
! if (!$this->source_langarray[$_mess_id])
{
$this->missing_langarray[$_mess_id]['message_id'] = $_mess_id;
--- 163,167 ----
// if
((!$this->source_langarray[strtolower($p)])&&(!$this->source_langarray[$p]))
$_mess_id = strtolower(trim($p));
! if (!empty($_mess_id) &&
!$this->source_langarray[$_mess_id] && !$this->common_langarray[$_mess_id])
{
$this->missing_langarray[$_mess_id]['message_id'] = $_mess_id;
Index: class.solangfile.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/class.solangfile.inc.php,v
retrieving revision 1.9.2.4.2.1
retrieving revision 1.9.2.4.2.2
diff -C2 -r1.9.2.4.2.1 -r1.9.2.4.2.2
*** class.solangfile.inc.php 31 Mar 2003 20:42:23 -0000 1.9.2.4.2.1
--- class.solangfile.inc.php 5 Apr 2003 03:24:41 -0000 1.9.2.4.2.2
***************
*** 23,26 ****
--- 23,35 ----
var $tgt_file;
var $loaded_apps = array(); // Loaded app langs
+
+ var $functions = array( // functions containing phrases
to translate and param#
+ 'lang' => array(1),
+ 'create_input_box' => array(1,3),
+ 'create_check_box' => array(1,3),
+ 'create_select_box' => array(1,4),
+ 'create_text_area' => array(1,3),
+ 'create_password_box' => array(1,3)
+ );
var $public_functions = array(
***************
*** 45,52 ****
--- 54,64 ----
}
+
//Known Issue, if a phrase contains a ' or a " the parse will
be thrown off. unless ' are nested inside " or vice versa
function parse_php_app($fd,$plist)
{
+ $reg_expr =
'('.implode('|',array_keys($this->functions)).")[ \t]*\([ \t]*(.*)$";
define('SEP',filesystem_separator());
+ list($app) = explode(SEP,$fd);
$d=dir($fd);
while ($fn=$d->read())
***************
*** 61,65 ****
elseif ((strpos($fn,'.php')>1) &&
(is_readable($fd.$fn)))
{
! $fp=fopen($fd.SEP.$fn,'r');
$fds=substr($fd,strpos($fd,SEP));
while (!feof($fp))
--- 73,130 ----
elseif ((strpos($fn,'.php')>1) &&
(is_readable($fd.$fn)))
{
! $lines = file($fd.SEP.$fn);
!
! foreach($lines as $n => $line)
! {
! //echo "line='$line',
lines[1+$n]='".$lines[1+$n]."'<br>\n";
! while
(eregi($reg_expr,$line,$parts))
! {
! //echo
"***func='$parts[1]', rest='$parts[2]'<br>\n";
! $args =
$this->functions[$parts[1]];
! $rest = $parts[2];
! for($i = 1; $i <=
$args[0]; ++$i)
! {
! $next = 1;
! if (!$rest ||
strpos($rest,$del,1) === False)
! {
! $rest
.= trim($lines[++$n]);
! }
! $del = $rest[0];
! if ($del == '"'
|| $del == "'")
! {
! //echo
"rest='$rest'<br>\n";
! while
(($next = strpos($rest,$del,$next)) !== False && $rest[$next-1] == '\\')
! {
!
++$next;
! }
! if
($next === False)
! {
!
break;
! }
! $phrase
= substr($rest,1,$next-1);
! //echo
"next2=$next, phrase='$phrase'<br>\n";
! if
($args[0] == $i)
! {
!
//echo ">>>$phrase<<<<br>\n";
!
$plist[$phrase] = $app;
!
array_shift($args);
!
if (!count($args))
!
{
!
break; // no more args needed
!
}
! }
! $rest =
substr($rest,$next+1);
! }
! if(!ereg("[
\t\n]*,[ \t\n]*(.*)$",$rest,$parts))
! {
! break;
// nothing found
! }
! $rest =
$parts[1];
! }
! $line = $rest;
! }
! }
! /*
! $fd=fopen($fd.SEP.$fn,'r');
$fds=substr($fd,strpos($fd,SEP));
while (!feof($fp))
***************
*** 88,91 ****
--- 153,157 ----
}
fclose($fp);
+ */
}
}
***************
*** 102,106 ****
@result returns portion of $str from the end of substring to
the end of $str, or empty string if substring was not found
*/
! function strstr_multiple($str,$sub1,$sub2)
{
if (isset($sub1))
--- 168,172 ----
@result returns portion of $str from the end of substring to
the end of $str, or empty string if substring was not found
*/
! /* function strstr_multiple($str,$sub1,$sub2)
{
if (isset($sub1))
***************
*** 130,134 ****
return "";
}
!
function missing_app($app,$userlang=en)
{
--- 196,200 ----
return "";
}
! */
function missing_app($app,$userlang=en)
{
***************
*** 153,162 ****
$fd = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup';
$fn = $fd . SEP . 'phpgw_' . $userlang . '.lang';
! if (is_writeable($fn))
! {
! $wr = True;
! }
! elseif(!file_exists($fn) && is_writeable($fd))
!
{
$wr = True;
--- 219,223 ----
$fd = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup';
$fn = $fd . SEP . 'phpgw_' . $userlang . '.lang';
! if (@is_writeable($fn) || is_writeable($fd))
{
$wr = True;
***************
*** 205,213 ****
$fd = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup';
$fn = $fd . SEP . 'phpgw_' . $userlang . '.lang';
! if (@is_writeable($fn))
! {
! $wr = True;
! }
! elseif(!file_exists($fn) && is_writeable($fd))
{
$wr = True;
--- 266,270 ----
$fd = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup';
$fn = $fd . SEP . 'phpgw_' . $userlang . '.lang';
! if (@is_writeable($fn) || is_writeable($fd))
{
$wr = True;
***************
*** 247,274 ****
}
- function list_apps()
- {
- $this->db->query("SELECT * FROM
phpgw_applications",__LINE__,__FILE__);
- if($this->db->num_rows())
- {
- while($this->db->next_record())
- {
- $name = $this->db->f('app_name');
- $title = $this->db->f('app_title');
- $apps[$name] = array(
- 'title' => $title,
- 'name' => $name
- );
- }
- }
- @reset($apps);
- $this->total = count($apps);
- if ($this->debug) { _debug_array($apps); }
- return $apps;
- }
-
function list_langs()
{
! $this->db->query("SELECT lang_id,lang_name FROM
languages ORDER BY lang_name");
$i = 0;
while ($this->db->next_record())
--- 304,310 ----
}
function list_langs()
{
! $this->db->query("SELECT lang_id,lang_name FROM
phpgw_languages ORDER BY lang_name");
$i = 0;
while ($this->db->next_record())
***************
*** 286,289 ****
--- 322,331 ----
{
$fn = PHPGW_SERVER_ROOT . SEP . $app_name . SEP .
'setup' . SEP . 'phpgw_' . $userlang . '.lang';
+ if (file_exists($fn))
+ {
+ $backup = $fn . '.old';
+ @unlink($backup);
+ @rename($fn,$backup);
+ }
$fp = fopen($fn,'wb');
while(list($mess_id,$data) = @each($langarray))
***************
*** 309,317 ****
}
$addit = False;
/*echo '<br><br><pre> checking ' .
$data['message_id'] . "\t" . $data['app_name'] . "\t" . $userlang . "\t" .
$data['content'];*/
! $this->db->query("SELECT COUNT(*) FROM lang"
! ." WHERE message_id='" .
$this->db->db_addslashes($data['message_id'])
! ."' AND lang='$userlang' AND
app_name='$app_name'",__LINE__,__FILE__);
$this->db->next_record();
--- 351,360 ----
}
+ $message_id =
$this->db->db_addslashes(substr($data['message_id'],0,MAX_MESSAGE_ID_LENGTH));
+
$addit = False;
/*echo '<br><br><pre> checking ' .
$data['message_id'] . "\t" . $data['app_name'] . "\t" . $userlang . "\t" .
$data['content'];*/
! $this->db->query("SELECT COUNT(*) FROM
phpgw_lang"
! ." WHERE message_id='$message_id' AND
lang='$userlang' AND app_name='$app_name'",__LINE__,__FILE__);
$this->db->next_record();
***************
*** 331,337 ****
{
/* echo "<br>adding - insert
into lang values ('" . $data['message_id'] . "','$app_name','$userlang','" .
$data['content'] . "')"; */
! $this->db->query("INSERT into
lang VALUES ('"
! .
$this->db->db_addslashes($data['message_id'])
! .
"','$app_name','$userlang','"
.
$this->db->db_addslashes($data['content']) . "')",__LINE__,__FILE__);
}
--- 374,378 ----
{
/* echo "<br>adding - insert
into lang values ('" . $data['message_id'] . "','$app_name','$userlang','" .
$data['content'] . "')"; */
! $this->db->query("INSERT into
phpgw_lang VALUES ('$message_id','$app_name','$userlang','"
.
$this->db->db_addslashes($data['content']) . "')",__LINE__,__FILE__);
}
***************
*** 341,346 ****
if($data['message_id'] &&
$data['content'])
{
! $this->db->query("UPDATE lang
SET content='". $this->db->db_addslashes($data['content']) . "'"
! . " WHERE message_id='"
. $this->db->db_addslashes($data['message_id']) . "'"
. " AND
app_name='$app_name' AND lang='$userlang'",__LINE__,__FILE__);
if ($this->db->affected_rows()
> 0)
--- 382,387 ----
if($data['message_id'] &&
$data['content'])
{
! $this->db->query("UPDATE
phpgw_lang SET content='". $this->db->db_addslashes($data['content']) . "'"
! . " WHERE
message_id='message_id'"
. " AND
app_name='$app_name' AND lang='$userlang'",__LINE__,__FILE__);
if ($this->db->affected_rows()
> 0)
Index: class.uilangfile.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/class.uilangfile.inc.php,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.1.2.1
diff -C2 -r1.10.2.1 -r1.10.2.1.2.1
*** class.uilangfile.inc.php 30 Jun 2002 00:11:25 -0000 1.10.2.1
--- class.uilangfile.inc.php 5 Apr 2003 03:24:41 -0000 1.10.2.1.2.1
***************
*** 41,47 ****
function load()
{
! $app_name = $GLOBALS['HTTP_POST_VARS']['app_name'];
! $sourcelang = $GLOBALS['HTTP_POST_VARS']['sourcelang'];
! $targetlang = $GLOBALS['HTTP_POST_VARS']['targetlang'];
$GLOBALS['phpgw']->common->phpgw_header();
--- 41,47 ----
function load()
{
! $app_name = $_POST['app_name'];
! $sourcelang = $_POST['sourcelang'];
! $targetlang = $_POST['targetlang'];
$GLOBALS['phpgw']->common->phpgw_header();
***************
*** 54,119 ****
echo '<br><a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. $app_name
! . '&sourcelang=' . $sourcelang . '&targetlang='
. $targetlang) . '">' . lang('ok') . '</a>';
}
function addphrase()
{
! $app_name = $GLOBALS['HTTP_POST_VARS']['app_name'];
! $sourcelang = $GLOBALS['HTTP_POST_VARS']['sourcelang'];
! $targetlang = $GLOBALS['HTTP_POST_VARS']['targetlang'];
! $entry = $GLOBALS['HTTP_POST_VARS']['entry'];
! $submit = $GLOBALS['HTTP_POST_VARS']['submit'];
$this->bo->read_sessiondata();
! if($submit)
{
! $this->bo->addphrase($entry);
! if ($sourcelang == $targetlang)
{
! $this->bo->target_langarray =
$this->bo->source_langarray;
}
!
$this->bo->save_sessiondata($this->bo->source_langarray,$this->bo->target_langarray);
!
! Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. $app_name
! . '&sourcelang=' . $sourcelang .
'&targetlang=' . $targetlang));
}
! else
! {
! $GLOBALS['phpgw']->common->phpgw_header();
! echo parse_navbar();
!
! $this->template->set_file(array('form' =>
'addphrase.tpl'));
!
$this->template->set_var('message_id_field','<input size ="40"
name="entry[message_id]">');
!
$this->template->set_var('translation_field','<input size ="40"
name="entry[content]">');
! $this->template->set_var('app_name','<input
type="hidden" name="entry[app_name]" value="'.$app_name.'">');
!
$this->template->set_var('lang_message',lang('Add new phrase'));
!
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.addphrase'));
!
$this->template->set_var('sourcelang',$sourcelang);
!
$this->template->set_var('targetlang',$targetlang);
! $this->template->set_var('app_name',$app_name);
!
$this->template->set_var('lang_message_id',lang('message_id in English'));
!
$this->template->set_var('lang_translation',lang('Phrase in English'));
!
$this->template->set_var('lang_button',lang('add'));
! $this->template->pfp('out','form');
! $GLOBALS['phpgw']->common->phpgw_footer();
! }
}
function missingphrase()
{
! $app_name = $GLOBALS['HTTP_POST_VARS']['app_name'] ?
$GLOBALS['HTTP_POST_VARS']['app_name'] : $GLOBALS['HTTP_GET_VARS']['app_name'];
! $newlang = $GLOBALS['HTTP_POST_VARS']['newlang'];
! $sourcelang = $GLOBALS['HTTP_POST_VARS']['sourcelang'];
! $targetlang = $GLOBALS['HTTP_POST_VARS']['targetlang'];
! $dlsource = $GLOBALS['HTTP_POST_VARS']['dlsource'];
! $writesource =
$GLOBALS['HTTP_POST_VARS']['writesource'];
! $dltarget = $GLOBALS['HTTP_POST_VARS']['dltarget'];
! $writetarget =
$GLOBALS['HTTP_POST_VARS']['writetarget'];
! $update = $GLOBALS['HTTP_POST_VARS']['update'];
! $entry = $GLOBALS['HTTP_POST_VARS']['entry'];
! $submit = $GLOBALS['HTTP_POST_VARS']['submit'];
$this->bo->read_sessiondata();
--- 54,121 ----
echo '<br><a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. $app_name
! . '&sourcelang=' . $sourcelang . '&targetlang='
. $targetlang) . '">' . lang('Ok') . '</a>';
}
function addphrase()
{
! $app_name = $_POST['app_name'];
! $sourcelang = $_POST['sourcelang'];
! $targetlang = $_POST['targetlang'];
! $entry = $_POST['entry'];
$this->bo->read_sessiondata();
! if($_POST['add'] || $_POST['cancel'])
{
! if($_POST['add'])
{
! $this->bo->addphrase($entry);
! if ($sourcelang == $targetlang)
! {
! $this->bo->target_langarray =
$this->bo->source_langarray;
! }
!
$this->bo->save_sessiondata($this->bo->source_langarray,$this->bo->target_langarray);
}
!
$GLOBALS['phpgw']->redirect_link('/index.php',array(
! 'menuaction' =>
'developer_tools.uilangfile.edit',
! 'app_name' => $app_name,
! 'sourcelang' => $sourcelang,
! 'targetlang' => $targetlang
! ));
}
! $GLOBALS['phpgw']->common->phpgw_header();
! echo parse_navbar();
! $this->template->set_file(array('form' =>
'addphrase.tpl'));
! $this->template->set_var('message_id_field','<input
size ="40" name="entry[message_id]">');
! $this->template->set_var('translation_field','<input
size ="40" name="entry[content]">');
! $this->template->set_var('app_name','<input
type="hidden" name="entry[app_name]" value="'.$app_name.'">');
!
! $this->template->set_var('lang_message',lang('Add new
phrase'));
!
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.addphrase'));
! $this->template->set_var('sourcelang',$sourcelang);
! $this->template->set_var('targetlang',$targetlang);
! $this->template->set_var('app_name',$app_name);
!
$this->template->set_var('lang_message_id',lang('message_id in English'));
!
$this->template->set_var('lang_translation',lang('Phrase in English'));
! $this->template->set_var('lang_add',lang('Add'));
! $this->template->set_var('lang_cancel',lang('Cancel'));
! $this->template->pfp('phpgw_body','form');
}
function missingphrase()
{
! $app_name = $_POST['app_name'] ? $_POST['app_name']
: $_GET['app_name'];
! $newlang = $_POST['newlang'];
! $sourcelang = $_POST['sourcelang'];
! $targetlang = $_POST['targetlang'];
! $dlsource = $_POST['dlsource'];
! $writesource = $_POST['writesource'];
! $dltarget = $_POST['dltarget'];
! $writetarget = $_POST['writetarget'];
! $update = $_POST['update'];
! $entry = $_POST['entry'];
! $submit = $_POST['submit'];
$this->bo->read_sessiondata();
***************
*** 139,148 ****
if ($update)
{
! $deleteme =
$GLOBALS['HTTP_POST_VARS']['delete'];
while (list($_mess,$_checked) =
@each($deleteme))
{
if($_checked == 'on')
{
! $_mess =
$this->reverse_htmlspecialchars($_mess);
$this->bo->movephrase($_mess);
/*
_debug_array($missingarray[$_mess]); */
--- 141,150 ----
if ($update)
{
! $deleteme = $_POST['delete'];
while (list($_mess,$_checked) =
@each($deleteme))
{
if($_checked == 'on')
{
! $_mess =
$this->htmlspecialchars($_mess,True);
$this->bo->movephrase($_mess);
/*
_debug_array($missingarray[$_mess]); */
***************
*** 152,162 ****
}
unset($deleteme);
! /*
! if ($deleteme!='')
! {
! echo 'tEST';
! Header('Location: '
.$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. $app_name)),TRUE);
! exit;
! }*/
}
$GLOBALS['phpgw']->common->phpgw_header();
--- 154,167 ----
}
unset($deleteme);
!
! if (!count($missingarray)) { // if no
phrases left, go direct back
!
$this->bo->save_sessiondata($this->bo->source_langarray,$this->bo->target_langarray);
!
$GLOBALS['phpgw']->redirect_link('/index.php',array(
! 'menuaction' =>
'developer_tools.uilangfile.edit',
! 'app_name' => $app_name,
! 'sourcelang' => $sourcelang,
! 'targetlang' => $targetlang
! ));
! }
}
$GLOBALS['phpgw']->common->phpgw_header();
***************
*** 164,174 ****
include(PHPGW_APP_INC . '/header.inc.php');
! $this->template->set_var('lang_remove',lang('add
phrase'));
$this->template->set_var('lang_application',lang('Application'));
// $this->template->set_var('lang_source',lang('Source
Language'));
// $this->template->set_var('lang_target',lang('Target
Language'));
//
$this->template->set_var('lang_submit',lang('Submit'));
! $this->template->set_var('lang_update',lang('Update'));
! $this->template->set_var('lang_write',lang('Write'));
//
$this->template->set_var('lang_cancel',lang('Cancel'));
$this->template->set_var('lang_view',lang('Back'));
--- 169,179 ----
include(PHPGW_APP_INC . '/header.inc.php');
! $this->template->set_var('lang_remove',lang('Add
phrase'));
$this->template->set_var('lang_application',lang('Application'));
// $this->template->set_var('lang_source',lang('Source
Language'));
// $this->template->set_var('lang_target',lang('Target
Language'));
//
$this->template->set_var('lang_submit',lang('Submit'));
! $this->template->set_var('lang_update',lang('Save'));
! //$this->template->set_var('lang_write',lang('Write'));
//
$this->template->set_var('lang_cancel',lang('Cancel'));
$this->template->set_var('lang_view',lang('Back'));
***************
*** 211,214 ****
--- 216,220 ----
$this->template->set_var('targetlangs',$targetlangs);
$this->template->set_var('app_name',$app_name);
+
$this->template->set_var('app_title',$GLOBALS['phpgw_info']['apps'][$app_name]['title']);
$this->template->pfp('out','header');
if($sourcelang && $targetlang)
***************
*** 231,242 ****
while(list($key,$data) = @each($missingarray))
{
! $mess_id = $key;
$content = $data['content'];
- $transapp = $data['app_name'];
// $transy = $content;
!
$this->template->set_var('mess_id',htmlspecialchars($mess_id));
$this->template->set_var('source_content',htmlspecialchars($content));
//
$this->template->set_var('content',$GLOBALS['phpgw']->strip_html($transy));
!
$this->template->set_var('transapp',$this->lang_option($app_name,$transapp,$mess_id));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
$this->template->pfp('out','detail');
--- 237,247 ----
while(list($key,$data) = @each($missingarray))
{
! $mess_id =
$this->htmlspecialchars($key);
$content = $data['content'];
// $transy = $content;
!
$this->template->set_var('mess_id',$mess_id);
$this->template->set_var('source_content',htmlspecialchars($content));
//
$this->template->set_var('content',$GLOBALS['phpgw']->strip_html($transy));
!
$this->template->set_var('transapp',$this->lang_option($app_name,$data['app_name'],$mess_id));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
$this->template->pfp('out','detail');
***************
*** 247,254 ****
$this->template->pfp('out','prefooter');
// $this->template->pfp('out','srcdownload');
!
if($this->bo->loaded_apps[$sourcelang]['writeable'])
! {
! $this->template->pfp('out','srcwrite');
! }
//
$this->template->set_var('tgt_file',$this->bo->tgt_file);
--- 252,259 ----
$this->template->pfp('out','prefooter');
// $this->template->pfp('out','srcdownload');
!
//if($this->bo->loaded_apps[$sourcelang]['writeable'])
! //{
! // $this->template->pfp('out','srcwrite');
! //}
//
$this->template->set_var('tgt_file',$this->bo->tgt_file);
***************
*** 267,288 ****
function edit()
{
! $app_name = $GLOBALS['HTTP_POST_VARS']['app_name'] ?
$GLOBALS['HTTP_POST_VARS']['app_name'] : $GLOBALS['HTTP_GET_VARS']['app_name'];
! $newlang = $GLOBALS['HTTP_POST_VARS']['newlang'];
! $sourcelang = $GLOBALS['HTTP_POST_VARS']['sourcelang']
? $GLOBALS['HTTP_POST_VARS']['sourcelang'] :
$GLOBALS['HTTP_GET_VARS']['sourcelang'];
! $targetlang = $GLOBALS['HTTP_POST_VARS']['targetlang']
? $GLOBALS['HTTP_POST_VARS']['targetlang'] :
$GLOBALS['HTTP_GET_VARS']['targetlang'];
! $dlsource = $GLOBALS['HTTP_POST_VARS']['dlsource'];
! $writesource =
$GLOBALS['HTTP_POST_VARS']['writesource'];
! $dltarget = $GLOBALS['HTTP_POST_VARS']['dltarget'];
! $writetarget =
$GLOBALS['HTTP_POST_VARS']['writetarget'];
! $add_phrase = $GLOBALS['HTTP_POST_VARS']['add_phrase'];
! $update = $GLOBALS['HTTP_POST_VARS']['update'];
! $revert = $GLOBALS['HTTP_POST_VARS']['revert'];
! $entry = $GLOBALS['HTTP_POST_VARS']['entry'];
! $submit = $GLOBALS['HTTP_POST_VARS']['submit'];
if($add_phrase)
{
! Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.addphrase&app_name='.$app_name
! . '&sourcelang=' . $sourcelang .
'&targetlang=' . $targetlang));
}
elseif ($revert)
--- 272,293 ----
function edit()
{
! $app_name = $_POST['app_name'] ? $_POST['app_name']
: $_GET['app_name'];
! $newlang = $_POST['newlang'];
! $sourcelang = $_POST['sourcelang'] ?
$_POST['sourcelang'] : $_GET['sourcelang'];
! $targetlang = $_POST['targetlang'] ?
$_POST['targetlang'] : $_GET['targetlang'];
! $dlsource = $_POST['dlsource'];
! $writesource = $_POST['writesource'];
! $dltarget = $_POST['dltarget'];
! $writetarget = $_POST['writetarget'];
! $add_phrase = $_POST['add_phrase'];
! $update = $_POST['update'];
! $revert = $_POST['revert'];
! $entry = $_POST['entry'];
! $submit = $_POST['submit'];
if($add_phrase)
{
!
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.addphrase&app_name='.$app_name
! . '&sourcelang=' . $sourcelang .
'&targetlang=' . $targetlang);
}
elseif ($revert)
***************
*** 330,339 ****
$this->template->set_var('loaddb_url',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.load'));
$this->template->set_var('lang_remove',lang('Remove'));
! $this->template->set_var('lang_loaddb',lang('Write to
lang table'));
$this->template->set_var('lang_application',lang('Application'));
$this->template->set_var('lang_source',lang('Source
Language'));
$this->template->set_var('lang_target',lang('Target
Language'));
! $this->template->set_var('lang_submit',lang('Submit'));
! $this->template->set_var('lang_update',lang('Update'));
$this->template->set_var('lang_revert',lang('Revert'));
$this->template->set_var('lang_cancel',lang('Cancel'));
--- 335,344 ----
$this->template->set_var('loaddb_url',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.load'));
$this->template->set_var('lang_remove',lang('Remove'));
! $this->template->set_var('lang_loaddb',lang('Update
Database'));
$this->template->set_var('lang_application',lang('Application'));
$this->template->set_var('lang_source',lang('Source
Language'));
$this->template->set_var('lang_target',lang('Target
Language'));
! $this->template->set_var('lang_submit',lang('Load'));
! $this->template->set_var('lang_update',lang('Save'));
$this->template->set_var('lang_revert',lang('Revert'));
$this->template->set_var('lang_cancel',lang('Cancel'));
***************
*** 347,351 ****
if(!$targetlang)
{
! $targetlang = 'en';
}
--- 352,356 ----
if(!$targetlang)
{
! $targetlang =
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
}
***************
*** 387,390 ****
--- 392,396 ----
$this->template->set_var('targetlangs',$targetlangs);
$this->template->set_var('app_name',$app_name);
+
$this->template->set_var('app_title',$GLOBALS['phpgw_info']['apps'][$app_name]['title']);
$this->template->pfp('out','header');
***************
*** 405,409 ****
$userapps .= ' selected';
}
! $userapps .= '>' .
lang($GLOBALS['phpgw_info']['apps'][$userapp]['title']) . '</option>' . "\n";
}
}
--- 411,415 ----
$userapps .= ' selected';
}
! $userapps .= '>' .
$GLOBALS['phpgw_info']['apps'][$userapp]['title'] . '</option>' . "\n";
}
}
***************
*** 412,423 ****
if ($update)
{
! $transapp =
$GLOBALS['HTTP_POST_VARS']['transapp'];
! $translations =
$GLOBALS['HTTP_POST_VARS']['translations'];
! $deleteme =
$GLOBALS['HTTP_POST_VARS']['delete'];
while (list($_mess,$_app) = each($transapp))
{
if($_mess)
{
! $_mess =
$this->reverse_htmlspecialchars($_mess);
$this->bo->source_langarray[$_mess]['app_name'] = $_app;
$this->bo->target_langarray[$_mess]['app_name'] = $_app;
--- 418,429 ----
if ($update)
{
! $transapp = $_POST['transapp'];
! $translations = $_POST['translations'];
! $deleteme = $_POST['delete'];
while (list($_mess,$_app) = each($transapp))
{
if($_mess)
{
! $_mess =
strtolower(trim($this->htmlspecialchars($_mess,True)));
$this->bo->source_langarray[$_mess]['app_name'] = $_app;
$this->bo->target_langarray[$_mess]['app_name'] = $_app;
***************
*** 428,432 ****
if($_mess && $_cont)
{
! $_mess =
$this->reverse_htmlspecialchars(strtolower(trim($_mess)));
//Known issue: if a message
containing a ] is used as index of array, when the array is posted the index
gets truncated;
$this->bo->target_langarray[$_mess]['message_id'] = $_mess;
--- 434,438 ----
if($_mess && $_cont)
{
! $_mess =
strtolower(trim($this->htmlspecialchars($_mess,True)));
//Known issue: if a message
containing a ] is used as index of array, when the array is posted the index
gets truncated;
$this->bo->target_langarray[$_mess]['message_id'] = $_mess;
***************
*** 444,448 ****
if($_checked == 'on')
{
! $_mess =
$this->reverse_htmlspecialchars($_mess);
unset($this->bo->source_langarray[$_mess]);
unset($this->bo->target_langarray[$_mess]);
--- 450,454 ----
if($_checked == 'on')
{
! $_mess =
strtolower(trim($this->htmlspecialchars($_mess,True)));
unset($this->bo->source_langarray[$_mess]);
unset($this->bo->target_langarray[$_mess]);
***************
*** 467,476 ****
$this->template->set_var('lang_original',lang('Original'));
$this->template->set_var('lang_translation',lang('Translation'));
!
$this->template->set_var('lang_missingphrase',lang('Search for missing
phrase'));
!
$this->template->set_var('lang_addphrase',lang('Add Phrase'));
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$this->template->set_var('sourcelang',$sourcelang);
$this->template->set_var('targetlang',$targetlang);
- $this->template->set_var('app_name',$app_name);
$this->template->set_var('missing_link',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.missingphrase'));
$this->template->set_var('phrase_link',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.addphrase'));
--- 473,481 ----
$this->template->set_var('lang_original',lang('Original'));
$this->template->set_var('lang_translation',lang('Translation'));
!
$this->template->set_var('lang_missingphrase',lang('Search new phrases'));
!
$this->template->set_var('lang_addphrase',lang('Add new phrase'));
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$this->template->set_var('sourcelang',$sourcelang);
$this->template->set_var('targetlang',$targetlang);
$this->template->set_var('missing_link',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.missingphrase'));
$this->template->set_var('phrase_link',$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.addphrase'));
***************
*** 483,494 ****
while(list($key,$data) = @each($langarray))
{
! $mess_id = $data['message_id'];
$content = $data['content'];
- $transapp = $data['app_name'];
$transy =
$translation[$key]['content'];
!
$this->template->set_var('mess_id',htmlspecialchars($key));
$this->template->set_var('source_content',htmlspecialchars($content));
$this->template->set_var('content',htmlspecialchars($transy));
!
$this->template->set_var('transapp',$this->lang_option($app_name,$transapp,htmlspecialchars($key)));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
$this->template->pfp('out','detail');
--- 488,498 ----
while(list($key,$data) = @each($langarray))
{
! $mess_id =
$this->htmlspecialchars($key);
$content = $data['content'];
$transy =
$translation[$key]['content'];
!
$this->template->set_var('mess_id',$this->htmlspecialchars($key));
$this->template->set_var('source_content',htmlspecialchars($content));
$this->template->set_var('content',htmlspecialchars($transy));
!
$this->template->set_var('transapp',$this->lang_option($app_name,$data['app_name'],$mess_id));
$this->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
$this->template->pfp('out','detail');
***************
*** 496,500 ****
$this->template->set_var('sourcelang',$sourcelang);
$this->template->set_var('targetlang',$targetlang);
- $this->template->set_var('app_name',$app_name);
$this->template->set_var('lang_write',lang('Write'));
$this->template->set_var('lang_download',lang('Download'));
--- 500,503 ----
***************
*** 515,519 ****
$this->template->pfp('out','tgtwrite');
}
!
$this->template->pfp('out','footer');
}
--- 518,523 ----
$this->template->pfp('out','tgtwrite');
}
! $this->template->set_var('helpmsg',lang('!!!
You have to [Save] your changes before you can [Update Database], [Download] or
[Write] the lang-file !!!'));
!
$this->template->pfp('out','footer');
}
***************
*** 523,547 ****
/*!
! @function reverse_htmlspecialchars
! @abstract reverts a string converted by htmlspecialchars() to
its original form
@param $text
*/
! function reverse_htmlspecialchars($text)
{
! $text=ereg_replace('>', '>', $text);
! $text=ereg_replace('<', '<', $text);
! $text=ereg_replace('"', "\"", $text);
! return ereg_replace('&', '&', $text);
}
function save($which,$userlang)
{
! $app_name = $GLOBALS['HTTP_POST_VARS']['app_name'];
! $sourcelang = $GLOBALS['HTTP_POST_VARS']['sourcelang'];
! $targetlang = $GLOBALS['HTTP_POST_VARS']['targetlang'];
$this->bo->write_file($which,$app_name,$userlang);
! Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='.$app_name
! . '&sourcelang=' . $sourcelang . '&targetlang='
. $targetlang));
}
--- 527,559 ----
/*!
! @function htmlspecialchars
! @abstract converts/reverts a string converted by
htmlspecialchars() to its original form
@param $text
*/
! function htmlspecialchars($text,$reverse=False)
{
! $from = array('>','<','"','&','[',']');
! $to =
array('>','<','"','&','%5B','%5D');
!
! if (!$reverse)
! {
! return str_replace($from,$to,$text);
! }
! else
! {
! return str_replace($to,$from,$text);
!
! }
}
function save($which,$userlang)
{
! $app_name = $_POST['app_name'];
! $sourcelang = $_POST['sourcelang'];
! $targetlang = $_POST['targetlang'];
$this->bo->write_file($which,$app_name,$userlang);
!
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='.$app_name
! . '&sourcelang=' . $sourcelang . '&targetlang='
. $targetlang);
}
***************
*** 570,577 ****
function index()
{
! $start = $GLOBALS['HTTP_POST_VARS']['start'];
! $sort = $GLOBALS['HTTP_POST_VARS']['sort'];
! $order = $GLOBALS['HTTP_POST_VARS']['order'];
! $query = $GLOBALS['HTTP_POST_VARS']['query'];
$this->bo->save_sessiondata('','');
--- 582,589 ----
function index()
{
! $start = $_POST['start'];
! $sort = $_POST['sort'];
! $order = $_POST['order'];
! $query = $_POST['query'];
$this->bo->save_sessiondata('','');
***************
*** 586,591 ****
$offset =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
! $apps = $this->bo->list_apps();
! $total = $this->bo->total;
if(!$sort)
--- 598,606 ----
$offset =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
! foreach($GLOBALS['phpgw_info']['apps'] as $app => $data)
! {
! $apps[strtolower($data['title'])] = $data;
! }
! $total = count($apps);
if(!$sort)
***************
*** 626,640 ****
}
- $i = 0;
- $applications = array();
- while(list($app,$data) = @each($apps))
- {
- if($i >= $start && $i<= $limit)
- {
- $applications[$app] = $data;
- }
- $i++;
- }
-
$this->template->set_var('lang_installed',lang('Installed applications'));
$this->template->set_var('bg_color',$GLOBALS['phpgw_info']['theme']['bg_color']);
--- 641,644 ----
***************
*** 651,680 ****
$this->template->set_var('create_new',lang('Create New
Language File'));
! @reset($applications);
! while (list($key,$app) = @each($applications))
{
! $tr_color =
$this->nextmatchs->alternate_row_color($tr_color);
!
! if($app['name'])
! {
! $name = $app['name'];
! }
! else
{
! $name = ' ';
! }
! $this->template->set_var('tr_color',$tr_color);
! $this->template->set_var('name',$name);
! $this->template->set_var('edit','<a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. urlencode($app['name'])) . '"> ' . lang('Edit') . ' </a>');
! // $this->template->set_var('translate','<a
href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.translate&app_name='
. urlencode($app['name'])) . '"> ' . lang('Translate') . ' </a>');
! $this->template->set_var('status',$status);
! $this->template->parse('rows','row',True);
}
! $this->template->pparse('out','list');
}
--- 655,679 ----
$this->template->set_var('create_new',lang('Create New
Language File'));
! $i = 0;
! foreach($apps as $data)
{
! if($start <= $i && $i < $limit)
{
! $tr_color =
$this->nextmatchs->alternate_row_color($tr_color);
!
$this->template->set_var('tr_color',$tr_color);
!
$this->template->set_var('name',$data['title']);
! $this->template->set_var('edit','<a
href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.edit&app_name='
. urlencode($data['name'])) . '"> ' . lang('Edit') . ' </a>');
! //
$this->template->set_var('translate','<a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.translate&app_name='
. urlencode($app['name'])) . '"> ' . lang('Translate') . ' </a>');
!
$this->template->set_var('status',$status);
!
$this->template->parse('rows','row',True);
! }
! ++$i;
}
! $this->template->pparse('phpgw_body','list');
}
Index: header.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/developer_tools/inc/header.inc.php,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.1.2.1
diff -C2 -r1.7.2.1 -r1.7.2.1.2.1
*** header.inc.php 15 Jan 2002 01:59:17 -0000 1.7.2.1
--- header.inc.php 5 Apr 2003 03:24:41 -0000 1.7.2.1.2.1
***************
*** 14,26 ****
$GLOBALS['phpgw']->template->set_file(array('header' => 'header.tpl'));
!
$GLOBALS['phpgw']->template->set_var('lang_developer_tools',lang('Developer
tools'));
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$GLOBALS['phpgw']->template->set_var('link_diary',lang('Diary'));
! /*
! $GLOBALS['phpgw']->template->set_var('link_sourceforge_project','<a
href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uisf_project_tracker.display_tracker')
. '">' . lang('SF Project tracker') . '</a>');
! */
$GLOBALS['phpgw']->template->set_var('link_changelog','<a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uichangelogs.list_changelogs')
. '">' . lang('Changelogs') . '</a>');
$GLOBALS['phpgw']->template->set_var('link_language_management','<a
href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.index')
. '">' . lang('Language file management'));
$GLOBALS['phpgw']->template->set_var('link_preferences','<a href="' .
$GLOBALS['phpgw']->link('/preferences/index.php#developer_tools') . '">' .
lang('Preferences') . '</a>');
!
$GLOBALS['phpgw']->template->pfp('out','header');
--- 14,27 ----
$GLOBALS['phpgw']->template->set_file(array('header' => 'header.tpl'));
!
$GLOBALS['phpgw']->template->set_var('lang_developer_tools',$GLOBALS['phpgw_info']['apps']['developer_tools']['title']);
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+ /*
$GLOBALS['phpgw']->template->set_var('link_diary',lang('Diary'));
!
! //$GLOBALS['phpgw']->template->set_var('link_sourceforge_project','<a
href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uisf_project_tracker.display_tracker')
. '">' . lang('SF Project tracker') . '</a>');
!
$GLOBALS['phpgw']->template->set_var('link_changelog','<a href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uichangelogs.list_changelogs')
. '">' . lang('Changelogs') . '</a>');
$GLOBALS['phpgw']->template->set_var('link_language_management','<a
href="' .
$GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.index')
. '">' . lang('Language file management'));
$GLOBALS['phpgw']->template->set_var('link_preferences','<a href="' .
$GLOBALS['phpgw']->link('/preferences/index.php#developer_tools') . '">' .
lang('Preferences') . '</a>');
! */
$GLOBALS['phpgw']->template->pfp('out','header');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: developer_tools/inc class.bolangfile.inc.php,1.8.2.2,1.8.2.2.2.1 class.solangfile.inc.php,1.9.2.4.2.1,1.9.2.4.2.2 class.uilangfile.inc.php,1.10.2.1,1.10.2.1.2.1 header.inc.php,1.7.2.1,1.7.2.1.2.1,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: developer_tools/templates/default addphrase.tpl,1.2,1.2.4.1 applications.tpl,1.3,1.3.4.1 header.tpl,1.3,1.3.4.1 langfile.tpl,1.8,1.8.4.1 langmissing.tpl,1.1,1.1.4.1
- Next by Date:
[Phpgroupware-cvs] CVS: admin/templates/default application_form.tpl,1.7,1.7.4.1 applications.tpl,1.5.2.1,1.5.2.1.2.1 delete_common.tpl,1.5,1.5.4.1 listservers.tpl,1.2,1.2.4.1 server_form.tpl,1.2,1.2.4.1
- Previous by thread:
[Phpgroupware-cvs] CVS: developer_tools/templates/default addphrase.tpl,1.2,1.2.4.1 applications.tpl,1.3,1.3.4.1 header.tpl,1.3,1.3.4.1 langfile.tpl,1.8,1.8.4.1 langmissing.tpl,1.1,1.1.4.1
- Next by thread:
[Phpgroupware-cvs] CVS: admin/templates/default application_form.tpl,1.7,1.7.4.1 applications.tpl,1.5.2.1,1.5.2.1.2.1 delete_common.tpl,1.5,1.5.4.1 listservers.tpl,1.2,1.2.4.1 server_form.tpl,1.2,1.2.4.1
- Index(es):