Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Commit

Permalink
Merge branch '2.1' of github.com:OPL/Open-Power-Template into 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
eXtreme committed Jul 16, 2010
2 parents ae60548 + b1da6fd commit b8333ff
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/Opt/Format/RuntimeGenerator.php
Expand Up @@ -47,13 +47,13 @@ protected function _build($hookName)
$section = $this->_getVar('section'); $section = $this->_getVar('section');


// Choose the data source. // Choose the data source.
if(!is_null($section['parent'])) if($section['parent'] !== null)
{ {
$parent = Opt_Instruction_BaseSection::getSection($section['parent']); $parent = Opt_Instruction_Section_Abstract::getSection($section['parent']);
$parent['format']->assign('item', $section['name']); $parent['format']->assign('item', $section['name']);
$ds = $parent['format']->get('section:variable'); $ds = $parent['format']->get('section:variable');
} }
elseif(!is_null($section['datasource'])) elseif($section['datasource'] !== null)
{ {
$ds = $section['datasource']; $ds = $section['datasource'];
} }
Expand All @@ -65,7 +65,7 @@ protected function _build($hookName)


if(!is_object($this->_decorated)) if(!is_object($this->_decorated))
{ {
throw new Opt_FormatNotDecorated_Exception('StaticGenerator'); throw new Opt_Format_Exception('StaticGenerator format must be decorated.');
} }
$ref = ($this->_decorated->property('section:useReference') ? ' & ' : ''); $ref = ($this->_decorated->property('section:useReference') ? ' & ' : '');


Expand Down
51 changes: 51 additions & 0 deletions lib/Opt/Output/Exception.php
@@ -0,0 +1,51 @@
<?php
/*
* OPEN POWER LIBS <http://www.invenzzia.org>
*
* This file is subject to the new BSD license that is bundled
* with this package in the file LICENSE. It is also available through
* WWW at this URL: <http://www.invenzzia.org/license/new-bsd>
*
* Copyright (c) Invenzzia Group <http://www.invenzzia.org>
* and other contributors. See website for details.
*
*/

/**
* The class for output system errors.
*
* @author Tomasz Jędrzejewski
* @copyright Invenzzia Group <http://www.invenzzia.org/> and contributors.
* @license http://www.invenzzia.org/license/new-bsd New BSD License
*/
class Opt_Output_Exception extends Opt_Exception
{
/**
* The output name.
* @var string
*/
private $_outputName;

/**
* Creates a new output exception. The output system should specify
* its name in the second argument.
*
* @param string $message The error message.
* @param string $output The name of the output system.
*/
public function __construct($message, $output)
{
$this->message = (string)$message;
$this->_outputName = (string)$output;
} // end __construct();

/**
* Returns the name of the output that caused the exception.
*
* @return string
*/
public function getOutputName()
{
return $this->_outputName;
} // end getOutputName();
} // end Opt_Output_Exception;
3 changes: 2 additions & 1 deletion lib/Opt/Output/Http.php
Expand Up @@ -167,6 +167,7 @@ public function setContentType($contentType = null, $charset = null)
if($this->_tpl->contentNegotiation) if($this->_tpl->contentNegotiation)
{ {
// This part of the code requires OPC! // This part of the code requires OPC!
// TODO: Replace with non-singleton OPC
$visit = Opc_Visit::getInstance(); $visit = Opc_Visit::getInstance();
if($contentType == self::XHTML) if($contentType == self::XHTML)
{ {
Expand Down Expand Up @@ -268,7 +269,7 @@ public function render(Opt_View $view)
} }
elseif($this->_parser == 'Html' || $this->_parser == 'Xml') elseif($this->_parser == 'Html' || $this->_parser == 'Xml')
{ {
throw new Opt_OutputOverloaded_Exception; throw new Opt_Output_Exception('The HTTP output is overloaded: an HTML or XML template has already been sent.', 'HTTP');
} }
return $view->_parse($this, true); return $view->_parse($this, true);
} // end output(); } // end output();
Expand Down

0 comments on commit b8333ff

Please sign in to comment.