Author: dsvyatobatsko
Date: 2008-02-21 04:25:44 -0500 (Thu, 21 Feb 2008)
New Revision: 6230
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
maxFiles attribute is taken into consideration
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
---
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-21
09:25:35 UTC (rev 6229)
+++
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-21
09:25:44 UTC (rev 6230)
@@ -360,9 +360,9 @@
classes: null,
- maxFileBatchSize: 5,
+ maxFileBatchSize: null,
- initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label,
options) {
+ initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label,
maxFiles, options) {
this.id = id;
this.element = $(this.id);
//this.progressBarId = progressBarId;
@@ -379,6 +379,7 @@
this.iframe = $(this.id + "_iframe");
this.items = $(this.id + ":fileItems");
this.classes = classes;
+ this.maxFileBatchSize = maxFiles;
this.currentInput = $(this.id + ":file");
this.options = options || {};
@@ -438,7 +439,7 @@
entry.clear();
this.entries = this.entries.without(entry);
- //this.disableAddButton(this.entries.length > this.maxFileBatchSize);
+ //this.disableAddButton(this.maxFileBatchSize && this.entries.length >=
this.maxFileBatchSize);
},
_selectEntryForUpload: function() {
@@ -496,14 +497,14 @@
}
this.processButtons();
},
-
+
processButtons: function () {
- this.disableAddButton(this.entries.length > this.maxFileBatchSize);
+ this.disableAddButton(this.maxFileBatchSize && this.entries.length >=
this.maxFileBatchSize);
this.disableCleanButton(this.cleanAllDisabled());
this.disableUploadButton(this.uploadAllDisabled());
this.switchUploadButton();
},
-
+
cleanAllDisabled: function () {
var c = 0;
for (var i = 0; i < this.entries.length; i++) {
Modified: trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
---
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-21
09:25:35 UTC (rev 6229)
+++
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-21
09:25:44 UTC (rev 6230)
@@ -123,7 +123,7 @@
}
};
- new FileUpload('#{clientId}', #{this:getStopScript(context, component)},
#{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context,
component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)});
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)},
#{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context,
component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)},
'#{component.attributes["maxFiles"]}');
</script>
</span>