Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1045,6 +1045,7 @@ |
1046 | 1046 | 'allpagessubmit', |
1047 | 1047 | 'allpagesprefix', |
1048 | 1048 | 'allpagesbadtitle', |
| 1049 | + 'allpages-bad-ns', |
1049 | 1050 | ), |
1050 | 1051 | 'listusers' => array( |
1051 | 1052 | 'listusersfrom', |
Index: trunk/phase3/includes/SpecialAllpages.php |
— | — | @@ -19,10 +19,7 @@ |
20 | 20 | |
21 | 21 | $indexPage = new SpecialAllpages(); |
22 | 22 | |
23 | | - if( !in_array($namespace, array_keys($namespaces)) ) |
24 | | - $namespace = 0; |
25 | | - |
26 | | - $wgOut->setPagetitle( $namespace > 0 ? |
| 23 | + $wgOut->setPagetitle( ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ? |
27 | 24 | wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : |
28 | 25 | wfMsg( 'allarticles' ) |
29 | 26 | ); |
— | — | @@ -53,41 +50,44 @@ |
54 | 51 | * @param string $from Article name we are starting listing at. |
55 | 52 | */ |
56 | 53 | function namespaceForm ( $namespace = NS_MAIN, $from = '' ) { |
57 | | - global $wgScript; |
| 54 | + global $wgScript, $wgContLang; |
58 | 55 | $t = SpecialPage::getTitleFor( $this->name ); |
| 56 | + $align = $wgContLang->isRtl() ? 'left' : 'right'; |
59 | 57 | |
60 | | - $namespaceselect = HTMLnamespaceselector($namespace, null); |
61 | | - |
62 | | - $frombox = "<input type='text' size='20' name='from' id='nsfrom' value=\"" |
63 | | - . htmlspecialchars ( $from ) . '"/>'; |
64 | | - $submitbutton = '<input type="submit" value="' . wfMsgHtml( 'allpagessubmit' ) . '" />'; |
65 | | - |
66 | | - $out = "<div class='namespaceoptions'><form method='get' action='{$wgScript}'>"; |
67 | | - $out .= '<input type="hidden" name="title" value="'.$t->getPrefixedText().'" />'; |
68 | | - $out .= " |
69 | | -<table id='nsselect' class='allpages'> |
70 | | - <tr> |
71 | | - <td align='right'>" . wfMsgHtml($this->nsfromMsg) . "</td> |
72 | | - <td align='left'><label for='nsfrom'>$frombox</label></td> |
73 | | - </tr> |
74 | | - <tr> |
75 | | - <td align='right'><label for='namespace'>" . wfMsgHtml('namespace') . "</label></td> |
76 | | - <td align='left'> |
77 | | - $namespaceselect $submitbutton |
78 | | - </td> |
79 | | - </tr> |
80 | | -</table> |
81 | | -"; |
82 | | - $out .= '</form></div>'; |
83 | | - return $out; |
| 58 | + $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); |
| 59 | + $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
| 60 | + $out .= Xml::hidden( 'title', $t->getPrefixedText() ); |
| 61 | + $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'allpages' ) ); |
| 62 | + $out .= "<tr> |
| 63 | + <td align='$align'>" . |
| 64 | + Xml::label( wfMsg( $this->nsfromMsg ), 'nsfrom' ) . |
| 65 | + "</td> |
| 66 | + <td>" . |
| 67 | + Xml::input( 'from', 20, htmlspecialchars ( $from ), array( 'id' => 'nsfrom' ) ) . |
| 68 | + "</td> |
| 69 | + </tr> |
| 70 | + <tr> |
| 71 | + <td align='$align'>" . |
| 72 | + Xml::label( wfMsg( 'namespace' ), 'namespace' ) . |
| 73 | + "</td> |
| 74 | + <td>" . |
| 75 | + Xml::namespaceSelector( $namespace, null ) . |
| 76 | + Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . |
| 77 | + "</td> |
| 78 | + </tr>"; |
| 79 | + $out .= Xml::closeElement( 'table' ); |
| 80 | + $out .= Xml::closeElement( 'form' ); |
| 81 | + $out .= Xml::closeElement( 'div' ); |
| 82 | + return $out; |
84 | 83 | } |
85 | 84 | |
86 | 85 | /** |
87 | 86 | * @param integer $namespace (default NS_MAIN) |
88 | 87 | */ |
89 | 88 | function showToplevel ( $namespace = NS_MAIN, $including = false ) { |
90 | | - global $wgOut; |
| 89 | + global $wgOut, $wgContLang; |
91 | 90 | $fname = "indexShowToplevel"; |
| 91 | + $align = $wgContLang->isRtl() ? 'left' : 'right'; |
92 | 92 | |
93 | 93 | # TODO: Either make this *much* faster or cache the title index points |
94 | 94 | # in the querycache table. |
— | — | @@ -170,8 +170,8 @@ |
171 | 171 | $morelinks = ''; |
172 | 172 | if ( $morelinks != '' ) { |
173 | 173 | $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
174 | | - $out2 .= '<tr valign="top"><td align="left">' . $nsForm; |
175 | | - $out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">'; |
| 174 | + $out2 .= '<tr valign="top"><td>' . $nsForm; |
| 175 | + $out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">'; |
176 | 176 | $out2 .= $morelinks . '</td></tr></table><hr />'; |
177 | 177 | } else { |
178 | 178 | $out2 = $nsForm . '<hr />'; |
— | — | @@ -187,6 +187,8 @@ |
188 | 188 | * @param integer $namespace (Default NS_MAIN) |
189 | 189 | */ |
190 | 190 | function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { |
| 191 | + global $wgContLang; |
| 192 | + $align = $wgContLang->isRtl() ? 'left' : 'right'; |
191 | 193 | $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); |
192 | 194 | $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); |
193 | 195 | $queryparams = ($namespace ? "namespace=$namespace" : ''); |
— | — | @@ -196,9 +198,9 @@ |
197 | 199 | $out = wfMsgHtml( |
198 | 200 | 'alphaindexline', |
199 | 201 | "<a href=\"$link\">$inpointf</a></td><td><a href=\"$link\">", |
200 | | - "</a></td><td align=\"left\"><a href=\"$link\">$outpointf</a>" |
| 202 | + "</a></td><td><a href=\"$link\">$outpointf</a>" |
201 | 203 | ); |
202 | | - return '<tr><td align="right">'.$out.'</td></tr>'; |
| 204 | + return '<tr><td align="' . $align . '">'.$out.'</td></tr>'; |
203 | 205 | } |
204 | 206 | |
205 | 207 | /** |
— | — | @@ -209,14 +211,20 @@ |
210 | 212 | global $wgOut, $wgUser, $wgContLang; |
211 | 213 | |
212 | 214 | $fname = 'indexShowChunk'; |
213 | | - |
214 | 215 | $sk = $wgUser->getSkin(); |
215 | 216 | |
216 | 217 | $fromList = $this->getNamespaceKeyAndText($namespace, $from); |
| 218 | + $namespaces = $wgContLang->getNamespaces(); |
| 219 | + $align = $wgContLang->isRtl() ? 'left' : 'right'; |
| 220 | + |
217 | 221 | $n = 0; |
218 | | - |
| 222 | + |
219 | 223 | if ( !$fromList ) { |
220 | 224 | $out = wfMsgWikiHtml( 'allpagesbadtitle' ); |
| 225 | + } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) { |
| 226 | + // Show errormessage and reset to NS_MAIN |
| 227 | + $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace ); |
| 228 | + $namespace = NS_MAIN; |
221 | 229 | } else { |
222 | 230 | list( $namespace, $fromKey, $from ) = $fromList; |
223 | 231 | |
— | — | @@ -298,8 +306,8 @@ |
299 | 307 | |
300 | 308 | $nsForm = $this->namespaceForm ( $namespace, $from ); |
301 | 309 | $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
302 | | - $out2 .= '<tr valign="top"><td align="left">' . $nsForm; |
303 | | - $out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' . |
| 310 | + $out2 .= '<tr valign="top"><td>' . $nsForm; |
| 311 | + $out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">' . |
304 | 312 | $sk->makeKnownLink( $wgContLang->specialPage( "Allpages" ), |
305 | 313 | wfMsgHtml ( 'allpages' ) ); |
306 | 314 | |
— | — | @@ -324,11 +332,16 @@ |
325 | 333 | |
326 | 334 | $wgOut->addHtml( $out2 . $out ); |
327 | 335 | if( isset($prevLink) or isset($nextLink) ) { |
328 | | - $wgOut->addHtml( '<hr/><p style="font-size: smaller; float: right;">' ); |
329 | | - if( isset( $prevLink ) ) |
330 | | - $wgOut->addHTML( $prevLink . ' | '); |
331 | | - if( isset( $nextLink ) ) |
| 336 | + $wgOut->addHtml( '<hr /><p style="font-size: smaller; float: ' . $align . '">' ); |
| 337 | + if( isset( $prevLink ) ) { |
| 338 | + $wgOut->addHTML( $prevLink ); |
| 339 | + } |
| 340 | + if( isset( $prevLink ) && isset( $nextLink ) ) { |
| 341 | + $wgOut->addHTML( ' | ' ); |
| 342 | + } |
| 343 | + if( isset( $nextLink ) ) { |
332 | 344 | $wgOut->addHTML( $nextLink ); |
| 345 | + } |
333 | 346 | $wgOut->addHTML( '</p>' ); |
334 | 347 | |
335 | 348 | } |
Index: trunk/phase3/includes/SpecialPrefixindex.php |
— | — | @@ -15,21 +15,15 @@ |
16 | 16 | $from = $wgRequest->getVal( 'from' ); |
17 | 17 | $prefix = $wgRequest->getVal( 'prefix' ); |
18 | 18 | $namespace = $wgRequest->getInt( 'namespace' ); |
19 | | - |
20 | 19 | $namespaces = $wgContLang->getNamespaces(); |
21 | 20 | |
22 | 21 | $indexPage = new SpecialPrefixIndex(); |
23 | 22 | |
24 | | - if( !in_array($namespace, array_keys($namespaces)) ) |
25 | | - $namespace = 0; |
| 23 | + $wgOut->setPagetitle( ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) |
| 24 | + ? wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) |
| 25 | + : wfMsg( 'allarticles' ) |
| 26 | + ); |
26 | 27 | |
27 | | - $wgOut->setPagetitle( $namespace > 0 ? |
28 | | - wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : |
29 | | - wfMsg( 'allarticles' ) |
30 | | - ); |
31 | | - |
32 | | - |
33 | | - |
34 | 28 | if ( isset($par) ) { |
35 | 29 | $indexPage->showChunk( $namespace, $par, $specialPage->including(), $from ); |
36 | 30 | } elseif ( isset($prefix) ) { |
— | — | @@ -67,9 +61,15 @@ |
68 | 62 | |
69 | 63 | $fromList = $this->getNamespaceKeyAndText($namespace, $from); |
70 | 64 | $prefixList = $this->getNamespaceKeyAndText($namespace, $prefix); |
| 65 | + $namespaces = $wgContLang->getNamespaces(); |
| 66 | + $align = $wgContLang->isRtl() ? 'left' : 'right'; |
71 | 67 | |
72 | 68 | if ( !$prefixList || !$fromList ) { |
73 | 69 | $out = wfMsgWikiHtml( 'allpagesbadtitle' ); |
| 70 | + } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) { |
| 71 | + // Show errormessage and reset to NS_MAIN |
| 72 | + $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace ); |
| 73 | + $namespace = NS_MAIN; |
74 | 74 | } else { |
75 | 75 | list( $namespace, $prefixKey, $prefix ) = $prefixList; |
76 | 76 | list( /* $fromNs */, $fromKey, $from ) = $fromList; |
— | — | @@ -127,8 +127,8 @@ |
128 | 128 | } else { |
129 | 129 | $nsForm = $this->namespaceForm ( $namespace, $prefix ); |
130 | 130 | $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
131 | | - $out2 .= '<tr valign="top"><td align="left">' . $nsForm; |
132 | | - $out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' . |
| 131 | + $out2 .= '<tr valign="top"><td>' . $nsForm; |
| 132 | + $out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">' . |
133 | 133 | $sk->makeKnownLink( $wgContLang->specialPage( $this->name ), |
134 | 134 | wfMsg ( 'allpages' ) ); |
135 | 135 | if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1652,6 +1652,7 @@ |
1653 | 1653 | 'allpagessubmit' => 'Go', |
1654 | 1654 | 'allpagesprefix' => 'Display pages with prefix:', |
1655 | 1655 | 'allpagesbadtitle' => 'The given page title was invalid or had an inter-language or inter-wiki prefix. It may contain one or more characters which cannot be used in titles.', |
| 1656 | +'allpages-bad-ns' => '{{SITENAME}} does not have namespace "$1".', |
1656 | 1657 | |
1657 | 1658 | # Special:Listusers |
1658 | 1659 | 'listusersfrom' => 'Display users starting at:', |
Index: trunk/phase3/languages/messages/MessagesDe.php |
— | — | @@ -1273,6 +1273,7 @@ |
1274 | 1274 | 'allpagessubmit' => 'Anwenden', |
1275 | 1275 | 'allpagesprefix' => 'Seiten anzeigen mit Präfix:', |
1276 | 1276 | 'allpagesbadtitle' => 'Der eingegebene Seitenname ist ungültig: Er hat entweder ein vorangestelltes Sprach-, ein Interwiki-Kürzel oder enthält ein oder mehrere Zeichen, welche in Seitennamen nicht verwendet werden dürfen.', |
| 1277 | +'allpages-bad-ns' => 'Der Namensraum „$1“ ist in {{SITENAME}} nicht vorhanden.', |
1277 | 1278 | |
1278 | 1279 | # Special:Listusers |
1279 | 1280 | 'listusersfrom' => 'Zeige Benutzer ab:', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -208,6 +208,8 @@ |
209 | 209 | * Fixed zero-padding issues with MySQL 5 binary schema |
210 | 210 | * (bug 10344) Don't follow a redirect after changing its protection level |
211 | 211 | * (bug 10333) Correct date format in Slovenian |
| 212 | +* (bug 10160) Show error message for unknown namespace on Special:Allpages and |
| 213 | + Special:Prefixindex; making forms prettier for RTL wikis. |
212 | 214 | |
213 | 215 | == API changes since 1.10 == |
214 | 216 | |