[limb-svn] r6263 - in 3.x/trunk/limb/wact: src/compiler/expression/node src/tags/list tests/cases/tags/list
svn at limb-project.com
svn at limb-project.com
Wed Sep 5 17:33:22 MSD 2007
Author: serega
Date: 2007-09-05 17:33:22 +0400 (Wed, 05 Sep 2007)
New Revision: 6263
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6263
Modified:
3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php
3.x/trunk/limb/wact/src/tags/list/list_fill.tag.php
3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php
Log:
-- fixed a bug in WactDataBindingExpressionNode
-- <list:fill> tag now supports dynamic "upto" attribute value
Modified: 3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php 2007-09-05 13:14:39 UTC (rev 6262)
+++ 3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php 2007-09-05 13:33:22 UTC (rev 6263)
@@ -109,7 +109,7 @@
// parent context
if ($modifier == "^")
{
- if($this->is_property)
+ if(!$this->is_property)
$this->datasource_context = $this->datasource_context->getParentDataSource();
else
$this->datasource_context = $this->datasource_context->getParent();
Modified: 3.x/trunk/limb/wact/src/tags/list/list_fill.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/list/list_fill.tag.php 2007-09-05 13:14:39 UTC (rev 6262)
+++ 3.x/trunk/limb/wact/src/tags/list/list_fill.tag.php 2007-09-05 13:33:22 UTC (rev 6263)
@@ -2,9 +2,9 @@
/*
* Limb PHP Framework
*
- * @link http://limb-project.com
+ * @link http://limb-project.com
* @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
/**
@@ -26,11 +26,6 @@
function preParse($compiler)
{
- if (!$ratio = $this->getAttribute('upto'))
- $this->ratio = 1;
- else
- $this->ratio = $ratio;
-
if($var_name = $this->getAttribute('var'))
$this->var_name = $var_name;
else
@@ -42,6 +37,11 @@
function generateTagContent($code)
{
+ $ratio_var = $code->getTempVarRef();
+ $code->writePHP($ratio_var . ' = ');
+ $this->generateRatioAttributeValue($code);
+ $code->writePhp(";\n");
+
$ListList = $this->findParentByClass('WactListListTag');
$code->writePhp('if (!' . $ListList->getComponentRefCode($code) . '->valid()){' . "\n");
@@ -50,8 +50,8 @@
$items_left_var = $code->getTempVarRef();
$code->writePhp($count_var .' = '. $ListList->getComponentRefCode($code) . '->countPaginated();');
- $code->writePhp("if ({$count_var}/{$this->ratio} > 1) \n");
- $code->writePhp($items_left_var . " = ceil({$count_var}/{$this->ratio})*{$this->ratio} - {$count_var}; \n");
+ $code->writePhp("if ({$count_var}/{$ratio_var} > 1) \n");
+ $code->writePhp($items_left_var . " = ceil({$count_var}/{$ratio_var})*{$ratio_var} - {$count_var}; \n");
$code->writePhp("else \n");
$code->writePhp($items_left_var . " = 0;\n");
@@ -64,5 +64,13 @@
$code->writePhp('}'. "\n");
$code->writePhp('}'. "\n");
}
+
+ function generateRatioAttributeValue($code)
+ {
+ if($this->hasAttribute('upto'))
+ $this->attributeNodes['upto']->generateExpression($code);
+ else
+ $code->writePhp("1");
+ }
}
Modified: 3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php 2007-09-05 13:14:39 UTC (rev 6262)
+++ 3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php 2007-09-05 13:33:22 UTC (rev 6263)
@@ -305,7 +305,7 @@
function testListTotalItemsProperty()
{
- $template = '<list:LIST id="test"><list:item>{$:TotalItems}</list:item></list:LIST>';
+ $template = '<list:LIST id="test"><list:item>{$^:TotalItems}</list:item></list:LIST>';
$this->registerTestingTemplate('/tags/list/list-total-items.html', $template);
$page = $this->initTemplate('/tags/list/list-total-items.html');
@@ -314,7 +314,6 @@
$list->registerDataSet($this->founding_fathers);
$output = $page->capture();
$this->assertEqual($output, "333");
- die();
}
function testListFrom()
More information about the limb-svn
mailing list