[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: etemplate/inc class.editor.inc.php,1.11,1.12 cla
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.editor.inc.php,1.11,1.12 class.xul_io.inc.php,1.1,1.2 |
Date: |
Thu, 12 Sep 2002 06:03:55 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv11376
Modified Files:
class.editor.inc.php class.xul_io.inc.php
Log Message:
added UI to import eTemplates from xml / xul-files
Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.editor.inc.php 12 Sep 2002 00:31:57 -0000 1.11
--- class.editor.inc.php 12 Sep 2002 10:03:52 -0000 1.12
***************
*** 25,29 ****
'other_version' => 'only an other Version found !!!',
'ext_loaded' => 'Extensions loaded:',
! 'x_found' => '%d eTemplates found'
);
var $aligns = array(
--- 25,33 ----
'other_version' => 'only an other Version found !!!',
'ext_loaded' => 'Extensions loaded:',
! 'x_found' => '%d eTemplates found',
! 'imported' => "eTemplate '%s' 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 '%s' !!!",
! 'exported' => "eTemplate '%s' written to '%s'"
);
var $aligns = array(
***************
*** 356,359 ****
--- 360,367 ----
$msg = $this->export_xml();
}
+ elseif ($content['import_xml'])
+ {
+ $msg = $this->import_xml($content['file']);
+ }
elseif ($content['db_tools'])
{
***************
*** 378,382 ****
if (!is_writeable($dir))
{
! return "Error: webserver is not allowed to
write into '$dir' !!!";
}
if ($create)
--- 386,390 ----
if (!is_writeable($dir))
{
! return
sprintf($this->messages['not_writable'],$dir);
}
if ($create)
***************
*** 406,411 ****
fclose($f);
! return $xul_io->import(&$this->etemplate,$xul);
! return "eTemplate '$name' written to '$file'";
}
--- 414,437 ----
fclose($f);
! return sprintf($this->messages['exported'],$name,$file);
! }
!
! function import_xml($file)
! {
! if ($file == 'none' || $file == '' || !($f =
fopen($file,'r')))
! {
! return $this->messages['no_filename'];
! }
! $xul = fread ($f, filesize ($file));
! fclose($f);
!
! $xul_io = CreateObject('etemplate.xul_io');
! $msg = $xul_io->import(&$this->etemplate,$xul);
!
! if (!$msg)
! {
! $msg =
sprintf($this->messages['imported'],$this->etemplate->name);
! }
! return $msg;
}
Index: class.xul_io.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.xul_io.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.xul_io.inc.php 12 Sep 2002 00:31:57 -0000 1.1
--- class.xul_io.inc.php 12 Sep 2002 10:03:52 -0000 1.2
***************
*** 32,36 ****
'readonly' => 'readonly=true'
);
! $this->widget2xul = array( // how to translate
widget-names ( 0 => ) and widget-spec. attr.
'label' => array(
'.name' => 'label',
--- 32,36 ----
'readonly' => 'readonly=true'
);
! $this->widget2xul = array( // how to translate
widget-names and widget-spec. attr.
'label' => array(
'.name' => 'label',
***************
*** 200,204 ****
function import(&$etempl,$data)
{
! //if ($this->debug)
{
echo "<pre>\n" . htmlentities($data) .
"\n</pre><p>\n";
--- 200,204 ----
function import(&$etempl,$data)
{
! if ($this->debug)
{
echo "<pre>\n" . htmlentities($data) .
"\n</pre><p>\n";
***************
*** 207,214 ****
--- 207,223 ----
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING,
0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE,
1);
+ $vals = $index = '';
xml_parse_into_struct($parser, $data, $vals, $index);
+ if (!is_array($vals))
+ {
+ $err =
xml_error_string(xml_get_error_code($parser));
+ }
xml_parser_free($parser);
+ if ($err != '')
+ {
+ return $err;
+ }
while (list($n,$node) = each($vals))
{
***************
*** 314,318 ****
}
}
! //if ($this->debug)
{
_debug_array($etempl->data);
--- 323,327 ----
}
}
! if ($this->debug)
{
_debug_array($etempl->data);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.editor.inc.php,1.11,1.12 class.xul_io.inc.php,1.1,1.2,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.13,1.14 class.html.inc.php,1.4,1.5 class.uietemplate.inc.php,1.16,1.17
- Next by Date:
[Phpgroupware-cvs] CVS: etemplate/setup etemplates.inc.php,1.13,1.14 phpgw_en.lang,1.8,1.9
- Previous by thread:
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.13,1.14 class.html.inc.php,1.4,1.5 class.uietemplate.inc.php,1.16,1.17
- Next by thread:
[Phpgroupware-cvs] CVS: etemplate/setup etemplates.inc.php,1.13,1.14 phpgw_en.lang,1.8,1.9
- Index(es):