Merge "[JobQueue] Added support for approximate FIFO job queues."
[lhc/web/wiklou.git] / includes / ImagePage.php
index fdc2061..316e1c9 100644 (file)
@@ -94,47 +94,10 @@ class ImagePage extends Article {
        /**
         * Handler for action=render
         * Include body text only; none of the image extras
-        * However, also include the shared description text
-        * so that cascading ForeignAPIRepo's work.
-        *
-        * @note This uses a div with the class "mw-shared-image-desc"
-        *    as opposed to the id "mw-shared-image-desc" since the text
-        *    from here may be cascadingly transcluded to other shared
-        *    repos, and we want all ids to be unique. On normal
-        *    view, the outermost shared description will still have
-        *    the id.
-        *
-        * This also differs from normal view in that "shareddescriptionfollows"
-        * message is not shown. I was not sure if it was appropriate to
-        * add that message here.
         */
        public function render() {
-               $out = $this->getContext()->getOutput();
-                $this->loadFile();
-
-                $descText = $this->mPage->getFile()->getDescriptionText();
-
-               $out->setArticleBodyOnly( true );
-
-               if ( !$descText ) {
-                       // If no description text, just do standard action=render
-                       parent::view();
-               } else {
-                       if ( $this->mPage->getID() !== 0 ) {
-                               // Local description exists. We need to output both
-                               parent::view();
-                               $out->addHTML( '<div class="mw-shared-image-desc">' . $descText . "</div>\n" );
-                       } else {
-                               // We don't want to output both a "noarticletext" message and the shared
-                               // description, so don't call parent::view().
-                               $out->addHTML( '<div class="mw-shared-image-desc">' . $descText . "</div>\n" );
-                               // Since we did not call parent::view(), have to call some methods it
-                               // normally takes care of. (Not that it matters much since skin not displayed)
-                               $out->setArticleFlag( true );
-                               $out->setPageTitle( $this->getTitle()->getPrefixedText() );
-                               $this->mPage->doViewUpdates( $this->getContext()->getUser() );
-                       }
-               }
+               $this->getContext()->getOutput()->setArticleBodyOnly( true );
+               parent::view();
        }
 
        public function view() {
@@ -190,11 +153,13 @@ class ImagePage extends Article {
                if ( $this->mPage->getID() ) {
                        # NS_FILE is in the user language, but this section (the actual wikitext)
                        # should be in page content language
-                       $pageLang = $this->getTitle()->getPageLanguage();
+                       $pageLang = $this->getTitle()->getPageViewLanguage();
                        $out->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content',
                                'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(),
                                'class' => 'mw-content-'.$pageLang->getDir() ) ) );
+
                        parent::view();
+
                        $out->addHTML( Xml::closeElement( 'div' ) );
                } else {
                        # Just need to set the right headers
@@ -209,7 +174,7 @@ class ImagePage extends Article {
                        if ( !$fol->isDisabled() ) {
                                $out->addWikiText( $fol->plain() );
                        }
-                       $out->addHTML( '<div id="shared-image-desc" class="mw-shared-image-desc">' . $this->mExtraDescription . "</div>\n" );
+                       $out->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n" );
                }
 
                $this->closeShowImage();
@@ -309,18 +274,18 @@ class ImagePage extends Article {
        }
 
        /**
-        * Overloading Article's getContent method.
+        * Overloading Article's getContentObject method.
         *
         * Omit noarticletext if sharedupload; text will be fetched from the
         * shared upload server if possible.
         * @return string
         */
-       public function getContent() {
+       public function getContentObject() {
                $this->loadFile();
                if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getID() ) {
-                       return '';
+                       return null;
                }
-               return parent::getContent();
+               return parent::getContentObject();
        }
 
        protected function openShowImage() {
@@ -420,6 +385,9 @@ class ImagePage extends Article {
                                        # Some sort of audio file that doesn't have dimensions
                                        # Don't output a no hi res message for such a file
                                        $msgsmall = '';
+                               } elseif ( $this->displayImg->isVectorized() ) {
+                                       # For vectorized images, full size is just the frame size
+                                       $msgsmall = '';
                                } else {
                                        # Image is small enough to show full size on image page
                                        $msgsmall = wfMessage( 'file-nohires' )->parse();