phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: etemplate/inc class.xul_io.inc.php,NONE,1.1 xmlt


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.xul_io.inc.php,NONE,1.1 xmltools.php,NONE,1.1 class.editor.inc.php,1.10,1.11 class.uietemplate.inc.php,1.15,1.16
Date: Wed, 11 Sep 2002 20:32:00 -0400

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

Modified Files:
        class.editor.inc.php class.uietemplate.inc.php 
Added Files:
        class.xul_io.inc.php xmltools.php 
Log Message:
first version of xml/xul import & export of etemplates

***** Error reading new file: [Errno 2] No such file or directory: 
'class.xul_io.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'xmltools.php'
Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.editor.inc.php        3 Sep 2002 22:58:53 -0000       1.10
--- class.editor.inc.php        12 Sep 2002 00:31:57 -0000      1.11
***************
*** 352,355 ****
--- 352,359 ----
                                $msg = 
$this->etemplate->writeLangFile($content['name'],'en',$additional);
                        }
+                       elseif ($content['export_xml'])
+                       {
+                               $msg = $this->export_xml();
+                       }
                        elseif ($content['db_tools'])
                        {
***************
*** 360,363 ****
--- 364,413 ----
                }
  
+               function export_xml()
+               {
+                       $name = $this->etemplate->name;
+                       $template = $this->etemplate->template != '' ? 
$this->etemplate->template : 'default';
+ 
+                       list($app) = explode('.',$name);
+ 
+                       $dir = PHPGW_SERVER_ROOT . "/$app/templates/$template";
+                       if ($create_it = !is_dir($dir))
+                       {
+                               $dir = PHPGW_SERVER_ROOT . "/$app/templates";
+                       }
+                       if (!is_writeable($dir))
+                       {
+                               return "Error: webserver is not allowed to 
write into '$dir' !!!";
+                       }
+                       if ($create)
+                       {
+                               mkdir($dir .= "/$template");
+                       }
+                       $file = "$dir/$name";
+                       if ($this->etemplate->lang)
+                       {
+                               $file .= '.' . $this->etemplate->lang;
+                       }
+                       $old_file = $file . '.old.xul';
+                       $file .= '.xul';
+                       if (file_exists($file))
+                       {
+                               rename($file,$old_file);
+                       }
+ 
+                       if (!($f = fopen($file,'w')))
+                       {
+                               return 0;
+                       }
+                       $xul_io = CreateObject('etemplate.xul_io');
+                       $xul = $xul_io->export(&$this->etemplate);
+ 
+                       fwrite($f,$xul);
+                       fclose($f);
+ 
+                       return $xul_io->import(&$this->etemplate,$xul);
+                       return "eTemplate '$name' written to '$file'";
+               }
+ 
                function delete($post_vars='',$back = 'edit')
                {
***************
*** 509,513 ****
                                'dump' => True,
                                'langfile' => True,
!                               'size' => True
                        );
                        if (!$msg && isset($post_vars['values']) && 
!isset($post_vars['vals']))
--- 559,564 ----
                                'dump' => True,
                                'langfile' => True,
!                               'size' => True,
!                               'export_xml' => True
                        );
                        if (!$msg && isset($post_vars['values']) && 
!isset($post_vars['vals']))

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.uietemplate.inc.php   3 Sep 2002 10:27:23 -0000       1.15
--- class.uietemplate.inc.php   12 Sep 2002 00:31:57 -0000      1.16
***************
*** 546,550 ****
                                        if 
(!isset($this->extension[$cell['type']]))
                                        {
!                                               $html .= '<i>unknown type</i>';
                                        }
                                        else
--- 546,550 ----
                                        if 
(!isset($this->extension[$cell['type']]))
                                        {
!                                               $html .= "<i>unknown type 
'$cell[type]'</i>";
                                        }
                                        else





reply via email to

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