Selaa lähdekoodia

Adding email tag in quickform

Julio Montoya 13 vuotta sitten
vanhempi
commit
d9fa46d4ed

+ 1 - 1
main/auth/profile.php

@@ -191,7 +191,7 @@ if (CONFVAL_ASK_FOR_OFFICIAL_CODE) {
 }
 
 //	EMAIL
-$form->addElement('text', 'email', get_lang('Email'), array('size' => 40));
+$form->addElement('email', 'email', get_lang('Email'), array('size' => 40));
 if (api_get_setting('profile', 'email') !== 'true') {
 	$form->freeze('email');
 }

+ 1 - 0
main/inc/lib/pear/HTML/QuickForm.php

@@ -65,6 +65,7 @@ $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] =
             'xbutton'           =>array('HTML/QuickForm/xbutton.php','HTML_QuickForm_xbutton'),
             'advanced_settings' =>array('HTML/QuickForm/advanced_settings.php','HTML_QuickForm_advanced_settings'),
             'label'             =>array('HTML/QuickForm/label.php','HTML_QuickForm_label'),
+            'email'             =>array('HTML/QuickForm/email.php','HTML_QuickForm_email'),
             
         );
 

+ 76 - 0
main/inc/lib/pear/HTML/QuickForm/email.php

@@ -0,0 +1,76 @@
+<?php
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a password type field
+ *
+ * @category    HTML
+ * @package     HTML_QuickForm
+ * @author      Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author      Bertrand Mansion <bmansion@mamasam.com>
+ * @version     Release: 3.2.11
+ * @since       1.0
+ */
+class HTML_QuickForm_email extends HTML_QuickForm_input
+{
+    // {{{ constructor
+
+    /**
+     * Class constructor
+     *
+     * @param     string    $elementName    (optional)Input field name attribute
+     * @param     string    $elementLabel   (optional)Input field label
+     * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
+     *                                      or an associative array
+     * @since     1.0
+     * @access    public
+     * @return    void
+     * @throws
+     */
+    function HTML_QuickForm_email($elementName=null, $elementLabel=null, $attributes=null)
+    {
+        HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+        $this->setType('email');
+    } //end constructor
+
+    // }}}
+    // {{{ setSize()
+
+    /**
+     * Sets size of password element
+     *
+     * @param     string    $size  Size of password field
+     * @since     1.0
+     * @access    public
+     * @return    void
+     */
+    function setSize($size)
+    {
+        $this->updateAttributes(array('size'=>$size));
+    } //end func setSize
+
+    // }}}
+    // {{{ setMaxlength()
+
+    /**
+     * Sets maxlength of password element
+     *
+     * @param     string    $maxlength  Maximum length of password field
+     * @since     1.0
+     * @access    public
+     * @return    void
+     */
+    function setMaxlength($maxlength)
+    {
+        $this->updateAttributes(array('maxlength'=>$maxlength));
+    } //end func setMaxlength
+
+    // }}}
+    // {{{ getFrozenHtml()
+
+    // }}}
+
+} //end class HTML_QuickForm_password