[limb-svn] r6386 - in 3.x/trunk/limb/wact: src src/compiler src/compiler/compile_tree_node src/compiler/expression src/compiler/expression/node src/compiler/filter src/components src/components/form src/components/iterator src/tags/core src/tags/form src/tags/list src/tags/pager tests/cases/compiler/compile_tree_node tests/cases/compiler/expression tests/cases/filters tests/cases/functional tests/cases/tags/dev tests/cases/tags/fetch tests/cases/tags/form tests/cases/tags/iterator tests/cases/tags/list tests/cases/tags/perform
svn at limb-project.com
svn at limb-project.com
Fri Oct 5 18:22:21 MSD 2007
Author: serega
Date: 2007-10-05 18:22:21 +0400 (Fri, 05 Oct 2007)
New Revision: 6386
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6386
Removed:
3.x/trunk/limb/wact/src/compiler/expression/WactTagPropertyExpressionNode.class.php
3.x/trunk/limb/wact/src/components/WactArrayObject.class.php
Modified:
3.x/trunk/limb/wact/src/WactTemplate.class.php
3.x/trunk/limb/wact/src/compiler/WactCodeWriter.class.php
3.x/trunk/limb/wact/src/compiler/compile_tree_node/WactCompileTreeNode.class.php
3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php
3.x/trunk/limb/wact/src/compiler/expression/node/WactConstantExpressionNode.class.php
3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php
3.x/trunk/limb/wact/src/compiler/filter/WactCompilerFilter.class.php
3.x/trunk/limb/wact/src/components/WactArrayIterator.class.php
3.x/trunk/limb/wact/src/components/WactDatasourceRuntimeComponent.class.php
3.x/trunk/limb/wact/src/components/WactRuntimeComponent.class.php
3.x/trunk/limb/wact/src/components/components.inc.php
3.x/trunk/limb/wact/src/components/form/WactFormComponent.class.php
3.x/trunk/limb/wact/src/components/form/WactGroupedOptionsSelectComponent.class.php
3.x/trunk/limb/wact/src/components/form/WactSelectOptionsSourceComponent.class.php
3.x/trunk/limb/wact/src/components/iterator/WactBaseIteratorComponent.class.php
3.x/trunk/limb/wact/src/tags/core/set.tag.php
3.x/trunk/limb/wact/src/tags/form/form.tag.php
3.x/trunk/limb/wact/src/tags/form/form_referer.tag.php
3.x/trunk/limb/wact/src/tags/list/list_fill.tag.php
3.x/trunk/limb/wact/src/tags/pager/current.tag.php
3.x/trunk/limb/wact/src/tags/pager/first.tag.php
3.x/trunk/limb/wact/src/tags/pager/last.tag.php
3.x/trunk/limb/wact/src/tags/pager/next.tag.php
3.x/trunk/limb/wact/src/tags/pager/number.tag.php
3.x/trunk/limb/wact/src/tags/pager/prev.tag.php
3.x/trunk/limb/wact/src/tags/pager/section.tag.php
3.x/trunk/limb/wact/src/tags/pager/total_pages.prop.php
3.x/trunk/limb/wact/tests/cases/compiler/compile_tree_node/WactCompileTreeNodeTest.class.php
3.x/trunk/limb/wact/tests/cases/compiler/expression/WactDataBindingExpressionNodeTest.class.php
3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionTest.class.php
3.x/trunk/limb/wact/tests/cases/filters/stats_filter.test.php
3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php
3.x/trunk/limb/wact/tests/cases/functional/WactTemplateFiltersTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/dev/WactDevSourceTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/fetch/WactFetchTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/form/WactFormTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/form/WactInputCheckboxTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectMultipleComponentTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectOptionsSourceTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectSingleComponentTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/iterator/WactIteratorTransferTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/list/decorators.inc.php
3.x/trunk/limb/wact/tests/cases/tags/perform/WactPerformTagTest.class.php
3.x/trunk/limb/wact/tests/cases/tags/perform/WactSpecialTestingTemplateCommand.class.php
Log:
-- WACT changes.
* WACT doesn't wrap datasources into WactArrayObject anymore.
* WactArrayObject removed.
* Now output expressions can be used to output fields in arrays. See tests for <list> tags.
* Other minor fixes.
Modified: 3.x/trunk/limb/wact/src/WactTemplate.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/WactTemplate.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/WactTemplate.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/src/components/components.inc.php');
@@ -73,19 +73,35 @@
return new WactCompiler($this->config, $this->locator);
}
- /**
- * @return WactArrayObject
- **/
- static function makeObject($value)
+ static function getValue($source, $value)
{
- if (is_object($value) && method_exists($value, 'get'))
- return $value;
- elseif(is_object($value) || is_array($value))
- return new WactArrayObject($value);
+ if(is_scalar($source) || is_null($source))
+ return null;
- return new WactArrayObject(array());
+ if (is_object($source) && method_exists($source, 'get'))
+ return $source->get($value);
+
+ if((is_array($source) || $source instanceof ArrayAccess) && isset($source[$value]))
+ return $source[$value];
+
+ return null;
}
+ static function setValue(&$source, $field, $value)
+ {
+ if(is_scalar($source) || is_null($source))
+ return;
+
+ if (is_object($source) && method_exists($source, 'set'))
+ {
+ $source->set($field, $value);
+ return;
+ }
+
+ if((is_array($source) || $source instanceof ArrayAccess))
+ $source[$field] = $value;
+ }
+
/**
* @return WactArrayIterator/Iterator
**/
Modified: 3.x/trunk/limb/wact/src/compiler/WactCodeWriter.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/WactCodeWriter.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/WactCodeWriter.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -67,7 +67,9 @@
{
$this->switchToPHP();
- if ($escape_text)
+ if(is_numeric($text))
+ $this->code .= $text;
+ elseif ($escape_text)
$this->code .= "'" . $this->escapeLiteral($text) . "'";
else
$this->code .= "'" . $text . "'";
Modified: 3.x/trunk/limb/wact/src/compiler/compile_tree_node/WactCompileTreeNode.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/compile_tree_node/WactCompileTreeNode.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/compile_tree_node/WactCompileTreeNode.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -310,6 +310,11 @@
return $this->parent->getComponentRefCode();
}
+ function getDatasourceRefCode()
+ {
+ return $this->getDatasource()->getComponentRefCode() . "->datasource";
+ }
+
function generateConstructor($code_writer)
{
foreach( array_keys($this->children) as $key)
Modified: 3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once 'limb/wact/src/compiler/expression/node/WactTemplateExpressionNode.class.php';
@@ -57,7 +57,7 @@
*/
protected function parsePrimary()
{
- $token = $this->getToken('/\G\s*(#|\^|\$|:|-|"|\'|!|\[|\(|[0-9]+|[A-Za-z][A-Za-z0-9_.]*)/u');
+ $token = $this->getToken('/\G\s*(#|\^|\$|:|-|\.[0-9]+|"|\'|!|\[|\(|[0-9]+|[A-Za-z][A-Za-z0-9_.]*)/u');
if ($token === FALSE)
$this->raiseError("Expecting primary operand in expression.");
@@ -117,6 +117,8 @@
return new WactConstantExpressionNode(TRUE);
elseif (strcasecmp($token, 'false') == 0)
return new WactConstantExpressionNode(FALSE);
+ elseif(strcasecmp($token, '.') == 0)
+ return new WactDataBindingExpressionNode(substr($token, 1), $this->context);
else
return new WactDataBindingExpressionNode($token, $this->context);
}
Deleted: 3.x/trunk/limb/wact/src/compiler/expression/WactTagPropertyExpressionNode.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/expression/WactTagPropertyExpressionNode.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/expression/WactTagPropertyExpressionNode.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -1,151 +0,0 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-/**
- * class WactTagPropertyExpressionNode.
- *
- * @package wact
- * @version $Id$
- */
-class WactTagPropertyExpressionNode
-{
- protected $context;
- protected $property;
-
- function __construct($expression, $context)
- {
- $this->original_expression = $expression;
- $this->context = $context_node;
- }
-
- function analyzeExpression()
- {
- if ($this->expression_analyzed)
- return;
-
- /* pre-defined properties will never be found inside a child datasource context */
- if (is_object($this->context))
- {
- $this->property = $this->context->getProperty($this->field_name);
- if (is_object($this->property))
- $this->property->activate();
- }
-
- $this->expression_analyzed = TRUE;
- }
-
- function prepare()
- {
- $this->analyzeExpression();
- }
-
- function isConstant()
- {
- $this->analyzeExpression();
-
- if (is_object($this->property))
- return $this->property->isConstant();
-
- return FALSE;
- }
-
- /**
- * Return the value of this expression
- */
- function getValue()
- {
- $this->analyzeExpression();
-
- if (is_null($this->property) || !$this->property->isConstant())
- $this->datasource_context->raiseCompilerError('Cannot resolve data binding', array('expression' => $this->original_expression));
- else
- return $this->property->getValue();
- }
-
- /**
- * Generate setup code for an expression reference
- */
- function generatePreStatement($code_writer)
- {
- $this->analyzeExpression();
-
- if (is_object($this->property))
- $this->property->generatePreStatement($code_writer);
-
- $this->_generateReferencesChainToTargetDatasource($code_writer);
- }
-
- protected function _generateReferencesChainToTargetDatasource($code_writer)
- {
- if (!isset($this->path_to_target_datasource))
- return;
-
- $key = array_shift($this->path_to_target_datasource);
-
- $this->datasource_ref_var = $code_writer->getTempVarRef();
-
- $code_writer->writePHP($this->datasource_ref_var . '= WactTemplate :: makeObject(' . $this->datasource_context->getDataSource()->getComponentRefCode() . '->get(');
- $code_writer->writePHPLIteral($key);
- $code_writer->writePHP('));');
-
- foreach ($this->path_to_target_datasource as $key)
- {
- $datasource_ref_var = $code_writer->getTempVarRef();
- $code_writer->writePHP($datasource_ref_var . '= WactTemplate :: makeObject(' . $this->datasource_ref_var . '->get(');
- $code_writer->writePHPLIteral($key);
- $code_writer->writePHP('));');
- $this->datasource_ref_var = $datasource_ref_var;
- }
- }
-
- /**
- * Generate the code to read the data value at run time
- * Must generate only a valid PHP Expression.
- */
- function generateExpression($code_writer)
- {
- $this->analyzeExpression();
-
- if (is_object($this->property))
- {
- $this->property->generateExpression($code_writer);
- return;
- }
-
- if (isset($this->datasource_ref_var))
- {
- $code_writer->writePHP($this->datasource_ref_var . '->get(');
- $code_writer->writePHPLiteral($this->field_name);
- $code_writer->writePHP(')');
- }
- else
- {
- if($this->field_name)
- {
- $code_writer->writePHP('' . $this->datasource_context->getDatasource()->getComponentRefCode() . '->get(');
- $code_writer->writePHPLiteral($this->field_name);
- $code_writer->writePHP(')');
- }
- else
- {
- $code_writer->writePHP($this->datasource_context->getComponentRefCode());
- }
- }
- }
-
- function generatePostStatement($code_writer)
- {
- $this->analyzeExpression();
-
- if (is_object($this->property))
- $this->property->generatePostStatement($code_writer);
- }
-}
-
-
Modified: 3.x/trunk/limb/wact/src/compiler/expression/node/WactConstantExpressionNode.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/expression/node/WactConstantExpressionNode.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/expression/node/WactConstantExpressionNode.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
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-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -21,7 +21,7 @@
protected $processed_expression;
protected $path_to_target_datasource;
- protected $field_name;
+ protected $field_name = null;
protected $datasource_ref_var;
@@ -82,6 +82,14 @@
do
{
$modifier = $this->processed_expression{0};
+
+ // the same datasource
+ if ($modifier == ".")
+ {
+ $this->processed_expression = substr($this->processed_expression, 1);
+ continue;
+ }
+
// local PHP variable
if ($modifier == "$")
{
@@ -152,7 +160,7 @@
protected function _extractTargetFieldName()
{
- if(is_null($this->processed_expression) || $this->processed_expression == "")
+ if(is_null($this->processed_expression) || ($this->processed_expression === false))
return;
if (preg_match("/^\w+$/", $this->processed_expression))
@@ -231,21 +239,21 @@
if($this->php_variable)
{
- $code_writer->writePHP($this->datasource_ref_var . '= WactTemplate :: makeObject($' . $key . ');');
+ $this->datasource_ref_var = '$' . $key;
}
else
{
- $code_writer->writePHP($this->datasource_ref_var . '= WactTemplate :: makeObject(' . $this->datasource_context->getDataSource()->getComponentRefCode() . '->get(');
+ $code_writer->writePHP($this->datasource_ref_var . '= WactTemplate::getValue(' . $this->datasource_context->getDataSource()->getDatasourceRefCode() . ',');
$code_writer->writePHPLIteral($key);
- $code_writer->writePHP('));');
+ $code_writer->writePHP(');');
}
foreach ($this->path_to_target_datasource as $key)
{
$datasource_ref_var = $code_writer->getTempVarRef();
- $code_writer->writePHP($datasource_ref_var . '= WactTemplate :: makeObject(' . $this->datasource_ref_var . '->get(');
+ $code_writer->writePHP($datasource_ref_var . '= WactTemplate::getValue(' . $this->datasource_ref_var . ',');
$code_writer->writePHPLIteral($key);
- $code_writer->writePHP('));');
+ $code_writer->writePHP(');');
$this->datasource_ref_var = $datasource_ref_var;
}
}
@@ -268,7 +276,7 @@
{
if($this->datasource_ref_var)
{
- $code_writer->writePHP($this->datasource_ref_var . '->get(');
+ $code_writer->writePHP('WactTemplate::getValue(' . $this->datasource_ref_var . ',');
$code_writer->writePHPLiteral($this->field_name);
$code_writer->writePHP(')');
return;
@@ -282,15 +290,15 @@
if (isset($this->datasource_ref_var))
{
- $code_writer->writePHP($this->datasource_ref_var . '->get(');
+ $code_writer->writePHP('WactTemplate::getValue(' . $this->datasource_ref_var . ',');
$code_writer->writePHPLiteral($this->field_name);
$code_writer->writePHP(')');
}
else
{
- if($this->field_name)
+ if(!is_null($this->field_name))
{
- $code_writer->writePHP('' . $this->datasource_context->getDatasource()->getComponentRefCode() . '->get(');
+ $code_writer->writePHP('WactTemplate::getValue(' . $this->datasource_context->getDatasource()->getDatasourceRefCode() . ',');
$code_writer->writePHPLiteral($this->field_name);
$code_writer->writePHP(')');
}
Modified: 3.x/trunk/limb/wact/src/compiler/filter/WactCompilerFilter.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/filter/WactCompilerFilter.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/compiler/filter/WactCompilerFilter.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
Modified: 3.x/trunk/limb/wact/src/components/WactArrayIterator.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/WactArrayIterator.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/WactArrayIterator.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -28,11 +28,6 @@
$this->seek($this->offset);
}
- function current()
- {
- return new WactArrayObject(parent :: current());
- }
-
function next()
{
$this->position++;
Deleted: 3.x/trunk/limb/wact/src/components/WactArrayObject.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/WactArrayObject.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/WactArrayObject.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -1,104 +0,0 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-/**
- * class WactArrayObject.
- *
- * @package wact
- * @version $Id$
- */
-class WactArrayObject implements ArrayAccess
-{
- /**
- * @var ArrayAccess
- */
- protected $innerObject;
-
- protected $use_getter;
-
- /**
- * @param $object ArrayAccess/array
- */
- public function __construct($object = array())
- {
- if(is_object($object))
- {
- $this->innerObject = $object;
- $this->use_getter = method_exists($object, 'get');
- return;
- }
-
- if(is_null($object) || is_scalar($object))
- $object = array();
-
- $this->innerObject = $object;
- }
-
- function getInnerObject()
- {
- return $this->innerObject;
- }
-
- function offsetGet($key)
- {
- return $this->get($key);
- }
-
- function offsetSet($key, $value)
- {
- return $this->set($key, $value);
- }
-
- function offsetUnset($key)
- {
- unset($this->innerObject[$key]);
- }
-
- function offsetExists($key)
- {
- return isset($this->innerObject[$key]);
- }
-
- function export()
- {
- if(is_array($this->innerObject))
- return $this->innerObject;
- if(method_exists($this->innerObject, 'export'))
- return $this->innerObject->export();
- elseif(method_exists($this->innerObject, 'getArrayCopy'))
- return $this->innerObject->getArrayCopy();
- }
-
- function get($name)
- {
- if($this->use_getter)
- return $this->innerObject->get($name);
- else
- {
- if(isset($this->innerObject[$name]))
- return $this->innerObject[$name];
- else
- return NULL;
- }
- }
-
- function set($name, $value)
- {
- if($this->use_getter)
- return $this->innerObject->set($name, $value);
-
- return $this->innerObject[$name] = $value;
- }
-
- function __call($methodName, $arguments)
- {
- return call_user_func_array(array($this->innerObject, $methodName), $arguments);
- }
-}
-
Modified: 3.x/trunk/limb/wact/src/components/WactDatasourceRuntimeComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/WactDatasourceRuntimeComponent.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/WactDatasourceRuntimeComponent.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -12,61 +12,36 @@
* @package wact
* @version $Id$
*/
-class WactDatasourceRuntimeComponent extends WactRuntimeComponent implements ArrayAccess
+class WactDatasourceRuntimeComponent extends WactRuntimeComponent
{
- protected $datasource;
+ public $datasource;
function __construct($id)
{
parent :: __construct($id);
- $this->datasource = new WactArrayObject(new ArrayObject());
+ $this->datasource = array();
}
function set($field, $value)
{
- $this->datasource->set($field, $value);
+ WactTemplate :: setValue($this->datasource, $field, $value);
}
function get($field)
{
- return $this->datasource->get($field);
+ return WactTemplate :: getValue($this->datasource, $field);
}
- function getDatasourceComponent()
- {
- return $this;
- }
-
function registerDataSource($datasource)
{
- $this->datasource = new WactArrayObject($datasource);
+ $this->datasource = $datasource;
}
function getDataSource()
{
return $this->datasource;
}
-
- function offsetGet($offset)
- {
- return $this->get($offset);
- }
-
- function offsetSet($offset, $value)
- {
- $this->set($offset, $value);
- }
-
- function offsetExists($offset)
- {
- return isset($this->datasource[$offset]);
- }
-
- function offsetUnset($offset)
- {
- unset($this->datasource[$offset]);
- }
}
Modified: 3.x/trunk/limb/wact/src/components/WactRuntimeComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/WactRuntimeComponent.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/WactRuntimeComponent.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -87,10 +87,6 @@
return parent :: getDatasource();
}
- function getDatasourceComponent()
- {
- return parent :: getDatasourceComponent();
- }
/**
* Set the data source of a child component, or raise an error
* if the child is not found.
Modified: 3.x/trunk/limb/wact/src/components/components.inc.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/components.inc.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/components.inc.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -14,6 +14,5 @@
require_once(dirname(__FILE__) . '/WactRuntimeComponent.class.php');
require_once(dirname(__FILE__) . '/WactDatasourceRuntimeComponent.class.php');
require_once(dirname(__FILE__) . '/WactRuntimeTagComponent.class.php');
-require_once(dirname(__FILE__) . '/WactArrayObject.class.php');
require_once(dirname(__FILE__) . '/WactArrayIterator.class.php');
Modified: 3.x/trunk/limb/wact/src/components/form/WactFormComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactFormComponent.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/form/WactFormComponent.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,24 +21,25 @@
protected $state_vars = array();
- protected $_datasource;
+ public $datasource;
- protected function _ensureDataSourceAvailable()
+ function __construct($id)
{
- if (!isset($this->_datasource))
- $this->registerDataSource(new ArrayObject());
+ parent :: __construct($id);
+ $this->datasource = array();
}
function get($name)
{
- $this->_ensureDataSourceAvailable();
- return $this->_datasource->get($name);
+ return WactTemplate :: getValue($this->datasource, $name);
}
+ /**
+ * Set a named property in the form DataSource
+ */
function set($name, $value)
{
- $this->_ensureDataSourceAvailable();
- $this->_datasource->set($name, $value);
+ WactTemplate :: setValue($this->datasource, $name, $value);
}
/**
@@ -51,8 +52,7 @@
*/
function getValue($name)
{
- $this->_ensureDataSourceAvailable();
- return $this->_datasource->get($name);
+ return WactTemplate :: getValue($this->datasource, $name);
}
/**
@@ -60,23 +60,17 @@
*/
function setValue($name, $value)
{
- $this->_ensureDataSourceAvailable();
- $this->_datasource->set($name, $value);
+ WactTemplate :: setValue($this->datasource, $name, $value);
}
- function prepare()
- {
- $this->_ensureDataSourceAvailable();
- }
-
function registerDataSource($datasource)
{
- $this->_datasource = WactTemplate :: makeObject($datasource);
+ $this->datasource = $datasource;
}
function getDataSource()
{
- return $this->_datasource;
+ return $this->datasource;
}
/**
Modified: 3.x/trunk/limb/wact/src/components/form/WactGroupedOptionsSelectComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactGroupedOptionsSelectComponent.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/form/WactGroupedOptionsSelectComponent.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/src/components/form/WactOptionRenderer.class.php');
@@ -30,7 +30,7 @@
{
foreach($groups as $group)
{
- if(!$options = $group->get('options'))
+ if(!$options = WactTemplate :: getValue($group,'options'))
continue;
echo '<optgroup ';
@@ -45,8 +45,7 @@
protected function _renderOptGroupTagAttributes($group, $level)
{
- $attrs = $group->export();
- foreach($attrs as $key => $value)
+ foreach($group as $key => $value)
{
if($key == 'options' || is_object($value))
continue;
Modified: 3.x/trunk/limb/wact/src/components/form/WactSelectOptionsSourceComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactSelectOptionsSourceComponent.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/form/WactSelectOptionsSourceComponent.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -65,6 +65,12 @@
if($this->dataset)
return $this->_exportDataSetAsChoices($choices);
+ if(is_array($this->datasource))
+ {
+ $this->dataset = $this->datasource;
+ return $this->_exportDatasetAsChoices($choices);
+ }
+
if(is_object($this->datasource))
{
if(method_exists($this->datasource, 'export'))
@@ -93,8 +99,7 @@
}
elseif(!$this->field_for_id || !$this->field_for_name)
{
- $raw = $record->export();
- $choices[key($raw)] = current($raw);
+ $choices[key($record)] = current($record);
}
elseif($this->field_for_id && $this->field_for_name)
$choices[$record[$this->field_for_id]] = $record[$this->field_for_name];
Modified: 3.x/trunk/limb/wact/src/components/iterator/WactBaseIteratorComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/iterator/WactBaseIteratorComponent.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/components/iterator/WactBaseIteratorComponent.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -121,7 +121,7 @@
if($dataset->valid())
$record = $dataset->current();
else
- $record = new WactArrayObject();
+ $record = array();
$this->_passRecordToBuffer($record);
}
Modified: 3.x/trunk/limb/wact/src/tags/core/set.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/core/set.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/core/set.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once 'limb/wact/src/compiler/property/WactConstantProperty.class.php';
Modified: 3.x/trunk/limb/wact/src/tags/form/form.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/form/form.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/form/form.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -51,11 +51,6 @@
return $this->ServerId;
}
- function generateBeforeOpenTag($code_writer)
- {
- $code_writer->writePHP($this->getComponentRefCode() . '->prepare();');
- }
-
function generateBeforeCloseTag($code_writer)
{
$code_writer->writePHP($this->getComponentRefCode() . '->renderState();');
Modified: 3.x/trunk/limb/wact/src/tags/form/form_referer.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/form/form_referer.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/form/form_referer.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -20,9 +20,9 @@
$ref = $code->getTempVarRef();
$ds = $code->getTempVarRef();
- $code->writePHP($ds . ' =' . $this->getComponentRefCode() . ';');
+ $code->writePHP($ds . ' =' . $this->getDatasourceRefCode() . ';');
- $code->writePHP("if(!$ref = {$ds}->get('referer'))\n");
+ $code->writePHP("if(!$ref = WactTemplate :: getValue({$ds}, 'referer'))\n");
if($this->getBoolAttribute('use_current'))
$code->writePHP($ref . ' = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";' . "\n");
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-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/list/list_fill.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -9,7 +9,7 @@
/**
* Compile time component for output finalizers in a list
- * Allows to generate valid layout while output multicolumb lists
+ * Allows to generate valid layout while output multicolumn lists
* Default ratio attribute is 1
*
* @tag list:FILL
@@ -57,7 +57,7 @@
$code->writePhp("if ({$items_left_var}){\n");
- $code->writePhp($this->getDataSource()->getComponentRefCode() . "['" . $this->var_name . "'] = {$items_left_var};");
+ $code->writePhp($this->getDatasource()->getComponentRefCode() . "->set('" . $this->var_name . "', {$items_left_var});");
parent :: generateTagContent($code);
Modified: 3.x/trunk/limb/wact/src/tags/pager/current.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/current.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/current.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -22,8 +22,8 @@
$code->writePhp('if (' . $parent->getComponentRefCode() . '->isDisplayedPage()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' . $parent->getComponentRefCode() . '->getDisplayedPageUri();' . "\n");
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["number"] = ' . $parent->getComponentRefCode() . '->getPage();' . "\n");
+ $code->writePhp($this->getDatasourceRefCode() . '["href"] = ' . $parent->getComponentRefCode() . '->getDisplayedPageUri();' . "\n");
+ $code->writePhp($this->getDatasourceRefCode() . '["number"] = ' . $parent->getComponentRefCode() . '->getPage();' . "\n");
parent :: generateTagContent($code);
Modified: 3.x/trunk/limb/wact/src/tags/pager/first.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/first.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/first.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,7 +21,7 @@
$parent = $this->findParentByClass('WactPagerNavigatorTag');
$code->writePhp('if (!' . $parent->getComponentRefCode() . '->isFirst()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' .
+ $code->writePhp($this->getDataSourceRefCode() . '["href"] = ' .
$parent->getComponentRefCode() . '->getFirstPageUri();' . "\n");
parent :: generateTagContent($code);
Modified: 3.x/trunk/limb/wact/src/tags/pager/last.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/last.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/last.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,7 +21,7 @@
$parent = $this->findParentByClass('WactPagerNavigatorTag');
$code->writePhp('if (!' . $parent->getComponentRefCode() . '->isLast()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' .
+ $code->writePhp($this->getDataSourceRefCode() . '["href"] = ' .
$parent->getComponentRefCode() . '->getLastPageUri();' . "\n");
parent :: generateTagContent($code);
Modified: 3.x/trunk/limb/wact/src/tags/pager/next.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/next.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/next.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,7 +21,7 @@
$parent = $this->findParentByClass('WactPagerNavigatorTag');
$code->writePhp('if (' . $parent->getComponentRefCode() . '->hasNext()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' .
+ $code->writePhp($this->getDataSourceRefCode() . '["href"] = ' .
$parent->getComponentRefCode() . '->getPageUri( ' .
$parent->getComponentRefCode() . '->getDisplayedPage() + 1 );' . "\n");
Modified: 3.x/trunk/limb/wact/src/tags/pager/number.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/number.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/number.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,8 +21,8 @@
$parent = $this->findParentByClass('WactPagerNavigatorTag');
$code->writePhp('if (!' . $parent->getComponentRefCode() . '->isDisplayedPage()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' . $parent->getComponentRefCode() . '->getPageUri();' . "\n");
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["number"] = ' . $parent->getComponentRefCode() . '->getPage();' . "\n");
+ $code->writePhp($this->getDataSourceRefCode() . '["href"] = ' . $parent->getComponentRefCode() . '->getPageUri();' . "\n");
+ $code->writePhp($this->getDataSourceRefCode() . '["number"] = ' . $parent->getComponentRefCode() . '->getPage();' . "\n");
parent :: generateTagContent($code);
Modified: 3.x/trunk/limb/wact/src/tags/pager/prev.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/prev.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/prev.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,7 +21,7 @@
$parent = $this->findParentByClass('WactPagerNavigatorTag');
$code->writePhp('if (' . $parent->getComponentRefCode() . '->hasPrev()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' .
+ $code->writePhp($this->getDataSourceRefCode() . '["href"] = ' .
$parent->getComponentRefCode() . '->getPageUri( ' .
$parent->getComponentRefCode() . '->getDisplayedPage() - 1 );' . "\n");
Modified: 3.x/trunk/limb/wact/src/tags/pager/section.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/section.tag.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/section.tag.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -21,9 +21,9 @@
$parent = $this->findParentByClass('WactPagerNavigatorTag');
$code->writePhp('if (!' . $parent->getComponentRefCode() . '->isDisplayedSection()) {');
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["href"] = ' . $parent->getComponentRefCode() . '->getSectionUri();' . "\n");
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["number_begin"] = ' . $parent->getComponentRefCode() . '->getSectionBeginPage();' . "\n");
- $code->writePhp($this->getDataSource()->getComponentRefCode() . '["number_end"] = ' . $parent->getComponentRefCode() . '->getSectionEndPage();' . "\n");
+ $code->writePhp($this->getDataSourceRefCode() . '["href"] = ' . $parent->getComponentRefCode() . '->getSectionUri();' . "\n");
+ $code->writePhp($this->getDataSourceRefCode() . '["number_begin"] = ' . $parent->getComponentRefCode() . '->getSectionBeginPage();' . "\n");
+ $code->writePhp($this->getDataSourceRefCode() . '["number_end"] = ' . $parent->getComponentRefCode() . '->getSectionEndPage();' . "\n");
parent :: generateTagContent($code);
Modified: 3.x/trunk/limb/wact/src/tags/pager/total_pages.prop.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/pager/total_pages.prop.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/src/tags/pager/total_pages.prop.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
Modified: 3.x/trunk/limb/wact/tests/cases/compiler/compile_tree_node/WactCompileTreeNodeTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/compiler/compile_tree_node/WactCompileTreeNodeTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/compiler/compile_tree_node/WactCompileTreeNodeTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/src/compiler/templatecompiler.inc.php');
@@ -128,16 +128,16 @@
function testGetDataSource()
{
$parent = new MockWactCompileTreeNode();
- $ds = new WactArrayObject();
+ $ds = new ArrayObject();
$parent->setReturnValue('getDataSource', $ds);
$this->component->parent = $parent;
- $this->assertIsA($this->component->getDataSource(), 'WactArrayObject');
+ $this->assertIsA($this->component->getDataSource(), 'ArrayObject');
}
function testGetParentDataSource() {
/* This test case is broken
$parent = &new MockWactCompileTreeNode($this);
- $ds = new WactArrayObject();
+ $ds = new ArrayObject();
$testparent = new MockWactCompileTreeNode($this);
$testparent->expectCallCount('getDataSource', 1);
$mockds->parent = & $testparent;
Modified: 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactDataBindingExpressionNodeTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactDataBindingExpressionNodeTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactDataBindingExpressionNodeTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -357,7 +357,6 @@
function testGenerateExpressionForRegularCompileTreeNode()
{
$code_writer = new WactCodeWriter();
-
$root = new WactCompileTreeRootNode();
$context = new MockWactCompileTreeNode();
@@ -366,7 +365,7 @@
$DBE = new WactDataBindingExpressionNode('Test', $context);
$DBE->generateExpression($code_writer);
- $this->assertEqual($code_writer->getCode(), '<?php $root->get(\'Test\')');
+ $this->assertEqual($code_writer->getCode(), '<?php WactTemplate::getValue($root->datasource,\'Test\')');
}
function testGenerateExpressionWithRootModifier()
@@ -379,8 +378,20 @@
$DBE = new WactDataBindingExpressionNode('#Test', $context);
$DBE->generateExpression($code_writer);
+ $this->assertEqual($code_writer->getCode(), '<?php WactTemplate::getValue($root->datasource,\'Test\')');
+ }
- $this->assertEqual($code_writer->getCode(), '<?php $root->get(\'Test\')');
+ function testGenerateExpressionWithPointModifierUsedForArrayIndexOperations()
+ {
+ $code_writer = new WactCodeWriter();
+
+ $root = new WactCompileTreeRootNode();
+ $context = new WactCompileTreeNode();
+ $context->parent = $root;
+
+ $DBE = new WactDataBindingExpressionNode('.0', $context);
+ $DBE->generateExpression($code_writer);
+ $this->assertEqual($code_writer->getCode(), '<?php WactTemplate::getValue($root->datasource,0)');
}
function testGenerateExpressionWithLocalVariableModifier()
@@ -435,9 +446,9 @@
$DBE->generateExpression($code_writer);
$DBE->generatePostStatement($code_writer);
- $this->assertEqual($code_writer->getCode(), '<?php $A= WactTemplate :: makeObject($root->get(\'Test\'));'.
- '$B= WactTemplate :: makeObject($A->get(\'item1\'));'.
- '$B->get(\'item2\')');
+ $this->assertEqual($code_writer->getCode(), '<?php $A= WactTemplate::getValue($root->datasource,\'Test\');'.
+ '$B= WactTemplate::getValue($A,\'item1\');'.
+ 'WactTemplate::getValue($B,\'item2\')');
}
@@ -454,8 +465,7 @@
$DBE->generateExpression($code_writer);
$DBE->generatePostStatement($code_writer);
- $this->assertEqual($code_writer->getCode(), '<?php $A= WactTemplate :: makeObject($Test);'.
- '$A->get(\'var\')');
+ $this->assertEqual($code_writer->getCode(), '<?php WactTemplate::getValue($Test,\'var\')');
}
}
Modified: 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once 'limb/wact/src/compiler/templatecompiler.inc.php';
Modified: 3.x/trunk/limb/wact/tests/cases/filters/stats_filter.test.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/filters/stats_filter.test.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/filters/stats_filter.test.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/tests/cases/WactTemplateTestCase.class.php');
@@ -114,8 +114,8 @@
$this->registerTestingTemplate('/template/filter/stats_filter_aq2.html', $template);
$page = $this->initTemplate('/template/filter/stats_filter_aq2.html');
- $DS = new WactArrayObject(array());
- $DS->set('data', new WactArrayIterator(array(array('val'=>10),array('val'=>20),array('val'=>30))));
+ $DS = new ArrayObject(array());
+ $DS['data'] = new WactArrayIterator(array(array('val'=>10),array('val'=>20),array('val'=>30)));
$page->registerDataSource($DS);
Modified: 3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
/**
@@ -83,8 +83,7 @@
$form = $page->getChild('test');
- $data = new WactArrayObject();
- $data->set('Var', 'Foo');
+ $data = new ArrayObject(array('Var' => 'Foo'));
$form->registerDataSource($data);
$output = $page->capture();
@@ -100,8 +99,7 @@
$form = $page->getChild('test');
- $data = new WactArrayObject();
- $data->set('Var', 'Foo');
+ $data = new ArrayObject(array('Var' => 'Foo'));
$form->registerDataSource($data);
$output = $page->capture();
@@ -130,8 +128,7 @@
$form = $page->getChild('test');
- $data = new WactArrayObject();
- $data->set('Var', 'Foo');
+ $data = new ArrayObject(array('Var' => 'Foo'));
$form->registerDataSource($data);
$output = $page->capture();
@@ -147,8 +144,7 @@
$form = $page->getChild('test');
- $data = new WactArrayObject();
- $data->set('Var', 'Foo');
+ $data = new ArrayObject(array('Var' => 'Foo'));
$form->registerDataSource($data);
$output = $page->capture();
@@ -178,8 +174,7 @@
$form = $page->getChild('test');
- $data = new WactArrayObject();
- $data->set('Var', '&"\'<>');
+ $data = new ArrayObject(array('Var' => '&"\'<>'));
$form->registerDataSource($data);
$output = $page->capture();
Modified: 3.x/trunk/limb/wact/tests/cases/functional/WactTemplateFiltersTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/functional/WactTemplateFiltersTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/functional/WactTemplateFiltersTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
@@ -28,8 +28,7 @@
$page = $this->initTemplate('/template/filter/wactattributevarfilter.html');
$form = $page->getChild('test');
- $data = new WactArrayObject();
- $data->set('Var', 'Foo');
+ $data = new ArrayObject(array('Var' => 'Foo'));
$form->registerDataSource($data);
$output = $page->capture();
Modified: 3.x/trunk/limb/wact/tests/cases/tags/dev/WactDevSourceTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/dev/WactDevSourceTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/dev/WactDevSourceTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/tests/cases/WactTemplateTestCase.class.php');
@@ -17,7 +17,7 @@
$this->registerTestingTemplate('/tags/dev/source.tag', $template);
$page = $this->initTemplate('/tags/dev/source.tag');
- $this->assertWantedPattern('~\$root->get\(\'var\'\)~', $page->capture());
+ $this->assertWantedPattern('~WactTemplate::getValue\(\$root->datasource,\'var\'\)~', $page->capture());
}
}
Modified: 3.x/trunk/limb/wact/tests/cases/tags/fetch/WactFetchTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/fetch/WactFetchTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/fetch/WactFetchTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/src/components/fetch/WactFetcher.interface.php');
require_once('limb/wact/src/components/WactArrayIteratorDecorator.class.php');
@@ -41,9 +41,9 @@
function current()
{
$record = parent :: current();
- $data = $record->export();
+ $data = $record;
$data['full'] = $this->prefix1 . $data['title'] . '-' . $data['description'] . $this->prefix2;
- return new WactArrayObject($data);
+ return new ArrayObject($data);
}
}
Modified: 3.x/trunk/limb/wact/tests/cases/tags/form/WactFormTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/form/WactFormTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactFormTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/tests/cases/WactTemplateTestCase.class.php');
@@ -55,13 +55,6 @@
$this->assertFalse($errors->valid());
}
- function testPrepare()
- {
- $form = new WactFormComponent('my_id');
- $form->prepare();
- $this->assertIsA($form->getDataSource(), 'WactArrayObject');
- }
-
/**
* Should test registerFilter, prepare and registerDataSource but lazy right now...
*/
@@ -84,7 +77,7 @@
function testFormTagGeneratesLocalPHPVariableReferencingToForm()
{
$template = '<form id="testForm" runat="server">'.
- '<?php echo $testForm->get("test_value"); ?>'.
+ '<?php echo $testForm["test_value"]; ?>'.
'</form>';
$this->registerTestingTemplate('/tags/form/form/form_tag_generates_php_variable.html', $template);
@@ -252,10 +245,9 @@
function testPreserveState()
{
- $data = new WactArrayObject();
- $data->set('x','a');
- $data->set('y','b');
- $data->set('z','x < z');
+ $data = new ArrayObject(array('x' => 'a',
+ 'y' => 'b',
+ 'z' => 'x < z'));
$form = new WactFormComponent('my_id');
$form->registerDataSource($data);
Modified: 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputCheckboxTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputCheckboxTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputCheckboxTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once 'limb/wact/src/components/form/form.inc.php';
@@ -24,8 +24,7 @@
$form = $page->getChild('testForm');
- $data = new WactArrayObject(array('myInput' =>'foo'));
-
+ $data = new ArrayObject(array('myInput' =>'foo'));
$form->registerDataSource($data);
$input = $page->getChild('test');
@@ -46,8 +45,7 @@
$form = $page->getChild('testForm');
- $data = new WactArrayObject(array('myInput' => 'foo')); // foo is not equal to bar
-
+ $data = new ArrayObject(array('myInput' => 'foo')); // foo is not equal to bar
$form->registerDataSource($data);
$input = $page->getChild('test');
Modified: 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectMultipleComponentTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectMultipleComponentTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectMultipleComponentTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once 'limb/wact/src/components/form/form.inc.php';
@@ -133,8 +133,7 @@
$select->setChoices($choices);
// The selected values typed as strings
- $data = new WactArrayObject(array('multiple' => $selectedToString));
-
+ $data = new ArrayObject(array('multiple' => $selectedToString));
$form->registerDataSource($data);
ob_start();
@@ -157,8 +156,8 @@
$choices = array(1 => 'red',2 => 'green',3 => 'blue');
$select = $page->getChild('test');
$select->setChoices($choices);
- $object1 = new WactArrayObject(array('id' => 2));
- $object2 = new WactArrayObject(array('id' => 3));
+ $object1 = new ArrayObject(array('id' => 2));
+ $object2 = new ArrayObject(array('id' => 3));
$select->setSelection(array($object1, $object2));
$output = $page->capture();
@@ -180,8 +179,8 @@
$choices = array(1 => 'red',2 => 'green',3 => 'blue');
$select = $page->getChild('test');
$select->setChoices($choices);
- $object1 = new WactArrayObject(array('my_id' => 2));
- $object2 = new WactArrayObject(array('my_id' => 3));
+ $object1 = new ArrayObject(array('my_id' => 2));
+ $object2 = new ArrayObject(array('my_id' => 3));
$select->setSelection(array($object1, $object2));
$output = $page->capture();
Modified: 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectOptionsSourceTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectOptionsSourceTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectOptionsSourceTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
class WactSelectOptionsSourceTagTest extends WactTemplateTestCase
@@ -179,6 +179,5 @@
'<select id="select" name="select"><option value="" selected="true">select</option><option value="4">red</option><option value="5">blue</option></select>'.
'</form>');
}
-
}
Modified: 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectSingleComponentTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectSingleComponentTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectSingleComponentTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once 'limb/wact/src/components/form/form.inc.php';
@@ -85,7 +85,7 @@
$Select = $page->getChild('test');
$Select->setChoices($choices);
- $data = new WactArrayObject(array('mySelect' => $selectedKey));
+ $data = new ArrayObject(array('mySelect' => $selectedKey));
$Form->registerDataSource($data);
@@ -146,7 +146,7 @@
$choices = array(1 => 'red',2 => 'green',3 => 'blue');
$Select = $page->getChild('test');
$Select->setChoices($choices);
- $object = new WactArrayObject(array('id' => 2));
+ $object = new ArrayObject(array('id' => 2));
$Select->setSelection($object);
$output = $page->capture();
@@ -167,7 +167,7 @@
$choices = array(1 => 'red',2 => 'green',3 => 'blue');
$Select = $page->getChild('test');
$Select->setChoices($choices);
- $object = new WactArrayObject(array('my_id' => 2));
+ $object = new ArrayObject(array('my_id' => 2));
$Select->setSelection($object);
$output = $page->capture();
@@ -188,7 +188,7 @@
$choices = array(0 => '--', 'red' => 'R', 'green' => 'G', 'blue' => 'B');
$Select = $page->getChild('test');
$Select->setChoices($choices);
- $object = new WactArrayObject(array('my_id' => 'green'));
+ $object = new ArrayObject(array('my_id' => 'green'));
$Select->setSelection($object);
$output = $page->capture();
Modified: 3.x/trunk/limb/wact/tests/cases/tags/iterator/WactIteratorTransferTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/iterator/WactIteratorTransferTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/iterator/WactIteratorTransferTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
class WactIteratorTransferTagTest extends WactTemplateTestCase
@@ -71,7 +71,7 @@
$data = array(array('name'=> 'joe'),
array('name'=> 'ivan'));
- $page->set('object', new WactArrayObject(array('fathers' => $data)));
+ $page->set('object', new ArrayObject(array('fathers' => $data)));
$this->assertEqual($page->capture(), 'joe:ivan:');
}
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-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -43,7 +43,7 @@
function testListItemGeneratedLocalVariableInside()
{
- $template = '<list:LIST id="test"><list:ITEM id="father"><?php echo $father->get("First"); ?></list:ITEM></list:LIST>';
+ $template = '<list:LIST id="test"><list:ITEM id="father"><?php echo $father["First"]; ?></list:ITEM></list:LIST>';
$this->registerTestingTemplate('/tags/list/list_list_generates_local_php_variable.html', $template);
$page = $this->initTemplate('/tags/list/list_list_generates_local_php_variable.html');
@@ -243,9 +243,9 @@
'<list:ITEM>{$ListRowNumber}:{$First}</list:ITEM>'.
'</list:LIST>';
- $this->registerTestingTemplate('/limb/list_row_number_with_offset.html', $template);
+ $this->registerTestingTemplate('/tags/list/list_row_number_with_offset.html', $template);
- $page = $this->initTemplate('/limb/list_row_number_with_offset.html');
+ $page = $this->initTemplate('/tags/list/list_row_number_with_offset.html');
$list = $page->getChild('test');
@@ -636,5 +636,55 @@
$output = $page->capture();
$this->assertEqual($output, "0:George-0:Alexander-1:Benjamin-");
}
+
+ function testOutputPlainArrays()
+ {
+ $template = '<list:LIST id="test">'.
+ '<list:ITEM id="father">{$$father}</list:ITEM>'.
+ '</list:LIST>';
+
+ $this->registerTestingTemplate('/tags/list/output_plain_arrays.html', $template);
+
+ $page = $this->initTemplate('/tags/list/output_plain_arrays.html');
+ $page->setChildDataset('test', array('George', 'Alexander', 'Benjamin'));
+
+ $this->assertEqual($page->capture(), 'GeorgeAlexanderBenjamin');
+ }
+
+ function testOutputNestedPlainArrays()
+ {
+ $template = '<list:LIST id="test">'.
+ '<list:ITEM id="item">'.
+ '<list:list from="$item">:{$:Key}:<list:item id="father">{$$father}</list:item></list:list>'.
+ '</list:ITEM>'.
+ '</list:LIST>';
+
+ $this->registerTestingTemplate('/tags/list/output_nested_plain_arrays.html', $template);
+
+ $page = $this->initTemplate('/tags/list/output_nested_plain_arrays.html');
+
+ $page->setChildDataset('test', array('first' => array('George', 'Alexander', 'Benjamin'),
+ 'second' => array('Ivanov', 'Petrov', 'Sidorov')));
+
+ $this->assertEqual($page->capture(), ':first:GeorgeAlexanderBenjamin:second:IvanovPetrovSidorov');
+ }
+
+ function testOutputNestedPlainArraysIndexedFields()
+ {
+ $template = '<list:LIST id="test">'.
+ '<list:ITEM id="item">'.
+ ':{$:Key}:{$$item.0} or {$.0}-{$$item.1} or {$.1}'.
+ '</list:ITEM>'.
+ '</list:LIST>';
+
+ $this->registerTestingTemplate('/tags/list/output_nested_plain_arrays_indexed_fields.html', $template);
+
+ $page = $this->initTemplate('/tags/list/output_nested_plain_arrays_indexed_fields.html');
+
+ $page->setChildDataset('test', array('first' => array('Ivan', 'Ivanov'),
+ 'second' => array('Peter', 'Petrov')));
+
+ $this->assertEqual($page->capture(), ':first:Ivan or Ivan-Ivanov or Ivanov:second:Peter or Peter-Petrov or Petrov');
+ }
}
Modified: 3.x/trunk/limb/wact/tests/cases/tags/list/decorators.inc.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/list/decorators.inc.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/list/decorators.inc.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
class InnerDataSource extends IteratorIterator
@@ -20,7 +20,7 @@
function rewind()
{
$ns = $this->number_source->current();
- $Number = $ns->get('BaseNumber');
+ $Number = WactTemplate :: getValue($ns,'BaseNumber');
if (!empty($Number))
{
Modified: 3.x/trunk/limb/wact/tests/cases/tags/perform/WactPerformTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/perform/WactPerformTagTest.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/perform/WactPerformTagTest.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/src/components/perform/WactTemplateCommand.class.php');
@@ -13,7 +13,7 @@
function doPerform($value1, $value2)
{
$this->template->set('my_var', $value1); // root component is always a datasource
- $this->context_component->getDatasourceComponent()->set('my_var', $value2);
+ $this->context_component->set('my_var', $value2);
}
function doSetOtherText($text)
Modified: 3.x/trunk/limb/wact/tests/cases/tags/perform/WactSpecialTestingTemplateCommand.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/perform/WactSpecialTestingTemplateCommand.class.php 2007-10-05 14:12:03 UTC (rev 6385)
+++ 3.x/trunk/limb/wact/tests/cases/tags/perform/WactSpecialTestingTemplateCommand.class.php 2007-10-05 14:22:21 UTC (rev 6386)
@@ -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
*/
require_once('limb/wact/src/components/perform/WactTemplateCommand.class.php');
@@ -13,7 +13,7 @@
function doPerform($value1, $value2)
{
$this->template->set('my_var', $value1); // root component is always a datasource
- $this->context_component->getDatasourceComponent()->set('my_var', $value2);
+ $this->context_component->set('my_var', $value2);
}
}
More information about the limb-svn
mailing list