Ticket #1837: 1837_5.patch

File 1837_5.patch, 4.2 KB (added by Artur Formella, 11 years ago)
  • FCKeditor.body.php

     
    283283                global $wgFCKEditorExtDir, $wgFCKEditorDir, $wgFCKEditorHeight, $wgUser;
    284284                global $wgStylePath, $wgStyleVersion, $wgDefaultSkin, $wgExtensionFunctions;
    285285                global $wgFCKWikiTextBeforeParse;
     286                global $wgHooks;
    286287
    287288                if (!isset($this->showFCKEditor))
    288289                {
     
    361362                if (!empty($userStyles)) {
    362363                        $script .= 'sEditorAreaCSS += ",'.implode(',', $userStyles).'";';
    363364                }
     365               
     366                $showRef = false;
     367                if (isset ($wgHooks['ParserFirstCallInit']) && (in_array('wfCite',$wgHooks['ParserFirstCallInit']) )){
     368                        $showRef = true;
     369                }else if (isset ($wgExtensionFunctions) && (in_array('wfCite',$wgExtensionFunctions) )){
     370                        $showRef = true;
     371                }
     372
    364373                $script .= '
    365374var showFCKEditor = '. $this->showFCKEditor .';
    366375var popup = false;              //pointer to popup document
     
    382391oFCKeditor.Config["EditorAreaCSS"] = "'.$wgScriptPath.'/'.$wgFCKEditorExtDir.'/css/fckeditor.css" ;
    383392oFCKeditor.ToolbarSet = "'. $wgFCKEditorToolbarSet .'" ;
    384393oFCKeditor.ready = true;
     394oFCKeditor.Config["showreferences"] = '.(($showRef)?'true':'false').';
    385395';
    386396                $script .= '</script>';
    387397               
  • fckeditor_config.js

     
    1212        ['Cut','Copy','Paste',/*'PasteText','PasteWord',*/'-','Print'],
    1313        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
    1414        ['SpecialChar','Table','Image','Rule'],
    15         ['MW_Template','MW_Special','MW_Ref','MW_Math'],
     15        ['MW_Template','MW_Special','MW_Ref','MW_References','MW_Math'],
    1616        '/',
    1717        ['FontFormat'],
    1818        ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
  • plugins/mediawiki/fckplugin.js

     
    3636tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_template.gif' ;
    3737FCKToolbarItems.RegisterItem( 'MW_Template', tbButton ) ;
    3838
    39 tbButton = new FCKToolbarButton( 'MW_Ref', 'Reference', FCKLang.wikiBtnReference || 'Insert/Edit Reference' ) ;
     39//Ref button
     40tbButton = new FCKToolbarButton( 'MW_Ref', 'Ref', FCKLang.wikiBtnReference || 'Insert/Edit Reference',FCK_TOOLBARITEM_ICONTEXT ) ;
    4041tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_ref.gif' ;
     42if ( !FCKConfig.showreferences ) {              //hack to disable MW_Ref  button
     43        tbButton.Create = function()            {return 0;}
     44        tbButton.Disable  = function()  {return 0;}
     45}
    4146FCKToolbarItems.RegisterItem( 'MW_Ref', tbButton ) ;
    4247
     48
     49//References button
     50var FCKReferences = function( ) {       } ;
     51FCKReferences.prototype.GetState = function()   { return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED) } ;
     52FCKCommands.RegisterCommand( 'MW_References', new FCKReferences() ) ;
     53tbButton = new FCKToolbarButton( 'MW_References', 'References', 'Insert <references /> tag', FCK_TOOLBARITEM_ICONTEXT,true, true, 1  );
     54tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_ref.gif' ;
     55if ( !FCKConfig.showreferences ) {              //hack to disable MW_References  button
     56        tbButton.Create = function()            {return 0;}
     57        tbButton.Disable  = function()  {return 0;}
     58}
     59
     60FCKReferences.prototype.Execute = function()
     61{
     62        if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
     63                return ;
     64       
     65        FCKUndo.SaveUndoStep() ;
     66
     67        var e = FCK.EditorDocument.createElement( 'span' ) ;
     68        e.setAttribute("_fck_mw_customtag", "true");
     69        e.setAttribute("_fck_mw_tagname", "references");
     70        e.className = "fck_mw_references";
     71       
     72        oFakeImage = FCK.InsertElement( FCKDocumentProcessor_CreateFakeImage( 'FCK__MWReferences', e ) ) ;
     73}
     74FCKToolbarItems.RegisterItem( 'MW_References', tbButton ) ;
     75
     76
    4377tbButton = new FCKToolbarButton( 'MW_Math', 'Formula', FCKLang.wikiBtnFormula || 'Insert/Edit Formula' ) ;
    4478tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_math.gif' ;
    4579FCKToolbarItems.RegisterItem( 'MW_Math', tbButton ) ;
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy