And while I'm at it: removed unused global declarations of $wgFeedClasses
[lhc/web/wiklou.git] / includes / HTMLForm.php
index dc2d0a5..a6c7946 100644 (file)
@@ -66,7 +66,7 @@ class HTMLForm {
                'edittools' => 'HTMLEditTools',
        
                # HTMLTextField will output the correct type="" attribute automagically.
-               # There are about four zillion other HTML 5 input types, like url, but
+               # There are about four zillion other HTML5 input types, like url, but
                # we don't use those at the moment, so no point in adding all of them.
                'email' => 'HTMLTextField',
                'password' => 'HTMLTextField',
@@ -152,9 +152,9 @@ class HTMLForm {
        static function addJS() {
                if( self::$jsAdded ) return;
 
-               global $wgOut;
+               global $wgOut, $wgStylePath;
 
-               $wgOut->addScriptClass( 'htmlform' );
+               $wgOut->addScriptFile( "$wgStylePath/common/htmlform.js" );
        }
 
        /**
@@ -364,7 +364,7 @@ class HTMLForm {
                $html = '';
 
                $html .= Html::hidden( 'wpEditToken', $wgUser->editToken(), array( 'id' => 'wpEditToken' ) ) . "\n";
-               $html .= Html::hidden( 'title', $this->getTitle() ) . "\n";
+               $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
                
                foreach( $this->mHiddenFields as $name => $value ){
                        $html .= Html::hidden( $name, $value ) . "\n";
@@ -874,7 +874,6 @@ class HTMLTextField extends HTMLFormField {
        }
 
        function getInputHTML( $value ) {
-               global $wgHtml5;
                $attribs = array(
                        'id' => $this->mID,
                        'name' => $this->mName,
@@ -890,20 +889,18 @@ class HTMLTextField extends HTMLFormField {
                        $attribs['disabled'] = 'disabled';
                }
 
-               if ( $wgHtml5 ) {
-                       # TODO: Enforce pattern, step, required, readonly on the server
-                       # side as well
-                       foreach ( array( 'min', 'max', 'pattern', 'title', 'step',
-                       'placeholder' ) as $param ) {
-                               if ( isset( $this->mParams[$param] ) ) {
-                                       $attribs[$param] = $this->mParams[$param];
-                               }
+               # TODO: Enforce pattern, step, required, readonly on the server side as
+               # well
+               foreach ( array( 'min', 'max', 'pattern', 'title', 'step',
+               'placeholder' ) as $param ) {
+                       if ( isset( $this->mParams[$param] ) ) {
+                               $attribs[$param] = $this->mParams[$param];
                        }
-                       foreach ( array( 'required', 'autofocus', 'multiple', 'readonly' )
-                       as $param ) {
-                               if ( isset( $this->mParams[$param] ) ) {
-                                       $attribs[$param] = '';
-                               }
+               }
+               foreach ( array( 'required', 'autofocus', 'multiple', 'readonly' ) as
+               $param ) {
+                       if ( isset( $this->mParams[$param] ) ) {
+                               $attribs[$param] = '';
                        }
                }
                        
@@ -911,23 +908,17 @@ class HTMLTextField extends HTMLFormField {
                # here, rather than creating a new class for each one which
                # is essentially just a clone of this one.
                if ( isset( $this->mParams['type'] ) ) {
-                       # Options that apply only to HTML5
-                       if( $wgHtml5 ){
-                               switch ( $this->mParams['type'] ) {
-                                       case 'email':
-                                               $attribs['type'] = 'email';
-                                               break;
-                                       case 'int':
-                                               $attribs['type'] = 'number';
-                                               break;
-                                       case 'float':
-                                               $attribs['type'] = 'number';
-                                               $attribs['step'] = 'any';
-                                               break;
-                               }
-                       }
-                       # Options that apply to HTML4 as well
-                       switch( $this->mParams['type'] ) {
+                       switch ( $this->mParams['type'] ) {
+                               case 'email':
+                                       $attribs['type'] = 'email';
+                                       break;
+                               case 'int':
+                                       $attribs['type'] = 'number';
+                                       break;
+                               case 'float':
+                                       $attribs['type'] = 'number';
+                                       $attribs['step'] = 'any';
+                                       break;
                                # Pass through
                                case 'password':
                                case 'file':
@@ -953,7 +944,6 @@ class HTMLTextAreaField extends HTMLFormField {
        }
        
        function getInputHTML( $value ) {
-               global $wgHtml5;
                $attribs = array(
                        'id' => $this->mID,
                        'name' => $this->mName,
@@ -969,14 +959,11 @@ class HTMLTextAreaField extends HTMLFormField {
                        $attribs['readonly'] = 'readonly';
                }
                
-               if ( $wgHtml5 ) {
-                       foreach ( array( 'required', 'autofocus' ) as $param ) {
-                               if ( isset( $this->mParams[$param] ) ) {
-                                       $attribs[$param] = '';
-                               }
+               foreach ( array( 'required', 'autofocus' ) as $param ) {
+                       if ( isset( $this->mParams[$param] ) ) {
+                               $attribs[$param] = '';
                        }
                }
-                       
 
                return Html::element( 'textarea', $attribs, $value );
        }
@@ -1401,4 +1388,4 @@ class HTMLEditTools extends HTMLFormField {
                                array( 'parse', 'content' ) )
                        . "</div></td></tr>\n";
        }
-}
\ No newline at end of file
+}