r97975 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97974‎ | r97975 | r97976 >
Date:23:24, 23 September 2011
Author:catrope
Status:ok
Tags:
Comment:
Special:MoodBarFeedback: if there are no results, show a message and don't show the paging links
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/SpecialMoodBarFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/SpecialMoodBarFeedback.php
@@ -86,7 +86,7 @@
8787 public function buildList( $rows ) {
8888 global $wgLang;
8989 $now = wfTimestamp( TS_UNIX );
90 - $html = '<ul id="fbd-list">';
 90+ $list = '';
9191 foreach ( $rows as $row ) {
9292 $type = $row->mbf_type;
9393 $typeMsg = wfMessage( "moodbar-type-$type" )->escaped();
@@ -100,7 +100,7 @@
101101 $permalinkURL = $this->getTitle( $row->mbf_id )->getLinkURL();
102102 $permalinkText = wfMessage( 'moodbar-feedback-permalink' )->escaped();
103103
104 - $html .= <<<HTML
 104+ $list .= <<<HTML
105105 <li class="fbd-item">
106106 <div class="fbd-item-emoticon fbd-item-emoticon-$type">
107107 <span class="fbd-item-emoticon-label">$typeMsg</span>
@@ -118,11 +118,14 @@
119119 </li>
120120 HTML;
121121 }
122 -
123 - $moreURL = '#'; //TODO
124 - $moreText = wfMessage( 'moodbar-feedback-more' )->escaped();
125 - $html .= '</ul><div id="fbd-list-more"><a href="#">More</a></div>';
126 - return $html;
 122+ if ( $list === '' ) {
 123+ return '<div id="fbd-list">' . wfMessage( 'moodbar-feedback-noresults' )->escaped() . '</div>';
 124+ } else {
 125+ // Only show paging stuff if the result is not empty
 126+ $moreURL = '#'; //TODO
 127+ $moreText = wfMessage( 'moodbar-feedback-more' )->escaped();
 128+ return "<ul id=\"fbd-list\">$list</ul>" . '<div id="fbd-list-more"><a href="#">More</a></div>';
 129+ }
127130 }
128131
129132 public function doQuery( $filters ) {
Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -83,6 +83,7 @@
8484 'moodbar-feedback-filters-button' => 'Set filters',
8585 'moodbar-feedback-whatis' => 'What is this feature?',
8686 'moodbar-feedback-permalink' => 'link to here',
 87+ 'moodbar-feedback-noresults' => 'There are no comments that match your filters.',
8788 // Mood types
8889 'moodbar-type-happy' => 'Happy',
8990 'moodbar-type-sad' => 'Sad',

Status & tagging log