r103930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103929‎ | r103930 | r103931 >
Date:18:09, 22 November 2011
Author:jeroendedauw
Status:reverted
Tags:
Comment:
work on reviews pager
Modified paths:
  • /trunk/extensions/Reviews/Reviews.i18n.php (modified) (history)
  • /trunk/extensions/Reviews/includes/Review.php (modified) (history)
  • /trunk/extensions/Reviews/includes/ReviewPager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Reviews/includes/ReviewPager.php
@@ -81,16 +81,16 @@
8282
8383 if ( is_null( $headers ) ) {
8484 $headers = array(
85 - 'reviews-pager-post-time',
86 - 'reviews-pager-state',
87 - 'reviews-pager-title',
 85+ 'review_title' => 'reviews-pager-title',
 86+ 'review_page_id' => 'reviews-pager-page',
 87+ 'review_post_time' => 'reviews-pager-post-time',
8888 );
8989
9090 if ( !array_key_exists( 'review_user_id', $this->conds ) ) {
91 - $headers[] = 'reviews-pager-user';
 91+ $headers['review_user_id'] = 'reviews-pager-user';
9292 }
9393
94 - $headers[] = 'reviews-pager-page';
 94+ $headers['review_state'] = 'reviews-pager-state';
9595
9696 $headers = array_map( 'wfMsg', $headers );
9797 }
@@ -113,9 +113,31 @@
114114 */
115115 public function formatValue( $name, $value ) {
116116 switch ( $name ) {
117 - case '':
118 -
 117+ case 'review_post_time':
 118+ $value = $this->getLang()->timeanddate( $value, true );
119119 break;
 120+ case 'review_state':
 121+ $value = Review::getStateMessage( $value );
 122+ break;
 123+ case 'review_page_id':
 124+ $title = Title::newFromID( $value );
 125+ $value = Html::element(
 126+ 'a',
 127+ array( 'href' => $title->getLocalURL() ),
 128+ $title->getFullText()
 129+ );
 130+ break;
 131+ case 'review_user_id':
 132+ $title = User::newFromId( $value )->getUserPage();
 133+ $value = Html::element(
 134+ 'a',
 135+ array( 'href' => $title->getLocalURL() ),
 136+ $title->getFullText()
 137+ );
 138+ break;
 139+ case 'review_title':
 140+ // TODO
 141+ break;
120142 }
121143
122144 return $value;
@@ -152,7 +174,8 @@
153175 return in_array(
154176 $name,
155177 array(
156 - // TODO
 178+ 'review_post_time',
 179+ 'review_state',
157180 )
158181 );
159182 }
Index: trunk/extensions/Reviews/includes/Review.php
@@ -146,5 +146,24 @@
147147
148148 return $ratings;
149149 }
 150+
 151+ /**
 152+ * Get the message for a review state.
 153+ *
 154+ * @since 0.1
 155+ *
 156+ * @param Review::STATE_ $state
 157+ *
 158+ * @return string
 159+ */
 160+ public static function getStateMessage( $state ) {
 161+ $map = array(
 162+ self::STATUS_NEW => 'new',
 163+ self::STATUS_FLAGGED => 'flagged',
 164+ self::STATUS_REVIEWED => 'reviewed',
 165+ );
 166+
 167+ return wfMsg( 'reviews-state-' . $map[$state] );
 168+ }
150169
151170 }
Index: trunk/extensions/Reviews/Reviews.i18n.php
@@ -39,6 +39,11 @@
4040 'group-reviewer-member' => '{{GENDER:$1|Reviewer}}',
4141 'grouppage-reviewer' => '{{ns:project}}:Reviewers',
4242
 43+ // Review states
 44+ 'reviews-state-new' => 'New',
 45+ 'reviews-state-flagged' => 'Flagged',
 46+ 'reviews-state-reviewed' => 'Reviewed',
 47+
4348 // Preferences
4449 'prefs-reviews' => 'Reviews',
4550 'reviews-prefs-showtoplink' => 'Show a link to [[Special:MyReviews|your reviews]] at the top of every page.',

Status & tagging log