Update of /cvsroot/phpwiki/phpwiki/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8982
Modified Files:
ErrorManager.php
Log Message:
in deferred html error messages use the worst header and class
(notice => warning => errors)
Index: ErrorManager.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/ErrorManager.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -2 -b -p -d -r1.33 -r1.34
--- ErrorManager.php 14 Sep 2004 10:28:21 -0000 1.33
+++ ErrorManager.php 24 Sep 2004 18:52:19 -0000 1.34
@@ -103,6 +103,16 @@ class ErrorManager
if ($flushed->isEmpty())
return false;
- $html = HTML::div(array('class' => 'errors'),
- HTML::h4("PHP Warnings"));
+ // format it with the worst class (error, warning, notice)
+ //$class = 'notice';
+ $cur_err = new PhpError(0,"","","");
+ foreach ($flushed->_content as $err) {
+ if ($err and isa($err, 'PhpError') and $err->errno >
$cur_err->errno) {
+ $cur_err = $err;
+ }
+ }
+ $class = $cur_err->getHtmlClass();
+ $html = HTML::div(array('class' => $class),
+ HTML::h4(array('class' => 'errors'),
+ "PHP " . $cur_err->getDescription()));
$html->pushContent($flushed);
return $html;
@@ -388,4 +398,23 @@ class PhpError {
return ($this->errno & EM_NOTICE_ERRORS) != 0;
}
+ function getHtmlClass() {
+ if ($this->isNotice()) {
+ return 'hint';
+ } elseif ($this->isWarning()) {
+ return 'errors';
+ } else {
+ return 'errors';
+ }
+ }
+
+ function getDescription() {
+ if ($this->isNotice()) {
+ return 'Notice';
+ } elseif ($this->isWarning()) {
+ return 'Warning';
+ } else {
+ return 'Error';
+ }
+ }
/**
@@ -394,11 +423,4 @@ class PhpError {
*/
function _getDetail() {
- if ($this->isNotice())
- $what = 'Notice';
- else if ($this->isWarning())
- $what = 'Warning';
- else
- $what = 'Fatal';
-
$dir = defined('PHPWIKI_DIR') ? PHPWIKI_DIR :
substr(dirname(__FILE__),0,-4);
if (substr(PHP_OS,0,3) == 'WIN') {
@@ -413,9 +435,10 @@ class PhpError {
$msg = sprintf("%s:%d: %s[%d]: %s",
$errfile, $this->errline,
- $what, $this->errno,
+ $this->getDescription(), $this->errno,
array_shift($lines));
- $html = HTML::div(array('class' => 'error'), HTML::p($msg));
-
+ //$html = HTML::div(array('class' => $this->getHtmlClass()),
HTML::p($msg));
+ // The class is now used for the div container.
+ $html = HTML::div(HTML::p($msg));
if ($lines) {
$list = HTML::ul();
@@ -480,12 +503,6 @@ class PhpWikiError extends PhpError {
function _getDetail() {
- if ($this->isNotice())
- $what = 'Notice';
- else if ($this->isWarning())
- $what = 'Warning';
- else
- $what = 'Fatal';
-
- return HTML::div(array('class' => 'error'), HTML::p("$what:
$this->errstr"));
+ return HTML::div(//array('class' => $this->getHtmlClass()),
+ HTML::p($this->getDescription() . ": $this->errstr"));
}
}
@@ -526,10 +543,4 @@ class PhpErrorOnce extends PhpError {
function _getDetail($count=0) {
if (!$count) $count = $this->_count;
- if ($this->isNotice())
- $what = 'Notice';
- else if ($this->isWarning())
- $what = 'Warning';
- else
- $what = 'Fatal';
$dir = defined('PHPWIKI_DIR') ? PHPWIKI_DIR :
substr(dirname(__FILE__),0,-4);
if (substr(PHP_OS,0,3) == 'WIN') {
@@ -543,10 +554,10 @@ class PhpErrorOnce extends PhpError {
$msg = sprintf("%s:%d: %s[%d]: %s %s",
$errfile, $this->errline,
- $what, $this->errno,
+ $this->getDescription(), $this->errno,
array_shift($lines),
$count > 1 ? sprintf(" (...repeated %d times)",$count)
: ""
);
-
- $html = HTML::div(array('class' => 'error'), HTML::p($msg));
+ $html = HTML::div(//array('class' => $this->getHtmlClass()),
+ HTML::p($msg));
if ($lines) {
$list = HTML::ul();
@@ -567,4 +578,8 @@ if (!isset($GLOBALS['ErrorManager'])) {
// $Log$
+// Revision 1.34 2004/09/24 18:52:19 rurban
+// in deferred html error messages use the worst header and class
+// (notice => warning => errors)
+//
// Revision 1.33 2004/09/14 10:28:21 rurban
// use assert, maybe we should only turn it off for releases
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
|