From 05edce6ac1bf1bb0702500c1ae128a33d79b5e77 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Fri, 1 Apr 2005 11:09:47 +0000 Subject: [PATCH] * New feature, the ability to 'invert' namespaces in Special:Allmessages, given 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 --- includes/SpecialAllpages.php | 60 ++++++++++++++++++++----------- includes/SpecialContributions.php | 2 +- languages/Language.php | 44 +++++++++++++++++------ languages/LanguageEs.php | 4 +-- languages/LanguageFi.php | 2 +- languages/LanguageFr.php | 4 +-- languages/LanguageIs.php | 1 - languages/LanguageNds.php | 4 +-- languages/LanguageNn.php | 4 +-- languages/LanguageRu.php | 4 +-- languages/LanguageZh_cn.php | 4 +-- languages/LanguageZh_tw.php | 4 +-- 12 files changed, 81 insertions(+), 56 deletions(-) diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index d2eacf61f5..99e457ff15 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -11,23 +11,38 @@ */ 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 = ''; $submitbutton = ''; + + $invertbox = "'; $out = "
"; $out .= ''; - $out .= wfMsg ( 'allpagesformtext1', $frombox ) . '
'; - $out .= wfMsg ( 'allpagesformtext2', $namespaceselect, $submitbutton ); + $out .= wfMsg ( 'allpagesformtext', $frombox, $namespaceselect, $submitbutton, $invertbox ); $out .= '
'; 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 .= ''; - - $nsForm = namespaceForm ( $namespace ); + + $nsForm = namespaceForm ( $namespace, '', $invert ); # Is there more? $morelinks = ''; @@ -193,7 +209,7 @@ function indexShowline( $inpoint, $outpoint, $namespace = NS_MAIN ) { return ''.$out.''; } -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 .= ''; } $out .= ''; - - $nsForm = namespaceForm ( $namespace, $from ); + + $nsForm = namespaceForm ( $namespace, $from, $invert ); $out2 = ''; $out2 .= '
' . $nsForm; $out2 .= '' . @@ -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 .= "

"; diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 492cf4e4b3..25e444d491 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -244,7 +244,7 @@ function namespaceForm ( $target, $hideminor, $namespace ) { $out .= ''; $out .= ''; $out .= ''; - $out .= wfMsg ( 'allpagesformtext2', $namespaceselect, $submitbutton ); + $out .= wfMsg ( 'contributionsformtext', $namespaceselect, $submitbutton ); $out .= ''; return $out; } diff --git a/languages/Language.php b/languages/Language.php index 6d04ef719f..0a57e2734f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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' => ' + + + + + + + + + + + + + +
Display pages starting at:$1
Namespace:$2 $3
$4Invert
', +'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 logged in @@ -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' => ' + + + + + +
Namespace:$1 $2
', 'nocontribs' => 'No changes were found matching these criteria.', 'ucnote' => "Below are this user's last $1 changes in the last $2 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); diff --git a/languages/LanguageEs.php b/languages/LanguageEs.php index 1a9a7c31af..6934b240c8 100644 --- a/languages/LanguageEs.php +++ b/languages/LanguageEs.php @@ -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 diff --git a/languages/LanguageFi.php b/languages/LanguageFi.php index 31e6da8d36..cbd7dcb953 100644 --- a/languages/LanguageFi.php +++ b/languages/LanguageFi.php @@ -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 diff --git a/languages/LanguageFr.php b/languages/LanguageFr.php index 664d57263a..9edd2730f3 100644 --- a/languages/LanguageFr.php +++ b/languages/LanguageFr.php @@ -818,9 +818,7 @@ Parmi ceux-ci, $2 ont le statut d'administrateur (voir $3).", # All pages # -'allpagesformtext1' => "Afficher les pages à partir de : $1", -'allpagesformtext2' => "Choisir un namespace : $1 $2", -'allpagesnamespace' => "Toutes les pages (espace $1)", +'allinnamespace' => "Toutes les pages (espace $1)", 'allpagesnext' => "Suivant", 'allpagesprev' => "Précédent", 'allpagessubmit' => "Valider", diff --git a/languages/LanguageIs.php b/languages/LanguageIs.php index 7fa3fb6b45..67384bbf76 100644 --- a/languages/LanguageIs.php +++ b/languages/LanguageIs.php @@ -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' => 'Notandinn $1 er þegar innskráður!
', 'ancientpages' => 'Elstu síður', diff --git a/languages/LanguageNds.php b/languages/LanguageNds.php index b1b7404d7c..8f81249348 100644 --- a/languages/LanguageNds.php +++ b/languages/LanguageNds.php @@ -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 diff --git a/languages/LanguageNn.php b/languages/LanguageNn.php index 294b9f8b2b..dec2e98507 100644 --- a/languages/LanguageNn.php +++ b/languages/LanguageNn.php @@ -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 diff --git a/languages/LanguageRu.php b/languages/LanguageRu.php index 57b96a1981..e6675d5adf 100644 --- a/languages/LanguageRu.php +++ b/languages/LanguageRu.php @@ -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 diff --git a/languages/LanguageZh_cn.php b/languages/LanguageZh_cn.php index 2b85492c3c..99fb7b6221 100644 --- a/languages/LanguageZh_cn.php +++ b/languages/LanguageZh_cn.php @@ -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", diff --git a/languages/LanguageZh_tw.php b/languages/LanguageZh_tw.php index 300f45bfba..fb6b6f7c79 100644 --- a/languages/LanguageZh_tw.php +++ b/languages/LanguageZh_tw.php @@ -943,9 +943,7 @@ alt=\"Google\" align=\"middle\"> '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", -- 2.20.1