From aa1a87f328dd9c5cad97c5c8441298dc61aaefc5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 14 May 2007 10:41:11 +0000 Subject: [PATCH] "fix for bug #622: 'XML Import' doesn't work right" --- etemplate/inc/class.editor.inc.php | 2 +- etemplate/inc/class.xul_io.inc.php | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 059296df59..8433e78976 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -320,7 +320,7 @@ $msg = $ok ? lang('Template saved') : lang('Error: while saving !!!'); if ($ok) unset($preserv['import']); } - elseif (isset($_GET['name']) || isset($content['name'])) + elseif (!$content['import_xml'] && (isset($_GET['name']) || isset($content['name']))) { if ($_GET['name']) { diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php index 097e0ebf80..335a9ec819 100644 --- a/etemplate/inc/class.xul_io.inc.php +++ b/etemplate/inc/class.xul_io.inc.php @@ -428,7 +428,7 @@ * * @param object &$etempl eTemplate object to set * @param string $data the XML - * @param array/string array with names of imported templates or error-message + * @return array/string array with names of imported templates or error-message */ function import(&$etempl,$data) { @@ -498,9 +498,8 @@ switch ($type) { case 'close': - if (!count($parents) || $parent['.is_root']) // templ import complet => save it + if (!count($parents)) // templ import complet => save it { - unset($parent['.is_root']); unset($parent); $parents = array(); $etempl->fix_old_template_format(); // set the depricated compat vars // save tmpl to the cache, as the file may contain more then one tmpl @@ -525,7 +524,7 @@ { $etempl->init($attr); $etempl->children = array(); // init adds one grid by default - $parent = &$etempl->children; + $parent = &$etempl; // parent is the template-object itself! } if ($tag == 'grid') { @@ -541,7 +540,6 @@ 'rows' => 0, 'size' => $size, ); - if ($is_root) $grid['.is_root'] = true; // we need to remember we have no template as parent soetemplate::add_child($parent,$grid); $parents[count($parents)] = &$parent; $parent = &$grid;