protected $mPre = '';
protected $mHeader = '';
+ protected $mFooter = '';
protected $mPost = '';
protected $mId;
*/
function addHeaderText( $msg ) { $this->mHeader .= $msg; }
+ /**
+ * Add footer text, inside the form.
+ * @param $msg String complete text of message to display
+ */
+ function addFooterText( $msg ) { $this->mFooter .= $msg; }
+
/**
* Add text to the end of the display.
* @param $msg String complete text of message to display
function displayForm( $submitResult ) {
global $wgOut;
- if ( $submitResult !== false ) {
- $this->displayErrors( $submitResult );
- }
-
$html = ''
+ . $this->getErrors( $submitResult )
. $this->mHeader
. $this->getBody()
. $this->getHiddenFields()
. $this->getButtons()
+ . $this->mFooter
;
$html = $this->wrapForm( $html );
/**
* Format and display an error message stack.
* @param $errors Mixed String or Array of message keys
+ * @return String
*/
- function displayErrors( $errors ) {
+ function getErrors( $errors ) {
if ( is_array( $errors ) ) {
$errorstr = $this->formatErrors( $errors );
} else {
$errorstr = $errors;
}
- $errorstr = Html::rawElement( 'div', array( 'class' => 'error' ), $errorstr );
-
- global $wgOut;
- $wgOut->addHTML( $errorstr );
+ return $errorstr
+ ? Html::rawElement( 'div', array( 'class' => 'error' ), $errorstr )
+ : '';
}
/**
return Html::element( 'textarea', $attribs, $value );
}
+
+ public function validate( $value, $alldata ){
+ $p = parent::validate( $value, $alldata );
+ if( $p !== true ) return $p;
+
+ if( isset( $this->mParams['required'] ) && $value === '' ){
+ return wfMsgExt( 'htmlform-required', 'parseinline' );
+ }
+ return true;
+ }
}
/**
'listgrouprights-removegroup-self-all' => 'Remove all groups from own account',
# E-mail user
-'mailnologin' => 'No send address',
-'mailnologintext' => 'You must be [[Special:UserLogin|logged in]] and have a valid e-mail address in your [[Special:Preferences|preferences]] to send e-mail to other users.',
-'emailuser' => 'E-mail this user',
-'emailpage' => 'E-mail user',
-'emailpagetext' => 'You can use the form below to send an e-mail message to this user.
+'mailnologin' => 'No send address',
+'mailnologintext' => 'You must be [[Special:UserLogin|logged in]] and have a valid e-mail address in your [[Special:Preferences|preferences]] to send e-mail to other users.',
+'emailuser' => 'E-mail this user',
+'emailpage' => 'E-mail user',
+'emailpagetext' => 'You can use the form below to send an e-mail message to this user.
The e-mail address you entered in [[Special:Preferences|your user preferences]] will appear as the "From" address of the e-mail, so the recipient will be able to reply directly to you.',
-'usermailererror' => 'Mail object returned error:',
-'defemailsubject' => '{{SITENAME}} e-mail',
-'noemailtitle' => 'No e-mail address',
-'noemailtext' => 'This user has not specified a valid e-mail address.',
-'nowikiemailtitle' => 'No e-mail allowed',
-'nowikiemailtext' => 'This user has chosen not to receive e-mail from other users.',
-'email-legend' => 'Send an e-mail to another {{SITENAME}} user',
-'emailfrom' => 'From:',
-'emailto' => 'To:',
-'emailsubject' => 'Subject:',
-'emailmessage' => 'Message:',
-'emailsend' => 'Send',
-'emailccme' => 'E-mail me a copy of my message.',
-'emailccsubject' => 'Copy of your message to $1: $2',
-'emailsent' => 'E-mail sent',
-'emailsenttext' => 'Your e-mail message has been sent.',
-'emailuserfooter' => 'This e-mail was sent by $1 to $2 by the "E-mail user" function at {{SITENAME}}.',
+'usermailererror' => 'Mail object returned error:',
+'defemailsubject' => '{{SITENAME}} e-mail',
+'usermaildisabled' => 'User email disabled',
+'usermaildisabledtext' => 'You cannot send email to other users on this wiki',
+'noemailtitle' => 'No e-mail address',
+'noemailtext' => 'This user has not specified a valid e-mail address.',
+'nowikiemailtitle' => 'No e-mail allowed',
+'nowikiemailtext' => 'This user has chosen not to receive e-mail from other users.',
+'email-legend' => 'Send an e-mail to another {{SITENAME}} user',
+'emailfrom' => 'From:',
+'emailto' => 'To:',
+'emailsubject' => 'Subject:',
+'emailmessage' => 'Message:',
+'emailsend' => 'Send',
+'emailccme' => 'E-mail me a copy of my message.',
+'emailccsubject' => 'Copy of your message to $1: $2',
+'emailsent' => 'E-mail sent',
+'emailsenttext' => 'Your e-mail message has been sent.',
+'emailuserfooter' => 'This e-mail was sent by $1 to $2 by the "E-mail user" function at {{SITENAME}}.',
# Watchlist
'watchlist' => 'My watchlist',
'htmlform-float-invalid' => 'The value you specified is not a number.',
'htmlform-int-toolow' => 'The value you specified is below the minimum of $1',
'htmlform-int-toohigh' => 'The value you specified is above the maximum of $1',
+'htmlform-required' => 'This value is required',
'htmlform-submit' => 'Submit',
'htmlform-reset' => 'Undo changes',
'htmlform-selectorother-other' => 'Other',