* ( bug 18264 ) upload-by-url form was still disabled in non-js2 form output
[lhc/web/wiklou.git] / includes / specials / SpecialMergeHistory.php
index f870406..1b4ef30 100644 (file)
@@ -67,7 +67,7 @@ class MergehistoryForm {
        }
 
        function execute() {
-               global $wgOut, $wgUser;
+               global $wgOut;
 
                $wgOut->setPagetitle( wfMsgHtml( "mergehistory" ) );
 
@@ -97,7 +97,7 @@ class MergehistoryForm {
                        );
                }
                
-               if ( $this->mTargetObj->equals( $this->mDestObj ) ) {
+               if ( $this->mTargetObj && $this->mDestObj && $this->mTargetObj->equals( $this->mDestObj ) ) {
                        $errors[] = wfMsgExt( 'mergehistory-same-destination', array( 'parse' ) );
                }
 
@@ -142,7 +142,7 @@ class MergehistoryForm {
        }
 
        private function showHistory() {
-               global $wgLang, $wgContLang, $wgUser, $wgOut;
+               global $wgLang, $wgUser, $wgOut;
 
                $this->sk = $wgUser->getSkin();
 
@@ -155,7 +155,7 @@ class MergehistoryForm {
                $haveRevisions = $revisions && $revisions->getNumRows() > 0;
 
                $titleObj = SpecialPage::getTitleFor( "Mergehistory" );
-               $action = $titleObj->getLocalURL( "action=submit" );
+               $action = $titleObj->getLocalURL( array( 'action' => 'submit' ) );
                # Start the form here
                $top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'merge' ) );
                $wgOut->addHTML( $top );
@@ -163,27 +163,22 @@ class MergehistoryForm {
                if( $haveRevisions ) {
                        # Format the user-visible controls (comment field, submission button)
                        # in a nice little table
-                       $align = $wgContLang->isRtl() ? 'left' : 'right';
                        $table =
                                Xml::openElement( 'fieldset' ) .
-                               Xml::openElement( 'table' ) .
+                               wfMsgExt( 'mergehistory-merge', array('parseinline'),
+                                       $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText() ) .
+                               Xml::openElement( 'table', array( 'id' => 'mw-mergehistory-table' ) ) .
                                        "<tr>
-                                               <td colspan='2'>" .
-                                                       wfMsgExt( 'mergehistory-merge', array('parseinline'),
-                                                               $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText() ) .
+                                               <td class='mw-label'>" .
+                                                       Xml::label( wfMsg( 'mergehistory-reason' ), 'wpComment' ) .
                                                "</td>
-                                       </tr>
-                                       <tr>
-                                               <td align='$align'>" .
-                                                       Xml::label( wfMsg( 'undeletecomment' ), 'wpComment' ) .
-                                               "</td>
-                                               <td>" .
-                                                       Xml::input( 'wpComment', 50, $this->mComment ) .
+                                               <td class='mw-input'>" .
+                                                       Xml::input( 'wpComment', 50, $this->mComment, array('id' => 'wpComment') ) .
                                                "</td>
                                        </tr>
                                        <tr>
                                                <td>&nbsp;</td>
-                                               <td>" .
+                                               <td class='mw-submit'>" .
                                                        Xml::submitButton( wfMsg( 'mergehistory-submit' ), array( 'name' => 'merge', 'id' => 'mw-merge-submit' ) ) .
                                                "</td>
                                        </tr>" .
@@ -223,7 +218,7 @@ class MergehistoryForm {
        }
 
        function formatRevisionRow( $row ) {
-               global $wgUser, $wgLang;
+               global $wgLang;
 
                $rev = new Revision( $row );
 
@@ -233,8 +228,12 @@ class MergehistoryForm {
                $ts = wfTimestamp( TS_MW, $row->rev_timestamp );
                $checkBox = Xml::radio( "mergepoint", $ts, false );
 
-               $pageLink = $this->sk->makeKnownLinkObj( $rev->getTitle(),
-                       htmlspecialchars( $wgLang->timeanddate( $ts ) ), 'oldid=' . $rev->getId() );
+               $pageLink = $this->sk->linkKnown(
+                       $rev->getTitle(),
+                       htmlspecialchars( $wgLang->timeanddate( $ts ) ),
+                       array(),
+                       array( 'oldid' => $rev->getId() )
+               );
                if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
                        $pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
                }
@@ -243,8 +242,15 @@ class MergehistoryForm {
                if( !$rev->userCan( Revision::DELETED_TEXT ) )
                        $last = $this->message['last'];
                else if( isset($this->prevId[$row->rev_id]) )
-                       $last = $this->sk->makeKnownLinkObj( $rev->getTitle(), $this->message['last'],
-                               "diff=" . $row->rev_id . "&oldid=" . $this->prevId[$row->rev_id] );
+                       $last = $this->sk->linkKnown(
+                               $rev->getTitle(),
+                               $this->message['last'],
+                               array(),
+                               array(
+                                       'diff' => $row->rev_id,
+                                       'oldid' => $this->prevId[$row->rev_id]
+                               )
+                       );
 
                $userLink = $this->sk->revUserTools( $rev );
 
@@ -266,8 +272,15 @@ class MergehistoryForm {
                if( !$this->userCan($row, Revision::DELETED_TEXT) ) {
                        return '<span class="history-deleted">' . $wgLang->timeanddate( $ts, true ) . '</span>';
                } else {
-                       $link = $this->sk->makeKnownLinkObj( $titleObj,
-                               $wgLang->timeanddate( $ts, true ), "target=$target&timestamp=$ts" );
+                       $link = $this->sk->linkKnown(
+                               $titleObj,
+                               $wgLang->timeanddate( $ts, true ),
+                               array(),
+                               array(
+                                       'target' => $target,
+                                       'timestamp' => $ts
+                               )
+                       );
                        if( $this->isDeleted($row, Revision::DELETED_TEXT) )
                                $link = '<span class="history-deleted">' . $link . '</span>';
                        return $link;
@@ -275,7 +288,7 @@ class MergehistoryForm {
        }
 
        function merge() {
-               global $wgOut, $wgUser;
+               global $wgOut;
                # Get the titles directly from the IDs, in case the target page params
                # were spoofed. The queries are done based on the IDs, so it's best to
                # keep it consistent...
@@ -439,7 +452,7 @@ class MergeHistoryPager extends ReverseChronologicalPager {
                return array(
                        'tables' => array('revision','page'),
                        'fields' => array( 'rev_minor_edit', 'rev_timestamp', 'rev_user', 'rev_user_text', 'rev_comment',
-                                'rev_id', 'rev_page', 'rev_text_id', 'rev_len', 'rev_deleted' ),
+                                'rev_id', 'rev_page', 'rev_parent_id', 'rev_text_id', 'rev_len', 'rev_deleted' ),
                        'conds' => $conds
                );
        }