[limb-svn] r5878 - in 3.x/trunk/limb/wact: . src/compiler/expression src/compiler/expression/node src/compiler/parser src/compiler/tag_node src/tags/core src/tags/form src/tags/iterator src/tags/list tests/cases/compiler/expression tests/cases/functional tests/cases/tags/core tests/cases/tags/fetch tests/cases/tags/form tests/cases/tags/list

svn at limb-project.com svn at limb-project.com
Sun May 13 15:14:57 MSD 2007


Author: serega
Date: 2007-05-13 15:14:57 +0400 (Sun, 13 May 2007)
New Revision: 5878
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5878

Modified:
   3.x/trunk/limb/wact/error.inc.php
   3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php
   3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php
   3.x/trunk/limb/wact/src/compiler/parser/WactTreeBuilder.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactCompilerTag.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeComponentHTMLTag.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentHTMLTag.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentTag.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfo.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfoExtractor.class.php
   3.x/trunk/limb/wact/src/tags/core/datasource.tag.php
   3.x/trunk/limb/wact/src/tags/core/default.tag.php
   3.x/trunk/limb/wact/src/tags/core/optional.tag.php
   3.x/trunk/limb/wact/src/tags/form/control.inc.php
   3.x/trunk/limb/wact/src/tags/form/form.tag.php
   3.x/trunk/limb/wact/src/tags/form/select_options_source.tag.php
   3.x/trunk/limb/wact/src/tags/iterator/iterator_transfer.tag.php
   3.x/trunk/limb/wact/src/tags/list/list.tag.php
   3.x/trunk/limb/wact/tests/cases/compiler/expression/WactDataBindingExpressionNodeTest.class.php
   3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionValueParserTest.class.php
   3.x/trunk/limb/wact/tests/cases/functional/WactGoodHtmlTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDatasourceTagTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDefaultTagTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreSetTagTest.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/WactInputTagTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectOptionsSourceTagTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php
Log:
-- better exception message formating in WactException
-- new syntax for any dynamic attributes what were use to point at variables in runtime.
 For example: instead of <core:datasource from='var'> you should write <core:datasource from={$var}>
 The old syntax is supported for BC in almost all cases except complex cases with <list:list> like <list:list from='[data]var'> (should be <list:list from='{$#[date]var}'>
-- now it's possible to have dynamic "id" and "name" attribute for form elements.
-- now all datasource tags generates a php variable that referencing to themself. You can use this variables in php-blocks inside tags. For example:
   <list:LIST id="test"><list:ITEM id="father"><?php echo $father->get("First"); ?></list:ITEM></list:LIST>

 This variable has a name of tag ID.
-- WactCompilerTag :: hasConstantAttribute() added
-- WactCompilerTag :: generateAttributeList() removed since it should be in other class (WactRuntimeComponentHTMLTag)

Modified: 3.x/trunk/limb/wact/error.inc.php
===================================================================
--- 3.x/trunk/limb/wact/error.inc.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/error.inc.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -23,7 +23,7 @@
     else
       $this->params = $params;
 
-    $error_message = 'WACT exception: ' . $message . "\n" . var_export($this->params, true);
+    $error_message = 'WACT exception: ' . $message . "\n. Params : " . var_export($this->params, true);
 
     parent :: __construct($error_message);
   }

Modified: 3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/expression/WactExpressionValueParser.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -54,7 +54,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]+|[A-Za-z][A-Za-z0-9_.]*)/u');
     if ($token === FALSE)
       $this->raiseError("Expecting primary operand in expression.");
 
@@ -70,9 +70,9 @@
         $this->raiseError('Expecting ) in expression');
     }
     // one of the DBE context modifier
-    elseif($token == '^' || $token == '#' || $token == '[')
+    elseif($token == '^' || $token == '#' || $token == '[' || $token == ':')
     {
-      if (!($token2 = $this->getToken('/\G([A-Za-z^\[][A-Za-z0-9_.\[\]^]*)/u')))
+      if (!($token2 = $this->getToken('/\G([A-Za-z^:\[][A-Za-z0-9_.\[\]^]*)/u')))
         $this->raiseError("Expecting identifier after DBE modifier.");
 
       return new WactDataBindingExpressionNode($token . $token2, $this->context);

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-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/expression/node/WactDataBindingExpressionNode.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -81,9 +81,16 @@
         $this->datasource_context = null;
         $this->php_variable = true;
         $this->processed_expression = substr($this->processed_expression, 1);
-        continue;
+        return;
       }
 
+      // tag property
+      if ($modifier == ":")
+      {
+        $this->processed_expression = substr($this->processed_expression, 1);
+        return;
+      }
+
       // root context
       if ($modifier == "#")
       {

Modified: 3.x/trunk/limb/wact/src/compiler/parser/WactTreeBuilder.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/parser/WactTreeBuilder.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/parser/WactTreeBuilder.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -267,10 +267,16 @@
   function buildTagNode($tag_info, $tag, $location, $attrs, $is_empty = false, $has_closing_tag = true)
   {
     $tag_node = $this->_createTagNode($tag_info, $tag, $location);
+
     $this->_registerPropertiesInTagNode($tag_node);
+
     $tag_node->emptyClosedTag = $is_empty;
     $tag_node->hasClosingTag = $has_closing_tag;
+
+    $this->_convertAttributesToExpressionIfRequired($tag_node, $tag_info, $attrs);
+
     $this->_addAttributesToTagNode($tag_node, $location, $attrs);
+
     return $tag_node;
   }
 
@@ -310,6 +316,27 @@
     }
   }
 
+  // this code added to support old form of DBE expressions in some attributes
+  // like <core:optional for='var'> should actually be <core:optional
+  protected function _convertAttributesToExpressionIfRequired($tag_node, $tag_info, &$attributes)
+  {
+    foreach($tag_info->getConvertAttributesToExpressions() as $name)
+    {
+      if(!isset($attributes[$name]))
+        continue;
+
+      $value = $attributes[$name];
+
+      if(strpos($value, '{$') !== FALSE)
+        continue;
+
+      if($tag_node->isDataSource() && (strpos($value, '#') === FALSE))
+        $attributes[$name] = '{$^' . $value . '}';
+      else
+        $attributes[$name] = '{$' . $value . '}';
+    }
+  }
+
   function addContent($text, $location)
   {
     $listener = new WactContentBlockAnalizerListener($this, $location, $this->filter_dictionary);

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactCompilerTag.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactCompilerTag.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactCompilerTag.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -124,6 +124,11 @@
     return isset($this->attributeNodes[strtolower($attrib)]);
   }
 
+  function hasConstantAttribute($attrib)
+  {
+    return $this->hasAttribute($attrib) && $this->attributeNodes[strtolower($attrib)]->isConstant();
+  }
+
   /**
   * Return the value of a boolean attribute as a boolean.
   * ATTRIBUTE=ANYTHING  (true)
@@ -176,16 +181,6 @@
     return $attributes;
   }
 
-  function generateAttributeList($code_writer, $suppress = array())
-  {
-    $suppress = array_map('strtolower', $suppress);
-    foreach(array_keys($this->attributeNodes) as $key)
-    {
-      if (!in_array($key, $suppress))
-        $this->attributeNodes[$key]->generate($code_writer);
-    }
-  }
-
   function generateDynamicAttributeList($code_writer, $suppress = array())
   {
     $suppress = array_map('strtolower', $suppress);

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeComponentHTMLTag.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeComponentHTMLTag.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeComponentHTMLTag.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -30,7 +30,7 @@
 
   function generateExtraAttributes($code_writer)
   {
-    $this->generateDynamicAttributeList($code_writer);
+    $this->generateDynamicAttributeList($code_writer, $this->tag_info->getSuppressAttributes());
   }
 
   function generateBeforeContent($code_writer)

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentHTMLTag.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentHTMLTag.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentHTMLTag.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -19,20 +19,14 @@
     parent :: generateBeforeContent($code_writer);
 
     if($this->hasAttribute('from'))
-      $this->generateRegisterDatasource($code_writer, $this->getAttribute('from'));
-  }
+    {
+      $code_writer->writePHP($this->getComponentRefCode() . '->registerDataSource(');
+      $this->attributeNodes['from']->generateExpression($code_writer);
+      $code_writer->writePHP(');');
+    }
 
-  function generateRegisterDatasource($code_writer, $from)
-  {
-    $from_dbe = new WactDataBindingExpressionNode($from, $this->parent);
-
-    $from_dbe->generatePreStatement($code_writer);
-
-    $code_writer->writePHP($this->getComponentRefCode() . '->registerDataSource(');
-    $from_dbe->generateExpression($code_writer);
-    $code_writer->writePHP(');');
-
-    $from_dbe->generatePostStatement($code_writer);
+    $id = $this->getServerId();
+    $code_writer->writePHP('$' . $id . ' = ' . $this->getComponentRefCode() . ";\n");
   }
 
   function getDataSource()

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentTag.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentTag.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactRuntimeDatasourceComponentTag.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -19,20 +19,14 @@
   function generateBeforeContent($code_writer)
   {
     if($this->hasAttribute('from'))
-      $this->generateRegisterDatasource($code_writer, $this->getAttribute('from'));
-  }
+    {
+      $code_writer->writePHP($this->getComponentRefCode() . '->registerDataSource(');
+      $this->attributeNodes['from']->generateExpression($code_writer);
+      $code_writer->writePHP(');');
+    }
 
-  function generateRegisterDatasource($code_writer, $from)
-  {
-    $from_dbe = new WactDataBindingExpressionNode($from, $this->parent);
-
-    $from_dbe->generatePreStatement($code_writer);
-
-    $code_writer->writePHP($this->getComponentRefCode() . '->registerDataSource(');
-    $from_dbe->generateExpression($code_writer);
-    $code_writer->writePHP(');');
-
-    $from_dbe->generatePostStatement($code_writer);
+    $id = $this->getServerId();
+    $code_writer->writePHP('$' . $id . ' = ' . $this->getComponentRefCode() . ";\n");
   }
 
   function getDataSource()

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfo.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfo.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfo.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -1,14 +1,14 @@
-<?php
-/**
- * Limb Web Application Framework
- *
- * @link http://limb-project.com
- *
- * @copyright  Copyright &copy; 2004-2007 BIT
- * @license    LGPL http://www.gnu.org/copyleft/lesser.html
- * @version    $Id$
- * @package    wact
- */
+<?php
+/**
+ * Limb Web Application Framework
+ *
+ * @link http://limb-project.com
+ *
+ * @copyright  Copyright &copy; 2004-2007 BIT
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
+ * @version    $Id$
+ * @package    wact
+ */
 
 class WactTagInfo
 {
@@ -24,6 +24,8 @@
   public $RestrictSelfNesting = false;
   public $ForbidParsing = false;
   public $ForbidEndTag = false;
+  // this code here for BC only
+  public $ConvertAttributesToExpressions = array();
 
   function WactTagInfo($tag, $class)
   {
@@ -126,5 +128,16 @@
     if (!class_exists($this->TagClass) && isset($this->File))
       require_once $this->File;
   }
+
+  // this code here for BC only
+  function setConvertAttributesToExpressions($attributes)
+  {
+    $this->ConvertAttributesToExpressions = $attributes;
+  }
+
+  function getConvertAttributesToExpressions()
+  {
+    return $this->ConvertAttributesToExpressions;
+  }
 }
 ?>
\ No newline at end of file

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfoExtractor.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfoExtractor.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactTagInfoExtractor.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -49,7 +49,6 @@
 
   protected function _fillTagInfo($info)
   {
-
     if(isset($this->annotations['suppress_attributes']))
     {
       $attrs = $this->_processAttributesString($this->annotations['suppress_attributes']);
@@ -85,6 +84,14 @@
 
     if(isset($this->annotations['runat_as']))
       $info->setRunatAs($this->annotations['runat_as']);
+
+    // this code added to support old form of DBE expressions in some attributes
+    // like <core:optional for='var'> should actually be <core:optional for='{$var}'>
+    if(isset($this->annotations['convert_to_expression']))
+    {
+      $attrs = $this->_processAttributesString($this->annotations['convert_to_expression']);
+      $info->setConvertAttributesToExpressions($attrs);
+    }
   }
 
   function endClass()

Modified: 3.x/trunk/limb/wact/src/tags/core/datasource.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/core/datasource.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/core/datasource.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -13,6 +13,7 @@
 /**
 * Datasources act is "namespaces" for a template.
 * @tag core:DATASOURCE
+* @convert_to_expression from
 */
 class WactCoreDatasourceTag extends WactRuntimeDatasourceComponentTag
 {

Modified: 3.x/trunk/limb/wact/src/tags/core/default.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/core/default.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/core/default.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -13,28 +13,17 @@
 /**
  * Output a portion of the template if DBE property has a value at runtime
  * @tag core:DEFAULT
- * @req_const_attributes for
+ * @req_attributes for
+ * @convert_to_expression for
  */
 class WactCoreDefaultTag extends WactCompilerTag
 {
-  protected $DBE;
-
-  function prepare()
-  {
-    $this->DBE = new WactDataBindingExpressionNode($this->getAttribute('for'), $this);
-    $this->DBE->prepare();
-
-    parent::prepare();
-  }
-
   function generateTagContent($code)
   {
     $tempvar = $code->getTempVariable();
-    $this->DBE->generatePreStatement($code);
     $code->writePHP('$' . $tempvar . ' = ');
-    $this->DBE->generateExpression($code);
+    $this->attributeNodes['for']->generateExpression($code);
     $code->writePHP(';');
-    $this->DBE->generatePostStatement($code);
 
     $code->writePHP('if (is_scalar($' . $tempvar .' )) $' . $tempvar . ' = trim($' . $tempvar . ');');
     $code->writePHP('if (empty($' . $tempvar . ')) {');

Modified: 3.x/trunk/limb/wact/src/tags/core/optional.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/core/optional.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/core/optional.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -13,28 +13,17 @@
 /**
  * The opposite of the CoreDefaultTag
  * @tag core:OPTIONAL
- * @req_const_attributes for
+ * @req_attributes for
+ * @convert_to_expression for
  */
 class WactCoreOptionalTag extends WactCompilerTag
 {
-  protected $DBE;
-
-  function prepare()
-  {
-    $this->DBE = new WactDataBindingExpressionNode($this->getAttribute('for'), $this);
-    $this->DBE->prepare();
-
-    parent::prepare();
-  }
-
   function generateTagContent($code)
   {
     $tempvar = $code->getTempVariable();
-    $this->DBE->generatePreStatement($code);
     $code->writePHP('$' . $tempvar . ' = ');
-    $this->DBE->generateExpression($code);
+    $this->attributeNodes['for']->generateExpression($code);
     $code->writePHP(';');
-    $this->DBE->generatePostStatement($code);
 
     $code->writePHP('if (is_scalar($' . $tempvar .' )) $' . $tempvar . '= trim($' . $tempvar . ');');
     $code->writePHP('if (!empty($' . $tempvar . ')){');

Modified: 3.x/trunk/limb/wact/src/tags/form/control.inc.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/form/control.inc.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/form/control.inc.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -32,9 +32,9 @@
   {
     if ($this->hasAttribute('wact:id')) {
       return $this->getAttribute('wact:id');
-    } else if ($this->hasAttribute('id')) {
+    } else if ($this->hasConstantAttribute('id')) {
       return $this->getAttribute('id');
-    } else if ($this->hasAttribute('name')) {
+    } else if ($this->hasConstantAttribute('name')) {
       return str_replace('[]', '', $this->getAttribute('name'));
     } else if (!empty($this->ServerId)) {
       return $this->ServerId;
@@ -49,14 +49,14 @@
    */
   function prepare()
   {
-    if (!$this->getBoolAttribute('name')) {
-      if ( $this->getBoolAttribute('wact:id') ) {
+    if(!$this->hasAttribute('name'))
+    {
+      if($this->hasConstantAttribute('id'))
+        $this->setAttribute('name', $this->getAttribute('id'));
+      elseif ($this->hasAttribute('wact:id') )
         $this->setAttribute('name', $this->getAttribute('wact:id'));
-      } else if ( $this->getBoolAttribute('id') ) {
-        $this->setAttribute('name', $this->getAttribute('id'));
-      } else {
+      else
         $this->raiseRequiredAttributeError('name');
-      }
     }
 
     parent::prepare();

Modified: 3.x/trunk/limb/wact/src/tags/form/form.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/form/form.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/form/form.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -16,6 +16,7 @@
  * @suppress_attributes children_reuse_runat from
  * @runat client
  * @restrict_self_nesting
+ * @convert_to_expression from
  */
 class WactFormTag extends WactRuntimeDatasourceComponentHTMLTag
 {

Modified: 3.x/trunk/limb/wact/src/tags/form/select_options_source.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/form/select_options_source.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/form/select_options_source.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -15,6 +15,7 @@
 * @known_parent WactFormTag
 * @forbid_end_tag
 * @req_const_attributes target
+* @convert_to_expression from
 */
 class WactSelectOptionsSource extends WactRuntimeDatasourceComponentTag
 {

Modified: 3.x/trunk/limb/wact/src/tags/iterator/iterator_transfer.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/iterator/iterator_transfer.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/iterator/iterator_transfer.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -13,7 +13,8 @@
 
 /**
 * @tag iterator:TRANSFER
-* @req_const_attributes to from
+* @req_attributes to from
+* @convert_to_expression from
 */
 class WactIteratorTransferTag extends WactBaseFetchingTag
 {
@@ -24,22 +25,10 @@
   {
     parent :: generateBeforeContent($code);
 
-    $this->generateDereference($code);
+    $code->writePHP($this->getComponentRefCode() . '->registerDataset(');
+    $this->attributeNodes['from']->generateExpression($code);
+    $code->writePHP(');');
   }
-
-  function generateDereference($code_writer)
-  {
-    $from_dbe = new WactDataBindingExpressionNode($this->getAttribute('from'), $this);
-    $from_dbe->generatePreStatement($code_writer);
-
-    $code_writer->writePHP($this->getComponentRefCode() . '->registerDataset(');
-
-    $from_dbe->generateExpression($code_writer);
-
-    $code_writer->writePHP(');');
-
-    $from_dbe->generatePostStatement($code_writer);
-  }
 }
 
 ?>
\ No newline at end of file

Modified: 3.x/trunk/limb/wact/src/tags/list/list.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/list/list.tag.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/src/tags/list/list.tag.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -14,6 +14,7 @@
 /**
  * The parent compile time component for lists
  * @tag list:LIST
+ * @convert_to_expression from
  */
 class WactListListTag extends WactRuntimeComponentTag
 {
@@ -24,7 +25,9 @@
   {
     if ($this->hasAttribute('from'))
     {
-      $this->generateDereference($code_writer, $this->getAttribute('from'));
+      $code_writer->writePHP($this->getComponentRefCode() . '->registerDataset(');
+      $this->attributeNodes['from']->generateExpression($code_writer);
+      $code_writer->writePHP(');' . "\n");
     }
 
     $code_writer->writePHP($this->getComponentRefCode() . '->rewind();' . "\n");
@@ -42,19 +45,5 @@
       $code_writer->writePHP('}' . "\n");
     }
   }
-
-  function generateDereference($code_writer, $from)
-  {
-    $from_dbe = new WactDataBindingExpressionNode($from, $this->parent);
-    $from_dbe->generatePreStatement($code_writer);
-
-    $code_writer->writePHP($this->getComponentRefCode() . '->registerDataset(');
-
-    $from_dbe->generateExpression($code_writer);
-
-    $code_writer->writePHP(');' . "\n");
-
-    $from_dbe->generatePostStatement($code_writer);
-  }
 }
 ?>
\ No newline at end of file

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-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactDataBindingExpressionNodeTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -214,6 +214,18 @@
     $this->assertIdentical($DBE->getValue(), 'hello');
   }
 
+  function testPropertyPrefix()
+  {
+    $property = new WactConstantProperty('hello');
+
+    $context = new WactCompileTreeNode();
+    $context->registerProperty('Test', $property);
+
+    $DBE = new WactDataBindingExpressionNode(':Test', $context);
+
+    $this->assertIdentical($DBE->getValue(), 'hello');
+  }
+
   function testGetValueWithRootModifier()
   {
     $property = new WactConstantProperty('hello');

Modified: 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionValueParserTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionValueParserTest.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/compiler/expression/WactExpressionValueParserTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -254,6 +254,16 @@
     $this->assertIdentical($expr->getValue(),'hello');
   }
 
+  function testConstantPropertyWithNewSyntax()
+  {
+    $property = new WactConstantProperty('hello');
+
+    $this->root->registerProperty('Test', $property);
+
+    $expr = $this->parser->parse(':Test');
+    $this->assertIdentical($expr->getValue(),'hello');
+  }
+
   function testConstantPropertyFromRootContext()
   {
     $property = new WactConstantProperty('hello');
@@ -270,11 +280,20 @@
 
     $this->root->registerProperty('Test', $property);
 
-    //debugBreak();
     $expr = $this->parser->parse('^Test');
     $this->assertIdentical($expr->getValue(),'hello');
   }
 
+  function testConstantPropertyFromParentContextWithNewSyntax()
+  {
+    $property = new WactConstantProperty('hello');
+
+    $this->root->registerProperty('Test', $property);
+
+    $expr = $this->parser->parse('^:Test');
+    $this->assertIdentical($expr->getValue(),'hello');
+  }
+
   function testLocalVariableModifier()
   {
     $expr = $this->parser->parse('$Test');

Modified: 3.x/trunk/limb/wact/tests/cases/functional/WactGoodHtmlTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/functional/WactGoodHtmlTest.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/functional/WactGoodHtmlTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -39,7 +39,7 @@
 
   function testUnclosedHtmlTagInCoreOptional()
   {
-    $template = '<core:optional for="var"><tr></core:optional>';
+    $template = '<core:optional for="{$var}"><tr></core:optional>';
     $this->registerTestingTemplate('/goodhtml/unclosed_html_tag_in_core_optional.html', $template);
     $page = $this->initTemplate('/goodhtml/unclosed_html_tag_in_core_optional.html');
     $page->set('var', 1);

Modified: 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDatasourceTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDatasourceTagTest.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDatasourceTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -85,10 +85,9 @@
 
   function testFromAttributeDataTakenFromParent()
   {
-    $template =
-        '<core:datasource from="middle">' .
-        '{$Var}:{$^Var}:{$#Var}' .
-        '</core:datasource>';
+    $template = '<core:datasource from="{$^middle}">' .
+                '{$Var}:{$^Var}:{$#Var}' .
+                '</core:datasource>';
 
     $this->registerTestingTemplate('/tags/core/dataspace/from_attribute.html', $template);
     $page = $this->initTemplate('/tags/core/dataspace/from_attribute.html');
@@ -103,7 +102,7 @@
   {
     $template =
         '<core:datasource>' .
-        '<core:datasource from="#middle">' .
+        '<core:datasource from="{$#middle}">' .
         '{$Var}' .
         '</core:datasource>'.
         '</core:datasource>';
@@ -115,5 +114,21 @@
     $output = $page->capture();
     $this->assertEqual($output, 'middle');
   }
+
+  function testOldFormOfFromAttribute()
+  {
+    $template =
+        '<core:datasource from="middle">' .
+        '{$Var}:{$^Var}:{$#Var}' .
+        '</core:datasource>';
+
+    $this->registerTestingTemplate('/tags/core/dataspace/old_form_of_from_attribute.html', $template);
+    $page = $this->initTemplate('/tags/core/dataspace/old_form_of_from_attribute.html');
+    $page->set('Var', 'outer');
+    $page->set('middle', array('Var' => 'middle'));
+
+    $output = $page->capture();
+    $this->assertEqual($output, 'middle:outer:outer');
+  }
 }
 ?>
\ No newline at end of file

Modified: 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDefaultTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDefaultTagTest.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreDefaultTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -16,8 +16,8 @@
   {
     parent :: setUp();
 
-    $template = '<core:default for="Var">default</core:default>'.
-                '<core:optional for="Var">optional</core:optional>';
+    $template = '<core:default for="{$Var}">default</core:default>'.
+                '<core:optional for="{$Var}">optional</core:optional>';
     $this->registerTestingTemplate('/tags/core/default/default.html', $template);
   }
 
@@ -139,5 +139,16 @@
       $this->assertWantedPattern('/Missing required attribute/', $e->getMessage());
     }
   }
+
+  function testDBKept()
+  {
+    $template = '<core:default for="Var">default</core:default>'.
+                '<core:optional for="Var">optional</core:optional>';
+    $this->registerTestingTemplate('/tags/core/default/default_bc_kept.html', $template);
+    $page = $this->initTemplate('/tags/core/default/default_bc_kept.html');
+    $page->set('Var', 1);
+    $output = $page->capture();
+    $this->assertEqual($output, 'optional');
+  }
 }
 ?>
\ No newline at end of file

Modified: 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreSetTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreSetTagTest.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/core/WactCoreSetTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -163,8 +163,8 @@
 
   function testGenerateRuntimeExpressionOnlyByDefault()
   {
-    $template = '<core:optional for="item1"><core:SET color="yellow"/></core:optional>'.
-                '<core:optional for="item2"><core:SET color="green"/></core:optional>'.
+    $template = '<core:optional for="{$item1}"><core:SET color="yellow"/></core:optional>'.
+                '<core:optional for="{$item2}"><core:SET color="green"/></core:optional>'.
                 '{$color}';
     $this->registerTestingTemplate('/tags/core/set_value_in_runtime_only.html', $template);
 
@@ -175,8 +175,8 @@
 
   function testNotGenerateRuntimeExpressionIfSuchAttribute()
   {
-    $template = '<core:optional for="item1"><core:SET color="yellow" runtime="false"/></core:optional>'.
-                '<core:optional for="item2"><core:SET color="green" runtime="false"/></core:optional>'.
+    $template = '<core:optional for="{$item1}"><core:SET color="yellow" runtime="false"/></core:optional>'.
+                '<core:optional for="{$item2}"><core:SET color="green" runtime="false"/></core:optional>'.
                 '{$color}';
     $this->registerTestingTemplate('/tags/core/force_set_value_in_compiletime.html', $template);
 

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-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/fetch/WactFetchTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -125,7 +125,7 @@
   function testSaveDatasetToVarInDatasource()
   {
     $template = '<core:datasource id="data"/><fetch using="TestingFetchTagsDatasetFetcher" to="[data]var1"/>' .
-                '<list:LIST from="[data]var1"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
+                '<list:LIST from="{$#[data]var1}"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
 
     $this->registerTestingTemplate('/tags/fetch/save_dataset_to_datasource_buffer.html', $template);
 
@@ -137,19 +137,18 @@
   function testSaveDatasetToVarInWrongDatasourceThrowException()
   {
     $template = '<list:list id="data"/><fetch using="TestingFetchTagsDatasetFetcher" to="[data]var1"/>' .
-                '<list:LIST from="(data)var1"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
+                '<list:LIST from="{$[data]var1}"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
 
     $this->registerTestingTemplate('/tags/fetch/save_dataset_to_var_in_wrong_datasource.html', $template);
 
     try
     {
       $page = $this->initTemplate('/tags/fetch/save_dataset_to_var_in_wrong_datasource.html');
-      $page->capture(); // Need this line to show error if exception was not raised at compiletime
       $this->assertTrue(false);
     }
     catch(WactException $e)
     {
-      $this->assertWantedPattern('/Wrong DBE datasource context in buffer attribute/', $e->getMessage());
+      $this->assertWantedPattern('/None existing expression datasource context/', $e->getMessage());
       $this->assertEqual($e->getParam('expression'), '[data]var1');
     }
   }
@@ -157,7 +156,7 @@
   function testSaveDatasetToListList()
   {
     $template = '<list:list id="data"/><fetch using="TestingFetchTagsDatasetFetcher" to="[data]"/>' .
-                '<list:LIST from="[data]"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
+                 '<list:LIST from="{$#[data]}"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
 
     $this->registerTestingTemplate('/tags/fetch/save_dataset_to_list_list.html', $template);
 
@@ -169,7 +168,7 @@
   function testSaveDatasetToNonExistingTargetDatasourceThrowException()
   {
     $template = '<fetch using="TestingFetchTagsDatasetFetcher" to="[no_such_datasource]"/>' .
-                '<list:LIST from="(data)"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
+                '<list:LIST from="{$[data]}"><list:ITEM>{$title}|</list:ITEM></list:LIST>';
 
     $this->registerTestingTemplate('/tags/fetch/save_dataset_to_none_existing_target_datasource.html', $template);
 

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-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactFormTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -74,9 +74,9 @@
     $template = '<form id="testForm" runat="server">
                     <label id="testLabel" for="testId" runat="server">A label</label>
                 </form>';
-    $this->registerTestingTemplate('/components/form/findlabel.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/findlabel.html', $template);
 
-    $page = $this->initTemplate('/components/form/findlabel.html');
+    $page = $this->initTemplate('/tags/form/form/findlabel.html');
 
     $form = $page->getChild('testForm');
     $label = $page->getChild('testLabel');
@@ -84,14 +84,30 @@
     $this->assertReference($form->findLabel('testId', $form), $label);
   }
 
+  function testFormTagGeneratesLocalPHPVariableReferencingToForm()
+  {
+    $template = '<form id="testForm" runat="server">'.
+                '<?php echo $testForm->get("test_value"); ?>'.
+                '</form>';
+    $this->registerTestingTemplate('/tags/form/form/form_tag_generates_php_variable.html', $template);
+
+    $page = $this->initTemplate('/tags/form/form/form_tag_generates_php_variable.html');
+
+    $form = $page->getChild('testForm');
+    $form->registerDatasource(array('test_value' => "my_value"));
+
+    $expected = '<form id="testForm">my_value</form>';
+    $this->assertEqual($page->capture(), $expected);
+  }
+
   function testFindLabelNotFound()
   {
     $template = '<form id="testForm" runat="server">
                     <label id="testLabel" for="testId" runat="server">A label</label>
                 </form>';
-    $this->registerTestingTemplate('/components/form/findlabelnotfound.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/findlabelnotfound.html', $template);
 
-    $page = $this->initTemplate('/components/form/findlabelnotfound.html');
+    $page = $this->initTemplate('/tags/form/form/findlabelnotfound.html');
 
     $form = $page->getChild('testForm');
 
@@ -125,9 +141,9 @@
                     <input name="Input3" type="text" runat="server">
                 </form>';
 
-    $this->registerTestingTemplate('/components/form/seterrors.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/seterrors.html', $template);
 
-    $page = $this->initTemplate('/components/form/seterrors.html');
+    $page = $this->initTemplate('/tags/form/form/seterrors.html');
 
     $form = $page->getChild('testForm');
 
@@ -188,9 +204,9 @@
 
                 </form>';
 
-    $this->registerTestingTemplate('/components/form/seterrorstricky.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/seterrorstricky.html', $template);
 
-    $page = $this->initTemplate('/components/form/seterrorstricky.html');
+    $page = $this->initTemplate('/tags/form/form/seterrorstricky.html');
 
     $form = $page->getChild('testForm');
 
@@ -263,9 +279,9 @@
   function testKnownChildren()
   {
     $template = '<form id="test" runat="server"><input id="submit" type="submit" name="submit" value="hey"/></form>';
-    $this->registerTestingTemplate('/tags/form/knownchildren.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/knownchildren.html', $template);
 
-    $page = $this->initTemplate('/tags/form/knownchildren.html');
+    $page = $this->initTemplate('/tags/form/form/knownchildren.html');
     $this->assertIsA($page->findChild('test'),'WactFormComponent');
     $this->assertIsA($page->findChild('submit'),'WactFormElementComponent');
     $output = $page->capture();
@@ -275,9 +291,9 @@
   function testKnownChildrenReuseRunatTrue()
   {
     $template = '<form id="test" runat="server" children_reuse_runat="true"><input id="submit" type="submit" name="submit" value="hey"></form>';
-    $this->registerTestingTemplate('/tags/form/knownchildrenchildren_reuse_runattrue.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/knownchildrenchildren_reuse_runattrue.html', $template);
 
-    $page = $this->initTemplate('/tags/form/knownchildrenchildren_reuse_runattrue.html');
+    $page = $this->initTemplate('/tags/form/form/knownchildrenchildren_reuse_runattrue.html');
     $this->assertIsA($page->findChild('test'),'WactFormComponent');
     $this->assertIsA($page->findChild('submit'),'WactFormElementComponent');
     $output = $page->capture();
@@ -287,9 +303,9 @@
   function testKnownChildrenReuseRunatFalse()
   {
     $template = '<form id="test" runat="server" children_reuse_runat="fAlSe"><input id="submit" type="submit" name="submit" value="hey" /></form>';
-    $this->registerTestingTemplate('/tags/form/knownchildrenchildren_reuse_runatfalse.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/knownchildrenchildren_reuse_runatfalse.html', $template);
 
-    $page = $this->initTemplate('/tags/form/knownchildrenchildren_reuse_runatfalse.html');
+    $page = $this->initTemplate('/tags/form/form/knownchildrenchildren_reuse_runatfalse.html');
     $this->assertIsA($page->findChild('test'),'WactFormComponent');
     $this->assertFalse($page->findChild('submit'));
     $output = $page->capture();
@@ -299,9 +315,9 @@
   function testKnownChildrenRunatClient()
   {
     $template = '<form id="test" runat="server"><input id="submit" type="submit" name="submit" value="hey" runat="client" /></form>';
-    $this->registerTestingTemplate('/tags/form/knownchildrenuserunatclient.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/knownchildrenuserunatclient.html', $template);
 
-    $page = $this->initTemplate('/tags/form/knownchildrenuserunatclient.html');
+    $page = $this->initTemplate('/tags/form/form/knownchildrenuserunatclient.html');
     $this->assertIsA($page->findChild('test'),'WactFormComponent');
     $this->assertFalse($page->findChild('submit'));
     $output = $page->capture();
@@ -311,9 +327,9 @@
   function testNestedKnownChildren()
   {
     $template = '<form id="test" runat="server"><core:block name="block"><input id="submit" type="submit" name="submit" value="hey"/></core:block></form>';
-    $this->registerTestingTemplate('/tags/form/nestedknownchildren.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/nestedknownchildren.html', $template);
 
-    $page = $this->initTemplate('/tags/form/nestedknownchildren.html');
+    $page = $this->initTemplate('/tags/form/form/nestedknownchildren.html');
     $this->assertIsA($page->findChild('test'),'WactFormComponent');
     $this->assertIsA($page->findChild('submit'),'WactFormElementComponent');
     $output = $page->capture();
@@ -323,12 +339,12 @@
   function testIncludedKnownChildren()
   {
     $template = '<input id="submit" type="submit" name="submit" value="hey"/>';
-    $this->registerTestingTemplate('/tags/form/knowninclude.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/knowninclude.html', $template);
 
-    $template = '<form id="test" runat="server"><core:include file="/tags/form/knowninclude.html"/></form>';
-    $this->registerTestingTemplate('/tags/form/includedknownchildren.html', $template);
+    $template = '<form id="test" runat="server"><core:include file="/tags/form/form/knowninclude.html"/></form>';
+    $this->registerTestingTemplate('/tags/form/form/includedknownchildren.html', $template);
 
-    $page = $this->initTemplate('/tags/form/includedknownchildren.html');
+    $page = $this->initTemplate('/tags/form/form/includedknownchildren.html');
     $this->assertIsA($page->findChild('test'),'WactFormComponent');
     $this->assertIsA($page->findChild('submit'),'WactFormElementComponent');
     $output = $page->capture();
@@ -338,9 +354,9 @@
   function testGetServerIdWithID()
   {
     $template = '<form id="test" name="foo" runat="server"></form>';
-    $this->registerTestingTemplate('/tags/form/getserveridwithid.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/getserveridwithid.html', $template);
 
-    $page = $this->initTemplate('/tags/form/getserveridwithid.html');
+    $page = $this->initTemplate('/tags/form/form/getserveridwithid.html');
     $page->getChild('test');
     $this->assertNoErrors();
   }
@@ -348,9 +364,9 @@
   function testGetServerIdWithName()
   {
     $template = '<form name="foo" runat="server"></form>';
-    $this->registerTestingTemplate('/tags/form/getserveridwithname.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/getserveridwithname.html', $template);
 
-    $page = $this->initTemplate('/tags/form/getserveridwithname.html');
+    $page = $this->initTemplate('/tags/form/form/getserveridwithname.html');
     $page->getChild('foo');
     $this->assertNoErrors();
   }
@@ -361,15 +377,15 @@
     $this->assertTrue($FormTag->isDataSource());
   }
 
-  function testFromAttributeDataTakenFromParent()
+  function testFromAttribute()
   {
     $template =
-        '<form name="my_form" from="middle" runat="server">' .
+        '<form name="my_form" from="{$^middle}" runat="server">' .
         '{$Var}:{$^Var}:{$#Var}' .
         '</form>';
 
-    $this->registerTestingTemplate('/tags/core/form/from_attribute.html', $template);
-    $page = $this->initTemplate('/tags/core/form/from_attribute.html');
+    $this->registerTestingTemplate('/tags/form/form/from_attribute.html', $template);
+    $page = $this->initTemplate('/tags/form/form/from_attribute.html');
     $page->set('Var', 'outer');
     $page->set('middle', array('Var' => 'middle'));
 
@@ -377,29 +393,28 @@
     $this->assertEqual($output, '<form name="my_form">middle:outer:outer</form>');
   }
 
-  function testDBEFromAttribute()
+  function testFromAttributeWithOldSyntaxDataTakenFromParent()
   {
     $template =
-        '<core:datasource>' .
-        '<form  name="my_form" from="#middle" runat="server">' .
-        '{$Var}' .
-        '</form>'.
-        '</core:datasource>';
+        '<form name="my_form" from="middle" runat="server">' .
+        '{$Var}:{$^Var}:{$#Var}' .
+        '</form>';
 
-    $this->registerTestingTemplate('/tags/core/form/dbe_from_attribute.html', $template);
-    $page = $this->initTemplate('/tags/core/form/dbe_from_attribute.html');
+    $this->registerTestingTemplate('/tags/form/form/from_attribute_old_syntax.html', $template);
+    $page = $this->initTemplate('/tags/form/form/from_attribute_old_syntax.html');
+    $page->set('Var', 'outer');
     $page->set('middle', array('Var' => 'middle'));
 
     $output = $page->capture();
-    $this->assertEqual($output, '<form name="my_form">middle</form>');
+    $this->assertEqual($output, '<form name="my_form">middle:outer:outer</form>');
   }
 
   function testDynamicAttributes()
   {
     $template = '<form id="test" action="{$^action}" runat="server"></form>';
-    $this->registerTestingTemplate('/tags/form/dymanic_attribute.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/dymanic_attribute.html', $template);
 
-    $page = $this->initTemplate('/tags/form/dymanic_attribute.html');
+    $page = $this->initTemplate('/tags/form/form/dymanic_attribute.html');
     $page->set('action', 'my_action');
     $output = $page->capture();
     $this->assertEqual($output, '<form id="test" action="my_action"></form>');
@@ -408,9 +423,9 @@
   function testComplexDynamicAttributes()
   {
     $template = '<form id="test" action="{$^my.action}" runat="server"></form>';
-    $this->registerTestingTemplate('/tags/form/complex_dynamic_attribute.html', $template);
+    $this->registerTestingTemplate('/tags/form/form/complex_dynamic_attribute.html', $template);
 
-    $page = $this->initTemplate('/tags/form/complex_dynamic_attribute.html');
+    $page = $this->initTemplate('/tags/form/form/complex_dynamic_attribute.html');
     $page->set('my', array('action' => 'my_action'));
     $output = $page->capture();
     $this->assertEqual($output, '<form id="test" action="my_action"></form>');

Modified: 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputTagTest.class.php	2007-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -61,9 +61,9 @@
     $template ='<form id="testForm" runat="server">'.
                 '<input type="text" id="test" name="myInput" value="my_value" runat="server" />'.
                '</form>';
-    $this->registerTestingTemplate('/components/form/input_tag/value_from_form.html', $template);
+    $this->registerTestingTemplate('/tags/form/input/value_from_form.html', $template);
 
-    $page = $this->initTemplate('/components/form/input_tag/value_from_form.html');
+    $page = $this->initTemplate('/tags/form/input/value_from_form.html');
 
     $form = $page->getChild('testForm');
     $form->registerDataSource(array('myInput' => 'foo'));
@@ -79,9 +79,9 @@
     $template ='<form id="testForm" runat="server">'.
                '<input type="text" id="test" name="myInput" runat="server" given_value="{$#bar.var1}" />'.
                '</form>';
-    $this->registerTestingTemplate('/components/form/input_tag/use_given_value.html', $template);
+    $this->registerTestingTemplate('/tags/form/input/use_given_value.html', $template);
 
-    $page = $this->initTemplate('/components/form/input_tag/use_given_value.html');
+    $page = $this->initTemplate('/tags/form/input/use_given_value.html');
     $page->set('bar', array('var1' => 'other_value'));
 
     $form = $page->getChild('testForm');
@@ -96,9 +96,9 @@
   function testUseGivenValueWithoutForm()
   {
     $template = '<input type="text" id="test" name="myInput" runat="server" given_value="{$#bar}" />';
-    $this->registerTestingTemplate('/components/form/input_tag/use_given_value_without_form.html', $template);
+    $this->registerTestingTemplate('/tags/form/input/use_given_value_without_form.html', $template);
 
-    $page = $this->initTemplate('/components/form/input_tag/use_given_value_without_form.html');
+    $page = $this->initTemplate('/tags/form/input/use_given_value_without_form.html');
     $page->set('bar', 'other_value');
 
     $expected = '<input type="text" id="test" name="myInput" value="other_value" />';
@@ -110,14 +110,30 @@
     $template = '<form id="testForm" runat="server">'.
                  '<input type="text" id="test" name="myInput" runat="server"/>'.
                 '</form>';
-    $this->registerTestingTemplate('/components/form/input_tag/test_novalue.html', $template);
+    $this->registerTestingTemplate('/tags/form/input/test_novalue.html', $template);
 
-    $page = $this->initTemplate('/components/form/input_tag/test_novalue.html');
+    $page = $this->initTemplate('/tags/form/input/test_novalue.html');
 
     $expected = '<form id="testForm">'.
                 '<input type="text" id="test" name="myInput" value="" />'.
                 '</form>';
     $this->assertEqual($page->capture(), $expected);
   }
+
+  function testAllowToUseDynamicIdAttribute()
+  {
+    $template = '<form id="testForm" runat="server">'.
+                '<input type="text" id="{$test_value}" name="myInput" runat="server"/>'.
+                '</form>';
+    $this->registerTestingTemplate('/tags/form/input/dynamic_attribute.html', $template);
+
+    $page = $this->initTemplate('/tags/form/input/dynamic_attribute.html');
+    $page->setChildDatasource('testForm', array('test_value' => 'my_value'));
+
+    $expected = '<form id="testForm">'.
+                '<input type="text" name="myInput" value="" id="my_value" />'.
+                '</form>';
+    $this->assertEqual($page->capture(), $expected);
+  }
 }
 ?>
\ No newline at end of file

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-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactSelectOptionsSourceTagTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -18,11 +18,11 @@
                 '<select:OPTIONS_SOURCE target="select" from="source"/>' .
                 '</core:DATASOURCE>';
 
-    $this->registerTestingTemplate('/form/select_options_source/error.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/error.html', $template);
 
     try
     {
-      $page = $this->initTemplate('/form/select_options_source/error.html');
+      $page = $this->initTemplate('/tags/form/select_options_source/error.html');
       $this->assertTrue(false);
     }
     catch(WactException $e)
@@ -38,11 +38,11 @@
                 '<core:DATASOURCE id="select"></core:DATASOURCE>' .
                 '</core:DATASOURCE>';
 
-    $this->registerTestingTemplate('/form/select_options_source/not_supported.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/not_supported.html', $template);
 
     try
     {
-      $page = $this->initTemplate('/form/select_options_source/not_supported.html');
+      $page = $this->initTemplate('/tags/form/select_options_source/not_supported.html');
       $this->assertTrue(false);
     }
     catch(WactException $e)
@@ -54,15 +54,15 @@
   function testTakeOptionsFrom()
   {
     $template = '<core:DATASOURCE id="data">' .
-                '<select:OPTIONS_SOURCE target="select" from="source"/>' .
+                '<select:OPTIONS_SOURCE target="select" from="{$^source}"/>' .
                 '<form runat="server">' .
                 '<select id="select" name="select"></select>' .
                 '</form>' .
                 '</core:DATASOURCE>';
 
-    $this->registerTestingTemplate('/form/select_options_source/from.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/from.html', $template);
 
-    $page = $this->initTemplate('/form/select_options_source/from.html');
+    $page = $this->initTemplate('/tags/form/select_options_source/from.html');
 
     $data = $page->getChild('data');
     $data->set('source', $options = array('4' => 'red', '5' => 'blue'));
@@ -80,9 +80,9 @@
                 '<select id="select" name="select"></select>' .
                 '</form>';
 
-    $this->registerTestingTemplate('/form/select_options_source/register_dataset.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/register_dataset.html', $template);
 
-    $page = $this->initTemplate('/form/select_options_source/register_dataset.html');
+    $page = $this->initTemplate('/tags/form/select_options_source/register_dataset.html');
 
     $data = $page->getChild('source');
 
@@ -101,9 +101,9 @@
                 '<select id="select" name="select"></select>' .
                 '</form>';
 
-    $this->registerTestingTemplate('/form/select_options_source/use_name_and_id.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/use_name_and_id.html', $template);
 
-    $page = $this->initTemplate('/form/select_options_source/use_name_and_id.html');
+    $page = $this->initTemplate('/tags/form/select_options_source/use_name_and_id.html');
 
     $data = $page->getChild('source');
 
@@ -124,9 +124,9 @@
                 '<select id="select2" name="select2"></select>' .
                 '</form>';
 
-    $this->registerTestingTemplate('/form/select_options_source/several_targets.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/several_targets.html', $template);
 
-    $page = $this->initTemplate('/form/select_options_source/several_targets.html');
+    $page = $this->initTemplate('/tags/form/select_options_source/several_targets.html');
 
     $data = $page->getChild('source');
 
@@ -147,9 +147,9 @@
                 '<select id="select" name="select"></select>' .
                 '</form>';
 
-    $this->registerTestingTemplate('/form/select_options_source/with_default.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/with_default.html', $template);
 
-    $page = $this->initTemplate('/form/select_options_source/with_default.html');
+    $page = $this->initTemplate('/tags/form/select_options_source/with_default.html');
 
     $data = $page->getChild('source');
 
@@ -169,9 +169,9 @@
                 '<select id="select" name="select"></select>' .
                 '</form>';
 
-    $this->registerTestingTemplate('/form/select_options_source/register_datasource_and_default_option.html', $template);
+    $this->registerTestingTemplate('/tags/form/select_options_source/register_datasource_and_default_option.html', $template);
 
-    $page = $this->initTemplate('/form/select_options_source/register_datasource_and_default_option.html');
+    $page = $this->initTemplate('/tags/form/select_options_source/register_datasource_and_default_option.html');
 
     $data = $page->getChild('source');
 

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-05-13 05:18:20 UTC (rev 5877)
+++ 3.x/trunk/limb/wact/tests/cases/tags/list/WactListTagsTest.class.php	2007-05-13 11:14:57 UTC (rev 5878)
@@ -39,11 +39,24 @@
     $page = $this->initTemplate('/tags/list/list.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "George-Alexander-Benjamin-");
   }
 
+  function testListItemGeneratedLocalVariableInside()
+  {
+    $template = '<list:LIST id="test"><list:ITEM id="father"><?php echo $father->get("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');
+
+    $list = $page->getChild('test');
+    $list->registerDataSet($this->founding_fathers);
+    $output = $page->capture();
+    $this->assertEqual($output, "GeorgeAlexanderBenjamin");
+  }
+
   function testListSeparator()
   {
     $template = '<list:LIST id="test"><list:ITEM>{$First}'.
@@ -53,7 +66,7 @@
     $page = $this->initTemplate('/tags/list/separator.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "George-Alexander-Benjamin");
   }
@@ -132,7 +145,7 @@
     $page = $this->initTemplate('/tags/list/separator_with_unbalanced_content.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "George</tr><tr>Alexander</tr><tr>Benjamin");
   }
@@ -164,7 +177,7 @@
     $page = $this->initTemplate('/tags/list/separator_with_literal.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, 'George{$var}Alexander{$var}Benjamin');
   }
@@ -179,7 +192,7 @@
     $page = $this->initTemplate('/tags/list/default.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "George-Alexander-Benjamin-");
   }
@@ -207,7 +220,7 @@
     $page = $this->initTemplate('/tags/list/list-rownumber.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "1:George-2:Alexander-3:Benjamin-");
   }
@@ -234,8 +247,8 @@
   function testListRowOddProperty()
   {
     $template = '<list:LIST id="test"><list:ITEM>'.
-                '<core:optional for="ListRowOdd">odd</core:optional>'.
-                '<core:default for="ListRowOdd">even</core:default>'.
+                '<core:optional for="{$:ListRowOdd}">odd</core:optional>'.
+                '<core:default for="{$:ListRowOdd}">even</core:default>'.
                 ':{$First}-'.
                 '</list:ITEM></list:LIST>';
 
@@ -243,7 +256,7 @@
     $page = $this->initTemplate('/tags/list/list-rowodd.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "odd:George-even:Alexander-odd:Benjamin-");
   }
@@ -260,7 +273,7 @@
     $page = $this->initTemplate('/tags/list/list-roweven.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "odd:George-even:Alexander-odd:Benjamin-");
   }
@@ -273,23 +286,35 @@
     $page = $this->initTemplate('/tags/list/list-parity.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new WactArrayIterator($this->founding_fathers));
+    $list->registerDataSet($this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "odd:George-even:Alexander-odd:Benjamin-");
   }
 
   function testListFrom()
   {
-    $template = '<list:LIST from="test"><list:ITEM>{$First}-</list:ITEM></list:LIST>';
+    $template = '<list:LIST from="{$test}"><list:ITEM>{$First}-</list:ITEM></list:LIST>';
 
     $this->registerTestingTemplate('/tags/list/list_from.html', $template);
     $page = $this->initTemplate('/tags/list/list_from.html');
 
-    $page->set('test', new WactArrayIterator($this->founding_fathers));
+    $page->set('test', $this->founding_fathers);
     $output = $page->capture();
     $this->assertEqual($output, "George-Alexander-Benjamin-");
   }
 
+  function testListFromOldSyntaxForBC()
+  {
+    $template = '<list:LIST from="test"><list:ITEM>{$First}-</list:ITEM></list:LIST>';
+
+    $this->registerTestingTemplate('/tags/list/list_from_old_syntax.html', $template);
+    $page = $this->initTemplate('/tags/list/list_from_old_syntax.html');
+
+    $page->set('test', $this->founding_fathers);
+    $output = $page->capture();
+    $this->assertEqual($output, "George-Alexander-Benjamin-");
+  }
+
   function testNestedListOuterIdInnerFrom()
   {
      $template = '<list:LIST id="test"><list:ITEM>'.
@@ -301,7 +326,7 @@
     $page = $this->initTemplate('/tags/list/nested-id-from.html');
 
     $list = $page->getChild('test');
-    $list->registerDataSet(new NestedDataSetDecorator(new WactArrayIterator($this->founding_fathers)));
+    $list->registerDataSet(new NestedDataSetDecorator($this->founding_fathers));
     $output = $page->capture();
     $this->assertEqual($output, "George:value1 value3 value5 -Alexander:value1 value3 value5 -Benjamin:value1 value3 value5 -");
   }
@@ -316,7 +341,7 @@
     $this->registerTestingTemplate('/tags/list/nested-from-from.html', $template);
     $page = $this->initTemplate('/tags/list/nested-from-from.html');
 
-    $page->set('test',new NestedDataSetDecorator(new WactArrayIterator($this->founding_fathers)));
+    $page->set('test',new NestedDataSetDecorator($this->founding_fathers));
     $output = $page->capture();
     $this->assertEqual($output, "George:value1 value3 value5 -Alexander:value1 value3 value5 -Benjamin:value1 value3 value5 -");
   }



More information about the limb-svn mailing list