Revert r34267, r34268, r34269, r34270 for now.
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 5 May 2008 22:14:55 +0000 (22:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 5 May 2008 22:14:55 +0000 (22:14 +0000)
I don't like the UI chhanges here; the file usage links simply disappear from their current location with no warning or explanation, while the in-page TOC at the top suddenly starts linking to a different page, totally unexpectedly.

RELEASE-NOTES
includes/ImagePage.php
includes/SpecialWhatlinkshere.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index acb1dd7..cc77377 100644 (file)
@@ -103,7 +103,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   shared when $wgSharedDB is enabled.
 * Drop-down AJAX search suggestions (turn on $wgEnableMWSuggest) 
 * More relevant search snippets (turn on $wgAdvancedSearchHighlighting)
-* Image links are now displayed using Special:Whatlinkshere
 
 === Bug fixes in 1.13 ===
 
index 9c28f2c..3b8a1f5 100644 (file)
@@ -87,7 +87,7 @@ class ImagePage extends Article {
 
                $this->closeShowImage();
                $this->imageHistory();
-               
+               $this->imageLinks();
 
                if ( $showmeta ) {
                        global $wgStylePath, $wgStyleVersion;
@@ -111,12 +111,10 @@ class ImagePage extends Article {
         */
        function showTOC( $metadata ) {
                global $wgLang;
-               $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' );
-               $backlinksUrl = $wlh->getLocalUrl( 'hidelinks=1&hidetrans=1&target=' . urlencode( $this->mTitle->getFullText() ) );
                $r = '<ul id="filetoc">
                        <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>
                        <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>
-                       <li><a href="' . htmlspecialchars( $backlinksUrl ) . '">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
+                       <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
                        ($metadata ? ' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
                </ul>';
                return $r;
@@ -494,6 +492,36 @@ EOT
 
        }
 
+       function imageLinks()
+       {
+               global $wgUser, $wgOut;
+
+               $wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
+
+               $dbr = wfGetDB( DB_SLAVE );
+               $page = $dbr->tableName( 'page' );
+               $imagelinks = $dbr->tableName( 'imagelinks' );
+
+               $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" .
+                 $dbr->addQuotes( $this->mTitle->getDBkey() ) . " AND il_from=page_id";
+               $sql = $dbr->limitResult($sql, 500, 0);
+               $res = $dbr->query( $sql, "ImagePage::imageLinks" );
+
+               if ( 0 == $dbr->numRows( $res ) ) {
+                       $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" );
+                       return;
+               }
+               $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) .  "</p>\n<ul>" );
+
+               $sk = $wgUser->getSkin();
+               while ( $s = $dbr->fetchObject( $res ) ) {
+                       $name = Title::MakeTitle( $s->page_namespace, $s->page_title );
+                       $link = $sk->makeKnownLinkObj( $name, "" );
+                       $wgOut->addHTML( "<li>{$link}</li>\n" );
+               }
+               $wgOut->addHTML( "</ul>\n" );
+       }
+
        /**
         * Delete the file, or an earlier version of it
         */
index d51e13a..c1eb456 100644 (file)
@@ -51,7 +51,6 @@ class WhatLinksHerePage {
                $opts->add( 'hideredirs', false );
                $opts->add( 'hidetrans', false );
                $opts->add( 'hidelinks', false );
-               $opts->add( 'hideimages', false );
 
                $opts->fetchValuesFromRequest( $this->request );
                $opts->validateIntBounds( 'limit', 0, 5000 );
@@ -95,7 +94,6 @@ class WhatLinksHerePage {
                $hidelinks = $this->opts->getValue( 'hidelinks' );
                $hideredirs = $this->opts->getValue( 'hideredirs' );
                $hidetrans = $this->opts->getValue( 'hidetrans' );
-               $hideimages = $target->getNamespace() != NS_IMAGE || $this->opts->getValue( 'hideimages' );
 
                $fetchlinks = !$hidelinks || !$hideredirs;
 
@@ -117,10 +115,6 @@ class WhatLinksHerePage {
                        'tl_title' => $target->getDBkey(),
                );
 
-               $ilConds = array(
-                       'page_id=il_from',
-                       'il_to' => $target->getDBkey(),
-               );
 
                $namespace = $this->opts->getValue( 'namespace' );
                if ( is_int($namespace) ){
@@ -155,19 +149,13 @@ class WhatLinksHerePage {
                                $tlConds, __METHOD__, $options );
                }
 
-               if( !$hideimages ) {
-                       $options['ORDER BY'] = 'il_from';
-                       $ilRes = $dbr->select( array( 'imagelinks', 'page' ), $fields,
-                               $ilConds, __METHOD__, $options );
-               }
-
-               if( ( !$fetchlinks || !$dbr->numRows( $plRes ) ) && ( $hidetrans || !$dbr->numRows( $tlRes ) ) && ( $hideimages || !$dbr->numRows( $ilRes ) ) ) {
+               if( ( !$fetchlinks || !$dbr->numRows( $plRes ) ) && ( $hidetrans || !$dbr->numRows( $tlRes ) ) ) {
                        if ( 0 == $level ) {
                                $wgOut->addHTML( $this->whatlinkshereForm() );
                                $errMsg = is_int($namespace) ? 'nolinkshere-ns' : 'nolinkshere';
                                $wgOut->addWikiMsg( $errMsg, $this->target->getPrefixedText() );
                                // Show filters only if there are links
-                               if( $hidelinks || $hidetrans || $hideredirs || $hideimages )
+                               if( $hidelinks || $hidetrans || $hideredirs )
                                        $wgOut->addHTML( $this->getFilterPanel() );
                        }
                        return;
@@ -179,7 +167,6 @@ class WhatLinksHerePage {
                if( $fetchlinks ) {
                        while ( $row = $dbr->fetchObject( $plRes ) ) {
                                $row->is_template = 0;
-                               $row->is_image = 0;
                                $rows[$row->page_id] = $row;
                        }
                        $dbr->freeResult( $plRes );
@@ -188,19 +175,10 @@ class WhatLinksHerePage {
                if( !$hidetrans ) {
                        while ( $row = $dbr->fetchObject( $tlRes ) ) {
                                $row->is_template = 1;
-                               $row->is_image = 0;
                                $rows[$row->page_id] = $row;
                        }
                        $dbr->freeResult( $tlRes );
                }
-               if( !$hideimages ) {
-                       while ( $row = $dbr->fetchObject( $ilRes ) ) {
-                               $row->is_template = 0;
-                               $row->is_image = 1;
-                               $rows[$row->page_id] = $row;
-                       }
-                       $dbr->freeResult( $ilRes );
-               }
 
                // Sort by key and then change the keys to 0-based indices
                ksort( $rows );
@@ -259,7 +237,7 @@ class WhatLinksHerePage {
                static $msgcache = null;
                if ( $msgcache === null ) {
                        static $msgs = array( 'isredirect', 'istemplate', 'semicolon-separator',
-                               'whatlinkshere-links', 'isimage' );
+                               'whatlinkshere-links' );
                        $msgcache = array();
                        foreach ( $msgs as $msg ) {
                                $msgcache[$msg] = wfMsgHtml( $msg );
@@ -276,8 +254,6 @@ class WhatLinksHerePage {
                        $props[] = $msgcache['isredirect'];
                if ( $row->is_template )
                        $props[] = $msgcache['istemplate'];
-               if( $row->is_image )
-                       $props[] = $msgcache['isimage'];
 
                if ( count( $props ) ) {
                        $propsText = '(' . implode( $msgcache['semicolon-separator'], $props ) . ')';
@@ -390,10 +366,7 @@ class WhatLinksHerePage {
                unset($changed['target']); // Already in the request title
 
                $links = array();
-               $types = array( 'hidetrans', 'hidelinks', 'hideredirs' );
-               if( $this->target->getNamespace() == NS_IMAGE )
-                       $types[] = 'hideimages';
-               foreach( $types as $type ) {
+               foreach( array( 'hidetrans', 'hidelinks', 'hideredirs' ) as $type ) {
                        $chosen = $this->opts->getValue( $type );
                        $msg = wfMsgHtml( "whatlinkshere-{$type}", $chosen ? $show : $hide );
                        $overrides = array( $type => !$chosen );
index 71bd562..4fb40a0 100644 (file)
@@ -2422,8 +2422,8 @@ Do you want to delete it to make way for the move?',
 cannot move a page over itself.',
 'immobile_namespace'      => 'Source or destination title is of a special type;
 cannot move pages from and into that namespace.',
-'imagenocrossnamespace'   => 'Cannot move file to non-file namespace',
-'imagetypemismatch'       => 'The new file extension does not match its type',
+'imagenocrossnamespace'   => "Cannot move file to non-file namespace",
+'imagetypemismatch'       => "The new file extension does not match its type",
 
 # Export
 'export'            => 'Export pages',
index 24b214a..facc519 100644 (file)
@@ -1518,11 +1518,9 @@ $wgMessageStructure = array(
                'nolinkshere-ns',
                'isredirect',
                'istemplate',
-               'isimage',
                'whatlinkshere-prev',
                'whatlinkshere-next',
                'whatlinkshere-links',
-               'whatlinkshere-hideimages',
                'whatlinkshere-hideredirs',
                'whatlinkshere-hidetrans',
                'whatlinkshere-hidelinks',