Author: andrei_exadel
Date: 2008-03-18 10:11:28 -0400 (Tue, 18 Mar 2008)
New Revision: 6905
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
RF-2478
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
---
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-18
13:57:11 UTC (rev 6904)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-18
14:11:28 UTC (rev 6905)
@@ -410,6 +410,7 @@
this.checkFrame();
this.initFileEntryWidth();
this.initLabels(labels);
+ this.element.onload = function () {this.initFileInput();}.bind(this);
this.initFileInput();
},
@@ -424,8 +425,16 @@
initFileInput: function () {
var o = this.currentInput.parentNode;
var p = o.parentNode;
- o.style.width = p.clientWidth;
- o.style.height = p.clientHeight;
+ p = $(p);
+ if (p.getWidth() != 0) {
+ o.style.width = p.getWidth() + "px";
+ o.style.height = p.getHeight() + "px";
+ p.onclick = null;
+ }else {
+ o.style.width = "30px";
+ o.style.height = "10px";
+ p.onclick = function () {this.initFileInput();}.bind(this);
+ }
},
initFileEntryWidth: function () {
@@ -446,11 +455,10 @@
createFrame: function () {
var div = document.createElement("div");
div.style.display = 'none';
- var child = "<iframe name='"+this.id+"'
id='"+this.id+"_iframe'></iframe>";
+ var child = "<iframe name='"+this.id+"_iframe'
id='"+this.id+"_iframe'></iframe>";
div.innerHTML = child;
document.body.appendChild(div);
var iframe = $(this.id + "_iframe");
-
this.iframe = iframe;
return iframe;
},
@@ -639,8 +647,8 @@
},
uploadAllDisabled: function () {
- if (this.runUpload && !this.options.autoUpload) {
- return false;
+ if (this.runUpload && this.activeEntry) {
+ return false;
} else {
var c = this.getFileEntriesSumByState(FileUploadEntry.READY,
FileUploadEntry.INITIALIZED, FileUploadEntry.UPLOAD_CANCELED);
return (c == 0);
@@ -827,7 +835,7 @@
newState == FileUploadEntry.UPLOAD_TRANSFER_ERROR ||
newState == FileUploadEntry.UPLOAD_SERVER_ERROR) {
-
+
this._endUpload();
this.runUpload = false;
@@ -882,7 +890,7 @@
parentForm.encoding = "multipart/form-data";
parentForm.enctype = "multipart/form-data";
- parentForm.target = this.id;
+ parentForm.target = this.id + "_iframe";//this.id;
parentForm.action = oldAction + (/\?/.test(oldAction) ?
'&_richfaces_upload_uid' : '?_richfaces_upload_uid') + '=' +
encodeURI(entry.uid);
try {
@@ -922,7 +930,6 @@
}.bind(this));
parentForm.submit();
- //this.uploading = true;
}
for (var i = 0; i < l; i++) {
Show replies by date