Browse files

Builds for additional fixes for #2532705

  • Loading branch information...
1 parent 10564ff commit 95c7f187b6f8d318ae87694ee3fc6281027badc0 @allenrabinovich committed Nov 10, 2012
View
4 build/uploader-flash/uploader-flash-coverage.js
@@ -26,7 +26,7 @@ _yuitest_coverage["build/uploader-flash/uploader-flash.js"] = {
path: "build/uploader-flash/uploader-flash.js",
code: []
};
-_yuitest_coverage["build/uploader-flash/uploader-flash.js"].code=["YUI.add('uploader-flash', function (Y, NAME) {","",""," /**"," * This module provides a UI for file selection and multiple file upload capability using"," * Flash as a transport engine."," * The supported features include: automatic upload queue management, upload progress"," * tracking, file filtering, server response retrieval and error reporting."," *"," * @module uploader-flash"," */ ","","// Shorthands for external modules","var substitute = Y.substitute,"," UploaderQueue = Y.Uploader.Queue,"," getCN = Y.ClassNameManager.getClassName,"," UPLOADER = 'uploader',"," SELECT_FILES = getCN(UPLOADER, 'selectfiles-button');","",""," /**"," * This module provides a UI for file selection and multiple file upload capability"," * using Flash as a transport engine."," * @class UploaderFlash"," * @extends Widget"," * @constructor"," * @param {Object} config Configuration object."," */","","function UploaderFlash(config) {"," UploaderFlash.superclass.constructor.apply ( this, arguments );","}","","","","Y.UploaderFlash = Y.extend(UploaderFlash, Y.Widget, {",""," /**"," * Stored value of the current button state (based on "," * mouse events dispatched by the Flash player)"," * @property _buttonState"," * @type {String}"," * @protected"," */"," _buttonState: \"up\",",""," /**"," * Stored value of the current button focus state (based "," * on keyboard and mouse events)."," * @property _buttonFocus"," * @type {Boolean}"," * @protected"," */"," _buttonFocus: false,",""," /**"," * Stored value of the unique id for the container that holds the "," * Flash uploader."," *"," * @property _swfContainerId"," * @type {String}"," * @protected"," */"," _swfContainerId: null,",""," /**"," * Stored reference to the instance of SWF used to host the"," * Flash uploader."," *"," * @property _swfReference"," * @type {SWF}"," * @protected"," */"," _swfReference: null,",""," /**"," * Stored reference to the instance of Uploader.Queue used to manage"," * the upload process. This is a read-only property that only exists"," * during an active upload process. Only one queue can be active at"," * a time; if an upload start is attempted while a queue is active,"," * it will be ignored."," *"," * @property queue"," * @type {Y.Uploader.Queue}"," */"," queue: null,",""," /**"," * Stored event bindings for keyboard navigation to and from the uploader."," *"," * @property _tabElementBindings"," * @type {Object}"," * @protected"," */"," _tabElementBindings: null,","","","/**"," * Construction logic executed during UploaderFlash instantiation."," *"," * @method initializer"," * @protected"," */"," initializer : function () {",""," // Assign protected variable values"," this._swfContainerId = Y.guid(\"uploader\");"," this._swfReference = null;"," this.queue = null;"," this._buttonState = \"up\";"," this._buttonFocus = null;"," this._tabElementBindings = null;"," this._fileList = [];",""," // Publish available events",""," /**"," * Signals that files have been selected. "," *"," * @event fileselect"," * @param event {Event} The event object for the `fileselect` with the"," * following payload:"," * <dl>"," * <dt>fileList</dt>"," * <dd>An `Array` of files selected by the user, encapsulated"," * in Y.FileFlash objects.</dd>"," * </dl>"," */"," this.publish(\"fileselect\");",""," /**"," * Signals that an upload of multiple files has been started. "," *"," * @event uploadstart"," * @param event {Event} The event object for the `uploadstart`."," */"," this.publish(\"uploadstart\");",""," /**"," * Signals that an upload of a specific file has started. "," *"," * @event fileuploadstart"," * @param event {Event} The event object for the `fileuploadstart` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>A reference to the Y.File that dispatched the event.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by Y.File.</dd>"," * </dl>"," */"," this.publish(\"fileuploadstart\");",""," /**"," * Reports on upload progress of a specific file. "," *"," * @event uploadprogress"," * @param event {Event} The event object for the `uploadprogress` with the"," * following payload:"," * <dl>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file that has been uploaded, out of 100</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by the SWF uploader</dd>"," * </dl>"," */"," this.publish(\"uploadprogress\");",""," /**"," * Reports on the total upload progress of the file list. "," *"," * @event totaluploadprogress"," * @param event {Event} The event object for the `totaluploadprogress` with the"," * following payload:"," * <dl>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file list that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file list</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file list that has been uploaded, out of 100</dd>"," * </dl>"," */"," this.publish(\"totaluploadprogress\");",""," /**"," * Signals that a single file upload has been completed. "," *"," * @event uploadcomplete"," * @param event {Event} The event object for the `uploadcomplete` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>The pointer to the instance of `Y.File` whose upload has been completed.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event fired by the SWF Uploader</dd>"," * <dt>data</dt>"," * <dd>Data returned by the server.</dd>"," * </dl>"," */"," this.publish(\"uploadcomplete\");",""," /**"," * Signals that the upload process of the entire file list has been completed. "," *"," * @event alluploadscomplete"," * @param event {Event} The event object for the `alluploadscomplete`."," */"," this.publish(\"alluploadscomplete\");",""," /**"," * Signals that a error has occurred in a specific file's upload process. "," *"," * @event uploaderror"," * @param event {Event} The event object for the `uploaderror` with the"," * following payload:"," * <dl>"," * <dt>originEvent</dt>"," * <dd>The original error event fired by the SWF Uploader. </dd>"," * <dt>file</dt>"," * <dd>The pointer at the instance of Y.FileFlash that returned the error.</dd>"," * <dt>source</dt>"," * <dd>The source of the upload error, either \"io\" or \"http\"</dd> "," * <dt>message</dt>"," * <dd>The message that accompanied the error. Corresponds to the text of"," * the error in cases where source is \"io\", and to the HTTP status for"," cases where source is \"http\".</dd> "," * </dl>"," */"," this.publish(\"uploaderror\");",""," /**"," * Signals that a mouse has begun hovering over the `Select Files` button. "," *"," * @event mouseenter"," * @param event {Event} The event object for the `mouseenter` event."," */"," this.publish(\"mouseenter\");",""," /**"," * Signals that a mouse has stopped hovering over the `Select Files` button. "," *"," * @event mouseleave"," * @param event {Event} The event object for the `mouseleave` event."," */"," this.publish(\"mouseleave\");",""," /**"," * Signals that a mouse button has been pressed over the `Select Files` button. "," *"," * @event mousedown"," * @param event {Event} The event object for the `mousedown` event."," */"," this.publish(\"mousedown\");",""," /**"," * Signals that a mouse button has been released over the `Select Files` button. "," *"," * @event mouseup"," * @param event {Event} The event object for the `mouseup` event."," */"," this.publish(\"mouseup\");",""," /**"," * Signals that a mouse has been clicked over the `Select Files` button. "," *"," * @event click"," * @param event {Event} The event object for the `click` event."," */"," this.publish(\"click\");"," },",""," /**"," * Creates the DOM structure for the UploaderFlash."," * UploaderFlash's DOM structure consists of two layers: the base \"Select Files\""," * button that can be replaced by the developer's widget of choice; and a transparent"," * Flash overlay positoned above the button that captures all input events."," * The `position` style attribute of the `boundingBox` of the `Uploader` widget"," * is forced to be `relative`, in order to accommodate the Flash player overlay"," * (which is `position`ed `absolute`ly)."," *"," * @method renderUI"," * @protected"," */"," renderUI : function () {"," var boundingBox = this.get(\"boundingBox\"),"," contentBox = this.get('contentBox'),"," selFilesButton = this.get(\"selectFilesButton\");"," "," boundingBox.setStyle(\"position\", \"relative\");"," selFilesButton.setStyles({width: \"100%\", height: \"100%\"});"," contentBox.append(selFilesButton);"," contentBox.append(Y.Node.create(substitute(UploaderFlash.FLASH_CONTAINER, "," {swfContainerId: this._swfContainerId})));"," var flashContainer = Y.one(\"#\" + this._swfContainerId);"," var params = {version: \"10.0.45\","," fixedAttributes: {wmode: \"transparent\", "," allowScriptAccess:\"always\", "," allowNetworking:\"all\", "," scale: \"noscale\""," }"," };"," this._swfReference = new Y.SWF(flashContainer, this.get(\"swfURL\"), params);"," },",""," /**"," * Binds handlers to the UploaderFlash UI events and propagates attribute"," * values to the Flash player."," * The propagation of initial values is set to occur once the Flash player "," * instance is ready (as indicated by the `swfReady` event.)"," *"," * @method bindUI"," * @protected"," */"," bindUI : function () {",""," this._swfReference.on(\"swfReady\", function () {"," this._setMultipleFiles();"," this._setFileFilters();"," this._triggerEnabled();"," this._attachTabElements();"," this.after(\"multipleFilesChange\", this._setMultipleFiles, this);"," this.after(\"fileFiltersChange\", this._setFileFilters, this);"," this.after(\"enabledChange\", this._triggerEnabled, this);"," this.after(\"tabElementsChange\", this._attachTabElements);"," }, this);"," "," this._swfReference.on(\"fileselect\", this._updateFileList, this);","","",""," // this._swfReference.on(\"trace\", function (ev) {console.log(ev.message);});",""," this._swfReference.on(\"mouseenter\", function () {"," this.fire(\"mouseenter\");"," this._setButtonClass(\"hover\", true);"," if (this._buttonState == \"down\") {"," this._setButtonClass(\"active\", true);"," }"," }, this);"," this._swfReference.on(\"mouseleave\", function () {"," this.fire(\"mouseleave\");"," this._setButtonClass(\"hover\", false);"," this._setButtonClass(\"active\", false);"," "," }, this);"," this._swfReference.on(\"mousedown\", function () {"," this.fire(\"mousedown\");"," this._buttonState = \"down\";"," this._setButtonClass(\"active\", true);"," }, this);"," this._swfReference.on(\"mouseup\", function () {"," this.fire(\"mouseup\");"," this._buttonState = \"up\";"," this._setButtonClass(\"active\", false);"," }, this);"," this._swfReference.on(\"click\", function () {"," this.fire(\"click\");"," this._buttonFocus = true;"," this._setButtonClass(\"focus\", true);"," Y.one(\"body\").focus();"," this._swfReference._swf.focus();"," }, this);"," },",""," /**"," * Attaches keyboard bindings to enabling tabbing to and from the instance of the Flash"," * player in the Uploader widget. If the previous and next elements are specified, the"," * keyboard bindings enable the user to tab from the `tabElements[\"from\"]` node to the "," * Flash-powered \"Select Files\" button, and to the `tabElements[\"to\"]` node. "," *"," * @method _attachTabElements"," * @protected"," * @param ev {Event} Optional event payload if called as a `tabElementsChange` handler."," */"," _attachTabElements : function (ev) {"," if (this.get(\"tabElements\") !== null && this.get(\"tabElements\").from !== null && this.get(\"tabElements\").to !== null) {",""," if (this._tabElementBindings !== null) {"," this._tabElementBindings.from.detach();"," this._tabElementBindings.to.detach();"," this._tabElementBindings.tabback.detach();"," this._tabElementBindings.tabforward.detach();"," this._tabElementBindings.focus.detach();"," this._tabElementBindings.blur.detach();"," }"," else {"," this._tabElementBindings = {};"," }",""," var fromElement = Y.one(this.get(\"tabElements\").from);"," var toElement = Y.one(this.get(\"tabElements\").to);","",""," this._tabElementBindings.from = fromElement.on(\"keydown\", function (ev) { "," if (ev.keyCode == 9 && !ev.shiftKey) {"," ev.preventDefault();"," this._swfReference._swf.setAttribute(\"tabindex\", 0); "," this._swfReference._swf.setAttribute(\"role\", \"button\");"," this._swfReference._swf.setAttribute(\"aria-label\", this.get(\"selectButtonLabel\"));"," this._swfReference._swf.focus();"," }"," }, this);"," this._tabElementBindings.to = toElement.on(\"keydown\", function (ev) { "," if (ev.keyCode == 9 && ev.shiftKey) {"," ev.preventDefault();"," this._swfReference._swf.setAttribute(\"tabindex\", 0); "," this._swfReference._swf.setAttribute(\"role\", \"button\");"," this._swfReference._swf.setAttribute(\"aria-label\", this.get(\"selectButtonLabel\"));"," this._swfReference._swf.focus();"," }"," }, this);"," this._tabElementBindings.tabback = this._swfReference.on(\"tabback\", function (ev) {this._swfReference._swf.blur(); setTimeout(function () {fromElement.focus();}, 30);}, this);"," this._tabElementBindings.tabforward = this._swfReference.on(\"tabforward\", function (ev) {this._swfReference._swf.blur(); setTimeout(function () {toElement.focus();}, 30);}, this);",""," this._tabElementBindings.focus = this._swfReference._swf.on(\"focus\", function (ev) {this._buttonFocus = true; this._setButtonClass(\"focus\", true);}, this);"," this._tabElementBindings.blur = this._swfReference._swf.on(\"blur\", function (ev) {this._buttonFocus = false; this._setButtonClass(\"focus\", false);}, this);"," }"," else if (this._tabElementBindings !== null) {"," this._tabElementBindings.from.detach();"," this._tabElementBindings.to.detach();"," this._tabElementBindings.tabback.detach();"," this._tabElementBindings.tabforward.detach();"," this._tabElementBindings.focus.detach();"," this._tabElementBindings.blur.detach();"," }"," },","",""," /**"," * Adds or removes a specified state CSS class to the underlying uploader button. "," *"," * @method _setButtonClass"," * @protected"," * @param state {String} The name of the state enumerated in `buttonClassNames` attribute"," * from which to derive the needed class name."," * @param add {Boolean} A Boolean indicating whether to add or remove the class."," */"," _setButtonClass : function (state, add) {"," if (add) {"," this.get(\"selectFilesButton\").addClass(this.get(\"buttonClassNames\")[state]);"," }"," else {"," this.get(\"selectFilesButton\").removeClass(this.get(\"buttonClassNames\")[state]);"," }"," },","",""," /**"," * Syncs the state of the `fileFilters` attribute between the instance of UploaderFlash"," * and the Flash player."," * "," * @method _setFileFilters"," * @private"," */"," _setFileFilters : function () {"," if (this._swfReference && this.get(\"fileFilters\").length > 0) {"," this._swfReference.callSWF(\"setFileFilters\", [this.get(\"fileFilters\")]);"," } ",""," },","","",""," /**"," * Syncs the state of the `multipleFiles` attribute between this class"," * and the Flash uploader."," * "," * @method _setMultipleFiles"," * @private"," */"," _setMultipleFiles : function () {"," if (this._swfReference) {"," this._swfReference.callSWF(\"setAllowMultipleFiles\", [this.get(\"multipleFiles\")]);"," }"," },",""," /**"," * Syncs the state of the `enabled` attribute between this class"," * and the Flash uploader."," * "," * @method _triggerEnabled"," * @private"," */"," _triggerEnabled : function () {"," if (this.get(\"enabled\")) {"," this._swfReference.callSWF(\"enable\");"," this._swfReference._swf.setAttribute(\"aria-disabled\", \"false\");"," this._setButtonClass(\"disabled\", false);"," }"," else {"," this._swfReference.callSWF(\"disable\");"," this._swfReference._swf.setAttribute(\"aria-disabled\", \"true\");"," this._setButtonClass(\"disabled\", true);"," }"," },",""," /**"," * Getter for the `fileList` attribute"," * "," * @method _getFileList"," * @private"," */"," _getFileList : function (arr) {"," return this._fileList.concat();"," },",""," /**"," * Setter for the `fileList` attribute"," * "," * @method _setFileList"," * @private"," */"," _setFileList : function (val) {"," this._fileList = val.concat();"," return this._fileList.concat();"," },",""," /**"," * Adjusts the content of the `fileList` based on the results of file selection"," * and the `appendNewFiles` attribute. If the `appendNewFiles` attribute is true,"," * then selected files are appended to the existing list; otherwise, the list is"," * cleared and populated with the newly selected files."," * "," * @method _updateFileList"," * @param ev {Event} The file selection event received from the uploader."," * @private"," */"," _updateFileList : function (ev) {"," "," Y.one(\"body\").focus();"," this._swfReference._swf.focus();","",""," var newfiles = ev.fileList,"," fileConfObjects = [],"," parsedFiles = [],"," swfRef = this._swfReference,"," filterFunc = this.get(\"fileFilterFunction\");"," "," Y.each(newfiles, function (value) {"," var newFileConf = {};"," newFileConf.id = value.fileId;"," newFileConf.name = value.fileReference.name;"," newFileConf.size = value.fileReference.size;"," newFileConf.type = value.fileReference.type;"," newFileConf.dateCreated = value.fileReference.creationDate;"," newFileConf.dateModified = value.fileReference.modificationDate;"," newFileConf.uploader = swfRef;",""," fileConfObjects.push(newFileConf);"," });",""," if (filterFunc) {"," Y.each(fileConfObjects, function (value) {"," var newfile = new Y.FileFlash(value);"," if (filterFunc(newfile)) {"," parsedFiles.push(newfile);"," }"," });"," }"," else {"," Y.each(fileConfObjects, function (value) {"," parsedFiles.push(new Y.FileFlash(value));"," });"," }",""," if (parsedFiles.length > 0) {"," var oldfiles = this.get(\"fileList\");",""," this.set(\"fileList\", "," this.get(\"appendNewFiles\") ? oldfiles.concat(parsedFiles) : parsedFiles );",""," this.fire(\"fileselect\", {fileList: parsedFiles});"," }",""," },","","",""," /**"," * Handles and retransmits events fired by `Y.FileFlash` and `Y.Uploader.Queue`."," * "," * @method _uploadEventHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadEventHandler : function (event) {"," "," switch (event.type) {"," case \"file:uploadstart\":"," this.fire(\"fileuploadstart\", event);"," break;"," case \"file:uploadprogress\":"," this.fire(\"uploadprogress\", event);"," break;"," case \"uploaderqueue:totaluploadprogress\":"," this.fire(\"totaluploadprogress\", event);"," break;"," case \"file:uploadcomplete\":"," this.fire(\"uploadcomplete\", event);"," break;"," case \"uploaderqueue:alluploadscomplete\":"," this.queue = null;"," this.fire(\"alluploadscomplete\", event);"," break;"," case \"file:uploaderror\":"," case \"uploaderqueue:uploaderror\":"," this.fire(\"uploaderror\", event);"," break;"," case \"file:uploadcancel\":"," case \"uploaderqueue:uploadcancel\":"," this.fire(\"uploadcancel\", event);"," break;"," } ",""," },","","",""," /**"," * Starts the upload of a specific file."," *"," * @method upload"," * @param file {Y.FileFlash} Reference to the instance of the file to be uploaded."," * @param url {String} The URL to upload the file to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */",""," upload : function (file, url, postvars) {"," "," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\"),"," fileId = file.get(\"id\");",""," postVars = postVars.hasOwnProperty(fileId) ? postVars[fileId] : postVars;",""," if (file instanceof Y.FileFlash) {"," "," file.on(\"uploadstart\", this._uploadEventHandler, this);"," file.on(\"uploadprogress\", this._uploadEventHandler, this);"," file.on(\"uploadcomplete\", this._uploadEventHandler, this);"," file.on(\"uploaderror\", this._uploadEventHandler, this);"," file.on(\"uploadcancel\", this._uploadEventHandler, this);",""," file.startUpload(uploadURL, postVars, this.get(\"fileFieldName\"));"," }"," },",""," /**"," * Starts the upload of all files on the file list, using an automated queue."," *"," * @method uploadAll"," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadAll : function (url, postvars) {"," this.uploadThese(this.get(\"fileList\"), url, postvars);"," },",""," /**"," * Starts the upload of the files specified in the first argument, using an automated queue."," *"," * @method uploadThese"," * @param files {Array} The list of files to upload."," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadThese : function (files, url, postvars) {"," if (!this.queue) {"," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\");",""," this.queue = new UploaderQueue({simUploads: this.get(\"simLimit\"), "," errorAction: this.get(\"errorAction\"),"," fileFieldName: this.get(\"fileFieldName\"),"," fileList: files,"," uploadURL: uploadURL,"," perFileParameters: postVars,"," retryCount: this.get(\"retryCount\")"," });"," this.queue.on(\"uploadstart\", this._uploadEventHandler, this);"," this.queue.on(\"uploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"totaluploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"uploadcomplete\", this._uploadEventHandler, this);"," this.queue.on(\"alluploadscomplete\", this._uploadEventHandler, this);"," this.queue.on(\"alluploadscancelled\", function (ev) {this.queue = null;}, this);"," this.queue.on(\"uploaderror\", this._uploadEventHandler, this);"," this.queue.startUpload(); "," "," this.fire(\"uploadstart\"); "," }"," }","},","","{"," /**"," * The template for the Flash player container. Since the Flash player container needs"," * to completely overlay the &lquot;Select Files&rqot; control, it's positioned absolutely,"," * with width and height set to 100% of the parent."," *"," * @property FLASH_CONTAINER"," * @type {String}"," * @static"," * @default \"<div id='{swfContainerId}' style='position:absolute; top:0px; left: 0px; margin: 0; padding: 0; border: 0; width:100%; height:100%'></div>\""," */"," FLASH_CONTAINER: \"<div id='{swfContainerId}' style='position:absolute; top:0px; left: 0px; margin: 0; padding: 0; border: 0; width:100%; height:100%'></div>\",",""," /**"," * The template for the \"Select Files\" button."," *"," * @property SELECT_FILES_BUTTON"," * @type {String}"," * @static"," * @default \"<button type='button' class='yui3-button' tabindex='-1'>{selectButtonLabel}</button>\""," */"," SELECT_FILES_BUTTON: \"<button type='button' class='yui3-button' tabindex='-1'>{selectButtonLabel}</button>\",",""," /**"," * The static property reflecting the type of uploader that `Y.Uploader`"," * aliases. The UploaderFlash value is `\"flash\"`."," * "," * @property TYPE"," * @type {String}"," * @static"," */"," TYPE: \"flash\",",""," /**"," * The identity of the widget."," *"," * @property NAME"," * @type String"," * @default 'uploader'"," * @readOnly"," * @protected"," * @static"," */"," NAME: \"uploader\",",""," /**"," * Static property used to define the default attribute configuration of"," * the Widget."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * A Boolean indicating whether newly selected files should be appended "," * to the existing file list, or whether they should replace it."," *"," * @attribute appendNewFiles"," * @type {Boolean}"," * @default true"," */"," appendNewFiles : {"," value: true"," },",""," /**"," * The names of CSS classes that correspond to different button states"," * of the \"Select Files\" control. These classes are assigned to the "," * \"Select Files\" control based on the mouse states reported by the"," * Flash player. The keys for the class names are:"," * <ul>"," * <li> <strong>`hover`</strong>: the class corresponding to mouse hovering over"," * the \"Select Files\" button.</li>"," * <li> <strong>`active`</strong>: the class corresponding to mouse down state of"," * the \"Select Files\" button.</li>"," * <li> <strong>`disabled`</strong>: the class corresponding to the disabled state"," * of the \"Select Files\" button.</li>"," * <li> <strong>`focus`</strong>: the class corresponding to the focused state of"," * the \"Select Files\" button.</li>"," * </ul>"," * @attribute buttonClassNames"," * @type {Object}"," * @default { hover: \"yui3-button-hover\","," * active: \"yui3-button-active\","," * disabled: \"yui3-button-disabled\","," * focus: \"yui3-button-selected\""," * }"," */"," buttonClassNames: {"," value: {"," \"hover\": \"yui3-button-hover\","," \"active\": \"yui3-button-active\","," \"disabled\": \"yui3-button-disabled\","," \"focus\": \"yui3-button-selected\""," }"," },",""," /**"," * A Boolean indicating whether the uploader is enabled or disabled for user input."," *"," * @attribute enabled"," * @type {Boolean}"," * @default true"," */"," enabled : {"," value: true"," },",""," /**"," * The action performed when an upload error occurs for a specific file being uploaded."," * The possible values are: "," * <ul>"," * <li> <strong>`UploaderQueue.CONTINUE`</strong>: the error is ignored and the upload process is continued.</li>"," * <li> <strong>`UploaderQueue.STOP`</strong>: the upload process is stopped as soon as any other parallel file"," * uploads are finished.</li>"," * <li> <strong>`UploaderQueue.RESTART_ASAP`</strong>: the file is added back to the front of the queue.</li>"," * <li> <strong>`UploaderQueue.RESTART_AFTER`</strong>: the file is added to the back of the queue.</li>"," * </ul>"," * @attribute errorAction"," * @type {String}"," * @default UploaderQueue.CONTINUE"," */"," errorAction: {"," value: \"continue\","," validator: function (val, name) {"," return (val === UploaderQueue.CONTINUE || val === UploaderQueue.STOP || val === UploaderQueue.RESTART_ASAP || val === UploaderQueue.RESTART_AFTER); "," }"," },",""," /**"," * An array indicating what fileFilters should be applied to the file"," * selection dialog. Each element in the array should be an object with"," * the following key-value pairs:"," * {"," * description : String "," extensions: String of the form &lquot;*.ext1;*.ext2;*.ext3;...&rquot;"," * }"," * @attribute fileFilters"," * @type {Array}"," * @default []"," */"," fileFilters: {"," value: []"," },",""," /**"," * A filtering function that is applied to every file selected by the user."," * The function receives the `Y.File` object and must return a Boolean value."," * If a `false` value is returned, the file in question is not added to the"," * list of files to be uploaded."," * Use this function to put limits on file sizes or check the file names for"," * correct extension, but make sure that a server-side check is also performed,"," * since any client-side restrictions are only advisory and can be circumvented."," *"," * @attribute fileFilterFunction"," * @type {Function}"," * @default null"," */"," fileFilterFunction: {"," value: null"," },"," "," /**"," * A String specifying what should be the POST field name for the file"," * content in the upload request."," *"," * @attribute fileFieldName"," * @type {String}"," * @default Filedata"," */"," fileFieldName: {"," value: \"Filedata\""," },",""," /**"," * The array of files to be uploaded. All elements in the array"," * must be instances of `Y.FileFlash` and be instantiated with a `fileId`"," * retrieved from an instance of the uploader."," *"," * @attribute fileList"," * @type {Array}"," * @default []"," */"," fileList: {"," value: [],"," getter: \"_getFileList\","," setter: \"_setFileList\""," },",""," /**"," * A Boolean indicating whether multiple file selection is enabled."," *"," * @attribute multipleFiles"," * @type {Boolean}"," * @default false"," */"," multipleFiles: {"," value: false"," },",""," /**"," * An object, keyed by `fileId`, containing sets of key-value pairs"," * that should be passed as POST variables along with each corresponding"," * file. This attribute is only used if no POST variables are specifed"," * in the upload method call."," *"," * @attribute postVarsPerFile"," * @type {Object}"," * @default {}"," */"," postVarsPerFile: {"," value: {}"," },",""," /**"," * The label for the \"Select Files\" widget. This is the value that replaces the"," * `{selectButtonLabel}` token in the `SELECT_FILES_BUTTON` template."," * "," * @attribute selectButtonLabel"," * @type {String}"," * @default \"Select Files\""," */"," selectButtonLabel: {"," value: \"Select Files\""," },",""," /**"," * The widget that serves as the \"Select Files\" control for the file uploader"," * "," *"," * @attribute selectFilesButton"," * @type {Node | Widget}"," * @default A standard HTML button with YUI CSS Button skin."," */"," selectFilesButton : {"," valueFn: function () {"," return Y.Node.create(substitute(Y.UploaderFlash.SELECT_FILES_BUTTON, {selectButtonLabel: this.get(\"selectButtonLabel\")}));"," }"," },"," "," /**"," * The number of files that can be uploaded"," * simultaneously if the automatic queue management"," * is used. This value can be in the range between 2"," * and 5."," *"," * @attribute simLimit"," * @type {Number}"," * @default 2"," */"," simLimit: {"," value: 2,"," validator: function (val, name) {"," return (val >= 2 && val <= 5);"," }"," },",""," /**"," * The URL to the SWF file of the flash uploader. A copy local to"," * the server that hosts the page on which the uploader appears is"," * recommended."," *"," * @attribute swfURL"," * @type {String}"," * @default \"CDN Prefix + uploader/assets/flashuploader.swf\" with a "," * random GET parameter for IE (to prevent buggy behavior when the SWF "," * is cached)."," */"," swfURL: {"," valueFn: function () {"," var prefix = Y.Env.cdn + \"uploader/assets/flashuploader.swf\";",""," if (Y.UA.ie > 0) {"," return (prefix + \"?t=\" + Y.guid(\"uploader\"));"," }"," return prefix;"," }"," },",""," /**"," * The id's or `Node` references of the DOM elements that precede"," * and follow the `Select Files` button in the tab order. Specifying"," * these allows keyboard navigation to and from the Flash player"," * layer of the uploader."," * The two keys corresponding to the DOM elements are:"," <ul>"," * <li> `from`: the id or the `Node` reference corresponding to the"," * DOM element that precedes the `Select Files` button in the tab order.</li>"," * <li> `to`: the id or the `Node` reference corresponding to the"," * DOM element that follows the `Select Files` button in the tab order.</li>"," * </ul>"," * @attribute tabElements"," * @type {Object}"," * @default null"," */"," tabElements: {"," value: null"," },",""," /**"," * The URL to which file upload requested are POSTed. Only used if a different url is not passed to the upload method call."," *"," * @attribute uploadURL"," * @type {String}"," * @default \"\""," */"," uploadURL: {"," value: \"\""," },",""," /**"," * The number of times to try re-uploading a file that failed to upload before"," * cancelling its upload."," *"," * @attribute retryCount"," * @type {Number}"," * @default 3"," */ "," retryCount: {"," value: 3"," }"," }","});","","Y.UploaderFlash.Queue = UploaderQueue;","","","","","}, '@VERSION@', {\"requires\": [\"swf\", \"widget\", \"substitute\", \"base\", \"cssbutton\", \"node\", \"event-custom\", \"file-flash\", \"uploader-queue\"]});"];
+_yuitest_coverage["build/uploader-flash/uploader-flash.js"].code=["YUI.add('uploader-flash', function (Y, NAME) {","",""," /**"," * This module provides a UI for file selection and multiple file upload capability using"," * Flash as a transport engine."," * The supported features include: automatic upload queue management, upload progress"," * tracking, file filtering, server response retrieval and error reporting."," *"," * @module uploader-flash"," */ ","","// Shorthands for external modules","var substitute = Y.Lang.sub,"," UploaderQueue = Y.Uploader.Queue,"," getCN = Y.ClassNameManager.getClassName,"," UPLOADER = 'uploader',"," SELECT_FILES = getCN(UPLOADER, 'selectfiles-button');","",""," /**"," * This module provides a UI for file selection and multiple file upload capability"," * using Flash as a transport engine."," * @class UploaderFlash"," * @extends Widget"," * @constructor"," * @param {Object} config Configuration object."," */","","function UploaderFlash(config) {"," UploaderFlash.superclass.constructor.apply ( this, arguments );","}","","","","Y.UploaderFlash = Y.extend(UploaderFlash, Y.Widget, {",""," /**"," * Stored value of the current button state (based on "," * mouse events dispatched by the Flash player)"," * @property _buttonState"," * @type {String}"," * @protected"," */"," _buttonState: \"up\",",""," /**"," * Stored value of the current button focus state (based "," * on keyboard and mouse events)."," * @property _buttonFocus"," * @type {Boolean}"," * @protected"," */"," _buttonFocus: false,",""," /**"," * Stored value of the unique id for the container that holds the "," * Flash uploader."," *"," * @property _swfContainerId"," * @type {String}"," * @protected"," */"," _swfContainerId: null,",""," /**"," * Stored reference to the instance of SWF used to host the"," * Flash uploader."," *"," * @property _swfReference"," * @type {SWF}"," * @protected"," */"," _swfReference: null,",""," /**"," * Stored reference to the instance of Uploader.Queue used to manage"," * the upload process. This is a read-only property that only exists"," * during an active upload process. Only one queue can be active at"," * a time; if an upload start is attempted while a queue is active,"," * it will be ignored."," *"," * @property queue"," * @type {Y.Uploader.Queue}"," */"," queue: null,",""," /**"," * Stored event bindings for keyboard navigation to and from the uploader."," *"," * @property _tabElementBindings"," * @type {Object}"," * @protected"," */"," _tabElementBindings: null,","","","/**"," * Construction logic executed during UploaderFlash instantiation."," *"," * @method initializer"," * @protected"," */"," initializer : function () {",""," // Assign protected variable values"," this._swfContainerId = Y.guid(\"uploader\");"," this._swfReference = null;"," this.queue = null;"," this._buttonState = \"up\";"," this._buttonFocus = null;"," this._tabElementBindings = null;"," this._fileList = [];",""," // Publish available events",""," /**"," * Signals that files have been selected. "," *"," * @event fileselect"," * @param event {Event} The event object for the `fileselect` with the"," * following payload:"," * <dl>"," * <dt>fileList</dt>"," * <dd>An `Array` of files selected by the user, encapsulated"," * in Y.FileFlash objects.</dd>"," * </dl>"," */"," this.publish(\"fileselect\");",""," /**"," * Signals that an upload of multiple files has been started. "," *"," * @event uploadstart"," * @param event {Event} The event object for the `uploadstart`."," */"," this.publish(\"uploadstart\");",""," /**"," * Signals that an upload of a specific file has started. "," *"," * @event fileuploadstart"," * @param event {Event} The event object for the `fileuploadstart` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>A reference to the Y.File that dispatched the event.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by Y.File.</dd>"," * </dl>"," */"," this.publish(\"fileuploadstart\");",""," /**"," * Reports on upload progress of a specific file. "," *"," * @event uploadprogress"," * @param event {Event} The event object for the `uploadprogress` with the"," * following payload:"," * <dl>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file that has been uploaded, out of 100</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by the SWF uploader</dd>"," * </dl>"," */"," this.publish(\"uploadprogress\");",""," /**"," * Reports on the total upload progress of the file list. "," *"," * @event totaluploadprogress"," * @param event {Event} The event object for the `totaluploadprogress` with the"," * following payload:"," * <dl>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file list that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file list</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file list that has been uploaded, out of 100</dd>"," * </dl>"," */"," this.publish(\"totaluploadprogress\");",""," /**"," * Signals that a single file upload has been completed. "," *"," * @event uploadcomplete"," * @param event {Event} The event object for the `uploadcomplete` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>The pointer to the instance of `Y.File` whose upload has been completed.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event fired by the SWF Uploader</dd>"," * <dt>data</dt>"," * <dd>Data returned by the server.</dd>"," * </dl>"," */"," this.publish(\"uploadcomplete\");",""," /**"," * Signals that the upload process of the entire file list has been completed. "," *"," * @event alluploadscomplete"," * @param event {Event} The event object for the `alluploadscomplete`."," */"," this.publish(\"alluploadscomplete\");",""," /**"," * Signals that a error has occurred in a specific file's upload process. "," *"," * @event uploaderror"," * @param event {Event} The event object for the `uploaderror` with the"," * following payload:"," * <dl>"," * <dt>originEvent</dt>"," * <dd>The original error event fired by the SWF Uploader. </dd>"," * <dt>file</dt>"," * <dd>The pointer at the instance of Y.FileFlash that returned the error.</dd>"," * <dt>source</dt>"," * <dd>The source of the upload error, either \"io\" or \"http\"</dd> "," * <dt>message</dt>"," * <dd>The message that accompanied the error. Corresponds to the text of"," * the error in cases where source is \"io\", and to the HTTP status for"," cases where source is \"http\".</dd> "," * </dl>"," */"," this.publish(\"uploaderror\");",""," /**"," * Signals that a mouse has begun hovering over the `Select Files` button. "," *"," * @event mouseenter"," * @param event {Event} The event object for the `mouseenter` event."," */"," this.publish(\"mouseenter\");",""," /**"," * Signals that a mouse has stopped hovering over the `Select Files` button. "," *"," * @event mouseleave"," * @param event {Event} The event object for the `mouseleave` event."," */"," this.publish(\"mouseleave\");",""," /**"," * Signals that a mouse button has been pressed over the `Select Files` button. "," *"," * @event mousedown"," * @param event {Event} The event object for the `mousedown` event."," */"," this.publish(\"mousedown\");",""," /**"," * Signals that a mouse button has been released over the `Select Files` button. "," *"," * @event mouseup"," * @param event {Event} The event object for the `mouseup` event."," */"," this.publish(\"mouseup\");",""," /**"," * Signals that a mouse has been clicked over the `Select Files` button. "," *"," * @event click"," * @param event {Event} The event object for the `click` event."," */"," this.publish(\"click\");"," },",""," /**"," * Creates the DOM structure for the UploaderFlash."," * UploaderFlash's DOM structure consists of two layers: the base \"Select Files\""," * button that can be replaced by the developer's widget of choice; and a transparent"," * Flash overlay positoned above the button that captures all input events."," * The `position` style attribute of the `boundingBox` of the `Uploader` widget"," * is forced to be `relative`, in order to accommodate the Flash player overlay"," * (which is `position`ed `absolute`ly)."," *"," * @method renderUI"," * @protected"," */"," renderUI : function () {"," var boundingBox = this.get(\"boundingBox\"),"," contentBox = this.get('contentBox'),"," selFilesButton = this.get(\"selectFilesButton\");"," "," boundingBox.setStyle(\"position\", \"relative\");"," selFilesButton.setStyles({width: \"100%\", height: \"100%\"});"," contentBox.append(selFilesButton);"," contentBox.append(Y.Node.create(substitute(UploaderFlash.FLASH_CONTAINER, "," {swfContainerId: this._swfContainerId})));"," var flashContainer = Y.one(\"#\" + this._swfContainerId);"," var params = {version: \"10.0.45\","," fixedAttributes: {wmode: \"transparent\", "," allowScriptAccess:\"always\", "," allowNetworking:\"all\", "," scale: \"noscale\""," }"," };"," this._swfReference = new Y.SWF(flashContainer, this.get(\"swfURL\"), params);"," },",""," /**"," * Binds handlers to the UploaderFlash UI events and propagates attribute"," * values to the Flash player."," * The propagation of initial values is set to occur once the Flash player "," * instance is ready (as indicated by the `swfReady` event.)"," *"," * @method bindUI"," * @protected"," */"," bindUI : function () {",""," this._swfReference.on(\"swfReady\", function () {"," this._setMultipleFiles();"," this._setFileFilters();"," this._triggerEnabled();"," this._attachTabElements();"," this.after(\"multipleFilesChange\", this._setMultipleFiles, this);"," this.after(\"fileFiltersChange\", this._setFileFilters, this);"," this.after(\"enabledChange\", this._triggerEnabled, this);"," this.after(\"tabElementsChange\", this._attachTabElements);"," }, this);"," "," this._swfReference.on(\"fileselect\", this._updateFileList, this);","","",""," // this._swfReference.on(\"trace\", function (ev) {console.log(ev.message);});",""," this._swfReference.on(\"mouseenter\", function () {"," this.fire(\"mouseenter\");"," this._setButtonClass(\"hover\", true);"," if (this._buttonState == \"down\") {"," this._setButtonClass(\"active\", true);"," }"," }, this);"," this._swfReference.on(\"mouseleave\", function () {"," this.fire(\"mouseleave\");"," this._setButtonClass(\"hover\", false);"," this._setButtonClass(\"active\", false);"," "," }, this);"," this._swfReference.on(\"mousedown\", function () {"," this.fire(\"mousedown\");"," this._buttonState = \"down\";"," this._setButtonClass(\"active\", true);"," }, this);"," this._swfReference.on(\"mouseup\", function () {"," this.fire(\"mouseup\");"," this._buttonState = \"up\";"," this._setButtonClass(\"active\", false);"," }, this);"," this._swfReference.on(\"click\", function () {"," this.fire(\"click\");"," this._buttonFocus = true;"," this._setButtonClass(\"focus\", true);"," Y.one(\"body\").focus();"," this._swfReference._swf.focus();"," }, this);"," },",""," /**"," * Attaches keyboard bindings to enabling tabbing to and from the instance of the Flash"," * player in the Uploader widget. If the previous and next elements are specified, the"," * keyboard bindings enable the user to tab from the `tabElements[\"from\"]` node to the "," * Flash-powered \"Select Files\" button, and to the `tabElements[\"to\"]` node. "," *"," * @method _attachTabElements"," * @protected"," * @param ev {Event} Optional event payload if called as a `tabElementsChange` handler."," */"," _attachTabElements : function (ev) {"," if (this.get(\"tabElements\") !== null && this.get(\"tabElements\").from !== null && this.get(\"tabElements\").to !== null) {",""," if (this._tabElementBindings !== null) {"," this._tabElementBindings.from.detach();"," this._tabElementBindings.to.detach();"," this._tabElementBindings.tabback.detach();"," this._tabElementBindings.tabforward.detach();"," this._tabElementBindings.focus.detach();"," this._tabElementBindings.blur.detach();"," }"," else {"," this._tabElementBindings = {};"," }",""," var fromElement = Y.one(this.get(\"tabElements\").from);"," var toElement = Y.one(this.get(\"tabElements\").to);","",""," this._tabElementBindings.from = fromElement.on(\"keydown\", function (ev) { "," if (ev.keyCode == 9 && !ev.shiftKey) {"," ev.preventDefault();"," this._swfReference._swf.setAttribute(\"tabindex\", 0); "," this._swfReference._swf.setAttribute(\"role\", \"button\");"," this._swfReference._swf.setAttribute(\"aria-label\", this.get(\"selectButtonLabel\"));"," this._swfReference._swf.focus();"," }"," }, this);"," this._tabElementBindings.to = toElement.on(\"keydown\", function (ev) { "," if (ev.keyCode == 9 && ev.shiftKey) {"," ev.preventDefault();"," this._swfReference._swf.setAttribute(\"tabindex\", 0); "," this._swfReference._swf.setAttribute(\"role\", \"button\");"," this._swfReference._swf.setAttribute(\"aria-label\", this.get(\"selectButtonLabel\"));"," this._swfReference._swf.focus();"," }"," }, this);"," this._tabElementBindings.tabback = this._swfReference.on(\"tabback\", function (ev) {this._swfReference._swf.blur(); setTimeout(function () {fromElement.focus();}, 30);}, this);"," this._tabElementBindings.tabforward = this._swfReference.on(\"tabforward\", function (ev) {this._swfReference._swf.blur(); setTimeout(function () {toElement.focus();}, 30);}, this);",""," this._tabElementBindings.focus = this._swfReference._swf.on(\"focus\", function (ev) {this._buttonFocus = true; this._setButtonClass(\"focus\", true);}, this);"," this._tabElementBindings.blur = this._swfReference._swf.on(\"blur\", function (ev) {this._buttonFocus = false; this._setButtonClass(\"focus\", false);}, this);"," }"," else if (this._tabElementBindings !== null) {"," this._tabElementBindings.from.detach();"," this._tabElementBindings.to.detach();"," this._tabElementBindings.tabback.detach();"," this._tabElementBindings.tabforward.detach();"," this._tabElementBindings.focus.detach();"," this._tabElementBindings.blur.detach();"," }"," },","",""," /**"," * Adds or removes a specified state CSS class to the underlying uploader button. "," *"," * @method _setButtonClass"," * @protected"," * @param state {String} The name of the state enumerated in `buttonClassNames` attribute"," * from which to derive the needed class name."," * @param add {Boolean} A Boolean indicating whether to add or remove the class."," */"," _setButtonClass : function (state, add) {"," if (add) {"," this.get(\"selectFilesButton\").addClass(this.get(\"buttonClassNames\")[state]);"," }"," else {"," this.get(\"selectFilesButton\").removeClass(this.get(\"buttonClassNames\")[state]);"," }"," },","",""," /**"," * Syncs the state of the `fileFilters` attribute between the instance of UploaderFlash"," * and the Flash player."," * "," * @method _setFileFilters"," * @private"," */"," _setFileFilters : function () {"," if (this._swfReference && this.get(\"fileFilters\").length > 0) {"," this._swfReference.callSWF(\"setFileFilters\", [this.get(\"fileFilters\")]);"," } ",""," },","","",""," /**"," * Syncs the state of the `multipleFiles` attribute between this class"," * and the Flash uploader."," * "," * @method _setMultipleFiles"," * @private"," */"," _setMultipleFiles : function () {"," if (this._swfReference) {"," this._swfReference.callSWF(\"setAllowMultipleFiles\", [this.get(\"multipleFiles\")]);"," }"," },",""," /**"," * Syncs the state of the `enabled` attribute between this class"," * and the Flash uploader."," * "," * @method _triggerEnabled"," * @private"," */"," _triggerEnabled : function () {"," if (this.get(\"enabled\")) {"," this._swfReference.callSWF(\"enable\");"," this._swfReference._swf.setAttribute(\"aria-disabled\", \"false\");"," this._setButtonClass(\"disabled\", false);"," }"," else {"," this._swfReference.callSWF(\"disable\");"," this._swfReference._swf.setAttribute(\"aria-disabled\", \"true\");"," this._setButtonClass(\"disabled\", true);"," }"," },",""," /**"," * Getter for the `fileList` attribute"," * "," * @method _getFileList"," * @private"," */"," _getFileList : function (arr) {"," return this._fileList.concat();"," },",""," /**"," * Setter for the `fileList` attribute"," * "," * @method _setFileList"," * @private"," */"," _setFileList : function (val) {"," this._fileList = val.concat();"," return this._fileList.concat();"," },",""," /**"," * Adjusts the content of the `fileList` based on the results of file selection"," * and the `appendNewFiles` attribute. If the `appendNewFiles` attribute is true,"," * then selected files are appended to the existing list; otherwise, the list is"," * cleared and populated with the newly selected files."," * "," * @method _updateFileList"," * @param ev {Event} The file selection event received from the uploader."," * @private"," */"," _updateFileList : function (ev) {"," "," Y.one(\"body\").focus();"," this._swfReference._swf.focus();","",""," var newfiles = ev.fileList,"," fileConfObjects = [],"," parsedFiles = [],"," swfRef = this._swfReference,"," filterFunc = this.get(\"fileFilterFunction\");"," "," Y.each(newfiles, function (value) {"," var newFileConf = {};"," newFileConf.id = value.fileId;"," newFileConf.name = value.fileReference.name;"," newFileConf.size = value.fileReference.size;"," newFileConf.type = value.fileReference.type;"," newFileConf.dateCreated = value.fileReference.creationDate;"," newFileConf.dateModified = value.fileReference.modificationDate;"," newFileConf.uploader = swfRef;",""," fileConfObjects.push(newFileConf);"," });",""," if (filterFunc) {"," Y.each(fileConfObjects, function (value) {"," var newfile = new Y.FileFlash(value);"," if (filterFunc(newfile)) {"," parsedFiles.push(newfile);"," }"," });"," }"," else {"," Y.each(fileConfObjects, function (value) {"," parsedFiles.push(new Y.FileFlash(value));"," });"," }",""," if (parsedFiles.length > 0) {"," var oldfiles = this.get(\"fileList\");",""," this.set(\"fileList\", "," this.get(\"appendNewFiles\") ? oldfiles.concat(parsedFiles) : parsedFiles );",""," this.fire(\"fileselect\", {fileList: parsedFiles});"," }",""," },","","",""," /**"," * Handles and retransmits events fired by `Y.FileFlash` and `Y.Uploader.Queue`."," * "," * @method _uploadEventHandler"," * @param event The event dispatched during the upload process."," * @private"," */"," _uploadEventHandler : function (event) {"," "," switch (event.type) {"," case \"file:uploadstart\":"," this.fire(\"fileuploadstart\", event);"," break;"," case \"file:uploadprogress\":"," this.fire(\"uploadprogress\", event);"," break;"," case \"uploaderqueue:totaluploadprogress\":"," this.fire(\"totaluploadprogress\", event);"," break;"," case \"file:uploadcomplete\":"," this.fire(\"uploadcomplete\", event);"," break;"," case \"uploaderqueue:alluploadscomplete\":"," this.queue = null;"," this.fire(\"alluploadscomplete\", event);"," break;"," case \"file:uploaderror\":"," case \"uploaderqueue:uploaderror\":"," this.fire(\"uploaderror\", event);"," break;"," case \"file:uploadcancel\":"," case \"uploaderqueue:uploadcancel\":"," this.fire(\"uploadcancel\", event);"," break;"," } ",""," },","","",""," /**"," * Starts the upload of a specific file."," *"," * @method upload"," * @param file {Y.FileFlash} Reference to the instance of the file to be uploaded."," * @param url {String} The URL to upload the file to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */",""," upload : function (file, url, postvars) {"," "," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\"),"," fileId = file.get(\"id\");",""," postVars = postVars.hasOwnProperty(fileId) ? postVars[fileId] : postVars;",""," if (file instanceof Y.FileFlash) {"," "," file.on(\"uploadstart\", this._uploadEventHandler, this);"," file.on(\"uploadprogress\", this._uploadEventHandler, this);"," file.on(\"uploadcomplete\", this._uploadEventHandler, this);"," file.on(\"uploaderror\", this._uploadEventHandler, this);"," file.on(\"uploadcancel\", this._uploadEventHandler, this);",""," file.startUpload(uploadURL, postVars, this.get(\"fileFieldName\"));"," }"," },",""," /**"," * Starts the upload of all files on the file list, using an automated queue."," *"," * @method uploadAll"," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadAll : function (url, postvars) {"," this.uploadThese(this.get(\"fileList\"), url, postvars);"," },",""," /**"," * Starts the upload of the files specified in the first argument, using an automated queue."," *"," * @method uploadThese"," * @param files {Array} The list of files to upload."," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadThese : function (files, url, postvars) {"," if (!this.queue) {"," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\");",""," this.queue = new UploaderQueue({simUploads: this.get(\"simLimit\"), "," errorAction: this.get(\"errorAction\"),"," fileFieldName: this.get(\"fileFieldName\"),"," fileList: files,"," uploadURL: uploadURL,"," perFileParameters: postVars,"," retryCount: this.get(\"retryCount\")"," });"," this.queue.on(\"uploadstart\", this._uploadEventHandler, this);"," this.queue.on(\"uploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"totaluploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"uploadcomplete\", this._uploadEventHandler, this);"," this.queue.on(\"alluploadscomplete\", this._uploadEventHandler, this);"," this.queue.on(\"alluploadscancelled\", function (ev) {this.queue = null;}, this);"," this.queue.on(\"uploaderror\", this._uploadEventHandler, this);"," this.queue.startUpload(); "," "," this.fire(\"uploadstart\"); "," }"," }","},","","{"," /**"," * The template for the Flash player container. Since the Flash player container needs"," * to completely overlay the &lquot;Select Files&rqot; control, it's positioned absolutely,"," * with width and height set to 100% of the parent."," *"," * @property FLASH_CONTAINER"," * @type {String}"," * @static"," * @default \"<div id='{swfContainerId}' style='position:absolute; top:0px; left: 0px; margin: 0; padding: 0; border: 0; width:100%; height:100%'></div>\""," */"," FLASH_CONTAINER: \"<div id='{swfContainerId}' style='position:absolute; top:0px; left: 0px; margin: 0; padding: 0; border: 0; width:100%; height:100%'></div>\",",""," /**"," * The template for the \"Select Files\" button."," *"," * @property SELECT_FILES_BUTTON"," * @type {String}"," * @static"," * @default \"<button type='button' class='yui3-button' tabindex='-1'>{selectButtonLabel}</button>\""," */"," SELECT_FILES_BUTTON: \"<button type='button' class='yui3-button' tabindex='-1'>{selectButtonLabel}</button>\",",""," /**"," * The static property reflecting the type of uploader that `Y.Uploader`"," * aliases. The UploaderFlash value is `\"flash\"`."," * "," * @property TYPE"," * @type {String}"," * @static"," */"," TYPE: \"flash\",",""," /**"," * The identity of the widget."," *"," * @property NAME"," * @type String"," * @default 'uploader'"," * @readOnly"," * @protected"," * @static"," */"," NAME: \"uploader\",",""," /**"," * Static property used to define the default attribute configuration of"," * the Widget."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * A Boolean indicating whether newly selected files should be appended "," * to the existing file list, or whether they should replace it."," *"," * @attribute appendNewFiles"," * @type {Boolean}"," * @default true"," */"," appendNewFiles : {"," value: true"," },",""," /**"," * The names of CSS classes that correspond to different button states"," * of the \"Select Files\" control. These classes are assigned to the "," * \"Select Files\" control based on the mouse states reported by the"," * Flash player. The keys for the class names are:"," * <ul>"," * <li> <strong>`hover`</strong>: the class corresponding to mouse hovering over"," * the \"Select Files\" button.</li>"," * <li> <strong>`active`</strong>: the class corresponding to mouse down state of"," * the \"Select Files\" button.</li>"," * <li> <strong>`disabled`</strong>: the class corresponding to the disabled state"," * of the \"Select Files\" button.</li>"," * <li> <strong>`focus`</strong>: the class corresponding to the focused state of"," * the \"Select Files\" button.</li>"," * </ul>"," * @attribute buttonClassNames"," * @type {Object}"," * @default { hover: \"yui3-button-hover\","," * active: \"yui3-button-active\","," * disabled: \"yui3-button-disabled\","," * focus: \"yui3-button-selected\""," * }"," */"," buttonClassNames: {"," value: {"," \"hover\": \"yui3-button-hover\","," \"active\": \"yui3-button-active\","," \"disabled\": \"yui3-button-disabled\","," \"focus\": \"yui3-button-selected\""," }"," },",""," /**"," * A Boolean indicating whether the uploader is enabled or disabled for user input."," *"," * @attribute enabled"," * @type {Boolean}"," * @default true"," */"," enabled : {"," value: true"," },",""," /**"," * The action performed when an upload error occurs for a specific file being uploaded."," * The possible values are: "," * <ul>"," * <li> <strong>`UploaderQueue.CONTINUE`</strong>: the error is ignored and the upload process is continued.</li>"," * <li> <strong>`UploaderQueue.STOP`</strong>: the upload process is stopped as soon as any other parallel file"," * uploads are finished.</li>"," * <li> <strong>`UploaderQueue.RESTART_ASAP`</strong>: the file is added back to the front of the queue.</li>"," * <li> <strong>`UploaderQueue.RESTART_AFTER`</strong>: the file is added to the back of the queue.</li>"," * </ul>"," * @attribute errorAction"," * @type {String}"," * @default UploaderQueue.CONTINUE"," */"," errorAction: {"," value: \"continue\","," validator: function (val, name) {"," return (val === UploaderQueue.CONTINUE || val === UploaderQueue.STOP || val === UploaderQueue.RESTART_ASAP || val === UploaderQueue.RESTART_AFTER); "," }"," },",""," /**"," * An array indicating what fileFilters should be applied to the file"," * selection dialog. Each element in the array should be an object with"," * the following key-value pairs:"," * {"," * description : String "," extensions: String of the form &lquot;*.ext1;*.ext2;*.ext3;...&rquot;"," * }"," * @attribute fileFilters"," * @type {Array}"," * @default []"," */"," fileFilters: {"," value: []"," },",""," /**"," * A filtering function that is applied to every file selected by the user."," * The function receives the `Y.File` object and must return a Boolean value."," * If a `false` value is returned, the file in question is not added to the"," * list of files to be uploaded."," * Use this function to put limits on file sizes or check the file names for"," * correct extension, but make sure that a server-side check is also performed,"," * since any client-side restrictions are only advisory and can be circumvented."," *"," * @attribute fileFilterFunction"," * @type {Function}"," * @default null"," */"," fileFilterFunction: {"," value: null"," },"," "," /**"," * A String specifying what should be the POST field name for the file"," * content in the upload request."," *"," * @attribute fileFieldName"," * @type {String}"," * @default Filedata"," */"," fileFieldName: {"," value: \"Filedata\""," },",""," /**"," * The array of files to be uploaded. All elements in the array"," * must be instances of `Y.FileFlash` and be instantiated with a `fileId`"," * retrieved from an instance of the uploader."," *"," * @attribute fileList"," * @type {Array}"," * @default []"," */"," fileList: {"," value: [],"," getter: \"_getFileList\","," setter: \"_setFileList\""," },",""," /**"," * A Boolean indicating whether multiple file selection is enabled."," *"," * @attribute multipleFiles"," * @type {Boolean}"," * @default false"," */"," multipleFiles: {"," value: false"," },",""," /**"," * An object, keyed by `fileId`, containing sets of key-value pairs"," * that should be passed as POST variables along with each corresponding"," * file. This attribute is only used if no POST variables are specifed"," * in the upload method call."," *"," * @attribute postVarsPerFile"," * @type {Object}"," * @default {}"," */"," postVarsPerFile: {"," value: {}"," },",""," /**"," * The label for the \"Select Files\" widget. This is the value that replaces the"," * `{selectButtonLabel}` token in the `SELECT_FILES_BUTTON` template."," * "," * @attribute selectButtonLabel"," * @type {String}"," * @default \"Select Files\""," */"," selectButtonLabel: {"," value: \"Select Files\""," },",""," /**"," * The widget that serves as the \"Select Files\" control for the file uploader"," * "," *"," * @attribute selectFilesButton"," * @type {Node | Widget}"," * @default A standard HTML button with YUI CSS Button skin."," */"," selectFilesButton : {"," valueFn: function () {"," return Y.Node.create(substitute(Y.UploaderFlash.SELECT_FILES_BUTTON, {selectButtonLabel: this.get(\"selectButtonLabel\")}));"," }"," },"," "," /**"," * The number of files that can be uploaded"," * simultaneously if the automatic queue management"," * is used. This value can be in the range between 2"," * and 5."," *"," * @attribute simLimit"," * @type {Number}"," * @default 2"," */"," simLimit: {"," value: 2,"," validator: function (val, name) {"," return (val >= 2 && val <= 5);"," }"," },",""," /**"," * The URL to the SWF file of the flash uploader. A copy local to"," * the server that hosts the page on which the uploader appears is"," * recommended."," *"," * @attribute swfURL"," * @type {String}"," * @default \"CDN Prefix + uploader/assets/flashuploader.swf\" with a "," * random GET parameter for IE (to prevent buggy behavior when the SWF "," * is cached)."," */"," swfURL: {"," valueFn: function () {"," var prefix = Y.Env.cdn + \"uploader/assets/flashuploader.swf\";",""," if (Y.UA.ie > 0) {"," return (prefix + \"?t=\" + Y.guid(\"uploader\"));"," }"," return prefix;"," }"," },",""," /**"," * The id's or `Node` references of the DOM elements that precede"," * and follow the `Select Files` button in the tab order. Specifying"," * these allows keyboard navigation to and from the Flash player"," * layer of the uploader."," * The two keys corresponding to the DOM elements are:"," <ul>"," * <li> `from`: the id or the `Node` reference corresponding to the"," * DOM element that precedes the `Select Files` button in the tab order.</li>"," * <li> `to`: the id or the `Node` reference corresponding to the"," * DOM element that follows the `Select Files` button in the tab order.</li>"," * </ul>"," * @attribute tabElements"," * @type {Object}"," * @default null"," */"," tabElements: {"," value: null"," },",""," /**"," * The URL to which file upload requested are POSTed. Only used if a different url is not passed to the upload method call."," *"," * @attribute uploadURL"," * @type {String}"," * @default \"\""," */"," uploadURL: {"," value: \"\""," },",""," /**"," * The number of times to try re-uploading a file that failed to upload before"," * cancelling its upload."," *"," * @attribute retryCount"," * @type {Number}"," * @default 3"," */ "," retryCount: {"," value: 3"," }"," }","});","","Y.UploaderFlash.Queue = UploaderQueue;","","","","","}, '@VERSION@', {\"requires\": [\"swf\", \"widget\", \"substitute\", \"base\", \"cssbutton\", \"node\", \"event-custom\", \"file-flash\", \"uploader-queue\"]});"];
_yuitest_coverage["build/uploader-flash/uploader-flash.js"].lines = {"1":0,"14":0,"30":0,"31":0,"36":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"129":0,"137":0,"152":0,"171":0,"188":0,"205":0,"213":0,"234":0,"242":0,"250":0,"258":0,"266":0,"274":0,"290":0,"294":0,"295":0,"296":0,"297":0,"299":0,"300":0,"307":0,"321":0,"322":0,"323":0,"324":0,"325":0,"326":0,"327":0,"328":0,"329":0,"332":0,"338":0,"339":0,"340":0,"341":0,"342":0,"345":0,"346":0,"347":0,"348":0,"351":0,"352":0,"353":0,"354":0,"356":0,"357":0,"358":0,"359":0,"361":0,"362":0,"363":0,"364":0,"365":0,"366":0,"381":0,"383":0,"384":0,"385":0,"386":0,"387":0,"388":0,"389":0,"392":0,"395":0,"396":0,"399":0,"400":0,"401":0,"402":0,"403":0,"404":0,"405":0,"408":0,"409":0,"410":0,"411":0,"412":0,"413":0,"414":0,"417":0,"418":0,"420":0,"421":0,"423":0,"424":0,"425":0,"426":0,"427":0,"428":0,"429":0,"444":0,"445":0,"448":0,"461":0,"462":0,"477":0,"478":0,"490":0,"491":0,"492":0,"493":0,"496":0,"497":0,"498":0,"509":0,"519":0,"520":0,"535":0,"536":0,"539":0,"545":0,"546":0,"547":0,"548":0,"549":0,"550":0,"551":0,"552":0,"553":0,"555":0,"558":0,"559":0,"560":0,"561":0,"562":0,"567":0,"568":0,"572":0,"573":0,"575":0,"578":0,"594":0,"596":0,"597":0,"599":0,"600":0,"602":0,"603":0,"605":0,"606":0,"608":0,"609":0,"610":0,"613":0,"614":0,"617":0,"618":0,"637":0,"641":0,"643":0,"645":0,"646":0,"647":0,"648":0,"649":0,"651":0,"664":0,"677":0,"678":0,"681":0,"689":0,"690":0,"691":0,"692":0,"693":0,"694":0,"695":0,"696":0,"698":0,"831":0,"942":0,"959":0,"976":0,"978":0,"979":0,"981":0,"1030":0};
_yuitest_coverage["build/uploader-flash/uploader-flash.js"].functions = {"UploaderFlash:30":0,"initializer:104":0,"renderUI:289":0,"(anonymous 2):321":0,"(anonymous 3):338":0,"(anonymous 4):345":0,"(anonymous 5):351":0,"(anonymous 6):356":0,"(anonymous 7):361":0,"bindUI:319":0,"(anonymous 8):399":0,"(anonymous 9):408":0,"(anonymous 11):417":0,"(anonymous 10):417":0,"(anonymous 13):418":0,"(anonymous 12):418":0,"(anonymous 14):420":0,"(anonymous 15):421":0,"_attachTabElements:380":0,"_setButtonClass:443":0,"_setFileFilters:460":0,"_setMultipleFiles:476":0,"_triggerEnabled:489":0,"_getFileList:508":0,"_setFileList:518":0,"(anonymous 16):545":0,"(anonymous 17):559":0,"(anonymous 18):567":0,"_updateFileList:533":0,"_uploadEventHandler:592":0,"upload:635":0,"uploadAll:663":0,"(anonymous 19):694":0,"uploadThese:676":0,"validator:830":0,"valueFn:941":0,"validator:958":0,"valueFn:975":0,"(anonymous 1):1":0};
_yuitest_coverage["build/uploader-flash/uploader-flash.js"].coveredLines = 189;
@@ -47,7 +47,7 @@ YUI.add('uploader-flash', function (Y, NAME) {
// Shorthands for external modules
_yuitest_coverfunc("build/uploader-flash/uploader-flash.js", "(anonymous 1)", 1);
_yuitest_coverline("build/uploader-flash/uploader-flash.js", 14);
-var substitute = Y.substitute,
+var substitute = Y.Lang.sub,
UploaderQueue = Y.Uploader.Queue,
getCN = Y.ClassNameManager.getClassName,
UPLOADER = 'uploader',
View
2 build/uploader-flash/uploader-flash-debug.js
@@ -11,7 +11,7 @@ YUI.add('uploader-flash', function (Y, NAME) {
*/
// Shorthands for external modules
-var substitute = Y.substitute,
+var substitute = Y.Lang.sub,
UploaderQueue = Y.Uploader.Queue,
getCN = Y.ClassNameManager.getClassName,
UPLOADER = 'uploader',
View
2 build/uploader-flash/uploader-flash-min.js
@@ -1 +1 @@
-YUI.add("uploader-flash",function(e,t){function u(e){u.superclass.constructor.apply(this,arguments)}var n=e.substitute,r=e.Uploader.Queue,i=e.ClassNameManager.getClassName,s="uploader",o=i(s,"selectfiles-button");e.UploaderFlash=e.extend(u,e.Widget,{_buttonState:"up",_buttonFocus:!1,_swfContainerId:null,_swfReference:null,queue:null,_tabElementBindings:null,initializer:function(){this._swfContainerId=e.guid("uploader"),this._swfReference=null,this.queue=null,this._buttonState="up",this._buttonFocus=null,this._tabElementBindings=null,this._fileList=[],this.publish("fileselect"),this.publish("uploadstart"),this.publish("fileuploadstart"),this.publish("uploadprogress"),this.publish("totaluploadprogress"),this.publish("uploadcomplete"),this.publish("alluploadscomplete"),this.publish("uploaderror"),this.publish("mouseenter"),this.publish("mouseleave"),this.publish("mousedown"),this.publish("mouseup"),this.publish("click")},renderUI:function(){var t=this.get("boundingBox"),r=this.get("contentBox"),i=this.get("selectFilesButton");t.setStyle("position","relative"),i.setStyles({width:"100%",height:"100%"}),r.append(i),r.append(e.Node.create(n(u.FLASH_CONTAINER,{swfContainerId:this._swfContainerId})));var s=e.one("#"+this._swfContainerId),o={version:"10.0.45",fixedAttributes:{wmode:"transparent",allowScriptAccess:"always",allowNetworking:"all",scale:"noscale"}};this._swfReference=new e.SWF(s,this.get("swfURL"),o)},bindUI:function(){this._swfReference.on("swfReady",function(){this._setMultipleFiles(),this._setFileFilters(),this._triggerEnabled(),this._attachTabElements(),this.after("multipleFilesChange",this._setMultipleFiles,this),this.after("fileFiltersChange",this._setFileFilters,this),this.after("enabledChange",this._triggerEnabled,this),this.after("tabElementsChange",this._attachTabElements)},this),this._swfReference.on("fileselect",this._updateFileList,this),this._swfReference.on("mouseenter",function(){this.fire("mouseenter"),this._setButtonClass("hover",!0),this._buttonState=="down"&&this._setButtonClass("active",!0)},this),this._swfReference.on("mouseleave",function(){this.fire("mouseleave"),this._setButtonClass("hover",!1),this._setButtonClass("active",!1)},this),this._swfReference.on("mousedown",function(){this.fire("mousedown"),this._buttonState="down",this._setButtonClass("active",!0)},this),this._swfReference.on("mouseup",function(){this.fire("mouseup"),this._buttonState="up",this._setButtonClass("active",!1)},this),this._swfReference.on("click",function(){this.fire("click"),this._buttonFocus=!0,this._setButtonClass("focus",!0),e.one("body").focus(),this._swfReference._swf.focus()},this)},_attachTabElements:function(t){if(this.get("tabElements")!==null&&this.get("tabElements").from!==null&&this.get("tabElements").to!==null){this._tabElementBindings!==null?(this._tabElementBindings.from.detach(),this._tabElementBindings.to.detach(),this._tabElementBindings.tabback.detach(),this._tabElementBindings.tabforward.detach(),this._tabElementBindings.focus.detach(),this._tabElementBindings.blur.detach()):this._tabElementBindings={};var n=e.one(this.get("tabElements").from),r=e.one(this.get("tabElements").to);this._tabElementBindings.from=n.on("keydown",function(e){e.keyCode==9&&!e.shiftKey&&(e.preventDefault(),this._swfReference._swf.setAttribute("tabindex",0),this._swfReference._swf.setAttribute("role","button"),this._swfReference._swf.setAttribute("aria-label",this.get("selectButtonLabel")),this._swfReference._swf.focus())},this),this._tabElementBindings.to=r.on("keydown",function(e){e.keyCode==9&&e.shiftKey&&(e.preventDefault(),this._swfReference._swf.setAttribute("tabindex",0),this._swfReference._swf.setAttribute("role","button"),this._swfReference._swf.setAttribute("aria-label",this.get("selectButtonLabel")),this._swfReference._swf.focus())},this),this._tabElementBindings.tabback=this._swfReference.on("tabback",function(e){this._swfReference._swf.blur(),setTimeout(function(){n.focus()},30)},this),this._tabElementBindings.tabforward=this._swfReference.on("tabforward",function(e){this._swfReference._swf.blur(),setTimeout(function(){r.focus()},30)},this),this._tabElementBindings.focus=this._swfReference._swf.on("focus",function(e){this._buttonFocus=!0,this._setButtonClass("focus",!0)},this),this._tabElementBindings.blur=this._swfReference._swf.on("blur",function(e){this._buttonFocus=!1,this._setButtonClass("focus",!1)},this)}else this._tabElementBindings!==null&&(this._tabElementBindings.from.detach(),this._tabElementBindings.to.detach(),this._tabElementBindings.tabback.detach(),this._tabElementBindings.tabforward.detach(),this._tabElementBindings.focus.detach(),this._tabElementBindings.blur.detach())},_setButtonClass:function(e,t){t?this.get("selectFilesButton").addClass(this.get("buttonClassNames")[e]):this.get("selectFilesButton").removeClass(this.get("buttonClassNames")[e])},_setFileFilters:function(){this._swfReference&&this.get("fileFilters").length>0&&this._swfReference.callSWF("setFileFilters",[this.get("fileFilters")])},_setMultipleFiles:function(){this._swfReference&&this._swfReference.callSWF("setAllowMultipleFiles",[this.get("multipleFiles")])},_triggerEnabled:function(){this.get("enabled")?(this._swfReference.callSWF("enable"),this._swfReference._swf.setAttribute("aria-disabled","false"),this._setButtonClass("disabled",!1)):(this._swfReference.callSWF("disable"),this._swfReference._swf.setAttribute("aria-disabled","true"),this._setButtonClass("disabled",!0))},_getFileList:function(e){return this._fileList.concat()},_setFileList:function(e){return this._fileList=e.concat(),this._fileList.concat()},_updateFileList:function(t){e.one("body").focus(),this._swfReference._swf.focus();var n=t.fileList,r=[],i=[],s=this._swfReference,o=this.get("fileFilterFunction");e.each(n,function(e){var t={};t.id=e.fileId,t.name=e.fileReference.name,t.size=e.fileReference.size,t.type=e.fileReference.type,t.dateCreated=e.fileReference.creationDate,t.dateModified=e.fileReference.modificationDate,t.uploader=s,r.push(t)}),o?e.each(r,function(t){var n=new e.FileFlash(t);o(n)&&i.push(n)}):e.each(r,function(t){i.push(new e.FileFlash(t))});if(i.length>0){var u=this.get("fileList");this.set("fileList",this.get("appendNewFiles")?u.concat(i):i),this.fire("fileselect",{fileList:i})}},_uploadEventHandler:function(e){switch(e.type){case"file:uploadstart":this.fire("fileuploadstart",e);break;case"file:uploadprogress":this.fire("uploadprogress",e);break;case"uploaderqueue:totaluploadprogress":this.fire("totaluploadprogress",e);break;case"file:uploadcomplete":this.fire("uploadcomplete",e);break;case"uploaderqueue:alluploadscomplete":this.queue=null,this.fire("alluploadscomplete",e);break;case"file:uploaderror":case"uploaderqueue:uploaderror":this.fire("uploaderror",e);break;case"file:uploadcancel":case"uploaderqueue:uploadcancel":this.fire("uploadcancel",e)}},upload:function(t,n,r){var i=n||this.get("uploadURL"),s=r||this.get("postVarsPerFile"),o=t.get("id");s=s.hasOwnProperty(o)?s[o]:s,t instanceof e.FileFlash&&(t.on("uploadstart",this._uploadEventHandler,this),t.on("uploadprogress",this._uploadEventHandler,this),t.on("uploadcomplete",this._uploadEventHandler,this),t.on("uploaderror",this._uploadEventHandler,this),t.on("uploadcancel",this._uploadEventHandler,this),t.startUpload(i,s,this.get("fileFieldName")))},uploadAll:function(e,t){this.uploadThese(this.get("fileList"),e,t)},uploadThese:function(e,t,n){if(!this.queue){var i=t||this.get("uploadURL"),s=n||this.get("postVarsPerFile");this.queue=new r({simUploads:this.get("simLimit"),errorAction:this.get("errorAction"),fileFieldName:this.get("fileFieldName"),fileList:e,uploadURL:i,perFileParameters:s,retryCount:this.get("retryCount")}),this.queue.on("uploadstart",this._uploadEventHandler,this),this.queue.on("uploadprogress",this._uploadEventHandler,this),this.queue.on("totaluploadprogress",this._uploadEventHandler,this),this.queue.on("uploadcomplete",this._uploadEventHandler,this),this.queue.on("alluploadscomplete",this._uploadEventHandler,this),this.queue.on("alluploadscancelled",function(e){this.queue=null},this),this.queue.on("uploaderror",this._uploadEventHandler,this),this.queue.startUpload(),this.fire("uploadstart")}}},{FLASH_CONTAINER:"<div id='{swfContainerId}' style='position:absolute; top:0px; left: 0px; margin: 0; padding: 0; border: 0; width:100%; height:100%'></div>",SELECT_FILES_BUTTON:"<button type='button' class='yui3-button' tabindex='-1'>{selectButtonLabel}</button>",TYPE:"flash",NAME:"uploader",ATTRS:{appendNewFiles:{value:!0},buttonClassNames:{value:{hover:"yui3-button-hover",active:"yui3-button-active",disabled:"yui3-button-disabled",focus:"yui3-button-selected"}},enabled:{value:!0},errorAction:{value:"continue",validator:function(e,t){return e===r.CONTINUE||e===r.STOP||e===r.RESTART_ASAP||e===r.RESTART_AFTER}},fileFilters:{value:[]},fileFilterFunction:{value:null},fileFieldName:{value:"Filedata"},fileList:{value:[],getter:"_getFileList",setter:"_setFileList"},multipleFiles:{value:!1},postVarsPerFile:{value:{}},selectButtonLabel:{value:"Select Files"},selectFilesButton:{valueFn:function(){return e.Node.create(n(e.UploaderFlash.SELECT_FILES_BUTTON,{selectButtonLabel:this.get("selectButtonLabel")}))}},simLimit:{value:2,validator:function(e,t){return e>=2&&e<=5}},swfURL:{valueFn:function(){var t=e.Env.cdn+"uploader/assets/flashuploader.swf";return e.UA.ie>0?t+"?t="+e.guid("uploader"):t}},tabElements:{value:null},uploadURL:{value:""},retryCount:{value:3}}}),e.UploaderFlash.Queue=r},"@VERSION@",{requires:["swf","widget","substitute","base","cssbutton","node","event-custom","file-flash","uploader-queue"]});
+YUI.add("uploader-flash",function(e,t){function u(e){u.superclass.constructor.apply(this,arguments)}var n=e.Lang.sub,r=e.Uploader.Queue,i=e.ClassNameManager.getClassName,s="uploader",o=i(s,"selectfiles-button");e.UploaderFlash=e.extend(u,e.Widget,{_buttonState:"up",_buttonFocus:!1,_swfContainerId:null,_swfReference:null,queue:null,_tabElementBindings:null,initializer:function(){this._swfContainerId=e.guid("uploader"),this._swfReference=null,this.queue=null,this._buttonState="up",this._buttonFocus=null,this._tabElementBindings=null,this._fileList=[],this.publish("fileselect"),this.publish("uploadstart"),this.publish("fileuploadstart"),this.publish("uploadprogress"),this.publish("totaluploadprogress"),this.publish("uploadcomplete"),this.publish("alluploadscomplete"),this.publish("uploaderror"),this.publish("mouseenter"),this.publish("mouseleave"),this.publish("mousedown"),this.publish("mouseup"),this.publish("click")},renderUI:function(){var t=this.get("boundingBox"),r=this.get("contentBox"),i=this.get("selectFilesButton");t.setStyle("position","relative"),i.setStyles({width:"100%",height:"100%"}),r.append(i),r.append(e.Node.create(n(u.FLASH_CONTAINER,{swfContainerId:this._swfContainerId})));var s=e.one("#"+this._swfContainerId),o={version:"10.0.45",fixedAttributes:{wmode:"transparent",allowScriptAccess:"always",allowNetworking:"all",scale:"noscale"}};this._swfReference=new e.SWF(s,this.get("swfURL"),o)},bindUI:function(){this._swfReference.on("swfReady",function(){this._setMultipleFiles(),this._setFileFilters(),this._triggerEnabled(),this._attachTabElements(),this.after("multipleFilesChange",this._setMultipleFiles,this),this.after("fileFiltersChange",this._setFileFilters,this),this.after("enabledChange",this._triggerEnabled,this),this.after("tabElementsChange",this._attachTabElements)},this),this._swfReference.on("fileselect",this._updateFileList,this),this._swfReference.on("mouseenter",function(){this.fire("mouseenter"),this._setButtonClass("hover",!0),this._buttonState=="down"&&this._setButtonClass("active",!0)},this),this._swfReference.on("mouseleave",function(){this.fire("mouseleave"),this._setButtonClass("hover",!1),this._setButtonClass("active",!1)},this),this._swfReference.on("mousedown",function(){this.fire("mousedown"),this._buttonState="down",this._setButtonClass("active",!0)},this),this._swfReference.on("mouseup",function(){this.fire("mouseup"),this._buttonState="up",this._setButtonClass("active",!1)},this),this._swfReference.on("click",function(){this.fire("click"),this._buttonFocus=!0,this._setButtonClass("focus",!0),e.one("body").focus(),this._swfReference._swf.focus()},this)},_attachTabElements:function(t){if(this.get("tabElements")!==null&&this.get("tabElements").from!==null&&this.get("tabElements").to!==null){this._tabElementBindings!==null?(this._tabElementBindings.from.detach(),this._tabElementBindings.to.detach(),this._tabElementBindings.tabback.detach(),this._tabElementBindings.tabforward.detach(),this._tabElementBindings.focus.detach(),this._tabElementBindings.blur.detach()):this._tabElementBindings={};var n=e.one(this.get("tabElements").from),r=e.one(this.get("tabElements").to);this._tabElementBindings.from=n.on("keydown",function(e){e.keyCode==9&&!e.shiftKey&&(e.preventDefault(),this._swfReference._swf.setAttribute("tabindex",0),this._swfReference._swf.setAttribute("role","button"),this._swfReference._swf.setAttribute("aria-label",this.get("selectButtonLabel")),this._swfReference._swf.focus())},this),this._tabElementBindings.to=r.on("keydown",function(e){e.keyCode==9&&e.shiftKey&&(e.preventDefault(),this._swfReference._swf.setAttribute("tabindex",0),this._swfReference._swf.setAttribute("role","button"),this._swfReference._swf.setAttribute("aria-label",this.get("selectButtonLabel")),this._swfReference._swf.focus())},this),this._tabElementBindings.tabback=this._swfReference.on("tabback",function(e){this._swfReference._swf.blur(),setTimeout(function(){n.focus()},30)},this),this._tabElementBindings.tabforward=this._swfReference.on("tabforward",function(e){this._swfReference._swf.blur(),setTimeout(function(){r.focus()},30)},this),this._tabElementBindings.focus=this._swfReference._swf.on("focus",function(e){this._buttonFocus=!0,this._setButtonClass("focus",!0)},this),this._tabElementBindings.blur=this._swfReference._swf.on("blur",function(e){this._buttonFocus=!1,this._setButtonClass("focus",!1)},this)}else this._tabElementBindings!==null&&(this._tabElementBindings.from.detach(),this._tabElementBindings.to.detach(),this._tabElementBindings.tabback.detach(),this._tabElementBindings.tabforward.detach(),this._tabElementBindings.focus.detach(),this._tabElementBindings.blur.detach())},_setButtonClass:function(e,t){t?this.get("selectFilesButton").addClass(this.get("buttonClassNames")[e]):this.get("selectFilesButton").removeClass(this.get("buttonClassNames")[e])},_setFileFilters:function(){this._swfReference&&this.get("fileFilters").length>0&&this._swfReference.callSWF("setFileFilters",[this.get("fileFilters")])},_setMultipleFiles:function(){this._swfReference&&this._swfReference.callSWF("setAllowMultipleFiles",[this.get("multipleFiles")])},_triggerEnabled:function(){this.get("enabled")?(this._swfReference.callSWF("enable"),this._swfReference._swf.setAttribute("aria-disabled","false"),this._setButtonClass("disabled",!1)):(this._swfReference.callSWF("disable"),this._swfReference._swf.setAttribute("aria-disabled","true"),this._setButtonClass("disabled",!0))},_getFileList:function(e){return this._fileList.concat()},_setFileList:function(e){return this._fileList=e.concat(),this._fileList.concat()},_updateFileList:function(t){e.one("body").focus(),this._swfReference._swf.focus();var n=t.fileList,r=[],i=[],s=this._swfReference,o=this.get("fileFilterFunction");e.each(n,function(e){var t={};t.id=e.fileId,t.name=e.fileReference.name,t.size=e.fileReference.size,t.type=e.fileReference.type,t.dateCreated=e.fileReference.creationDate,t.dateModified=e.fileReference.modificationDate,t.uploader=s,r.push(t)}),o?e.each(r,function(t){var n=new e.FileFlash(t);o(n)&&i.push(n)}):e.each(r,function(t){i.push(new e.FileFlash(t))});if(i.length>0){var u=this.get("fileList");this.set("fileList",this.get("appendNewFiles")?u.concat(i):i),this.fire("fileselect",{fileList:i})}},_uploadEventHandler:function(e){switch(e.type){case"file:uploadstart":this.fire("fileuploadstart",e);break;case"file:uploadprogress":this.fire("uploadprogress",e);break;case"uploaderqueue:totaluploadprogress":this.fire("totaluploadprogress",e);break;case"file:uploadcomplete":this.fire("uploadcomplete",e);break;case"uploaderqueue:alluploadscomplete":this.queue=null,this.fire("alluploadscomplete",e);break;case"file:uploaderror":case"uploaderqueue:uploaderror":this.fire("uploaderror",e);break;case"file:uploadcancel":case"uploaderqueue:uploadcancel":this.fire("uploadcancel",e)}},upload:function(t,n,r){var i=n||this.get("uploadURL"),s=r||this.get("postVarsPerFile"),o=t.get("id");s=s.hasOwnProperty(o)?s[o]:s,t instanceof e.FileFlash&&(t.on("uploadstart",this._uploadEventHandler,this),t.on("uploadprogress",this._uploadEventHandler,this),t.on("uploadcomplete",this._uploadEventHandler,this),t.on("uploaderror",this._uploadEventHandler,this),t.on("uploadcancel",this._uploadEventHandler,this),t.startUpload(i,s,this.get("fileFieldName")))},uploadAll:function(e,t){this.uploadThese(this.get("fileList"),e,t)},uploadThese:function(e,t,n){if(!this.queue){var i=t||this.get("uploadURL"),s=n||this.get("postVarsPerFile");this.queue=new r({simUploads:this.get("simLimit"),errorAction:this.get("errorAction"),fileFieldName:this.get("fileFieldName"),fileList:e,uploadURL:i,perFileParameters:s,retryCount:this.get("retryCount")}),this.queue.on("uploadstart",this._uploadEventHandler,this),this.queue.on("uploadprogress",this._uploadEventHandler,this),this.queue.on("totaluploadprogress",this._uploadEventHandler,this),this.queue.on("uploadcomplete",this._uploadEventHandler,this),this.queue.on("alluploadscomplete",this._uploadEventHandler,this),this.queue.on("alluploadscancelled",function(e){this.queue=null},this),this.queue.on("uploaderror",this._uploadEventHandler,this),this.queue.startUpload(),this.fire("uploadstart")}}},{FLASH_CONTAINER:"<div id='{swfContainerId}' style='position:absolute; top:0px; left: 0px; margin: 0; padding: 0; border: 0; width:100%; height:100%'></div>",SELECT_FILES_BUTTON:"<button type='button' class='yui3-button' tabindex='-1'>{selectButtonLabel}</button>",TYPE:"flash",NAME:"uploader",ATTRS:{appendNewFiles:{value:!0},buttonClassNames:{value:{hover:"yui3-button-hover",active:"yui3-button-active",disabled:"yui3-button-disabled",focus:"yui3-button-selected"}},enabled:{value:!0},errorAction:{value:"continue",validator:function(e,t){return e===r.CONTINUE||e===r.STOP||e===r.RESTART_ASAP||e===r.RESTART_AFTER}},fileFilters:{value:[]},fileFilterFunction:{value:null},fileFieldName:{value:"Filedata"},fileList:{value:[],getter:"_getFileList",setter:"_setFileList"},multipleFiles:{value:!1},postVarsPerFile:{value:{}},selectButtonLabel:{value:"Select Files"},selectFilesButton:{valueFn:function(){return e.Node.create(n(e.UploaderFlash.SELECT_FILES_BUTTON,{selectButtonLabel:this.get("selectButtonLabel")}))}},simLimit:{value:2,validator:function(e,t){return e>=2&&e<=5}},swfURL:{valueFn:function(){var t=e.Env.cdn+"uploader/assets/flashuploader.swf";return e.UA.ie>0?t+"?t="+e.guid("uploader"):t}},tabElements:{value:null},uploadURL:{value:""},retryCount:{value:3}}}),e.UploaderFlash.Queue=r},"@VERSION@",{requires:["swf","widget","substitute","base","cssbutton","node","event-custom","file-flash","uploader-queue"]});
View
2 build/uploader-flash/uploader-flash.js
@@ -11,7 +11,7 @@ YUI.add('uploader-flash', function (Y, NAME) {
*/
// Shorthands for external modules
-var substitute = Y.substitute,
+var substitute = Y.Lang.sub,
UploaderQueue = Y.Uploader.Queue,
getCN = Y.ClassNameManager.getClassName,
UPLOADER = 'uploader',
View
4 build/uploader-html5/uploader-html5-coverage.js
@@ -26,7 +26,7 @@ _yuitest_coverage["build/uploader-html5/uploader-html5.js"] = {
path: "build/uploader-html5/uploader-html5.js",
code: []
};
-_yuitest_coverage["build/uploader-html5/uploader-html5.js"].code=["YUI.add('uploader-html5', function (Y, NAME) {","",""," /**"," * This module provides a UI for file selection and multiple file upload capability using"," * HTML5 XMLHTTPRequest Level 2 as a transport engine."," * The supported features include: automatic upload queue management, upload progress"," * tracking, drag-and-drop support, server response retrieval and error reporting."," *"," * @module uploader-html5"," */ ","","// Shorthands for the external modules","var substitute = Y.substitute,"," UploaderQueue = Y.Uploader.Queue;",""," /**"," * This module provides a UI for file selection and multiple file upload capability using"," * HTML5 XMLHTTPRequest Level 2 as a transport engine."," * @class UploaderHTML5"," * @extends Widget"," * @constructor"," */","","function UploaderHTML5(config) {"," UploaderHTML5.superclass.constructor.apply ( this, arguments );","}","","","","Y.UploaderHTML5 = Y.extend( UploaderHTML5, Y.Widget, {",""," /**"," * Stored reference to the instance of the file input field used to "," * initiate the file selection dialog."," *"," * @property _fileInputField"," * @type {Node}"," * @protected"," */"," _fileInputField: null,",""," /**"," * Stored reference to the click event binding of the `Select Files`"," * button."," *"," * @property _buttonBinding"," * @type {EventHandle}"," * @protected"," */"," _buttonBinding: null,",""," /**"," * Stored reference to the instance of Uploader.Queue used to manage"," * the upload process. This is a read-only property that only exists"," * during an active upload process. Only one queue can be active at"," * a time; if an upload start is attempted while a queue is active,"," * it will be ignored."," *"," * @property queue"," * @type {Y.Uploader.Queue}"," */"," queue: null,",""," // Y.UploaderHTML5 prototype",""," /**"," * Construction logic executed during UploaderHTML5 instantiation."," *"," * @method initializer"," * @protected"," */"," initializer : function () {",""," this._fileInputField = null;"," this.queue = null;"," this._buttonBinding = null;"," this._fileList = [];",""," // Publish available events",""," /**"," * Signals that files have been selected. "," *"," * @event fileselect"," * @param event {Event} The event object for the `fileselect` with the"," * following payload:"," * <dl>"," * <dt>fileList</dt>"," * <dd>An `Array` of files selected by the user, encapsulated"," * in Y.FileHTML5 objects.</dd>"," * </dl>"," */"," this.publish(\"fileselect\");",""," /**"," * Signals that an upload of multiple files has been started. "," *"," * @event uploadstart"," * @param event {Event} The event object for the `uploadstart`."," */"," this.publish(\"uploadstart\");",""," /**"," * Signals that an upload of a specific file has started. "," *"," * @event fileuploadstart"," * @param event {Event} The event object for the `fileuploadstart` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>A reference to the Y.File that dispatched the event.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by Y.File.</dd>"," * </dl>"," */"," this.publish(\"fileuploadstart\");",""," /**"," * Reports on upload progress of a specific file. "," *"," * @event uploadprogress"," * @param event {Event} The event object for the `uploadprogress` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>The pointer to the instance of `Y.File` that dispatched the event.</dd>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file that has been uploaded, out of 100</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by the HTML5 uploader</dd>"," * </dl>"," */"," this.publish(\"uploadprogress\");",""," /**"," * Reports on the total upload progress of the file list. "," *"," * @event totaluploadprogress"," * @param event {Event} The event object for the `totaluploadprogress` with the"," * following payload:"," * <dl>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file list that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file list</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file list that has been uploaded, out of 100</dd>"," * </dl>"," */"," this.publish(\"totaluploadprogress\");",""," /**"," * Signals that a single file upload has been completed. "," *"," * @event uploadcomplete"," * @param event {Event} The event object for the `uploadcomplete` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>The pointer to the instance of `Y.File` whose upload has been completed.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event fired by the SWF Uploader</dd>"," * <dt>data</dt>"," * <dd>Data returned by the server.</dd>"," * </dl>"," */"," this.publish(\"uploadcomplete\");",""," /**"," * Signals that the upload process of the entire file list has been completed. "," *"," * @event alluploadscomplete"," * @param event {Event} The event object for the `alluploadscomplete`."," */"," this.publish(\"alluploadscomplete\");",""," /**"," * Signals that a error has occurred in a specific file's upload process. "," *"," * @event uploaderror"," * @param event {Event} The event object for the `uploaderror` with the"," * following payload:"," * <dl>"," * <dt>originEvent</dt>"," * <dd>The original error event fired by the HTML5 Uploader. </dd>"," * <dt>file</dt>"," * <dd>The pointer at the instance of Y.File that returned the error.</dd> "," * <dt>status</dt>"," * <dd>The status reported by the XMLHttpRequest object.</dd>"," * <dt>statusText</dt>"," * <dd>The statusText reported by the XMLHttpRequest object.</dd> "," * </dl>"," */"," this.publish(\"uploaderror\");",""," /**"," * Signals that a dragged object has entered into the uploader's associated drag-and-drop area. "," *"," * @event dragenter"," * @param event {Event} The event object for the `dragenter`."," */"," this.publish(\"dragenter\");",""," /**"," * Signals that an object has been dragged over the uploader's associated drag-and-drop area. "," *"," * @event dragover"," * @param event {Event} The event object for the `dragover`."," */"," this.publish(\"dragover\");",""," /**"," * Signals that an object has been dragged off of the uploader's associated drag-and-drop area. "," *"," * @event dragleave"," * @param event {Event} The event object for the `dragleave`."," */"," this.publish(\"dragleave\");",""," /**"," * Signals that an object has been dropped over the uploader's associated drag-and-drop area. "," *"," * @event drop"," * @param event {Event} The event object for the `drop`."," */"," this.publish(\"drop\");"," "," },",""," /**"," * Create the DOM structure for the UploaderHTML5."," * UploaderHTML5's DOM structure consists of a \"Select Files\" button that can "," * be replaced by the developer's widget of choice; and a hidden file input field"," * that is used to instantiate the File Select dialog."," *"," * @method renderUI"," * @protected"," */"," renderUI : function () {"," var boundingBox = this.get(\"boundingBox\"),"," contentBox = this.get('contentBox'),"," selButton = this.get(\"selectFilesButton\");",""," selButton.setStyles({width:\"100%\", height:\"100%\"});"," contentBox.append(selButton);"," this._fileInputField = Y.Node.create(UploaderHTML5.HTML5FILEFIELD_TEMPLATE);"," contentBox.append(this._fileInputField);"," },",""," /**"," * Binds to the UploaderHTML5 UI and subscribes to the necessary events."," *"," * @method bindUI"," * @protected"," */"," bindUI : function () {",""," this._bindSelectButton();"," this._setMultipleFiles();"," this._setFileFilters();"," this._bindDropArea();"," this._triggerEnabled();",""," this.after(\"multipleFilesChange\", this._setMultipleFiles, this);"," this.after(\"fileFiltersChange\", this._setFileFilters, this);"," this.after(\"enabledChange\", this._triggerEnabled, this);"," this.after(\"selectFilesButtonChange\", this._bindSelectButton, this);"," this.after(\"dragAndDropAreaChange\", this._bindDropArea, this);"," this.after(\"tabIndexChange\", function (ev) {this.get(\"selectFilesButton\").set(\"tabIndex\", this.get(\"tabIndex\"));}, this);"," this._fileInputField.on(\"change\", this._updateFileList, this);",""," this.get(\"selectFilesButton\").set(\"tabIndex\", this.get(\"tabIndex\"));"," },","",""," /**"," * Recreates the file field to null out the previous list of files and"," * thus allow for an identical file list selection."," * "," * @method _rebindFileField"," * @protected"," */"," _rebindFileField : function () {"," this._fileInputField.remove(true);"," this._fileInputField = Y.Node.create(UploaderHTML5.HTML5FILEFIELD_TEMPLATE);"," this.get(\"contentBox\").append(this._fileInputField);"," this._fileInputField.on(\"change\", this._updateFileList, this);"," this._setMultipleFiles();"," this._setFileFilters();"," },","",""," /**"," * Binds the specified drop area's drag and drop events to the"," * uploader's custom handler."," * "," * @method _bindDropArea"," * @protected"," */"," _bindDropArea : function (event) {"," var ev = event || {prevVal: null};",""," if (ev.prevVal !== null) {"," ev.prevVal.detach('drop', this._ddEventHandler);"," ev.prevVal.detach('dragenter', this._ddEventHandler);"," ev.prevVal.detach('dragover', this._ddEventHandler);"," ev.prevVal.detach('dragleave', this._ddEventHandler);"," }",""," var ddArea = this.get(\"dragAndDropArea\");",""," if (ddArea !== null) {"," ddArea.on('drop', this._ddEventHandler, this);"," ddArea.on('dragenter', this._ddEventHandler, this);"," ddArea.on('dragover', this._ddEventHandler, this);"," ddArea.on('dragleave', this._ddEventHandler, this);"," }"," },",""," /**"," * Binds the instantiation of the file select dialog to the current file select"," * control."," * "," * @method _bindSelectButton"," * @protected"," */"," _bindSelectButton : function () {"," this._buttonBinding = this.get(\"selectFilesButton\").on(\"click\", this.openFileSelectDialog, this);"," },",""," /**"," * Handles the drag and drop events from the uploader's specified drop"," * area."," * "," * @method _ddEventHandler"," * @protected"," */"," _ddEventHandler : function (event) {",""," event.stopPropagation();"," event.preventDefault(); "," "," switch (event.type) {"," case \"dragenter\":"," this.fire(\"dragenter\"); "," break;"," case \"dragover\":"," this.fire(\"dragover\");"," break;"," case \"dragleave\": "," this.fire(\"dragleave\");"," break;"," case \"drop\":",""," var newfiles = event._event.dataTransfer.files,"," parsedFiles = [],"," filterFunc = this.get(\"fileFilterFunction\");"," "," if (filterFunc) {"," Y.each(newfiles, function (value) {"," var newfile = new Y.FileHTML5(value);"," if (filterFunc(newfile)) {"," parsedFiles.push(newfile);"," }"," });"," }"," else {"," Y.each(newfiles, function (value) {"," parsedFiles.push(new Y.FileHTML5(value));"," });"," }",""," if (parsedFiles.length > 0) {"," var oldfiles = this.get(\"fileList\");"," this.set(\"fileList\", "," this.get(\"appendNewFiles\") ? oldfiles.concat(parsedFiles) : parsedFiles);"," this.fire(\"fileselect\", {fileList: parsedFiles});"," }",""," this.fire(\"drop\");"," break;"," }"," },",""," /**"," * Adds or removes a specified state CSS class to the underlying uploader button. "," *"," * @method _setButtonClass"," * @protected"," * @param state {String} The name of the state enumerated in `buttonClassNames` attribute"," * from which to derive the needed class name."," * @param add {Boolean} A Boolean indicating whether to add or remove the class."," */"," _setButtonClass : function (state, add) {"," if (add) {"," this.get(\"selectFilesButton\").addClass(this.get(\"buttonClassNames\")[state]);"," }"," else {"," this.get(\"selectFilesButton\").removeClass(this.get(\"buttonClassNames\")[state]);"," }"," },",""," /**"," * Syncs the state of the `multipleFiles` attribute between this class"," * and the file input field."," * "," * @method _setMultipleFiles"," * @protected"," */"," _setMultipleFiles : function () {"," if (this.get(\"multipleFiles\") === true) {"," this._fileInputField.set(\"multiple\", \"multiple\");"," }"," else {"," this._fileInputField.set(\"multiple\", \"\");"," }"," },",""," /**"," * Syncs the state of the `fileFilters` attribute between this class"," * and the file input field."," * "," * @method _setFileFilters"," * @protected"," */"," _setFileFilters : function () {"," if (this.get(\"fileFilters\").length > 0) {"," this._fileInputField.set(\"accept\", this.get(\"fileFilters\").join(\",\"));"," }"," else {"," this._fileInputField.set(\"accept\", \"\");"," }"," },","",""," /**"," * Syncs the state of the `enabled` attribute between this class"," * and the underlying button."," * "," * @method _triggerEnabled"," * @private"," */"," _triggerEnabled : function () {"," if (this.get(\"enabled\") && this._buttonBinding === null) {"," this._bindSelectButton();"," this._setButtonClass(\"disabled\", false);"," this.get(\"selectFilesButton\").setAttribute(\"aria-disabled\", \"false\");"," }"," else if (!this.get(\"enabled\") && this._buttonBinding) {"," this._buttonBinding.detach();"," this._buttonBinding = null;"," this._setButtonClass(\"disabled\", true);"," this.get(\"selectFilesButton\").setAttribute(\"aria-disabled\", \"true\");"," }"," },",""," /**"," * Getter for the `fileList` attribute"," * "," * @method _getFileList"," * @private"," */"," _getFileList : function (arr) {"," return this._fileList.concat();"," },",""," /**"," * Setter for the `fileList` attribute"," * "," * @method _setFileList"," * @private"," */"," _setFileList : function (val) {"," this._fileList = val.concat();"," return this._fileList.concat();"," },",""," /**"," * Adjusts the content of the `fileList` based on the results of file selection"," * and the `appendNewFiles` attribute. If the `appendNewFiles` attribute is true,"," * then selected files are appended to the existing list; otherwise, the list is"," * cleared and populated with the newly selected files."," * "," * @method _updateFileList"," * @param ev {Event} The file selection event received from the uploader."," * @protected"," */"," _updateFileList : function (ev) {"," var newfiles = ev.target.getDOMNode().files,"," parsedFiles = [],"," filterFunc = this.get(\"fileFilterFunction\");",""," if (filterFunc) {"," Y.each(newfiles, function (value) {"," var newfile = new Y.FileHTML5(value);"," if (filterFunc(newfile)) {"," parsedFiles.push(newfile);"," }"," });"," }"," else {"," Y.each(newfiles, function (value) {"," parsedFiles.push(new Y.FileHTML5(value));"," });"," }",""," if (parsedFiles.length > 0) {"," var oldfiles = this.get(\"fileList\");",""," this.set(\"fileList\", "," this.get(\"appendNewFiles\") ? oldfiles.concat(parsedFiles) : parsedFiles );",""," this.fire(\"fileselect\", {fileList: parsedFiles});"," }",""," this._rebindFileField();"," },","",""," /**"," * Handles and retransmits events fired by `Y.File` and `Y.Uploader.Queue`."," * "," * @method _uploadEventHandler"," * @param event The event dispatched during the upload process."," * @protected"," */"," _uploadEventHandler : function (event) {"," "," switch (event.type) {"," case \"file:uploadstart\":"," this.fire(\"fileuploadstart\", event);"," break;"," case \"file:uploadprogress\":"," this.fire(\"uploadprogress\", event);"," break;"," case \"uploaderqueue:totaluploadprogress\":"," this.fire(\"totaluploadprogress\", event);"," break;"," case \"file:uploadcomplete\":"," this.fire(\"uploadcomplete\", event);"," break;"," case \"uploaderqueue:alluploadscomplete\":"," this.queue = null;"," this.fire(\"alluploadscomplete\", event);"," break;"," case \"file:uploaderror\":"," case \"uploaderqueue:uploaderror\":"," this.fire(\"uploaderror\", event);"," break;"," case \"file:uploadcancel\":"," case \"uploaderqueue:uploadcancel\":"," this.fire(\"uploadcancel\", event);"," break;"," } ",""," },",""," /**"," * Opens the File Selection dialog by simulating a click on the file input field."," * "," * @method openFileSelectDialog"," */"," openFileSelectDialog : function () {"," var fileDomNode = this._fileInputField.getDOMNode();"," if (fileDomNode.click) {"," fileDomNode.click();"," } "," },",""," /**"," * Starts the upload of a specific file."," *"," * @method upload"," * @param file {Y.File} Reference to the instance of the file to be uploaded."," * @param url {String} The URL to upload the file to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," upload : function (file, url, postvars) {"," "," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\"),"," fileId = file.get(\"id\");",""," postVars = postVars.hasOwnProperty(fileId) ? postVars[fileId] : postVars;",""," if (file instanceof Y.FileHTML5) {"," "," file.on(\"uploadstart\", this._uploadEventHandler, this);"," file.on(\"uploadprogress\", this._uploadEventHandler, this);"," file.on(\"uploadcomplete\", this._uploadEventHandler, this);"," file.on(\"uploaderror\", this._uploadEventHandler, this);"," file.on(\"uploadcancel\", this._uploadEventHandler, this);",""," file.startUpload(uploadURL, postVars, this.get(\"fileFieldName\"));"," }"," },",""," /**"," * Starts the upload of all files on the file list, using an automated queue."," *"," * @method uploadAll"," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadAll : function (url, postvars) {"," this.uploadThese(this.get(\"fileList\"), url, postvars);"," },",""," /**"," * Starts the upload of the files specified in the first argument, using an automated queue."," *"," * @method uploadThese"," * @param files {Array} The list of files to upload."," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadThese : function (files, url, postvars) {"," if (!this.queue) {"," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\");",""," this.queue = new UploaderQueue({simUploads: this.get(\"simLimit\"), "," errorAction: this.get(\"errorAction\"),"," fileFieldName: this.get(\"fileFieldName\"),"," fileList: files,"," uploadURL: uploadURL,"," perFileParameters: postVars,"," retryCount: this.get(\"retryCount\"),"," uploadHeaders: this.get(\"uploadHeaders\"),"," withCredentials: this.get(\"withCredentials\")"," });"," this.queue.on(\"uploadstart\", this._uploadEventHandler, this);"," this.queue.on(\"uploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"totaluploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"uploadcomplete\", this._uploadEventHandler, this);"," this.queue.on(\"alluploadscomplete\", this._uploadEventHandler, this);"," this.queue.on(\"uploadcancel\", this._uploadEventHandler, this);"," this.queue.on(\"uploaderror\", this._uploadEventHandler, this);"," this.queue.startUpload(); "," "," this.fire(\"uploadstart\"); "," }"," else if (this.queue._currentState === UploaderQueue.UPLOADING) {"," this.queue.set(\"perFileParameters\", this.get(\"postVarsPerFile\"));"," Y.each(files, function (file) {"," this.queue.addToQueueBottom(file);"," }, this);"," }"," }","},","","{"," /**"," * The template for the hidden file input field container. The file input field will only"," * accept clicks if its visibility is set to hidden (and will not if it's `display` value"," * is set to `none`)"," *"," * @property HTML5FILEFIELD_TEMPLATE"," * @type {String}"," * @static"," */"," HTML5FILEFIELD_TEMPLATE: \"<input type='file' style='visibility:hidden; width:0px; height: 0px;'>\","," "," /**"," * The template for the \"Select Files\" button."," *"," * @property SELECT_FILES_BUTTON"," * @type {String}"," * @static"," * @default \"<button type='button' class='yui3-button' role='button' aria-label='{selectButtonLabel}' tabindex='{tabIndex}'>{selectButtonLabel}</button>\""," */ "," SELECT_FILES_BUTTON: \"<button type='button' class='yui3-button' role='button' aria-label='{selectButtonLabel}' tabindex='{tabIndex}'>{selectButtonLabel}</button>\",",""," /**"," * The static property reflecting the type of uploader that `Y.Uploader`"," * aliases. The UploaderHTML5 value is `\"html5\"`."," * "," * @property TYPE"," * @type {String}"," * @static"," */"," TYPE: \"html5\",",""," /**"," * The identity of the widget."," *"," * @property NAME"," * @type String"," * @default 'uploader'"," * @readOnly"," * @protected"," * @static"," */"," NAME: \"uploader\",",""," /**"," * Static property used to define the default attribute configuration of"," * the Widget."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * A Boolean indicating whether newly selected files should be appended "," * to the existing file list, or whether they should replace it."," *"," * @attribute appendNewFiles"," * @type {Boolean}"," * @default true"," */"," appendNewFiles : {"," value: true"," },",""," /**"," * The names of CSS classes that correspond to different button states"," * of the \"Select Files\" control. These classes are assigned to the "," * \"Select Files\" control based on the configuration of the uploader."," * Currently, the only class name used is that corresponding to the "," * `disabled` state of the uploader. Other button states should be managed"," * directly via CSS selectors."," * <ul>"," * <li> <strong>`disabled`</strong>: the class corresponding to the disabled state"," * of the \"Select Files\" button.</li>"," * </ul>"," * @attribute buttonClassNames"," * @type {Object}"," * @default {"," * disabled: \"yui3-button-disabled\""," * }"," */"," buttonClassNames: {"," value: {"," \"hover\": \"yui3-button-hover\","," \"active\": \"yui3-button-active\","," \"disabled\": \"yui3-button-disabled\","," \"focus\": \"yui3-button-selected\""," }"," },",""," /**"," * The node that serves as the drop target for files."," *"," * @attribute dragAndDropArea"," * @type {Node}"," * @default null"," */"," dragAndDropArea: {"," value: null,"," setter: function (val) {"," return Y.one(val);"," }"," },",""," /**"," * A Boolean indicating whether the uploader is enabled or disabled for user input."," *"," * @attribute enabled"," * @type {Boolean}"," * @default true"," */"," enabled : {"," value: true"," },",""," /**"," * The action performed when an upload error occurs for a specific file being uploaded."," * The possible values are: "," * <ul>"," * <li> <strong>`UploaderQueue.CONTINUE`</strong>: the error is ignored and the upload process is continued.</li>"," * <li> <strong>`UploaderQueue.STOP`</strong>: the upload process is stopped as soon as any other parallel file"," * uploads are finished.</li>"," * <li> <strong>`UploaderQueue.RESTART_ASAP`</strong>: the file is added back to the front of the queue.</li>"," * <li> <strong>`UploaderQueue.RESTART_AFTER`</strong>: the file is added to the back of the queue.</li>"," * </ul>"," * @attribute errorAction"," * @type {String}"," * @default UploaderQueue.CONTINUE"," */"," errorAction: {"," value: \"continue\","," validator: function (val, name) {"," return (val === UploaderQueue.CONTINUE || val === UploaderQueue.STOP || val === UploaderQueue.RESTART_ASAP || val === UploaderQueue.RESTART_AFTER); }"," },",""," /**"," * An array indicating what fileFilters should be applied to the file"," * selection dialog. Each element in the array should be a string"," * indicating the Media (MIME) type for the files that should be supported"," * for selection. The Media type strings should be properly formatted"," * or this parameter will be ignored. Examples of valid strings include: "," * \"audio/*\", \"video/*\", \"application/pdf\", etc. More information"," * on valid Media type strings is available here: "," * http://www.iana.org/assignments/media-types/index.html"," * @attribute fileFilters"," * @type {Array}"," * @default []"," */"," fileFilters: {"," value: []"," },",""," /**"," * A filtering function that is applied to every file selected by the user."," * The function receives the `Y.File` object and must return a Boolean value."," * If a `false` value is returned, the file in question is not added to the"," * list of files to be uploaded."," * Use this function to put limits on file sizes or check the file names for"," * correct extension, but make sure that a server-side check is also performed,"," * since any client-side restrictions are only advisory and can be circumvented."," *"," * @attribute fileFilterFunction"," * @type {Function}"," * @default null"," */"," fileFilterFunction: {"," value: null"," },",""," /**"," * A String specifying what should be the POST field name for the file"," * content in the upload request."," *"," * @attribute fileFieldName"," * @type {String}"," * @default Filedata"," */"," fileFieldName: {"," value: \"Filedata\" "," },",""," /**"," * The array of files to be uploaded. All elements in the array"," * must be instances of `Y.File` and be instantiated with an instance"," * of native JavaScript File() class."," *"," * @attribute fileList"," * @type {Array}"," * @default []"," */"," fileList: {"," value: [],"," getter: \"_getFileList\","," setter: \"_setFileList\""," },",""," /**"," * A Boolean indicating whether multiple file selection is enabled."," *"," * @attribute multipleFiles"," * @type {Boolean}"," * @default false"," */"," multipleFiles: {"," value: false"," },",""," /**"," * An object, keyed by `fileId`, containing sets of key-value pairs"," * that should be passed as POST variables along with each corresponding"," * file. This attribute is only used if no POST variables are specifed"," * in the upload method call."," *"," * @attribute postVarsPerFile"," * @type {Object}"," * @default {}"," */"," postVarsPerFile: {"," value: {}"," },",""," /**"," * The label for the \"Select Files\" widget. This is the value that replaces the"," * `{selectButtonLabel}` token in the `SELECT_FILES_BUTTON` template."," * "," * @attribute selectButtonLabel"," * @type {String}"," * @default \"Select Files\""," */"," selectButtonLabel: {"," value: \"Select Files\""," },",""," /**"," * The widget that serves as the \"Select Files control for the file uploader"," * "," *"," * @attribute selectFilesButton"," * @type {Node | Widget}"," * @default A standard HTML button with YUI CSS Button skin."," */"," selectFilesButton : {"," valueFn: function () {"," return Y.Node.create(substitute(Y.UploaderHTML5.SELECT_FILES_BUTTON, {selectButtonLabel: this.get(\"selectButtonLabel\"),"," tabIndex: this.get(\"tabIndex\")}));"," }"," },",""," /**"," * The number of files that can be uploaded"," * simultaneously if the automatic queue management"," * is used. This value can be in the range between 2"," * and 5."," *"," * @attribute simLimit"," * @type {Number}"," * @default 2"," */"," simLimit: {"," value: 2,"," validator: function (val, name) {"," return (val >= 1 && val <= 5);"," }"," },",""," /**"," * The URL to which file upload requested are POSTed. Only used if a different url is not passed to the upload method call."," *"," * @attribute uploadURL"," * @type {String}"," * @default \"\""," */"," uploadURL: {"," value: \"\""," },",""," /**"," * Additional HTTP headers that should be included"," * in the upload request."," *"," *"," * @attribute uploadHeaders"," * @type {Object}"," * @default {}"," */ "," uploadHeaders: {"," value: {}"," },",""," /**"," * A Boolean that specifies whether the file should be"," * uploaded with the appropriate user credentials for the"," * domain. "," *"," * @attribute withCredentials"," * @type {Boolean}"," * @default true"," */ "," withCredentials: {"," value: true"," },",""," /**"," * The number of times to try re-uploading a file that failed to upload before"," * cancelling its upload."," *"," * @attribute retryCount"," * @type {Number}"," * @default 3"," */ "," retryCount: {"," value: 3"," }"," }","});","","Y.UploaderHTML5.Queue = UploaderQueue;","","","","}, '@VERSION@', {\"requires\": [\"widget\", \"node-event-simulate\", \"substitute\", \"file-html5\", \"uploader-queue\"]});"];
+_yuitest_coverage["build/uploader-html5/uploader-html5.js"].code=["YUI.add('uploader-html5', function (Y, NAME) {","",""," /**"," * This module provides a UI for file selection and multiple file upload capability using"," * HTML5 XMLHTTPRequest Level 2 as a transport engine."," * The supported features include: automatic upload queue management, upload progress"," * tracking, drag-and-drop support, server response retrieval and error reporting."," *"," * @module uploader-html5"," */ ","","// Shorthands for the external modules","var substitute = Y.Lang.sub,"," UploaderQueue = Y.Uploader.Queue;",""," /**"," * This module provides a UI for file selection and multiple file upload capability using"," * HTML5 XMLHTTPRequest Level 2 as a transport engine."," * @class UploaderHTML5"," * @extends Widget"," * @constructor"," */","","function UploaderHTML5(config) {"," UploaderHTML5.superclass.constructor.apply ( this, arguments );","}","","","","Y.UploaderHTML5 = Y.extend( UploaderHTML5, Y.Widget, {",""," /**"," * Stored reference to the instance of the file input field used to "," * initiate the file selection dialog."," *"," * @property _fileInputField"," * @type {Node}"," * @protected"," */"," _fileInputField: null,",""," /**"," * Stored reference to the click event binding of the `Select Files`"," * button."," *"," * @property _buttonBinding"," * @type {EventHandle}"," * @protected"," */"," _buttonBinding: null,",""," /**"," * Stored reference to the instance of Uploader.Queue used to manage"," * the upload process. This is a read-only property that only exists"," * during an active upload process. Only one queue can be active at"," * a time; if an upload start is attempted while a queue is active,"," * it will be ignored."," *"," * @property queue"," * @type {Y.Uploader.Queue}"," */"," queue: null,",""," // Y.UploaderHTML5 prototype",""," /**"," * Construction logic executed during UploaderHTML5 instantiation."," *"," * @method initializer"," * @protected"," */"," initializer : function () {",""," this._fileInputField = null;"," this.queue = null;"," this._buttonBinding = null;"," this._fileList = [];",""," // Publish available events",""," /**"," * Signals that files have been selected. "," *"," * @event fileselect"," * @param event {Event} The event object for the `fileselect` with the"," * following payload:"," * <dl>"," * <dt>fileList</dt>"," * <dd>An `Array` of files selected by the user, encapsulated"," * in Y.FileHTML5 objects.</dd>"," * </dl>"," */"," this.publish(\"fileselect\");",""," /**"," * Signals that an upload of multiple files has been started. "," *"," * @event uploadstart"," * @param event {Event} The event object for the `uploadstart`."," */"," this.publish(\"uploadstart\");",""," /**"," * Signals that an upload of a specific file has started. "," *"," * @event fileuploadstart"," * @param event {Event} The event object for the `fileuploadstart` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>A reference to the Y.File that dispatched the event.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by Y.File.</dd>"," * </dl>"," */"," this.publish(\"fileuploadstart\");",""," /**"," * Reports on upload progress of a specific file. "," *"," * @event uploadprogress"," * @param event {Event} The event object for the `uploadprogress` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>The pointer to the instance of `Y.File` that dispatched the event.</dd>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file that has been uploaded, out of 100</dd>"," * <dt>originEvent</dt>"," * <dd>The original event dispatched by the HTML5 uploader</dd>"," * </dl>"," */"," this.publish(\"uploadprogress\");",""," /**"," * Reports on the total upload progress of the file list. "," *"," * @event totaluploadprogress"," * @param event {Event} The event object for the `totaluploadprogress` with the"," * following payload:"," * <dl>"," * <dt>bytesLoaded</dt>"," * <dd>The number of bytes of the file list that has been uploaded</dd>"," * <dt>bytesTotal</dt>"," * <dd>The total number of bytes in the file list</dd>"," * <dt>percentLoaded</dt>"," * <dd>The fraction of the file list that has been uploaded, out of 100</dd>"," * </dl>"," */"," this.publish(\"totaluploadprogress\");",""," /**"," * Signals that a single file upload has been completed. "," *"," * @event uploadcomplete"," * @param event {Event} The event object for the `uploadcomplete` with the"," * following payload:"," * <dl>"," * <dt>file</dt>"," * <dd>The pointer to the instance of `Y.File` whose upload has been completed.</dd>"," * <dt>originEvent</dt>"," * <dd>The original event fired by the SWF Uploader</dd>"," * <dt>data</dt>"," * <dd>Data returned by the server.</dd>"," * </dl>"," */"," this.publish(\"uploadcomplete\");",""," /**"," * Signals that the upload process of the entire file list has been completed. "," *"," * @event alluploadscomplete"," * @param event {Event} The event object for the `alluploadscomplete`."," */"," this.publish(\"alluploadscomplete\");",""," /**"," * Signals that a error has occurred in a specific file's upload process. "," *"," * @event uploaderror"," * @param event {Event} The event object for the `uploaderror` with the"," * following payload:"," * <dl>"," * <dt>originEvent</dt>"," * <dd>The original error event fired by the HTML5 Uploader. </dd>"," * <dt>file</dt>"," * <dd>The pointer at the instance of Y.File that returned the error.</dd> "," * <dt>status</dt>"," * <dd>The status reported by the XMLHttpRequest object.</dd>"," * <dt>statusText</dt>"," * <dd>The statusText reported by the XMLHttpRequest object.</dd> "," * </dl>"," */"," this.publish(\"uploaderror\");",""," /**"," * Signals that a dragged object has entered into the uploader's associated drag-and-drop area. "," *"," * @event dragenter"," * @param event {Event} The event object for the `dragenter`."," */"," this.publish(\"dragenter\");",""," /**"," * Signals that an object has been dragged over the uploader's associated drag-and-drop area. "," *"," * @event dragover"," * @param event {Event} The event object for the `dragover`."," */"," this.publish(\"dragover\");",""," /**"," * Signals that an object has been dragged off of the uploader's associated drag-and-drop area. "," *"," * @event dragleave"," * @param event {Event} The event object for the `dragleave`."," */"," this.publish(\"dragleave\");",""," /**"," * Signals that an object has been dropped over the uploader's associated drag-and-drop area. "," *"," * @event drop"," * @param event {Event} The event object for the `drop`."," */"," this.publish(\"drop\");"," "," },",""," /**"," * Create the DOM structure for the UploaderHTML5."," * UploaderHTML5's DOM structure consists of a \"Select Files\" button that can "," * be replaced by the developer's widget of choice; and a hidden file input field"," * that is used to instantiate the File Select dialog."," *"," * @method renderUI"," * @protected"," */"," renderUI : function () {"," var boundingBox = this.get(\"boundingBox\"),"," contentBox = this.get('contentBox'),"," selButton = this.get(\"selectFilesButton\");",""," selButton.setStyles({width:\"100%\", height:\"100%\"});"," contentBox.append(selButton);"," this._fileInputField = Y.Node.create(UploaderHTML5.HTML5FILEFIELD_TEMPLATE);"," contentBox.append(this._fileInputField);"," },",""," /**"," * Binds to the UploaderHTML5 UI and subscribes to the necessary events."," *"," * @method bindUI"," * @protected"," */"," bindUI : function () {",""," this._bindSelectButton();"," this._setMultipleFiles();"," this._setFileFilters();"," this._bindDropArea();"," this._triggerEnabled();",""," this.after(\"multipleFilesChange\", this._setMultipleFiles, this);"," this.after(\"fileFiltersChange\", this._setFileFilters, this);"," this.after(\"enabledChange\", this._triggerEnabled, this);"," this.after(\"selectFilesButtonChange\", this._bindSelectButton, this);"," this.after(\"dragAndDropAreaChange\", this._bindDropArea, this);"," this.after(\"tabIndexChange\", function (ev) {this.get(\"selectFilesButton\").set(\"tabIndex\", this.get(\"tabIndex\"));}, this);"," this._fileInputField.on(\"change\", this._updateFileList, this);",""," this.get(\"selectFilesButton\").set(\"tabIndex\", this.get(\"tabIndex\"));"," },","",""," /**"," * Recreates the file field to null out the previous list of files and"," * thus allow for an identical file list selection."," * "," * @method _rebindFileField"," * @protected"," */"," _rebindFileField : function () {"," this._fileInputField.remove(true);"," this._fileInputField = Y.Node.create(UploaderHTML5.HTML5FILEFIELD_TEMPLATE);"," this.get(\"contentBox\").append(this._fileInputField);"," this._fileInputField.on(\"change\", this._updateFileList, this);"," this._setMultipleFiles();"," this._setFileFilters();"," },","",""," /**"," * Binds the specified drop area's drag and drop events to the"," * uploader's custom handler."," * "," * @method _bindDropArea"," * @protected"," */"," _bindDropArea : function (event) {"," var ev = event || {prevVal: null};",""," if (ev.prevVal !== null) {"," ev.prevVal.detach('drop', this._ddEventHandler);"," ev.prevVal.detach('dragenter', this._ddEventHandler);"," ev.prevVal.detach('dragover', this._ddEventHandler);"," ev.prevVal.detach('dragleave', this._ddEventHandler);"," }",""," var ddArea = this.get(\"dragAndDropArea\");",""," if (ddArea !== null) {"," ddArea.on('drop', this._ddEventHandler, this);"," ddArea.on('dragenter', this._ddEventHandler, this);"," ddArea.on('dragover', this._ddEventHandler, this);"," ddArea.on('dragleave', this._ddEventHandler, this);"," }"," },",""," /**"," * Binds the instantiation of the file select dialog to the current file select"," * control."," * "," * @method _bindSelectButton"," * @protected"," */"," _bindSelectButton : function () {"," this._buttonBinding = this.get(\"selectFilesButton\").on(\"click\", this.openFileSelectDialog, this);"," },",""," /**"," * Handles the drag and drop events from the uploader's specified drop"," * area."," * "," * @method _ddEventHandler"," * @protected"," */"," _ddEventHandler : function (event) {",""," event.stopPropagation();"," event.preventDefault(); "," "," switch (event.type) {"," case \"dragenter\":"," this.fire(\"dragenter\"); "," break;"," case \"dragover\":"," this.fire(\"dragover\");"," break;"," case \"dragleave\": "," this.fire(\"dragleave\");"," break;"," case \"drop\":",""," var newfiles = event._event.dataTransfer.files,"," parsedFiles = [],"," filterFunc = this.get(\"fileFilterFunction\");"," "," if (filterFunc) {"," Y.each(newfiles, function (value) {"," var newfile = new Y.FileHTML5(value);"," if (filterFunc(newfile)) {"," parsedFiles.push(newfile);"," }"," });"," }"," else {"," Y.each(newfiles, function (value) {"," parsedFiles.push(new Y.FileHTML5(value));"," });"," }",""," if (parsedFiles.length > 0) {"," var oldfiles = this.get(\"fileList\");"," this.set(\"fileList\", "," this.get(\"appendNewFiles\") ? oldfiles.concat(parsedFiles) : parsedFiles);"," this.fire(\"fileselect\", {fileList: parsedFiles});"," }",""," this.fire(\"drop\");"," break;"," }"," },",""," /**"," * Adds or removes a specified state CSS class to the underlying uploader button. "," *"," * @method _setButtonClass"," * @protected"," * @param state {String} The name of the state enumerated in `buttonClassNames` attribute"," * from which to derive the needed class name."," * @param add {Boolean} A Boolean indicating whether to add or remove the class."," */"," _setButtonClass : function (state, add) {"," if (add) {"," this.get(\"selectFilesButton\").addClass(this.get(\"buttonClassNames\")[state]);"," }"," else {"," this.get(\"selectFilesButton\").removeClass(this.get(\"buttonClassNames\")[state]);"," }"," },",""," /**"," * Syncs the state of the `multipleFiles` attribute between this class"," * and the file input field."," * "," * @method _setMultipleFiles"," * @protected"," */"," _setMultipleFiles : function () {"," if (this.get(\"multipleFiles\") === true) {"," this._fileInputField.set(\"multiple\", \"multiple\");"," }"," else {"," this._fileInputField.set(\"multiple\", \"\");"," }"," },",""," /**"," * Syncs the state of the `fileFilters` attribute between this class"," * and the file input field."," * "," * @method _setFileFilters"," * @protected"," */"," _setFileFilters : function () {"," if (this.get(\"fileFilters\").length > 0) {"," this._fileInputField.set(\"accept\", this.get(\"fileFilters\").join(\",\"));"," }"," else {"," this._fileInputField.set(\"accept\", \"\");"," }"," },","",""," /**"," * Syncs the state of the `enabled` attribute between this class"," * and the underlying button."," * "," * @method _triggerEnabled"," * @private"," */"," _triggerEnabled : function () {"," if (this.get(\"enabled\") && this._buttonBinding === null) {"," this._bindSelectButton();"," this._setButtonClass(\"disabled\", false);"," this.get(\"selectFilesButton\").setAttribute(\"aria-disabled\", \"false\");"," }"," else if (!this.get(\"enabled\") && this._buttonBinding) {"," this._buttonBinding.detach();"," this._buttonBinding = null;"," this._setButtonClass(\"disabled\", true);"," this.get(\"selectFilesButton\").setAttribute(\"aria-disabled\", \"true\");"," }"," },",""," /**"," * Getter for the `fileList` attribute"," * "," * @method _getFileList"," * @private"," */"," _getFileList : function (arr) {"," return this._fileList.concat();"," },",""," /**"," * Setter for the `fileList` attribute"," * "," * @method _setFileList"," * @private"," */"," _setFileList : function (val) {"," this._fileList = val.concat();"," return this._fileList.concat();"," },",""," /**"," * Adjusts the content of the `fileList` based on the results of file selection"," * and the `appendNewFiles` attribute. If the `appendNewFiles` attribute is true,"," * then selected files are appended to the existing list; otherwise, the list is"," * cleared and populated with the newly selected files."," * "," * @method _updateFileList"," * @param ev {Event} The file selection event received from the uploader."," * @protected"," */"," _updateFileList : function (ev) {"," var newfiles = ev.target.getDOMNode().files,"," parsedFiles = [],"," filterFunc = this.get(\"fileFilterFunction\");",""," if (filterFunc) {"," Y.each(newfiles, function (value) {"," var newfile = new Y.FileHTML5(value);"," if (filterFunc(newfile)) {"," parsedFiles.push(newfile);"," }"," });"," }"," else {"," Y.each(newfiles, function (value) {"," parsedFiles.push(new Y.FileHTML5(value));"," });"," }",""," if (parsedFiles.length > 0) {"," var oldfiles = this.get(\"fileList\");",""," this.set(\"fileList\", "," this.get(\"appendNewFiles\") ? oldfiles.concat(parsedFiles) : parsedFiles );",""," this.fire(\"fileselect\", {fileList: parsedFiles});"," }",""," this._rebindFileField();"," },","",""," /**"," * Handles and retransmits events fired by `Y.File` and `Y.Uploader.Queue`."," * "," * @method _uploadEventHandler"," * @param event The event dispatched during the upload process."," * @protected"," */"," _uploadEventHandler : function (event) {"," "," switch (event.type) {"," case \"file:uploadstart\":"," this.fire(\"fileuploadstart\", event);"," break;"," case \"file:uploadprogress\":"," this.fire(\"uploadprogress\", event);"," break;"," case \"uploaderqueue:totaluploadprogress\":"," this.fire(\"totaluploadprogress\", event);"," break;"," case \"file:uploadcomplete\":"," this.fire(\"uploadcomplete\", event);"," break;"," case \"uploaderqueue:alluploadscomplete\":"," this.queue = null;"," this.fire(\"alluploadscomplete\", event);"," break;"," case \"file:uploaderror\":"," case \"uploaderqueue:uploaderror\":"," this.fire(\"uploaderror\", event);"," break;"," case \"file:uploadcancel\":"," case \"uploaderqueue:uploadcancel\":"," this.fire(\"uploadcancel\", event);"," break;"," } ",""," },",""," /**"," * Opens the File Selection dialog by simulating a click on the file input field."," * "," * @method openFileSelectDialog"," */"," openFileSelectDialog : function () {"," var fileDomNode = this._fileInputField.getDOMNode();"," if (fileDomNode.click) {"," fileDomNode.click();"," } "," },",""," /**"," * Starts the upload of a specific file."," *"," * @method upload"," * @param file {Y.File} Reference to the instance of the file to be uploaded."," * @param url {String} The URL to upload the file to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," upload : function (file, url, postvars) {"," "," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\"),"," fileId = file.get(\"id\");",""," postVars = postVars.hasOwnProperty(fileId) ? postVars[fileId] : postVars;",""," if (file instanceof Y.FileHTML5) {"," "," file.on(\"uploadstart\", this._uploadEventHandler, this);"," file.on(\"uploadprogress\", this._uploadEventHandler, this);"," file.on(\"uploadcomplete\", this._uploadEventHandler, this);"," file.on(\"uploaderror\", this._uploadEventHandler, this);"," file.on(\"uploadcancel\", this._uploadEventHandler, this);",""," file.startUpload(uploadURL, postVars, this.get(\"fileFieldName\"));"," }"," },",""," /**"," * Starts the upload of all files on the file list, using an automated queue."," *"," * @method uploadAll"," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadAll : function (url, postvars) {"," this.uploadThese(this.get(\"fileList\"), url, postvars);"," },",""," /**"," * Starts the upload of the files specified in the first argument, using an automated queue."," *"," * @method uploadThese"," * @param files {Array} The list of files to upload."," * @param url {String} The URL to upload the files to."," * @param postVars {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request."," * If not specified, the values from the attribute `postVarsPerFile` are used instead. "," */"," uploadThese : function (files, url, postvars) {"," if (!this.queue) {"," var uploadURL = url || this.get(\"uploadURL\"),"," postVars = postvars || this.get(\"postVarsPerFile\");",""," this.queue = new UploaderQueue({simUploads: this.get(\"simLimit\"), "," errorAction: this.get(\"errorAction\"),"," fileFieldName: this.get(\"fileFieldName\"),"," fileList: files,"," uploadURL: uploadURL,"," perFileParameters: postVars,"," retryCount: this.get(\"retryCount\"),"," uploadHeaders: this.get(\"uploadHeaders\"),"," withCredentials: this.get(\"withCredentials\")"," });"," this.queue.on(\"uploadstart\", this._uploadEventHandler, this);"," this.queue.on(\"uploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"totaluploadprogress\", this._uploadEventHandler, this);"," this.queue.on(\"uploadcomplete\", this._uploadEventHandler, this);"," this.queue.on(\"alluploadscomplete\", this._uploadEventHandler, this);"," this.queue.on(\"uploadcancel\", this._uploadEventHandler, this);"," this.queue.on(\"uploaderror\", this._uploadEventHandler, this);"," this.queue.startUpload(); "," "," this.fire(\"uploadstart\"); "," }"," else if (this.queue._currentState === UploaderQueue.UPLOADING) {"," this.queue.set(\"perFileParameters\", this.get(\"postVarsPerFile\"));"," Y.each(files, function (file) {"," this.queue.addToQueueBottom(file);"," }, this);"," }"," }","},","","{"," /**"," * The template for the hidden file input field container. The file input field will only"," * accept clicks if its visibility is set to hidden (and will not if it's `display` value"," * is set to `none`)"," *"," * @property HTML5FILEFIELD_TEMPLATE"," * @type {String}"," * @static"," */"," HTML5FILEFIELD_TEMPLATE: \"<input type='file' style='visibility:hidden; width:0px; height: 0px;'>\","," "," /**"," * The template for the \"Select Files\" button."," *"," * @property SELECT_FILES_BUTTON"," * @type {String}"," * @static"," * @default \"<button type='button' class='yui3-button' role='button' aria-label='{selectButtonLabel}' tabindex='{tabIndex}'>{selectButtonLabel}</button>\""," */ "," SELECT_FILES_BUTTON: \"<button type='button' class='yui3-button' role='button' aria-label='{selectButtonLabel}' tabindex='{tabIndex}'>{selectButtonLabel}</button>\",",""," /**"," * The static property reflecting the type of uploader that `Y.Uploader`"," * aliases. The UploaderHTML5 value is `\"html5\"`."," * "," * @property TYPE"," * @type {String}"," * @static"," */"," TYPE: \"html5\",",""," /**"," * The identity of the widget."," *"," * @property NAME"," * @type String"," * @default 'uploader'"," * @readOnly"," * @protected"," * @static"," */"," NAME: \"uploader\",",""," /**"," * Static property used to define the default attribute configuration of"," * the Widget."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * A Boolean indicating whether newly selected files should be appended "," * to the existing file list, or whether they should replace it."," *"," * @attribute appendNewFiles"," * @type {Boolean}"," * @default true"," */"," appendNewFiles : {"," value: true"," },",""," /**"," * The names of CSS classes that correspond to different button states"," * of the \"Select Files\" control. These classes are assigned to the "," * \"Select Files\" control based on the configuration of the uploader."," * Currently, the only class name used is that corresponding to the "," * `disabled` state of the uploader. Other button states should be managed"," * directly via CSS selectors."," * <ul>"," * <li> <strong>`disabled`</strong>: the class corresponding to the disabled state"," * of the \"Select Files\" button.</li>"," * </ul>"," * @attribute buttonClassNames"," * @type {Object}"," * @default {"," * disabled: \"yui3-button-disabled\""," * }"," */"," buttonClassNames: {"," value: {"," \"hover\": \"yui3-button-hover\","," \"active\": \"yui3-button-active\","," \"disabled\": \"yui3-button-disabled\","," \"focus\": \"yui3-button-selected\""," }"," },",""," /**"," * The node that serves as the drop target for files."," *"," * @attribute dragAndDropArea"," * @type {Node}"," * @default null"," */"," dragAndDropArea: {"," value: null,"," setter: function (val) {"," return Y.one(val);"," }"," },",""," /**"," * A Boolean indicating whether the uploader is enabled or disabled for user input."," *"," * @attribute enabled"," * @type {Boolean}"," * @default true"," */"," enabled : {"," value: true"," },",""," /**"," * The action performed when an upload error occurs for a specific file being uploaded."," * The possible values are: "," * <ul>"," * <li> <strong>`UploaderQueue.CONTINUE`</strong>: the error is ignored and the upload process is continued.</li>"," * <li> <strong>`UploaderQueue.STOP`</strong>: the upload process is stopped as soon as any other parallel file"," * uploads are finished.</li>"," * <li> <strong>`UploaderQueue.RESTART_ASAP`</strong>: the file is added back to the front of the queue.</li>"," * <li> <strong>`UploaderQueue.RESTART_AFTER`</strong>: the file is added to the back of the queue.</li>"," * </ul>"," * @attribute errorAction"," * @type {String}"," * @default UploaderQueue.CONTINUE"," */"," errorAction: {"," value: \"continue\","," validator: function (val, name) {"," return (val === UploaderQueue.CONTINUE || val === UploaderQueue.STOP || val === UploaderQueue.RESTART_ASAP || val === UploaderQueue.RESTART_AFTER); }"," },",""," /**"," * An array indicating what fileFilters should be applied to the file"," * selection dialog. Each element in the array should be a string"," * indicating the Media (MIME) type for the files that should be supported"," * for selection. The Media type strings should be properly formatted"," * or this parameter will be ignored. Examples of valid strings include: "," * \"audio/*\", \"video/*\", \"application/pdf\", etc. More information"," * on valid Media type strings is available here: "," * http://www.iana.org/assignments/media-types/index.html"," * @attribute fileFilters"," * @type {Array}"," * @default []"," */"," fileFilters: {"," value: []"," },",""," /**"," * A filtering function that is applied to every file selected by the user."," * The function receives the `Y.File` object and must return a Boolean value."," * If a `false` value is returned, the file in question is not added to the"," * list of files to be uploaded."," * Use this function to put limits on file sizes or check the file names for"," * correct extension, but make sure that a server-side check is also performed,"," * since any client-side restrictions are only advisory and can be circumvented."," *"," * @attribute fileFilterFunction"," * @type {Function}"," * @default null"," */"," fileFilterFunction: {"," value: null"," },",""," /**"," * A String specifying what should be the POST field name for the file"," * content in the upload request."," *"," * @attribute fileFieldName"," * @type {String}"," * @default Filedata"," */"," fileFieldName: {"," value: \"Filedata\" "," },",""," /**"," * The array of files to be uploaded. All elements in the array"," * must be instances of `Y.File` and be instantiated with an instance"," * of native JavaScript File() class."," *"," * @attribute fileList"," * @type {Array}"," * @default []"," */"," fileList: {"," value: [],"," getter: \"_getFileList\","," setter: \"_setFileList\""," },",""," /**"," * A Boolean indicating whether multiple file selection is enabled."," *"," * @attribute multipleFiles"," * @type {Boolean}"," * @default false"," */"," multipleFiles: {"," value: false"," },",""," /**"," * An object, keyed by `fileId`, containing sets of key-value pairs"," * that should be passed as POST variables along with each corresponding"," * file. This attribute is only used if no POST variables are specifed"," * in the upload method call."," *"," * @attribute postVarsPerFile"," * @type {Object}"," * @default {}"," */"," postVarsPerFile: {"," value: {}"," },",""," /**"," * The label for the \"Select Files\" widget. This is the value that replaces the"," * `{selectButtonLabel}` token in the `SELECT_FILES_BUTTON` template."," * "," * @attribute selectButtonLabel"," * @type {String}"," * @default \"Select Files\""," */"," selectButtonLabel: {"," value: \"Select Files\""," },",""," /**"," * The widget that serves as the \"Select Files control for the file uploader"," * "," *"," * @attribute selectFilesButton"," * @type {Node | Widget}"," * @default A standard HTML button with YUI CSS Button skin."," */"," selectFilesButton : {"," valueFn: function () {"," return Y.Node.create(substitute(Y.UploaderHTML5.SELECT_FILES_BUTTON, {selectButtonLabel: this.get(\"selectButtonLabel\"),"," tabIndex: this.get(\"tabIndex\")}));"," }"," },",""," /**"," * The number of files that can be uploaded"," * simultaneously if the automatic queue management"," * is used. This value can be in the range between 2"," * and 5."," *"," * @attribute simLimit"," * @type {Number}"," * @default 2"," */"," simLimit: {"," value: 2,"," validator: function (val, name) {"," return (val >= 1 && val <= 5);"," }"," },",""," /**"," * The URL to which file upload requested are POSTed. Only used if a different url is not passed to the upload method call."," *"," * @attribute uploadURL"," * @type {String}"," * @default \"\""," */"," uploadURL: {"," value: \"\""," },",""," /**"," * Additional HTTP headers that should be included"," * in the upload request."," *"," *"," * @attribute uploadHeaders"," * @type {Object}"," * @default {}"," */ "," uploadHeaders: {"," value: {}"," },",""," /**"," * A Boolean that specifies whether the file should be"," * uploaded with the appropriate user credentials for the"," * domain. "," *"," * @attribute withCredentials"," * @type {Boolean}"," * @default true"," */ "," withCredentials: {"," value: true"," },",""," /**"," * The number of times to try re-uploading a file that failed to upload before"," * cancelling its upload."," *"," * @attribute retryCount"," * @type {Number}"," * @default 3"," */ "," retryCount: {"," value: 3"," }"," }","});","","Y.UploaderHTML5.Queue = UploaderQueue;","","","","}, '@VERSION@', {\"requires\": [\"widget\", \"node-event-simulate\", \"substitute\", \"file-html5\", \"uploader-queue\"]});"];
_yuitest_coverage["build/uploader-html5/uploader-html5.js"].lines = {"1":0,"14":0,"25":0,"26":0,"31":0,"75":0,"76":0,"77":0,"78":0,"94":0,"102":0,"117":0,"138":0,"155":0,"172":0,"180":0,"199":0,"207":0,"215":0,"223":0,"231":0,"245":0,"249":0,"250":0,"251":0,"252":0,"263":0,"264":0,"265":0,"266":0,"267":0,"269":0,"270":0,"271":0,"272":0,"273":0,"274":0,"275":0,"277":0,"289":0,"290":0,"291":0,"292":0,"293":0,"294":0,"306":0,"308":0,"309":0,"310":0,"311":0,"312":0,"315":0,"317":0,"318":0,"319":0,"320":0,"321":0,"333":0,"345":0,"346":0,"348":0,"350":0,"351":0,"353":0,"354":0,"356":0,"357":0,"360":0,"364":0,"365":0,"366":0,"367":0,"368":0,"373":0,"374":0,"378":0,"379":0,"380":0,"382":0,"385":0,"386":0,"400":0,"401":0,"404":0,"416":0,"417":0,"420":0,"432":0,"433":0,"436":0,"449":0,"450":0,"451":0,"452":0,"454":0,"455":0,"456":0,"457":0,"458":0,"469":0,"479":0,"480":0,"494":0,"498":0,"499":0,"500":0,"501":0,"502":0,"507":0,"508":0,"512":0,"513":0,"515":0,"518":0,"521":0,"534":0,"536":0,"537":0,"539":0,"540":0,"542":0,"543":0,"545":0,"546":0,"548":0,"549":0,"550":0,"553":0,"554":0,"557":0,"558":0,"569":0,"570":0,"571":0,"586":0,"590":0,"592":0,"594":0,"595":0,"596":0,"597":0,"598":0,"600":0,"613":0,"626":0,"627":0,"630":0,"640":0,"641":0,"642":0,"643":0,"644":0,"645":0,"646":0,"647":0,"649":0,"651":0,"652":0,"653":0,"654":0,"763":0,"795":0,"906":0,"924":0,"979":0};
_yuitest_coverage["build/uploader-html5/uploader-html5.js"].functions = {"UploaderHTML5:25":0,"initializer:73":0,"renderUI:244":0,"(anonymous 2):274":0,"bindUI:261":0,"_rebindFileField:288":0,"_bindDropArea:305":0,"_bindSelectButton:332":0,"(anonymous 3):365":0,"(anonymous 4):373":0,"_ddEventHandler:343":0,"_setButtonClass:399":0,"_setMultipleFiles:415":0,"_setFileFilters:431":0,"_triggerEnabled:448":0,"_getFileList:468":0,"_setFileList:478":0,"(anonymous 5):499":0,"(anonymous 6):507":0,"_updateFileList:493":0,"_uploadEventHandler:532":0,"openFileSelectDialog:568":0,"upload:584":0,"uploadAll:612":0,"(anonymous 7):653":0,"uploadThese:625":0,"setter:762":0,"validator:794":0,"valueFn:905":0,"validator:923":0,"(anonymous 1):1":0};
_yuitest_coverage["build/uploader-html5/uploader-html5.js"].coveredLines = 165;
@@ -47,7 +47,7 @@ YUI.add('uploader-html5', function (Y, NAME) {
// Shorthands for the external modules
_yuitest_coverfunc("build/uploader-html5/uploader-html5.js", "(anonymous 1)", 1);
_yuitest_coverline("build/uploader-html5/uploader-html5.js", 14);
-var substitute = Y.substitute,
+var substitute = Y.Lang.sub,
UploaderQueue = Y.Uploader.Queue;
/**
View
2 build/uploader-html5/uploader-html5-debug.js
@@ -11,7 +11,7 @@ YUI.add('uploader-html5', function (Y, NAME) {
*/
// Shorthands for the external modules
-var substitute = Y.substitute,
+var substitute = Y.Lang.sub,
UploaderQueue = Y.Uploader.Queue;
/**
View
2 build/uploader-html5/uploader-html5-min.js
@@ -1 +1 @@
-YUI.add("uploader-html5",function(e,t){function i(e){i.superclass.constructor.apply(this,arguments)}var n=e.substitute,r=e.Uploader.Queue;e.UploaderHTML5=e.extend(i,e.Widget,{_fileInputField:null,_buttonBinding:null,queue:null,initializer:function(){this._fileInputField=null,this.queue=null,this._buttonBinding=null,this._fileList=[],this.publish("fileselect"),this.publish("uploadstart"),this.publish("fileuploadstart"),this.publish("uploadprogress"),this.publish("totaluploadprogress"),this.publish("uploadcomplete"),this.publish("alluploadscomplete"),this.publish("uploaderror"),this.publish("dragenter"),this.publish("dragover"),this.publish("dragleave"),this.publish("drop")},renderUI:function(){var t=this.get("boundingBox"),n=this.get("contentBox"),r=this.get("selectFilesButton");r.setStyles({width:"100%",height:"100%"}),n.append(r),this._fileInputField=e.Node.create(i.HTML5FILEFIELD_TEMPLATE),n.append(this._fileInputField)},bindUI:function(){this._bindSelectButton(),this._setMultipleFiles(),this._setFileFilters(),this._bindDropArea(),this._triggerEnabled(),this.after("multipleFilesChange",this._setMultipleFiles,this),this.after("fileFiltersChange",this._setFileFilters,this),this.after("enabledChange",this._triggerEnabled,this),this.after("selectFilesButtonChange",this._bindSelectButton,this),this.after("dragAndDropAreaChange",this._bindDropArea,this),this.after("tabIndexChange",function(e){this.get("selectFilesButton").set("tabIndex",this.get("tabIndex"))},this),this._fileInputField.on("change",this._updateFileList,this),this.get("selectFilesButton").set("tabIndex",this.get("tabIndex"))},_rebindFileField:function(){this._fileInputField.remove(!0),this._fileInputField=e.Node.create(i.HTML5FILEFIELD_TEMPLATE),this.get("contentBox").append(this._fileInputField),this._fileInputField.on("change",this._updateFileList,this),this._setMultipleFiles(),this._setFileFilters()},_bindDropArea:function(e){var t=e||{prevVal:null};t.prevVal!==null&&(t.prevVal.detach("drop",this._ddEventHandler),t.prevVal.detach("dragenter",this._ddEventHandler),t.prevVal.detach("dragover",this._ddEventHandler),t.prevVal.detach("dragleave",this._ddEventHandler));var n=this.get("dragAndDropArea");n!==null&&(n.on("drop",this._ddEventHandler,this),n.on("dragenter",this._ddEventHandler,this),n.on("dragover",this._ddEventHandler,this),n.on("dragleave",this._ddEventHandler,this))},_bindSelectButton:function(){this._buttonBinding=this.get("selectFilesButton").on("click",this.openFileSelectDialog,this)},_ddEventHandler:function(t){t.stopPropagation(),t.preventDefault();switch(t.type){case"dragenter":this.fire("dragenter");break;case"dragover":this.fire("dragover");break;case"dragleave":this.fire("dragleave");break;case"drop":var n=t._event.dataTransfer.files,r=[],i=this.get("fileFilterFunction");i?e.each(n,function(t){var n=new e.FileHTML5(t);i(n)&&r.push(n)}):e.each(n,function(t){r.push(new e.FileHTML5(t))});if(r.length>0){var s=this.get("fileList");this.set("fileList",this.get("appendNewFiles")?s.concat(r):r),this.fire("fileselect",{fileList:r})}this.fire("drop")}},_setButtonClass:function(e,t){t?this.get("selectFilesButton").addClass(this.get("buttonClassNames")[e]):this.get("selectFilesButton").removeClass(this.get("buttonClassNames")[e])},_setMultipleFiles:function(){this.get("multipleFiles")===!0?this._fileInputField.set("multiple","multiple"):this._fileInputField.set("multiple","")},_setFileFilters:function(){this.get("fileFilters").length>0?this._fileInputField.set("accept",this.get("fileFilters").join(",")):this._fileInputField.set("accept","")},_triggerEnabled:function(){this.get("enabled")&&this._buttonBinding===null?(this._bindSelectButton(),this._setButtonClass("disabled",!1),this.get("selectFilesButton").setAttribute("aria-disabled","false")):!this.get("enabled")&&this._buttonBinding&&(this._buttonBinding.detach(),this._buttonBinding=null,this._setButtonClass("disabled",!0),this.get("selectFilesButton").setAttribute("aria-disabled","true"))},_getFileList:function(e){return this._fileList.concat()},_setFileList:function(e){return this._fileList=e.concat(),this._fileList.concat()},_updateFileList:function(t){var n=t.target.getDOMNode().files,r=[],i=this.get("fileFilterFunction");i?e.each(n,function(t){var n=new e.FileHTML5(t);i(n)&&r.push(n)}):e.each(n,function(t){r.push(new e.FileHTML5(t))});if(r.length>0){var s=this.get("fileList");this.set("fileList",this.get("appendNewFiles")?s.concat(r):r),this.fire("fileselect",{fileList:r})}this._rebindFileField()},_uploadEventHandler:function(e){switch(e.type){case"file:uploadstart":this.fire("fileuploadstart",e);break;case"file:uploadprogress":this.fire("uploadprogress",e);break;case"uploaderqueue:totaluploadprogress":this.fire("totaluploadprogress",e);break;case"file:uploadcomplete":this.fire("uploadcomplete",e);break;case"uploaderqueue:alluploadscomplete":this.queue=null,this.fire("alluploadscomplete",e);break;case"file:uploaderror":case"uploaderqueue:uploaderror":this.fire("uploaderror",e);break;case"file:uploadcancel":case"uploaderqueue:uploadcancel":this.fire("uploadcancel",e)}},openFileSelectDialog:function(){var e=this._fileInputField.getDOMNode();e.click&&e.click()},upload:function(t,n,r){var i=n||this.get("uploadURL"),s=r||this.get("postVarsPerFile"),o=t.get("id");s=s.hasOwnProperty(o)?s[o]:s,t instanceof e.FileHTML5&&(t.on("uploadstart",this._uploadEventHandler,this),t.on("uploadprogress",this._uploadEventHandler,this),t.on("uploadcomplete",this._uploadEventHandler,this),t.on("uploaderror",this._uploadEventHandler,this),t.on("uploadcancel",this._uploadEventHandler,this),t.startUpload(i,s,this.get("fileFieldName")))},uploadAll:function(e,t){this.uploadThese(this.get("fileList"),e,t)},uploadThese:function(t,n,i){if(!this.queue){var s=n||this.get("uploadURL"),o=i||this.get("postVarsPerFile");this.queue=new r({simUploads:this.get("simLimit"),errorAction:this.get("errorAction"),fileFieldName:this.get("fileFieldName"),fileList:t,uploadURL:s,perFileParameters:o,retryCount:this.get("retryCount"),uploadHeaders:this.get("uploadHeaders"),withCredentials:this.get("withCredentials")}),this.queue.on("uploadstart",this._uploadEventHandler,this),this.queue.on("uploadprogress",this._uploadEventHandler,this),this.queue.on("totaluploadprogress",this._uploadEventHandler,this),this.queue.on("uploadcomplete",this._uploadEventHandler,this),this.queue.on("alluploadscomplete",this._uploadEventHandler,this),this.queue.on("uploadcancel",this._uploadEventHandler,this),this.queue.on("uploaderror",this._uploadEventHandler,this),this.queue.startUpload(),this.fire("uploadstart")}else this.queue._currentState===r.UPLOADING&&(this.queue.set("perFileParameters",this.get("postVarsPerFile")),e.each(t,function(e){this.queue.addToQueueBottom(e)},this))}},{HTML5FILEFIELD_TEMPLATE:"<input type='file' style='visibility:hidden; width:0px; height: 0px;'>",SELECT_FILES_BUTTON:"<button type='button' class='yui3-button' role='button' aria-label='{selectButtonLabel}' tabindex='{tabIndex}'>{selectButtonLabel}</button>",TYPE:"html5",NAME:"uploader",ATTRS:{appendNewFiles:{value:!0},buttonClassNames:{value:{hover:"yui3-button-hover",active:"yui3-button-active",disabled:"yui3-button-disabled",focus:"yui3-button-selected"}},dragAndDropArea:{value:null,setter:function(t){return e.one(t)}},enabled:{value:!0},errorAction:{value:"continue",validator:function(e,t){return e===r.CONTINUE||e===r.STOP||e===r.RESTART_ASAP||e===r.RESTART_AFTER}},fileFilters:{value:[]},fileFilterFunction:{value:null},fileFieldName:{value:"Filedata"},fileList:{value:[],getter:"_getFileList",setter:"_setFileList"},multipleFiles:{value:!1},postVarsPerFile:{value:{}},selectButtonLabel:{value:"Select Files"},selectFilesButton:{valueFn:function(){return e.Node.create(n(e.UploaderHTML5.SELECT_FILES_BUTTON,{selectButtonLabel:this.get("selectButtonLabel"),tabIndex:this.get("tabIndex")}))}},simLimit:{value:2,validator:function(e,t){return e>=1&&e<=5}},uploadURL:{value:""},uploadHeaders:{value:{}},withCredentials:{value:!0},retryCount:{value:3}}}),e.UploaderHTML5.Queue=r},"@VERSION@",{requires:["widget","node-event-simulate","substitute","file-html5","uploader-queue"]});
+YUI.add("uploader-html5",function(e,t){function i(e){i.superclass.constructor.apply(this,arguments)}var n=e.Lang.sub,r=e.Uploader.Queue;e.UploaderHTML5=e.extend(i,e.Widget,{_fileInputField:null,_buttonBinding:null,queue:null,initializer:function(){this._fileInputField=null,this.queue=null,this._buttonBinding=null,this._fileList=[],this.publish("fileselect"),this.publish("uploadstart"),this.publish("fileuploadstart"),this.publish("uploadprogress"),this.publish("totaluploadprogress"),this.publish("uploadcomplete"),this.publish("alluploadscomplete"),this.publish("uploaderror"),this.publish("dragenter"),this.publish("dragover"),this.publish("dragleave"),this.publish("drop")},renderUI:function(){var t=this.get("boundingBox"),n=this.get("contentBox"),r=this.get("selectFilesButton");r.setStyles({width:"100%",height:"100%"}),n.append(r),this._fileInputField=e.Node.create(i.HTML5FILEFIELD_TEMPLATE),n.append(this._fileInputField)},bindUI:function(){this._bindSelectButton(),this._setMultipleFiles(),this._setFileFilters(),this._bindDropArea(),this._triggerEnabled(),this.after("multipleFilesChange",this._setMultipleFiles,this),this.after("fileFiltersChange",this._setFileFilters,this),this.after("enabledChange",this._triggerEnabled,this),this.after("selectFilesButtonChange",this._bindSelectButton,this),this.after("dragAndDropAreaChange",this._bindDropArea,this),this.after("tabIndexChange",function(e){this.get("selectFilesButton").set("tabIndex",this.get("tabIndex"))},this),this._fileInputField.on("change",this._updateFileList,this),this.get("selectFilesButton").set("tabIndex",this.get("tabIndex"))},_rebindFileField:function(){this._fileInputField.remove(!0),this._fileInputField=e.Node.create(i.HTML5FILEFIELD_TEMPLATE),this.get("contentBox").append(this._fileInputField),this._fileInputField.on("change",this._updateFileList,this),this._setMultipleFiles(),this._setFileFilters()},_bindDropArea:function(e){var t=e||{prevVal:null};t.prevVal!==null&&(t.prevVal.detach("drop",this._ddEventHandler),t.prevVal.detach("dragenter",this._ddEventHandler),t.prevVal.detach("dragover",this._ddEventHandler),t.prevVal.detach("dragleave",this._ddEventHandler));var n=this.get("dragAndDropArea");n!==null&&(n.on("drop",this._ddEventHandler,this),n.on("dragenter",this._ddEventHandler,this),n.on("dragover",this._ddEventHandler,this),n.on("dragleave",this._ddEventHandler,this))},_bindSelectButton:function(){this._buttonBinding=this.get("selectFilesButton").on("click",this.openFileSelectDialog,this)},_ddEventHandler:function(t){t.stopPropagation(),t.preventDefault();switch(t.type){case"dragenter":this.fire("dragenter");break;case"dragover":this.fire("dragover");break;case"dragleave":this.fire("dragleave");break;case"drop":var n=t._event.dataTransfer.files,r=[],i=this.get("fileFilterFunction");i?e.each(n,function(t){var n=new e.FileHTML5(t);i(n)&&r.push(n)}):e.each(n,function(t){r.push(new e.FileHTML5(t))});if(r.length>0){var s=this.get("fileList");this.set("fileList",this.get("appendNewFiles")?s.concat(r):r),this.fire("fileselect",{fileList:r})}this.fire("drop")}},_setButtonClass:function(e,t){t?this.get("selectFilesButton").addClass(this.get("buttonClassNames")[e]):this.get("selectFilesButton").removeClass(this.get("buttonClassNames")[e])},_setMultipleFiles:function(){this.get("multipleFiles")===!0?this._fileInputField.set("multiple","multiple"):this._fileInputField.set("multiple","")},_setFileFilters:function(){this.get("fileFilters").length>0?this._fileInputField.set("accept",this.get("fileFilters").join(",")):this._fileInputField.set("accept","")},_triggerEnabled:function(){this.get("enabled")&&this._buttonBinding===null?(this._bindSelectButton(),this._setButtonClass("disabled",!1),this.get("selectFilesButton").setAttribute("aria-disabled","false")):!this.get("enabled")&&this._buttonBinding&&(this._buttonBinding.detach(),this._buttonBinding=null,this._setButtonClass("disabled",!0),this.get("selectFilesButton").setAttribute("aria-disabled","true"))},_getFileList:function(e){return this._fileList.concat()},_setFileList:function(e){return this._fileList=e.concat(),this._fileList.concat()},_updateFileList:function(t){var n=t.target.getDOMNode().files,r=[],i=this.get("fileFilterFunction");i?e.each(n,function(t){var n=new e.FileHTML5(t);i(n)&&r.push(n)}):e.each(n,function(t){r.push(new e.FileHTML5(t))});if(r.length>0){var s=this.get("fileList");this.set("fileList",this.get("appendNewFiles")?s.concat(r):r),this.fire("fileselect",{fileList:r})}this._rebindFileField()},_uploadEventHandler:function(e){switch(e.type){case"file:uploadstart":this.fire("fileuploadstart",e);break;case"file:uploadprogress":this.fire("uploadprogress",e);break;case"uploaderqueue:totaluploadprogress":this.fire("totaluploadprogress",e);break;case"file:uploadcomplete":this.fire("uploadcomplete",e);break;case"uploaderqueue:alluploadscomplete":this.queue=null,this.fire("alluploadscomplete",e);break;case"file:uploaderror":case"uploaderqueue:uploaderror":this.fire("uploaderror",e);break;case"file:uploadcancel":case"uploaderqueue:uploadcancel":this.fire("uploadcancel",e)}},openFileSelectDialog:function(){var e=this._fileInputField.getDOMNode();e.click&&e.click()},upload:function(t,n,r){var i=n||this.get("uploadURL"),s=r||this.get("postVarsPerFile"),o=t.get("id");s=s.hasOwnProperty(o)?s[o]:s,t instanceof e.FileHTML5&&(t.on("uploadstart",this._uploadEventHandler,this),t.on("uploadprogress",this._uploadEventHandler,this),t.on("uploadcomplete",this._uploadEventHandler,this),t.on("uploaderror",this._uploadEventHandler,this),t.on("uploadcancel",this._uploadEventHandler,this),t.startUpload(i,s,this.get("fileFieldName")))},uploadAll:function(e,t){this.uploadThese(this.get("fileList"),e,t)},uploadThese:function(t,n,i){if(!this.queue){var s=n||this.get("uploadURL"),o=i||this.get("postVarsPerFile");this.queue=new r({simUploads:this.get("simLimit"),errorAction:this.get("errorAction"),fileFieldName:this.get("fileFieldName"),fileList:t,uploadURL:s,perFileParameters:o,retryCount:this.get("retryCount"),uploadHeaders:this.get("uploadHeaders"),withCredentials:this.get("withCredentials")}),this.queue.on("uploadstart",this._uploadEventHandler,this),this.queue.on("uploadprogress",this._uploadEventHandler,this),this.queue.on("totaluploadprogress",this._uploadEventHandler,this),this.queue.on("uploadcomplete",this._uploadEventHandler,this),this.queue.on("alluploadscomplete",this._uploadEventHandler,this),this.queue.on("uploadcancel",this._uploadEventHandler,this),this.queue.on("uploaderror",this._uploadEventHandler,this),this.queue.startUpload(),this.fire("uploadstart")}else this.queue._currentState===r.UPLOADING&&(this.queue.set("perFileParameters",this.get("postVarsPerFile")),e.each(t,function(e){this.queue.addToQueueBottom(e)},this))}},{HTML5FILEFIELD_TEMPLATE:"<input type='file' style='visibility:hidden; width:0px; height: 0px;'>",SELECT_FILES_BUTTON:"<button type='button' class='yui3-button' role='button' aria-label='{selectButtonLabel}' tabindex='{tabIndex}'>{selectButtonLabel}</button>",TYPE:"html5",NAME:"uploader",ATTRS:{appendNewFiles:{value:!0},buttonClassNames:{value:{hover:"yui3-button-hover",active:"yui3-button-active",disabled:"yui3-button-disabled",focus:"yui3-button-selected"}},dragAndDropArea:{value:null,setter:function(t){return e.one(t)}},enabled:{value:!0},errorAction:{value:"continue",validator:function(e,t){return e===r.CONTINUE||e===r.STOP||e===r.RESTART_ASAP||e===r.RESTART_AFTER}},fileFilters:{value:[]},fileFilterFunction:{value:null},fileFieldName:{value:"Filedata"},fileList:{value:[],getter:"_getFileList",setter:"_setFileList"},multipleFiles:{value:!1},postVarsPerFile:{value:{}},selectButtonLabel:{value:"Select Files"},selectFilesButton:{valueFn:function(){return e.Node.create(n(e.UploaderHTML5.SELECT_FILES_BUTTON,{selectButtonLabel:this.get("selectButtonLabel"),tabIndex:this.get("tabIndex")}))}},simLimit:{value:2,validator:function(e,t){return e>=1&&e<=5}},uploadURL:{value:""},uploadHeaders:{value:{}},withCredentials:{value:!0},retryCount:{value:3}}}),e.UploaderHTML5.Queue=r},"@VERSION@",{requires:["widget","node-event-simulate","substitute","file-html5","uploader-queue"]});
View
2 build/uploader-html5/uploader-html5.js
@@ -11,7 +11,7 @@ YUI.add('uploader-html5', function (Y, NAME) {
*/
// Shorthands for the external modules
-var substitute = Y.substitute,
+var substitute = Y.Lang.sub,
UploaderQueue = Y.Uploader.Queue;
/**

0 comments on commit 95c7f18

Please sign in to comment.