Localisation updates for core and extension messages from translatewiki.net (2010...
[lhc/web/wiklou.git] / includes / ChangesList.php
index dfd2b93..5de3b06 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Classes to show various lists of changes:
- * - what links here
+ * - watchlist
  * - related changes
  * - recent changes
  *
@@ -129,47 +129,6 @@ class ChangesList {
                        . '</abbr>';
        }
 
-       /**
-        * Some explanatory wrapper text for the given flag, to be used in a legend
-        * explaining what the flags mean.  For instance, "N - new page".  See
-        * also flag().
-        *
-        * @param $key String: 'newpage', 'unpatrolled', 'minor', or 'bot'
-        * @return String: Raw HTML
-        */
-       private static function flagLine( $key ) {
-               return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities',
-                       'replaceafter' ), self::flag( $key ) );
-       }
-
-       /**
-        * A handy legend to tell users what the little "m", "b", and so on mean.
-        *
-        * @return String: Raw HTML
-        */
-       public static function flagLegend() {
-               global $wgGroupPermissions, $wgLang;
-
-               $flags = array( self::flagLine( 'newpage' ),
-                       self::flagLine( 'minor' ) );
-
-               # Don't show info on bot edits unless there's a bot group of some kind
-               foreach ( $wgGroupPermissions as $rights ) {
-                       if ( isset( $rights['bot'] ) && $rights['bot'] ) {
-                               $flags[] = self::flagLine( 'bot' );
-                               break;
-                       }
-               }
-
-               if ( self::usePatrol() ) {
-                       $flags[] = self::flagLine( 'unpatrolled' );
-               }
-
-               return '<div class="mw-rc-label-legend">' .
-                       wfMsgExt( 'recentchanges-label-legend', 'parseinline',
-                       $wgLang->commaList( $flags ) ) . '</div>';
-       }
-
        /**
         * Returns text for the start of the tabular part of RC
         * @return String
@@ -601,14 +560,14 @@ class EnhancedChangesList extends ChangesList {
         * @return String
         */
        public function beginRecentChangesList() {
-               global $wgStylePath, $wgStyleVersion, $wgOut;
+               global $wgOut;
                $this->rc_cache = array();
                $this->rcMoveIndex = 0;
                $this->rcCacheIndex = 0;
                $this->lastdate = '';
                $this->rclistOpen = false;
                $wgOut->addModules( 'mediawiki.legacy.enhancedchanges' );
-               return $script;
+               return '';
        }
        /**
         * Format a line for enhanced recentchange (aka with javascript and block of lines).
@@ -634,7 +593,7 @@ class EnhancedChangesList extends ChangesList {
                        # Process current cache
                        $ret = $this->recentChangesBlock();
                        $this->rc_cache = array();
-                       $ret .= Xml::element( 'h4', null, $date );
+                       $ret .= Xml::element( 'h4', null, $date ) . "\n";
                        $this->lastdate = $date;
                }
 
@@ -777,7 +736,15 @@ class EnhancedChangesList extends ChangesList {
 
                wfProfileIn( __METHOD__ );
 
-               $r = '<table class="mw-enhanced-rc"><tr>';
+               # Add the namespace and title of the block as part of the class
+               if ( $block[0]->mAttribs['rc_log_type'] ) {
+                       # Log entry
+                       $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] );
+               } else {
+                       $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
+               }
+               $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
+                       Html::openElement( 'tr' );
 
                # Collate list of users
                $userlinks = array();
@@ -1088,11 +1055,19 @@ class EnhancedChangesList extends ChangesList {
                # Extract fields from DB into the function scope (rc_xxxx variables)
                // FIXME: Would be good to replace this extract() call with something
                // that explicitly initializes variables.
-               $classes = array(); // TODO implement
+               // TODO implement
                extract( $rcObj->mAttribs );
                $query['curid'] = $rc_cur_id;
 
-               $r = '<table class="mw-enhanced-rc"><tr>';
+               if( $rc_log_type ) {
+                       # Log entry
+                       $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' . $rc_log_type . '-' . $rcObj->mAttribs['rc_title'] );
+               } else {
+                       $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
+               }
+               $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
+                       Html::openElement( 'tr' );
+
                $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow() . '&#160;';
                # Flag and Timestamp
                if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {