[limb-svn] r5875 - in 3.x/trunk/limb/wact: src/compiler/attribute src/compiler/parser src/compiler/tag_node src/components/form src/tags src/tags/datasource src/tags/form tests/cases/compiler/parser tests/cases/component/form tests/cases/functional tests/cases/tags tests/cases/tags/datasource tests/cases/tags/form

svn at limb-project.com svn at limb-project.com
Sun May 13 02:45:34 MSD 2007


Author: serega
Date: 2007-05-13 02:45:34 +0400 (Sun, 13 May 2007)
New Revision: 5875
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5875

Added:
   3.x/trunk/limb/wact/src/components/form/WactOptionRenderer.class.php
   3.x/trunk/limb/wact/src/components/form/WactSelectMultipleComponent.class.php
   3.x/trunk/limb/wact/src/tags/datasource/
   3.x/trunk/limb/wact/src/tags/datasource/datasource_push.tag.php
   3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRendererTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/datasource/
   3.x/trunk/limb/wact/tests/cases/tags/datasource/WactDatasourcePushTagTest.class.php
Removed:
   3.x/trunk/limb/wact/src/components/form/select.inc.php
   3.x/trunk/limb/wact/src/components/form/select_date.inc.php
   3.x/trunk/limb/wact/src/components/form/select_time.inc.php
   3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRenderTest.class.php
Modified:
   3.x/trunk/limb/wact/src/compiler/attribute/WactAttribute.class.php
   3.x/trunk/limb/wact/src/compiler/parser/WactTreeBuilder.class.php
   3.x/trunk/limb/wact/src/compiler/tag_node/WactGenericContainerHTMLTag.class.php
   3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php
   3.x/trunk/limb/wact/src/tags/form/select.tag.php
   3.x/trunk/limb/wact/tests/cases/compiler/parser/WactTreeBuilderTest.class.php
   3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php
   3.x/trunk/limb/wact/tests/cases/functional/WactGoodHtmlTest.class.php
   3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php
   3.x/trunk/limb/wact/tests/cases/tags/form/WactInputCheckboxTagTest.class.php
Log:
-- new tag <datasource:push> added. This tags works almost like <iterator:transfer> tag that is accepts from and to attribute. Note: for <datasource:push> from tag should have a form of regular outpur expression, e.g.: <datasource:push from='{$var}' target='target_component'>
-- now WACT allows to use tag attribute without any value. Like <input type='checkbox' checked>
-- select.inc.php files splitted into WactSelectMultipleComponent, WactSelectSingleComponent and WactOptionRenderer.
-- select_date.inc.php and select_time.inc.php removed

Modified: 3.x/trunk/limb/wact/src/compiler/attribute/WactAttribute.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/attribute/WactAttribute.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/compiler/attribute/WactAttribute.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -52,6 +52,9 @@
 
   function getValue()
   {
+    if(!count($this->fragments))
+      return null;
+
     $value = "";
     foreach( array_keys($this->fragments) as $key)
       $value .= $this->fragments[$key]->getValue();
@@ -62,6 +65,10 @@
   function generate($code_writer)
   {
     $code_writer->writeHTML(' ' . $this->name);
+
+    if(!count($this->fragments))
+      return;
+
     $code_writer->writeHTML('="');
 
     foreach( array_keys($this->fragments) as $key)

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-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/compiler/parser/WactTreeBuilder.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -297,21 +297,15 @@
   {
     foreach ($attrs as $name => $value)
     {
-      if(($value === NULL) && WACT_STRICT_MODE)
+      $attribute = new WactAttribute($name);
+      if($value !== NULL)
       {
-        throw new WactException('Attribute should have a value',
-                              array('file' => $location->getFile(),
-                                    'line' => $location->getLine(),
-                                    'tag' => $tag_node->getTag(),
-                                    'attribute' => $name));
+        $listener = new WactAttributeBlockAnalizerListener($attribute, $tag_node, $this->filter_dictionary);
+
+        $analizer = new WactBlockAnalizer();
+        $analizer->parse($value, $listener);
       }
 
-      $attribute = new WactAttribute($name);
-      $listener = new WactAttributeBlockAnalizerListener($attribute, $tag_node, $this->filter_dictionary);
-
-      $analizer = new WactBlockAnalizer();
-      $analizer->parse($value, $listener);
-
       $tag_node->addChildAttribute($attribute);
     }
   }

Modified: 3.x/trunk/limb/wact/src/compiler/tag_node/WactGenericContainerHTMLTag.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/compiler/tag_node/WactGenericContainerHTMLTag.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/compiler/tag_node/WactGenericContainerHTMLTag.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -22,7 +22,7 @@
   protected $runtimeIncludeFile;
   protected $runtimeComponentName = 'WactRuntimeTagComponent';
 
-  function generateBeforeOpenTag($code_writer)
+  function generateAfterOpenTag($code_writer)
   {
     $code_writer->writePHP($this->getComponentRefCode() . '->render();');
   }

Modified: 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/components/form/WactCheckableInputComponent.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -43,7 +43,7 @@
       return true;
     elseif($value && !$this->getAttribute('value'))
       return true;
-    elseif($this->getBoolAttribute('checked') && is_null($value))
+    elseif($this->hasAttribute('checked') && is_null($value))
       return true;
     elseif($value && $value != $this->getAttribute('value'))
       return false;

Added: 3.x/trunk/limb/wact/src/components/form/WactOptionRenderer.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactOptionRenderer.class.php	                        (rev 0)
+++ 3.x/trunk/limb/wact/src/components/form/WactOptionRenderer.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -0,0 +1,50 @@
+<?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: select.inc.php 5873 2007-05-12 17:17:45Z serega $
+ * @package    wact
+ */
+
+require_once 'limb/wact/src/components/form/form.inc.php';
+
+//--------------------------------------------------------------------------------
+/**
+* Deals with rendering option elements for HTML select tags
+* Simple renderer for OPTIONs.  Does not support disabled
+* and label attributes. Does not support OPTGROUP tags.
+*/
+class WactOptionRenderer
+{
+  /**
+  * Renders an option, sending directly to display.
+  * Called from WactSelectSingleComponent or WactSelectMultipleComponent
+  * in their renderContents() method
+  * @todo XTHML: selected="selected"
+  * @param string value to place within the option value attribute
+  * @param string contents of the option tag
+  * @param boolean whether the option is selected or not
+  * @return void
+  */
+  function renderOption($key, $contents, $selected)
+  {
+    echo '<option value="';
+    echo htmlspecialchars($key, ENT_QUOTES);
+    echo '"';
+    if ($selected) {
+        echo " selected=\"true\"";
+    }
+    echo '>';
+    if (empty($contents)) {
+        echo htmlspecialchars($key, ENT_QUOTES);
+    } else {
+        echo htmlspecialchars($contents, ENT_QUOTES);
+    }
+    echo '</option>';
+  }
+}
+?>
\ No newline at end of file

Added: 3.x/trunk/limb/wact/src/components/form/WactSelectMultipleComponent.class.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/WactSelectMultipleComponent.class.php	                        (rev 0)
+++ 3.x/trunk/limb/wact/src/components/form/WactSelectMultipleComponent.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -0,0 +1,150 @@
+<?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
+ */
+
+require_once 'limb/wact/src/components/form/WactFormElementComponent.class.php';
+require_once 'limb/wact/src/components/form/WactOptionRenderer.class.php';
+
+/**
+* Represents an HTML select multiple tag where multiple options
+* can be selected
+*/
+class WactSelectMultipleComponent extends WactFormElementComponent
+{
+  /**
+  * A associative array of choices to build the option list with
+  * @var array
+  * @access private
+  */
+  var $choice_list = array();
+
+  protected $default_selection = array();
+  /**
+  * The object responsible for rendering the option tags
+  * @var object
+  * @access private
+  */
+  var $option_handler;
+
+  /**
+  * Override WactFormElementComponent method to deal with name attributes containing
+  * PHP array syntax.
+  * @return array the contents of the value
+  * @access private
+  */
+  function getValue()
+  {
+    $form_component = $this->findParentByClass('WactFormComponent');
+    $name = str_replace('[]', '', $this->getAttribute('name'));
+    return $form_component->getValue($name);
+  }
+
+  /**
+  * Sets the choice list. Passed an associative array, the keys become the
+  * contents of the option value attributes and the values in the array
+  * become the text contents of the option tag e.g.
+  * <code>
+  * $choices = array ( 4 => 'red', 5=>'blue', 6=>'green' );
+  * </code>
+  * ...becomes...
+  * <pre>
+  * <select multiple>
+  *   <option value="4">red</option>
+  *   <option value="5">blue</option>
+  *   <option value="6">green</option>
+  * </select>
+  * </pre>
+  * @see setSelection()
+  * @param array
+  * @return void
+  * @access public
+  */
+  function setChoices($choice_list)
+  {
+    $this->choice_list = $choice_list;
+  }
+
+  function addToChoices($key, $value)
+  {
+    $this->choice_list[$key] = $value;
+  }
+
+  function prependToChoices($key, $value)
+  {
+    $this->choice_list = array($key => $value) + $this->choice_list;
+  }
+
+  function addToDefaultSelection($selection)
+  {
+    $this->default_selection[] = $selection;
+  }
+
+  function setSelection($selection)
+  {
+    $form_component = $this->findParentByClass('WactFormComponent');
+    $name = str_replace('[]', '', $this->getAttribute('name'));
+    $form_component->setValue($name, $selection);
+  }
+
+  /**
+  * Sets object responsible for rendering the options
+  * Supply your own WactOptionRenderer if the default
+  * is too simple
+  * @see WactOptionRenderer
+  * @param object
+  * @return void
+  * @access public
+  */
+  function setOptionRenderer($option_handler) {
+      $this->option_handler = $option_handler;
+  }
+
+  /**
+  * Renders the contents of the the select tag, option tags being built by
+  * the option handler. Called from with a compiled template render function.
+  * @return void
+  * @access public
+  */
+  function renderContents()
+  {
+    $values = $this->getValue();
+    if(!is_object($values) && !is_array($values))
+      $values = $this->default_selection;
+
+    if(empty($this->option_handler))
+      $this->option_handler = new WactOptionRenderer();
+
+    if(!$select_field = $this->getAttribute('select_field'))
+      $select_field = 'id';
+
+    foreach($this->choice_list as $key => $choice)
+    {
+      $selected = false;
+      foreach($values as $value)
+      {
+        if(is_scalar($value) && $key == $value)
+        {
+          $selected = true;
+          break;
+        }
+        elseif(!is_scalar($value) && $value[$select_field] == $key)
+        {
+          $selected = true;
+          break;
+        }
+      }
+
+      $this->option_handler->renderOption($key, $choice, $selected);
+    }
+  }
+}
+
+?>
\ No newline at end of file

Deleted: 3.x/trunk/limb/wact/src/components/form/select.inc.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/select.inc.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/components/form/select.inc.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -1,297 +0,0 @@
-<?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
- */
-
-require_once 'limb/wact/src/components/form/form.inc.php';
-
-/**
-* Represents an HTML select multiple tag where multiple options
-* can be selected
-*/
-class WactSelectMultipleComponent extends WactFormElementComponent
-{
-  /**
-  * A associative array of choices to build the option list with
-  * @var array
-  * @access private
-  */
-  var $choice_list = array();
-
-  protected $default_selection = array();
-  /**
-  * The object responsible for rendering the option tags
-  * @var object
-  * @access private
-  */
-  var $option_handler;
-
-  /**
-  * Override WactFormElementComponent method to deal with name attributes containing
-  * PHP array syntax.
-  * @return array the contents of the value
-  * @access private
-  */
-  function getValue()
-  {
-    $form_component = $this->findParentByClass('WactFormComponent');
-    $name = str_replace('[]', '', $this->getAttribute('name'));
-    return $form_component->getValue($name);
-  }
-
-  /**
-  * Sets the choice list. Passed an associative array, the keys become the
-  * contents of the option value attributes and the values in the array
-  * become the text contents of the option tag e.g.
-  * <code>
-  * $choices = array ( 4 => 'red', 5=>'blue', 6=>'green' );
-  * </code>
-  * ...becomes...
-  * <pre>
-  * <select multiple>
-  *   <option value="4">red</option>
-  *   <option value="5">blue</option>
-  *   <option value="6">green</option>
-  * </select>
-  * </pre>
-  * @see setSelection()
-  * @param array
-  * @return void
-  * @access public
-  */
-  function setChoices($choice_list)
-  {
-    $this->choice_list = $choice_list;
-  }
-
-  function addToChoices($key, $value)
-  {
-    $this->choice_list[$key] = $value;
-  }
-
-  function prependToChoices($key, $value)
-  {
-    $this->choice_list = array($key => $value) + $this->choice_list;
-  }
-
-  function addToDefaultSelection($selection)
-  {
-    $this->default_selection[] = $selection;
-  }
-
-  function setSelection($selection)
-  {
-    $form_component = $this->findParentByClass('WactFormComponent');
-    $name = str_replace('[]', '', $this->getAttribute('name'));
-    $form_component->setValue($name, $selection);
-  }
-
-  /**
-  * Sets object responsible for rendering the options
-  * Supply your own WactOptionRenderer if the default
-  * is too simple
-  * @see WactOptionRenderer
-  * @param object
-  * @return void
-  * @access public
-  */
-  function setOptionRenderer($option_handler) {
-      $this->option_handler = $option_handler;
-  }
-
-  /**
-  * Renders the contents of the the select tag, option tags being built by
-  * the option handler. Called from with a compiled template render function.
-  * @return void
-  * @access public
-  */
-  function renderContents()
-  {
-    $values = $this->getValue();
-    if(!is_object($values) && !is_array($values))
-      $values = $this->default_selection;
-
-    if(empty($this->option_handler))
-      $this->option_handler = new WactOptionRenderer();
-
-    if(!$select_field = $this->getAttribute('select_field'))
-      $select_field = 'id';
-
-    foreach($this->choice_list as $key => $choice)
-    {
-      $selected = false;
-      foreach($values as $value)
-      {
-        if(is_scalar($value) && $key == $value)
-        {
-          $selected = true;
-          break;
-        }
-        elseif(!is_scalar($value) && $value[$select_field] == $key)
-        {
-          $selected = true;
-          break;
-        }
-      }
-
-      $this->option_handler->renderOption($key, $choice, $selected);
-    }
-  }
-}
-
-//--------------------------------------------------------------------------------
-/**
-* Deals with rendering option elements for HTML select tags
-* Simple renderer for OPTIONs.  Does not support disabled
-* and label attributes. Does not support OPTGROUP tags.
-* @package    wact
-*/
-class WactOptionRenderer {
-
-  /**
-  * Renders an option, sending directly to display.
-  * Called from WactSelectSingleComponent or WactSelectMultipleComponent
-  * in their renderContents() method
-  * @todo XTHML: selected="selected"
-  * @param string value to place within the option value attribute
-  * @param string contents of the option tag
-  * @param boolean whether the option is selected or not
-  * @return void
-  * @access private
-  */
-  function renderOption($key, $contents, $selected)
-  {
-    echo '<option value="';
-    echo htmlspecialchars($key, ENT_QUOTES);
-    echo '"';
-    if ($selected) {
-        echo " selected=\"true\"";
-    }
-    echo '>';
-    if (empty($contents)) {
-        echo htmlspecialchars($key, ENT_QUOTES);
-    } else {
-        echo htmlspecialchars($contents, ENT_QUOTES);
-    }
-    echo '</option>';
-  }
-}
-
-//--------------------------------------------------------------------------------
-/**
-* Represents an HTML select tag where only a single option can
-* be selected
-* @package    wact
-*/
-class WactSelectSingleComponent extends WactFormElementComponent
-{
-  /**
-  * A associative array of choices to build the option list with
-  * @var array
-  * @access private
-  */
-  var $choice_list = array();
-
-  protected $default_selection = null;
-  /**
-  * The object responsible for rendering the option tags
-  * @var object
-  * @access private
-  */
-  var $option_handler;
-
-  /**
-  * Sets the choice list. Passed an associative array, the keys become the
-  * contents of the option value attributes and the values in the array
-  * become the text contents of the option tag e.g.
-  * <code>
-  * $choices = array ( 4 => 'red', 5=>'blue', 6=>'green' );
-  * </code>
-  * ...becomes...
-  * <pre>
-  * <select>
-  *   <option value="4">red</option>
-  *   <option value="5">blue</option>
-  *   <option value="6">green</option>
-  * </select>
-  * </pre>
-  * @see setSelection()
-  * @param array
-  * @return void
-  * @access public
-  */
-  function setChoices($choice_list)
-  {
-    $this->choice_list = $choice_list;
-  }
-
-  function addToChoices($key, $value)
-  {
-    $this->choice_list[$key] = $value;
-  }
-
-  function prependToChoices($key, $value)
-  {
-    $this->choice_list = array($key => $value) + $this->choice_list;
-  }
-
-  function addToDefaultSelection($selection)
-  {
-    $this->default_selection = $selection;
-  }
-
-  function setSelection($selection)
-  {
-    $form_component = $this->findParentByClass('WactFormComponent');
-    $form_component->setValue($this->getAttribute('name'), $selection);
-  }
-
-  /**
-  * Sets object responsible for rendering the options
-  * Supply your own WactOptionRenderer if the default
-  * is too simple
-  * @see WactOptionRenderer
-  */
-  function setOptionRenderer($option_handler)
-  {
-    $this->option_handler = $option_handler;
-  }
-
-  /**
-  * Renders the contents of the the select tag, option tags being built by
-  * the option handler. Called from with a compiled template render function.
-  */
-  function renderContents()
-  {
-    $value = $this->getValue();
-    if(is_null($value))
-      $value = $this->default_selection;
-
-    if(!is_object($this->option_handler))
-      $this->option_handler = new WactOptionRenderer();
-
-    if(!$select_field = $this->getAttribute('select_field'))
-      $select_field = 'id';
-
-    if(!is_scalar($value))
-      $selected = $value[$select_field];
-    else
-      $selected = $value;
-
-    foreach($this->choice_list as $key => $choice)
-    {
-      //special case, since in PHP "0 == 'bar'"
-      $set = ((string)$key) == $selected;
-      $this->option_handler->renderOption($key, $choice, $set);
-    }
-  }
-}
-
-?>
\ No newline at end of file

Deleted: 3.x/trunk/limb/wact/src/components/form/select_date.inc.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/select_date.inc.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/components/form/select_date.inc.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -1,308 +0,0 @@
-<?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
- */
-
-require_once 'limb/wact/src/components/form/form.inc.php';
-require_once 'select.inc.php';
-
-/**
- * extends WactSelectSingleComponent with new methods for month handling
- */
-class WactSelectMonth extends WactSelectSingleComponent
-{
-    /**
-     * @var string strftime() parameter for option tag contents
-     */
-    var $format = '&B';  // == long
-
-    /**
-     * @var string strftime() parameter for option tag values
-     */
-    var $valueFormat = '%m'; // == numeric
-
-    /**
-     * translate human-readable string in strftime() parameter
-     */
-    function getFormat($format) {
-        switch (strtolower($format)) {
-            case 'numeric':
-                return '%m';
-            case 'short':
-                return '%b';
-            case 'long':
-            default:
-                return '%B';
-        }
-    }
-
-    /**
-     * Allowed options are 'numeric', 'long', 'short'.
-     * @param string
-     */
-    function setValueFormat($format='numeric') {
-        $this->valueFormat = $this->getFormat($format);
-    }
-
-    /**
-     * Allowed options are 'numeric', 'long', 'short'.
-     * @param string
-     */
-    function setFormat($format='long') {
-        $this->format = $this->getFormat($format);
-    }
-
-    /**
-     * set option tag choices
-     */
-    function fillChoices() {
-        $months = array();
-        for ($i=1; $i<=12; $i++) {
-            $months[strftime($this->valueFormat, mktime(0, 0, 0, $i, 1, 2000))]
-                = strftime($this->format, mktime(0, 0, 0, $i, 1, 2000));
-        }
-        $this->setChoices($months);
-    }
-
-    /**
-     * set selection
-     */
-    function setSelectedMonth($m) {
-        $this->setSelection(strftime($this->valueFormat, mktime(0, 0, 0, $m, 1, 2000)));
-    }
-}
-//--------------------------------------------------------------------------------
-
-/**
- * Runtime form:selectdate API
- * @todo EXPERIMENTAL
- * @package    wact
- */
-class WactFormSelectDateComponent extends WactFormComponent
-{
-    var $selectYear = null;
-    var $selectMonth = null;
-    var $selectDay = null;
-    var $selectedTime = array();
-
-    var $setDefaultSelection = false;
-    var $asArray = false;
-    var $groupName;
-
-    /**
-     * the compiler complains if not defined...
-     */
-    function isVisible() {
-        return true;
-    }
-
-    /**
-     * @param string 'name' attribute of the form:selectdate tag
-     */
-    function setGroupName($name) {
-        $this->groupName = $name;
-    }
-
-    function setAsArray() {
-        $this->asArray = $this->getAttribute('asArray');
-    }
-
-    /**
-     * @param mixed int|string unix timestamp or ISO-8601 timestamp
-     * @param WactCodeWriter
-     * @return array
-     * @access private
-     */
-    function parseTime($time=null)
-    {
-        if (is_integer($time)) {
-            //$time = unix timestamp
-            return array(
-                'year'  => date('Y', $time),
-                'month' => date('m', $time),
-                'day'   => date('d', $time)
-            );
-        }
-        $len = (is_string($time)) ? strlen($time) : 0;
-        if ($len == 14) {
-            //$time = mysql timestamp YYYYMMDDHHMMSS
-            return array(
-                'year'  => (int)substr($time, 0, 4),
-                'month' => (int)substr($time, 4, 2),
-                'day'   => (int)substr($time, 6, 2),
-            );
-        }
-
-        if ($len == 10 || $len == 19) {
-            //$time = ISO-8601 timestamp YYYY-MM-DD or YYYY-MM-DD HH:MM:SS
-            return array(
-                'year'  => (int)substr($time, 0, 4),
-                'month' => (int)substr($time, 5, 2),
-                'day'   => (int)substr($time, 8, 2),
-            );
-        }
-        //if everything failed, try with strtotime
-        if (empty($time)) {
-            $time = 'now';
-        }
-        $time = strtotime($time);
-        if (!is_numeric($time) || $time == -1) {
-            $time = strtotime('now');
-        }
-        return array(
-            'year'  => date('Y', $time),
-            'month' => date('m', $time),
-            'day'   => date('d', $time),
-        );
-    }
-
-    /**
-     * build SelectSimpleComponent object and set options for years
-     */
-    function prepareYear()
-    {
-        $this->selectYear  = new WactSelectSingleComponent(); //SelectYear
-        $this->addChild($this->selectYear);
-
-        $start = ($this->hasAttribute('startYear') ? $this->getAttribute('startYear') : date('Y'));
-        $end   = ($this->hasAttribute('endYear') ? $this->getAttribute('endYear') : date('Y'));
-        if ((strpos($start.'', '+') !== false) || (strpos($start.'', '-') !== false)) {
-            $start += date('Y');
-        }
-        if ((strpos($end.'', '+') !== false) || (strpos($end.'', '-') !== false)) {
-            $end += date('Y');
-        }
-
-        $years = array();
-        for ($i=$start; $i<=$end; $i++) {
-            $years[$i] = $i;
-        }
-        $this->selectYear->setChoices($years);
-        if ($this->setDefaultSelection) {
-            $this->selectYear->setSelection($this->selectedTime['year']);
-        }
-
-        //maintain selection through pages
-        $form_component = $this->findParentByClass('WactFormComponent');
-
-        if ($y = $form_component->getValue($this->groupName.'_Year'))
-            $this->selectYear->setSelection($y);
-
-        if ($date = $form_component->getValue($this->groupName))
-        {
-            if (is_array($date) && array_key_exists('Year', $date))
-                $this->selectYear->setSelection($date['Year']);
-            else
-            {
-              $this->selectedTime = $this->parseTime($date);
-              $this->selectYear->setSelection($this->selectedTime['year']);
-            }
-        }
-    }
-
-    /**
-     * build SelectSimpleComponent object and set options for months
-     */
-    function prepareMonth()
-    {
-        $this->WactSelectMonth = new WactSelectMonth();
-        $this->addChild($this->WactSelectMonth);
-
-        if ($this->hasAttribute('monthValueFormat')) {
-            $this->WactSelectMonth->setValueFormat($this->getAttribute('monthValueFormat'));
-        }
-        if ($this->setDefaultSelection) {
-            $this->WactSelectMonth->setSelectedMonth($this->selectedTime['month']);
-        }
-
-        //maintain selection through pages
-        $FormComponent = &$this->findParentByClass('WactFormComponent');
-        if ($m = $FormComponent->getValue($this->groupName.'_Month')) {
-            $this->WactSelectMonth->setSelection($m);
-        }
-        if ($date = $FormComponent->getValue($this->groupName)) {
-            if (is_array($date) && array_key_exists('Month', $date)) {
-                $this->WactSelectMonth->setSelection($date['Month']);
-            } else {
-                $this->selectedTime = $this->parseTime($date);
-                $this->WactSelectMonth->setSelectedMonth($this->selectedTime['month']);
-            }
-        }
-    }
-
-    /**
-     * build SelectSimpleComponent object and set options for days
-     */
-    function prepareDay()
-    {
-
-        $this->selectDay = new WactSelectSingleComponent(); // new SelectDay
-        $this->addChild($this->selectDay);
-
-        $days = array();
-        for ($i=1; $i<=31; $i++) {
-            $days[$i] = $i;
-        }
-        $this->selectDay->setChoices($days);
-        if ($this->setDefaultSelection) {
-            $this->selectDay->setSelection($this->selectedTime['day']);
-        }
-
-        //maintain selection through pages
-        $FormComponent = &$this->findParentByClass('WactFormComponent');
-        if ($d = $FormComponent->getValue($this->groupName.'_Day')) {
-            $this->selectDay->setSelection($d);
-        }
-        if ($date = $FormComponent->getValue($this->groupName)) {
-            if (is_array($date) && array_key_exists('Day', $date)) {
-                $this->selectDay->setSelection($date['Day']);
-            } else {
-                $this->selectedTime = $this->parseTime($date);
-                $this->selectDay->setSelection($this->selectedTime['day']);
-            }
-        }
-    }
-
-    /**
-     * override default behaviour when onInitial() is called
-     */
-    function setSelection($time=null) {
-        if (is_null($time)) {
-            $time = time();
-        }
-        $this->selectedTime = $this->parseTime($time);
-        $this->setDefaultSelection = true;
-    }
-
-    /**
-     * @return WactSelectSingleComponent object
-     * @access protected
-     */
-    function getYear() {
-        return $this->selectYear;
-    }
-
-    /**
-     * @return WactSelectSingleComponent object
-     * @access protected
-     */
-    function getMonth() {
-        return $this->WactSelectMonth;
-    }
-
-    /**
-     * @return WactSelectSingleComponent object
-     * @access protected
-     */
-    function getDay() {
-        return $this->selectDay;
-    }
-}
-?>

Deleted: 3.x/trunk/limb/wact/src/components/form/select_time.inc.php
===================================================================
--- 3.x/trunk/limb/wact/src/components/form/select_time.inc.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/components/form/select_time.inc.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -1,237 +0,0 @@
-<?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
- */
-
-require_once 'limb/wact/src/components/form/form.inc.php';
-require_once 'select.inc.php';
-
-/**
- * Runtime form:selecttime API
- * @todo EXPERIMENTAL
- * @package    wact
- */
-class WactFormSelectTimeComponent extends WactFormComponent
-{
-    var $selectHour   = null;
-    var $selectMinute = null;
-    var $selectSecond = null;
-    var $selectedTime = array();
-
-    var $setDefaultSelection = false;
-    var $asArray = false;
-    var $groupName;
-
-    /**
-     * the compiler complains if not defined...
-     */
-    function isVisible() {
-        return true;
-    }
-
-    /**
-     * @param string 'name' attribute of the form:selecttime tag
-     */
-    function setGroupName($name) {
-        $this->groupName = $name;
-    }
-
-    function setAsArray() {
-        $this->asArray = $this->getAttribute('asArray');
-    }
-
-    /**
-     * @param mixed int|string unix timestamp or ISO-8601 timestamp
-     * @param WactCodeWriter
-     * @return array
-     * @access private
-     */
-    function parseTime($time=null)
-    {
-        if (is_integer($time)) {
-            //$time = unix timestamp
-            return array(
-                'hour'   => date('H', $time),
-                'minute' => date('i', $time),
-                'second' => date('s', $time)
-            );
-        }
-        $len = (is_string($time)) ? strlen($time) : 0;
-        if ($len == 14) {
-            //$time = mysql timestamp YYYYMMDDHHMMSS
-            return array(
-                'hour'   => (int)substr($time, 8, 2),
-                'minute' => (int)substr($time, 10, 2),
-                'second' => (int)substr($time, 12, 2),
-            );
-        }
-
-        if ($len == 19) {
-            //$time = ISO-8601 timestamp YYYY-MM-DD HH:MM:SS
-            return array(
-                'hour'   => (int)substr($time, 11, 2),
-                'minute' => (int)substr($time, 14, 2),
-                'second' => (int)substr($time, 17, 2),
-            );
-        }
-        //if everything failed, try with strtotime
-        if (empty($time)) {
-            $time = 'now';
-        }
-        $time = strtotime($time);
-        if (!is_numeric($time) || $time == -1) {
-            $time = strtotime('now');
-        }
-        return array(
-            'hour'   => date('H', $time),
-            'minute' => date('i', $time),
-            'second' => date('s', $time)
-        );
-    }
-
-    /**
-     * build SelectSimpleComponent object and set options for hours
-     */
-    function prepareHour()
-    {
-        $this->selectHour  = new WactSelectSingleComponent(); //SelectHour
-        $this->addChild($this->selectHour);
-
-        $use24hours = ($this->hasAttribute('use24hours') ? $this->getAttribute('use24hours') : true);
-
-        $hours = array();
-        $end = ($use24hours ? 24 : 12);
-        for ($i=1; $i<=$end; $i++) {
-            $hours[sprintf('%02d', $i)] = sprintf('%02d', $i);
-        }
-        $this->selectHour->setChoices($hours);
-        if ($this->setDefaultSelection) {
-            $this->selectHour->setSelection(($this->selectedTime['hour'] % $end));
-        }
-
-        //maintain selection through pages
-        $form_component = $this->findParentByClass('WactFormComponent');
-
-        if ($h = $form_component->getValue($this->groupName.'_Hour'))
-            $this->selectHour->setSelection($h);
-
-        if ($date = $form_component->getValue($this->groupName))
-        {
-          if (is_array($date) && array_key_exists('Hour', $date))
-            $this->selectHour->setSelection($date['Hour']);
-          else
-          {
-            $this->selectedTime = $this->parseTime($date);
-            $this->selectHour->setSelection($this->selectedTime['hour']);
-          }
-        }
-    }
-
-    /**
-     * build SelectSimpleComponent object and set options for minutes
-     */
-    function prepareMinute()
-    {
-
-        $this->selectMinute = new WactSelectSingleComponent(); // new SelectMinute
-        $this->addChild($this->selectMinute);
-
-        $minutes = array();
-        for ($i=1; $i<=60; $i++) {
-            $minutes[sprintf('%02d', $i)] = sprintf('%02d', $i);
-        }
-        $this->selectMinute->setChoices($minutes);
-        if ($this->setDefaultSelection) {
-            $this->selectMinute->setSelection($this->selectedTime['minute']);
-        }
-
-        //maintain selection through pages
-        $FormComponent = &$this->findParentByClass('WactFormComponent');
-        if ($m = $FormComponent->getValue($this->groupName.'_Minute')) {
-            $this->selectMinute->setSelection($m);
-        }
-        if ($date = $FormComponent->getValue($this->groupName)) {
-            if (is_array($date) && array_key_exists('Minute', $date)) {
-                $this->selectMinute->setSelection($date['Minute']);
-            } else {
-                $this->selectedTime = $this->parseTime($date);
-                $this->selectMinute->setSelection($this->selectedTime['minute']);
-            }
-        }
-    }
-
-    /**
-     * build SelectSimpleComponent object and set options for seconds
-     */
-    function prepareSecond()
-    {
-        $this->selectSecond = new WactSelectSingleComponent(); // new SelectSecond
-        $this->addChild($this->selectSecond);
-
-        $seconds = array();
-        for ($i=1; $i<=60; $i++) {
-            $seconds[sprintf('%02d', $i)] = sprintf('%02d', $i);
-        }
-        $this->selectSecond->setChoices($seconds);
-        if ($this->setDefaultSelection) {
-            $this->selectSecond->setSelection($this->selectedTime['second']);
-        }
-
-        //maintain selection through pages
-        $FormComponent = &$this->findParentByClass('WactFormComponent');
-        if ($s = $FormComponent->getValue($this->groupName.'_Second')) {
-            $this->selectSecond->setSelection($s);
-        }
-        if ($date = $FormComponent->getValue($this->groupName)) {
-            if (is_array($date) && array_key_exists('Second', $date)) {
-                $this->selectSecond->setSelection($date['Second']);
-            } else {
-                $this->selectedTime = $this->parseTime($date);
-                $this->selectSecond->setSelection($this->selectedTime['second']);
-            }
-        }
-    }
-
-    /**
-     * override default behaviour when onInitial() is called
-     */
-    function setSelection($time=null) {
-        if (is_null($time)) {
-            $time = time();
-        }
-        $this->selectedTime = $this->parseTime($time);
-        $this->setDefaultSelection = true;
-    }
-
-    /**
-     * @return WactSelectSingleComponent object
-     * @access protected
-     */
-    function getHour() {
-        return $this->selectHour;
-    }
-
-    /**
-     * @return WactSelectSingleComponent object
-     * @access protected
-     */
-    function getMinute() {
-        return $this->selectMinute;
-    }
-
-    /**
-     * @return WactSelectSingleComponent object
-     * @access protected
-     */
-    function getSecond() {
-        return $this->selectSecond;
-    }
-}
-?>

Added: 3.x/trunk/limb/wact/src/tags/datasource/datasource_push.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/datasource/datasource_push.tag.php	                        (rev 0)
+++ 3.x/trunk/limb/wact/src/tags/datasource/datasource_push.tag.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -0,0 +1,87 @@
+<?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
+ */
+require_once('limb/wact/src/tags/fetch/WactBaseFetchingTag.class.php');
+
+/**
+* @tag datasource:push
+* @req_const_attributes to
+* @req_attributes from
+* @forbid_end_tag
+*/
+class WactDatasourcePushTag extends WactCompilerTag
+{
+  function preParse()
+  {
+    if(!$this->hasAttribute('target') && !$this->hasAttribute('to'))
+      $this->raiseCompilerError('Required attribute not found',
+                                array('attribute' => 'target or to'));
+
+    if($this->hasAttribute('target') && $this->hasAttribute('to'))
+      $this->raiseCompilerError('Both target and to attribute are not supported');
+
+    $this->_fillToAttributeFromTargetAttribute();
+
+    return parent :: preParse();
+  }
+
+  function generateBeforeContent($code_writer)
+  {
+    foreach($this->_getExpressionsInTargetAttribute() as $expression)
+    {
+      $dbe = new WactDataBindingExpressionNode($expression, $this, $this->parent);
+      $datasource = $dbe->getDatasourceContext();
+      $field_name = $dbe->getFieldName();
+
+      if($field_name && !$datasource->isDatasource())
+        $this->raiseCompilerError('Wrong datasource path in target or to attribute',
+                                  array('expression' => $expression));
+
+      if(count($dbe->getPathToTargetDatasource()))
+      {
+        $this->raiseCompilerError('Path based variable is not supported in target or to attribute',
+                                  array('expression' => $expression));
+      }
+
+      $code_writer->writePHP($datasource->getComponentRefCode() . '->registerDatasource(');
+      $this->attributeNodes['from']->generateExpression($code_writer);
+      $code_writer->writePHP(');' . "\n");
+    }
+  }
+
+  protected function _fillToAttributeFromTargetAttribute()
+  {
+    if(!$this->hasAttribute('target'))
+      return;
+
+    $pieces = explode(',', $this->getAttribute('target'));
+
+    $to = array();
+    foreach($pieces as $piece)
+     $to[] = '[' . $piece . ']';
+
+    $this->setAttribute('to', implode(',', $to));
+  }
+
+  protected function _getExpressionsInTargetAttribute()
+  {
+    $result = array();
+
+    $pieces = explode(',', $this->getAttribute('to'));
+
+    foreach($pieces as $piece)
+     $result[] = trim($piece);
+
+    return $result;
+  }
+}
+
+?>
\ No newline at end of file

Modified: 3.x/trunk/limb/wact/src/tags/form/select.tag.php
===================================================================
--- 3.x/trunk/limb/wact/src/tags/form/select.tag.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/src/tags/form/select.tag.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -26,7 +26,7 @@
   {
     if ($this->getBoolAttribute('multiple'))
     {
-      $this->runtimeIncludeFile = 'limb/wact/src/components/form/select.inc.php';
+      $this->runtimeIncludeFile = 'limb/wact/src/components/form/WactSelectMultipleComponent.class.php';
       $this->runtimeComponentName = 'WactSelectMultipleComponent';
 
       // Repetition of ControlTag::prepare but required for special case
@@ -47,7 +47,7 @@
     }
     else
     {
-      $this->runtimeIncludeFile = 'limb/wact/src/components/form/select.inc.php';
+      $this->runtimeIncludeFile = 'limb/wact/src/components/form/WactSelectSingleComponent.class.php';
       $this->runtimeComponentName = 'WactSelectSingleComponent';
     }
 

Modified: 3.x/trunk/limb/wact/tests/cases/compiler/parser/WactTreeBuilderTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/compiler/parser/WactTreeBuilderTest.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/tests/cases/compiler/parser/WactTreeBuilderTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -353,26 +353,15 @@
                            $this->filter_dictionary);
   }
 
-  function testBuildTagNodeWithNullAttributeThrowsException()
+  function testBuildTagNodeWithNullAttribute()
   {
     $location = new WactSourceLocation('my_file', 5);
     $tag_info = new WactTagInfo('my_tag', 'WactNodeBuilderTestTag');
 
     $attrs = array('attr1' => null);
 
-    try
-    {
-      $node = $this->tree_builder->buildTagNode($tag_info, $tag = 'MY_TAG', $location, $attrs, $isEmpty = true);
-      $this->assertTrue(false);
-    }
-    catch (WactException $e)
-    {
-      $this->assertWantedPattern('/Attribute should have a value/', $e->getMessage());
-      $this->assertEqual($e->getParam('file'), 'my_file');
-      $this->assertEqual($e->getParam('line'), 5);
-      $this->assertEqual($e->getParam('tag'), 'MY_TAG');
-      $this->assertEqual($e->getParam('attribute'), 'attr1');
-    }
+    $node = $this->tree_builder->buildTagNode($tag_info, $tag = 'MY_TAG', $location, $attrs, $isEmpty = true);
+    $this->assertFalse($node->getAttribute('attr1'));
   }
 
   function testAddContentWithSimpleText()

Modified: 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/tests/cases/component/form/WactCheckableInputComponentTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -45,12 +45,6 @@
     $this->assertTrue($this->checkbox->isChecked());
   }
 
-  function testNotCheckedIfNotValueAndFalseCheckedAttribute()
-  {
-    $this->checkbox->setAttribute('checked', false);
-    $this->assertFalse($this->checkbox->isChecked());
-  }
-
   function testCheckedIfValueAttributeEqualFormValue()
   {
     $this->form->set('my_checkbox', 3);

Deleted: 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRenderTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRenderTest.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRenderTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -1,70 +0,0 @@
-<?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: WactOptionRenderTest.class.php 5202 2007-03-07 08:47:03Z serega $
- * @package    wact
- */
-
-require_once 'limb/wact/src/components/form/form.inc.php';
-require_once 'limb/wact/src/components/form/select.inc.php';
-
-class WactOptionRenderTest extends UnitTestCase
-{
-  protected $renderer;
-
-  function setUp()
-  {
-    $this->renderer=  new WactOptionRenderer();
-  }
-
-  function testRender()
-  {
-    ob_start();
-    $this->renderer->renderOption('foo','bar',FALSE);
-    $out = ob_get_contents();
-    ob_end_clean();
-    $this->assertEqual($out,'<option value="foo">bar</option>');
-  }
-
-  function testRenderNoContents()
-  {
-    ob_start();
-    $this->renderer->renderOption('foo','',$selected = FALSE);
-    $out = ob_get_contents();
-    ob_end_clean();
-    $this->assertEqual($out,'<option value="foo">foo</option>');
-  }
-
-  function testRenderEntities()
-  {
-    ob_start();
-    $this->renderer->renderOption('x > y','& v < z',$selected = FALSE);
-    $out = ob_get_contents();
-    ob_end_clean();
-    $this->assertEqual($out,'<option value="x &gt; y">&amp; v &lt; z</option>');
-  }
-
-  function testRenderEntitiesNoContents()
-  {
-    ob_start();
-    $this->renderer->renderOption('x > y', FALSE, $selected = FALSE);
-    $out = ob_get_contents();
-    ob_end_clean();
-    $this->assertEqual($out,'<option value="x &gt; y">x &gt; y</option>');
-  }
-
-  function testSelected()
-  {
-    ob_start();
-    $this->renderer->renderOption('foo','bar',TRUE);
-    $out = ob_get_contents();
-    ob_end_clean();
-    $this->assertEqual($out,'<option value="foo" selected="true">bar</option>');
-  }
-}
-?>

Copied: 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRendererTest.class.php (from rev 5872, 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRenderTest.class.php)
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRendererTest.class.php	                        (rev 0)
+++ 3.x/trunk/limb/wact/tests/cases/component/form/WactOptionRendererTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -0,0 +1,70 @@
+<?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: WactOptionRenderTest.class.php 5202 2007-03-07 08:47:03Z serega $
+ * @package    wact
+ */
+
+require_once 'limb/wact/src/components/form/form.inc.php';
+require_once 'limb/wact/src/components/form/WactOptionRenderer.class.php';
+
+class WactOptionRendererTest extends UnitTestCase
+{
+  protected $renderer;
+
+  function setUp()
+  {
+    $this->renderer=  new WactOptionRenderer();
+  }
+
+  function testRender()
+  {
+    ob_start();
+    $this->renderer->renderOption('foo','bar',FALSE);
+    $out = ob_get_contents();
+    ob_end_clean();
+    $this->assertEqual($out,'<option value="foo">bar</option>');
+  }
+
+  function testRenderNoContents()
+  {
+    ob_start();
+    $this->renderer->renderOption('foo','',$selected = FALSE);
+    $out = ob_get_contents();
+    ob_end_clean();
+    $this->assertEqual($out,'<option value="foo">foo</option>');
+  }
+
+  function testRenderEntities()
+  {
+    ob_start();
+    $this->renderer->renderOption('x > y','& v < z',$selected = FALSE);
+    $out = ob_get_contents();
+    ob_end_clean();
+    $this->assertEqual($out,'<option value="x &gt; y">&amp; v &lt; z</option>');
+  }
+
+  function testRenderEntitiesNoContents()
+  {
+    ob_start();
+    $this->renderer->renderOption('x > y', FALSE, $selected = FALSE);
+    $out = ob_get_contents();
+    ob_end_clean();
+    $this->assertEqual($out,'<option value="x &gt; y">x &gt; y</option>');
+  }
+
+  function testSelected()
+  {
+    ob_start();
+    $this->renderer->renderOption('foo','bar',TRUE);
+    $out = ob_get_contents();
+    ob_end_clean();
+    $this->assertEqual($out,'<option value="foo" selected="true">bar</option>');
+  }
+}
+?>

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-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/tests/cases/functional/WactGoodHtmlTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -17,7 +17,7 @@
 */
 class WactGoodHtmlTest extends WactTemplateTestCase
 {
-  function _testSelfClose()
+  function testSelfClose()
   {
     $template = '<BR /><BR />\n<BR />\n<B></B><BR />\n';
 
@@ -27,7 +27,7 @@
     $this->assertEqual($output, $template);
   }
 
-  function _testWactSelfCloseForbidden()
+  function testWactSelfCloseForbidden()
   {
     $template = '<core:SET Variable="Value" />';
 

Modified: 3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php	2007-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/tests/cases/functional/WactTagAttributesTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -339,24 +339,17 @@
     $this->assertEqual($output, '<form id="test" extra="&#039;">contents</form>');
   }
 
-  function testNullAttributesNotAllowedInStrictMode()
+  function testNullAttributeValue()
   {
     $template = '<P id="test" runat="server" extra>contents</P>';
 
     $this->registerTestingTemplate('/attributes/minimized_attribute.html', $template);
 
-    try
-    {
-      $page = $this->initTemplate('/attributes/minimized_attribute.html');
-      $this->assertTrue(false);
-    }
-    catch(WactException $e)
-    {
-      $this->assertWantedPattern('/Attribute should have a value/', $e->getMessage());
-    }
+    $page = $this->initTemplate('/attributes/minimized_attribute.html');
+    $this->assertEqual($page->capture(), '<P id="test" extra>contents</P>');
   }
 
-  function testEmptyAttributeValueIsAllowedInStrictMode()
+  function testEmptyAttributeValue()
   {
     $template = '<P id="test" extra="">contents</P>';
 

Added: 3.x/trunk/limb/wact/tests/cases/tags/datasource/WactDatasourcePushTagTest.class.php
===================================================================
--- 3.x/trunk/limb/wact/tests/cases/tags/datasource/WactDatasourcePushTagTest.class.php	                        (rev 0)
+++ 3.x/trunk/limb/wact/tests/cases/tags/datasource/WactDatasourcePushTagTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -0,0 +1,41 @@
+<?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 WactDatasourcePushTagTest extends WactTemplateTestCase
+{
+  function testPush()
+  {
+    $template = '<datasource:push from="{$#names}" to="[fathers]"/><core:datasource id="fathers">{$name}</core:datasource>';
+
+    $this->registerTestingTemplate('/tags/datasource/datasource_push.html', $template);
+
+    $page = $this->initTemplate('/tags/datasource/datasource_push.html');
+
+    $page->set('names', array('name'=> 'joe'));
+
+    $this->assertEqual($page->capture(), 'joe');
+  }
+
+  function testPushWithTargetAttribute()
+  {
+    $template = '<datasource:push from="{$#names}" target="fathers"/><core:datasource id="fathers">{$name}</core:datasource>';
+
+    $this->registerTestingTemplate('/tags/datasource/datasource_push_with_target_attribute.html', $template);
+
+    $page = $this->initTemplate('/tags/datasource/datasource_push_with_target_attribute.html');
+
+    $page->set('names', array('name'=> 'joe'));
+
+    $this->assertEqual($page->capture(), 'joe');
+  }
+}
+?>

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-05-12 17:21:35 UTC (rev 5874)
+++ 3.x/trunk/limb/wact/tests/cases/tags/form/WactInputCheckboxTagTest.class.php	2007-05-12 22:45:34 UTC (rev 5875)
@@ -41,7 +41,7 @@
   function testRemoveCheckedIfNoChecked()
   {
     $template = '<form id="testForm" runat="server">'.
-                '<input type="checkbox" id="test" name="myInput" runat="server" value="bar" checked="true"/>' .
+                '<input type="checkbox" id="test" name="myInput" runat="server" value="bar" checked />' .
                 '</form>';
     $this->registerTestingTemplate('/components/form/inputcheckbox/isunchecked.html', $template);
 



More information about the limb-svn mailing list