diff --git a/config/dmsDefaults.php b/config/dmsDefaults.php index 347b72f..f853f57 100644 --- a/config/dmsDefaults.php +++ b/config/dmsDefaults.php @@ -265,8 +265,10 @@ class KTInit { if ($checkup === true) { return; } - // XXX: Make it look pretty - die($oError->toString()); + require_once(KT_LIB_DIR . '/dispatcher.inc.php'); + $oDispatcher =& new KTErrorDispatcher($oError); + $oDispatcher->dispatch(); + exit(0); } // }}} diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php index 3761c4f..b445b95 100644 --- a/lib/dispatcher.inc.php +++ b/lib/dispatcher.inc.php @@ -276,5 +276,23 @@ class KTAdminDispatcher extends KTStandardDispatcher { } } +class KTErrorDispatcher extends KTStandardDispatcher { + var $bLogonRequired = true; + + function KTErrorDispatcher($oError) { + parent::KTStandardDispatcher(); + $this->oError =& $oError; + } + + function dispatch() { + require_once(KT_LIB_DIR . '/validation/errorviewer.inc.php'); + $oRegistry =& KTErrorViewerRegistry::getSingleton(); + $oViewer =& $oRegistry->getViewer($this->oError); + $this->oPage->setTitle($oViewer->view()); + $this->oPage->hideSection(); + $this->handleOutput($oViewer->page()); + } +} + ?> diff --git a/lib/validation/errorviewer.inc.php b/lib/validation/errorviewer.inc.php index fb83cc4..5c6524b 100644 --- a/lib/validation/errorviewer.inc.php +++ b/lib/validation/errorviewer.inc.php @@ -13,11 +13,11 @@ class KTErrorViewerRegistry { } function register($sViewerClassName, $sHandledClass) { - $this->aViewers[$sHandledClass] = $sViewerClassName; + $this->aViewers[strtolower($sHandledClass)] = $sViewerClassName; } function getViewer($oError) { - $sErrorClass = get_class($oError); + $sErrorClass = strtolower(get_class($oError)); // Try for direct hit first $sClass = $sErrorClass; @@ -77,14 +77,56 @@ class KTErrorViewer { } function viewFull() { - return $this->oError->getString(); + return $this->oError->toString(); + } + + function page() { + $ret = "