Index: trunk/phase3/includes/specials/SpecialEmailuser.php |
— | — | @@ -89,19 +89,10 @@ |
90 | 90 | $this->setHeaders(); |
91 | 91 | $this->outputHeader(); |
92 | 92 | $wgOut->addModuleStyles( 'mediawiki.special' ); |
93 | | - |
94 | 93 | $this->mTarget = is_null( $par ) |
95 | 94 | ? $wgRequest->getVal( 'wpTarget', $wgRequest->getVal( 'target', '' ) ) |
96 | 95 | : $par; |
97 | | - |
98 | | - $ret = self::getTarget( $this->mTarget ); |
99 | | - if( $ret instanceof User ){ |
100 | | - $this->mTargetObj = $ret; |
101 | | - } else { |
102 | | - $wgOut->showErrorPage( "{$ret}title", "{$ret}text" ); |
103 | | - return false; |
104 | | - } |
105 | | - |
| 96 | + // error out if sending user cannot do this |
106 | 97 | $error = self::getPermissionsError( $wgUser, $wgRequest->getVal( 'wpEditToken' ) ); |
107 | 98 | switch ( $error ) { |
108 | 99 | case null: |
— | — | @@ -126,7 +117,19 @@ |
127 | 118 | $wgOut->showErrorPage( $title, $msg, $params ); |
128 | 119 | return; |
129 | 120 | } |
| 121 | + // Got a valid target user name? Else ask for one. |
| 122 | + $ret = self::getTarget( $this->mTarget ); |
| 123 | + if( ! $ret instanceof User ){ |
| 124 | + if( $this->mTarget != '' ) { |
| 125 | + $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' ) ; |
| 126 | + $wgOut->addHtml ( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' ); |
| 127 | + } |
| 128 | + $wgOut->addHtml (self::userForm( $this->mTarget ) ); |
| 129 | + return false; |
| 130 | + } |
130 | 131 | |
| 132 | + $this->mTargetObj = $ret; |
| 133 | + |
131 | 134 | $form = new HTMLForm( $this->getFormFields() ); |
132 | 135 | $form->addPreText( wfMsgExt( 'emailpagetext', 'parseinline' ) ); |
133 | 136 | $form->setSubmitText( wfMsg( 'emailsend' ) ); |
— | — | @@ -216,6 +219,23 @@ |
217 | 220 | |
218 | 221 | return null; |
219 | 222 | } |
| 223 | + |
| 224 | + /** |
| 225 | + * Form to ask for target user name. |
| 226 | + * @author purodha |
| 227 | + * @param $name string User name submitted. |
| 228 | + * @return string form asking for user name. |
| 229 | + */ |
| 230 | + static function userForm( $name ) { |
| 231 | + $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => '', 'id' => 'askusername' ) ) . |
| 232 | + Xml::openElement( 'fieldset' ) . |
| 233 | + Html::rawElement( 'legend', null, wfMessage( 'emailtarget' )->parse() ) . |
| 234 | + Xml::inputLabel( wfMessage('emailusername')->text(), 'target', 'emailusertarget', 30, $name ) . ' ' . |
| 235 | + Xml::submitButton( wfMessage('emailusernamesubmit')->text() ) . |
| 236 | + Xml::closeElement( 'fieldset' ) . |
| 237 | + Xml::closeElement( 'form' ) . "\n"; |
| 238 | + return $string; |
| 239 | + } |
220 | 240 | |
221 | 241 | /** |
222 | 242 | * Really send a mail. Permissions should have been checked using |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2679,6 +2679,10 @@ |
2680 | 2680 | 'noemailtext' => 'This user has not specified a valid e-mail address.', |
2681 | 2681 | 'nowikiemailtitle' => 'No e-mail allowed', |
2682 | 2682 | 'nowikiemailtext' => 'This user has chosen not to receive e-mail from other users.', |
| 2683 | +'emailnotarget' => 'Nonexistent or invalid user name to receive e-mail.', |
| 2684 | +'emailtarget' => 'Enter user to receive e-mail', |
| 2685 | +'emailusername' => 'User name:', |
| 2686 | +'emailusernamesubmit' => 'Submit', |
2683 | 2687 | 'email-legend' => 'Send an e-mail to another {{SITENAME}} user', |
2684 | 2688 | 'emailfrom' => 'From:', |
2685 | 2689 | 'emailto' => 'To:', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -130,6 +130,7 @@ |
131 | 131 | to avoid loops and confusion; auth plugins like CentralAuth need to handle |
132 | 132 | AbortNewAccount separately. |
133 | 133 | * Special:ListFiles is now transcludable. |
| 134 | +* (bug 13879) Special:Emailuser asks for suitable target user if called without. |
134 | 135 | |
135 | 136 | |
136 | 137 | === Bug fixes in 1.18 === |