Index: trunk/phase3/includes/User.php |
— | — | @@ -216,6 +216,8 @@ |
217 | 217 | //@} |
218 | 218 | |
219 | 219 | static $idCacheByName = array(); |
| 220 | + |
| 221 | + var $mNewtalknumber; |
220 | 222 | |
221 | 223 | /** |
222 | 224 | * Lightweight constructor for an anonymous user. |
— | — | @@ -1546,9 +1548,10 @@ |
1547 | 1549 | } else { |
1548 | 1550 | $db = wfGetDB( DB_SLAVE ); |
1549 | 1551 | } |
1550 | | - $ok = $db->selectField( 'user_newtalk', $field, |
| 1552 | + $query = $db->select( 'user_newtalk', $field, |
1551 | 1553 | array( $field => $id ), __METHOD__ ); |
1552 | | - return $ok !== false; |
| 1554 | + $this->mNewtalknumber = $ok = $db->numRows( $query ); |
| 1555 | + return $ok !== 0; |
1553 | 1556 | } |
1554 | 1557 | |
1555 | 1558 | /** |
— | — | @@ -1631,6 +1634,15 @@ |
1632 | 1635 | $this->invalidateCache(); |
1633 | 1636 | } |
1634 | 1637 | } |
| 1638 | + |
| 1639 | + /** |
| 1640 | + * Return the number of new messages |
| 1641 | + * @return \int The number of new messages |
| 1642 | + */ |
| 1643 | + public function getNewtalkNumber() { |
| 1644 | + global $wgLang; |
| 1645 | + return $wgLang->formatNum( $this->mNewtalknumber ); |
| 1646 | + } |
1635 | 1647 | |
1636 | 1648 | /** |
1637 | 1649 | * Generate a current or new-future timestamp to be stored in the |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -319,11 +319,14 @@ |
320 | 320 | array( 'diff' => 'cur' ), |
321 | 321 | array( 'known', 'noclasses' ) |
322 | 322 | ); |
| 323 | + |
| 324 | + $newmessagesnumber = $wgUser->getNewtalkNumber(); |
323 | 325 | |
324 | 326 | $ntl = wfMsg( |
325 | 327 | 'youhavenewmessages', |
326 | 328 | $newmessageslink, |
327 | | - $newmessagesdifflink |
| 329 | + $newmessagesdifflink, |
| 330 | + $newmessagesnumber |
328 | 331 | ); |
329 | 332 | # Disable Cache |
330 | 333 | $out->setSquidMaxage( 0 ); |
— | — | @@ -532,31 +535,24 @@ |
533 | 536 | ); |
534 | 537 | $usertalkUrlDetails = $this->makeTalkUrlDetails( $this->userpage ); |
535 | 538 | if ( $wgUser->getNewtalk() ) { |
536 | | - # do not show "(!)" text when we are viewing our |
| 539 | + # do not show text when we are viewing our |
537 | 540 | # own talk page |
538 | | - if( !$title->equals( $wgUser->getTalkPage() ) ) { |
539 | | - $field = ( $wgUser->getID() == 0 )? 'user_ip' : 'user_id'; |
540 | | - $id = ( $wgUser->getID() == 0 )? $wgUser->getName() : $wgUser->getID(); |
| 541 | + if( !$title->equals( $wgUser->getTalkPage() ) ) { |
| 542 | + $newtalk = $wgUser->getNewtalkNumber(); |
541 | 543 | |
542 | | - $db = wfGetDB( DB_SLAVE ); |
543 | | - $query = $db->select( 'user_newtalk', $field, array( $field => $id ) ); |
544 | | - $num = $db->numRows( $query ); |
545 | | - |
546 | | - $text = '('.$wgLang->formatNum( $num ).')'; |
547 | | - |
548 | 544 | # disable caching |
549 | 545 | $wgOut->setSquidMaxage( 0 ); |
550 | 546 | $wgOut->enableClientCache( false ); |
551 | 547 | } |
552 | 548 | else { |
553 | | - $text = ''; |
| 549 | + $newtalk = 0; |
554 | 550 | } |
555 | 551 | } |
556 | 552 | else { |
557 | | - $text = ''; |
| 553 | + $newtalk = 0; |
558 | 554 | } |
559 | 555 | $personal_urls['mytalk'] = array( |
560 | | - 'text' => wfMsg( 'mytalk' ).$text, |
| 556 | + 'text' => wfMsg( 'mytalk', $newtalk ), |
561 | 557 | 'href' => &$usertalkUrlDetails['href'], |
562 | 558 | 'class' => $usertalkUrlDetails['exists'] ? false : 'new', |
563 | 559 | 'active' => ( $usertalkUrlDetails['href'] == $pageurl ) |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -751,7 +751,7 @@ |
752 | 752 | 'cancel' => 'Cancel', |
753 | 753 | 'moredotdotdot' => 'More...', |
754 | 754 | 'mypage' => 'My page', |
755 | | -'mytalk' => 'My talk', |
| 755 | +'mytalk' => 'My talk ($1)', |
756 | 756 | 'anontalk' => 'Talk for this IP', |
757 | 757 | 'navigation' => 'Navigation', |
758 | 758 | 'and' => ' and', |
— | — | @@ -894,7 +894,7 @@ |
895 | 895 | 'pagetitle' => '$1 - {{SITENAME}}', # only translate this message to other languages if you have to change it |
896 | 896 | 'pagetitle-view-mainpage' => '{{SITENAME}}', # only translate this message to other languages if you have to change it |
897 | 897 | 'retrievedfrom' => 'Retrieved from "$1"', |
898 | | -'youhavenewmessages' => 'You have $1 ($2).', |
| 898 | +'youhavenewmessages' => 'You have $3 $1 ($2).', |
899 | 899 | 'newmessageslink' => 'new messages', |
900 | 900 | 'newmessagesdifflink' => 'last change', |
901 | 901 | 'youhavenewmessagesmulti' => 'You have new messages on $1', |