only get the title string if action is not empty
[lhc/web/wiklou.git] / includes / PageHistory.php
index 65f041e..323bf4f 100644 (file)
@@ -78,22 +78,26 @@ class PageHistory {
                        "action=history", $atend );
                $s = $numbar;
                $s .= $this->beginHistoryList();
-
+               $counter = 1;
                if( $offset == 0 ){
                        $this->linesonpage++;
                        $s .= $this->historyLine( 
                                $this->mArticle->getTimestamp(), 
                                $this->mArticle->getUser(),
                                $this->mArticle->getUserText(), $namespace,
-                               $title, 0, $this->mArticle->getComment(),
-                               ( $this->mArticle->getMinorEdit() > 0 ) 
+                               $title, 0, $this->mArticle->getComment(),
+                               ( $this->mArticle->getMinorEdit() > 0 ),
+                               $counter++
                        );
                }
                while ( $line = wfFetchObject( $res ) ) {
-                       $s .= $this->historyLine( $line->old_timestamp, $line->old_user,
-                         $line->old_user_text, $namespace,
-                         $title, $line->old_id,
-                         $line->old_comment, ( $line->old_minor_edit > 0 ) );
+                       $s .= $this->historyLine( 
+                               $line->old_timestamp, $line->old_user,
+                               $line->old_user_text, $namespace,
+                               $title, $line->old_id,
+                               $line->old_comment, ( $line->old_minor_edit > 0 ),
+                               $counter++
+                       );
                }
                $s .= $this->endHistoryList( !$atend );
                $s .= $numbar;
@@ -105,9 +109,9 @@ class PageHistory {
        {
                global $wgTitle;
                $this->lastdate = $this->lastline = "";
-               $s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul class='special'>";
-               $url = $wgTitle->getLocalURL("-");
-               $s .= "<SCRIPT>
+               $url = $wgTitle->getFullURL("-");
+               $s = "\n<script type='text/javascript'>
+                       /*<![CDATA[*/
                        var sel = -1;
                        function anysel(oid){ 
                                row = document.getElementById(\"ver\" + oid);
@@ -131,10 +135,12 @@ class PageHistory {
                                if( (diff < oldid && diff != 0) || oldid == 0 ){ 
                                        tmp = oldid; oldid = diff; diff = tmp; 
                                }
-                               u = \"{$url}&diff=\" + diff + \"&oldid=\" + oldid;
+                               u = \"{$url}diff=\" + diff + \"&oldid=\" + oldid;
                                location.href=u;
                        }
-               </SCRIPT>";
+                       /*]]>*/
+               </script>";
+               $s .= "\n<p>" . wfMsg( "histlegend" ) . "</p>\n<ul class='special'>";
                return $s;
        }
 
@@ -147,7 +153,7 @@ class PageHistory {
                return $s;
        }
 
-       function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor )
+       function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor, $counter = '' )
        {
                global $wgLang;
 
@@ -158,7 +164,7 @@ class PageHistory {
 
                if ( $oid && $this->lastline ) {
                        $ret = preg_replace( "/!OLDID!([0-9]+)!/", $this->mSkin->makeKnownLink(
-                         $artname, $last, "diff=\\1&oldid={$oid}" ), $this->lastline );
+                         $artname, $last, "diff=\\1&oldid={$oid}",'' ,'' ,' tabindex="'.$counter.'"' ), $this->lastline );
                } else {
                        $ret = "";
                }
@@ -188,16 +194,18 @@ class PageHistory {
                }
                $arbitrary = "";
                if( $this->linesonpage > 1)
-                       $arbitrary = "<INPUT TYPE=CHECKBOX onClick='anysel($oid)' TITLE='Select any two versions to diff them'>";
+                       $arbitrary = "<input type='checkbox' onclick='anysel($oid)' title='Select any two versions to diff them' />";
                $s .= "({$curlink}) (!OLDID!{$oid}!) $arbitrary . .";
                $M = wfMsg( "minoreditletter" );
                if ( $isminor ) {
                        $s .= " <strong>{$M}</strong>";
                }
-               $s .= " <span ID='ver$oid'>{$link} . . {$ul}</span>";
+               $s .= " <span id='ver$oid'>{$link} . . {$ul}</span>";
 
                if ( "" != $c && "*" != $c ) {
-                       $s .= " <em>(" . wfEscapeHTML($c) . ")</em>";
+
+                       $c = $this->mSkin->formatcomment($c);
+                       $s .= " <em>(" . $c . ")</em>";
                }
                $s .= "</li>\n";