Mix back some of the changes from previous check-in with additional fixes
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 30 Apr 2005 02:37:16 +0000 (02:37 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 30 Apr 2005 02:37:16 +0000 (02:37 +0000)
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

includes/ImagePage.php
skins/monobook/main.css

index ebbc971..6cd7b27 100644 (file)
@@ -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;\">&nbsp;&nbsp;</td>\n";
+                               $r .= "<td class='spacer'>&nbsp;</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();
                }
 
index 0dbb0bd..aa936bc 100644 (file)
@@ -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;