List of non-collapsing fields is in [[MediaWiki:Metadata-fields]].
Intro paragraph is in [[MediaWiki:Metadata-help]].
* (bug 4090) Fix diff links in Special:Recentchangeslinked
* (bug 4093) '&bot=1' in Special:Contributions now propagate to other links
* Fix display of old recentchanges records for page moves
+* (bug 2111) Collapsable exif metadata table, clean up display
=== Caveats ===
case 'Software':
$tags[$tag] = $this->msg( $tag, '', $val );
break;
+
+ case 'ExposureTime':
+ // Show the pretty fraction as well as decimal version
+ $tags[$tag] = wfMsg( 'exif-exposuretime-format',
+ $val, $this->formatNum( $val ) );
+ break;
+
+ case 'FNumber':
+ $tags[$tag] = wfMsg( 'exif-fnumber-format',
+ $this->formatNum( $val ) );
+ break;
+
+ case 'FocalLength':
+ $tags[$tag] = wfMsg( 'exif-focallength-format',
+ $this->formatNum( $val ) );
+ break;
+
default:
$tags[$tag] = $this->formatNum( $val );
break;
$wgOut->addHTML($this->showTOC($showmeta));
$this->openShowImage();
- if ($exif)
- $wgOut->addWikiText($this->makeMetadataTable($exif));
# No need to display noarticletext, we use our own message, output in openShowImage()
if( $this->getID() ) {
$this->closeShowImage();
$this->imageHistory();
$this->imageLinks();
+ if( $exif ) {
+ global $wgStylePath;
+ $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
+ $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
+ $wgOut->addHTML( "<h2 id=\"metadata\">" . wfMsgHtml( 'metadata' ) . "</h2>\n" );
+ $wgOut->addWikiText( $this->makeMetadataTable( $exif ) );
+ $wgOut->addHTML(
+ "<script type=\"text/javascript\" src=\"$wgStylePath/common/metadata.js\"></script>\n" .
+ "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '$expand', '$collapse');</script>\n" );
+ }
} else {
Article::view();
}
function showTOC( $metadata ) {
global $wgLang;
$r = '<ul id="filetoc">
- <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>' .
- ($metadata ? '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
+ <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>
<li><a href="#filehistory">' . wfMsgHtml( 'imghistory' ) . '</a></li>
- <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>
+ <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
+ ($metadata ? '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
</ul>';
return $r;
}
* @return string
*/
function makeMetadataTable( $exif ) {
- $r = "{| class=metadata align=right width=250px\n";
- $r .= '|+ id=metadata | '. wfMsg( 'metadata' ) . "\n";
+ $r = wfMsg( 'metadata-help' ) . "\n\n";
+ $r .= "{| id=mw_metadata class=mw_metadata\n";
+ $visibleFields = $this->visibleMetadataFields();
foreach( $exif as $k => $v ) {
$tag = strtolower( $k );
$msg = wfMsg( "exif-$tag" );
-
- $r .= "! class=$tag | $msg\n";
- $r .= "| class=$tag | $v\n";
- $r .= "|-\n";
+ $class = "exif-$tag";
+ if( !in_array( $tag, $visibleFields ) ) {
+ $class .= ' collapsable';
+ }
+ $r .= "|- class=\"$class\"\n";
+ $r .= "!| $msg\n";
+ $r .= "|| $v\n";
+ }
+ $r .= '|}';
+ return $r;
+ }
+
+ /**
+ * Get a list of EXIF metadata items which should be displayed when
+ * the metadata table is collapsed.
+ *
+ * @return array of strings
+ * @access private
+ */
+ function visibleMetadataFields() {
+ $fields = array();
+ $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) );
+ foreach( $lines as $line ) {
+ if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
+ $fields[] = $matches[1];
+ }
}
- return substr($r, 0, -3) . '|}';
+ return $fields;
}
/**
}
/** @return string path to the skin stylesheet */
- function getStylesheet() { return 'common/wikistandard.css'; }
+ function getStylesheet() { return 'common/wikistandard.css?1'; }
/** @return string skin name */
function getSkinName() {
# Metadata
'metadata' => 'Metadata',
+'metadata-help' => 'This file contains additional information, probably added from the digital camera or scanner used to create or digitize it. If the file has been modified from its original state, some details may not fully reflect the modified image.',
+'metadata-expand' => 'Show extended details',
+'metadata-collapse' => 'Hide extended details',
+'metadata-fields' => 'EXIF metadata fields listed in this message will
+be included on image page display when the metadata table
+is collapsed. Others will be hidden by default.
+* make
+* model
+* datetimeoriginal
+* exposuretime
+* fnumber
+* focallength',
# Exif tags
'exif-imagewidth' =>'Width',
'exif-subsectimeoriginal' =>'DateTimeOriginal subseconds',
'exif-subsectimedigitized' =>'DateTimeDigitized subseconds',
'exif-exposuretime' =>'Exposure time',
+'exif-exposuretime-format' => '$1 sec ($2)',
'exif-fnumber' =>'F Number',
+'exif-fnumber-format' =>'f/$1',
'exif-exposureprogram' =>'Exposure Program',
'exif-spectralsensitivity' =>'Spectral sensitivity',
'exif-isospeedratings' =>'ISO speed rating',
'exif-lightsource' =>'Light source',
'exif-flash' =>'Flash',
'exif-focallength' =>'Lens focal length',
+'exif-focallength-format' =>'$1 mm',
'exif-subjectarea' =>'Subject area',
'exif-flashenergy' =>'Flash energy',
'exif-spatialfrequencyresponse' =>'Spatial frequency response',
class SkinCologneBlue extends Skin {
function getStylesheet() {
- return "common/cologneblue.css";
+ return "common/cologneblue.css?1";
}
function getSkinName() {
return "cologneblue";
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>
<title><?php $this->text('pagetitle') ?></title>
- <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?1"; /*]]>*/</style>
+ <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?2"; /*]]>*/</style>
<link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
<!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
<!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
}
function getStylesheet() {
- return 'common/nostalgia.css';
+ return 'common/nostalgia.css?1';
}
function getSkinName() {
return "nostalgia";
#jump-to-nav {
display: none;
-}
\ No newline at end of file
+}
+
+table.collapsed tr.collapsable {
+ display: none;
+}
-@import url("common.css");
+@import url("common.css?1");
body { margin: 0px; padding: 0px; color: black; }
#specialform { display: inline; }
/* Classes for EXIF data display */
-table.exif {
+table.mw_metadata {
margin-left: 0.5em;
}
-table.exif caption { font-weight: bold; }
-table.exif th { font-weight: normal; }
-table.exif td { padding: 0.1em; }
+table.mw_metadata caption { font-weight: bold; }
+table.mw_metadata th { font-weight: normal; }
+table.mw_metadata td { padding: 0.1em; }
-table.exif {
+table.mw_metadata {
border: none;
border-collapse: collapse;
}
-table.exif td, table.exif th {
+table.mw_metadata td, table.mw_metadata th {
border: 1px solid #aaaaaa;
padding-left: 4px;
padding-right: 4px;
}
-table.exif th {
+table.mw_metadata th {
background-color: #f9f9f9;
}
-table.exif td {
+table.mw_metadata td {
background-color: #fcfcfc;
}
-table.exif td.spacer {
+table.mw_metadata td.spacer {
background: inherit;
border-top: none;
border-bottom: none;
}
+table.collapsed tr.collapsable {
+ display: none;
+}
.visualClear {
clear: both;
--- /dev/null
+// Exif metadata display for MediaWiki file uploads
+//
+// Add an expand/collapse link and collapse by default if set to
+// (with JS disabled, user will see all items)
+//
+// attachMetadataToggle("mw_metadata", "More...", "Fewer...");
+
+
+function attachMetadataToggle(tableId, showText, hideText) {
+ if (document.createTextNode) {
+ var box = document.getElementById(tableId);
+ if (!box)
+ return false;
+
+ var tbody = box.getElementsByTagName('tbody')[0];
+
+ var row = document.createElement('tr');
+
+ var col = document.createElement('td');
+ col.colSpan = 2;
+
+ var link = document.createElement('a');
+ link.href = '#';
+
+ link.onclick = function() {
+ if (box.className == 'mw_metadata collapsed') {
+ changeText(link, hideText);
+ box.className = 'mw_metadata expanded';
+ } else {
+ changeText(link, showText);
+ box.className = 'mw_metadata collapsed';
+ }
+ return false;
+ }
+
+ var text = document.createTextNode(hideText);
+
+ link.appendChild(text);
+ col.appendChild(link);
+ row.appendChild(col);
+ tbody.appendChild(row);
+
+ // And collapse!
+ link.onclick();
+
+ return true;
+ }
+ return false;
+}
-@import url("common.css");
+@import url("common.css?1");
body {
/* Background color is set separately on page type */
color: black;
-@import url("common.css");
+@import url("common.css?1");
#article { padding: 4px; }
#content { margin: 0; padding: 0; }
}
/* Classes for EXIF data display */
-table.metadata {
+table.mw_metadata {
font-size: 0.8em;
margin-left: 0.5em;
margin-bottom: 0.5em;
+ width: 300px;
}
-table.metadata caption {
+table.mw_metadata caption {
font-weight: bold;
}
-table.metadata th {
+table.mw_metadata th {
font-weight: normal;
}
-table.metadata td {
+table.mw_metadata td {
padding: 0.1em;
}
-table.metadata {
+table.mw_metadata {
border: none;
border-collapse: collapse;
}
-table.metadata td, table.metadata th {
+table.mw_metadata td, table.mw_metadata th {
text-align: center;
border: 1px solid #aaaaaa;
padding-left: 0.1em;
padding-right: 0.1em;
}
-table.metadata th {
+table.mw_metadata th {
background-color: #f9f9f9;
}
-table.metadata td {
+table.mw_metadata td {
background-color: #fcfcfc;
}
+table.collapsed tr.collapsable {
+ display: none;
+}
+
+
/* filetoc */
ul#filetoc {
text-align: center;
#jump-to-nav {
display: none;
-}
\ No newline at end of file
+}
+
+table.collapsed tr.collapsable {
+ display: none;
+}