23 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7ee46fef21b7/ Changeset: 7ee46fef21b7 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 13:30:39+00:00 Summary: Adding select-all to ftpupload Affected #: 1 file diff -r a2308bdc93b897af974766b190abe019ade49e9a -r 7ee46fef21b796e355e4dcc995852345f2325879 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -49,6 +49,48 @@ // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); + // ADD THINGS HERE + // + $($('.upload-ftp')[0]).find('#selectAll').on('click', function(){ + var checkboxes=$(this).parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); + var len = checkboxes.length; + var allChecked; + $this = $(this); + // + if($this.hasClass("fa-square-o")){ + $this.removeClass("fa-square-o"); + $this.removeClass("fa-minus-square-o"); + $this.addClass("fa-check-square-o"); + allChecked=true; + } + else{ + $this.removeClass("fa-check-square-o"); + $this.removeClass("fa-minus-square-o"); + $this.addClass("fa-square-o"); + allChecked=false; + } + // + for(i = 0; i < len; i++){ + if(allChecked) + { + + checkboxes.eq(i).removeClass("fa-square-o"); + checkboxes.eq(i).addClass("fa-check-square-o"); + } + else{ + checkboxes.eq(i).removeClass("fa-check-square-o"); + checkboxes.eq(i).addClass("fa-square-o"); + } + } + console.log(checkboxes, allChecked); + return; + } ); + + + + // END JC ADD + + } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); @@ -56,6 +98,10 @@ // hide spinner this.$el.find('#upload-ftp-wait').hide(); + + + + }, // add @@ -110,7 +156,40 @@ // add new icon class $icon.addClass(self.options.class_add); } + + var selectBox=$icon.parent().parent().parent().parent().find('#selectAll'); + var checkboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); + var checkedCheckboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; +// var checked = 0; + // console.log("BeforeLoop " + checked); + // for (i = 0; i < len; i++) { + // console.log("In loop "+checked, checkboxes.eq(i)); + // if (checkboxes.eq(i).hasClass("fa-check-square-o")) { + // checked++; + // console.log("In if "+checked); + // } + // } + if(lenChecked > 0 && lenChecked !== lenAll){ + selectBox.removeClass("fa-square-o"); + selectBox.removeClass("fa-check-square-o"); + selectBox.addClass("fa-minus-square-o"); + } + else if(lenChecked === lenAll){ + selectBox.removeClass("fa-square-o"); + selectBox.addClass("fa-check-square-o"); + selectBox.removeClass("fa-minus-square-o"); + } + else if(lenChecked === 0){ + selectBox.addClass("fa-square-o"); + selectBox.removeClass("fa-check-square-o"); + selectBox.removeClass("fa-minus-square-o"); + } + console.log(checkboxes,lenChecked); + }); + }, // get model index @@ -130,7 +209,7 @@ // template row _templateRow: function(options) { return '<tr class="upload-ftp-row" style="cursor: pointer;">' + - '<td><div class="icon"/></td>' + + '<td><div class="icon " /></td>' + '<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' + '<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' + '<td style="white-space: nowrap;">' + options.ctime + '</td>' + @@ -149,7 +228,9 @@ '<table class="grid" style="float: left;">' + '<thead>' + '<tr>' + - '<th></th>' + +//jc added + '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' + +//end jc added '<th>Name</th>' + '<th>Size</th>' + '<th>Created</th>' + @@ -171,7 +252,11 @@ return '<div class="upload-ftp">' + '<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' + '<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' + - '<div id="upload-ftp-content"></div>' + + '<div id="upload-ftp-content">' +//jc added + +//end jc added + '</div>' + '<div>'; } https://bitbucket.org/galaxy/galaxy-central/commits/49f601721738/ Changeset: 49f601721738 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 20:33:26+00:00 Summary: complete selectAll checkbox Affected #: 1 file diff -r 7ee46fef21b796e355e4dcc995852345f2325879 -r 49f601721738ec2742252c090240381ff2551455 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -49,59 +49,62 @@ // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); - // ADD THINGS HERE - // - $($('.upload-ftp')[0]).find('#selectAll').on('click', function(){ - var checkboxes=$(this).parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); + + var selectAll = this.$el.find('#selectAll'); + + // call method to determine and set selectAll status on loading + this._updateSelectAll(selectAll); + + // selectAll checkbox has been clicked + selectAll.on('click', function(){ + var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); var len = checkboxes.length; var allChecked; $this = $(this); - // - if($this.hasClass("fa-square-o")){ - $this.removeClass("fa-square-o"); - $this.removeClass("fa-minus-square-o"); - $this.addClass("fa-check-square-o"); + + // change state of the selectAll checkbox + if($this.hasClass('fa-square-o')){ + // in unchecked, change to checked + $this.removeClass('fa-square-o fa-minus-square-o'); + $this.addClass('fa-check-square-o'); allChecked=true; } else{ - $this.removeClass("fa-check-square-o"); - $this.removeClass("fa-minus-square-o"); - $this.addClass("fa-square-o"); + // if checked, change to unchecked + $this.removeClass('fa-check-square-o fa-minus-square-o'); + $this.addClass('fa-square-o'); allChecked=false; } - // + + // change state of the sub-checkboxes for(i = 0; i < len; i++){ if(allChecked) { - - checkboxes.eq(i).removeClass("fa-square-o"); - checkboxes.eq(i).addClass("fa-check-square-o"); + // all checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-square-o')) + { + // if they are not checked, check them + checkboxes.eq(i).trigger('addToUpBox'); + } } else{ - checkboxes.eq(i).removeClass("fa-check-square-o"); - checkboxes.eq(i).addClass("fa-square-o"); + // no checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-check-square-o')) + { + // if they are checked, uncheck them + checkboxes.eq(i).trigger('addToUpBox'); + } } } - console.log(checkboxes, allChecked); return; } ); - - - // END JC ADD - - } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } - // hide spinner this.$el.find('#upload-ftp-wait').hide(); - - - - }, // add @@ -125,73 +128,74 @@ } else { icon_class = this.options.class_add; } - // add icon class $icon.addClass(icon_class); + + $it.on('addToUpBox', function(){ + var model_index = self._find(ftp_file); - // click to add ftp files - $it.on('click', function() { - // find model - var model_index = self._find(ftp_file); - - // update icon - $icon.removeClass(); - - // add model - if (!model_index) { - // add to uploadbox - self.app.uploadbox.add([{ - mode : 'ftp', - name : ftp_file.path, - size : ftp_file.size, - path : ftp_file.path - }]); - - // add new icon class - $icon.addClass(self.options.class_remove); - } else { - // remove - self.app.collection.remove(model_index); - - // add new icon class - $icon.addClass(self.options.class_add); - } + // update icon + $icon.removeClass(); - var selectBox=$icon.parent().parent().parent().parent().find('#selectAll'); - var checkboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); - var checkedCheckboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div.fa-check-square-o'); - var lenAll = checkboxes.length; - var lenChecked = checkedCheckboxes.length; -// var checked = 0; - // console.log("BeforeLoop " + checked); - // for (i = 0; i < len; i++) { - // console.log("In loop "+checked, checkboxes.eq(i)); - // if (checkboxes.eq(i).hasClass("fa-check-square-o")) { - // checked++; - // console.log("In if "+checked); - // } - // } - if(lenChecked > 0 && lenChecked !== lenAll){ - selectBox.removeClass("fa-square-o"); - selectBox.removeClass("fa-check-square-o"); - selectBox.addClass("fa-minus-square-o"); - } - else if(lenChecked === lenAll){ - selectBox.removeClass("fa-square-o"); - selectBox.addClass("fa-check-square-o"); - selectBox.removeClass("fa-minus-square-o"); - } - else if(lenChecked === 0){ - selectBox.addClass("fa-square-o"); - selectBox.removeClass("fa-check-square-o"); - selectBox.removeClass("fa-minus-square-o"); - } - console.log(checkboxes,lenChecked); - + // add model + if (!model_index) { + // add to uploadbox + self.app.uploadbox.add([{ + mode : 'ftp', + name : ftp_file.path, + size : ftp_file.size, + path : ftp_file.path + }]); + // add new icon class + $icon.addClass(self.options.class_remove); + } else { + // remove + self.app.collection.remove(model_index); + // add new icon class + $icon.addClass(self.options.class_add); + } }); - }, - + $it.on('click', function() { + //trigger my new event + $icon.trigger('addToUpBox'); + + // click to add ftp files + // modify selectAll box based on number of checkboxes checked + var selectBox=$icon.parents().find('#selectAll'); + // determine and set state of selectAll after sub-checkbox clicked + self._updateSelectAll(selectBox); + }); + }, + + _updateSelectAll: function(selectBox){ + // array of all checkboxes + var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); + // array of only checked checkboxes + var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; + + // determine which state the selectAll checkbox needs to be and setting it + if(lenChecked > 0 && lenChecked !== lenAll){ + // indeterminate state + selectBox.removeClass('fa-square-o fa-check-square-o'); + selectBox.addClass('fa-minus-square-o'); + } + else if(lenChecked === lenAll){ + // checked state + selectBox.removeClass('fa-square-o fa-minus-square-o'); + selectBox.addClass('fa-check-square-o'); + } + else if(lenChecked === 0){ + // unchecked state + selectBox.removeClass('fa-check-square-o fa-minus-square-o'); + selectBox.addClass('fa-square-o'); + } + }, + + + // get model index _find: function(ftp_file) { // check if exists already https://bitbucket.org/galaxy/galaxy-central/commits/05d85016a5cc/ Changeset: 05d85016a5cc Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 20:40:28+00:00 Summary: complete selectAll checkbox cleanup Affected #: 1 file diff -r 49f601721738ec2742252c090240381ff2551455 -r 05d85016a5ccf5fc3437e75cc3e3b726387042e6 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -103,6 +103,7 @@ // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } + // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -128,10 +129,12 @@ } else { icon_class = this.options.class_add; } + // add icon class $icon.addClass(icon_class); $it.on('addToUpBox', function(){ + // find model var model_index = self._find(ftp_file); // update icon @@ -146,16 +149,19 @@ size : ftp_file.size, path : ftp_file.path }]); + // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); + // add new icon class $icon.addClass(self.options.class_add); } }); + // click to add ftp files $it.on('click', function() { //trigger my new event $icon.trigger('addToUpBox'); @@ -232,9 +238,7 @@ '<table class="grid" style="float: left;">' + '<thead>' + '<tr>' + -//jc added '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' + -//end jc added '<th>Name</th>' + '<th>Size</th>' + '<th>Created</th>' + @@ -257,9 +261,7 @@ '<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' + '<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' + '<div id="upload-ftp-content">' -//jc added -//end jc added '</div>' + '<div>'; } https://bitbucket.org/galaxy/galaxy-central/commits/7be57e717422/ Changeset: 7be57e717422 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 20:53:07+00:00 Summary: complete selectAll tab fixes Affected #: 1 file diff -r 05d85016a5ccf5fc3437e75cc3e3b726387042e6 -r 7be57e7174228c8300fc76d1514f25f7408bf32a static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -56,48 +56,48 @@ this._updateSelectAll(selectAll); // selectAll checkbox has been clicked - selectAll.on('click', function(){ - var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); - var len = checkboxes.length; - var allChecked; - $this = $(this); + selectAll.on('click', function(){ + var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); + var len = checkboxes.length; + var allChecked; + $this = $(this); - // change state of the selectAll checkbox - if($this.hasClass('fa-square-o')){ - // in unchecked, change to checked - $this.removeClass('fa-square-o fa-minus-square-o'); - $this.addClass('fa-check-square-o'); - allChecked=true; - } - else{ - // if checked, change to unchecked - $this.removeClass('fa-check-square-o fa-minus-square-o'); - $this.addClass('fa-square-o'); - allChecked=false; - } + // change state of the selectAll checkbox + if($this.hasClass('fa-square-o')){ + // in unchecked, change to checked + $this.removeClass('fa-square-o fa-minus-square-o'); + $this.addClass('fa-check-square-o'); + allChecked=true; + } + else{ + // if checked, change to unchecked + $this.removeClass('fa-check-square-o fa-minus-square-o'); + $this.addClass('fa-square-o'); + allChecked=false; + } - // change state of the sub-checkboxes - for(i = 0; i < len; i++){ - if(allChecked) - { - // all checkboxes should be checked + // change state of the sub-checkboxes + for(i = 0; i < len; i++){ + if(allChecked) + { + // all checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-square-o')) { - // if they are not checked, check them + // if they are not checked, check them checkboxes.eq(i).trigger('addToUpBox'); } - } - else{ - // no checkboxes should be checked + } + else{ + // no checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-check-square-o')) { - // if they are checked, uncheck them - checkboxes.eq(i).trigger('addToUpBox'); + // if they are checked, uncheck them + checkboxes.eq(i).trigger('addToUpBox'); } - } - } - return; - } ); + } + } + return; + } ); } else { // add info @@ -134,74 +134,74 @@ $icon.addClass(icon_class); $it.on('addToUpBox', function(){ - // find model - var model_index = self._find(ftp_file); +// find model +var model_index = self._find(ftp_file); - // update icon - $icon.removeClass(); + // update icon + $icon.removeClass(); - // add model - if (!model_index) { - // add to uploadbox - self.app.uploadbox.add([{ - mode : 'ftp', - name : ftp_file.path, - size : ftp_file.size, - path : ftp_file.path - }]); + // add model + if (!model_index) { + // add to uploadbox + self.app.uploadbox.add([{ + mode : 'ftp', + name : ftp_file.path, + size : ftp_file.size, + path : ftp_file.path + }]); - // add new icon class - $icon.addClass(self.options.class_remove); - } else { - // remove - self.app.collection.remove(model_index); - - // add new icon class - $icon.addClass(self.options.class_add); - } + // add new icon class + $icon.addClass(self.options.class_remove); + } else { + // remove + self.app.collection.remove(model_index); + + // add new icon class + $icon.addClass(self.options.class_add); + } }); // click to add ftp files - $it.on('click', function() { - //trigger my new event - $icon.trigger('addToUpBox'); + $it.on('click', function() { + //trigger my new event + $icon.trigger('addToUpBox'); - // click to add ftp files - // modify selectAll box based on number of checkboxes checked - var selectBox=$icon.parents().find('#selectAll'); - // determine and set state of selectAll after sub-checkbox clicked - self._updateSelectAll(selectBox); - }); - }, + // click to add ftp files + // modify selectAll box based on number of checkboxes checked + var selectBox=$icon.parents().find('#selectAll'); + // determine and set state of selectAll after sub-checkbox clicked + self._updateSelectAll(selectBox); + }); + }, - _updateSelectAll: function(selectBox){ - // array of all checkboxes - var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); - // array of only checked checkboxes - var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); - var lenAll = checkboxes.length; - var lenChecked = checkedCheckboxes.length; + _updateSelectAll: function(selectBox){ + // array of all checkboxes + var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); + // array of only checked checkboxes + var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; - // determine which state the selectAll checkbox needs to be and setting it - if(lenChecked > 0 && lenChecked !== lenAll){ - // indeterminate state - selectBox.removeClass('fa-square-o fa-check-square-o'); - selectBox.addClass('fa-minus-square-o'); - } - else if(lenChecked === lenAll){ - // checked state - selectBox.removeClass('fa-square-o fa-minus-square-o'); - selectBox.addClass('fa-check-square-o'); - } - else if(lenChecked === 0){ - // unchecked state - selectBox.removeClass('fa-check-square-o fa-minus-square-o'); - selectBox.addClass('fa-square-o'); - } - }, + // determine which state the selectAll checkbox needs to be and setting it + if(lenChecked > 0 && lenChecked !== lenAll){ + // indeterminate state + selectBox.removeClass('fa-square-o fa-check-square-o'); + selectBox.addClass('fa-minus-square-o'); + } + else if(lenChecked === lenAll){ + // checked state + selectBox.removeClass('fa-square-o fa-minus-square-o'); + selectBox.addClass('fa-check-square-o'); + } + else if(lenChecked === 0){ + // unchecked state + selectBox.removeClass('fa-check-square-o fa-minus-square-o'); + selectBox.addClass('fa-square-o'); + } + }, - + // get model index _find: function(ftp_file) { // check if exists already https://bitbucket.org/galaxy/galaxy-central/commits/a0c0e0b6188c/ Changeset: a0c0e0b6188c Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 20:56:46+00:00 Summary: complete selectAll tab fixes2 Affected #: 1 file diff -r 7be57e7174228c8300fc76d1514f25f7408bf32a -r a0c0e0b6188c5144564175a664c66c2f66915d17 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -78,8 +78,8 @@ // change state of the sub-checkboxes for(i = 0; i < len; i++){ - if(allChecked) - { + if(allChecked) + { // all checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-square-o')) { @@ -97,7 +97,7 @@ } } return; - } ); + }); } else { // add info @@ -134,24 +134,24 @@ $icon.addClass(icon_class); $it.on('addToUpBox', function(){ -// find model -var model_index = self._find(ftp_file); + // find model + var model_index = self._find(ftp_file); // update icon $icon.removeClass(); // add model if (!model_index) { - // add to uploadbox - self.app.uploadbox.add([{ - mode : 'ftp', - name : ftp_file.path, - size : ftp_file.size, - path : ftp_file.path - }]); + // add to uploadbox + self.app.uploadbox.add([{ + mode : 'ftp', + name : ftp_file.path, + size : ftp_file.size, + path : ftp_file.path + }]); - // add new icon class - $icon.addClass(self.options.class_remove); + // add new icon class + $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); https://bitbucket.org/galaxy/galaxy-central/commits/fe8d22502cde/ Changeset: fe8d22502cde Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 20:59:58+00:00 Summary: complete selectAll tab fixes2 Affected #: 1 file diff -r a0c0e0b6188c5144564175a664c66c2f66915d17 -r fe8d22502cde12470b14597669d350b94046c579 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -63,18 +63,18 @@ $this = $(this); // change state of the selectAll checkbox - if($this.hasClass('fa-square-o')){ - // in unchecked, change to checked + if($this.hasClass('fa-check-square-o')){ + $this.removeClass('fa-check-square-o fa-minus-square-o'); + $this.addClass('fa-square-o'); + allChecked=false; + + } + else{ + // in unchecked, change to checked $this.removeClass('fa-square-o fa-minus-square-o'); $this.addClass('fa-check-square-o'); allChecked=true; } - else{ - // if checked, change to unchecked - $this.removeClass('fa-check-square-o fa-minus-square-o'); - $this.addClass('fa-square-o'); - allChecked=false; - } // change state of the sub-checkboxes for(i = 0; i < len; i++){ https://bitbucket.org/galaxy/galaxy-central/commits/e43cffbd226d/ Changeset: e43cffbd226d Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-14 21:10:38+00:00 Summary: complete selectAll indeter to checked Affected #: 1 file diff -r fe8d22502cde12470b14597669d350b94046c579 -r e43cffbd226d85ef0565a6b513f583d3fdf21957 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -56,41 +56,36 @@ this._updateSelectAll(selectAll); // selectAll checkbox has been clicked - selectAll.on('click', function(){ + selectAll.on('click', function() { var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); var len = checkboxes.length; var allChecked; $this = $(this); // change state of the selectAll checkbox - if($this.hasClass('fa-check-square-o')){ - $this.removeClass('fa-check-square-o fa-minus-square-o'); + if($this.hasClass('fa-check-square-o')) { + // if checked change to unchecked + $this.removeClass('fa-check-square-o'); $this.addClass('fa-square-o'); allChecked=false; - - } - else{ - // in unchecked, change to checked + } else { + // if checked or partially checked, change to checked $this.removeClass('fa-square-o fa-minus-square-o'); $this.addClass('fa-check-square-o'); allChecked=true; } // change state of the sub-checkboxes - for(i = 0; i < len; i++){ - if(allChecked) - { + for(i = 0; i < len; i++) { + if(allChecked) { // all checkboxes should be checked - if(checkboxes.eq(i).hasClass('fa-square-o')) - { + if(checkboxes.eq(i).hasClass('fa-square-o')) { // if they are not checked, check them checkboxes.eq(i).trigger('addToUpBox'); } - } - else{ + } else { // no checkboxes should be checked - if(checkboxes.eq(i).hasClass('fa-check-square-o')) - { + if(checkboxes.eq(i).hasClass('fa-check-square-o')) { // if they are checked, uncheck them checkboxes.eq(i).trigger('addToUpBox'); } @@ -133,9 +128,9 @@ // add icon class $icon.addClass(icon_class); - $it.on('addToUpBox', function(){ - // find model - var model_index = self._find(ftp_file); + $it.on('addToUpBox', function() { + // find model + var model_index = self._find(ftp_file); // update icon $icon.removeClass(); @@ -174,7 +169,7 @@ }); }, - _updateSelectAll: function(selectBox){ + _updateSelectAll: function(selectBox) { // array of all checkboxes var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); // array of only checked checkboxes @@ -183,17 +178,15 @@ var lenChecked = checkedCheckboxes.length; // determine which state the selectAll checkbox needs to be and setting it - if(lenChecked > 0 && lenChecked !== lenAll){ + if(lenChecked > 0 && lenChecked !== lenAll) { // indeterminate state selectBox.removeClass('fa-square-o fa-check-square-o'); selectBox.addClass('fa-minus-square-o'); - } - else if(lenChecked === lenAll){ + } else if(lenChecked === lenAll) { // checked state selectBox.removeClass('fa-square-o fa-minus-square-o'); selectBox.addClass('fa-check-square-o'); - } - else if(lenChecked === 0){ + } else if(lenChecked === 0) { // unchecked state selectBox.removeClass('fa-check-square-o fa-minus-square-o'); selectBox.addClass('fa-square-o'); https://bitbucket.org/galaxy/galaxy-central/commits/599ebe1f1ea4/ Changeset: 599ebe1f1ea4 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-15 13:35:52+00:00 Summary: remove non changes and use _updateSelectAll Affected #: 1 file diff -r e43cffbd226d85ef0565a6b513f583d3fdf21957 -r 599ebe1f1ea49845e139fc6b0124416e5b95d0ad static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -35,6 +35,7 @@ // fill table _fill: function(ftp_files) { + var self = this; if (ftp_files && ftp_files.length > 0) { // add table this.$el.find('#upload-ftp-content').html($(this._templateTable())); @@ -59,21 +60,23 @@ selectAll.on('click', function() { var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); var len = checkboxes.length; - var allChecked; $this = $(this); + var allChecked = !($this.hasClass('fa-check-square-o')); + + // change state of the selectAll checkbox - if($this.hasClass('fa-check-square-o')) { - // if checked change to unchecked - $this.removeClass('fa-check-square-o'); - $this.addClass('fa-square-o'); - allChecked=false; - } else { - // if checked or partially checked, change to checked - $this.removeClass('fa-square-o fa-minus-square-o'); - $this.addClass('fa-check-square-o'); - allChecked=true; - } + // if($this.hasClass('fa-check-square-o')) { + // // if checked change to unchecked + // $this.removeClass('fa-check-square-o'); + // $this.addClass('fa-square-o'); + // allChecked=false; + // } else { + // // if checked or partially checked, change to checked + // $this.removeClass('fa-square-o fa-minus-square-o'); + // $this.addClass('fa-check-square-o'); + // allChecked=true; + // } // change state of the sub-checkboxes for(i = 0; i < len; i++) { @@ -91,6 +94,7 @@ } } } + self._updateSelectAll(selectAll); return; }); @@ -212,7 +216,7 @@ // template row _templateRow: function(options) { return '<tr class="upload-ftp-row" style="cursor: pointer;">' + - '<td><div class="icon " /></td>' + + '<td><div class="icon" /></td>' + '<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' + '<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' + '<td style="white-space: nowrap;">' + options.ctime + '</td>' + @@ -253,9 +257,7 @@ return '<div class="upload-ftp">' + '<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' + '<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' + - '<div id="upload-ftp-content">' - - '</div>' + + '<div id="upload-ftp-content"></div>' + '<div>'; } https://bitbucket.org/galaxy/galaxy-central/commits/4ef51dde1d05/ Changeset: 4ef51dde1d05 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-15 13:37:40+00:00 Summary: remove non changes and use _updateSelectAll2 Affected #: 1 file diff -r 599ebe1f1ea49845e139fc6b0124416e5b95d0ad -r 4ef51dde1d050ca04999343699db84340e9dde22 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -102,7 +102,6 @@ // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } - // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -128,17 +127,14 @@ } else { icon_class = this.options.class_add; } - // add icon class $icon.addClass(icon_class); $it.on('addToUpBox', function() { // find model var model_index = self._find(ftp_file); - // update icon $icon.removeClass(); - // add model if (!model_index) { // add to uploadbox @@ -148,13 +144,11 @@ size : ftp_file.size, path : ftp_file.path }]); - // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); - // add new icon class $icon.addClass(self.options.class_add); } @@ -216,7 +210,7 @@ // template row _templateRow: function(options) { return '<tr class="upload-ftp-row" style="cursor: pointer;">' + - '<td><div class="icon" /></td>' + + '<td><div class="icon"/></td>' + '<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' + '<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' + '<td style="white-space: nowrap;">' + options.ctime + '</td>' + https://bitbucket.org/galaxy/galaxy-central/commits/8a6305f20e33/ Changeset: 8a6305f20e33 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-15 13:41:26+00:00 Summary: remove non changes and use _updateSelectAll3 Affected #: 1 file diff -r 4ef51dde1d050ca04999343699db84340e9dde22 -r 8a6305f20e3328aa9db245d58d59a7ab448ee28a static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -102,6 +102,7 @@ // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } + // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -127,14 +128,17 @@ } else { icon_class = this.options.class_add; } + // add icon class $icon.addClass(icon_class); $it.on('addToUpBox', function() { // find model var model_index = self._find(ftp_file); + // update icon $icon.removeClass(); + // add model if (!model_index) { // add to uploadbox @@ -144,11 +148,13 @@ size : ftp_file.size, path : ftp_file.path }]); + // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); + // add new icon class $icon.addClass(self.options.class_add); } https://bitbucket.org/galaxy/galaxy-central/commits/53bb9c3c16a0/ Changeset: 53bb9c3c16a0 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-15 13:44:15+00:00 Summary: remove non changes and use _updateSelectAll4 Affected #: 1 file diff -r 8a6305f20e3328aa9db245d58d59a7ab448ee28a -r 53bb9c3c16a04a64984803e2fef125ba1d9319db static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -62,21 +62,6 @@ var len = checkboxes.length; $this = $(this); var allChecked = !($this.hasClass('fa-check-square-o')); - - - - // change state of the selectAll checkbox - // if($this.hasClass('fa-check-square-o')) { - // // if checked change to unchecked - // $this.removeClass('fa-check-square-o'); - // $this.addClass('fa-square-o'); - // allChecked=false; - // } else { - // // if checked or partially checked, change to checked - // $this.removeClass('fa-square-o fa-minus-square-o'); - // $this.addClass('fa-check-square-o'); - // allChecked=true; - // } // change state of the sub-checkboxes for(i = 0; i < len; i++) { @@ -94,8 +79,8 @@ } } } + self._updateSelectAll(selectAll); - return; }); } else { https://bitbucket.org/galaxy/galaxy-central/commits/af54fe317fba/ Changeset: af54fe317fba Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-15 15:44:03+00:00 Summary: adding packed file Affected #: 1 file diff -r 53bb9c3c16a04a64984803e2fef125ba1d9319db -r af54fe317fbab0336a549ece5909a5f17eb42cb7 static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,1 +1,2 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c&&c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file +// dependencies +define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("addToUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("addToUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("addToUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("addToUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/c37851171ccd/ Changeset: c37851171ccd Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-16 21:23:05+00:00 Summary: Type drop-down for all files Affected #: 3 files diff -r af54fe317fbab0336a549ece5909a5f17eb42cb7 -r c37851171ccd8656657ea77de388b853baf8946e static/scripts/mvc/upload/upload-model.js --- a/static/scripts/mvc/upload/upload-model.js +++ b/static/scripts/mvc/upload/upload-model.js @@ -14,6 +14,7 @@ file_type : null, file_path : '', percentage : 0, + row : null, // settings space_to_tabs : false, diff -r af54fe317fbab0336a549ece5909a5f17eb42cb7 -r c37851171ccd8656657ea77de388b853baf8946e static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -83,7 +83,7 @@ }, data: self.app.list_extensions, container: it.find('#extension'), - value: self.model.get('extension') + value: self.app.select_extension.value() }); // initialize extension @@ -139,6 +139,7 @@ this.app.collection.on('reset', function() { self.remove(); }); + self.model.set('row', self); }, // render diff -r af54fe317fbab0336a549ece5909a5f17eb42cb7 -r c37851171ccd8656657ea77de388b853baf8946e static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -6,6 +6,7 @@ "mvc/upload/upload-ftp", "mvc/ui/ui-popover", "mvc/ui/ui-modal", + "mvc/ui/ui-select", "utils/uploadbox"], function( Utils, @@ -14,7 +15,8 @@ UploadItem, UploadFtp, Popover, - Modal + Modal, + Select ) { // galaxy upload @@ -35,6 +37,9 @@ // current history current_history: null, + + // extension selector + select_extension : null, // current upload size upload_size: 0, @@ -218,6 +223,23 @@ title : 'FTP files', container : button }); + + // select extension + this.select_extension = new Select.View({ + css: 'extension', + onchange : function() { + var newExten =self.select_extension.value() + var len = self.collection.models.length; + for(i = 0; i < len; i++) + { + self.collection.models[i].attributes['row'].select_extension.value(newExten); + } + }, + data: self.list_extensions, + container: self.$el.find('#extension'), + value: self.list_extensions[0] + }); + } // show modal @@ -228,6 +250,66 @@ // setup info this._updateScreen(); + + // handle extension info popover + self.$el.find('#extension-info').on('click' , function(e) { self._showExtensionInfo(); }) + .on('mousedown', function(e) { e.preventDefault(); }); + + }, + + _showExtensionInfo : function() { + // initialize + var self = this; + var $el = $(this.el).find('#extension-info'); + var extension = self.select_extension.value(); + + var title = this.select_extension.text(); + + var description = _.findWhere(self.list_extensions, {'id': extension}); + //console.log(extension, $el); + + // create popup + if (!this.extension_popup) { + this.extension_popup = new Popover.View({ + placement: 'bottom', + container: $el + }); + } + //console.log(description); + // show / hide popup + if (!this.extension_popup.visible) { + this.extension_popup.title(title); + this.extension_popup.empty(); + this.extension_popup.append(this._templateDescription(description)); + this.extension_popup.show(); + } else { + this.extension_popup.hide(); + } + }, + + _showSettings : function() { + // check if popover is visible + if (!this.settings.visible) { + // show popover + this.settings.empty(); + this.settings.append((new UploadSettings(this)).$el); + this.settings.show(); + } else { + // hide popover + this.settings.hide(); + } + }, + + _templateDescription: function(options) { + if (options.description) { + var tmpl = options.description; + if (options.description_url) { + tmpl += ' (<a href="' + options.description_url + '" target="_blank">read more</a>)'; + } + return tmpl; + } else { + return 'There is no description available for this file extension.'; + } }, // @@ -513,6 +595,9 @@ // remove from queue this.uploadbox.reset(); + + // reset value for universal type drop-down + this.select_extension.value(this.list_extensions[0]); // reset button this.ui_button.set('percentage', 0); @@ -612,7 +697,10 @@ '<tr>' + '<th>Name</th>' + '<th>Size</th>' + - '<th>Type</th>' + + '<th>Type' + + '<div id="extension" class="extension" style="float: left;"/>  ' + + '<div id="extension-info" class="upload-icon-button fa fa-search"/>' + + '</th>' + '<th>Genome</th>' + '<th>Settings</th>' + '<th>Status</th>' + https://bitbucket.org/galaxy/galaxy-central/commits/b7729c84ae07/ Changeset: b7729c84ae07 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-20 17:36:08+00:00 Summary: UI changes - added global file format selector Affected #: 3 files diff -r c37851171ccd8656657ea77de388b853baf8946e -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -80,6 +80,13 @@ css: 'extension', onchange : function() { self.model.set('extension', self.select_extension.value()); + // if user has changed individual row type, then change "set all" + // type to '---' + if(!(self.select_extension.value() == app.select_extension.value())) + { + var newExte = '---'; + app.select_extension.value(newExte); + } }, data: self.app.list_extensions, container: it.find('#extension'), diff -r c37851171ccd8656657ea77de388b853baf8946e -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -129,6 +129,14 @@ self.list_extensions.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); + + // add the '---' extension for use when the row types are changed individually + self.list_extensions.push({ + id : "---", + text : "---", + description : "", + description_url : "" + }); // add auto field if (!self.options.datatypes_disable_auto) { @@ -230,16 +238,22 @@ onchange : function() { var newExten =self.select_extension.value() var len = self.collection.models.length; - for(i = 0; i < len; i++) - { - self.collection.models[i].attributes['row'].select_extension.value(newExten); + // Only trigger changing the rows if the "set all" isn't set to '---' + // Prevents recursively changing the rows after an individual row has been changed + if(!(newExten=='---')){ + for(i = 0; i < len; i++){ + self.collection.models[i].attributes['row'].select_extension.value(newExten); + } } }, data: self.list_extensions, - container: self.$el.find('#extension'), + container: self.$el.parents().find('#extension'), value: self.list_extensions[0] }); + // handle extension info popover + self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); }) + .on('mousedown', function(e) { e.preventDefault(); }); } // show modal @@ -251,22 +265,17 @@ // setup info this._updateScreen(); - // handle extension info popover - self.$el.find('#extension-info').on('click' , function(e) { self._showExtensionInfo(); }) - .on('mousedown', function(e) { e.preventDefault(); }); - }, _showExtensionInfo : function() { // initialize var self = this; - var $el = $(this.el).find('#extension-info'); + var $el = $(this.el).parents().find('#extension-info_out'); var extension = self.select_extension.value(); var title = this.select_extension.text(); var description = _.findWhere(self.list_extensions, {'id': extension}); - //console.log(extension, $el); // create popup if (!this.extension_popup) { @@ -275,7 +284,7 @@ container: $el }); } - //console.log(description); + // show / hide popup if (!this.extension_popup.visible) { this.extension_popup.title(title); @@ -691,26 +700,36 @@ // load html template _template: function(id, idInfo) { - return '<div id="' + id + '" class="upload-box">' + - '<table id="upload-table" class="table table-striped" style="display: none;">' + - '<thead>' + - '<tr>' + - '<th>Name</th>' + - '<th>Size</th>' + - '<th>Type' + - '<div id="extension" class="extension" style="float: left;"/>  ' + - '<div id="extension-info" class="upload-icon-button fa fa-search"/>' + - '</th>' + - '<th>Genome</th>' + - '<th>Settings</th>' + - '<th>Status</th>' + - '<th></th>' + - '</tr>' + - '</thead>' + - '<tbody></tbody>' + - '</table>' + - '</div>' + - '<h6 id="' + idInfo + '" class="upload-info"></h6>'; + return '<div class="uploadwrap">' + + '<div id="uploadhead" class="uploadhead">' + + '<span class="fftext">"Set All" Types:  </span>' + + '<span id="extension" class="extension"/>  ' + + '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' + + '</div>' + + '<div class="uploadcont">' + + '<div class="uploadcont-wrap">' + + '<div id="' + id + '" class="upload-box">' + + '<table id="upload-table" class="table table-striped" style="display: none;">' + + '<thead>' + + '<tr>' + + '<th>Name</th>' + + '<th>Size</th>' + + '<th>Type</th>' + + '<th>Genome</th>' + + '<th>Settings</th>' + + '<th>Status</th>' + + '<th></th>' + + '</tr>' + + '</thead>' + + '<tbody></tbody>' + + '</table>' + + '</div>' + + '</div>' + + '</div>' + + '<div class="uploadfoot">' + + '<h6 id="' + idInfo + '" class="upload-info"></h6>' + + '</div>' + + '</div>'; } }); diff -r c37851171ccd8656657ea77de388b853baf8946e -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -119,6 +119,15 @@ .table caption+thead tr:first-child th,.table colgroup+thead tr:first-child th,.table thead:first-child tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child td{border-top:0} .table tbody+tbody{border-top:2px solid #d6b161} .table .table{background-color:#fff} +.uploadwrap {display: table; height: 100%; width: 100%;} +.uploadcont{display: table-row; height: 100%;} +.uploadcont-wrap{height: 100%; overflow: auto;} +.uploadfoot{display: table-row; text-align:center;} +.uploadhead{display: table-row; float:left; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;} +.uploadhead .fftext{font-weight: bold;} +.uploadhead .select2-container .select2-choice .select2-arrow b{background-position:0 -3px} +.uploadhead .extension{width:100px;min-width:100px;font-size:11px} +.uploadhead .select2-container .select2-choice{max-height:20px;line-height:18px;text-align:center; font-weight: normal;} .table-condensed thead>tr>th,.table-condensed tbody>tr>th,.table-condensed tfoot>tr>th,.table-condensed thead>tr>td,.table-condensed tbody>tr>td,.table-condensed tfoot>tr>td{padding:5px} .table-bordered{border:1px solid #d6b161}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #d6b161} .table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px} @@ -1370,7 +1379,7 @@ .upload-icon{font-size:1.2em;width:1.2em} .upload-icon-button{font-size:1.2em;width:1.2em;cursor:pointer} .upload-info{font-weight:normal;text-align:center} -.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} +.upload-box{width:100%;height:100%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} .upload-box .table th{text-align:center;white-space:nowrap} .upload-box .table td{margin:0px} .upload-box .upload-item .select2-arrow b{background-position:0 -3px} https://bitbucket.org/galaxy/galaxy-central/commits/b995da1e4740/ Changeset: b995da1e4740 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-20 17:46:34+00:00 Summary: UI changes - added global file format selector - fixed code spacing Affected #: 2 files diff -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e -r b995da1e4740a55aafdba8fa67987ba52aacdbba static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -82,7 +82,6 @@ self._updateSelectAll(selectAll); }); - } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); @@ -117,6 +116,7 @@ // add icon class $icon.addClass(icon_class); + // add files to the uploadbox $it.on('addToUpBox', function() { // find model var model_index = self._find(ftp_file); @@ -182,8 +182,6 @@ } }, - - // get model index _find: function(ftp_file) { // check if exists already diff -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e -r b995da1e4740a55aafdba8fa67987ba52aacdbba static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -124,7 +124,7 @@ description_url : datatypes[key].description_url }); } - + // sort self.list_extensions.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; @@ -264,7 +264,6 @@ // setup info this._updateScreen(); - }, _showExtensionInfo : function() { https://bitbucket.org/galaxy/galaxy-central/commits/4019ee6c42c1/ Changeset: 4019ee6c42c1 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-20 20:20:01+00:00 Summary: UI changes - added global file format selector - fixed error on adding another file after --- Affected #: 1 file diff -r b995da1e4740a55aafdba8fa67987ba52aacdbba -r 4019ee6c42c1bc97e1ee493fdfe9c5ff31de96d9 static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -42,6 +42,9 @@ // link app this.app = app; + // default value for extension of files + var default_ext = 'Auto-detect'; + // link this var self = this; @@ -75,6 +78,12 @@ // initialize genome this.model.set('genome', self.select_genome.value()); + // ensure files added after an individual row has changed + // default to Auto-detect instead of --- + if(!(this.app.select_extension.value()=='---')){ + this.default_ext=this.app.select_extension.value(); + } + // select extension this.select_extension = new Select.View({ css: 'extension', @@ -90,7 +99,7 @@ }, data: self.app.list_extensions, container: it.find('#extension'), - value: self.app.select_extension.value() + value: self.default_ext }); // initialize extension https://bitbucket.org/galaxy/galaxy-central/commits/126f96bd87a3/ Changeset: 126f96bd87a3 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-20 20:40:55+00:00 Summary: UI changes - added global file format selector - fixed text spacing Affected #: 2 files diff -r 4019ee6c42c1bc97e1ee493fdfe9c5ff31de96d9 -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -80,8 +80,8 @@ // ensure files added after an individual row has changed // default to Auto-detect instead of --- - if(!(this.app.select_extension.value()=='---')){ - this.default_ext=this.app.select_extension.value(); + if(!(this.app.select_extension.value() === '---')){ + this.default_ext = this.app.select_extension.value(); } // select extension @@ -91,7 +91,7 @@ self.model.set('extension', self.select_extension.value()); // if user has changed individual row type, then change "set all" // type to '---' - if(!(self.select_extension.value() == app.select_extension.value())) + if(!(self.select_extension.value() === app.select_extension.value())) { var newExte = '---'; app.select_extension.value(newExte); diff -r 4019ee6c42c1bc97e1ee493fdfe9c5ff31de96d9 -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -236,11 +236,11 @@ this.select_extension = new Select.View({ css: 'extension', onchange : function() { - var newExten =self.select_extension.value() + var newExten = self.select_extension.value() var len = self.collection.models.length; // Only trigger changing the rows if the "set all" isn't set to '---' // Prevents recursively changing the rows after an individual row has been changed - if(!(newExten=='---')){ + if(!(newExten === '---')){ for(i = 0; i < len; i++){ self.collection.models[i].attributes['row'].select_extension.value(newExten); } https://bitbucket.org/galaxy/galaxy-central/commits/fdb6215d8c09/ Changeset: fdb6215d8c09 Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-23 14:19:25+00:00 Summary: adding packed files and changing fcn name for addToUpBox to updateUpBox Affected #: 5 files diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -69,13 +69,13 @@ // all checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-square-o')) { // if they are not checked, check them - checkboxes.eq(i).trigger('addToUpBox'); + checkboxes.eq(i).trigger('updateUpBox'); } } else { // no checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-check-square-o')) { // if they are checked, uncheck them - checkboxes.eq(i).trigger('addToUpBox'); + checkboxes.eq(i).trigger('updateUpBox'); } } } @@ -117,7 +117,7 @@ $icon.addClass(icon_class); // add files to the uploadbox - $it.on('addToUpBox', function() { + $it.on('updateUpBox', function() { // find model var model_index = self._find(ftp_file); @@ -148,7 +148,7 @@ // click to add ftp files $it.on('click', function() { //trigger my new event - $icon.trigger('addToUpBox'); + $icon.trigger('updateUpBox'); // click to add ftp files // modify selectAll box based on number of checkboxes checked diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,2 +1,1 @@ -// dependencies -define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("addToUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("addToUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("addToUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("addToUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})}); \ No newline at end of file +define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("updateUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("updateUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("updateUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("updateUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})}); \ No newline at end of file diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-model.js --- a/static/scripts/packed/mvc/upload/upload-model.js +++ b/static/scripts/packed/mvc/upload/upload-model.js @@ -1,1 +1,1 @@ -define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,space_to_tabs:false,to_posix_lines:true}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}}); \ No newline at end of file +define([],function(){var e=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:!1,to_posix_lines:!0}}),t=Backbone.Collection.extend({model:e});return{Model:e,Collection:t}}); \ No newline at end of file diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-row.js --- a/static/scripts/packed/mvc/upload/upload-row.js +++ b/static/scripts/packed/mvc/upload/upload-row.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(i,g){this.app=i;var f=this;this.model=new b.Model(g);this.setElement(this._template(g));var h=this.$el;this.settings=new c.View({title:"Upload configuration",container:h.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){f.model.set("genome",f.select_genome.value())},data:f.app.list_genomes,container:h.find("#genome"),value:f.model.get("genome")});this.model.set("genome",f.select_genome.value());this.select_extension=new e.View({css:"extension",onchange:function(){f.model.set("extension",f.select_extension.value())},data:f.app.list_extensions,container:h.find("#extension"),value:f.model.get("extension")});this.model.set("extension",f.select_extension.value());h.find("#symbol").on("click",function(){f._removeRow()});h.find("#extension-info").on("click",function(j){f._showExtensionInfo()}).on("mousedown",function(j){j.preventDefault()});h.find("#settings").on("click",function(j){f._showSettings()}).on("mousedown",function(j){j.preventDefault()});h.find("#text-content").on("keyup",function(j){f.model.set("url_paste",$(j.target).val());f.model.set("file_size",$(j.target).val().length)});h.find("#space_to_tabs").on("change",function(j){f.model.set("space_to_tabs",$(j.target).prop("checked"))});this.model.on("change:percentage",function(){f._refreshPercentage()});this.model.on("change:status",function(){f._refreshStatus()});this.model.on("change:info",function(){f._refreshInfo()});this.model.on("change:genome",function(){f._refreshGenome()});this.model.on("change:file_size",function(){f._refreshFileSize()});this.model.on("remove",function(){f.remove()});this.app.collection.on("reset",function(){f.remove()})},render:function(){var m=this.model.get("file_name");var g=this.model.get("file_size");var j=this.model.get("file_mode");var i=this.$el;i.find("#title").html(m);i.find("#size").html(d.bytesToString(g));i.find("#mode").removeClass().addClass("mode");if(j=="new"){var l=i.find("#text");var k=this.options.padding;var h=i.width()-2*k;var f=i.height()-k;l.css("width",h+"px");l.css("top",f+"px");i.height(f+l.height()+2*k);l.show();i.find("#mode").addClass("fa fa-pencil")}if(j=="local"){i.find("#mode").addClass("fa fa-laptop")}if(j=="ftp"){i.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var f=this.model.get("genome");this.select_genome.value(f)},_refreshInfo:function(){var f=this.model.get("info");if(f){this.$el.find("#info").html("<strong>Failed: </strong>"+f).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var f=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:f+"%"});if(f!=100){this.$el.find("#percentage").html(f+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var g=this.$el;var f=this.model.get("status");var i=this.status_classes[f];var h=this.$el.find("#symbol");h.removeClass();h.addClass(i);if(f=="init"){this.select_genome.enable();this.select_extension.enable();g.find("#text-content").attr("disabled",false);g.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();g.find("#text-content").attr("disabled",true);g.find("#space_to_tabs").attr("disabled",true)}if(f=="success"){g.addClass("success");g.find("#percentage").html("100%")}if(f=="error"){g.addClass("danger");g.find(".progress").remove()}},_refreshFileSize:function(){var f=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(f))},_removeRow:function(){var f=this.model.get("status");if(f=="init"||f=="success"||f=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var f=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();var g=_.findWhere(this.app.list_extensions,{id:i});if(!this.extension_popup){this.extension_popup=new c.View({placement:"bottom",container:f})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(g));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(g){if(g.description){var f=g.description;if(g.description_url){f+=' (<a href="'+g.description_url+'" target="_blank">read more</a>)'}return f}else{return"There is no description available for this file extension."}},_template:function(f){return'<tr id="upload-item-'+f.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(e,t,n,r,i){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(e,n){this.app=e;var s="Auto-detect",o=this;this.model=new t.Model(n),this.setElement(this._template(n));var u=this.$el;this.settings=new r.View({title:"Upload configuration",container:u.find("#settings"),placement:"bottom"}),this.select_genome=new i.View({css:"genome",onchange:function(){o.model.set("genome",o.select_genome.value())},data:o.app.list_genomes,container:u.find("#genome"),value:o.model.get("genome")}),this.model.set("genome",o.select_genome.value()),this.app.select_extension.value()!=="---"&&(this.default_ext=this.app.select_extension.value()),this.select_extension=new i.View({css:"extension",onchange:function(){o.model.set("extension",o.select_extension.value());if(o.select_extension.value()!==e.select_extension.value()){var t="---";e.select_extension.value(t)}},data:o.app.list_extensions,container:u.find("#extension"),value:o.default_ext}),this.model.set("extension",o.select_extension.value()),u.find("#symbol").on("click",function(){o._removeRow()}),u.find("#extension-info").on("click",function(e){o._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()}),u.find("#settings").on("click",function(e){o._showSettings()}).on("mousedown",function(e){e.preventDefault()}),u.find("#text-content").on("keyup",function(e){o.model.set("url_paste",$(e.target).val()),o.model.set("file_size",$(e.target).val().length)}),u.find("#space_to_tabs").on("change",function(e){o.model.set("space_to_tabs",$(e.target).prop("checked"))}),this.model.on("change:percentage",function(){o._refreshPercentage()}),this.model.on("change:status",function(){o._refreshStatus()}),this.model.on("change:info",function(){o._refreshInfo()}),this.model.on("change:genome",function(){o._refreshGenome()}),this.model.on("change:file_size",function(){o._refreshFileSize()}),this.model.on("remove",function(){o.remove()}),this.app.collection.on("reset",function(){o.remove()}),o.model.set("row",o)},render:function(){var t=this.model.get("file_name"),n=this.model.get("file_size"),r=this.model.get("file_mode"),i=this.$el;i.find("#title").html(t),i.find("#size").html(e.bytesToString(n)),i.find("#mode").removeClass().addClass("mode");if(r=="new"){var s=i.find("#text"),o=this.options.padding,u=i.width()-2*o,a=i.height()-o;s.css("width",u+"px"),s.css("top",a+"px"),i.height(a+s.height()+2*o),s.show(),i.find("#mode").addClass("fa fa-pencil")}r=="local"&&i.find("#mode").addClass("fa fa-laptop"),r=="ftp"&&i.find("#mode").addClass("fa fa-code-fork")},remove:function(){this.select_genome.remove(),this.select_extension.remove(),Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var e=this.model.get("genome");this.select_genome.value(e)},_refreshInfo:function(){var e=this.model.get("info");e?this.$el.find("#info").html("<strong>Failed: </strong>"+e).show():this.$el.find("#info").hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:e+"%"}),e!=100?this.$el.find("#percentage").html(e+"%"):this.$el.find("#percentage").html("Adding to history...")},_refreshStatus:function(){var e=this.$el,t=this.model.get("status"),n=this.status_classes[t],r=this.$el.find("#symbol");r.removeClass(),r.addClass(n),t=="init"?(this.select_genome.enable(),this.select_extension.enable(),e.find("#text-content").attr("disabled",!1),e.find("#space_to_tabs").attr("disabled",!1)):(this.select_genome.disable(),this.select_extension.disable(),e.find("#text-content").attr("disabled",!0),e.find("#space_to_tabs").attr("disabled",!0)),t=="success"&&(e.addClass("success"),e.find("#percentage").html("100%")),t=="error"&&(e.addClass("danger"),e.find(".progress").remove())},_refreshFileSize:function(){var t=this.model.get("file_size");this.$el.find("#size").html(e.bytesToString(t))},_removeRow:function(){var e=this.model.get("status");(e=="init"||e=="success"||e=="error")&&this.app.collection.remove(this.model)},_showExtensionInfo:function(){var e=$(this.el).find("#extension-info"),t=this.model.get("extension"),n=this.select_extension.text(),i=_.findWhere(this.app.list_extensions,{id:t});this.extension_popup||(this.extension_popup=new r.View({placement:"bottom",container:e})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(n),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new n(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_template:function(e){return'<tr id="upload-item-'+e.id+'" class="upload-item">'+"<td>"+'<div style="position: relative;">'+'<div id="mode"></div>'+'<div id="title" class="title"></div>'+'<div id="text" class="text">'+'<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>'+'<textarea id="text-content" class="text-content form-control"></textarea>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="size" class="size"></div>'+"</td>"+"<td>"+'<div id="extension" class="extension" style="float: left;"/>  '+'<div id="extension-info" class="upload-icon-button fa fa-search"/>'+"</td>"+"<td>"+'<div id="genome" class="genome" />'+"</td>"+'<td><div id="settings" class="upload-icon-button fa fa-gear"></div>'+"<td>"+'<div id="info" class="info">'+'<div class="progress">'+'<div class="progress-bar progress-bar-success"></div>'+'<div id="percentage" class="percentage">0%</div>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="symbol" class="'+this.status_classes.init+'"></div>'+"</td>"+"</tr>"}})}); \ No newline at end of file diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-view.js --- a/static/scripts/packed/mvc/upload/upload-view.js +++ b/static/scripts/packed/mvc/upload/upload-view.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","utils/uploadbox"],function(f,e,c,b,g,d,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(i){this.options=_.defaults(i,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){j.preventDefault();h.show()}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var h=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(j){for(key in j){h.list_extensions.push({id:j[key].extension,text:j[key].extension,description:j[key].description,description_url:j[key].description_url})}h.list_extensions.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0});if(!h.options.datatypes_disable_auto){h.list_extensions.unshift(h.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})}});this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},show:function(){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.show()},500);return}if(!this.modal){var h=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Paste/Fetch data":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(j,k,l){h._eventAnnounce(j,k,l)},initialize:function(j,k,l){return h._eventInitialize(j,k,l)},progress:function(j,k,l){h._eventProgress(j,k,l)},success:function(j,k,l){h._eventSuccess(j,k,l)},error:function(j,k,l){h._eventError(j,k,l)},complete:function(){h._eventComplete()}});var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}this.modal.show();this._updateUser();this._updateScreen()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=l;tool_input.to_posix_lines=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(e,t,n,r,s,o,u,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new n.Collection,ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(n){var r=this;n&&(this.options=_.defaults(n,this.options)),this.ui_button=new t.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(e){e&&(e.preventDefault(),r.show())},onunload:function(){if(r.counter.running>0)return"Several uploads are still processing."}}),$(".with-upload-button").append((new t.View(this.ui_button)).$el);var r=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(e){for(key in e)r.list_extensions.push({id:e[key].extension,text:e[key].extension,description:e[key].description,description_url:e[key].description_url});r.list_extensions.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0}),r.list_extensions.push({id:"---",text:"---",description:"",description_url:""}),r.options.datatypes_disable_auto||r.list_extensions.unshift(r.auto)}}),e.get({url:galaxy_config.root+"api/genomes",success:function(e){for(key in e)r.list_genomes.push({id:e[key][1],text:e[key][0]});r.list_genomes.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0})}}),this.collection.on("remove",function(e){r._eventRemove(e)}),this.collection.on("change:genome",function(e){var t=e.get("genome");r.collection.each(function(e){e.get("status")=="init"&&e.get("genome")=="?"&&e.set("genome",t)})})},show:function(){var e=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){e.show()},500);return}if(!this.modal){var e=this;this.modal=new u.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){e.uploadbox.select()},"Choose FTP file":function(){e._eventFtp()},"Paste/Fetch data":function(){e._eventCreate()},Start:function(){e._eventStart()},Pause:function(){e._eventStop()},Reset:function(){e._eventReset()},Close:function(){e.modal.hide()}},height:"400",width:"900",closing_events:!0}),this.setElement("#upload-box");var e=this;this.uploadbox=this.$el.uploadbox({announce:function(t,n,r){e._eventAnnounce(t,n,r)},initialize:function(t,n,r){return e._eventInitialize(t,n,r)},progress:function(t,n,r){e._eventProgress(t,n,r)},success:function(t,n,r){e._eventSuccess(t,n,r)},error:function(t,n,r){e._eventError(t,n,r)},complete:function(){e._eventComplete()}});var t=this.modal.getButton("Choose FTP file");this.ftp=new o.View({title:"FTP files",container:t}),this.select_extension=new a.View({css:"extension",onchange:function(){var t=e.select_extension.value(),n=e.collection.models.length;if(t!=="---")for(i=0;i<n;i++)e.collection.models[i].attributes.row.select_extension.value(t)},data:e.list_extensions,container:e.$el.parents().find("#extension"),value:e.list_extensions[0]}),e.$el.parents().find("#extension-info_out").on("click",function(t){e._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()})}this.modal.show(),this._updateUser(),this._updateScreen()},_showExtensionInfo:function(){var e=this,t=$(this.el).parents().find("#extension-info_out"),n=e.select_extension.value(),r=this.select_extension.text(),i=_.findWhere(e.list_extensions,{id:n});this.extension_popup||(this.extension_popup=new o.View({placement:"bottom",container:t})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(r),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new UploadSettings(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_eventRemove:function(e){var t=e.get("status");t=="success"?this.counter.success--:t=="error"?this.counter.error--:this.counter.announce--,this._updateScreen(),this.uploadbox.remove(e.id)},_eventAnnounce:function(e,t,n){this.counter.announce++,this._updateScreen();var i=new r(this,{id:e,file_name:t.name,file_size:t.size,file_mode:t.mode,file_path:t.path});this.collection.add(i.model),$(this.el).find("tbody:first").append(i.$el),i.render()},_eventInitialize:function(e,t,n){var r=this.collection.get(e);r.set("status","running");var i=r.get("file_name"),s=r.get("file_path"),o=r.get("file_mode"),u=r.get("extension"),a=r.get("genome"),f=r.get("url_paste"),l=r.get("space_to_tabs"),c=r.get("to_posix_lines");return!!f||t.size>0?(this.uploadbox.configure({url:this.options.nginx_upload_path}),o=="local"?this.uploadbox.configure({paramname:"files_0|file_data"}):this.uploadbox.configure({paramname:null}),tool_input={},o=="new"&&(tool_input["files_0|url_paste"]=f),o=="ftp"&&(tool_input["files_0|ftp_files"]=s),tool_input.dbkey=a,tool_input.file_type=u,tool_input["files_0|type"]="upload_dataset",tool_input.space_to_tabs=l,tool_input.to_posix_lines=c,data={},data.history_id=this.current_history,data.tool_id="upload1",data.inputs=JSON.stringify(tool_input),data):null},_eventProgress:function(e,t,n){var r=this.collection.get(e);r.set("percentage",n),this.ui_button.set("percentage",this._upload_percentage(n,t.size))},_eventSuccess:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","success");var i=r.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i)),this.upload_completed+=i*100,this.counter.announce--,this.counter.success++,this._updateScreen(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","error"),r.set("info",n),this.ui_button.set("percentage",this._upload_percentage(100,t.size)),this.ui_button.set("status","danger"),this.upload_completed+=t.size*100,this.counter.announce--,this.counter.error++,this._updateScreen()},_eventComplete:function(){this.collection.each(function(e){e.get("status")=="queued"&&e.set("status","init")}),this.counter.running=0,this._updateScreen()},_eventFtp:function(){this.ftp.visible?this.ftp.hide():(this.ftp.empty(),this.ftp.append((new s(this)).$el),this.ftp.show())},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0)return;var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){t.get("status")=="init"&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.set("percentage",0),this.ui_button.set("status","success"),this.counter.running=this.counter.announce,this._updateScreen(),this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0)return;this.ui_button.set("status","info"),this.uploadbox.stop(),$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){this.counter.running==0&&(this.collection.reset(),this.counter.reset(),this._updateScreen(),this.uploadbox.reset(),this.select_extension.value(this.list_extensions[0]),this.ui_button.set("percentage",0))},_updateUser:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))},_updateScreen:function(){this.counter.announce==0?this.uploadbox.compatible()?message="You can Drag & Drop files into this box.":message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":this.counter.running==0?message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",$("#upload-info").html(message),this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0?this.modal.enableButton("Reset"):this.modal.disableButton("Reset"),this.counter.running==0&&this.counter.announce>0?this.modal.enableButton("Start"):this.modal.disableButton("Start"),this.counter.running>0?this.modal.enableButton("Pause"):this.modal.disableButton("Pause"),this.counter.running==0?(this.modal.enableButton("Choose local file"),this.modal.enableButton("Choose FTP file"),this.modal.enableButton("Paste/Fetch data")):(this.modal.disableButton("Choose local file"),this.modal.disableButton("Choose FTP file"),this.modal.disableButton("Paste/Fetch data")),this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site?this.modal.showButton("Choose FTP file"):this.modal.hideButton("Choose FTP file"),this.counter.announce+this.counter.success+this.counter.error>0?$(this.el).find("#upload-table").show():$(this.el).find("#upload-table").hide()},_upload_percentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(e,t){return'<div class="uploadwrap"><div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div class="uploadcont"><div class="uploadcont-wrap"><div id="'+e+'" class="upload-box">'+'<table id="upload-table" class="table table-striped" style="display: none;">'+"<thead>"+"<tr>"+"<th>Name</th>"+"<th>Size</th>"+"<th>Type</th>"+"<th>Genome</th>"+"<th>Settings</th>"+"<th>Status</th>"+"<th></th>"+"</tr>"+"</thead>"+"<tbody></tbody>"+"</table>"+"</div>"+"</div>"+"</div>"+'<div class="uploadfoot">'+'<h6 id="'+t+'" class="upload-info"></h6>'+"</div>"+"</div>"}})}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/32c0e2ce30dc/ Changeset: 32c0e2ce30dc Branch: upload-UI-enhancement User: JenCabral Date: 2015-01-23 15:13:13+00:00 Summary: fixing compatibility issues in IE and Firefox Affected #: 3 files diff -r fdb6215d8c090154aa6f9d0719d281cdb8526848 -r 32c0e2ce30dce27b22646031e408c400d735863e static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -699,36 +699,30 @@ // load html template _template: function(id, idInfo) { - return '<div class="uploadwrap">' + - '<div id="uploadhead" class="uploadhead">' + - '<span class="fftext">"Set All" Types:  </span>' + - '<span id="extension" class="extension"/>  ' + - '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' + - '</div>' + - '<div class="uploadcont">' + - '<div class="uploadcont-wrap">' + - '<div id="' + id + '" class="upload-box">' + - '<table id="upload-table" class="table table-striped" style="display: none;">' + - '<thead>' + - '<tr>' + - '<th>Name</th>' + - '<th>Size</th>' + - '<th>Type</th>' + - '<th>Genome</th>' + - '<th>Settings</th>' + - '<th>Status</th>' + - '<th></th>' + - '</tr>' + - '</thead>' + - '<tbody></tbody>' + - '</table>' + - '</div>' + - '</div>' + - '</div>' + - '<div class="uploadfoot">' + - '<h6 id="' + idInfo + '" class="upload-info"></h6>' + - '</div>' + - '</div>'; + return '<div id="uploadhead" class="uploadhead">' + + '<span class="fftext">"Set All" Types:  </span>' + + '<span id="extension" class="extension"/>  ' + + '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' + + '</div>' + + '<div id="' + id + '" class="upload-box">' + + '<table id="upload-table" class="table table-striped" style="display: none;">' + + '<thead>' + + '<tr>' + + '<th>Name</th>' + + '<th>Size</th>' + + '<th>Type</th>' + + '<th>Genome</th>' + + '<th>Settings</th>' + + '<th>Status</th>' + + '<th></th>' + + '</tr>' + + '</thead>' + + '<tbody></tbody>' + + '</table>' + + '</div>' + + '<div class="uploadfoot">' + + '<h6 id="' + idInfo + '" class="upload-info"></h6>' + + '</div>' ; } }); diff -r fdb6215d8c090154aa6f9d0719d281cdb8526848 -r 32c0e2ce30dce27b22646031e408c400d735863e static/scripts/packed/mvc/upload/upload-view.js --- a/static/scripts/packed/mvc/upload/upload-view.js +++ b/static/scripts/packed/mvc/upload/upload-view.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(e,t,n,r,s,o,u,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new n.Collection,ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(n){var r=this;n&&(this.options=_.defaults(n,this.options)),this.ui_button=new t.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(e){e&&(e.preventDefault(),r.show())},onunload:function(){if(r.counter.running>0)return"Several uploads are still processing."}}),$(".with-upload-button").append((new t.View(this.ui_button)).$el);var r=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(e){for(key in e)r.list_extensions.push({id:e[key].extension,text:e[key].extension,description:e[key].description,description_url:e[key].description_url});r.list_extensions.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0}),r.list_extensions.push({id:"---",text:"---",description:"",description_url:""}),r.options.datatypes_disable_auto||r.list_extensions.unshift(r.auto)}}),e.get({url:galaxy_config.root+"api/genomes",success:function(e){for(key in e)r.list_genomes.push({id:e[key][1],text:e[key][0]});r.list_genomes.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0})}}),this.collection.on("remove",function(e){r._eventRemove(e)}),this.collection.on("change:genome",function(e){var t=e.get("genome");r.collection.each(function(e){e.get("status")=="init"&&e.get("genome")=="?"&&e.set("genome",t)})})},show:function(){var e=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){e.show()},500);return}if(!this.modal){var e=this;this.modal=new u.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){e.uploadbox.select()},"Choose FTP file":function(){e._eventFtp()},"Paste/Fetch data":function(){e._eventCreate()},Start:function(){e._eventStart()},Pause:function(){e._eventStop()},Reset:function(){e._eventReset()},Close:function(){e.modal.hide()}},height:"400",width:"900",closing_events:!0}),this.setElement("#upload-box");var e=this;this.uploadbox=this.$el.uploadbox({announce:function(t,n,r){e._eventAnnounce(t,n,r)},initialize:function(t,n,r){return e._eventInitialize(t,n,r)},progress:function(t,n,r){e._eventProgress(t,n,r)},success:function(t,n,r){e._eventSuccess(t,n,r)},error:function(t,n,r){e._eventError(t,n,r)},complete:function(){e._eventComplete()}});var t=this.modal.getButton("Choose FTP file");this.ftp=new o.View({title:"FTP files",container:t}),this.select_extension=new a.View({css:"extension",onchange:function(){var t=e.select_extension.value(),n=e.collection.models.length;if(t!=="---")for(i=0;i<n;i++)e.collection.models[i].attributes.row.select_extension.value(t)},data:e.list_extensions,container:e.$el.parents().find("#extension"),value:e.list_extensions[0]}),e.$el.parents().find("#extension-info_out").on("click",function(t){e._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()})}this.modal.show(),this._updateUser(),this._updateScreen()},_showExtensionInfo:function(){var e=this,t=$(this.el).parents().find("#extension-info_out"),n=e.select_extension.value(),r=this.select_extension.text(),i=_.findWhere(e.list_extensions,{id:n});this.extension_popup||(this.extension_popup=new o.View({placement:"bottom",container:t})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(r),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new UploadSettings(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_eventRemove:function(e){var t=e.get("status");t=="success"?this.counter.success--:t=="error"?this.counter.error--:this.counter.announce--,this._updateScreen(),this.uploadbox.remove(e.id)},_eventAnnounce:function(e,t,n){this.counter.announce++,this._updateScreen();var i=new r(this,{id:e,file_name:t.name,file_size:t.size,file_mode:t.mode,file_path:t.path});this.collection.add(i.model),$(this.el).find("tbody:first").append(i.$el),i.render()},_eventInitialize:function(e,t,n){var r=this.collection.get(e);r.set("status","running");var i=r.get("file_name"),s=r.get("file_path"),o=r.get("file_mode"),u=r.get("extension"),a=r.get("genome"),f=r.get("url_paste"),l=r.get("space_to_tabs"),c=r.get("to_posix_lines");return!!f||t.size>0?(this.uploadbox.configure({url:this.options.nginx_upload_path}),o=="local"?this.uploadbox.configure({paramname:"files_0|file_data"}):this.uploadbox.configure({paramname:null}),tool_input={},o=="new"&&(tool_input["files_0|url_paste"]=f),o=="ftp"&&(tool_input["files_0|ftp_files"]=s),tool_input.dbkey=a,tool_input.file_type=u,tool_input["files_0|type"]="upload_dataset",tool_input.space_to_tabs=l,tool_input.to_posix_lines=c,data={},data.history_id=this.current_history,data.tool_id="upload1",data.inputs=JSON.stringify(tool_input),data):null},_eventProgress:function(e,t,n){var r=this.collection.get(e);r.set("percentage",n),this.ui_button.set("percentage",this._upload_percentage(n,t.size))},_eventSuccess:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","success");var i=r.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i)),this.upload_completed+=i*100,this.counter.announce--,this.counter.success++,this._updateScreen(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","error"),r.set("info",n),this.ui_button.set("percentage",this._upload_percentage(100,t.size)),this.ui_button.set("status","danger"),this.upload_completed+=t.size*100,this.counter.announce--,this.counter.error++,this._updateScreen()},_eventComplete:function(){this.collection.each(function(e){e.get("status")=="queued"&&e.set("status","init")}),this.counter.running=0,this._updateScreen()},_eventFtp:function(){this.ftp.visible?this.ftp.hide():(this.ftp.empty(),this.ftp.append((new s(this)).$el),this.ftp.show())},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0)return;var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){t.get("status")=="init"&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.set("percentage",0),this.ui_button.set("status","success"),this.counter.running=this.counter.announce,this._updateScreen(),this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0)return;this.ui_button.set("status","info"),this.uploadbox.stop(),$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){this.counter.running==0&&(this.collection.reset(),this.counter.reset(),this._updateScreen(),this.uploadbox.reset(),this.select_extension.value(this.list_extensions[0]),this.ui_button.set("percentage",0))},_updateUser:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))},_updateScreen:function(){this.counter.announce==0?this.uploadbox.compatible()?message="You can Drag & Drop files into this box.":message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":this.counter.running==0?message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",$("#upload-info").html(message),this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0?this.modal.enableButton("Reset"):this.modal.disableButton("Reset"),this.counter.running==0&&this.counter.announce>0?this.modal.enableButton("Start"):this.modal.disableButton("Start"),this.counter.running>0?this.modal.enableButton("Pause"):this.modal.disableButton("Pause"),this.counter.running==0?(this.modal.enableButton("Choose local file"),this.modal.enableButton("Choose FTP file"),this.modal.enableButton("Paste/Fetch data")):(this.modal.disableButton("Choose local file"),this.modal.disableButton("Choose FTP file"),this.modal.disableButton("Paste/Fetch data")),this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site?this.modal.showButton("Choose FTP file"):this.modal.hideButton("Choose FTP file"),this.counter.announce+this.counter.success+this.counter.error>0?$(this.el).find("#upload-table").show():$(this.el).find("#upload-table").hide()},_upload_percentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(e,t){return'<div class="uploadwrap"><div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div class="uploadcont"><div class="uploadcont-wrap"><div id="'+e+'" class="upload-box">'+'<table id="upload-table" class="table table-striped" style="display: none;">'+"<thead>"+"<tr>"+"<th>Name</th>"+"<th>Size</th>"+"<th>Type</th>"+"<th>Genome</th>"+"<th>Settings</th>"+"<th>Status</th>"+"<th></th>"+"</tr>"+"</thead>"+"<tbody></tbody>"+"</table>"+"</div>"+"</div>"+"</div>"+'<div class="uploadfoot">'+'<h6 id="'+t+'" class="upload-info"></h6>'+"</div>"+"</div>"}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(e,t,n,r,s,o,u,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new n.Collection,ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(n){var r=this;n&&(this.options=_.defaults(n,this.options)),this.ui_button=new t.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(e){e&&(e.preventDefault(),r.show())},onunload:function(){if(r.counter.running>0)return"Several uploads are still processing."}}),$(".with-upload-button").append((new t.View(this.ui_button)).$el);var r=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(e){for(key in e)r.list_extensions.push({id:e[key].extension,text:e[key].extension,description:e[key].description,description_url:e[key].description_url});r.list_extensions.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0}),r.list_extensions.push({id:"---",text:"---",description:"",description_url:""}),r.options.datatypes_disable_auto||r.list_extensions.unshift(r.auto)}}),e.get({url:galaxy_config.root+"api/genomes",success:function(e){for(key in e)r.list_genomes.push({id:e[key][1],text:e[key][0]});r.list_genomes.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0})}}),this.collection.on("remove",function(e){r._eventRemove(e)}),this.collection.on("change:genome",function(e){var t=e.get("genome");r.collection.each(function(e){e.get("status")=="init"&&e.get("genome")=="?"&&e.set("genome",t)})})},show:function(){var e=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){e.show()},500);return}if(!this.modal){var e=this;this.modal=new u.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){e.uploadbox.select()},"Choose FTP file":function(){e._eventFtp()},"Paste/Fetch data":function(){e._eventCreate()},Start:function(){e._eventStart()},Pause:function(){e._eventStop()},Reset:function(){e._eventReset()},Close:function(){e.modal.hide()}},height:"400",width:"900",closing_events:!0}),this.setElement("#upload-box");var e=this;this.uploadbox=this.$el.uploadbox({announce:function(t,n,r){e._eventAnnounce(t,n,r)},initialize:function(t,n,r){return e._eventInitialize(t,n,r)},progress:function(t,n,r){e._eventProgress(t,n,r)},success:function(t,n,r){e._eventSuccess(t,n,r)},error:function(t,n,r){e._eventError(t,n,r)},complete:function(){e._eventComplete()}});var t=this.modal.getButton("Choose FTP file");this.ftp=new o.View({title:"FTP files",container:t}),this.select_extension=new a.View({css:"extension",onchange:function(){var t=e.select_extension.value(),n=e.collection.models.length;if(t!=="---")for(i=0;i<n;i++)e.collection.models[i].attributes.row.select_extension.value(t)},data:e.list_extensions,container:e.$el.parents().find("#extension"),value:e.list_extensions[0]}),e.$el.parents().find("#extension-info_out").on("click",function(t){e._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()})}this.modal.show(),this._updateUser(),this._updateScreen()},_showExtensionInfo:function(){var e=this,t=$(this.el).parents().find("#extension-info_out"),n=e.select_extension.value(),r=this.select_extension.text(),i=_.findWhere(e.list_extensions,{id:n});this.extension_popup||(this.extension_popup=new o.View({placement:"bottom",container:t})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(r),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new UploadSettings(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_eventRemove:function(e){var t=e.get("status");t=="success"?this.counter.success--:t=="error"?this.counter.error--:this.counter.announce--,this._updateScreen(),this.uploadbox.remove(e.id)},_eventAnnounce:function(e,t,n){this.counter.announce++,this._updateScreen();var i=new r(this,{id:e,file_name:t.name,file_size:t.size,file_mode:t.mode,file_path:t.path});this.collection.add(i.model),$(this.el).find("tbody:first").append(i.$el),i.render()},_eventInitialize:function(e,t,n){var r=this.collection.get(e);r.set("status","running");var i=r.get("file_name"),s=r.get("file_path"),o=r.get("file_mode"),u=r.get("extension"),a=r.get("genome"),f=r.get("url_paste"),l=r.get("space_to_tabs"),c=r.get("to_posix_lines");return!!f||t.size>0?(this.uploadbox.configure({url:this.options.nginx_upload_path}),o=="local"?this.uploadbox.configure({paramname:"files_0|file_data"}):this.uploadbox.configure({paramname:null}),tool_input={},o=="new"&&(tool_input["files_0|url_paste"]=f),o=="ftp"&&(tool_input["files_0|ftp_files"]=s),tool_input.dbkey=a,tool_input.file_type=u,tool_input["files_0|type"]="upload_dataset",tool_input.space_to_tabs=l,tool_input.to_posix_lines=c,data={},data.history_id=this.current_history,data.tool_id="upload1",data.inputs=JSON.stringify(tool_input),data):null},_eventProgress:function(e,t,n){var r=this.collection.get(e);r.set("percentage",n),this.ui_button.set("percentage",this._upload_percentage(n,t.size))},_eventSuccess:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","success");var i=r.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i)),this.upload_completed+=i*100,this.counter.announce--,this.counter.success++,this._updateScreen(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","error"),r.set("info",n),this.ui_button.set("percentage",this._upload_percentage(100,t.size)),this.ui_button.set("status","danger"),this.upload_completed+=t.size*100,this.counter.announce--,this.counter.error++,this._updateScreen()},_eventComplete:function(){this.collection.each(function(e){e.get("status")=="queued"&&e.set("status","init")}),this.counter.running=0,this._updateScreen()},_eventFtp:function(){this.ftp.visible?this.ftp.hide():(this.ftp.empty(),this.ftp.append((new s(this)).$el),this.ftp.show())},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0)return;var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){t.get("status")=="init"&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.set("percentage",0),this.ui_button.set("status","success"),this.counter.running=this.counter.announce,this._updateScreen(),this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0)return;this.ui_button.set("status","info"),this.uploadbox.stop(),$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){this.counter.running==0&&(this.collection.reset(),this.counter.reset(),this._updateScreen(),this.uploadbox.reset(),this.select_extension.value(this.list_extensions[0]),this.ui_button.set("percentage",0))},_updateUser:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))},_updateScreen:function(){this.counter.announce==0?this.uploadbox.compatible()?message="You can Drag & Drop files into this box.":message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":this.counter.running==0?message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",$("#upload-info").html(message),this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0?this.modal.enableButton("Reset"):this.modal.disableButton("Reset"),this.counter.running==0&&this.counter.announce>0?this.modal.enableButton("Start"):this.modal.disableButton("Start"),this.counter.running>0?this.modal.enableButton("Pause"):this.modal.disableButton("Pause"),this.counter.running==0?(this.modal.enableButton("Choose local file"),this.modal.enableButton("Choose FTP file"),this.modal.enableButton("Paste/Fetch data")):(this.modal.disableButton("Choose local file"),this.modal.disableButton("Choose FTP file"),this.modal.disableButton("Paste/Fetch data")),this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site?this.modal.showButton("Choose FTP file"):this.modal.hideButton("Choose FTP file"),this.counter.announce+this.counter.success+this.counter.error>0?$(this.el).find("#upload-table").show():$(this.el).find("#upload-table").hide()},_upload_percentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(e,t){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+e+'" class="upload-box">'+'<table id="upload-table" class="table table-striped" style="display: none;">'+"<thead>"+"<tr>"+"<th>Name</th>"+"<th>Size</th>"+"<th>Type</th>"+"<th>Genome</th>"+"<th>Settings</th>"+"<th>Status</th>"+"<th></th>"+"</tr>"+"</thead>"+"<tbody></tbody>"+"</table>"+"</div>"+'<div class="uploadfoot">'+'<h6 id="'+t+'" class="upload-info"></h6>'+"</div>"}})}); \ No newline at end of file diff -r fdb6215d8c090154aa6f9d0719d281cdb8526848 -r 32c0e2ce30dce27b22646031e408c400d735863e static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -119,11 +119,8 @@ .table caption+thead tr:first-child th,.table colgroup+thead tr:first-child th,.table thead:first-child tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child td{border-top:0} .table tbody+tbody{border-top:2px solid #d6b161} .table .table{background-color:#fff} -.uploadwrap {display: table; height: 100%; width: 100%;} -.uploadcont{display: table-row; height: 100%;} -.uploadcont-wrap{height: 100%; overflow: auto;} -.uploadfoot{display: table-row; text-align:center;} -.uploadhead{display: table-row; float:left; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;} +.uploadhead{height:10%; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;} +.uploadfoot{height:5%; text-align:center;} .uploadhead .fftext{font-weight: bold;} .uploadhead .select2-container .select2-choice .select2-arrow b{background-position:0 -3px} .uploadhead .extension{width:100px;min-width:100px;font-size:11px} @@ -1379,7 +1376,7 @@ .upload-icon{font-size:1.2em;width:1.2em} .upload-icon-button{font-size:1.2em;width:1.2em;cursor:pointer} .upload-info{font-weight:normal;text-align:center} -.upload-box{width:100%;height:100%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} +.upload-box{width:100%;height:85%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} .upload-box .table th{text-align:center;white-space:nowrap} .upload-box .table td{margin:0px} .upload-box .upload-item .select2-arrow b{background-position:0 -3px} https://bitbucket.org/galaxy/galaxy-central/commits/e5e6fb30d560/ Changeset: e5e6fb30d560 User: dannon Date: 2015-01-23 15:59:45+00:00 Summary: Merge Upload UI Enhancements from JCabral Affected #: 9 files diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -35,6 +35,7 @@ // fill table _fill: function(ftp_files) { + var self = this; if (ftp_files && ftp_files.length > 0) { // add table this.$el.find('#upload-ftp-content').html($(this._templateTable())); @@ -49,11 +50,43 @@ // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); + + var selectAll = this.$el.find('#selectAll'); + + // call method to determine and set selectAll status on loading + this._updateSelectAll(selectAll); + + // selectAll checkbox has been clicked + selectAll.on('click', function() { + var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); + var len = checkboxes.length; + $this = $(this); + var allChecked = !($this.hasClass('fa-check-square-o')); + + // change state of the sub-checkboxes + for(i = 0; i < len; i++) { + if(allChecked) { + // all checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-square-o')) { + // if they are not checked, check them + checkboxes.eq(i).trigger('updateUpBox'); + } + } else { + // no checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-check-square-o')) { + // if they are checked, uncheck them + checkboxes.eq(i).trigger('updateUpBox'); + } + } + } + + self._updateSelectAll(selectAll); + }); } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } - + // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -79,18 +112,18 @@ } else { icon_class = this.options.class_add; } - + // add icon class $icon.addClass(icon_class); - - // click to add ftp files - $it.on('click', function() { + + // add files to the uploadbox + $it.on('updateUpBox', function() { // find model var model_index = self._find(ftp_file); - + // update icon $icon.removeClass(); - + // add model if (!model_index) { // add to uploadbox @@ -100,19 +133,55 @@ size : ftp_file.size, path : ftp_file.path }]); - + // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); - + // add new icon class $icon.addClass(self.options.class_add); } }); + + // click to add ftp files + $it.on('click', function() { + //trigger my new event + $icon.trigger('updateUpBox'); + + // click to add ftp files + // modify selectAll box based on number of checkboxes checked + var selectBox=$icon.parents().find('#selectAll'); + // determine and set state of selectAll after sub-checkbox clicked + self._updateSelectAll(selectBox); + }); }, - + + _updateSelectAll: function(selectBox) { + // array of all checkboxes + var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); + // array of only checked checkboxes + var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; + + // determine which state the selectAll checkbox needs to be and setting it + if(lenChecked > 0 && lenChecked !== lenAll) { + // indeterminate state + selectBox.removeClass('fa-square-o fa-check-square-o'); + selectBox.addClass('fa-minus-square-o'); + } else if(lenChecked === lenAll) { + // checked state + selectBox.removeClass('fa-square-o fa-minus-square-o'); + selectBox.addClass('fa-check-square-o'); + } else if(lenChecked === 0) { + // unchecked state + selectBox.removeClass('fa-check-square-o fa-minus-square-o'); + selectBox.addClass('fa-square-o'); + } + }, + // get model index _find: function(ftp_file) { // check if exists already @@ -149,7 +218,7 @@ '<table class="grid" style="float: left;">' + '<thead>' + '<tr>' + - '<th></th>' + + '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' + '<th>Name</th>' + '<th>Size</th>' + '<th>Created</th>' + diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-model.js --- a/static/scripts/mvc/upload/upload-model.js +++ b/static/scripts/mvc/upload/upload-model.js @@ -14,6 +14,7 @@ file_type : null, file_path : '', percentage : 0, + row : null, // settings space_to_tabs : false, diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -42,6 +42,9 @@ // link app this.app = app; + // default value for extension of files + var default_ext = 'Auto-detect'; + // link this var self = this; @@ -75,15 +78,28 @@ // initialize genome this.model.set('genome', self.select_genome.value()); + // ensure files added after an individual row has changed + // default to Auto-detect instead of --- + if(!(this.app.select_extension.value() === '---')){ + this.default_ext = this.app.select_extension.value(); + } + // select extension this.select_extension = new Select.View({ css: 'extension', onchange : function() { self.model.set('extension', self.select_extension.value()); + // if user has changed individual row type, then change "set all" + // type to '---' + if(!(self.select_extension.value() === app.select_extension.value())) + { + var newExte = '---'; + app.select_extension.value(newExte); + } }, data: self.app.list_extensions, container: it.find('#extension'), - value: self.model.get('extension') + value: self.default_ext }); // initialize extension @@ -139,6 +155,7 @@ this.app.collection.on('reset', function() { self.remove(); }); + self.model.set('row', self); }, // render diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -6,6 +6,7 @@ "mvc/upload/upload-ftp", "mvc/ui/ui-popover", "mvc/ui/ui-modal", + "mvc/ui/ui-select", "utils/uploadbox"], function( Utils, @@ -14,7 +15,8 @@ UploadItem, UploadFtp, Popover, - Modal + Modal, + Select ) { // galaxy upload @@ -35,6 +37,9 @@ // current history current_history: null, + + // extension selector + select_extension : null, // current upload size upload_size: 0, @@ -119,11 +124,19 @@ description_url : datatypes[key].description_url }); } - + // sort self.list_extensions.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); + + // add the '---' extension for use when the row types are changed individually + self.list_extensions.push({ + id : "---", + text : "---", + description : "", + description_url : "" + }); // add auto field if (!self.options.datatypes_disable_auto) { @@ -218,6 +231,29 @@ title : 'FTP files', container : button }); + + // select extension + this.select_extension = new Select.View({ + css: 'extension', + onchange : function() { + var newExten = self.select_extension.value() + var len = self.collection.models.length; + // Only trigger changing the rows if the "set all" isn't set to '---' + // Prevents recursively changing the rows after an individual row has been changed + if(!(newExten === '---')){ + for(i = 0; i < len; i++){ + self.collection.models[i].attributes['row'].select_extension.value(newExten); + } + } + }, + data: self.list_extensions, + container: self.$el.parents().find('#extension'), + value: self.list_extensions[0] + }); + + // handle extension info popover + self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); }) + .on('mousedown', function(e) { e.preventDefault(); }); } // show modal @@ -230,6 +266,60 @@ this._updateScreen(); }, + _showExtensionInfo : function() { + // initialize + var self = this; + var $el = $(this.el).parents().find('#extension-info_out'); + var extension = self.select_extension.value(); + + var title = this.select_extension.text(); + + var description = _.findWhere(self.list_extensions, {'id': extension}); + + // create popup + if (!this.extension_popup) { + this.extension_popup = new Popover.View({ + placement: 'bottom', + container: $el + }); + } + + // show / hide popup + if (!this.extension_popup.visible) { + this.extension_popup.title(title); + this.extension_popup.empty(); + this.extension_popup.append(this._templateDescription(description)); + this.extension_popup.show(); + } else { + this.extension_popup.hide(); + } + }, + + _showSettings : function() { + // check if popover is visible + if (!this.settings.visible) { + // show popover + this.settings.empty(); + this.settings.append((new UploadSettings(this)).$el); + this.settings.show(); + } else { + // hide popover + this.settings.hide(); + } + }, + + _templateDescription: function(options) { + if (options.description) { + var tmpl = options.description; + if (options.description_url) { + tmpl += ' (<a href="' + options.description_url + '" target="_blank">read more</a>)'; + } + return tmpl; + } else { + return 'There is no description available for this file extension.'; + } + }, + // // events triggered by collection // @@ -513,6 +603,9 @@ // remove from queue this.uploadbox.reset(); + + // reset value for universal type drop-down + this.select_extension.value(this.list_extensions[0]); // reset button this.ui_button.set('percentage', 0); @@ -606,7 +699,12 @@ // load html template _template: function(id, idInfo) { - return '<div id="' + id + '" class="upload-box">' + + return '<div id="uploadhead" class="uploadhead">' + + '<span class="fftext">"Set All" Types:  </span>' + + '<span id="extension" class="extension"/>  ' + + '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' + + '</div>' + + '<div id="' + id + '" class="upload-box">' + '<table id="upload-table" class="table table-striped" style="display: none;">' + '<thead>' + '<tr>' + @@ -622,7 +720,9 @@ '<tbody></tbody>' + '</table>' + '</div>' + - '<h6 id="' + idInfo + '" class="upload-info"></h6>'; + '<div class="uploadfoot">' + + '<h6 id="' + idInfo + '" class="upload-info"></h6>' + + '</div>' ; } }); diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c&&c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file +define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("updateUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("updateUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("updateUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("updateUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})}); \ No newline at end of file diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/packed/mvc/upload/upload-model.js --- a/static/scripts/packed/mvc/upload/upload-model.js +++ b/static/scripts/packed/mvc/upload/upload-model.js @@ -1,1 +1,1 @@ -define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,space_to_tabs:false,to_posix_lines:true}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}}); \ No newline at end of file +define([],function(){var e=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:!1,to_posix_lines:!0}}),t=Backbone.Collection.extend({model:e});return{Model:e,Collection:t}}); \ No newline at end of file diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/packed/mvc/upload/upload-row.js --- a/static/scripts/packed/mvc/upload/upload-row.js +++ b/static/scripts/packed/mvc/upload/upload-row.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(i,g){this.app=i;var f=this;this.model=new b.Model(g);this.setElement(this._template(g));var h=this.$el;this.settings=new c.View({title:"Upload configuration",container:h.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){f.model.set("genome",f.select_genome.value())},data:f.app.list_genomes,container:h.find("#genome"),value:f.model.get("genome")});this.model.set("genome",f.select_genome.value());this.select_extension=new e.View({css:"extension",onchange:function(){f.model.set("extension",f.select_extension.value())},data:f.app.list_extensions,container:h.find("#extension"),value:f.model.get("extension")});this.model.set("extension",f.select_extension.value());h.find("#symbol").on("click",function(){f._removeRow()});h.find("#extension-info").on("click",function(j){f._showExtensionInfo()}).on("mousedown",function(j){j.preventDefault()});h.find("#settings").on("click",function(j){f._showSettings()}).on("mousedown",function(j){j.preventDefault()});h.find("#text-content").on("keyup",function(j){f.model.set("url_paste",$(j.target).val());f.model.set("file_size",$(j.target).val().length)});h.find("#space_to_tabs").on("change",function(j){f.model.set("space_to_tabs",$(j.target).prop("checked"))});this.model.on("change:percentage",function(){f._refreshPercentage()});this.model.on("change:status",function(){f._refreshStatus()});this.model.on("change:info",function(){f._refreshInfo()});this.model.on("change:genome",function(){f._refreshGenome()});this.model.on("change:file_size",function(){f._refreshFileSize()});this.model.on("remove",function(){f.remove()});this.app.collection.on("reset",function(){f.remove()})},render:function(){var m=this.model.get("file_name");var g=this.model.get("file_size");var j=this.model.get("file_mode");var i=this.$el;i.find("#title").html(m);i.find("#size").html(d.bytesToString(g));i.find("#mode").removeClass().addClass("mode");if(j=="new"){var l=i.find("#text");var k=this.options.padding;var h=i.width()-2*k;var f=i.height()-k;l.css("width",h+"px");l.css("top",f+"px");i.height(f+l.height()+2*k);l.show();i.find("#mode").addClass("fa fa-pencil")}if(j=="local"){i.find("#mode").addClass("fa fa-laptop")}if(j=="ftp"){i.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var f=this.model.get("genome");this.select_genome.value(f)},_refreshInfo:function(){var f=this.model.get("info");if(f){this.$el.find("#info").html("<strong>Failed: </strong>"+f).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var f=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:f+"%"});if(f!=100){this.$el.find("#percentage").html(f+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var g=this.$el;var f=this.model.get("status");var i=this.status_classes[f];var h=this.$el.find("#symbol");h.removeClass();h.addClass(i);if(f=="init"){this.select_genome.enable();this.select_extension.enable();g.find("#text-content").attr("disabled",false);g.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();g.find("#text-content").attr("disabled",true);g.find("#space_to_tabs").attr("disabled",true)}if(f=="success"){g.addClass("success");g.find("#percentage").html("100%")}if(f=="error"){g.addClass("danger");g.find(".progress").remove()}},_refreshFileSize:function(){var f=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(f))},_removeRow:function(){var f=this.model.get("status");if(f=="init"||f=="success"||f=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var f=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();var g=_.findWhere(this.app.list_extensions,{id:i});if(!this.extension_popup){this.extension_popup=new c.View({placement:"bottom",container:f})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(g));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(g){if(g.description){var f=g.description;if(g.description_url){f+=' (<a href="'+g.description_url+'" target="_blank">read more</a>)'}return f}else{return"There is no description available for this file extension."}},_template:function(f){return'<tr id="upload-item-'+f.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(e,t,n,r,i){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(e,n){this.app=e;var s="Auto-detect",o=this;this.model=new t.Model(n),this.setElement(this._template(n));var u=this.$el;this.settings=new r.View({title:"Upload configuration",container:u.find("#settings"),placement:"bottom"}),this.select_genome=new i.View({css:"genome",onchange:function(){o.model.set("genome",o.select_genome.value())},data:o.app.list_genomes,container:u.find("#genome"),value:o.model.get("genome")}),this.model.set("genome",o.select_genome.value()),this.app.select_extension.value()!=="---"&&(this.default_ext=this.app.select_extension.value()),this.select_extension=new i.View({css:"extension",onchange:function(){o.model.set("extension",o.select_extension.value());if(o.select_extension.value()!==e.select_extension.value()){var t="---";e.select_extension.value(t)}},data:o.app.list_extensions,container:u.find("#extension"),value:o.default_ext}),this.model.set("extension",o.select_extension.value()),u.find("#symbol").on("click",function(){o._removeRow()}),u.find("#extension-info").on("click",function(e){o._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()}),u.find("#settings").on("click",function(e){o._showSettings()}).on("mousedown",function(e){e.preventDefault()}),u.find("#text-content").on("keyup",function(e){o.model.set("url_paste",$(e.target).val()),o.model.set("file_size",$(e.target).val().length)}),u.find("#space_to_tabs").on("change",function(e){o.model.set("space_to_tabs",$(e.target).prop("checked"))}),this.model.on("change:percentage",function(){o._refreshPercentage()}),this.model.on("change:status",function(){o._refreshStatus()}),this.model.on("change:info",function(){o._refreshInfo()}),this.model.on("change:genome",function(){o._refreshGenome()}),this.model.on("change:file_size",function(){o._refreshFileSize()}),this.model.on("remove",function(){o.remove()}),this.app.collection.on("reset",function(){o.remove()}),o.model.set("row",o)},render:function(){var t=this.model.get("file_name"),n=this.model.get("file_size"),r=this.model.get("file_mode"),i=this.$el;i.find("#title").html(t),i.find("#size").html(e.bytesToString(n)),i.find("#mode").removeClass().addClass("mode");if(r=="new"){var s=i.find("#text"),o=this.options.padding,u=i.width()-2*o,a=i.height()-o;s.css("width",u+"px"),s.css("top",a+"px"),i.height(a+s.height()+2*o),s.show(),i.find("#mode").addClass("fa fa-pencil")}r=="local"&&i.find("#mode").addClass("fa fa-laptop"),r=="ftp"&&i.find("#mode").addClass("fa fa-code-fork")},remove:function(){this.select_genome.remove(),this.select_extension.remove(),Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var e=this.model.get("genome");this.select_genome.value(e)},_refreshInfo:function(){var e=this.model.get("info");e?this.$el.find("#info").html("<strong>Failed: </strong>"+e).show():this.$el.find("#info").hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:e+"%"}),e!=100?this.$el.find("#percentage").html(e+"%"):this.$el.find("#percentage").html("Adding to history...")},_refreshStatus:function(){var e=this.$el,t=this.model.get("status"),n=this.status_classes[t],r=this.$el.find("#symbol");r.removeClass(),r.addClass(n),t=="init"?(this.select_genome.enable(),this.select_extension.enable(),e.find("#text-content").attr("disabled",!1),e.find("#space_to_tabs").attr("disabled",!1)):(this.select_genome.disable(),this.select_extension.disable(),e.find("#text-content").attr("disabled",!0),e.find("#space_to_tabs").attr("disabled",!0)),t=="success"&&(e.addClass("success"),e.find("#percentage").html("100%")),t=="error"&&(e.addClass("danger"),e.find(".progress").remove())},_refreshFileSize:function(){var t=this.model.get("file_size");this.$el.find("#size").html(e.bytesToString(t))},_removeRow:function(){var e=this.model.get("status");(e=="init"||e=="success"||e=="error")&&this.app.collection.remove(this.model)},_showExtensionInfo:function(){var e=$(this.el).find("#extension-info"),t=this.model.get("extension"),n=this.select_extension.text(),i=_.findWhere(this.app.list_extensions,{id:t});this.extension_popup||(this.extension_popup=new r.View({placement:"bottom",container:e})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(n),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new n(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_template:function(e){return'<tr id="upload-item-'+e.id+'" class="upload-item">'+"<td>"+'<div style="position: relative;">'+'<div id="mode"></div>'+'<div id="title" class="title"></div>'+'<div id="text" class="text">'+'<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>'+'<textarea id="text-content" class="text-content form-control"></textarea>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="size" class="size"></div>'+"</td>"+"<td>"+'<div id="extension" class="extension" style="float: left;"/>  '+'<div id="extension-info" class="upload-icon-button fa fa-search"/>'+"</td>"+"<td>"+'<div id="genome" class="genome" />'+"</td>"+'<td><div id="settings" class="upload-icon-button fa fa-gear"></div>'+"<td>"+'<div id="info" class="info">'+'<div class="progress">'+'<div class="progress-bar progress-bar-success"></div>'+'<div id="percentage" class="percentage">0%</div>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="symbol" class="'+this.status_classes.init+'"></div>'+"</td>"+"</tr>"}})}); \ No newline at end of file diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -119,6 +119,12 @@ .table caption+thead tr:first-child th,.table colgroup+thead tr:first-child th,.table thead:first-child tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child td{border-top:0} .table tbody+tbody{border-top:2px solid #d6b161} .table .table{background-color:#fff} +.uploadhead{height:10%; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;} +.uploadfoot{height:5%; text-align:center;} +.uploadhead .fftext{font-weight: bold;} +.uploadhead .select2-container .select2-choice .select2-arrow b{background-position:0 -3px} +.uploadhead .extension{width:100px;min-width:100px;font-size:11px} +.uploadhead .select2-container .select2-choice{max-height:20px;line-height:18px;text-align:center; font-weight: normal;} .table-condensed thead>tr>th,.table-condensed tbody>tr>th,.table-condensed tfoot>tr>th,.table-condensed thead>tr>td,.table-condensed tbody>tr>td,.table-condensed tfoot>tr>td{padding:5px} .table-bordered{border:1px solid #d6b161}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #d6b161} .table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px} @@ -1370,7 +1376,7 @@ .upload-icon{font-size:1.2em;width:1.2em} .upload-icon-button{font-size:1.2em;width:1.2em;cursor:pointer} .upload-info{font-weight:normal;text-align:center} -.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} +.upload-box{width:100%;height:85%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} .upload-box .table th{text-align:center;white-space:nowrap} .upload-box .table td{margin:0px} .upload-box .upload-item .select2-arrow b{background-position:0 -3px} https://bitbucket.org/galaxy/galaxy-central/commits/693f01fe6a68/ Changeset: 693f01fe6a68 User: dannon Date: 2015-01-23 16:08:05+00:00 Summary: Copy changes from PR644 to client. Affected #: 4 files diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-ftp.js --- a/client/galaxy/scripts/mvc/upload/upload-ftp.js +++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js @@ -35,6 +35,7 @@ // fill table _fill: function(ftp_files) { + var self = this; if (ftp_files && ftp_files.length > 0) { // add table this.$el.find('#upload-ftp-content').html($(this._templateTable())); @@ -49,11 +50,43 @@ // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); + + var selectAll = this.$el.find('#selectAll'); + + // call method to determine and set selectAll status on loading + this._updateSelectAll(selectAll); + + // selectAll checkbox has been clicked + selectAll.on('click', function() { + var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); + var len = checkboxes.length; + $this = $(this); + var allChecked = !($this.hasClass('fa-check-square-o')); + + // change state of the sub-checkboxes + for(i = 0; i < len; i++) { + if(allChecked) { + // all checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-square-o')) { + // if they are not checked, check them + checkboxes.eq(i).trigger('updateUpBox'); + } + } else { + // no checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-check-square-o')) { + // if they are checked, uncheck them + checkboxes.eq(i).trigger('updateUpBox'); + } + } + } + + self._updateSelectAll(selectAll); + }); } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } - + // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -79,18 +112,18 @@ } else { icon_class = this.options.class_add; } - + // add icon class $icon.addClass(icon_class); - - // click to add ftp files - $it.on('click', function() { + + // add files to the uploadbox + $it.on('updateUpBox', function() { // find model var model_index = self._find(ftp_file); - + // update icon $icon.removeClass(); - + // add model if (!model_index) { // add to uploadbox @@ -100,19 +133,55 @@ size : ftp_file.size, path : ftp_file.path }]); - + // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); - + // add new icon class $icon.addClass(self.options.class_add); } }); + + // click to add ftp files + $it.on('click', function() { + //trigger my new event + $icon.trigger('updateUpBox'); + + // click to add ftp files + // modify selectAll box based on number of checkboxes checked + var selectBox=$icon.parents().find('#selectAll'); + // determine and set state of selectAll after sub-checkbox clicked + self._updateSelectAll(selectBox); + }); }, - + + _updateSelectAll: function(selectBox) { + // array of all checkboxes + var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); + // array of only checked checkboxes + var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; + + // determine which state the selectAll checkbox needs to be and setting it + if(lenChecked > 0 && lenChecked !== lenAll) { + // indeterminate state + selectBox.removeClass('fa-square-o fa-check-square-o'); + selectBox.addClass('fa-minus-square-o'); + } else if(lenChecked === lenAll) { + // checked state + selectBox.removeClass('fa-square-o fa-minus-square-o'); + selectBox.addClass('fa-check-square-o'); + } else if(lenChecked === 0) { + // unchecked state + selectBox.removeClass('fa-check-square-o fa-minus-square-o'); + selectBox.addClass('fa-square-o'); + } + }, + // get model index _find: function(ftp_file) { // check if exists already @@ -149,7 +218,7 @@ '<table class="grid" style="float: left;">' + '<thead>' + '<tr>' + - '<th></th>' + + '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' + '<th>Name</th>' + '<th>Size</th>' + '<th>Created</th>' + diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-model.js --- a/client/galaxy/scripts/mvc/upload/upload-model.js +++ b/client/galaxy/scripts/mvc/upload/upload-model.js @@ -14,6 +14,7 @@ file_type : null, file_path : '', percentage : 0, + row : null, // settings space_to_tabs : false, diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-row.js --- a/client/galaxy/scripts/mvc/upload/upload-row.js +++ b/client/galaxy/scripts/mvc/upload/upload-row.js @@ -42,6 +42,9 @@ // link app this.app = app; + // default value for extension of files + var default_ext = 'Auto-detect'; + // link this var self = this; @@ -75,15 +78,28 @@ // initialize genome this.model.set('genome', self.select_genome.value()); + // ensure files added after an individual row has changed + // default to Auto-detect instead of --- + if(!(this.app.select_extension.value() === '---')){ + this.default_ext = this.app.select_extension.value(); + } + // select extension this.select_extension = new Select.View({ css: 'extension', onchange : function() { self.model.set('extension', self.select_extension.value()); + // if user has changed individual row type, then change "set all" + // type to '---' + if(!(self.select_extension.value() === app.select_extension.value())) + { + var newExte = '---'; + app.select_extension.value(newExte); + } }, data: self.app.list_extensions, container: it.find('#extension'), - value: self.model.get('extension') + value: self.default_ext }); // initialize extension @@ -139,6 +155,7 @@ this.app.collection.on('reset', function() { self.remove(); }); + self.model.set('row', self); }, // render diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-view.js --- a/client/galaxy/scripts/mvc/upload/upload-view.js +++ b/client/galaxy/scripts/mvc/upload/upload-view.js @@ -6,6 +6,7 @@ "mvc/upload/upload-ftp", "mvc/ui/ui-popover", "mvc/ui/ui-modal", + "mvc/ui/ui-select", "utils/uploadbox"], function( Utils, @@ -14,7 +15,8 @@ UploadItem, UploadFtp, Popover, - Modal + Modal, + Select ) { // galaxy upload @@ -35,6 +37,9 @@ // current history current_history: null, + + // extension selector + select_extension : null, // current upload size upload_size: 0, @@ -119,11 +124,19 @@ description_url : datatypes[key].description_url }); } - + // sort self.list_extensions.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); + + // add the '---' extension for use when the row types are changed individually + self.list_extensions.push({ + id : "---", + text : "---", + description : "", + description_url : "" + }); // add auto field if (!self.options.datatypes_disable_auto) { @@ -218,6 +231,29 @@ title : 'FTP files', container : button }); + + // select extension + this.select_extension = new Select.View({ + css: 'extension', + onchange : function() { + var newExten = self.select_extension.value() + var len = self.collection.models.length; + // Only trigger changing the rows if the "set all" isn't set to '---' + // Prevents recursively changing the rows after an individual row has been changed + if(!(newExten === '---')){ + for(i = 0; i < len; i++){ + self.collection.models[i].attributes['row'].select_extension.value(newExten); + } + } + }, + data: self.list_extensions, + container: self.$el.parents().find('#extension'), + value: self.list_extensions[0] + }); + + // handle extension info popover + self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); }) + .on('mousedown', function(e) { e.preventDefault(); }); } // show modal @@ -230,6 +266,60 @@ this._updateScreen(); }, + _showExtensionInfo : function() { + // initialize + var self = this; + var $el = $(this.el).parents().find('#extension-info_out'); + var extension = self.select_extension.value(); + + var title = this.select_extension.text(); + + var description = _.findWhere(self.list_extensions, {'id': extension}); + + // create popup + if (!this.extension_popup) { + this.extension_popup = new Popover.View({ + placement: 'bottom', + container: $el + }); + } + + // show / hide popup + if (!this.extension_popup.visible) { + this.extension_popup.title(title); + this.extension_popup.empty(); + this.extension_popup.append(this._templateDescription(description)); + this.extension_popup.show(); + } else { + this.extension_popup.hide(); + } + }, + + _showSettings : function() { + // check if popover is visible + if (!this.settings.visible) { + // show popover + this.settings.empty(); + this.settings.append((new UploadSettings(this)).$el); + this.settings.show(); + } else { + // hide popover + this.settings.hide(); + } + }, + + _templateDescription: function(options) { + if (options.description) { + var tmpl = options.description; + if (options.description_url) { + tmpl += ' (<a href="' + options.description_url + '" target="_blank">read more</a>)'; + } + return tmpl; + } else { + return 'There is no description available for this file extension.'; + } + }, + // // events triggered by collection // @@ -513,6 +603,9 @@ // remove from queue this.uploadbox.reset(); + + // reset value for universal type drop-down + this.select_extension.value(this.list_extensions[0]); // reset button this.ui_button.set('percentage', 0); @@ -606,7 +699,12 @@ // load html template _template: function(id, idInfo) { - return '<div id="' + id + '" class="upload-box">' + + return '<div id="uploadhead" class="uploadhead">' + + '<span class="fftext">"Set All" Types:  </span>' + + '<span id="extension" class="extension"/>  ' + + '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' + + '</div>' + + '<div id="' + id + '" class="upload-box">' + '<table id="upload-table" class="table table-striped" style="display: none;">' + '<thead>' + '<tr>' + @@ -622,7 +720,9 @@ '<tbody></tbody>' + '</table>' + '</div>' + - '<h6 id="' + idInfo + '" class="upload-info"></h6>'; + '<div class="uploadfoot">' + + '<h6 id="' + idInfo + '" class="upload-info"></h6>' + + '</div>' ; } }); https://bitbucket.org/galaxy/galaxy-central/commits/b73cb7a7cdca/ Changeset: b73cb7a7cdca User: dannon Date: 2015-01-23 16:10:17+00:00 Summary: Pack scripts Affected #: 4 files diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("updateUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("updateUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("updateUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("updateUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(d){var b=this;if(d&&d.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var c=0;for(key in d){this.add(d[key]);c+=d[key].size}this.$el.find("#upload-ftp-number").html(d.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(c,true));var e=this.$el.find("#selectAll");this._updateSelectAll(e);e.on("click",function(){var h=$(this).parents().find("tr.upload-ftp-row>td>div");var g=h.length;$this=$(this);var f=!($this.hasClass("fa-check-square-o"));for(i=0;i<g;i++){if(f){if(h.eq(i).hasClass("fa-square-o")){h.eq(i).trigger("updateUpBox")}}else{if(h.eq(i).hasClass("fa-check-square-o")){h.eq(i).trigger("updateUpBox")}}}b._updateSelectAll(e)})}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("updateUpBox",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}});e.on("click",function(){b.trigger("updateUpBox");var g=b.parents().find("#selectAll");d._updateSelectAll(g)})},_updateSelectAll:function(e){var d=e.parents().find("tr.upload-ftp-row>td>div");var f=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o");var c=d.length;var b=f.length;if(b>0&&b!==c){e.removeClass("fa-square-o fa-check-square-o");e.addClass("fa-minus-square-o")}else{if(b===c){e.removeClass("fa-square-o fa-minus-square-o");e.addClass("fa-check-square-o")}else{if(b===0){e.removeClass("fa-check-square-o fa-minus-square-o");e.addClass("fa-square-o")}}}},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-model.js --- a/static/scripts/packed/mvc/upload/upload-model.js +++ b/static/scripts/packed/mvc/upload/upload-model.js @@ -1,1 +1,1 @@ -define([],function(){var e=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:!1,to_posix_lines:!0}}),t=Backbone.Collection.extend({model:e});return{Model:e,Collection:t}}); \ No newline at end of file +define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:false,to_posix_lines:true}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}}); \ No newline at end of file diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-row.js --- a/static/scripts/packed/mvc/upload/upload-row.js +++ b/static/scripts/packed/mvc/upload/upload-row.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(e,t,n,r,i){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(e,n){this.app=e;var s="Auto-detect",o=this;this.model=new t.Model(n),this.setElement(this._template(n));var u=this.$el;this.settings=new r.View({title:"Upload configuration",container:u.find("#settings"),placement:"bottom"}),this.select_genome=new i.View({css:"genome",onchange:function(){o.model.set("genome",o.select_genome.value())},data:o.app.list_genomes,container:u.find("#genome"),value:o.model.get("genome")}),this.model.set("genome",o.select_genome.value()),this.app.select_extension.value()!=="---"&&(this.default_ext=this.app.select_extension.value()),this.select_extension=new i.View({css:"extension",onchange:function(){o.model.set("extension",o.select_extension.value());if(o.select_extension.value()!==e.select_extension.value()){var t="---";e.select_extension.value(t)}},data:o.app.list_extensions,container:u.find("#extension"),value:o.default_ext}),this.model.set("extension",o.select_extension.value()),u.find("#symbol").on("click",function(){o._removeRow()}),u.find("#extension-info").on("click",function(e){o._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()}),u.find("#settings").on("click",function(e){o._showSettings()}).on("mousedown",function(e){e.preventDefault()}),u.find("#text-content").on("keyup",function(e){o.model.set("url_paste",$(e.target).val()),o.model.set("file_size",$(e.target).val().length)}),u.find("#space_to_tabs").on("change",function(e){o.model.set("space_to_tabs",$(e.target).prop("checked"))}),this.model.on("change:percentage",function(){o._refreshPercentage()}),this.model.on("change:status",function(){o._refreshStatus()}),this.model.on("change:info",function(){o._refreshInfo()}),this.model.on("change:genome",function(){o._refreshGenome()}),this.model.on("change:file_size",function(){o._refreshFileSize()}),this.model.on("remove",function(){o.remove()}),this.app.collection.on("reset",function(){o.remove()}),o.model.set("row",o)},render:function(){var t=this.model.get("file_name"),n=this.model.get("file_size"),r=this.model.get("file_mode"),i=this.$el;i.find("#title").html(t),i.find("#size").html(e.bytesToString(n)),i.find("#mode").removeClass().addClass("mode");if(r=="new"){var s=i.find("#text"),o=this.options.padding,u=i.width()-2*o,a=i.height()-o;s.css("width",u+"px"),s.css("top",a+"px"),i.height(a+s.height()+2*o),s.show(),i.find("#mode").addClass("fa fa-pencil")}r=="local"&&i.find("#mode").addClass("fa fa-laptop"),r=="ftp"&&i.find("#mode").addClass("fa fa-code-fork")},remove:function(){this.select_genome.remove(),this.select_extension.remove(),Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var e=this.model.get("genome");this.select_genome.value(e)},_refreshInfo:function(){var e=this.model.get("info");e?this.$el.find("#info").html("<strong>Failed: </strong>"+e).show():this.$el.find("#info").hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:e+"%"}),e!=100?this.$el.find("#percentage").html(e+"%"):this.$el.find("#percentage").html("Adding to history...")},_refreshStatus:function(){var e=this.$el,t=this.model.get("status"),n=this.status_classes[t],r=this.$el.find("#symbol");r.removeClass(),r.addClass(n),t=="init"?(this.select_genome.enable(),this.select_extension.enable(),e.find("#text-content").attr("disabled",!1),e.find("#space_to_tabs").attr("disabled",!1)):(this.select_genome.disable(),this.select_extension.disable(),e.find("#text-content").attr("disabled",!0),e.find("#space_to_tabs").attr("disabled",!0)),t=="success"&&(e.addClass("success"),e.find("#percentage").html("100%")),t=="error"&&(e.addClass("danger"),e.find(".progress").remove())},_refreshFileSize:function(){var t=this.model.get("file_size");this.$el.find("#size").html(e.bytesToString(t))},_removeRow:function(){var e=this.model.get("status");(e=="init"||e=="success"||e=="error")&&this.app.collection.remove(this.model)},_showExtensionInfo:function(){var e=$(this.el).find("#extension-info"),t=this.model.get("extension"),n=this.select_extension.text(),i=_.findWhere(this.app.list_extensions,{id:t});this.extension_popup||(this.extension_popup=new r.View({placement:"bottom",container:e})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(n),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new n(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_template:function(e){return'<tr id="upload-item-'+e.id+'" class="upload-item">'+"<td>"+'<div style="position: relative;">'+'<div id="mode"></div>'+'<div id="title" class="title"></div>'+'<div id="text" class="text">'+'<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>'+'<textarea id="text-content" class="text-content form-control"></textarea>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="size" class="size"></div>'+"</td>"+"<td>"+'<div id="extension" class="extension" style="float: left;"/>  '+'<div id="extension-info" class="upload-icon-button fa fa-search"/>'+"</td>"+"<td>"+'<div id="genome" class="genome" />'+"</td>"+'<td><div id="settings" class="upload-icon-button fa fa-gear"></div>'+"<td>"+'<div id="info" class="info">'+'<div class="progress">'+'<div class="progress-bar progress-bar-success"></div>'+'<div id="percentage" class="percentage">0%</div>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="symbol" class="'+this.status_classes.init+'"></div>'+"</td>"+"</tr>"}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(j,h){this.app=j;var g="Auto-detect";var f=this;this.model=new b.Model(h);this.setElement(this._template(h));var i=this.$el;this.settings=new c.View({title:"Upload configuration",container:i.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){f.model.set("genome",f.select_genome.value())},data:f.app.list_genomes,container:i.find("#genome"),value:f.model.get("genome")});this.model.set("genome",f.select_genome.value());if(!(this.app.select_extension.value()==="---")){this.default_ext=this.app.select_extension.value()}this.select_extension=new e.View({css:"extension",onchange:function(){f.model.set("extension",f.select_extension.value());if(!(f.select_extension.value()===j.select_extension.value())){var k="---";j.select_extension.value(k)}},data:f.app.list_extensions,container:i.find("#extension"),value:f.default_ext});this.model.set("extension",f.select_extension.value());i.find("#symbol").on("click",function(){f._removeRow()});i.find("#extension-info").on("click",function(k){f._showExtensionInfo()}).on("mousedown",function(k){k.preventDefault()});i.find("#settings").on("click",function(k){f._showSettings()}).on("mousedown",function(k){k.preventDefault()});i.find("#text-content").on("keyup",function(k){f.model.set("url_paste",$(k.target).val());f.model.set("file_size",$(k.target).val().length)});i.find("#space_to_tabs").on("change",function(k){f.model.set("space_to_tabs",$(k.target).prop("checked"))});this.model.on("change:percentage",function(){f._refreshPercentage()});this.model.on("change:status",function(){f._refreshStatus()});this.model.on("change:info",function(){f._refreshInfo()});this.model.on("change:genome",function(){f._refreshGenome()});this.model.on("change:file_size",function(){f._refreshFileSize()});this.model.on("remove",function(){f.remove()});this.app.collection.on("reset",function(){f.remove()});f.model.set("row",f)},render:function(){var m=this.model.get("file_name");var g=this.model.get("file_size");var j=this.model.get("file_mode");var i=this.$el;i.find("#title").html(m);i.find("#size").html(d.bytesToString(g));i.find("#mode").removeClass().addClass("mode");if(j=="new"){var l=i.find("#text");var k=this.options.padding;var h=i.width()-2*k;var f=i.height()-k;l.css("width",h+"px");l.css("top",f+"px");i.height(f+l.height()+2*k);l.show();i.find("#mode").addClass("fa fa-pencil")}if(j=="local"){i.find("#mode").addClass("fa fa-laptop")}if(j=="ftp"){i.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var f=this.model.get("genome");this.select_genome.value(f)},_refreshInfo:function(){var f=this.model.get("info");if(f){this.$el.find("#info").html("<strong>Failed: </strong>"+f).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var f=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:f+"%"});if(f!=100){this.$el.find("#percentage").html(f+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var g=this.$el;var f=this.model.get("status");var i=this.status_classes[f];var h=this.$el.find("#symbol");h.removeClass();h.addClass(i);if(f=="init"){this.select_genome.enable();this.select_extension.enable();g.find("#text-content").attr("disabled",false);g.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();g.find("#text-content").attr("disabled",true);g.find("#space_to_tabs").attr("disabled",true)}if(f=="success"){g.addClass("success");g.find("#percentage").html("100%")}if(f=="error"){g.addClass("danger");g.find(".progress").remove()}},_refreshFileSize:function(){var f=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(f))},_removeRow:function(){var f=this.model.get("status");if(f=="init"||f=="success"||f=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var f=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();var g=_.findWhere(this.app.list_extensions,{id:i});if(!this.extension_popup){this.extension_popup=new c.View({placement:"bottom",container:f})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(g));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(g){if(g.description){var f=g.description;if(g.description_url){f+=' (<a href="'+g.description_url+'" target="_blank">read more</a>)'}return f}else{return"There is no description available for this file extension."}},_template:function(f){return'<tr id="upload-item-'+f.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})}); \ No newline at end of file diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-view.js --- a/static/scripts/packed/mvc/upload/upload-view.js +++ b/static/scripts/packed/mvc/upload/upload-view.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","utils/uploadbox"],function(f,e,c,b,g,d,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(i){this.options=_.defaults(i,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){j.preventDefault();h.show()}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var h=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(j){for(key in j){h.list_extensions.push({id:j[key].extension,text:j[key].extension,description:j[key].description,description_url:j[key].description_url})}h.list_extensions.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0});if(!h.options.datatypes_disable_auto){h.list_extensions.unshift(h.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})}});this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},show:function(){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.show()},500);return}if(!this.modal){var h=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Paste/Fetch data":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(j,k,l){h._eventAnnounce(j,k,l)},initialize:function(j,k,l){return h._eventInitialize(j,k,l)},progress:function(j,k,l){h._eventProgress(j,k,l)},success:function(j,k,l){h._eventSuccess(j,k,l)},error:function(j,k,l){h._eventError(j,k,l)},complete:function(){h._eventComplete()}});var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}this.modal.show();this._updateUser();this._updateScreen()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=l&&"Yes"||null;tool_input["files_0|to_posix_lines"]=i&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(f,e,c,b,g,d,a,h){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(k){var j=this;if(k){this.options=_.defaults(k,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(l){if(l){l.preventDefault();j.show()}},onunload:function(){if(j.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var j=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(l){for(key in l){j.list_extensions.push({id:l[key].extension,text:l[key].extension,description:l[key].description,description_url:l[key].description_url})}j.list_extensions.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0});j.list_extensions.push({id:"---",text:"---",description:"",description_url:""});if(!j.options.datatypes_disable_auto){j.list_extensions.unshift(j.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(l){for(key in l){j.list_genomes.push({id:l[key][1],text:l[key][0]})}j.list_genomes.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0})}});this.collection.on("remove",function(l){j._eventRemove(l)});this.collection.on("change:genome",function(m){var l=m.get("genome");j.collection.each(function(n){if(n.get("status")=="init"&&n.get("genome")=="?"){n.set("genome",l)}})})},show:function(){var j=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){j.show()},500);return}if(!this.modal){var j=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){j.uploadbox.select()},"Choose FTP file":function(){j._eventFtp()},"Paste/Fetch data":function(){j._eventCreate()},Start:function(){j._eventStart()},Pause:function(){j._eventStop()},Reset:function(){j._eventReset()},Close:function(){j.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var j=this;this.uploadbox=this.$el.uploadbox({announce:function(l,m,n){j._eventAnnounce(l,m,n)},initialize:function(l,m,n){return j._eventInitialize(l,m,n)},progress:function(l,m,n){j._eventProgress(l,m,n)},success:function(l,m,n){j._eventSuccess(l,m,n)},error:function(l,m,n){j._eventError(l,m,n)},complete:function(){j._eventComplete()}});var k=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:k});this.select_extension=new h.View({css:"extension",onchange:function(){var m=j.select_extension.value();var l=j.collection.models.length;if(!(m==="---")){for(i=0;i<l;i++){j.collection.models[i].attributes.row.select_extension.value(m)}}},data:j.list_extensions,container:j.$el.parents().find("#extension"),value:j.list_extensions[0]});j.$el.parents().find("#extension-info_out").on("click",function(l){j._showExtensionInfo()}).on("mousedown",function(l){l.preventDefault()})}this.modal.show();this._updateUser();this._updateScreen()},_showExtensionInfo:function(){var j=this;var k=$(this.el).parents().find("#extension-info_out");var n=j.select_extension.value();var m=this.select_extension.text();var l=_.findWhere(j.list_extensions,{id:n});if(!this.extension_popup){this.extension_popup=new d.View({placement:"bottom",container:k})}if(!this.extension_popup.visible){this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new UploadSettings(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(k){if(k.description){var j=k.description;if(k.description_url){j+=' (<a href="'+k.description_url+'" target="_blank">read more</a>)'}return j}else{return"There is no description available for this file extension."}},_eventRemove:function(k){var j=k.get("status");if(j=="success"){this.counter.success--}else{if(j=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(k.id)},_eventAnnounce:function(j,k,m){this.counter.announce++;this._updateScreen();var l=new b(this,{id:j,file_name:k.name,file_size:k.size,file_mode:k.mode,file_path:k.path});this.collection.add(l.model);$(this.el).find("tbody:first").append(l.$el);l.render()},_eventInitialize:function(o,l,u){var m=this.collection.get(o);m.set("status","running");var q=m.get("file_name");var p=m.get("file_path");var j=m.get("file_mode");var r=m.get("extension");var t=m.get("genome");var s=m.get("url_paste");var n=m.get("space_to_tabs");var k=m.get("to_posix_lines");if(!s&&!(l.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(j=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(j=="new"){tool_input["files_0|url_paste"]=s}if(j=="ftp"){tool_input["files_0|ftp_files"]=p}tool_input.dbkey=t;tool_input.file_type=r;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=n&&"Yes"||null;tool_input["files_0|to_posix_lines"]=k&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(k,l,j){var m=this.collection.get(k);m.set("percentage",j);this.ui_button.set("percentage",this._upload_percentage(j,l.size))},_eventSuccess:function(k,l,n){var m=this.collection.get(k);m.set("percentage",100);m.set("status","success");var j=m.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,j));this.upload_completed+=j*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","error");l.set("info",m);this.ui_button.set("percentage",this._upload_percentage(100,k.size));this.ui_button.set("status","danger");this.upload_completed+=k.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(j){if(j.get("status")=="queued"){j.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var j=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(k){if(k.get("status")=="init"){k.set("status","queued");j.upload_size+=k.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.select_extension.value(this.list_extensions[0]);this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(j,k){return(this.upload_completed+(j*k))/this.upload_size},_template:function(k,j){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+k+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><div class="uploadfoot"><h6 id="'+j+'" class="upload-info"></h6></div>'}})}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/4da8605f69c8/ Changeset: 4da8605f69c8 Branch: upload-UI-enhancement User: dannon Date: 2015-01-23 16:12:35+00:00 Summary: Branch prune. Affected #: 0 files Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.