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

View File

@ -308,6 +308,8 @@
$this->lang = ''; $this->lang = '';
} }
$this->tpls_in_file = is_array($name) ? $name['tpls_in_file'] : 0; $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'])) if (is_array($name) && isset($name['data']))
{ {
@ -652,9 +654,10 @@
* Calls it self recursivly for arrays / the rows * Calls it self recursivly for arrays / the rows
* *
* @param array $arr the array to compress * @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 * @return array
*/ */
function compress_array($arr) function compress_array($arr,$remove_objs=false)
{ {
if (!is_array($arr)) if (!is_array($arr))
{ {
@ -664,7 +667,11 @@
{ {
if (is_array($val)) 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)) elseif ($val == '' || is_object($val))
{ {
@ -705,7 +712,7 @@
if ($data_too > 0) if ($data_too > 0)
{ {
$arr[$db_keys ? $db_col : $col] = $data_too < 2 ? $this->children : $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 else
@ -717,6 +724,10 @@
{ {
$arr['tpls_in_file'] = $this->tpls_in_file; $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; return $arr;
} }

View File

@ -156,7 +156,40 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('java_script' => $GLOBALS['phpgw_info']['flags']['java_script'].$this->include_java_script(2))); $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( if ((int) $output_mode != 1) // NOT returning html
{
if (!$this->xslt)
{
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'])
{
if((int) $output_mode != 2)
{
echo parse_navbar();
}
else
{
echo '<div id="divMain">'."\n";
}
}
echo $GLOBALS['phpgw_info']['etemplate']['hook_content'].$html;
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'] &&
(!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php')))
{
if((int) $output_mode == 2)
{
echo "</div>\n";
}
$GLOBALS['phpgw']->common->phpgw_footer();
}
}
else
{
// need to add some logic here to support popups (output_mode==2) for xslt, but who cares ...
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('body_data' => $html));
}
}
$this->save_appsession($this->as_array(2) + array(
'readonlys' => $readonlys, 'readonlys' => $readonlys,
'content' => $content, 'content' => $content,
'changes' => $changes, 'changes' => $changes,
@ -176,36 +209,6 @@
{ {
return $html; return $html;
} }
if (!$this->xslt)
{
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'])
{
if((int) $output_mode != 2)
{
echo parse_navbar();
}
else
{
echo '<div id="divMain">'."\n";
}
}
echo $GLOBALS['phpgw_info']['etemplate']['hook_content'].$html;
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'] &&
(!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php')))
{
if((int) $output_mode == 2)
{
echo "</div>\n";
}
$GLOBALS['phpgw']->common->phpgw_footer();
}
}
else
{
// need to add some logic here to support popups (output_mode==2) for xslt, but who cares ...
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('body_data' => $html));
}
} }
/** /**
@ -870,6 +873,13 @@
echo "<p>Object in Name in tpl '$this->name': "; _debug_array($grid); echo "<p>Object in Name in tpl '$this->name': "; _debug_array($grid);
} }
$obj_read = 'already loaded'; $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 (!is_object($cell['obj']))
{ {
if ($cell['name'][0] == '@') if ($cell['name'][0] == '@')
@ -954,16 +964,20 @@
{ {
$sels += $sel_options[$name]; $sels += $sel_options[$name];
} }
elseif (count($name_parts)) else
{ {
$org_name = $name_parts[count($name_parts)-1]; $name_parts = explode('[',str_replace(']','',$name));
if (isset($sel_options[$org_name]) && is_array($sel_options[$org_name])) if (count($name_parts))
{ {
$sels += $sel_options[$org_name]; $org_name = $name_parts[count($name_parts)-1];
} if (isset($sel_options[$org_name]) && is_array($sel_options[$org_name]))
elseif (isset($sel_options[$name_parts[0]]) && is_array($sel_options[$name_parts[0]])) {
{ $sels += $sel_options[$org_name];
$sels += $sel_options[$name_parts[0]]; }
elseif (isset($sel_options[$name_parts[0]]) && is_array($sel_options[$name_parts[0]]))
{
$sels += $sel_options[$name_parts[0]];
}
} }
} }
if (isset($content["options-$name"])) if (isset($content["options-$name"]))

File diff suppressed because one or more lines are too long