Index: trunk/phase3/includes/specials/SpecialInterwiki.php |
— | — | @@ -7,17 +7,15 @@ |
8 | 8 | class SpecialInterwiki extends SpecialPage { |
9 | 9 | |
10 | 10 | function __construct() { |
11 | | - parent::__construct( 'Interwiki' ); |
| 11 | + parent::__construct( 'Interwiki', 'interwiki' ); |
12 | 12 | } |
13 | | - |
14 | 13 | |
15 | | - function execute( $par = null ) { |
| 14 | + function execute( $par ) { |
16 | 15 | global $wgRequest, $wgOut, $wgUser; |
17 | 16 | |
18 | | - $admin = $wgUser->isAllowed( 'interwiki' ); |
19 | | - |
20 | 17 | $this->setHeaders(); |
21 | | - if( $admin ){ |
| 18 | + $admin = $this->userCanExecute( $wgUser ); |
| 19 | + if ( $admin ) { |
22 | 20 | $wgOut->setPagetitle( wfMsg( 'interwiki' ) ); |
23 | 21 | } else { |
24 | 22 | $wgOut->setPagetitle( wfMsg( 'interwiki-title-norights' ) ); |
— | — | @@ -39,31 +37,32 @@ |
40 | 38 | } |
41 | 39 | |
42 | 40 | $prefix = $wgRequest->getVal( 'prefix' ); |
43 | | - $encPrefix = htmlspecialchars( $prefix ); |
44 | | - $actionUrl = $selfTitle->escapeLocalURL( "action=submit" ); |
45 | | - $button = wfMsgHtml( 'delete' ); |
46 | | - $topmessage = wfMsgHtml( 'interwiki_delquestion', $encPrefix ); |
| 41 | + $actionUrl = $selfTitle->getLocalURL( "action=submit" ); |
| 42 | + $button = wfMsg( 'delete' ); |
| 43 | + $topmessage = wfMsg( 'interwiki_delquestion', $encPrefix ); |
47 | 44 | $deletingmessage = wfMsgHtml( 'interwiki_deleting', $encPrefix ); |
48 | | - $reasonmessage = wfMsgHtml( 'deletecomment' ); |
| 45 | + $reasonmessage = wfMsg( 'deletecomment' ); |
49 | 46 | $defaultreason = wfMsgForContent( 'interwiki_defaultreason' ); |
50 | | - $token = htmlspecialchars( $wgUser->editToken() ); |
| 47 | + $token = $wgUser->editToken(); |
51 | 48 | |
52 | 49 | $wgOut->addHTML( |
53 | | - "<fieldset> |
54 | | - <legend>$topmessage</legend> |
55 | | - <form id=\"delete\" method=\"post\" action=\"{$actionUrl}\"> |
56 | | - <table><tr> |
57 | | - <td>$deletingmessage</td> |
58 | | - </tr><tr> |
59 | | - <td>$reasonmessage <input tabindex='1' type='text' name=\"reason\" maxlength='200' size='60' value='$defaultreason' /></td> |
60 | | - </tr><tr><td> |
61 | | - <input type='submit' name='delete' id=\"interwikideletebutton\" value='{$button}' /> |
62 | | - <input type='hidden' name='prefix' value='{$encPrefix}' /> |
63 | | - <input type='hidden' name='do' value='delete' /> |
64 | | - <input type='hidden' name='wpEditToken' value='{$token}' /> |
65 | | - </td></tr></table> |
66 | | - </form> |
67 | | - </fieldset>\n" |
| 50 | + Xml::openElement( 'fieldset' ) . |
| 51 | + Xml::element( 'legend', null, $topmessage ) . |
| 52 | + Xml::openElement( 'form', array('id'=> 'mw-interwiki-deleteform', 'method'=> 'post', 'action'=>$actionUrl) ) . |
| 53 | + Xml::openElement( 'table' ) . |
| 54 | + "<tr><td>$deletingmessage</td></tr>". |
| 55 | + '<tr><td class="mw-label">' . Xml::label( $reasonmessage, 'mw-interwiki-deletereason') . '</td>' . |
| 56 | + '<td class="mw-input">' . |
| 57 | + Xml::input( 'wpInterwikiReason', 60, $defaultreason, array('tabindex'=>'1', 'id'=>'mw-interwiki-deletereason', 'maxlength'=>'200') ) . |
| 58 | + '</td></tr>' . |
| 59 | + '<tr><td class="mw-submit">' . Xml::submitButton( $button, array('id'=>'mw-interwiki-submit') ) . |
| 60 | + Xml::hidden( 'wpInterwikiPrefix', $prefix ) . |
| 61 | + Xml::hidden( 'wpInterwikiAction', $action ) . |
| 62 | + Xml::hidden( 'wpEditToken', $token ) . |
| 63 | + '</td></tr>' . |
| 64 | + Xml::closeElement( 'table' ) . |
| 65 | + Xml::closeElement( 'form' ) . |
| 66 | + Xml::closeElement( 'fieldset' ) |
68 | 67 | ); |
69 | 68 | break; |
70 | 69 | case "edit" : |
— | — | @@ -80,61 +79,57 @@ |
81 | 80 | $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>', array( 'interwiki_editerror', $prefix ) ); |
82 | 81 | return; |
83 | 82 | } |
84 | | - $prefix = htmlspecialchars( $row->iw_prefix ); |
85 | | - $defaulturl = htmlspecialchars( $row->iw_url ); |
86 | | - $trans = $row->iw_trans ? " checked='checked'" : '' ; |
87 | | - $local = $row->iw_local ? " checked='checked'" : ''; |
88 | | - $old = "<input type='hidden' name='prefix' value='" . htmlspecialchars( $row->iw_prefix ) . "' />"; |
89 | | - $topmessage = wfMsgHtml( 'interwiki_edittext' ); |
90 | | - $intromessage = wfMsgHtml( 'interwiki_editintro' ); |
91 | | - $button = wfMsgHtml( 'edit' ); |
| 83 | + $prefix = '<tt>' . htmlspecialchars( $row->iw_prefix ) . '</tt>'; |
| 84 | + $defaulturl = $row->iw_url; |
| 85 | + $trans = $row->iw_trans; |
| 86 | + $local = $row->iw_local; |
| 87 | + $old = Xml::hidden( 'wpInterwikiPrefix', $row->iw_prefix ); |
| 88 | + $topmessage = wfMsgExt( 'interwiki_edittext', array('parseinline') ); |
| 89 | + $intromessage = wfMsgExt( 'interwiki_editintro', array('parseinline') ); |
| 90 | + $button = wfMsg( 'edit' ); |
92 | 91 | } else { |
93 | | - $prefix = "<input tabindex='1' type='text' name='prefix' maxlength='20' size='20' />"; |
94 | | - $local = ''; |
95 | | - $trans = ''; |
| 92 | + $prefix = Xml::input( 'wpInterwikiPrefix', 20, false, array( 'tabindex'=>'1', 'id'=>'mw-interwiki-prefix', 'maxlength'=>'20') ); |
| 93 | + $local = false; |
| 94 | + $trans = false; |
96 | 95 | $old = ''; |
97 | | - $defaulturl = wfMsgHtml( 'interwiki_defaulturl' ); |
98 | | - $topmessage = wfMsgHtml( 'interwiki_addtext' ); |
99 | | - $intromessage = wfMsgHtml( 'interwiki_addintro' ); |
100 | | - $button = wfMsgHtml( 'interwiki_addbutton' ); |
| 96 | + $defaulturl = wfMsg( 'interwiki_defaulturl' ); |
| 97 | + $topmessage = wfMsgExt( 'interwiki_addtext', array('parseinline') ); |
| 98 | + $intromessage = wfMsgExt( 'interwiki_addintro', array('parseinline') ); |
| 99 | + $button = wfMsg( 'interwiki_addbutton' ); |
101 | 100 | } |
102 | 101 | |
103 | | - $actionUrl = $selfTitle->escapeLocalURL( 'action=submit' ); |
| 102 | + $actionUrl = $selfTitle->getLocalURL( 'action=submit' ); |
104 | 103 | $prefixmessage = wfMsgHtml( 'interwiki_prefix' ); |
105 | | - $localmessage = wfMsgHtml( 'interwiki_local' ); |
106 | | - $transmessage = wfMsgHtml( 'interwiki_trans' ); |
107 | | - $reasonmessage = wfMsgHtml( 'interwiki_reasonfield' ); |
108 | | - $urlmessage = wfMsgHtml( 'interwiki_url' ); |
109 | | - $token = htmlspecialchars( $wgUser->editToken() ); |
110 | | - $defaultreason = htmlspecialchars( wfMsgForContent( 'interwiki_defaultreason' ) ); |
| 104 | + $localmessage = wfMsg( 'interwiki_local' ); |
| 105 | + $transmessage = wfMsg( 'interwiki_trans' ); |
| 106 | + $reasonmessage = wfMsg( 'interwiki_reasonfield' ); |
| 107 | + $urlmessage = wfMsg( 'interwiki_url' ); |
| 108 | + $token = $wgUser->editToken(); |
| 109 | + $defaultreason = wfMsgForContent( 'interwiki_defaultreason' ); |
111 | 110 | |
112 | 111 | $wgOut->addHTML( |
113 | | - "<fieldset> |
114 | | - <legend>$topmessage</legend> |
115 | | - $intromessage |
116 | | - <form id='{$action}' method='post' action='{$actionUrl}'> |
117 | | - <table id='interwikitable-{$action}'><tr> |
118 | | - <td>$prefixmessage</td> |
119 | | - <td>$prefix</td> |
120 | | - </tr><tr> |
121 | | - <td>$localmessage</td> |
122 | | - <td><input type='checkbox' id='local' name='local' {$local}/></td> |
123 | | - </tr><tr> |
124 | | - <td>$transmessage</td> |
125 | | - <td><input type='checkbox' id='trans' name='trans' {$trans}/></td> |
126 | | - </tr><tr> |
127 | | - <td>$urlmessage</td> |
128 | | - <td><input tabindex='1' type='text' name='theurl' maxlength='200' size='60' value='$defaulturl' /></td> |
129 | | - </tr><tr> |
130 | | - <td>$reasonmessage</td> |
131 | | - <td><input tabindex='1' type='text' name='reason' maxlength='200' size='60' value='$defaultreason' /></td> |
132 | | - </tr></table> |
133 | | - <input type='submit' name='{$action}' id='interwiki{$action}button' value='{$button}' /> |
134 | | - <input type='hidden' name='do' value='{$action}' /> |
135 | | - $old |
136 | | - <input type='hidden' name='wpEditToken' value='{$token}' /> |
137 | | - </form> |
138 | | - </fieldset>\n" |
| 112 | + Xml::openElement( 'fieldset' ) . |
| 113 | + Xml::element( 'legend', null, $topmessage ) . |
| 114 | + $intromessage . |
| 115 | + Xml::openElement( 'form', array('id'=> 'mw-interwiki-editform', 'method'=> 'post', 'action'=>$actionUrl) ) . |
| 116 | + Xml::openElement( 'table', array('id'=>"mw-interwiki-$action") ) . |
| 117 | + "<tr><td class='mw-label'>$prefixmessage</td><td><tt>$prefix</tt></td></tr>" . |
| 118 | + "<tr><td class='mw-label'>" . Xml::label( $localmessage, 'mw-interwiki-local' ) . '</td>' . |
| 119 | + "<td class='mw-input'>" . Xml::check( 'wpInterwikiLocal', $local, array('id'=>'mw-interwiki-local') ) . '</td></tr>' . |
| 120 | + '<tr><td class="mw-label">' . Xml::label( $transmessage, 'mw-interwiki-trans' ) . '</td>' . |
| 121 | + '<td class="mw-input">' . Xml::check( 'wpInterwikiTrans', $trans, array('id'=>'mw-interwiki-trans') ) . '</td></tr>' . |
| 122 | + '<tr><td class="mw-label">' . Xml::label( $urlmessage, 'mw-interwiki-url' ) . '</td>' . |
| 123 | + '<td class="mw-input">' . Xml::input( 'wpInterwikiURL', 60, $defaulturl, array('tabindex'=>'1', 'maxlength'=>'200', 'id'=>'mw-interwiki-url') ) . '</td></tr>' . |
| 124 | + '<tr><td class="mw-label">' . Xml::label( $reasonmessage, 'mw-interwiki-editreason' ) . '</td>' . |
| 125 | + '<td class="mw-input">' . Xml::input( 'wpInterwikiReason', 60, $defaultreason, array( 'tabindex'=>'1', 'id'=>'mw-interwiki-editreason', 'maxlength'=>'200') ) . |
| 126 | + Xml::hidden( 'wpInterwikiAction', $action ) . |
| 127 | + $old . |
| 128 | + Xml::hidden( 'wpEditToken', $token ) . |
| 129 | + '</td></tr>' . |
| 130 | + '<tr><td class="mw-submit">' . Xml::submitButton( $button, array('id'=>'mw-interwiki-submit') ) . '</td></tr>' . |
| 131 | + Xml::closeElement( 'table' ) . |
| 132 | + Xml::closeElement( 'form' ) . |
| 133 | + Xml::closeElement( 'fieldset' ) |
139 | 134 | ); |
140 | 135 | break; |
141 | 136 | case "submit": |
— | — | @@ -147,9 +142,9 @@ |
148 | 143 | return; |
149 | 144 | } |
150 | 145 | |
151 | | - $prefix = $wgRequest->getVal('prefix'); |
152 | | - $reason = $wgRequest->getText('reason'); |
153 | | - $do = $wgRequest->getVal('do'); |
| 146 | + $prefix = $wgRequest->getVal( 'wpInterwikiPrefix' ); |
| 147 | + $reason = $wgRequest->getText( 'wpInterwikiReason' ); |
| 148 | + $do = $wgRequest->getVal( 'wpInterwikiAction' ); |
154 | 149 | $dbw = wfGetDB( DB_MASTER ); |
155 | 150 | switch( $do ){ |
156 | 151 | case "delete": |
— | — | @@ -166,9 +161,9 @@ |
167 | 162 | break; |
168 | 163 | case "edit": |
169 | 164 | case "add": |
170 | | - $theurl = $wgRequest->getVal('theurl'); |
171 | | - $local = $wgRequest->getCheck('local') ? 1 : 0; |
172 | | - $trans = $wgRequest->getCheck('trans') ? 1 : 0; |
| 165 | + $theurl = $wgRequest->getVal( 'wpInterwikiURL' ); |
| 166 | + $local = $wgRequest->getCheck( 'wpInterwikiLocal' ) ? 1 : 0; |
| 167 | + $trans = $wgRequest->getCheck( 'wpInterwikiTrans' ) ? 1 : 0; |
173 | 168 | $data = array( 'iw_prefix' => $prefix, 'iw_url' => $theurl, |
174 | 169 | 'iw_local' => $local, 'iw_trans' => $trans ); |
175 | 170 | |
— | — | @@ -195,7 +190,7 @@ |
196 | 191 | $localmessage = wfMsgHtml( 'interwiki_local' ); |
197 | 192 | $transmessage = wfMsgHtml( 'interwiki_trans' ); |
198 | 193 | |
199 | | - $wgOut->addWikiText( wfMsg( 'interwiki_intro', '[http://www.mediawiki.org/wiki/Interwiki_table MediaWiki.org]' ) ); |
| 194 | + $wgOut->addWikiText( wfMsg( 'interwiki_intro' ) ); |
200 | 195 | |
201 | 196 | if ($admin) { |
202 | 197 | $skin = $wgUser->getSkin(); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2212,7 +2212,7 @@ |
2213 | 2213 | Remember that this can break existing links.', |
2214 | 2214 | 'interwiki_edittext' => 'Editing an interwiki prefix', |
2215 | 2215 | 'interwiki_error' => 'Error: The interwiki table is empty, or something else went wrong.', |
2216 | | -'interwiki_intro' => 'See $1 for more information about the interwiki table. |
| 2216 | +'interwiki_intro' => 'See [http://www.mediawiki.org/wiki/Interwiki_table MediaWiki.org] for more information about the interwiki table. |
2217 | 2217 | There is a [[Special:Log/interwiki|log of changes]] to the interwiki table.', |
2218 | 2218 | 'interwiki_local' => 'Define this as a local wiki', |
2219 | 2219 | 'interwiki_log_added' => 'added prefix "$2" ($3) (trans: $4) (local: $5) to the interwiki table', |