phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: etemplate/inc class.editor.inc.php,1.14,1.15 cla


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.editor.inc.php,1.14,1.15 class.soetemplate.inc.php,1.8,1.9
Date: Tue, 17 Sep 2002 09:27:40 -0400

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

Modified Files:
        class.editor.inc.php class.soetemplate.inc.php 
Log Message:
read eTemplates from filesystem if 
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files'

Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.editor.inc.php        12 Sep 2002 12:21:27 -0000      1.14
--- class.editor.inc.php        17 Sep 2002 13:27:37 -0000      1.15
***************
*** 405,409 ****
                                mkdir($dir .= "/$template");
                        }
!                       $file = "$dir/$name";
                        if ($this->etemplate->lang)
                        {
--- 405,409 ----
                                mkdir($dir .= "/$template");
                        }
!                       $file = $dir . '/' . substr($name,strlen($app)+1);
                        if ($this->etemplate->lang)
                        {
***************
*** 421,426 ****
                                return 0;
                        }
!                       $xul_io = CreateObject('etemplate.xul_io');
!                       $xul = $xul_io->export(&$this->etemplate);
  
                        fwrite($f,$xul);
--- 421,429 ----
                                return 0;
                        }
!                       if (!is_object($this->etemplate->xul_io))
!                       {
!                               $this->etemplate->xul_io = 
CreateObject('etemplate.xul_io');
!                       }
!                       $xul = 
$this->etemplate->xul_io->export(&$this->etemplate);
  
                        fwrite($f,$xul);
***************
*** 439,444 ****
                        fclose($f);
  
!                       $xul_io = CreateObject('etemplate.xul_io');
!                       $msg = $xul_io->import(&$this->etemplate,$xul);
  
                        if (!$msg)
--- 442,450 ----
                        fclose($f);
  
!                       if (!is_object($this->etemplate->xul_io))
!                       {
!                               $this->etemplate->xul_io = 
CreateObject('etemplate.xul_io');
!                       }
!                       $msg = 
$this->etemplate->xul_io->import(&$this->etemplate,$xul);
  
                        if (!$msg)

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.soetemplate.inc.php   3 Sep 2002 22:59:26 -0000       1.8
--- class.soetemplate.inc.php   17 Sep 2002 13:27:37 -0000      1.9
***************
*** 159,162 ****
--- 159,166 ----
                        $this->init($name,$template,$lang,$group,$version);
  
+                       if 
($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' && 
$this->readfile())
+                       {
+                               return True;
+                       }
                        if ($this->name)
                        {
***************
*** 204,207 ****
--- 208,248 ----
                        }
                        $this->db2obj();
+ 
+                       return True;
+               }
+ 
+               /*!
+               @function readfile
+               @abstract Reads an eTemplate from the filesystem, the keys are 
already set by init in read
+               @result True if a template is found, else False
+               */
+               function readfile()
+               {
+                       list($app,$name) = split("\.",$this->name,2);
+                       $template = $this->template == '' ? 'default' : 
$this->template;
+                       $file = PHPGW_SERVER_ROOT . 
"/$app/templates/$template/$name";
+                       if ($this->lang)
+                       {
+                               $file .= '.' . $this->lang;
+                       }
+                       $file .= '.xul';
+ 
+                       if (!is_readable($file) || !($f = fopen($file,'r')))
+                       {
+                               //echo "<p>Can't open '$file' !!!</p>\n";
+                               return False;
+                       }
+                       $xul = fread ($f, filesize ($file));
+                       fclose($f);
+ 
+                       if (!is_object($this->xul_io))
+                       {
+                               $this->xul_io = 
CreateObject('etemplate.xul_io');
+                       }
+                       if ($this->xul_io->import(&$this,$xul) != '')
+                       {
+                               return False;
+                       }
+                       $this->name = $app . '.' . $name;       // if template 
was copied or app was renamed
  
                        return True;





reply via email to

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