Changeset 1834 for MediaWiki/trunk

Show
Ignore:
Timestamp:
2008-03-28 16:56:36 (5 months ago)
Author:
wwalc
Message:

Fix for #1437. MW Special Tags.

Location:
MediaWiki/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • MediaWiki/trunk/fckeditor_config.js

    r1660 r1834  
    1313        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], 
    1414        ['SpecialChar','Table','Image','Rule'], 
    15         ['MW_Template','MW_Ref','MW_Math'], 
     15        ['MW_Template','MW_Special','MW_Ref','MW_Math'], 
    1616        '/', 
    1717        ['FontFormat'], 
     
    3737 
    3838FCKConfig.EditorAreaStyles = '\ 
    39 .FCK__MWTemplate \ 
     39.FCK__MWTemplate, .FCK__MWRef, .FCK__MWSpecial, .FCK__MWReferences, .FCK__MWNowiki, .FCK__MWIncludeonly, .FCK__MWNoinclude, .FCK__MWOnlyinclude \ 
    4040{ \ 
    4141        border: 1px dotted #00F; \ 
    4242        background-position: center center; \ 
     43        background-repeat: no-repeat; \ 
     44        vertical-align: middle; \ 
     45} \ 
     46.FCK__MWTemplate, \ 
     47{ \ 
    4348        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_template.gif); \ 
    44         background-repeat: no-repeat; \ 
    4549        width: 20px; \ 
    4650        height: 15px; \ 
    47         vertical-align: middle; \ 
    4851} \ 
    4952.FCK__MWRef \ 
    5053{ \ 
    51         border: 1px dotted #00F; \ 
    52         background-position: center center; \ 
    5354        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_ref.gif); \ 
    54         background-repeat: no-repeat; \ 
    5555        width: 18px; \ 
    5656        height: 15px; \ 
    57         vertical-align: middle; \ 
     57} \ 
     58.FCK__MWSpecial \ 
     59{ \ 
     60        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_special.gif); \ 
     61        width: 66px; \ 
     62        height: 15px; \ 
     63} \ 
     64.FCK__MWNowiki \ 
     65{ \ 
     66        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_nowiki.gif); \ 
     67        width: 66px; \ 
     68        height: 15px; \ 
     69} \ 
     70.FCK__MWIncludeonly \ 
     71{ \ 
     72        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_includeonly.gif); \ 
     73        width: 66px; \ 
     74        height: 15px; \ 
     75} \ 
     76.FCK__MWNoinclude \ 
     77{ \ 
     78        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_noinclude.gif); \ 
     79        width: 66px; \ 
     80        height: 15px; \ 
     81} \ 
     82.FCK__MWOnlyinclude \ 
     83{ \ 
     84        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_onlyinclude.gif); \ 
     85        width: 66px; \ 
     86        height: 15px; \ 
    5887} \ 
    5988.FCK__MWReferences \ 
    6089{ \ 
    61         border: 1px dotted #00F; \ 
    62         background-position: center center; \ 
    6390        background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_references.gif); \ 
    64         background-repeat: no-repeat; \ 
    6591        width: 66px; \ 
    6692        height: 15px; \ 
    67         vertical-align: middle; \ 
    6893} \ 
    6994' ; 
  • MediaWiki/trunk/FCKeditorParser.body.php

    r1829 r1834  
    4747                $key = 'Fckmw'.$this->fck_mw_strtr_span_counter.'fckmw'; 
    4848                $this->fck_mw_strtr_span_counter++; 
    49                 $this->fck_mw_strtr_span[$key] = $text; 
     49                $this->fck_mw_strtr_span[$key] = str_replace(array("\r\n", "\n", "\r"),"fckLR",$text); 
    5050                return $key; 
    5151        } 
     
    5959        */ 
    6060        function fck_genericTagHook( $str, $argv, $parser ) { 
     61                if (in_array($this->fck_mw_taghook, array("ref", "math", "references"))) { 
     62                        $class = $this->fck_mw_taghook; 
     63                } 
     64                else { 
     65                        $class = "special"; 
     66                } 
     67                 
    6168                if (empty($argv)) { 
    62                         $ret = "<span class=\"fck_mw_".$this->fck_mw_taghook."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\">"; 
     69                        $ret = "<span class=\"fck_mw_".$class."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\">"; 
    6370                } 
    6471                else { 
    65                         $ret = "<span class=\"fck_mw_".$this->fck_mw_taghook."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\""; 
     72                        $ret = "<span class=\"fck_mw_".$class."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\""; 
    6673                        foreach ($argv as $key=>$value) { 
    6774                                $ret .= " ".$key."=\"".$value."\""; 
     
    9198        function fck_wikiTag( $tagName, $str, $argv = array()) { 
    9299                if (empty($argv)) { 
    93                         $ret = "<span class=\"fck_mw_".$tagName."\">"; 
     100                        $ret = "<span class=\"fck_mw_".$tagName."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$tagName."\">"; 
    94101                } 
    95102                else { 
    96                         $ret = "<span class=\"fck_mw_".$tagName."\""; 
     103                        $ret = "<span class=\"fck_mw_".$tagName."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$tagName."\">"; 
    97104                        foreach ($argv as $key=>$value) { 
    98105                                $ret .= " ".$key."=\"".$value."\""; 
  • MediaWiki/trunk/FCKeditor.php

    r1829 r1834  
    6969$wgAjaxExportList[] = 'wfSajaxGetMathUrl'; 
    7070$wgAjaxExportList[] = 'wfSajaxSearchTemplateFCKeditor'; 
     71$wgAjaxExportList[] = 'wfSajaxSearchSpecialTagFCKeditor'; 
    7172 
    7273$wgExtensionCredits['other'][] = array( 
  • MediaWiki/trunk/FCKeditorSajax.body.php

    r1829 r1834  
    3737 
    3838        return $url; 
     39} 
     40 
     41function wfSajaxSearchSpecialTagFCKeditor($empty) 
     42{ 
     43        global $wgParser; 
     44 
     45        $ret = "nowiki\nincludeonly\nonlyinclude\nnoinclude\n"; 
     46        foreach ($wgParser->getTags() as $h) { 
     47                if (!in_array($h, array("pre", "math", "ref", "references"))) { 
     48                        $ret .= $h ."\n"; 
     49                } 
     50        } 
     51        return $ret; 
    3952} 
    4053 
  • MediaWiki/trunk/mw12/FCKeditorParser_OldPP.body.php

    r1829 r1834  
    4747                $key = 'Fckmw'.$this->fck_mw_strtr_span_counter.'fckmw'; 
    4848                $this->fck_mw_strtr_span_counter++; 
    49                 $this->fck_mw_strtr_span[$key] = $text; 
     49                $this->fck_mw_strtr_span[$key] = str_replace(array("\r\n", "\n", "\r"),"fckLR",$text); 
    5050                return $key; 
    5151        } 
     
    5959        */ 
    6060        function fck_genericTagHook( $str, $argv, $parser ) { 
     61                if (in_array($this->fck_mw_taghook, array("ref", "math", "references"))) { 
     62                        $class = $this->fck_mw_taghook; 
     63                } 
     64                else { 
     65                        $class = "special"; 
     66                } 
     67                 
    6168                if (empty($argv)) { 
    62                         $ret = "<span class=\"fck_mw_".$this->fck_mw_taghook."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\">"; 
     69                        $ret = "<span class=\"fck_mw_".$class."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\">"; 
    6370                } 
    6471                else { 
    65                         $ret = "<span class=\"fck_mw_".$this->fck_mw_taghook."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\""; 
     72                        $ret = "<span class=\"fck_mw_".$class."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$this->fck_mw_taghook."\""; 
    6673                        foreach ($argv as $key=>$value) { 
    6774                                $ret .= " ".$key."=\"".$value."\""; 
     
    9198        function fck_wikiTag( $tagName, $str, $argv = array()) { 
    9299                if (empty($argv)) { 
    93                         $ret = "<span class=\"fck_mw_".$tagName."\">"; 
     100                        $ret = "<span class=\"fck_mw_".$tagName."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$tagName."\">"; 
    94101                } 
    95102                else { 
    96                         $ret = "<span class=\"fck_mw_".$tagName."\""; 
     103                        $ret = "<span class=\"fck_mw_".$tagName."\" _fck_mw_customtag=\"true\" _fck_mw_tagname=\"".$tagName."\">"; 
    97104                        foreach ($argv as $key=>$value) { 
    98105                                $ret .= " ".$key."=\"".$value."\""; 
  • MediaWiki/trunk/plugins/mediawiki/fckplugin.js

    r1832 r1834  
    4545FCKToolbarItems.RegisterItem( 'MW_Math', tbButton ) ; 
    4646 
     47tbButton = new FCKToolbarButton( 'MW_Special', 'Special Tag', 'Insert/Edit Special Tag' ) ; 
     48tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_special.gif' ; 
     49FCKToolbarItems.RegisterItem( 'MW_Special', tbButton ) ; 
     50 
    4751// Override some dialogs. 
    4852FCKCommands.RegisterCommand( 'MW_Template', new FCKDialogCommand( 'MW_Template', 'Template Properties', FCKConfig.PluginsPath + 'mediawiki/dialogs/template.html', 400, 330 ) ) ; 
    4953FCKCommands.RegisterCommand( 'MW_Ref', new FCKDialogCommand( 'MW_Ref', 'Reference Properties', FCKConfig.PluginsPath + 'mediawiki/dialogs/ref.html', 400, 250 ) ) ; 
    5054FCKCommands.RegisterCommand( 'MW_Math', new FCKDialogCommand( 'MW_Math', 'Formula', FCKConfig.PluginsPath + 'mediawiki/dialogs/math.html', 400, 300 ) ) ; 
     55FCKCommands.RegisterCommand( 'MW_Special', new FCKDialogCommand( 'MW_Special', 'Special Tag Properties', FCKConfig.PluginsPath + 'mediawiki/dialogs/special.html', 400, 330 ) ) ; //YC 
    5156FCKCommands.RegisterCommand( 'Link', new FCKDialogCommand( 'Link', FCKLang.DlgLnkWindowTitle, FCKConfig.PluginsPath + 'mediawiki/dialogs/link.html', 400, 250 ) ) ; 
    5257FCKCommands.RegisterCommand( 'Image', new FCKDialogCommand( 'Image', FCKLang.DlgImgTitle, FCKConfig.PluginsPath + 'mediawiki/dialogs/image.html', 450, 300 ) ) ; 
     58 
    5359 
    5460// MediaWiki Wikitext Data Processor implementation. 
     
    452458                                                                case 'fck_mw_onlyinclude' : 
    453459                                                                        sNodeName = 'onlyinclude' ; 
     460                                                                         
    454461                                                                        break ; 
    455462                                                        } 
     
    517524                                var parentIsSpecialTag = htmlNode.parentNode.getAttribute( '_fck_mw_customtag' ) ;  
    518525                                var textValue = htmlNode.nodeValue; 
    519  
     526         
    520527                                if ( !parentIsSpecialTag )  
    521528                                { 
    522529                                        textValue = textValue.replace( /[\n\t]/g, ' ' ) ;  
     530         
    523531                                        textValue = FCKTools.HTMLEncode( textValue ) ; 
    524532                                        textValue = textValue.replace( /\u00A0/g, '&nbsp;' ) ; 
     
    537545                                        if ( this._inLSpace && textValue.length == 1 && textValue.charCodeAt(0) == 13 ) 
    538546                                                textValue = textValue + " " ; 
    539                                          
    540547                                        if ( this._IsInsideCell ) 
    541548                                                textValue = textValue.replace( /\|/g, '&#124;' ) ; 
    542  
    543549                                } 
    544550                                else  
    545                                 { 
    546                                         textValue = FCKTools.HTMLDecode( textValue ) ; 
     551                                {                                        
     552                                        textValue = FCKTools.HTMLDecode(textValue).replace(/fckLR/g,'\r\n'); 
    547553                                } 
    548  
     554                                 
    549555                                stringBuilder.push( textValue ) ; 
    550556                                return ; 
     
    676682                                        className = 'FCK__MWReferences' ; 
    677683                        case 'fck_mw_template' : 
     684                                if ( className == null ) //YC 
     685                                        className = 'FCK__MWTemplate' ; //YC 
    678686                        case 'fck_mw_magic' : 
    679687                                if ( className == null ) 
    680                                         className = 'FCK__MWTemplate' ; 
    681  
     688                                        className = 'FCK__MWMagicWord' ; 
     689                        case 'fck_mw_magic' : 
     690                                if ( className == null ) 
     691                                        className = 'FCK__MWMagicWord' ; 
     692                        case 'fck_mw_special' : //YC 
     693                                if ( className == null ) 
     694                                        className = 'FCK__MWSpecial' ; 
     695                        case 'fck_mw_nowiki' : 
     696                                if ( className == null ) 
     697                                        //className = 'FCK__MWSpecial' ; 
     698                                        className = 'FCK__MWNowiki' ; 
     699                        case 'fck_mw_includeonly' : 
     700                                if ( className == null ) 
     701                                        //className = 'FCK__MWSpecial' ; 
     702                                        className = 'FCK__MWIncludeonly' ; 
     703                        case 'fck_mw_noinclude' : 
     704                                if ( className == null ) 
     705                                        //className = 'FCK__MWSpecial' ; 
     706                                        className = 'FCK__MWNoinclude' ; 
     707                        case 'fck_mw_onlyinclude' : 
     708                                if ( className == null ) 
     709                                        //className = 'FCK__MWSpecial' ; 
     710                                        className = 'FCK__MWOnlyinclude' ; 
     711                                         
    682712                                var oImg = FCKDocumentProcessor_CreateFakeImage( className, eSpan.cloneNode(true) ) ; 
    683713                                oImg.setAttribute( '_' + eSpan.className, 'true', 0 ) ; 
     
    716746                                contextMenu.AddItem( 'MW_Math', 'Edit Formula' ) ; 
    717747                        } 
     748                        if ( tag.getAttribute( '_fck_mw_special' ) || tag.getAttribute( '_fck_mw_nowiki' ) || tag.getAttribute( '_fck_mw_includeonly' ) || tag.getAttribute( '_fck_mw_noinclude' ) || tag.getAttribute( '_fck_mw_onlyinclude' )) //YC 
     749                        { 
     750                                contextMenu.AddSeparator() ; 
     751                                contextMenu.AddItem( 'MW_Special', 'Special Tag Properties' ) ; 
     752                        } 
    718753                } 
    719754        }