mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
php3 and formatting adjustments - needs tweaking to make sure it works as
desired.
This commit is contained in:
parent
e78caa8232
commit
4f9a3b4ef1
@ -16,7 +16,7 @@
|
||||
|
||||
var $public_functions = array
|
||||
(
|
||||
'read_log' => True
|
||||
'read_log' => True
|
||||
);
|
||||
|
||||
function bolog($session=False)
|
||||
@ -53,17 +53,17 @@
|
||||
// should remove the accounts_pwd
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
function get_no_errors()
|
||||
{
|
||||
$rows = $this->so->get_no_errors();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
function get_error_e($values='')
|
||||
{
|
||||
$rows = $this->so->get_error_e($values);
|
||||
|
||||
|
||||
// Enhance the fields
|
||||
reset($rows);
|
||||
while(list($rno,$r)=each($rows))
|
||||
|
@ -12,511 +12,531 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class html
|
||||
{
|
||||
function hash_table($rows,$head='',$obj, $frtn)
|
||||
class html
|
||||
{
|
||||
global $phpgw, $start, $phpgw_info;
|
||||
$html = '';
|
||||
$edittable =$head['_edittable'];
|
||||
if (isset($edittable))
|
||||
function hash_table($rows,$head='',$obj, $frtn)
|
||||
{
|
||||
if ($edittable)
|
||||
$start = $GLOBALS['HTTP_POST_VARS']['start'] ? $GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start'];
|
||||
|
||||
$html = '';
|
||||
$edittable =$head['_edittable'];
|
||||
if (isset($edittable))
|
||||
{
|
||||
// Generate the customization table...
|
||||
return $this->edit_table($rows,$head,$obj,$frtn);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<form method=\"post\" action=\""
|
||||
. $phpgw->link('/admin/log.php') ;
|
||||
// . "&editable=true\">\n";
|
||||
// --------------------------------- nextmatch ---------------------------
|
||||
// nextmatchs
|
||||
$bo = CreateObject('admin.bolog',True);
|
||||
if (!isset($start))
|
||||
if ($edittable)
|
||||
{
|
||||
$start = 0;
|
||||
// Generate the customization table...
|
||||
return $this->edit_table($rows,$head,$obj,$frtn);
|
||||
}
|
||||
$num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs'];
|
||||
$stop = $start + $num_rows;
|
||||
if ($stop > count($rows))
|
||||
else
|
||||
{
|
||||
$stop = count($rows);
|
||||
}
|
||||
$nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
$total_records = $bo->get_no_errors();
|
||||
$left = $nextmatchs->left('/admin/log.php',$start,$total_records,$extradata='');
|
||||
$right = $nextmatchs->right('/admin/log.php',$start,$total_records,$extradata='');
|
||||
$hits = $nextmatchs->show_hits($total_records,$start);
|
||||
|
||||
// -------------------------- end nextmatch ------------------------------------
|
||||
$html .= "<table width=\"98%\"><tr>";
|
||||
$html .= "<td align=left>$left</td>";
|
||||
$html .= "<td align=right> $hits</td>";
|
||||
$html .= "<td align=left> <A href=".$phpgw->link('/admin/log.php'). "&editable=true" ."> Edit Table format </A></td>";
|
||||
$html .= "<td align=right>$right</td>";
|
||||
$html .= "</tr></table>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($head == '')
|
||||
{
|
||||
$frow = $rows[0];
|
||||
$cnam = array_keys($frow);
|
||||
while(list(,$fn)=each($cnam))
|
||||
{
|
||||
$head[$fn] = array();
|
||||
}
|
||||
};
|
||||
|
||||
if ( gettype($head['_cols'])=="NULL")
|
||||
{
|
||||
$cols = array_keys($rows[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cols = $head['_cols'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Build Header Row...
|
||||
|
||||
// First Get the layout arrays...
|
||||
$layout = $head['#layout'];
|
||||
if (gettype($layout) != 'array')
|
||||
{
|
||||
$layout = array_keys($cols);
|
||||
}
|
||||
|
||||
// printlist, a list of all columns in a logical row,
|
||||
// with Row/ColSpawn values, in print order...
|
||||
|
||||
$printlist = $this->make_printlist($layout,$cols);
|
||||
|
||||
|
||||
// $table contains data for header row....
|
||||
$table = $this->make_tblhead($printlist,$head);
|
||||
|
||||
// get GroupBy
|
||||
$groupby = $head['_groupby'];
|
||||
$supres = $head['_supres'];
|
||||
$lastgroup = '';
|
||||
|
||||
// build actual Rows...
|
||||
$rparms = array();
|
||||
$mrow = $stop;
|
||||
for ($rno=0;$rno<$mrow;$rno++)
|
||||
{
|
||||
// Build GroupKey
|
||||
if (isset($groupby))
|
||||
{
|
||||
$gkey = '';
|
||||
reset($groupby);
|
||||
while (list($gname,)=each($groupby))
|
||||
{
|
||||
$gkey .= $rows[$rno][$gname]['value'];
|
||||
}
|
||||
$rows[$rno]['#gkey'] = $gkey;
|
||||
}
|
||||
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
$cparms = array_merge($head[$cname],$pcol,array('bgcolor'=>'FFFFFF'),$rows[$rno][$cname]);
|
||||
$rows[$rno][$cname] = $cparms;
|
||||
}
|
||||
}
|
||||
|
||||
// Grouping Suppression
|
||||
|
||||
if (isset($groupby))
|
||||
{
|
||||
$grno = $start;
|
||||
$gkey = $rows[$start]['#gkey'];
|
||||
for ($rno=$start+1;$rno<$stop;$rno++)
|
||||
{
|
||||
$rowspan = 1;
|
||||
$rkey = $rows[$rno]['#gkey'];
|
||||
|
||||
while ( $gkey == $rkey)
|
||||
{
|
||||
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are equal</p>";
|
||||
$rowspan = $rowspan + 1;
|
||||
$row = $rows[$rno];
|
||||
|
||||
for ($pc=0;$pc<count($row);$pc++)
|
||||
$html .= '<form method="post" action="'
|
||||
. $GLOBALS['phpgw']->link('/index.php')
|
||||
. '">' . "\n";
|
||||
$bo = CreateObject('admin.bolog',True);
|
||||
if (!isset($start))
|
||||
{
|
||||
$c = $row[$cols[$pc]];
|
||||
$cno = $c['#colno'];
|
||||
$cname = $c['#name'];
|
||||
|
||||
if ($supres[$cname])
|
||||
{
|
||||
$rows[$rno][$cname]['#supres']='yes';
|
||||
$rows[$rno][$cname]['value']='  ';
|
||||
$rows[$grno][$cname]['rowspan']=$printlist[$cno]['rowspan']*$rowspan;
|
||||
}
|
||||
$start = 0;
|
||||
}
|
||||
$rno++;
|
||||
$rkey = $rows[$rno]['#gkey'];
|
||||
}
|
||||
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are not equal</p>";
|
||||
$grno=$rno;
|
||||
$gkey=$rkey;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Now Generate the Html For the Table Header
|
||||
*/
|
||||
//print_r($table);
|
||||
|
||||
$html .= $this->html_head($head,$table,$printlist);
|
||||
/*
|
||||
** Now (finaly) Generate the Html For the Table
|
||||
*/
|
||||
//print_r($rows);
|
||||
for ($rno=$start;$rno<$stop;$rno++)
|
||||
{
|
||||
// let user have a hack at the row...
|
||||
$row = $obj->$frtn($rno,$rows[$rno]);
|
||||
// $row = $rows[$rno];
|
||||
|
||||
// $rp = $this->makeparms($row[$rno]['#row_parms']);
|
||||
$rp = '';
|
||||
$gkey = $row['#gkey'];
|
||||
// $html .= "\t<tr $rp> <comment $gkey>\n";
|
||||
$html .= "\t<tr $rp> \n";
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
|
||||
$cp = $this->makeparms($row[$cname]);
|
||||
if($row[$cname]['#supres'] != 'yes')
|
||||
{
|
||||
$html .= "\t\t<td $cp>".$row[$cname]['value']."</td>\n";
|
||||
}
|
||||
if($pcol['#eor']=='1')
|
||||
{
|
||||
$html .= "\t</tr>\n"; // \t<tr $rp>\n
|
||||
}
|
||||
}
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "</form>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function makeparms($parmlist)
|
||||
{
|
||||
$html = '';
|
||||
$comma = ' ';
|
||||
if (gettype($parmlist) != 'array')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
reset($parmlist);
|
||||
while(list($pname,$pvalue)=each($parmlist))
|
||||
{
|
||||
switch($pname)
|
||||
{
|
||||
case 'value':
|
||||
break;
|
||||
case 'colspan':
|
||||
case 'rowspan':
|
||||
if ($pvalue != 1)
|
||||
$num_rows = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$stop = $start + $num_rows;
|
||||
if ($stop > count($rows))
|
||||
{
|
||||
$html .= $comma . $pname . '="' . $pvalue . '"';
|
||||
$comma = ', ';
|
||||
};
|
||||
break;
|
||||
default:
|
||||
if (substr($pname,0,1) != '#')
|
||||
{
|
||||
$html .= $comma . $pname . '="' . $pvalue . '"';
|
||||
$comma = ', ';
|
||||
$stop = count($rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
$nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
$total_records = $bo->get_no_errors();
|
||||
$left = $nextmatchs->left('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
|
||||
$right = $nextmatchs->right('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
|
||||
$hits = $nextmatchs->show_hits($total_records,$start);
|
||||
|
||||
function edit_table($rows,$head='',$obj, $frtn)
|
||||
{
|
||||
global $phpgw, $nocols, $noflds, $norows, $layout, $_cols;
|
||||
$html = '';
|
||||
$html .= "<form method=\"post\" action=\""
|
||||
. $phpgw->link('/admin/log.php')
|
||||
. "&editable=true"
|
||||
. "\">\n";
|
||||
|
||||
$params = $head['_table_parms'];
|
||||
$frow = $rows[0];
|
||||
$cnam = array_keys($frow);
|
||||
if ($head == '')
|
||||
{
|
||||
while(list(,$fn)=each($cnam))
|
||||
$html .= '<table width="98%"><tr>';
|
||||
$html .= '<td align="left">' . $left . '</td>';
|
||||
$html .= '<td align="right"> ' . $hits . ' </td>';
|
||||
$html .= '<td align="left"> <a href=' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true') .'> ' . lang('Edit Table format') . '</a></td>';
|
||||
$html .= '<td align="right">' . $right . '</td>';
|
||||
$html .= '</tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($head == '')
|
||||
{
|
||||
$head[$fn] = array();
|
||||
$frow = $rows[0];
|
||||
$cnam = $this->arr_keys($frow);
|
||||
while(list(,$fn)=each($cnam))
|
||||
{
|
||||
$head[$fn] = array();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (isset($_cols))
|
||||
{
|
||||
$cols = $_cols;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( gettype($head['_cols'])=="NULL")
|
||||
{
|
||||
$cols = array_keys($rows[0]);
|
||||
$cols = $this->arr_keys($rows[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cols = $head['_cols'];
|
||||
};
|
||||
}
|
||||
|
||||
if (!isset($noflds))
|
||||
{
|
||||
$noflds = count($cols);
|
||||
}
|
||||
if (!isset($layout))
|
||||
{
|
||||
}
|
||||
|
||||
// Build Header Row...
|
||||
|
||||
// First Get the layout arrays...
|
||||
$layout = $head['#layout'];
|
||||
};
|
||||
if (!isset($norows))
|
||||
{
|
||||
$norows = count($layout);
|
||||
if (gettype($layout) != 'array')
|
||||
{
|
||||
$layout = $this->arr_keys($cols);
|
||||
}
|
||||
|
||||
// printlist, a list of all columns in a logical row,
|
||||
// with Row/ColSpawn values, in print order...
|
||||
|
||||
$printlist = $this->make_printlist($layout,$cols);
|
||||
|
||||
// $table contains data for header row....
|
||||
$table = $this->make_tblhead($printlist,$head);
|
||||
|
||||
// get GroupBy
|
||||
$groupby = $head['_groupby'];
|
||||
$supres = $head['_supres'];
|
||||
$lastgroup = '';
|
||||
|
||||
// build actual Rows...
|
||||
$rparms = array();
|
||||
$mrow = $stop;
|
||||
for ($rno=0;$rno<$mrow;$rno++)
|
||||
{
|
||||
// Build GroupKey
|
||||
if (isset($groupby))
|
||||
{
|
||||
$gkey = '';
|
||||
reset($groupby);
|
||||
while (list($gname,)=each($groupby))
|
||||
{
|
||||
$gkey .= $rows[$rno][$gname]['value'];
|
||||
}
|
||||
$rows[$rno]['#gkey'] = $gkey;
|
||||
}
|
||||
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
$cparms = $this->arr_merge($head[$cname],$pcol,array('bgcolor'=>'FFFFFF'),$rows[$rno][$cname]);
|
||||
$rows[$rno][$cname] = $cparms;
|
||||
}
|
||||
}
|
||||
|
||||
// Grouping Suppression
|
||||
|
||||
if (isset($groupby))
|
||||
{
|
||||
$grno = $start;
|
||||
$gkey = $rows[$start]['#gkey'];
|
||||
for ($rno=$start+1;$rno<$stop;$rno++)
|
||||
{
|
||||
$rowspan = 1;
|
||||
$rkey = $rows[$rno]['#gkey'];
|
||||
|
||||
while ( $gkey == $rkey)
|
||||
{
|
||||
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are equal</p>";
|
||||
$rowspan = $rowspan + 1;
|
||||
$row = $rows[$rno];
|
||||
|
||||
for ($pc=0;$pc<count($row);$pc++)
|
||||
{
|
||||
$c = $row[$cols[$pc]];
|
||||
$cno = $c['#colno'];
|
||||
$cname = $c['#name'];
|
||||
|
||||
if ($supres[$cname])
|
||||
{
|
||||
$rows[$rno][$cname]['#supres']='yes';
|
||||
$rows[$rno][$cname]['value']='  ';
|
||||
$rows[$grno][$cname]['rowspan']=$printlist[$cno]['rowspan']*$rowspan;
|
||||
}
|
||||
}
|
||||
$rno++;
|
||||
$rkey = $rows[$rno]['#gkey'];
|
||||
}
|
||||
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are not equal</p>";
|
||||
$grno=$rno;
|
||||
$gkey=$rkey;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Now Generate the Html For the Table Header
|
||||
*/
|
||||
//print_r($table);
|
||||
|
||||
$html .= $this->html_head($head,$table,$printlist);
|
||||
/*
|
||||
** Now (finaly) Generate the Html For the Table
|
||||
*/
|
||||
//print_r($rows);
|
||||
for ($rno=$start;$rno<$stop;$rno++)
|
||||
{
|
||||
// let user have a hack at the row...
|
||||
$row = $obj->$frtn($rno,$rows[$rno]);
|
||||
// $row = $rows[$rno];
|
||||
|
||||
// $rp = $this->makeparms($row[$rno]['#row_parms']);
|
||||
$rp = '';
|
||||
$gkey = $row['#gkey'];
|
||||
// $html .= "\t<tr $rp> <comment $gkey>\n";
|
||||
$html .= "\t<tr $rp> \n";
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
|
||||
$cp = $this->makeparms($row[$cname]);
|
||||
if($row[$cname]['#supres'] != 'yes')
|
||||
{
|
||||
$html .= "\t\t<td $cp>".$row[$cname]['value']."</td>\n";
|
||||
}
|
||||
if($pcol['#eor']=='1')
|
||||
{
|
||||
$html .= "\t</tr>\n"; // \t<tr $rp>\n
|
||||
}
|
||||
}
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "</form>";
|
||||
return $html;
|
||||
}
|
||||
if (!isset($nocols))
|
||||
|
||||
function makeparms($parmlist)
|
||||
{
|
||||
$nocols = count($layout[0]);
|
||||
$html = '';
|
||||
$comma = ' ';
|
||||
if (gettype($parmlist) != 'array')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
reset($parmlist);
|
||||
while(list($pname,$pvalue)=each($parmlist))
|
||||
{
|
||||
switch($pname)
|
||||
{
|
||||
case 'value':
|
||||
break;
|
||||
case 'colspan':
|
||||
case 'rowspan':
|
||||
if ($pvalue != 1)
|
||||
{
|
||||
$html .= $comma . $pname . '="' . $pvalue . '"';
|
||||
$comma = ', ';
|
||||
};
|
||||
break;
|
||||
default:
|
||||
if (substr($pname,0,1) != '#')
|
||||
{
|
||||
$html .= $comma . $pname . '="' . $pvalue . '"';
|
||||
$comma = ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
// Table Excmple
|
||||
|
||||
// Build Header Row...
|
||||
$html .= "<h2>Table Size</h2>";
|
||||
// $html .= "<p>";
|
||||
$html .= "Rows: ";
|
||||
$html .= "<input type=\"input\" name=\"norows\" value=\"$norows\">";
|
||||
$html .= "Columns: ";
|
||||
$html .= "<input type=\"input\" name=\"nocols\" value=\"$nocols\">";
|
||||
$html .= "Fields: ";
|
||||
$html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">";
|
||||
// $html .= "\t<tr> ";
|
||||
|
||||
|
||||
|
||||
// Column Defintions...
|
||||
$html .= "<h2>Column Definition</h2>";
|
||||
$html .= "<table width=\"98%\", bgcolor=\"000000\">\n";
|
||||
$f = array();
|
||||
for ($fno=0;$fno<$noflds;$fno++)
|
||||
{
|
||||
$f[]=$fno;
|
||||
};
|
||||
// Column Headings
|
||||
$html .= "\t<tr bgcolor=\"D3DCFF\">\n";
|
||||
for ($cno=0;$cno<$nocols;$cno++)
|
||||
{
|
||||
$html .= "\t\t<td align=center>$cno</td>\n";
|
||||
}
|
||||
$html .= "\t</tr >\n";
|
||||
for ($rno=0;$rno<$norows;$rno++)
|
||||
function edit_table($rows,$head='',$obj, $frtn)
|
||||
{
|
||||
$nocols = $GLOBALS['HTTP_POST_VARS']['nocols'];
|
||||
$noflds = $GLOBALS['HTTP_POST_VARS']['noflds'];
|
||||
$norows = $GLOBALS['HTTP_POST_VARS']['norows'];
|
||||
$layout = $GLOBALS['HTTP_POST_VARS']['layout'];
|
||||
$_cols = $GLOBALS['HTTP_POST_VARS']['_cols'];
|
||||
|
||||
$html = '';
|
||||
$html .= '<form method="post" action="'
|
||||
. $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true')
|
||||
. '">' . "\n";
|
||||
|
||||
$params = $head['_table_parms'];
|
||||
$frow = $rows[0];
|
||||
$cnam = $this->arr_keys($frow);
|
||||
if ($head == '')
|
||||
{
|
||||
while(list(,$fn)=each($cnam))
|
||||
{
|
||||
$head[$fn] = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_cols))
|
||||
{
|
||||
$cols = $_cols;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( gettype($head['_cols'])=="NULL")
|
||||
{
|
||||
$cols = $this->arr_keys($rows[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cols = $head['_cols'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($noflds))
|
||||
{
|
||||
$noflds = count($cols);
|
||||
}
|
||||
if (!isset($layout))
|
||||
{
|
||||
$layout = $head['#layout'];
|
||||
}
|
||||
if (!isset($norows))
|
||||
{
|
||||
$norows = count($layout);
|
||||
}
|
||||
if (!isset($nocols))
|
||||
{
|
||||
$nocols = count($layout[0]);
|
||||
}
|
||||
// Table Excmple
|
||||
|
||||
// Build Header Row...
|
||||
$html .= "<h2>Table Size</h2>";
|
||||
// $html .= "<p>";
|
||||
$html .= "Rows: ";
|
||||
$html .= "<input type=\"input\" name=\"norows\" value=\"$norows\">";
|
||||
$html .= "Columns: ";
|
||||
$html .= "<input type=\"input\" name=\"nocols\" value=\"$nocols\">";
|
||||
$html .= "Fields: ";
|
||||
$html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">";
|
||||
// $html .= "\t<tr> ";
|
||||
|
||||
// Column Defintions...
|
||||
$html .= "<h2>Column Definition</h2>";
|
||||
$html .= "<table width=\"98%\", bgcolor=\"000000\">\n";
|
||||
$f = array();
|
||||
for ($fno=0;$fno<$noflds;$fno++)
|
||||
{
|
||||
$f[]=$fno;
|
||||
}
|
||||
// Column Headings
|
||||
$html .= "\t<tr bgcolor=\"D3DCFF\">\n";
|
||||
for ($cno=0;$cno<$nocols;$cno++)
|
||||
{
|
||||
$c = $layout[$rno][$cno];
|
||||
$tname = "layout[$rno][]";
|
||||
$t = $this->DropDown($f,$tname,$c);
|
||||
$html .= "\t\t<td align=center>$t</td>\n";
|
||||
$html .= "\t\t<td align=center>$cno</td>\n";
|
||||
}
|
||||
$html .= "\t</tr >\n";
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "<p>\n";
|
||||
|
||||
// Header of Table...
|
||||
$printlist = $this->make_printlist($layout,$cols);
|
||||
$table = $this->make_tblhead($printlist,$head);
|
||||
$html .= $this->html_head($head,$table,$printlist);
|
||||
$html .= "</table>\n";
|
||||
|
||||
$html .= "<input type=\"submit\" name=\"submit\" value=\"Update\">";
|
||||
//Field Definitions
|
||||
$html .= "<h2>Field Definitions</h2>";
|
||||
$html .= "<table width=\"98%\", bgcolor=\"D3DCFF\">\n";
|
||||
$html .= "\t\t<td width=\"2%\", align=\"center\">No</td>\n";
|
||||
$html .= "\t\t<td width=\"2%\", align=\"center\">Del</td>\n";
|
||||
$html .= "\t\t<td width=\"5%\">Field</td>\n";
|
||||
$html .= "\t\t<td>Value</td>\n";
|
||||
$html .= "\t</tr>\n";
|
||||
|
||||
|
||||
// Add Table Rows...
|
||||
reset($cols);
|
||||
// while (list($cno,$name) = each($cols))
|
||||
for ($fno=0;$fno<$noflds;$fno++)
|
||||
{
|
||||
$name = $cols[$fno];
|
||||
$values = $head[$name];
|
||||
$title = $values['title'];
|
||||
if ($title == '')
|
||||
for ($rno=0;$rno<$norows;$rno++)
|
||||
{
|
||||
$title = $name;
|
||||
}
|
||||
$html .= "\t</tr>\n";
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\">$fno</td>\n";
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\"><input type=\"checkbox\" name=\"_delcol[]\" value=\"$fno\"></td>\n";
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\">".$this->dropdown($cnam,'_cols[]',$name)."</td>\n";
|
||||
$value = $rows[0][$name]['value'];
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\">$value</td>\n";
|
||||
$html .= "\t</tr>\n";
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "<input type=\"submit\" name=\"modifytable\" value=\"Save Changes\">";
|
||||
$html .= "</form>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function dropdown($opts,$name='',$sel='')
|
||||
{
|
||||
$items = $opts;
|
||||
$html = '<select ';
|
||||
if ($name != '')
|
||||
{
|
||||
$html .= 'name="'.$name.'"';
|
||||
}
|
||||
$html .= ">\n";
|
||||
|
||||
while (list(,$itm)=each($opts))
|
||||
{
|
||||
$html .= '<option value="'.$itm.'" ';
|
||||
if ($itm == $sel)
|
||||
{
|
||||
$html .= 'selected ';
|
||||
}
|
||||
$html .= '>'.$itm."</option>\n";
|
||||
}
|
||||
$html .= "</select>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function make_printlist($layout,$cols)
|
||||
{
|
||||
// Build Printlist... (Col and Row Spans...)
|
||||
$tlayout = $layout;
|
||||
$printlist = array();
|
||||
$mrows = count($tlayout);
|
||||
$mcols = count($tlayout[0]);
|
||||
for($pr=0;$pr<$mrows;$pr++)
|
||||
{
|
||||
for($pc=0;$pc<$mcols;$pc++)
|
||||
{
|
||||
if (isset($tlayout[$pr][$pc]))
|
||||
$html .= "\t<tr bgcolor=\"D3DCFF\">\n";
|
||||
for ($cno=0;$cno<$nocols;$cno++)
|
||||
{
|
||||
$cno = $tlayout[$pr][$pc];
|
||||
$cname = $cols[$cno];
|
||||
$colspan=1;
|
||||
$rowspan=1;
|
||||
while(($pr + $rowspan < $mrows) && ($tlayout[$pr + $rowspan][$pc] == $cno))
|
||||
$c = $layout[$rno][$cno];
|
||||
$tname = "layout[$rno][]";
|
||||
$t = $this->DropDown($f,$tname,$c);
|
||||
$html .= "\t\t<td align=center>$t</td>\n";
|
||||
}
|
||||
$html .= "\t</tr >\n";
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "<p>\n";
|
||||
|
||||
// Header of Table...
|
||||
$printlist = $this->make_printlist($layout,$cols);
|
||||
$table = $this->make_tblhead($printlist,$head);
|
||||
$html .= $this->html_head($head,$table,$printlist);
|
||||
$html .= "</table>\n";
|
||||
|
||||
$html .= "<input type=\"submit\" name=\"submit\" value=\"Update\">";
|
||||
//Field Definitions
|
||||
$html .= "<h2>Field Definitions</h2>";
|
||||
$html .= "<table width=\"98%\", bgcolor=\"D3DCFF\">\n";
|
||||
$html .= "\t\t<td width=\"2%\", align=\"center\">No</td>\n";
|
||||
$html .= "\t\t<td width=\"2%\", align=\"center\">Del</td>\n";
|
||||
$html .= "\t\t<td width=\"5%\">Field</td>\n";
|
||||
$html .= "\t\t<td>Value</td>\n";
|
||||
$html .= "\t</tr>\n";
|
||||
|
||||
// Add Table Rows...
|
||||
reset($cols);
|
||||
// while (list($cno,$name) = each($cols))
|
||||
for ($fno=0;$fno<$noflds;$fno++)
|
||||
{
|
||||
$name = $cols[$fno];
|
||||
$values = $head[$name];
|
||||
$title = $values['title'];
|
||||
if ($title == '')
|
||||
{
|
||||
$title = $name;
|
||||
}
|
||||
$html .= "\t</tr>\n";
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\">$fno</td>\n";
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\"><input type=\"checkbox\" name=\"_delcol[]\" value=\"$fno\"></td>\n";
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\">".$this->dropdown($cnam,'_cols[]',$name)."</td>\n";
|
||||
$value = $rows[0][$name]['value'];
|
||||
$html .= "\t\t<td bgcolor=\"FFFFFF\">$value</td>\n";
|
||||
$html .= "\t</tr>\n";
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "<input type=\"submit\" name=\"modifytable\" value=\"Save Changes\">";
|
||||
$html .= "</form>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function dropdown($opts,$name='',$sel='')
|
||||
{
|
||||
$items = $opts;
|
||||
$html = '<select ';
|
||||
if ($name != '')
|
||||
{
|
||||
$html .= 'name="'.$name.'"';
|
||||
}
|
||||
$html .= ">\n";
|
||||
|
||||
while (list(,$itm)=each($opts))
|
||||
{
|
||||
$html .= '<option value="'.$itm.'" ';
|
||||
if ($itm == $sel)
|
||||
{
|
||||
$html .= 'selected ';
|
||||
}
|
||||
$html .= '>'.$itm."</option>\n";
|
||||
}
|
||||
$html .= "</select>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function make_printlist($layout,$cols)
|
||||
{
|
||||
// Build Printlist... (Col and Row Spans...)
|
||||
$tlayout = $layout;
|
||||
$printlist = array();
|
||||
$mrows = count($tlayout);
|
||||
$mcols = count($tlayout[0]);
|
||||
for($pr=0;$pr<$mrows;$pr++)
|
||||
{
|
||||
for($pc=0;$pc<$mcols;$pc++)
|
||||
{
|
||||
if (isset($tlayout[$pr][$pc]))
|
||||
{
|
||||
unset($tlayout[$pr + $rowspan][$pc]);
|
||||
$rowspan++;
|
||||
};
|
||||
while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno))
|
||||
{
|
||||
unset($tlayout[$pr][$pc+$colspan]);
|
||||
$colspan++;
|
||||
};
|
||||
if ($colspan > 1 && $rowspan > 1)
|
||||
{
|
||||
|
||||
for($r=$pr+1;$r<$pr+$rowspan;$r++)
|
||||
$cno = $tlayout[$pr][$pc];
|
||||
$cname = $cols[$cno];
|
||||
$colspan=1;
|
||||
$rowspan=1;
|
||||
while(($pr + $rowspan < $mrows) && ($tlayout[$pr + $rowspan][$pc] == $cno))
|
||||
{
|
||||
for($c=$pc+1;$c<$pc+$colspan;$c++)
|
||||
unset($tlayout[$pr + $rowspan][$pc]);
|
||||
$rowspan++;
|
||||
}
|
||||
while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno))
|
||||
{
|
||||
unset($tlayout[$pr][$pc+$colspan]);
|
||||
$colspan++;
|
||||
}
|
||||
if ($colspan > 1 && $rowspan > 1)
|
||||
{
|
||||
for($r=$pr+1;$r<$pr+$rowspan;$r++)
|
||||
{
|
||||
unset($tlayout[$r][$c]);
|
||||
for($c=$pc+1;$c<$pc+$colspan;$c++)
|
||||
{
|
||||
unset($tlayout[$r][$c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$printlist[] = array(
|
||||
'#name' =>$cname,
|
||||
'rowspan' =>$rowspan,
|
||||
'colspan' =>$colspan,
|
||||
'valign' =>'top',
|
||||
'#colno' =>$cno,
|
||||
'#eor' =>0
|
||||
);
|
||||
}
|
||||
$printlist[]=array('#name' =>$cname,
|
||||
'rowspan' =>$rowspan,
|
||||
'colspan' =>$colspan,
|
||||
'valign' =>'top',
|
||||
'#colno' =>$cno,
|
||||
'#eor' =>0
|
||||
);
|
||||
}
|
||||
$printlist[count($printlist)-1]['#eor'] = '1';
|
||||
}
|
||||
return $printlist;
|
||||
}
|
||||
|
||||
function make_tblhead($printlist,$head)
|
||||
{
|
||||
// Build Title Row
|
||||
$table = array();
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
$values = $head[$cname];
|
||||
$title = $values['#title'];
|
||||
if ($title == '')
|
||||
{
|
||||
$title = $cname;
|
||||
}
|
||||
$cparms = $this->arr_merge($values['#parms_hdr'],$pcol);
|
||||
$cparms['value']=$title;
|
||||
$table[0][$pc] = $cparms;
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
||||
function html_head($head,$table,$printlist)
|
||||
{
|
||||
$html = '';
|
||||
$tparams = $this->makeparms($head['#table_parms']);
|
||||
$html .= "<table $tparams>\n";
|
||||
$rp = $this->makeparms($head['#head_parms']);
|
||||
// $html .= "\t<tr $rp> <comment header>\n";
|
||||
$html .= "\t<tr $rp> \n";
|
||||
|
||||
$row = $table[0];
|
||||
reset($row);
|
||||
$intr = true;
|
||||
while(list(,$col)=each($row))
|
||||
{
|
||||
if (!$intr)
|
||||
{
|
||||
$html .= "\t<tr $rp>\n";
|
||||
$intr = true;
|
||||
}
|
||||
$cname = $col['#name'];
|
||||
$cp = $this->makeparms($col);
|
||||
$html .= "\t\t<td $cp>".$col['value']."</td>\n";
|
||||
if($col['#eor']=='1')
|
||||
{
|
||||
$html .= "\t</tr>\n";
|
||||
$intr = false;
|
||||
}
|
||||
}
|
||||
$printlist[count($printlist)-1]['#eor']='1';
|
||||
return $html;
|
||||
}
|
||||
return $printlist;
|
||||
}
|
||||
|
||||
function make_tblhead($printlist,$head)
|
||||
{
|
||||
// Build Title Row
|
||||
$table = array();
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
function arr_merge($a1='',$a2='',$a3='',$a4='',$a5='',$a6='',$a7='',$a8='')
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
$values = $head[$cname];
|
||||
$title = $values['#title'];
|
||||
if ($title == '')
|
||||
$out = array();
|
||||
$test = array($a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8);
|
||||
while(list(,$val) = each($test))
|
||||
{
|
||||
$title = $cname;
|
||||
if(is_array($val))
|
||||
{
|
||||
$out += $val;
|
||||
}
|
||||
}
|
||||
$cparms = array_merge($values['#parms_hdr'],$pcol);
|
||||
$cparms['value']=$title;
|
||||
$table[0][$pc] = $cparms;
|
||||
return $out;
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
||||
function html_head($head,$table,$printlist)
|
||||
{
|
||||
$html = '';
|
||||
$tparams = $this->makeparms($head['#table_parms']);
|
||||
$html .= "<table $tparams>\n";
|
||||
$rp = $this->makeparms($head['#head_parms']);
|
||||
// $html .= "\t<tr $rp> <comment header>\n";
|
||||
$html .= "\t<tr $rp> \n";
|
||||
|
||||
$row = $table[0];
|
||||
reset($row);
|
||||
$intr = true;
|
||||
while(list(,$col)=each($row))
|
||||
function arr_keys($fields,$array=True)
|
||||
{
|
||||
if (!$intr)
|
||||
@reset($fields);
|
||||
while(list($key,$val) = @each($fields))
|
||||
{
|
||||
$html .= "\t<tr $rp>\n";
|
||||
$intr = true;
|
||||
$fkeys .= $key . ',';
|
||||
}
|
||||
$cname = $col['#name'];
|
||||
$cp = $this->makeparms($col);
|
||||
$html .= "\t\t<td $cp>".$col['value']."</td>\n";
|
||||
if($col['#eor']=='1')
|
||||
$fkeys = substr($fkeys,0,-1);
|
||||
if($array)
|
||||
{
|
||||
$html .= "\t</tr>\n";
|
||||
$intr = false;
|
||||
|
||||
}
|
||||
$ex = explode(',',$fkeys);
|
||||
return $ex;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $fkeys;
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,12 +20,12 @@
|
||||
var $owner;
|
||||
var $error_cols = '';
|
||||
var $error_cols_e = '';
|
||||
var $public_functions = array
|
||||
('get_error_cols' => True
|
||||
,'get_error_cols_e'=> True
|
||||
,'get_error' => True
|
||||
,'get_error_e' => True
|
||||
);
|
||||
var $public_functions = array(
|
||||
'get_error_cols' => True,
|
||||
'get_error_cols_e' => True,
|
||||
'get_error' => True,
|
||||
'get_error_e' => True
|
||||
);
|
||||
|
||||
function solog()
|
||||
{
|
||||
@ -39,7 +39,7 @@
|
||||
{
|
||||
$this->error_cols = array();
|
||||
|
||||
// fields from phpgw_log table
|
||||
/* fields from phpgw_log table */
|
||||
$clist = $this->db->metadata('phpgw_log');
|
||||
for ($i=0; $i<count($clist); $i++)
|
||||
{
|
||||
@ -47,7 +47,7 @@
|
||||
$this->error_cols[$name] = array();
|
||||
}
|
||||
|
||||
// fields from phpgw_log_msg table
|
||||
/* fields from phpgw_log_msg table */
|
||||
$clist = $this->db->metadata('phpgw_log_msg');
|
||||
for ($i=0; $i<count($clist); $i++)
|
||||
{
|
||||
@ -62,10 +62,10 @@
|
||||
{
|
||||
if ($this->task_cols_e == '')
|
||||
{
|
||||
// Get Columns for Errors
|
||||
/* Get Columns for Errors */
|
||||
$this->error_cols_e = $this->get_error_cols();
|
||||
|
||||
// Enhance with Columns for phpgw_accounts
|
||||
/* Enhance with Columns for phpgw_accounts */
|
||||
$clist = $this->db->metadata('phpgw_accounts');
|
||||
for ($i=0; $i<count($clist); $i++)
|
||||
{
|
||||
@ -77,8 +77,8 @@
|
||||
}
|
||||
|
||||
function get_error_e($parms)
|
||||
{
|
||||
// Fixed From
|
||||
{
|
||||
/* Fixed From */
|
||||
if (!isset($parms['from']))
|
||||
{
|
||||
$parms['from'] = array('phpgw_accounts');
|
||||
@ -88,7 +88,7 @@
|
||||
$parms['from'][] = 'phpgw_accounts';
|
||||
}
|
||||
|
||||
// Fix Where
|
||||
/* Fix Where */
|
||||
if (!isset($parms['where']))
|
||||
{
|
||||
$parms['where'] = array('phpgw_log.log_user = phpgw_accounts.account_id');
|
||||
@ -98,7 +98,7 @@
|
||||
$parms['where'][] = 'phpgw_log.log_id = phpgw_accounts.account_id';
|
||||
}
|
||||
|
||||
// Fix Default Fields
|
||||
/* Fix Default Fields */
|
||||
if (!isset($parms['fields']))
|
||||
{
|
||||
$parms['fields'] = $this->get_error_cols_e();
|
||||
@ -108,20 +108,20 @@
|
||||
}
|
||||
|
||||
function get_no_errors()
|
||||
{ // Get max ErrorId
|
||||
{ /* Get max ErrorId */
|
||||
$this->db->query("select count(*) as max_id from phpgw_log, phpgw_log_msg WHERE phpgw_log.log_id = phpgw_log_msg.log_msg_log_id",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
return $this->db->f('max_id');
|
||||
}
|
||||
|
||||
function get_error($parms)
|
||||
{ // Get paramenter values
|
||||
{ /* Get parameter values */
|
||||
$from = $parms['from'];
|
||||
$where = $parms['where'];
|
||||
$orderby = $parms['orderby'];
|
||||
$fields = $parms['fields'];
|
||||
|
||||
// Build From_Clause
|
||||
/* Build From_Clause */
|
||||
$from_clause = 'FROM phpgw_log, phpgw_log_msg ';
|
||||
if (isset($from))
|
||||
{
|
||||
@ -129,32 +129,39 @@
|
||||
$from[] = 'phpgw_log_msg';
|
||||
$from_clause = 'FROM '.implode(', ' , $from).' ';
|
||||
}
|
||||
|
||||
// Build Where_Clause
|
||||
|
||||
/* Build Where_Clause */
|
||||
$where_clause = 'WHERE phpgw_log.log_id = phpgw_log_msg.log_msg_log_id ';
|
||||
if (isset($where))
|
||||
{
|
||||
$where[] = 'phpgw_log.log_id = phpgw_log_msg.log_msg_log_id';
|
||||
$where_clause = 'WHERE ' . implode(' AND ',$where) . ' ';
|
||||
}
|
||||
|
||||
// Build Order_By_Clause
|
||||
$orderby_clause = 'Order By phpgw_log.log_id, phpgw_log_msg.log_msg_seq_no ';
|
||||
|
||||
/* Build Order_By_Clause */
|
||||
$orderby_clause = 'ORDER BY phpgw_log.log_id, phpgw_log_msg.log_msg_seq_no ';
|
||||
if (isset($orderby))
|
||||
{
|
||||
$orderby_clause = 'Order By ' . implode(', ',$orderby);
|
||||
$orderby_clause = 'ORDER BY ' . implode(', ',$orderby);
|
||||
}
|
||||
|
||||
// If no Fields specified default to *
|
||||
|
||||
/* If no Fields specified default to * */
|
||||
if (!isset($fields))
|
||||
{
|
||||
$fields = $this->error_cols();
|
||||
}
|
||||
|
||||
|
||||
$rows = array();
|
||||
|
||||
// Do Select
|
||||
$select = "select ". implode(', ',array_keys($fields)).' '.$from_clause.$where_clause.$orderby_clause;
|
||||
|
||||
/* Do Select */
|
||||
@reset($fields);
|
||||
while(list($key,$val) = @each($fields))
|
||||
{
|
||||
$fkeys .= $key . ',';
|
||||
}
|
||||
$fkeys = substr($fkeys,0,-1);
|
||||
|
||||
$select = 'SELECT ' . $fkeys . ' ' . $from_clause . $where_clause . $orderby_clause;
|
||||
$this->db->query($select,__LINE__,__FILE__);
|
||||
while($this->db->next_record())
|
||||
{
|
||||
@ -162,9 +169,9 @@
|
||||
while(list($fname,$fopt) = each($fields))
|
||||
{
|
||||
$this_row[$fname]['value'] = $this->db->f($fname);
|
||||
};
|
||||
}
|
||||
$rows[] = $this_row;
|
||||
};
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
@ -19,41 +19,40 @@
|
||||
var $search;
|
||||
var $filter;
|
||||
|
||||
var $public_functions = array
|
||||
(
|
||||
'list_log' => True
|
||||
var $public_functions = array(
|
||||
'list_log' => True
|
||||
);
|
||||
|
||||
function uilog()
|
||||
{
|
||||
global $phpgw, $_cols, $editable, $modifytable, $nocols, $_delcol, $layout,
|
||||
$phpgw_info;
|
||||
$_cols = $GLOBALS['HTTP_POST_VARS']['_cols'];
|
||||
$nocols = $GLOBALS['HTTP_POST_VARS']['nocols'];
|
||||
$_delcol = $GLOBALS['HTTP_POST_VARS']['_delcol'];
|
||||
$layout = $GLOBALS['HTTP_POST_VARS']['layout'];
|
||||
$editable = $GLOBALS['HTTP_GET_VARS']['editable'];
|
||||
$modifytable = $GLOBALS['HTTP_GET_VARS']['modifytable'] ? $GLOBALS['HTTP_GET_VARS']['modifytable'] : $GLOBALS['HTTP_POST_VARS']['modifytable'];
|
||||
|
||||
$this->bolog = CreateObject('admin.bolog',True);
|
||||
$this->html = createobject('admin.html');
|
||||
$this->t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
||||
$this->lastid = "";
|
||||
$this->t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('admin'));
|
||||
$this->lastid = '';
|
||||
$this->editmode = false;
|
||||
|
||||
|
||||
|
||||
|
||||
// Handle the Edit Table Button
|
||||
if (isset($editable))
|
||||
if (isset($editable))
|
||||
{
|
||||
$this->editmode = $editable;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// Handle return from Modify Table form...
|
||||
if (isset($modifytable))
|
||||
{
|
||||
if ($modifytable)
|
||||
{
|
||||
// the delete column must not be empty
|
||||
if (!isset($_delcol))
|
||||
{
|
||||
$_delcol = array();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// Build New fields_inc array...
|
||||
if (isset($_cols))
|
||||
{
|
||||
@ -63,78 +62,77 @@
|
||||
if (!in_array($i, $_delcol))
|
||||
{
|
||||
$c[] = $_cols[$i];
|
||||
};
|
||||
}
|
||||
}
|
||||
$this->fields_inc = $c;
|
||||
};
|
||||
}
|
||||
|
||||
// Reset Mode to display...
|
||||
$this->editmode = false;
|
||||
$this->layout = $layout;
|
||||
|
||||
|
||||
// Save the fields_inc values in Session and User Preferences...
|
||||
$data = array('fields_inc'=>$this->fields_inc,'layout'=>$layout);
|
||||
$phpgw->session->appsession('session_data','log',$data);
|
||||
$phpgw->preferences->read_repository();
|
||||
$phpgw->preferences->delete('log','fields_inc');
|
||||
$phpgw->preferences->add('log','fields_inc',$this->fields_inc);
|
||||
$phpgw->preferences->delete('log','layout');
|
||||
$phpgw->preferences->add('log','layout',$this->layout);
|
||||
$phpgw->preferences->save_repository();
|
||||
|
||||
$GLOBALS['phpgw']->session->appsession('session_data','log',$data);
|
||||
$GLOBALS['phpgw']->preferences->read_repository();
|
||||
$GLOBALS['phpgw']->preferences->delete('log','fields_inc');
|
||||
$GLOBALS['phpgw']->preferences->add('log','fields_inc',$this->fields_inc);
|
||||
$GLOBALS['phpgw']->preferences->delete('log','layout');
|
||||
$GLOBALS['phpgw']->preferences->add('log','layout',$this->layout);
|
||||
$GLOBALS['phpgw']->preferences->save_repository();
|
||||
}
|
||||
|
||||
|
||||
// Make sure that $this->fields_inc is filled
|
||||
if ( !isset($this->field_inc))
|
||||
{
|
||||
{
|
||||
// Need to fill from Session Data...
|
||||
$data = $phpgw->session->appsession('session_data','log');
|
||||
$data = $GLOBALS['phpgw']->session->appsession('session_data','log');
|
||||
if (isset($data) && isset($data['fields_inc']))
|
||||
{
|
||||
|
||||
$this->fields_inc = $data['fields_inc'];
|
||||
$this->layout = $data['layout'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw->preferences->read_repository();
|
||||
$GLOBALS['phpgw']->preferences->read_repository();
|
||||
// Get From User Profile...
|
||||
if (@$phpgw_info['user']['preferences']['log']['fields_inc'])
|
||||
if (@$GLOBALS['phpgw_info']['user']['preferences']['log']['fields_inc'])
|
||||
{
|
||||
$fields_inc = $phpgw_info['user']['preferences']['log']['fields_inc'];
|
||||
$fields_inc = $GLOBALS['phpgw_info']['user']['preferences']['log']['fields_inc'];
|
||||
$this->fields_inc = $fields_inc;
|
||||
$layout = $phpgw_info['user']['preferences']['log']['layout'];
|
||||
$layout = $GLOBALS['phpgw_info']['user']['preferences']['log']['layout'];
|
||||
$this->layout = $layout;
|
||||
$phpgw->session->appsession('session_data','log',array('fields_inc'=>$fields_inc,'layout'=>$layout));
|
||||
$GLOBALS['phpgw']->session->appsession('session_data','log',array('fields_inc'=>$fields_inc,'layout'=>$layout));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use defaults...
|
||||
$this->fields_inc = array ('log_severity',
|
||||
'log_id',
|
||||
'log_date_e',
|
||||
'log_app',
|
||||
'log_full_name',
|
||||
'log_msg_seq_no',
|
||||
'log_msg_date_e',
|
||||
'log_msg_severity',
|
||||
'log_msg_code',
|
||||
'log_msg_text',
|
||||
'log_msg_file',
|
||||
'log_msg_line'
|
||||
);
|
||||
$this->layout[]= array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
$this->layout[]= array( 0, 1, 2, 3, 4, 5, 6, 7, 10, 11);
|
||||
|
||||
// Store defaults in session data...
|
||||
$phpgw->session->appsession ('session_data',
|
||||
'log',
|
||||
array ('fields_inc'=>$this->fields_inc,
|
||||
'layout'=>$this->layout
|
||||
)
|
||||
);
|
||||
$this->fields_inc = array(
|
||||
'log_severity',
|
||||
'log_id',
|
||||
'log_date_e',
|
||||
'log_app',
|
||||
'log_full_name',
|
||||
'log_msg_seq_no',
|
||||
'log_msg_date_e',
|
||||
'log_msg_severity',
|
||||
'log_msg_code',
|
||||
'log_msg_text',
|
||||
'log_msg_file',
|
||||
'log_msg_line'
|
||||
);
|
||||
$this->layout[]= array(0,1,2,3,4,5,6,7,8,9);
|
||||
$this->layout[]= array(0,1,2,3,4,5,6,7,10,11);
|
||||
|
||||
// Store defaults in session data...
|
||||
$GLOBALS['phpgw']->session->appsession(
|
||||
'session_data',
|
||||
'log',
|
||||
array(
|
||||
'fields_inc'=>$this->fields_inc,
|
||||
'layout'=>$this->layout
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,66 +141,57 @@
|
||||
while(list($cno,$cname)=each($this->fields_inc))
|
||||
{
|
||||
$this->column[$cname]=$cno;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function list_log()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
if (false) // add some errors to the log...
|
||||
{
|
||||
// Test 1: single Error line immedeately to errorlog
|
||||
// (could be type Debug, Info, Warning, or Error)
|
||||
$phpgw->log->write(array('text'=>'I-TestWrite, write: %1','p1'=>'This message should appear in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
|
||||
$GLOBALS['phpgw']->log->write(array('text'=>'I-TestWrite, write: %1','p1'=>'This message should appear in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
|
||||
// Test 2: A message should appear in log even if clearstack is called
|
||||
$phpgw->log->message(array('text'=>'I-TestMsg, msg: %1','p1'=>'This message should appear in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should not be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->clearstack();
|
||||
$phpgw->log->commit(); // commit error stack to log...
|
||||
$GLOBALS['phpgw']->log->message(array('text'=>'I-TestMsg, msg: %1','p1'=>'This message should appear in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should not be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->clearstack();
|
||||
$GLOBALS['phpgw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 3: one debug message
|
||||
$phpgw->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->commit(); // commit error stack to log...
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 3: debug and one informational
|
||||
$phpgw->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->commit(); // commit error stack to log...
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 4: an informational and a Warning
|
||||
$phpgw->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->commit(); // commit error stack to log...
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 5: and an error
|
||||
$phpgw->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'E-TestError, err: %1','p1'=>'This is a test Error','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->commit(); // commit error stack to log...
|
||||
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'E-TestError, err: %1','p1'=>'This is a test Error','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 6: and finally a fatal...
|
||||
$phpgw->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'E-TestError, err: %1','p1'=>'This is a test Error','file'=>__FILE__,'line'=>__LINE__));
|
||||
$phpgw->log->error(array('text'=>'F-Abend, abort: %1','p1'=>'Force abnormal termination','file'=>__FILE__,'line'=>__LINE__));
|
||||
|
||||
};
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'E-TestError, err: %1','p1'=>'This is a test Error','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['phpgw']->log->error(array('text'=>'F-Abend, abort: %1','p1'=>'Force abnormal termination','file'=>__FILE__,'line'=>__LINE__));
|
||||
}
|
||||
$this->t->set_file(array('log_list_t' => 'log.tpl'));
|
||||
|
||||
|
||||
|
||||
// -------------------------- Layout Description -------------------------------
|
||||
$phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%');
|
||||
|
||||
// -------------------------- end Layout Description ---------------------------
|
||||
|
||||
// -------------------------- Layout Description -------------------------------
|
||||
$phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%');
|
||||
// -------------------------- end Layout Description ---------------------------
|
||||
|
||||
// Get list of Possible Columns
|
||||
$header = $this->bolog->get_error_cols_e();
|
||||
@ -210,7 +199,7 @@ $phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%'
|
||||
// Describe table layout...
|
||||
$header['#phycols'] = $phycols;
|
||||
$header['#layout'] = $this->layout;
|
||||
|
||||
|
||||
// Set User Configured List of columns to show
|
||||
$header['_cols']= $this->fields_inc;
|
||||
|
||||
@ -224,12 +213,12 @@ $phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%'
|
||||
$header['log_id']['#parms_hdr'] = array('align'=>"center");
|
||||
$header['log_id']['#title'] = 'Id';
|
||||
$header['log_id']['align'] = 'center';
|
||||
|
||||
|
||||
// Column Log_Severity
|
||||
$header['log_severity']['#parms_hdr'] = array('align'=>"center");
|
||||
$header['log_severity']['#title'] = 'S';
|
||||
$header['log_severity']['align'] = 'center';
|
||||
|
||||
|
||||
// Column Trans Date
|
||||
$header['log_date_e']['#title'] = 'Tans. Date';
|
||||
|
||||
@ -244,39 +233,37 @@ $phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%'
|
||||
$header['log_msg_seq_no']['#parms_hdr'] = array('align'=>"center");
|
||||
$header['log_msg_seq_no']['#title'] = 'Sno';
|
||||
$header['log_msg_seq_no']['align'] = 'center';
|
||||
|
||||
|
||||
// Column log_msg_seq_no
|
||||
$header['log_msg_date_e']['#title'] = 'TimeStamp';
|
||||
$header['log_msg_severity']['#title'] = 'S';
|
||||
$header['log_msg_severity']['align'] = 'center';
|
||||
$header['log_msg_severity']['align'] = 'center';
|
||||
$header['log_msg_code']['#title'] = 'Code';
|
||||
$header['log_msg_text']['#title'] = 'Error Msg';
|
||||
$header['log_msg_file']['#title'] = 'File';
|
||||
$header['log_msg_line']['#title'] = 'Line';
|
||||
|
||||
|
||||
// Set up Grouping, Suppression...
|
||||
$header['_groupby']=array('log_id'=>1);
|
||||
$header['_supres']=array('log_id'=>1,'log_severity'=>1,'log_date_e'=>1,'log_app'=>1,'log_full_name'=>1);
|
||||
|
||||
|
||||
// Hack Get All Rows
|
||||
$rows = $this->bolog->get_error_e(array('orderby'=>array('log_id','log_msg_log_id')));
|
||||
$norows = count($rows);
|
||||
$header['_edittable']=$this->editmode;
|
||||
$table = $this->html->hash_table($rows,$header,$this, 'format_row');
|
||||
$this->t->set_var('event_list',$table);
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
$this->t->pfp('out','log_list_t');
|
||||
$phpgw->common->phpgw_footer();
|
||||
// $this->set_app_langs();
|
||||
}
|
||||
|
||||
function format_row($rno, $row)
|
||||
{
|
||||
|
||||
switch($row['log_severity']['value'])
|
||||
{
|
||||
|
||||
case 'D': $row['log_severity']['bgcolor'] = 'D3DCFF'; break;
|
||||
case 'I': $row['log_severity']['bgcolor'] = 'C0FFC0'; break;
|
||||
case 'W': $row['log_severity']['bgcolor'] = 'FFFFC0'; break;
|
||||
@ -303,7 +290,7 @@ $phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%'
|
||||
{
|
||||
// $row[$cno]['bgcolor'] = $lcolor;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
@ -51,11 +51,11 @@
|
||||
$file['View Sessions'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions');
|
||||
}
|
||||
|
||||
// These need to be added still
|
||||
$file['View Access Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccess_history.list_history');
|
||||
$file['View Error Log'] = $GLOBALS['phpgw']->link('/admin/log.php');
|
||||
$file['phpInfo'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/admin/phpinfo.php') . "')"; //$GLOBALS['phpgw']->link('/admin/phpinfo.php');
|
||||
/* These need to be added still */
|
||||
$file['View Access Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccess_history.list_history');
|
||||
$file['View Error Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log');
|
||||
$file['phpInfo'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/admin/phpinfo.php') . "')"; //$GLOBALS['phpgw']->link('/admin/phpinfo.php');
|
||||
|
||||
//Do not modify below this line
|
||||
/* Do not modify below this line */
|
||||
display_section('admin','admin',$file);
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user