Skip to content

Commit

Permalink
- Fixed bug #016814: Rendering problems in ezxmltext datatype
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@25307 a01eee8c-daba-0310-acae-fa49f3023285
  • Loading branch information
andrerom committed May 27, 2010
1 parent 17937f5 commit 9df764f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 5 deletions.
Expand Up @@ -22,6 +22,7 @@ Changes from 4.4.0alpha1 to 4.4.0alpha2
- Fixed bug #016830: kernel/setup/systemupgrade.php - typo in php classname - Fixed bug #016830: kernel/setup/systemupgrade.php - typo in php classname
- Fixed bug #016829: Bug in user/preferences - Fixed bug #016829: Bug in user/preferences
- Fixed bug #016828: content/view/full => if node_id is no numeric or < 2 ez should return an error_code - Fixed bug #016828: content/view/full => if node_id is no numeric or < 2 ez should return an error_code
- Fixed bug #016814: Rendering problems in ezxmltext datatype
- Fixed bug #016799: CSS class doesn't show when link is image, not text - Fixed bug #016799: CSS class doesn't show when link is image, not text
- Fixed bug #016797: eZSimplifiedXMLEditOutput does not unescape &nbsp; like output handler does - Fixed bug #016797: eZSimplifiedXMLEditOutput does not unescape &nbsp; like output handler does
- Fixed bug #016713: eZImageType doesn't use real main node for image path - Fixed bug #016713: eZImageType doesn't use real main node for image path
Expand Down
Expand Up @@ -449,7 +449,10 @@ function renderParagraph( $element, $childrenOutput, $vars )
{ {
if( $childOutput[1] === ' ' ) if( $childOutput[1] === ' ' )
{ {
continue; if ( isset( $childrenOutput[ $key + 1 ] ) )
continue;
else if ( isset( $childrenOutput[ $key - 1 ] ) && $childrenOutput[ $key - 1 ][0] === false )
continue;
} }


$inlineContent .= $childOutput[1]; $inlineContent .= $childOutput[1];
Expand Down Expand Up @@ -539,6 +542,12 @@ function renderLine( $element, $childrenOutput, $vars )
elseif ( $childOutput[0] === true && !isset( $childrenOutput[ $key + 1 ] ) ) elseif ( $childOutput[0] === true && !isset( $childrenOutput[ $key + 1 ] ) )
{ {
$next = $element->nextSibling; $next = $element->nextSibling;
// Make sure we get next element that is an element (ignoring whitespace)
while ( $next && !$next instanceof DOMElement )
{
$next = $next->nextSibling;
}

if ( $next && $next->nodeName == 'line' ) if ( $next && $next->nodeName == 'line' )
{ {
$tagText = $this->renderTag( $element, $inlineContent, $vars ); $tagText = $this->renderTag( $element, $inlineContent, $vars );
Expand Down
Expand Up @@ -9,7 +9,6 @@


class eZXHTMLXMLOutputRegression extends ezpDatabaseTestCase class eZXHTMLXMLOutputRegression extends ezpDatabaseTestCase
{ {

public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
Expand Down Expand Up @@ -60,7 +59,7 @@ public function testRenderParagraphBlockTags()
$XMLString = '<?xml version="1.0" encoding="utf-8"?> <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" $XMLString = '<?xml version="1.0" encoding="utf-8"?> <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"> xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
<paragraph> <table><tr><td>foo</td></tr></table> </paragraph> <paragraph> <table><tr><td>foo</td></tr></table> </paragraph>
</section>'; </section>';


$outputHandler = new eZXHTMLXMLOutput( $XMLString, false ); $outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
Expand All @@ -79,8 +78,64 @@ public function testRenderParagraphBlockTags()
} }


/** /**
* Tests that eZXML from ezp3 and ezp4 produces the same * Regression in renderParagraph() after #16184 causing last paragraphs to not be shown
* result *
* @link http://issues.ez.no/16814
* @note Test depends on template output!!
*/
public function testMissingParagraphs()
{
$XMLString = '<?xml version="1.0" encoding="utf-8"?>
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
<paragraph>
<line>Haustsemesteret,
<strong>7,5 studiepoeng</strong>
</line>
<line><strong>FP 336 620 Naturfag, del 1</strong>: Individuell, skriftleg mappe (HSF Oppdrag/betalingsemne)</line>
</paragraph>
<paragraph>
<line><strong>FP334 620 Naturfag, del 2</strong> : Individuell, skriftleg eksamen.</line>
<line>Tid: 4 timar </line>
</paragraph>
</section>';

$outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
$result = $outputHandler->outputText();

$html = ' <p>
Haustsemesteret, <b>7,5 studiepoeng</b> <br /><b>FP 336 620 Naturfag, del 1</b>: Individuell, skriftleg mappe (HSF Oppdrag/betalingsemne) </p> <p>
<b>FP334 620 Naturfag, del 2</b> : Individuell, skriftleg eksamen.<br />Tid: 4 timar </p>';

$this->assertEquals( $html, $result );
}

/**
* Regression in renderParagraph() after #15310 causing lines to not have line breaks in ouput
*
* @link http://issues.ez.no/16814
* @note Test depends on template output!!
*/
public function testMissingBreak()
{
$XMLString = '<?xml version="1.0" encoding="utf-8"?>
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
<paragraph>
<line>Telephone #1</line>
<line>Telephone #2</line>
</paragraph>
</section>';

$outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
$result = $outputHandler->outputText();

$html = '<p>
Telephone #1<br />Telephone #2</p>';

$this->assertEquals( $html, $result );
}

/**
* Tests that eZXML from ezp3 and ezp4 produces the same result
* *
* @link http://issues.ez.no/16184 * @link http://issues.ez.no/16184
* @note XML is from actual customer xml * @note XML is from actual customer xml
Expand Down

0 comments on commit 9df764f

Please sign in to comment.