Ticket #3673: 3673_5.patch
File 3673_5.patch, 29.4 KB (added by , 14 years ago) |
---|
-
_source/core/config.js
149 149 * @example 150 150 * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea'; 151 151 */ 152 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 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', 155 153 /** 156 154 * List of additional plugins to be loaded. This is a tool setting which 157 155 * makes it easier to add new plugins, whithout having to touch and -
_source/plugins/dialog/plugin.js
756 756 '<a class="cke_dialog_tab"', 757 757 ( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ), 758 758 titleHtml, 759 ( !!contents.hidden ? ' style="display:none"' : '' ), 759 760 ' id="', contents.id + '_', CKEDITOR.tools.getNextNumber(), '"' + 760 761 ' href="javascript:void(0)"', 761 762 ' hidefocus="true">', … … 859 860 }, 860 861 861 862 /** 863 * Returns boolean variable indicating whether page was initially hidden. 864 * @param {String} id The page's Id. 865 * @returns {Boolean} true if hidden, false if not. 866 * @example 867 * dialog.isInitiallyHidden( 'upload' ); 868 */ 869 isInitiallyHidden : function( id ) 870 { 871 return !!this.definition.getContents( id ).hidden; 872 }, 873 874 /** 862 875 * Gets the root DOM element of the dialog. 863 876 * @returns {CKEDITOR.dom.element} The <span> element containing this dialog. 864 877 * @example … … 871 884 }, 872 885 873 886 /** 887 * Gets the name of the dialog. 888 * @returns {String} The name of this dialog. 889 * @example 890 * var dialogName = dialogObj.getName(); 891 */ 892 getName : function() 893 { 894 return this._.name; 895 }, 896 897 /** 874 898 * Gets a dialog UI element object from a dialog page. 875 899 * @param {String} pageId id of dialog page. 876 900 * @param {String} elementId id of UI element. … … 1780 1804 * generate the final widget.</li> 1781 1805 * <li><strong>title</strong> (Optional) The popup tooltip for the UI 1782 1806 * element.</li> 1807 * <li><strong>hidden</strong> (Optional) A flag that tells if the element 1808 * should be initially visible.</li> 1783 1809 * <li><strong>className</strong> (Optional) Additional CSS class names 1784 1810 * to add to the UI element. Separated by space.</li> 1785 1811 * <li><strong>style</strong> (Optional) Additional CSS inline styles … … 1853 1879 var styleStr = ( elementDefinition.style || '' ).split( ';' ); 1854 1880 for ( i in styles ) 1855 1881 styleStr.push( i + ':' + styles[i] ); 1882 if ( elementDefinition.hidden ) 1883 styleStr.push( 'display:none' ); 1856 1884 for ( i = styleStr.length - 1 ; i >= 0 ; i-- ) 1857 1885 { 1858 1886 if ( styleStr[i] === '' ) 1859 1887 styleStr.splice( i, 1 ); 1860 1888 } 1861 1889 if ( styleStr.length > 0 ) 1862 attributes.style = ( attributes.style ||'' ) + styleStr.join( '; ' );1890 attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' ); 1863 1891 1864 1892 // Write the attributes. 1865 1893 for ( i in attributes ) … … 2177 2205 }, 2178 2206 2179 2207 /** 2208 * Gets the name of the parent tab of this element. 2209 * @returns {String} The name of selected tab. 2210 * @example 2211 * focus : function() 2212 * { 2213 * this.getParentTab(); 2214 * // do something else. 2215 * } 2216 */ 2217 getParentTab : function() 2218 { 2219 var element = this.getInputElement(), 2220 cursor = element, 2221 tabId; 2222 while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 ) 2223 { /*jsl:pass*/ } 2224 2225 tabId = cursor.getAttribute( 'name' ); 2226 2227 return tabId; 2228 }, 2229 2230 /** 2180 2231 * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page. 2181 2232 * @returns {CKEDITOR.dialog.uiElement} The current UI element. 2182 2233 * @example -
_source/plugins/dialogui/plugin.js
654 654 this.validate = elementDefinition.validate; 655 655 656 656 var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition ); 657 var onClick = myDefinition.onClick; 657 658 myDefinition.className = ( myDefinition.className ? myDefinition.className + ' ' : '' ) + 'cke_dialog_ui_button'; 658 659 myDefinition.onClick = function( evt ) 659 660 { 660 661 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 } 663 667 }; 664 668 665 669 dialog.on( 'load', function() … … 1197 1201 }, 1198 1202 1199 1203 /** 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 /** 1200 1214 * Redraws the file input and resets the file path in the file input. 1201 1215 * The redraw logic is necessary because non-IE browsers tend to clear 1202 1216 * the <iframe> containing the file input after closing the dialog. 1203 1217 * @example 1204 1218 */ 1205 reset : function( )1219 reset : function( action ) 1206 1220 { 1207 1221 var frameElement = CKEDITOR.document.getById( this._.frameId ), 1208 1222 frameDocument = frameElement.getFrameDocument(), … … 1219 1233 1220 1234 frameDocument.$.write( [ '<html><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">', 1221 1235 '<form enctype="multipart/form-data" method="POST" action="', 1222 CKEDITOR.tools.htmlEncode( elementDefinition.action ),1236 CKEDITOR.tools.htmlEncode( action || elementDefinition.action ), 1223 1237 '">', 1224 1238 '<input type="file" name="', 1225 1239 CKEDITOR.tools.htmlEncode( elementDefinition.id || 'cke_upload' ), -
_source/plugins/filebrowser/plugin.js
1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For 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&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 * Reference to the editor instance. 117 * 118 * @type CKEDITOR 119 */ 120 var editorInstance; 121 /** 122 * Reference to the UI element that started the Browse/QuickUpload action. 123 * 124 * @type CKEDITOR.ui.dialog.uiElement 125 */ 126 var sourceElement; 127 /** 128 * Anonymous function to be called when file is selected/updated by the external file browser. 129 * 130 * @type Number 131 */ 132 var functionNumber; 133 134 /** 135 * Adds (additional) arguments to given url. 136 * 137 * @param {String} 138 * url The url. 139 * @param {Object} 140 * params Additional parameters. 141 */ 142 var addQueryString = function( url, params ) 143 { 144 var queryString = []; 145 146 if ( !params ) 147 return url; 148 else 149 { 150 for ( var i in params ) 151 queryString.push( i + "=" + encodeURIComponent( params[ i ] ) ); 152 } 153 154 return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" ); 155 }; 156 157 /** 158 * Make a string's first character uppercase. 159 * 160 * @param {String} 161 * str String. 162 */ 163 var ucFirst = function( str ) 164 { 165 str += ''; 166 var f = str.charAt( 0 ).toUpperCase(); 167 return f + str.substr( 1 ); 168 }; 169 170 /** 171 * The onlick function assigned to the 'Browse Server' button. Opens the 172 * file browser and updates target field when file is selected. 173 * 174 * @param {CKEDITOR.event} 175 * evt The event object. 176 */ 177 var browseServer = function( evt ) 178 { 179 sourceElement = this; 180 181 var dialog = this.getDialog(); 182 var width = editorInstance.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowWidth' ] 183 || editorInstance.config.filebrowserWindowWidth || '80%'; 184 var height = editorInstance.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowHeight' ] 185 || editorInstance.config.filebrowserWindowHeight || '70%'; 186 187 var params = this.filebrowser.params || {}; 188 params.CKEditor = editorInstance.name; 189 params.CKEditorFuncNum = functionNumber; 190 if ( !params.langCode ) 191 params.langCode = editorInstance.langCode; 192 193 url = addQueryString( this.filebrowser.url, params ); 194 editorInstance.popup( url, width, height ); 195 }; 196 197 /** 198 * The onlick function assigned to the 'Upload' button. Makes the final 199 * decision whether form is really submitted and updates target field when 200 * file is uploaded. 201 * 202 * @param {CKEDITOR.event} 203 * evt The event object. 204 */ 205 var uploadFile = function( evt ) 206 { 207 sourceElement = this; 208 209 var dialog = this.getDialog(); 210 211 // If user didn't select the file, stop the upload. 212 if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement().$.value ) 213 return false; 214 215 if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getAction() ) 216 return false; 217 218 return true; 219 }; 220 221 /** 222 * Setups the file element. 223 * 224 * @param {CKEDITOR.ui.dialog.file} 225 * fileInput The file element used during file upload. 226 * @param {Object} 227 * filebrowser Object containing filebrowser settings assigned to 228 * the fileButton associated with this file element. 229 */ 230 var setupFileElement = function( fileInput, filebrowser ) 231 { 232 var params = filebrowser.params || {}; 233 params.CKEditor = editorInstance.name; 234 params.CKEditorFuncNum = functionNumber; 235 if ( !params.langCode ) 236 params.langCode = editorInstance.langCode; 237 238 fileInput.action = addQueryString( filebrowser.url, params ); 239 fileInput.filebrowser = filebrowser; 240 }; 241 242 /** 243 * Traverse through the content definition and attach filebrowser to 244 * elements with 'filebrowser' attribute. 245 * 246 * @param String 247 * dialogName Dialog name. 248 * @param {CKEDITOR.dialog.dialogDefinitionObject} 249 * definition Dialog definition. 250 * @param {Array} 251 * elements Array of {@link CKEDITOR.dialog.contentDefinition} 252 * objects. 253 */ 254 var attachFileBrowser = function( dialogName, definition, elements ) 255 { 256 var element, fileInput; 257 258 for ( var i in elements ) 259 { 260 element = elements[ i ]; 261 262 if ( element.type == 'hbox' || element.type == 'vbox' ) 263 attachFileBrowser( dialogName, definition, element.children ); 264 265 if ( !element.filebrowser ) 266 continue; 267 268 if ( typeof element.filebrowser == 'string' ) 269 { 270 var fb = 271 { 272 action : ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse', 273 target : element.filebrowser 274 }; 275 element.filebrowser = fb; 276 } 277 278 if ( element.filebrowser.action == 'Browse' ) 279 { 280 var url = element.filebrowser.url || editorInstance.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ] 281 || editorInstance.config.filebrowserBrowseUrl; 282 283 if ( url ) 284 { 285 element.onClick = browseServer; 286 element.filebrowser.url = url; 287 element.hidden = false; 288 } 289 290 } 291 else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] ) 292 { 293 var url = element.filebrowser.url || editorInstance.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ] 294 || editorInstance.config.filebrowserUploadUrl; 295 296 if ( url ) 297 { 298 element.onClick = uploadFile; 299 element.filebrowser.url = url; 300 element.hidden = false; 301 setupFileElement( definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser ); 302 } 303 } 304 } 305 }; 306 307 /** 308 * Updates the target element with the url of uploaded/selected file. 309 * 310 * @param {String} 311 * url The url of a file. 312 */ 313 var updateTargetElement = function( url ) 314 { 315 var dialog = sourceElement.getDialog(); 316 var targetElement = sourceElement.filebrowser.target || null; 317 url = url.replace( /#/g, '%23' ); 318 319 // If there is a reference to targetElement, update it. 320 if ( targetElement ) 321 { 322 if ( targetElement === true ) 323 targetElement = 'url'; 324 325 if ( targetElement.indexOf( ':' ) == -1 ) 326 { 327 dialog.foreach( function( element ) 328 { 329 if ( element.id == targetElement ) 330 { 331 element.setValue( url ); 332 dialog.selectPage( element.getParentTab() ); 333 } 334 } ); 335 } 336 else 337 { 338 var target = targetElement.split( ':' ); 339 var element = dialog.getContentElement( target[ 0 ], target[ 1 ] ); 340 if ( element ) 341 { 342 element.setValue( url ); 343 dialog.selectPage( target[ 0 ] ); 344 } 345 } 346 } 347 }; 348 349 /** 350 * Returns true if filebrowser is configured in one of the elements. 351 * 352 * @param {CKEDITOR.dialog.dialogDefinitionObject} 353 * definition Dialog definition. 354 * @param String 355 * tabId The tab id where element(s) can be found. 356 * @param String 357 * elementId The element id (or ids, separated with a semicolon) to check. 358 */ 359 var isConfigured = function( definition, tabId, elementId ) 360 { 361 if ( elementId.indexOf( ";" ) !== -1 ) 362 { 363 var ids = elementId.split( ";" ); 364 for ( var i = 0 ; i < ids.length ; i++ ) 365 { 366 if ( isConfigured( definition, tabId, ids[i]) ) 367 return true; 368 } 369 return false; 370 } 371 372 return ( definition.getContents( tabId ).get( elementId ).filebrowser && definition.getContents( tabId ).get( elementId ).filebrowser.url ); 373 }; 374 375 var setUrl = function( fileUrl, data ) 376 { 377 var dialog = sourceElement.getDialog(), 378 targetInput = sourceElement[ 'for' ], 379 onSelect = sourceElement.filebrowser.onSelect; 380 381 if ( targetInput ) 382 { 383 var formAction = dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).getAction(); 384 dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).reset( formAction ); 385 } 386 387 if ( onSelect && onSelect.call( sourceElement, fileUrl, data ) === false ) 388 return; 389 390 // The "data" argument may be used to pass the error message to the editor. 391 if ( typeof data == 'string' && data ) 392 alert( data ); 393 394 if ( fileUrl ) 395 updateTargetElement( fileUrl ); 396 }; 397 398 CKEDITOR.plugins.add( 'filebrowser', 399 { 400 init : function( editor, pluginPath ) 401 { 402 functionNumber = CKEDITOR.tools.addFunction( setUrl, editor ); 403 404 CKEDITOR.on( 'dialogDefinition', function( evt ) 405 { 406 editorInstance = editor; 407 408 // Associate filebrowser to elements with 'filebrowser' attribute. 409 for ( var i in evt.data.definition.contents ) 410 { 411 attachFileBrowser( evt.data.name, evt.data.definition, evt.data.definition.contents[ i ].elements ); 412 if ( evt.data.definition.contents[ i ].hidden && evt.data.definition.contents[ i ].filebrowser ) 413 { 414 evt.data.definition.contents[ i ].hidden = 415 !isConfigured( evt.data.definition, evt.data.definition.contents[ i ][ 'id' ], evt.data.definition.contents[ i ].filebrowser ); 416 } 417 } 418 } ); 419 } 420 } ); 421 422 } )(); -
_source/plugins/flash/dialogs/flash.js
181 181 title : editor.lang.flash.title, 182 182 minWidth : 420, 183 183 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 },192 184 onShow : function() 193 185 { 194 186 // Clear previously saved elements. … … 347 339 { 348 340 type : 'button', 349 341 id : 'browse', 342 filebrowser : 'src', 343 hidden : true, 350 344 align : 'center', 351 345 label : editor.lang.common.browseServer 352 346 } … … 438 432 }, 439 433 { 440 434 id : 'Upload', 435 hidden : true, 436 filebrowser : 'uploadButton', 441 437 label : editor.lang.common.upload, 442 438 elements : 443 439 [ … … 445 441 type : 'file', 446 442 id : 'upload', 447 443 label : editor.lang.common.upload, 448 action : editor.config.image_uploadAction,449 444 size : 38 450 445 }, 451 446 { 452 447 type : 'fileButton', 453 448 id : 'uploadButton', 454 449 label : editor.lang.common.uploadSubmit, 450 filebrowser : 'src', 455 451 'for' : [ 'Upload', 'upload' ] 456 452 } 457 453 ] -
_source/plugins/flash/plugin.js
142 142 143 143 CKEDITOR.tools.extend( CKEDITOR.config, 144 144 { 145 flashUploadTab : true,146 flashUploadAction : 'nowhere.php',147 flashBrowseServer : true,148 149 145 /** 150 146 * Save as EMBED tag only. This tag is unrecommended. 151 147 * @type Boolean -
_source/plugins/image/dialogs/image.js
445 445 id : 'browse', 446 446 align : 'center', 447 447 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' 458 450 } 459 451 ] 460 452 } … … 930 922 { 931 923 type : 'button', 932 924 id : 'browse', 925 filebrowser : 'Link:txtUrl', 933 926 style : 'float:right', 934 label : editor.lang.common.browseServer, 935 onClick : function() 936 { 937 } 927 hidden : true, 928 label : editor.lang.common.browseServer 938 929 }, 939 930 { 940 931 id : 'cmbTarget', … … 967 958 }, 968 959 { 969 960 id : 'Upload', 961 hidden : true, 962 filebrowser : 'uploadButton', 970 963 label : editor.lang.image.upload, 971 964 elements : 972 965 [ … … 974 967 type : 'file', 975 968 id : 'upload', 976 969 label : editor.lang.image.btnUpload, 977 action : editor.config.image_uploadAction,978 970 size : 38 979 971 }, 980 972 { 981 973 type : 'fileButton', 982 974 id : 'uploadButton', 975 filebrowser : 'info:txtUrl', 983 976 label : editor.lang.image.btnUpload, 984 977 'for' : [ 'Upload', 'upload' ] 985 978 } -
_source/plugins/image/plugin.js
54 54 } 55 55 } ); 56 56 57 /**58 * Show Browse Server button.59 * @type Boolean60 * @default true61 */62 CKEDITOR.config.image_browseServer = true;63 64 /**65 * Upload action attribute.66 * @type URL67 */68 CKEDITOR.config.image_uploadAction = 'nowhere.php';69 70 57 CKEDITOR.config.image_removeLinkByEmptyURL = true; -
_source/plugins/link/dialogs/link.js
41 41 { 42 42 if ( editor.config.linkShowTargetTab ) 43 43 dialog.showPage( 'target' ); 44 if ( editor.config.linkUploadTab)44 if ( !dialog.isInitiallyHidden( 'upload' ) ) 45 45 dialog.showPage( 'upload' ); 46 46 } 47 47 else 48 48 { 49 49 dialog.hidePage( 'target' ); 50 dialog.hidePage( 'upload' ); 50 if ( !dialog.isInitiallyHidden( 'upload' ) ) 51 dialog.hidePage( 'upload' ); 51 52 } 52 53 53 54 for ( var i = 0 ; i < partIds.length ; i++ ) … … 388 389 { 389 390 type : 'button', 390 391 id : 'browse', 392 hidden : 'true', 393 filebrowser : 'url', 391 394 label : editor.lang.common.browseServer 392 395 } 393 396 ] … … 815 818 id : 'upload', 816 819 label : editor.lang.link.upload, 817 820 title : editor.lang.link.upload, 821 hidden : true, 822 filebrowser : 'uploadButton', 818 823 elements : 819 824 [ 820 825 { 821 826 type : 'file', 822 827 id : 'upload', 823 828 label : editor.lang.common.upload, 824 action : editor.config.linkUploadAction,825 829 size : 38 826 830 }, 827 831 { 828 832 type : 'fileButton', 829 833 id : 'uploadButton', 830 834 label : editor.lang.common.uploadSubmit, 835 filebrowser : 'url', 831 836 'for' : [ 'upload', 'upload' ] 832 837 } 833 838 ] … … 1039 1044 case 'url': 1040 1045 var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://', 1041 1046 url = ( data.url && data.url.url ) || ''; 1042 attributes._cke_saved_href = protocol + url;1047 attributes._cke_saved_href = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url; 1043 1048 break; 1044 1049 case 'anchor': 1045 1050 var name = ( data.anchor && data.anchor.name ), … … 1195 1200 }, 1196 1201 onLoad : function() 1197 1202 { 1198 if ( !editor.config.linkUploadTab )1199 this.hidePage( 'upload' ); //Hide Upload tab.1200 1201 1203 if ( !editor.config.linkShowAdvancedTab ) 1202 1204 this.hidePage( 'advanced' ); //Hide Advanded tab. 1203 1205 1204 if ( !editor.config.linkBrowseServer )1205 this.getContentElement( 'info', 'browse' ).getElement().hide();1206 1207 1206 if ( !editor.config.linkShowTargetTab ) 1208 1207 this.hidePage( 'target' ); //Hide Target tab. 1209 1208 -
_source/plugins/link/plugin.js
183 183 184 184 CKEDITOR.tools.extend( CKEDITOR.config, 185 185 { 186 linkUploadTab : true,187 linkBrowseServer : true,188 linkUploadAction : 'nowhere.php',189 186 linkShowAdvancedTab : true, 190 187 linkShowTargetTab : true 191 188 } ); -
_source/plugins/popup/plugin.js
1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 CKEDITOR.plugins.add( 'popup'); 7 8 CKEDITOR.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
153 153 '_source/plugins/pagebreak/plugin.js', 154 154 '_source/plugins/pastefromword/plugin.js', 155 155 '_source/plugins/pastetext/plugin.js', 156 '_source/plugins/popup/plugin.js', 156 157 '_source/plugins/preview/plugin.js', 157 158 '_source/plugins/print/plugin.js', 158 159 '_source/plugins/removeformat/plugin.js', 159 160 '_source/plugins/resize/plugin.js', 160 161 '_source/plugins/save/plugin.js', 162 '_source/plugins/filebrowser/plugin.js', 161 163 '_source/plugins/scayt/plugin.js', 162 164 '_source/plugins/smiley/plugin.js', 163 165 '_source/plugins/showblocks/plugin.js',