File upload dialog.

This commit is contained in:
Michael Jumper
2013-10-15 12:39:43 -07:00
parent 3925eedc53
commit 76049fbc38
3 changed files with 92 additions and 2 deletions

View File

@@ -788,6 +788,78 @@ GuacUI.Download = function(filename) {
};
/**
* Interface object which displays the progress of a upload.
*
* @constructor
* @param {String} filename The name the file will have once complete.
*/
GuacUI.Upload = function(filename) {
/**
* Reference to this GuacUI.Upload.
* @private
*/
var guac_upload = this;
/**
* The outer div representing the notification.
* @private
*/
var element = GuacUI.createElement("div", "upload notification");
/**
* Title bar describing the notification.
* @private
*/
var title = GuacUI.createChildElement(element, "div", "title-bar");
/**
* Close button for removing the notification.
* @private
*/
var close_button = GuacUI.createChildElement(title, "div", "close");
close_button.onclick = function() {
if (guac_upload.onclose)
guac_upload.onclose();
};
GuacUI.createChildElement(title, "div", "title").textContent =
"File Transfer";
GuacUI.createChildElement(element, "div", "caption").textContent =
filename + " ";
/**
* Progress bar and status.
* @private
*/
var progress = GuacUI.createChildElement(element, "div", "progress");
/**
* Updates the content of the progress indicator with the given text.
*
* @param {String} text The text to assign to the progress indicator.
*/
this.updateProgress = function(text) {
progress.textContent = text;
};
/**
* Returns the element representing this notification.
*/
this.getElement = function() {
return element;
};
/**
* Called when the close button of this notification is clicked.
* @event
*/
this.onclose = null;
};
/**
* A grouping component. Child elements can be added via the addElement()
* function. By default, groups display as collapsed.