Mix back some of the changes from previous check-in with additional fixes
and a cleaner version of the table. * Clean up EXIF display table: - use localized description of items - don't forget to HTML-encode the localized messages! - clean up the style a bit on the middle spacer - distinguish the header and data columns a little better * Don't show 'edit this image' link if no file exists
This commit is contained in:
parent
3073714101
commit
e4b96bc7ec
2 changed files with 37 additions and 16 deletions
|
|
@ -25,13 +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();
|
||||
|
||||
# No need to display noarticletext, we use our own message, output in openShowImage()
|
||||
if ( $this->getID() ) {
|
||||
if( $this->getID() ) {
|
||||
Article::view();
|
||||
} else {
|
||||
# Just need to set the right headers
|
||||
|
|
@ -45,7 +45,9 @@ class ImagePage extends Article {
|
|||
$this->closeShowImage();
|
||||
$this->imageHistory();
|
||||
$this->imageLinks();
|
||||
if ( $this->img->exists() ) $this->showEXIFdata();
|
||||
if( $this->img->exists() ) {
|
||||
$this->showEXIFdata();
|
||||
}
|
||||
} else {
|
||||
Article::view();
|
||||
}
|
||||
|
|
@ -69,31 +71,35 @@ class ImagePage extends Article {
|
|||
|
||||
function showEXIFdata() {
|
||||
global $wgOut, $wgShowEXIF;
|
||||
if ( ! $wgShowEXIF ) return;
|
||||
if( !$wgShowEXIF ) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Get the EXIF data
|
||||
$exif = $this->img->getExifData();
|
||||
if ( count ( $exif ) == 0 ) return; # No EXIF data available
|
||||
if( count ( $exif ) == 0 ) {
|
||||
return; # No EXIF data available
|
||||
}
|
||||
|
||||
# Create the table
|
||||
$r = '<h2 id="exifdata">'. wfMsg( 'exifdata' ) . "</h2>\n";
|
||||
$r = '<h2 id="exifdata">'. htmlspecialchars( wfMsg( 'exifdata' ) ) . "</h2>\n";
|
||||
$r .= "<table class=\"exif\">\n" ;
|
||||
$n = 0;
|
||||
foreach ( $exif as $k => $v ) {
|
||||
if ( $n % 2 == 0 ) {
|
||||
foreach( $exif as $k => $v ) {
|
||||
if( $n % 2 == 0 ) {
|
||||
$r .= '<tr>';
|
||||
}
|
||||
$r .= "<th>$k</th>\n";
|
||||
$r .= '<td>' . htmlspecialchars($v) . "</td>\n";
|
||||
$r .= '<th>' . wfMsg( 'exif-' . strtolower( $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 .= "<td class='spacer'> </td>\n";
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
if ( $n % 2 == 1 ) {
|
||||
$r .= "<td></td><td></td></tr>\n";
|
||||
$r .= "<th></th><td></td></tr>\n";
|
||||
}
|
||||
|
||||
$wgOut->addHTML( $r . "</table>\n" );
|
||||
|
|
@ -226,7 +232,9 @@ class ImagePage extends Article {
|
|||
} else { $s=''; }
|
||||
$wgOut->addHTML( $s );
|
||||
|
||||
if ( $wgUseExternalEditor ) {
|
||||
# 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 && $this->img->exists() ) {
|
||||
$this->uploadLinksBox();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,6 @@ li span.deleted {
|
|||
|
||||
/* Classes for EXIF data display */
|
||||
table.exif {
|
||||
background-color: #f9f9f9;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
|
|
@ -1119,10 +1118,24 @@ table.exif caption { font-weight: bold; }
|
|||
table.exif th { font-weight: normal; }
|
||||
table.exif td { padding: 0.1em; }
|
||||
|
||||
table.exif, table.exif td, table.exif th {
|
||||
border: 1px solid #aaaaaa;
|
||||
table.exif {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.exif td, table.exif th {
|
||||
border: 1px solid #aaaaaa;
|
||||
}
|
||||
table.exif th {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
table.exif td {
|
||||
background-color: #fcfcfc;
|
||||
}
|
||||
table.exif td.spacer {
|
||||
background: white;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
margin-left: 2em;
|
||||
|
|
|
|||
Loading…
Reference in a new issue