2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/48fc9b40fda9/ Changeset: 48fc9b40fda9 User: martenson Date: 2014-09-17 04:06:28+00:00 Summary: with John's help - this includes changed wording in user messages & errors to be more formal / no smilies :( / Affected #: 27 files diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/galaxy.library.js --- a/client/galaxy/scripts/galaxy.library.js +++ b/client/galaxy/scripts/galaxy.library.js @@ -107,7 +107,7 @@ this.library_router.on('route:download', function(folder_id, format) { if ($('#folder_list_body').find(':checked').length === 0) { - mod_toastr.info('You have to select some datasets to download'); + mod_toastr.info( 'You must select at least one dataset to download' ); Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: true, replace: true}); } else { Galaxy.libraries.folderToolbarView.download(folder_id, format); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-dataset-view.js --- a/client/galaxy/scripts/mvc/library/library-dataset-view.js +++ b/client/galaxy/scripts/mvc/library/library-dataset-view.js @@ -61,7 +61,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); @@ -93,7 +93,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -136,7 +136,7 @@ $('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') .appendTo('body').submit().remove(); - mod_toastr.info('Your download will begin soon'); + mod_toastr.info('Your download will begin soon.'); } }, @@ -171,7 +171,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -197,7 +197,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error('Dataset not imported. ' + response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured! Dataset not imported. Please try again.'); + mod_toastr.error('An error occured. Dataset not imported. Please try again.'); } } }); @@ -235,7 +235,7 @@ $.get( "/api/libraries/datasets/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { self.prepareSelectBoxes({fetched_permissions:fetched_permissions, is_admin:is_admin}); }).fail(function(){ - mod_toastr.error('An error occurred while fetching dataset permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch dataset permissions.'); }); } else { this.prepareSelectBoxes({is_admin:is_admin}); @@ -417,13 +417,13 @@ $('.access_perm').html(template({options:data.roles})); self.accessSelectObject = $('#access_select').select2(); }).fail(function() { - mod_toastr.error('An error occurred while fetching data with permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch dataset permissions.'); }); } }, comingSoon: function(){ - mod_toastr.warning('Feature coming soon'); + mod_toastr.warning('Feature coming soon.'); }, copyToClipboard: function(){ @@ -439,9 +439,9 @@ $.post("/api/libraries/datasets/" + self.id + "/permissions?action=make_private").done(function(fetched_permissions) { self.model.set({is_unrestricted:false}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('The dataset is now private to you'); + mod_toastr.success('The dataset is now private to you.'); }).fail(function(){ - mod_toastr.error('An error occurred while making dataset private :('); + mod_toastr.error('An error occurred while attempting to make dataset private.'); }); }, @@ -451,10 +451,10 @@ .done(function(fetched_permissions) { self.model.set({is_unrestricted:true}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Access to this dataset is now unrestricted'); + mod_toastr.success('Access to this dataset is now unrestricted.'); }) .fail(function(){ - mod_toastr.error('An error occurred while making dataset unrestricted :('); + mod_toastr.error('An error occurred while attempting to make dataset unrestricted.'); }); }, @@ -482,10 +482,10 @@ .done(function(fetched_permissions){ //fetch dataset again self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Permissions saved'); + mod_toastr.success('Permissions saved.'); }) .fail(function(){ - mod_toastr.error('An error occurred while setting dataset permissions :('); + mod_toastr.error('An error occurred while attempting to set dataset permissions.'); }) }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-folder-view.js --- a/client/galaxy/scripts/mvc/library/library-folder-view.js +++ b/client/galaxy/scripts/mvc/library/library-folder-view.js @@ -45,7 +45,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); @@ -84,7 +84,7 @@ $.get( "/api/folders/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { self.prepareSelectBoxes({fetched_permissions:fetched_permissions}); }).fail(function(){ - mod_toastr.error('An error occurred while fetching folder permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch folder permissions.'); }); } else { this.prepareSelectBoxes({}); @@ -170,7 +170,7 @@ }, comingSoon: function(){ - mod_toastr.warning('Feature coming soon'); + mod_toastr.warning('Feature coming soon.'); }, copyToClipboard: function(){ @@ -199,10 +199,10 @@ .done(function(fetched_permissions){ //fetch dataset again self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Permissions saved'); + mod_toastr.success('Permissions saved.'); }) .fail(function(){ - mod_toastr.error('An error occurred while setting folder permissions :('); + mod_toastr.error('An error occurred while attempting to set folder permissions.'); }) }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-folderlist-view.js --- a/client/galaxy/scripts/mvc/library/library-folderlist-view.js +++ b/client/galaxy/scripts/mvc/library/library-folderlist-view.js @@ -79,7 +79,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js --- a/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js +++ b/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js @@ -124,7 +124,7 @@ folder.save(folderDetails, { success: function (folder) { Galaxy.modal.hide(); - mod_toastr.success('Folder created'); + mod_toastr.success('Folder created.'); folder.set({'type' : 'folder'}); Galaxy.libraries.folderListView.collection.add(folder); }, @@ -133,12 +133,12 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); } else { - mod_toastr.error('Folder\'s name is missing'); + mod_toastr.error('Folder\'s name is missing.'); } return false; }, @@ -161,7 +161,7 @@ modalBulkImport : function(){ var checkedValues = $('#folder_table').find(':checked'); if(checkedValues.length === 0){ - mod_toastr.info('You have to select some datasets first'); + mod_toastr.info('You must select some datasets first.'); } else { this.refreshUserHistoriesList(function(that){ var template = that.templateBulkImportInModal(); @@ -190,7 +190,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -275,9 +275,9 @@ // send request $('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') .appendTo( 'body' ).submit().remove(); - mod_toastr.info( 'Your download will begin soon' ); + mod_toastr.info( 'Your download will begin soon.' ); } else { - mod_toastr.error( 'An error occurred :(' ); + mod_toastr.error( 'An error occurred.' ); } }, @@ -306,7 +306,7 @@ self.fetchAndDisplayHistoryContents(event.target.value); }); } else { - mod_toastr.error( 'An error ocurred :(' ); + mod_toastr.error( 'An error ocurred.' ); } }); }, @@ -417,7 +417,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }) @@ -434,7 +434,7 @@ var paths = $('textarea#import_paths').val(); var valid_paths = []; if (!paths){ - mod_toastr.info('Please enter a path relative to Galaxy root'); + mod_toastr.info('Please enter a path relative to Galaxy root.'); } else { this.modal.disableButton('Import'); paths = paths.split('\n'); @@ -497,7 +497,7 @@ var selection_type = selected_nodes[0].type; var paths = []; if ( selected_nodes.length < 1 ){ - mod_toastr.info( 'You have to select some items first' ); + mod_toastr.info( 'You must select some items first.' ); } else { this.modal.disableButton( 'Import' ); for ( var i = selected_nodes.length - 1; i >= 0; i-- ){ @@ -527,7 +527,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -541,7 +541,7 @@ var history_dataset_ids = []; var hdas_to_add = []; if ( checked_hdas.length < 1 ){ - mod_toastr.info( 'You have to select some datasets first' ); + mod_toastr.info( 'You must select some datasets first.' ); } else { this.modal.disableButton( 'Add' ); checked_hdas.each(function(){ @@ -608,7 +608,7 @@ mod_toastr.success( 'Selected files imported into the current folder' ); Galaxy.modal.hide(); } else { - mod_toastr.error( 'Something went wrong :(' ); + mod_toastr.error( 'An error occured.' ); } return true; } @@ -641,11 +641,11 @@ var popped_item = paths.pop(); if (typeof popped_item == "undefined") { if (this.options.chain_call_control.failed_number === 0){ - mod_toastr.success('Selected folders and their contents imported into the current folder'); + mod_toastr.success('Selected folders and their contents imported into the current folder.'); Galaxy.modal.hide(); } else { // TODO better error report - mod_toastr.error('Something went wrong :('); + mod_toastr.error('An error occured.'); } return true; } @@ -755,7 +755,7 @@ deleteSelectedDatasets: function(){ var checkedValues = $('#folder_table').find(':checked'); if(checkedValues.length === 0){ - mod_toastr.info('You have to select some datasets first'); + mod_toastr.info('You must select at least one dataset for deletion.'); } else { var template = this.templateDeletingDatasetsProgressBar(); this.modal = Galaxy.modal; @@ -812,7 +812,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }) diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-library-view.js --- a/client/galaxy/scripts/mvc/library/library-library-view.js +++ b/client/galaxy/scripts/mvc/library/library-library-view.js @@ -45,7 +45,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); @@ -90,7 +90,7 @@ $.get( "/api/libraries/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { self.prepareSelectBoxes({fetched_permissions:fetched_permissions}); }).fail(function(){ - mod_toastr.error('An error occurred while fetching library permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch library permissions.'); }); } else { this.prepareSelectBoxes({}); @@ -180,7 +180,7 @@ }, comingSoon: function(){ - mod_toastr.warning('Feature coming soon'); + mod_toastr.warning('Feature coming soon.'); }, copyToClipboard: function(){ @@ -196,9 +196,9 @@ $.post("/api/libraries/datasets/" + self.id + "/permissions?action=make_private").done(function(fetched_permissions) { self.model.set({is_unrestricted:false}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('The dataset is now private to you'); + mod_toastr.success('The dataset is now private to you.'); }).fail(function(){ - mod_toastr.error('An error occurred while making dataset private :('); + mod_toastr.error('An error occurred while attempting to make dataset private.'); }); }, @@ -208,10 +208,10 @@ .done(function(fetched_permissions) { self.model.set({is_unrestricted:true}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Access to this dataset is now unrestricted'); + mod_toastr.success('Access to this dataset is now unrestricted.'); }) .fail(function(){ - mod_toastr.error('An error occurred while making dataset unrestricted :('); + mod_toastr.error('An error occurred while attempting to make dataset unrestricted.'); }); }, @@ -234,10 +234,10 @@ .done(function(fetched_permissions){ //fetch dataset again self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Permissions saved'); + mod_toastr.success('Permissions saved.'); }) .fail(function(){ - mod_toastr.error('An error occurred while setting library permissions :('); + mod_toastr.error('An error occurred while attempting to set library permissions.'); }) }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-librarylist-view.js --- a/client/galaxy/scripts/mvc/library/library-librarylist-view.js +++ b/client/galaxy/scripts/mvc/library/library-librarylist-view.js @@ -40,7 +40,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-libraryrow-view.js --- a/client/galaxy/scripts/mvc/library/library-libraryrow-view.js +++ b/client/galaxy/scripts/mvc/library/library-libraryrow-view.js @@ -126,7 +126,7 @@ library.set("name", new_name); is_changed = true; } else{ - mod_toastr.warning('Library name has to be at least 3 characters long'); + mod_toastr.warning('Library name has to be at least 3 characters long.'); return; } } @@ -150,20 +150,20 @@ success: function(library) { row_view.edit_mode = false; row_view.repaint(library); - mod_toastr.success('Changes to library saved'); + mod_toastr.success('Changes to library saved.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured during updating the library :('); + mod_toastr.error('An error occured while attempting to update the library.'); } } }); } else { this.edit_mode = false; this.repaint(library); - mod_toastr.info('Nothing has changed'); + mod_toastr.info('Nothing has changed.'); } }, @@ -184,13 +184,13 @@ } else if (Galaxy.libraries.preferences.get('with_deleted') === true){ row_view.repaint(library); } - mod_toastr.success('Library has been marked deleted'); + mod_toastr.success('Library has been marked deleted.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured during deleting the library :('); + mod_toastr.error('An error occured during deleting the library.'); } } }); @@ -210,13 +210,13 @@ Galaxy.libraries.libraryListView.collection.add(library); row_view.edit_mode = false; row_view.repaint(library); - mod_toastr.success('Library has been undeleted'); + mod_toastr.success('Library has been undeleted.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured while undeleting the library :('); + mod_toastr.error('An error occured while undeleting the library.'); } } }); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js --- a/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js +++ b/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js @@ -62,18 +62,18 @@ self.modal.hide(); self.clear_library_modal(); Galaxy.libraries.libraryListView.render(); - mod_toastr.success('Library created'); + mod_toastr.success('Library created.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured :('); + mod_toastr.error('An error occured.'); } } }); } else { - mod_toastr.error('Library\'s name is missing'); + mod_toastr.error('Library\'s name is missing.'); } return false; }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/galaxy.library.js --- a/static/scripts/galaxy.library.js +++ b/static/scripts/galaxy.library.js @@ -107,7 +107,7 @@ this.library_router.on('route:download', function(folder_id, format) { if ($('#folder_list_body').find(':checked').length === 0) { - mod_toastr.info('You have to select some datasets to download'); + mod_toastr.info( 'You must select at least one dataset to download' ); Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: true, replace: true}); } else { Galaxy.libraries.folderToolbarView.download(folder_id, format); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-dataset-view.js --- a/static/scripts/mvc/library/library-dataset-view.js +++ b/static/scripts/mvc/library/library-dataset-view.js @@ -61,7 +61,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); @@ -93,7 +93,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -136,7 +136,7 @@ $('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') .appendTo('body').submit().remove(); - mod_toastr.info('Your download will begin soon'); + mod_toastr.info('Your download will begin soon.'); } }, @@ -171,7 +171,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -197,7 +197,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error('Dataset not imported. ' + response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured! Dataset not imported. Please try again.'); + mod_toastr.error('An error occured. Dataset not imported. Please try again.'); } } }); @@ -235,7 +235,7 @@ $.get( "/api/libraries/datasets/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { self.prepareSelectBoxes({fetched_permissions:fetched_permissions, is_admin:is_admin}); }).fail(function(){ - mod_toastr.error('An error occurred while fetching dataset permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch dataset permissions.'); }); } else { this.prepareSelectBoxes({is_admin:is_admin}); @@ -417,13 +417,13 @@ $('.access_perm').html(template({options:data.roles})); self.accessSelectObject = $('#access_select').select2(); }).fail(function() { - mod_toastr.error('An error occurred while fetching data with permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch dataset permissions.'); }); } }, comingSoon: function(){ - mod_toastr.warning('Feature coming soon'); + mod_toastr.warning('Feature coming soon.'); }, copyToClipboard: function(){ @@ -439,9 +439,9 @@ $.post("/api/libraries/datasets/" + self.id + "/permissions?action=make_private").done(function(fetched_permissions) { self.model.set({is_unrestricted:false}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('The dataset is now private to you'); + mod_toastr.success('The dataset is now private to you.'); }).fail(function(){ - mod_toastr.error('An error occurred while making dataset private :('); + mod_toastr.error('An error occurred while attempting to make dataset private.'); }); }, @@ -451,10 +451,10 @@ .done(function(fetched_permissions) { self.model.set({is_unrestricted:true}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Access to this dataset is now unrestricted'); + mod_toastr.success('Access to this dataset is now unrestricted.'); }) .fail(function(){ - mod_toastr.error('An error occurred while making dataset unrestricted :('); + mod_toastr.error('An error occurred while attempting to make dataset unrestricted.'); }); }, @@ -482,10 +482,10 @@ .done(function(fetched_permissions){ //fetch dataset again self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Permissions saved'); + mod_toastr.success('Permissions saved.'); }) .fail(function(){ - mod_toastr.error('An error occurred while setting dataset permissions :('); + mod_toastr.error('An error occurred while attempting to set dataset permissions.'); }) }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-folder-view.js --- a/static/scripts/mvc/library/library-folder-view.js +++ b/static/scripts/mvc/library/library-folder-view.js @@ -45,7 +45,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); @@ -84,7 +84,7 @@ $.get( "/api/folders/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { self.prepareSelectBoxes({fetched_permissions:fetched_permissions}); }).fail(function(){ - mod_toastr.error('An error occurred while fetching folder permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch folder permissions.'); }); } else { this.prepareSelectBoxes({}); @@ -170,7 +170,7 @@ }, comingSoon: function(){ - mod_toastr.warning('Feature coming soon'); + mod_toastr.warning('Feature coming soon.'); }, copyToClipboard: function(){ @@ -199,10 +199,10 @@ .done(function(fetched_permissions){ //fetch dataset again self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Permissions saved'); + mod_toastr.success('Permissions saved.'); }) .fail(function(){ - mod_toastr.error('An error occurred while setting folder permissions :('); + mod_toastr.error('An error occurred while attempting to set folder permissions.'); }) }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-folderlist-view.js --- a/static/scripts/mvc/library/library-folderlist-view.js +++ b/static/scripts/mvc/library/library-folderlist-view.js @@ -79,7 +79,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-foldertoolbar-view.js --- a/static/scripts/mvc/library/library-foldertoolbar-view.js +++ b/static/scripts/mvc/library/library-foldertoolbar-view.js @@ -124,7 +124,7 @@ folder.save(folderDetails, { success: function (folder) { Galaxy.modal.hide(); - mod_toastr.success('Folder created'); + mod_toastr.success('Folder created.'); folder.set({'type' : 'folder'}); Galaxy.libraries.folderListView.collection.add(folder); }, @@ -133,12 +133,12 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); } else { - mod_toastr.error('Folder\'s name is missing'); + mod_toastr.error('Folder\'s name is missing.'); } return false; }, @@ -161,7 +161,7 @@ modalBulkImport : function(){ var checkedValues = $('#folder_table').find(':checked'); if(checkedValues.length === 0){ - mod_toastr.info('You have to select some datasets first'); + mod_toastr.info('You must select some datasets first.'); } else { this.refreshUserHistoriesList(function(that){ var template = that.templateBulkImportInModal(); @@ -190,7 +190,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -275,9 +275,9 @@ // send request $('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') .appendTo( 'body' ).submit().remove(); - mod_toastr.info( 'Your download will begin soon' ); + mod_toastr.info( 'Your download will begin soon.' ); } else { - mod_toastr.error( 'An error occurred :(' ); + mod_toastr.error( 'An error occurred.' ); } }, @@ -306,7 +306,7 @@ self.fetchAndDisplayHistoryContents(event.target.value); }); } else { - mod_toastr.error( 'An error ocurred :(' ); + mod_toastr.error( 'An error ocurred.' ); } }); }, @@ -417,7 +417,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }) @@ -434,7 +434,7 @@ var paths = $('textarea#import_paths').val(); var valid_paths = []; if (!paths){ - mod_toastr.info('Please enter a path relative to Galaxy root'); + mod_toastr.info('Please enter a path relative to Galaxy root.'); } else { this.modal.disableButton('Import'); paths = paths.split('\n'); @@ -497,7 +497,7 @@ var selection_type = selected_nodes[0].type; var paths = []; if ( selected_nodes.length < 1 ){ - mod_toastr.info( 'You have to select some items first' ); + mod_toastr.info( 'You must select some items first.' ); } else { this.modal.disableButton( 'Import' ); for ( var i = selected_nodes.length - 1; i >= 0; i-- ){ @@ -527,7 +527,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); @@ -541,7 +541,7 @@ var history_dataset_ids = []; var hdas_to_add = []; if ( checked_hdas.length < 1 ){ - mod_toastr.info( 'You have to select some datasets first' ); + mod_toastr.info( 'You must select some datasets first.' ); } else { this.modal.disableButton( 'Add' ); checked_hdas.each(function(){ @@ -608,7 +608,7 @@ mod_toastr.success( 'Selected files imported into the current folder' ); Galaxy.modal.hide(); } else { - mod_toastr.error( 'Something went wrong :(' ); + mod_toastr.error( 'An error occured.' ); } return true; } @@ -641,11 +641,11 @@ var popped_item = paths.pop(); if (typeof popped_item == "undefined") { if (this.options.chain_call_control.failed_number === 0){ - mod_toastr.success('Selected folders and their contents imported into the current folder'); + mod_toastr.success('Selected folders and their contents imported into the current folder.'); Galaxy.modal.hide(); } else { // TODO better error report - mod_toastr.error('Something went wrong :('); + mod_toastr.error('An error occured.'); } return true; } @@ -755,7 +755,7 @@ deleteSelectedDatasets: function(){ var checkedValues = $('#folder_table').find(':checked'); if(checkedValues.length === 0){ - mod_toastr.info('You have to select some datasets first'); + mod_toastr.info('You must select at least one dataset for deletion.'); } else { var template = this.templateDeletingDatasetsProgressBar(); this.modal = Galaxy.modal; @@ -812,7 +812,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }) diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-library-view.js --- a/static/scripts/mvc/library/library-library-view.js +++ b/static/scripts/mvc/library/library-library-view.js @@ -45,7 +45,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg + ' Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } else { - mod_toastr.error('An error ocurred :(. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); + mod_toastr.error('An error ocurred. Click this to go back.', '', {onclick: function() {Galaxy.libraries.library_router.back();}}); } } }); @@ -90,7 +90,7 @@ $.get( "/api/libraries/" + self.id + "/permissions?scope=current").done(function(fetched_permissions) { self.prepareSelectBoxes({fetched_permissions:fetched_permissions}); }).fail(function(){ - mod_toastr.error('An error occurred while fetching library permissions. :('); + mod_toastr.error('An error occurred while attempting to fetch library permissions.'); }); } else { this.prepareSelectBoxes({}); @@ -180,7 +180,7 @@ }, comingSoon: function(){ - mod_toastr.warning('Feature coming soon'); + mod_toastr.warning('Feature coming soon.'); }, copyToClipboard: function(){ @@ -196,9 +196,9 @@ $.post("/api/libraries/datasets/" + self.id + "/permissions?action=make_private").done(function(fetched_permissions) { self.model.set({is_unrestricted:false}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('The dataset is now private to you'); + mod_toastr.success('The dataset is now private to you.'); }).fail(function(){ - mod_toastr.error('An error occurred while making dataset private :('); + mod_toastr.error('An error occurred while attempting to make dataset private.'); }); }, @@ -208,10 +208,10 @@ .done(function(fetched_permissions) { self.model.set({is_unrestricted:true}); self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Access to this dataset is now unrestricted'); + mod_toastr.success('Access to this dataset is now unrestricted.'); }) .fail(function(){ - mod_toastr.error('An error occurred while making dataset unrestricted :('); + mod_toastr.error('An error occurred while attempting to make dataset unrestricted.'); }); }, @@ -234,10 +234,10 @@ .done(function(fetched_permissions){ //fetch dataset again self.showPermissions({fetched_permissions:fetched_permissions}) - mod_toastr.success('Permissions saved'); + mod_toastr.success('Permissions saved.'); }) .fail(function(){ - mod_toastr.error('An error occurred while setting library permissions :('); + mod_toastr.error('An error occurred while attempting to set library permissions.'); }) }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-librarylist-view.js --- a/static/scripts/mvc/library/library-librarylist-view.js +++ b/static/scripts/mvc/library/library-librarylist-view.js @@ -40,7 +40,7 @@ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error ocurred :('); + mod_toastr.error('An error ocurred.'); } } }); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-libraryrow-view.js --- a/static/scripts/mvc/library/library-libraryrow-view.js +++ b/static/scripts/mvc/library/library-libraryrow-view.js @@ -126,7 +126,7 @@ library.set("name", new_name); is_changed = true; } else{ - mod_toastr.warning('Library name has to be at least 3 characters long'); + mod_toastr.warning('Library name has to be at least 3 characters long.'); return; } } @@ -150,20 +150,20 @@ success: function(library) { row_view.edit_mode = false; row_view.repaint(library); - mod_toastr.success('Changes to library saved'); + mod_toastr.success('Changes to library saved.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured during updating the library :('); + mod_toastr.error('An error occured while attempting to update the library.'); } } }); } else { this.edit_mode = false; this.repaint(library); - mod_toastr.info('Nothing has changed'); + mod_toastr.info('Nothing has changed.'); } }, @@ -184,13 +184,13 @@ } else if (Galaxy.libraries.preferences.get('with_deleted') === true){ row_view.repaint(library); } - mod_toastr.success('Library has been marked deleted'); + mod_toastr.success('Library has been marked deleted.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured during deleting the library :('); + mod_toastr.error('An error occured during deleting the library.'); } } }); @@ -210,13 +210,13 @@ Galaxy.libraries.libraryListView.collection.add(library); row_view.edit_mode = false; row_view.repaint(library); - mod_toastr.success('Library has been undeleted'); + mod_toastr.success('Library has been undeleted.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured while undeleting the library :('); + mod_toastr.error('An error occured while undeleting the library.'); } } }); diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/mvc/library/library-librarytoolbar-view.js --- a/static/scripts/mvc/library/library-librarytoolbar-view.js +++ b/static/scripts/mvc/library/library-librarytoolbar-view.js @@ -62,18 +62,18 @@ self.modal.hide(); self.clear_library_modal(); Galaxy.libraries.libraryListView.render(); - mod_toastr.success('Library created'); + mod_toastr.success('Library created.'); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ mod_toastr.error(response.responseJSON.err_msg); } else { - mod_toastr.error('An error occured :('); + mod_toastr.error('An error occured.'); } } }); } else { - mod_toastr.error('Library\'s name is missing'); + mod_toastr.error('Library\'s name is missing.'); } return false; }, diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/galaxy.library.js --- a/static/scripts/packed/galaxy.library.js +++ b/static/scripts/packed/galaxy.library.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/base-mvc","mvc/library/library-model","mvc/library/library-folderlist-view","mvc/library/library-librarylist-view","mvc/library/library-librarytoolbar-view","mvc/library/library-foldertoolbar-view","mvc/library/library-dataset-view","mvc/library/library-library-view","mvc/library/library-folder-view"],function(h,e,j,n,k,c,i,g,l,f,b,a){var o=Backbone.Router.extend({initialize:function(){this.routesHit=0;Backbone.history.on("route",function(){this.routesHit++},this)},routes:{"":"libraries","library/:library_id/permissions":"library_permissions","folders/:folder_id/permissions":"folder_permissions","folders/:id":"folder_content","folders/:folder_id/datasets/:dataset_id":"dataset_detail","folders/:folder_id/datasets/:dataset_id/permissions":"dataset_permissions","folders/:folder_id/datasets/:dataset_id/versions/:ldda_id":"dataset_version","folders/:folder_id/download/:format":"download","folders/:folder_id/import/:source":"import_datasets"},back:function(){if(this.routesHit>1){window.history.back()}else{this.navigate("#",{trigger:true,replace:true})}}});var m=n.SessionStorageModel.extend({defaults:{with_deleted:false,sort_order:"asc",sort_by:"name"}});var d=Backbone.View.extend({libraryToolbarView:null,libraryListView:null,library_router:null,libraryView:null,folderToolbarView:null,folderListView:null,datasetView:null,initialize:function(){Galaxy.libraries=this;this.preferences=new m({id:"global-lib-prefs"});this.library_router=new o();this.library_router.on("route:libraries",function(){Galaxy.libraries.libraryToolbarView=new g.LibraryToolbarView();Galaxy.libraries.libraryListView=new i.LibraryListView()});this.library_router.on("route:folder_content",function(p){if(Galaxy.libraries.folderToolbarView){Galaxy.libraries.folderToolbarView.$el.unbind("click")}Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p})});this.library_router.on("route:download",function(p,q){if($("#folder_list_body").find(":checked").length===0){j.info("You have to select some datasets to download");Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:true,replace:true})}else{Galaxy.libraries.folderToolbarView.download(p,q);Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:false,replace:true})}});this.library_router.on("route:dataset_detail",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p})});this.library_router.on("route:dataset_version",function(q,p,r){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,ldda_id:r,show_version:true})});this.library_router.on("route:dataset_permissions",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,show_permissions:true})});this.library_router.on("route:library_permissions",function(p){if(Galaxy.libraries.libraryView){Galaxy.libraries.libraryView.$el.unbind("click")}Galaxy.libraries.libraryView=new b.LibraryView({id:p,show_permissions:true})});this.library_router.on("route:folder_permissions",function(p){if(Galaxy.libraries.folderView){Galaxy.libraries.folderView.$el.unbind("click")}Galaxy.libraries.folderView=new a.FolderView({id:p,show_permissions:true})});this.library_router.on("route:import_datasets",function(p,q){if(Galaxy.libraries.folderToolbarView&&Galaxy.libraries.folderListView){Galaxy.libraries.folderToolbarView.showImportModal({source:q})}else{Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p});Galaxy.libraries.folderToolbarView.showImportModal({source:q})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:d}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/base-mvc","mvc/library/library-model","mvc/library/library-folderlist-view","mvc/library/library-librarylist-view","mvc/library/library-librarytoolbar-view","mvc/library/library-foldertoolbar-view","mvc/library/library-dataset-view","mvc/library/library-library-view","mvc/library/library-folder-view"],function(h,e,j,n,k,c,i,g,l,f,b,a){var o=Backbone.Router.extend({initialize:function(){this.routesHit=0;Backbone.history.on("route",function(){this.routesHit++},this)},routes:{"":"libraries","library/:library_id/permissions":"library_permissions","folders/:folder_id/permissions":"folder_permissions","folders/:id":"folder_content","folders/:folder_id/datasets/:dataset_id":"dataset_detail","folders/:folder_id/datasets/:dataset_id/permissions":"dataset_permissions","folders/:folder_id/datasets/:dataset_id/versions/:ldda_id":"dataset_version","folders/:folder_id/download/:format":"download","folders/:folder_id/import/:source":"import_datasets"},back:function(){if(this.routesHit>1){window.history.back()}else{this.navigate("#",{trigger:true,replace:true})}}});var m=n.SessionStorageModel.extend({defaults:{with_deleted:false,sort_order:"asc",sort_by:"name"}});var d=Backbone.View.extend({libraryToolbarView:null,libraryListView:null,library_router:null,libraryView:null,folderToolbarView:null,folderListView:null,datasetView:null,initialize:function(){Galaxy.libraries=this;this.preferences=new m({id:"global-lib-prefs"});this.library_router=new o();this.library_router.on("route:libraries",function(){Galaxy.libraries.libraryToolbarView=new g.LibraryToolbarView();Galaxy.libraries.libraryListView=new i.LibraryListView()});this.library_router.on("route:folder_content",function(p){if(Galaxy.libraries.folderToolbarView){Galaxy.libraries.folderToolbarView.$el.unbind("click")}Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p})});this.library_router.on("route:download",function(p,q){if($("#folder_list_body").find(":checked").length===0){j.info("You must select at least one dataset to download");Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:true,replace:true})}else{Galaxy.libraries.folderToolbarView.download(p,q);Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:false,replace:true})}});this.library_router.on("route:dataset_detail",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p})});this.library_router.on("route:dataset_version",function(q,p,r){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,ldda_id:r,show_version:true})});this.library_router.on("route:dataset_permissions",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,show_permissions:true})});this.library_router.on("route:library_permissions",function(p){if(Galaxy.libraries.libraryView){Galaxy.libraries.libraryView.$el.unbind("click")}Galaxy.libraries.libraryView=new b.LibraryView({id:p,show_permissions:true})});this.library_router.on("route:folder_permissions",function(p){if(Galaxy.libraries.folderView){Galaxy.libraries.folderView.$el.unbind("click")}Galaxy.libraries.folderView=new a.FolderView({id:p,show_permissions:true})});this.library_router.on("route:import_datasets",function(p,q){if(Galaxy.libraries.folderToolbarView&&Galaxy.libraries.folderListView){Galaxy.libraries.folderToolbarView.showImportModal({source:q})}else{Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p});Galaxy.libraries.folderToolbarView.showImportModal({source:q})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:d}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-dataset-view.js --- a/static/scripts/packed/mvc/library/library-dataset-view.js +++ b/static/scripts/packed/mvc/library/library-dataset-view.js @@ -1,1 +1,1 @@ -define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,b){var a=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_modify_dataset":"enableModification","click .toolbtn_cancel_modifications":"render","click .toolbtn-download-dataset":"downloadDataset","click .toolbtn-import-dataset":"importIntoHistory","click .toolbtn-share-dataset":"shareDataset","click .btn-copy-link-to-clipboard":"copyToClipboard","click .btn-make-private":"makeDatasetPrivate","click .btn-remove-restrictions":"removeDatasetRestrictions","click .toolbtn_save_permissions":"savePermissions","click .toolbtn_save_modifications":"comingSoon",},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchDataset()}},fetchDataset:function(e){this.options=_.extend(this.options,e);this.model=new c.Item({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{if(f.options.show_version){f.fetchVersion()}else{f.render()}}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){this.options=_.extend(this.options,e);$(".tooltip").remove();var f=this.templateDataset();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},fetchVersion:function(e){this.options=_.extend(this.options,e);that=this;if(!this.options.ldda_id){this.render();d.error("Library dataset version requested but no id provided.")}else{this.ldda=new c.Ldda({id:this.options.ldda_id});this.ldda.url=this.ldda.urlRoot+this.model.id+"/versions/"+this.ldda.id;this.ldda.fetch({success:function(){that.renderVersion()},error:function(g,f){if(typeof f.responseJSON!=="undefined"){d.error(f.responseJSON.err_msg)}else{d.error("An error ocurred :(")}}})}},renderVersion:function(){$(".tooltip").remove();var e=this.templateVersion();this.$el.html(e({item:this.model,ldda:this.ldda}));$(".peek").html(this.ldda.get("peek"))},enableModification:function(){$(".tooltip").remove();var e=this.templateModifyDataset();this.$el.html(e({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},downloadDataset:function(){var e="/api/libraries/datasets/download/uncompressed";var f={ldda_ids:this.id};this.processDownload(e,f)},processDownload:function(f,g,h){if(f&&g){g=typeof g=="string"?g:$.param(g);var e="";$.each(g.split("&"),function(){var i=this.split("=");e+='<input type="hidden" name="'+i[0]+'" value="'+i[1]+'" />'});$('<form action="'+f+'" method="'+(h||"post")+'">'+e+"</form>").appendTo("body").submit().remove();d.info("Your download will begin soon")}},importIntoHistory:function(){this.refreshUserHistoriesList(function(e){var f=e.templateBulkImportInModal();e.modal=Galaxy.modal;e.modal.show({closing_events:true,title:"Import into History",body:f({histories:e.histories.models}),buttons:{Import:function(){e.importCurrentIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})},refreshUserHistoriesList:function(f){var e=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(g){if(g.length===0){d.warning("You have to create history first. Click this to do so.","",{onclick:function(){window.location="/"}})}else{f(e)}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error ocurred :(")}}})},importCurrentIntoHistory:function(){var e=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();var f=new c.HistoryItem();f.url=f.urlRoot+e+"/contents";jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+e);f.save({content:this.id,source:"library"},{success:function(){Galaxy.modal.hide();d.success("Dataset imported. Click this to start analysing it.","",{onclick:function(){window.location="/"}})},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error("Dataset not imported. "+g.responseJSON.err_msg)}else{d.error("An error occured! Dataset not imported. Please try again.")}}})},shareDataset:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();if(this.options.fetched_permissions!==undefined){if(this.options.fetched_permissions.access_dataset_roles.length===0){this.model.set({is_unrestricted:true})}else{this.model.set({is_unrestricted:false})}}var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateDatasetPermissions();this.$el.html(g({item:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/datasets/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i,is_admin:h})}).fail(function(){d.error("An error occurred while fetching dataset permissions. :(")})}else{this.prepareSelectBoxes({is_admin:h})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},prepareSelectBoxes:function(r){this.options=_.extend(this.options,r);var s=this.options.fetched_permissions;var k=this.options.is_admin;var q=this;var m=[];for(var h=0;h<s.access_dataset_roles.length;h++){m.push(s.access_dataset_roles[h]+":"+s.access_dataset_roles[h])}var f=[];for(var h=0;h<s.modify_item_roles.length;h++){f.push(s.modify_item_roles[h]+":"+s.modify_item_roles[h])}var g=[];for(var h=0;h<s.manage_dataset_roles.length;h++){g.push(s.manage_dataset_roles[h]+":"+s.manage_dataset_roles[h])}if(k){var o={minimumInputLength:0,css:"access_perm",multiple:true,placeholder:"Click to select a role",container:q.$el.find("#access_perm"),ajax:{url:"/api/libraries/datasets/"+q.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(i,t){return{q:i,page_limit:10,page:t}},results:function(u,t){var i=(t*10)<u.total;return{results:u.roles,more:i}}},formatResult:function j(i){return i.name+" type: "+i.type},formatSelection:function e(i){return i.name},initSelection:function(i,u){var t=[];$(i.val().split(",")).each(function(){var v=this.split(":");t.push({id:v[1],name:v[1]})});u(t)},initialData:m.join(","),dropdownCssClass:"bigdrop"};var l={minimumInputLength:0,css:"modify_perm",multiple:true,placeholder:"Click to select a role",container:q.$el.find("#modify_perm"),ajax:{url:"/api/libraries/datasets/"+q.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(i,t){return{q:i,page_limit:10,page:t}},results:function(u,t){var i=(t*10)<u.total;return{results:u.roles,more:i}}},formatResult:function j(i){return i.name+" type: "+i.type},formatSelection:function e(i){return i.name},initSelection:function(i,u){var t=[];$(i.val().split(",")).each(function(){var v=this.split(":");t.push({id:v[1],name:v[1]})});u(t)},initialData:f.join(","),dropdownCssClass:"bigdrop"};var p={minimumInputLength:0,css:"manage_perm",multiple:true,placeholder:"Click to select a role",container:q.$el.find("#manage_perm"),ajax:{url:"/api/libraries/datasets/"+q.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(i,t){return{q:i,page_limit:10,page:t}},results:function(u,t){var i=(t*10)<u.total;return{results:u.roles,more:i}}},formatResult:function j(i){return i.name+" type: "+i.type},formatSelection:function e(i){return i.name},initSelection:function(i,u){var t=[];$(i.val().split(",")).each(function(){var v=this.split(":");t.push({id:v[1],name:v[1]})});u(t)},initialData:g.join(","),dropdownCssClass:"bigdrop"};q.accessSelectObject=new b.View(o);q.modifySelectObject=new b.View(l);q.manageSelectObject=new b.View(p)}else{var n=q.templateAccessSelect();$.get("/api/libraries/datasets/"+q.id+"/permissions?scope=available",function(i){$(".access_perm").html(n({options:i.roles}));q.accessSelectObject=$("#access_select").select2()}).fail(function(){d.error("An error occurred while fetching data with permissions. :(")})}},comingSoon:function(){d.warning("Feature coming soon")},copyToClipboard:function(){var e=Backbone.history.location.href;if(e.lastIndexOf("/permissions")!==-1){e=e.substr(0,e.lastIndexOf("/permissions"))}window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},makeDatasetPrivate:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=make_private").done(function(f){e.model.set({is_unrestricted:false});e.showPermissions({fetched_permissions:f});d.success("The dataset is now private to you")}).fail(function(){d.error("An error occurred while making dataset private :(")})},removeDatasetRestrictions:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=remove_restrictions").done(function(f){e.model.set({is_unrestricted:true});e.showPermissions({fetched_permissions:f});d.success("Access to this dataset is now unrestricted")}).fail(function(){d.error("An error occurred while making dataset unrestricted :(")})},savePermissions:function(e){var n=this;var k=this.accessSelectObject.$el.select2("data");var f=this.manageSelectObject.$el.select2("data");var m=this.modifySelectObject.$el.select2("data");var g=[];var j=[];var l=[];for(var h=k.length-1;h>=0;h--){g.push(k[h].id)}for(var h=f.length-1;h>=0;h--){j.push(f[h].id)}for(var h=m.length-1;h>=0;h--){l.push(m[h].id)}$.post("/api/libraries/datasets/"+n.id+"/permissions?action=set_permissions",{"access_ids[]":g,"manage_ids[]":j,"modify_ids[]":l,}).done(function(i){n.showPermissions({fetched_permissions:i});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting dataset permissions :(")})},templateDataset:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Download dataset" class="btn btn-default toolbtn-download-dataset primary-button" type="button"><span class="fa fa-download"></span> Download</span></button>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Import dataset into history" class="btn btn-default toolbtn-import-dataset primary-button" type="button"><span class="fa fa-book"></span> to History</span></button>');e.push(' <% if (item.get("can_user_modify")) { %>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');e.push(" <% } %>");e.push(' <% if (item.get("can_user_manage")) { %>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');e.push(" <% } %>");e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push('<% if (item.get("is_unrestricted")) { %>');e.push(' <div class="alert alert-info">');e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');e.push(" </div>");e.push("<% } %>");e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><%= _.escape(item.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (item.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("genome_build")) { %>');e.push(" <tr>");e.push(' <th scope="row">Genome build</th>');e.push(' <td><%= _.escape(item.get("genome_build")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("file_size")) { %>');e.push(" <tr>");e.push(' <th scope="row">Size</th>');e.push(' <td><%= _.escape(item.get("file_size")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("date_uploaded")) { %>');e.push(" <tr>");e.push(' <th scope="row">Date uploaded (UTC)</th>');e.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("uploaded_by")) { %>');e.push(" <tr>");e.push(' <th scope="row">Uploaded by</th>');e.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_data_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data Lines</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_comment_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Comment Lines</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_columns")) { %>');e.push(" <tr>");e.push(' <th scope="row">Number of Columns</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_column_types")) { %>');e.push(" <tr>");e.push(' <th scope="row">Column Types</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("message")) { %>');e.push(" <tr>");e.push(' <th scope="row">Message</th>');e.push(' <td scope="row"><%= _.escape(item.get("message")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("misc_blurb")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous blurb</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("misc_info")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous information</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_info")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push(" <div>");e.push(' <pre class="peek">');e.push(" </pre>");e.push(" </div>");e.push(' <% if (item.get("has_versions")) { %>');e.push(" <div>");e.push(" <h3>Expired versions:</h3>");e.push(" <ul>");e.push(' <% _.each(item.get("expired_versions"), function(version) { %>');e.push(' <li><a title="See details of this version" href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/versions/<%- version[0] %>"><%- version[1] %></a></li>');e.push(" <% }) %>");e.push(" <ul>");e.push(" </div>");e.push(" <% } %>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateVersion:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>"><button data-toggle="tooltip" data-placement="top" title="Go to latest dataset" class="btn btn-default primary-button" type="button"><span class="fa fa-caret-left fa-lg"></span> Latest dataset</span></button><a>');e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push(' <div class="alert alert-warning">This is an expired version of the library dataset: <%= _.escape(item.get("name")) %></div>');e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(ldda.id) %>">Name</th>');e.push(' <td><%= _.escape(ldda.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (ldda.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(ldda.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("genome_build")) { %>');e.push(" <tr>");e.push(' <th scope="row">Genome build</th>');e.push(' <td><%= _.escape(ldda.get("genome_build")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("file_size")) { %>');e.push(" <tr>");e.push(' <th scope="row">Size</th>');e.push(' <td><%= _.escape(ldda.get("file_size")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("date_uploaded")) { %>');e.push(" <tr>");e.push(' <th scope="row">Date uploaded (UTC)</th>');e.push(' <td><%= _.escape(ldda.get("date_uploaded")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("uploaded_by")) { %>');e.push(" <tr>");e.push(' <th scope="row">Uploaded by</th>');e.push(' <td><%= _.escape(ldda.get("uploaded_by")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_data_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data Lines</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_data_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_comment_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Comment Lines</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_comment_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_columns")) { %>');e.push(" <tr>");e.push(' <th scope="row">Number of Columns</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_columns")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_column_types")) { %>');e.push(" <tr>");e.push(' <th scope="row">Column Types</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_column_types")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("message")) { %>');e.push(" <tr>");e.push(' <th scope="row">Message</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("message")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_blurb")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous blurb</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("misc_blurb")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_info")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous information</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("misc_info")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push(" <div>");e.push(' <pre class="peek">');e.push(" </pre>");e.push(" </div>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateModifyDataset:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Cancel modifications" class="btn btn-default toolbtn_cancel_modifications primary-button" type="button"><span class="fa fa-times"></span> Cancel</span></button>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Save modifications" class="btn btn-default toolbtn_save_modifications primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push('<div class="dataset_table">');e.push('<p>For more editing options please import the dataset to history and use "Edit attributes" on it.</p>');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><input class="input_dataset_name form-control" type="text" placeholder="name" value="<%= _.escape(item.get("name")) %>"></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Genome build</th>');e.push(' <td><%= _.escape(item.get("genome_build")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Size</th>');e.push(' <td><%= _.escape(item.get("file_size")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Date uploaded (UTC)</th>');e.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Uploaded by</th>');e.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');e.push(" </tr>");e.push(' <tr scope="row">');e.push(' <th scope="row">Data Lines</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');e.push(" </tr>");e.push(' <th scope="row">Comment Lines</th>');e.push(' <% if (item.get("metadata_comment_lines") === "") { %>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');e.push(" <% } else { %>");e.push(' <td scope="row">unknown</td>');e.push(" <% } %>");e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Number of Columns</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Column Types</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Message</th>');e.push(' <td scope="row"><%= _.escape(item.get("message")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Miscellaneous information</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_info")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Miscellaneous blurb</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');e.push(" </tr>");e.push(" </table>");e.push("<div>");e.push(' <pre class="peek">');e.push(" </pre>");e.push("</div>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateDatasetPermissions:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#folders/<%- item.get("folder_id") %>"><button data-toggle="tooltip" data-placement="top" title="Go back to containing folder" class="btn btn-default primary-button" type="button"><span class="fa fa-folder-open-o"></span> Containing Folder</span></button></a>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>"><button data-toggle="tooltip" data-placement="top" title="Go back to dataset" class="btn btn-default primary-button" type="button"><span class="fa fa-file-o"></span> Dataset Details</span></button><a>');e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push('<h1>Dataset: <%= _.escape(item.get("name")) %></h1>');e.push('<div class="alert alert-warning">');e.push("<% if (is_admin) { %>");e.push("You are logged in as an <strong>administrator</strong> therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% } %>");e.push("</div>");e.push('<div class="dataset_table">');e.push("<h2>Library-related permissions</h2>");e.push("<h4>Roles that can modify the library item</h4>");e.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify name, metadata, and other information about this library item.</div>');e.push("<hr/>");e.push("<h2>Dataset-related permissions</h2>");e.push('<div class="alert alert-warning">Changes made below will affect <strong>every</strong> library item that was created from this dataset and also every history this dataset is part of.</div>');e.push('<% if (!item.get("is_unrestricted")) { %>');e.push(" <p>You can remove all access restrictions on this dataset. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Everybody will be able to access the dataset." class="btn btn-default btn-remove-restrictions primary-button" type="button">');e.push(' <span class="fa fa-globe"> Remove restrictions</span>');e.push(" </button>");e.push(" </p>");e.push("<% } else { %>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page.");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"> To Clipboard</span></button> ');e.push(" <p>You can make this dataset private to you. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Only you will be able to access the dataset." class="btn btn-default btn-make-private primary-button" type="button"><span class="fa fa-key"> Make Private</span></button>');e.push(" </p>");e.push("<% } %>");e.push("<h4>Roles that can access the dataset</h4>");e.push('<div id="access_perm" class="access_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User has to have <strong>all these roles</strong> in order to access this dataset. Users without access permission <strong>cannot</strong> have other permissions on this dataset. If there are no access roles set on the dataset it is considered <strong>unrestricted</strong>.</div>');e.push("<h4>Roles that can manage permissions on the dataset</h4>");e.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions of this dataset. If you remove yourself you will loose the ability manage this dataset unless you are an admin.</div>');e.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications made on this page" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateBulkImportInModal:function(){var e=[];e.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');e.push("Select history: ");e.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');e.push(" <% _.each(histories, function(history) { %>");e.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');e.push(" <% }); %>");e.push("</select>");e.push("</span>");return _.template(e.join(""))},templateAccessSelect:function(){var e=[];e.push('<select id="access_select" multiple>');e.push(" <% _.each(options, function(option) { %>");e.push(' <option value="<%- option.name %>"><%- option.name %></option>');e.push(" <% }); %>");e.push("</select>");return _.template(e.join(""))}});return{LibraryDatasetView:a}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,b){var a=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_modify_dataset":"enableModification","click .toolbtn_cancel_modifications":"render","click .toolbtn-download-dataset":"downloadDataset","click .toolbtn-import-dataset":"importIntoHistory","click .toolbtn-share-dataset":"shareDataset","click .btn-copy-link-to-clipboard":"copyToClipboard","click .btn-make-private":"makeDatasetPrivate","click .btn-remove-restrictions":"removeDatasetRestrictions","click .toolbtn_save_permissions":"savePermissions","click .toolbtn_save_modifications":"comingSoon",},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchDataset()}},fetchDataset:function(e){this.options=_.extend(this.options,e);this.model=new c.Item({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{if(f.options.show_version){f.fetchVersion()}else{f.render()}}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){this.options=_.extend(this.options,e);$(".tooltip").remove();var f=this.templateDataset();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},fetchVersion:function(e){this.options=_.extend(this.options,e);that=this;if(!this.options.ldda_id){this.render();d.error("Library dataset version requested but no id provided.")}else{this.ldda=new c.Ldda({id:this.options.ldda_id});this.ldda.url=this.ldda.urlRoot+this.model.id+"/versions/"+this.ldda.id;this.ldda.fetch({success:function(){that.renderVersion()},error:function(g,f){if(typeof f.responseJSON!=="undefined"){d.error(f.responseJSON.err_msg)}else{d.error("An error ocurred.")}}})}},renderVersion:function(){$(".tooltip").remove();var e=this.templateVersion();this.$el.html(e({item:this.model,ldda:this.ldda}));$(".peek").html(this.ldda.get("peek"))},enableModification:function(){$(".tooltip").remove();var e=this.templateModifyDataset();this.$el.html(e({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},downloadDataset:function(){var e="/api/libraries/datasets/download/uncompressed";var f={ldda_ids:this.id};this.processDownload(e,f)},processDownload:function(f,g,h){if(f&&g){g=typeof g=="string"?g:$.param(g);var e="";$.each(g.split("&"),function(){var i=this.split("=");e+='<input type="hidden" name="'+i[0]+'" value="'+i[1]+'" />'});$('<form action="'+f+'" method="'+(h||"post")+'">'+e+"</form>").appendTo("body").submit().remove();d.info("Your download will begin soon.")}},importIntoHistory:function(){this.refreshUserHistoriesList(function(e){var f=e.templateBulkImportInModal();e.modal=Galaxy.modal;e.modal.show({closing_events:true,title:"Import into History",body:f({histories:e.histories.models}),buttons:{Import:function(){e.importCurrentIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})},refreshUserHistoriesList:function(f){var e=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(g){if(g.length===0){d.warning("You have to create history first. Click this to do so.","",{onclick:function(){window.location="/"}})}else{f(e)}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error ocurred.")}}})},importCurrentIntoHistory:function(){var e=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();var f=new c.HistoryItem();f.url=f.urlRoot+e+"/contents";jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+e);f.save({content:this.id,source:"library"},{success:function(){Galaxy.modal.hide();d.success("Dataset imported. Click this to start analysing it.","",{onclick:function(){window.location="/"}})},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error("Dataset not imported. "+g.responseJSON.err_msg)}else{d.error("An error occured. Dataset not imported. Please try again.")}}})},shareDataset:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();if(this.options.fetched_permissions!==undefined){if(this.options.fetched_permissions.access_dataset_roles.length===0){this.model.set({is_unrestricted:true})}else{this.model.set({is_unrestricted:false})}}var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateDatasetPermissions();this.$el.html(g({item:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/datasets/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i,is_admin:h})}).fail(function(){d.error("An error occurred while attempting to fetch dataset permissions.")})}else{this.prepareSelectBoxes({is_admin:h})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},prepareSelectBoxes:function(r){this.options=_.extend(this.options,r);var s=this.options.fetched_permissions;var k=this.options.is_admin;var q=this;var m=[];for(var h=0;h<s.access_dataset_roles.length;h++){m.push(s.access_dataset_roles[h]+":"+s.access_dataset_roles[h])}var f=[];for(var h=0;h<s.modify_item_roles.length;h++){f.push(s.modify_item_roles[h]+":"+s.modify_item_roles[h])}var g=[];for(var h=0;h<s.manage_dataset_roles.length;h++){g.push(s.manage_dataset_roles[h]+":"+s.manage_dataset_roles[h])}if(k){var o={minimumInputLength:0,css:"access_perm",multiple:true,placeholder:"Click to select a role",container:q.$el.find("#access_perm"),ajax:{url:"/api/libraries/datasets/"+q.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(i,t){return{q:i,page_limit:10,page:t}},results:function(u,t){var i=(t*10)<u.total;return{results:u.roles,more:i}}},formatResult:function j(i){return i.name+" type: "+i.type},formatSelection:function e(i){return i.name},initSelection:function(i,u){var t=[];$(i.val().split(",")).each(function(){var v=this.split(":");t.push({id:v[1],name:v[1]})});u(t)},initialData:m.join(","),dropdownCssClass:"bigdrop"};var l={minimumInputLength:0,css:"modify_perm",multiple:true,placeholder:"Click to select a role",container:q.$el.find("#modify_perm"),ajax:{url:"/api/libraries/datasets/"+q.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(i,t){return{q:i,page_limit:10,page:t}},results:function(u,t){var i=(t*10)<u.total;return{results:u.roles,more:i}}},formatResult:function j(i){return i.name+" type: "+i.type},formatSelection:function e(i){return i.name},initSelection:function(i,u){var t=[];$(i.val().split(",")).each(function(){var v=this.split(":");t.push({id:v[1],name:v[1]})});u(t)},initialData:f.join(","),dropdownCssClass:"bigdrop"};var p={minimumInputLength:0,css:"manage_perm",multiple:true,placeholder:"Click to select a role",container:q.$el.find("#manage_perm"),ajax:{url:"/api/libraries/datasets/"+q.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(i,t){return{q:i,page_limit:10,page:t}},results:function(u,t){var i=(t*10)<u.total;return{results:u.roles,more:i}}},formatResult:function j(i){return i.name+" type: "+i.type},formatSelection:function e(i){return i.name},initSelection:function(i,u){var t=[];$(i.val().split(",")).each(function(){var v=this.split(":");t.push({id:v[1],name:v[1]})});u(t)},initialData:g.join(","),dropdownCssClass:"bigdrop"};q.accessSelectObject=new b.View(o);q.modifySelectObject=new b.View(l);q.manageSelectObject=new b.View(p)}else{var n=q.templateAccessSelect();$.get("/api/libraries/datasets/"+q.id+"/permissions?scope=available",function(i){$(".access_perm").html(n({options:i.roles}));q.accessSelectObject=$("#access_select").select2()}).fail(function(){d.error("An error occurred while attempting to fetch dataset permissions.")})}},comingSoon:function(){d.warning("Feature coming soon.")},copyToClipboard:function(){var e=Backbone.history.location.href;if(e.lastIndexOf("/permissions")!==-1){e=e.substr(0,e.lastIndexOf("/permissions"))}window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},makeDatasetPrivate:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=make_private").done(function(f){e.model.set({is_unrestricted:false});e.showPermissions({fetched_permissions:f});d.success("The dataset is now private to you.")}).fail(function(){d.error("An error occurred while attempting to make dataset private.")})},removeDatasetRestrictions:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=remove_restrictions").done(function(f){e.model.set({is_unrestricted:true});e.showPermissions({fetched_permissions:f});d.success("Access to this dataset is now unrestricted.")}).fail(function(){d.error("An error occurred while attempting to make dataset unrestricted.")})},savePermissions:function(e){var n=this;var k=this.accessSelectObject.$el.select2("data");var f=this.manageSelectObject.$el.select2("data");var m=this.modifySelectObject.$el.select2("data");var g=[];var j=[];var l=[];for(var h=k.length-1;h>=0;h--){g.push(k[h].id)}for(var h=f.length-1;h>=0;h--){j.push(f[h].id)}for(var h=m.length-1;h>=0;h--){l.push(m[h].id)}$.post("/api/libraries/datasets/"+n.id+"/permissions?action=set_permissions",{"access_ids[]":g,"manage_ids[]":j,"modify_ids[]":l,}).done(function(i){n.showPermissions({fetched_permissions:i});d.success("Permissions saved.")}).fail(function(){d.error("An error occurred while attempting to set dataset permissions.")})},templateDataset:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Download dataset" class="btn btn-default toolbtn-download-dataset primary-button" type="button"><span class="fa fa-download"></span> Download</span></button>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Import dataset into history" class="btn btn-default toolbtn-import-dataset primary-button" type="button"><span class="fa fa-book"></span> to History</span></button>');e.push(' <% if (item.get("can_user_modify")) { %>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');e.push(" <% } %>");e.push(' <% if (item.get("can_user_manage")) { %>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');e.push(" <% } %>");e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push('<% if (item.get("is_unrestricted")) { %>');e.push(' <div class="alert alert-info">');e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');e.push(" </div>");e.push("<% } %>");e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><%= _.escape(item.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (item.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("genome_build")) { %>');e.push(" <tr>");e.push(' <th scope="row">Genome build</th>');e.push(' <td><%= _.escape(item.get("genome_build")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("file_size")) { %>');e.push(" <tr>");e.push(' <th scope="row">Size</th>');e.push(' <td><%= _.escape(item.get("file_size")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("date_uploaded")) { %>');e.push(" <tr>");e.push(' <th scope="row">Date uploaded (UTC)</th>');e.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("uploaded_by")) { %>');e.push(" <tr>");e.push(' <th scope="row">Uploaded by</th>');e.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_data_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data Lines</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_comment_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Comment Lines</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_columns")) { %>');e.push(" <tr>");e.push(' <th scope="row">Number of Columns</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("metadata_column_types")) { %>');e.push(" <tr>");e.push(' <th scope="row">Column Types</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("message")) { %>');e.push(" <tr>");e.push(' <th scope="row">Message</th>');e.push(' <td scope="row"><%= _.escape(item.get("message")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("misc_blurb")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous blurb</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (item.get("misc_info")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous information</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_info")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push(" <div>");e.push(' <pre class="peek">');e.push(" </pre>");e.push(" </div>");e.push(' <% if (item.get("has_versions")) { %>');e.push(" <div>");e.push(" <h3>Expired versions:</h3>");e.push(" <ul>");e.push(' <% _.each(item.get("expired_versions"), function(version) { %>');e.push(' <li><a title="See details of this version" href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/versions/<%- version[0] %>"><%- version[1] %></a></li>');e.push(" <% }) %>");e.push(" <ul>");e.push(" </div>");e.push(" <% } %>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateVersion:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>"><button data-toggle="tooltip" data-placement="top" title="Go to latest dataset" class="btn btn-default primary-button" type="button"><span class="fa fa-caret-left fa-lg"></span> Latest dataset</span></button><a>');e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push(' <div class="alert alert-warning">This is an expired version of the library dataset: <%= _.escape(item.get("name")) %></div>');e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(ldda.id) %>">Name</th>');e.push(' <td><%= _.escape(ldda.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (ldda.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(ldda.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("genome_build")) { %>');e.push(" <tr>");e.push(' <th scope="row">Genome build</th>');e.push(' <td><%= _.escape(ldda.get("genome_build")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("file_size")) { %>');e.push(" <tr>");e.push(' <th scope="row">Size</th>');e.push(' <td><%= _.escape(ldda.get("file_size")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("date_uploaded")) { %>');e.push(" <tr>");e.push(' <th scope="row">Date uploaded (UTC)</th>');e.push(' <td><%= _.escape(ldda.get("date_uploaded")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("uploaded_by")) { %>');e.push(" <tr>");e.push(' <th scope="row">Uploaded by</th>');e.push(' <td><%= _.escape(ldda.get("uploaded_by")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_data_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data Lines</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_data_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_comment_lines")) { %>');e.push(" <tr>");e.push(' <th scope="row">Comment Lines</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_comment_lines")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_columns")) { %>');e.push(" <tr>");e.push(' <th scope="row">Number of Columns</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_columns")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_column_types")) { %>');e.push(" <tr>");e.push(' <th scope="row">Column Types</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("metadata_column_types")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("message")) { %>');e.push(" <tr>");e.push(' <th scope="row">Message</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("message")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_blurb")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous blurb</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("misc_blurb")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_info")) { %>');e.push(" <tr>");e.push(' <th scope="row">Miscellaneous information</th>');e.push(' <td scope="row"><%= _.escape(ldda.get("misc_info")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push(" <div>");e.push(' <pre class="peek">');e.push(" </pre>");e.push(" </div>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateModifyDataset:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Cancel modifications" class="btn btn-default toolbtn_cancel_modifications primary-button" type="button"><span class="fa fa-times"></span> Cancel</span></button>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Save modifications" class="btn btn-default toolbtn_save_modifications primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push('<div class="dataset_table">');e.push('<p>For more editing options please import the dataset to history and use "Edit attributes" on it.</p>');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><input class="input_dataset_name form-control" type="text" placeholder="name" value="<%= _.escape(item.get("name")) %>"></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Genome build</th>');e.push(' <td><%= _.escape(item.get("genome_build")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Size</th>');e.push(' <td><%= _.escape(item.get("file_size")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Date uploaded (UTC)</th>');e.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Uploaded by</th>');e.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');e.push(" </tr>");e.push(' <tr scope="row">');e.push(' <th scope="row">Data Lines</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');e.push(" </tr>");e.push(' <th scope="row">Comment Lines</th>');e.push(' <% if (item.get("metadata_comment_lines") === "") { %>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');e.push(" <% } else { %>");e.push(' <td scope="row">unknown</td>');e.push(" <% } %>");e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Number of Columns</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Column Types</th>');e.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Message</th>');e.push(' <td scope="row"><%= _.escape(item.get("message")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Miscellaneous information</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_info")) %></td>');e.push(" </tr>");e.push(" <tr>");e.push(' <th scope="row">Miscellaneous blurb</th>');e.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');e.push(" </tr>");e.push(" </table>");e.push("<div>");e.push(' <pre class="peek">');e.push(" </pre>");e.push("</div>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateDatasetPermissions:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#folders/<%- item.get("folder_id") %>"><button data-toggle="tooltip" data-placement="top" title="Go back to containing folder" class="btn btn-default primary-button" type="button"><span class="fa fa-folder-open-o"></span> Containing Folder</span></button></a>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>"><button data-toggle="tooltip" data-placement="top" title="Go back to dataset" class="btn btn-default primary-button" type="button"><span class="fa fa-file-o"></span> Dataset Details</span></button><a>');e.push(" </div>");e.push('<ol class="breadcrumb">');e.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');e.push(' <% _.each(item.get("full_path"), function(path_item) { %>');e.push(" <% if (path_item[0] != item.id) { %>");e.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');e.push("<% } else { %>");e.push(' <li class="active"><span title="You are here"><%- path_item[1] %></span></li>');e.push(" <% } %>");e.push(" <% }); %>");e.push("</ol>");e.push('<h1>Dataset: <%= _.escape(item.get("name")) %></h1>');e.push('<div class="alert alert-warning">');e.push("<% if (is_admin) { %>");e.push("You are logged in as an <strong>administrator</strong> therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% } %>");e.push("</div>");e.push('<div class="dataset_table">');e.push("<h2>Library-related permissions</h2>");e.push("<h4>Roles that can modify the library item</h4>");e.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify name, metadata, and other information about this library item.</div>');e.push("<hr/>");e.push("<h2>Dataset-related permissions</h2>");e.push('<div class="alert alert-warning">Changes made below will affect <strong>every</strong> library item that was created from this dataset and also every history this dataset is part of.</div>');e.push('<% if (!item.get("is_unrestricted")) { %>');e.push(" <p>You can remove all access restrictions on this dataset. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Everybody will be able to access the dataset." class="btn btn-default btn-remove-restrictions primary-button" type="button">');e.push(' <span class="fa fa-globe"> Remove restrictions</span>');e.push(" </button>");e.push(" </p>");e.push("<% } else { %>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page.");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"> To Clipboard</span></button> ');e.push(" <p>You can make this dataset private to you. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Only you will be able to access the dataset." class="btn btn-default btn-make-private primary-button" type="button"><span class="fa fa-key"> Make Private</span></button>');e.push(" </p>");e.push("<% } %>");e.push("<h4>Roles that can access the dataset</h4>");e.push('<div id="access_perm" class="access_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User has to have <strong>all these roles</strong> in order to access this dataset. Users without access permission <strong>cannot</strong> have other permissions on this dataset. If there are no access roles set on the dataset it is considered <strong>unrestricted</strong>.</div>');e.push("<h4>Roles that can manage permissions on the dataset</h4>");e.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions of this dataset. If you remove yourself you will loose the ability manage this dataset unless you are an admin.</div>');e.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications made on this page" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateBulkImportInModal:function(){var e=[];e.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');e.push("Select history: ");e.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');e.push(" <% _.each(histories, function(history) { %>");e.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');e.push(" <% }); %>");e.push("</select>");e.push("</span>");return _.template(e.join(""))},templateAccessSelect:function(){var e=[];e.push('<select id="access_select" multiple>');e.push(" <% _.each(options, function(option) { %>");e.push(' <option value="<%- option.name %>"><%- option.name %></option>');e.push(" <% }); %>");e.push("</select>");return _.template(e.join(""))}});return{LibraryDatasetView:a}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-folder-view.js --- a/static/scripts/packed/mvc/library/library-folder-view.js +++ b/static/scripts/packed/mvc/library/library-folder-view.js @@ -1,1 +1,1 @@ -define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchFolder()}},fetchFolder:function(e){this.options=_.extend(this.options,e);this.model=new c.FolderAsModel({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{f.render()}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateFolder();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},shareFolder:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateFolderPermissions();this.$el.html(g({folder:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/folders/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while fetching folder permissions. :(")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f<g.length;f++){e.push(g[f]+":"+g[f])}return e},prepareSelectBoxes:function(h){this.options=_.extend(this.options,h);var f=this.options.fetched_permissions;var g=this;var i=this._serializeRoles(f.add_library_item_role_list);var j=this._serializeRoles(f.manage_folder_role_list);var e=this._serializeRoles(f.modify_folder_role_list);g.addSelectObject=new a.View(this._createSelectOptions(this,"add_perm",i,false));g.manageSelectObject=new a.View(this._createSelectOptions(this,"manage_perm",j,false));g.modifySelectObject=new a.View(this._createSelectOptions(this,"modify_perm",e,false))},_createSelectOptions:function(e,j,h){var i={minimumInputLength:0,css:j,multiple:true,placeholder:"Click to select a role",container:e.$el.find("#"+j),ajax:{url:"/api/folders/"+e.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(k,l){return{q:k,page_limit:10,page:l}},results:function(m,l){var k=(l*10)<m.total;return{results:m.roles,more:k}}},formatResult:function f(k){return k.name+" type: "+k.type},formatSelection:function g(k){return k.name},initSelection:function(k,m){var l=[];$(k.val().split(",")).each(function(){var n=this.split(":");l.push({id:n[1],name:n[1]})});m(l)},initialData:h.join(","),dropdownCssClass:"bigdrop"};return i},comingSoon:function(){d.warning("Feature coming soon")},copyToClipboard:function(){var e=Backbone.history.location.href;if(e.lastIndexOf("/permissions")!==-1){e=e.substr(0,e.lastIndexOf("/permissions"))}window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},_extractIds:function(e){ids_list=[];for(var f=e.length-1;f>=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var e=this._extractIds(this.addSelectObject.$el.select2("data"));var i=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/folders/"+g.id+"/permissions?action=set_permissions",{"add_ids[]":e,"manage_ids[]":i,"modify_ids[]":f,}).done(function(j){g.showPermissions({fetched_permissions:j});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting folder permissions :(")})},templateFolder:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');e.push(" </div>");e.push(" <p>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');e.push(" </p>");e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><%= _.escape(item.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (item.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateFolderPermissions:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#/folders/<%= folder.get("parent_id") %>"><button data-toggle="tooltip" data-placement="top" title="Go back to the parent folder" class="btn btn-default primary-button" type="button"><span class="fa fa-caret-left fa-lg"></span> Parent folder</span></button></a>');e.push(" </div>");e.push('<h1>Folder: <%= _.escape(folder.get("name")) %></h1>');e.push('<div class="alert alert-warning">');e.push("<% if (is_admin) { %>");e.push("You are logged in as an <strong>administrator</strong> therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% }%>");e.push("</div>");e.push('<div class="dataset_table">');e.push("<h2>Folder permissions</h2>");e.push("<h4>Roles that can manage permissions on this folder</h4>");e.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions on this folder.</div>');e.push("<h4>Roles that can add items to this folder</h4>");e.push('<div id="add_perm" class="add_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can add items to this folder (folders and datasets).</div>');e.push("<h4>Roles that can modify this folder</h4>");e.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify this folder (name, etc.).</div>');e.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push("</div>");e.push("</div>");return _.template(e.join(""))}});return{FolderView:b}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchFolder()}},fetchFolder:function(e){this.options=_.extend(this.options,e);this.model=new c.FolderAsModel({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{f.render()}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateFolder();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},shareFolder:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateFolderPermissions();this.$el.html(g({folder:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/folders/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while attempting to fetch folder permissions.")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f<g.length;f++){e.push(g[f]+":"+g[f])}return e},prepareSelectBoxes:function(h){this.options=_.extend(this.options,h);var f=this.options.fetched_permissions;var g=this;var i=this._serializeRoles(f.add_library_item_role_list);var j=this._serializeRoles(f.manage_folder_role_list);var e=this._serializeRoles(f.modify_folder_role_list);g.addSelectObject=new a.View(this._createSelectOptions(this,"add_perm",i,false));g.manageSelectObject=new a.View(this._createSelectOptions(this,"manage_perm",j,false));g.modifySelectObject=new a.View(this._createSelectOptions(this,"modify_perm",e,false))},_createSelectOptions:function(e,j,h){var i={minimumInputLength:0,css:j,multiple:true,placeholder:"Click to select a role",container:e.$el.find("#"+j),ajax:{url:"/api/folders/"+e.id+"/permissions?scope=available",dataType:"json",quietMillis:100,data:function(k,l){return{q:k,page_limit:10,page:l}},results:function(m,l){var k=(l*10)<m.total;return{results:m.roles,more:k}}},formatResult:function f(k){return k.name+" type: "+k.type},formatSelection:function g(k){return k.name},initSelection:function(k,m){var l=[];$(k.val().split(",")).each(function(){var n=this.split(":");l.push({id:n[1],name:n[1]})});m(l)},initialData:h.join(","),dropdownCssClass:"bigdrop"};return i},comingSoon:function(){d.warning("Feature coming soon.")},copyToClipboard:function(){var e=Backbone.history.location.href;if(e.lastIndexOf("/permissions")!==-1){e=e.substr(0,e.lastIndexOf("/permissions"))}window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},_extractIds:function(e){ids_list=[];for(var f=e.length-1;f>=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var e=this._extractIds(this.addSelectObject.$el.select2("data"));var i=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/folders/"+g.id+"/permissions?action=set_permissions",{"add_ids[]":e,"manage_ids[]":i,"modify_ids[]":f,}).done(function(j){g.showPermissions({fetched_permissions:j});d.success("Permissions saved.")}).fail(function(){d.error("An error occurred while attempting to set folder permissions.")})},templateFolder:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');e.push(" </div>");e.push(" <p>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');e.push(" </p>");e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><%= _.escape(item.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (item.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateFolderPermissions:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#/folders/<%= folder.get("parent_id") %>"><button data-toggle="tooltip" data-placement="top" title="Go back to the parent folder" class="btn btn-default primary-button" type="button"><span class="fa fa-caret-left fa-lg"></span> Parent folder</span></button></a>');e.push(" </div>");e.push('<h1>Folder: <%= _.escape(folder.get("name")) %></h1>');e.push('<div class="alert alert-warning">');e.push("<% if (is_admin) { %>");e.push("You are logged in as an <strong>administrator</strong> therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% }%>");e.push("</div>");e.push('<div class="dataset_table">');e.push("<h2>Folder permissions</h2>");e.push("<h4>Roles that can manage permissions on this folder</h4>");e.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions on this folder.</div>');e.push("<h4>Roles that can add items to this folder</h4>");e.push('<div id="add_perm" class="add_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can add items to this folder (folders and datasets).</div>');e.push("<h4>Roles that can modify this folder</h4>");e.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify this folder (name, etc.).</div>');e.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push("</div>");e.push("</div>");return _.template(e.join(""))}});return{FolderView:b}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-folderlist-view.js --- a/static/scripts/packed/mvc/library/library-folderlist-view.js +++ b/static/scripts/packed/mvc/library/library-folderlist-view.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view","mvc/library/library-dataset-view"],function(d,f,g,e,a,c){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sortColumnClicked"},rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);this.fetchFolder()},fetchFolder:function(h){var h=h||{};this.options.include_deleted=h.include_deleted;var i=this;this.collection=new e.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new e.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(j){i.folder_container=j;i.render();i.addAll(j.get("folder").models);if(i.options.dataset_id){row=_.findWhere(i.rowViews,{id:i.options.dataset_id});if(row){row.showDatasetDetails()}else{g.error("Dataset not found. Showing folder instead.")}}},error:function(k,j){if(typeof j.responseJSON!=="undefined"){g.error(j.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{g.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(h){this.options=_.defaults(this.options,h);var i=this.templateFolder();$(".tooltip").hide();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,parent_library_id:this.folderContainer.attributes.metadata.parent_library_id,id:this.options.id,upper_folder_id:k,order:this.sort}));$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},postRender:function(){var h=this.folderContainer.attributes.metadata;h.contains_file=typeof this.collection.findWhere({type:"file"})!=="undefined";Galaxy.libraries.folderToolbarView.configureElements(h);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},addAll:function(h){_.each(h.reverse(),function(i){Galaxy.libraries.folderListView.collection.add(i)});$("#center [data-toggle]").tooltip();this.checkEmptiness();this.postRender()},renderAll:function(){var h=this;_.each(this.collection.models.reverse(),function(i){h.renderOne(i)});this.postRender()},renderOne:function(i){if(i.get("type")!=="folder"){this.options.contains_file=true}i.set("folder_id",this.id);var h=new a.FolderRowView(i);this.rowViews[i.get("id")]=h;this.$el.find("#first_folder_item").after(h.el);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(h){this.$el.find("#"+h.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sortColumnClicked:function(h){h.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll();this.checkEmptiness()},sortFolder:function(i,h){if(i==="name"){if(h==="asc"){return this.collection.sortByNameAsc()}else{if(h==="desc"){return this.collection.sortByNameDesc()}}}},selectAll:function(i){var h=i.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=h;$row=$(this.parentElement.parentElement);if(h){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(i){var k="";var h;var j;if(i.target.localName==="input"){k=i.target;h=$(i.target.parentElement.parentElement);j="input"}else{if(i.target.localName==="td"){k=$("#"+i.target.parentElement.id).find(":checkbox")[0];h=$(i.target.parentElement);j="td"}}if(k.checked){if(j==="td"){k.checked="";this.makeWhiteRow(h)}else{if(j==="input"){this.makeDarkRow(h)}}}else{if(j==="td"){k.checked="selected";this.makeDarkRow(h)}else{if(j==="input"){this.makeWhiteRow(h)}}}},makeDarkRow:function(h){h.removeClass("light").addClass("dark");h.find("a").removeClass("light").addClass("dark");h.find(".fa-file-o").removeClass("fa-file-o").addClass("fa-file")},makeWhiteRow:function(h){h.removeClass("dark").addClass("light");h.find("a").removeClass("dark").addClass("light");h.find(".fa-file").removeClass("fa-file").addClass("fa-file-o")},templateFolder:function(){var h=[];h.push('<ol class="breadcrumb">');h.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');h.push(" <% _.each(path, function(path_item) { %>");h.push(" <% if (path_item[0] != id) { %>");h.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');h.push("<% } else { %>");h.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');h.push(" <% } %>");h.push(" <% }); %>");h.push("</ol>");h.push('<table data-library-id="<%- parent_library_id %>" id="folder_table" class="grid table table-condensed">');h.push(" <thead>");h.push(' <th class="button_heading"></th>');h.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');h.push(' <th><a class="sort-folder-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');h.push(' <th style="width:5%;">data type</th>');h.push(' <th style="width:10%;">size</th>');h.push(' <th style="width:160px;">time updated (UTC)</th>');h.push(' <th style="width:10%;"></th> ');h.push(" </thead>");h.push(' <tbody id="folder_list_body">');h.push(' <tr id="first_folder_item">');h.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" </tr>");h.push(" </tbody>");h.push("</table>");h.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents. If you expected something to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');return _.template(h.join(""))}});return{FolderListView:b}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view","mvc/library/library-dataset-view"],function(d,f,g,e,a,c){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sortColumnClicked"},rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);this.fetchFolder()},fetchFolder:function(h){var h=h||{};this.options.include_deleted=h.include_deleted;var i=this;this.collection=new e.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new e.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(j){i.folder_container=j;i.render();i.addAll(j.get("folder").models);if(i.options.dataset_id){row=_.findWhere(i.rowViews,{id:i.options.dataset_id});if(row){row.showDatasetDetails()}else{g.error("Dataset not found. Showing folder instead.")}}},error:function(k,j){if(typeof j.responseJSON!=="undefined"){g.error(j.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{g.error("An error ocurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(h){this.options=_.defaults(this.options,h);var i=this.templateFolder();$(".tooltip").hide();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,parent_library_id:this.folderContainer.attributes.metadata.parent_library_id,id:this.options.id,upper_folder_id:k,order:this.sort}));$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},postRender:function(){var h=this.folderContainer.attributes.metadata;h.contains_file=typeof this.collection.findWhere({type:"file"})!=="undefined";Galaxy.libraries.folderToolbarView.configureElements(h);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},addAll:function(h){_.each(h.reverse(),function(i){Galaxy.libraries.folderListView.collection.add(i)});$("#center [data-toggle]").tooltip();this.checkEmptiness();this.postRender()},renderAll:function(){var h=this;_.each(this.collection.models.reverse(),function(i){h.renderOne(i)});this.postRender()},renderOne:function(i){if(i.get("type")!=="folder"){this.options.contains_file=true}i.set("folder_id",this.id);var h=new a.FolderRowView(i);this.rowViews[i.get("id")]=h;this.$el.find("#first_folder_item").after(h.el);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(h){this.$el.find("#"+h.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sortColumnClicked:function(h){h.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll();this.checkEmptiness()},sortFolder:function(i,h){if(i==="name"){if(h==="asc"){return this.collection.sortByNameAsc()}else{if(h==="desc"){return this.collection.sortByNameDesc()}}}},selectAll:function(i){var h=i.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=h;$row=$(this.parentElement.parentElement);if(h){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(i){var k="";var h;var j;if(i.target.localName==="input"){k=i.target;h=$(i.target.parentElement.parentElement);j="input"}else{if(i.target.localName==="td"){k=$("#"+i.target.parentElement.id).find(":checkbox")[0];h=$(i.target.parentElement);j="td"}}if(k.checked){if(j==="td"){k.checked="";this.makeWhiteRow(h)}else{if(j==="input"){this.makeDarkRow(h)}}}else{if(j==="td"){k.checked="selected";this.makeDarkRow(h)}else{if(j==="input"){this.makeWhiteRow(h)}}}},makeDarkRow:function(h){h.removeClass("light").addClass("dark");h.find("a").removeClass("light").addClass("dark");h.find(".fa-file-o").removeClass("fa-file-o").addClass("fa-file")},makeWhiteRow:function(h){h.removeClass("dark").addClass("light");h.find("a").removeClass("dark").addClass("light");h.find(".fa-file").removeClass("fa-file").addClass("fa-file-o")},templateFolder:function(){var h=[];h.push('<ol class="breadcrumb">');h.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');h.push(" <% _.each(path, function(path_item) { %>");h.push(" <% if (path_item[0] != id) { %>");h.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');h.push("<% } else { %>");h.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');h.push(" <% } %>");h.push(" <% }); %>");h.push("</ol>");h.push('<table data-library-id="<%- parent_library_id %>" id="folder_table" class="grid table table-condensed">');h.push(" <thead>");h.push(' <th class="button_heading"></th>');h.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');h.push(' <th><a class="sort-folder-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');h.push(' <th style="width:5%;">data type</th>');h.push(' <th style="width:10%;">size</th>');h.push(' <th style="width:160px;">time updated (UTC)</th>');h.push(' <th style="width:10%;"></th> ');h.push(" </thead>");h.push(' <tbody id="folder_list_body">');h.push(' <tr id="first_folder_item">');h.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" <td></td>");h.push(" </tr>");h.push(" </tbody>");h.push("</table>");h.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents. If you expected something to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');return _.template(h.join(""))}});return{FolderListView:b}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-foldertoolbar-view.js --- a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js +++ b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(f){this.options=_.extend(this.options,f);var h=this.templateToolBar();var g={id:this.options.id,is_admin:false,is_anonym:true,user_library_import_dir:Galaxy.config.user_library_import_dir,allow_library_path_paste:Galaxy.config.allow_library_path_paste,library_import_dir:Galaxy.config.library_import_dir,mutiple_add_dataset_options:false};if(Galaxy.currUser){g.is_admin=Galaxy.currUser.isAdmin();g.is_anonym=Galaxy.currUser.isAnonymous();if(g.user_library_import_dir!==null||g.allow_library_path_paste!==false||g.library_import_dir!==null){g.mutiple_add_dataset_options=true}}this.$el.html(h(g))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(h){h.preventDefault();h.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(h){var g=h.templateBulkImportInModal();h.modal=Galaxy.modal;h.modal.show({closing_events:true,title:"Import into History",body:g({histories:h.histories.models}),buttons:{Import:function(){h.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var j=$("select[name=dataset_import_bulk] option:selected").val();var m=$("select[name=dataset_import_bulk] option:selected").text();this.options.last_used_history_id=j;var g=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});var l=[];for(var h=g.length-1;h>=0;h--){var f=g[h];var k=new c.HistoryItem();k.url=k.urlRoot+j+"/contents";k.content=f;k.source="library";l.push(k)}this.initChainCallControl({length:l.length,action:"to_history",history_name:m});jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+j);this.chainCallImportingIntoHistory(l,m)},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(f,j){var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var g="/api/libraries/datasets/download/"+j;var i={ldda_ids:h};this.processDownload(g,i,"get")},processDownload:function(g,h,i){if(g&&h){h=typeof h==="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}else{e.error("An error occurred :(")}},addFilesFromHistoryModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesFromHistory();var h=f.options.full_path[f.options.full_path.length-1][1];f.modal.show({closing_events:true,title:"Adding datasets from your history to folder "+h,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.back()}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(i){f.fetchAndDisplayHistoryContents(i.target.value)})}else{e.error("An error ocurred :(")}})},importFilesFromPathModal:function(){var g=this;this.modal=Galaxy.modal;var f=this.templateImportPathModal();this.modal.show({closing_events:true,title:"Enter paths relative to Galaxy root",body:f({}),buttons:{Import:function(){g.importFromPathsClicked(g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+g.id,{trigger:true})}})},importFilesFromUserdirModal:function(){var g=this;this.modal=Galaxy.modal;var f=this.templateBrowserModal();this.modal.show({closing_events:true,title:"Select folders or files to import",body:f({}),buttons:{Import:function(){g.importFromUserdirClicked(g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+g.id,{trigger:true})}});this.renderJstree({disabled_jstree_element:"folders"});$("input[type=radio]").change(function(h){if(h.target.value==="jstree-disable-folders"){g.renderJstree({disabled_jstree_element:"folders"});$(".jstree-folders-message").hide();$(".jstree-preserve-structure").hide();$(".jstree-link-files").hide();$(".jstree-files-message").show()}else{if(h.target.value==="jstree-disable-files"){$(".jstree-files-message").hide();$(".jstree-folders-message").show();$(".jstree-link-files").show();$(".jstree-preserve-structure").show();g.renderJstree({disabled_jstree_element:"files"})}}})},renderJstree:function(f){var h=this;this.options=_.extend(this.options,f);var g=this.options.disabled_jstree_element;this.jstree=new c.Jstree();this.jstree.url=this.jstree.urlRoot+"?target=userdir&format=jstree&disable="+g;this.jstree.fetch({success:function(j,i){define("jquery",function(){return jQuery});require(["libs/jquery/jstree"],function(k){$("#jstree_browser").jstree("destroy");$("#jstree_browser").jstree({core:{data:j},plugins:["types","checkbox"],types:{folder:{icon:"jstree-folder"},file:{icon:"jstree-file"}},checkbox:{three_state:false}})})},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importFromPathsClicked:function(){var f=this.modal.$el.find(".preserve-checkbox").is(":checked");var k=this.modal.$el.find(".link-checkbox").is(":checked");var j=$("textarea#import_paths").val();var h=[];if(!j){e.info("Please enter a path relative to Galaxy root")}else{this.modal.disableButton("Import");j=j.split("\n");for(var g=j.length-1;g>=0;g--){trimmed=j[g].trim();if(trimmed.length!==0){h.push(trimmed)}}this.initChainCallControl({length:h.length,action:"adding_datasets"});this.chainCallImportingFolders(h,f,k,"admin_path")}},initChainCallControl:function(f){var g;switch(f.action){case"adding_datasets":g=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(g({folder_name:this.options.folder_name}));break;case"deleting_datasets":g=this.templateDeletingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(g());break;case"to_history":g=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(g({history_name:f.history_name}));break;default:console.error("Wrong action specified.");break}this.progress=0;this.progressStep=100/f.length;this.options.chain_call_control.total_number=f.length;this.options.chain_call_control.failed_number=0},importFromUserdirClicked:function(k){var g=$("#jstree_browser").jstree().get_selected(true);var f=this.modal.$el.find(".preserve-checkbox").is(":checked");var m=this.modal.$el.find(".link-checkbox").is(":checked");var j=g[0].type;var l=[];if(g.length<1){e.info("You have to select some items first")}else{this.modal.disableButton("Import");for(var h=g.length-1;h>=0;h--){if(g[h].li_attr.full_path!==undefined){l.push(g[h].li_attr.full_path)}}this.initChainCallControl({length:l.length,action:"adding_datasets"});if(j==="folder"){this.chainCallImportingFolders(l,f,m,"userdir_folder")}else{if(j==="file"){this.chainCallImportingUserdirFiles(l)}}}},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},addAllDatasetsFromHistory:function(){var k=this.modal.$el.find("#selected_history_content").find(":checked");var f=[];var j=[];if(k.length<1){e.info("You have to select some datasets first")}else{this.modal.disableButton("Add");k.each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.initChainCallControl({length:j.length,action:"adding_datasets"});this.chainCallAddingHdas(j)}},chainCallImportingIntoHistory:function(g,j){var f=this;var h=g.pop();if(typeof h=="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be imported into history. Click this to see what was imported.","",{onclick:function(){window.location="/"}})}}}Galaxy.modal.hide();return true}var i=$.when(h.save({content:h.content,source:h.source}));i.done(function(){f.updateProgress();f.chainCallImportingIntoHistory(g,j)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallImportingIntoHistory(g,j)})},chainCallImportingUserdirFiles:function(i){var f=this;var g=i.pop();if(typeof g==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected files imported into the current folder");Galaxy.modal.hide()}else{e.error("Something went wrong :(")}return true}var h=$.when($.post("/api/libraries/datasets?encoded_folder_id="+f.id+"&source=userdir_file&path="+g));h.done(function(j){f.updateProgress();f.chainCallImportingUserdirFiles(i)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallImportingUserdirFiles(i)})},chainCallImportingFolders:function(k,f,l,i){var g=this;var h=k.pop();if(typeof h=="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected folders and their contents imported into the current folder");Galaxy.modal.hide()}else{e.error("Something went wrong :(")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+g.id+"&source="+i+"&path="+h+"&preserve_dirs="+f+"&link_data="+l));j.done(function(m){g.updateProgress();g.chainCallImportingFolders(k,f,l,i)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallImportingFolders(k,f,l,i)})},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h=="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var i=$.when(h.save({from_hda_id:h.get("from_hda_id")}));i.done(function(j){Galaxy.libraries.folderListView.collection.add(j);f.updateProgress();f.chainCallAddingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallAddingHdas(g)})},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var i=$.when(h.destroy());i.done(function(k){Galaxy.libraries.folderListView.collection.remove(h.id);f.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var j=new c.Item(k);Galaxy.libraries.folderListView.collection.add(j)}f.chainCallDeletingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallDeletingHdas(g)})},checkIncludeDeleted:function(f){if(f.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{var j=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:j({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var g=[];f.each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});this.progressStep=100/g.length;this.progress=0;var l=[];for(var h=g.length-1;h>=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},showLibInfo:function(){var g=Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;var f=null;var h=this;if(Galaxy.libraries.libraryListView!==null){f=Galaxy.libraries.libraryListView.collection.get(g);this.showLibInfoModal(f)}else{f=new c.Library({id:g});f.fetch({success:function(){h.showLibInfoModal(f)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}},showLibInfoModal:function(f){var g=this.templateLibInfoInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Library Information",body:g({library:f}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(f){switch(f.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromUserdirModal();break;default:Galaxy.libraries.library_router.back();e.error("Invalid import source.");break}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push("<% if(mutiple_add_dataset_options) { %>");tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button title="Add Datasets to Current Folder" id="" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-plus"></span><span class="fa fa-file"></span><span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#folders/<%= id %>/import/history"> from History</a></li>');tmpl_array.push("<% if(user_library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/userdir"> from User Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(allow_library_path_paste) { %>");tmpl_array.push(' <li class="divider"></li>');tmpl_array.push(' <li class="dropdown-header">Admins only</li>');tmpl_array.push("<% if(allow_library_path_paste) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/path">from Path</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push("<% } else { %>");tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("<% } %>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> Download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('<div id="lif_info_modal">');tmpl_array.push("<h2>Library name:</h2>");tmpl_array.push('<p><%- library.get("name") %></p>');tmpl_array.push("<h3>Library description:</h3>");tmpl_array.push('<p><%- library.get("description") %></p>');tmpl_array.push("<h3>Library synopsis:</h3>");tmpl_array.push('<p><%- library.get("synopsis") %></p>');tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Adding selected datasets to library folder <b><%= _.escape(folder_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateBrowserModal:function(){var f=[];f.push('<div id="file_browser_modal">');f.push('<div style="margin-bottom:1em;">');f.push('<label class="radio-inline">');f.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');f.push("</label>");f.push('<label class="radio-inline">');f.push(' <input title="Switch to selecting folders" type="radio" name="jstree-radio" value="jstree-disable-files"> Folders');f.push("</label>");f.push('<label class="checkbox-inline jstree-preserve-structure" style="display:none;">');f.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');f.push("Preserve directory structure");f.push(" </label>");f.push('<label class="checkbox-inline jstree-link-files" style="display:none;">');f.push(' <input class="link-checkbox" type="checkbox" value="link_files">');f.push("Link files instead of copying");f.push(" </label>");f.push("</div>");f.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');f.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');f.push('<div id="jstree_browser">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateImportPathModal:function(){var f=[];f.push('<div id="file_browser_modal">');f.push('<label class="checkbox-inline jstree-preserve-structure">');f.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');f.push("Preserve directory structure");f.push(" </label>");f.push('<label class="checkbox-inline jstree-link-files">');f.push(' <input class="link-checkbox" type="checkbox" value="link_files">');f.push("Link files instead of copying");f.push(" </label>");f.push("</div>");f.push('<div class="alert alert-info jstree-folders-message">All files within the given folders and their subfolders will be imported into the current folder.</div>');f.push('<textarea id="import_paths" class="form-control" rows="5" placeholder="Paths separated by newline"></textarea>');f.push("</div>");return _.template(f.join(""))},templateAddFilesFromHistory:function(){var f=[];f.push('<div id="add_files_modal">');f.push('<div id="history_modal_combo_bulk">');f.push("Select history: ");f.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</div>");f.push("<br/>");f.push('<div id="selected_history_content">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("<strong>Choose the datasets to import:</strong>");f.push("<ul>");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');f.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push(" </li>");f.push(" <% }); %>");f.push("</ul>");return _.template(f.join(""))}});return{FolderToolbarView:a}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(f){this.options=_.extend(this.options,f);var h=this.templateToolBar();var g={id:this.options.id,is_admin:false,is_anonym:true,user_library_import_dir:Galaxy.config.user_library_import_dir,allow_library_path_paste:Galaxy.config.allow_library_path_paste,library_import_dir:Galaxy.config.library_import_dir,mutiple_add_dataset_options:false};if(Galaxy.currUser){g.is_admin=Galaxy.currUser.isAdmin();g.is_anonym=Galaxy.currUser.isAnonymous();if(g.user_library_import_dir!==null||g.allow_library_path_paste!==false||g.library_import_dir!==null){g.mutiple_add_dataset_options=true}}this.$el.html(h(g))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(h){h.preventDefault();h.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created.");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})}else{e.error("Folder's name is missing.")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You must select some datasets first.")}else{this.refreshUserHistoriesList(function(h){var g=h.templateBulkImportInModal();h.modal=Galaxy.modal;h.modal.show({closing_events:true,title:"Import into History",body:g({histories:h.histories.models}),buttons:{Import:function(){h.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var j=$("select[name=dataset_import_bulk] option:selected").val();var m=$("select[name=dataset_import_bulk] option:selected").text();this.options.last_used_history_id=j;var g=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});var l=[];for(var h=g.length-1;h>=0;h--){var f=g[h];var k=new c.HistoryItem();k.url=k.urlRoot+j+"/contents";k.content=f;k.source="library";l.push(k)}this.initChainCallControl({length:l.length,action:"to_history",history_name:m});jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+j);this.chainCallImportingIntoHistory(l,m)},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(f,j){var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var g="/api/libraries/datasets/download/"+j;var i={ldda_ids:h};this.processDownload(g,i,"get")},processDownload:function(g,h,i){if(g&&h){h=typeof h==="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon.")}else{e.error("An error occurred.")}},addFilesFromHistoryModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesFromHistory();var h=f.options.full_path[f.options.full_path.length-1][1];f.modal.show({closing_events:true,title:"Adding datasets from your history to folder "+h,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.back()}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(i){f.fetchAndDisplayHistoryContents(i.target.value)})}else{e.error("An error ocurred.")}})},importFilesFromPathModal:function(){var g=this;this.modal=Galaxy.modal;var f=this.templateImportPathModal();this.modal.show({closing_events:true,title:"Enter paths relative to Galaxy root",body:f({}),buttons:{Import:function(){g.importFromPathsClicked(g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+g.id,{trigger:true})}})},importFilesFromUserdirModal:function(){var g=this;this.modal=Galaxy.modal;var f=this.templateBrowserModal();this.modal.show({closing_events:true,title:"Select folders or files to import",body:f({}),buttons:{Import:function(){g.importFromUserdirClicked(g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+g.id,{trigger:true})}});this.renderJstree({disabled_jstree_element:"folders"});$("input[type=radio]").change(function(h){if(h.target.value==="jstree-disable-folders"){g.renderJstree({disabled_jstree_element:"folders"});$(".jstree-folders-message").hide();$(".jstree-preserve-structure").hide();$(".jstree-link-files").hide();$(".jstree-files-message").show()}else{if(h.target.value==="jstree-disable-files"){$(".jstree-files-message").hide();$(".jstree-folders-message").show();$(".jstree-link-files").show();$(".jstree-preserve-structure").show();g.renderJstree({disabled_jstree_element:"files"})}}})},renderJstree:function(f){var h=this;this.options=_.extend(this.options,f);var g=this.options.disabled_jstree_element;this.jstree=new c.Jstree();this.jstree.url=this.jstree.urlRoot+"?target=userdir&format=jstree&disable="+g;this.jstree.fetch({success:function(j,i){define("jquery",function(){return jQuery});require(["libs/jquery/jstree"],function(k){$("#jstree_browser").jstree("destroy");$("#jstree_browser").jstree({core:{data:j},plugins:["types","checkbox"],types:{folder:{icon:"jstree-folder"},file:{icon:"jstree-file"}},checkbox:{three_state:false}})})},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})},importFromPathsClicked:function(){var f=this.modal.$el.find(".preserve-checkbox").is(":checked");var k=this.modal.$el.find(".link-checkbox").is(":checked");var j=$("textarea#import_paths").val();var h=[];if(!j){e.info("Please enter a path relative to Galaxy root.")}else{this.modal.disableButton("Import");j=j.split("\n");for(var g=j.length-1;g>=0;g--){trimmed=j[g].trim();if(trimmed.length!==0){h.push(trimmed)}}this.initChainCallControl({length:h.length,action:"adding_datasets"});this.chainCallImportingFolders(h,f,k,"admin_path")}},initChainCallControl:function(f){var g;switch(f.action){case"adding_datasets":g=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(g({folder_name:this.options.folder_name}));break;case"deleting_datasets":g=this.templateDeletingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(g());break;case"to_history":g=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(g({history_name:f.history_name}));break;default:console.error("Wrong action specified.");break}this.progress=0;this.progressStep=100/f.length;this.options.chain_call_control.total_number=f.length;this.options.chain_call_control.failed_number=0},importFromUserdirClicked:function(k){var g=$("#jstree_browser").jstree().get_selected(true);var f=this.modal.$el.find(".preserve-checkbox").is(":checked");var m=this.modal.$el.find(".link-checkbox").is(":checked");var j=g[0].type;var l=[];if(g.length<1){e.info("You must select some items first.")}else{this.modal.disableButton("Import");for(var h=g.length-1;h>=0;h--){if(g[h].li_attr.full_path!==undefined){l.push(g[h].li_attr.full_path)}}this.initChainCallControl({length:l.length,action:"adding_datasets"});if(j==="folder"){this.chainCallImportingFolders(l,f,m,"userdir_folder")}else{if(j==="file"){this.chainCallImportingUserdirFiles(l)}}}},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})},addAllDatasetsFromHistory:function(){var k=this.modal.$el.find("#selected_history_content").find(":checked");var f=[];var j=[];if(k.length<1){e.info("You must select some datasets first.")}else{this.modal.disableButton("Add");k.each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.initChainCallControl({length:j.length,action:"adding_datasets"});this.chainCallAddingHdas(j)}},chainCallImportingIntoHistory:function(g,j){var f=this;var h=g.pop();if(typeof h=="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be imported into history. Click this to see what was imported.","",{onclick:function(){window.location="/"}})}}}Galaxy.modal.hide();return true}var i=$.when(h.save({content:h.content,source:h.source}));i.done(function(){f.updateProgress();f.chainCallImportingIntoHistory(g,j)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallImportingIntoHistory(g,j)})},chainCallImportingUserdirFiles:function(i){var f=this;var g=i.pop();if(typeof g==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected files imported into the current folder");Galaxy.modal.hide()}else{e.error("An error occured.")}return true}var h=$.when($.post("/api/libraries/datasets?encoded_folder_id="+f.id+"&source=userdir_file&path="+g));h.done(function(j){f.updateProgress();f.chainCallImportingUserdirFiles(i)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallImportingUserdirFiles(i)})},chainCallImportingFolders:function(k,f,l,i){var g=this;var h=k.pop();if(typeof h=="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected folders and their contents imported into the current folder.");Galaxy.modal.hide()}else{e.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+g.id+"&source="+i+"&path="+h+"&preserve_dirs="+f+"&link_data="+l));j.done(function(m){g.updateProgress();g.chainCallImportingFolders(k,f,l,i)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallImportingFolders(k,f,l,i)})},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h=="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var i=$.when(h.save({from_hda_id:h.get("from_hda_id")}));i.done(function(j){Galaxy.libraries.folderListView.collection.add(j);f.updateProgress();f.chainCallAddingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallAddingHdas(g)})},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var i=$.when(h.destroy());i.done(function(k){Galaxy.libraries.folderListView.collection.remove(h.id);f.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var j=new c.Item(k);Galaxy.libraries.folderListView.collection.add(j)}f.chainCallDeletingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallDeletingHdas(g)})},checkIncludeDeleted:function(f){if(f.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You must select at least one dataset for deletion.")}else{var j=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:j({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var g=[];f.each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});this.progressStep=100/g.length;this.progress=0;var l=[];for(var h=g.length-1;h>=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},showLibInfo:function(){var g=Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;var f=null;var h=this;if(Galaxy.libraries.libraryListView!==null){f=Galaxy.libraries.libraryListView.collection.get(g);this.showLibInfoModal(f)}else{f=new c.Library({id:g});f.fetch({success:function(){h.showLibInfoModal(f)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})}},showLibInfoModal:function(f){var g=this.templateLibInfoInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Library Information",body:g({library:f}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(f){switch(f.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromUserdirModal();break;default:Galaxy.libraries.library_router.back();e.error("Invalid import source.");break}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push("<% if(mutiple_add_dataset_options) { %>");tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button title="Add Datasets to Current Folder" id="" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-plus"></span><span class="fa fa-file"></span><span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#folders/<%= id %>/import/history"> from History</a></li>');tmpl_array.push("<% if(user_library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/userdir"> from User Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(allow_library_path_paste) { %>");tmpl_array.push(' <li class="divider"></li>');tmpl_array.push(' <li class="dropdown-header">Admins only</li>');tmpl_array.push("<% if(allow_library_path_paste) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/path">from Path</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push("<% } else { %>");tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("<% } %>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> Download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('<div id="lif_info_modal">');tmpl_array.push("<h2>Library name:</h2>");tmpl_array.push('<p><%- library.get("name") %></p>');tmpl_array.push("<h3>Library description:</h3>");tmpl_array.push('<p><%- library.get("description") %></p>');tmpl_array.push("<h3>Library synopsis:</h3>");tmpl_array.push('<p><%- library.get("synopsis") %></p>');tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Adding selected datasets to library folder <b><%= _.escape(folder_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateBrowserModal:function(){var f=[];f.push('<div id="file_browser_modal">');f.push('<div style="margin-bottom:1em;">');f.push('<label class="radio-inline">');f.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');f.push("</label>");f.push('<label class="radio-inline">');f.push(' <input title="Switch to selecting folders" type="radio" name="jstree-radio" value="jstree-disable-files"> Folders');f.push("</label>");f.push('<label class="checkbox-inline jstree-preserve-structure" style="display:none;">');f.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');f.push("Preserve directory structure");f.push(" </label>");f.push('<label class="checkbox-inline jstree-link-files" style="display:none;">');f.push(' <input class="link-checkbox" type="checkbox" value="link_files">');f.push("Link files instead of copying");f.push(" </label>");f.push("</div>");f.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');f.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');f.push('<div id="jstree_browser">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateImportPathModal:function(){var f=[];f.push('<div id="file_browser_modal">');f.push('<label class="checkbox-inline jstree-preserve-structure">');f.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');f.push("Preserve directory structure");f.push(" </label>");f.push('<label class="checkbox-inline jstree-link-files">');f.push(' <input class="link-checkbox" type="checkbox" value="link_files">');f.push("Link files instead of copying");f.push(" </label>");f.push("</div>");f.push('<div class="alert alert-info jstree-folders-message">All files within the given folders and their subfolders will be imported into the current folder.</div>');f.push('<textarea id="import_paths" class="form-control" rows="5" placeholder="Paths separated by newline"></textarea>');f.push("</div>");return _.template(f.join(""))},templateAddFilesFromHistory:function(){var f=[];f.push('<div id="add_files_modal">');f.push('<div id="history_modal_combo_bulk">');f.push("Select history: ");f.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</div>");f.push("<br/>");f.push('<div id="selected_history_content">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("<strong>Choose the datasets to import:</strong>");f.push("<ul>");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');f.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push(" </li>");f.push(" <% }); %>");f.push("</ul>");return _.template(f.join(""))}});return{FolderToolbarView:a}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-library-view.js --- a/static/scripts/packed/mvc/library/library-library-view.js +++ b/static/scripts/packed/mvc/library/library-library-view.js @@ -1,1 +1,1 @@ -define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchLibrary()}},fetchLibrary:function(e){this.options=_.extend(this.options,e);this.model=new c.Library({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{f.render()}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateLibrary();this.$el.html(f({item:this.model}));$("#center [data-toggle]").tooltip()},shareDataset:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();if(this.options.fetched_permissions!==undefined){if(this.options.fetched_permissions.access_library_role_list.length===0){this.model.set({is_unrestricted:true})}else{this.model.set({is_unrestricted:false})}}var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateLibraryPermissions();this.$el.html(g({library:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while fetching library permissions. :(")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f<g.length;f++){e.push(g[f][1]+":"+g[f][0])}return e},prepareSelectBoxes:function(i){this.options=_.extend(this.options,i);var e=this.options.fetched_permissions;var g=this;var f=this._serializeRoles(e.access_library_role_list);var j=this._serializeRoles(e.add_library_item_role_list);var h=this._serializeRoles(e.manage_library_role_list);var k=this._serializeRoles(e.modify_library_role_list);g.accessSelectObject=new a.View(this._createSelectOptions(this,"access_perm",f,true));g.addSelectObject=new a.View(this._createSelectOptions(this,"add_perm",j,false));g.manageSelectObject=new a.View(this._createSelectOptions(this,"manage_perm",h,false));g.modifySelectObject=new a.View(this._createSelectOptions(this,"modify_perm",k,false))},_createSelectOptions:function(f,k,i,e){e=e===true?e:false;var j={minimumInputLength:0,css:k,multiple:true,placeholder:"Click to select a role",container:f.$el.find("#"+k),ajax:{url:"/api/libraries/"+f.id+"/permissions?scope=available&is_library_access="+e,dataType:"json",quietMillis:100,data:function(l,m){return{q:l,page_limit:10,page:m}},results:function(n,m){var l=(m*10)<n.total;return{results:n.roles,more:l}}},formatResult:function g(l){return l.name+" type: "+l.type},formatSelection:function h(l){return l.name},initSelection:function(l,n){var m=[];$(l.val().split(",")).each(function(){var o=this.split(":");m.push({id:o[0],name:o[1]})});n(m)},initialData:i,dropdownCssClass:"bigdrop"};return j},comingSoon:function(){d.warning("Feature coming soon")},copyToClipboard:function(){var e=Backbone.history.location.href;if(e.lastIndexOf("/permissions")!==-1){e=e.substr(0,e.lastIndexOf("/permissions"))}window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},makeDatasetPrivate:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=make_private").done(function(f){e.model.set({is_unrestricted:false});e.showPermissions({fetched_permissions:f});d.success("The dataset is now private to you")}).fail(function(){d.error("An error occurred while making dataset private :(")})},removeDatasetRestrictions:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=remove_restrictions").done(function(f){e.model.set({is_unrestricted:true});e.showPermissions({fetched_permissions:f});d.success("Access to this dataset is now unrestricted")}).fail(function(){d.error("An error occurred while making dataset unrestricted :(")})},_extractIds:function(e){ids_list=[];for(var f=e.length-1;f>=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var i=this._extractIds(this.accessSelectObject.$el.select2("data"));var e=this._extractIds(this.addSelectObject.$el.select2("data"));var j=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/libraries/"+g.id+"/permissions?action=set_permissions",{"access_ids[]":i,"add_ids[]":e,"manage_ids[]":j,"modify_ids[]":f,}).done(function(k){g.showPermissions({fetched_permissions:k});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting library permissions :(")})},templateLibrary:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');e.push(" </div>");e.push(" <p>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');e.push(" </p>");e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><%= _.escape(item.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (item.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateLibraryPermissions:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#"><button data-toggle="tooltip" data-placement="top" title="Go back to the list of Libraries" class="btn btn-default primary-button" type="button"><span class="fa fa-list"></span> Libraries</span></button></a>');e.push(" </div>");e.push('<h1>Library: <%= _.escape(library.get("name")) %></h1>');e.push('<div class="alert alert-warning">');e.push("<% if (is_admin) { %>");e.push("You are logged in as an <strong>administrator</strong> therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% }%>");e.push("</div>");e.push('<div class="dataset_table">');e.push("<h2>Library permissions</h2>");e.push("<h4>Roles that can access the library</h4>");e.push('<div id="access_perm" class="access_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can access this library. If there are no access roles set on the library it is considered <strong>unrestricted</strong>.</div>');e.push("<h4>Roles that can manage permissions on this library</h4>");e.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions on this library (includes giving access).</div>');e.push("<h4>Roles that can add items to this library</h4>");e.push('<div id="add_perm" class="add_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can add items to this library (folders and datasets).</div>');e.push("<h4>Roles that can modify this library</h4>");e.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify this library (name, synopsis, etc.).</div>');e.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications made on this page" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push("</div>");e.push("</div>");return _.template(e.join(""))}});return{LibraryView:b}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchLibrary()}},fetchLibrary:function(e){this.options=_.extend(this.options,e);this.model=new c.Library({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{f.render()}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateLibrary();this.$el.html(f({item:this.model}));$("#center [data-toggle]").tooltip()},shareDataset:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();if(this.options.fetched_permissions!==undefined){if(this.options.fetched_permissions.access_library_role_list.length===0){this.model.set({is_unrestricted:true})}else{this.model.set({is_unrestricted:false})}}var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateLibraryPermissions();this.$el.html(g({library:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while attempting to fetch library permissions.")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f<g.length;f++){e.push(g[f][1]+":"+g[f][0])}return e},prepareSelectBoxes:function(i){this.options=_.extend(this.options,i);var e=this.options.fetched_permissions;var g=this;var f=this._serializeRoles(e.access_library_role_list);var j=this._serializeRoles(e.add_library_item_role_list);var h=this._serializeRoles(e.manage_library_role_list);var k=this._serializeRoles(e.modify_library_role_list);g.accessSelectObject=new a.View(this._createSelectOptions(this,"access_perm",f,true));g.addSelectObject=new a.View(this._createSelectOptions(this,"add_perm",j,false));g.manageSelectObject=new a.View(this._createSelectOptions(this,"manage_perm",h,false));g.modifySelectObject=new a.View(this._createSelectOptions(this,"modify_perm",k,false))},_createSelectOptions:function(f,k,i,e){e=e===true?e:false;var j={minimumInputLength:0,css:k,multiple:true,placeholder:"Click to select a role",container:f.$el.find("#"+k),ajax:{url:"/api/libraries/"+f.id+"/permissions?scope=available&is_library_access="+e,dataType:"json",quietMillis:100,data:function(l,m){return{q:l,page_limit:10,page:m}},results:function(n,m){var l=(m*10)<n.total;return{results:n.roles,more:l}}},formatResult:function g(l){return l.name+" type: "+l.type},formatSelection:function h(l){return l.name},initSelection:function(l,n){var m=[];$(l.val().split(",")).each(function(){var o=this.split(":");m.push({id:o[0],name:o[1]})});n(m)},initialData:i,dropdownCssClass:"bigdrop"};return j},comingSoon:function(){d.warning("Feature coming soon.")},copyToClipboard:function(){var e=Backbone.history.location.href;if(e.lastIndexOf("/permissions")!==-1){e=e.substr(0,e.lastIndexOf("/permissions"))}window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},makeDatasetPrivate:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=make_private").done(function(f){e.model.set({is_unrestricted:false});e.showPermissions({fetched_permissions:f});d.success("The dataset is now private to you.")}).fail(function(){d.error("An error occurred while attempting to make dataset private.")})},removeDatasetRestrictions:function(){var e=this;$.post("/api/libraries/datasets/"+e.id+"/permissions?action=remove_restrictions").done(function(f){e.model.set({is_unrestricted:true});e.showPermissions({fetched_permissions:f});d.success("Access to this dataset is now unrestricted.")}).fail(function(){d.error("An error occurred while attempting to make dataset unrestricted.")})},_extractIds:function(e){ids_list=[];for(var f=e.length-1;f>=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var i=this._extractIds(this.accessSelectObject.$el.select2("data"));var e=this._extractIds(this.addSelectObject.$el.select2("data"));var j=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/libraries/"+g.id+"/permissions?action=set_permissions",{"access_ids[]":i,"add_ids[]":e,"manage_ids[]":j,"modify_ids[]":f,}).done(function(k){g.showPermissions({fetched_permissions:k});d.success("Permissions saved.")}).fail(function(){d.error("An error occurred while attempting to set library permissions.")})},templateLibrary:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library item" class="btn btn-default toolbtn_modify_dataset primary-button" type="button"><span class="fa fa-pencil"></span> Modify</span></button>');e.push(' <a href="#folders/<%- item.get("folder_id") %>/datasets/<%- item.id %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Manage permissions" class="btn btn-default toolbtn_change_permissions primary-button" type="button"><span class="fa fa-group"></span> Permissions</span></button></a>');e.push(' <button data-toggle="tooltip" data-placement="top" title="Share dataset" class="btn btn-default toolbtn-share-dataset primary-button" type="button"><span class="fa fa-share"></span> Share</span></button>');e.push(" </div>");e.push(" <p>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' <button data-toggle="tooltip" data-placement="top" title="Copy to clipboard" class="btn btn-default btn-copy-link-to-clipboard primary-button" type="button"><span class="fa fa-clipboard"></span> To Clipboard</span></button> ');e.push(" </p>");e.push('<div class="dataset_table">');e.push(' <table class="grid table table-striped table-condensed">');e.push(" <tr>");e.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');e.push(' <td><%= _.escape(item.get("name")) %></td>');e.push(" </tr>");e.push(' <% if (item.get("file_ext")) { %>');e.push(" <tr>");e.push(' <th scope="row">Data type</th>');e.push(' <td><%= _.escape(item.get("file_ext")) %></td>');e.push(" </tr>");e.push(" <% } %>");e.push(" </table>");e.push("</div>");e.push("</div>");return _.template(e.join(""))},templateLibraryPermissions:function(){var e=[];e.push('<div class="library_style_container">');e.push(' <div id="library_toolbar">');e.push(' <a href="#"><button data-toggle="tooltip" data-placement="top" title="Go back to the list of Libraries" class="btn btn-default primary-button" type="button"><span class="fa fa-list"></span> Libraries</span></button></a>');e.push(" </div>");e.push('<h1>Library: <%= _.escape(library.get("name")) %></h1>');e.push('<div class="alert alert-warning">');e.push("<% if (is_admin) { %>");e.push("You are logged in as an <strong>administrator</strong> therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% }%>");e.push("</div>");e.push('<div class="dataset_table">');e.push("<h2>Library permissions</h2>");e.push("<h4>Roles that can access the library</h4>");e.push('<div id="access_perm" class="access_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can access this library. If there are no access roles set on the library it is considered <strong>unrestricted</strong>.</div>');e.push("<h4>Roles that can manage permissions on this library</h4>");e.push('<div id="manage_perm" class="manage_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can manage permissions on this library (includes giving access).</div>');e.push("<h4>Roles that can add items to this library</h4>");e.push('<div id="add_perm" class="add_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can add items to this library (folders and datasets).</div>');e.push("<h4>Roles that can modify this library</h4>");e.push('<div id="modify_perm" class="modify_perm roles-selection"></div>');e.push('<div class="alert alert-info roles-selection">User with <strong>any</strong> of these roles can modify this library (name, synopsis, etc.).</div>');e.push('<button data-toggle="tooltip" data-placement="top" title="Save modifications made on this page" class="btn btn-default toolbtn_save_permissions primary-button" type="button"><span class="fa fa-floppy-o"></span> Save</span></button>');e.push("</div>");e.push("</div>");return _.template(e.join(""))}});return{LibraryView:b}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-librarylist-view.js --- a/static/scripts/packed/mvc/library/library-librarylist-view.js +++ b/static/scripts/packed/mvc/library/library-librarylist-view.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);var i=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){i.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');tmpl_array.push("<% } else{ %>");tmpl_array.push('<table class="grid table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');tmpl_array.push(' <th style="width:22%;">description</th>');tmpl_array.push(' <th style="width:22%;">synopsis</th> ');tmpl_array.push(' <th style="width:26%;"></th> ');tmpl_array.push(" </thead>");tmpl_array.push(' <tbody id="library_list_body">');tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("<% }%>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}}); \ No newline at end of file +define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);var i=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){i.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');tmpl_array.push("<% } else{ %>");tmpl_array.push('<table class="grid table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');tmpl_array.push(' <th style="width:22%;">description</th>');tmpl_array.push(' <th style="width:22%;">synopsis</th> ');tmpl_array.push(' <th style="width:26%;"></th> ');tmpl_array.push(" </thead>");tmpl_array.push(' <tbody id="library_list_body">');tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("<% }%>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-libraryrow-view.js --- a/static/scripts/packed/mvc/library/library-libraryrow-view.js +++ b/static/scripts/packed/mvc/library/library-libraryrow-view.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr"],function(b,c,d){var a=Backbone.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:false,element_visibility_config:{upload_library_btn:false,edit_library_btn:false,permission_library_btn:false,save_library_btn:false,cancel_library_btn:false,delete_library_btn:false,undelete_library_btn:false},initialize:function(e){this.render(e)},render:function(f){if(typeof f==="undefined"){f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(f);var e=this.templateRow();this.setElement(e({library:f,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(e){$(".tooltip").hide();var f=this.$el;this.render(e);f.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){vis_config=this.element_visibility_config;if(this.edit_mode===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.delete_library_btn=false;if(e.get("deleted")===true){vis_config.undelete_library_btn=true;vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false}else{if(e.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(e.get("can_user_add")===true){vis_config.upload_library_btn=true}if(e.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(e.get("can_user_manage")===true){vis_config.permission_library_btn=true}}}}else{if(this.edit_mode===true){vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false;vis_config.save_library_btn=true;vis_config.cancel_library_btn=true;vis_config.delete_library_btn=true;vis_config.undelete_library_btn=false}}this.element_visibility_config=vis_config},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){this.edit_mode=false;this.repaint()},save_library_modification:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var g=false;var i=this.$el.find(".input_library_name").val();if(typeof i!=="undefined"&&i!==f.get("name")){if(i.length>2){f.set("name",i);g=true}else{d.warning("Library name has to be at least 3 characters long");return}}var h=this.$el.find(".input_library_description").val();if(typeof h!=="undefined"&&h!==f.get("description")){f.set("description",h);g=true}var j=this.$el.find(".input_library_synopsis").val();if(typeof j!=="undefined"&&j!==f.get("synopsis")){f.set("synopsis",j);g=true}if(g){var e=this;f.save(null,{patch:true,success:function(k){e.edit_mode=false;e.repaint(k);d.success("Changes to library saved")},error:function(l,k){if(typeof k.responseJSON!=="undefined"){d.error(k.responseJSON.err_msg)}else{d.error("An error occured during updating the library :(")}}})}else{this.edit_mode=false;this.repaint(f);d.info("Nothing has changed")}},delete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.destroy({success:function(g){g.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();e.repaint(g);e.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){e.repaint(g)}}d.success("Library has been marked deleted")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error occured during deleting the library :(")}}})},undelete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.url=f.urlRoot+f.id+"?undelete=true";f.destroy({success:function(g){g.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;e.repaint(g);d.success("Library has been undeleted")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error occured while undeleting the library :(")}}})},templateRow:function(){tmpl_array=[];tmpl_array.push(' <tr class="<% if(library.get("deleted") === true) { print("active") } %>" style="display:none;" data-id="<%- library.get("id") %>">');tmpl_array.push(" <% if(!edit_mode) { %>");tmpl_array.push(' <% if(library.get("deleted")) { %>');tmpl_array.push(' <td style="color:grey;"><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span><%- library.get("name") %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <% if(library.get("description")) { %>');tmpl_array.push(' <% if( (library.get("description")).length> 80 ) { %>');tmpl_array.push(' <td data-toggle="tooltip" data-placement="bottom" title="<%= _.escape(library.get("description")) %>"><%= _.escape(library.get("description")).substring(0, 80) + "..." %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><%= _.escape(library.get("description"))%></td>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(" <td></td>");tmpl_array.push(" <% } %>");tmpl_array.push(' <% if(library.get("synopsis")) { %>');tmpl_array.push(' <% if( (library.get("synopsis")).length> 120 ) { %>');tmpl_array.push(' <td data-toggle="tooltip" data-placement="bottom" title="<%= _.escape(library.get("synopsis")) %>"><%= _.escape(library.get("synopsis")).substring(0, 120) + "..." %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><%= _.escape(library.get("synopsis"))%></td>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(" <td></td>");tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else if(edit_mode){ %>");tmpl_array.push(' <td><textarea rows="4" class="form-control input_library_name" placeholder="name" ><%- library.get("name") %></textarea></td>');tmpl_array.push(' <td><textarea rows="4" class="form-control input_library_description" placeholder="description" ><%- library.get("description") %></textarea></td>');tmpl_array.push(' <td><textarea rows="4" class="form-control input_library_synopsis" placeholder="synopsis" ><%- library.get("synopsis") %></textarea></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if( (library.get("public")) && (library.get("deleted") === false) ) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Unrestricted library" style="color:grey;" class="fa fa-globe fa-lg public_lib_ico"></span>');tmpl_array.push(" <% }%>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify <%- library.get("name") %>" class="primary-button btn-xs edit_library_btn" type="button" style="<% if(button_config.edit_library_btn === false) { print("display:none;") } %>"><span class="fa fa-pencil"></span></button>');tmpl_array.push(' <a href="#library/<%- library.get("id") %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Modify permissions" class="primary-button btn-xs permission_library_btn" type="button" style="<% if(button_config.permission_library_btn === false) { print("display:none;") } %>"><span class="fa fa-group"></span></button></a>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Save changes" class="primary-button btn-xs save_library_btn" type="button" style="<% if(button_config.save_library_btn === false) { print("display:none;") } %>"><span class="fa fa-floppy-o"> Save</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Discard changes" class="primary-button btn-xs cancel_library_btn" type="button" style="<% if(button_config.cancel_library_btn === false) { print("display:none;") } %>"><span class="fa fa-times"> Cancel</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Delete <%- library.get("name") %>" class="primary-button btn-xs delete_library_btn" type="button" style="<% if(button_config.delete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-trash-o"> Delete</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete <%- library.get("name") %> " class="primary-button btn-xs undelete_library_btn" type="button" style="<% if(button_config.undelete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-unlock"> Undelete</span></button>');tmpl_array.push(" </td>");tmpl_array.push(" </tr>");return _.template(tmpl_array.join(""))}});return{LibraryRowView:a}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr"],function(b,c,d){var a=Backbone.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:false,element_visibility_config:{upload_library_btn:false,edit_library_btn:false,permission_library_btn:false,save_library_btn:false,cancel_library_btn:false,delete_library_btn:false,undelete_library_btn:false},initialize:function(e){this.render(e)},render:function(f){if(typeof f==="undefined"){f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(f);var e=this.templateRow();this.setElement(e({library:f,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(e){$(".tooltip").hide();var f=this.$el;this.render(e);f.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){vis_config=this.element_visibility_config;if(this.edit_mode===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.delete_library_btn=false;if(e.get("deleted")===true){vis_config.undelete_library_btn=true;vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false}else{if(e.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(e.get("can_user_add")===true){vis_config.upload_library_btn=true}if(e.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(e.get("can_user_manage")===true){vis_config.permission_library_btn=true}}}}else{if(this.edit_mode===true){vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false;vis_config.save_library_btn=true;vis_config.cancel_library_btn=true;vis_config.delete_library_btn=true;vis_config.undelete_library_btn=false}}this.element_visibility_config=vis_config},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){this.edit_mode=false;this.repaint()},save_library_modification:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var g=false;var i=this.$el.find(".input_library_name").val();if(typeof i!=="undefined"&&i!==f.get("name")){if(i.length>2){f.set("name",i);g=true}else{d.warning("Library name has to be at least 3 characters long.");return}}var h=this.$el.find(".input_library_description").val();if(typeof h!=="undefined"&&h!==f.get("description")){f.set("description",h);g=true}var j=this.$el.find(".input_library_synopsis").val();if(typeof j!=="undefined"&&j!==f.get("synopsis")){f.set("synopsis",j);g=true}if(g){var e=this;f.save(null,{patch:true,success:function(k){e.edit_mode=false;e.repaint(k);d.success("Changes to library saved.")},error:function(l,k){if(typeof k.responseJSON!=="undefined"){d.error(k.responseJSON.err_msg)}else{d.error("An error occured while attempting to update the library.")}}})}else{this.edit_mode=false;this.repaint(f);d.info("Nothing has changed.")}},delete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.destroy({success:function(g){g.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();e.repaint(g);e.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){e.repaint(g)}}d.success("Library has been marked deleted.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error occured during deleting the library.")}}})},undelete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.url=f.urlRoot+f.id+"?undelete=true";f.destroy({success:function(g){g.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;e.repaint(g);d.success("Library has been undeleted.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error occured while undeleting the library.")}}})},templateRow:function(){tmpl_array=[];tmpl_array.push(' <tr class="<% if(library.get("deleted") === true) { print("active") } %>" style="display:none;" data-id="<%- library.get("id") %>">');tmpl_array.push(" <% if(!edit_mode) { %>");tmpl_array.push(' <% if(library.get("deleted")) { %>');tmpl_array.push(' <td style="color:grey;"><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span><%- library.get("name") %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <% if(library.get("description")) { %>');tmpl_array.push(' <% if( (library.get("description")).length> 80 ) { %>');tmpl_array.push(' <td data-toggle="tooltip" data-placement="bottom" title="<%= _.escape(library.get("description")) %>"><%= _.escape(library.get("description")).substring(0, 80) + "..." %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><%= _.escape(library.get("description"))%></td>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(" <td></td>");tmpl_array.push(" <% } %>");tmpl_array.push(' <% if(library.get("synopsis")) { %>');tmpl_array.push(' <% if( (library.get("synopsis")).length> 120 ) { %>');tmpl_array.push(' <td data-toggle="tooltip" data-placement="bottom" title="<%= _.escape(library.get("synopsis")) %>"><%= _.escape(library.get("synopsis")).substring(0, 120) + "..." %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><%= _.escape(library.get("synopsis"))%></td>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(" <td></td>");tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else if(edit_mode){ %>");tmpl_array.push(' <td><textarea rows="4" class="form-control input_library_name" placeholder="name" ><%- library.get("name") %></textarea></td>');tmpl_array.push(' <td><textarea rows="4" class="form-control input_library_description" placeholder="description" ><%- library.get("description") %></textarea></td>');tmpl_array.push(' <td><textarea rows="4" class="form-control input_library_synopsis" placeholder="synopsis" ><%- library.get("synopsis") %></textarea></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if( (library.get("public")) && (library.get("deleted") === false) ) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Unrestricted library" style="color:grey;" class="fa fa-globe fa-lg public_lib_ico"></span>');tmpl_array.push(" <% }%>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify <%- library.get("name") %>" class="primary-button btn-xs edit_library_btn" type="button" style="<% if(button_config.edit_library_btn === false) { print("display:none;") } %>"><span class="fa fa-pencil"></span></button>');tmpl_array.push(' <a href="#library/<%- library.get("id") %>/permissions"><button data-toggle="tooltip" data-placement="top" title="Modify permissions" class="primary-button btn-xs permission_library_btn" type="button" style="<% if(button_config.permission_library_btn === false) { print("display:none;") } %>"><span class="fa fa-group"></span></button></a>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Save changes" class="primary-button btn-xs save_library_btn" type="button" style="<% if(button_config.save_library_btn === false) { print("display:none;") } %>"><span class="fa fa-floppy-o"> Save</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Discard changes" class="primary-button btn-xs cancel_library_btn" type="button" style="<% if(button_config.cancel_library_btn === false) { print("display:none;") } %>"><span class="fa fa-times"> Cancel</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Delete <%- library.get("name") %>" class="primary-button btn-xs delete_library_btn" type="button" style="<% if(button_config.delete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-trash-o"> Delete</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete <%- library.get("name") %> " class="primary-button btn-xs undelete_library_btn" type="button" style="<% if(button_config.undelete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-unlock"> Undelete</span></button>');tmpl_array.push(" </td>");tmpl_array.push(" </tr>");return _.template(tmpl_array.join(""))}});return{LibraryRowView:a}}); \ No newline at end of file diff -r c059c1061efa625d6ad1ff2fc298db03b01e2c61 -r 48fc9b40fda9458d502055d4887f5028ee64aa64 static/scripts/packed/mvc/library/library-librarytoolbar-view.js --- a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js +++ b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js @@ -1,1 +1,1 @@ -define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(" <div>");tmpl_array.push(" ");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured.")}}})}else{b.error("Library's name is missing.")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(" <div>");tmpl_array.push(" ");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/ac8d29ffce54/ Changeset: ac8d29ffce54 User: martenson Date: 2014-09-17 04:07:52+00:00 Summary: Merge Affected #: 23 files diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 config/tool_shed.ini.sample --- /dev/null +++ b/config/tool_shed.ini.sample @@ -0,0 +1,114 @@ +# ---- HTTP Server ---------------------------------------------------------- + +[server:main] + +use = egg:Paste#http +port = 9009 + +# The address on which to listen. By default, only listen to localhost (the tool shed will not +# be accessible over the network). Use '0.0.0.0' to listen on all available network interfaces. +#host = 0.0.0.0 +host = 127.0.0.1 + +use_threadpool = true +threadpool_workers = 10 +# Set the number of seconds a thread can work before you should kill it (assuming it will never finish) to 3 hours. +threadpool_kill_thread_limit = 10800 + +# ---- Galaxy Webapps Community Interface ------------------------------------------------- + +[app:main] + +# Specifies the factory for the universe WSGI application +paste.app_factory = galaxy.webapps.tool_shed.buildapp:app_factory +log_level = DEBUG + +# Database connection +database_file = database/community.sqlite +# You may use a SQLAlchemy connection string to specify an external database instead +#database_connection = postgres:///community_test?host=/var/run/postgresql + +# Where the hgweb.config file is stored. The default is the Galaxy installation directory. +#hgweb_config_dir = None + +# Where tool shed repositories are stored. +file_path = database/community_files +# Temporary storage for additional datasets, this should be shared through the cluster +new_file_path = database/tmp + +# File containing old-style genome builds +#builds_file_path = tool-data/shared/ucsc/builds.txt + +# Session support (beaker) +use_beaker_session = True +session_type = memory +session_data_dir = %(here)s/database/beaker_sessions +session_key = galaxysessions +session_secret = changethisinproduction + +# -- Users and Security + +# Galaxy encodes various internal values when these values will be output in +# some format (for example, in a URL or cookie). You should set a key to be +# used by the algorithm that encodes and decodes these values. It can be any +# string. If left unchanged, anyone could construct a cookie that would grant +# them access to others' sessions. +id_secret = changethisinproductiontoo + +# User authentication can be delegated to an upstream proxy server (usually +# Apache). The upstream proxy should set a REMOTE_USER header in the request. +# Enabling remote user disables regular logins. For more information, see: +# https://wiki.galaxyproject.org/Admin/Config/ApacheProxy +#use_remote_user = False + +# Configuration for debugging middleware +debug = true +use_lint = false + +# NEVER enable this on a public site (even test or QA) +# use_interactive = true + +# this should be a comma-separated list of valid Galaxy users +#admin_users = user1@example.org,user2@example.org + +# Force everyone to log in (disable anonymous access) +require_login = False + +# path to sendmail +sendmail_path = /usr/sbin/sendmail + +# Number of saved tool test results produced by the install and test framework for each repository. +#num_tool_test_results_saved = 5 + +# For use by email messages sent from the tool shed +#smtp_server = smtp.your_tool_shed_server +#email_from = your_tool_shed_email@server + +# The URL linked by the "Support" link in the "Help" menu. +#support_url = https://wiki.galaxyproject.org/Support + +# Write thread status periodically to 'heartbeat.log' (careful, uses disk space rapidly!) +## use_heartbeat = True + +# Profiling middleware (cProfile based) +## use_profile = True + +# Enable creation of Galaxy flavor Docker Image +#enable_galaxy_flavor_docker_image = False + +# Use the new iframe / javascript based layout +use_new_layout = true + +# Show a message box under the masthead. +#message_box_visible = False +#message_box_content = None +#message_box_class = info + +# Serving static files (needed if running standalone) +#static_enabled = True +#static_cache_time = 360 +#static_dir = static/ +#static_images_dir = static/images +#static_favicon_dir = static/favicon.ico +#static_scripts_dir = static/scripts/ +#static_style_dir = static/style/blue diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 config/tool_shed_wsgi.ini.sample --- a/config/tool_shed_wsgi.ini.sample +++ /dev/null @@ -1,114 +0,0 @@ -# ---- HTTP Server ---------------------------------------------------------- - -[server:main] - -use = egg:Paste#http -port = 9009 - -# The address on which to listen. By default, only listen to localhost (the tool shed will not -# be accessible over the network). Use '0.0.0.0' to listen on all available network interfaces. -#host = 0.0.0.0 -host = 127.0.0.1 - -use_threadpool = true -threadpool_workers = 10 -# Set the number of seconds a thread can work before you should kill it (assuming it will never finish) to 3 hours. -threadpool_kill_thread_limit = 10800 - -# ---- Galaxy Webapps Community Interface ------------------------------------------------- - -[app:main] - -# Specifies the factory for the universe WSGI application -paste.app_factory = galaxy.webapps.tool_shed.buildapp:app_factory -log_level = DEBUG - -# Database connection -database_file = database/community.sqlite -# You may use a SQLAlchemy connection string to specify an external database instead -#database_connection = postgres:///community_test?host=/var/run/postgresql - -# Where the hgweb.config file is stored. The default is the Galaxy installation directory. -#hgweb_config_dir = None - -# Where tool shed repositories are stored. -file_path = database/community_files -# Temporary storage for additional datasets, this should be shared through the cluster -new_file_path = database/tmp - -# File containing old-style genome builds -#builds_file_path = tool-data/shared/ucsc/builds.txt - -# Session support (beaker) -use_beaker_session = True -session_type = memory -session_data_dir = %(here)s/database/beaker_sessions -session_key = galaxysessions -session_secret = changethisinproduction - -# -- Users and Security - -# Galaxy encodes various internal values when these values will be output in -# some format (for example, in a URL or cookie). You should set a key to be -# used by the algorithm that encodes and decodes these values. It can be any -# string. If left unchanged, anyone could construct a cookie that would grant -# them access to others' sessions. -id_secret = changethisinproductiontoo - -# User authentication can be delegated to an upstream proxy server (usually -# Apache). The upstream proxy should set a REMOTE_USER header in the request. -# Enabling remote user disables regular logins. For more information, see: -# https://wiki.galaxyproject.org/Admin/Config/ApacheProxy -#use_remote_user = False - -# Configuration for debugging middleware -debug = true -use_lint = false - -# NEVER enable this on a public site (even test or QA) -# use_interactive = true - -# this should be a comma-separated list of valid Galaxy users -#admin_users = user1@example.org,user2@example.org - -# Force everyone to log in (disable anonymous access) -require_login = False - -# path to sendmail -sendmail_path = /usr/sbin/sendmail - -# Number of saved tool test results produced by the install and test framework for each repository. -#num_tool_test_results_saved = 5 - -# For use by email messages sent from the tool shed -#smtp_server = smtp.your_tool_shed_server -#email_from = your_tool_shed_email@server - -# The URL linked by the "Support" link in the "Help" menu. -#support_url = https://wiki.galaxyproject.org/Support - -# Write thread status periodically to 'heartbeat.log' (careful, uses disk space rapidly!) -## use_heartbeat = True - -# Profiling middleware (cProfile based) -## use_profile = True - -# Enable creation of Galaxy flavor Docker Image -#enable_galaxy_flavor_docker_image = False - -# Use the new iframe / javascript based layout -use_new_layout = true - -# Show a message box under the masthead. -#message_box_visible = False -#message_box_content = None -#message_box_class = info - -# Serving static files (needed if running standalone) -static_enabled = True -static_cache_time = 360 -static_dir = %(here)s/static/ -static_images_dir = %(here)s/static/images -static_favicon_dir = %(here)s/static/favicon.ico -static_scripts_dir = %(here)s/static/scripts/ -static_style_dir = %(here)s/static/june_2007_style/blue diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 install_and_test_tool_shed_repositories.sh --- a/install_and_test_tool_shed_repositories.sh +++ b/install_and_test_tool_shed_repositories.sh @@ -33,7 +33,7 @@ fi if [ -z "$GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF" ] ; then - if grep --quiet $GALAXY_INSTALL_TEST_TOOL_SHED_URL tool_sheds_conf.xml; then + if grep --quiet $GALAXY_INSTALL_TEST_TOOL_SHED_URL config/tool_sheds_conf.xml.sample; then echo "Tool sheds configuration tool_sheds_conf.xml ok, proceeding." else echo "ERROR: Tool sheds configuration tool_sheds_conf.xml does not have an entry for $GALAXY_INSTALL_TEST_TOOL_SHED_URL." diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -101,19 +101,22 @@ In case the activation is enforced it will filter out the jobs of inactive users. """ jobs_at_startup = [] + if self.track_jobs_in_database: + in_list = ( model.Job.states.QUEUED, + model.Job.states.RUNNING ) + else: + in_list = ( model.Job.states.NEW, + model.Job.states.QUEUED, + model.Job.states.RUNNING ) if self.app.config.user_activation_on: jobs_at_startup = self.sa_session.query( model.Job ).enable_eagerloads( False ) \ .outerjoin( model.User ) \ - .filter( ( ( model.Job.state == model.Job.states.NEW ) \ - | ( model.Job.state == model.Job.states.RUNNING ) \ - | ( model.Job.state == model.Job.states.QUEUED ) ) \ + .filter( model.Job.state.in_( in_list ) \ & ( model.Job.handler == self.app.config.server_name ) \ & or_( ( model.Job.user_id == None ), ( model.User.active == True ) ) ).all() else: jobs_at_startup = self.sa_session.query( model.Job ).enable_eagerloads( False ) \ - .filter( ( ( model.Job.state == model.Job.states.NEW ) \ - | ( model.Job.state == model.Job.states.RUNNING ) \ - | ( model.Job.state == model.Job.states.QUEUED ) ) \ + .filter( model.Job.state.in_( in_list ) \ & ( model.Job.handler == self.app.config.server_name ) ).all() for job in jobs_at_startup: diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/galaxy/model/orm/scripts.py --- a/lib/galaxy/model/orm/scripts.py +++ b/lib/galaxy/model/orm/scripts.py @@ -31,7 +31,7 @@ "tool_shed": { 'repo': 'lib/galaxy/webapps/tool_shed/model/migrate', - 'config_file': 'tool_shed_wsgi.ini', + 'config_file': 'config/tool_shed.ini', 'default_sqlite_file': './database/community.sqlite', }, "install": @@ -79,7 +79,7 @@ ... p.add_section('app:main') ... p.set('app:main', property, value) ... with open(os.path.join(config_dir, path), 'w') as f: p.write(f) - >>> write_ini('tool_shed_wsgi.ini', 'database_connection', 'sqlite:///pg/testdb1') + >>> write_ini('tool_shed.ini', 'database_connection', 'sqlite:///pg/testdb1') >>> config = get_config(['manage_db.py', 'tool_shed'], cwd=config_dir) >>> config['repo'] 'lib/galaxy/webapps/tool_shed/model/migrate' diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/galaxy/webapps/tool_shed/app.py --- a/lib/galaxy/webapps/tool_shed/app.py +++ b/lib/galaxy/webapps/tool_shed/app.py @@ -20,7 +20,7 @@ def __init__( self, **kwd ): print >> sys.stderr, "python path is: " + ", ".join( sys.path ) self.name = "tool_shed" - # Read the tool_shed_wsgi.ini configuration file and check for errors. + # Read the tool_shed.ini configuration file and check for errors. self.config = config.Configuration( **kwd ) self.config.check() config.configure_logging( self.config ) diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/galaxy/webapps/tool_shed/buildapp.py --- a/lib/galaxy/webapps/tool_shed/buildapp.py +++ b/lib/galaxy/webapps/tool_shed/buildapp.py @@ -220,11 +220,12 @@ # Send to dynamic app by default urlmap["/"] = app # Define static mappings from config - urlmap["/static"] = Static( conf.get( "static_dir" ), cache_time ) - urlmap["/images"] = Static( conf.get( "static_images_dir" ), cache_time ) - urlmap["/static/scripts"] = Static( conf.get( "static_scripts_dir" ), cache_time ) - urlmap["/static/style"] = Static( conf.get( "static_style_dir" ), cache_time ) - urlmap["/favicon.ico"] = Static( conf.get( "static_favicon_dir" ), cache_time ) + urlmap["/static"] = Static( conf.get( "static_dir", "./static/" ), cache_time ) + urlmap["/images"] = Static( conf.get( "static_images_dir", "./static/images" ), cache_time ) + urlmap["/static/scripts"] = Static( conf.get( "static_scripts_dir", "./static/scripts/" ), cache_time ) + urlmap["/static/style"] = Static( conf.get( "static_style_dir", "./static/style/blue" ), cache_time ) + urlmap["/favicon.ico"] = Static( conf.get( "static_favicon_dir", "./static/favicon.ico" ), cache_time ) + urlmap["/robots.txt"] = Static( conf.get( "static_robots_txt", "./static/robots.txt" ), cache_time ) # URL mapper becomes the root webapp return urlmap diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/galaxy/webapps/tool_shed/config.py --- a/lib/galaxy/webapps/tool_shed/config.py +++ b/lib/galaxy/webapps/tool_shed/config.py @@ -27,6 +27,10 @@ def __init__( self, **kwargs ): self.config_dict = kwargs self.root = kwargs.get( 'root_dir', '.' ) + + # Resolve paths of other config files + self.__parse_config_file_options( kwargs ) + # Collect the umask and primary gid from the environment self.umask = os.umask( 077 ) # get the current umask os.umask( self.umask ) # can't get w/o set, so set it back @@ -41,7 +45,6 @@ self.new_file_path = resolve_path( kwargs.get( "new_file_path", "database/tmp" ), self.root ) self.cookie_path = kwargs.get( "cookie_path", "/" ) self.enable_quotas = string_as_bool( kwargs.get( 'enable_quotas', False ) ) - self.datatypes_config = kwargs.get( 'datatypes_config_file', 'datatypes_conf.xml' ) self.test_conf = resolve_path( kwargs.get( "test_conf", "" ), self.root ) self.id_secret = kwargs.get( "id_secret", "USING THE DEFAULT IS NOT SECURE!" ) # Tool stuff @@ -51,8 +54,6 @@ self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root ) self.tool_secret = kwargs.get( "tool_secret", "" ) self.tool_data_path = resolve_path( kwargs.get( "tool_data_path", "shed-tool-data" ), os.getcwd() ) - self.tool_data_table_config_path = resolve_path( kwargs.get( 'tool_data_table_config_path', 'tool_data_table_conf.xml' ), self.root ) - self.shed_tool_data_table_config = resolve_path( kwargs.get( 'shed_tool_data_table_config', 'shed_tool_data_table_conf.xml' ), self.root ) self.integrated_tool_panel_config = resolve_path( kwargs.get( 'integrated_tool_panel_config', 'integrated_tool_panel.xml' ), self.root ) self.builds_file_path = resolve_path( kwargs.get( "builds_file_path", os.path.join( self.tool_data_path, 'shared', 'ucsc', 'builds.txt') ), self.root ) self.len_file_path = resolve_path( kwargs.get( "len_file_path", os.path.join( self.tool_data_path, 'shared','ucsc','chrom') ), self.root ) @@ -136,6 +137,47 @@ self.citation_cache_data_dir = resolve_path( kwargs.get( "citation_cache_data_dir", "database/tool_shed_citations/data" ), self.root ) self.citation_cache_lock_dir = resolve_path( kwargs.get( "citation_cache_lock_dir", "database/tool_shed_citations/locks" ), self.root ) + def __parse_config_file_options( self, kwargs ): + defaults = dict( + datatypes_config_file = [ 'datatypes_conf.xml', 'config/datatypes_conf.xml', 'config/datatypes_conf.xml.sample' ], + shed_tool_data_table_config = [ 'shed_tool_data_table_conf.xml', 'config/shed_tool_data_table_conf.xml' ], + ) + + listify_defaults = dict( + tool_data_table_config_path = [ 'tool_data_table_conf.xml', 'config/tool_data_table_conf.xml', 'config/tool_data_table_conf.xml.sample' ], + ) + + for var, defaults in defaults.items(): + if kwargs.get( var, None ) is not None: + path = kwargs.get( var ) + else: + for default in defaults: + if os.path.exists( resolve_path( default, self.root ) ): + path = default + break + else: + path = defaults[-1] + setattr( self, var, resolve_path( path, self.root ) ) + + for var, defaults in listify_defaults.items(): + paths = [] + if kwargs.get( var, None ) is not None: + paths = listify( kwargs.get( var ) ) + else: + for default in defaults: + for path in listify( default ): + if not os.path.exists( resolve_path( path, self.root ) ): + break + else: + paths = listify( default ) + break + else: + paths = listify( defaults[-1] ) + setattr( self, var, [ resolve_path( x, self.root ) for x in paths ] ) + + # Backwards compatibility for names used in too many places to fix + self.datatypes_config = self.datatypes_config_file + def get( self, key, default ): return self.config_dict.get( key, default ) diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/pulsar/client/__init__.py --- a/lib/pulsar/client/__init__.py +++ b/lib/pulsar/client/__init__.py @@ -34,7 +34,7 @@ test_tool = pulsar://http://remotehost:8913 Remember this must be added after the ``[galaxy:tool_runners]`` header -in the ``universe.ini`` file. +in the ``galaxy.ini`` file. """ diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/pulsar/client/amqp_exchange.py --- a/lib/pulsar/client/amqp_exchange.py +++ b/lib/pulsar/client/amqp_exchange.py @@ -85,18 +85,27 @@ if heartbeat_thread: heartbeat_thread.join() sleep(DEFAULT_RECONNECT_CONSUMER_WAIT) + except BaseException: + log.exception("Problem consuming queue, consumer quitting in problematic fashion!") + raise def heartbeat(self, connection): log.debug('AMQP heartbeat thread alive') - while connection.connected: - connection.heartbeat_check() - sleep(DEFAULT_HEARTBEAT_WAIT) + try: + while connection.connected: + connection.heartbeat_check() + sleep(DEFAULT_HEARTBEAT_WAIT) + except BaseException: + log.exception("Problem with heartbeat, leaving heartbeat method in problematic state!") + raise log.debug('AMQP heartbeat thread exiting') def publish(self, name, payload): + key = self.__queue_name(name) + log.debug("Begin publishing to key %s" % key) with self.connection(self.__url) as connection: with pools.producers[connection].acquire() as producer: - key = self.__queue_name(name) + log.debug("Have producer for publishing to key %s" % key) producer.publish( payload, serializer='json', @@ -105,6 +114,7 @@ routing_key=key, **self.__publish_kwds ) + log.debug("Published to key %s" % key) def __publish_errback(self, exc, interval): log.error("Connection error while publishing: %r", exc, exc_info=1) diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/pulsar/client/transport/__init__.py --- a/lib/pulsar/client/transport/__init__.py +++ b/lib/pulsar/client/transport/__init__.py @@ -23,9 +23,16 @@ transport_type = 'curl' return transport_type -# TODO: Provide urllib implementation if these unavailable, -# also explore a requests+poster option. -from .curl import get_file -from .curl import post_file +from .curl import curl_available +from .requests import requests_multipart_post_available +if curl_available: + from .curl import get_file + from .curl import post_file +elif requests_multipart_post_available: + from .requests import get_file + from .requests import post_file +else: + from .poster import get_file + from .poster import post_file __all__ = [get_transport, get_file, post_file] diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/pulsar/client/transport/curl.py --- a/lib/pulsar/client/transport/curl.py +++ b/lib/pulsar/client/transport/curl.py @@ -2,10 +2,11 @@ from cStringIO import StringIO except ImportError: from io import StringIO +curl_available = True try: from pycurl import Curl except ImportError: - pass + curl_available = False from os.path import getsize diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/pulsar/client/transport/poster.py --- /dev/null +++ b/lib/pulsar/client/transport/poster.py @@ -0,0 +1,56 @@ +from __future__ import absolute_import +try: + from urllib2 import urlopen +except ImportError: + from urllib.request import urlopen +try: + from urllib2 import Request +except ImportError: + from urllib.request import Request +try: + from galaxy import eggs + eggs.require("poster") +except ImportError: + pass + +try: + import poster +except ImportError: + poster = None + +POSTER_UNAVAILABLE_MESSAGE = "Pulsar configured to use poster module - but it is unavailable. Please install poster." + +import logging +log = logging.getLogger(__name__) + + +if poster is not None: + poster.streaminghttp.register_openers() + + +def post_file(url, path): + __ensure_poster() + try: + datagen, headers = poster.encode.multipart_encode({"file": open(path, "rb")}) + request = Request(url, datagen, headers) + return urlopen(request).read() + except: + log.exception("problem") + raise + + +def get_file(url, path): + __ensure_poster() + request = Request(url=url) + response = urlopen(request) + with open(path, 'wb') as output: + while True: + buffer = response.read(1024) + if not buffer: + break + output.write(buffer) + + +def __ensure_poster(): + if poster is None: + raise ImportError(POSTER_UNAVAILABLE_MESSAGE) diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/pulsar/client/transport/requests.py --- /dev/null +++ b/lib/pulsar/client/transport/requests.py @@ -0,0 +1,50 @@ +from __future__ import absolute_import +try: + from galaxy import eggs + eggs.require("requests") +except ImportError: + pass + +try: + import requests +except ImportError: + requests = None +requests_multipart_post_available = False +try: + import requests_toolbelt + requests_multipart_post_available = True +except ImportError: + requests_toolbelt = None + + +REQUESTS_UNAVAILABLE_MESSAGE = "Pulsar configured to use requests module - but it is unavailable. Please install requests." +REQUESTS_TOOLBELT_UNAVAILABLE_MESSAGE = "Pulsar configured to use requests_toolbelt module - but it is unavailable. Please install requests_toolbelt." + +import logging +log = logging.getLogger(__name__) + + +def post_file(url, path): + if requests_toolbelt is None: + raise ImportError(REQUESTS_TOOLBELT_UNAVAILABLE_MESSAGE) + + __ensure_requests() + m = requests_toolbelt.MultipartEncoder( + fields={'file': ('filename', open(path, 'rb'))} + ) + requests.post(url, data=m, headers={'Content-Type': m.content_type}) + + +def get_file(url, path): + __ensure_requests() + r = requests.get(url, stream=True) + with open(path, 'wb') as f: + for chunk in r.iter_content(chunk_size=1024): + if chunk: # filter out keep-alive new chunks + f.write(chunk) + f.flush() + + +def __ensure_requests(): + if requests is None: + raise ImportError(REQUESTS_UNAVAILABLE_MESSAGE) diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_tool_shed.sh --- a/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_tool_shed.sh +++ b/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_tool_shed.sh @@ -1,8 +1,10 @@ #!/bin/bash +: ${TOOL_SHED_CONFIG_FILE:=config/tool_shed.ini.sample} + stop_err() { echo $1 - python ./scripts/paster.py serve tool_shed_wsgi.ini --pid-file=tool_shed_bootstrap.pid --log-file=tool_shed_bootstrap.log --stop-daemon + python ./scripts/paster.py serve ${TOOL_SHED_CONFIG_FILE} --pid-file=tool_shed_bootstrap.pid --log-file=tool_shed_bootstrap.log --stop-daemon exit 1 } @@ -14,7 +16,7 @@ log_file="lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap.log" -database_result=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute check_db --config_file tool_shed_wsgi.ini` +database_result=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute check_db --config_file ${TOOL_SHED_CONFIG_FILE}` if [ $? -ne 0 ] ; then stop_err "Unable to bootstrap tool shed. $database_result" @@ -31,8 +33,8 @@ fi if [ $? -eq 0 ] ; then - user_auth=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute admin_user_info --config_file tool_shed_wsgi.ini` - local_shed_url=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute get_url --config_file tool_shed_wsgi.ini` + user_auth=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute admin_user_info --config_file ${TOOL_SHED_CONFIG_FILE}` + local_shed_url=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute get_url --config_file ${TOOL_SHED_CONFIG_FILE}` fi admin_user_name=`echo $user_auth | awk 'BEGIN { FS="__SEP__" } ; { print \$1 }'` @@ -41,18 +43,18 @@ echo -n "Creating user '$admin_user_name' with email address '$admin_user_email'..." -python lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py tool_shed_wsgi.ini >> $log_file +python lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py ${TOOL_SHED_CONFIG_FILE} >> $log_file echo " done." -sed -i "s/#admin_users = user1@example.org,user2@example.org/admin_users = $admin_user_email/" tool_shed_wsgi.ini +sed -i "s/#admin_users = user1@example.org,user2@example.org/admin_users = $admin_user_email/" ${TOOL_SHED_CONFIG_FILE} echo -n "Starting tool shed in order to populate users and categories... " if [ -f tool_shed_bootstrap.pid ] ; then stop_err "A bootstrap process is already running." fi -python ./scripts/paster.py serve tool_shed_wsgi.ini --pid-file=tool_shed_bootstrap.pid --log-file=tool_shed_bootstrap.log --daemon > /dev/null +python ./scripts/paster.py serve ${TOOL_SHED_CONFIG_FILE} --pid-file=tool_shed_bootstrap.pid --log-file=tool_shed_bootstrap.log --daemon > /dev/null shed_pid=`cat tool_shed_bootstrap.pid` @@ -94,6 +96,6 @@ fi echo "Bootstrap complete, shutting down temporary tool shed process. A log has been saved to tool_shed_bootstrap.log" -python ./scripts/paster.py serve tool_shed_wsgi.ini --pid-file=tool_shed_bootstrap.pid --log-file=tool_shed_bootstrap.log --stop-daemon +python ./scripts/paster.py serve ${TOOL_SHED_CONFIG_FILE} --pid-file=tool_shed_bootstrap.pid --log-file=tool_shed_bootstrap.log --stop-daemon -exit 0 \ No newline at end of file +exit 0 diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --- a/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py +++ b/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py @@ -25,7 +25,7 @@ db_file = config_parser.get( 'app:main', 'database_file' ) dburi = "sqlite:///%s?isolation_level=IMMEDIATE" % db_file else: - print 'The database configuration setting is missing from the tool_shed_wsgi.ini file. Add this setting before attempting to bootstrap.' + print 'The database configuration setting is missing from the tool_shed.ini file. Add this setting before attempting to bootstrap.' exit(1) sa_session = None @@ -122,7 +122,7 @@ return 1 parser = argparse.ArgumentParser() -parser.add_argument( '-c', '--config_file', dest='config', action='store', default='tool_shed_wsgi.ini' ) +parser.add_argument( '-c', '--config_file', dest='config', action='store', default='config/tool_shed.ini.sample' ) parser.add_argument( '-e', '--execute', dest='method', action='store', default='check_db' ) args = parser.parse_args() diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 run.sh --- a/run.sh +++ b/run.sh @@ -22,7 +22,7 @@ if [ -f universe_wsgi.ini ]; then GALAXY_CONFIG_FILE=universe_wsgi.ini elif [ -f config/galaxy.ini ]; then - GALAXY_CONFIG_FILE=universe_wsgi.ini + GALAXY_CONFIG_FILE=config/galaxy.ini else GALAXY_CONFIG_FILE=config/galaxy.ini.sample fi diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 run_tool_shed.sh --- a/run_tool_shed.sh +++ b/run_tool_shed.sh @@ -12,4 +12,15 @@ args=`echo $@ | sed "s#-\?-bootstrap_from_tool_shed $tool_shed##"` fi -python ./scripts/paster.py serve tool_shed_wsgi.ini --pid-file=tool_shed_webapp.pid --log-file=tool_shed_webapp.log $args +if [ -z "$TOOL_SHED_CONFIG_FILE" ]; then + if [ -f tool_shed_wsgi.ini ]; then + TOOL_SHED_CONFIG_FILE=tool_shed_wsgi.ini + elif [ -f config/tool_shed.ini ]; then + TOOL_SHED_CONFIG_FILE=config/tool_shed.ini + else + TOOL_SHED_CONFIG_FILE=config/tool_shed.ini.sample + fi + export TOOL_SHED_CONFIG_FILE +fi + +python ./scripts/paster.py serve $TOOL_SHED_CONFIG_FILE --pid-file=tool_shed_webapp.pid --log-file=tool_shed_webapp.log $args diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 test/api/test_libraries.py --- a/test/api/test_libraries.py +++ b/test/api/test_libraries.py @@ -43,7 +43,7 @@ library_dataset = show().json() self._assert_has_keys( library_dataset, "peek", "data_type" ) assert library_dataset[ "peek" ].find("create_test") >= 0 - assert library_dataset[ "data_type" ] == "txt" + assert library_dataset[ "file_ext" ] == "txt", library_dataset[ "file_ext" ] def _create_folder( self, library ): create_data = dict( diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 test/api/test_workflows.py --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -26,9 +26,9 @@ self.dataset_populator = DatasetPopulator( self.galaxy_interactor ) self.dataset_collection_populator = DatasetCollectionPopulator( self.galaxy_interactor ) - def test_show_invalid_is_404( self ): - show_response = self._get( "workflow/%s" % self._random_key() ) - self._assert_status_code_is( show_response, 404 ) + def test_show_invalid_key_is_400( self ): + show_response = self._get( "workflows/%s" % self._random_key() ) + self._assert_status_code_is( show_response, 400 ) def test_cannot_show_private_workflow( self ): workflow_id = self.workflow_populator.simple_workflow( "test_not_importportable" ) @@ -134,12 +134,12 @@ run_workflow_response = self._post( "workflows", data=workflow_request ) self._assert_status_code_is( run_workflow_response, 403 ) - def test_404_on_invalid_workflow( self ): + def test_400_on_invalid_workflow_id( self ): workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" ) workflow_request, history_id = self._setup_workflow_run( workflow ) workflow_request[ "workflow_id" ] = self._random_key() run_workflow_response = self._post( "workflows", data=workflow_request ) - self._assert_status_code_is( run_workflow_response, 404 ) + self._assert_status_code_is( run_workflow_response, 400 ) def test_cannot_run_against_other_users_history( self ): workflow = self.workflow_populator.load_workflow( name="test_for_run_does_not_exist" ) @@ -558,21 +558,6 @@ for step in usage_details[ "steps" ]: self._assert_has_keys( step, "workflow_step_id", "order_index", "id" ) - @skip_without_tool( "cat1" ) - def test_post_job_action( self ): - """ Tests both import and execution of post job actions. - """ - workflow = self.workflow_populator.load_workflow( name="test_for_pja_run", add_pja=True ) - workflow_request, history_id = self._setup_workflow_run( workflow ) - run_workflow_response = self._post( "workflows", data=workflow_request ) - self._assert_status_code_is( run_workflow_response, 200 ) - self.dataset_populator.wait_for_history( history_id, assert_ok=True ) - time.sleep(.1) # Give another little bit of time for rename (needed?) - contents = self._get( "histories/%s/contents" % history_id ).json() - # loading workflow with add_pja=True causes workflow output to be - # renamed to 'the_new_name'. - assert "the_new_name" in map( lambda hda: hda[ "name" ], contents ) - def _invocation_details( self, workflow_id, invocation_id ): invocation_details_response = self._get( "workflows/%s/usage/%s" % ( workflow_id, invocation_id ) ) self._assert_status_code_is( invocation_details_response, 200 ) diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 test/functional/tools/samples_tool_conf.xml --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -22,6 +22,8 @@ <tool file="multi_data_param.xml" /><tool file="special_params.xml" /><tool file="validation_default.xml" /> + <tool file="validation_sanitizer.xml" /> + <tool file="validation_repeat.xml" /><tool file="collection_paired_test.xml" /><tool file="collection_nested_test.xml" /><tool file="collection_mixed_param.xml" /> diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 test/functional/tools/validation_repeat.xml --- /dev/null +++ b/test/functional/tools/validation_repeat.xml @@ -0,0 +1,56 @@ +<tool id="validation_repeat" name="Validation (default)"> + <command> + #for $r in $r1 + echo "${r.text}" >> out1; + #end for + #for $r in $r2 + echo "${r.text}" >> out2; + #end for + </command> + <inputs> + <repeat name="r1" label="Repeat 1"> + <param name="text" type="text" label="text input" /> + </repeat> + <repeat name="r2" label="Repeat 2"> + <param name="text" type="text" label="text input"> + <sanitizer> + <valid initial="none"> + <add value="a"/> + <add value="b"/> + <add value="d"/> + <add value="e"/> + </valid> + <mapping initial="none"> + <add source="@" target="c"/> + </mapping> + </sanitizer> + </param> + </repeat> + </inputs> + <outputs> + <data name="out_file1" from_work_dir="out1" /> + <data name="out_file2" from_work_dir="out2" /> + </outputs> + <tests> + <test> + <repeat name="r1"> + <param name="text" value="" ; echo "moo" /> + </repeat> + <repeat name="r2"> + <param name="text" value="ab@de" /> + </repeat> + <output name="out_file1"> + <assert_contents> + <has_line line="__dq__ X echo __dq__moo" /> + </assert_contents> + </output> + <output name="out_file2"> + <assert_contents> + <has_line line="abcde" /> + </assert_contents> + </output> + </test> + </tests> + <help> + </help> +</tool> diff -r 48fc9b40fda9458d502055d4887f5028ee64aa64 -r ac8d29ffce549f2c1570b661e8747c5beed2e676 test/functional/tools/validation_sanitizer.xml --- /dev/null +++ b/test/functional/tools/validation_sanitizer.xml @@ -0,0 +1,35 @@ +<tool id="validation_sanitizer" name="Validation (simple sanitizer)"> + <command> + echo "${text}" >> out1; + </command> + <inputs> + <param name="text" type="text" label="text input"> + <sanitizer> + <valid initial="none"> + <add value="a"/> + <add value="b"/> + <add value="d"/> + <add value="e"/> + </valid> + <mapping initial="none"> + <add source="@" target="c"/> + </mapping> + </sanitizer> + </param> + </inputs> + <outputs> + <data name="out_file1" from_work_dir="out1" /> + </outputs> + <tests> + <test> + <param name="text" value="ab@de" /> + <output name="out_file1"> + <assert_contents> + <has_line line="abcde" /> + </assert_contents> + </output> + </test> + </tests> + <help> + </help> +</tool> 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.