Finished drag'n'drop upload (issue #2403)
authorChristos Stathis <chstath@ebs.gr>
Mon, 21 May 2012 10:44:40 +0000 (13:44 +0300)
committerChristos Stathis <chstath@ebs.gr>
Mon, 21 May 2012 10:44:40 +0000 (13:44 +0300)
src/gr/grnet/pithos/web/client/FileUploadDialog.java
src/gr/grnet/pithos/web/client/Pithos.css
src/gr/grnet/pithos/web/client/Pithos.java
src/gr/grnet/pithos/web/client/UploadAlert.java

index ba778d6..052ce30 100644 (file)
@@ -210,7 +210,8 @@ public class FileUploadDialog extends DialogBox {
                                                dlg.@gr.grnet.pithos.web.client.FileUploadDialog::setInProgress(Z)(true);
                                                up.start();
                                                app.@gr.grnet.pithos.web.client.Pithos::showUploadIndicator()();
-                                               app.@gr.grnet.pithos.web.client.Pithos::showUploadAlert(I)(files.length);
+                                               if (!dlg.@gr.grnet.pithos.web.client.FileUploadDialog::isVisible()())
+                                                       app.@gr.grnet.pithos.web.client.Pithos::showUploadAlert(I)(files.length);
                                        },
                                        
                                        FilesRemoved: function(up, files) {
@@ -226,6 +227,11 @@ public class FileUploadDialog extends DialogBox {
                                                up.settings.url = file.url + + "?X-Auth-Token=" + encodeURIComponent(token);
                                        },
                                        
+                                       UploadProgress: function(up, file) {
+                                               $wnd.$('#upload_alert_progress_bar').css('width', up.total.percent + '%');
+                                               $wnd.$('#upload_alert_percent').html(up.total.percent + '%');
+                                       },
+                                       
                                        FileUploaded: function(up, file, response) {
                                                if ($wnd.console && $wnd.console.log) {
                                                        $wnd.console.log('File ' + file.name + ' uploaded');
index 3fb0478..391e198 100644 (file)
        right: 1px;
        top: 2px;
 }
+
+.uploadAlertProgress {
+       display: block;
+       float: left;    
+}
+
+.uploadAlertPercent {
+       position: absolute;
+       left: 90px;
+}
\ No newline at end of file
index cf14f1b..3013491 100644 (file)
@@ -135,6 +135,10 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
                String uploadAlertLink();
 
+               String uploadAlertProgress();
+               
+               String uploadAlertPercent();
+               
                String uploadAlertClose();
        }
        
index 5cffa45..bd4b9b6 100644 (file)
@@ -79,6 +79,24 @@ public class UploadAlert extends PopupPanel {
                });
                close.addStyleName(Pithos.resources.pithosCss().uploadAlertClose());
                content.add(close);
+               
+               FlowPanel progress = new FlowPanel();
+               progress.addStyleName("plupload_progress");
+               progress.addStyleName(Pithos.resources.pithosCss().uploadAlertProgress());
+               FlowPanel progress_container = new FlowPanel();
+               progress_container.addStyleName("plupload_progress_container");
+               progress.add(progress_container);
+               FlowPanel progress_bar = new FlowPanel();
+               progress_bar.getElement().setId("upload_alert_progress_bar");
+               progress_bar.addStyleName("plupload_progress_bar");
+               progress_container.add(progress_bar);
+               content.add(progress);
+
+               HTML percent = new HTML();
+               percent.getElement().setId("upload_alert_percent");
+               percent.addStyleName(Pithos.resources.pithosCss().uploadAlertPercent());
+               content.add(percent);
+               
                add(content);
        }
 }