[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: etemplate/inc class.soetemplate.inc.php,1.16,1.1
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.soetemplate.inc.php,1.16,1.17 |
Date: |
Mon, 30 Sep 2002 15:06:34 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv31304
Modified Files:
class.soetemplate.inc.php
Log Message:
renamed eTemplates xml files from .xul to .xet and added support to load a
xslt-file as a template
Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.soetemplate.inc.php 29 Sep 2002 13:00:58 -0000 1.16
--- class.soetemplate.inc.php 30 Sep 2002 19:06:29 -0000 1.17
***************
*** 184,188 ****
echo
"<p>soetemplate::read('$this->name','$this->template','$this->lang',$this->group,'$this->version')</p>\n";
}
! if
($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' &&
$this->readfile())
{
return True;
--- 184,189 ----
echo
"<p>soetemplate::read('$this->name','$this->template','$this->lang',$this->group,'$this->version')</p>\n";
}
! if
(($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' ||
!
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt') &&
$this->readfile())
{
return True;
***************
*** 251,286 ****
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 ($this->name == '' || $app == '' || $name == '' ||
address@hidden($file) || !($f = @fopen($file,'r')))
{
if ($this->debug == 1 || $this->name != '' &&
$this->debug == $this->name)
{
! 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');
}
! $loaded = $this->xul_io->import(&$this,$xul);
!
! if (!is_array($loaded))
{
! return False;
! }
! $this->name = $app . '.' . $name; // if template
was copied or app was renamed
! $this->tpls_in_file = count($loaded);
return True;
}
--- 252,318 ----
list($app,$name) = split("\.",$this->name,2);
$template = $this->template == '' ? 'default' :
$this->template;
!
if ($this->lang)
{
! $lang = '.' . $this->lang;
}
! $first_try = $ext =
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt' ? '.xsl' :
'.xet';
+ while ((!$lang || address@hidden($file =
PHPGW_SERVER_ROOT . "/$app/templates/$template/$name$lang$ext") &&
+ address@hidden($file =
PHPGW_SERVER_ROOT . "/$app/templates/default/$name$lang$ext")) &&
+ address@hidden($file = PHPGW_SERVER_ROOT .
"/$app/templates/$template/$name$ext") &&
+ address@hidden($file = PHPGW_SERVER_ROOT .
"/$app/templates/default/$name$ext"))
+ {
+ if ($ext == $first_try)
+ {
+ $ext = $ext == '.xet' ? '.xsl' : '.xet';
+
+ if ($this->debug == 1 || $this->name !=
'' && $this->debug == $this->name)
+ {
+ echo "<p>tried '$file' now
trying it with extension '$ext' !!!</p>\n";
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
if ($this->name == '' || $app == '' || $name == '' ||
address@hidden($file) || !($f = @fopen($file,'r')))
{
if ($this->debug == 1 || $this->name != '' &&
$this->debug == $this->name)
{
! echo "<p>Can't open template
'$this->name' / '$file' !!!</p>\n";
}
return False;
}
! $xml = fread ($f, filesize ($file));
fclose($f);
! if ($ext == '.xsl')
{
! $cell = $this->empty_cell();
! $cell['type'] = 'xslt';
! $cell['size'] = $this->name;
! //$cell['xslt'] = &$xml; xslttemplate
class cant use it direct at the moment
! $cell['name'] = '';
! $this->data = array(0 => array(),1 => array('A'
=> &$cell));
! $this->rows = $this->cols = 1;
}
! else
{
! if (!is_object($this->xul_io))
! {
! $this->xul_io =
CreateObject('etemplate.xul_io');
! }
! $loaded = $this->xul_io->import(&$this,$xml);
! if (!is_array($loaded))
! {
! return False;
! }
! $this->name = $app . '.' . $name; // if
template was copied or app was renamed
+ $this->tpls_in_file = count($loaded);
+ }
return True;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.soetemplate.inc.php,1.16,1.17,
Ralf Becker <address@hidden> <=