From: <ral...@us...> - 2012-07-18 17:51:32
|
Author: ralfbecker Date: Wed Jul 18 19:51:09 2012 New Revision: 39866 URL: http://svn.stylite.de/viewvc/egroupware?rev=39866&view=rev Log: backported xml-import/export from trunk, as it works a lot better then version in 1.8 Modified: branches/1.8/etemplate/inc/class.xul_io.inc.php Modified: branches/1.8/etemplate/inc/class.xul_io.inc.php URL: http://svn.stylite.de/viewvc/egroupware/branches/1.8/etemplate/inc/class.xul_io.inc.php?rev=39866&r1=39865&r2=39866&view=diff ============================================================================== --- branches/1.8/etemplate/inc/class.xul_io.inc.php (original) +++ branches/1.8/etemplate/inc/class.xul_io.inc.php Wed Jul 18 19:51:09 2012 @@ -1,12 +1,12 @@ <?php /** - * eGroupWare - eTemplates - XUL/XML Import & Export + * EGroupware - eTemplates - XUL/XML Import & Export * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package etemplate * @link http://www.egroupware.org * @author Ralf Becker <Ral...@ou...> - * @copyright 2002-9 by Ral...@ou... + * @copyright 2002-11 by Ral...@ou... * @version $Id$ */ @@ -51,7 +51,8 @@ var $widget2xul = array( 'label' => array( '.name' => 'description', - 'label' => 'value' + 'label' => 'value', + 'size' => 'font_style,href,activate_links,for,extra_link_target,extra_link_popup,extra_link_title', ), 'text' => array( '.name' => 'textbox', @@ -65,12 +66,17 @@ 'integer' => array( '.name' => 'textbox', '.set' => 'type=integer', - 'size' => 'min,max,size' + 'size' => 'min,max,size,precision,step' + ), + 'int' => array( + '.name' => 'textbox', + '.set' => 'type=integer', + 'size' => 'min,max,size,precision,step' ), 'float' => array( '.name' => 'textbox', '.set' => 'type=float', - 'size' => 'min,max,size,precision' + 'size' => 'min,max,size,precision,step' ), 'select' => array( '.name' => 'menulist,menupopup', @@ -85,7 +91,12 @@ ), 'image' => array( '.name' => 'image', - 'name' => 'src' + 'name' => 'src', + 'size' => 'href,extra_link_target,imagemap,extra_link_popup,id', + ), + 'progres' => array( + '.name' => 'progress', + 'size' => 'href,extra_link_target,,extra_link_popup', ), 'tab' => array( '.name' => 'tabbox,tabs,tabpanels' @@ -154,12 +165,15 @@ */ function &add_widget(&$parent,$cell,&$embeded_too) { + // sort attributes, to stop xet files from changing because of changed attribute order + ksort($cell, SORT_STRING); + $type = $cell['type']; if (is_array($type)) { list(,$type) = each($type); } - if (!$type) $cell['type'] = $type = 'hugo'; + if (!$type) $cell['type'] = $type = 'unknown'; if (substr($type,0,6) == 'select') { $type = $cell['size'] > 1 ? 'select-multi' : 'select'; @@ -191,7 +205,7 @@ { case 'nextmatch': list($tpl) = explode(',',$cell['size']); - $embeded = new etemplate($tpl,$this->load_via); + $embeded = new boetemplate($tpl,$this->load_via); if ($embeded_too) { $this->add_etempl($embeded,$embeded_too); @@ -210,11 +224,12 @@ for ($n = 0; $n < count($labels); ++$n) { $tab = new xmlnode('tab'); + $tab->set_attribute('id',$names[$n]); $tab->set_attribute('label',$labels[$n]); - $tab->set_attribute('statustext',$helps[$n]); + if ($helps[$n]) $tab->set_attribute('statustext',$helps[$n]); $child->add_node($tab); - $embeded = new etemplate($names[$n],$this->load_via); + $embeded = new boetemplate($names[$n],$this->load_via); if ($embeded_too) { $this->add_etempl($embeded,$embeded_too); @@ -267,7 +282,7 @@ case 'template': if ($cell['name'][0] != '@' && $embeded_too) { - $templ = new etemplate(); + $templ = new boetemplate(); if ($templ->read(boetemplate::expand_name($cell['name'],0,0),'default','default',0,'',$this->load_via)) { $this->add_etempl($templ,$embeded_too); @@ -359,10 +374,10 @@ /** * add / embed an eTemplate into the global $xul_overlay object (used by export) * - * @param etemplate &$etempl eTemplate to embed + * @param boetemplate &$etempl eTemplate to embed * @param array &embeded_too array with already embeded templates */ - function add_etempl(etemplate $etempl,&$embeded_too) + function add_etempl(boetemplate $etempl,&$embeded_too) { if (is_array($embeded_too)) { @@ -644,6 +659,8 @@ { $attr['size'] = '0'.($attr['orient'] || $attr['size'] ? ','.$attr['orient']. ($attr['size'] ? ','.$attr['size'] : '') : ''); + $attr['span'] .= $attr['class'] ? ','.$attr['class'] : ''; + unset($attr['class']); soetemplate::add_child($parent,$attr); $parents[count($parents)] = &$parent; // $parents[] does not always the same - strange $parent = &$attr; |