some bugfixes:

- tab-widgets can be edited (new editor lost template content and onclick_handler, if looping)
- select widgets accept again options via $sel_options[$name]  $name is the name of the widget and not the form_name
- grid-options get loaded again via the old editor
This commit is contained in:
Ralf Becker 2005-02-23 14:33:00 +00:00
parent 51fa973640
commit 717f53ece2
4 changed files with 83 additions and 56 deletions

View File

@ -131,7 +131,7 @@
);
foreach(explode(',',$this->etemplate->size) as $n => $opt)
{
$content['options'][$opt] = $options[$n];
$content['options'][$this->options[$n]] = $opt;
}
$cols_spanned = array();
reset($this->etemplate->data);
@ -1708,7 +1708,7 @@
$editor->exec('etemplate.editor.widget',$content,array(
'type' => array_merge($this->etemplate->types,$this->extensions),
'align' => $this->aligns,
'grid_row[valign]' => $this->valigns,
'valign' => $this->valigns,
'edit_menu' => $this->edit_menu,
'box_menu' => $this->box_menu,
'row_menu' => $this->row_menu,

View File

@ -309,6 +309,8 @@
}
$this->tpls_in_file = is_array($name) ? $name['tpls_in_file'] : 0;
if (is_array($name) && $name['onclick_handler']) $this->onclick_handler = $name['onclick_handler'];
if (is_array($name) && isset($name['data']))
{
// data/children are in $name['data']
@ -652,9 +654,10 @@
* Calls it self recursivly for arrays / the rows
*
* @param array $arr the array to compress
* @param boolean $remove_all_objs if true unset all objs, on false use as_array to save only the data of objs
* @return array
*/
function compress_array($arr)
function compress_array($arr,$remove_objs=false)
{
if (!is_array($arr))
{
@ -664,7 +667,11 @@
{
if (is_array($val))
{
$arr[$key] = $this->compress_array($val);
$arr[$key] = $this->compress_array($val,$remove_objs);
}
elseif (!$remove_objs && $key == 'obj' && is_object($val) && method_exists($val,'as_array'))
{
$arr['obj'] = $val->as_array(2);
}
elseif ($val == '' || is_object($val))
{
@ -705,7 +712,7 @@
if ($data_too > 0)
{
$arr[$db_keys ? $db_col : $col] = $data_too < 2 ? $this->children :
serialize($this->compress_array($this->children));
serialize($this->compress_array($this->children,$db_keys));
}
}
else
@ -717,6 +724,10 @@
{
$arr['tpls_in_file'] = $this->tpls_in_file;
}
if ($data_too != -1 && $this->onclick_handler && !$db_keys)
{
$arr['onclick_handler'] = $this->onclick_handler;
}
return $arr;
}

View File

@ -156,26 +156,8 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('java_script' => $GLOBALS['phpgw_info']['flags']['java_script'].$this->include_java_script(2)));
}
$id = $this->save_appsession($this->as_array(1) + array(
'readonlys' => $readonlys,
'content' => $content,
'changes' => $changes,
'sel_options' => $sel_options,
'preserv' => $preserv,
'extension_data' => $GLOBALS['phpgw_info']['etemplate']['extension_data'],
'to_process' => $GLOBALS['phpgw_info']['etemplate']['to_process'],
'java_script' => $GLOBALS['phpgw_info']['etemplate']['java_script'],
'dom_enabled' => $GLOBALS['phpgw_info']['etemplate']['dom_enabled'],
'hooked' => $hooked != '' ? $hooked : $GLOBALS['phpgw_info']['etemplate']['hook_content'],
'app_header' => $GLOBALS['phpgw_info']['flags']['app_header'],
'output_mode' => $output_mode,
'session_used' => 0,
),$id);
if ((int) $output_mode == 1) // return html
if ((int) $output_mode != 1) // NOT returning html
{
return $html;
}
if (!$this->xslt)
{
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'])
@ -207,6 +189,27 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('body_data' => $html));
}
}
$this->save_appsession($this->as_array(2) + array(
'readonlys' => $readonlys,
'content' => $content,
'changes' => $changes,
'sel_options' => $sel_options,
'preserv' => $preserv,
'extension_data' => $GLOBALS['phpgw_info']['etemplate']['extension_data'],
'to_process' => $GLOBALS['phpgw_info']['etemplate']['to_process'],
'java_script' => $GLOBALS['phpgw_info']['etemplate']['java_script'],
'dom_enabled' => $GLOBALS['phpgw_info']['etemplate']['dom_enabled'],
'hooked' => $hooked != '' ? $hooked : $GLOBALS['phpgw_info']['etemplate']['hook_content'],
'app_header' => $GLOBALS['phpgw_info']['flags']['app_header'],
'output_mode' => $output_mode,
'session_used' => 0,
),$id);
if ((int) $output_mode == 1) // return html
{
return $html;
}
}
/**
* Makes the necessary adjustments to _POST before it calls the app's method
@ -870,6 +873,13 @@
echo "<p>Object in Name in tpl '$this->name': "; _debug_array($grid);
}
$obj_read = 'already loaded';
if (is_array($cell['obj']))
{
$obj =& new etemplate();
$obj->init($cell['obj']);
$cell['obj'] =& $obj;
unset($obj);
}
if (!is_object($cell['obj']))
{
if ($cell['name'][0] == '@')
@ -954,7 +964,10 @@
{
$sels += $sel_options[$name];
}
elseif (count($name_parts))
else
{
$name_parts = explode('[',str_replace(']','',$name));
if (count($name_parts))
{
$org_name = $name_parts[count($name_parts)-1];
if (isset($sel_options[$org_name]) && is_array($sel_options[$org_name]))
@ -966,6 +979,7 @@
$sels += $sel_options[$name_parts[0]];
}
}
}
if (isset($content["options-$name"]))
{
$sels += $content["options-$name"];

File diff suppressed because one or more lines are too long