[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin inc/class.bolog.inc.php inc/class.solog.i...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] admin inc/class.bolog.inc.php inc/class.solog.i... |
Date: |
Tue, 19 Sep 2006 15:16:32 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: admin
Changes by: Dave Hall <skwashd> 06/09/19 15:16:32
Modified files:
inc : class.bolog.inc.php class.solog.inc.php
class.uilog.inc.php class.uiloglevels.inc.php
templates/base : log_level_select.tpl loglevels.tpl log.tpl
Log message:
most of the new error hander code
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.bolog.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.solog.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.uilog.inc.php?cvsroot=phpgroupware&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.uiloglevels.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/admin/templates/base/log_level_select.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/admin/templates/base/loglevels.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/admin/templates/base/log.tpl?cvsroot=phpgroupware&r1=1.3&r2=1.4
Patches:
Index: inc/class.bolog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.bolog.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- inc/class.bolog.inc.php 14 Feb 2006 08:48:21 -0000 1.10
+++ inc/class.bolog.inc.php 19 Sep 2006 15:16:32 -0000 1.11
@@ -1,85 +1,74 @@
<?php
-
/***************************************************************************\
- * phpGroupWare - log
*
+
/**************************************************************************\
+ * phpGroupWare - Administration
*
* http://www.phpgroupware.org
*
- * Written by : Jerry Westrick address@hidden *
- * -------------------------------------------------
*
+ * --------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by the
*
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
-
\***************************************************************************/
+
\**************************************************************************/
- /* $Id: class.bolog.inc.php,v 1.10 2006/02/14 08:48:21 skwashd Exp $ */
+ /* $Id: class.bolog.inc.php,v 1.11 2006/09/19 15:16:32 skwashd Exp $ */
class bolog
{
var $public_functions = array
(
- 'read_log' => True
+ 'list_log' => True,
+ 'purge_log' => True
);
- function bolog($session=False)
+ function bolog()
{
- $this->so = CreateObject('admin.solog');
+ $this->so = createobject('admin.solog');
}
- function get_error_cols()
+ function list_log($account_id,$start,$order,$sort)
{
- $fields = $this->so->get_error_cols();
- // boAccounts
- $fields['account_pwd']['include'] = false;
- return $fields;
+ if
($GLOBALS['phpgw']->acl->check('error_log_access',1,'admin'))
+ {
+ return array();
}
- function get_error_cols_e()
+ $_records = array();
+ $records = $this->so->list_log($account_id, $start,
$order, $sort);
+ foreach ( $records as $record )
{
- $fields = $this->so->get_error_cols_e();
- $fields['log_date_e'] = array();
- $fields['log_msg_date_e'] = array();
- $fields['log_full_name'] = array();
- // boAccounts
- $fields['account_pwd']['include'] = false;
- $fields['account_lastlogin_e'] = array();
- $fields['account_lastloginfrom_e'] = array();
- $fields['account_lastpwd_change_e'] = array();
- return $fields;
- }
+ // build and pass the format by hand as we want
to show the seconds
+ $record['log_date'] =
$GLOBALS['phpgw']->common->show_date(
+
$GLOBALS['phpgw']->db->from_timestamp($record['log_date']),
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] . ' -
H:i:s');
- function get_error($values='')
+ if (ereg('@',$record['log_account_lid']))
{
- $rows = $this->so->get_error($values);
- // should remove the accounts_pwd
- return $rows;
+ $t =
split('@',$record['log_account_lid']);
+ $record['log_account_lid'] = $t[0];
}
- function get_no_errors()
- {
- $rows = $this->so->get_no_errors();
- return $rows;
+ $record['log_severity'] =
lang($GLOBALS['phpgw']->log->get_level_name($record['log_severity']));
+
+ $_records[] = array(
+ 'log_date' =>
$record['log_date'],
+ 'log_account_lid' =>
$record['log_account_lid'],
+ 'log_app' =>
$record['log_app'],
+ 'log_severity' =>
$record['log_severity'],
+ 'log_file' =>
$record['log_file'],
+ 'log_line' =>
$record['log_line'],
+ 'log_msg' =>
$record['log_msg']
+ );
+ }
+ return $_records;
}
- function get_error_e($values='')
+ function purge_log($account_id)
{
- $rows = $this->so->get_error_e($values);
+ return $this->so->purge_log($account_id);
+ }
- // Enhance the fields
- reset($rows);
- while(list($rno,$r)=each($rows))
+ function total($account_id)
{
- unset($r['acount_pwd']); // remove the
accounts_pwd
- $r['log_date_e']['value'] =
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->from_timestamp($r['log_date']['value']));
- $r['log_msg_date_e']['value'] =
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->from_timestamp($r['log_msg_date']['value']));
- $r['log_full_name']['value'] =
$r['account_lastname']['value'] . ', ' .$r['account_firstname']['value'];
- $r['account_lastlogin_e']['value'] =
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->from_timestamp($r['account_lastlogin']['value']));
- $r['account_lastpwd_change_e']['value'] =
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->from_timestamp($r['account_lastpwd_change']['value']));
- $r['account_lastloginfrom_e']['value'] =
'www.nowhere.com';
-
- $r['log_msg_text']['value'] =
lang($r['log_msg_msg']['value'],explode('|',$r['log_msg_parms']['value']));
-
- $rows[$rno]=$r;
- }
- return $rows;
+ return $this->so->total($account_id);
}
+
}
-?>
Index: inc/class.solog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.solog.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- inc/class.solog.inc.php 18 Sep 2006 08:23:39 -0000 1.10
+++ inc/class.solog.inc.php 19 Sep 2006 15:16:32 -0000 1.11
@@ -1,10 +1,7 @@
<?php
/**************************************************************************\
- * phpGroupWare - solog
*
+ * phpGroupWare - Administration
*
* http://www.phpgroupware.org
*
- * This application written by Jerry Westrick <address@hidden> *
- * --------------------------------------------
*
- * Funding for this program was provided by http://www.checkwithmom.com
*
* --------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by
the *
@@ -12,167 +9,72 @@
* option) any later version.
*
\**************************************************************************/
- /* $Id: class.solog.inc.php,v 1.10 2006/09/18 08:23:39 sigurdne Exp $ */
+ /* $Id: class.solog.inc.php,v 1.11 2006/09/19 15:16:32 skwashd Exp $ */
class solog
{
var $db;
- 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
- );
function solog()
{
- $this->db = $GLOBALS['phpgw']->db;
- }
-
- function get_error_cols()
- {
- if ($this->error_cols == '')
- {
- $this->error_cols = array();
-
- /* fields from phpgw_log table */
- $clist =
array_keys($this->db->metadata('phpgw_log'));
- for ($i=0; $i<count($clist); $i++)
- {
- $name = $clist[$i];
- $this->error_cols[$name] = array();
- }
-
- /* fields from phpgw_log_msg table */
- $clist =
array_keys($this->db->metadata('phpgw_log_msg'));
- for ($i=0; $i<count($clist); $i++)
- {
- $name = $clist[$i];
- $this->error_cols[$name] = array();
- }
- }
- return $this->error_cols;
+ $this->db =& $GLOBALS['phpgw']->db;
}
- function get_error_cols_e()
- {
- if ($this->task_cols_e == '')
+ function test_account_id($account_id)
{
- /* Get Columns for Errors */
- $this->error_cols_e = $this->get_error_cols();
-
- /* Enhance with Columns for phpgw_accounts */
- $clist =
array_keys(($this->db->metadata('phpgw_accounts'));
- for ($i=0; $i<count($clist); $i++)
+ $account_id = (int) $account_id;
+ if ($account_id > 0)
{
- $name = $clist[$i];
- $this->error_cols_e[$name] = array();
- }
+ return " WHEEE log_account_id = $account_id";
}
- return $this->error_cols_e;
}
- function get_error_e($parms)
+ function list_log($account_id,$start,$order,$sort)
{
- /* Fixed From */
- if (!isset($parms['from']))
+ $where = $this->test_account_id($account_id);
+ $this->db->limit_query("SELECT
log_date,log_account_lid,log_app,log_severity,log_file,log_line,log_msg FROM
phpgw_log $where ORDER BY log_id desc",$start, __LINE__, __FILE__);
+ $records = array();
+ while ($this->db->next_record())
{
- $parms['from'] = array('phpgw_accounts');
+ $records[] = array(
+ 'log_date' =>
$this->db->f('log_date'),
+ 'log_account_lid' =>
$this->db->f('log_account_lid'),
+ 'log_app' =>
$this->db->f('log_app'),
+ 'log_severity' =>
$this->db->f('log_severity'),
+ 'log_file' =>
$this->db->f('log_file'),
+ 'log_line' =>
$this->db->f('log_line'),
+ 'log_msg' =>
$this->db->f('log_msg')
+ );
}
- else
- {
- $parms['from'][] = 'phpgw_accounts';
+ return $records;
}
- /* Fix Where */
- if (!isset($parms['where']))
- {
- $parms['where'] = array('phpgw_log.log_user =
phpgw_accounts.account_id');
- }
- else
+ function total($account_id)
{
- $parms['where'][] = 'phpgw_log.log_id =
phpgw_accounts.account_id';
- }
+ $where = $this->test_account_id($account_id);
- /* Fix Default Fields */
- if (!isset($parms['fields']))
- {
- $parms['fields'] = $this->get_error_cols_e();
- }
-
- return $this->get_error($parms);
- }
-
- function get_no_errors()
- {
- /* 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(*) FROM phpgw_log
$where", __LINE__, __FILE__);
$this->db->next_record();
- return $this->db->f('max_id');
- }
- function get_error($parms)
- {
- /* Get parameter values */
- $from = $parms['from'];
- $where = $parms['where'];
- $orderby = $parms['orderby'];
- $fields = $parms['fields'];
-
- /* Build From_Clause */
- $from_clause = 'FROM phpgw_log, phpgw_log_msg ';
- if (isset($from))
- {
- $from[] = 'phpgw_log';
- $from[] = 'phpgw_log_msg';
- $from_clause = 'FROM '.implode(', ' , $from).'
';
+ return $this->db->f(0);
}
- /* Build Where_Clause */
- $where_clause = 'WHERE phpgw_log.log_id =
phpgw_log_msg.log_msg_log_id ';
- if (isset($where))
+ function purge_log($account_id)
{
- $where[] = 'phpgw_log.log_id =
phpgw_log_msg.log_msg_log_id';
- $where_clause = 'WHERE ' . implode(' AND
',$where) . ' ';
- }
+ $where = $this->test_account_id($account_id);
- /* Build Order_By_Clause */
- $orderby_clause = 'ORDER BY phpgw_log.log_id,
phpgw_log_msg.log_msg_seq_no ';
- if (isset($orderby))
+ $this->db->query("delete from phpgw_log $where",
__LINE__, __FILE__);
+ if ( isset($this->db->Errno) && $this->db->Errno )
{
- $orderby_clause = 'ORDER BY ' . implode(',
',$orderby);
+ log_error(array('text' => 'Failed to delete log
records from database using where clause of %1. DB errno %2: message %3',
+ 'p1' => $where,
+ 'p2' =>
$this->db->Errno,
+ 'p3' =>
$this->db->Error,
+ 'file' =>
__FILE__,
+ 'line' =>
__LINE__));
+ return false;
}
-
- /* If no Fields specified default to * */
- if (!isset($fields))
- {
- $fields = $this->get_error_cols();
- }
-
- $rows = array();
-
- /* Do Select */
- @reset($fields);
- while(list($key,$val) = @each($fields))
- {
- $fkeys .= $key . ',';
+ return true;
}
- $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())
- {
- reset($fields);
- while(list($fname,$fopt) = each($fields))
- {
- $this_row[$fname]['value'] =
$this->db->f($fname);
- }
- $rows[] = $this_row;
- }
- return $rows;
- }
}
Index: inc/class.uilog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uilog.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- inc/class.uilog.inc.php 14 Feb 2006 08:48:21 -0000 1.13
+++ inc/class.uilog.inc.php 19 Sep 2006 15:16:32 -0000 1.14
@@ -1,298 +1,172 @@
<?php
-
/***************************************************************************\
- * phpGroupWare - uilog
*
+
/**************************************************************************\
+ * phpGroupWare - Administration
*
* http://www.phpgroupware.org
*
- * Written by : jerry westrick address@hidden *
- * -------------------------------------------------
*
+ * --------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by the
*
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
-
\***************************************************************************/
+
\**************************************************************************/
- /* $Id: class.uilog.inc.php,v 1.13 2006/02/14 08:48:21 skwashd Exp $ */
+ /* $Id: class.uilog.inc.php,v 1.14 2006/09/19 15:16:32 skwashd Exp $ */
class uilog
{
- var $grants;
- var $cat_id;
- var $start;
- var $search;
- var $filter;
-
- var $public_functions = array(
- 'list_log' => True
+ var $template;
+ var $public_functions = array
+ (
+ 'list_log' => true,
+ 'purge_log' => true
);
function uilog()
{
- $_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'];
+ if
($GLOBALS['phpgw']->acl->check('error_log_access',1,'admin'))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php');
+ }
- $this->bolog = CreateObject('admin.bolog',True);
- $this->html = createobject('admin.html');
- $this->t =
CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('admin'));
- $this->lastid = '';
- $this->editmode = False;
+ $this->bo = createobject('admin.bolog');
+ $this->nextmatchs = createobject('phpgwapi.nextmatchs');
+ $this->template =& $GLOBALS['phpgw']->template;
- // Handle the Edit Table Button
- if (isset($editable))
- {
- $this->editmode = $editable;
}
- // Handle return from Modify Table form...
- if ($modifytable)
+ function list_log()
{
- // the delete column must not be empty
- if (!isset($_delcol))
+ if
($GLOBALS['phpgw']->acl->check('error_log_access',1,'admin'))
{
- $_delcol = array();
+ $GLOBALS['phpgw']->redirect_link('/index.php');
}
- // Build New fields_inc array...
- if (isset($_cols))
- {
- $c = array();
- for ($i=0;$i<count($_cols);$i++)
- {
- if (!in_array($i, $_delcol))
+ $account_id = get_var('account_id',array('GET','POST'));
+ $start = get_var('start',array('POST'),0);
+ $sort = get_var('sort',array('POST'),0);
+ $order = get_var('order',array('POST'),0);
+
+ $this->template->set_file(array
+ (
+ 'errorlog' => 'errorlog_view.tpl',
+ 'form_button' => 'form_button_script.tpl'
+ ));
+
+ $this->template->set_block('errorlog','list');
+ $this->template->set_block('errorlog','row');
+ $this->template->set_block('errorlog','row_empty');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Admin').' - '.lang('View error log');
+ if ( $account_id )
{
- $c[] = $_cols[$i];
- }
- }
- $this->fields_inc = $c;
+ $GLOBALS['phpgw_info']['flags']['app_header']
.= ' ' . lang('for') . ' ' .
$GLOBALS['phpgw']->common->grab_owner_name($account_id);
}
- // Reset Mode to display...
- $this->editmode = False;
- $this->layout = $layout;
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
- // Save the fields_inc values in Session and
User Preferences...
- $data =
array('fields_inc'=>$this->fields_inc,'layout'=>$layout);
-
$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();
- }
+ $total_records = $this->bo->total($account_id);
- // Make sure that $this->fields_inc is filled
- if ( !isset($this->field_inc))
- {
- // Need to fill from Session Data...
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','log');
- if (isset($data) && isset($data['fields_inc']))
+ $var = array
+ (
+ 'nextmatchs_left' =>
$this->nextmatchs->left('/index.php',$start,$total_records,'&menuaction=admin.uilog.list_log&account_id='
. $account_id),
+ 'nextmatchs_right' =>
$this->nextmatchs->right('/index.php',$start,$total_records,'&menuaction=admin.uilog.list_log&account_id='
. $account_id),
+ 'showing' =>
$this->nextmatchs->show_hits($total_records,$start),
+ 'lang_loginid' => lang('LoginID'),
+ 'lang_date' => lang('time'),
+ 'lang_app' => lang('module'),
+ 'lang_severity' => lang('severity'),
+ 'lang_line' => lang('line'),
+ 'lang_file' => lang('file'),
+ 'lang_message' => lang('log message'),
+ 'lang_total' => lang('Total')
+ );
+
+ $this->template->set_var($var);
+
+ $records =
$this->bo->list_log($account_id,$start,$order,$sort);
+ if ( !is_array($records) || !count($records) )
{
- $this->fields_inc = $data['fields_inc'];
- $this->layout = $data['layout'];
+ $this->template->set_var(array
+ (
+ 'row_message' => lang('No error log
records exist for this user'),
+ 'tr_class' => 'row_on'
+ ));
+
$this->template->fp('rows_access','row_empty',True);
}
else
{
-
$GLOBALS['phpgw']->preferences->read_repository();
- // Get From User Profile...
- if
(@$GLOBALS['phpgw_info']['user']['preferences']['log']['fields_inc'])
- {
- $fields_inc =
$GLOBALS['phpgw_info']['user']['preferences']['log']['fields_inc'];
- $this->fields_inc = $fields_inc;
- $layout =
$GLOBALS['phpgw_info']['user']['preferences']['log']['layout'];
- $this->layout = $layout;
-
$GLOBALS['phpgw']->session->appsession('session_data','log',array('fields_inc'=>$fields_inc,'layout'=>$layout));
- }
- else
+ $tr_class = '';
+ foreach ( $records as $record )
{
- // 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...
-
$GLOBALS['phpgw']->session->appsession(
- 'session_data',
- 'log',
- array(
-
'fields_inc'=>$this->fields_inc,
-
'layout'=>$this->layout
- )
- );
+ $tr_class =
$this->nextmatchs->alternate_row_class($tr_class);
+ $this->template->set_var(array
+ (
+ 'row_date' =>
$record['log_date'],
+ 'row_loginid' =>
$record['log_account_lid'],
+ 'row_app' =>
$record['log_app'],
+ 'row_severity' =>
$record['log_severity'],
+ 'row_file' =>
$record['log_file'],
+ 'row_line' =>
$record['log_line'],
+ 'row_message' =>
$record['log_msg'],
+ 'tr_class' =>
$tr_class
+ ));
+
$this->template->fp('rows_access','row',True);
}
}
- } // Values already filled...
- reset($this->fields_inc);
- while(list($cno,$cname)=each($this->fields_inc))
+ if ( $total_records )
+ {
+ if ( $account_id )
+ {
+ $var = Array(
+ 'submit_button' =>
lang('Submit'),
+ 'action_url_button' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uilog.purge_log', 'account_id' => $account_id)),
+ 'action_text_button' => '
'.lang('Delete all log records for
').$GLOBALS['phpgw']->common->grab_owner_name($account_id),
+ 'action_confirm_button' => '',
+ 'action_extra_field' => ''
+ );
+ }
+ else
{
- $this->column[$cname]=$cno;
+ $var = Array(
+ 'submit_button' =>
lang('Submit'),
+ 'action_url_button' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uilog.purge_log') ),
+ 'action_text_button' => '
'.lang('Delete all log records'),
+ 'action_confirm_button' => '',
+ 'action_extra_field' => ''
+ );
}
+ $this->template->set_var($var);
+ $var['purge_log_button'] =
$this->template->fp('button', 'form_button', True);
+ $this->template->set_var($var);
}
- function list_log()
- {
- if (False) // add some errors to the log...
+ if ( $account_id )
{
- // Test 1: single Error line immedeately to
errorlog
- // (could be type Debug, Info, Warning, or
Error)
-
$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
-
$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
-
$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
-
$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
-
$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
-
$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...
-
$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
---------------------------
-
- // Get list of Possible Columns
- $header = $this->bolog->get_error_cols_e();
-
- // Describe table layout...
- $header['#phycols'] = $phycols;
- $header['#layout'] = $this->layout;
-
- // Set User Configured List of columns to show
- $header['_cols']= $this->fields_inc;
-
- // Set Table formating parameters
- $header['#table_parms']=array('width'=>"98%",
'bgcolor'=>"000000", 'border'=>"0");
-
- // Set Header formating parameters
- $header['#head_parms']=array('bgcolor'=>"D3DCFF");
-
- // Column Log_ID
- $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';
-
- // Column Application
- $header['log_app']['#title'] = 'App.';
-
- // Column FullName
- $header['log_full_name']['#title'] = 'User';
- $header['log_full_name']['align'] = 'center';
-
- // Column log_msg_seq_no
- $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_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_info']['flags']['app_header'] =
lang('Admin').' - '.($this->editmode?lang('Edit Table format') : lang('View
error log'));
- $GLOBALS['phpgw']->common->phpgw_header();
- $this->t->pfp('out','log_list_t');
-// $this->set_app_langs();
+ $var = array('footer_total' => lang('Total
records for %1 : %2', $GLOBALS['phpgw']->common->grab_owner_name($account_id),
$total_records) );
}
-
- function format_row($rno, $row)
- {
- switch($row['log_severity']['value'])
+ else
{
- case 'D': $row['log_severity']['bgcolor'] =
'D3DCFF'; break;
- case 'I': $row['log_severity']['bgcolor'] =
'C0FFC0'; break;
- case 'W': $row['log_severity']['bgcolor'] =
'FFFFC0'; break;
- case 'E': $row['log_severity']['bgcolor'] =
'FFC0C0'; break;
- case 'F': $row['log_severity']['bgcolor'] =
'FF0909'; break;
+ $var = array('footer_total' => lang('Total
records: %1', $total_records));
}
- switch($row['log_msg_severity']['value'])
- {
- case 'D': $color = 'D3DCFF'; break;
- case 'I': $color = 'C0FFC0'; break;
- case 'W': $color = 'FFFFC0'; break;
- case 'E': $color = 'FFC0C0'; break;
- case 'F': $color = 'FF0909'; break;
+ // create the menu on the left, if needed
+ $menuClass = CreateObject('admin.uimenuclass');
+ $var['rows'] =
$menuClass->createHTMLCode('view_account');
+
+ $this->template->set_var($var);
+ $this->template->pfp('out','list');
}
- reset($this->fields_inc);
- while(list($cno,$fld) = each($this->fields_inc))
- {
- if (substr($fld,0,7) == 'log_msg')
+
+ function purge_log()
{
- $row[$fld]['bgcolor'] = $color;
- }
- else
+ if
($GLOBALS['phpgw']->acl->check('error_log_access',1,'admin'))
{
-// $row[$cno]['bgcolor'] = $lcolor;
+ $GLOBALS['phpgw']->redirect_link('/index.php');
}
+ $this->bo->purge_log(isset($_REQUEST['account_id']) ?
$_REQUEST['account_id'] : 0);
+ $GLOBALS['phpgw']->redirect_link('index.php',
array('menuaction', 'admin.uilog.list_log'));
}
- return $row;
- }
+
}
-?>
Index: inc/class.uiloglevels.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uiloglevels.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- inc/class.uiloglevels.inc.php 11 May 2005 07:23:07 -0000 1.3
+++ inc/class.uiloglevels.inc.php 19 Sep 2006 15:16:32 -0000 1.4
@@ -1,19 +1,16 @@
<?php
- /**
- * Administration - Log levels
- *
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @package admin
- * @version $Id: class.uiloglevels.inc.php,v 1.3 2005/05/11 07:23:07
powerstat Exp $
- */
+
/**************************************************************************\
+ * phpGroupWare - Administration
*
+ * http://www.phpgroupware.org
*
+ * --------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by
the *
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+ /* $Id: class.uiloglevels.inc.php,v 1.4 2006/09/19 15:16:32 skwashd Exp
$ */
- /**
- * Log levels
- *
- * @package admin
- */
class uiloglevels
{
var $template;
@@ -93,8 +90,6 @@
$var['lang_module_level'] = "Module Logging Levels";
$var['lang_user_level'] = "User Logging Levels";
$var['global_option'] =
$this->create_select_box('global', '',
$GLOBALS['phpgw_info']['server']['log_levels']['global_level']);
- $var['th_bg'] =
$GLOBALS['phpgw_info']['theme']['th_bg'];
- $var['tr_color'] =
$GLOBALS['phpgw_info']['theme']['row_on'];
$this->template->set_var($var);
$this->template->pfp('out','loglevels');
@@ -113,13 +108,13 @@
$add_options = '';
asort($sorted_apps);
- $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];
+ $tr_class = 'row_on';
foreach ( $sorted_apps as $app => $title)
{
if (
isset($GLOBALS['phpgw_info']['server']['log_levels']['module'][$app]) )
{
$var = array(
- 'tr_color' =>
$tr_color,
+ 'tr_class' =>
$tr_class,
'type' =>
'module',
'module_name' => $title,
'module_option' =>
$this->create_select_box('module', $app,
$GLOBALS['phpgw_info']['server']['log_levels']['module'][$app]),
@@ -128,13 +123,13 @@
);
$this->template->set_var($var);
$this->template->fp('module_list','module',True);
- if ($tr_color ==
$GLOBALS['phpgw_info']['theme']['row_on'])
+ if ($tr_class == 'row_on' )
{
- $tr_color =
$GLOBALS['phpgw_info']['theme']['row_off'];
+ $tr_class = 'row_off';
}
else
{
- $tr_color =
$GLOBALS['phpgw_info']['theme']['row_on'];
+ $tr_class = 'row_on';
}
}
else
@@ -146,7 +141,7 @@
if ( $add_options )
{
$var = array(
- 'tr_color' => $tr_color,
+ 'tr_class' => $tr_class,
'type' => 'module',
'module_add_link' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiloglevels.edit_log_levels'),
'lang_add' => lang('add'),
@@ -154,6 +149,7 @@
'lang_fatal' => lang('fatal'),
'lang_error' => lang('error'),
'lang_warn' => lang('warn'),
+ 'lang_notice' => lang('notice'),
'lang_info' => lang('info'),
'lang_debug' => lang('debug'),
'lang_add' => lang('add')
@@ -166,15 +162,16 @@
function add_users_list()
{
- $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];
+ $tr_class = 'row_on';
$accounts =
$GLOBALS['phpgw']->accounts->get_list('accounts');
foreach($accounts as $account)
{
$account_lid = $account['account_lid'];
if (
isset($GLOBALS['phpgw_info']['server']['log_levels']['user'][$account_lid]) )
{
- $var = array(
- 'tr_color' =>
$tr_color,
+ $var = array
+ (
+ 'tr_class' =>
$tr_class,
'module_name' => $account_lid,
'module_option' =>
$this->create_select_box('user', $account_lid,
$GLOBALS['phpgw_info']['server']['log_levels']['user'][$account_lid]),
'remove_url' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiloglevels.edit_log_levels'
. '&level_type=user&level_key='.$account_lid),
@@ -182,13 +179,13 @@
);
$this->template->set_var($var);
$this->template->fp('user_list','module',True);
- if ($tr_color ==
$GLOBALS['phpgw_info']['theme']['row_on'])
+ if ($tr_class == 'row_on')
{
- $tr_color =
$GLOBALS['phpgw_info']['theme']['row_off'];
+ $tr_class = 'row_off';
}
else
{
- $tr_color =
$GLOBALS['phpgw_info']['theme']['row_on'];
+ $tr_class = 'row_on';
}
}
else
@@ -201,7 +198,7 @@
{
$var = array(
'type' => 'user',
- 'tr_color' => $tr_color,
+ 'tr_class' => $tr_class,
'module_add_link' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiloglevels.edit_log_levels'),
'lang_add' => lang('add'),
'module_add_options' => $add_options,
@@ -221,7 +218,8 @@
{
$select_name = $level_type . '_' . $level_key .
'_select';
- $var = Array(
+ $var = array
+ (
'level_type' => $level_type,
'level_key' => $level_key,
'select_link' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiloglevels.edit_log_levels'),
@@ -230,9 +228,11 @@
'lang_error' =>
lang('error'),
'lang_warn' => lang('warn'),
'lang_info' => lang('info'),
+ 'lang_notice' => lang('notice'),
'lang_debug' =>
lang('debug'),
'F_selected' => '',
'E_selected' => '',
+ 'N_selected' => '',
'W_selected' => '',
'I_selected' => '',
'D_selected' => ''
Index: templates/base/log_level_select.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/admin/templates/base/log_level_select.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/log_level_select.tpl 30 Dec 2004 07:38:14 -0000 1.2
+++ templates/base/log_level_select.tpl 19 Sep 2006 15:16:32 -0000 1.3
@@ -7,6 +7,7 @@
<option value="F" {F_selected}>{lang_fatal}</option>
<option value="E" {E_selected}>{lang_error}</option>
<option value="W" {W_selected}>{lang_warn}</option>
+ <option value="N" {N_selected}>{lang_notice}</option>
<option value="I" {I_selected}>{lang_info}</option>
<option value="D" {D_selected}>{lang_debug}</option>
</select>
Index: templates/base/loglevels.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/admin/templates/base/loglevels.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/loglevels.tpl 30 Dec 2004 07:38:14 -0000 1.2
+++ templates/base/loglevels.tpl 19 Sep 2006 15:16:32 -0000 1.3
@@ -1,49 +1,43 @@
<!-- BEGIN loglevels -->
-
- <center>
- <table border="0" cellspacing="2" cellpadding="2">
- <tr bgcolor="{th_bg}">
- <td colspan="2" align="center">{lang_set_levels}</td>
- </tr>
- <tr bgcolor="{tr_color}">
+<h1>{lang_set_levels}</h1>
+<table>
+ <tbody>
+ <tr class="{tr_class}">
<td>{lang_global_level}</td>
<td>{global_option}</td>
</tr>
<tr>
- <td width="50%" valign="top">
- <table width="100%" border="0" cellspacing="2" cellpadding="2">
- <tr bgcolor="{th_bg}"><td colspan="3"
align="center">{lang_module_level}</td></tr>
+ <td>{lang_module_level}</td>
+ <td>
+ <table>
{module_list}
{module_add_row}
</table>
</td>
- <td width="50%" valign="top">
- <table width="100%" border="0" cellspacing="2" cellpadding="2">
- <tr bgcolor="{th_bg}"><td colspan="3"
align="center">{lang_user_level}</td></tr>
+ </tr>
+ <tr>
+ <td>{lang_user_level}</td>
+ <td>
+ <table>
{user_list}
{user_add_row}
</table>
</td>
</tr>
-
- </table>
- </center>
-
+ </tbody>
+</table>
<!-- END loglevels -->
<!-- BEGIN module -->
-
- <tr bgcolor="{tr_color}">
+ <tr class="{tr_class}">
<td>{module_name}</td>
<td>{module_option}</td>
- <td align="center"><a href="{remove_url}">{lang_remove}</a></td>
+ <td><a
href="{remove_url}">{lang_remove}</a></td>
</tr>
-
<!-- END module -->
<!-- BEGIN module_add -->
-
- <tr bgcolor="{tr_color}">
+ <tr class="{tr_class}">
<form action="{module_add_link}" method="post"
name="{type}_add_form">
<td>
<select name="{type}_add_name_select" size="1">
@@ -54,16 +48,13 @@
<select name="{type}_add_level_select" size="1">
<option value="F">{lang_fatal}</option>
<option value="E">{lang_error}</option>
+ <option value="N">{lang_notice}</option>
<option value="W">{lang_warn}</option>
<option value="I">{lang_info}</option>
<option value="D" selected>{lang_debug}</option>
</select>
</td>
- <td align="center"><input value="{lang_add}"
type="submit"/></td>
+ <td align="center"><input value="{lang_add}" type="submit"></td>
</form>
</tr>
-
<!-- END module_add -->
-
-
-
Index: templates/base/log.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/admin/templates/base/log.tpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- templates/base/log.tpl 14 Feb 2006 08:48:21 -0000 1.3
+++ templates/base/log.tpl 19 Sep 2006 15:16:32 -0000 1.4
@@ -1,4 +1,4 @@
-<!-- $Id: log.tpl,v 1.3 2006/02/14 08:48:21 skwashd Exp $ -->
+<!-- $Id: log.tpl,v 1.4 2006/09/19 15:16:32 skwashd Exp $ -->
{app_header}
<center>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] admin inc/class.bolog.inc.php inc/class.solog.i...,
Dave Hall <=