some docu updates and cleaned up some debug-code

This commit is contained in:
Ralf Becker 2003-02-22 12:29:04 +00:00
parent 22407e6b33
commit 7d836e4c53
2 changed files with 43 additions and 21 deletions

View File

@ -30,6 +30,7 @@
'link-to' => 'LinkTo',
'link-list' => 'LinkList'
);
var $debug = False;
function link_widget($ui)
{
@ -45,7 +46,11 @@
'to_app' => $GLOBALS['phpgw_info']['flags']['currentapp']
);
}
//echo "<p>start: $cell[type]::pre_process: value ="; _debug_array($value);
if ($this->debug)
{
echo "<p>start: $cell[type][$name]::pre_process: value ="; _debug_array($value);
echo "extension_data[$cell[type]][$name] ="; _debug_array($extension_data);
}
switch ($type = $cell['type'])
{
case 'link-to':
@ -82,9 +87,11 @@
case 'link-list':
$app = $value['to_app'];
$id = $value['to_id'];
//echo "<p>link-list-widget.preprocess: value="; _debug_array($value);
$id = isset($extension_data['to_id']) ? $extension_data['to_id'] : $value['to_id'];
if ($this->debug)
{
echo "<p>link-list-widget[$name].preprocess: value="; _debug_array($value);
}
if (!isset($value['title']))
{
$value['title'] = $this->link->title($app,$id);
@ -114,16 +121,19 @@
$cell['name'] = $tpl->name;
$cell['obj'] = &$tpl;
//echo "<p>end: $type::pre_process: value ="; _debug_array($value);
if ($this->debug)
{
echo "<p>end: $type"."[$name]::pre_process: value ="; _debug_array($value);
}
return True; // extra Label is ok
}
function post_process($name,&$value,&$extension_data,&$loop,&$tmpl,$value_in)
{
$buttons = array('search','create','new','upload','attach');
while (!$button && list(,$name) = each($buttons))
while (!$button && list(,$bname) = each($buttons))
{
$button = $value[$name] ? $name : '';
$button = $value[$bname] ? $bname : '';
}
if (is_array($value['unlink']))
{
@ -136,7 +146,7 @@
if ($button && $this->debug)
{
echo "<p>start: link_widget::post_process: button='$button', unlink='$unlink', value ="; _debug_array($value);
echo "<p>start: link_widget[$name]::post_process: button='$button', unlink='$unlink', value ="; _debug_array($value);
}
switch ($button)
{
@ -162,7 +172,7 @@
if (is_array($value['file']) && $value['to_app'])
{
$link_id = $this->link->link($value['to_app'],$value['to_id'],
'vfs',$value['file'],$value['remark']);
$this->link->vfs_appname,$value['file'],$value['remark']);
unlink($value['file']['tmp_name']);
unset($value['file']);
}
@ -187,13 +197,24 @@
break;
case 'unlink':
if ($this->debug)
{
echo "<p>unlink(link-id=$unlink,$value[to_app],$value[to_id])</p>\n";
if (is_array($value['to_id'])) _debug_array($value['to_id']);
}
$this->link->unlink($unlink,$value['to_app'],&$value['to_id']);
//echo "<p>unlink(link-id=$unlink,$value[to_app],$value[to_id])</p>\n";
if (is_array($value['to_id']))
{
$extension_data['to_id'] = $value['to_id']; // else changes from unlink get lost
}
$loop = True;
break;
}
$value['button'] = $button;
//echo "<p>end: link_widget::post_process: value ="; _debug_array($value);
if ($this->debug)
{
echo "<p>end: link_widget[$name]::post_process: value ="; _debug_array($value);
}
return True;
}
}

View File

@ -276,7 +276,7 @@
{
$readonlys = array();
}
if ($this->debug >= 1 || $this->debug == $this->name && $this->name)
if (is_int($this->debug) && $this->debug >= 1 || $this->debug == $this->name && $this->name)
{
echo "<p>etemplate.show($this->name): $cname =\n"; _debug_array($content);
}
@ -414,7 +414,7 @@
*/
function show_cell($cell,$content,$sel_options,$readonlys,$cname,$show_c,$show_row,&$span)
{
if ($this->debug >= 3 || $this->debug == $cell['type'])
if (is_int($this->debug) && $this->debug >= 3 || $this->debug == $cell['type'])
{
echo "<p>etemplate.show_cell($this->name,name='${cell['name']}',type='${cell['type']}',cname='$cname')</p>\n";
}
@ -625,7 +625,7 @@
$cell['obj'] = new etemplate(/*** TESTWEISE ***$cell['name']*/$name,$this->as_array());
}
}
if ($this->debug >= 3 || $this->debug == $cell['type'])
if (is_int($this->debug) && $this->debug >= 3 || $this->debug == $cell['type'])
{
echo "<p>show_cell::template(tpl=$this->name,name=$cell[name]): $obj_read</p>\n";
}
@ -818,6 +818,7 @@
@abstract makes necessary adjustments on HTTP_POST_VARS after a eTemplate / form gots submitted
@discussion This is only an internal function, dont call it direct use only exec
@discussion Process_show uses a list of input-fields/widgets generated by show.
@syntax process_show(&$content,$to_process,$cname='')
@param $content HTTP_POST_VARS[$cname]
@param $to_process list of widgets/form-fields to process
@param $cname basename of our returnt content (same as in call to show)
@ -829,7 +830,7 @@
{
return;
}
if ($this->debug >= 1 || $this->debug == $this->name && $this->name)
if (is_int($this->debug) && $this->debug >= 1 || $this->debug == $this->name && $this->name)
{
echo "<p>process_show($this->name) start: content ="; _debug_array($content);
}
@ -911,7 +912,7 @@
{
$content = $content[$cname];
}
if ($this->debug >= 2 || $this->debug == $this->name && $this->name)
if (is_int($this->debug) && $this->debug >= 2 || $this->debug == $this->name && $this->name)
{
echo "<p>process_show($this->name) end: content ="; _debug_array($content);
}