X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Forg.argeo.slc.ria%2Fsrc%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2Fmonitor%2FUploadView.js;h=a6bb544be8eed7d4c163815b0d793e926dedba02;hb=6c6a8fbd377d35149e1a6cdde8d36ea752f3a58c;hp=f54ba16ccd1d26932ef4b66695c1a4149cc49545;hpb=c2e177905e07ce5c72a089f670cb6fde054232bc;p=gpl%2Fargeo-slc.git diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/UploadView.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/UploadView.js index f54ba16cc..a6bb544be 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/UploadView.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/UploadView.js @@ -23,7 +23,7 @@ qx.Class.define("org.argeo.slc.ria.monitor.UploadView", { construct : function(){ this.base(arguments); - this.setLayout(new qx.ui.layout.Dock()); + this.setLayout(new qx.ui.layout.Basic); }, members : { @@ -38,20 +38,59 @@ qx.Class.define("org.argeo.slc.ria.monitor.UploadView", { init : function(viewPane, data){ this.setView(viewPane); this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId())); - this.label = new qx.ui.basic.Label("Upoad"); - this.add(this.label, {edge : "center"}); + this.form = new org.argeo.ria.components.upload.UploadForm("uploadFrm", org.argeo.slc.ria.SlcApi.getInstallModuleService()); + this.form.setLayout(new qx.ui.layout.HBox(5)); + this.fileWidget = new org.argeo.ria.components.upload.UploadField("uploadFile", "Choose a file"); + + this.form.addListener("completed", function(e){ + this.fileWidget.setFieldValue(""); + var response = this.form.getIframeHtmlContent(); + this.debug(response); + this.displayMessage(response, 4000); + }, this); + this.form.addListener("sending", function(e){ + this.debug("Sending..."); + this.displayMessage("Sending..."); + }, this); + this.fileWidget.addListener("changeFieldValue", function(e){ + if(e.getData()!=""){ + this.submitButton.setEnabled(true); + } + }, this); + + this.submitButton = new qx.ui.form.Button("Upload"); + this.submitButton.setEnabled(false); + this.submitButton.addListener("execute", function(e){ + if(this.fileWidget.getFieldValue()!=""){ + this.form.send(); + } + }, this); + + this.fileWidget.getTextField().setWidth(200); + this.form.add(this.fileWidget); + this.form.add(this.submitButton); + this.messageLabel = new qx.ui.basic.Label(""); + this.messageLabel.setRich(true); + this.messageLabel.setPadding(4,4,4,20); + this.form.add(this.messageLabel); + this.add(this.form, {left : 20, top:20}); + }, + + displayMessage : function(message, timer){ + this.messageLabel.setContent(""+qx.lang.String.stripTags(message)+""); + if(timer){ + qx.event.Timer.once(function(){ + this.messageLabel.setContent(""); + }, this, timer); + } }, /** * The implementation should contain the real data loading (i.o. query...) * @return {Boolean} */ - load : function(){ - + load : function(){ }, - updateData : function(node){ - this.label.setContent("Properties for : " + node.getLabel()); - }, /** * Whether this component is already contained in a scroller (return false) or not (return true). * @return {Boolean}