Style fix
[lhc/web/wiklou.git] / includes / ImagePage.php
index 7d45bcd..6f1b1a1 100644 (file)
@@ -153,7 +153,7 @@ 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() ) ) );
@@ -383,6 +383,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();
@@ -510,6 +513,25 @@ EOT
                                }
                        }
 
+                       // Add cannot animate thumbnail warning
+                       if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) {
+                               // Include the extension so wiki admins can
+                               // customize it on a per file-type basis
+                               // (aka say things like use format X instead).
+                               // additionally have a specific message for
+                               // file-no-thumb-animation-gif
+                               $ext = $this->displayImg->getExtension();
+                               $noAnimMesg = wfMessageFallback(
+                                       'file-no-thumb-animation-' . $ext,
+                                       'file-no-thumb-animation'
+                               )->plain();
+
+                               $out->addWikiText( <<<EOT
+<div class="mw-noanimatethumb">{$noAnimMesg}</div>
+EOT
+                               );
+                       }
+
                        if ( !$this->displayImg->isLocal() ) {
                                $this->printSharedImageText();
                        }
@@ -635,12 +657,15 @@ EOT
                }
 
                $out = $this->getContext()->getOutput();
-               $out->addHTML( "<br /><ul>\n" );
+               $out->addHTML( "<ul>\n" );
 
                # "Upload a new version of this file" link
-               if ( UploadBase::userCanReUpload( $this->getContext()->getUser(), $this->mPage->getFile()->name ) ) {
+               $canUpload = $this->getTitle()->userCan( 'upload', $this->getContext()->getUser() );
+               if ( $canUpload && UploadBase::userCanReUpload( $this->getContext()->getUser(), $this->mPage->getFile()->name ) ) {
                        $ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMessage( 'uploadnewversion-linktext' )->text() );
                        $out->addHTML( "<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n" );
+               } else {
+                       $out->addHTML( "<li id=\"mw-imagepage-upload-disallowed\">" . $this->getContext()->msg( 'upload-disallowed-here' )->escaped() . "</li>\n" );
                }
 
                # External editing link