* Add method to FileRepo to get the human-readable name of the repository (getDisplayName())
* Use this in ImagePage to show what repo the dupes are from * Added default "shared repository" message for shared repos without names.
This commit is contained in:
parent
03449c1564
commit
884a7a80f4
4 changed files with 23 additions and 1 deletions
|
|
@ -646,13 +646,15 @@ EOT
|
|||
|
||||
$sk = $wgUser->getSkin();
|
||||
foreach ( $dupes as $file ) {
|
||||
$fromSrc = '';
|
||||
if( $file->isLocal() )
|
||||
$link = $sk->makeKnownLinkObj( $file->getTitle(), "" );
|
||||
else {
|
||||
$link = $sk->makeExternalLink( $file->getDescriptionUrl(),
|
||||
$file->getTitle()->getPrefixedText() );
|
||||
$fromSrc = wfMsg( 'shared-repo-from', $file->getRepo()->getDisplayName() );
|
||||
}
|
||||
$wgOut->addHTML( "<li>{$link}</li>\n" );
|
||||
$wgOut->addHTML( "<li>{$link} {$fromSrc}</li>\n" );
|
||||
}
|
||||
$wgOut->addHTML( "</ul></div>\n" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,4 +538,20 @@ abstract class FileRepo {
|
|||
function findBySha1( $hash ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-readable name of the repo.
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName() {
|
||||
// We don't name our own repo, return nothing
|
||||
if ( $this->name == 'local' ) {
|
||||
return null;
|
||||
}
|
||||
$repoName = wfMsg( 'shared-repo-' . $this->name );
|
||||
if ( !wfEmptyMsg( 'shared-repo-' . $this->name, $repoName ) ) {
|
||||
return $repoName;
|
||||
}
|
||||
return wfMsg( 'shared-repo' );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1989,6 +1989,8 @@ A [[Special:WhatLinksHere/$2|full list]] is available.',
|
|||
'noimage' => 'No file by this name exists, but you can $1.',
|
||||
'noimage-linktext' => 'upload one',
|
||||
'uploadnewversion-linktext' => 'Upload a new version of this file',
|
||||
'shared-repo-from' => 'from $1', // $1 is the repository name
|
||||
'shared-repo' => 'shared repository', // used when shared-repo-NAME doesn't exist
|
||||
|
||||
# File reversion
|
||||
'filerevert' => 'Revert $1',
|
||||
|
|
|
|||
|
|
@ -1246,6 +1246,8 @@ $wgMessageStructure = array(
|
|||
'noimage',
|
||||
'noimage-linktext',
|
||||
'uploadnewversion-linktext',
|
||||
'shared-repo-from',
|
||||
'shared-repo',
|
||||
),
|
||||
'filerevert' => array(
|
||||
'filerevert',
|
||||
|
|
|
|||
Loading…
Reference in a new issue