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

Source for file HTMLSubmitButton.class.php

Documentation is available at HTMLSubmitButton.class.php

  1. <?php
  2. /**
  3.  * For including this file you have to define the constant "CLASSPATH".
  4.  * Because every include in the framework depends on the CLASSPATH definition.
  5.  * The CLASSPATH means the relative path to the folder that contains the
  6.  * framework GilliGan.
  7.  *
  8.  * @package forms
  9.  * @subpackage items
  10.  */
  11. if!defined"CLASSPATH" ) )
  12. {
  13.   echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
  14.   echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
  15.   exit();
  16. }
  17.  
  18. /**
  19.  *
  20.  */
  21. require_onceCLASSPATH."forms/items/ABSTHTMLFormItem.class.php" );
  22.  
  23. /**
  24.  * @package    forms
  25.  * @subpackage items
  26.  * @version    0.1.85
  27.  * @author     Daniel Pl&uuml;cken <daniel@debakel.net>
  28.  * @license    http://www.gnu.org/copyleft/lesser.html
  29.  *              GNU Lesser General Public License
  30.  * @copyright  Copyright (c) 2004 Daniel Pluecken <daniel@debakel.net>
  31.  *
  32.  *  This library is free software; you can redistribute it and/or
  33.  *  modify it under the terms of the GNU Lesser General Public
  34.  *  License as published by the Free Software Foundation; either
  35.  *  version 2.1 of the License.
  36.  *
  37.  *  This library is distributed in the hope that it will be useful,
  38.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  39.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  40.  *  GNU Lesser General Public License for more details.
  41.  *
  42.  *  You should have received a copy of the GNU Lesser General
  43.  *  Public License along with this library; if not, write to the
  44.  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  45.  *  Boston, MA 02111-1307 USA
  46.  */
  47. {
  48.    /**
  49.     * @var    string $label_on_submit_success 
  50.     * @access public
  51.     */
  52.  
  53.  
  54.    /**
  55.     * Constructor
  56.     *
  57.     * @version 1.4
  58.     * @since   0.1.0
  59.     * @author  Daniel Plücken <daniel@debakel.net>
  60.     * @access  public
  61.     * @param   string  $name 
  62.     * @param   string  $value 
  63.     */
  64.    function HTMLSubmitButton(
  65.                                $name  "",
  66.                                $value ""
  67.                             )
  68.    {
  69.      $this->name  = $name;
  70.      $this->id    = $name;
  71.      $this->value = $value;
  72.    }
  73.  
  74.  
  75.  
  76.    /**
  77.     * Sets the value of the onMouseup-attribute of this submit button.
  78.     *
  79.     * @deprecated
  80.     * @version 1.0
  81.     * @since   0.1.0
  82.     * @author  Daniel Plücken <daniel@debakel.net>
  83.     * @access  public
  84.     * @param   string $string 
  85.     * @return  void 
  86.     */
  87.    function setMouseup$string )
  88.    $this->mouseup = $string}
  89.  
  90.  
  91.  
  92.    /**
  93.     * Sets the label of this button on mouseup if the form data could be send.
  94.     *
  95.     * @version 1.0
  96.     * @since   0.1.7
  97.     * @author  Daniel Plücken <daniel@debakel.net>
  98.     * @access  public
  99.     * @param   string $string 
  100.     * @return  void 
  101.     */
  102.    function setLabelOnSubmitSuccess$string )
  103.    $this->label_on_submit_success = $string}
  104.  
  105.  
  106.  
  107.    /**
  108.     * Sets the javascript to change the label of this button on mouseup if the
  109.     * form data could be send.
  110.     *
  111.     * @version 1.0
  112.     * @since   0.1.7
  113.     * @author  Daniel Plücken <daniel@debakel.net>
  114.     * @access  private
  115.     * @return  void 
  116.     */
  117.    {
  118.      if !empty$this->label_on_submit_success ) )
  119.      {
  120.         $str_tmp "str_onsbt = ''; "
  121.                   ."try "
  122.                   ."{ "
  123.                     ."str_onsbt = document.".$this->parentform->name
  124.                                .".onsubmit.toString(); "
  125.                   ."} "
  126.                   ."catch(e) {}; "
  127.                   ."int_spos = str_onsbt.search( /return/ ) + 7; "
  128.                   ."bool_submit_success = true; "
  129.                   ."if ( int_spos > 6 ) "
  130.                   ."{ "
  131.                      ."str_onsbt = str_onsbt.substr( int_spos ); "
  132.                      ."int_spos = str_onsbt.search( /;/ ); "
  133.                      ."str_onsbt = str_onsbt.substr( 0, int_spos ); "
  134.                      ."try { bool_submit_success = eval( str_onsbt ); } "
  135.                      ."catch(e) {}; "
  136.                   ."} "
  137.                   ."str_mem_name = this.name; "
  138.                   ."str_mem_value = this.value; "
  139.                   ."if ( bool_submit_success ) "
  140.                   ."{ "
  141.                      ."document.GGobj_global_tmp=this; "
  142.                      ."setTimeout( "
  143.                           ."'document.GGobj_global_tmp"
  144.                           .".value=\\'".$this->label_on_submit_success."\\'', "
  145.                           ."100 "
  146.                                ."); "
  147.                      ."this.name = str_mem_value + 'BACKUP'; "
  148.                      ."obj_input = document.createElement( 'input' ); "
  149.                      ."obj_input.setAttribute( 'type', 'hidden' ); "
  150.                      ."obj_input.setAttribute( 'name', str_mem_name ); "
  151.                      ."obj_input.setAttribute( 'value', str_mem_value ); "
  152.                      ."document.".$this->parentform->name
  153.                                .".appendChild( obj_input ); "
  154.                      ."document.".$this->parentform->name.".submit(); "
  155.                   ."} ";
  156.  
  157.         if empty$this->mouseup ) )
  158.            $this->mouseup = $str_tmp;
  159.         else
  160.            $this->mouseup .= "; ".$str_tmp;
  161.      }
  162.    }
  163.  
  164.  
  165.  
  166.  
  167.    /**
  168.     * Blind method cause other objects will invoke it.
  169.     *
  170.     * @version 1.0
  171.     * @since   0.1.2
  172.     * @author  Daniel Plücken <daniel@debakel.net>
  173.     * @access  public
  174.     * @param   string  $formname 
  175.     * @return  boolean (false)
  176.     */
  177.    function getCheckOrder$formname )
  178.    return false}
  179.  
  180.  
  181.  
  182.    /**
  183.     * Blind method cause other objects will invoke it.
  184.     *
  185.     * @version 1.0
  186.     * @since   0.1.2
  187.     * @author  Daniel Plücken <daniel@debakel.net>
  188.     * @access  public
  189.     * @param   string  $formname 
  190.     * @return  boolean (false)
  191.     */
  192.    function getValidationOrder$formname )
  193.    return false}
  194.  
  195.  
  196.  
  197.    /**
  198.     * Returns a generated string based on the attributes of this object.
  199.     *
  200.     * @version 1.45
  201.     * @since   0.1.0
  202.     * @author  Daniel Plücken <daniel@debakel.net>
  203.     * @access  public
  204.     * @param   string forminput POST or GET or REQUEST
  205.     * @return  string 
  206.     */
  207.    function get()
  208.    {
  209.  
  210.       $out  "<!--\r\n"
  211.              ."--><input type=\"".(
  212.                                     empty$this->label_on_submit_success )
  213.                                     ? "submit"
  214.                                     : "button"
  215.                                   )."\"\r\n"
  216.              ."          name=\"".$this->name."\"\r\n";
  217.       $out .= !empty$this->id )
  218.               ? "          id=\"".$this->id."\"\r\n" "";
  219.       $out .= !empty$this->style_class )
  220.               ? "          class=\"".$this->style_class."\"\r\n" "";
  221.       $out .= !empty$this->value )
  222.               ? "          value=\"".$this->value."\"\r\n" "";
  223.       $out .= !empty$this->mouseup )
  224.               ? "          onMouseup=\"".$this->mouseup."\"\r\n" "";
  225.       $out .= !empty$this->click )
  226.               ? "          onClick=\"".$this->click."\"\r\n" "";
  227.       $out .= !empty$this->mouseover )
  228.               ? "          onMouseover=\"".$this->mouseover."\"\r\n" "";
  229.       $out .= !empty$this->mouseout )
  230.               ? "          onMouseout=\"".$this->mouseout."\"\r\n" "";
  231.       $out .= !empty$this->mousemove )
  232.               ? "          onMousemove=\"".$this->mousemove."\"\r\n" "";
  233.       $out .= !empty$this->focus )
  234.               ? "          onFocus=\"".$this->focus."\"\r\n" "";
  235.       $out .= !empty$this->blur )
  236.               ? "          onBlur=\"".$this->blur."\"\r\n" "";
  237.       $out .= !empty$this->freestyle )
  238.               ? "          style=\"".$this->freestyle."\"\r\n" "";
  239.       $out .= " />";
  240.  
  241.       return $out;
  242.    }
  243. // END of class HTMLSubmitButton
  244. ?>

Documentation generated on Thu, 05 Jun 2008 19:13:08 +0200 by phpDocumentor 1.4.1