Made suppress link bold
[lhc/web/wiklou.git] / includes / PageHistory.php
index e21e499..a137235 100644 (file)
@@ -123,7 +123,7 @@ class PageHistory {
                        Xml::fieldset( wfMsg( 'history-fieldset-title' ), false, array( 'id' => 'mw-history-search' ) ) .
                        Xml::hidden( 'title', $this->mTitle->getPrefixedDBKey() ) . "\n" .
                        Xml::hidden( 'action', 'history' ) . "\n" .
-                       $this->getDateMenu( $year, $month ) . ' ' .
+                       xml::dateMenu( $year, $month ) . ' ' .
                        ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) .
                        Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
                        '</fieldset></form>'
@@ -147,37 +147,6 @@ class PageHistory {
                wfProfileOut( __METHOD__ );
        }
 
-       /**
-        * @return string Formatted HTML
-        * @param int $year
-        * @param int $month
-        */
-       private function getDateMenu( $year, $month ) {
-               # Offset overrides year/month selection
-               if( $month && $month !== -1 ) {
-                       $encMonth = intval( $month );
-               } else {
-                       $encMonth = '';
-               }
-               if( $year ) {
-                       $encYear = intval( $year );
-               } else if( $encMonth ) {
-                       $thisMonth = intval( gmdate( 'n' ) );
-                       $thisYear = intval( gmdate( 'Y' ) );
-                       if( intval($encMonth) > $thisMonth ) {
-                               $thisYear--;
-                       }
-                       $encYear = $thisYear;
-               } else {
-                       $encYear = '';
-               }
-               return Xml::label( wfMsg( 'year' ), 'year' ) . ' '.
-                       Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) .
-                               ' '.
-                       Xml::label( wfMsg( 'month' ), 'month' ) . ' '.
-                       Xml::monthSelector( $encMonth, -1 );
-       }
-
        /**
         * Creates begin of history list with a submit button
         *
@@ -283,7 +252,9 @@ class PageHistory {
         * @param bool $firstInList Whether this row corresponds to the first displayed on this history page.
         * @return string HTML output for the row
         */
-       function historyLine( $row, $next, $counter = '', $notificationtimestamp = false, $latest = false, $firstInList = false ) {
+       function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
+               $latest = false, $firstInList = false )
+       {
                global $wgUser, $wgLang;
                $rev = new Revision( $row );
                $rev->setTitle( $this->mTitle );
@@ -297,12 +268,14 @@ class PageHistory {
                $s = "($curlink) ($lastlink) $arbitrary";
 
                if( $wgUser->isAllowed( 'deleterevision' ) ) {
-                       if( $firstInList ) {
+                       if( $latest ) {
                                // We don't currently handle well changing the top revision's settings
-                               $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message['rev-delundel'].')' );
+                               $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.
+                                       $this->message['rev-delundel'].')' );
                        } else if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
                                // If revision was hidden from sysops
-                               $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message['rev-delundel'].')' );
+                               $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.
+                                       $this->message['rev-delundel'].')' );
                        } else {
                                $query = array( 'target' => $this->mTitle->getPrefixedDbkey(),
                                        'oldid' => $rev->getId()
@@ -381,10 +354,13 @@ class PageHistory {
        function revLink( $rev ) {
                global $wgLang;
                $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
-               if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
+               if( $rev->userCan( Revision::DELETED_TEXT ) ) {
                        $link = $this->mSkin->makeKnownLinkObj( $this->mTitle, $date, "oldid=" . $rev->getId() );
                } else {
-                       $link = '<span class="history-deleted">' . $date . '</span>';
+                       $link = $date;
+               }
+               if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+                       $link = "<span class=\"history-deleted\">$link</span>";
                }
                return $link;
        }
@@ -397,7 +373,7 @@ class PageHistory {
         */
        function curLink( $rev, $latest ) {
                $cur = $this->message['cur'];
-               if( $latest || $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+               if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
                        return $cur;
                } else {
                        return $this->mSkin->makeKnownLinkObj( $this->mTitle, $cur,
@@ -423,7 +399,7 @@ class PageHistory {
                        # Next row probably exists but is unknown, use an oldid=prev link
                        return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
                                "diff=" . $prevRev->getId() . "&oldid=prev" );
-               } elseif( $prevRev->isDeleted(Revision::DELETED_TEXT) || $nextRev->isDeleted(Revision::DELETED_TEXT) ) {
+               } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
                        return $last;
                } else {
                        return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
@@ -450,7 +426,7 @@ class PageHistory {
                                $checkmark = array( 'checked' => 'checked' );
                        } else {
                                # Check visibility of old revisions
-                               if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+                               if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
                                        $radio['disabled'] = 'disabled';
                                        $checkmark = array(); // We will check the next possible one
                                } else if( $counter == 2 || !$this->mOldIdChecked ) {
@@ -603,7 +579,12 @@ class PageHistoryPager extends ReverseChronologicalPager {
                        'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ),
                        'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
                );
-               ChangeTags::modifyDisplayQuery( $queryInfo['tables'], $queryInfo['fields'], $queryInfo['conds'], $queryInfo['join_conds'], $this->tagFilter );
+               ChangeTags::modifyDisplayQuery( $queryInfo['tables'],
+                                                                               $queryInfo['fields'],
+                                                                               $queryInfo['conds'],
+                                                                               $queryInfo['join_conds'],
+                                                                               $queryInfo['options'],
+                                                                               $this->tagFilter );
                wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) );
                return $queryInfo;
        }