JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.2
[ckeditor.git] / _source / plugins / filebrowser / plugin.js
index 799d68f..5f87180 100644 (file)
@@ -4,15 +4,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 */\r
 \r
 /**\r
- * @fileOverview The "filebrowser" plugin, it adds support for file uploads and\r
+ * @fileOverview The "filebrowser" plugin that adds support for file uploads and\r
  *               browsing.\r
  *\r
- * When file is selected inside of the file browser or uploaded, its url is\r
- * inserted automatically to a field, which is described in the 'filebrowser'\r
- * attribute. To specify field that should be updated, pass the tab id and\r
- * element id, separated with a colon.\r
+ * When a file is uploaded or selected inside the file browser, its URL is\r
+ * inserted automatically into a field defined in the <code>filebrowser</code>\r
+ * attribute. In order to specify a field that should be updated, pass the tab ID and\r
+ * the element ID, separated with a colon.<br /><br />\r
  *\r
- * Example 1: (Browse)\r
+ * <strong>Example 1: (Browse)</strong>\r
  *\r
  * <pre>\r
  * {\r
@@ -23,10 +23,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  * }\r
  * </pre>\r
  *\r
- * If you set the 'filebrowser' attribute on any element other than\r
- * 'fileButton', the 'Browse' action will be triggered.\r
+ * If you set the <code>filebrowser</code> attribute for an element other than\r
+ * the <code>fileButton</code>, the <code>Browse</code> action will be triggered.<br /><br />\r
  *\r
- * Example 2: (Quick Upload)\r
+ * <strong>Example 2: (Quick Upload)</strong>\r
  *\r
  * <pre>\r
  * {\r
@@ -38,23 +38,23 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  * }\r
  * </pre>\r
  *\r
- * If you set the 'filebrowser' attribute on a fileButton element, the\r
- * 'QuickUpload' action will be executed.\r
+ * If you set the <code>filebrowser</code> attribute for a <code>fileButton</code>\r
+ * element, the <code>QuickUpload</code> action will be executed.<br /><br />\r
  *\r
- * Filebrowser plugin also supports more advanced configuration (through\r
- * javascript object).\r
+ * The filebrowser plugin also supports more advanced configuration performed through\r
+ * a JavaScript object.\r
  *\r
  * The following settings are supported:\r
  *\r
- * <pre>\r
- *  [action] - Browse or QuickUpload\r
- *  [target] - field to update, tabId:elementId\r
- *  [params] - additional arguments to be passed to the server connector (optional)\r
- *  [onSelect] - function to execute when file is selected/uploaded (optional)\r
- *  [url] - the URL to be called (optional)\r
- * </pre>\r
+ * <ul>\r
+ * <li><code>action</code> &ndash; <code>Browse</code> or <code>QuickUpload</code>.</li>\r
+ * <li><code>target</code> &ndash; the field to update in the <code><em>tabId:elementId</em></code> format.</li>\r
+ * <li><code>params</code> &ndash; additional arguments to be passed to the server connector (optional).</li>\r
+ * <li><code>onSelect</code> &ndash; a function to execute when the file is selected/uploaded (optional).</li>\r
+ * <li><code>url</code> &ndash; the URL to be called (optional).</li>\r
+ * </ul>\r
  *\r
- * Example 3: (Quick Upload)\r
+ * <strong>Example 3: (Quick Upload)</strong>\r
  *\r
  * <pre>\r
  * {\r
@@ -63,16 +63,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  *     id : 'buttonId',\r
  *     filebrowser :\r
  *     {\r
- *             action : 'QuickUpload', //required\r
- *             target : 'tab1:elementId', //required\r
- *             params : //optional\r
+ *             action : 'QuickUpload', // required\r
+ *             target : 'tab1:elementId', // required\r
+ *             params : // optional\r
  *             {\r
  *                     type : 'Files',\r
  *                     currentFolder : '/folder/'\r
  *             },\r
- *             onSelect : function( fileUrl, errorMessage ) //optional\r
+ *             onSelect : function( fileUrl, errorMessage ) // optional\r
  *             {\r
- *                     // Do not call the built-in selectFuntion\r
+ *                     // Do not call the built-in selectFuntion.\r
  *                     // return false;\r
  *             }\r
  *     },\r
@@ -80,14 +80,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  * }\r
  * </pre>\r
  *\r
- * Suppose we have a file element with id 'myFile', text field with id\r
- * 'elementId' and a fileButton. If filebowser.url is not specified explicitly,\r
- * form action will be set to 'filebrowser[DialogName]UploadUrl' or, if not\r
- * specified, to 'filebrowserUploadUrl'. Additional parameters from 'params'\r
- * object will be added to the query string. It is possible to create your own\r
- * uploadHandler and cancel the built-in updateTargetElement command.\r
+ * Suppose you have a file element with an ID of <code>myFile</code>, a text\r
+ * field with an ID of <code>elementId</code> and a <code>fileButton</code>.\r
+ * If the <code>filebowser.url</code> attribute is not specified explicitly,\r
+ * the form action will be set to <code>filebrowser[<em>DialogWindowName</em>]UploadUrl</code>\r
+ * or, if not specified, to <code>filebrowserUploadUrl</code>. Additional parameters\r
+ * from the <code>params</code> object will be added to the query string. It is\r
+ * possible to create your own <code>uploadHandler</code> and cancel the built-in\r
+ * <code>updateTargetElement</code> command.<br /><br />\r
  *\r
- * Example 4: (Browse)\r
+ * <strong>Example 4: (Browse)</strong>\r
  *\r
  * <pre>\r
  * {\r
@@ -103,12 +105,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  * }\r
  * </pre>\r
  *\r
- * In this example, after pressing a button, file browser will be opened in a\r
- * popup. If we don't specify filebrowser.url attribute,\r
- * 'filebrowser[DialogName]BrowseUrl' or 'filebrowserBrowseUrl' will be used.\r
- * After selecting a file in a file browser, an element with id 'elementId' will\r
- * be updated. Just like in the third example, a custom 'onSelect' function may be\r
- * defined.\r
+ * In this example, when the button is pressed, the file browser will be opened in a\r
+ * popup window. If you do not specify the <code>filebrowser.url</code> attribute,\r
+ * <code>filebrowser[<em>DialogName</em>]BrowseUrl</code> or\r
+ * <code>filebrowserBrowseUrl</code> will be used. After selecting a file in the file\r
+ * browser, an element with an ID of <code>elementId</code> will be updated. Just\r
+ * like in the third example, a custom <code>onSelect</code> function may be defined.\r
  */\r
 ( function()\r
 {\r
@@ -174,7 +176,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        params.langCode = editor.langCode;\r
 \r
                var url = addQueryString( this.filebrowser.url, params );\r
-               editor.popup( url, width, height, editor.config.fileBrowserWindowFeatures );\r
+               // TODO: V4: Remove backward compatibility (#8163).\r
+               editor.popup( url, width, height, editor.config.filebrowserWindowFeatures || editor.config.fileBrowserWindowFeatures );\r
        }\r
 \r
        /*\r
@@ -413,99 +416,105 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 } )();\r
 \r
 /**\r
- * The location of an external file browser, that should be launched when "Browse Server" button is pressed.\r
- * If configured, the "Browse Server" button will appear in Link, Image and Flash dialogs.\r
+ * The location of an external file browser that should be launched when the <strong>Browse Server</strong>\r
+ * button is pressed. If configured, the <strong>Browse Server</strong> button will appear in the\r
+ * <strong>Link</strong>, <strong>Image</strong>, and <strong>Flash</strong> dialog windows.\r
  * @see The <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)">File Browser/Uploader</a> documentation.\r
  * @name CKEDITOR.config.filebrowserBrowseUrl\r
  * @since 3.0\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserBrowseUrl = '/browser/browse.php';\r
  */\r
 \r
 /**\r
- * The location of a script that handles file uploads.\r
- * If set, the "Upload" tab will appear in "Link", "Image" and "Flash" dialogs.\r
+ * The location of the script that handles file uploads.\r
+ * If set, the <strong>Upload</strong> tab will appear in the <strong>Link</strong>, <strong>Image</strong>,\r
+ * and <strong>Flash</strong> dialog windows.\r
  * @name CKEDITOR.config.filebrowserUploadUrl\r
  * @see The <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)">File Browser/Uploader</a> documentation.\r
  * @since 3.0\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserUploadUrl = '/uploader/upload.php';\r
  */\r
 \r
 /**\r
- * The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.\r
- * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserBrowseUrl}.\r
+ * The location of an external file browser that should be launched when the <strong>Browse Server</strong>\r
+ * button is pressed in the <strong>Image</strong> dialog window.\r
+ * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserBrowseUrl}</code>.\r
  * @name CKEDITOR.config.filebrowserImageBrowseUrl\r
  * @since 3.0\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images';\r
  */\r
 \r
 /**\r
- * The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.\r
- * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserBrowseUrl}.\r
+ * The location of an external file browser that should be launched when the <strong>Browse Server</strong>\r
+ * button is pressed in the <strong>Flash</strong> dialog window.\r
+ * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserBrowseUrl}</code>.\r
  * @name CKEDITOR.config.filebrowserFlashBrowseUrl\r
  * @since 3.0\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserFlashBrowseUrl = '/browser/browse.php?type=Flash';\r
  */\r
 \r
 /**\r
- * The location of a script that handles file uploads in the Image dialog.\r
- * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserUploadUrl}.\r
+ * The location of the script that handles file uploads in the <strong>Image</strong> dialog window.\r
+ * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserUploadUrl}</code>.\r
  * @name CKEDITOR.config.filebrowserImageUploadUrl\r
  * @since 3.0\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserImageUploadUrl = '/uploader/upload.php?type=Images';\r
  */\r
 \r
 /**\r
- * The location of a script that handles file uploads in the Flash dialog.\r
- * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserUploadUrl}.\r
+ * The location of the script that handles file uploads in the <strong>Flash</strong> dialog window.\r
+ * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserUploadUrl}</code>.\r
  * @name CKEDITOR.config.filebrowserFlashUploadUrl\r
  * @since 3.0\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserFlashUploadUrl = '/uploader/upload.php?type=Flash';\r
  */\r
 \r
 /**\r
- * The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.\r
- * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserBrowseUrl}.\r
+ * The location of an external file browser that should be launched when the <strong>Browse Server</strong>\r
+ * button is pressed in the <strong>Link</strong> tab of the <strong>Image</strong> dialog window.\r
+ * If not set, CKEditor will use <code>{@link CKEDITOR.config.filebrowserBrowseUrl}</code>.\r
  * @name CKEDITOR.config.filebrowserImageBrowseLinkUrl\r
  * @since 3.2\r
  * @type String\r
- * @default '' (empty string = disabled)\r
+ * @default <code>''</code> (empty string = disabled)\r
  * @example\r
  * config.filebrowserImageBrowseLinkUrl = '/browser/browse.php';\r
  */\r
 \r
 /**\r
- * The "features" to use in the file browser popup window.\r
+ * The features to use in the file browser popup window.\r
  * @name CKEDITOR.config.filebrowserWindowFeatures\r
  * @since 3.4.1\r
  * @type String\r
- * @default 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes'\r
+ * @default <code>'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes'</code>\r
  * @example\r
  * config.filebrowserWindowFeatures = 'resizable=yes,scrollbars=no';\r
  */\r
 \r
 /**\r
- * The width of the file browser popup window. It can be a number or a percent string.\r
+ * The width of the file browser popup window. It can be a number denoting a value in\r
+ * pixels or a percent string.\r
  * @name CKEDITOR.config.filebrowserWindowWidth\r
  * @type Number|String\r
- * @default '80%'\r
+ * @default <code>'80%'</code>\r
  * @example\r
  * config.filebrowserWindowWidth = 750;\r
  * @example\r
@@ -513,10 +522,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  */\r
 \r
 /**\r
- * The height of the file browser popup window. It can be a number or a percent string.\r
+ * The height of the file browser popup window. It can be a number denoting a value in\r
+ * pixels or a percent string.\r
  * @name CKEDITOR.config.filebrowserWindowHeight\r
  * @type Number|String\r
- * @default '70%'\r
+ * @default <code>'70%'</code>\r
  * @example\r
  * config.filebrowserWindowHeight = 580;\r
  * @example\r