# Yet we return metadata about the target. Definitely an issue in the FileRepo
$this->imageRedirects();
$this->imageLinks();
+
+ # Allow extensions to add something after the image links
+ $html = '';
+ wfRunHooks( 'ImagePageAfterImageLinks', array( $this, &$html ) );
+ if ( $html)
+ $wgOut->addHTML( $html );
if( $showmeta ) {
global $wgStylePath, $wgStyleVersion;
* @return string
*/
protected function showTOC( $metadata ) {
- global $wgLang;
- $r = '<ul id="filetoc">
- <li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>
- <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>
- <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . "</a></li>\n" .
- ($metadata ? ' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . "
- </ul>\n";
- return $r;
+ $r = array(
+ '<li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>',
+ '<li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>',
+ '<li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>',
+ );
+ if ( $metadata ) {
+ $r[] = '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>';
+ }
+
+ wfRunHooks( 'ImagePageShowTOC', array( $this, &$r ) );
+
+ return '<ul id="filetoc">' . implode( "\n", $r ) . '</ul>';
}
/**
$linkAttribs = array( 'href' => $full_url );
$longDesc = $this->displayImg->getLongDesc();
- wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this , &$wgOut ) ) ;
+ wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$wgOut ) );
if( $this->displayImg->allowInlineDisplay() ) {
# image
'<br />' . Xml::tags( 'a', $linkAttribs, $msgbig ) . "$dirmark " . $longDesc;
}
- if( $this->displayImg->isMultipage() ) {
+ $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
+ if( $isMulti ) {
$wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
}
$anchorclose . "</div>\n" );
}
- if( $this->displayImg->isMultipage() ) {
+ if( $isMulti ) {
$count = $this->displayImg->pageCount();
if( $page > 1 ) {
$icon= $this->displayImg->iconThumb();
$wgOut->addHTML( '<div class="fullImageLink" id="file">' .
- $icon->toHtml( array( 'desc-link' => true ) ) .
+ $icon->toHtml( array( 'file-link' => true ) ) .
"</div>\n" );
}
* external editing (and instructions link) etc.
*/
protected function uploadLinksBox() {
- global $wgUser, $wgOut, $wgEnableUploads;
+ global $wgUser, $wgOut, $wgEnableUploads, $wgUseExternalEditor;
if( !$wgEnableUploads ) { return; }
}
# External editing link
- $elink = $sk->link(
- $this->mTitle,
- wfMsgHtml( 'edit-externally' ),
- array(),
- array(
- 'action' => 'edit',
- 'externaledit' => 'true',
- 'mode' => 'file'
- ),
- array( 'known', 'noclasses' )
- );
- $wgOut->addHTML( '<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) . "</small></li>\n" );
+ if ( $wgUseExternalEditor ) {
+ $elink = $sk->link(
+ $this->mTitle,
+ wfMsgHtml( 'edit-externally' ),
+ array(),
+ array(
+ 'action' => 'edit',
+ 'externaledit' => 'true',
+ 'mode' => 'file'
+ ),
+ array( 'known', 'noclasses' )
+ );
+ $wgOut->addHTML( '<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) . "</small></li>\n" );
+ }
$wgOut->addHTML( "</ul>\n" );
}
* we follow it with an upload history of the image and its usage.
*/
protected function imageHistory() {
- global $wgOut, $wgUseExternalEditor;
+ global $wgOut;
$this->loadFile();
$pager = new ImageHistoryPseudoPager( $this );
# 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() ) {
+ if( $this->img->exists() ) {
$this->uploadLinksBox();
}
}
$this->img = $imagePage->getDisplayedFile();
$this->title = $imagePage->getTitle();
$this->imagePage = $imagePage;
- $this->showThumb = $wgShowArchiveThumbnails;
+ $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
}
public function getImagePage() {
. $navLinks . "\n"
. Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
. '<tr><td></td>'
- . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? '<td></td>' : '' )
+ . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deletedhistory') ) ? '<td></td>' : '' )
. '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
. ( $this->showThumb ? '<th>' . wfMsgHtml( 'filehist-thumb' ) . '</th>' : '' )
. '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
$row = $css = $selected = '';
// Deletion link
- if( $local && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ) {
+ if( $local && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deletedhistory') ) ) {
$row .= '<td>';
# Link to remove from history
if( $wgUser->isAllowed( 'delete' ) ) {
array(), $q, array( 'known' )
);
}
- # Link to hide content
- if( $wgUser->isAllowed( 'deleterevision' ) ) {
+ # Link to hide content. Don't show useless link to people who cannot hide revisions.
+ $canHide = $wgUser->isAllowed( 'deleterevision' );
+ if( $canHide || ($wgUser->isAllowed('deletedhistory') && $file->getVisibility()) ) {
if( $wgUser->isAllowed('delete') ) {
- $row .= '<br/>';
+ $row .= '<br />';
}
- $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
// If file is top revision or locked from this user, don't link
if( $iscur || !$file->userCan(File::DELETED_RESTRICTED) ) {
- $del = wfMsgHtml( 'rev-delundel' );
+ $del = $this->skin->revDeleteLinkDisabled( $canHide );
} else {
list( $ts, $name ) = explode( '!', $img, 2 );
- $del = $this->skin->link( $revdel, wfMsgHtml( 'rev-delundel' ),
- array(),
- array(
- 'type' => 'oldimage',
- 'target' => $wgTitle->getPrefixedText(),
- 'ids' => $ts,
- ),
- array( 'known' )
+ $query = array(
+ 'type' => 'oldimage',
+ 'target' => $wgTitle->getPrefixedText(),
+ 'ids' => $ts,
);
- // Bolden oversighted content
- if( $file->isDeleted(File::DELETED_RESTRICTED) )
- $del = "<strong>$del</strong>";
+ $del = $this->skin->revDeleteLink( $query,
+ $file->isDeleted(File::DELETED_RESTRICTED), $canHide );
}
- $row .= "<span class='mw-revdelundel-link'>$del</span>";
+ $row .= $del;
}
$row .= '</td>';
}
$this->mImagePage = $imagePage;
$this->mTitle = clone( $imagePage->getTitle() );
$this->mTitle->setFragment( '#filehistory' );
- $this->mImg = NULL;
+ $this->mImg = null;
$this->mHist = array();
$this->mRange = array( 0, 0 ); // display range
}