Skip to content

Commit

Permalink
Merge commit 'ff750df460cbd9eaed7771fecd5ef9adaefcf4b9'
Browse files Browse the repository at this point in the history
  • Loading branch information
taiwen committed Jul 5, 2013
2 parents e2b6c91 + ff750df commit b913b18
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 77 deletions.
3 changes: 3 additions & 0 deletions doc/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ June 24th, 2013
8. Added "pi-feature" and "pi-spotlight" blocks to homepage on installation
9. Added two new block zones to theme font layout: $block['0'] for head blocks and $block['99'] for foot blocks
10. Added browser support indication to theme configuration
11. Fixed Issue #121: exception messages were missed by ErrorStrategy template overwritten
12. Merged theme/template/error-exception.phtml to error.phtml
13. Modified config: var/config/config.application.php -- changed 'exception_template' value


June 19th, 2013
Expand Down
9 changes: 4 additions & 5 deletions lib/Pi/Mvc/View/Http/ErrorStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public function prepareErrorViewModel(MvcEvent $e)
$viewModel = null;
if (!$result instanceof ViewModel) {
$viewModel = new ViewModel;
$config = $e->getApplication()->getServiceManager()->get('Config');
$viewConfig = $config['view_manager'];
$template = isset($viewConfig[$templateName]) ? $viewConfig[$templateName] : 'error';
$viewModel->setTemplate($template);
} else {
$viewModel = $result;
}
Expand All @@ -96,11 +100,6 @@ public function prepareErrorViewModel(MvcEvent $e)
}
$viewModel->setVariable('code', $statusCode);

$config = $e->getApplication()->getServiceManager()->get('Config');
$viewConfig = $config['view_manager'];
$template = isset($viewConfig[$templateName]) ? $viewConfig[$templateName] : 'error';
$viewModel->setTemplate($template);

$e->setResult($viewModel);

// Inject error ViewModel to root ViewModel in case InjectViewModelListener is not triggered
Expand Down
3 changes: 1 addition & 2 deletions usr/theme/default/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
* tmplate/layout-simple.phtml - error page layout: header, footer, body
* tmplate/layout-style.phtml - content with stylesheets
* tmplate/layout-content.phtml - raw content without stylesheets
* template/error.phtml - defined in var/config/config.application.php: view_manager.error_template
* template/error.phtml - defined in var/config/config.application.php: view_manager.error_template, view_manager.error_exception_template
* REQUIRED for admin:
* tmplate/layout-admin.phtml - backoffice layout
* OPTIONAL for front:
* template/page-zone.phtml - for block manipulation on a page
* template/block.phtml - called by layout-front.phtml
* template/error-404.phtml - defined in var/config/config.application.php: view_manager.not_found_template
* template/error-denied.phtml - defined in var/config/config.application.php: view_manager.denied_template
* template/error-exception.phtml - defined in var/config/config.application.php: view_manager.exception_template
*
* Stylesheet files:
* REQUIRED:
Expand Down
68 changes: 0 additions & 68 deletions usr/theme/default/template/error-exception.phtml

This file was deleted.

62 changes: 62 additions & 0 deletions usr/theme/default/template/error.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,65 @@
<p><?php echo $this->escape($message ?: __('Please visit later.')); ?></p>

</div>


<?php if ('production' == Pi::environment()) return; ?>

<?php if (isset($this->display_exceptions) && $this->display_exceptions): ?>

<?php if (isset($this->exception) && $this->exception instanceof Exception): ?>
<h3 class="page-header">Additional information:</h3>
<h4><?php echo get_class($this->exception); ?></h4>
<dl>
<dt>File:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo Pi::service('security')->path($this->exception->getFile()); ?>: <?php echo $this->exception->getLine(); ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $this->exception->getMessage(); ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo Pi::service('security')->path($this->exception->getTraceAsString()); ?></pre>
</dd>
</dl>
<?php
$e = $this->exception->getPrevious();
if ($e) :
?>

<h3 class="page-header">Previous exceptions:</h3>
<ul class="unstyled">
<?php while($e): ?>
<li>
<h3><?php echo get_class($e); ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo Pi::service('security')->path($e->getFile()); ?>: <?php echo $e->getLine(); ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $this->escape($e->getMessage()); ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo Pi::service('security')->path($e->getTraceAsString()); ?></pre>
</dd>
</dl>
</li>
<?php
$e = $e->getPrevious();
endwhile;
?>
</ul>
<?php endif; ?>

<?php else: ?>

<h3>No Exception available</h3>

<?php endif ?>

<?php endif ?>
4 changes: 2 additions & 2 deletions var/config/config.application.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'error_template' => 'error',
'not_found_template' => 'error-404',
'exception_template' => 'error-exception',
'exception_template' => 'error',
'error_template' => 'error',
'denied_template' => 'error-denied',
'layout' => 'layout-front',
'layout_error' => 'layout-style',
Expand Down

0 comments on commit b913b18

Please sign in to comment.