Ticket #2386: 2386_4.patch

File 2386_4.patch, 3.7 KB (added by Wiktor Walc, 15 years ago)

Rerolled patch against head

  • FCKeditorSajax.body.php

     
    9393}
    9494
    9595function wfSajaxSearchArticleFCKeditor( $term ) {
    96         global $wgContLang, $wgOut;
     96        global $wgContLang, $wgOut, $wgExtraNamespaces;
    9797        $limit = 10;
    9898        $ns = NS_MAIN;
    9999
    100100        $term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) );
    101101
    102         if (strpos($term, "Category:") === 0) {
     102        if (strpos(strtolower($term), "category:") === 0) {
    103103                $ns = NS_CATEGORY;
    104104                $term = substr($term, 9);
    105105                $prefix = "Category:";
    106106        }
    107         else if (strpos($term, ":Category:") === 0) {
     107        else if (strpos(strtolower($term), ":category:") === 0) {
    108108                $ns = NS_CATEGORY;
    109109                $term = substr($term, 10);
    110110                $prefix = ":Category:";
    111111        }
     112        else if (strpos(strtolower($term), "media:") === 0) {
     113                $ns = NS_IMAGE;
     114                $term = substr($term, 6);
     115                $prefix = "Media:";
     116        }
     117        else if (strpos(strtolower($term), ":image:") === 0) {
     118                $ns = NS_IMAGE;
     119                $term = substr(strtolower($term), 7);
     120                $prefix = ":Image:";
     121        }
     122        else if ( strpos($term,":") && is_array($wgExtraNamespaces )) {
     123                $pos = strpos($term,":");
     124                $find_ns = array_search(substr($term,0,$pos),$wgExtraNamespaces);
     125                if ($find_ns) {
     126                        $ns = $find_ns;
     127                        $prefix = substr($term,0,$pos+1);
     128                        $term = substr($term,$pos+1);
     129                }
     130        }
    112131
    113132        $term1 = str_replace( ' ', '_', $wgContLang->ucfirst( $term ) );
    114133        $term2 = str_replace( ' ', '_', $wgContLang->lc( $term ) );
  • plugins/mediawiki/dialogs/link.html

     
    192192        var aLinks = oLink ? [ oLink ] : oEditor.FCK.CreateLink( sUri ) ;
    193193
    194194        // If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26)
     195        var noTitle = false;
    195196        var aHasSelection = ( aLinks.length > 0 ) ;
    196197        if ( !aHasSelection )
    197198        {
    198                 sInnerHtml = sUri;
     199                sInnerHtml = realUri;
     200                noTitle = true;
    199201
    200202                var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$") ;
    201                 var asLinkPath = oLinkPathRegEx.exec( sUri ) ;
     203                var asLinkPath = oLinkPathRegEx.exec( realUri ) ;
    202204                if (asLinkPath != null)
    203205                        sInnerHtml = asLinkPath[1];  // use matched path
    204206
     
    223225                else
    224226                        oLink.innerHTML = sInnerHtml ;          // Set (or restore) the innerHTML
    225227
     228                if ( noTitle )
     229                        SetAttribute( oLink, '_fcknotitle','true');
    226230        }
    227231
    228232        // Select the (first) link.
  • plugins/mediawiki/fckplugin.js

     
    403403                                                        //#2223
    404404                                                        if (htmlNode.getAttribute( '_fcknotitle' ) && htmlNode.getAttribute( '_fcknotitle' ) == "true")
    405405                                                        {
    406                                                                 var testInner = FCKConfig.ProtectedSource.Revert(htmlNode.innerHTML, 0);
     406                                                                var testHref = FCKConfig.ProtectedSource.Revert(href, 0);
    407407                                                                if (href.toLowerCase().StartsWith( 'category:' )) testInner = 'Category:'+testInner;
    408                                                                 testInner = testInner.replace(/&/, "&")
    409                                                                 if ( testInner == FCKConfig.ProtectedSource.Revert(href, 0) ) pipeline = false;
     408                                                                if (testHref.toLowerCase().StartsWith( 'rtecolon' ) )
     409                                                                        testHref = testHref.replace( /rtecolon/, ":" ) ;
     410                                                                testInner = testInner.replace( /&/, "&" ) ;
     411                                                                if ( testInner == testHref ) pipeline = false ;
    410412                                                        }
    411413                                                        if (href.toLowerCase().StartsWith( 'rtecolon' ))                //change 'rtecolon=' => ':' in links
    412414                                                        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy