"export now correctly included multiple levels of included templates using relative names"

This commit is contained in:
Ralf Becker 2009-09-29 12:19:54 +00:00
parent 638ec3fcd0
commit ba213a6946

View File

@ -6,6 +6,7 @@
* @package etemplate
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2002-9 by RalfBecker@outdoor-training.de
* @version $Id$
*/
@ -25,11 +26,6 @@
* XUL/XML Import & Export for eTemplates
*
* used only internaly
*
* @package etemplate
* @subpackage api
* @author RalfBecker-AT-outdoor-training.de
* @license GPL
*/
class xul_io
{
@ -113,6 +109,12 @@
'menupopup' => 'select',
'description' => 'label'
);
/**
* Keys of currently processed template on export, to resolve relative names
*
* @var array
*/
var $load_via;
/**
* sets an attribute in the xml object representing a widget
@ -357,10 +359,10 @@
/**
* add / embed an eTemplate into the global $xul_overlay object (used by export)
*
* @param object &$etempl eTemplate to embed
* @param etemplate &$etempl eTemplate to embed
* @param array &embeded_too array with already embeded templates
*/
function add_etempl(&$etempl,&$embeded_too)
function add_etempl(etemplate $etempl,&$embeded_too)
{
if (is_array($embeded_too))
{
@ -382,10 +384,15 @@
$template->set_attribute('group',$etempl->group);
$template->set_attribute('version',$etempl->version);
$backup_load_via = $this->load_via;
$this->load_via = $etempl->as_array(-1);
foreach($etempl->children as $child)
{
$this->add_widget($template,$child,$embeded_too);
}
$this->load_via = $backup_load_via;
if ($etempl->style != '')
{
$styles = new xmlnode('styles');
@ -398,7 +405,7 @@
/**
* create an XML representation of an eTemplate
*
* @param object $etempl eTemplate object to export
* @param etemplate $etempl eTemplate object to export
* @return string the XML
*/
function export($etempl)
@ -411,7 +418,6 @@
$doc->add_comment('$'.'Id$');
$this->xul_overlay = new xmlnode('overlay'); // global for all add_etempl calls
$this->load_via = $etempl->as_array();
$embeded_too = True;
$this->add_etempl($etempl,$embeded_too);