Class Index | File Index

Classes


Class Alfresco.DNDUpload

Extends Alfresco.component.Base
Drag and Drop Upload component.

Pops up a YUI panel and initiates the upload and progress monitoring of
the files providing in the calling arguments.

A multi file upload scenario could look like:

var dndUpload = Alfresco.component.getDNDUploadInstance();
var multiUploadConfig =
{
files: files,
destination: destination,
siteId: siteId,
containerId: doclibContainerId,
path: docLibUploadPath,
filter: [],
mode: flashUpload.MODE_MULTI_UPLOAD,
}
dndUpload.show(multiUploadConfig);
Defined in: dnd-upload.js
Constructor Summary
Constructor Attributes Constructor Name and Description
 
DNDUpload constructor.
Field Summary
Field Attributes Field Name and Description
 
Remembers what files that how been added to the file list since
 
HTMLElement of type div that displays the aggregate upload data that is
 
HTMLElement of type span that displays the aggregate upload progress
 
The current volume of data uploaded in the current operation.
 
The expected volume of data to be uploaded by all selected files.
 
The flash move will dispatch the contentReady event twice,
 
Used to display the user selceted files and keep track of what files
 
The default config for the gui state for the uploader.
 
HTMLElement of type textarea for version comment
 
HTMLElements of type div that is used to to display a column in a
 
Stores references and state for each file that is in the file list.
 
The client supports FormData upload.
 
The client requires in-memory upload.
 
HTMLElement of type radio button for major or minor version
 
Shows uploader in multi upload mode.
 
Shows uploader in single update mode.
 
Shows uploader in single upload mode.
 
The number of failed uploads since upload was clicked.
 
The number of successful uploads since upload was clicked.
 
Contains the upload gui
 
The merged result of the defaultShowConfig and the config passed in
 
The state of which the uploader currently is, where the flow is.
 
The user is browsing and adding files to the file list
 
File failed to upload.
 
All files are processed and have either failed or been successfully
 
File was successfully STATE_SUCCESS.
 
File(s) is being uploaded to the server
 
HTMLElement of type span that displays the total upload status
 
The config passed in to the show method.
 
HTMLElement of type span that displays the dialog title.
 
The method that will be used to perform file upload. This is determined via browser
 
HTMLElement of type div that displays the version input form.
Fields borrowed from class Alfresco.component.Base:
modules, options, services, widgets
Method Summary
Method Attributes Method Name and Description
 
Returns the maximum size of the sum of file sizes that be uploaded in a single operation. This
 
Fired when the user clicks the cancel/ok button.
 
Fired by YUI:s DataTable when the added row has been rendered to the data table list.
 
Fired by YUI when parent element is available for scripting.
 
Fired by YUI:s DataTable when a row has been added to the data table list.
 
recursiveUpload(i, max, scope)
A function that uploads a file, increments the file count and then recurses. Recursion is used instead of iteration
 
Sets maximum size of the sum of file sizes that be uploaded in a single operation. This
 
show(config)
Show can be called multiple times and will display the uploader dialog
Methods borrowed from class Alfresco.component.Base:
attachLinkClickListeners, bind, createYUIButtons, destroy, fire, invokeAction, msg, onComponentLoaded, onComponentsLoaded, onReadyWrapper, refresh, setMessages, setOptions
Constructor Detail
Alfresco.DNDUpload(htmlId)
DNDUpload constructor.

DNDUpload is considered a singleton so constructor should be treated as private,
please use Alfresco.component.getDNDUploadInstance() instead.
Parameters:
{String} htmlId
The HTML id of the parent element
Returns:
{Alfresco.component.DNDUpload} The new DNDUpload instance
Field Detail
{object} addedFiles
Remembers what files that how been added to the file list since
the show method was called.

{HTMLElement} aggregateDataWrapper
HTMLElement of type div that displays the aggregate upload data that is
is shown when uploads are in progress.

{HTMLElement} aggregateProgressText
HTMLElement of type span that displays the aggregate upload progress

{int} aggregateUploadCurrentSize
The current volume of data uploaded in the current operation.

{int} aggregateUploadTargetSize
The expected volume of data to be uploaded by all selected files.

{boolean} contentReady
The flash move will dispatch the contentReady event twice,
make sure we only react on it twice.

{YAHOO.widget.DataTable} dataTable
Used to display the user selceted files and keep track of what files
that are selected and should be STATE_FINISHED.

{object} defaultShowConfig
The default config for the gui state for the uploader.
The user can override these properties in the show() method to use the
uploader for both single & multi uploads and single updates.

{HTMLElement} description
HTMLElement of type textarea for version comment

{HTMLElement} fileItemTemplates
HTMLElements of type div that is used to to display a column in a
row in the file table list. It is loaded dynamically from the server
and then cloned for each row and column in the file list.
The fileItemTemplates has the following form:
{
left: HTMLElement to display the left column
center: HTMLElement to display the center column
right: HTMLElement to display the right column
}

{object Used as a hash table with fileId as key and an object literal as the value. The object literal is of the form: { contentType: {HTMLElement}, // select, hidden input or null (holds the chosen contentType for the file). fileButton: {YAHOO.widget.Button}, // Will be disabled on success or STATE_FAILURE state: {int}, // Keeps track if the individual file has been successfully uploaded or failed // (state flow: STATE_BROWSING > STATE_UPLOADING > STATE_SUCCESS or STATE_FAILURE) progress: {HTMLElement}, // span that is the "progress bar" which is moved during progress progressInfo: {HTMLElement}, // span that displays the filename and the state progressPercentage: {HTMLElement}, // span that displays the upload percentage for the individual file fileName: {string}, // filename nodeRef: {string} // nodeRef if the file has been uploaded successfully }} fileStore
Stores references and state for each file that is in the file list.
The fileId parameter from the YAHOO.widget.Uploader is used as the key
and the value is an object that stores the state and references.

{int} FORMDATA_UPLOAD
The client supports FormData upload.

{int} INMEMORY_UPLOAD
The client requires in-memory upload.

{HTMLElement} minorVersion
HTMLElement of type radio button for major or minor version

{int} MODE_MULTI_UPLOAD
Shows uploader in multi upload mode.

{int} MODE_SINGLE_UPDATE
Shows uploader in single update mode.

{int} MODE_SINGLE_UPLOAD
Shows uploader in single upload mode.

{int} noOfFailedUploads
The number of failed uploads since upload was clicked.

{int} noOfSuccessfulUploads
The number of successful uploads since upload was clicked.

{YAHOO.widget.Dialog} panel
Contains the upload gui

{object} showConfig
The merged result of the defaultShowConfig and the config passed in
to the show method.

{int} state
The state of which the uploader currently is, where the flow is.
STATE_BROWSING > STATE_UPLOADING > STATE_FINISHED

{int} STATE_BROWSING
The user is browsing and adding files to the file list

{int} STATE_FAILURE
File failed to upload.

{int} STATE_FINISHED
All files are processed and have either failed or been successfully
uploaded to the server.

{int} STATE_SUCCESS
File was successfully STATE_SUCCESS.

{int} STATE_UPLOADING
File(s) is being uploaded to the server

{HTMLElement} statusText
HTMLElement of type span that displays the total upload status

{object} suppliedConfig
The config passed in to the show method.

{HTMLElement} titleText
HTMLElement of type span that displays the dialog title.

{int} uploadMethod
The method that will be used to perform file upload. This is determined via browser
feature detection and is set during singleton instantiation.

{HTMLElement} versionSection
HTMLElement of type div that displays the version input form.
Method Detail
getInMemoryLimit(limit)
Returns the maximum size of the sum of file sizes that be uploaded in a single operation. This
limit only affects browsers operating in INMEMORY_UPLOAD mode.
Parameters:
limit

onCancelOkButtonClick(event)
Fired when the user clicks the cancel/ok button.
The action taken depends on what state the uploader is in.
In STATE_UPLOADING - Cancels current uploads,
informs the user about how many that were uploaded,
tells the documentlist to update itself
and closes the panel.
In STATE_FINISHED - Tells the documentlist to update itself
and closes the panel.
Parameters:
{object} event
a Button "click" event

onPostRenderEvent(e)
Fired by YUI:s DataTable when the added row has been rendered to the data table list.
Parameters:
e

onReady()
Fired by YUI when parent element is available for scripting.
Initial History Manager event registration

onRowAddEvent(event)
Fired by YUI:s DataTable when a row has been added to the data table list.
This retrieves the previously stored file information (which includes
prepared XMLHttpRequest and FormData objects) and initiates the file
upload.
Parameters:
{object} event
a DataTable "rowAdd" event

recursiveUpload(i, max, scope)
A function that uploads a file, increments the file count and then recurses. Recursion is used instead of iteration
because the progress events do not contain enough information to link them back to the file they relate. The alternative
to recursion is to assign custom data to the XMLHttpRequest.upload object but the FireFox browser can randomly lose
this data and stall the upload. Using recursion ensures that the "fileId" variable is set correctly as the event listener
functions will only find the correct value in their immediate closure (using iteration it will always end up as the
last value)
Parameters:
i
The index in the file to upload
max
The count of files to upload (recursion stops when i is no longer less than max)
scope
Should be set to the widget scope (i.e. this).

setInMemoryLimit(limit)
Sets maximum size of the sum of file sizes that be uploaded in a single operation. This
limit only affects browsers operating in INMEMORY_UPLOAD mode.
Parameters:
limit

show(config)
Show can be called multiple times and will display the uploader dialog
in different ways depending on the config parameter.
Parameters:
{object} config
describes how the upload dialog should be displayed
The config object is in the form of:
{
siteId: {string}, // site to upload file(s) to
containerId: {string}, // container to upload file(s) to (i.e. a doclib id)
destination: {string}, // destination nodeRef to upload to if not using site & container
uploadPath: {string}, // directory path inside the component to where the uploaded file(s) should be save
updateNodeRef: {string}, // nodeRef to the document that should be updated
updateFilename: {string},// The name of the file that should be updated, used to display the tip
mode: {int}, // MODE_SINGLE_UPLOAD, MODE_MULTI_UPLOAD or MODE_SINGLE_UPDATE
filter: {array}, // limits what kind of files the user can select in the OS file selector
onFileUploadComplete: null, // Callback after upload
overwrite: false // If true and in mode MODE_XXX_UPLOAD it tells
// the backend to overwrite a versionable file with the existing name
// If false and in mode MODE_XXX_UPLOAD it tells
// the backend to append a number to the versionable filename to avoid
// an overwrite and a new version
}

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Feb 16 2012 12:24:25 GMT-0000 (GMT)