Added message to be displayed when query returns no revision
Added message that is displayed when no revisions are returned by query, also stopped HistoryPager::getStartBody and HistoryPager::getEndBody from outputting unnecessary html when no revisions are returned. Bug: T227578 Change-Id: I18981c8d8d4feea548ba7321137237017a714bb6
This commit is contained in:
parent
8c53f65794
commit
db039086d4
3 changed files with 25 additions and 10 deletions
|
|
@ -171,6 +171,14 @@ class HistoryPager extends ReverseChronologicalPager {
|
|||
$this->mResult->seek( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns message when query returns no revisions
|
||||
* @return string escaped message
|
||||
*/
|
||||
protected function getEmptyBody() {
|
||||
return $this->msg( 'history-empty' )->escaped();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates begin of history list with a submit button
|
||||
*
|
||||
|
|
@ -181,17 +189,19 @@ class HistoryPager extends ReverseChronologicalPager {
|
|||
$this->lastRow = false;
|
||||
$this->counter = 1;
|
||||
$this->oldIdChecked = 0;
|
||||
|
||||
$this->getOutput()->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' );
|
||||
$s = Html::openElement( 'form', [ 'action' => wfScript(),
|
||||
'id' => 'mw-history-compare' ] ) . "\n";
|
||||
$s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
|
||||
$s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
|
||||
$s .= Html::hidden( 'type', 'revision' ) . "\n";
|
||||
|
||||
$s = '';
|
||||
// Button container stored in $this->buttons for re-use in getEndBody()
|
||||
$this->buttons = '';
|
||||
if ( $this->getNumRows() > 0 ) {
|
||||
$this->getOutput()->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' );
|
||||
$s = Html::openElement( 'form', [
|
||||
'action' => wfScript(),
|
||||
'id' => 'mw-history-compare'
|
||||
] ) . "\n";
|
||||
$s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
|
||||
$s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
|
||||
$s .= Html::hidden( 'type', 'revision' ) . "\n";
|
||||
|
||||
$this->buttons .= Html::openElement(
|
||||
'div', [ 'class' => 'mw-history-compareselectedversions' ] );
|
||||
$className = 'historysubmit mw-history-compareselectedversions-button mw-ui-button';
|
||||
|
|
@ -223,8 +233,8 @@ class HistoryPager extends ReverseChronologicalPager {
|
|||
$this->buttons .= '</div>';
|
||||
|
||||
$s .= $this->buttons;
|
||||
$s .= '<ul id="pagehistory">' . "\n";
|
||||
}
|
||||
$s .= '<ul id="pagehistory">' . "\n";
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
|
@ -245,6 +255,10 @@ class HistoryPager extends ReverseChronologicalPager {
|
|||
}
|
||||
|
||||
protected function getEndBody() {
|
||||
if ( $this->getNumRows() == 0 ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( $this->lastRow ) {
|
||||
$firstInList = $this->counter == 1;
|
||||
if ( $this->mIsBackwards ) {
|
||||
|
|
@ -274,7 +288,6 @@ class HistoryPager extends ReverseChronologicalPager {
|
|||
$s .= $this->buttons;
|
||||
}
|
||||
$s .= '</form>';
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -864,6 +864,7 @@
|
|||
"history-feed-item-nocomment": "$1 at $2",
|
||||
"history-feed-empty": "The requested page does not exist.\nIt may have been deleted from the wiki, or renamed.\nTry [[Special:Search|searching on the wiki]] for relevant new pages.",
|
||||
"history-edit-tags": "Edit tags of selected revisions",
|
||||
"history-empty": "No matching revisions were found.",
|
||||
"rev-deleted-comment": "(edit summary removed)",
|
||||
"rev-deleted-user": "(username removed)",
|
||||
"rev-deleted-event": "(log details removed)",
|
||||
|
|
|
|||
|
|
@ -1079,6 +1079,7 @@
|
|||
"history-feed-item-nocomment": "Title for each revision when viewing the RSS/Atom [[:w:en:web feed|feed]] for a page history.\n\nParameters:\n* $1 - username\n* $2 - date/time\n* $3 - (Optional) date\n* $4 - (Optional) time",
|
||||
"history-feed-empty": "Used as summary of the RSS/Atom feed for a page history when the feed is empty.\nSee [{{canonicalurl:x|feed=atom&action=history}} example].",
|
||||
"history-edit-tags": "Text of button used to access change tagging interface. For more information on tags see [[mw:Manual:Tags]].",
|
||||
"history-empty": "Text shown to user when no revision is returned by the query.",
|
||||
"rev-deleted-comment": "Apparently this can also be about the reason of a log action, not only an edit summary. See also:\n*{{msg-mw|revdelete-hide-comment}}",
|
||||
"rev-deleted-user": "See also:\n* {{msg-mw|Rev-deleted-event}}",
|
||||
"rev-deleted-event": "See also:\n* {{msg-mw|Rev-deleted-user}}",
|
||||
|
|
|
|||
Loading…
Reference in a new issue