php3 and formatting adjustments - needs tweaking to make sure it works as

desired.
This commit is contained in:
Miles Lott 2001-09-26 01:02:39 +00:00
parent e78caa8232
commit 4f9a3b4ef1
5 changed files with 618 additions and 604 deletions

View File

@ -16,7 +16,8 @@ class html
{ {
function hash_table($rows,$head='',$obj, $frtn) function hash_table($rows,$head='',$obj, $frtn)
{ {
global $phpgw, $start, $phpgw_info; $start = $GLOBALS['HTTP_POST_VARS']['start'] ? $GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start'];
$html = ''; $html = '';
$edittable =$head['_edittable']; $edittable =$head['_edittable'];
if (isset($edittable)) if (isset($edittable))
@ -28,17 +29,15 @@ class html
} }
else else
{ {
$html .= "<form method=\"post\" action=\"" $html .= '<form method="post" action="'
. $phpgw->link('/admin/log.php') ; . $GLOBALS['phpgw']->link('/index.php')
// . "&editable=true\">\n"; . '">' . "\n";
// --------------------------------- nextmatch ---------------------------
// nextmatchs
$bo = CreateObject('admin.bolog',True); $bo = CreateObject('admin.bolog',True);
if (!isset($start)) if (!isset($start))
{ {
$start = 0; $start = 0;
} }
$num_rows = $phpgw_info['user']['preferences']['common']['maxmatchs']; $num_rows = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$stop = $start + $num_rows; $stop = $start + $num_rows;
if ($stop > count($rows)) if ($stop > count($rows))
{ {
@ -46,51 +45,45 @@ class html
} }
$nextmatchs = CreateObject('phpgwapi.nextmatchs'); $nextmatchs = CreateObject('phpgwapi.nextmatchs');
$total_records = $bo->get_no_errors(); $total_records = $bo->get_no_errors();
$left = $nextmatchs->left('/admin/log.php',$start,$total_records,$extradata=''); $left = $nextmatchs->left('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
$right = $nextmatchs->right('/admin/log.php',$start,$total_records,$extradata=''); $right = $nextmatchs->right('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
$hits = $nextmatchs->show_hits($total_records,$start); $hits = $nextmatchs->show_hits($total_records,$start);
// -------------------------- end nextmatch ------------------------------------ $html .= '<table width="98%"><tr>';
$html .= "<table width=\"98%\"><tr>"; $html .= '<td align="left">' . $left . '</td>';
$html .= "<td align=left>$left</td>"; $html .= '<td align="right"> ' . $hits . ' </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=left> <A href=".$phpgw->link('/admin/log.php'). "&editable=true" ."> Edit Table format </A></td>"; $html .= '<td align="right">' . $right . '</td>';
$html .= "<td align=right>$right</td>"; $html .= '</tr></table>';
$html .= "</tr></table>";
} }
} }
if ($head == '') if ($head == '')
{ {
$frow = $rows[0]; $frow = $rows[0];
$cnam = array_keys($frow); $cnam = $this->arr_keys($frow);
while(list(,$fn)=each($cnam)) while(list(,$fn)=each($cnam))
{ {
$head[$fn] = array(); $head[$fn] = array();
} }
}; }
if ( gettype($head['_cols'])=="NULL") if ( gettype($head['_cols'])=="NULL")
{ {
$cols = array_keys($rows[0]); $cols = $this->arr_keys($rows[0]);
} }
else else
{ {
$cols = $head['_cols']; $cols = $head['_cols'];
} }
// Build Header Row... // Build Header Row...
// First Get the layout arrays... // First Get the layout arrays...
$layout = $head['#layout']; $layout = $head['#layout'];
if (gettype($layout) != 'array') if (gettype($layout) != 'array')
{ {
$layout = array_keys($cols); $layout = $this->arr_keys($cols);
} }
// printlist, a list of all columns in a logical row, // printlist, a list of all columns in a logical row,
@ -98,7 +91,6 @@ class html
$printlist = $this->make_printlist($layout,$cols); $printlist = $this->make_printlist($layout,$cols);
// $table contains data for header row.... // $table contains data for header row....
$table = $this->make_tblhead($printlist,$head); $table = $this->make_tblhead($printlist,$head);
@ -128,7 +120,7 @@ class html
while(list($pc,$pcol)=each($printlist)) while(list($pc,$pcol)=each($printlist))
{ {
$cname = $pcol['#name']; $cname = $pcol['#name'];
$cparms = array_merge($head[$cname],$pcol,array('bgcolor'=>'FFFFFF'),$rows[$rno][$cname]); $cparms = $this->arr_merge($head[$cname],$pcol,array('bgcolor'=>'FFFFFF'),$rows[$rno][$cname]);
$rows[$rno][$cname] = $cparms; $rows[$rno][$cname] = $cparms;
} }
} }
@ -213,8 +205,6 @@ class html
return $html; return $html;
} }
function makeparms($parmlist) function makeparms($parmlist)
{ {
$html = ''; $html = '';
@ -251,23 +241,27 @@ class html
function edit_table($rows,$head='',$obj, $frtn) function edit_table($rows,$head='',$obj, $frtn)
{ {
global $phpgw, $nocols, $noflds, $norows, $layout, $_cols; $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 = '';
$html .= "<form method=\"post\" action=\"" $html .= '<form method="post" action="'
. $phpgw->link('/admin/log.php') . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true')
. "&editable=true" . '">' . "\n";
. "\">\n";
$params = $head['_table_parms']; $params = $head['_table_parms'];
$frow = $rows[0]; $frow = $rows[0];
$cnam = array_keys($frow); $cnam = $this->arr_keys($frow);
if ($head == '') if ($head == '')
{ {
while(list(,$fn)=each($cnam)) while(list(,$fn)=each($cnam))
{ {
$head[$fn] = array(); $head[$fn] = array();
} }
}; }
if (isset($_cols)) if (isset($_cols))
{ {
@ -277,12 +271,12 @@ class html
{ {
if ( gettype($head['_cols'])=="NULL") if ( gettype($head['_cols'])=="NULL")
{ {
$cols = array_keys($rows[0]); $cols = $this->arr_keys($rows[0]);
} }
else else
{ {
$cols = $head['_cols']; $cols = $head['_cols'];
}; }
} }
if (!isset($noflds)) if (!isset($noflds))
@ -292,7 +286,7 @@ class html
if (!isset($layout)) if (!isset($layout))
{ {
$layout = $head['#layout']; $layout = $head['#layout'];
}; }
if (!isset($norows)) if (!isset($norows))
{ {
$norows = count($layout); $norows = count($layout);
@ -314,8 +308,6 @@ class html
$html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">"; $html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">";
// $html .= "\t<tr> "; // $html .= "\t<tr> ";
// Column Defintions... // Column Defintions...
$html .= "<h2>Column Definition</h2>"; $html .= "<h2>Column Definition</h2>";
$html .= "<table width=\"98%\", bgcolor=\"000000\">\n"; $html .= "<table width=\"98%\", bgcolor=\"000000\">\n";
@ -323,7 +315,7 @@ class html
for ($fno=0;$fno<$noflds;$fno++) for ($fno=0;$fno<$noflds;$fno++)
{ {
$f[]=$fno; $f[]=$fno;
}; }
// Column Headings // Column Headings
$html .= "\t<tr bgcolor=\"D3DCFF\">\n"; $html .= "\t<tr bgcolor=\"D3DCFF\">\n";
for ($cno=0;$cno<$nocols;$cno++) for ($cno=0;$cno<$nocols;$cno++)
@ -362,7 +354,6 @@ class html
$html .= "\t\t<td>Value</td>\n"; $html .= "\t\t<td>Value</td>\n";
$html .= "\t</tr>\n"; $html .= "\t</tr>\n";
// Add Table Rows... // Add Table Rows...
reset($cols); reset($cols);
// while (list($cno,$name) = each($cols)) // while (list($cno,$name) = each($cols))
@ -389,7 +380,6 @@ class html
return $html; return $html;
} }
function dropdown($opts,$name='',$sel='') function dropdown($opts,$name='',$sel='')
{ {
$items = $opts; $items = $opts;
@ -413,7 +403,6 @@ class html
return $html; return $html;
} }
function make_printlist($layout,$cols) function make_printlist($layout,$cols)
{ {
// Build Printlist... (Col and Row Spans...) // Build Printlist... (Col and Row Spans...)
@ -435,15 +424,14 @@ class html
{ {
unset($tlayout[$pr + $rowspan][$pc]); unset($tlayout[$pr + $rowspan][$pc]);
$rowspan++; $rowspan++;
}; }
while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno)) while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno))
{ {
unset($tlayout[$pr][$pc+$colspan]); unset($tlayout[$pr][$pc+$colspan]);
$colspan++; $colspan++;
}; }
if ($colspan > 1 && $rowspan > 1) if ($colspan > 1 && $rowspan > 1)
{ {
for($r=$pr+1;$r<$pr+$rowspan;$r++) for($r=$pr+1;$r<$pr+$rowspan;$r++)
{ {
for($c=$pc+1;$c<$pc+$colspan;$c++) for($c=$pc+1;$c<$pc+$colspan;$c++)
@ -452,7 +440,8 @@ class html
} }
} }
} }
$printlist[]=array('#name' =>$cname, $printlist[] = array(
'#name' =>$cname,
'rowspan' =>$rowspan, 'rowspan' =>$rowspan,
'colspan' =>$colspan, 'colspan' =>$colspan,
'valign' =>'top', 'valign' =>'top',
@ -480,7 +469,7 @@ class html
{ {
$title = $cname; $title = $cname;
} }
$cparms = array_merge($values['#parms_hdr'],$pcol); $cparms = $this->arr_merge($values['#parms_hdr'],$pcol);
$cparms['value']=$title; $cparms['value']=$title;
$table[0][$pc] = $cparms; $table[0][$pc] = $cparms;
} }
@ -513,10 +502,41 @@ class html
{ {
$html .= "\t</tr>\n"; $html .= "\t</tr>\n";
$intr = false; $intr = false;
} }
} }
return $html; return $html;
} }
function arr_merge($a1='',$a2='',$a3='',$a4='',$a5='',$a6='',$a7='',$a8='')
{
$out = array();
$test = array($a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8);
while(list(,$val) = each($test))
{
if(is_array($val))
{
$out += $val;
}
}
return $out;
}
function arr_keys($fields,$array=True)
{
@reset($fields);
while(list($key,$val) = @each($fields))
{
$fkeys .= $key . ',';
}
$fkeys = substr($fkeys,0,-1);
if($array)
{
$ex = explode(',',$fkeys);
return $ex;
}
else
{
return $fkeys;
}
}
} }

View File

@ -20,11 +20,11 @@
var $owner; var $owner;
var $error_cols = ''; var $error_cols = '';
var $error_cols_e = ''; var $error_cols_e = '';
var $public_functions = array var $public_functions = array(
('get_error_cols' => True 'get_error_cols' => True,
,'get_error_cols_e'=> True 'get_error_cols_e' => True,
,'get_error' => True 'get_error' => True,
,'get_error_e' => True 'get_error_e' => True
); );
function solog() function solog()
@ -39,7 +39,7 @@
{ {
$this->error_cols = array(); $this->error_cols = array();
// fields from phpgw_log table /* fields from phpgw_log table */
$clist = $this->db->metadata('phpgw_log'); $clist = $this->db->metadata('phpgw_log');
for ($i=0; $i<count($clist); $i++) for ($i=0; $i<count($clist); $i++)
{ {
@ -47,7 +47,7 @@
$this->error_cols[$name] = array(); $this->error_cols[$name] = array();
} }
// fields from phpgw_log_msg table /* fields from phpgw_log_msg table */
$clist = $this->db->metadata('phpgw_log_msg'); $clist = $this->db->metadata('phpgw_log_msg');
for ($i=0; $i<count($clist); $i++) for ($i=0; $i<count($clist); $i++)
{ {
@ -62,10 +62,10 @@
{ {
if ($this->task_cols_e == '') if ($this->task_cols_e == '')
{ {
// Get Columns for Errors /* Get Columns for Errors */
$this->error_cols_e = $this->get_error_cols(); $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'); $clist = $this->db->metadata('phpgw_accounts');
for ($i=0; $i<count($clist); $i++) for ($i=0; $i<count($clist); $i++)
{ {
@ -78,7 +78,7 @@
function get_error_e($parms) function get_error_e($parms)
{ {
// Fixed From /* Fixed From */
if (!isset($parms['from'])) if (!isset($parms['from']))
{ {
$parms['from'] = array('phpgw_accounts'); $parms['from'] = array('phpgw_accounts');
@ -88,7 +88,7 @@
$parms['from'][] = 'phpgw_accounts'; $parms['from'][] = 'phpgw_accounts';
} }
// Fix Where /* Fix Where */
if (!isset($parms['where'])) if (!isset($parms['where']))
{ {
$parms['where'] = array('phpgw_log.log_user = phpgw_accounts.account_id'); $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'; $parms['where'][] = 'phpgw_log.log_id = phpgw_accounts.account_id';
} }
// Fix Default Fields /* Fix Default Fields */
if (!isset($parms['fields'])) if (!isset($parms['fields']))
{ {
$parms['fields'] = $this->get_error_cols_e(); $parms['fields'] = $this->get_error_cols_e();
@ -108,20 +108,20 @@
} }
function get_no_errors() 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->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(); $this->db->next_record();
return $this->db->f('max_id'); return $this->db->f('max_id');
} }
function get_error($parms) function get_error($parms)
{ // Get paramenter values { /* Get parameter values */
$from = $parms['from']; $from = $parms['from'];
$where = $parms['where']; $where = $parms['where'];
$orderby = $parms['orderby']; $orderby = $parms['orderby'];
$fields = $parms['fields']; $fields = $parms['fields'];
// Build From_Clause /* Build From_Clause */
$from_clause = 'FROM phpgw_log, phpgw_log_msg '; $from_clause = 'FROM phpgw_log, phpgw_log_msg ';
if (isset($from)) if (isset($from))
{ {
@ -130,7 +130,7 @@
$from_clause = 'FROM '.implode(', ' , $from).' '; $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 '; $where_clause = 'WHERE phpgw_log.log_id = phpgw_log_msg.log_msg_log_id ';
if (isset($where)) if (isset($where))
{ {
@ -138,14 +138,14 @@
$where_clause = 'WHERE ' . implode(' AND ',$where) . ' '; $where_clause = 'WHERE ' . implode(' AND ',$where) . ' ';
} }
// Build Order_By_Clause /* Build Order_By_Clause */
$orderby_clause = 'Order By phpgw_log.log_id, phpgw_log_msg.log_msg_seq_no '; $orderby_clause = 'ORDER BY phpgw_log.log_id, phpgw_log_msg.log_msg_seq_no ';
if (isset($orderby)) 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)) if (!isset($fields))
{ {
$fields = $this->error_cols(); $fields = $this->error_cols();
@ -153,8 +153,15 @@
$rows = array(); $rows = array();
// Do Select /* Do Select */
$select = "select ". implode(', ',array_keys($fields)).' '.$from_clause.$where_clause.$orderby_clause; @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__); $this->db->query($select,__LINE__,__FILE__);
while($this->db->next_record()) while($this->db->next_record())
{ {
@ -162,9 +169,9 @@
while(list($fname,$fopt) = each($fields)) while(list($fname,$fopt) = each($fields))
{ {
$this_row[$fname]['value'] = $this->db->f($fname); $this_row[$fname]['value'] = $this->db->f($fname);
}; }
$rows[] = $this_row; $rows[] = $this_row;
}; }
return $rows; return $rows;
} }
} }

View File

@ -19,40 +19,39 @@
var $search; var $search;
var $filter; var $filter;
var $public_functions = array var $public_functions = array(
(
'list_log' => True 'list_log' => True
); );
function uilog() function uilog()
{ {
global $phpgw, $_cols, $editable, $modifytable, $nocols, $_delcol, $layout, $_cols = $GLOBALS['HTTP_POST_VARS']['_cols'];
$phpgw_info; $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->bolog = CreateObject('admin.bolog',True);
$this->html = createobject('admin.html'); $this->html = createobject('admin.html');
$this->t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $this->t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('admin'));
$this->lastid = ""; $this->lastid = '';
$this->editmode = false; $this->editmode = false;
// Handle the Edit Table Button // Handle the Edit Table Button
if (isset($editable)) if (isset($editable))
{ {
$this->editmode = $editable; $this->editmode = $editable;
}; }
// Handle return from Modify Table form... // Handle return from Modify Table form...
if (isset($modifytable)) if ($modifytable)
{ {
// the delete column must not be empty // the delete column must not be empty
if (!isset($_delcol)) if (!isset($_delcol))
{ {
$_delcol = array(); $_delcol = array();
}; }
// Build New fields_inc array... // Build New fields_inc array...
if (isset($_cols)) if (isset($_cols))
@ -63,10 +62,10 @@
if (!in_array($i, $_delcol)) if (!in_array($i, $_delcol))
{ {
$c[] = $_cols[$i]; $c[] = $_cols[$i];
}; }
} }
$this->fields_inc = $c; $this->fields_inc = $c;
}; }
// Reset Mode to display... // Reset Mode to display...
$this->editmode = false; $this->editmode = false;
@ -74,44 +73,42 @@
// Save the fields_inc values in Session and User Preferences... // Save the fields_inc values in Session and User Preferences...
$data = array('fields_inc'=>$this->fields_inc,'layout'=>$layout); $data = array('fields_inc'=>$this->fields_inc,'layout'=>$layout);
$phpgw->session->appsession('session_data','log',$data); $GLOBALS['phpgw']->session->appsession('session_data','log',$data);
$phpgw->preferences->read_repository(); $GLOBALS['phpgw']->preferences->read_repository();
$phpgw->preferences->delete('log','fields_inc'); $GLOBALS['phpgw']->preferences->delete('log','fields_inc');
$phpgw->preferences->add('log','fields_inc',$this->fields_inc); $GLOBALS['phpgw']->preferences->add('log','fields_inc',$this->fields_inc);
$phpgw->preferences->delete('log','layout'); $GLOBALS['phpgw']->preferences->delete('log','layout');
$phpgw->preferences->add('log','layout',$this->layout); $GLOBALS['phpgw']->preferences->add('log','layout',$this->layout);
$phpgw->preferences->save_repository(); $GLOBALS['phpgw']->preferences->save_repository();
} }
// Make sure that $this->fields_inc is filled // Make sure that $this->fields_inc is filled
if ( !isset($this->field_inc)) if ( !isset($this->field_inc))
{ {
// Need to fill from Session Data... // 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'])) if (isset($data) && isset($data['fields_inc']))
{ {
$this->fields_inc = $data['fields_inc']; $this->fields_inc = $data['fields_inc'];
$this->layout = $data['layout']; $this->layout = $data['layout'];
} }
else else
{ {
$phpgw->preferences->read_repository(); $GLOBALS['phpgw']->preferences->read_repository();
// Get From User Profile... // 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; $this->fields_inc = $fields_inc;
$layout = $phpgw_info['user']['preferences']['log']['layout']; $layout = $GLOBALS['phpgw_info']['user']['preferences']['log']['layout'];
$this->layout = $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 else
{ {
// Use defaults... // Use defaults...
$this->fields_inc = array ('log_severity', $this->fields_inc = array(
'log_severity',
'log_id', 'log_id',
'log_date_e', 'log_date_e',
'log_app', 'log_app',
@ -128,13 +125,14 @@
$this->layout[]= array(0,1,2,3,4,5,6,7,10,11); $this->layout[]= array(0,1,2,3,4,5,6,7,10,11);
// Store defaults in session data... // Store defaults in session data...
$phpgw->session->appsession ('session_data', $GLOBALS['phpgw']->session->appsession(
'session_data',
'log', 'log',
array ('fields_inc'=>$this->fields_inc, array(
'fields_inc'=>$this->fields_inc,
'layout'=>$this->layout 'layout'=>$this->layout
) )
); );
} }
} }
@ -143,67 +141,58 @@
while(list($cno,$cname)=each($this->fields_inc)) while(list($cno,$cname)=each($this->fields_inc))
{ {
$this->column[$cname]=$cno; $this->column[$cname]=$cno;
}; }
} }
function list_log() function list_log()
{ {
global $phpgw, $phpgw_info;
if (false) // add some errors to the log... if (false) // add some errors to the log...
{ {
// Test 1: single Error line immedeately to errorlog // Test 1: single Error line immedeately to errorlog
// (could be type Debug, Info, Warning, or Error) // (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 // 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__)); $GLOBALS['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__)); $GLOBALS['phpgw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should not be in log','file'=>__FILE__,'line'=>__LINE__));
$phpgw->log->clearstack(); $GLOBALS['phpgw']->log->clearstack();
$phpgw->log->commit(); // commit error stack to log... $GLOBALS['phpgw']->log->commit(); // commit error stack to log...
// Test 3: one debug message // 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__)); $GLOBALS['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->commit(); // commit error stack to log...
// Test 3: debug and one informational // 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__)); $GLOBALS['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__)); $GLOBALS['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->commit(); // commit error stack to log...
// Test 4: an informational and a Warning // 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__)); $GLOBALS['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__)); $GLOBALS['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__)); $GLOBALS['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->commit(); // commit error stack to log...
// Test 5: and an error // 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__)); $GLOBALS['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__)); $GLOBALS['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__)); $GLOBALS['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__)); $GLOBALS['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->commit(); // commit error stack to log...
// Test 6: and finally a fatal... // 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__)); $GLOBALS['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__)); $GLOBALS['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__)); $GLOBALS['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__)); $GLOBALS['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'=>'F-Abend, abort: %1','p1'=>'Force abnormal termination','file'=>__FILE__,'line'=>__LINE__));
}
};
$this->t->set_file(array('log_list_t' => 'log.tpl')); $this->t->set_file(array('log_list_t' => 'log.tpl'));
// -------------------------- Layout Description ------------------------------- // -------------------------- Layout Description -------------------------------
$phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%'); $phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%');
// -------------------------- end Layout Description --------------------------- // -------------------------- end Layout Description ---------------------------
// Get list of Possible Columns // Get list of Possible Columns
$header = $this->bolog->get_error_cols_e(); $header = $this->bolog->get_error_cols_e();
@ -254,29 +243,27 @@ $phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%'
$header['log_msg_file']['#title'] = 'File'; $header['log_msg_file']['#title'] = 'File';
$header['log_msg_line']['#title'] = 'Line'; $header['log_msg_line']['#title'] = 'Line';
// Set up Grouping, Suppression... // Set up Grouping, Suppression...
$header['_groupby']=array('log_id'=>1); $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); $header['_supres']=array('log_id'=>1,'log_severity'=>1,'log_date_e'=>1,'log_app'=>1,'log_full_name'=>1);
// Hack Get All Rows // Hack Get All Rows
$rows = $this->bolog->get_error_e(array('orderby'=>array('log_id','log_msg_log_id'))); $rows = $this->bolog->get_error_e(array('orderby'=>array('log_id','log_msg_log_id')));
$norows = count($rows); $norows = count($rows);
$header['_edittable']=$this->editmode; $header['_edittable']=$this->editmode;
$table = $this->html->hash_table($rows,$header,$this, 'format_row'); $table = $this->html->hash_table($rows,$header,$this, 'format_row');
$this->t->set_var('event_list',$table); $this->t->set_var('event_list',$table);
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$this->t->pfp('out','log_list_t'); $this->t->pfp('out','log_list_t');
$phpgw->common->phpgw_footer();
// $this->set_app_langs(); // $this->set_app_langs();
} }
function format_row($rno, $row) function format_row($rno, $row)
{ {
switch($row['log_severity']['value']) switch($row['log_severity']['value'])
{ {
case 'D': $row['log_severity']['bgcolor'] = 'D3DCFF'; break; case 'D': $row['log_severity']['bgcolor'] = 'D3DCFF'; break;
case 'I': $row['log_severity']['bgcolor'] = 'C0FFC0'; break; case 'I': $row['log_severity']['bgcolor'] = 'C0FFC0'; break;
case 'W': $row['log_severity']['bgcolor'] = 'FFFFC0'; break; case 'W': $row['log_severity']['bgcolor'] = 'FFFFC0'; break;

View File

@ -51,11 +51,11 @@
$file['View Sessions'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions'); $file['View Sessions'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions');
} }
// These need to be added still /* These need to be added still */
$file['View Access Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccess_history.list_history'); $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['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'); $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); display_section('admin','admin',$file);
?> ?>