phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: etemplate/inc class.db_tools.inc.php, 1.18, 1.19


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.db_tools.inc.php, 1.18, 1.19 class.editor.inc.php, 1.36, 1.37 class.soetemplate.inc.php, 1.27, 1.28
Date: Fri, 08 Aug 2003 12:18:32 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv21018

Modified Files:
        class.db_tools.inc.php class.editor.inc.php 
        class.soetemplate.inc.php 
Log Message:
1) partialy undoing gugux changes (label use '%s' if they want to place the 
widget within the label!)
2) useing a regular lang()-call with parameters instead of a message array, 
which got translated by the constructor


Index: class.db_tools.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.db_tools.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** class.db_tools.inc.php      21 Jul 2003 16:07:38 -0000      1.18
--- class.db_tools.inc.php      8 Aug 2003 16:18:30 -0000       1.19
***************
*** 19,23 ****
                        'edit'         => True,
                        'needs_save'   => True,
-                       'writeLangFile'=> True,
                        //'admin'       => True,
                        //'preferences' => True
--- 19,22 ----
***************
*** 29,41 ****
                var $app;               // used app
                var $table;             // used table
-               var $messages = array(
-                       'not_found' => 'Not found !!!',
-                       'writen' => 'File writen',
-                       'error_writing' => 'Error: writing file (no 
write-permission for the webserver) !!!',
-                       'no_write_necessary' => 'Table unchanged, no write 
necessary !!!',
-                       'give_table_name' => 'Please enter table-name first 
!!!',
-                       'new_table' => 'New table created',
-                       'select_app' => 'Select an app first !!!'
-               );
                var $types = array(
                        'varchar'       => 'varchar',
--- 28,31 ----
***************
*** 73,77 ****
                @abstract constructor of class
                */
!               function db_tools($lang_on_messages=True)
                {
                        $this->editor = 
CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
--- 63,67 ----
                @abstract constructor of class
                */
!               function db_tools()
                {
                        $this->editor = 
CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
***************
*** 82,92 ****
                                
ExecMethod('phpgwapi.applications.read_installed_apps');
                        }
-                       if ($lang_on_messages)
-                       {
-                               foreach($this->messages as $key => $msg)
-                               {
-                                       $this->messages[$key] = lang($msg);
-                               }
-                       }
                }
  
--- 72,75 ----
***************
*** 152,156 ****
                                        return;
                                }
!                               $msg .= $this->messages['no_write_necessary'];
                        }
                        elseif ($content['delete'])
--- 135,139 ----
                                        return;
                                }
!                               $msg .= lang('Table unchanged, no write 
necessary !!!');
                        }
                        elseif ($content['delete'])
***************
*** 172,180 ****
                                if (!$this->app)
                                {
!                                       $msg .= $this->messages['select_app'];
                                }
                                elseif (!$content['new_table_name'])
                                {
!                                       $msg .= 
$this->messages['give_table_name'];
                                }
                                elseif ($content['add_table'])
--- 155,163 ----
                                if (!$this->app)
                                {
!                                       $msg .= lang('Select an app first !!!');
                                }
                                elseif (!$content['new_table_name'])
                                {
!                                       $msg .= lang('Please enter table-name 
first !!!');
                                }
                                elseif ($content['add_table'])
***************
*** 182,186 ****
                                        $this->table = 
$content['new_table_name'];
                                        $this->data[$this->table] = array('fd' 
=> array(),'pk' =>array(),'ix' => array(),'uc' => array(),'fk' => array());
!                                       $msg .= $this->messages['new_table'];
                                }
                                else // import
--- 165,169 ----
                                        $this->table = 
$content['new_table_name'];
                                        $this->data[$this->table] = array('fd' 
=> array(),'pk' =>array(),'ix' => array(),'uc' => array(),'fk' => array());
!                                       $msg .= lang('New table created');
                                }
                                else // import
***************
*** 275,280 ****
                                                
$this->setup_version($this->app,'',$tables);
                                        }
!                                       $msg .= 
$this->messages[$this->write($this->app,$this->data) ?
!                                               'writen' : 'error_writing'];
                                }
                                $this->changes = array();
--- 258,263 ----
                                                
$this->setup_version($this->app,'',$tables);
                                        }
!                                       $msg .= 
$this->write($this->app,$this->data) ?
!                                               lang('File writen') : 
lang('Error: writing file (no write-permission for the webserver) !!!');
                                }
                                $this->changes = array();
***************
*** 913,927 ****
  
                        return $a == $b;
-               }
- 
-               /*!
-               @function writeLangFile
-               @abstract writes langfile with all templates and messages 
registered here
-               @discussion can be called via 
http://domain/phpgroupware/index.php?etemplate.db_tools.writeLangFile
-               */
-               function writeLangFile()
-               {
-                       $m = new db_tools(False);       // no lang on messages
-                       
$this->editor->writeLangFile('etemplate','en',$m->messages);
                }
        };
--- 896,899 ----

Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** class.editor.inc.php        21 Jul 2003 16:09:33 -0000      1.36
--- class.editor.inc.php        8 Aug 2003 16:18:30 -0000       1.37
***************
*** 18,37 ****
                var $etemplate; // eTemplate we edit
                var $editor;    // editor eTemplate
-               var $messages = array(
-                       'not_found' => 'Error: Template not found !!!',
-                       'deleted'   => 'Template deleted',
-                       'saved'     => 'Template saved',
-                       'error_writing' => 'Error: while saveing !!!',
-                       'other_version' => 'only an other Version found !!!',
-                       'ext_loaded' => 'Extensions loaded:',
-                       'x_found'    => '%1 eTemplates found',
-                       'imported'   => "eTemplate '%1' imported, use Save to 
put it in the database",
-                       'no_filename'=> 'no filename given or selected via 
Browse...',
-                       'not_writeable' => "Error: webserver is not allowed to 
write into '%1' !!!",
-                       'exported'   => "eTemplate '%1' written to '%2'",
-                       'newer_version' => "newer version '%1' exists !!!",
-                       'need_name'  => 'Application name needed to write a 
langfile or dump the eTemplates !!!',
-                       'x_deleted'  => '%1 eTemplates deleted'
-               );
                var $aligns = array(
                        '' => 'Left',
--- 18,21 ----
***************
*** 66,70 ****
                );
  
!               function editor($lang_on_messages=True)
                {
                        $this->etemplate = CreateObject('etemplate.etemplate');
--- 50,54 ----
                );
  
!               function editor()
                {
                        $this->etemplate = CreateObject('etemplate.etemplate');
***************
*** 72,90 ****
  
                        $this->editor = new etemplate('etemplate.editor');
- 
-                       if ($lang_on_messages)
-                       {
-                               reset($this->messages);
-                               while (list($key,$msg) = each($this->messages))
-                                       $this->messages[$key] = lang($msg);
-                       }
                }
  
                function edit($msg = '')
                {
!                       $get_vars = $GLOBALS['HTTP_GET_VARS'];
!                       if (isset($get_vars['name']) && 
!$this->etemplate->read($get_vars))
                        {
!                               $msg .= $this->messages['not_found'];
                        }
                        if (!is_array($this->extensions))
--- 56,66 ----
  
                        $this->editor = new etemplate('etemplate.editor');
                }
  
                function edit($msg = '')
                {
!                       if (isset($_GET['name']) && 
!$this->etemplate->read($_GET))
                        {
!                               $msg .= lang('Error: Template not found !!!');
                        }
                        if (!is_array($this->extensions))
***************
*** 93,97 ****
                                if (count($this->extensions))
                                {
!                                       $msg .= $this->messages['ext_loaded'] . 
' ' . implode(', ',$this->extensions);
                                        $msg_ext_loaded = True;
                                }
--- 69,73 ----
                                if (count($this->extensions))
                                {
!                                       $msg .= lang('Extensions loaded:') . ' 
' . implode(', ',$this->extensions);
                                        $msg_ext_loaded = True;
                                }
***************
*** 108,112 ****
                                if (count($extensions))
                                {
!                                       $msg .= 
(!$msg_ext_loaded?$this->messages['ext_loaded'].' ':', ') . implode(', 
',$extensions);
                                        $this->extensions += $extensions;
                                }
--- 84,88 ----
                                if (count($extensions))
                                {
!                                       $msg .= 
(!$msg_ext_loaded?lang('Extensions loaded:').' ':', ') . implode(', 
',$extensions);
                                        $this->extensions += $extensions;
                                }
***************
*** 397,401 ****
                                        if ($this->etemplate->read($content))
                                        {
!                                               $msg = 
$this->messages['other_version'];
                                        }
                                        else
--- 373,377 ----
                                        if ($this->etemplate->read($content))
                                        {
!                                               $msg = lang('only an other 
Version found !!!');
                                        }
                                        else
***************
*** 408,416 ****
                                                elseif (!count($result) || 
!$this->etemplate->read($result[0]))
                                                {
!                                                       $msg = 
$this->messages['not_found'];
                                                }
                                                elseif ($content['name'] == 
$result[0]['name'])
                                                {
!                                                       $msg = 
$this->messages['other_version'];
                                                }
                                        }
--- 384,392 ----
                                                elseif (!count($result) || 
!$this->etemplate->read($result[0]))
                                                {
!                                                       $msg = lang('Error: 
Template not found !!!');
                                                }
                                                elseif ($content['name'] == 
$result[0]['name'])
                                                {
!                                                       $msg = lang('only an 
other Version found !!!');
                                                }
                                        }
***************
*** 418,422 ****
                                elseif ($newest_version != '' && 
$this->etemplate->version != $newest_version)
                                {
!                                       $msg = 
sprintf($this->messages['newer_version'],$newest_version);
                                }
                        }
--- 394,398 ----
                                elseif ($newest_version != '' && 
$this->etemplate->version != $newest_version)
                                {
!                                       $msg = lang("newer version '%1' exists 
!!!",$newest_version);
                                }
                        }
***************
*** 431,435 ****
                                if (empty($name) || 
address@hidden(PHPGW_SERVER_ROOT.'/'.$name))
                                {
!                                       $msg = $this->messages['need_name'];
                                }
                                else
--- 407,411 ----
                                if (empty($name) || 
address@hidden(PHPGW_SERVER_ROOT.'/'.$name))
                                {
!                                       $msg = lang('Application name needed to 
write a langfile or dump the eTemplates !!!');
                                }
                                else
***************
*** 445,449 ****
                                }
                                $ok = 
$this->etemplate->save(trim($content['name']),trim($content['template']),trim($content['lang']),intval($content['group']),trim($content['version']));
!                               $msg = $this->messages[$ok ? 'saved' : 
'error_writing'];
                        }
                        elseif ($content['show'])
--- 421,425 ----
                                }
                                $ok = 
$this->etemplate->save(trim($content['name']),trim($content['template']),trim($content['lang']),intval($content['group']),trim($content['version']));
!                               $msg = $ok ? lang('Template saved') : 
lang('Error: while saveing !!!');
                        }
                        elseif ($content['show'])
***************
*** 457,461 ****
                                if (empty($name) || 
address@hidden(PHPGW_SERVER_ROOT.'/'.$name))
                                {
!                                       $msg = $this->messages['need_name'];
                                }
                                else
--- 433,437 ----
                                if (empty($name) || 
address@hidden(PHPGW_SERVER_ROOT.'/'.$name))
                                {
!                                       $msg = lang('Application name needed to 
write a langfile or dump the eTemplates !!!');
                                }
                                else
***************
*** 464,470 ****
                                        if ($name == 'etemplate')
                                        {
!                                               $m = new editor(False);
!                                               $db_tools = 
CreateObject('etemplate.db_tools',False);
!                                               $additional = $m->messages + 
$db_tools->messages + $this->etemplate->types + $this->extensions + 
$this->aligns;
                                        }
                                        else    // try to call the 
writeLangFile function of the app's ui-layer
--- 440,444 ----
                                        if ($name == 'etemplate')
                                        {
!                                               $additional = 
$this->etemplate->types + $this->extensions + $this->aligns;
                                        }
                                        else    // try to call the 
writeLangFile function of the app's ui-layer
***************
*** 521,525 ****
                        if (!is_writeable($dir))
                        {
!                               return 
sprintf($this->messages['not_writeable'],$dir);
                        }
                        if ($create)
--- 495,499 ----
                        if (!is_writeable($dir))
                        {
!                               return lang("Error: webserver is not allowed to 
write into '%1' !!!",$dir);
                        }
                        if ($create)
***************
*** 556,560 ****
                        fclose($f);
  
!                       return sprintf($this->messages['exported'],$name,$file);
                }
  
--- 530,534 ----
                        fclose($f);
  
!                       return lang("eTemplate '%1' written to 
'%2'",$name,$file);
                }
  
***************
*** 563,567 ****
                        if ($file == 'none' || $file == '' || !($f = 
fopen($file,'r')))
                        {
!                               return $this->messages['no_filename'];
                        }
                        $xul = fread ($f, filesize ($file));
--- 537,541 ----
                        if ($file == 'none' || $file == '' || !($f = 
fopen($file,'r')))
                        {
!                               return lang('no filename given or selected via 
Browse...');
                        }
                        $xul = fread ($f, filesize ($file));
***************
*** 580,588 ****
                                if (count($imported) == 1)
                                {
!                                       $imported = 
sprintf($this->messages['imported'],$this->etemplate->name);
                                }
                                else
                                {
!                                       $imported = 'File contains more than 
one etemplates, last one is shown !!!';
                                }
                        }
--- 554,562 ----
                                if (count($imported) == 1)
                                {
!                                       $imported = lang("eTemplate '%1' 
imported, use Save to put it in the database",$this->etemplate->name);
                                }
                                else
                                {
!                                       $imported = lang('File contains more 
than one eTemplate, last one is shown !!!');
                                }
                        }
***************
*** 614,618 ****
                                        $read_ok = $this->etemplate->delete();
                                }
!                               $msg = $this->messages[$read_ok ? 'deleted' : 
'not_found'];
  
                                if ($content['back'] == 'list_result')
--- 588,592 ----
                                        $read_ok = $this->etemplate->delete();
                                }
!                               $msg = $read_ok ? lang('Template deleted') : 
lang('Error: Template not found !!!');
  
                                if ($content['back'] == 'list_result')
***************
*** 641,647 ****
                                return;
                        }
!                       if (isset($GLOBALS['HTTP_GET_VARS']['name']) && 
!$this->etemplate->read($GLOBALS['HTTP_GET_VARS']))
                        {
!                               $this->edit($this->messages['not_found']);
                                return;
                        }
--- 615,621 ----
                                return;
                        }
!                       if (isset($_GET['name']) && 
!$this->etemplate->read($_GET))
                        {
!                               $this->edit(lang('Error: Template not found 
!!!'));
                                return;
                        }
***************
*** 701,705 ****
                                if ($n)
                                {
!                                       $msg = 
sprintf($this->messages['x_deleted'],$n);
                                }
                                unset($cont['selected']);
--- 675,679 ----
                                if ($n)
                                {
!                                       $msg = lang('%1 eTemplates deleted',$n);
                                }
                                unset($cont['selected']);
***************
*** 716,720 ****
                        if (!$msg)
                        {
!                               $msg = 
sprintf($this->messages['x_found'],count($result));
                        }
                        unset($cont['result']);
--- 690,694 ----
                        if (!$msg)
                        {
!                               $msg = lang('%1 eTemplates 
found',count($result));
                        }
                        unset($cont['result']);
***************
*** 752,759 ****
                                $this->extensions = 
$post_vars['**extensions**']; unset($post_vars['**extensions**']);
                        }
!                       if (isset($GLOBALS['HTTP_GET_VARS']['name']) && 
!$this->etemplate->read($GLOBALS['HTTP_GET_VARS']) ||
                            isset($post_vars['name']) && 
!$this->etemplate->read($post_vars))
                        {
!                               $msg = $this->messages['not_found'];
  
                                if (isset($post_vars['name']))
--- 726,733 ----
                                $this->extensions = 
$post_vars['**extensions**']; unset($post_vars['**extensions**']);
                        }
!                       if (isset($_GET['name']) && 
!$this->etemplate->read($_GET) ||
                            isset($post_vars['name']) && 
!$this->etemplate->read($post_vars))
                        {
!                               $msg = lang('Error: Template not found !!!');
  
                                if (isset($post_vars['name']))
***************
*** 762,766 ****
                                        if ($this->etemplate->read($post_vars))
                                        {
!                                               $msg = 
$this->messages['other_version'];
                                        }
                                }
--- 736,740 ----
                                        if ($this->etemplate->read($post_vars))
                                        {
!                                               $msg = lang('only an other 
Version found !!!');
                                        }
                                }

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** class.soetemplate.inc.php   21 Jul 2003 16:07:38 -0000      1.27
--- class.soetemplate.inc.php   8 Aug 2003 16:18:30 -0000       1.28
***************
*** 605,609 ****
                        if (!is_writeable($dir))
                        {
!                               return "Error: webserver is not allowed to 
write into '$dir' !!!";
                        }
                        $file = "$dir/etemplates.inc.php";
--- 605,609 ----
                        if (!is_writeable($dir))
                        {
!                               return lang("Error: webserver is not allowed to 
write into '%1' !!!",$dir);
                        }
                        $file = "$dir/etemplates.inc.php";
***************
*** 637,641 ****
                        fclose($f);
  
!                       return "$n eTemplates for Application '$app' dumped to 
'$file'";
                }
  
--- 637,641 ----
                        fclose($f);
  
!                       return lang("%1 eTemplates for Application '%2' dumped 
to '%3'",$n,$app,$file);
                }
  
***************
*** 778,782 ****
                        if (!is_writeable($dir))
                        {
!                               return "Error: webserver is not allowed to 
write into '$dir' !!!";
                        }
                        $file = "$dir/phpgw_$lang.lang";
--- 778,782 ----
                        if (!is_writeable($dir))
                        {
!                               return lang("Error: webserver is not allowed to 
write into '%1' !!!",$dir);
                        }
                        $file = "$dir/phpgw_$lang.lang";
***************
*** 793,797 ****
                        $solangfile->loaddb($app,$lang);
  
!                       return "$n ($new new) Messages writen for Application 
'$app' and Languages '$lang'";
                }
  
--- 793,797 ----
                        $solangfile->loaddb($app,$lang);
  
!                       return lang("%1 (%2 new) Messages writen for 
Application '%3' and Languages '%4'",$n,$new,$app,$lang);
                }
  
***************
*** 821,825 ****
                                $templ->save();
                        }
!                       return "$n new eTemplates imported for Application 
'$app'";
                }
  
--- 821,825 ----
                                $templ->save();
                        }
!                       return lang("%1 new eTemplates imported for Application 
'%2'",$n,$app);
                }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]