Ticket #2116: 2116.patch

File 2116.patch, 10.3 KB (added by Artur Formella, 16 years ago)

All in 1 patch

  • FCKeditor.body.php

     
    370370                        $showRef = true;
    371371                }
    372372
     373                $showLlink = false;
     374                if (isset ($wgExtensionFunctions) && (in_array('wfFilelinkExtension',$wgExtensionFunctions) )){
     375                        $showLlink = true;
     376                }
     377
    373378                $script .= '
    374379var showFCKEditor = '. $this->showFCKEditor .';
    375380var popup = false;              //pointer to popup document
     
    392397oFCKeditor.ToolbarSet = "'. $wgFCKEditorToolbarSet .'" ;
    393398oFCKeditor.ready = true;
    394399oFCKeditor.Config["showreferences"] = '.(($showRef)?'true':'false').';
     400oFCKeditor.Config["showlocalLink"] = '.(($showLlink)?'true':'false').';
    395401';
    396402                $script .= '</script>';
    397403               
  • 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_References','MW_Math'],
     15        ['MW_Local_Link','MW_Template','MW_Special','MW_Ref','MW_References','MW_Math'],
    1616        '/',
    1717        ['FontFormat'],
    1818        ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
     
    2525
    2626// Load the extension plugins.
    2727FCKConfig.PluginsPath = FCKConfig.EditorPath + '../plugins/' ;
    28 FCKConfig.Plugins.Add( 'mediawiki', 'en,pl') ;
     28FCKConfig.Plugins.Add( 'mediawiki', 'en,pl,es') ;
    2929
    3030FCKConfig.ForcePasteAsPlainText = true ;
    3131FCKConfig.FontFormats   = 'p;h1;h2;h3;h4;h5;h6;pre' ;
  • plugins/mediawiki/dialogs/locallink.html

     
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
     2<!--
     3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
     4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
     5 *
     6 * == BEGIN LICENSE ==
     7 *
     8 * Licensed under the terms of any of the following licenses at your
     9 * choice:
     10 *
     11 *  - GNU General Public License Version 2 or later (the "GPL")
     12 *    http://www.gnu.org/licenses/gpl.html
     13 *
     14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
     15 *    http://www.gnu.org/licenses/lgpl.html
     16 *
     17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
     18 *    http://www.mozilla.org/MPL/MPL-1.1.html
     19 *
     20 * == END LICENSE ==
     21 *
     22 * Local File Link
     23 *
     24 * written by Michael Tran (dublue@gmail.com) for MediaWiki+FCKeditor
     25-->
     26<html>
     27<head>
     28<title>Local Link</title>
     29<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     30<meta name="robots" content="noindex, nofollow" />
     31<script type="text/javascript">
     32var oEditor     = window.parent.InnerDialogLoaded();
     33var FCK         = oEditor.FCK;
     34var FCKLang     = oEditor.FCKLang;
     35var FCKConfig   = oEditor.FCKConfig;
     36var FCKRegexLib = oEditor.FCKRegexLib;
     37var FCKTools    = oEditor.FCKTools;
     38
     39document.write('<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>');
     40
     41window.onload = function()
     42{
     43        oEditor.FCKLanguageManager.TranslatePage(document) ;
     44        // Activate the "OK" button.
     45        window.parent.SetOkButton(true) ;
     46        window.parent.SetAutoSize(true) ;
     47
     48        // load the highlighted text (if any) and place
     49        // into the description input field
     50        oLink = FCK.Selection.MoveToAncestorNode("A");
     51        if (oLink) {
     52                FCK.Selection.SelectNode(oLink);
     53                // you cannot alter the value attribute of a file input!!
     54                //document.getElementById("idFile").value = oLink.getAttribute("href", 2);
     55                document.getElementById("idDesc").value = oLink.innerHTML;
     56        }
     57        else {
     58                // selected text is not currently a link
     59                if (document.all)
     60                        document.getElementById("idDesc").value = FCK.EditorDocument.selection.createRange().text;
     61                else
     62                        document.getElementById("idDesc").value = FCK.EditorWindow.getSelection();
     63        }
     64} // end function
     65
     66function Ok()
     67{
     68        // check if a file has been selected
     69        if (document.getElementById("idFile").value.length > 0) {
     70                // add an undo step
     71                oEditor.FCKUndo.SaveUndoStep();
     72
     73                // obtain and cleanse data
     74                strLink = "file:///" + encodeURI(document.getElementById("idFile").value);
     75                // strDesc does not need to be cleansed as it will be done server side
     76                // so any injection attempts will be filtered after saving
     77                strDesc = document.getElementById("idDesc").value;
     78
     79                if (strDesc.length < 1) strDesc = document.getElementById("idFile").value;
     80       
     81                // create an empty anchor
     82                objLink = oEditor.FCK.InsertElement("a");
     83                objLink.href = strLink;
     84                objLink.setAttribute('_fcklocallink','true');
     85                objLink.innerHTML = strDesc;
     86
     87                // add to the editor
     88                oEditor.FCKSelection.SelectNode(objLink);
     89
     90                return true;
     91        }
     92        else {
     93                alert(FCKLang.DlgLocalLinkNoFileSelected);
     94                return false;
     95        } // end if
     96} // end function
     97</script>
     98</head>
     99<body>
     100<p><span fcklang="DlgLocalLinkDescription">To insert a link to a resource on a shared group drive (eg G: or W:), browse for your resource, add a description for the link, then click OK.</span></p>
     101<p>
     102        <label for="idFile" fcklang="DlgLocalLinkInputFileBrowse">File:</label>
     103        <br /><input type="file" name="file" size="50" id="idFile" />
     104</p>
     105<p>
     106        <label for="idDesc"><span fcklang="DlgLocalLinkInputLinkDescription">Link Description:</span></label>
     107        <br /><input type="text" name="desc" size="50" id="idDesc" />
     108</p>
     109</body>
     110</html>
  • plugins/mediawiki/fckplugin.js

     
    7474}
    7575FCKToolbarItems.RegisterItem( 'MW_References', tbButton ) ;
    7676
     77// register the local link command
     78FCKCommands.RegisterCommand( "MW_Local_Link",
     79        new FCKDialogCommand(FCKLang["DlgLocalLinkTitle"] || 'Local File Link', FCKLang["DlgLocalLinkTitle"] || 'Local File Link', FCKConfig.PluginsPath + "mediawiki/dialogs/locallink.html",500, 300  )
     80);
     81
     82// create the local link toolbar button
     83var tbButton = new FCKToolbarButton("MW_Local_Link", FCKLang["DlgLocalLinkTitle"] || 'Local File Link', null, FCK_TOOLBARITEM_ICONTEXT);
     84if ( !FCKConfig.showlocalLink ) {               //hack to disable local link  button
     85        tbButton.Create = function()            {return 0;}
     86        tbButton.Disable  = function()  {return 0;}
     87        tbButton.RefreshState  = function()     {return 0;}
     88}
     89tbButton.IconPath = FCKConfig.PluginsPath + "mediawiki/images/tb_locallink.gif";
     90FCKToolbarItems.RegisterItem("MW_Local_Link", tbButton);
     91
     92
    7793tbButton = new FCKToolbarButton( 'MW_Math', 'Formula', FCKLang.wikiBtnFormula || 'Insert/Edit Formula' ) ;
    7894tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_math.gif' ;
    7995FCKToolbarItems.RegisterItem( 'MW_Math', tbButton ) ;
     
    400416                                                                var isWikiUrl = !( href.StartsWith( 'mailto:' ) || /^\w+:\/\//.test( href ) ) ;
    401417                                                                stringBuilder.push( isWikiUrl ? '[[' : '[' ) ;
    402418                                                        }
     419                                                        if ( FCKConfig.showlocalLink ) {
     420                                                                if((htmlNode.getAttribute('_fcklocallink')) || (href.toLowerCase().StartsWith( 'file://' ))){
     421                                                                        if(!isWikiUrl) stringBuilder.push( '[' ) ;
     422                                                                        isWikiUrl = true;
     423                                                                }
     424                                                        }
    403425                                                        //#2223
    404426                                                        if (htmlNode.getAttribute( '_fcknotitle' ) && htmlNode.getAttribute( '_fcknotitle' ) == "true")
    405427                                                        {
  • plugins/mediawiki/lang/en.js

     
    7272
    7373FCKLang.DplHelp                                                         = 'DPL stands for Dynamic Page List, and allows to generate a formatted list of pages based on selection criteria. See %link for details';
    7474FCKLang.inputboxHelp                                    = 'Inputbox allows to create a form for users to create new pages. The new pages edit box can be pre-loaded with any template. See %link for details';
     75
     76
     77FCKLang.DlgLocalLinkTitle                       = "Local File Link";
     78FCKLang.DlgLocalLinkDescription = "To insert a link to a resource on a shared group drive (eg G: or W:), browse for your resource, add a description for the link, then click OK.";
     79FCKLang.DlgLocalLinkInputFileBrowse = "File:";
     80FCKLang.DlgLocalLinkInputLinkDescription = "Link Description:";
     81FCKLang.DlgLocalLinkNoFileSelected = "Please ensure you have selected a file to link to.";
  • plugins/mediawiki/lang/es.js

     
     1/*
     2 * mediaWiki FCKeditor plugin
     3 *
     4 * Spanish language file.
     5 */
     6
     7FCKLang.DlgLocalLinkTitle                       = "Enlace a archivo local";
     8FCKLang.DlgLocalLinkDescription = "Para insertar un enlace a un recurso en una unidad de red (como G: o W:), explore el recurso compartido, an~ada una descripción para el enlace, y pulse OK.";
     9FCKLang.DlgLocalLinkInputFileBrowse = "File:";
     10FCKLang.DlgLocalLinkInputLinkDescription = "Descripción del enlace:";
     11FCKLang.DlgLocalLinkNoFileSelected = "Por favor, compruebe que ha seleccionado el archivo a enlazar.";
  • plugins/mediawiki/lang/pl.js

     
    7373FCKLang.DplHelp                                                         = 'Dynamic Page List pozwala na generowanie formatowanych list stron bazując na podanych kryteriach Zobacz %link aby dowiedzieć się więcej';;
    7474FCKLang.inputboxHelp                                    = 'Inputbox pozwala na stworzenie formularza dla użytkowników do tworzenia nowych stron. Zobacz %link aby dowiedzieć się więcej';
    7575
     76FCKLang.DlgLocalLinkTitle                       = "Link lokalny";
     77FCKLang.DlgLocalLinkDescription = "Aby stworzyć odnośnik do treści udostępnionej dla lokalnej grupy, wybierz plik, dodaj odpowiedni opis oraz kliknij OK.";
     78FCKLang.DlgLocalLinkInputFileBrowse = "Plik:";
     79FCKLang.DlgLocalLinkInputLinkDescription = "Opis:";
     80FCKLang.DlgLocalLinkNoFileSelected = "Upewnij się, że odpowiedni plik został wybrany";
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy