'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',
static function addJS() {
if( self::$jsAdded ) return;
- global $wgOut;
+ global $wgOut, $wgStylePath;
- $wgOut->addScriptClass( 'htmlform' );
+ $wgOut->addScriptFile( "$wgStylePath/common/htmlform.js" );
}
/**
$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";
}
function getInputHTML( $value ) {
- global $wgHtml5;
$attribs = array(
'id' => $this->mID,
'name' => $this->mName,
$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] = '';
}
}
# 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':
}
function getInputHTML( $value ) {
- global $wgHtml5;
$attribs = array(
'id' => $this->mID,
'name' => $this->mName,
$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 );
}
array( 'parse', 'content' ) )
. "</div></td></tr>\n";
}
-}
\ No newline at end of file
+}