Add very basic support for et2 widgets into editor, to at least not destroy templates

This commit is contained in:
Nathan Gray 2013-04-08 14:06:01 +00:00
parent fd41f7e4bc
commit 715d45a2c1
4 changed files with 43 additions and 1 deletions

View File

@ -1371,6 +1371,37 @@ class editor
{
$editor->set_cell_attribute('etemplate.editor.widget.generic','obj',$type_tmpl);
}
/*
Not a known type, use a generic attribute thing to at least allow working
with the attributes provided
*/
if(!$this->types[$widget['type']] && !$this->extensions[$widget['type']])
{
$grid =& $editor->get_widget_by_name('etemplate.editor.widget.generic');
$grid['type'] = 'grid';
$grid['name'] = 'cell';
$grid['data'] = array(array());
$grid['data'][] = array('A'=>boetemplate::empty_cell('label','',array('label' => 'Type')), 'B' => boetemplate::empty_cell('select','type'));
$attributes = array('type'=>$widget_type,'name'=>'');
if(is_array($widget))
{
$attributes += $widget;
}
foreach($attributes as $attr_name => $attr_value)
{
if(is_array($attr_value) || in_array($attr_value, array('type','options')))
{
continue;
}
else
{
$attr = boetemplate::empty_cell('text',$attr_name,array());
}
$grid['data'][] = array('A' => boetemplate::empty_cell('label','',array('label' => $attr_name)),'B'=>$attr);
//boetemplate::add_child($grid,$attr);
unset($attr);
}
}
if ($parent['type'] == 'grid')
{
$editor->disable_cells('box_menu');
@ -1382,6 +1413,7 @@ class editor
}
$preserv = $this->etemplate->as_array()+array(
'path' => $content['path'],
'type' => $content['type'],
'old_version' => $this->etemplate->version,
'opener' => $content['opener'],
'cell' => $content['cell'],
@ -1392,7 +1424,9 @@ class editor
$GLOBALS['egw_info']['flags']['java_script'] = "<script>window.focus();</script>\n";
$GLOBALS['egw_info']['flags']['app_header'] = lang('Editable Templates - Editor');
$editor->exec('etemplate.editor.widget',$content,array(
'type' => array_merge(boetemplate::$types,$this->extensions),
'type' => array_merge(array($widget['type'] => $widget['type'] . ' (?)'),
boetemplate::$types,$this->extensions
),
'align' => &$this->aligns,
'valign' => &$this->valigns,
'part' => $allowed_parts,

View File

@ -1719,6 +1719,9 @@ class etemplate_old extends boetemplate
));
}
break;
case 'split':
// Render this et2 widget as a box
$orient = $cell['orientation'];
case 'vbox':
case 'hbox':
case 'groupbox':

View File

@ -78,6 +78,7 @@ class soetemplate
'hbox' => 'box',
'groupbox' => 'box',
'deck' => 'box',
'split' => 'box',
);
/**
@ -242,6 +243,7 @@ class soetemplate
case 'groupbox':
case 'box':
case 'deck':
default:
list($n,$options) = explode(',',$parent['size'],2);
$parent[++$n] = &$cell;
$parent['size'] = $n . ($options ? ','.$options : '');
@ -1171,6 +1173,7 @@ class soetemplate
}
switch($widget['type'])
{
case 'split':
case 'box':
case 'vbox':
case 'hbox':

View File

@ -271,6 +271,7 @@ class xul_io
unset($cell['label']);
}
// fall-through
case 'split':
case 'vbox':
case 'hbox':
case 'box':
@ -664,6 +665,7 @@ class xul_io
unset($menulist_attr);
}
break;
case 'split':
case 'vbox':
case 'hbox':
case 'deck':