From 8df1407a11df3e5a8c33c6fae1c522707aefccf3 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 24 Mar 2006 23:06:31 +0000 Subject: Enhanced error context display when a PHP error occurs. --- HISTORY | 6 +++-- .../pages/Controls/Samples/TWizard/Sample2.page | 2 ++ .../protected/pages/Controls/Wizard.page | 31 +++++++++++++++++----- framework/Data/TDataFieldAccessor.php | 2 +- framework/Exceptions/TErrorHandler.php | 17 ++++++++++-- 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/HISTORY b/HISTORY index 8e91244a..6ac5f3fa 100644 --- a/HISTORY +++ b/HISTORY @@ -1,14 +1,16 @@ Version 3.0RC1 April 1, 2006 ============================ -BUG: Ticket#88 - Unclosed HTML tag rendered in TDatePicker - and TColorPicker (Qiang) +BUG: Ticket#88 - Unclosed HTML tag in TDatePicker and TColorPicker (Qiang) BUG: Ticket#85 - Undefined TDataGrid::setSelectedIndex (Qiang) BUG: Ticket#87 - Typo in IDbConnection (Qiang) +BUG: Ticket#95 - Typo in TTemplateControl::registerContentPlaceHolder (Qiang) BUG: SF#1446846 - Typo in THead (Qiang) BUG: SF#1432624 - Incorrect documentation about caching expiry (Qiang) BUG: THttpSession fails when user storage module is used (Qiang) ENH: TDataFieldAccessor can access public class variables (Qiang) ENH: Pagers in TDataGrid are now enclosed within panels (Qiang) +ENH: Ticket#92 - Support for user exception message file (Qiang) +ENH: TPhpErrorException now shows the actual error lines (Qiang) NEW: TSQLMap module (Wei) NEW: TStack class (Qiang) NEW: TImageMap control (Qiang) diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page index 727179bd..ea01e320 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page @@ -12,6 +12,8 @@ SideBarStyle.Width="100px" SideBarStyle.Height="100px" SideBarStyle.BackColor="#507CD1" + SideBarStyle.HorizontalAlign="Center" + StepStyle.HorizontalAlign="Center" NavigationStyle.HorizontalAlign="Right" NavigationButtonStyle.BackColor="White" NavigationButtonStyle.BorderColor="#507CD1" diff --git a/demos/quickstart/protected/pages/Controls/Wizard.page b/demos/quickstart/protected/pages/Controls/Wizard.page index 3034c0c6..0de4a44a 100644 --- a/demos/quickstart/protected/pages/Controls/Wizard.page +++ b/demos/quickstart/protected/pages/Controls/Wizard.page @@ -5,7 +5,7 @@

Overview

-TWizard is analogous to the installation wizard commonly used to install software on Windows. It splits a large form and presents the user with a series of smaller forms, called wizard steps, to complete. The following figure shows how a wizard is composed of when presented to users, where step content is the main content of a wizard step for users to complete, header refers to header content common to all steps, navigation contains buttons that allow users to navigate step by step, and side bar contains a list of hyperlinks by which users can reach to any step with one click. +TWizard is analogous to the installation wizard commonly used to install software on Windows. It splits a large form and presents the user with a series of smaller forms, called wizard steps, to complete. The following figure shows how a wizard is composed of when presented to users, where step content is the main content of a wizard step for users to complete, header refers to header content common to all steps, navigation contains buttons that allow users to navigate step by step, and side bar contains a list of hyperlinks by which users can reach to any step with one click. The visibility of the side bar can be toggled by setting DisplaySideBar.

components of wizard @@ -40,7 +40,7 @@ In the above, StepType refers to the type of a wizard step, which can a
  • Start - the first step in the wizard.
  • Step - the internal steps in the wizard.
  • Finish - the last step that allows user interaction.
  • -
  • Complete - the step that shows a summary to user (no interaction is allowed).
  • +
  • Complete - the step that shows a summary to user. In this step, both side bar and navigation panel are invisible. Thus, this step usually does not allow user interaction.
  • Auto - the step type is determined by wizard automatically.
  • @@ -55,15 +55,34 @@ In this sample, we use wizard to collect user's preference of color. In the firs

    Customizing Wizard Styles

    -TWizard defines a whole set of properties for customization of its various components as shown in the above figure. In particular, the following properties are provided: +TWizard defines a whole set of properties for customization of appearance of its various components as shown in the above figure. In particular, the following properties are provided for style customization:

    +

    Customizing Wizard Navigation

    +

    +Bidirectional, +Unidirectional, +Non-linear +

    + +

    Using Templates in Wizard

    +

    +

    + + +

    Using Templated Wizard Steps

    +

    +

    \ No newline at end of file diff --git a/framework/Data/TDataFieldAccessor.php b/framework/Data/TDataFieldAccessor.php index a28b9d1f..aa6d7be7 100644 --- a/framework/Data/TDataFieldAccessor.php +++ b/framework/Data/TDataFieldAccessor.php @@ -78,7 +78,7 @@ class TDataFieldAccessor { if(is_array($data) || ($data instanceof ArrayAccess)) { - if(isset($data[$field])) + if(isset($data[$field]) || $data[$field]===null) return $data[$field]; else throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid',$field); diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index 23644fb7..4b42491e 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -207,8 +207,21 @@ class TErrorHandler extends TModule */ protected function displayException($exception) { - $lines=file($exception->getFile()); + $fileName=$exception->getFile(); $errorLine=$exception->getLine(); + if($exception instanceof TPhpErrorException) + { + // if PHP exception, we want to show the 2nd stack level context + // because the 1st stack level is of little use (it's in error handler) + $trace=$exception->getTrace(); + if(isset($trace[0]) && isset($trace[0]['file']) && isset($trace[0]['line'])) + { + $fileName=$trace[0]['file']; + $errorLine=$trace[0]['line']; + } + } + $lines=file($fileName); + $beginLine=$errorLine-self::SOURCE_LINES>=0?$errorLine-self::SOURCE_LINES:0; $endLine=$errorLine+self::SOURCE_LINES<=count($lines)?$errorLine+self::SOURCE_LINES:count($lines); @@ -227,7 +240,7 @@ class TErrorHandler extends TModule $tokens=array( '%%ErrorType%%' => get_class($exception), '%%ErrorMessage%%' => htmlspecialchars($exception->getMessage()), - '%%SourceFile%%' => htmlspecialchars($exception->getFile()).' ('.$exception->getLine().')', + '%%SourceFile%%' => htmlspecialchars($fileName).' ('.$errorLine.')', '%%SourceCode%%' => $source, '%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()), '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' PRADO/'.Prado::getVersion(), -- cgit v1.2.3