$text = $pair[1];
# Give extensions a chance to select the file revision for us
- $time = false;
- wfRunHooks( 'BeforeGalleryFindFile', array( &$this, &$nt, &$time ) );
+ $time = $descQuery = false;
+ wfRunHooks( 'BeforeGalleryFindFile', array( &$this, &$nt, &$time, &$descQuery ) );
$img = wfFindFile( $nt, $time );
# handlers since they may emit block-level elements as opposed to simple <img> tags.
# ref http://css-discuss.incutio.com/?page=CenteringBlockElement
. '<div style="margin-left: auto; margin-right: auto; width: ' .$this->mWidths.'px;">'
- . $thumb->toHtml( array( 'desc-link' => true ) ) . '</div></div>';
+ . $thumb->toHtml( array( 'desc-link' => true, 'desc-query' => $descQuery ) ) . '</div></div>';
// Call parser transform hook
if ( $this->mParser && $img->getHandler() ) {
function __construct( $title, $time = false ) {
parent::__construct( $title );
+
+ global $wgRequest;
+ $time = $time ? $time : $wgRequest->getVal( 'filetimestamp' );
+
$this->img = wfFindFile( $this->mTitle, $time );
if ( !$this->img ) {
$this->img = wfLocalFile( $this->mTitle );
$sk = $wgUser->getSkin();
if ( $this->img->exists() ) {
- $list = new ImageHistoryList( $sk, $this->current );
+ $list = new ImageHistoryList( $sk, $this->current, $this->img );
$file = $this->current;
$dims = $file->getDimensionsString();
$s = $list->beginImageHistoryList();
protected $img, $skin, $title, $repo;
- public function __construct( $skin, $img ) {
+ public function __construct( $skin, $curimg, $img ) {
$this->skin = $skin;
+ $this->current = $curimg;
$this->img = $img;
$this->title = $img->getTitle();
}
. $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
. Xml::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
. '<tr><td></td>'
- . ( $this->img->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? '<td></td>' : '' )
+ . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? '<td></td>' : '' )
. '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
. '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
. '<th>' . wfMsgHtml( 'filehist-user' ) . '</th>'
$dims = $file->getDimensionsString();
$sha1 = $file->getSha1();
- $local = $this->img->isLocal();
- $row = $css = '';
+ $local = $this->current->isLocal();
+ $row = $css = $selected = '';
// Deletion link
if( $local && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ) {
$row .= '</td>';
// Date/time and image link
- $row .= "<td style='white-space: nowrap;'>";
+ if( $file->getTimestamp() === $this->img->getTimestamp() ) {
+ $selected = "class='filehistory-selected'";
+ }
+ $row .= "<td $selected style='white-space: nowrap;'>";
if( !$file->userCan(File::DELETED_FILE) ) {
# Don't link to unviewable files
$row .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
$revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
# Make a link to review the image
$url = $this->skin->makeKnownLinkObj( $revdel, $wgLang->timeAndDate( $timestamp, true ),
- "target=".$wgTitle->getPrefixedText()."&file=$sha1.".$this->img->getExtension() );
+ "target=".$wgTitle->getPrefixedText()."&file=$sha1.".$this->current->getExtension() );
$row .= '<span class="history-deleted">'.$url.'</span>';
} else {
- $url = $iscur ? $this->img->getUrl() : $this->img->getArchiveUrl( $img );
+ $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
$row .= Xml::element( 'a', array( 'href' => $url ), $wgLang->timeAndDate( $timestamp, true ) );
}
$row .= '</td>';
wfRunHooks( 'ImagePageFileHistoryLine', array( &$file, &$row, &$css ) );
- $tagCSS = $css ? " class='$css'" : "";
-
- return "<tr{$tagCSS}>{$row}</tr>\n";
+ $trCSS = $css ? " class='$css'" : "";
+
+ return "<tr{$trCSS}>{$row}</tr>\n";
}
}
* @param array $handlerParams Associative array of media handler parameters, to be passed
* to transform(). Typical keys are "width" and "page".
* @param string $time, timestamp of the file, set as false for current
+ * @param string $query, query params for desc url
* @return string HTML for an image, with links, wrappers, etc.
*/
- function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false ) {
+ function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "" ) {
$res = null;
if( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$this, &$title,
&$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
if ( $fp['align'] == '' ) {
$fp['align'] = $wgContLang->isRTL() ? 'left' : 'right';
}
- return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp, $time ).$postfix;
+ return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp, $time, $query ).$postfix;
}
if ( $file && isset( $fp['frameless'] ) ) {
} else {
$s = $thumb->toHtml( array(
'desc-link' => true,
+ 'desc-query' => $query,
'alt' => $fp['alt'],
'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false ,
'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false ) );
return $this->makeThumbLink2( $title, $file, $frameParams, $params );
}
- function makeThumbLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false ) {
+ function makeThumbLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "" ) {
global $wgStylePath, $wgContLang;
$exists = $file && $file->exists();
}
}
- $query = $page ? 'page=' . urlencode( $page ) : '';
+ if( $page ) {
+ $query = $query ? '&page=' . urlencode( $page ) : 'page=' . urlencode( $page );
+ }
$url = $title->getLocalURL( $query );
$more = htmlspecialchars( wfMsg( 'thumbnail-more' ) );
$s .= $thumb->toHtml( array(
'alt' => $fp['alt'],
'img-class' => 'thumbimage',
- 'desc-link' => true ) );
+ 'desc-link' => true,
+ 'desc-query' => $query ) );
if ( isset( $fp['framed'] ) ) {
$zoomicon="";
} else {
}
}
- function getDescLinkAttribs( $alt = false ) {
+ function getDescLinkAttribs( $alt = false, $params = '' ) {
$query = $this->page ? ( 'page=' . urlencode( $this->page ) ) : '';
+ if( $params ) {
+ $query .= $query ? '&'.$params : $params;
+ }
$title = $this->file->getTitle();
if ( strval( $alt ) === '' ) {
$alt = $title->getText();
* file-link Boolean, show a file download link
* valign vertical-align property, if the output is an inline element
* img-class Class applied to the <img> tag, if there is such a tag
+ * desc-query String, description link query params
*
* For images, desc-link and file-link are implemented as a click-through. For
* sounds and videos, they may be displayed in other ways.
}
$alt = empty( $options['alt'] ) ? '' : $options['alt'];
+ $query = empty($options['desc-query']) ? '' : $options['desc-query'];
if ( !empty( $options['desc-link'] ) ) {
- $linkAttribs = $this->getDescLinkAttribs( $alt );
+ $linkAttribs = $this->getDescLinkAttribs( $alt, $query );
} elseif ( !empty( $options['file-link'] ) ) {
$linkAttribs = array( 'href' => $this->file->getURL() );
} else {
$sk = $this->mOptions->getSkin();
# Give extensions a chance to select the file revision for us
- $skip = $time = false;
- wfRunHooks( 'BeforeParserMakeImageLinkObj', array( &$this, &$title, &$skip, &$time ) );
+ $skip = $time = $descQuery = false;
+ wfRunHooks( 'BeforeParserMakeImageLinkObj', array( &$this, &$title, &$skip, &$time, &$descQuery ) );
if ( $skip ) {
return $sk->makeLinkObj( $title );
wfRunHooks( 'ParserMakeImageParams', array( $title, $file, &$params ) );
# Linker does the rest
- $ret = $sk->makeImageLink2( $title, $file, $params['frame'], $params['handler'], $time );
+ $ret = $sk->makeImageLink2( $title, $file, $params['frame'], $params['handler'], $time, $descQuery );
# Give the handler a chance to modify the parser object
if ( $handler ) {
white-space:nowrap;
}
+table.filehistory td.filehistory-selected {
+ font-weight: bold;
+}
+
/*
* rev_deleted stuff
*/