Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | 'articlefeedbackv5-special-showing' => '{{PLURAL:$1|1 feedback post|$1 feedback posts}} on this article', |
76 | 76 | 'articleFeedbackv5-comment-ago' => '$1 ago', |
77 | 77 | 'articlefeedbackv5-updates-since' => '{{PLURAL:$1|1 edit|$1 edits}} since post', |
78 | | - 'articlefeedbackv5-revision-link' => 'View original version', |
| 78 | + 'articlefeedbackv5-revision-link' => 'View article revision', |
79 | 79 | 'articlefeedbackv5-special-more' => 'Show more posts', |
80 | 80 | 'articlefeedbackv5-special-pagetitle' => 'Feedback: $1', |
81 | 81 | 'articlefeedbackv5-form-optionid' => 'Option $1', |
— | — | @@ -135,7 +135,12 @@ |
136 | 136 | 'articlefeedbackv5-comment-less' => 'Less', |
137 | 137 | 'articlefeedbackv5-beta-notice' => 'Beta', |
138 | 138 | 'articlefeedbackv5-viewactivity' => 'View activity', |
| 139 | + 'articlefeedbackv5-timestamp-years' => '{{PLURAL:$1|$1 year|$1 years}}', |
| 140 | + 'articlefeedbackv5-timestamp-months' => '{{PLURAL:$1|$1 month|$1 months}}', |
| 141 | + 'articlefeedbackv5-timestamp-weeks' => '{{PLURAL:$1|$1 week|$1 weeks}}', |
| 142 | + 'articlefeedbackv5-timestamp-seconds' => 'less than 1 minute', |
139 | 143 | |
| 144 | + |
140 | 145 | /* Special page flyover panels */ |
141 | 146 | /* Hide this post panel */ |
142 | 147 | 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css |
— | — | @@ -208,12 +208,15 @@ |
209 | 209 | width: 140px; |
210 | 210 | } |
211 | 211 | .articleFeedbackv5-feedback .articleFeedbackv5-comment-details-updates { |
212 | | - float: right; |
213 | | - margin-right: 10px; |
| 212 | + float: left; |
| 213 | + display: block; |
| 214 | + line-height: 24px; |
| 215 | + margin: 0 5px 0 30px; |
| 216 | + position: relative; |
| 217 | + top: 18px; |
214 | 218 | } |
215 | 219 | .articleFeedbackv5-comment-details-date { |
216 | 220 | float: left; |
217 | | - clear: right; |
218 | 221 | display: block; |
219 | 222 | line-height: 24px; |
220 | 223 | margin: 0 5px 0 0; |
— | — | @@ -257,7 +260,7 @@ |
258 | 261 | #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot { |
259 | 262 | line-height: 22px; |
260 | 263 | float: left; |
261 | | - width: 520px; |
| 264 | + width: 450px; |
262 | 265 | } |
263 | 266 | .articleFeedbackv5-vote-wrapper { |
264 | 267 | float: left; |
— | — | @@ -313,7 +316,7 @@ |
314 | 317 | .articleFeedbackv5-feedback .articleFeedbackv5-comment-wrap h3 { |
315 | 318 | display: block; |
316 | 319 | float: left; |
317 | | - width: 520px; |
| 320 | + width: 450px; |
318 | 321 | line-height: 24px; |
319 | 322 | } |
320 | 323 | .articleFeedbackv5-feedback .articleFeedbackv5-comment-wrap h3 .icon { |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -376,6 +376,14 @@ |
377 | 377 | $.articleFeedbackv5special.currentPanelHostId = undefined; |
378 | 378 | } ); |
379 | 379 | |
| 380 | + // flyover panel close button |
| 381 | + $( '#articlefeedbackv5-noteflyover-close' ).live( 'click', function( e ) { |
| 382 | + e.preventDefault(); |
| 383 | + var $l = $( '#' + $.articleFeedbackv5special.currentPanelHostId ); |
| 384 | + $l.tipsy( 'hide' ); |
| 385 | + $.articleFeedbackv5special.currentPanelHostId = undefined; |
| 386 | + } ); |
| 387 | + |
380 | 388 | // Delete/Undelete this post |
381 | 389 | /*$( '.articleFeedbackv5-delete-link' ).live( 'click', function( e ) { |
382 | 390 | e.preventDefault(); |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -331,17 +331,6 @@ |
332 | 332 | $can_hide = $wgUser->isAllowed( 'aftv5-hide-feedback' ); |
333 | 333 | $can_delete = $wgUser->isAllowed( 'aftv5-delete-feedback' ); |
334 | 334 | |
335 | | - $details = Html::openElement( 'div', array( |
336 | | - 'class' => 'articleFeedbackv5-comment-details-updates' |
337 | | - ) ); |
338 | | - $details .= Linker::link( |
339 | | - Title::newFromRow( $record[0] ), |
340 | | - wfMessage( 'articlefeedbackv5-revision-link' )->escaped(), |
341 | | - array(), |
342 | | - array( 'oldid' => $record[0]->af_revision_id ) |
343 | | - ); |
344 | | - $details .= Html::closeElement( 'div' ); |
345 | | - |
346 | 335 | $footer_links = Html::openElement( 'div', array( |
347 | 336 | 'class' => 'articleFeedbackv5-vote-wrapper' |
348 | 337 | ) ) |
— | — | @@ -383,7 +372,7 @@ |
384 | 373 | 'rel' => $record[0]->af_abuse_count |
385 | 374 | ), wfMessage( $msg, $wgLang->formatNum( $record[0]->af_abuse_count ) )->text() ); |
386 | 375 | } |
387 | | - $footer_links .= $details . Html::closeElement( 'div' ); |
| 376 | + $footer_links .= Html::closeElement( 'div' ); |
388 | 377 | |
389 | 378 | /*$footer_links .= Html::element( 'span', array( |
390 | 379 | 'class' => 'articleFeedbackv5-helpful-votes' |
— | — | @@ -504,33 +493,66 @@ |
505 | 494 | global $wgLang; |
506 | 495 | $id = $record->af_id; |
507 | 496 | $title = $record->page_title; |
| 497 | + |
| 498 | + $blocks = array( |
| 499 | + array( 'total' => 60 * 60 * 24 * 365, 'name' => 'years' ), |
| 500 | + array( 'total' => 60 * 60 * 24 * 30, 'name' => 'months'), |
| 501 | + array( 'total' => 60 * 60 * 24 * 7, 'name' => 'weeks'), |
| 502 | + array( 'total' => 60 * 60 * 24, 'name' => 'days'), |
| 503 | + array( 'total' => 60 * 60, 'name' => 'hours'), |
| 504 | + array( 'total' => 60, 'name' => 'minutes') ); |
| 505 | + |
| 506 | + $since = wfTimestamp( TS_UNIX ) - wfTimestamp( TS_UNIX, $record->af_created ); |
| 507 | + $displayTime = 0; |
| 508 | + $displayBlock = ''; |
| 509 | + |
| 510 | + // get the largest time block, 1 minute 35 seconds -> 2 minutes |
| 511 | + for( $i = 0, $count = count( $blocks ); $i < $count; $i++ ) { |
| 512 | + $seconds = $blocks[$i]['total']; |
| 513 | + $displayTime = floor( $since / $seconds ); |
508 | 514 | |
509 | | - // Taken from the Moodbar extension. |
510 | | - $now = wfTimestamp( TS_UNIX ); |
511 | | - $timestamp = wfTimestamp( TS_UNIX, $record->af_created ); |
512 | | - $date = ''; |
| 515 | + if ( $displayTime > 0 ) { |
| 516 | + $displayBlock = $blocks[$i]['name']; |
| 517 | + // round up if the remaining time is greater than |
| 518 | + // half of the time unit |
| 519 | + if ( ( $since % $seconds ) >= ( $seconds / 2 ) ) { |
| 520 | + $displayTime++; |
513 | 521 | |
514 | | - // Relative dates for 48 hours, normal timestamps later. |
515 | | - if ( $timestamp > ( $now - ( 86400 * 2 ) ) ) { |
516 | | - $time = $wgLang->formatTimePeriod( |
517 | | - ( $now - $timestamp ), |
518 | | - array( 'avoid' => 'avoidseconds', 'noabbrevs' => true ) |
519 | | - ); |
520 | | - $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped(); |
521 | | - } elseif( $timestamp ) { |
522 | | - $date = $wgLang->timeanddate($record->af_created ); |
| 522 | + //advance to upper unit if possible, eg, 24 hours to 1 day |
| 523 | + if ( isset( $blocks[$i-1] ) && $displayTime * $seconds == $blocks[$i-1]['total'] ) { |
| 524 | + $displayTime = 1; |
| 525 | + $displayBlock = $blocks[$i-1]['name']; |
| 526 | + } |
| 527 | + } |
| 528 | + break; |
| 529 | + } |
523 | 530 | } |
524 | 531 | |
| 532 | + $date = ''; |
| 533 | + if ( $displayTime > 0 ) { |
| 534 | + if ( in_array( $displayBlock, array( 'years', 'months', 'weeks' ) ) ) { |
| 535 | + $messageKey = 'articlefeedbackv5-timestamp-' . $displayBlock; |
| 536 | + } else { |
| 537 | + $messageKey = $displayBlock; |
| 538 | + } |
| 539 | + $date = wfMessage( $messageKey )->params( $wgLang->formatNum( $displayTime ) )->escaped(); |
| 540 | + } else { |
| 541 | + $date = wfMessage( 'articlefeedbackv5-timestamp-seconds' )->escaped(); |
| 542 | + } |
| 543 | + |
| 544 | + $message = wfMessage( 'articleFeedbackv5-comment-ago', $date )->escaped(); |
| 545 | + |
525 | 546 | // format the element |
526 | 547 | return Html::openElement( 'span', array( |
527 | 548 | 'class' => 'articleFeedbackv5-comment-details-date' |
528 | 549 | ) ) |
529 | 550 | . Linker::link( |
530 | 551 | SpecialPage::getTitleFor( 'ArticleFeedbackv5', "$title/$id" ), |
531 | | - $date |
| 552 | + $message |
532 | 553 | ) |
533 | 554 | . Html::closeElement( 'span' ); |
534 | 555 | } |
| 556 | + |
535 | 557 | |
536 | 558 | private function renderBucket1( $record ) { |
537 | 559 | if ( $record['found']->aa_response_boolean == 1 ) { |
— | — | @@ -676,6 +698,17 @@ |
677 | 699 | if( !$title->exists() ) { |
678 | 700 | $title = SpecialPage::getTitleFor( 'Contributions', $record->user_name ); |
679 | 701 | } |
| 702 | + |
| 703 | + $details = Html::openElement( 'span', array( |
| 704 | + 'class' => 'articleFeedbackv5-comment-details-updates' |
| 705 | + ) ); |
| 706 | + $details .= Linker::link( |
| 707 | + Title::newFromRow( $record ), |
| 708 | + wfMessage( 'articlefeedbackv5-revision-link' )->escaped(), |
| 709 | + array(), |
| 710 | + array( 'oldid' => $record->af_revision_id ) |
| 711 | + ); |
| 712 | + $details .= Html::closeElement( 'span' ); |
680 | 713 | |
681 | 714 | return Html::openElement( 'h3', array( 'class' => $class) ) |
682 | 715 | . Html::element( 'span', array( 'class' => 'icon' ) ) |
— | — | @@ -686,7 +719,8 @@ |
687 | 720 | )->escaped() |
688 | 721 | ) |
689 | 722 | . Html::closeElement( 'h3' ) |
690 | | - . $this->renderPermalinkTimestamp( $record ); |
| 723 | + . $this->renderPermalinkTimestamp( $record ) |
| 724 | + . $details; |
691 | 725 | } |
692 | 726 | |
693 | 727 | /** |