summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe.Boulain <>2009-04-14 11:27:19 +0000
committerChristophe.Boulain <>2009-04-14 11:27:19 +0000
commit37cd9aec35acd0cd03946fc6f26d7fe02c3c5d48 (patch)
treeac7ebf698fedfc5b0553b097ed8bf2d74dce1a0e
parentca080e5dc8ff461f63f2e22e83a3b3898642c5ba (diff)
Fixed Issue#135 - Add AutoPostBack property to TActiveFileUpload
-rw-r--r--HISTORY1
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/activefileupload.js136
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveFileUpload.php28
3 files changed, 98 insertions, 67 deletions
diff --git a/HISTORY b/HISTORY
index fe699f42..58774564 100644
--- a/HISTORY
+++ b/HISTORY
@@ -16,6 +16,7 @@ BUG: Issue#130 - TDbLogRoute::processLogs wrong values binding (Christophe)
BUG: Issue#136 - TActiveDatePicker don't callback when ShowCalendar is false (Christophe)
CHG: Issue#7 - Clients Scripts are not combined anymore in Debug application mode (Christophe)
ENH: Issue#115 - Registry for Prado generated clientside counterparts of serverside controls (Yves Berkholz)
+ENH: Issue#135 - Add AutoPostBack property to TActiveFileUpload (Bradley)
ENH: Added caching of message files to TException (Michael)
ENH: Updated to scriptaculous 1.8.2 & Prototype 1.6.0.3
ENH: replace is_null() function calls with native language constuct (Yves)
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
index faaab19a..7a1e0e77 100755
--- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
+++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
@@ -1,65 +1,71 @@
-Prado.WebUI.TActiveFileUpload = Base.extend(
-{
- constructor : function(options)
- {
- this.options = options || {};
- Prado.WebUI.TActiveFileUpload.register(this);
-
- this.input = $(options.inputID);
- this.flag = $(options.flagID);
- this.form = $(options.formID);
-
- this.indicator = $(options.indicatorID);
- this.complete = $(options.completeID);
- this.error = $(options.errorID);
-
- Prado.Registry.set(options.inputID, this);
-
- // set up events
- Event.observe(this.input,"change",this.fileChanged.bind(this));
- },
-
- fileChanged:function(){
- // show the upload indicator, and hide the complete and error indicators (if they areSn't already).
- this.flag.value = '1';
- this.complete.style.display = 'none';
- this.error.style.display = 'none';
- this.indicator.style.display = '';
-
- // set the form to submit in the iframe, submit it, and then reset it.
- this.oldtargetID = this.form.target;
- this.form.target = this.options.targetID;
- this.form.submit();
- this.form.target = this.oldtargetID;
- },
-
- finishUpload:function(options){
- // hide the display indicator.
- this.flag.value = '';
- this.indicator.style.display = 'none';
- if (this.options.targetID == options.targetID){
- // show the complete indicator.
- if (options.errorCode == 0){
- this.complete.style.display = '';
- this.input.value = '';
- } else {
- this.error.style.display = '';
- }
- Prado.Callback(this.options.EventTarget, options, null, this.options);
- }
- }
-},
-{
-// class methods
- controls : {},
-
- register : function(control)
- {
- Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control;
- },
-
- onFileUpload: function(options)
- {
- Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options);
- }
-});
+Prado.WebUI.TActiveFileUpload = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = options || {};
+ Prado.WebUI.TActiveFileUpload.register(this);
+
+ this.input = $(options.inputID);
+ this.flag = $(options.flagID);
+ this.form = $(options.formID);
+
+ this.indicator = $(options.indicatorID);
+ this.complete = $(options.completeID);
+ this.error = $(options.errorID);
+
+ Prado.Registry.set(options.inputID, this);
+
+ // set up events
+ if (options.autoPostBack){
+ Event.observe(this.input,"change",this.fileChanged.bind(this));
+ }
+ },
+
+ fileChanged : function(){
+ // show the upload indicator, and hide the complete and error indicators (if they areSn't already).
+ this.flag.value = '1';
+ this.complete.style.display = 'none';
+ this.error.style.display = 'none';
+ this.indicator.style.display = '';
+
+ // set the form to submit in the iframe, submit it, and then reset it.
+ this.oldtargetID = this.form.target;
+ this.form.target = this.options.targetID;
+ this.form.submit();
+ this.form.target = this.oldtargetID;
+ },
+
+ finishUpload : function(options){
+ // hide the display indicator.
+ this.flag.value = '';
+ this.indicator.style.display = 'none';
+ if (this.options.targetID == options.targetID){
+ // show the complete indicator.
+ if (options.errorCode == 0){
+ this.complete.style.display = '';
+ this.input.value = '';
+ } else {
+ this.error.style.display = '';
+ }
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ }
+ }
+},
+{
+// class methods
+ controls : {},
+
+ register : function(control)
+ {
+ Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control;
+ },
+
+ onFileUpload : function(options)
+ {
+ Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options);
+ },
+
+ fileChanged : function(controlID){
+ Prado.WebUI.TActiveFileUpload.controls[controlID].fileChanged();
+ }
+});
diff --git a/framework/Web/UI/ActiveControls/TActiveFileUpload.php b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
index a0a066f7..b935936b 100755
--- a/framework/Web/UI/ActiveControls/TActiveFileUpload.php
+++ b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
@@ -133,7 +133,30 @@ EOS;
* default "Application.runtime.*"
*/
public function setTempPath($value){
- $this->setViewState('TempNamespace',$value,'Application.runtime.*');
+ $this->setViewState('TempPath',$value,'Application.runtime.*');
+ }
+
+ /**
+ * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
+ * Note: When set to false, you will need to trigger the callback yourself.
+ */
+ public function getAutoPostBack(){
+ return $this->getViewState('AutoPostBack', true);
+ }
+
+ /**
+ * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
+ * Note: When set to false, you will need to trigger the callback yourself.
+ */
+ public function setAutoPostBack($value){
+ $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true);
+ }
+
+ /**
+ * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false}
+ */
+ public function getCallbackJavascript(){
+ return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")";
}
/**
@@ -267,6 +290,7 @@ EOS;
$options['indicatorID'] = $this->_busy->getClientID();
$options['completeID'] = $this->_success->getClientID();
$options['errorID'] = $this->_error->getClientID();
+ $options['autoPostBack'] = $this->getAutoPostBack();
return $options;
}
@@ -313,4 +337,4 @@ EOS;
$this->ensureChildControls();
return $this->_busy;
}
-} \ No newline at end of file
+}