From ffbd771fdf889b387e1fbc030a8f0db126a21000 Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Fri, 29 Apr 2005 19:45:49 +0000 Subject: [PATCH] Unclutter ImagePage. Move EXIF data to the end of the page. Move image upload links to image revision section --- includes/ImagePage.php | 99 ++++++++++++++++++++++++++++------------- skins/monobook/main.css | 5 ++- 2 files changed, 73 insertions(+), 31 deletions(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 6abf063e85..9c7fb5713c 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -25,8 +25,10 @@ class ImagePage extends Article { $this->img = new Image( $this->mTitle ); if( $this->mTitle->getNamespace() == NS_IMAGE ) { + if ( $this->img->exists() ) { + $this->showTOC(); + } $this->openShowImage(); - if ( $this->img->exists() ) $this->showEXIFdata(); # No need to display noarticletext, we use our own message, output in openShowImage() if ( $this->getID() ) { @@ -40,19 +42,30 @@ class ImagePage extends Article { $this->viewUpdates(); } - if ( $this->img->exists() ) { - $this->uploadNewVersionLink(); - if ( $wgUseExternalEditor && $this->img->exists() ) { - $this->externalEditorLink(); - } - } $this->closeShowImage(); $this->imageHistory(); $this->imageLinks(); + if ( $this->img->exists() ) $this->showEXIFdata(); } else { Article::view(); } } + + 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 . '
' ); + + } function showEXIFdata() { global $wgOut, $wgShowEXIF; @@ -63,13 +76,27 @@ class ImagePage extends Article { if ( count ( $exif ) == 0 ) return; # No EXIF data available # Create the table - $r = "{| class=exif\n" ; - $r .= '|+ ' . wfMsg( 'exifdata' ) . "\n|-\n" ; + $r = '

'. wfMsg( 'exifdata' ) . "

\n"; + $r .= "\n" ; + $n = 0; foreach ( $exif as $k => $v ) { - $r .= "! $k\n"; - $r .= '| ' . htmlspecialchars($v) . "\n|-\n"; + if ( $n % 2 == 0 ) { + $r .= ''; + } + $r .= "\n"; + $r .= '\n"; + if ( $n % 2 == 1 ) { + $r .= "\n"; + } else { + $r .= "\n"; + } + $n++; + } + if ( $n % 2 == 1 ) { + $r .= "\n"; } - $wgOut->addWikiText( substr($r, 0, -3) . '|}' ); + + $wgOut->addHTML( $r . "
$k' . htmlspecialchars($v) . "
  
\n" ); } function openShowImage() @@ -99,6 +126,7 @@ class ImagePage extends Article { # image $width = $this->img->getWidth(); $height = $this->img->getHeight(); + # "Download high res version" link below the image $msg = wfMsg('showbigimage', $width, $height, intval( $this->img->getSize()/1024 ) ); if ( $width > $maxWidth ) { $height = floor( $height * $maxWidth / $width ); @@ -151,24 +179,30 @@ class ImagePage extends Article { } - function uploadNewVersionLink() { - global $wgOut; - $wgOut->addHTML("
"); - $wgOut->addWikiText( wfMsg( 'uploadnewversion', $this->getUploadUrl() ) ); - $wgOut->addHTML("

"); - } - - function externalEditorLink() + function uploadLinksBox() { global $wgUser,$wgOut; $sk = $wgUser->getSkin(); - $wgOut->addHTML( '
' ); - $wgOut->addHTML( $sk->makeKnownLinkObj( $this->mTitle, - wfMsg( 'edit-externally' ), - "action=edit&externaledit=true&mode=file" ) ); - $wgOut->addWikiText( '
' . - wfMsg('edit-externally-help') . '
' ); - $wgOut->addHTML( '

' ); + if (0) { + $wgOut->addHTML( '
' ); + $wgOut->addWikiText( '
'. wfMsg( 'uploadnewversion', $this->getUploadUrl() ) .'
' ); + $wgOut->addHTML( '
' ); + $wgOut->addHTML( $sk->makeKnownLinkObj( $this->mTitle, + wfMsg( 'edit-externally' ), + "action=edit&externaledit=true&mode=file" ) ); + $wgOut->addWikiText( '
' . + wfMsg('edit-externally-help') . '
' ); + $wgOut->addHTML( '

' ); + } else if (0) { + $wgOut->addHTML( '
' ); + } else { + } } function closeShowImage() @@ -183,7 +217,7 @@ class ImagePage extends Article { */ function imageHistory() { - global $wgUser, $wgOut; + global $wgUser, $wgOut, $wgUseExternalEditor; $sk = $wgUser->getSkin(); @@ -204,13 +238,18 @@ class ImagePage extends Article { $s .= $list->endImageHistoryList(); } else { $s=''; } $wgOut->addHTML( $s ); + + if ( $wgUseExternalEditor ) { + $this->uploadLinksBox(); + } + } function imageLinks() { global $wgUser, $wgOut; - $wgOut->addHTML( '

' . wfMsg( 'imagelinks' ) . "

\n" ); + $wgOut->addHTML( '\n" ); $dbr =& wfGetDB( DB_SLAVE ); $page = $dbr->tableName( 'page' ); @@ -485,7 +524,7 @@ class ImageHistoryList { } function beginImageHistoryList() { - $s = "\n

" . wfMsg( 'imghistory' ) . "

\n" . + $s = "\n

" . wfMsg( 'imghistory' ) . "

\n" . "

" . wfMsg( 'imghistlegend' ) . "

\n".'