* New feature, the ability to 'invert' namespaces in Special:Allmessages, given
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Fri, 1 Apr 2005 11:09:47 +0000 (11:09 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Fri, 1 Apr 2005 11:09:47 +0000 (11:09 +0000)
  a namespace the 'Invert' namespace can be selected to perform WHERE
  page_namespace != $namespace instead of WHERE page_namespace = ..

** Added code in includes/SpecialAllpages.php to make this possible

** Removed messages: allpagesformtext1 and allpagesformtext2 (obsoleted by the
   new allpagesformtext messsage)
** Renamed message allpagesnamespace to allinnamespace
** Added messages allnonarticles, allnotinnamespace, contributionsformtext

** includes/SpecialContributions.php no longer uses allpagesformtext2 but the
   new contributionsformtext

12 files changed:
includes/SpecialAllpages.php
includes/SpecialContributions.php
languages/Language.php
languages/LanguageEs.php
languages/LanguageFi.php
languages/LanguageFr.php
languages/LanguageIs.php
languages/LanguageNds.php
languages/LanguageNn.php
languages/LanguageRu.php
languages/LanguageZh_cn.php
languages/LanguageZh_tw.php

index d2eacf6..99e457f 100644 (file)
  */
 function wfSpecialAllpages( $par=NULL ) {
        global $indexMaxperpage, $toplevelMaxperpage, $wgRequest, $wgOut, $wgContLang;
+       # Config
        $indexMaxperpage = 480;
        $toplevelMaxperpage = 50;
+       # GET values
        $from = $wgRequest->getVal( 'from' );
        $namespace = $wgRequest->getInt( 'namespace' );
+       $invert = $wgRequest->getInt( 'invert' );
+       
        $names = $wgContLang->getNamespaces();
+
        if( !isset( $names[$namespace] ) ) {
                $namespace = 0;
        }
-       $wgOut->setPagetitle ( $namespace > 0 ? wfMsg ( 'allpagesnamespace', $names[$namespace] )
-                                             : wfMsg ( 'allarticles' ) );
 
+       if ($invert) {
+               $wgOut->setPagetitle( $namespace > 0 ?
+                       wfMsg( 'allnotinnamespace', $names[$namespace] ) :
+                       wfMsg( 'allnonarticles' )
+                       );
+       } else {
+               $wgOut->setPagetitle( $namespace > 0 ?
+                       wfMsg( 'allinnamespace', $names[$namespace] ) :
+                       wfMsg( 'allarticles' )
+                       );
+       }
+       
        if ( $par ) {
-               indexShowChunk( $par, $namespace );
+               indexShowChunk( $namespace, $par, $invert );
        } elseif ( $from ) {
-               indexShowChunk( $from, $namespace );
+               indexShowChunk( $namespace, $from, $invert );
        } else {
-               indexShowToplevel ( $namespace );
+               indexShowToplevel ( $namespace, $invert );
        }
 }
 
@@ -36,9 +51,8 @@ function wfSpecialAllpages( $par=NULL ) {
  * @param integer $namespace A namespace constant (default NS_MAIN).
  * @param string $from Article name we are starting listing at.
  */
-function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
+function namespaceForm ( $namespace = NS_MAIN, $from = '', $invert = 0) {
        global $wgContLang, $wgScript;
-
        $t = Title::makeTitle( NS_SPECIAL, "Allpages" );
 
        $namespaceselect = '<select name="namespace">';
@@ -55,11 +69,12 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
        $frombox = '<input type="text" size="20" name="from" value="'
                    . htmlspecialchars ( $from ) . '"/>';
        $submitbutton = '<input type="submit" value="' . wfMsg( 'allpagessubmit' ) . '" />';
+       
+       $invertbox = "<input type='checkbox' name='invert' value='1'" . ( $invert == 1 ? ' checked="checked"' : '' ) . ' />';
 
        $out = "<div class='namespaceselector'><form method='get' action='{$wgScript}'>";
        $out .= '<input type="hidden" name="title" value="'.$t->getPrefixedText().'" />';
-       $out .= wfMsg ( 'allpagesformtext1', $frombox ) . '<br />';
-       $out .= wfMsg ( 'allpagesformtext2', $namespaceselect, $submitbutton );
+       $out .= wfMsg ( 'allpagesformtext', $frombox, $namespaceselect, $submitbutton, $invertbox );
        $out .= '</form></div>';
        return $out;
 }
@@ -68,7 +83,7 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
  * @todo Document
  * @param integer $namespace (default NS_MAIN)
  */
-function indexShowToplevel ( $namespace = NS_MAIN ) {
+function indexShowToplevel ( $namespace = NS_MAIN, $invert = 0 ) {
        global $wgOut, $indexMaxperpage, $toplevelMaxperpage, $wgContLang, $wgRequest, $wgUser;
        $sk = $wgUser->getSkin();
        $fname = "indexShowToplevel";
@@ -79,7 +94,8 @@ function indexShowToplevel ( $namespace = NS_MAIN ) {
 
        $dbr =& wfGetDB( DB_SLAVE );
        $page = $dbr->tableName( 'page' );
-       $fromwhere = "FROM $page WHERE page_namespace=$namespace";
+       $invsql = ($invert) ? '!' : '';
+       $fromwhere = "FROM $page WHERE page_namespace$invsql=$namespace";
        $order_arr = array ( 'ORDER BY' => 'page_title' );
        $order_str = 'ORDER BY page_title';
        $out = "";
@@ -87,11 +103,11 @@ function indexShowToplevel ( $namespace = NS_MAIN ) {
 
        $count = $dbr->selectField( 'page', 'COUNT(*)', $where, $fname );
        $sections = ceil( $count / $indexMaxperpage );
-
+       
        if ( $sections < 3 ) {
                # If there are only two or less sections, don't even display them.
                # Instead, display the first section directly.
-               indexShowChunk( '', $namespace );
+               indexShowChunk( $namespace, '', $invert );
                return;
        }
 
@@ -110,7 +126,7 @@ function indexShowToplevel ( $namespace = NS_MAIN ) {
        $lines = array();
 
        # If we are going to show n rows, we need n+1 queries to find the relevant titles.
-       for ( $i = $offset; $i <= $stopat; $i++ ) {
+       for ( $i = $offset; $i <= $stopat; ++$i ) {
                if ( $i == $sections )                  # if we're displaying the last section, we need to
                        $from = $count-1;                       # find the last page_title in the DB
                else if ( $i > $offset )
@@ -136,8 +152,8 @@ function indexShowToplevel ( $namespace = NS_MAIN ) {
                $out .= indexShowline ( $inpoint, $outpoint, $namespace );
        }
        $out .= '</table>';
-
-       $nsForm = namespaceForm ( $namespace );
+       
+       $nsForm = namespaceForm ( $namespace, '', $invert );
 
        # Is there more?
        $morelinks = '';
@@ -193,7 +209,7 @@ function indexShowline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
        return '<tr><td align="right">'.$out.'</td></tr>';
 }
 
-function indexShowChunk( $from, $namespace = NS_MAIN ) {
+function indexShowChunk( $namespace = NS_MAIN, $from, $invert ) {
        global $wgOut, $wgUser, $indexMaxperpage, $wgContLang;
        $sk = $wgUser->getSkin();
        $maxPlusOne = $indexMaxperpage + 1;
@@ -206,7 +222,8 @@ function indexShowChunk( $from, $namespace = NS_MAIN ) {
        $fromTitle = Title::newFromURL( $from );
        $fromKey = is_null( $fromTitle ) ? '' : $fromTitle->getDBkey();
        
-       $sql = "SELECT page_title FROM $page WHERE page_namespace=$namespacee" .
+       $invsql = ($invert) ? '!' : '';
+       $sql = "SELECT page_title FROM $page WHERE page_namespace$invsql=$namespacee" .
                " AND page_title >= ".  $dbr->addQuotes( $fromKey ) .
                " ORDER BY page_title LIMIT " . $maxPlusOne;
        $res = $dbr->query( $sql, 'indexShowChunk' );
@@ -235,8 +252,8 @@ function indexShowChunk( $from, $namespace = NS_MAIN ) {
                $out .= '</tr>';
        }
        $out .= '</table>';
-
-       $nsForm = namespaceForm ( $namespace, $from );
+       
+       $nsForm = namespaceForm ( $namespace, $from, $invert );
        $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">';
        $out2 .= '<tr valign="top"><td align="left">' . $nsForm;
        $out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' .
@@ -244,10 +261,11 @@ function indexShowChunk( $from, $namespace = NS_MAIN ) {
                                wfMsg ( 'allpages' ) );
        if ( ($n == $indexMaxperpage) && ($s = $dbr->fetchObject( $res )) ) {
                $namespaceparam = $namespace ? "&namespace=$namespace" : "";
+               $invertparam = $invert ? "&invert=$invert" : '';
                $out2 .= " | " . $sk->makeKnownLink(
                        $wgContLang->specialPage( "Allpages" ),
                        wfMsg ( 'nextpage', $s->page_title ),
-                       "from=" . wfUrlEncode ( $s->page_title ) . $namespaceparam );
+                       "from=" . wfUrlEncode ( $s->page_title ) . $namespaceparam . $invertparam );
        }
        $out2 .= "</td></tr></table><hr />";
 
index 492cf4e..25e444d 100644 (file)
@@ -244,7 +244,7 @@ function namespaceForm ( $target, $hideminor, $namespace ) {
        $out .= '<input type="hidden" name="title" value="'.$wgContLang->specialpage( 'Contributions' ).'" />';
        $out .= '<input type="hidden" name="target" value="'.htmlspecialchars( $target ).'" />';
        $out .= '<input type="hidden" name="hideminor" value="'.$hideminor.'" />';      
-       $out .= wfMsg ( 'allpagesformtext2', $namespaceselect, $submitbutton );
+       $out .= wfMsg ( 'contributionsformtext', $namespaceselect, $submitbutton );
        $out .= '</form></div>';
        return $out;
 }
index 6d04ef7..0a57e27 100644 (file)
@@ -1163,15 +1163,30 @@ You can narrow down the view by selecting a log type, the user name, or the affe
 # Special:Allpages
 'nextpage'          => 'Next page ($1)',
 'articlenamespace'  => '(articles)',
-'allpagesformtext1' => 'Display pages starting at: $1',
-'allpagesformtext2' => 'Choose namespace: $1 $2',
-'allarticles'       => 'All articles',
-'allpagesprev'      => 'Previous',
-'allpagesnext'      => 'Next',
-'allpagesnamespace' => 'All pages ($1 namespace)',
-'allpagessubmit'    => 'Go',
-
-# Email this user
+'allpagesformtext' => '
+<table border="0">
+       <tr>
+               <td align="right">Display pages starting at:</td>
+               <td align="left">$1</td>
+       </tr>
+       <tr>
+               <td align="right">Namespace:</td>
+               <td align="left">$2 $3</td>
+       </tr>
+       <tr>
+               <td align="right">$4</td>
+               <td align="left">Invert</td>
+       </tr>
+</table>',
+'allarticles'          => 'All articles',
+'allnonarticles'       => 'All non-articles',
+'allinnamespace'       => 'All pages ($1 namespace)',
+'allnotinnamespace'    => 'All pages (not in $1 namespace)',
+'allpagesprev'         => 'Previous',
+'allpagesnext'         => 'Next',
+'allpagessubmit'       => 'Go',
+
+# E this user
 #
 'mailnologin'  => 'No send address',
 'mailnologintext' => "You must be <a href=\"{{localurl:Special:Userlogin\">logged in</a>
@@ -1354,6 +1369,13 @@ See [[Special:Log/delete]] for a record of recent deletions and restorations.",
 'contributions' => 'User contributions',
 'mycontris'     => 'My contributions',
 'contribsub'    => "For $1",
+'contributionsformtext' => '
+<table border="0">
+        <tr>
+                <td align="right">Namespace:</td>
+                <td align="left">$1 $2</td>
+        </tr>
+</table>',
 'nocontribs'    => 'No changes were found matching these criteria.',
 'ucnote'        => "Below are this user's last <b>$1</b> changes in the last <b>$2</b> days.",
 'uclinks'       => "View the last $1 changes; view the last $2 days.",
@@ -1958,7 +1980,7 @@ class Language {
                global $wgUser, $wgLocalTZoffset;
 
                if (!$tz) {
-               $tz = $wgUser->getOption( 'timecorrection' );
+                       $tz = $wgUser->getOption( 'timecorrection' );
                }
 
                if ( $tz === '' ) {
@@ -2026,7 +2048,7 @@ class Language {
                }
                return $this->formatNum( $t );
        }
-
+       
        function timeanddate( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false, $dateandtime = false) {
                global $wgUser;
                $ts=wfTimestamp(TS_MW,$ts);
index 1a9a7c3..6934b24 100644 (file)
@@ -1043,12 +1043,10 @@ Por favor, elige otro nombre.",
 # Special:Allpages
 'nextpage'          => 'Next page ($1)',
 'articlenamespace'  => '(artículos)',
-'allpagesformtext1' => 'Mostrar páginas que comiencen por: $1',
-'allpagesformtext2' => 'Elige espacio de nombres: $1 $2',
 'allarticles'       => 'Todos los artículos',
 'allpagesprev'      => 'Anterior',
 'allpagesnext'      => 'Siguiente',
-'allpagesnamespace' => 'Todas las páginas (espacio $1)',
+'allinnamespace' => 'Todas las páginas (espacio $1)',
 'allpagessubmit'    => 'Mostrar',
 
 # Patrolling
index 31e6da8..cbd7dcb 100644 (file)
@@ -709,7 +709,7 @@ Voit rajoittaa listaa valitsemalla lokityypin, käyttäjän tai sivun johon muut
 'allarticles'       => 'Kaikki artikkelit',
 'allpagesprev'      => 'Edellinen',
 'allpagesnext'      => 'Seuraaa',
-'allpagesnamespace' => 'Kaikki sivut (nimiavaruudessa $1 )',
+'allinnamespace' => 'Kaikki sivut (nimiavaruudessa $1 )',
 'allpagessubmit'    => 'Mene',
 
 # Email this user
index 664d572..9edd273 100644 (file)
@@ -818,9 +818,7 @@ Parmi ceux-ci, <b>$2</b> ont le statut d'administrateur (voir $3).",
 
 # All pages
 #
-'allpagesformtext1' => "Afficher les pages à partir de : $1",
-'allpagesformtext2' => "Choisir un <i>namespace</i> : $1 $2",
-'allpagesnamespace' => "Toutes les pages (espace $1)",
+'allinnamespace' => "Toutes les pages (espace $1)",
 'allpagesnext' => "Suivant",
 'allpagesprev' => "Précédent",
 'allpagessubmit' => "Valider",
index 7fa3fb6..67384bb 100644 (file)
@@ -156,7 +156,6 @@ svo auðveldara sé að sjá hana þar meðal fjöldans.
 'allmessages' => 'Kerfismeldingar',
 'allmessagestext' => 'Listi yfir meldingar í kerfismeldingarýminu.',
 'allpages' => 'Allar síður',
-'allpagesformtext2' => 'Nafnrými: $1 $2',
 'alphaindexline' => '$1 til $2',
 'alreadyloggedin' => '<font color=red><b>Notandinn $1 er þegar innskráður!</b></font><br />',
 'ancientpages' => 'Elstu síður',
index b1b7404..8f81249 100644 (file)
@@ -868,12 +868,10 @@ Du kannst de List kötter maken, wenn du den Logtyp, den Brukernaam oder de de S
 # Special:Allpages
 'nextpage'          => 'tokamen Siet ($1)',
 'articlenamespace'  => '(Artikels)',
-'allpagesformtext1' => 'Wies Sieten, anfungen bi: $1',
-'allpagesformtext2' => 'Wähl Naamruum: $1 $2',
 'allarticles'       => 'Alle Artikels',
 'allpagesprev'      => 'vörig',
 'allpagesnext'      => 'tokamen',
-'allpagesnamespace' => 'Alle Sieten ($1 Naamruum)',
+'allinnamespace' => 'Alle Sieten ($1 Naamruum)',
 'allpagessubmit'    => 'Los',
 
 # Oppasslist
index 294b9f8..dec2e98 100644 (file)
@@ -899,12 +899,10 @@ Kvar line inneheld lenkjer til den første og den andre omdirigeringa, og den f
 # Special:Allpages
 'nextpage'              => 'Neste side ($1)',
 'articlenamespace'      => '(innhaldssider)',
-'allpagesformtext1'     => 'Vis sider frå: $1',
-'allpagesformtext2'     => 'Velj namnerom: $1 $2',
 'allarticles'           => 'Alle innhaldssider',
 'allpagesprev'          => 'Førre',
 'allpagesnext'          => 'Neste',
-'allpagesnamespace'     => 'Alle sider ($1 namnerom)',
+'allinnamespace'     => 'Alle sider ($1 namnerom)',
 'allpagessubmit'        => 'Utfør',
 
 # Email this user
index 57b96a1..e6675d5 100644 (file)
@@ -1010,12 +1010,10 @@ Cм. [[{{ns:project}}:Справка по настройкам]], чтобы р
 # Special:Allpages
 'nextpage'          => 'Следующая страница ($1)',
 'articlenamespace'  => '(статьи)',
-'allpagesformtext1' => 'Показать страницы начиная с: $1',
-'allpagesformtext2' => 'Выберите пространство имён: $1 $2',
 'allarticles'       => 'Все статьи',
 'allpagesprev'      => 'Предыдущие',
 'allpagesnext'      => 'Следующие',
-'allpagesnamespace' => 'Все страницы ($1 пространство имён)',
+'allinnamespace' => 'Все страницы ($1 пространство имён)',
 'allpagessubmit'    => 'Выполнить',
 
 # Email this user
index 2b85492..99fb7b6 100644 (file)
@@ -957,9 +957,7 @@ Wikipedia与这些公司并没有任何商业关系,因此本表不应该
 'allmessages' => "系统界面", //"All system messages",
 'allmessagesnotsupportedDB' => "系统界面功能处于关闭状态 (wgUseDatabaseMessages)。", //"Special:AllMessages not supported because wgUseDatabaseMessages is off.",
 'allmessagestext' => "这里列出所有可定制的系统界面。", //"This is a list of all system messages available in the MediaWiki: namespace.",
-'allpagesformtext1' => "列出从 $1 起的条目", //"Display pages starting at: $1",
-'allpagesformtext2' => "选定名字空间: $1 $2", //"Choose namespace: $1 $2",
-'allpagesnamespace' => "所有 $1 名字空间的条目", //"All pages ($1 namespace)",
+'allinnamespace' => "所有 $1 名字空间的条目", //"All pages ($1 namespace)",
 'allpagesnext' => "下一页", //"Next",
 'allpagesprev' => "上一页", //"Previous",
 'allpagessubmit' => "提交", //"Go",
index 300f45b..fb6b6f7 100644 (file)
@@ -943,9 +943,7 @@ alt=\"Google\" align=\"middle\"></a>
 'allmessages' => "系統界面", //"All system messages",
 'allmessagesnotsupportedDB' => "系統界面功能處於關閉狀態 (wgUseDatabaseMessages)。", //"Special:AllMessages not supported because wgUseDatabaseMessages is off.",
 'allmessagestext' => "這裡列出所有可定製的系統界面。", //"This is a list of all system messages available in the MediaWiki: namespace.",
-'allpagesformtext1' => "列出從 $1 起的條目", //"Display pages starting at: $1",
-'allpagesformtext2' => "選定名字空間: $1 $2", //"Choose namespace: $1 $2",
-'allpagesnamespace' => "所有 $1 名字空間的條目", //"All pages ($1 namespace)",
+'allinnamespace' => "所有 $1 名字空間的條目", //"All pages ($1 namespace)",
 'allpagesnext' => "下一頁", //"Next",
 'allpagesprev' => "上一頁", //"Previous",
 'allpagessubmit' => "提交", //"Go",