X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FImagePage.php;h=fc172dab988c88ec58dd9d993e96d816f34bd251;hb=7a6ce6c2d879af2105985dc7d4c32b1a67e0289c;hp=3fbbcba26b85bf83a3700bc0e340a6d6886fbeb8;hpb=ea973a8a002554c871487e90a8a621a1cafc3433;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 3fbbcba26b..fc172dab98 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -157,7 +157,9 @@ class ImagePage extends Article { $out->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content', 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), 'class' => 'mw-content-'.$pageLang->getDir() ) ) ); + parent::view(); + $out->addHTML( Xml::closeElement( 'div' ) ); } else { # Just need to set the right headers @@ -268,20 +270,20 @@ class ImagePage extends Article { return $r; } - /** - * Overloading Article's getContent method. - * - * Omit noarticletext if sharedupload; text will be fetched from the - * shared upload server if possible. - * @return string - */ - public function getContent() { - $this->loadFile(); - if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getID() ) { - return ''; - } - return parent::getContent(); - } + /** + * Overloading Article's getContentObject method. + * + * Omit noarticletext if sharedupload; text will be fetched from the + * shared upload server if possible. + * @return string + */ + public function getContentObject() { + $this->loadFile(); + if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getID() ) { + return null; + } + return parent::getContentObject(); + } protected function openShowImage() { global $wgImageLimits, $wgEnableUploads, $wgSend404Code; @@ -346,18 +348,30 @@ class ImagePage extends Article { # Note that $height <= $maxHeight now, but might not be identical # because of rounding. } - $msgbig = wfMsgHtml( 'show-big-image' ); + $msgbig = wfMsgHtml( 'show-big-image' ); + if ( $this->displayImg->getRepo()->canTransformVia404() ) { + $thumbSizes = $wgImageLimits; + } else { + # Creating thumb links triggers thumbnail generation. + # Just generate the thumb for the current users prefs. + $thumbOption = $user->getOption( 'thumbsize' ); + $thumbSizes = array( isset( $wgImageLimits[$thumbOption] ) + ? $wgImageLimits[$thumbOption] + : $wgImageLimits[User::getDefaultOption( 'thumbsize' )] ); + } + # Generate thumbnails or thumbnail links as needed... $otherSizes = array(); - foreach ( $wgImageLimits as $size ) { - if ( $size[0] < $width_orig && $size[1] < $height_orig && - $size[0] != $width && $size[1] != $height ) { + foreach ( $thumbSizes as $size ) { + if ( $size[0] < $width_orig && $size[1] < $height_orig + && $size[0] != $width && $size[1] != $height ) + { $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] ); } } $msgsmall = wfMessage( 'show-big-image-preview' )-> rawParams( $this->makeSizeLink( $params, $width, $height ) )-> parse(); - if ( count( $otherSizes ) && $this->displayImg->getRepo()->canTransformVia404() ) { + if ( count( $otherSizes ) ) { $msgsmall .= ' ' . Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ), wfMessage( 'show-big-image-other' )->rawParams( $lang->pipeList( $otherSizes ) )-> @@ -978,7 +992,7 @@ class ImageHistoryList extends ContextSource { $img = $iscur ? $file->getName() : $file->getArchiveName(); $userId = $file->getUser( 'id' ); $userText = $file->getUser( 'text' ); - $description = $file->getDescription(); + $description = $file->getDescription( File::FOR_THIS_USER, $user ); $local = $this->current->isLocal(); $row = $selected = ''; @@ -1026,7 +1040,9 @@ class ImageHistoryList extends ContextSource { $row .= ''; if ( $iscur ) { $row .= wfMsgHtml( 'filehist-current' ); - } elseif ( $local && $user->isLoggedIn() && $this->title->userCan( 'edit' ) ) { + } elseif ( $local && $this->title->quickUserCan( 'edit' ) + && $this->title->quickUserCan( 'upload' ) + ) { if ( $file->isDeleted( File::DELETED_FILE ) ) { $row .= wfMsgHtml( 'filehist-revert' ); } else { @@ -1087,7 +1103,10 @@ class ImageHistoryList extends ContextSource { // Image dimensions + size $row .= ''; $row .= htmlspecialchars( $file->getDimensionsString() ); - $row .= ' (' . Linker::formatSize( $file->getSize() ) . ')'; + $row .= $this->getContext()->msg( 'word-separator' )->plain(); + $row .= ''; + $row .= $this->getContext()->msg( 'parentheses' )->rawParams( Linker::formatSize( $file->getSize() ) )->plain(); + $row .= ''; $row .= ''; // Uploading user