[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/tags/form/ -> input.tag.php (source)

   1  <?php
   2  //--------------------------------------------------------------------------------
   3  // Copyright 2003 Procata, Inc.
   4  // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
   5  //--------------------------------------------------------------------------------
   6  /**
   7  * @package WACT_TAG
   8  * @version $Id: input.tag.php,v 1.24 2004/11/18 04:22:48 jeffmoore Exp $
   9  * @see http://www.w3.org/TR/html4/interact/forms.html
  10  */
  11  
  12  /**
  13  * Include control tag
  14  */
  15  require_once WACT_ROOT . 'template/tags/form/control.inc.php';
  16  
  17  /**
  18  * Register the tag
  19  */
  20  $taginfo =& new TagInfo('input', 'InputTag');
  21  $taginfo->setDefaultLocation(LOCATION_CLIENT);
  22  $taginfo->setEndTag(ENDTAG_FORBIDDEN);
  23  $taginfo->setCompilerAttributes(array('errorclass', 'errorstyle', 'displayname'));
  24  $taginfo->setKnownParent('FormTag');
  25  TagDictionary::registerTag($taginfo, __FILE__);
  26  
  27  /**
  28  * Compile time component for building runtime InputComponents
  29  * Creates all the components beginning with the name Input
  30  * @see http://wact.sourceforge.net/index.php/InputTag
  31  * @access protected
  32  * @package WACT_TAG
  33  */
  34  class InputTag extends ControlTag {
  35      /**
  36      * File to include at runtime
  37      * @var string path to runtime component relative to WACT_ROOT
  38      * @access private
  39      */
  40      var $runtimeIncludeFile = '/template/components/form/form.inc.php';
  41  
  42      /**
  43      * Sets the runtimeComponentName property, depending on the type of
  44      * Input tag
  45      * @return void
  46      * @access protected
  47      */
  48  	function prepare() {
  49          $type = strtolower($this->getAttribute('type'));
  50          switch ($type) {
  51          case 'text':
  52              $this->runtimeComponentName = 'InputFormElement';
  53              break;
  54          case 'password':
  55              $this->runtimeComponentName = 'FormElement';
  56              break;
  57          case 'checkbox':
  58              $this->runtimeComponentName = 'CheckableFormElement';
  59              break;
  60          case 'submit':
  61              $this->runtimeComponentName = 'FormElement';
  62              break;
  63          case 'radio':
  64              $this->runtimeComponentName = 'CheckableFormElement';
  65              break;
  66          case 'reset':
  67              $this->runtimeComponentName = 'FormElement';
  68              break;
  69          case 'file':
  70              $this->runtimeComponentName = 'InputFileComponent';
  71              $this->runtimeIncludeFile = '/template/components/form/inputfile.inc.php';
  72              break;
  73          case 'hidden':
  74              $this->runtimeComponentName = 'InputFormElement';
  75              break;
  76          case 'image':
  77              $this->runtimeComponentName = 'InputFormElement';
  78              break;
  79          case 'button':
  80              $this->runtimeComponentName = 'InputFormElement';
  81              break;
  82          default:
  83              RaiseError('compiler', 'UNKNOWNINPUTYPE', array(
  84                  'file' => $this->SourceFile,
  85                  'line' => $this->StartingLineNo));
  86          }
  87          
  88          parent::prepare();
  89      }
  90  }
  91  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5