/*
iim.form.singleUploadDialog
create a dialog containing a form with single File Upload;
Name of file input is: 'UPLOAD'
requires url propertey taken from data-dojo-props="url:'xxx'"
Example:
*/
define([
"dojo/_base/declare",
"dijit/form/Form",
"dijit/Dialog",
"dijit/layout/ContentPane",
"dijit/form/Button",
"dijit/ProgressBar",
"dojo/dom-style"
], function(declare, form,dialog,ContentPane,But,ProgressBar,style){
return declare("vs.singleUploadDialog", But, {
label: 'Datei hochladen',
iconClass: 'dijitIconFile',
url: '',
onClick: function(evt){
if(this.url == '') {
console.error("missing property: url");
return false;
} else {
inputName = (this.inputName != undefined ? this.inputName : 'UPLOAD');
dl = new dialog({
title: 'Datei anhängen',
style:'width:300px'
});
url = sCgiBin + "?" + this.url + "&" + ID;
uploadForm = new form({action: url, encType:'multipart/form-data', method:'post'});
submitter = new But({
type:'submit',
label:'hochladen',
onClick: function() {
myProgressBar = new ProgressBar({
style: "width: 275px",
indeterminate:true,
label:'Datei wird hochgeladen'
});
style.set(contentBoxForm.domNode,'display','none');
dl.containerNode.appendChild(myProgressBar.domNode);
}
});
inputFile = new ContentPane({content: ''});
uploadForm.containerNode.appendChild(inputFile.domNode);
uploadForm.containerNode.appendChild(submitter.domNode);
contentBoxForm = new ContentPane({});
contentBoxForm.containerNode.appendChild(uploadForm.domNode);
dl.containerNode.appendChild(contentBoxForm.domNode);
dl.show();
}
}
});
});