Ticket #3673: 3673_11.patch

File 3673_11.patch, 27.3 KB (added by Wiktor Walc, 15 years ago)
  • _source/core/config.js

     
    149149         * @example
    150150         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    151151         */
     152        plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    152153
    153         plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,resize,save,scayt,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    154 
    155154        /**
    156155         * List of additional plugins to be loaded. This is a tool setting which
    157156         * makes it easier to add new plugins, whithout having to touch and
  • _source/plugins/dialog/plugin.js

     
    759759                                        '<a class="cke_dialog_tab"',
    760760                                                ( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ),
    761761                                                titleHtml,
     762                                                ( !!contents.hidden ? ' style="display:none"' : '' ),
    762763                                                ' id="', contents.id + '_', CKEDITOR.tools.getNextNumber(), '"' +
    763764                                                ' href="javascript:void(0)"',
    764765                                                ' hidefocus="true">',
     
    862863                },
    863864
    864865                /**
     866                 * Returns boolean variable indicating whether page was initially hidden.
     867                 * @param {String} id The page's Id.
     868                 * @returns {Boolean} true if hidden, false if not.
     869                 * @example
     870                 * dialog.isInitiallyHidden( 'upload' );
     871                 */
     872                isInitiallyHidden : function( id )
     873                {
     874                        return !!this.definition.getContents( id ).hidden;
     875                },
     876
     877                /**
    865878                 * Gets the root DOM element of the dialog.
    866879                 * @returns {CKEDITOR.dom.element} The &lt;span&gt; element containing this dialog.
    867880                 * @example
     
    874887                },
    875888
    876889                /**
     890                 * Gets the name of the dialog.
     891                 * @returns {String} The name of this dialog.
     892                 * @example
     893                 * var dialogName = dialogObj.getName();
     894                 */
     895                getName : function()
     896                {
     897                        return this._.name;
     898                },
     899
     900                /**
    877901                 * Gets a dialog UI element object from a dialog page.
    878902                 * @param {String} pageId id of dialog page.
    879903                 * @param {String} elementId id of UI element.
     
    17891813                         *      generate the final widget.</li>
    17901814                         *      <li><strong>title</strong> (Optional) The popup tooltip for the UI
    17911815                         *      element.</li>
     1816                         *      <li><strong>hidden</strong> (Optional) A flag that tells if the element
     1817                         *      should be initially visible.</li>
    17921818                         *      <li><strong>className</strong> (Optional) Additional CSS class names
    17931819                         *      to add to the UI element. Separated by space.</li>
    17941820                         *      <li><strong>style</strong> (Optional) Additional CSS inline styles
     
    18621888                                var styleStr = ( elementDefinition.style || '' ).split( ';' );
    18631889                                for ( i in styles )
    18641890                                        styleStr.push( i + ':' + styles[i] );
     1891                                if ( elementDefinition.hidden )
     1892                                        styleStr.push( 'display:none' );
    18651893                                for ( i = styleStr.length - 1 ; i >= 0 ; i-- )
    18661894                                {
    18671895                                        if ( styleStr[i] === '' )
    18681896                                                styleStr.splice( i, 1 );
    18691897                                }
    18701898                                if ( styleStr.length > 0 )
    1871                                         attributes.style = ( attributes.style || '' ) + styleStr.join( '; ' );
     1899                                        attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' );
    18721900
    18731901                                // Write the attributes.
    18741902                                for ( i in attributes )
  • _source/plugins/dialogui/plugin.js

     
    654654                                        this.validate = elementDefinition.validate;
    655655
    656656                                var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
     657                                var onClick = myDefinition.onClick;
    657658                                myDefinition.className = ( myDefinition.className ? myDefinition.className + ' ' : '' ) + 'cke_dialog_ui_button';
    658659                                myDefinition.onClick = function( evt )
    659660                                {
    660661                                        var target = elementDefinition[ 'for' ];                // [ pageId, elementId ]
    661                                         dialog.getContentElement( target[0], target[1] ).submit();
    662                                         this.disable();
     662                                        if ( !onClick || onClick.call( this, evt ) !== false )
     663                                        {
     664                                                dialog.getContentElement( target[0], target[1] ).submit();
     665                                                this.disable();
     666                                        }
    663667                                };
    664668
    665669                                dialog.on( 'load', function()
     
    11971201                                },
    11981202
    11991203                                /**
     1204                                 * Get the action assigned to the form.
     1205                                 * @returns {String} The value of the action.
     1206                                 * @example
     1207                                 */
     1208                                getAction : function( action )
     1209                                {
     1210                                        return this.getInputElement().getParent().$.action;
     1211                                },
     1212
     1213                                /**
    12001214                                 * Redraws the file input and resets the file path in the file input.
    12011215                                 * The redraw logic is necessary because non-IE browsers tend to clear
    12021216                                 * the &lt;iframe&gt; containing the file input after closing the dialog.
  • _source/plugins/filebrowser/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @fileOverview The "filebrowser" plugin, it adds support for file uploads and
     8 *               browsing.
     9 *
     10 * When file is selected inside of the file browser or uploaded, its url is
     11 * inserted automatically to a field, which is described in the 'filebrowser'
     12 * attribute. To specify field that should be updated, pass the tab id and
     13 * element id, separated with a colon.
     14 *
     15 * Example 1: (Browse)
     16 *
     17 * <pre>
     18 * {
     19 *      type : 'button',
     20 *      id : 'browse',
     21 *      filebrowser : 'tabId:elementId',
     22 *      label : editor.lang.common.browseServer
     23 * }
     24 * </pre>
     25 *
     26 * If you set the 'filebrowser' attribute on any element other than
     27 * 'fileButton', the 'Browse' action will be triggered.
     28 *
     29 * Example 2: (Quick Upload)
     30 *
     31 * <pre>
     32 * {
     33 *      type : 'fileButton',
     34 *      id : 'uploadButton',
     35 *      filebrowser : 'tabId:elementId',
     36 *      label : editor.lang.common.uploadSubmit,
     37 *      'for' : [ 'upload', 'upload' ]
     38 * }
     39 * </pre>
     40 *
     41 * If you set the 'filebrowser' attribute on a fileButton element, the
     42 * 'QuickUpload' action will be executed.
     43 *
     44 * Filebrowser plugin also supports more advanced configuration (through
     45 * javascript object).
     46 *
     47 * The following settings are supported:
     48 *
     49 * <pre>
     50 *  [action] - Browse or QuickUpload
     51 *  [target] - field to update, tabId:elementId
     52 *  [params] - additional arguments to be passed to the server connector (optional)
     53 *  [onSelect] - function to execute when file is selected/uploaded (optional)
     54 *  [url] - the URL to be called (optional)
     55 * </pre>
     56 *
     57 * Example 3: (Quick Upload)
     58 *
     59 * <pre>
     60 * {
     61 *      type : 'fileButton',
     62 *      label : editor.lang.common.uploadSubmit,
     63 *      id : 'buttonId',
     64 *      filebrowser :
     65 *      {
     66 *              action : 'QuickUpload', //required
     67 *              target : 'tab1:elementId', //required
     68 *              params : //optional
     69 *              {
     70 *                      type : 'Files',
     71 *                      currentFolder : '/folder/'
     72 *              },
     73 *              onSelect : function( fileUrl, errorMessage ) //optional
     74 *              {
     75 *                      // Do not call the built-in selectFuntion
     76 *                      // return false;
     77 *              }
     78 *      },
     79 *      'for' : [ 'tab1', 'myFile' ]
     80 * }
     81 * </pre>
     82 *
     83 * Suppose we have a file element with id 'myFile', text field with id
     84 * 'elementId' and a fileButton. If filebowser.url is not specified explicitly,
     85 * form action will be set to 'filebrowser[DialogName]UploadUrl' or, if not
     86 * specified, to 'filebrowserUploadUrl'. Additional parameters from 'params'
     87 * object will be added to the query string. It is possible to create your own
     88 * uploadHandler and cancel the built-in updateTargetElement command.
     89 *
     90 * Example 4: (Browse)
     91 *
     92 * <pre>
     93 * {
     94 *      type : 'button',
     95 *      id : 'buttonId',
     96 *      label : editor.lang.common.browseServer,
     97 *      filebrowser :
     98 *      {
     99 *              action : 'Browse',
     100 *              url : '/ckfinder/ckfinder.html&amp;type=Images',
     101 *              target : 'tab1:elementId'
     102 *      }
     103 * }
     104 * </pre>
     105 *
     106 * In this example, after pressing a button, file browser will be opened in a
     107 * popup. If we don't specify filebrowser.url attribute,
     108 * 'filebrowser[DialogName]BrowseUrl' or 'filebrowserBrowseUrl' will be used.
     109 * After selecting a file in a file browser, an element with id 'elementId' will
     110 * be updated. Just like in the third example, a custom 'onSelect' function may be
     111 * defined.
     112 */
     113( function()
     114{
     115        /**
     116         * Adds (additional) arguments to given url.
     117         *
     118         * @param {String}
     119         *            url The url.
     120         * @param {Object}
     121         *            params Additional parameters.
     122         */
     123        function addQueryString( url, params )
     124        {
     125                var queryString = [];
     126
     127                if ( !params )
     128                        return url;
     129                else
     130                {
     131                        for ( var i in params )
     132                                queryString.push( i + "=" + encodeURIComponent( params[ i ] ) );
     133                }
     134
     135                return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
     136        }
     137
     138        /**
     139         * Make a string's first character uppercase.
     140         *
     141         * @param {String}
     142         *            str String.
     143         */
     144        function ucFirst( str )
     145        {
     146                str += '';
     147                var f = str.charAt( 0 ).toUpperCase();
     148                return f + str.substr( 1 );
     149        }
     150
     151        /**
     152         * The onlick function assigned to the 'Browse Server' button. Opens the
     153         * file browser and updates target field when file is selected.
     154         *
     155         * @param {CKEDITOR.event}
     156         *            evt The event object.
     157         */
     158        function browseServer( evt )
     159        {
     160                var dialog = this.getDialog();
     161                var editor = dialog.getParentEditor();
     162
     163                editor._.filebrowserSe = this;
     164
     165                var width = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowWidth' ]
     166                                || editor.config.filebrowserWindowWidth || '80%';
     167                var height = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowHeight' ]
     168                                || editor.config.filebrowserWindowHeight || '70%';
     169
     170                var params = this.filebrowser.params || {};
     171                params.CKEditor = editor.name;
     172                params.CKEditorFuncNum = editor._.filebrowserFn;
     173                if ( !params.langCode )
     174                        params.langCode = editor.langCode;
     175
     176                url = addQueryString( this.filebrowser.url, params );
     177                editor.popup( url, width, height );
     178        }
     179
     180        /**
     181         * The onlick function assigned to the 'Upload' button. Makes the final
     182         * decision whether form is really submitted and updates target field when
     183         * file is uploaded.
     184         *
     185         * @param {CKEDITOR.event}
     186         *            evt The event object.
     187         */
     188        function uploadFile( evt )
     189        {
     190                var dialog = this.getDialog();
     191                var editor = dialog.getParentEditor();
     192
     193                editor._.filebrowserSe = this;
     194
     195                // If user didn't select the file, stop the upload.
     196                if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement().$.value )
     197                        return false;
     198
     199                if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getAction() )
     200                        return false;
     201
     202                return true;
     203        }
     204
     205        /**
     206         * Setups the file element.
     207         *
     208         * @param {CKEDITOR.ui.dialog.file}
     209         *            fileInput The file element used during file upload.
     210         * @param {Object}
     211         *            filebrowser Object containing filebrowser settings assigned to
     212         *            the fileButton associated with this file element.
     213         */
     214        function setupFileElement( editor, fileInput, filebrowser )
     215        {
     216                var params = filebrowser.params || {};
     217                params.CKEditor = editor.name;
     218                params.CKEditorFuncNum = editor._.filebrowserFn;
     219                if ( !params.langCode )
     220                        params.langCode = editor.langCode;
     221
     222                fileInput.action = addQueryString( filebrowser.url, params );
     223                fileInput.filebrowser = filebrowser;
     224        }
     225
     226        /**
     227         * Traverse through the content definition and attach filebrowser to
     228         * elements with 'filebrowser' attribute.
     229         *
     230         * @param String
     231         *            dialogName Dialog name.
     232         * @param {CKEDITOR.dialog.dialogDefinitionObject}
     233         *            definition Dialog definition.
     234         * @param {Array}
     235         *            elements Array of {@link CKEDITOR.dialog.contentDefinition}
     236         *            objects.
     237         */
     238        function attachFileBrowser( editor, dialogName, definition, elements )
     239        {
     240                var element, fileInput;
     241
     242                for ( var i in elements )
     243                {
     244                        element = elements[ i ];
     245
     246                        if ( element.type == 'hbox' || element.type == 'vbox' )
     247                                attachFileBrowser( editor, dialogName, definition, element.children );
     248
     249                        if ( !element.filebrowser )
     250                                continue;
     251
     252                        if ( typeof element.filebrowser == 'string' )
     253                        {
     254                                var fb =
     255                                {
     256                                        action : ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse',
     257                                        target : element.filebrowser
     258                                };
     259                                element.filebrowser = fb;
     260                        }
     261
     262                        if ( element.filebrowser.action == 'Browse' )
     263                        {
     264                                var url = element.filebrowser.url || editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ]
     265                                                        || editor.config.filebrowserBrowseUrl;
     266
     267                                if ( url )
     268                                {
     269                                        element.onClick = browseServer;
     270                                        element.filebrowser.url = url;
     271                                        element.hidden = false;
     272                                }
     273                        }
     274                        else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] )
     275                        {
     276                                var url =  element.filebrowser.url || editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ]
     277                                                        || editor.config.filebrowserUploadUrl;
     278
     279                                if ( url )
     280                                {
     281                                        element.onClick = uploadFile;
     282                                        element.filebrowser.url = url;
     283                                        element.hidden = false;
     284                                        setupFileElement( editor, definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser );
     285                                }
     286                        }
     287                }
     288        }
     289
     290        /**
     291         * Updates the target element with the url of uploaded/selected file.
     292         *
     293         * @param {String}
     294         *            url The url of a file.
     295         */
     296        function updateTargetElement( url, sourceElement )
     297        {
     298                var dialog = sourceElement.getDialog();
     299                var targetElement = sourceElement.filebrowser.target || null;
     300                url = url.replace( /#/g, '%23' );
     301
     302                // If there is a reference to targetElement, update it.
     303                if ( targetElement )
     304                {
     305                        var target = targetElement.split( ':' );
     306                        var element = dialog.getContentElement( target[ 0 ], target[ 1 ] );
     307                        if ( element )
     308                        {
     309                                element.setValue( url );
     310                                dialog.selectPage( target[ 0 ] );
     311                        }
     312                }
     313        }
     314
     315        /**
     316         * Returns true if filebrowser is configured in one of the elements.   
     317         *
     318         * @param {CKEDITOR.dialog.dialogDefinitionObject}
     319         *            definition Dialog definition.
     320         * @param String
     321         *            tabId The tab id where element(s) can be found.
     322         * @param String
     323         *            elementId The element id (or ids, separated with a semicolon) to check.
     324         */
     325        function isConfigured( definition, tabId, elementId )
     326        {
     327                if ( elementId.indexOf( ";" ) !== -1 )
     328                {
     329                        var ids = elementId.split( ";" );
     330                        for ( var i = 0 ; i < ids.length ; i++ )
     331                        {
     332                                if ( isConfigured( definition, tabId, ids[i]) )
     333                                        return true;
     334                        }
     335                        return false;
     336                }
     337               
     338                return ( definition.getContents( tabId ).get( elementId ).filebrowser && definition.getContents( tabId ).get( elementId ).filebrowser.url );
     339        }
     340
     341        function setUrl( fileUrl, data )
     342        {
     343                var dialog = this._.filebrowserSe.getDialog(),
     344                        targetInput = this._.filebrowserSe[ 'for' ],
     345                        onSelect = this._.filebrowserSe.filebrowser.onSelect;
     346
     347                if ( targetInput )
     348                        dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).reset();
     349
     350                if ( onSelect && onSelect.call( this._.filebrowserSe, fileUrl, data ) === false )
     351                        return;
     352
     353                // The "data" argument may be used to pass the error message to the editor.   
     354                if ( typeof data == 'string' && data )
     355                        alert( data );
     356
     357                if ( fileUrl )
     358                        updateTargetElement( fileUrl, this._.filebrowserSe );
     359        }
     360
     361        CKEDITOR.plugins.add( 'filebrowser',
     362        {
     363                init : function( editor, pluginPath )
     364                {
     365                        editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUrl, editor );
     366
     367                        CKEDITOR.on( 'dialogDefinition', function( evt )
     368                        {
     369                                // Associate filebrowser to elements with 'filebrowser' attribute.
     370                                for ( var i in evt.data.definition.contents )
     371                                {
     372                                        attachFileBrowser( evt.editor, evt.data.name, evt.data.definition, evt.data.definition.contents[ i ].elements );
     373                                        if ( evt.data.definition.contents[ i ].hidden && evt.data.definition.contents[ i ].filebrowser )
     374                                        {
     375                                                evt.data.definition.contents[ i ].hidden =
     376                                                        !isConfigured( evt.data.definition, evt.data.definition.contents[ i ][ 'id' ], evt.data.definition.contents[ i ].filebrowser );
     377                                        }
     378                                }
     379                        } );
     380                }
     381        } );
     382
     383} )();
  • _source/plugins/flash/dialogs/flash.js

     
    181181                        title : editor.lang.flash.title,
    182182                        minWidth : 420,
    183183                        minHeight : 310,
    184                         onLoad : function()
    185                         {
    186                                 if ( !editor.config.flashUploadTab )
    187                                         this.hidePage( 'Upload' );              // Hide Upload tab.
    188 
    189                                 if ( !editor.config.flashBrowseServer )
    190                                         this.getContentElement( 'info', 'browse' ).getElement().hide();
    191                         },
    192184                        onShow : function()
    193185                        {
    194186                                // Clear previously saved elements.
     
    347339                                                                                {
    348340                                                                                        type : 'button',
    349341                                                                                        id : 'browse',
     342                                                                                        filebrowser : 'info:src',
     343                                                                                        hidden : true,
    350344                                                                                        align : 'center',
    351345                                                                                        label : editor.lang.common.browseServer
    352346                                                                                }
     
    438432                                },
    439433                                {
    440434                                        id : 'Upload',
     435                                        hidden : true,
     436                                        filebrowser : 'uploadButton',
    441437                                        label : editor.lang.common.upload,
    442438                                        elements :
    443439                                        [
     
    445441                                                        type : 'file',
    446442                                                        id : 'upload',
    447443                                                        label : editor.lang.common.upload,
    448                                                         action : editor.config.image_uploadAction,
    449444                                                        size : 38
    450445                                                },
    451446                                                {
    452447                                                        type : 'fileButton',
    453448                                                        id : 'uploadButton',
    454449                                                        label : editor.lang.common.uploadSubmit,
     450                                                        filebrowser : 'info:src',
    455451                                                        'for' : [ 'Upload', 'upload' ]
    456452                                                }
    457453                                        ]
  • _source/plugins/flash/plugin.js

     
    142142
    143143CKEDITOR.tools.extend( CKEDITOR.config,
    144144{
    145         flashUploadTab : true,
    146         flashUploadAction : 'nowhere.php',
    147         flashBrowseServer : true,
    148 
    149145        /**
    150146         * Save as EMBED tag only. This tag is unrecommended.
    151147         * @type Boolean
  • _source/plugins/image/dialogs/image.js

     
    445445                                                                                        id : 'browse',
    446446                                                                                        align : 'center',
    447447                                                                                        label : editor.lang.common.browseServer,
    448                                                                                         onLoad : function()
    449                                                                                         {
    450                                                                                                 var dialog = this.getDialog();
    451                                                                                                 if ( !dialog.getParentEditor().config.image_browseServer )
    452                                                                                                         dialog.getContentElement( 'info', 'browse' ).getElement().hide();
    453                                                                                         },
    454                                                                                         onClick : function()
    455                                                                                         {
    456 
    457                                                                                         }
     448                                                                                        hidden : true,
     449                                                                                        filebrowser : 'info:txtUrl'
    458450                                                                                }
    459451                                                                        ]
    460452                                                                }
     
    930922                                                {
    931923                                                        type : 'button',
    932924                                                        id : 'browse',
     925                                                        filebrowser : 'Link:txtUrl',
    933926                                                        style : 'float:right',
    934                                                         label : editor.lang.common.browseServer,
    935                                                         onClick : function()
    936                                                         {
    937                                                         }
     927                                                        hidden : true,
     928                                                        label : editor.lang.common.browseServer
    938929                                                },
    939930                                                {
    940931                                                        id : 'cmbTarget',
     
    967958                                },
    968959                                {
    969960                                        id : 'Upload',
     961                                        hidden : true,
     962                                        filebrowser : 'uploadButton',
    970963                                        label : editor.lang.image.upload,
    971964                                        elements :
    972965                                        [
     
    974967                                                        type : 'file',
    975968                                                        id : 'upload',
    976969                                                        label : editor.lang.image.btnUpload,
    977                                                         action : editor.config.image_uploadAction,
    978970                                                        size : 38
    979971                                                },
    980972                                                {
    981973                                                        type : 'fileButton',
    982974                                                        id : 'uploadButton',
     975                                                        filebrowser : 'info:txtUrl',
    983976                                                        label : editor.lang.image.btnUpload,
    984977                                                        'for' : [ 'Upload', 'upload' ]
    985978                                                }
  • _source/plugins/image/plugin.js

     
    5454        }
    5555} );
    5656
    57 /**
    58  * Show Browse Server button.
    59  * @type Boolean
    60  * @default true
    61  */
    62 CKEDITOR.config.image_browseServer = true;
    63 
    64 /**
    65  * Upload action attribute.
    66  * @type URL
    67  */
    68 CKEDITOR.config.image_uploadAction = 'nowhere.php';
    69 
    7057CKEDITOR.config.image_removeLinkByEmptyURL = true;
  • _source/plugins/link/dialogs/link.js

     
    3636        {
    3737                var dialog = this.getDialog(),
    3838                        partIds = [ 'urlOptions', 'anchorOptions', 'emailOptions' ],
    39                         typeValue = this.getValue();
     39                        typeValue = this.getValue(),
     40                        uploadInitiallyHidden = dialog.isInitiallyHidden( 'upload' );
    4041                if ( typeValue == 'url' )
    4142                {
    4243                        if ( editor.config.linkShowTargetTab )
    4344                                dialog.showPage( 'target' );
    44                         if ( editor.config.linkUploadTab )
     45                        if ( !uploadInitiallyHidden )
    4546                                dialog.showPage( 'upload' );
    4647                }
    4748                else
    4849                {
    4950                        dialog.hidePage( 'target' );
    50                         dialog.hidePage( 'upload' );
     51                        if ( !uploadInitiallyHidden )
     52                                dialog.hidePage( 'upload' );
    5153                }
    5254
    5355                for ( var i = 0 ; i < partIds.length ; i++ )
     
    388390                                                        {
    389391                                                                type : 'button',
    390392                                                                id : 'browse',
     393                                                                hidden : 'true',
     394                                                                filebrowser : 'info:url',
    391395                                                                label : editor.lang.common.browseServer
    392396                                                        }
    393397                                                ]
     
    815819                                id : 'upload',
    816820                                label : editor.lang.link.upload,
    817821                                title : editor.lang.link.upload,
     822                                hidden : true,
     823                                filebrowser : 'uploadButton',
    818824                                elements :
    819825                                [
    820826                                        {
    821827                                                type : 'file',
    822828                                                id : 'upload',
    823829                                                label : editor.lang.common.upload,
    824                                                 action : editor.config.linkUploadAction,
    825830                                                size : 38
    826831                                        },
    827832                                        {
    828833                                                type : 'fileButton',
    829834                                                id : 'uploadButton',
    830835                                                label : editor.lang.common.uploadSubmit,
     836                                                filebrowser : 'info:url',
    831837                                                'for' : [ 'upload', 'upload' ]
    832838                                        }
    833839                                ]
     
    10391045                                case 'url':
    10401046                                        var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://',
    10411047                                                url = ( data.url && data.url.url ) || '';
    1042                                         attributes._cke_saved_href = protocol + url;
     1048                                        attributes._cke_saved_href = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url;
    10431049                                        break;
    10441050                                case 'anchor':
    10451051                                        var name = ( data.anchor && data.anchor.name ),
     
    11951201                },
    11961202                onLoad : function()
    11971203                {
    1198                         if ( !editor.config.linkUploadTab )
    1199                                 this.hidePage( 'upload' );              //Hide Upload tab.
    1200 
    12011204                        if ( !editor.config.linkShowAdvancedTab )
    12021205                                this.hidePage( 'advanced' );            //Hide Advanded tab.
    12031206
    1204                         if ( !editor.config.linkBrowseServer )
    1205                                 this.getContentElement( 'info', 'browse' ).getElement().hide();
    1206 
    12071207                        if ( !editor.config.linkShowTargetTab )
    12081208                                this.hidePage( 'target' );              //Hide Target tab.
    12091209
  • _source/plugins/link/plugin.js

     
    183183
    184184CKEDITOR.tools.extend( CKEDITOR.config,
    185185{
    186         linkUploadTab : true,
    187         linkBrowseServer : true,
    188         linkUploadAction : 'nowhere.php',
    189186        linkShowAdvancedTab : true,
    190187        linkShowTargetTab : true
    191188} );
  • _source/plugins/popup/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'popup');
     7
     8CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
     9{
     10        /**
     11         * Opens Browser in a popup. The "width" and "height" parameters accept
     12         * numbers (pixels) or percent (of screen size) values.
     13         * @param {String} url The url of the external file browser.
     14         * @param {String} width Popup window width.
     15         * @param {String} height Popup window height.
     16         */
     17        popup : function( url, width, height )
     18        {
     19                width = width || '80%';
     20                height = height || '70%';
     21
     22                if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
     23                        width = parseInt( window.screen.width * parseInt( width, 10 ) / 100, 10 );
     24
     25                if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) == '%' )
     26                        height = parseInt( window.screen.height * parseInt( height, 10 ) / 100, 10 );
     27
     28                if ( width < 640 )
     29                        width = 640;
     30
     31                if ( height < 420 )
     32                        height = 420;
     33
     34                var top = parseInt( ( window.screen.height - height ) / 2, 10 ),
     35                        left = parseInt( ( window.screen.width  - width ) / 2, 10 ),
     36                        options = 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes' +
     37                        ',width='  + width +
     38                        ',height=' + height +
     39                        ',top='  + top +
     40                        ',left=' + left;
     41
     42                var popupWindow = window.open( '', null, options, true );
     43
     44                // Blocked by a popup blocker.
     45                if ( !popupWindow )
     46                        return false;
     47
     48                try
     49                {
     50                        popupWindow.moveTo( left, top );
     51                        popupWindow.resizeTo( width, height );
     52                        popupWindow.focus();
     53                        popupWindow.location.href = url;
     54                }
     55                catch (e)
     56                {
     57                        popupWindow = window.open( url, null, options, true );
     58                }
     59
     60                return true ;
     61        }
     62});
  • ckeditor.pack

     
    153153                                        '_source/plugins/pagebreak/plugin.js',
    154154                                        '_source/plugins/pastefromword/plugin.js',
    155155                                        '_source/plugins/pastetext/plugin.js',
     156                                        '_source/plugins/popup/plugin.js',
    156157                                        '_source/plugins/preview/plugin.js',
    157158                                        '_source/plugins/print/plugin.js',
    158159                                        '_source/plugins/removeformat/plugin.js',
    159160                                        '_source/plugins/resize/plugin.js',
    160161                                        '_source/plugins/save/plugin.js',
     162                                        '_source/plugins/filebrowser/plugin.js',
    161163                                        '_source/plugins/scayt/plugin.js',
    162164                                        '_source/plugins/smiley/plugin.js',
    163165                                        '_source/plugins/showblocks/plugin.js',
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy