$this->dupes = null;
$this->repo = null;
}
+
+ public function setFile( $file ) {
+ $this->displayImg = $file;
+ $this->img = $file;
+ $this->fileLoaded = true;
+ }
protected function loadFile() {
if( $this->fileLoaded ) {
$showmeta = false;
}
- if( $this->displayImg->exists() )
+ if( !$diff && $this->displayImg->exists() )
$wgOut->addHTML( $this->showTOC($showmeta) );
- $this->openShowImage();
+ if( !$diff )
+ $this->openShowImage();
# No need to display noarticletext, we use our own message, output in openShowImage()
if( $this->getID() ) {
if( $showmeta ) {
global $wgStylePath, $wgStyleVersion;
- $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
- $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
+ $expand = htmlspecialchars( Xml::escapeJsString( wfMsg( 'metadata-expand' ) ) );
+ $collapse = htmlspecialchars( Xml::escapeJsString( wfMsg( 'metadata-collapse' ) ) );
$wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" );
$wgOut->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
$wgOut->addScriptFile( 'metadata.js' );
$r .= "{| id=mw_metadata class=mw_metadata\n";
foreach ( $metadata as $type => $stuff ) {
foreach ( $stuff as $v ) {
+ # FIXME, why is this using escapeId for a class?!
$class = Sanitizer::escapeId( $v['id'] );
if( $type == 'collapsed' ) {
$class .= ' collapsable';
public function getUploadUrl() {
$this->loadFile();
$uploadTitle = SpecialPage::getTitleFor( 'Upload' );
- return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
+ return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) . '&wpReUpload=1' );
}
/**
$this->loadFile();
$pager = new ImageHistoryPseudoPager( $this );
- # Generate prev/next links
$wgOut->addHTML( $pager->getBody() );
$this->img->resetHistory(); // free db resources
class ImageHistoryPseudoPager extends ReverseChronologicalPager {
function __construct( $imagePage ) {
parent::__construct();
- $this->mImagePage =& $imagePage;
- $this->mTitle = $imagePage->getTitle();
+ $this->mImagePage = $imagePage;
+ $this->mTitle = clone( $imagePage->getTitle() );
+ $this->mTitle->setFragment( '#filehistory' );
$this->mImg = NULL;
$this->mHist = array();
$this->mRange = array( 0, 0 ); // display range
}
+
+ function getTitle() {
+ return $this->mTitle;
+ }
function getQueryInfo() {
return false;