r26090 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26089‎ | r26090 | r26091 >
Date:21:27, 24 September 2007
Author:raymond
Status:old
Tags:
Comment:
* (bug 8376) Special:Newpages accepts namespace in subpage form (again?)
* Removing some code which seems useless/outdated, parameters &limit=, &offset=, &username=... works furthermore
* Make input form nicer for RTL wikis
* Found and fixed another bug: namespace selection was lost after submit
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialNewpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialNewpages.php
@@ -138,19 +138,28 @@
139139 * @return string
140140 */
141141 function getPageHeader() {
142 - global $wgScript;
 142+ global $wgScript, $wgContLang;
 143+ $align = $wgContLang->isRTL() ? 'left' : 'right';
143144 $self = SpecialPage::getTitleFor( $this->getName() );
144 - $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
145 - $form .= Xml::hidden( 'title', $self->getPrefixedDBkey() );
146 - # Namespace selector
147 - $form .= '<table><tr><td align="right">' . Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '</td>';
148 - $form .= '<td>' . Xml::namespaceSelector( $this->namespace, 'all' ) . '</td></tr>';
149 - # Username filter
150 - $form .= '<tr><td align="right">' . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . '</td>';
151 - $form .= '<td>' . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . '</td></tr>';
152 -
153 - $form .= '<tr><td></td><td>' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>';
154 - $form .= Xml::hidden( 'offset', $this->offset ) . Xml::hidden( 'limit', $this->limit ) . '</form>';
 145+ $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
 146+ Xml::hidden( 'title', $self->getPrefixedDBkey() ) .
 147+ Xml::openElement( 'table' ) .
 148+ "<tr>
 149+ <td align=\"$align\">" . Xml::label( wfMsg( 'namespace' ), 'namespace' ) . "</td>
 150+ <td>" . Xml::namespaceSelector( intval( $this->namespace ), 'all' ) . "</td>
 151+ </tr>
 152+ <tr>
 153+ <td align=\"$align\">" . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . "</td>
 154+ <td>" . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . "</td>
 155+ </tr>
 156+ <tr>
 157+ <td></td>
 158+ <td>" . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</td>
 159+ </tr>" .
 160+ Xml::closeElement( 'table' ) .
 161+ Xml::hidden( 'offset', $this->offset ) .
 162+ Xml::hidden( 'limit', $this->limit ) .
 163+ Xml::closeElement( 'form' );
155164 return $form;
156165 }
157166
@@ -168,7 +177,7 @@
169178 /**
170179 * constructor
171180 */
172 -function wfSpecialNewpages($par, $specialPage) {
 181+function wfSpecialNewpages( $par, $specialPage ) {
173182 global $wgRequest, $wgContLang;
174183
175184 list( $limit, $offset ) = wfCheckLimits();
@@ -176,32 +185,13 @@
177186 $username = '';
178187
179188 if ( $par ) {
180 - $bits = preg_split( '/\s*,\s*/', trim( $par ) );
181 - foreach ( $bits as $bit ) {
182 - if ( 'shownav' == $bit )
183 - $shownavigation = true;
184 - if ( is_numeric( $bit ) )
185 - $limit = $bit;
186 -
187 - $m = array();
188 - if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) )
189 - $limit = intval($m[1]);
190 - if ( preg_match( '/^offset=(\d+)$/', $bit, $m ) )
191 - $offset = intval($m[1]);
192 - if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
193 - $ns = $wgContLang->getNsIndex( $m[1] );
194 - if( $ns !== false ) {
195 - $namespace = $ns;
196 - }
197 - }
198 - }
 189+ $namespace = $wgContLang->getNsIndex( $par );
199190 } else {
200191 if( $ns = $wgRequest->getText( 'namespace', NS_MAIN ) )
201192 $namespace = $ns;
202 - if( $un = $wgRequest->getText( 'username' ) )
203 - $username = $un;
204193 }
205 -
 194+ if( $un = $wgRequest->getText( 'username' ) )
 195+ $username = $un;
206196 if ( ! isset( $shownavigation ) )
207197 $shownavigation = ! $specialPage->including();
208198
@@ -209,4 +199,4 @@
210200
211201 if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) )
212202 $npp->doQuery( $offset, $limit, $shownavigation );
213 -}
\ No newline at end of file
 203+}
Index: trunk/phase3/RELEASE-NOTES
@@ -67,6 +67,9 @@
6868 * (bug 11331) Add buildConcat() and use CASE not IF for DB compatibility. Make oldimage
6969 cascade delete via image table for Postgres, change fa_storage_key TEXT.
7070 * (bug 11438) Live Preview chops returned text
 71+* (bug 8376) Special:Newpages accepts namespace in subpage form
 72+* Make input form of Special:Newpages nicer for RTL wikis
 73+* Fix namespace selection after submit of Special:Newpages
7174
7275 === API changes in 1.12 ===
7376

Follow-up revisions

RevisionCommit summaryAuthorDate
r26110Revert r26090 -- breaks parameters for Special:Newpages with no explanation o...brion14:14, 25 September 2007
r26135Merged revisions 26012-26133 via svnmerge from...david21:15, 25 September 2007

Status & tagging log