From 9ad30a36b93370f5305abc226fe67cecf1d4e785 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sat, 30 Apr 2005 01:41:52 +0000 Subject: [PATCH] * Only display the uploadLinksBox() if the subject is a valid image * Converted showTOC to an unordered list (it's not tabular data) * Displaying the exifdata as a sidebar again (made some css tweaks to limit the width) --- includes/ImagePage.php | 66 ++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index ebbc971937..937c3194bd 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -25,10 +25,13 @@ class ImagePage extends Article { $this->img = new Image( $this->mTitle ); if( $this->mTitle->getNamespace() == NS_IMAGE ) { - if ( $this->img->exists() ) { + if ( $this->img->exists() ) $this->showTOC(); - } $this->openShowImage(); + $this->closeShowImage(); + if ( $this->img->exists() ) + $this->showEXIFdata(); + # No need to display noarticletext, we use our own message, output in openShowImage() if ( $this->getID() ) { @@ -42,10 +45,12 @@ class ImagePage extends Article { $this->viewUpdates(); } - $this->closeShowImage(); $this->imageHistory(); + # Exist check because we don't want to show this on pages where an image + # doesn't exist along with the noimage message, that would suck. -ævar + if ( $wgUseExternalEditor and $this->img->exists() ) + $this->uploadLinksBox(); $this->imageLinks(); - if ( $this->img->exists() ) $this->showEXIFdata(); } else { Article::view(); } @@ -54,16 +59,13 @@ class ImagePage extends Article { function showTOC() { global $wgOut, $wgShowEXIF, $wgLang; - $r= '
'.wfMsg( 'toc' ).'
'; - $r .= '' . $wgLang->getNStext( NS_IMAGE ) . ' - '; - $r .= '' . wfMsg( 'imghistory' ) . ' - '; - $r .= '' . wfMsg( 'imagelinks' ) . ''; - if ( $wgShowEXIF ) { - $r .= ' - ' . wfMsg( 'exifdata' ) . ''; - } - - - $wgOut->addHTML( $r . '
' ); + $r = ''; + $wgOut->addHTML( $r ); } @@ -73,30 +75,18 @@ class ImagePage extends Article { # Get the EXIF data $exif = $this->img->getExifData(); - if ( count ( $exif ) == 0 ) return; # No EXIF data available + if ( !count($exif) ) + return; # No EXIF data available # Create the table - $r = '

'. wfMsg( 'exifdata' ) . "

\n"; - $r .= "\n" ; - $n = 0; + $r = "
\n{| class=metadata\n"; # For those wondering whether the div is redundant, then no, it isn't -ævar + $r .= '|+ ' . wfMsg( 'metadata' ) . "\n|-\n" ; foreach ( $exif as $k => $v ) { - if ( $n % 2 == 0 ) { - $r .= '
'; - } - $r .= "\n"; - $r .= '\n"; - if ( $n % 2 == 1 ) { - $r .= "\n"; - } else { - $r .= "\n"; - } - $n++; + $r .= '! ' . wfMsg( 'exif-' . strtolower($k) ) . "\n"; + $r .= "| $v\n"; + $r .= "|-\n"; } - if ( $n % 2 == 1 ) { - $r .= "\n"; - } - - $wgOut->addHTML( $r . "
$k' . htmlspecialchars($v) . "
  
\n" ); + $wgOut->addWikiText( substr($r, 0, -3) . "|}\n" ); } function openShowImage() @@ -183,7 +173,7 @@ class ImagePage extends Article { { global $wgUser,$wgOut; $sk = $wgUser->getSkin(); - $wgOut->addHTML( '