Modernize the email user form to our actual standards:
authorRaimond Spekking <raymond@users.mediawiki.org>
Thu, 28 Aug 2008 11:55:43 +0000 (11:55 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Thu, 28 Aug 2008 11:55:43 +0000 (11:55 +0000)
* Add fieldset
* RTL compatability
* CSS classes/IDs

includes/DefaultSettings.php
includes/specials/SpecialEmailuser.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc
skins/common/shared.css

index 617662b..1eb755c 100644 (file)
@@ -1382,7 +1382,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches don't keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '169';
+$wgStyleVersion = '170';
 
 
 # Server-side caching:
index 9dcf895..318b1c6 100644 (file)
@@ -98,46 +98,64 @@ class EmailUserForm {
                        $this->subject = wfMsgExt( 'defemailsubject', array( 'content', 'parsemag' ) );
                }
 
-               $emf = wfMsg( "emailfrom" );
-               $senderLink = $skin->makeLinkObj(
-                       $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) );
-               $emt = wfMsg( "emailto" );
-               $recipientLink = $skin->makeLinkObj(
-                       $this->target->getUserPage(), htmlspecialchars( $this->target->getName() ) );
-               $emr = wfMsg( "emailsubject" );
-               $emm = wfMsg( "emailmessage" );
-               $ems = wfMsg( "emailsend" );
-               $emc = wfMsg( "emailccme" );
-               $encSubject = htmlspecialchars( $this->subject );
-
                $titleObj = SpecialPage::getTitleFor( "Emailuser" );
-               $action = $titleObj->escapeLocalURL( "target=" .
+               $action = $titleObj->getLocalURL( "target=" .
                        urlencode( $this->target->getName() ) . "&action=submit" );
-               $token = htmlspecialchars( $wgUser->editToken() );
-
-               $wgOut->addHTML( "
-<form id=\"emailuser\" method=\"post\" action=\"{$action}\">
-<table border='0' id='mailheader'><tr>
-<td align='right'>{$emf}:</td>
-<td align='left'><strong>{$senderLink}</strong></td>
-</tr><tr>
-<td align='right'>{$emt}:</td>
-<td align='left'><strong>{$recipientLink}</strong></td>
-</tr><tr>
-<td align='right'>{$emr}:</td>
-<td align='left'>
-<input type='text' size='60' maxlength='200' name=\"wpSubject\" value=\"{$encSubject}\" />
-</td>
-</tr>
-</table>
-<span id='wpTextLabel'><label for=\"wpText\">{$emm}:</label><br /></span>
-<textarea id=\"wpText\" name=\"wpText\" rows='20' cols='80' style=\"width: 100%;\">" . htmlspecialchars( $this->text ) .
-"</textarea>
-" . wfCheckLabel( $emc, 'wpCCMe', 'wpCCMe', $wgUser->getBoolOption( 'ccmeonemails' ) ) . "<br />
-<input type='submit' name=\"wpSend\" value=\"{$ems}\" accesskey=\"s\" />
-<input type='hidden' name='wpEditToken' value=\"$token\" />
-</form>\n" );
 
+               $wgOut->addHTML(  
+                       Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'emailuser' ) ) .
+                       Xml::openElement( 'fieldset' ) .
+                       Xml::element( 'legend', null, wfMsg( 'email-legend' ) ) .
+                       Xml::openElement( 'table', array( 'class' => 'mw-emailuser-table' ) ) .
+                       "<tr>
+                               <td class='mw-label'>" .
+                                       Xml::label( wfMsg( 'emailfrom' ), 'emailfrom' ) .
+                               "</td>
+                               <td class='mw-input' id='mw-emailuser-sender'>" .
+                                       $skin->link( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) ) .
+                               "</td>
+                       </tr>
+                       <tr>
+                               <td class='mw-label'>" .
+                                       Xml::label( wfMsg( 'emailto' ), 'emailto' ) .
+                               "</td>
+                               <td class='mw-input' id='mw-emailuser-recipient'>" .
+                                       $skin->link( $this->target->getUserPage(), htmlspecialchars( $this->target->getName() ) ) .
+                               "</td>
+                       </tr>
+                       <tr>
+                               <td class='mw-label'>" .
+                                       Xml::label( wfMsg( 'emailsubject' ), 'wpSubject' ) .
+                               "</td>
+                               <td class='mw-input'>" .
+                                       Xml::input( 'wpSubject', 60, $this->subject, array( 'type' => 'text', 'maxlength' => 200 ) ) .
+                               "</td>
+                       </tr>
+                       <tr>
+                               <td class='mw-label'>" .
+                                       Xml::label( wfMsg( 'emailmessage' ), 'wpText' ) .
+                               "</td>
+                               <td class='mw-input'>" .
+                                       Xml::textarea( 'wpText', $this->text, 80, 20, array( 'id' => 'wpText' ) ) .
+                               "</td>
+                       </tr>
+                       <tr>
+                               <td></td>
+                               <td class='mw-input'>" .
+                                       Xml::checkLabel( wfMsg( 'emailccme' ), 'wpCCMe', 'wpCCMe', $wgUser->getBoolOption( 'ccmeonemails' ) ) .
+                               "</td>
+                       </tr>
+                       <tr>
+                               <td></td>
+                               <td class='mw-submit'>" .
+                                       Xml::submitButton( wfMsg( 'emailsend' ), array( 'name' => 'wpSend', 'accesskey' => 's' ) ) .
+                               "</td>
+                       </tr>" .
+                       Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .
+                       Xml::closeElement( 'table' ) .
+                       Xml::closeElement( 'fieldset' ) .
+                       Xml::closeElement( 'form' )
+               );
        }
 
        /*
index 1c337e0..f318dbb 100644 (file)
@@ -2117,6 +2117,7 @@ The e-mail address you entered in [[Special:Preferences|your user preferences]]
 'defemailsubject' => '{{SITENAME}} e-mail',
 'noemailtitle'    => 'No e-mail address',
 'noemailtext'     => 'This user has not specified a valid e-mail address, or 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:',
index cfb5c9c..bce227c 100644 (file)
@@ -1390,6 +1390,7 @@ $wgMessageStructure = array(
                'defemailsubject',
                'noemailtitle',
                'noemailtext',
+               'email-legend',
                'emailfrom',
                'emailto',
                'emailsubject',
index d42fc1c..a357e6d 100644 (file)
@@ -247,3 +247,12 @@ h4.mw-specialpagesgroup {
 #shared-image-dup, #shared-image-conflict {
        font-style: italic;
 }
+
+/* Special:EmailUser styling */
+table.mw-emailuser-table {
+       width: 98%;
+}
+td#mw-emailuser-sender, td#mw-emailuser-recipient {
+       font-weight: bold;
+}
+