From 3e071f5b841904adf72ce66eab3e1be1558c35df Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 3 Nov 2013 18:52:45 +0100 Subject: Ported TActiveFileUpload --- framework/Web/Javascripts/packages.php | 2 +- .../prado/activefileupload/activefileupload.js | 54 +++++++++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/framework/Web/Javascripts/packages.php b/framework/Web/Javascripts/packages.php index 185d12b9..6f962760 100644 --- a/framework/Web/Javascripts/packages.php +++ b/framework/Web/Javascripts/packages.php @@ -113,6 +113,7 @@ $dependencies = array( 'tabpanel' => array('jquery', 'prado', 'tabpanel'), 'ajax' => array('jquery', 'prado', 'ajax'), 'logger' => array('jquery', 'prado', 'logger'), + 'activefileupload' => array('jquery', 'prado', 'ajax', 'activefileupload'), 'effects' => array('prototype', 'prado', 'effects'), 'datepicker' => array('prototype', 'prado', 'datepicker'), @@ -121,7 +122,6 @@ $dependencies = array( 'slider' => array('prototype', 'prado', 'slider'), 'keyboard' => array('prototype', 'prado', 'keyboard'), 'activedatepicker' => array('prototype', 'prado', 'datepicker', 'ajax', 'activedatepicker'), - 'activefileupload' => array('prototype', 'prado', 'effects', 'ajax', 'activefileupload'), 'dragdropextra' => array('prototype', 'prado', 'effects', 'ajax', 'dragdrop','dragdropextra'), 'accordion' => array('prototype', 'prado', 'effects', 'accordion'), 'htmlarea' => array('prototype', 'prado', 'htmlarea'), diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js index 388bc7b0..29c9e3d4 100755 --- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js +++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js @@ -5,13 +5,13 @@ Prado.WebUI.TActiveFileUpload = jQuery.klass(Prado.WebUI.Control, this.options = options || {}; Prado.WebUI.TActiveFileUpload.register(this); - this.input = $(options.inputID); - this.flag = $(options.flagID); - this.form = $(options.formID); + this.input = $('#'+options.inputID).get(0); + this.flag = $('#'+options.flagID).get(0); + this.form = $('#'+options.formID).get(0); - this.indicator = $(options.indicatorID); - this.complete = $(options.completeID); - this.error = $(options.errorID); + this.indicator = $('#'+options.indicatorID).get(0); + this.complete = $('#'+options.completeID).get(0); + this.error = $('#'+options.errorID).get(0); // set up events if (options.autoPostBack){ @@ -47,21 +47,21 @@ Prado.WebUI.TActiveFileUpload = jQuery.klass(Prado.WebUI.Control, finishUpload : function(options){ if (this.options.targetID == options.targetID) - { - this.finishoptions = options; - var e = this; - var callback = - { - 'CallbackParameter' : options || '', - 'onSuccess' : function() { e.finishCallBack(true); }, - 'onFailure' : function() { e.finishCallBack(false); } - }; + { + this.finishoptions = options; + var e = this; + var callback = + { + 'CallbackParameter' : options || '', + 'onSuccess' : function() { e.finishCallBack(true); }, + 'onFailure' : function() { e.finishCallBack(false); } + }; - Object.extend(callback, this.options); + jQuery.extend(callback, this.options); - var request = new Prado.CallbackRequest(this.options.EventTarget, callback); - request.dispatch(); - } + var request = new Prado.CallbackRequest(this.options.EventTarget, callback); + request.dispatch(); + } else this.finishCallBack(true); @@ -71,18 +71,18 @@ Prado.WebUI.TActiveFileUpload = jQuery.klass(Prado.WebUI.Control, // hide the display indicator. this.flag.value = ''; this.indicator.style.display = 'none'; - // show the complete indicator. - if ((this.finishoptions.errorCode == 0) && (success)) { - this.complete.style.display = ''; - this.input.value = ''; - } else { - this.error.style.display = ''; - } + // show the complete indicator. + if ((this.finishoptions.errorCode == 0) && (success)) { + this.complete.style.display = ''; + this.input.value = ''; + } else { + this.error.style.display = ''; + } } }); -Object.extend(Prado.WebUI.TActiveFileUpload, +jQuery.extend(Prado.WebUI.TActiveFileUpload, { //class methods -- cgit v1.2.3