r105562 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105561‎ | r105562 | r105563 >
Date:16:58, 8 December 2011
Author:jeroendedauw
Status:reverted (Comments)
Tags:
Comment:
ui work
Modified paths:
  • /trunk/extensions/Reviews/includes/Review.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Reviews/includes/Review.php
@@ -359,14 +359,42 @@
360360 public function getHTML( User $user, Language $lang ) {
361361 $ratings = $this->getRatings( true );
362362
 363+ $controlLinks = array();
 364+
 365+ if ( $user->isAllowed( 'reviewsadmin' ) ) {
 366+ $controlLinks[] = Linker::linkKnown(
 367+ SpecialPage::getTitleFor( 'Reviews', $this->getId() ),
 368+ wfMsg( 'reviews-review-details' )
 369+ );
 370+ }
 371+
 372+ if ( $user->getId() === $this->getField( 'user_id' ) ) {
 373+ $controlLinks[] = Linker::linkKnown(
 374+ SpecialPage::getTitleFor( 'MyReviews', $this->getId() ),
 375+ wfMsg( 'reviews-review-edit' )
 376+ );
 377+ }
 378+
 379+ $stateControl = $this->getStateControl( $user, false );
 380+
363381 $html = '<table class="review-table">';
364382
365383 $html .= '<tr><th colspan="2" class="review-table-title">' . htmlspecialchars( $this->getField( 'title' ) ) . '</th></tr>';
366384
367385 $html .= '<tr>';
368386
369 - $html .= '<td rowspan="' . ( $this->hasRatings() ? 3 : 2 ) . '" class="review-author-box">';
 387+ $rowspan = 1;
370388
 389+ if ( $this->hasRatings() ) {
 390+ $rowspan++;
 391+ }
 392+
 393+ if ( count( $controlLinks ) > 0 || $stateControl !== '' ) {
 394+ $rowspan++;
 395+ }
 396+
 397+ $html .= '<td rowspan="' . $rowspan . '" class="review-author-box">';
 398+
371399 $html .= ReviewRating::getDisplayHTMLFor( $this->getRating() );
372400
373401 $html .= Html::element( 'p', array( 'class' => 'reviews-posted-by' ), wfMsgExt(
@@ -399,32 +427,18 @@
400428 $html .= '</tr>';
401429 }
402430
403 - $html .= '<tr><td>';
404 -
405 - $html .= $this->getStateControl( $user, false );
406 -
407 - $controlLinks = array();
408 -
409 - if ( $user->isAllowed( 'reviewsadmin' ) ) {
410 - $controlLinks[] = Linker::linkKnown(
411 - SpecialPage::getTitleFor( 'Reviews', $this->getId() ),
412 - wfMsg( 'reviews-review-details' )
413 - );
 431+ if ( count( $controlLinks ) > 0 || $stateControl ) {
 432+ $html .= '<tr><td>';
 433+
 434+ $html .= $stateControl;
 435+
 436+ if ( count( $controlLinks ) > 0 ) {
 437+ $html .= '(' . $lang->pipeList( $controlLinks ) . ')';
 438+ }
 439+
 440+ $html .= '</td></tr>';
414441 }
415442
416 - if ( $user->getId() === $this->getField( 'user_id' ) ) {
417 - $controlLinks[] = Linker::linkKnown(
418 - SpecialPage::getTitleFor( 'MyReviews', $this->getId() ),
419 - wfMsg( 'reviews-review-edit' )
420 - );
421 - }
422 -
423 - if ( count( $controlLinks ) > 0 ) {
424 - $html .= '(' . $lang->pipeList( $controlLinks ) . ')';
425 - }
426 -
427 - $html .= '</td></tr>';
428 -
429443 $html .= '</table>';
430444
431445 return Html::openElement(
@@ -486,23 +500,32 @@
487501 'reviewed' => array(),
488502 );
489503
 504+ $canView = false;
 505+
490506 if ( $user->isAllowed( 'reviewsadmin' ) ) {
491507 $states['new'] = array( 'flagged', 'reviewed' );
492508 $states['flagged'] = array( 'new', 'reviewed' );
493509 $states['reviewed'] = array( 'flagged' );
 510+ $canView = true;
494511 }
495512 else {
496513 if ( $user->isAllowed( 'reviewreview' ) ) {
497514 $states['flagged'] = array( 'new', 'reviewed' );
 515+ $canView = true;
498516 }
499517
500518 if ( $user->isAllowed( 'flagreview' ) ) {
501519 $states['reviewed'] = array( 'flagged' );
502520 $states['new'][] = 'flagged';
503521 $states['new'] = array_unique( $states['new'] );
 522+ $canView = true;
504523 }
505524 }
506525
 526+ if ( !$canView ) {
 527+ return '';
 528+ }
 529+
507530 $control = Html::element(
508531 'div',
509532 array(

Comments

#Comment by Nikerabbit (talk | contribs)   07:44, 9 December 2011

When was this reverted exactly?

#Comment by Nikerabbit (talk | contribs)   08:37, 9 December 2011

Found it.

Status & tagging log