gridftp ui: limit archive functionality only to moss
[qcg-portal.git] / qcg / templates / qcg / gridftp.html
index 0b0d55a..6bf6a5d 100644 (file)
@@ -54,8 +54,6 @@
 
             function conflictingName(name, modal) {
                 if (filex.files.some(function(item) { return item.get('name') == name })) {
-                    modal.find('.alert').remove();
-
                     $('<div>', {
                         'class': 'alert alert-danger',
                         html: '<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> Plik o podanej już nazwie istnieje!'
@@ -72,9 +70,9 @@
 
                 $('#btn-rename').toggleClass('disabled', selected != 1);
                 $('#btn-delete').toggleClass('disabled', selected == 0);
-                $('#btn-compress').toggleClass('disabled', selected == 0);
+                $('#btn-compress').toggleClass('disabled', filex.host != 'moss.man.poznan.pl' || selected == 0);
 
-                if (selected == 1) {
+                if (filex.host == 'moss.man.poznan.pl' && selected == 1) {
                     var filename = filex.selectedFiles()[0].get('name'),
                         is_archive = _.some(['.zip', '.tar.gz', '.tgz', '.tar.bz2', 'tbz'], function(ext) {
                             return filename.endsWith(ext);
                 }
             });
 
+            $('form').on('show.bs.modal', function() {
+                $(this).find('.alert').remove();
+                this.reset();
+            }).on('shown.bs.modal', function() {
+                $(this).find('input[type="text"]')[0].focus();
+            });
+
             $('#btn-upload').on('click', function() {
                 var url = '{% url 'gridftp_upload' %}?' + $.param({host: filex.host, path: filex.path.full()});