VCL
[ class tree: VCL ] [ index: VCL ] [ all elements ]

Source for file stdctrls.inc.php

Documentation is available at stdctrls.inc.php

  1. <?php
  2. /**
  3. *  This file is part of the VCL for PHP project
  4. *
  5. *  Copyright (c) 2004-2007 qadram software <support@qadram.com>
  6. *
  7. *  Checkout AUTHORS file for more information on the developers
  8. *
  9. *  This library is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU Lesser General Public
  11. *  License as published by the Free Software Foundation; either
  12. *  version 2.1 of the License, or (at your option) any later version.
  13. *
  14. *  This library is distributed in the hope that it will be useful,
  15. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. *  Lesser General Public License for more details.
  18. *
  19. *  You should have received a copy of the GNU Lesser General Public
  20. *  License along with this library; if not, write to the Free Software
  21. *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  22. *  USA
  23. *
  24. */
  25.  
  26. use_unit("classes.inc.php");
  27. use_unit("controls.inc.php");
  28. use_unit("db.inc.php");
  29.  
  30. /**
  31.  *
  32.  * Base class for DynAPI widgets
  33.  *
  34.  */
  35. class DWidget extends FocusControl
  36. {
  37.         protected $_DWidgetClassName="";
  38.  
  39.         /**
  40.         * Dynapi widget class
  41.         * @return string 
  42.         */
  43.         function readDWidgetClassName()         return $this->_DWidgetClassName}
  44.         function writeDWidgetClassName($value)  $this->_DWidgetClassName=$value}
  45.  
  46.         function dumpHeaderCode()
  47.         {
  48.                 if (!defined('DYNAPI'))
  49.                 {
  50.                         echo "<script type=\"text/javascript\" src=\""
  51.                            . VCL_HTTP_PATH "/dynapi/src/dynapi.js\"></script>\n"
  52.                            . "<script type=\"text/javascript\">\n"
  53.                            . "  dynapi.library.setPath('" VCL_HTTP_PATH "/dynapi/src/');\n"
  54.                            . "  dynapi.library.include('dynapi.api');\n"
  55.                            . "</script>\n";
  56.                         define('DYNAPI'1);
  57.                 }
  58.  
  59.                 if (!defined('DYNAPI_' strtoupper($this->className())))
  60.                 {
  61.                         echo "<script type=\"text/javascript\">\n"
  62.                              . "  dynapi.library.include('" $this->DWidgetClassName "');\n"
  63.                              . "</script>\n";
  64.                         define('DYNAPI_'.strtoupper($this->className()),1);
  65.                 }
  66.         }
  67.  
  68.         function dumpContents()
  69.         {
  70.                 echo "<script type=\"text/javascript\">\n"
  71.                    . "  dynapi.document.insertChild(" $this->Name ");\n"
  72.                    . "</script>\n";
  73.         }
  74.  
  75.         function __construct($aowner=null)
  76.         {
  77.                 //Calls inherited constructor
  78.                 parent::__construct($aowner);
  79.                 $this->ControlStyle="csSlowRedraw=1";
  80.         }
  81. }
  82.  
  83.         /**
  84.         * Init qooxdoo library, only once
  85.         */
  86. function __QLibrary_InitLib()
  87. {
  88.         if (!defined('QOOXDOO'))
  89.         {
  90.                 echo "<script type=\"text/javascript\" src=\"" VCL_HTTP_PATH "/qooxdoo/framework/script/qx.js\"></script>\n"
  91.                    . "<script type=\"text/javascript\">\n"
  92.                    . "  qx.log.Logger.ROOT_LOGGER.setMinLevel(qx.log.Logger.LEVEL_FATAL);\n"
  93.                    . "  qx.manager.object.AliasManager.getInstance().add(\"static\", \"" VCL_HTTP_PATH "/qooxdoo/framework/resource/static/\");\n"
  94.                    . "  qx.manager.object.AliasManager.getInstance().add(\"widget\", \"" VCL_HTTP_PATH "/qooxdoo/framework/resource/widget/windows/\");\n"
  95.                    . "  qx.manager.object.AliasManager.getInstance().add(\"icon\", \"" VCL_HTTP_PATH "/qooxdoo/framework/resource/icon/VistaInspirate/\");\n"
  96.                    . "</script>\n";
  97.  
  98.                 define('QOOXDOO',1);
  99.         }
  100. }
  101.  
  102.         /**
  103.         * Set widget cursor
  104.         * @param string $Name Component Name
  105.         * @param string $Cursor Cursor to be set
  106.         */
  107. function __QLibrary_SetCursor($Name$Cursor)
  108. {
  109.         if ($Cursor !== "")
  110.         {
  111.                 switch ($Cursor)
  112.                 {
  113.                         case "crPointer":   $cursor="pointer"break;
  114.                         case "crHand":      $cursor="pointer"break;
  115.                         case "crCrossHair"$cursor="crosshair"break;
  116.                         case "crHelp":      $cursor="help"break;
  117.                         case "crText":      $cursor="text"break;
  118.                         case "crWait":      $cursor="wait"break;
  119.                         case "crE-Resize":  $cursor="e-resize"break;
  120.                         case "crNE-Resize"$cursor="ne-resize"break;
  121.                         case "crN-Resize":  $cursor="n-resize"break;
  122.                         case "crNW-Resize"$cursor="nw-resize"break;
  123.                         case "crW-Resize":  $cursor="w-resize"break;
  124.                         case "crSW-Resize"$cursor="sw-resize"break;
  125.                         case "crS-Resize":  $cursor="s-resize"break;
  126.                         case "crSE-Resize"$cursor="se-resize"break;
  127.                         case "crAuto":      $cursor="move"break;
  128.                         default:            $cursor="default"break;
  129.                 }
  130.                 echo "  $Name.setCursor(\"$cursor\");\n";
  131.         }
  132. }
  133.  
  134. /**
  135.  * Base class for qooxdoo widgets
  136.  *
  137.  */
  138. class QWidget extends FocusControl
  139. {
  140.         function dumpCommonQWidgetProperties($Name$FontSupport 1)
  141.         {
  142.                 __QLibrary_SetCursor($Name$this->Cursor);
  143.                 if ($this->Enabled$enabled="true"}
  144.                 else                $enabled="false"}
  145.  
  146.                 echo "  $Name.setEnabled($enabled);\n";
  147.                 if ($FontSupport)
  148.                 {
  149.                 echo "  $Name.setFont(\"{$this->Font->Size} '{$this->Font->Family}' {$this->Font->Weight}\");\n";
  150.                 if ($this->Font->Color != "")
  151.                 echo "  $Name.setColor(new qx.renderer.color.Color('{$this->Font->Color}'));\n"}
  152.                 }
  153.  
  154.                 if (($this->Visible|| (($this->ControlState csDesigning)==csDesigning))
  155.                 $visible="true"}
  156.                 else
  157.                 $visible="false"}
  158.                 echo "  $Name.setVisibility($visible);\n";
  159.         }
  160.  
  161.         protected function PrepareQWJSEvent($Name$event$eventname)
  162.         {
  163.                 if ($event != null)
  164.                 {
  165.                         echo "  $Name.addEventListener('$eventname', function(e{ $event(e); });\n";
  166.                 }
  167.                 }
  168.  
  169.         function dumpCommonQWidgetJSEvents($Name$UseOnChangeEvent)
  170.                 {
  171.                 if (($this->ControlState csDesigning)!=csDesigning)
  172.                 {
  173.                         $this->PrepareQWJSEvent($Name$this->jsOnActivate"focusin");
  174.                         $this->PrepareQWJSEvent($Name$this->jsOnDeActivate"focusout");
  175.                         $this->PrepareQWJSEvent($Name$this->jsOnBlur"blur");
  176.                         $this->PrepareQWJSEvent($Name$this->jsOnClick"click");
  177.                         //$this->PrepareQWJSEvent($Name, $this->readjsOnShow, "appear");
  178.                         //$this->PrepareQWJSEvent($Name, $this->jsOnHide, "disappear");
  179.                         $this->PrepareQWJSEvent($Name$this->jsOnDblClick"dblclick");
  180.                         $this->PrepareQWJSEvent($Name$this->jsOnFocus"focus");
  181.                         $this->PrepareQWJSEvent($Name$this->jsOnKeyDown"keydown");
  182.                         $this->PrepareQWJSEvent($Name$this->jsOnKeyPress"keypress");
  183.                         $this->PrepareQWJSEvent($Name$this->jsOnKeyUp"keyup");
  184.                         $this->PrepareQWJSEvent($Name$this->jsOnMouseDown"mousedown");
  185.                         $this->PrepareQWJSEvent($Name$this->jsOnMouseUp"mouseup");
  186.                         $this->PrepareQWJSEvent($Name$this->jsOnMouseMove"mousemove");
  187.                         $this->PrepareQWJSEvent($Name$this->jsOnMouseOut"mouseout");
  188.                         $this->PrepareQWJSEvent($Name$this->jsOnMouseOver"mouseover");
  189.  
  190.                         // Special events
  191.                         if (($this->jsOnContextMenu != null|| ($this->PopupMenu != null))
  192.                         {
  193.                                 echo "  $Name.addEventListener('contextmenu', function(e{";
  194.                                 if ($this->jsOnContextMenu != nullecho " $this->jsOnContextMenu(e);";
  195.                                 if ($this->PopupMenu != null)       echo " Show" $this->PopupMenu->Name "(e, 1);";
  196.                                 echo " });\n";
  197.                 }
  198.                         if ($this->jsOnChange != null)
  199.                 {
  200.                                 switch ($UseOnChangeEvent)
  201.                                 {
  202.                                         case 1:
  203.                                                 $event "keyup";
  204.                                                 break;
  205.                                         case 2:
  206.                                                 $event "change";
  207.                                                 break;
  208.                                         default:
  209.                                                 $event "";
  210.                                                 break;
  211.                                 }
  212.                                 if ($event !== "")
  213.                                 {
  214.                                         echo "  $Name.addEventListener('$event', function(e{ $this->jsOnChange(e); });\n";
  215.                                 }
  216.                         }
  217.                 }
  218.         }
  219.  
  220.         function dumpHeaderCode()
  221.         {
  222.                 if (($this->ControlState csDesigning)==csDesigning)
  223.                 echo "<html>\n<head>\n"}
  224.                 __QLibrary_InitLib();
  225.                 if (($this->ControlState csDesigning)==csDesigning)
  226.                 echo "</head>\n"}
  227.         }
  228.  
  229.         /**
  230.          * Dump the common qooxdoo initialization code
  231.          *
  232.          */
  233.         function dumpCommonContentsTop()
  234.         {
  235.                 //In design mode, this component needs a body
  236.                 if (($this->ControlState csDesigning)==csDesigning)
  237.                 {
  238.                         echo '<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" >';
  239.                 }
  240.  
  241.                 echo "<input type=\"hidden\" id=\"$this->Name"."_state\" name=\"$this->Name"."_state\" value=\"\" />\n";
  242.  
  243.                 if ((($this->ControlState csDesigning)==csDesigning|| (($this->Parent!=null&& (!$this->Parent->inheritsFrom("QWidget"))))
  244.                 {
  245.                         //Creates the div
  246.                         echo "<div id=\"$this->Name\"></div>\n"
  247.                            . "<script type=\"text/javascript\">\n"
  248.                            . "  var d = qx.ui.core.ClientDocument.getInstance();\n"
  249.                            . "  var inline_div = new qx.ui.basic.Inline(\"$this->Name\");\n"
  250.                            . "  inline_div.setHeight(\"auto\");\n"
  251.                            . "  inline_div.setWidth(\"auto\");\n\n";
  252.                         //   . "  d.setOverflow(\"scrollY\");\n"
  253.                         //   . "  d.setBackgroundColor(null);\n"
  254.                 }
  255.                 else
  256.                 {
  257.                         echo "<script type=\"text/javascript\">\n";
  258.                 }
  259.         }
  260.  
  261.         /**
  262.          * Dump common qooxdoo finalization code
  263.          *
  264.          */
  265.         function dumpCommonContentsBottom()
  266.         {
  267.                 if ((($this->ControlState csDesigning)==csDesigning|| (($this->Parent!=null&& (!$this->Parent->inheritsFrom("QWidget"))))
  268.                 {
  269.                 echo "  d.add(inline_div);\n"
  270.                    . "  inline_div.add($this->Name);\n"
  271.                    . "</script>\n";
  272.                 }
  273.                 else
  274.                 {
  275.                         echo "</script>\n";
  276.                 }
  277.  
  278.                 if (($this->ControlState csDesigning)==csDesigning)
  279.                 {
  280.                         echo "</body>\n";
  281.                         echo "</html>\n";
  282.                 }
  283.         }
  284.  
  285.         /**
  286.         * Code to dump when the Widget accepts children controls.
  287.         */
  288.         function dumpChildrenControls($topoffset=0$leftoffset=0$ownername=""$layer="")
  289.         {
  290.                 $aowner=$this->Name;
  291.                 if ($ownername!=""$aowner=$ownername;
  292.  
  293.                 $js="";
  294.                 reset($this->controls->items);
  295.                 while (list($k,$v)=each($this->controls->items))
  296.                 {
  297.                                 if ($v->Layer==$layer)
  298.                                 {
  299.                                 if ($v->inheritsFrom("QWidget"))
  300.                                 {
  301.                                         echo "</script>";
  302.                                         $v->show();
  303.                                         echo "<script type=\"text/javascript\">\n";
  304.                                 echo "  $v->Name.setLeft(".($v->Left+$leftoffset).");\n";
  305.                                 echo "  $v->Name.setTop(".($v->Top+$topoffset).");\n";
  306.                                 echo "  $aowner.add($v->Name);\n";
  307.                                 }
  308.                                 else
  309.                                 {
  310.                                 echo "  var container = new qx.ui.basic.Atom(\"";
  311.                                 ob_start();
  312.                                 $v->show();
  313.                                 $c=ob_get_contents();
  314.                                 $c=extractjscript($c);
  315.                                 $js.=$c[0];
  316.                                 $html=$c[1];
  317.                                 ob_end_clean();
  318.  
  319.                                 echo str_replace("\r",'',str_replace("\n",'',str_replace('"','\"'$html)));
  320.                                 echo "\");\n";
  321.                                 echo "  container.setLeft(".($v->Left+$leftoffset).");\n";
  322.                                 echo "  container.setTop(".($v->Top+$topoffset).");\n";
  323.                                 echo "  container.setWidth($v->Width);\n";
  324.                                 echo "  container.setHeight($v->Height);\n";
  325.                                 echo "  $aowner.add(container);\n";
  326.                                 }
  327.                                 }
  328.                 }
  329.                 return($js);
  330.         }
  331.  
  332.         function __construct($aowner=null)
  333.         {
  334.                 //Calls inherited constructor
  335.                 parent::__construct($aowner);
  336.  
  337.                //For mapshapes
  338.                 $this->ControlStyle="csTopOffset=1";
  339.                 $this->ControlStyle="csLeftOffset=1";
  340.                 $this->ControlStyle="csSlowRedraw=1";
  341.         }
  342.  
  343. }
  344.  
  345. /**
  346.  * CustomLabel class
  347.  *
  348.  * CustomLabel is the base class for controls that display text on a form.
  349.  * The Caption of the CustomLabel may contain HTML formatted text.
  350.  *
  351.  */
  352. class CustomLabel extends GraphicControl
  353. {
  354.         protected $_datasource = null;
  355.         protected $_datafield = "";
  356.         protected $_link = "";
  357.         protected $_linktarget = "";
  358.         protected $_wordwrap = 1;
  359.  
  360.         protected $_onclick = null;
  361.         protected $_ondblclick = null;
  362.  
  363.  
  364.         function __construct($aowner null)
  365.         {
  366.                 //Calls inherited constructor
  367.                 parent::__construct($aowner);
  368.  
  369.                 $this->Width 75;
  370.                 $this->Height 13;
  371.                 $this->ControlStyle="csRenderOwner=1";
  372.                 $this->ControlStyle="csRenderAlso=StyleSheet";
  373.         }
  374.  
  375.         function init()
  376.         {
  377.                 parent::init();
  378.  
  379.                 $submitEventValue $this->input->{$this->getJSWrapperHiddenFieldName()};
  380.  
  381.                 if (is_object($submitEventValue))
  382.                 {
  383.                         // check if the a click event has been fired
  384.                         
  385.                         if ($this->_onclick != null && $submitEventValue->asString(== $this->getJSWrapperSubmitEventValue($this->_onclick))
  386.                         {
  387.                                 $this->callEvent('onclick'array());
  388.                         }
  389.                         // check if the a double-click event has been fired
  390.                         if ($this->_ondblclick != null && $submitEventValue->asString(== $this->getJSWrapperSubmitEventValue($this->_ondblclick))
  391.                         {
  392.                                 $this->callEvent('ondblclick'array());
  393.                         }
  394.                 }
  395.         }
  396.  
  397.         function loaded()
  398.         {
  399.                 parent::loaded();
  400.                 // call writeDataSource() since setDataSource() might not be implemented by the sub-class
  401.                 $this->writeDataSource($this->_datasource);
  402.         }
  403.  
  404.         function dumpContents()
  405.         {
  406.                 // get the string for the JS Events
  407.                 $events $this->readJsEvents();
  408.  
  409.                 // add or replace the JS events with the wrappers if necessary
  410.                 $this->addJSWrapperToEvents($events$this->_onclick,    $this->_jsonclick,    "onclick");
  411.                 $this->addJSWrapperToEvents($events$this->_ondblclick$this->_jsondblclick"ondblclick");
  412.  
  413.                 $style="";
  414.                 if ($this->Style=="")
  415.                 {
  416.                     // get the Font attributes
  417.                     $style $this->Font->FontString;
  418.  
  419.                     if ((($this->ControlState csDesigning== csDesigning&& ($this->_designcolor != ""))
  420.                     {
  421.                             $style .= "background-color: " $this->_designcolor ";";
  422.                     }
  423.                     else
  424.                     {
  425.                             $color $this->_color;
  426.                             if ($color != "")
  427.                             {
  428.                                     $style .= "background-color: " $color ";";
  429.                             }
  430.                     }
  431.  
  432.                     // add the cursor to the style
  433.                     if ($this->_cursor != "")
  434.                     {
  435.                             $cr strtolower(substr($this->_cursor2));
  436.                             $style .= "cursor$cr;";
  437.                     }
  438.                 }
  439.  
  440.                 // set height and width to the style attribute
  441.                 if (!$this->_adjusttolayout)
  442.                 {
  443.                     $style .= "height:" $this->Height . "px;width:" $this->Width . "px;";
  444.                 }
  445.                 else
  446.                 {
  447.                     $style .= "height:100%;width:100%;";
  448.                 }
  449.  
  450.                 if (!$this->_wordwrap)
  451.                 {
  452.                         $style .= "white-space: nowrap; ";
  453.                 }
  454.  
  455.                 if ($style != "")  $style "style=\"$style\"";
  456.  
  457.                 // get the alignment of the Caption inside the <div>
  458.                 $alignment "";
  459.                 switch ($this->_alignment)
  460.                 {
  461.                         case agNone :
  462.                                 $alignment "";
  463.                                 break;
  464.                         case agLeft :
  465.                                 $alignment " align=\"Left\" ";
  466.                                 break;
  467.                         case agCenter :
  468.                                 $alignment " align=\"Center\" ";
  469.                                 break;
  470.                         case agRight :
  471.                                 $alignment " align=\"Right\" ";
  472.                                 break;
  473.                 }
  474.  
  475.                 // get the hint attribute; returns: title="[HintText]"
  476.                 $hint $this->getHintAttribute();
  477.  
  478.                 $target="";
  479.                 if (trim($this->LinkTarget)!=""$target="target=\"$this->LinkTarget\"";
  480.  
  481.                 $class ($this->Style != """class=\"$this->StyleClass\""";
  482.  
  483.                 echo "<div id=\"$this->_name\" $style $alignment $hint $class";
  484.  
  485.                 if ($this->_link==""echo "$events";
  486.  
  487.                 echo ">";
  488.  
  489.                 if ($this->_link != "")  echo "<A HREF=\"$this->_link\" $target $events>";
  490.  
  491.                 if (($this->ControlState csDesigning!= csDesigning)
  492.                 {
  493.                         if ($this->hasValidDataField())
  494.                         {
  495.                                 //The value to show on the field is the one from the table
  496.                                 $this->Caption = $this->readDataFieldValue();
  497.                                 // dump no hidden fields since the label is read-only
  498.                         }
  499.                 }
  500.  
  501.  
  502.                 if ($this->_onshow != null)
  503.                 {
  504.                         $this->callEvent('onshow'array());
  505.                 }
  506.                 else
  507.                 {
  508.                         $caption $this->_caption;
  509.                         // If a link is defined strip all other links defined in the caption
  510.                         // Reason: Nested links are illegal
  511.                         if ($this->_link != "")
  512.                         {
  513.                                 $caption $this->strip_selected_tags($captionarray("a"));
  514.                         }
  515.  
  516.                         echo $caption;
  517.                 }
  518.  
  519.                 if ($this->_link != "")  echo "</A>";
  520.  
  521.                 // add a hidden field so we can determine which event for the label was fired
  522.                 if ($this->_onclick != null || $this->_ondblclick != null)
  523.                 {
  524.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  525.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  526.                 }
  527.  
  528.                 echo "</div>";
  529.         }
  530.  
  531.         function dumpJavascript()
  532.         {
  533.                 parent::dumpJavascript();
  534.  
  535.                 if ($this->_onclick != null && !defined($this->_onclick))
  536.                 {
  537.                         // only output the same function once;
  538.                         // otherwise if for example two labels use the same
  539.                         // OnClick event handler it would be outputted twice.
  540.                         $def=$this->_onclick;
  541.                         define($def,1);
  542.  
  543.                         // output the wrapper function
  544.                         echo $this->getJSWrapperFunction($this->_onclick);
  545.                 }
  546.  
  547.                 if ($this->_ondblclick != null && !defined($this->_ondblclick))
  548.                 {
  549.                         $def=$this->_ondblclick;
  550.                         define($def,1);
  551.  
  552.                         // output the wrapper function
  553.                         echo $this->getJSWrapperFunction($this->_ondblclick);
  554.                 }
  555.         }
  556.  
  557.  
  558.  
  559.         /**
  560.         * Helper function to strip selected tags.
  561.         * This function will also replace self-closing tags (XHTML <br /> <hr />)
  562.         * and will work if the text contains line breaks.
  563.         *
  564.         * @autor Bermi Ferrer @ http://www.php.net/manual/en/function.strip-tags.php
  565.         *
  566.         * @param string $text Text that may contain the tags to strip.
  567.         * @param array $tags All tags that should be stripped from $text.
  568.         * @return string Returns $text without the defined $tags.
  569.         */
  570.         protected function strip_selected_tags($text$tags array())
  571.         {
  572.                 $args func_get_args();
  573.                 $text array_shift($args);
  574.                 $tags func_num_args(array_diff($args,array($text))  : (array)$tags;
  575.                 foreach ($tags as $tag){
  576.                         ifpreg_match_all'/<'.$tag.'[^>]*>([^<]*)<\/'.$tag.'>/iu'$text$found) ){
  577.                                 $text str_replace($found[0],$found[1],$text);
  578.                         }
  579.                 }
  580.  
  581.                 return preg_replace'/(<('.join('|',$tags).')(\\n|\\r|.)*\/>)/iu'''$text);
  582.         }
  583.  
  584.         /**
  585.         * Occurs when the user clicks the control.
  586.         * @return mixed Returns the event handler or null if no handler is set.
  587.         */
  588.         function readOnClick()
  589.         {
  590.                 return $this->_onclick;
  591.         }
  592.         /**
  593.         * Occurs when the user clicks the control.
  594.         * @param mixed $value Event handler or null to unset.
  595.         */
  596.         function writeOnClick($value)
  597.         {
  598.                 $this->_onclick $value;
  599.         }
  600.         function defaultOnClick()
  601.         {
  602.                 return null;
  603.         }
  604.  
  605.         /**
  606.         * Occurs when the user double clicks the control.
  607.         * @return mixed Returns the event handler or null if no handler is set.
  608.         */
  609.         function readOnDblClick()
  610.         {
  611.                 return $this->_ondblclick;
  612.         }
  613.         /**
  614.         * Occurs when the user double clicks the control.
  615.         * @param mixed $value Event handler or null to unset.
  616.         */
  617.         function writeOnDblClick($value)
  618.         {
  619.                 $this->_ondblclick $value;
  620.         }
  621.         function defaultOnDblClick()
  622.         {
  623.                 return null;
  624.         }
  625.  
  626.         /**
  627.         * DataField indicates which field of the DataSource is used to fill in
  628.         * the Caption.
  629.         * @return string Returns the data field.
  630.         */
  631.         function readDataField()
  632.         {
  633.                 return $this->_datafield;
  634.         }
  635.         /**
  636.         * DataField indicates which field of the DataSource is used to fill in
  637.         * the Caption.
  638.         * @param string $value Data field
  639.         */
  640.         function writeDataField($value)
  641.         {
  642.                 $this->_datafield $value;
  643.         }
  644.         function defaultDataField()
  645.         {
  646.                 return "";
  647.         }
  648.  
  649.         /**
  650.         * DataSource indicates the source where the Caption is read from.
  651.         * The label is read-only meaning it does not update any data in the data source.
  652.         * @return mixed Data source object or null if not used.
  653.         */
  654.         function readDataSource()
  655.         {
  656.                 return $this->_datasource;
  657.         }
  658.         /**
  659.         * DataSource indicates the source where the Caption is read from.
  660.         * The label is read-only meaning it does not update any data in the data source.
  661.         * @param mixed $value Data source object or null if not used.
  662.         */
  663.         function writeDataSource($value)
  664.         {
  665.                 $this->_datasource=$this->fixupProperty($value);
  666.         }
  667.         function defaultDataSource()
  668.         {
  669.                 return null;
  670.         }
  671.  
  672.         /**
  673.         * If Link is set the Caption is rendered as a link.
  674.         * @return string Link, if empty string the link is not used.
  675.         */
  676.         function readLink()
  677.         {
  678.                 return $this->_link;
  679.         }
  680.         /**
  681.         * If Link is set the Caption is rendered as a link.
  682.         * @value string $value Link, if empty string the link is not used.
  683.         */
  684.         function writeLink($value)
  685.         {
  686.                 $this->_link $value;
  687.         }
  688.         function defaultLink()
  689.         {
  690.                 return "";
  691.         }
  692.  
  693.         /**
  694.         * Target attribute when the label acts as a link.
  695.         * @link http://www.w3.org/TR/html4/present/frames.html#adef-target
  696.         * @return string The link target as defined by the HTML specs.
  697.         */
  698.         function readLinkTarget(return $this->_linktarget}
  699.         /**
  700.         * Target attribute when the label acts as a link.
  701.         * @link http://www.w3.org/TR/html4/present/frames.html#adef-target
  702.         * @param string $value The link target as defined by the HTML specs.
  703.         */
  704.         function writeLinkTarget($value$this->_linktarget=$value}
  705.         function defaultLinkTarget(return ""}
  706.  
  707.         /**
  708.         * Specifies whether the label text wraps when it is too long
  709.         * for the width of the label.
  710.         * @return bool True if word wrap is enabled, false otherwise.
  711.         */
  712.         function readWordWrap()
  713.         {
  714.                 return $this->_wordwrap;
  715.         }
  716.         /**
  717.         * Specifies whether the label text wraps when it is too long
  718.         * for the width of the label.
  719.         *
  720.         * Note: white-space: nowrap; is applied to the <div> of the label.
  721.         *
  722.         * @param bool $value True if word wrap is enabled, false otherwise.
  723.         */
  724.         function writeWordWrap($value)
  725.         {
  726.                 $this->_wordwrap $value;
  727.         }
  728.         function defaultWordWrap()
  729.         {
  730.                 return 1;
  731.         }
  732. }
  733.  
  734.  
  735. /**
  736. * Label class derived from CustomLabel.
  737. *
  738. */
  739. class Label extends CustomLabel
  740. {
  741.         /*
  742.         * Publish the events for the Label component
  743.         */
  744.         function getOnClick                     (return $this->readOnClick()}
  745.         function setOnClick                     ($value$this->writeOnClick($value)}
  746.  
  747.         function getOnDblClick                  (return $this->readOnDblClick()}
  748.         function setOnDblClick                  ($value$this->writeOnDblClick($value)}
  749.  
  750.         /*
  751.         * Publish the JS events for the Label component
  752.         */
  753.         function getjsOnClick                   (return $this->readjsOnClick()}
  754.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  755.  
  756.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  757.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  758.  
  759.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  760.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  761.  
  762.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  763.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  764.  
  765.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  766.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  767.  
  768.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  769.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  770.  
  771.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  772.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  773.  
  774.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  775.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  776.  
  777.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  778.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  779.  
  780.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  781.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  782.  
  783.  
  784.         /*
  785.         * Publish the properties for the Label component
  786.         */
  787.  
  788.         function getAlignment()
  789.         {
  790.                 return $this->readAlignment();
  791.         }
  792.         function setAlignment($value)
  793.         {
  794.                 $this->writeAlignment($value);
  795.         }
  796.  
  797.         function getCaption()
  798.         {
  799.                 return $this->readCaption();
  800.         }
  801.         function setCaption($value)
  802.         {
  803.                 $this->writeCaption($value);
  804.         }
  805.  
  806.         function getColor()
  807.         {
  808.                 return $this->readColor();
  809.         }
  810.         function setColor($value)
  811.         {
  812.                 $this->writeColor($value);
  813.         }
  814.  
  815.         function getDataField()
  816.         {
  817.                 return $this->readDataField();
  818.         }
  819.         function setDataField($value)
  820.         {
  821.                 $this->writeDataField($value);
  822.         }
  823.  
  824.         function getDataSource()
  825.         {
  826.                 return $this->readDataSource();
  827.         }
  828.         function setDataSource($value)
  829.         {
  830.                 $this->writeDataSource($value);
  831.         }
  832.  
  833.         function getDesignColor()
  834.         {
  835.                 return $this->readDesignColor();
  836.         }
  837.         function setDesignColor($value)
  838.         {
  839.                 $this->writeDesignColor($value);
  840.         }
  841.  
  842.         function getFont()
  843.         {
  844.                 return $this->readFont();
  845.         }
  846.         function setFont($value)
  847.         {
  848.                 $this->writeFont($value);
  849.         }
  850.  
  851.         function getLink()
  852.         {
  853.                 return $this->readLink();
  854.         }
  855.         function setLink($value)
  856.         {
  857.                 $this->writeLink($value);
  858.         }
  859.  
  860.         function getLinkTarget()
  861.         {
  862.                 return $this->readLinkTarget();
  863.         }
  864.         function setLinkTarget($value)
  865.         {
  866.                 $this->writeLinkTarget($value);
  867.         }
  868.  
  869.         function getParentColor()
  870.         {
  871.                 return $this->readParentColor();
  872.         }
  873.         function setParentColor($value)
  874.         {
  875.                 $this->writeParentColor($value);
  876.         }
  877.  
  878.         function getParentFont()
  879.         {
  880.                 return $this->readParentFont();
  881.         }
  882.         function setParentFont($value)
  883.         {
  884.                 $this->writeParentFont($value);
  885.         }
  886.  
  887.         function getParentShowHint()
  888.         {
  889.                 return $this->readParentShowHint();
  890.         }
  891.         function setParentShowHint($value)
  892.         {
  893.                 $this->writeParentShowHint($value);
  894.         }
  895.  
  896.         function getPopupMenu()
  897.         {
  898.                 return $this->readPopupMenu();
  899.         }
  900.         function setPopupMenu($value)
  901.         {
  902.                 $this->writePopupMenu($value);
  903.         }
  904.  
  905.         function getShowHint()
  906.         {
  907.                 return $this->readShowHint();
  908.         }
  909.         function setShowHint($value)
  910.         {
  911.                 $this->writeShowHint($value);
  912.         }
  913.  
  914.         function getStyle()             return $this->readstyle()}
  915.         function setStyle($value)       $this->writestyle($value)}
  916.  
  917.         function getVisible()
  918.         {
  919.                 return $this->readVisible();
  920.         }
  921.         function setVisible($value)
  922.         {
  923.                 $this->writeVisible($value);
  924.         }
  925.  
  926.         function getWordWrap()
  927.         {
  928.                 return $this->readWordWrap();
  929.         }
  930.         function setWordWrap($value)
  931.         {
  932.                 $this->writeWordWrap($value);
  933.         }
  934. }
  935.  
  936.  
  937. // BorderStyles
  938. define('bsNone''bsNone');
  939. define('bsSingle''bsSingle');
  940.  
  941. // CharCase
  942. define('ecLowerCase''ecLowerCase');
  943. define('ecNormal''ecNormal');
  944. define('ecUpperCase''ecUpperCase');
  945.  
  946. /**
  947.  * CustomEdit class
  948.  *
  949.  * Base class for Edit controls.
  950.  * It allows to enter text in a single-line.
  951.  * The Edit control only accepts plain text. All HTML tags are stripped.
  952.  *
  953.  */
  954. class CustomEdit extends FocusControl
  955. {
  956.         protected $_onclick = null;
  957.         protected $_ondblclick = null;
  958.         protected $_onsubmit=null;
  959.  
  960.         protected $_jsonselect=null;
  961.  
  962.         protected $_borderstyle=bsSingle;
  963.         protected $_datasource = null;
  964.         protected $_datafield = "";
  965.         protected $_charcase=ecNormal;
  966.         protected $_ispassword = 0;
  967.         protected $_maxlength=0;
  968.         protected $_taborder=0;
  969.         protected $_tabstop=1;
  970.         protected $_text="";
  971.         protected $_readonly=0;
  972.  
  973.  
  974.         function __construct($aowner null)
  975.         {
  976.                 //Calls inherited constructor
  977.                 parent::__construct($aowner);
  978.  
  979.                 $this->Width 121;
  980.                 $this->Height 21;
  981.                 $this->ControlStyle="csRenderOwner=1";
  982.                 $this->ControlStyle="csRenderAlso=StyleSheet";
  983.         }
  984.  
  985.         function loaded()
  986.         {
  987.                 parent::loaded();
  988.                 // use writeDataSource() since setDataSource() might be implemented in the sub-component
  989.                 $this->writeDataSource($this->_datasource);
  990.         }
  991.  
  992.         function preinit()
  993.         {
  994.                 //If there is something posted
  995.                 $submitted $this->input->{$this->Name};
  996.                 if (is_object($submitted))
  997.                 {
  998.                         //Get the value and set the text field
  999.                         $this->_text = $submitted->asString();
  1000.  
  1001.                         //If there is any valid DataField attached, update it
  1002.                         $this->updateDataField($this->_text);
  1003.                 }
  1004.         }
  1005.  
  1006.         function init()
  1007.         {
  1008.                 parent::init();
  1009.  
  1010.                 $submitted $this->input->{$this->Name};
  1011.  
  1012.                 // Allow the OnSubmit event to be fired because it is not
  1013.                 // a mouse or keyboard event.
  1014.                 if ($this->_onsubmit != null && is_object($submitted))
  1015.                 {
  1016.                         $this->callEvent('onsubmit'array());
  1017.                 }
  1018.  
  1019.                 $submitEvent $this->input->{$this->getJSWrapperHiddenFieldName()};
  1020.  
  1021.                 if (is_object($submitEvent&& $this->_enabled == 1)
  1022.                 {
  1023.                         // check if the a click event has been fired
  1024.                         
  1025.                         if ($this->_onclick != null && $submitEvent->asString(== $this->getJSWrapperSubmitEventValue($this->_onclick))
  1026.                         {
  1027.                                 $this->callEvent('onclick'array());
  1028.                         }
  1029.                         // check if the a double-click event has been fired
  1030.                         if ($this->_ondblclick != null && $submitEvent->asString(== $this->getJSWrapperSubmitEventValue($this->_ondblclick))
  1031.                         {
  1032.                                 $this->callEvent('ondblclick'array());
  1033.                         }
  1034.                 }
  1035.         }
  1036.  
  1037.         /**
  1038.         * Get the common HTML tag attributes of a Edit control.
  1039.         * @return string Returns a string with the attributes.
  1040.         */
  1041.         protected function getCommonAttributes()
  1042.         {
  1043.                 $events "";
  1044.                 if ($this->_enabled == 1)
  1045.                 {
  1046.                         // get the string for the JS Events
  1047.                         $events $this->readJsEvents();
  1048.  
  1049.                         // add the OnSelect JS-Event
  1050.                         if ($this->_jsonselect != null)
  1051.                         {
  1052.                                 $events .= " onselect=\"return $this->_jsonselect(event)\" ";
  1053.                         }
  1054.  
  1055.                         // add or replace the JS events with the wrappers if necessary
  1056.                         $this->addJSWrapperToEvents($events$this->_onclick,    $this->_jsonclick,    "onclick");
  1057.                         $this->addJSWrapperToEvents($events$this->_ondblclick$this->_jsondblclick"ondblclick");
  1058.                 }
  1059.  
  1060.                 // set enabled/disabled status
  1061.                 $disabled (!$this->_enabled"disabled" "";
  1062.  
  1063.                 // set maxlength if bigger than 0
  1064.                 $maxlength ($this->_maxlength 0"maxlength=$this->_maxlength"";
  1065.  
  1066.                 // set readonly attribute if true
  1067.                 $readonly ($this->_readonly == 1"readonly" "";
  1068.  
  1069.                 // set tab order if tab stop set to true
  1070.                 $taborder ($this->_tabstop == 1"tabindex=\"$this->_taborder\""";
  1071.  
  1072.                 $class ($this->Style != """class=\"$this->StyleClass\""";
  1073.  
  1074.                 // get the hint attribute; returns: title="[HintText]"
  1075.                 $hint $this->getHintAttribute();
  1076.  
  1077.                 return "$disabled $maxlength $readonly $taborder $hint $events $class";
  1078.         }
  1079.  
  1080.         /**
  1081.         * Get the common styles of a Edit control.
  1082.         * @return string Returns a string with the common styles. It is not wrapped
  1083.         *                 in the style="" attribute.
  1084.         */
  1085.         protected function getCommonStyles()
  1086.         {
  1087.                 $style "";
  1088.                 if ($this->Style=="")
  1089.                 {
  1090.                         $style .= $this->Font->FontString;
  1091.  
  1092.                         // set the no border style
  1093.                         if ($this->_borderstyle == bsNone)
  1094.                         {
  1095.                                 $style .= "border-width: 0px; border-style: none;";
  1096.                         }
  1097.  
  1098.                         if ($this->Color != "")
  1099.                         {
  1100.                                 $style .= "background-color: " $this->Color . ";";
  1101.                         }
  1102.  
  1103.                         // add the cursor to the style
  1104.                         if ($this->_cursor != "")
  1105.                         {
  1106.                                 $cr strtolower(substr($this->_cursor2));
  1107.                                 $style .= "cursor$cr;";
  1108.                         }
  1109.  
  1110.                         // set the char case if not normal
  1111.                         if ($this->_charcase != ecNormal)
  1112.                         {
  1113.                                 if ($this->_charcase == ecLowerCase)
  1114.                                 {
  1115.                                         $style .= "text-transform: lowercase;";
  1116.                                 }
  1117.                                 else if ($this->_charcase == ecUpperCase)
  1118.                                 {
  1119.                                         $style .= "text-transform: uppercase;";
  1120.                                 }
  1121.                         }
  1122.                 }
  1123.  
  1124.                 $h $this->Height - 1;
  1125.                 $w $this->Width;
  1126.  
  1127.                 $style .= "height:" $h "px;width:" $w "px;";
  1128.  
  1129.                 return $style;
  1130.         }
  1131.  
  1132.         function dumpContents()
  1133.         {
  1134.                 // set type depending on $_ispassword
  1135.                 $type ($this->_ispassword'password' 'text';
  1136.  
  1137.                 $attributes $this->getCommonAttributes();
  1138.                 $style $this->getCommonStyles();
  1139.  
  1140.                 if ($style != "")  $style "style=\"$style\"";
  1141.  
  1142.                 if (($this->ControlState csDesigning!= csDesigning)
  1143.                 {
  1144.                         if ($this->hasValidDataField())
  1145.                         {
  1146.                                 //The value to show on the field is the one from the table
  1147.                                 $this->_text $this->readDataFieldValue();
  1148.  
  1149.                                 //Dumps hidden fields to know which is the record to update
  1150.                                 $this->dumpHiddenKeyFields();
  1151.                         }
  1152.                 }
  1153.  
  1154.                 // call the OnShow event if assigned so the Text property can be changed
  1155.                 if ($this->_onshow != null)
  1156.                 {
  1157.                         $this->callEvent('onshow'array());
  1158.                 }
  1159.  
  1160.                 echo "<input type=\"$type\" id=\"$this->_name\" name=\"$this->_name\" value=\"$this->_text\" $style $attributes />";
  1161.  
  1162.                 // add a hidden field so we can determine which event for the edit was fired
  1163.                 if ($this->_onclick != null || $this->_ondblclick != null)
  1164.                 {
  1165.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  1166.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  1167.                 }
  1168.         }
  1169.  
  1170.         /*
  1171.         * Write the Javascript section to the header
  1172.         */
  1173.         function dumpJavascript()
  1174.         {
  1175.                 parent::dumpJavascript();
  1176.  
  1177.                 if ($this->_enabled == 1)
  1178.                 {
  1179.                         if ($this->_onclick != null && !defined($this->_onclick))
  1180.                         {
  1181.                                 // only output the same function once;
  1182.                                 // otherwise if for example two edits use the same
  1183.                                 // OnClick event handler it would be outputted twice.
  1184.                                 $def=$this->_onclick;
  1185.                                 define($def,1);
  1186.  
  1187.                                 // output the wrapper function
  1188.                                 echo $this->getJSWrapperFunction($this->_onclick);
  1189.                         }
  1190.  
  1191.                         if ($this->_ondblclick != null && !defined($this->_ondblclick))
  1192.                         {
  1193.                                 $def=$this->_ondblclick;
  1194.                                 define($def,1);
  1195.  
  1196.                                 // output the wrapper function
  1197.                                 echo $this->getJSWrapperFunction($this->_ondblclick);
  1198.                         }
  1199.  
  1200.                         if ($this->_jsonselect != null)
  1201.                         {
  1202.                                 $this->dumpJSEvent($this->_jsonselect);
  1203.                         }
  1204.                 }
  1205.         }
  1206.  
  1207.  
  1208.  
  1209.         /**
  1210.         * Occurs when the user clicks the control.
  1211.         * @return mixed Returns the event handler or null if no handler is set.
  1212.         */
  1213.         function readOnClick()
  1214.         {
  1215.                 return $this->_onclick;
  1216.         }
  1217.         /**
  1218.         * Occurs when the user clicks the control.
  1219.         * @param mixed Event handler or null if no handler is set.
  1220.         */
  1221.         function writeOnClick($value)
  1222.         {
  1223.                 $this->_onclick $value;
  1224.         }
  1225.         function defaultOnClick()
  1226.         {
  1227.                 return null;
  1228.         }
  1229.  
  1230.         /**
  1231.         * Occurs when the user double-clicks the control.
  1232.         * @return mixed Returns the event handler or null if no handler is set.
  1233.         */
  1234.         function readOnDblClick()
  1235.         {
  1236.                 return $this->_ondblclick;
  1237.         }
  1238.         /**
  1239.         * Occurs when the user double-clicks the control.
  1240.         * @param mixed Event handler or null if no handler is set.
  1241.         */
  1242.         function writeOnDblClick($value)
  1243.         {
  1244.                 $this->_ondblclick $value;
  1245.         }
  1246.         function defaultOnDblClick()
  1247.         {
  1248.                 return null;
  1249.         }
  1250.  
  1251.         /**
  1252.         * Occurs when the form containing the control was submitted.
  1253.         * @return mixed Returns the event handler or null if no handler is set.
  1254.         */
  1255.         function readOnSubmit(return $this->_onsubmit}
  1256.         /**
  1257.         * Occurs when the form containing the control was submitted.
  1258.         * @param mixed Event handler or null if no handler is set.
  1259.         */
  1260.         function writeOnSubmit($value$this->_onsubmit=$value}
  1261.         function defaultOnSubmit(return null}
  1262.  
  1263.  
  1264.         /**
  1265.         * JS Event occurs when text in the control was selected.
  1266.         * @return mixed Returns the event handler or null if no handler is set.
  1267.         */
  1268.         function readjsOnSelect(return $this->_jsonselect}
  1269.         /**
  1270.         * JS Event occurs when text in the control was selected.
  1271.         * @param mixed Event handler or null if no handler is set.
  1272.         */
  1273.         function writejsOnSelect($value$this->_jsonselect=$value}
  1274.         function defaultjsOnSelect(return null}
  1275.  
  1276.  
  1277.         /**
  1278.         * Determines whether the edit control has a single line border around the client area.
  1279.         * @return enum (bsNone, bsSingle)
  1280.         */
  1281.         function readBorderStyle(return $this->_borderstyle}
  1282.         /**
  1283.         * Determines whether the edit control has a single line border around the client area.
  1284.         * @param enum $value (bsNone, bsSingle)
  1285.         */
  1286.         function writeBorderStyle($value$this->_borderstyle=$value}
  1287.         function defaultBorderStyle(return bsSingle}
  1288.  
  1289.         /**
  1290.         * DataField indicates which field of the DataSource is used to fill in
  1291.         * the Text.
  1292.         */
  1293.         function readDataField(return $this->_datafield}
  1294.         /**
  1295.         * DataField indicates which field of the DataSource is used to fill in
  1296.         * the Text.
  1297.         */
  1298.         function writeDataField($value$this->_datafield $value}
  1299.         function defaultDataField(return ""}
  1300.  
  1301.         /**
  1302.         * DataSource indicates the source where the Text is read from.
  1303.         */
  1304.         function readDataSource(return $this->_datasource}
  1305.         /**
  1306.         * DataSource indicates the source where the Text is read from.
  1307.         */
  1308.         function writeDataSource($value)
  1309.         {
  1310.                 $this->_datasource $this->fixupProperty($value);
  1311.         }
  1312.         function defaultDataSource(return null}
  1313.  
  1314.         /**
  1315.         * Determines the case of the text within the edit control.
  1316.         * Note: When CharCase is set to ecLowerCase or ecUpperCase,
  1317.         *       the case of characters is converted as the user types them
  1318.         *       into the edit control. Changing the CharCase property to
  1319.         *       ecLowerCase or ecUpperCase changes the actual contents
  1320.         *       of the text, not just the appearance. Any case information
  1321.         *       is lost and can’t be recaptured by changing CharCase to ecNormal.
  1322.         * @return enum (ecLowerCase, ecNormal, ecUpperCase)
  1323.         */
  1324.         function readCharCase(return $this->_charcase}
  1325.         /**
  1326.         * Determines the case of the text within the edit control.
  1327.         * Note: When CharCase is set to ecLowerCase or ecUpperCase,
  1328.         *       the case of characters is converted as the user types them
  1329.         *       into the edit control. Changing the CharCase property to
  1330.         *       ecLowerCase or ecUpperCase changes the actual contents
  1331.         *       of the text, not just the appearance. Any case information
  1332.         *       is lost and can’t be recaptured by changing CharCase to ecNormal.
  1333.         * @value enum $value (ecLowerCase, ecNormal, ecUpperCase)
  1334.         */
  1335.         function writeCharCase($value)
  1336.         {
  1337.                 $this->_charcase=$value;
  1338.                 if ($this->_charcase == ecUpperCase)
  1339.                 {
  1340.                         $this->_text strtoupper($this->_text);
  1341.                 }
  1342.                 else if ($this->_charcase == ecUpperCase)
  1343.                 {
  1344.                         $this->_text strtolower($this->_text);
  1345.                 }
  1346.         }
  1347.         function defaultCharCase(return ecNormal}
  1348.  
  1349.         /**
  1350.         * If IsPassword is true then all characters are displayed with a password
  1351.         * character defined by the browser.
  1352.         * Note: The text is still in readable text in the HTML page!
  1353.         * @return bool 
  1354.         */
  1355.         function readIsPassword(return $this->_ispassword}
  1356.         /**
  1357.         * If IsPassword is true then all characters are displayed with a password
  1358.         * character defined by the browser.
  1359.         * Note: The text is still in readable text in the HTML page!
  1360.         * @param bool $value 
  1361.         */
  1362.         function writeIsPassword($value$this->_ispassword $value}
  1363.         function defaultIsPassword(return 0}
  1364.  
  1365.         /**
  1366.         * Specifies the maximum number of characters the user can enter into
  1367.         * the edit control. A value of 0 indicates that there is no
  1368.         * application-defined limit on the length.
  1369.         * @return integer 
  1370.         */
  1371.         function readMaxLength(return $this->_maxlength}
  1372.         /**
  1373.         * Specifies the maximum number of characters the user can enter into
  1374.         * the edit control. A value of 0 indicates that there is no
  1375.         * application-defined limit on the length.
  1376.         * @param integer $value 
  1377.         */
  1378.         function writeMaxLength($value$this->_maxlength=$value}
  1379.         function defaultMaxLength(return 0}
  1380.  
  1381.         /**
  1382.         * Set the control to read-only mode. That way the user cannot enter
  1383.         * or change the text of the edit control.
  1384.         * @return bool 
  1385.         */
  1386.         function readReadOnly(return $this->_readonly}
  1387.         /**
  1388.         * Set the control to read-only mode. That way the user cannot enter
  1389.         * or change the text of the edit control.
  1390.         * @param bool $value 
  1391.         */
  1392.         function writeReadOnly($value$this->_readonly=$value}
  1393.         function defaultReadOnly(return 0}
  1394.  
  1395.         /**
  1396.         * TabOrder indicates in which order controls are access when using
  1397.         * the Tab key.
  1398.         * The value of the TabOrder can be between 0 and 32767.
  1399.         * @return integer 
  1400.         */
  1401.         function readTabOrder(return $this->_taborder}
  1402.         /**
  1403.         * TabOrder indicates in which order controls are access when using
  1404.         * the Tab key.
  1405.         * The value of the TabOrder can be between 0 and 32767.
  1406.         * @param integer $value 
  1407.         */
  1408.         function writeTabOrder($value$this->_taborder=$value}
  1409.         function defaultTabOrder(return 0}
  1410.  
  1411.         /**
  1412.         * Enable or disable the TabOrder property. The browser may still assign
  1413.         * a TabOrder by itself internally. This cannot be controlled by HTML.
  1414.         * @return bool 
  1415.         */
  1416.         function readTabStop(return $this->_tabstop}
  1417.         /**
  1418.         * Enable or disable the TabOrder property. The browser may still assign
  1419.         * a TabOrder by itself internally. This cannot be controlled by HTML.
  1420.         * @param bool $value 
  1421.         */
  1422.         function writeTabStop($value$this->_tabstop=$value}
  1423.         function defaultTabStop(return 1}
  1424.  
  1425.         /**
  1426.         * Contains the text string associated with the control.
  1427.         * Only plain text is accepted, all tags are stripped.
  1428.         * @return string 
  1429.         */
  1430.         function readText(return $this->_text}
  1431.         /**
  1432.         * Contains the text string associated with the control.
  1433.         * Only plain text is accepted, all tags are stripped.
  1434.         * @param string $value 
  1435.         */
  1436.         function writeText($value$this->_text=$value}
  1437.         function defaultText(return ""}
  1438.  
  1439. }
  1440.  
  1441. /**
  1442.  * Edit class
  1443.  *
  1444.  * Edit publishes many of the properties inherited from CustomEdit,
  1445.  * but does not introduce any new behavior. For specialized edit controls,
  1446.  * use other descendant classes of CustomEdit or derive from it.
  1447.  *
  1448.  */
  1449. class Edit extends CustomEdit
  1450. {
  1451.         /*
  1452.         * Publish the events for the Edit component
  1453.         */
  1454.         function getOnClick                     (return $this->readOnClick()}
  1455.         function setOnClick                     ($value$this->writeOnClick($value)}
  1456.  
  1457.         function getOnDblClick                  (return $this->readOnDblClick()}
  1458.         function setOnDblClick                  ($value$this->writeOnDblClick($value)}
  1459.  
  1460.         function getOnSubmit                    (return $this->readOnSubmit()}
  1461.         function setOnSubmit                    ($value$this->writeOnSubmit($value)}
  1462.  
  1463.         /*
  1464.         * Publish the JS events for the Edit component
  1465.         */
  1466.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  1467.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  1468.  
  1469.         function getjsOnChange                  (return $this->readjsOnChange()}
  1470.         function setjsOnChange                  ($value$this->writejsOnChange($value)}
  1471.  
  1472.         function getjsOnClick                   (return $this->readjsOnClick()}
  1473.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  1474.  
  1475.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  1476.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  1477.  
  1478.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  1479.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  1480.  
  1481.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  1482.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  1483.  
  1484.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  1485.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  1486.  
  1487.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  1488.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  1489.  
  1490.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  1491.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  1492.  
  1493.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  1494.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  1495.  
  1496.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  1497.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  1498.  
  1499.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  1500.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  1501.  
  1502.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  1503.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  1504.  
  1505.         function getjsOnSelect                  (return $this->readjsOnSelect()}
  1506.         function setjsOnSelect                  ($value$this->writejsOnSelect($value)}
  1507.  
  1508.  
  1509.  
  1510.         /*
  1511.         * Publish the properties for the component
  1512.         */
  1513.         function getBorderStyle()
  1514.         {
  1515.                 return $this->readBorderStyle();
  1516.         }
  1517.         function setBorderStyle($value)
  1518.         {
  1519.                 $this->writeBorderStyle($value);
  1520.         }
  1521.  
  1522.         function getDataField()
  1523.         {
  1524.                 return $this->readDataField();
  1525.         }
  1526.         function setDataField($value)
  1527.         {
  1528.                 $this->writeDataField($value);
  1529.         }
  1530.  
  1531.         function getDataSource()
  1532.         {
  1533.                 return $this->readDataSource();
  1534.         }
  1535.         function setDataSource($value)
  1536.         {
  1537.                 $this->writeDataSource($value);
  1538.         }
  1539.  
  1540.         function getCharCase()
  1541.         {
  1542.                 return $this->readCharCase();
  1543.         }
  1544.         function setCharCase($value)
  1545.         {
  1546.                 $this->writeCharCase($value);
  1547.         }
  1548.  
  1549.         function getColor()
  1550.         {
  1551.                 return $this->readColor();
  1552.         }
  1553.         function setColor($value)
  1554.         {
  1555.                 $this->writeColor($value);
  1556.         }
  1557.  
  1558.         function getEnabled()
  1559.         {
  1560.                 return $this->readEnabled();
  1561.         }
  1562.         function setEnabled($value)
  1563.         {
  1564.                 $this->writeEnabled($value);
  1565.         }
  1566.  
  1567.         function getFont()
  1568.         {
  1569.                 return $this->readFont();
  1570.         }
  1571.         function setFont($value)
  1572.         {
  1573.                 $this->writeFont($value);
  1574.         }
  1575.  
  1576.         function getIsPassword()
  1577.         {
  1578.                 return $this->readIsPassword();
  1579.         }
  1580.         function setIsPassword($value)
  1581.         {
  1582.                 $this->writeIsPassword($value);
  1583.         }
  1584.  
  1585.         function getMaxLength()
  1586.         {
  1587.                 return $this->readMaxLength();
  1588.         }
  1589.         function setMaxLength($value)
  1590.         {
  1591.                 $this->writeMaxLength($value);
  1592.         }
  1593.  
  1594.         function getParentColor()
  1595.         {
  1596.                 return $this->readParentColor();
  1597.         }
  1598.         function setParentColor($value)
  1599.         {
  1600.                 $this->writeParentColor($value);
  1601.         }
  1602.  
  1603.         function getParentFont()
  1604.         {
  1605.                 return $this->readParentFont();
  1606.         }
  1607.         function setParentFont($value)
  1608.         {
  1609.                 $this->writeParentFont($value);
  1610.         }
  1611.  
  1612.         function getParentShowHint()
  1613.         {
  1614.                 return $this->readParentShowHint();
  1615.         }
  1616.         function setParentShowHint($value)
  1617.         {
  1618.                 $this->writeParentShowHint($value);
  1619.         }
  1620.  
  1621.         function getPopupMenu()
  1622.         {
  1623.                 return $this->readPopupMenu();
  1624.         }
  1625.         function setPopupMenu($value)
  1626.         {
  1627.                 $this->writePopupMenu($value);
  1628.         }
  1629.  
  1630.         function getReadOnly()
  1631.         {
  1632.                 return $this->readReadOnly();
  1633.         }
  1634.         function setReadOnly($value)
  1635.         {
  1636.                 $this->writeReadOnly($value);
  1637.         }
  1638.  
  1639.         function getShowHint()
  1640.         {
  1641.                 return $this->readShowHint();
  1642.         }
  1643.         function setShowHint($value)
  1644.         {
  1645.                 $this->writeShowHint($value);
  1646.         }
  1647.  
  1648.         function getStyle()             return $this->readstyle()}
  1649.         function setStyle($value)       $this->writestyle($value)}
  1650.  
  1651.         function getTabOrder()
  1652.         {
  1653.                 return $this->readTabOrder();
  1654.         }
  1655.         function setTabOrder($value)
  1656.         {
  1657.                 $this->writeTabOrder($value);
  1658.         }
  1659.  
  1660.         function getTabStop()
  1661.         {
  1662.                 return $this->readTabStop();
  1663.         }
  1664.         function setTabStop($value)
  1665.         {
  1666.                 $this->writeTabStop($value);
  1667.         }
  1668.  
  1669.         function getText()
  1670.         {
  1671.                 return $this->readText();
  1672.         }
  1673.         function setText($value)
  1674.         {
  1675.                 $this->writeText($value);
  1676.         }
  1677.  
  1678.         function getVisible()
  1679.         {
  1680.                 return $this->readVisible();
  1681.         }
  1682.         function setVisible($value)
  1683.         {
  1684.                 $this->writeVisible($value);
  1685.         }
  1686. }
  1687.  
  1688. /**
  1689.  * CustomMemo class
  1690.  *
  1691.  * CustomMemo is the base class for memo components, which are multiline edit boxes,
  1692.  * including Memo.
  1693.  *
  1694.  * It is inherited from CustomEdit and introduces following new properties:
  1695.  * Lines, LineSeparator, Text and WordWrap
  1696.  *
  1697.  */
  1698. class CustomMemo extends CustomEdit
  1699. {
  1700.         public $_lines = array();
  1701.         // The $_lineseparator variable should always be double quoted!!!
  1702.         
  1703.         protected $_lineseparator = "\n";
  1704.         protected $_wordwrap = 1;
  1705.         // The richeditor property is here since it is used in the loaded() function.
  1706.         // loaded() needs to know how to treat the input data.
  1707.         // Note: Do not publish this variable!
  1708.         
  1709.         protected $_richeditor = 0;
  1710.  
  1711.  
  1712.         function __construct($aowner null)
  1713.         {
  1714.                 //Calls inherited constructor
  1715.                 parent::__construct($aowner);
  1716.  
  1717.                 $this->Width 185;
  1718.                 $this->Height 89;
  1719.         }
  1720.  
  1721.         function preinit()
  1722.         {
  1723.                 //If there is something posted
  1724.                 $submitted $this->input->{$this->Name};
  1725.                 if (is_object($submitted))
  1726.                 {
  1727.                         // Escape the posted string if sent from a richeditor;
  1728.                         // otherwise all tags are stripped and plain text is written to Text
  1729.                         $this->Text ($this->_richeditor$submitted->asSpecialChars($submitted->asString();
  1730.  
  1731.                         //If there is any valid DataField attached, update it
  1732.                         $this->updateDataField($this->Text);
  1733.                 }
  1734.         }
  1735.  
  1736.         function dumpContents()
  1737.         {
  1738.                 // get the common attributes from the CustomEdit
  1739.                 $attributes $this->getCommonAttributes();
  1740.  
  1741.                 // add the word wrap attribute if set
  1742.                 $attributes .= ($this->_wordwrap == 1" wrap=\"virtual\"" " wrap=\"off\"";
  1743.  
  1744.                 // maxlength has to be check with some JS; it's not supported by HTML 4.0
  1745.                 if ($this->_enabled && $this->_maxlength > 0)
  1746.                 {
  1747.                         if ($this->_jsonkeyup != null)
  1748.                         {
  1749.                                 $attributes str_replace("onkeyup=\"return $this->_jsonkeyup(event)\"",
  1750.                                                   "onkeyup=\"return checkMaxLength(thisevent$this->_jsonkeyup)\"",
  1751.                                                   $attributes);
  1752.                         }
  1753.                         else
  1754.                         {
  1755.                                 $attributes .= " onkeyup=\"return checkMaxLength(this, event, null)\"";
  1756.                         }
  1757.                 }
  1758.  
  1759.                 // get the common styles from the CustomEdit
  1760.                 $style $this->getCommonStyles();
  1761.  
  1762.                 if ($style != "")  $style "style=\"$style\"";
  1763.  
  1764.                 // if a datasource is set then get the data from there
  1765.                 if (($this->ControlState csDesigning!= csDesigning)
  1766.                 {
  1767.                         if ($this->hasValidDataField())
  1768.                         {
  1769.                                 //The value to show on the field is the one from the table
  1770.                                 $this->Text $this->readDataFieldValue();
  1771.                                 //Dumps hidden fields to know which is the record to update
  1772.                                 $this->dumpHiddenKeyFields();
  1773.                         }
  1774.                 }
  1775.  
  1776.                 // call the OnShow event if assigned so the Lines property can be changed
  1777.                 if ($this->_onshow != null)
  1778.                 {
  1779.                         $this->callEvent('onshow'array());
  1780.                 }
  1781.  
  1782.                 $lines $this->Text;
  1783.  
  1784.                 echo "<textarea id=\"$this->_name\" name=\"$this->_name\" $style $attributes>$lines</textarea>";
  1785.  
  1786.                 // add a hidden field so we can determine which event for the memo was fired
  1787.                 if ($this->_onclick != null || $this->_ondblclick != null)
  1788.                 {
  1789.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  1790.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  1791.                 }
  1792.         }
  1793.  
  1794.         function dumpJavascript()
  1795.         {
  1796.                 parent::dumpJavascript();
  1797.  
  1798.                 // only add this function once
  1799.                 if (!defined('checkMaxLength'&& $this->_enabled && $this->_maxlength > 0)
  1800.                 {
  1801.                         define('checkMaxLength'1);
  1802.  
  1803.                         echo "
  1804. function checkMaxLength(obj, event, onKeyUpFunc){
  1805.   var maxlength = obj.getAttribute ? parseInt(obj.getAttribute(\"maxlength\")) : \"\";
  1806.   if (obj.getAttribute && obj.value.length > maxlength)
  1807.     obj.value = obj.value.substring(0, maxlength);
  1808.   if (onKeyUpFunc != null)
  1809.     onKeyUpFunc(event);
  1810. }
  1811. ";
  1812.                 }
  1813.         }
  1814.  
  1815.         /**
  1816.         * Add a new line to the Memo. Calls AddLine().
  1817.         * @param $line string The content of the new line.
  1818.         * @return integer Returns the number of lines defined.
  1819.         */
  1820.         function Add($line)
  1821.         {
  1822.                 return $this->AddLine($line);
  1823.         }
  1824.         /**
  1825.         * Add a new line to the Memo
  1826.         * @param $line string The content of the new line.
  1827.         * @return integer Returns the number of lines defined.
  1828.         */
  1829.         function AddLine($line)
  1830.         {
  1831.                 $this->_lines[$line;
  1832.                 return count($this->_lines);
  1833.         }
  1834.  
  1835.         /**
  1836.         * Deletes all text (lines) from the memo control.
  1837.         */
  1838.         function Clear()
  1839.         {
  1840.                 $this->_lines = array();
  1841.         }
  1842.  
  1843.         /**
  1844.         * Converts the text of the Lines property into way which can be used
  1845.         * in the HTML output.
  1846.         * Please have a look at the PHP function nl2br.
  1847.         * @return string Returns the Text property with '<br />'
  1848.         *                 inserted before all newlines.
  1849.         */
  1850.         function LinesAsHTML()
  1851.         {
  1852.                 return nl2br($this->Text);
  1853.         }
  1854.  
  1855.         /**
  1856.         * LineSeparator is used in the Text property to convert a string into
  1857.         * an array and back.
  1858.         * Note: Escaped character need to be in a double-quoted string.
  1859.         *       e.g. "\n"
  1860.         *       See <a href="http://www.php.net/manual/en/language.types.string.php">http://www.php.net/manual/en/language.types.string.php</a>
  1861.         * @link http://www.php.net/manual/en/language.types.string.php
  1862.         * @return string 
  1863.         */
  1864.         function readLineSeparator(return $this->_lineseparator}
  1865.         /**
  1866.         * LineSeparator is used in the Text property to convert a string into
  1867.         * an array and back.
  1868.         * Note: Escaped character need to be in a double-quoted string.
  1869.         *       e.g. "\n"
  1870.         *       See <a href="http://www.php.net/manual/en/language.types.string.php">http://www.php.net/manual/en/language.types.string.php</a>
  1871.         * @link http://www.php.net/manual/en/language.types.string.php
  1872.         * @param string $value 
  1873.         */
  1874.         function writeLineSeparator($value$this->_lineseparator = $value}
  1875.  
  1876.         /**
  1877.         * Contains the individual lines of text in the memo control.
  1878.         * Lines is an array, so the PHP array manipulation functions may be used.
  1879.         *
  1880.         * Note: Do not manipulate the Lines property like this:
  1881.         *       $this->Memo1->Lines[] = "add new line";
  1882.         *       Various versions of PHP implement the behavior of this differently.
  1883.         *       Use following code:
  1884.         *       $lines = $this->Memo1->Lines;
  1885.         *       $lines[] = "new line";          // more lines may be added
  1886.         *       $this->Memo1->Lines = $lines;
  1887.         * @return array 
  1888.         */
  1889.         function readLines(return $this->_lines}
  1890.         /**
  1891.         * Contains the individual lines of text in the memo control.
  1892.         * Lines is an array, so the PHP array manipulation functions may be used.
  1893.         *
  1894.         * Note: Do not manipulate the Lines property like this:
  1895.         *       $this->Memo1->Lines[] = "add new line";
  1896.         *       Various versions of PHP implement the behavior of this differently.
  1897.         *       Use following code:
  1898.         *       $lines = $this->Memo1->Lines;
  1899.         *       $lines[] = "new line";          // more lines may be added
  1900.         *       $this->Memo1->Lines = $lines;
  1901.         * @param array $value 
  1902.         */
  1903.         function writeLines($value)
  1904.         {
  1905.                 if (is_array($value))
  1906.                 {
  1907.                         $this->_lines = $value;
  1908.                 }
  1909.                 else
  1910.                 {
  1911.                         $this->_lines = (empty($value)) array(array($value);
  1912.                 }
  1913.         }
  1914.         function defaultLines(return array()}
  1915.  
  1916.         /**
  1917.         * Text property allows read and write the contents of Lines in a string
  1918.         * separated by LineSeparator.
  1919.         * @return string 
  1920.         */
  1921.         function readText()
  1922.         {
  1923.                 return implode("$this->_lineseparator"$this->Lines);
  1924.         }
  1925.         /**
  1926.         * Text property allows read and write the contents of Lines in a string
  1927.         * separated by LineSeparator.
  1928.         * @param string $value 
  1929.         */
  1930.         function writeText($value)
  1931.         {
  1932.                 if (empty($value))
  1933.                 {
  1934.                         $this->Clear();
  1935.                 }
  1936.                 else
  1937.                 {
  1938.                         $lines explode("$this->_lineseparator"$value);
  1939.                         if (is_array($lines))
  1940.                         {
  1941.                                 $this->Lines $lines;
  1942.                         }
  1943.                         else
  1944.                         {
  1945.                                 $this->Lines array($value);
  1946.                         }
  1947.                 }
  1948.         }
  1949.  
  1950.         /**
  1951.         * Determines whether the edit control inserts soft carriage returns
  1952.         * so text wraps at the right margin.
  1953.         * Note: This may work with the browsers Firefox and Internet Explorer only.
  1954.         * @return bool 
  1955.         */
  1956.         function readWordWrap(return $this->_wordwrap}
  1957.         /**
  1958.         * Determines whether the edit control inserts soft carriage returns
  1959.         * so text wraps at the right margin.
  1960.         * Note: This may work with the browsers Firefox and Internet Explorer only.
  1961.         * @param bool $value 
  1962.         */
  1963.         function writeWordWrap($value$this->_wordwrap=$value}
  1964.         function defaultWordWrap(return 1}
  1965. }
  1966.  
  1967.  
  1968. /**
  1969.  * Memo class
  1970.  *
  1971.  * Memo publishes many of the properties inherited from CustomMemo,
  1972.  * but does not introduce any new behavior. For specialized memo controls,
  1973.  * use other descendant classes of CustomMemo (e.g. RichEdit) or derive from it.
  1974.  *
  1975.  */
  1976. class Memo extends CustomMemo
  1977. {
  1978.         /*
  1979.         * Publish the events for the Memo component
  1980.         */
  1981.         function getOnClick                     (return $this->readOnClick()}
  1982.         function setOnClick                     ($value$this->writeOnClick($value)}
  1983.  
  1984.         function getOnDblClick                  (return $this->readOnDblClick()}
  1985.         function setOnDblClick                  ($value$this->writeOnDblClick($value)}
  1986.  
  1987.         function getOnSubmit                    (return $this->readOnSubmit()}
  1988.         function setOnSubmit                    ($value$this->writeOnSubmit($value)}
  1989.  
  1990.         /*
  1991.         * Publish the JS events for the Memo component
  1992.         */
  1993.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  1994.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  1995.  
  1996.         function getjsOnChange                  (return $this->readjsOnChange()}
  1997.         function setjsOnChange                  ($value$this->writejsOnChange($value)}
  1998.  
  1999.         function getjsOnClick                   (return $this->readjsOnClick()}
  2000.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  2001.  
  2002.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  2003.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  2004.  
  2005.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  2006.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  2007.  
  2008.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  2009.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  2010.  
  2011.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  2012.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  2013.  
  2014.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  2015.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  2016.  
  2017.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  2018.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  2019.  
  2020.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  2021.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  2022.  
  2023.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  2024.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  2025.  
  2026.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  2027.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  2028.  
  2029.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  2030.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  2031.  
  2032.         function getjsOnSelect                  (return $this->readjsOnSelect()}
  2033.         function setjsOnSelect                  ($value$this->writejsOnSelect($value)}
  2034.  
  2035.  
  2036.  
  2037.         /*
  2038.         * Publish the properties for the Memo component
  2039.         */
  2040.         function getBorderStyle()
  2041.         {
  2042.                 return $this->readBorderStyle();
  2043.         }
  2044.         function setBorderStyle($value)
  2045.         {
  2046.                 $this->writeBorderStyle($value);
  2047.         }
  2048.  
  2049.         function getColor()
  2050.         {
  2051.                 return $this->readColor();
  2052.         }
  2053.         function setColor($value)
  2054.         {
  2055.                 $this->writeColor($value);
  2056.         }
  2057.  
  2058.         function getDataField()
  2059.         {
  2060.                 return $this->readDataField();
  2061.         }
  2062.         function setDataField($value)
  2063.         {
  2064.                 $this->writeDataField($value);
  2065.         }
  2066.  
  2067.         function getDataSource()
  2068.         {
  2069.                 return $this->readDataSource();
  2070.         }
  2071.         function setDataSource($value)
  2072.         {
  2073.                 $this->writeDataSource($value);
  2074.         }
  2075.  
  2076.         function getEnabled()
  2077.         {
  2078.                 return $this->readEnabled();
  2079.         }
  2080.         function setEnabled($value)
  2081.         {
  2082.                 $this->writeEnabled($value);
  2083.         }
  2084.  
  2085.         function getFont()
  2086.         {
  2087.                 return $this->readFont();
  2088.         }
  2089.         function setFont($value)
  2090.         {
  2091.                 $this->writeFont($value);
  2092.         }
  2093.  
  2094.         function getLines()
  2095.         {
  2096.                 return $this->readLines();
  2097.         }
  2098.         function setLines($value)
  2099.         {
  2100.                 $this->writeLines($value);
  2101.         }
  2102.  
  2103.         function getMaxLength()
  2104.         {
  2105.                 return $this->readMaxLength();
  2106.         }
  2107.         function setMaxLength($value)
  2108.         {
  2109.                 $this->writeMaxLength($value);
  2110.         }
  2111.  
  2112.         function getParentColor()
  2113.         {
  2114.                 return $this->readParentColor();
  2115.         }
  2116.         function setParentColor($value)
  2117.         {
  2118.                 $this->writeParentColor($value);
  2119.         }
  2120.  
  2121.         function getParentFont()
  2122.         {
  2123.                 return $this->readParentFont();
  2124.         }
  2125.         function setParentFont($value)
  2126.         {
  2127.                 $this->writeParentFont($value);
  2128.         }
  2129.  
  2130.         function getParentShowHint()
  2131.         {
  2132.                 return $this->readParentShowHint();
  2133.         }
  2134.         function setParentShowHint($value)
  2135.         {
  2136.                 $this->writeParentShowHint($value);
  2137.         }
  2138.  
  2139.         function getPopupMenu()
  2140.         {
  2141.                 return $this->readPopupMenu();
  2142.         }
  2143.         function setPopupMenu($value)
  2144.         {
  2145.                 $this->writePopupMenu($value);
  2146.         }
  2147.  
  2148.         function getReadOnly()
  2149.         {
  2150.                 return $this->readReadOnly();
  2151.         }
  2152.         function setReadOnly($value)
  2153.         {
  2154.                 $this->writeReadOnly($value);
  2155.         }
  2156.  
  2157.         function getShowHint()
  2158.         {
  2159.                 return $this->readShowHint();
  2160.         }
  2161.         function setShowHint($value)
  2162.         {
  2163.                 $this->writeShowHint($value);
  2164.         }
  2165.  
  2166.         function getStyle()             return $this->readstyle()}
  2167.         function setStyle($value)       $this->writestyle($value)}
  2168.  
  2169.         function getTabOrder()
  2170.         {
  2171.                 return $this->readTabOrder();
  2172.         }
  2173.         function setTabOrder($value)
  2174.         {
  2175.                 $this->writeTabOrder($value);
  2176.         }
  2177.  
  2178.         function getTabStop()
  2179.         {
  2180.                 return $this->readTabStop();
  2181.         }
  2182.         function setTabStop($value)
  2183.         {
  2184.                 $this->writeTabStop($value);
  2185.         }
  2186.  
  2187.         function getVisible()
  2188.         {
  2189.                 return $this->readVisible();
  2190.         }
  2191.         function setVisible($value)
  2192.         {
  2193.                 $this->writeVisible($value);
  2194.         }
  2195.  
  2196.         function getWordWrap()
  2197.         {
  2198.                 return $this->readWordWrap();
  2199.         }
  2200.         function setWordWrap($value)
  2201.         {
  2202.                 $this->writeWordWrap($value);
  2203.         }
  2204. }
  2205.  
  2206. /**
  2207.  * CustomListBox class
  2208.  *
  2209.  * Base class for Listbox controls, such as ListBox and ComboBox.
  2210.  * ListBox displays a collection of items in a scrollable list.
  2211.  *
  2212.  */
  2213. {
  2214.         public $_items = array();
  2215.         protected $_selitems = array();
  2216.  
  2217.         protected $_onchange = null;
  2218.         protected $_onclick = null;
  2219.         protected $_ondblclick = null;
  2220.         protected $_onsubmit = null;
  2221.  
  2222.         protected $_borderstyle = bsSingle;
  2223.         protected $_datasource = null;
  2224.         protected $_datafield = "";
  2225.         protected $_size = 4;
  2226.         protected $_sorted = 0;
  2227.         protected $_taborder=0;
  2228.         protected $_tabstop=1;
  2229.  
  2230.         function __construct($aowner null)
  2231.         {
  2232.                 //Calls inherited constructor
  2233.                 parent::__construct($aowner);
  2234.  
  2235.                 $this->Clear();
  2236.  
  2237.                 $this->Width 185;
  2238.                 $this->Height 89;
  2239.                 $this->ControlStyle="csRenderOwner=1";
  2240.                 $this->ControlStyle="csRenderAlso=StyleSheet";
  2241.         }
  2242.  
  2243.         function loaded()
  2244.         {
  2245.                 parent::loaded();
  2246.  
  2247.                 $this->writeDataSource($this->_datasource);
  2248.         }
  2249.  
  2250.         function preinit()
  2251.         {
  2252.                 $submitted $this->input->{$this->Name};
  2253.  
  2254.                 if (is_object($submitted))
  2255.                 {
  2256.                         $this->ClearSelection();
  2257.                         if ($this->_multiselect == 1)
  2258.                         {
  2259.                                 $this->_selitems = $submitted->asStringArray();
  2260.                         }
  2261.                         else
  2262.                         {
  2263.                                 $changed ($this->_itemindex != $submitted->asString());
  2264.                                 // the ItemIndex might be an integer or a string,
  2265.                                 // so let's get a string
  2266.                                 $this->_itemindex = $submitted->asString();
  2267.  
  2268.                                 // only update the data field if the item index was changed
  2269.                                 if ($changed)
  2270.                                 {
  2271.                                         // following somehow does not work here:
  2272.                                         //   if (array_key_exists($this->_itemindex, $this->_items)) { $this->updateDataField($this->_items[$this->_itemindex]); }
  2273.                                         // so let's do it like this...
  2274.                                         foreach ($this->_items as $key => $item)
  2275.                                         {
  2276.                                                 if ($key == $this->_itemindex)
  2277.                                                 {
  2278.                                                         //If there is any valid DataField attached, update it
  2279.                                                         $this->updateDataField($item);
  2280.                                                 }
  2281.                                         }
  2282.                                 }
  2283.                         }
  2284.                 }
  2285.         }
  2286.  
  2287.         function init()
  2288.         {
  2289.                 parent::init();
  2290.  
  2291.                 $submitted $this->input->{$this->Name};
  2292.  
  2293.                 // Allow the OnSubmit event to be fired because it is not
  2294.                 // a mouse or keyboard event.
  2295.                 if (is_object($submitted))
  2296.                 {
  2297.                         if ($this->_onsubmit != null)
  2298.                         {
  2299.                                 $this->callEvent('onsubmit'array());
  2300.                         }
  2301.                 }
  2302.  
  2303.                 $submitEvent $this->input->{$this->getJSWrapperHiddenFieldName()};
  2304.  
  2305.                 if (is_object($submitEvent&& $this->_enabled == 1)
  2306.                 {
  2307.                         // check if the a click event has been fired
  2308.                         
  2309.                         if ($this->_onclick != null && $submitEvent->asString(== $this->getJSWrapperSubmitEventValue($this->_onclick))
  2310.                         {
  2311.                                 $this->callEvent('onclick'array());
  2312.                         }
  2313.                         // check if the a double-click event has been fired
  2314.                         if ($this->_ondblclick != null && $submitEvent->asString(== $this->getJSWrapperSubmitEventValue($this->_ondblclick))
  2315.                         {
  2316.                                 $this->callEvent('ondblclick'array());
  2317.                         }
  2318.                         // check if the a change event has been fired
  2319.                         if ($this->_onchange != null && $submitEvent->asString(== $this->getJSWrapperSubmitEventValue($this->_onchange))
  2320.                         {
  2321.                                 $this->callEvent('onchange'array());
  2322.                         }
  2323.                 }
  2324.         }
  2325.  
  2326.  
  2327.         function dumpContents()
  2328.         {
  2329.                 $events "";
  2330.                 if ($this->_enabled == 1)
  2331.                 {
  2332.                         // get the string for the JS Events
  2333.                         $events $this->readJsEvents();
  2334.  
  2335.                         // add or replace the JS events with the wrappers if necessary
  2336.                         $this->addJSWrapperToEvents($events$this->_onclick,    $this->_jsonclick,    "onclick");
  2337.                         $this->addJSWrapperToEvents($events$this->_ondblclick$this->_jsondblclick"ondblclick");
  2338.                         $this->addJSWrapperToEvents($events$this->_onchange,   $this->_jsonchange,   "onchange");
  2339.                 }
  2340.  
  2341.                 $style "";
  2342.                 if ($this->Style=="")
  2343.                 {
  2344.                         $style .= $this->Font->FontString;
  2345.  
  2346.                         // set the no border style
  2347.                         if ($this->_borderstyle == bsNone)
  2348.                         {
  2349.                                 $style .= "border-width: 0px; border-style: none;";
  2350.                         }
  2351.  
  2352.                         if ($this->Color != "")
  2353.                         {
  2354.                                 $style .= "background-color: " $this->Color . ";";
  2355.                         }
  2356.  
  2357.                         // add the cursor to the style
  2358.                         if ($this->_cursor != "")
  2359.                         {
  2360.                                 $cr strtolower(substr($this->_cursor2));
  2361.                                 $style .= "cursor$cr;";
  2362.                         }
  2363.                 }
  2364.  
  2365.                 // set enabled/disabled status
  2366.                 $enabled (!$this->_enabled"disabled=\"disabled\"" "";
  2367.  
  2368.                 // multi-select
  2369.                 $multiselect ($this->_multiselect == 1"multiple=\"multiple\"" "";
  2370.                 // if multi-select then the name needs to have [] to indicate it will send an array
  2371.                 $name ($this->_multiselect == 1"$this->_name[]$this->_name;
  2372.  
  2373.                 // set tab order if tab stop set to true
  2374.                 $taborder ($this->_tabstop == 1"tabindex=\"$this->_taborder\""";
  2375.  
  2376.                 // get the hint attribute; returns: title="[HintText]"
  2377.                 $hint $this->getHintAttribute();
  2378.  
  2379.  
  2380.                 $h $this->Height - 2;
  2381.                 $w $this->Width;
  2382.  
  2383.                 $style .= "height:" $h "px;width:" $w "px;";
  2384.  
  2385.                 $class ($this->Style != """class=\"$this->StyleClass\""";
  2386.  
  2387.                 if ($style != "")  $style "style=\"$style\"";
  2388.  
  2389.                 if (($this->ControlState csDesigning!= csDesigning)
  2390.                 {
  2391.                         if ($this->hasValidDataField())
  2392.                         {
  2393.                                 //check if the value of the current data-field is in the itmes array as value
  2394.                                 $val $this->readDataFieldValue();
  2395.                                 // get the corresponding key to the value read from the data source
  2396.                                 if (($key array_search($val$this->_items)) !== FALSE)
  2397.                                 {
  2398.                                         // if an item was found the overwrite the itemindex
  2399.                                         $this->_itemindex $key;
  2400.                                 }
  2401.  
  2402.                                 //Dumps hidden fields to know which is the record to update
  2403.                                 $this->dumpHiddenKeyFields();
  2404.                         }
  2405.                 }
  2406.  
  2407.                 // call the OnShow event if assigned so the Items property can be changed
  2408.                 if ($this->_onshow != null)
  2409.                 {
  2410.                         $this->callEvent('onshow'array());
  2411.                 }
  2412.  
  2413.  
  2414.                 echo "<select name=\"$name\" id=\"$name\" size=\"$this->_size\" $style $enabled $multiselect $taborder $hint $events $class>";
  2415.                 if (is_array($this->_items))
  2416.                 {
  2417.                         reset($this->_items);
  2418.                         foreach ($this->_items as $key => $item)
  2419.                         {
  2420.                                 $selected "";
  2421.                                 if ($key == $this->_itemindex || ($this->_multiselect == true && in_array($key$this->_selitems)))
  2422.                                 {
  2423.                                         $selected " selected";
  2424.                                 }
  2425.                                 echo "<option value=\"$key\"$selected>$item</option>";
  2426.                         }
  2427.                 }
  2428.                 echo "</select>";
  2429.  
  2430.                 // add a hidden field so we can determine which listbox fired the event
  2431.                 if ($this->_onclick != null || $this->_onchange != null || $this->_ondblclick != null)
  2432.                 {
  2433.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  2434.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  2435.                 }
  2436.         }
  2437.  
  2438.         /*
  2439.         * Write the Javascript section to the header
  2440.         */
  2441.         function dumpJavascript()
  2442.         {
  2443.                 parent::dumpJavascript();
  2444.  
  2445.                 if ($this->_enabled == 1)
  2446.                 {
  2447.                         if ($this->_onclick != null && !defined($this->_onclick))
  2448.                         {
  2449.                                 // only output the same function once;
  2450.                                 // otherwise if for example two buttons use the same
  2451.                                 // OnClick event handler it would be outputted twice.
  2452.                                 $def=$this->_onclick;
  2453.                                 define($def,1);
  2454.  
  2455.                                 // output the wrapper function
  2456.                                 echo $this->getJSWrapperFunction($this->_onclick);
  2457.                         }
  2458.                         if ($this->_ondblclick != null && !defined($this->_ondblclick))
  2459.                         {
  2460.                                 $def=$this->_ondblclick;
  2461.                                 define($def,1);
  2462.  
  2463.                                 // output the wrapper function
  2464.                                 echo $this->getJSWrapperFunction($this->_ondblclick);
  2465.                         }
  2466.                         if ($this->_onchange != null && !defined($this->_onchange))
  2467.                         {
  2468.                                 $def=$this->_onchange;
  2469.                                 define($def,1);
  2470.  
  2471.                                 // output the wrapper function
  2472.                                 echo $this->getJSWrapperFunction($this->_onchange);
  2473.                         }
  2474.                 }
  2475.         }
  2476.  
  2477.         
  2478.  
  2479.         /*
  2480.         * <Implementation of functions from super-class; docu can be found there as well>
  2481.         */
  2482.  
  2483.         function readCount()
  2484.         {
  2485.                 return count($this->_items);
  2486.         }
  2487.         function readItemIndex()
  2488.         {
  2489.                 // Return the first item of the selitems only if
  2490.                 // the itemindex is -1 and multiselect is enabled and there
  2491.                 // are some values selected.
  2492.                 if ($this->_itemindex == -&& $this->_multiselect == && $this->SelCount > 0)
  2493.                 {
  2494.                         reset($this->_selitems);
  2495.                         return key($this->_selitems);
  2496.                 }
  2497.                 else
  2498.                 {
  2499.                         return $this->_itemindex;
  2500.                 }
  2501.         }
  2502.         function writeItemIndex($value)
  2503.         {
  2504.                 $this->_itemindex $value;
  2505.                 // if multi-select then also add it to the selected array
  2506.                 if ($this->_multiselect == 1)
  2507.                 {
  2508.                         $this->writeSelected($valuetrue);
  2509.                 }
  2510.         }
  2511.         function defaultItemIndex()
  2512.         {
  2513.                 return -1;
  2514.         }
  2515.  
  2516.         function AddItem($item$object null$itemkey null)
  2517.         {
  2518.                 if ($object != null)
  2519.                 {
  2520.                         throw new Exception('Object functionallity for ListBox is not yet implemented.');
  2521.                 }
  2522.  
  2523.                 //Set the array to the end
  2524.                 end($this->_items);
  2525.  
  2526.                 //Adds the item as the last one
  2527.                 if ($itemkey != null)
  2528.                 {
  2529.                         $this->_items[$itemkey$item;
  2530.                 }
  2531.                 else
  2532.                 {
  2533.                         $this->_items[$item;
  2534.                 }
  2535.  
  2536.                 if ($this->_sorted == 1)
  2537.                 {
  2538.                         $this->sortItems();
  2539.                 }
  2540.  
  2541.                 return($this->Count);
  2542.         }
  2543.  
  2544.         function Clear()
  2545.         {
  2546.                 $this->_items array();
  2547.                 $this->_selitems array();
  2548.         }
  2549.  
  2550.         function ClearSelection()
  2551.         {
  2552.                 if ($this->_multiselect == 1)
  2553.                 {
  2554.                         $this->_selitems array();
  2555.                 }
  2556.                 $this->_itemindex = -1;
  2557.         }
  2558.         function SelectAll()
  2559.         {
  2560.                 if ($this->_multiselect == 1)
  2561.                 {
  2562.                         $this->_selitems array_keys($this->_items);
  2563.                 }
  2564.         }
  2565.  
  2566.         function readSelCount()
  2567.         {
  2568.                 if ($this->_mulitselect == 1)
  2569.                 {
  2570.                         return count($this->_selitems);
  2571.                 }
  2572.                 else
  2573.                 {
  2574.                         return ($this->_itemindex != -10;
  2575.                 }
  2576.         }
  2577.         /**
  2578.         * Determines whether the user can select more than one element at a time.
  2579.         * Note: MultiSelect does not work if a data source is assigned.
  2580.         * @return bool 
  2581.         */
  2582.         function readMultiSelect()
  2583.         {
  2584.                 return $this->_multiselect;
  2585.         }
  2586.         /**
  2587.         * Determines whether the user can select more than one element at a time.
  2588.         * Note: MultiSelect does not work if a data source is assigned.
  2589.         * @param bool $value 
  2590.         */
  2591.         function writeMultiSelect($value)
  2592.         {
  2593.                 if ($this->_multiselect == && $value == false)
  2594.                 {
  2595.                         $this->ClearSelection();
  2596.                 }
  2597.                 $this->_multiselect $value;
  2598.  
  2599.                 if ($this->_multiselect == 1)
  2600.                 {
  2601.                         // unset data source if multi select is enabled
  2602.                         $this->writeDataSource(null);
  2603.                 }
  2604.         }
  2605.         function defaultMultiSelect()
  2606.         {
  2607.                 return 0;
  2608.         }
  2609.         /*
  2610.         * </Implementation of functions from super-class>
  2611.         */
  2612.  
  2613.         /**
  2614.         * Checks if $index is selected.
  2615.         * @param mixed $index Index to be checked.
  2616.         * @return bool Returns true if $index is selected.
  2617.         */
  2618.         function readSelected($index)
  2619.         {
  2620.                 if ($this->_multiselect)
  2621.                 {
  2622.                         return in_array($index$this->_selitems);
  2623.                 }
  2624.                 else
  2625.                 {
  2626.                         return $index == $this->_itemindex;
  2627.                 }
  2628.         }
  2629.         /**
  2630.         * Select or unselect a specific item.
  2631.         * @param mixed $index Key or index of the item to select.
  2632.         * @param bool $value True if selected, otherwise false.
  2633.         */
  2634.         function writeSelected($index$value)
  2635.         {
  2636.                 if ($this->_multiselect == 1)
  2637.                 {
  2638.                         // add it to the selitems
  2639.                         if ($value)
  2640.                         {
  2641.                                 // if the index does not already exist
  2642.                                 if (!in_array($index$this->_selitems))
  2643.                                 {
  2644.                                         $this->_selitems[$index;
  2645.                                 }
  2646.                         }
  2647.                         // remove the index from the selitems
  2648.                         else
  2649.                         {
  2650.                                 $this->_selitems array_diff($this->_selitemsarray($index));
  2651.                         }
  2652.                 }
  2653.                 else
  2654.                 {
  2655.                         $this->_itemindex ($value$index : -1;
  2656.                 }
  2657.         }
  2658.  
  2659.         /**
  2660.         * Sort the items array.
  2661.         */
  2662.         private function sortItems()
  2663.         {
  2664.                 // keep the keys when sorting the array (sort does not keep the keys)
  2665.                 asort($this->_items);
  2666.         }
  2667.  
  2668.  
  2669.  
  2670.         /**
  2671.         * Occurs when the user changed the item of the control.
  2672.         * @return mixed Returns the event handler or null if no handler is set.
  2673.         */
  2674.         function readOnChange(return $this->_onchange}
  2675.         /**
  2676.         * Occurs when the user changed the item of the control.
  2677.         * @param mixed $value Event handler or null if no handler is set.
  2678.         */
  2679.         function writeOnChange($value$this->_onchange $value}
  2680.         function defaultOnChange(return null}
  2681.  
  2682.         /**
  2683.         * Occurs when the user clicks the control.
  2684.         * @return mixed Returns the event handler or null if no handler is set.
  2685.         */
  2686.         function readOnClick(return $this->_onclick}
  2687.         /**
  2688.         * Occurs when the user clicks the control.
  2689.         * @param mixed Event handler or null if no handler is set.
  2690.         */
  2691.         function writeOnClick($value$this->_onclick $value}
  2692.         function defaultOnClick(return null}
  2693.  
  2694.         /**
  2695.         * Occurs when the user double clicks the control.
  2696.         * @return mixed Returns the event handler or null if no handler is set.
  2697.         */
  2698.         function readOnDblClick(return $this->_ondblclick}
  2699.         /**
  2700.         * Occurs when the user double clicks the control.
  2701.         * @param mixed $value Event handler or null if no handler is set.
  2702.         */
  2703.         function writeOnDblClick($value$this->_ondblclick $value}
  2704.         function defaultOnDblClick(return null}
  2705.  
  2706.         /**
  2707.         * Occurs when the control was submitted.
  2708.         * @return mixed Returns the event handler or null if no handler is set.
  2709.         */
  2710.         function readOnSubmit(return $this->_onsubmit}
  2711.         /**
  2712.         * Occurs when the control was submitted.
  2713.         * @param mixed Event handler or null if no handler is set.
  2714.         */
  2715.         function writeOnSubmit($value$this->_onsubmit=$value}
  2716.         function defaultOnSubmit(return null}
  2717.  
  2718.  
  2719.         /**
  2720.         * Determines whether the listbox control has a single line border around the client area.
  2721.         * @return enum (bsNone, bsSingle)
  2722.         */
  2723.         function readBorderStyle(return $this->_borderstyle}
  2724.         /**
  2725.         * Determines whether the listbox control has a single line border around the client area.
  2726.         * @param enum $value (bsNone, bsSingle)
  2727.         */
  2728.         function writeBorderStyle($value$this->_borderstyle=$value}
  2729.         function defaultBorderStyle(return bsSingle}
  2730.  
  2731.         function readDataField(return $this->_datafield}
  2732.         function writeDataField($value$this->_datafield $value}
  2733.         function defaultDataField(return ""}
  2734.  
  2735.         function readDataSource(return $this->_datasource}
  2736.         /**
  2737.         * If a data source is assigned multi-select cannot be used.
  2738.         */
  2739.         function writeDataSource($value)
  2740.         {
  2741.                 $this->_datasource $this->fixupProperty($value);
  2742.                 // if a data source is assigned then the list box can not be multi-select
  2743.                 if ($value != null)
  2744.                 {
  2745.                         $this->MultiSelect = 0;
  2746.                 }
  2747.         }
  2748.         function defaultDataSource(return null}
  2749.  
  2750.         /**
  2751.         * Contains the strings that appear in the list box.
  2752.         * @return array 
  2753.         */
  2754.         function readItems(return $this->_items}
  2755.         /**
  2756.         * Contains the strings that appear in the list box.
  2757.         * @param array $value 
  2758.         */
  2759.         function writeItems($value)
  2760.         {
  2761.                 if (is_array($value))
  2762.                 {
  2763.                         $this->_items $value;
  2764.                 }
  2765.                 else
  2766.                 {
  2767.                         $this->_items (empty($value)) array(array($value);
  2768.                 }
  2769.  
  2770.                 // sort the items
  2771.                 if ($this->_sorted == 1)
  2772.                 {
  2773.                         $this->sortItems();
  2774.                 }
  2775.         }
  2776.         function defaultItems(return array()}
  2777.  
  2778.         /**
  2779.         * Size of the listbox. Size defines the number of items that are shown
  2780.         * without a need of scrolling.
  2781.         * If bigger than 1 most browsers will use Height instead. If Size equals 1
  2782.         * the listbox truns into a combobox.
  2783.         * @return integer 
  2784.         */
  2785.         function readSize(return $this->_size}
  2786.         /**
  2787.         * Size of the listbox. Size defines the number of items that are shown
  2788.         * without a need of scrolling.
  2789.         * If bigger than 1 most browsers will use Height instead. If Size equals 1
  2790.         * the listbox truns into a combobox.
  2791.         * @param integer $value 
  2792.         */
  2793.         function writeSize($value$this->_size=$value}
  2794.         function defaultSize(return 4}
  2795.  
  2796.         /**
  2797.         * Specifies whether the items in a list box are arranged alphabetically.
  2798.         * @return bool 
  2799.         */
  2800.         function readSorted(return $this->_sorted}
  2801.         /**
  2802.         * Specifies whether the items in a list box are arranged alphabetically.
  2803.         * @param bool $value 
  2804.         */
  2805.         function writeSorted($value)
  2806.         {
  2807.                 $this->_sorted=$value;
  2808.                 if ($this->_sorted == 1)
  2809.                 {
  2810.                         $this->sortItems();
  2811.                 }
  2812.         }
  2813.         function defaultSorted(return 0}
  2814.  
  2815.         /**
  2816.         * TabOrder indicates in which order controls are access when using
  2817.         * the Tab key.
  2818.         * The value of the TabOrder can be between 0 and 32767.
  2819.         * @return integer 
  2820.         */
  2821.         function readTabOrder(return $this->_taborder}
  2822.         /**
  2823.         * TabOrder indicates in which order controls are access when using
  2824.         * the Tab key.
  2825.         * The value of the TabOrder can be between 0 and 32767.
  2826.         * @param integer $value 
  2827.         */
  2828.         function writeTabOrder($value$this->_taborder=$value}
  2829.         function defaultTabOrder(return 0}
  2830.  
  2831.         /**
  2832.         * Enable or disable the TabOrder property. The browser may still assign
  2833.         * a TabOrder by itself internally. This cannot be controlled by HTML.
  2834.         * @return bool 
  2835.         */
  2836.         function readTabStop(return $this->_tabstop}
  2837.         /**
  2838.         * Enable or disable the TabOrder property. The browser may still assign
  2839.         * a TabOrder by itself internally. This cannot be controlled by HTML.
  2840.         * @param bool $value 
  2841.         */
  2842.         function writeTabStop($value$this->_tabstop=$value}
  2843.         function defaultTabStop(return 1}
  2844.  
  2845. }
  2846.  
  2847.  
  2848. /**
  2849.  * Listbox class
  2850.  *
  2851.  * A class to encapsulate a listbox control
  2852.  *
  2853.  */
  2854. class ListBox extends CustomListBox
  2855. {
  2856.         /*
  2857.         * Publish the events
  2858.         */
  2859.         function getOnClick                     (return $this->readOnClick()}
  2860.         function setOnClick                     ($value$this->writeOnClick($value)}
  2861.  
  2862.         function getOnDblClick                  (return $this->readOnDblClick()}
  2863.         function setOnDblClick                  ($value$this->writeOnDblClick($value)}
  2864.  
  2865.         function getOnSubmit                    (return $this->readOnSubmit()}
  2866.         function setOnSubmit                    ($value$this->writeOnSubmit($value)}
  2867.  
  2868.         /*
  2869.         * Publish the JS events
  2870.         */
  2871.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  2872.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  2873.  
  2874.         function getjsOnChange                  (return $this->readjsOnChange()}
  2875.         function setjsOnChange                  ($value$this->writejsOnChange($value)}
  2876.  
  2877.         function getjsOnClick                   (return $this->readjsOnClick()}
  2878.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  2879.  
  2880.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  2881.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  2882.  
  2883.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  2884.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  2885.  
  2886.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  2887.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  2888.  
  2889.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  2890.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  2891.  
  2892.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  2893.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  2894.  
  2895.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  2896.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  2897.  
  2898.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  2899.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  2900.  
  2901.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  2902.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  2903.  
  2904.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  2905.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  2906.  
  2907.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  2908.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  2909.  
  2910.  
  2911.         /*
  2912.         * Publish the properties for the Label component
  2913.         */
  2914.  
  2915.         function getBorderStyle()
  2916.         {
  2917.                 return $this->readBorderStyle();
  2918.         }
  2919.         function setBorderStyle($value)
  2920.         {
  2921.                 $this->writeBorderStyle($value);
  2922.         }
  2923.  
  2924.         function getDataField()
  2925.         {
  2926.                 return $this->readDataField();
  2927.         }
  2928.         function setDataField($value)
  2929.         {
  2930.                 $this->writeDataField($value);
  2931.         }
  2932.  
  2933.         function getDataSource()
  2934.         {
  2935.                 return $this->readDataSource();
  2936.         }
  2937.         function setDataSource($value)
  2938.         {
  2939.                 $this->writeDataSource($value);
  2940.         }
  2941.  
  2942.         function getColor()
  2943.         {
  2944.                 return $this->readColor();
  2945.         }
  2946.         function setColor($value)
  2947.         {
  2948.                 $this->writeColor($value);
  2949.         }
  2950.  
  2951.         function getEnabled()
  2952.         {
  2953.                 return $this->readEnabled();
  2954.         }
  2955.         function setEnabled($value)
  2956.         {
  2957.                 $this->writeEnabled($value);
  2958.         }
  2959.  
  2960.         function getFont()
  2961.         {
  2962.                 return $this->readFont();
  2963.         }
  2964.         function setFont($value)
  2965.         {
  2966.                 $this->writeFont($value);
  2967.         }
  2968.  
  2969.         function getMultiSelect()
  2970.         {
  2971.                 return $this->readMultiSelect();
  2972.         }
  2973.         function setMultiSelect($value)
  2974.         {
  2975.                 $this->writeMultiSelect($value);
  2976.         }
  2977.  
  2978.         function getItems()
  2979.         {
  2980.                 return $this->readItems();
  2981.         }
  2982.         function setItems($value)
  2983.         {
  2984.                 $this->writeItems($value);
  2985.         }
  2986.  
  2987.         function getParentColor()
  2988.         {
  2989.                 return $this->readParentColor();
  2990.         }
  2991.         function setParentColor($value)
  2992.         {
  2993.                 $this->writeParentColor($value);
  2994.         }
  2995.  
  2996.         function getParentFont()
  2997.         {
  2998.                 return $this->readParentFont();
  2999.         }
  3000.         function setParentFont($value)
  3001.         {
  3002.                 $this->writeParentFont($value);
  3003.         }
  3004.  
  3005.         function getParentShowHint()
  3006.         {
  3007.                 return $this->readParentShowHint();
  3008.         }
  3009.         function setParentShowHint($value)
  3010.         {
  3011.                 $this->writeParentShowHint($value);
  3012.         }
  3013.  
  3014.         function getPopupMenu()
  3015.         {
  3016.                 return $this->readPopupMenu();
  3017.         }
  3018.         function setPopupMenu($value)
  3019.         {
  3020.                 $this->writePopupMenu($value);
  3021.         }
  3022.  
  3023.         function getShowHint()
  3024.         {
  3025.                 return $this->readShowHint();
  3026.         }
  3027.         function setShowHint($value)
  3028.         {
  3029.                 $this->writeShowHint($value);
  3030.         }
  3031.  
  3032.         function getSize()
  3033.         {
  3034.                 return $this->readSize();
  3035.         }
  3036.         function setSize($value)
  3037.         {
  3038.                 $this->writeSize($value);
  3039.         }
  3040.  
  3041.         function getSorted()
  3042.         {
  3043.                 return $this->readSorted();
  3044.         }
  3045.         function setSorted($value)
  3046.         {
  3047.                 $this->writeSorted($value);
  3048.         }
  3049.  
  3050.         function getStyle()             return $this->readstyle()}
  3051.         function setStyle($value)       $this->writestyle($value)}
  3052.  
  3053.         function getTabOrder()
  3054.         {
  3055.                 return $this->readTabOrder();
  3056.         }
  3057.         function setTabOrder($value)
  3058.         {
  3059.                 $this->writeTabOrder($value);
  3060.         }
  3061.  
  3062.         function getTabStop()
  3063.         {
  3064.                 return $this->readTabStop();
  3065.         }
  3066.         function setTabStop($value)
  3067.         {
  3068.                 $this->writeTabStop($value);
  3069.         }
  3070.  
  3071.         function getVisible()
  3072.         {
  3073.                 return $this->readVisible();
  3074.         }
  3075.         function setVisible($value)
  3076.         {
  3077.                 $this->writeVisible($value);
  3078.         }
  3079. }
  3080.  
  3081. /**
  3082.  * Combobox class
  3083.  *
  3084.  * A class to encapsulate a combobox control.
  3085.  * Note: It is directly subclassed from CustomListBox since they are almost
  3086.  *       identical in HTML. The only differentce is that no MultiSelect is
  3087.  *       possible.
  3088.  *
  3089.  */
  3090. class ComboBox extends CustomListBox
  3091. {
  3092.         function __construct($aowner null)
  3093.         {
  3094.                 //Calls inherited constructor
  3095.                 parent::__construct($aowner);
  3096.  
  3097.                 // size is always 1 to render a ComboBox in the browser
  3098.                 $this->_size = 1;
  3099.                 // no MultiSelect possible
  3100.                 $this->_multiselect = 0;
  3101.  
  3102.                 $this->Width 185;
  3103.                 $this->Height 18;
  3104.         }
  3105.  
  3106.         /*
  3107.         * Override the parent MultiSelect related functions; no MultiSelect possible.
  3108.         */
  3109.         function readSelCount()
  3110.         {
  3111.                 // only one or zero items can be selected
  3112.                 return ($this->_itemindex != -10;
  3113.         }
  3114.         function readMultiSelect()
  3115.         {
  3116.                 // always return false since MultiSelect can not be used with a ComboBox
  3117.                 return 0;
  3118.         }
  3119.         function writeMultiSelect($value)
  3120.         {
  3121.                 // do nothing; MultiSelect can not be used with a ComboBox
  3122.         }
  3123.  
  3124.         /*
  3125.         * Publish the events
  3126.         */
  3127.         function getOnChange                    (return $this->readOnChange()}
  3128.         function setOnChange                    ($value$this->writeOnChange($value)}
  3129.  
  3130.         function getOnDblClick                  (return $this->readOnDblClick()}
  3131.         function setOnDblClick                  ($value$this->writeOnDblClick($value)}
  3132.  
  3133.         function getOnSubmit                    (return $this->readOnSubmit()}
  3134.         function setOnSubmit                    ($value$this->writeOnSubmit($value)}
  3135.  
  3136.         /*
  3137.         * Publish the JS events
  3138.         */
  3139.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  3140.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  3141.  
  3142.         function getjsOnChange                  (return $this->readjsOnChange()}
  3143.         function setjsOnChange                  ($value$this->writejsOnChange($value)}
  3144.  
  3145.         function getjsOnClick                   (return $this->readjsOnClick()}
  3146.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  3147.  
  3148.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  3149.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  3150.  
  3151.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  3152.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  3153.  
  3154.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  3155.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  3156.  
  3157.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  3158.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  3159.  
  3160.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  3161.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  3162.  
  3163.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  3164.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  3165.  
  3166.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  3167.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  3168.  
  3169.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  3170.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  3171.  
  3172.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  3173.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  3174.  
  3175.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  3176.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  3177.  
  3178.  
  3179.         /*
  3180.         * Publish the properties for the Label component
  3181.         */
  3182.  
  3183.         function getBorderStyle()
  3184.         {
  3185.                 return $this->readBorderStyle();
  3186.         }
  3187.         function setBorderStyle($value)
  3188.         {
  3189.                 $this->writeBorderStyle($value);
  3190.         }
  3191.  
  3192.         function getDataField()
  3193.         {
  3194.                 return $this->readDataField();
  3195.         }
  3196.         function setDataField($value)
  3197.         {
  3198.                 $this->writeDataField($value);
  3199.         }
  3200.  
  3201.         function getDataSource()
  3202.         {
  3203.                 return $this->readDataSource();
  3204.         }
  3205.         function setDataSource($value)
  3206.         {
  3207.                 $this->writeDataSource($value);
  3208.         }
  3209.  
  3210.         function getColor()
  3211.         {
  3212.                 return $this->readColor();
  3213.         }
  3214.         function setColor($value)
  3215.         {
  3216.                 $this->writeColor($value);
  3217.         }
  3218.  
  3219.         function getEnabled()
  3220.         {
  3221.                 return $this->readEnabled();
  3222.         }
  3223.         function setEnabled($value)
  3224.         {
  3225.                 $this->writeEnabled($value);
  3226.         }
  3227.  
  3228.         function getFont()
  3229.         {
  3230.                 return $this->readFont();
  3231.         }
  3232.         function setFont($value)
  3233.         {
  3234.                 $this->writeFont($value);
  3235.         }
  3236.  
  3237.         function getItems()
  3238.         {
  3239.                 return $this->readItems();
  3240.         }
  3241.         function setItems($value)
  3242.         {
  3243.                 $this->writeItems($value);
  3244.         }
  3245.  
  3246.         function getItemIndex()
  3247.         {
  3248.                 return $this->readItemIndex();
  3249.         }
  3250.         function setItemIndex($value)
  3251.         {
  3252.                 $this->writeItemIndex($value);
  3253.         }
  3254.  
  3255.         function getParentColor()
  3256.         {
  3257.                 return $this->readParentColor();
  3258.         }
  3259.         function setParentColor($value)
  3260.         {
  3261.                 $this->writeParentColor($value);
  3262.         }
  3263.  
  3264.         function getParentFont()
  3265.         {
  3266.                 return $this->readParentFont();
  3267.         }
  3268.         function setParentFont($value)
  3269.         {
  3270.                 $this->writeParentFont($value);
  3271.         }
  3272.  
  3273.         function getParentShowHint()
  3274.         {
  3275.                 return $this->readParentShowHint();
  3276.         }
  3277.         function setParentShowHint($value)
  3278.         {
  3279.                 $this->writeParentShowHint($value);
  3280.         }
  3281.  
  3282.         function getPopupMenu()
  3283.         {
  3284.                 return $this->readPopupMenu();
  3285.         }
  3286.         function setPopupMenu($value)
  3287.         {
  3288.                 $this->writePopupMenu($value);
  3289.         }
  3290.  
  3291.         function getShowHint()
  3292.         {
  3293.                 return $this->readShowHint();
  3294.         }
  3295.         function setShowHint($value)
  3296.         {
  3297.                 $this->writeShowHint($value);
  3298.         }
  3299.  
  3300.         function getSorted()
  3301.         {
  3302.                 return $this->readSorted();
  3303.         }
  3304.         function setSorted($value)
  3305.         {
  3306.                 $this->writeSorted($value);
  3307.         }
  3308.  
  3309.         function getStyle()             return $this->readstyle()}
  3310.         function setStyle($value)       $this->writestyle($value)}
  3311.  
  3312.         function getTabOrder()
  3313.         {
  3314.                 return $this->readTabOrder();
  3315.         }
  3316.         function setTabOrder($value)
  3317.         {
  3318.                 $this->writeTabOrder($value);
  3319.         }
  3320.  
  3321.         function getTabStop()
  3322.         {
  3323.                 return $this->readTabStop();
  3324.         }
  3325.         function setTabStop($value)
  3326.         {
  3327.                 $this->writeTabStop($value);
  3328.         }
  3329.  
  3330.         function getVisible()
  3331.         {
  3332.                 return $this->readVisible();
  3333.         }
  3334.         function setVisible($value)
  3335.         {
  3336.                 $this->writeVisible($value);
  3337.         }
  3338. }
  3339.  
  3340.  
  3341. /**
  3342.  * ButtonControl class
  3343.  *
  3344.  * ButtonControl is the base class for objects that represent button controls,
  3345.  * such as Button, CheckBox, RadioButton.
  3346.  *
  3347.  */
  3348. class ButtonControl extends FocusControl
  3349. {
  3350.         protected $_onclick = null;
  3351.         protected $_onsubmit = null;
  3352.         protected $_jsonselect = null;
  3353.  
  3354.         protected $_checked = 0;
  3355.         protected $_datasource = null;
  3356.         protected $_datafield = "";
  3357.         protected $_taborder = 0;
  3358.         protected $_tabstop = 1;
  3359.  
  3360.         // defines which property is set by the datasource
  3361.         
  3362.         protected $_datafieldproperty = 'Caption';
  3363.  
  3364.  
  3365.         function __construct($aowner null)
  3366.         {
  3367.                 //Calls inherited constructor
  3368.                 parent::__construct($aowner);
  3369.  
  3370.                 $this->Width 75;
  3371.                 $this->Height 25;
  3372.                 $this->ControlStyle="csRenderOwner=1";
  3373.                 $this->ControlStyle="csRenderAlso=StyleSheet";
  3374.         }
  3375.  
  3376.         function loaded()
  3377.         {
  3378.                 parent::loaded();
  3379.                 $this->writeDataSource($this->_datasource);
  3380.         }
  3381.  
  3382.         function init()
  3383.         {
  3384.                 $submitted $this->input->{$this->Name};
  3385.  
  3386.                 // Allow the OnSubmit event to be fired because it is not
  3387.                 // a mouse or keyboard event.
  3388.                 if ($this->_onsubmit != null && is_object($submitted))
  3389.                 {
  3390.                         $this->callEvent('onsubmit'array());
  3391.                 }
  3392.  
  3393.                 $submitEventValue $this->input->{$this->getJSWrapperHiddenFieldName()};
  3394.                 if (is_object($submitEventValue&& $this->_enabled == 1)
  3395.                 {
  3396.                         // check if the a click event of the current button
  3397.                         // has been fired
  3398.                         
  3399.                         if ($this->_onclick != null && $submitEventValue->asString(== $this->getJSWrapperSubmitEventValue($this->_onclick))
  3400.                         {
  3401.                                 $this->callEvent('onclick'array());
  3402.                         }
  3403.                 }
  3404.         }
  3405.  
  3406.         /**
  3407.         * This function was introduced to be flexible with the sub-classed controls.
  3408.         * It takes all necessary info to dump the control.
  3409.         * @param string $inputType Input type such as submit, button, check, radio, etc..
  3410.         * @param string $name Name of the control
  3411.         * @param string $additionalAttributes String containing additional attributes that will be included in the <input ..> tag.
  3412.         * @param string $surroundingTags Tags that surround the <input ..> tag. Use %s to specify were the <input> tag should be placed.
  3413.         * @param bool $composite If true height and width will not be applied to the styles in this function,
  3414.         *                         they must be appied at the location where this fucntion is called.
  3415.         */
  3416.         function dumpContentsButtonControl($inputType$name,
  3417.           $additionalAttributes ""$surroundingTags "%s"$composite false)
  3418.         {
  3419.                 $events "";
  3420.                 if ($this->_enabled == 1)
  3421.                 {
  3422.                         // get the string for the JS Events
  3423.                         $events $this->readJsEvents();
  3424.  
  3425.                         // add the OnSelect JS-Event
  3426.                         if ($this->_jsonselect != null)
  3427.                         {
  3428.                                 $events .= " onselect=\"return $this->_jsonselect(event)\" ";
  3429.                         }
  3430.  
  3431.                         // add or replace the JS events with the wrappers if necessary
  3432.                         $this->addJSWrapperToEvents($events$this->_onclick$this->_jsonclick"onclick");
  3433.                 }
  3434.  
  3435.                 $style "";
  3436.                 if ($this->Style=="")
  3437.                 {
  3438.                         $style .= $this->Font->FontString;
  3439.                         if ($this->color != "")
  3440.                         {
  3441.                                 $style .= "background-color: " $this->color ";";
  3442.                         }
  3443.  
  3444.                         // add the cursor to the style
  3445.                         if ($this->_cursor != "")
  3446.                         {
  3447.                                 $cr strtolower(substr($this->_cursor2));
  3448.                                 $style .= "cursor$cr;";
  3449.                         }
  3450.                 }
  3451.  
  3452.                 if (!$composite)
  3453.                 {
  3454.                     if (!$this->_adjusttolayout)
  3455.                     {
  3456.                         $style .= "height:" $this->Height . "px;width:" $this->Width . "px;";
  3457.                     }
  3458.                     else
  3459.                     {
  3460.                         $style .= "height:100%;width:100%;";
  3461.                     }
  3462.                 }
  3463.  
  3464.                 // get the Caption of the button if it is data-aware
  3465.                 if (($this->ControlState csDesigning!= csDesigning)
  3466.                 {
  3467.                         if ($this->hasValidDataField())
  3468.                         {
  3469.                                 // depending on the sub-class there is another property to be set by the data-source (e.g. Button = Caption; CheckBox = Checked)
  3470.                                 $this->{$this->_datafieldproperty$this->readDataFieldValue();
  3471.  
  3472.                                 //Dumps hidden fields to know which is the record to update
  3473.                                 $this->dumpHiddenKeyFields();
  3474.                         }
  3475.                 }
  3476.  
  3477.                 // set the checked status
  3478.                 $checked ($this->_checked"checked=\"checked\"" "";
  3479.  
  3480.                 // set enabled/disabled status
  3481.                 $enabled (!$this->_enabled"disabled=\"disabled\"" "";
  3482.  
  3483.                 // set tab order if tab stop set to true
  3484.                 $taborder ($this->_tabstop == 1"tabindex=\"$this->_taborder\""";
  3485.  
  3486.                 // get the hint attribute; returns: title="[HintText]"
  3487.                 $hint $this->getHintAttribute();
  3488.  
  3489.                 if ($style != "")  $style "style=\"$style\"";
  3490.  
  3491.                 $class ($this->Style != """class=\"$this->StyleClass\""";
  3492.  
  3493.                 // call the OnShow event if assigned so the Caption property can be changed
  3494.                 if ($this->_onshow != null)
  3495.                 {
  3496.                         $this->callEvent('onshow'array());
  3497.                 }
  3498.  
  3499.                 // assemble the input tag
  3500.                 $input "<input type=\"$inputType\" id=\"$name\" name=\"$name\" value=\"$this->_caption\" $events $style $checked $enabled $taborder $hint $additionalAttributes $class />";
  3501.                 // output the control
  3502.                 printf($surroundingTags$input);
  3503.  
  3504.                 // add a hidden field so we can determine which button fired the OnClick event
  3505.                 if ($this->_onclick != null)
  3506.                 {
  3507.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  3508.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  3509.                 }
  3510.         }
  3511.  
  3512.         /*
  3513.         * Write the Javascript section to the header
  3514.         */
  3515.         function dumpJavascript()
  3516.         {
  3517.                 parent::dumpJavascript();
  3518.  
  3519.                 if ($this->_enabled == 1)
  3520.                 {
  3521.                         if ($this->_jsonselect != null)
  3522.                         {
  3523.                                 $this->dumpJSEvent($this->_jsonselect);
  3524.                         }
  3525.  
  3526.                         if ($this->_onclick != null && !defined($this->_onclick))
  3527.                         {
  3528.                                 // only output the same function once;
  3529.                                 // otherwise if for example two buttons use the same
  3530.                                 // OnClick event handler it would be outputted twice.
  3531.                                 $def=$this->_onclick;
  3532.                                 define($def,1);
  3533.  
  3534.                                 // output the wrapper function
  3535.                                 echo $this->getJSWrapperFunction($this->_onclick);
  3536.                         }
  3537.                 }
  3538.         }
  3539.  
  3540.  
  3541.  
  3542.         /**
  3543.         * Occurs when the user clicks the control.
  3544.         * @return mixed Returns the event handler or null if no handler is set.
  3545.         */
  3546.         function readOnClick(return $this->_onclick}
  3547.         /**
  3548.         * Occurs when the user clicks the control.
  3549.         * @param mixed $value Event handler or null to unset.
  3550.         */
  3551.         function writeOnClick($value$this->_onclick $value}
  3552.         function defaultOnClick(return ""}
  3553.  
  3554.         /**
  3555.         * JS event when the control gets focus.
  3556.         * @return mixed Returns the event handler or null if no handler is set.
  3557.         */
  3558.         function readjsOnSelect(return $this->_jsonselect}
  3559.         /**
  3560.         * JS event when the control gets focus.
  3561.         * @param mixed $value Event handler or null to unset.
  3562.         */
  3563.         function writejsOnSelect($value$this->_jsonselect=$value}
  3564.         function defaultjsOnSelect(return null}
  3565.  
  3566.         /**
  3567.         * Occurs when the form containing the control was submitted.
  3568.         * @return mixed Returns the event handler or null if no handler is set.
  3569.         */
  3570.         function readOnSubmit(return $this->_onsubmit}
  3571.         /**
  3572.         * Occurs when the form containing the control was submitted.
  3573.         * @param mixed Event handler or null if no handler is set.
  3574.         */
  3575.         function writeOnSubmit($value$this->_onsubmit=$value}
  3576.         function defaultOnSubmit(return null}
  3577.  
  3578.         /**
  3579.         * Specifies whether the button control is checked.
  3580.         * @return bool 
  3581.         */
  3582.         function readChecked(return $this->_checked}
  3583.         /**
  3584.         * Specifies whether the button control is checked.
  3585.         * @param bool $value 
  3586.         */
  3587.         function writeChecked($value$this->_checked=$value}
  3588.         function defaultChecked(return 0}
  3589.  
  3590.         //DataField property
  3591.         function readDataField(return $this->_datafield}
  3592.         function writeDataField($value$this->_datafield $value}
  3593.         function defaultDataField(return ""}
  3594.  
  3595.         //DataSource property
  3596.         function readDataSource(return $this->_datasource}
  3597.         function writeDataSource($value)
  3598.         {
  3599.                 $this->_datasource $this->fixupProperty($value);
  3600.         }
  3601.         function defaultDataSource(return null}
  3602.  
  3603.         /**
  3604.         * TabOrder indicates in which order controls are access when using
  3605.         * the Tab key.
  3606.         * The value of the TabOrder can be between 0 and 32767.
  3607.         * @return integer 
  3608.         */
  3609.         function readTabOrder(return $this->_taborder}
  3610.         /**
  3611.         * TabOrder indicates in which order controls are access when using
  3612.         * the Tab key.
  3613.         * The value of the TabOrder can be between 0 and 32767.
  3614.         * @param integer $value 
  3615.         */
  3616.         function writeTabOrder($value$this->_taborder=$value}
  3617.         function defaultTabOrder(return 0}
  3618.  
  3619.         /**
  3620.         * Enable or disable the TabOrder property. The browser may still assign
  3621.         * a TabOrder by itself internally. This cannot be controlled by HTML.
  3622.         * @return bool 
  3623.         */
  3624.         function readTabStop(return $this->_tabstop}
  3625.         /**
  3626.         * Enable or disable the TabOrder property. The browser may still assign
  3627.         * a TabOrder by itself internally. This cannot be controlled by HTML.
  3628.         * @param bool $value 
  3629.         */
  3630.         function writeTabStop($value$this->_tabstop=$value}
  3631.         function defaultTabStop(return 1}
  3632. }
  3633.  
  3634.  
  3635. define('btSubmit''btSubmit');
  3636. define('btReset''btReset');
  3637. define('btNormal''btNormal');
  3638.  
  3639. /**
  3640.  * Button class
  3641.  *
  3642.  * This class controls the properties and events of a button control.
  3643.  *
  3644.  */
  3645. class Button extends ButtonControl
  3646. {
  3647.         protected $_buttontype = btSubmit;
  3648.         protected $_default = 0;
  3649.         protected $_imagesource = "";
  3650.  
  3651.         function __construct($aowner null)
  3652.         {
  3653.                 //Calls inherited constructor
  3654.                 parent::__construct($aowner);
  3655.  
  3656.                 // define which property is set by the datasource
  3657.                 $this->_datafieldproperty = 'Caption';
  3658.         }
  3659.  
  3660.         function dumpContents()
  3661.         {
  3662.                 // get the button type
  3663.                 $buttontype "submit";
  3664.                 switch ($this->_buttontype)
  3665.                 {
  3666.                         case btSubmit :
  3667.                                 $buttontype "submit";
  3668.                                 break;
  3669.                         case btReset :
  3670.                                 $buttontype "reset";
  3671.                                 break;
  3672.                         case btNormal :
  3673.                                 $buttontype "button";
  3674.                                 break;
  3675.                 }
  3676.  
  3677.                 // Check if an imagesource is defined, if yes then let's make an
  3678.                 // image input.
  3679.                 $imagesrc "";
  3680.                 if ($this->_imagesource != "")
  3681.                 {
  3682.                         $buttontype "image";
  3683.                         $imagesrc "src=\"$this->_imagesource\"";
  3684.                 }
  3685.  
  3686.                 // override the buttontype if Default is true
  3687.                 if ($this->_default == 1)
  3688.                 {
  3689.                         $buttontype "submit";
  3690.                         $imagesrc "";
  3691.                 }
  3692.  
  3693.                 // dump to control with all other parameters
  3694.                 $this->dumpContentsButtonControl($buttontype$this->_name$imagesrc);
  3695.         }
  3696.  
  3697.         /**
  3698.         * A standard HTML button can have 3 different types:
  3699.         * - btSubmit submits the HTML form.
  3700.         * - btReset resets the HTML form back to the initial values.
  3701.         * - btNormal is a regular button, the browser does not submit the form if no OnClick event has been assigned.
  3702.         *
  3703.         * Note: If Default is true then ButtonType is always btSubmit.
  3704.         * @return enum (btSubmit, btReset, btNormal)
  3705.         */
  3706.         function readButtonType(return $this->_buttontype}
  3707.         /**
  3708.         * A standard HTML button can have 3 different types:
  3709.         * - btSubmit submits the HTML form.
  3710.         * - btReset resets the HTML form back to the initial values.
  3711.         * - btNormal is a regular button, the browser does not submit the form if no OnClick event has been assigned.
  3712.         *
  3713.         * Note: If Default is true then ButtonType is always btSubmit.
  3714.         * @param enum (btSubmit, btReset, btNormal)
  3715.         */
  3716.         function writeButtonType($value)
  3717.         {
  3718.                 $this->_buttontype = $value;
  3719.                 // if ButtonType is not submit and default is set then unset default
  3720.                 if ($this->_buttontype != btSubmit && $this->_default == 1)
  3721.                 {
  3722.                         $this->Default 0;
  3723.                 }
  3724.         }
  3725.         function defaultButtonType(return btSubmit}
  3726.  
  3727.         /**
  3728.         * Determines whether the button’s OnClick event handler executes when the Enter key is pressed.
  3729.         * If Default is true the button type is btSubmit.
  3730.         *
  3731.         * Note: This behavior is controlled by the browser and might vary between
  3732.         *       different browsers.
  3733.         *
  3734.         * @return bool 
  3735.         */
  3736.         function readDefault(return $this->_default}
  3737.         /**
  3738.         * Determines whether the button’s OnClick event handler executes when the Enter key is pressed.
  3739.         * If Default is true the button type is btSubmit.
  3740.         *
  3741.         * Note: This behavior is controlled by the browser and might vary between
  3742.         *       different browsers.
  3743.         *
  3744.         * @param bool $value 
  3745.         */
  3746.         function writeDefault($value)
  3747.         {
  3748.                 $this->_default=$value;
  3749.                 // If set to default the ButtonType has to be submit
  3750.                 if ($this->_default == 1)
  3751.                 {
  3752.                         $this->ButtonType btSubmit;
  3753.                 }
  3754.         }
  3755.         function defaultDefault(return 0}
  3756.  
  3757.         /**
  3758.         * An image can be used as button. This is usually done to have a nice graphical interface.
  3759.         * To avoid distortion make sure you set the images height and width to button's Height and Width.
  3760.         * If ImageSource is empty it is not used.
  3761.         * @return string 
  3762.         */
  3763.         function readImageSource(return $this->_imagesource}
  3764.         /**
  3765.         * An image can be used as button. This is usually done to have a nice graphical interface.
  3766.         * To avoid distortion make sure you set the images height and width to button's Height and Width.
  3767.         * If ImageSource is empty it is not used.
  3768.         * @param string $value 
  3769.         */
  3770.         function writeImageSource($value$this->_imagesource = $value}
  3771.         function defaultImageSource(return ""}
  3772.  
  3773.         /*
  3774.         * Publish the events for the Button component
  3775.         */
  3776.         function getOnClick                   (return $this->readOnClick()}
  3777.         function setOnClick($value)           $this->writeOnClick($value)}
  3778.  
  3779.         /*
  3780.         * Publish the JS events for the Button component
  3781.         */
  3782.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  3783.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  3784.  
  3785.         function getjsOnChange                  (return $this->readjsOnChange()}
  3786.         function setjsOnChange                  ($value$this->writejsOnChange($value)}
  3787.  
  3788.         function getjsOnClick                   (return $this->readjsOnClick()}
  3789.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  3790.  
  3791.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  3792.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  3793.  
  3794.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  3795.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  3796.  
  3797.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  3798.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  3799.  
  3800.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  3801.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  3802.  
  3803.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  3804.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  3805.  
  3806.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  3807.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  3808.  
  3809.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  3810.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  3811.  
  3812.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  3813.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  3814.  
  3815.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  3816.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  3817.  
  3818.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  3819.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  3820.  
  3821.         function getjsOnSelect                  (return $this->readjsOnSelect()}
  3822.         function setjsOnSelect                  ($value$this->writejsOnSelect($value)}
  3823.  
  3824.  
  3825.         /*
  3826.         * Publish the properties for the Button component
  3827.         */
  3828.  
  3829.         function getButtonType()
  3830.         {
  3831.                 return $this->readButtonType();
  3832.         }
  3833.         function setButtonType($value)
  3834.         {
  3835.                 $this->writeButtonType($value);
  3836.         }
  3837.  
  3838.         function getCaption()
  3839.         {
  3840.                 return $this->readCaption();
  3841.         }
  3842.         function setCaption($value)
  3843.         {
  3844.                 $this->writeCaption($value);
  3845.         }
  3846.  
  3847.         function getColor()
  3848.         {
  3849.                 return $this->readColor();
  3850.         }
  3851.         function setColor($value)
  3852.         {
  3853.                 $this->writeColor($value);
  3854.         }
  3855.  
  3856.         function getDataField()
  3857.         {
  3858.                 return $this->readDataField();
  3859.         }
  3860.         function setDataField($value)
  3861.         {
  3862.                 $this->writeDataField($value);
  3863.         }
  3864.  
  3865.         function getDataSource()
  3866.         {
  3867.                 return $this->readDataSource();
  3868.         }
  3869.         function setDataSource($value)
  3870.         {
  3871.                 $this->writeDataSource($value);
  3872.         }
  3873.  
  3874.         function getDefault()
  3875.         {
  3876.                 return $this->readDefault();
  3877.         }
  3878.         function setDefault($value)
  3879.         {
  3880.                 $this->writeDefault($value);
  3881.         }
  3882.  
  3883.         function getEnabled()
  3884.         {
  3885.                 return $this->readEnabled();
  3886.         }
  3887.         function setEnabled($value)
  3888.         {
  3889.                 $this->writeEnabled($value);
  3890.         }
  3891.  
  3892.         function getFont()
  3893.         {
  3894.                 return $this->readFont();
  3895.         }
  3896.         function setFont($value)
  3897.         {
  3898.                 $this->writeFont($value);
  3899.         }
  3900.  
  3901.         function getImageSource()
  3902.         {
  3903.                 return $this->readImageSource();
  3904.         }
  3905.         function setImageSource($value)
  3906.         {
  3907.                 $this->writeImageSource($value);
  3908.         }
  3909.  
  3910.         function getParentColor()
  3911.         {
  3912.                 return $this->readParentColor();
  3913.         }
  3914.         function setParentColor($value)
  3915.         {
  3916.                 $this->writeParentColor($value);
  3917.         }
  3918.  
  3919.         function getParentFont()
  3920.         {
  3921.                 return $this->readParentFont();
  3922.         }
  3923.         function setParentFont($value)
  3924.         {
  3925.                 $this->writeParentFont($value);
  3926.         }
  3927.  
  3928.         function getParentShowHint()
  3929.         {
  3930.                 return $this->readParentShowHint();
  3931.         }
  3932.         function setParentShowHint($value)
  3933.         {
  3934.                 $this->writeParentShowHint($value);
  3935.         }
  3936.  
  3937.         function getPopupMenu()
  3938.         {
  3939.                 return $this->readPopupMenu();
  3940.         }
  3941.         function setPopupMenu($value)
  3942.         {
  3943.                 $this->writePopupMenu($value);
  3944.         }
  3945.  
  3946.         function getShowHint()
  3947.         {
  3948.                 return $this->readShowHint();
  3949.         }
  3950.         function setShowHint($value)
  3951.         {
  3952.                 $this->writeShowHint($value);
  3953.         }
  3954.  
  3955.         function getStyle()             return $this->readstyle()}
  3956.         function setStyle($value)       $this->writestyle($value)}
  3957.  
  3958.         function getTabOrder()
  3959.         {
  3960.                 return $this->readTabOrder();
  3961.         }
  3962.         function setTabOrder($value)
  3963.         {
  3964.                 $this->writeTabOrder($value);
  3965.         }
  3966.  
  3967.         function getTabStop()
  3968.         {
  3969.                 return $this->readTabStop();
  3970.         }
  3971.         function setTabStop($value)
  3972.         {
  3973.                 $this->writeTabStop($value);
  3974.         }
  3975.  
  3976.         function getVisible()
  3977.         {
  3978.                 return $this->readVisible();
  3979.         }
  3980.         function setVisible($value)
  3981.         {
  3982.                 $this->writeVisible($value);
  3983.         }
  3984. }
  3985.  
  3986.  
  3987. /**
  3988.  * CustomCheckBox class
  3989.  *
  3990.  * Base class for Checkbox controls.
  3991.  * CheckBox represents a check box that can be on (checked) or off (unchecked).
  3992.  *
  3993.  */
  3994. class CustomCheckBox extends ButtonControl
  3995. {
  3996.  
  3997.         function __construct($aowner null)
  3998.         {
  3999.                 //Calls inherited constructor
  4000.                 parent::__construct($aowner);
  4001.  
  4002.                 $this->Width 121;
  4003.                 $this->Height 21;
  4004.  
  4005.                 // define which property is set by the datasource
  4006.                 $this->_datafieldproperty = 'Checked';
  4007.         }
  4008.  
  4009.         function preinit()
  4010.         {
  4011.                 $submittedValue $this->input->{$this->_name};
  4012.  
  4013.                 // check if the CheckBox is checked (compare against the Caption
  4014.                 // since it is submitted as value)
  4015.                 if (is_object($submittedValue&& $submittedValue->asString(== $this->_caption)
  4016.                 {
  4017.                         $this->_checked = 1;
  4018.                         //If there is any valid DataField attached, update it
  4019.                         $this->updateDataField($this->_checked);
  4020.                 }
  4021.                 else if (($this->ControlState csDesigning!= csDesigning)
  4022.                 {
  4023.                         $this->_checked = 0;
  4024.                         //If there is any valid DataField attached, update it
  4025.                         $this->updateDataField($this->_checked);
  4026.                 }
  4027.         }
  4028.  
  4029.         function dumpContents()
  4030.         {
  4031.                 $style "";
  4032.                 if ($this->Style=="")
  4033.                 {
  4034.                         $style .= $this->Font->FontString;
  4035.  
  4036.                         if ($this->color != "")
  4037.                         {
  4038.                                 $style .= "background-color: ".$this->color.";";
  4039.                         }
  4040.  
  4041.                         // add the cursor to the style
  4042.                         if ($this->_cursor != "")
  4043.                         {
  4044.                                 $cr strtolower(substr($this->_cursor2));
  4045.                                 $style .= "cursor$cr;";
  4046.                         }
  4047.                 }
  4048.  
  4049.                 $height $this->Height 1;
  4050.                 $width $this->Width;
  4051.  
  4052.                 $style .= "height:".$height."px;width:".$width."px;";
  4053.  
  4054.                 if ($style != "")  $style "style=\"$style\"";
  4055.  
  4056.                 // get the hint attribute; returns: title="[HintText]"
  4057.                 $hint $this->getHintAttribute();
  4058.  
  4059.                 // get the alignment of the Caption
  4060.                 $alignment "";
  4061.                 switch ($this->_alignment)
  4062.                 {
  4063.                         case agNone :
  4064.                                 $alignment "";
  4065.                                 break;
  4066.                         case agLeft :
  4067.                                 $alignment "align=\"Left\"";
  4068.                                 break;
  4069.                         case agCenter :
  4070.                                 $alignment "align=\"Center\"";
  4071.                                 break;
  4072.                         case agRight :
  4073.                                 $alignment "align=\"Right\"";
  4074.                                 break;
  4075.                 }
  4076.  
  4077.                 $class ($this->Style != """class=\"$this->StyleClass\""";
  4078.  
  4079.                 $surroundingTags "<table cellpadding=\"0\" cellspacing=\"0\" id=\"{$this->_name}_table\" $style $class><tr><td width=\"20\">\n";
  4080.                 $surroundingTags .= "%s\n";
  4081.                 $surroundingTags .= "</td><td $alignment>\n";
  4082.                 // add some JS to the Caption (OnClick)
  4083.                 $surroundingTags .= ($this->Owner != null"<span id=\"{$this->_name}_caption\" onclick=\"var c = document.forms[0].$this->_namec.checked = !c.checkedreturn (typeof(c.onclick) == 'function') ? c.onclick() : false;\" $hint $class>" : "<span>";
  4084.                 $surroundingTags .= $this->_caption;
  4085.                 $surroundingTags .= "</span>\n";
  4086.                 $surroundingTags .= "</td></tr></table>\n";
  4087.  
  4088.                 $this->dumpContentsButtonControl("checkbox"$this->_name,
  4089.                   ""$surroundingTagstrue);
  4090.         }
  4091. }
  4092.  
  4093. /**
  4094.  * CheckBox class
  4095.  *
  4096.  * A HTML checkbox.
  4097.  * CheckBox represents a check box that can be on (checked) or off (unchecked).
  4098.  *
  4099.  */
  4100. class CheckBox extends CustomCheckBox
  4101. {
  4102.         /*
  4103.         * Publish the events for the CheckBox component
  4104.         */
  4105.         function getOnClick                   () { return $this->readOnClick()}
  4106.         function setOnClick($value)           { $this->writeOnClick($value)}
  4107.  
  4108.         function getOnSubmit                  () { return $this->readOnSubmit()}
  4109.         function setOnSubmit                  ($value) { $this->writeOnSubmit($value)}
  4110.  
  4111.         /*
  4112.         * Publish the JS events for the CheckBox component
  4113.         */
  4114.         function getjsOnBlur                    () { return $this->readjsOnBlur()}
  4115.         function setjsOnBlur                    ($value) { $this->writejsOnBlur($value)}
  4116.  
  4117.         function getjsOnChange                  () { return $this->readjsOnChange()}
  4118.         function setjsOnChange                  ($value) { $this->writejsOnChange($value)}
  4119.  
  4120.         function getjsOnClick                   () { return $this->readjsOnClick()}
  4121.         function setjsOnClick                   ($value) { $this->writejsOnClick($value)}
  4122.  
  4123.         function getjsOnDblClick                () { return $this->readjsOnDblClick()}
  4124.         function setjsOnDblClick                ($value) { $this->writejsOnDblClick($value)}
  4125.  
  4126.         function getjsOnFocus                   () { return $this->readjsOnFocus()}
  4127.         function setjsOnFocus                   ($value) { $this->writejsOnFocus($value)}
  4128.  
  4129.         function getjsOnMouseDown               () { return $this->readjsOnMouseDown()}
  4130.         function setjsOnMouseDown               ($value) { $this->writejsOnMouseDown($value)}
  4131.  
  4132.         function getjsOnMouseUp                 () { return $this->readjsOnMouseUp()}
  4133.         function setjsOnMouseUp                 ($value) { $this->writejsOnMouseUp($value)}
  4134.  
  4135.         function getjsOnMouseOver               () { return $this->readjsOnMouseOver()}
  4136.         function setjsOnMouseOver               ($value) { $this->writejsOnMouseOver($value)}
  4137.  
  4138.         function getjsOnMouseMove               () { return $this->readjsOnMouseMove()}
  4139.         function setjsOnMouseMove               ($value) { $this->writejsOnMouseMove($value)}
  4140.  
  4141.         function getjsOnMouseOut                () { return $this->readjsOnMouseOut()}
  4142.         function setjsOnMouseOut                ($value) { $this->writejsOnMouseOut($value)}
  4143.  
  4144.         function getjsOnKeyPress                () { return $this->readjsOnKeyPress()}
  4145.         function setjsOnKeyPress                ($value) { $this->writejsOnKeyPress($value)}
  4146.  
  4147.         function getjsOnKeyDown                 () { return $this->readjsOnKeyDown()}
  4148.         function setjsOnKeyDown                 ($value) { $this->writejsOnKeyDown($value)}
  4149.  
  4150.         function getjsOnKeyUp                   () { return $this->readjsOnKeyUp()}
  4151.         function setjsOnKeyUp                   ($value) { $this->writejsOnKeyUp($value)}
  4152.  
  4153.         function getjsOnSelect                  () { return $this->readjsOnSelect()}
  4154.         function setjsOnSelect                  ($value) { $this->writejsOnSelect($value)}
  4155.  
  4156.  
  4157.         /*
  4158.         * Publish the properties for the CheckBox component
  4159.         */
  4160.  
  4161.         function getAlignment()
  4162.         {
  4163.                 return $this->readAlignment();
  4164.         }
  4165.         function setAlignment($value)
  4166.         {
  4167.                 $this->writeAlignment($value);
  4168.         }
  4169.  
  4170.         function getCaption()
  4171.         {
  4172.                 return $this->readCaption();
  4173.         }
  4174.         function setCaption($value)
  4175.         {
  4176.                 $this->writeCaption($value);
  4177.         }
  4178.  
  4179.         function getChecked()
  4180.         {
  4181.                 return $this->readChecked();
  4182.         }
  4183.         function setChecked($value)
  4184.         {
  4185.                 $this->writeChecked($value);
  4186.         }
  4187.  
  4188.         function getColor()
  4189.         {
  4190.                 return $this->readColor();
  4191.         }
  4192.         function setColor($value)
  4193.         {
  4194.                 $this->writeColor($value);
  4195.         }
  4196.  
  4197.         function getDataField()
  4198.         {
  4199.                 return $this->readDataField();
  4200.         }
  4201.         function setDataField($value)
  4202.         {
  4203.                 $this->writeDataField($value);
  4204.         }
  4205.  
  4206.         function getDataSource()
  4207.         {
  4208.                 return $this->readDataSource();
  4209.         }
  4210.         function setDataSource($value)
  4211.         {
  4212.                 $this->writeDataSource($value);
  4213.         }
  4214.  
  4215.         function getEnabled()
  4216.         {
  4217.                 return $this->readEnabled();
  4218.         }
  4219.         function setEnabled($value)
  4220.         {
  4221.                 $this->writeEnabled($value);
  4222.         }
  4223.  
  4224.         function getFont()
  4225.         {
  4226.                 return $this->readFont();
  4227.         }
  4228.         function setFont($value)
  4229.         {
  4230.                 $this->writeFont($value);
  4231.         }
  4232.  
  4233.         function getParentColor()
  4234.         {
  4235.                 return $this->readParentColor();
  4236.         }
  4237.         function setParentColor($value)
  4238.         {
  4239.                 $this->writeParentColor($value);
  4240.         }
  4241.  
  4242.         function getParentFont()
  4243.         {
  4244.                 return $this->readParentFont();
  4245.         }
  4246.         function setParentFont($value)
  4247.         {
  4248.                 $this->writeParentFont($value);
  4249.         }
  4250.  
  4251.         function getParentShowHint()
  4252.         {
  4253.                 return $this->readParentShowHint();
  4254.         }
  4255.         function setParentShowHint($value)
  4256.         {
  4257.                 $this->writeParentShowHint($value);
  4258.         }
  4259.  
  4260.         function getPopupMenu()
  4261.         {
  4262.                 return $this->readPopupMenu();
  4263.         }
  4264.         function setPopupMenu($value)
  4265.         {
  4266.                 $this->writePopupMenu($value);
  4267.         }
  4268.  
  4269.         function getShowHint()
  4270.         {
  4271.                 return $this->readShowHint();
  4272.         }
  4273.         function setShowHint($value)
  4274.         {
  4275.                 $this->writeShowHint($value);
  4276.         }
  4277.  
  4278.         function getStyle()             { return $this->readstyle()}
  4279.         function setStyle($value)       { $this->writestyle($value)}
  4280.  
  4281.         function getTabOrder()
  4282.         {
  4283.                 return $this->readTabOrder();
  4284.         }
  4285.         function setTabOrder($value)
  4286.         {
  4287.                 $this->writeTabOrder($value);
  4288.         }
  4289.  
  4290.         function getTabStop()
  4291.         {
  4292.                 return $this->readTabStop();
  4293.         }
  4294.         function setTabStop($value)
  4295.         {
  4296.                 $this->writeTabStop($value);
  4297.         }
  4298.  
  4299.         function getVisible()
  4300.         {
  4301.                 return $this->readVisible();
  4302.         }
  4303.         function setVisible($value)
  4304.         {
  4305.                 $this->writeVisible($value);
  4306.         }
  4307. }
  4308.  
  4309. /**
  4310.  * RadioButton class
  4311.  *
  4312.  * A HTML radiobutton.
  4313.  * Use RadioButton to add an indipendent radio button to a form.
  4314.  * Radio buttons present a set of mutually exclusive options to the user- that is,
  4315.  * only one radio button in a set can be selected at a time.
  4316.  *
  4317.  */
  4318. class RadioButton extends ButtonControl
  4319. {
  4320.         protected $_group = '';
  4321.  
  4322.         function __construct($aowner = null)
  4323.         {
  4324.                 //Calls inherited constructor
  4325.                 parent::__construct($aowner);
  4326.  
  4327.                 $this->Width 121;
  4328.                 $this->Height 21;
  4329.  
  4330.                 // define which property is set by the datasource
  4331.                 $this->_datafieldproperty = 'Checked';
  4332.         }
  4333.  
  4334.         function preinit()
  4335.         {
  4336.                 // get the group-name, if non is set then get the name of the RadioButton
  4337.                 $groupname = ($this->_group != ''$this->_group $this->_name;
  4338.  
  4339.                 $submittedValue $this->input->{$groupname};
  4340.  
  4341.                 // check if the RadioButton is checked (compare against the Caption
  4342.                 // since it is submitted as value)
  4343.                 if (is_object($submittedValue) && $submittedValue->asString(== $this->_caption)
  4344.                 {
  4345.                         $this->_checked = 1;
  4346.                         //If there is any valid DataField attached, update it
  4347.                         $this->updateDataField($this->_checked);
  4348.                 }
  4349.                 else if (($this->ControlState csDesigning!= csDesigning)
  4350.                 {
  4351.                         $this->_checked = 0;
  4352.                         //If there is any valid DataField attached, update it
  4353.                         $this->updateDataField($this->_checked);
  4354.                 }
  4355.         }
  4356.  
  4357.         function dumpContents()
  4358.         {
  4359.                 $style = "";
  4360.                 if ($this->Style=="")
  4361.                 {
  4362.                         $style .= $this->Font->FontString;
  4363.  
  4364.                         if ($this->color != "")
  4365.                         {
  4366.                                 $style .= "background-color: ".$this->color.";";
  4367.                         }
  4368.  
  4369.                         // add the cursor to the style
  4370.                         if ($this->_cursor != "")
  4371.                         {
  4372.                                 $cr = strtolower(substr($this->_cursor2));
  4373.                                 $style .= "cursor$cr;";
  4374.                         }
  4375.                 }
  4376.  
  4377.                 $height = $this->Height 1;
  4378.                 $width $this->Width;
  4379.  
  4380.                 $style .= "height:".$height."px;width:".$width."px;";
  4381.  
  4382.                 if ($style != "")  $style "style=\"$style\"";
  4383.  
  4384.                 // get the hint attribute; returns: title="[HintText]"
  4385.                 $hint = $this->getHintAttribute();
  4386.  
  4387.                 // get the alignment of the Caption
  4388.                 $alignment "";
  4389.                 switch ($this->_alignment)
  4390.                 {
  4391.                         case agNone :
  4392.                                 $alignment = "";
  4393.                                 break;
  4394.                         case agLeft :
  4395.                                 $alignment = "align=\"Left\"";
  4396.                                 break;
  4397.                         case agCenter :
  4398.                                 $alignment = "align=\"Center\"";
  4399.                                 break;
  4400.                         case agRight :
  4401.                                 $alignment = "align=\"Right\"";
  4402.                                 break;
  4403.                 }
  4404.  
  4405.                 $class = ($this->Style != """class=\"$this->StyleClass\"" : "";
  4406.  
  4407.                 // get the group-name, if non is set then get the name of the RadioButton
  4408.                 $groupname = ($this->_group != ''$this->_group $this->_name;
  4409.  
  4410.                 $surroundingTags "<table cellpadding=\"0\" cellspacing=\"0\" id=\"{$this->_name}_table\" $style $class><tr><td width=\"20\">\n";
  4411.                 $surroundingTags .= "%s\n";
  4412.                 $surroundingTags .= "</td><td $alignment>\n";
  4413.                 // Add some JS to the Caption (OnClick).
  4414.                 $surroundingTags .= ($this->Owner != null"<span id=\"{$this->_name}_caption\" onclick=\"return RadioButtonClick(document.forms[0].$groupname, '$this->_caption');\" $hint $class>" : "<span>";
  4415.                 $surroundingTags .= $this->_caption;
  4416.                 $surroundingTags .= "</span>\n";
  4417.                 $surroundingTags .= "</td></tr></table>\n";
  4418.  
  4419.                 $this->dumpContentsButtonControl("radio"$groupname,
  4420.                   ""$surroundingTagstrue);
  4421.         }
  4422.  
  4423.         /*
  4424.         * Write the Javascript section to the header
  4425.         */
  4426.         function dumpJavascript()
  4427.         {
  4428.                 parent::dumpJavascript();
  4429.  
  4430.                 // only output the function once
  4431.                 if (!defined('RadioButtonClick'))
  4432.                 {
  4433.                         define('RadioButtonClick', 1);
  4434.                         // Since all names are the same for the same group we
  4435.                         // have to check with the value attribute.
  4436.                         echo "
  4437. function RadioButtonClick(elem, caption)
  4438. {
  4439.    if (typeof(elem.length) == 'undefined') {
  4440.      elem.checked = true;
  4441.      return (typeof(elem.onclick) == 'function') ? elem.onclick() : false;
  4442.    } else {
  4443.      for(var i = 0; i < elem.length; i++) {
  4444.        if (elem[i].value == caption) {
  4445.          elem[i].checked = true;
  4446.          return (typeof(elem[i].onclick) == 'function') ? elem[i].onclick() : false;
  4447.        }
  4448.      }
  4449.    }
  4450.    return false;
  4451. }
  4452. ";
  4453.                 }
  4454.         }
  4455.  
  4456.  
  4457.         /**
  4458.         * Group where the RadioButton belongs to.
  4459.         * If group is empty the name of the RadioButton is used, but usually that is not the desired behavior.
  4460.         * @return string
  4461.         */
  4462.         function readGroup()
  4463.         {
  4464.                 return $this->_group;
  4465.         }
  4466.         /**
  4467.         * Group where the RadioButton belongs to.
  4468.         * If group is empty the name of the RadioButton is used, but usually that is not the desired behavior.
  4469.         * @param string $value
  4470.         */
  4471.         function writeGroup($value)
  4472.         {
  4473.                 $this->_group $value;
  4474.         }
  4475.         function defaultGroup() { return ''; }
  4476.  
  4477.  
  4478.         /*
  4479.         * Publish the events for the CheckBox component
  4480.         */
  4481.         function getOnClick                   () { return $this->readOnClick()}
  4482.         function setOnClick($value)           { $this->writeOnClick($value)}
  4483.  
  4484.         function getOnSubmit                  () { return $this->readOnSubmit()}
  4485.         function setOnSubmit                  ($value) { $this->writeOnSubmit($value)}
  4486.  
  4487.         /*
  4488.         * Publish the JS events for the CheckBox component
  4489.         */
  4490.         function getjsOnBlur                    () { return $this->readjsOnBlur()}
  4491.         function setjsOnBlur                    ($value) { $this->writejsOnBlur($value)}
  4492.  
  4493.         function getjsOnChange                  () { return $this->readjsOnChange()}
  4494.         function setjsOnChange                  ($value) { $this->writejsOnChange($value)}
  4495.  
  4496.         function getjsOnClick                   () { return $this->readjsOnClick()}
  4497.         function setjsOnClick                   ($value) { $this->writejsOnClick($value)}
  4498.  
  4499.         function getjsOnDblClick                () { return $this->readjsOnDblClick()}
  4500.         function setjsOnDblClick                ($value) { $this->writejsOnDblClick($value)}
  4501.  
  4502.         function getjsOnFocus                   () { return $this->readjsOnFocus()}
  4503.         function setjsOnFocus                   ($value) { $this->writejsOnFocus($value)}
  4504.  
  4505.         function getjsOnMouseDown               () { return $this->readjsOnMouseDown()}
  4506.         function setjsOnMouseDown               ($value) { $this->writejsOnMouseDown($value)}
  4507.  
  4508.         function getjsOnMouseUp                 () { return $this->readjsOnMouseUp()}
  4509.         function setjsOnMouseUp                 ($value) { $this->writejsOnMouseUp($value)}
  4510.  
  4511.         function getjsOnMouseOver               () { return $this->readjsOnMouseOver()}
  4512.         function setjsOnMouseOver               ($value) { $this->writejsOnMouseOver($value)}
  4513.  
  4514.         function getjsOnMouseMove               () { return $this->readjsOnMouseMove()}
  4515.         function setjsOnMouseMove               ($value) { $this->writejsOnMouseMove($value)}
  4516.  
  4517.         function getjsOnMouseOut                () { return $this->readjsOnMouseOut()}
  4518.         function setjsOnMouseOut                ($value) { $this->writejsOnMouseOut($value)}
  4519.  
  4520.         function getjsOnKeyPress                () { return $this->readjsOnKeyPress()}
  4521.         function setjsOnKeyPress                ($value) { $this->writejsOnKeyPress($value)}
  4522.  
  4523.         function getjsOnKeyDown                 () { return $this->readjsOnKeyDown()}
  4524.         function setjsOnKeyDown                 ($value) { $this->writejsOnKeyDown($value)}
  4525.  
  4526.         function getjsOnKeyUp                   () { return $this->readjsOnKeyUp()}
  4527.         function setjsOnKeyUp                   ($value) { $this->writejsOnKeyUp($value)}
  4528.  
  4529.         function getjsOnSelect                  () { return $this->readjsOnSelect()}
  4530.         function setjsOnSelect                  ($value) { $this->writejsOnSelect($value)}
  4531.  
  4532.  
  4533.         /*
  4534.         * Publish the properties for the CheckBox component
  4535.         */
  4536.  
  4537.         function getAlignment()
  4538.         {
  4539.                 return $this->readAlignment();
  4540.         }
  4541.         function setAlignment($value)
  4542.         {
  4543.                 $this->writeAlignment($value);
  4544.         }
  4545.  
  4546.         function getCaption()
  4547.         {
  4548.                 return $this->readCaption();
  4549.         }
  4550.         function setCaption($value)
  4551.         {
  4552.                 $this->writeCaption($value);
  4553.         }
  4554.  
  4555.         function getChecked()
  4556.         {
  4557.                 return $this->readChecked();
  4558.         }
  4559.         function setChecked($value)
  4560.         {
  4561.                 $this->writeChecked($value);
  4562.         }
  4563.  
  4564.         function getColor()
  4565.         {
  4566.                 return $this->readColor();
  4567.         }
  4568.         function setColor($value)
  4569.         {
  4570.                 $this->writeColor($value);
  4571.         }
  4572.  
  4573.         function getDataField()
  4574.         {
  4575.                 return $this->readDataField();
  4576.         }
  4577.         function setDataField($value)
  4578.         {
  4579.                 $this->writeDataField($value);
  4580.         }
  4581.  
  4582.         function getDataSource()
  4583.         {
  4584.                 return $this->readDataSource();
  4585.         }
  4586.         function setDataSource($value)
  4587.         {
  4588.                 $this->writeDataSource($value);
  4589.         }
  4590.  
  4591.         function getEnabled()
  4592.         {
  4593.                 return $this->readEnabled();
  4594.         }
  4595.         function setEnabled($value)
  4596.         {
  4597.                 $this->writeEnabled($value);
  4598.         }
  4599.  
  4600.         function getGroup()
  4601.         {
  4602.                 return $this->readGroup();
  4603.         }
  4604.         function setGroup($value)
  4605.         {
  4606.                 $this->writeGroup($value);
  4607.         }
  4608.  
  4609.         function getFont()
  4610.         {
  4611.                 return $this->readFont();
  4612.         }
  4613.         function setFont($value)
  4614.         {
  4615.                 $this->writeFont($value);
  4616.         }
  4617.  
  4618.         function getParentColor()
  4619.         {
  4620.                 return $this->readParentColor();
  4621.         }
  4622.         function setParentColor($value)
  4623.         {
  4624.                 $this->writeParentColor($value);
  4625.         }
  4626.  
  4627.         function getParentFont()
  4628.         {
  4629.                 return $this->readParentFont();
  4630.         }
  4631.         function setParentFont($value)
  4632.         {
  4633.                 $this->writeParentFont($value);
  4634.         }
  4635.  
  4636.         function getParentShowHint()
  4637.         {
  4638.                 return $this->readParentShowHint();
  4639.         }
  4640.         function setParentShowHint($value)
  4641.         {
  4642.                 $this->writeParentShowHint($value);
  4643.         }
  4644.  
  4645.         function getPopupMenu()
  4646.         {
  4647.                 return $this->readPopupMenu();
  4648.         }
  4649.         function setPopupMenu($value)
  4650.         {
  4651.                 $this->writePopupMenu($value);
  4652.         }
  4653.  
  4654.         function getShowHint()
  4655.         {
  4656.                 return $this->readShowHint();
  4657.         }
  4658.         function setShowHint($value)
  4659.         {
  4660.                 $this->writeShowHint($value);
  4661.         }
  4662.  
  4663.         function getStyle()             { return $this->readstyle()}
  4664.         function setStyle($value)       { $this->writestyle($value)}
  4665.  
  4666.         function getTabOrder()
  4667.         {
  4668.                 return $this->readTabOrder();
  4669.         }
  4670.         function setTabOrder($value)
  4671.         {
  4672.                 $this->writeTabOrder($value);
  4673.         }
  4674.  
  4675.         function getTabStop()
  4676.         {
  4677.                 return $this->readTabStop();
  4678.         }
  4679.         function setTabStop($value)
  4680.         {
  4681.                 $this->writeTabStop($value);
  4682.         }
  4683.  
  4684.         function getVisible()
  4685.         {
  4686.                 return $this->readVisible();
  4687.         }
  4688.         function setVisible($value)
  4689.         {
  4690.                 $this->writeVisible($value);
  4691.         }
  4692. }
  4693.  
  4694. define ('sbHorizontal', 'sbHorizontal');
  4695. define ('sbVertical', 'sbVertical');
  4696.  
  4697. /**
  4698. * ScrollBar class
  4699. *
  4700. */
  4701. class ScrollBar extends QWidget
  4702. {
  4703.         protected $_kind = sbHorizontal;
  4704.         protected $_min=0;
  4705.         protected $_max=500;
  4706.         protected $_smallchange=1;
  4707.         protected $_largechange=1;
  4708.         protected $_position=0;
  4709.         protected $_pagesize=0;
  4710.  
  4711.         function dumpContents()
  4712.         {
  4713.                 $this->dumpCommonContentsTop();
  4714.  
  4715.                 if ($this->_kind==sbHorizontal{ $horiz = "true"; }
  4716.                 else                            { $horiz = "false"; }
  4717.  
  4718.                 echo "  var " . $this->Name " = new qx.ui.core.ScrollBar($horiz);\n"
  4719.                    . "  $this->Name.setLeft(0);\n"
  4720.                    . "  $this->Name.setTop(0);\n"
  4721.                    . "  $this->Name.setWidth($this->Width);\n"
  4722.                    . "  $this->Name.setHeight($this->Height);\n"
  4723.                    . "  $this->Name.setMaximum($this->Max);\n"
  4724.                    . "  $this->Name.setValue($this->Position);\n";
  4725.  
  4726.                 $this->dumpCommonContentsBottom();
  4727.         }
  4728.  
  4729.         /**
  4730.         * Specifies whether the scroll bar is horizontal or vertical.
  4731.         * @return enum (sbHorizontal, sbVertical)
  4732.         */
  4733.         function getKind()       { return $this->_kind}
  4734.         /**
  4735.         * Specifies whether the scroll bar is horizontal or vertical.
  4736.         * @param enum (sbHorizontal, sbVertical)
  4737.         */
  4738.         function setKind($value)
  4739.         {
  4740.                 if ($value != $this->_kind)
  4741.         {
  4742.                 $w = $this->Width;
  4743.                 $h $this->Height;
  4744.  
  4745.                         if (($value == sbHorizontal&& ($w $h))
  4746.                         {
  4747.                                 $this->Height $w;
  4748.                                 $this->Width $h;
  4749.                         }
  4750.                         else
  4751.                         if (($value == sbVertical) && ($w > $h))
  4752.                         {
  4753.                                 $this->Height $w;
  4754.                                 $this->Width $h;
  4755.                         }
  4756.  
  4757.                         $this->_kind $value;
  4758.                 }
  4759.         }
  4760.         function defaultKind() { return sbHorizontal;  }
  4761.  
  4762.         /**
  4763.         * Specifies the minimum position represented by the scroll bar.
  4764.         * @return integer
  4765.         */
  4766.         function getMin()       { return $this->_min}
  4767.         /**
  4768.         * Specifies the minimum position represented by the scroll bar.
  4769.         * @param integer $value
  4770.         */
  4771.         function setMin($value) { $this->_min=$value}
  4772.         function defaultMin()   { return 0; }
  4773.  
  4774.         /**
  4775.         * Specifies the maximum position represented by the scroll bar.
  4776.         * @return integer
  4777.         */
  4778.         function getMax()       { return $this->_max}
  4779.         /**
  4780.         * Specifies the maximum position represented by the scroll bar.
  4781.         * @param integer $value
  4782.         */
  4783.         function setMax($value) { $this->_max=$value}
  4784.         function defaultMax()   { return 500; }
  4785.  
  4786.         /**
  4787.         * Determines how much Position changes when the user clicks the arrow buttons
  4788.         * on the scroll bar or presses the arrow keys on the keyboard.
  4789.         * Note: Not yet implemented.
  4790.         * @return integer
  4791.         */
  4792.         function getSmallChange()       { return $this->_smallchange}
  4793.         /**
  4794.         * Determines how much Position changes when the user clicks the arrow buttons
  4795.         * on the scroll bar or presses the arrow keys on the keyboard.
  4796.         * Note: Not yet implemented.
  4797.         * @param integer $value
  4798.         */
  4799.         function setSmallChange($value) { $this->_smallchange=$value}
  4800.         function defaultSmallChange()   { return 1; }
  4801.  
  4802.         /**
  4803.         * Determines how much Position changes when the user clicks the scroll bar
  4804.         * on either side of the thumb tab or presses PgUp or PgDn.
  4805.         * Note: Not yet implemented.
  4806.         * @return integer
  4807.         */
  4808.         function getLargeChange()       { return $this->_largechange}
  4809.         /**
  4810.         * Determines how much Position changes when the user clicks the scroll bar
  4811.         * on either side of the thumb tab or presses PgUp or PgDn.
  4812.         * Note: Not yet implemented.
  4813.         * @param integer $value
  4814.         */
  4815.         function setLargeChange($value) { $this->_largechange=$value}
  4816.         function defaultLargeChange()   { return 1; }
  4817.  
  4818.         /**
  4819.         * Indicates the current position of the scroll bar.
  4820.         * @return integer
  4821.         */
  4822.         function getPosition()       { return $this->_position}
  4823.         /**
  4824.         * Indicates the current position of the scroll bar.
  4825.         * @param integer $value
  4826.         */
  4827.         function setPosition($value) { $this->_position=$value}
  4828.         function defaultPosition()   { return 0; }
  4829.  
  4830.         /**
  4831.         * Specifies the size of the thumb tab.
  4832.         * Note: Not yet implemented.
  4833.         * @return integer
  4834.         */
  4835.         function getPageSize()       { return $this->_pagesize}
  4836.         /**
  4837.         * Specifies the size of the thumb tab.
  4838.         * Note: Not yet implemented.
  4839.         * @param integer $value
  4840.         */
  4841.         function setPageSize($value) { $this->_pagesize=$value}
  4842.         function defaultPageSize()   { return 0; }
  4843.  
  4844.         function __construct($aowner = null)
  4845.                 {
  4846.                 //Calls inherited constructor
  4847.                 parent::__construct($aowner);
  4848.  
  4849.                 $this->Width 200;
  4850.                 $this->Height 17;
  4851.         }
  4852.  
  4853. }
  4854.  
  4855.  
  4856.  

Documentation generated on Tue, 27 Mar 2007 13:35:44 +0200 by phpDocumentor 1.3.1