Ticket #1385: fix_for_1385_when_undo_can_be_performed.patch

File fix_for_1385_when_undo_can_be_performed.patch, 1.8 KB (added by Doru Moisa, 16 years ago)

a fix for the showDiff() function called when the undo can be performed, when the needed hook is never called

  • FCKeditorEditPage.body.php

     
    77         *
    88         * @return bool
    99         */
     10       
     11        public function FCKeditorEditPage( $article ){
     12                parent::EditPage( $article );
     13        }
     14       
    1015        public function previewOnOpen() {
    1116                global $wgRequest, $wgUser;
    1217                if( $wgRequest->getVal( 'preview' ) == 'yes' ) {
     
    4045                }
    4146                return $result;
    4247        }
     48        function getContent( $def_text = '' ) {
     49                $t = parent::getContent( $def_text );
     50                if(!$this->isConflict) return $t;
     51                $options = new FCKeditorParserOptions();
     52                $options->setTidy(true);
     53                $parser = new FCKeditorParser();
     54                $parser->setOutputType(OT_HTML);
     55                $pa = $parser->parse($t, $this->mTitle, $options);
     56                return $pa->mText;
     57               
     58        }
     59        function getWikiContent(){
     60                return $this->mArticle->getContent();
     61        }
     62        function showDiff(){
     63                global $wgRequest;
     64               
     65                $oldtext = $this->mArticle->fetchContent();
     66                $newtext = $wgRequest->getVal( 'wpTextbox1' );
     67               
     68                if($newtext == null) {
     69                        $rev_id = $wgRequest->getVal( 'undoafter' );
     70                        if($rev_id != null){
     71                                $revision = Revision::newFromId( $rev_id );
     72                                $newtext = $revision->getText();
     73                        }
     74                        else {
     75                                return parent::showDiff();
     76                        }
     77                       
     78                }
     79                $oldtitle = wfMsgExt( 'currentrev', array('parseinline') );
     80                $newtitle = wfMsgExt( 'yourtext', array('parseinline') );
     81
     82                if ( $oldtext !== false  || $newtext != '' ) {
     83                        $de = new DifferenceEngine( $this->mTitle );
     84                        $de->setText( $oldtext, $newtext );
     85                        $difftext = $de->getDiff( $oldtitle, $newtitle );
     86                        $de->showDiffStyle();
     87                } else {
     88                        $difftext = '';
     89                }
     90
     91                global $wgOut;
     92                $wgOut->addHtml( '<div id="wikiDiff">' . $difftext . '</div>' );
     93        }
    4394}
     95 No newline at end of file
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy