Index: trunk/extensions/PasswordReset/PasswordReset_body.php |
— | — | @@ -47,31 +47,31 @@ |
48 | 48 | |
49 | 49 | if ( !is_object( $objUser ) || $userID == 0 ) { |
50 | 50 | $validUser = false; |
51 | | - $wgOut->addHTML( "<span style=\"color: red;\">" . wfMsg( 'passwordreset-invalidusername' ) . "</span><br />\n" ); |
| 51 | + $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-invalidusername' ) ) . "\n" ); |
52 | 52 | } else { |
53 | 53 | $validUser = true; |
54 | 54 | } |
55 | 55 | } else { |
56 | 56 | $validUser = false; |
57 | | - $wgOut->addHTML( "<span style=\"color: red;\">" . wfMsg( 'passwordreset-emptyusername' ) . "</span><br />\n" ); |
| 57 | + $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-emptyusername' ) ) . "\n" ); |
58 | 58 | } |
59 | 59 | |
60 | 60 | $newpass = $wgRequest->getText( 'newpass' ); |
61 | 61 | $confirmpass = $wgRequest->getText( 'confirmpass' ); |
62 | 62 | |
63 | | - if( ( $newpass == $confirmpass && strlen( $newpass ) > 0) || $disableuser) { |
| 63 | + if( ( $newpass == $confirmpass && strlen( $newpass ) > 0 ) || $disableuser ) { |
64 | 64 | //Passwords match |
65 | 65 | $passMatch = true; |
66 | 66 | } else { |
67 | 67 | //Passwords DO NOT match |
68 | 68 | $passMatch = false; |
69 | | - $wgOut->addHTML( "<span style=\"color: red;\">" . wfMsg( 'passwordreset-nopassmatch' ) . "</span><br />\n" ); |
| 69 | + $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-nopassmatch' ) ) . "\n" ); |
70 | 70 | } |
71 | 71 | |
72 | 72 | if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) { |
73 | 73 | $validUser = false; |
74 | 74 | $passMatch = false; |
75 | | - $wgOut->addHTML( "<span style=\"color: red;\">" . wfMsg( 'passwordreset-badtoken' ) . "</span><br />\n" ); |
| 75 | + $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-badtoken' ) ) . "\n" ); |
76 | 76 | } |
77 | 77 | } else { |
78 | 78 | $validUser = false; |
— | — | @@ -79,9 +79,6 @@ |
80 | 80 | $newpass = ''; |
81 | 81 | } |
82 | 82 | |
83 | | - $action = $wgTitle->escapeLocalUrl(); |
84 | | - $token = $wgUser->editToken(); |
85 | | - |
86 | 83 | $wgOut->addHTML( " |
87 | 84 | <script language=\"Javascript\"> |
88 | 85 | function disableUserClicked() { |
— | — | @@ -94,37 +91,54 @@ |
95 | 92 | } |
96 | 93 | return true; |
97 | 94 | } |
98 | | -</script> |
99 | | -<form id='passwordresetform' method='post' action=\"$action\"> |
100 | | -<table> |
101 | | - <tr> |
102 | | - <td align='right'>" . wfMsg('passwordreset-username') . "</td> |
103 | | - <td align='left'><input tabindex='1' type='text' size='20' name='username' id='username' value=\"$username_text\" onFocus=\"document.getElementById('username').select;\" /></td> |
| 95 | +</script>" . |
| 96 | + Xml::openElement( 'form', array( 'method' => 'post', 'action' => $wgTitle->getLocalUrl(), 'id' => 'passwordresetform' ) ) . |
| 97 | + Xml::openElement( 'table', array( 'id' => 'mw-passwordreset-table' ) ) . |
| 98 | + "<tr> |
| 99 | + <td class='mw-label'>" . |
| 100 | + Xml::label( wfMsg( 'passwordreset-username' ), 'username' ) . |
| 101 | + "</td> |
| 102 | + <td class='mw-input'> |
| 103 | + <input tabindex='1' type='text' size='20' name='username' id='username' value=\"$username_text\" onFocus=\"document.getElementById('username').select;\" /> |
| 104 | + </td> |
104 | 105 | </tr> |
105 | 106 | <tr> |
106 | | - <td align='right'>" . wfMsg('passwordreset-newpass') . "</td> |
107 | | - <td align='left'><input tabindex='2' type='password' size='20' name='newpass' id='newpass' value=\"$newpass\" onFocus=\"document.getElementById('newpass').select;\"{$passwordfielddisabled} /></td> |
| 107 | + <td class='mw-label'>" . |
| 108 | + Xml::label( wfMsg( 'passwordreset-newpass' ), 'newpass' ) . |
| 109 | + "</td> |
| 110 | + <td class='mw-input'> |
| 111 | + <input tabindex='2' type='password' size='20' name='newpass' id='newpass' value=\"$newpass\" onFocus=\"document.getElementById('newpass').select;\"{$passwordfielddisabled} /> |
| 112 | + </td> |
108 | 113 | </tr> |
109 | 114 | <tr> |
110 | | - <td align='right'>" . wfMsg('passwordreset-confirmpass') . "</td> |
111 | | - <td align='left'><input tabindex='3' type='password' size='20' name='confirmpass' id='confirmpass' value=\"$confirmpass\" onFocus=\"document.getElementById('confirmpass').select;\"{$passwordfielddisabled} /></td> |
| 115 | + <td class='mw-label'>" . |
| 116 | + Xml::label( wfMsg( 'passwordreset-confirmpass' ), 'confirmpass' ) . |
| 117 | + "</td> |
| 118 | + <td class='mw-input'> |
| 119 | + <input tabindex='3' type='password' size='20' name='confirmpass' id='confirmpass' value=\"$confirmpass\" onFocus=\"document.getElementById('confirmpass').select;\"{$passwordfielddisabled} /> |
| 120 | + </td> |
112 | 121 | </tr> |
113 | 122 | <tr> |
114 | | - <td align='right'>" . wfMsg('passwordreset-disableuser') . "</td> |
115 | | - <td align='left'><input tabindex='4' type='checkbox' name='disableuser' id='disableuser' onmouseup='return disableUserClicked();'{$disableuserchecked} /> " . wfMsg('passwordreset-disableuserexplain') . "</td> |
| 123 | + <td class='mw-label'>" . |
| 124 | + Xml::label( wfMsg( 'passwordreset-disableuser' ), 'disableuser' ) . |
| 125 | + "</td> |
| 126 | + <td class='mw-input'> |
| 127 | + <input tabindex='4' type='checkbox' name='disableuser' id='disableuser' onmouseup='return disableUserClicked();'{$disableuserchecked} /> " . wfMsg('passwordreset-disableuserexplain') . |
| 128 | + "</td> |
116 | 129 | </tr> |
117 | 130 | <tr> |
118 | | - <td> </td> |
119 | | - <td align='right'><input type='submit' name='submit' value=\"" . wfMsg('passwordreset-submit') . "\" /></td> |
120 | | - </tr> |
121 | | -</table> |
122 | | -<input type='hidden' name='token' value='$token' /> |
123 | | -</form>" |
| 131 | + <td></td> |
| 132 | + <td class='mw-submit'>" . |
| 133 | + Xml::submitButton( wfMsg( 'passwordreset-submit' ), array( 'name' => 'submit' ) ) . |
| 134 | + "</td> |
| 135 | + </tr>" . |
| 136 | + Xml::closeElement( 'table' ) . |
| 137 | + Xml::hidden( 'token', $wgUser->editToken() ) . |
| 138 | + Xml::closeElement( 'form' ) |
124 | 139 | ); |
125 | 140 | |
126 | 141 | if ( $validUser && $passMatch ) { |
127 | | - $wgOut->addWikiText ( "<hr />\n" ); |
128 | | - $wgOut->addWikiText ( $this->resetPassword( $userID, $newpass, $disableuser ) ); |
| 142 | + $wgOut->addWikiText ( Xml::tags( 'div', array( 'class' => 'successbox' ), $this->resetPassword( $userID, $newpass, $disableuser ) ) ); |
129 | 143 | } else { |
130 | 144 | //Invalid user or passwords don't match - do nothing |
131 | 145 | } |