$this->img = new Image( $this->mTitle );
if( $this->mTitle->getNamespace() == NS_IMAGE ) {
- if ( $this->img->exists() ) $this->showEXIFdata();
+ if ( $this->img->exists() ) {
+ $this->showTOC();
+ }
$this->openShowImage();
# No need to display noarticletext, we use our own message, output in openShowImage()
$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= '<div class="imagepagetoc"><table id="toc" border="0"><tr><td valign="top"><b>'.wfMsg( 'toc' ).'</b><br />';
+ $r .= '<a href="#toc">' . $wgLang->getNStext( NS_IMAGE ) . '</a href> - ';
+ $r .= '<a href="#imghistory">' . wfMsg( 'imghistory' ) . '</a href> - ';
+ $r .= '<a href="#imagelinks">' . wfMsg( 'imagelinks' ) . '</a href>';
+ if ( $wgShowEXIF ) {
+ $r .= ' - <a href="#showexif">' . wfMsg( 'exifdata' ) . '</a>';
+ }
+
+
+ $wgOut->addHTML( $r . '</td></tr></table></div>' );
+
+ }
- function showEXIFdata()
- {
- global $wgOut , $wgShowEXIF ;
- if ( ! $wgShowEXIF ) return ;
+ function showEXIFdata() {
+ global $wgOut, $wgShowEXIF;
+ if ( ! $wgShowEXIF ) return;
# Get the EXIF data
- $exif = $this->img->getExifData () ;
- if ( count ( $exif ) == 0 ) return ; # No EXIF data
+ $exif = $this->img->getExifData();
+ if ( count ( $exif ) == 0 ) return; # No EXIF data available
# Create the table
- $r = "<table border='1' cellspacing='0' cellpadding='0' align='right'>" ;
- $r .= "<caption>EXIF data</caption>" ;
- foreach ( $exif AS $k => $v ) {
- $r .= "<tr>" ;
- $v = str_replace ( "\0" , "" , $v ) ;
- $r .= "<th><small>" . htmlspecialchars ( $k ) . "</small></th>" ;
- $r .= "<td><small>" . htmlspecialchars ( $v ) . "</small></td>" ;
- $r .= "</tr>" ;
+ $r = '<h2 id="exifdata">'. wfMsg( 'exifdata' ) . "</h2>\n";
+ $r .= "<table class=\"exif\">\n" ;
+ $n = 0;
+ foreach ( $exif as $k => $v ) {
+ if ( $n % 2 == 0 ) {
+ $r .= '<tr>';
+ }
+ $r .= "<th>$k</th>\n";
+ $r .= '<td>' . htmlspecialchars($v) . "</td>\n";
+ if ( $n % 2 == 1 ) {
+ $r .= "</tr>\n";
+ } else {
+ $r .= "<td style=\"background: white;\"> </td>\n";
}
- $r .= "</table>" ;
- $wgOut->addHTML ( $r ) ;
+ $n++;
+ }
+ if ( $n % 2 == 1 ) {
+ $r .= "<td></td><td></td></tr>\n";
}
+ $wgOut->addHTML( $r . "</table>\n" );
+ }
+
function openShowImage()
{
global $wgOut, $wgUser, $wgImageLimits, $wgRequest,
# 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 );
}
- function uploadNewVersionLink() {
- global $wgOut;
- $wgOut->addWikiText( wfMsg( 'uploadnewversion', $this->getUploadUrl() ) );
- }
-
- function externalEditorLink()
+ function uploadLinksBox()
{
global $wgUser,$wgOut;
$sk = $wgUser->getSkin();
- $wgOut->addHTML( '<div class="editExternally">' );
+ $wgOut->addHTML( '<br /><ul><li>' );
+ $wgOut->addWikiText( '<div>'. wfMsg( 'uploadnewversion', $this->getUploadUrl() ) .'</div>' );
+ $wgOut->addHTML( '</li><li>' );
$wgOut->addHTML( $sk->makeKnownLinkObj( $this->mTitle,
- wfMsg( 'edit-externally' ),
- "action=edit&externaledit=true&mode=file" ) );
- $wgOut->addWikiText( '<div class="editExternallyHelp">' .
- wfMsg('edit-externally-help') . '</div>' );
- $wgOut->addHTML( '</div><br clear="both" />' );
+ wfMsg( 'edit-externally' ), "action=edit&externaledit=true&mode=file" ) );
+ $wgOut->addWikiText( '<div>' . wfMsg('edit-externally-help') . '</div>' );
+ $wgOut->addHTML( '</li></ul>' );
}
function closeShowImage()
*/
function imageHistory()
{
- global $wgUser, $wgOut;
+ global $wgUser, $wgOut, $wgUseExternalEditor;
$sk = $wgUser->getSkin();
$s .= $list->endImageHistoryList();
} else { $s=''; }
$wgOut->addHTML( $s );
+
+ if ( $wgUseExternalEditor ) {
+ $this->uploadLinksBox();
+ }
+
}
function imageLinks()
{
global $wgUser, $wgOut;
- $wgOut->addHTML( '<h2>' . wfMsg( 'imagelinks' ) . "</h2>\n" );
+ $wgOut->addHTML( '<h2 id="imagelinks">' . wfMsg( 'imagelinks' ) . "</h2>\n" );
$dbr =& wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
}
function beginImageHistoryList() {
- $s = "\n<h2>" . wfMsg( 'imghistory' ) . "</h2>\n" .
+ $s = "\n<h2 id=\"imghistory\">" . wfMsg( 'imghistory' ) . "</h2>\n" .
"<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
return $s;
}