$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() ) {
$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();
}
function showTOC() {
global $wgOut, $wgShowEXIF, $wgLang;
- $r = '<ul id="imagetoc">
- <li><a href="#imagetoc">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>
- <li><a href="#imghistory">' . wfMsg( 'imghistory' ) . '</a></li>
- <li><a href="#imagelinks">' . wfMsg( 'imagelinks' ) . '</a></li>' .
- ($wgShowEXIF ? '<li><a href="#metadata">' . wfMsg( 'metadata' ) . '</a></li>' : '') .
- '</ul>';
- $wgOut->addHTML( $r );
+ $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>' );
}
# Get the EXIF data
$exif = $this->img->getExifData();
- if ( !count($exif) )
- return; # No EXIF data available
+ if ( count ( $exif ) == 0 ) return; # No EXIF data available
# Create the table
- $r = "<div id='metadata'>\n{| class=metadata\n"; # For those wondering whether the div is redundant, then no, it isn't -ævar
- $r .= '|+ ' . wfMsg( 'metadata' ) . "\n|-\n" ;
+ $r = '<h2 id="exifdata">'. wfMsg( 'exifdata' ) . "</h2>\n";
+ $r .= "<table class=\"exif\">\n" ;
+ $n = 0;
foreach ( $exif as $k => $v ) {
- $r .= '! ' . wfMsg( 'exif-' . strtolower($k) ) . "\n";
- $r .= "| $v\n";
- $r .= "|-\n";
+ 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";
+ }
+ $n++;
}
- $wgOut->addWikiText( substr($r, 0, -3) . "|}\n</div>" );
+ if ( $n % 2 == 1 ) {
+ $r .= "<td></td><td></td></tr>\n";
+ }
+
+ $wgOut->addHTML( $r . "</table>\n" );
}
function openShowImage()
{
global $wgUser,$wgOut;
$sk = $wgUser->getSkin();
- $wgOut->addHTML( '<ul><li>' );
+ $wgOut->addHTML( '<br /><ul><li>' );
$wgOut->addWikiText( '<div>'. wfMsg( 'uploadnewversion', $this->getUploadUrl() ) .'</div>' );
$wgOut->addHTML( '</li><li>' );
$wgOut->addHTML( $sk->makeKnownLinkObj( $this->mTitle,
$list->imageHistoryLine( true, $line->img_timestamp,
$this->mTitle->getDBkey(), $line->img_user,
$line->img_user_text, $line->img_size, $line->img_description );
+
while ( $line = $this->img->nextHistoryLine() ) {
$s .= $list->imageHistoryLine( false, $line->img_timestamp,
$line->oi_archive_name, $line->img_user,
$s .= $list->endImageHistoryList();
} else { $s=''; }
$wgOut->addHTML( $s );
+
+ if ( $wgUseExternalEditor ) {
+ $this->uploadLinksBox();
+ }
+
}
function imageLinks()
font-style: italic;
}
-.toggle {
- margin-left: 2em;
- text-indent: -2em;
-}
-
/* Classes for EXIF data display */
-/* <toc> */
-ul#imagetoc {
- text-align: center;
- border: 1px solid #aaaaaa;
+table.exif {
background-color: #f9f9f9;
- padding: 5px;
- font-size: 95%;
- margin-bottom: 0.5em;
- margin-left: 0;
- margin-right: 0;
-}
-
-#imagetoc li {
- display: inline;
- list-style-type: none;
- padding-right: 2em;
+ margin-left: 0.5em;
}
-/* </toc> */
-#metadata {
- float: right;
- max-width: 25%;
-}
+table.exif caption { font-weight: bold; }
+table.exif th { font-weight: normal; }
+table.exif td { padding: 0.1em; }
-table.metadata {
- background-color: #f9f9f9;
- margin-left: 0.5em;
- margin-bottom: 0.5em;
- font-size:80%;
- float: right;
+table.exif, table.exif td, table.exif th {
+ border: 1px solid #aaaaaa;
+ border-collapse: collapse;
}
-table.metadata caption { font-weight: bold; }
-table.metadata th {
- font-weight: normal;
-}
-table.metadata td {
- /*padding: 0.1em;*/
+.toggle {
+ margin-left: 2em;
+ text-indent: -2em;
}
-table.metadata, table.metadata td, table.metadata th {
- border: 1px solid #aaaaaa;
- border-collapse: collapse;
+div.imagepagetoc {
+ float: right;
+ margin-top: -4em;
}