Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -3207,6 +3207,15 @@ |
3208 | 3208 | 'ajax-error-dismiss', |
3209 | 3209 | 'ajax-remove-category-error', |
3210 | 3210 | ), |
| 3211 | + 'comparepages' => array( |
| 3212 | + 'comparepages'. |
| 3213 | + 'compare-selector', |
| 3214 | + 'compare-page1', |
| 3215 | + 'compare-page2', |
| 3216 | + 'compare-rev1', |
| 3217 | + 'compare-rev2', |
| 3218 | + 'compare-submit', |
| 3219 | + ), |
3211 | 3220 | ); |
3212 | 3221 | |
3213 | 3222 | /** Comments for each block */ |
— | — | @@ -3417,4 +3426,5 @@ |
3418 | 3427 | 'db-error-messages' => 'Database error messages', |
3419 | 3428 | 'html-forms' => 'HTML forms', |
3420 | 3429 | 'ajax-category' => 'Add categories per AJAX', |
| 3430 | + 'comparepages' => 'Special:ComparePages', |
3421 | 3431 | ); |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -577,6 +577,7 @@ |
578 | 578 | 'SpecialAllpages' => 'includes/specials/SpecialAllpages.php', |
579 | 579 | 'SpecialBlankpage' => 'includes/specials/SpecialBlankpage.php', |
580 | 580 | 'SpecialBookSources' => 'includes/specials/SpecialBooksources.php', |
| 581 | + 'SpecialComparePages' => 'includes/specials/SpecialComparePages.php', |
581 | 582 | 'SpecialExport' => 'includes/specials/SpecialExport.php', |
582 | 583 | 'SpecialImport' => 'includes/specials/SpecialImport.php', |
583 | 584 | 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php', |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -4635,6 +4635,7 @@ |
4636 | 4636 | 'Search' => 'redirects', |
4637 | 4637 | 'LinkSearch' => 'redirects', |
4638 | 4638 | |
| 4639 | + 'ComparePages' => 'pagetools', |
4639 | 4640 | 'Movepage' => 'pagetools', |
4640 | 4641 | 'MergeHistory' => 'pagetools', |
4641 | 4642 | 'Revisiondelete' => 'pagetools', |
Index: trunk/phase3/includes/specials/SpecialComparePages.php |
— | — | @@ -0,0 +1,150 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * implements Special:ComparePages |
| 6 | + * @ingroup SpecialPage |
| 7 | + */ |
| 8 | +class SpecialComparePages extends SpecialPage { |
| 9 | + |
| 10 | + // Stored objects |
| 11 | + protected $opts, $skin; |
| 12 | + |
| 13 | + // Some internal settings |
| 14 | + protected $showNavigation = false; |
| 15 | + |
| 16 | + public function __construct() { |
| 17 | + parent::__construct( 'ComparePages' ); |
| 18 | + $this->includable( false ); |
| 19 | + } |
| 20 | + |
| 21 | + protected function setup( $par ) { |
| 22 | + global $wgRequest, $wgUser, $wgEnableNewpagesUserFilter; |
| 23 | + |
| 24 | + // Options |
| 25 | + $opts = new FormOptions(); |
| 26 | + $this->opts = $opts; // bind |
| 27 | + $opts->add( 'page1', '' ); |
| 28 | + $opts->add( 'page2', '' ); |
| 29 | + $opts->add( 'rev1', '' ); |
| 30 | + $opts->add( 'rev2', '' ); |
| 31 | + $opts->add( 'action', '' ); |
| 32 | + $opts->add( 'diffonly', '' ); |
| 33 | + |
| 34 | + // Set values |
| 35 | + $opts->fetchValuesFromRequest( $wgRequest ); |
| 36 | + |
| 37 | + $title1 = Title::newFromText( $opts->getValue( 'page1' ) ); |
| 38 | + $title2 = Title::newFromText( $opts->getValue( 'page2' ) ); |
| 39 | + |
| 40 | + if( $title1 && $title1->exists() && $opts->getValue( 'rev1' ) == '' ) { |
| 41 | + $pda = new Article( $title1 ); |
| 42 | + $pdi = $pda->getID(); |
| 43 | + $pdLastRevision = Revision::loadFromPageId( wfGetDB( DB_SLAVE ), $pdi ); |
| 44 | + $opts->setValue('rev1', $pdLastRevision->getId() ); |
| 45 | + } elseif ( $opts->getValue( 'rev1' ) != '' ) { |
| 46 | + $pdrev = Revision::newFromId( $opts->getValue( 'rev1' ) ); |
| 47 | + if( $pdrev ) $opts->setValue( 'page1', $pdrev->getTitle()->getPrefixedDBkey() ); |
| 48 | + } |
| 49 | + if( $title2 && $title2->exists() && $opts->getValue( 'rev2' ) == '' ) { |
| 50 | + $pda = new Article( $title2 ); |
| 51 | + $pdi = $pda->getID(); |
| 52 | + $pdLastRevision = Revision::loadFromPageId( wfGetDB( DB_SLAVE ), $pdi ); |
| 53 | + $opts->setValue('rev2', $pdLastRevision->getId() ); |
| 54 | + } elseif ( $opts->getValue( 'rev2' ) != '' ) { |
| 55 | + $pdrev = Revision::newFromId( $opts->getValue( 'rev2' ) ); |
| 56 | + if( $pdrev ) $opts->setValue( 'page2', $pdrev->getTitle()->getPrefixedDBkey() ); |
| 57 | + } |
| 58 | + |
| 59 | + // Store some objects |
| 60 | + $this->skin = $wgUser->getSkin(); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Show a form for filtering namespace and username |
| 65 | + * |
| 66 | + * @param $par String |
| 67 | + * @return String |
| 68 | + */ |
| 69 | + public function execute( $par ) { |
| 70 | + global $wgLang, $wgOut; |
| 71 | + |
| 72 | + $this->setHeaders(); |
| 73 | + $this->outputHeader(); |
| 74 | + |
| 75 | + $this->setup( $par ); |
| 76 | + |
| 77 | + // Settings |
| 78 | + $this->form(); |
| 79 | + |
| 80 | + if( $this->opts->getValue( 'rev1' ) && $this->opts->getValue( 'rev2' ) ) { |
| 81 | + $de = new DifferenceEngine( null, |
| 82 | + $this->opts->getValue( 'rev1' ), |
| 83 | + $this->opts->getValue( 'rev2' ), |
| 84 | + null, // rcid |
| 85 | + ($this->opts->getValue( 'action') == "purge" ? true : false ), |
| 86 | + false ); |
| 87 | + $de->showDiffPage( (bool)$this->opts->getValue( 'diffonly' ) ); |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + protected function form() { |
| 92 | + global $wgOut, $wgScript; |
| 93 | + |
| 94 | + // Consume values |
| 95 | + $page1 = $this->opts->consumeValue( 'page1' ); |
| 96 | + $page2 = $this->opts->consumeValue( 'page2' ); |
| 97 | + $rev1 = $this->opts->consumeValue( 'rev1' ); |
| 98 | + $rev2 = $this->opts->consumeValue( 'rev2' ); |
| 99 | + |
| 100 | + // Store query values in hidden fields so that form submission doesn't lose them |
| 101 | + $hidden = array(); |
| 102 | + foreach ( $this->opts->getUnconsumedValues() as $key => $value ) { |
| 103 | + $hidden[] = Xml::hidden( $key, $value ); |
| 104 | + } |
| 105 | + $hidden = implode( "\n", $hidden ); |
| 106 | + |
| 107 | + $form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . |
| 108 | + Xml::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . |
| 109 | + Xml::fieldset( wfMsg( 'compare-selector') ) . |
| 110 | + Xml::openElement( 'table', array( 'id' => 'mw-diff-table', 'width' => '100%' ) ) . |
| 111 | + "<tr> |
| 112 | + <td class='mw-label' width='10%'>" . |
| 113 | + Xml::label( wfMsg( 'compare-page1' ), 'page1' ) . |
| 114 | + "</td> |
| 115 | + <td class='mw-input' width='40%'>" . |
| 116 | + Xml::input( 'page1', 40, $page1, array( 'type' => 'text' ) ) . |
| 117 | + "</td> |
| 118 | + <td class='mw-label' width='10%'>" . |
| 119 | + Xml::label( wfMsg( 'compare-page2' ), 'page2' ) . |
| 120 | + "</td> |
| 121 | + <td class='mw-input' width='40%'>" . |
| 122 | + Xml::input( 'page2', 40, $page2, array( 'type' => 'text' ) ) . |
| 123 | + "</td> |
| 124 | + </tr>" . |
| 125 | + "<tr> |
| 126 | + <td class='mw-label'>" . |
| 127 | + Xml::label( wfMsg( 'compare-rev1' ), 'rev1' ) . |
| 128 | + "</td> |
| 129 | + <td class='mw-input'>" . |
| 130 | + Xml::input( 'rev1', 8, $rev1, array( 'type' => 'text' ) ) . |
| 131 | + "</td> |
| 132 | + <td class='mw-label'>" . |
| 133 | + Xml::label( wfMsg( 'compare-rev2' ), 'rev2' ) . |
| 134 | + "</td> |
| 135 | + <td class='mw-input'>" . |
| 136 | + Xml::input( 'rev2', 8, $rev2, array( 'type' => 'text' ) ) . |
| 137 | + "</td> |
| 138 | + </tr>" . |
| 139 | + "<tr> <td></td> |
| 140 | + <td class='mw-submit' colspan='3'>" . |
| 141 | + Xml::submitButton( wfMsg( 'compare-submit') ) . |
| 142 | + "</td> |
| 143 | + </tr>" . |
| 144 | + Xml::closeElement( 'table' ) . |
| 145 | + Xml::closeElement( 'fieldset' ) . |
| 146 | + $hidden . |
| 147 | + Xml::closeElement( 'form' ); |
| 148 | + |
| 149 | + $wgOut->addHTML( $form ); |
| 150 | + } |
| 151 | +} |
Property changes on: trunk/phase3/includes/specials/SpecialComparePages.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 152 | + native |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -169,6 +169,7 @@ |
170 | 170 | 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ), |
171 | 171 | |
172 | 172 | # Page tools |
| 173 | + 'ComparePages' => 'SpecialComparePages', |
173 | 174 | 'Export' => 'SpecialExport', |
174 | 175 | 'Import' => 'SpecialImport', |
175 | 176 | 'Undelete' => 'UndeleteForm', |
Index: trunk/phase3/languages/messages/MessagesQqq.php |
— | — | @@ -3613,6 +3613,15 @@ |
3614 | 3614 | |
3615 | 3615 | * <code>$1</code> is the number of changes marked with the tag', |
3616 | 3616 | |
| 3617 | +# Special:ComparePages |
| 3618 | +'comparepages' => 'The title of [[Special:ComparePages]]', |
| 3619 | +'compare-selector' => 'Header of the form on [[Special:ComparePages]]', |
| 3620 | +'compare-page1' => 'Label for the field of the 1st page in the comparison for [[Special:ComparePages]]', |
| 3621 | +'compare-page2' => 'Label for the field of the 2nd page in the comparison for [[Special:ComparePages]]', |
| 3622 | +'compare-rev1' => 'Label for the field of the 1st revision in the comparison for [[Special:ComparePages]]', |
| 3623 | +'compare-rev2' => 'Label for the field of the 2nd revision in the comparison for [[Special:ComparePages]]', |
| 3624 | +'compare-submit' => 'Submit button on [[Special:ComparePages]]', |
| 3625 | + |
3617 | 3626 | # Database error messages |
3618 | 3627 | 'dberr-header' => 'This message does not allow any wiki nor html markup.', |
3619 | 3628 | 'dberr-problems' => 'This message does not allow any wiki nor html markup.', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -457,6 +457,7 @@ |
458 | 458 | 'Tags' => array( 'Tags' ), |
459 | 459 | 'Activeusers' => array( 'ActiveUsers' ), |
460 | 460 | 'RevisionMove' => array( 'RevisionMove' ), |
| 461 | + 'ComparePages' => array( 'ComparePages' ), |
461 | 462 | ); |
462 | 463 | |
463 | 464 | /** |
— | — | @@ -4286,6 +4287,15 @@ |
4287 | 4288 | 'tags-edit' => 'edit', |
4288 | 4289 | 'tags-hitcount' => '$1 {{PLURAL:$1|change|changes}}', |
4289 | 4290 | |
| 4291 | +# Special:ComparePAges |
| 4292 | +'comparepages' => 'Compare pages', |
| 4293 | +'compare-selector' => 'Compare page revisions', |
| 4294 | +'compare-page1' => 'Page 1', |
| 4295 | +'compare-page2' => 'Page 2', |
| 4296 | +'compare-rev1' => 'Revision 1', |
| 4297 | +'compare-rev2' => 'Revision 2', |
| 4298 | +'compare-submit' => 'Compare', |
| 4299 | + |
4290 | 4300 | # Database error messages |
4291 | 4301 | 'dberr-header' => 'This wiki has a problem', |
4292 | 4302 | 'dberr-problems' => 'Sorry! |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -83,6 +83,7 @@ |
84 | 84 | * Show validity period of the login cookie in Special:UserLogin and |
85 | 85 | Special:Preferences |
86 | 86 | * Interlanguage links display the page title in their tooltip. |
| 87 | +* (bug 23621) New Special:ComparePages to compare (diff) two articles. |
87 | 88 | |
88 | 89 | === Bug fixes in 1.17 === |
89 | 90 | * (bug 17560) Half-broken deletion moved image files to deletion archive |