',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% } %>","
",'
',"
Library-related permissions
","
Roles that can modify the library item
",'','
User with any of these roles can modify name, metadata, and other information about this library item.
',"","
Dataset-related permissions
",'
Changes made below will affect every library item that was created from this dataset and also every history this dataset is part of.
',"User has to have all these roles in order to access this dataset."," Users without access permission cannot have other permissions on this dataset."," If there are no access roles set on the dataset it is considered unrestricted.","
","
Roles that can manage permissions on the dataset
",'','
',"User with any of these roles can manage permissions of this dataset. If you remove yourself you will lose the ability manage this dataset unless you are an admin.","
',"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 library security wikipage',' or visit the Galaxy support site.',"
"].join(""))}});t.default={FolderListView:_}}).call(t,i(1),i(2),i(0))},302:function(e,t,i){"use strict";(function(e,s,a){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(42),n=r(o),l=i(156),d=r(l),c=i(225),h=r(c),_=e.View.extend({events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder","click .edit_folder_btn":"startModifications","click .cancel_folder_btn":"cancelModifications","click .save_folder_btn":"saveModifications"},defaults:{type:null,visibility_config:{edit_folder_btn:!1,save_folder_btn:!1,cancel_folder_btn:!1,permission_folder_btn:!1},edit_mode:!1},initialize:function(e){this.options=s.defaults(e||{},this.defaults),this.render(this.options)},render:function(e){this.options=s.extend(this.options,e);var t=this.options.model,i=null;return"folder"===t.get("type")||"LibraryFolder"===t.get("model_class")?(this.options.type="folder",this.prepareButtons(t),i=t.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===t.get("type")||"LibraryDatasetDatasetAssociation"===t.get("model_class")||"LibraryDataset"===t.get("model_class")?(this.options.type="file",i=t.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(t.get("type")||t.get("model_class"))),this.setElement(i({content_item:t,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(e){var t=this.options.visibility_config;!1===this.options.edit_mode?(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("deleted")?(t.edit_folder_btn=!1,t.permission_folder_btn=!1):!1===e.get("deleted")&&(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("can_modify")&&(t.edit_folder_btn=!0),!0===e.get("can_manage")&&(t.permission_folder_btn=!0))):!0===this.options.edit_mode&&(t.edit_folder_btn=!1,t.permission_folder_btn=!1,t.save_folder_btn=!0,t.cancel_folder_btn=!0),this.options.visibility_config=t},showDatasetDetails:function(){Galaxy.libraries.datasetView=new h.default.LibraryDatasetView({id:this.id})},undeleteDataset:function(e){a(".tooltip").hide();var t=this,i=a(e.target).closest("tr").data("id"),s=Galaxy.libraries.folderListView.collection.get(i);s.url=s.urlRoot+s.id+"?undelete=true",s.destroy({success:function(e,s){Galaxy.libraries.folderListView.collection.remove(i);var a=new d.default.Item(s);Galaxy.libraries.folderListView.collection.add(a),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),n.default.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var e=t.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+e+"/datasets/"+t.id}})},error:function(e,t){void 0!==t.responseJSON?n.default.error("Dataset was not undeleted. "+t.responseJSON.err_msg):n.default.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(e){a(".tooltip").hide();var t=a(e.target).closest("tr").data("id"),i=Galaxy.libraries.folderListView.collection.get(t);i.url=i.urlRoot+i.id+"?undelete=true",i.destroy({success:function(e,i){Galaxy.libraries.folderListView.collection.remove(t);var s=new d.default.FolderAsModel(i);Galaxy.libraries.folderListView.collection.add(s),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),n.default.success("Folder undeleted.")},error:function(e,t){void 0!==t.responseJSON?n.default.error("Folder was not undeleted. "+t.responseJSON.err_msg):n.default.error("An error occured! Folder was not undeleted. Please try again.")}})},startModifications:function(){this.options.edit_mode=!0,this.repaint()},cancelModifications:function(){this.options.edit_mode=!1,this.repaint()},saveModifications:function(){var e=Galaxy.libraries.folderListView.collection.get(this.$el.data("id")),t=!1,i=this.$el.find(".input_folder_name").val();if(void 0!==i&&i!==e.get("name")){if(!(i.length>2))return void n.default.warning("Folder name has to be at least 3 characters long.");e.set("name",i),t=!0}var s=this.$el.find(".input_folder_description").val();if(void 0!==s&&s!==e.get("description")&&(e.set("description",s),t=!0),t){var a=this;e.save(null,{patch:!0,success:function(e){a.options.edit_mode=!1,a.repaint(e),n.default.success("Changes to folder saved.")},error:function(e,t){void 0!==t.responseJSON?n.default.error(t.responseJSON.err_msg):n.default.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),n.default.info("Nothing has changed.")},repaint:function(){a(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return s.template(['
","<% }%>",""].join(""))}});t.default={LibraryListView:p}}).call(t,i(1),i(0))},304:function(e,t,i){"use strict";(function(e,s,a){Object.defineProperty(t,"__esModule",{value:!0});var r=i(42),o=function(e){return e&&e.__esModule?e:{default:e}}(r),n=e.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:!1,element_visibility_config:{upload_library_btn:!1,edit_library_btn:!1,permission_library_btn:!1,save_library_btn:!1,cancel_library_btn:!1,delete_library_btn:!1,undelete_library_btn:!1},initialize:function(e){this.render(e)},render:function(e){void 0===e&&(e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(e);var t=this.templateRow();return this.setElement(t({library:e,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(e){s(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){var t=this.element_visibility_config;!1===this.edit_mode?(t.save_library_btn=!1,t.cancel_library_btn=!1,t.delete_library_btn=!1,!0===e.get("deleted")?(t.undelete_library_btn=!0,t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1):!1===e.get("deleted")&&(t.save_library_btn=!1,t.cancel_library_btn=!1,t.undelete_library_btn=!1,!0===e.get("can_user_add")&&(t.upload_library_btn=!0),!0===e.get("can_user_modify")&&(t.edit_library_btn=!0),!0===e.get("can_user_manage")&&(t.permission_library_btn=!0))):!0===this.edit_mode&&(t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1,t.save_library_btn=!0,t.cancel_library_btn=!0,t.delete_library_btn=!0,t.undelete_library_btn=!1),this.element_visibility_config=t},edit_button_clicked:function(){this.edit_mode=!0,this.repaint()},cancel_library_modification:function(){this.edit_mode=!1,this.repaint()},save_library_modification:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=!1,i=this.$el.find(".input_library_name").val();if(void 0!==i&&i!==e.get("name")){if(!(i.length>2))return void o.default.warning("Library name has to be at least 3 characters long.");e.set("name",i),t=!0}var s=this.$el.find(".input_library_description").val();void 0!==s&&s!==e.get("description")&&(e.set("description",s),t=!0);var a=this.$el.find(".input_library_synopsis").val();if(void 0!==a&&a!==e.get("synopsis")&&(e.set("synopsis",a),t=!0),t){var r=this;e.save(null,{patch:!0,success:function(e){r.edit_mode=!1,r.repaint(e),o.default.success("Changes to library saved.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(e),o.default.info("Nothing has changed.")},delete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.destroy({success:function(e){e.set("deleted",!0),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,!1===Galaxy.libraries.preferences.get("with_deleted")?(s(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),o.default.success("Library has been marked deleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured during deleting the library.")}})},undelete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(e){e.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,t.repaint(e),o.default.success("Library has been undeleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while undeleting the library.")}})},templateRow:function(){return a.template(['
"].join(""))}});t.default={LibraryRowView:n}}).call(t,i(1),i(0),i(2))},305:function(e,t,i){"use strict";(function(e,s,a){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(42),n=r(o),l=i(156),d=r(l),c=e.View.extend({el:"#center",defaults:{search_term:""},events:{"click #create_new_library_btn":"createLibraryFromModal","click #include_deleted_chk":"includeDeletedChecked","click #exclude_restricted_chk":"excludeRestrictedChecked","click .page_size_prompt":"showPageSizePrompt","keyup .library-search-input":"searchLibraries"},initialize:function(e){this.options=s.defaults(this.options||{},e,this.defaults),this.render()},render:function(){var e=this.templateToolBar(),t=!1,i=!0;Galaxy.user&&(t=Galaxy.user.isAdmin(),i=Galaxy.user.isAnonymous()),this.$el.html(e({admin_user:t,anon_user:i})),t&&(this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted"),this.$el.find("#exclude_restricted_chk")[0].checked=Galaxy.libraries.preferences.get("without_restricted"))},renderPaginator:function(e){this.options=s.extend(this.options,e);var t=this.templatePaginator();this.$el.find("#library_paginator").html(t({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown,library_page_size:Galaxy.libraries.preferences.get("library_page_size")}))},createLibraryFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this;this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){t.createNewLibrary()},Close:function(){t.modal.hide()}}})},createNewLibrary:function(){var e=this.serializeNewLibrary();if(this.validateNewLibrary(e)){var t=new d.default.Library,i=this;t.save(e,{success:function(e){Galaxy.libraries.libraryListView.collection.add(e),i.modal.hide(),i.clearLibraryModal(),Galaxy.libraries.libraryListView.render(),n.default.success("Library created.")},error:function(e,t){void 0!==t.responseJSON?n.default.error(t.responseJSON.err_msg):n.default.error("An error occured.")}})}else n.default.error("Library's name is missing.");return!1},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({library_page_size:parseInt(t)}),Galaxy.libraries.libraryListView.render({show_page:1}))},clearLibraryModal:function(){a("input[name='Name']").val(""),a("input[name='Description']").val(""),a("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:a("input[name='Name']").val(),description:a("input[name='Description']").val(),synopsis:a("input[name='Synopsis']").val()}},validateNewLibrary:function(e){return""!==e.name},includeDeletedChecked:function(e){e.target.checked?(Galaxy.libraries.preferences.set({with_deleted:!0}),Galaxy.libraries.libraryListView.fetchDeleted()):(Galaxy.libraries.preferences.set({with_deleted:!1}),Galaxy.libraries.libraryListView.render())},excludeRestrictedChecked:function(e){e.target.checked?Galaxy.libraries.preferences.set({without_restricted:!0}):Galaxy.libraries.preferences.set({without_restricted:!1}),Galaxy.libraries.libraryListView.render()},searchLibraries:function(e){var t=a(".library-search-input").val();this.options.search_term=t,Galaxy.libraries.libraryListView.searchLibraries(t)},templateToolBar:function(){return s.template(['
"].join(""))}});t.default={LibraryToolbarView:c}}).call(t,i(1),i(2),i(0))},306:function(e,t,i){"use strict";(function(e,s,a,r){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(3),l=o(n),d=i(42),c=o(d),h=i(156),_=o(h),p=i(139),u=o(p);i(198);var f=e.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=s.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=s.extend(this.options,e);var t=this.templateToolBar(),i={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(i.is_admin=Galaxy.user.isAdmin(),i.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(i.mutiple_add_dataset_options=!0)),this.$el.html(t(i))},renderPaginator:function(e){this.options=s.extend(this.options,e);var t=this.templatePaginator();a("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=s.extend(this.options,e),!0===this.options.can_add_library_item?a(".add-library-items").show():a(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?(a(".dataset-manipulation").show(),a(".logged-dataset-manipulation").hide()):(a(".logged-dataset-manipulation").show(),a(".dataset-manipulation").show()):(a(".logged-dataset-manipulation").hide(),a(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,i=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:i(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var t=this.serialize_new_folder();if(this.validate_new_folder(t)){var i,s=new _.default.FolderAsModel,a=e.history.fragment.split("/");i=a.indexOf("page")>-1?a[a.length-3]:a[a.length-1],s.url=s.urlRoot+i,s.save(t,{success:function(e){Galaxy.modal.hide(),c.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")}})}else c.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:a("input[name='Name']").val(),description:a("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)c.default.info("You must select some datasets first.");else{var e=this;this.histories=new _.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)a.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,i){c.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var i=a("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=i;var s=a("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(i,s),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var i=[],s=[];this.findCheckedRows().each(function(){var e=a(this).closest("tr").data("id");"F"==e.substring(0,1)?s.push(e):i.push(e)});for(var o=[],n=i.length-1;n>=0;n--){var l=i[n],d=new _.default.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=l,d.source="library",o.push(d)}for(var n=s.length-1;n>=0;n--){var c=s[n],d=new _.default.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=c,d.source="library_folder",o.push(d)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),r.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,a(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";a(".completion_span").text(e)},download:function(e,t){var i=[],s=[];this.findCheckedRows().each(function(){var e=a(this).closest("tr").data("id");"F"==e.substring(0,1)?s.push(e):i.push(e)});var r=Galaxy.root+"api/libraries/datasets/download/"+t,o={ld_ids:i,folder_ids:s};this.processDownload(r,o,"get")},processDownload:function(e,t,i){if(e&&t){t="string"==typeof t?t:a.param(t);var s="";a.each(t.split("&"),function(){var e=this.split("=");s+=''}),a('").appendTo("body").submit().remove(),c.default.info("Your download will begin soon.")}else c.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new _.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),a("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var i in t)e.list_extensions.push({id:t[i].extension,text:t[i].extension,description:t[i].description,description_url:t[i].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;h--){var _=l[h].trim();0!==_.length&&d.push(_)}this.initChainCallControl({length:d.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:d,preserve_dirs:e,link_data:t,space_to_tab:i,to_posix_lines:s,source:"admin_path",file_type:o,tag_using_filenames:r,dbkey:n})}else c.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var i=a("#jstree_browser").jstree().get_selected(!0),r=s.filter(i,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),n=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),d=this.modal.$el.find(".posix-checkbox").is(":checked"),h=this.select_extension.value(),_=this.select_genome.value(),p=this.modal.$el.find(".tag-files").is(":checked"),u=r[0].type,f=[];if(r.length<1)c.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var g=r.length-1;g>=0;g--)void 0!==r[g].li_attr.full_path&&f.push(r[g].li_attr.full_path);if(this.initChainCallControl({length:f.length,action:"adding_datasets"}),"folder"===u){var m=t.source+"_folder";this.chainCallImportingFolders({paths:f,preserve_dirs:o,link_data:n,space_to_tab:l,to_posix_lines:d,source:m,file_type:h,dbkey:_,tag_using_filenames:p})}else if("file"===u){var m=t.source+"_file";this.chainCallImportingUserdirFiles({paths:f,file_type:h,dbkey:_,link_data:n,space_to_tab:l,to_posix_lines:d,source:m,tag_using_filenames:p})}}},fetchAndDisplayHistoryContents:function(e){var t=new _.default.HistoryContents({id:e}),i=this;t.fetch({success:function(t){var s=i.templateHistoryContents();i.histories.get(e).set({contents:t}),i.modal.$el.find("#selected_history_content").html(s({history_contents:t.models.reverse()})),i.modal.$el.find(".history-import-select-all").bind("click",function(){a("#selected_history_content [type=checkbox]").prop("checked",!0)}),i.modal.$el.find(".history-import-unselect-all").bind("click",function(){a("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],i=[],s=[];if(e.length<1)c.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=a(this).closest("li").data("id");if(e){var s=a(this).closest("li").data("name");t.push(e),i.push(s)}});for(var r=t.length-1;r>=0;r--){var o=t[r],n=new _.default.Item;n.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===i[r]?n.set({from_hdca_id:o}):n.set({from_hda_id:o}),s.push(n)}this.initChainCallControl({length:s.length,action:"adding_datasets"}),this.chainCallAddingHdas(s)}},chainCallImportingIntoHistory:function(e,t){var i=this,s=e.pop();if(void 0===s)return 0===this.options.chain_call_control.failed_number?c.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?c.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;n--){var l=new _.default.Item({id:e[n]});o.push(l)}for(var n=t.length-1;n>=0;n--){var d=new _.default.FolderAsModel({id:t[n]});o.push(d)}this.options.chain_call_control.total_number=r,this.chainCallDeletingItems(o)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new _.default.Library({id:this.options.parent_library_id}),e.fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")}}))},showLocInfoModal:function(e){var t=this,i=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:i({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),c.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return a("#folder_list_body").find(":checked")},templateToolBar:function(){return s.template(['
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
",'
',"
Library permissions
","
Roles that can access the library
",'','
',"User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.","
","
Roles that can manage permissions on this library
",'','
',"User with any of these roles can manage permissions on this library (includes giving access).","
","
Roles that can add items to this library
",'','
',"User with any of these roles can add items to this library (folders and datasets).","
","
Roles that can modify this library
",'','
',"User with any of these roles can modify this library (name, synopsis, etc.).","
",'","
","
"].join(""))}});t.default={LibraryView:_}}).call(t,i(1),i(2),i(0))},308:function(e,t,i){"use strict";(function(e,s,a){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(42),n=r(o),l=i(156),d=r(l),c=i(139),h=r(c),_=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=s.extend(this.options,e),this.options.id&&this.fetchFolder()},fetchFolder:function(e){this.options=s.extend(this.options,e),this.model=new d.default.FolderAsModel({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?n.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):n.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=s.extend(this.options,e),a(".tooltip").remove();var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var i=this.templateFolderPermissions();this.$el.html(i({folder:this.model,is_admin:t}));var r=this;a.get(Galaxy.root+"api/folders/"+r.id+"/permissions?scope=current").done(function(e){r.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){n.default.error("An error occurred while attempting to fetch folder permissions.")}),a("#center [data-toggle]").tooltip(),a("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],i=0;i=0;i--)t.push(e[i].id);return t},savePermissions:function(e){var t=this,i=this._extractIds(this.addSelectObject.$el.select2("data")),s=this._extractIds(this.manageSelectObject.$el.select2("data")),r=this._extractIds(this.modifySelectObject.$el.select2("data"));a.post(Galaxy.root+"api/folders/"+t.id+"/permissions?action=set_permissions",{"add_ids[]":i,"manage_ids[]":s,"modify_ids[]":r}).done(function(e){t.showPermissions({fetched_permissions:e}),n.default.success("Permissions saved.")}).fail(function(){n.default.error("An error occurred while attempting to set folder permissions.")})},templateFolderPermissions:function(){return s.template(['
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
",'
',"
Folder permissions
","
","Roles that can manage permissions on this folder","
",'','
',"User with any of these roles can manage permissions on this folder.","
","
","Roles that can add items to this folder","
",'','
',"User with any of these roles can add items to this folder (folders and datasets).","
","
","Roles that can modify this folder","
",'','
',"User with any of these roles can modify this folder (name, etc.).","
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% } %>","
",'
',"
Library-related permissions
","
Roles that can modify the library item
",'','
User with any of these roles can modify name, metadata, and other information about this library item.
',"","
Dataset-related permissions
",'
Changes made below will affect every library item that was created from this dataset and also every history this dataset is part of.
',"User has to have all these roles in order to access this dataset."," Users without access permission cannot have other permissions on this dataset."," If there are no access roles set on the dataset it is considered unrestricted.","
","
Roles that can manage permissions on the dataset
",'','
',"User with any of these roles can manage permissions of this dataset. If you remove yourself you will lose the ability manage this dataset unless you are an admin.","
',"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 library security wikipage',' or visit the Galaxy support site.',"
"].join(""))}});t.default={FolderListView:_}}).call(t,i(1),i(2),i(0))},302:function(e,t,i){"use strict";(function(e,s,a){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(42),n=r(o),l=i(156),d=r(l),c=i(225),h=r(c),_=e.View.extend({events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder","click .edit_folder_btn":"startModifications","click .cancel_folder_btn":"cancelModifications","click .save_folder_btn":"saveModifications"},defaults:{type:null,visibility_config:{edit_folder_btn:!1,save_folder_btn:!1,cancel_folder_btn:!1,permission_folder_btn:!1},edit_mode:!1},initialize:function(e){this.options=s.defaults(e||{},this.defaults),this.render(this.options)},render:function(e){this.options=s.extend(this.options,e);var t=this.options.model,i=null;return"folder"===t.get("type")||"LibraryFolder"===t.get("model_class")?(this.options.type="folder",this.prepareButtons(t),i=t.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===t.get("type")||"LibraryDatasetDatasetAssociation"===t.get("model_class")||"LibraryDataset"===t.get("model_class")?(this.options.type="file",i=t.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(t.get("type")||t.get("model_class"))),this.setElement(i({content_item:t,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(e){var t=this.options.visibility_config;!1===this.options.edit_mode?(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("deleted")?(t.edit_folder_btn=!1,t.permission_folder_btn=!1):!1===e.get("deleted")&&(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("can_modify")&&(t.edit_folder_btn=!0),!0===e.get("can_manage")&&(t.permission_folder_btn=!0))):!0===this.options.edit_mode&&(t.edit_folder_btn=!1,t.permission_folder_btn=!1,t.save_folder_btn=!0,t.cancel_folder_btn=!0),this.options.visibility_config=t},showDatasetDetails:function(){Galaxy.libraries.datasetView=new h.default.LibraryDatasetView({id:this.id})},undeleteDataset:function(e){a(".tooltip").hide();var t=this,i=a(e.target).closest("tr").data("id"),s=Galaxy.libraries.folderListView.collection.get(i);s.url=s.urlRoot+s.id+"?undelete=true",s.destroy({success:function(e,s){Galaxy.libraries.folderListView.collection.remove(i);var a=new d.default.Item(s);Galaxy.libraries.folderListView.collection.add(a),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),n.default.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var e=t.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+e+"/datasets/"+t.id}})},error:function(e,t){void 0!==t.responseJSON?n.default.error("Dataset was not undeleted. "+t.responseJSON.err_msg):n.default.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(e){a(".tooltip").hide();var t=a(e.target).closest("tr").data("id"),i=Galaxy.libraries.folderListView.collection.get(t);i.url=i.urlRoot+i.id+"?undelete=true",i.destroy({success:function(e,i){Galaxy.libraries.folderListView.collection.remove(t);var s=new d.default.FolderAsModel(i);Galaxy.libraries.folderListView.collection.add(s),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),n.default.success("Folder undeleted.")},error:function(e,t){void 0!==t.responseJSON?n.default.error("Folder was not undeleted. "+t.responseJSON.err_msg):n.default.error("An error occured! Folder was not undeleted. Please try again.")}})},startModifications:function(){this.options.edit_mode=!0,this.repaint()},cancelModifications:function(){this.options.edit_mode=!1,this.repaint()},saveModifications:function(){var e=Galaxy.libraries.folderListView.collection.get(this.$el.data("id")),t=!1,i=this.$el.find(".input_folder_name").val();if(void 0!==i&&i!==e.get("name")){if(!(i.length>2))return void n.default.warning("Folder name has to be at least 3 characters long.");e.set("name",i),t=!0}var s=this.$el.find(".input_folder_description").val();if(void 0!==s&&s!==e.get("description")&&(e.set("description",s),t=!0),t){var a=this;e.save(null,{patch:!0,success:function(e){a.options.edit_mode=!1,a.repaint(e),n.default.success("Changes to folder saved.")},error:function(e,t){void 0!==t.responseJSON?n.default.error(t.responseJSON.err_msg):n.default.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),n.default.info("Nothing has changed.")},repaint:function(){a(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return s.template(['
","<% }%>",""].join(""))}});t.default={LibraryListView:p}}).call(t,i(1),i(0))},304:function(e,t,i){"use strict";(function(e,s,a){Object.defineProperty(t,"__esModule",{value:!0});var r=i(42),o=function(e){return e&&e.__esModule?e:{default:e}}(r),n=e.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:!1,element_visibility_config:{upload_library_btn:!1,edit_library_btn:!1,permission_library_btn:!1,save_library_btn:!1,cancel_library_btn:!1,delete_library_btn:!1,undelete_library_btn:!1},initialize:function(e){this.render(e)},render:function(e){void 0===e&&(e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(e);var t=this.templateRow();return this.setElement(t({library:e,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(e){s(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){var t=this.element_visibility_config;!1===this.edit_mode?(t.save_library_btn=!1,t.cancel_library_btn=!1,t.delete_library_btn=!1,!0===e.get("deleted")?(t.undelete_library_btn=!0,t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1):!1===e.get("deleted")&&(t.save_library_btn=!1,t.cancel_library_btn=!1,t.undelete_library_btn=!1,!0===e.get("can_user_add")&&(t.upload_library_btn=!0),!0===e.get("can_user_modify")&&(t.edit_library_btn=!0),!0===e.get("can_user_manage")&&(t.permission_library_btn=!0))):!0===this.edit_mode&&(t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1,t.save_library_btn=!0,t.cancel_library_btn=!0,t.delete_library_btn=!0,t.undelete_library_btn=!1),this.element_visibility_config=t},edit_button_clicked:function(){this.edit_mode=!0,this.repaint()},cancel_library_modification:function(){this.edit_mode=!1,this.repaint()},save_library_modification:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=!1,i=this.$el.find(".input_library_name").val();if(void 0!==i&&i!==e.get("name")){if(!(i.length>2))return void o.default.warning("Library name has to be at least 3 characters long.");e.set("name",i),t=!0}var s=this.$el.find(".input_library_description").val();void 0!==s&&s!==e.get("description")&&(e.set("description",s),t=!0);var a=this.$el.find(".input_library_synopsis").val();if(void 0!==a&&a!==e.get("synopsis")&&(e.set("synopsis",a),t=!0),t){var r=this;e.save(null,{patch:!0,success:function(e){r.edit_mode=!1,r.repaint(e),o.default.success("Changes to library saved.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(e),o.default.info("Nothing has changed.")},delete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.destroy({success:function(e){e.set("deleted",!0),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,!1===Galaxy.libraries.preferences.get("with_deleted")?(s(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),o.default.success("Library has been marked deleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured during deleting the library.")}})},undelete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(e){e.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,t.repaint(e),o.default.success("Library has been undeleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while undeleting the library.")}})},templateRow:function(){return a.template(['
"].join(""))}});t.default={LibraryRowView:n}}).call(t,i(1),i(0),i(2))},305:function(e,t,i){"use strict";(function(e,s,a){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(42),n=r(o),l=i(156),d=r(l),c=e.View.extend({el:"#center",defaults:{search_term:""},events:{"click #create_new_library_btn":"createLibraryFromModal","click #include_deleted_chk":"includeDeletedChecked","click #exclude_restricted_chk":"excludeRestrictedChecked","click .page_size_prompt":"showPageSizePrompt","keyup .library-search-input":"searchLibraries"},initialize:function(e){this.options=s.defaults(this.options||{},e,this.defaults),this.render()},render:function(){var e=this.templateToolBar(),t=!1,i=!0;Galaxy.user&&(t=Galaxy.user.isAdmin(),i=Galaxy.user.isAnonymous()),this.$el.html(e({admin_user:t,anon_user:i})),t&&(this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted"),this.$el.find("#exclude_restricted_chk")[0].checked=Galaxy.libraries.preferences.get("without_restricted"))},renderPaginator:function(e){this.options=s.extend(this.options,e);var t=this.templatePaginator();this.$el.find("#library_paginator").html(t({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown,library_page_size:Galaxy.libraries.preferences.get("library_page_size")}))},createLibraryFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this;this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){t.createNewLibrary()},Close:function(){t.modal.hide()}}})},createNewLibrary:function(){var e=this.serializeNewLibrary();if(this.validateNewLibrary(e)){var t=new d.default.Library,i=this;t.save(e,{success:function(e){Galaxy.libraries.libraryListView.collection.add(e),i.modal.hide(),i.clearLibraryModal(),Galaxy.libraries.libraryListView.render(),n.default.success("Library created.")},error:function(e,t){void 0!==t.responseJSON?n.default.error(t.responseJSON.err_msg):n.default.error("An error occured.")}})}else n.default.error("Library's name is missing.");return!1},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({library_page_size:parseInt(t)}),Galaxy.libraries.libraryListView.render({show_page:1}))},clearLibraryModal:function(){a("input[name='Name']").val(""),a("input[name='Description']").val(""),a("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:a("input[name='Name']").val(),description:a("input[name='Description']").val(),synopsis:a("input[name='Synopsis']").val()}},validateNewLibrary:function(e){return""!==e.name},includeDeletedChecked:function(e){e.target.checked?(Galaxy.libraries.preferences.set({with_deleted:!0}),Galaxy.libraries.libraryListView.fetchDeleted()):(Galaxy.libraries.preferences.set({with_deleted:!1}),Galaxy.libraries.libraryListView.render())},excludeRestrictedChecked:function(e){e.target.checked?Galaxy.libraries.preferences.set({without_restricted:!0}):Galaxy.libraries.preferences.set({without_restricted:!1}),Galaxy.libraries.libraryListView.render()},searchLibraries:function(e){var t=a(".library-search-input").val();this.options.search_term=t,Galaxy.libraries.libraryListView.searchLibraries(t)},templateToolBar:function(){return s.template(['
"].join(""))}});t.default={LibraryToolbarView:c}}).call(t,i(1),i(2),i(0))},306:function(e,t,i){"use strict";(function(e,s,a,r){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(3),l=o(n),d=i(42),c=o(d),h=i(156),_=o(h),p=i(139),u=o(p);i(198);var f=e.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=s.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=s.extend(this.options,e);var t=this.templateToolBar(),i={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(i.is_admin=Galaxy.user.isAdmin(),i.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(i.mutiple_add_dataset_options=!0)),this.$el.html(t(i))},renderPaginator:function(e){this.options=s.extend(this.options,e);var t=this.templatePaginator();a("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=s.extend(this.options,e),!0===this.options.can_add_library_item?a(".add-library-items").show():a(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?(a(".dataset-manipulation").show(),a(".logged-dataset-manipulation").hide()):(a(".logged-dataset-manipulation").show(),a(".dataset-manipulation").show()):(a(".logged-dataset-manipulation").hide(),a(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,i=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:i(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var t=this.serialize_new_folder();if(this.validate_new_folder(t)){var i,s=new _.default.FolderAsModel,a=e.history.fragment.split("/");i=a.indexOf("page")>-1?a[a.length-3]:a[a.length-1],s.url=s.urlRoot+i,s.save(t,{success:function(e){Galaxy.modal.hide(),c.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")}})}else c.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:a("input[name='Name']").val(),description:a("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)c.default.info("You must select some datasets first.");else{var e=this;this.histories=new _.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)a.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,i){c.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var i=a("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=i;var s=a("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(i,s),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var i=[],s=[];this.findCheckedRows().each(function(){var e=a(this).closest("tr").data("id");"F"==e.substring(0,1)?s.push(e):i.push(e)});for(var o=[],n=i.length-1;n>=0;n--){var l=i[n],d=new _.default.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=l,d.source="library",o.push(d)}for(var n=s.length-1;n>=0;n--){var c=s[n],d=new _.default.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=c,d.source="library_folder",o.push(d)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),r.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,a(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";a(".completion_span").text(e)},download:function(e,t){var i=[],s=[];this.findCheckedRows().each(function(){var e=a(this).closest("tr").data("id");"F"==e.substring(0,1)?s.push(e):i.push(e)});var r=Galaxy.root+"api/libraries/datasets/download/"+t,o={ld_ids:i,folder_ids:s};this.processDownload(r,o,"get")},processDownload:function(e,t,i){if(e&&t){t="string"==typeof t?t:a.param(t);var s="";a.each(t.split("&"),function(){var e=this.split("=");s+=''}),a('").appendTo("body").submit().remove(),c.default.info("Your download will begin soon.")}else c.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new _.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),a("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var i in t)e.list_extensions.push({id:t[i].extension,text:t[i].extension,description:t[i].description,description_url:t[i].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;h--){var _=l[h].trim();0!==_.length&&d.push(_)}this.initChainCallControl({length:d.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:d,preserve_dirs:e,link_data:t,space_to_tab:i,to_posix_lines:s,source:"admin_path",file_type:o,tag_using_filenames:r,dbkey:n})}else c.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var i=a("#jstree_browser").jstree().get_selected(!0),r=s.filter(i,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),n=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),d=this.modal.$el.find(".posix-checkbox").is(":checked"),h=this.select_extension.value(),_=this.select_genome.value(),p=this.modal.$el.find(".tag-files").is(":checked"),u=r[0].type,f=[];if(r.length<1)c.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var g=r.length-1;g>=0;g--)void 0!==r[g].li_attr.full_path&&f.push(r[g].li_attr.full_path);if(this.initChainCallControl({length:f.length,action:"adding_datasets"}),"folder"===u){var m=t.source+"_folder";this.chainCallImportingFolders({paths:f,preserve_dirs:o,link_data:n,space_to_tab:l,to_posix_lines:d,source:m,file_type:h,dbkey:_,tag_using_filenames:p})}else if("file"===u){var m=t.source+"_file";this.chainCallImportingUserdirFiles({paths:f,file_type:h,dbkey:_,link_data:n,space_to_tab:l,to_posix_lines:d,source:m,tag_using_filenames:p})}}},fetchAndDisplayHistoryContents:function(e){var t=new _.default.HistoryContents({id:e}),i=this;t.fetch({success:function(t){var s=i.templateHistoryContents();i.histories.get(e).set({contents:t}),i.modal.$el.find("#selected_history_content").html(s({history_contents:t.models.reverse()})),i.modal.$el.find(".history-import-select-all").bind("click",function(){a("#selected_history_content [type=checkbox]").prop("checked",!0)}),i.modal.$el.find(".history-import-unselect-all").bind("click",function(){a("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],i=[],s=[];if(e.length<1)c.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=a(this).closest("li").data("id");if(e){var s=a(this).closest("li").data("name");t.push(e),i.push(s)}});for(var r=t.length-1;r>=0;r--){var o=t[r],n=new _.default.Item;n.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===i[r]?n.set({from_hdca_id:o}):n.set({from_hda_id:o}),s.push(n)}this.initChainCallControl({length:s.length,action:"adding_datasets"}),this.chainCallAddingHdas(s)}},chainCallImportingIntoHistory:function(e,t){var i=this,s=e.pop();if(void 0===s)return 0===this.options.chain_call_control.failed_number?c.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?c.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;n--){var l=new _.default.Item({id:e[n]});o.push(l)}for(var n=t.length-1;n>=0;n--){var d=new _.default.FolderAsModel({id:t[n]});o.push(d)}this.options.chain_call_control.total_number=r,this.chainCallDeletingItems(o)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new _.default.Library({id:this.options.parent_library_id}),e.fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?c.default.error(t.responseJSON.err_msg):c.default.error("An error occurred.")}}))},showLocInfoModal:function(e){var t=this,i=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:i({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),c.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return a("#folder_list_body").find(":checked")},templateToolBar:function(){return s.template(['
All files you select will be imported into the current folder ignoring their folder structure.
','
All files within the selected folders and their subfolders will be imported into the current folder.
','
','',' Choose Files',"",'',' Choose Folders',"","
",'
','','',"Preserve directory structure","",'','',"Link files instead of copying","",'','',"Convert line endings to POSIX","",'','',"Convert spaces to tabs","","
",'",'","",'
',"
","","
You can set extension type and genome for all imported datasets at once:
All files within the given folders and their subfolders will be imported into the current folder.
','
','','',"Preserve directory structure","",'','',"Link files instead of copying",""," ",'','',"Convert line endings to POSIX","",'','',"Convert spaces to tabs","","
",'',"","
You can set extension type and genome for all imported datasets at once:
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
",'
',"
Library permissions
","
Roles that can access the library
",'','
',"User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.","
","
Roles that can manage permissions on this library
",'','
',"User with any of these roles can manage permissions on this library (includes giving access).","
","
Roles that can add items to this library
",'','
',"User with any of these roles can add items to this library (folders and datasets).","
","
Roles that can modify this library
",'','
',"User with any of these roles can modify this library (name, synopsis, etc.).","
",'","
","
"].join(""))}});t.default={LibraryView:_}}).call(t,i(1),i(2),i(0))},308:function(e,t,i){"use strict";(function(e,s,a){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(42),n=r(o),l=i(156),d=r(l),c=i(139),h=r(c),_=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=s.extend(this.options,e),this.options.id&&this.fetchFolder()},fetchFolder:function(e){this.options=s.extend(this.options,e),this.model=new d.default.FolderAsModel({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?n.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):n.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=s.extend(this.options,e),a(".tooltip").remove();var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var i=this.templateFolderPermissions();this.$el.html(i({folder:this.model,is_admin:t}));var r=this;a.get(Galaxy.root+"api/folders/"+r.id+"/permissions?scope=current").done(function(e){r.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){n.default.error("An error occurred while attempting to fetch folder permissions.")}),a("#center [data-toggle]").tooltip(),a("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],i=0;i=0;i--)t.push(e[i].id);return t},savePermissions:function(e){var t=this,i=this._extractIds(this.addSelectObject.$el.select2("data")),s=this._extractIds(this.manageSelectObject.$el.select2("data")),r=this._extractIds(this.modifySelectObject.$el.select2("data"));a.post(Galaxy.root+"api/folders/"+t.id+"/permissions?action=set_permissions",{"add_ids[]":i,"manage_ids[]":s,"modify_ids[]":r}).done(function(e){t.showPermissions({fetched_permissions:e}),n.default.success("Permissions saved.")}).fail(function(){n.default.error("An error occurred while attempting to set folder permissions.")})},templateFolderPermissions:function(){return s.template(['
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
",'
',"
Folder permissions
","
","Roles that can manage permissions on this folder","
",'','
',"User with any of these roles can manage permissions on this folder.","
","
","Roles that can add items to this folder","
",'','
',"User with any of these roles can add items to this folder (folders and datasets).","
","
","Roles that can modify this folder","
",'','
',"User with any of these roles can modify this folder (name, etc.).","
",'","
","
"].join(""))}});t.default={FolderView:_}}).call(t,i(1),i(2),i(0))},62:function(e,t,i){"use strict";function s(e,t){var i=void 0!==e.prototype?e.prototype:e;return void 0!==t&&(i._logNamespace=t),a.forEach(function(e){i[e]=function(){if(this.logger)return this.logger.emit?this.logger.emit(e,this._logNamespace,arguments):this.logger[e]?this.logger[e].apply(this.logger,arguments):void 0}}),e}Object.defineProperty(t,"__esModule",{value:!0});var a=["log","debug","info","warn","error","metric"];t.default=s},8:function(e,t,i){"use strict";(function(e){function s(e){return e&&e.__esModule?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function r(e,t){var i=Array.prototype.slice.call(arguments,0),s=i.pop();return i.unshift(s),d.defaults.apply(d,i)}function o(e,t){t=t||"model";var i=d.template(e.join(""));return function(e,s){var a={view:s||{},_l:f.default};return a[t]=e||{},i(a)}}function n(e,t){t=t||{};var i=t.ascending?1:-1;return function(t,s){return t=t.get(e),s=s.get(e),(ts?1:0)*i}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(2),d=a(l),c=i(1),h=a(c),_=i(62),p=s(_),u=i(7),f=s(u),g={logger:null,_logNamespace:"."};(0,p.default)(g);var m=h.Model.extend({initialize:function(e){if(this._checkEnabledSessionStorage(),!e.id)throw new Error("SessionStorageModel requires an id in the initial attributes");this.id=e.id;var t=this.isNew()?{}:this._read(this);this.clear({silent:!0}),this.save(d.extend({},this.defaults,t,e),{silent:!0}),this.on("change",function(){this.save()})},_checkEnabledSessionStorage:function(){try{return window.sessionStorage.length>=0}catch(e){return alert("Please enable cookies in your browser for this Galaxy site"),!1}},sync:function(e,t,i){i.silent||t.trigger("request",t,{},i);var s={};switch(e){case"create":s=this._create(t);break;case"read":s=this._read(t);break;case"update":s=this._update(t);break;case"delete":s=this._delete(t)}return void 0!==s||null!==s?i.success&&i.success():i.error&&i.error(),s},_create:function(e){try{var t=e.toJSON(),i=sessionStorage.setItem(e.id,JSON.stringify(t));return null===i?i:t}catch(e){if(!(e instanceof DOMException&&navigator.userAgent.indexOf("Safari")>-1))throw e}return null},_read:function(e){return JSON.parse(sessionStorage.getItem(e.id))},_update:function(e){return e._create(e)},_delete:function(e){return sessionStorage.removeItem(e.id)},isNew:function(){return!sessionStorage.hasOwnProperty(this.id)},_log:function(){return JSON.stringify(this.toJSON(),null," ")},toString:function(){return"SessionStorageModel("+this.id+")"}});!function(){m.prototype=d.omit(m.prototype,"url","urlRoot")}();var b={searchAttributes:[],searchAliases:{},searchAttribute:function(e,t){var i=this.get(e);return!(!t||void 0===i||null===i)&&(d.isArray(i)?this._searchArrayAttribute(i,t):-1!==i.toString().toLowerCase().indexOf(t.toLowerCase()))},_searchArrayAttribute:function(e,t){return t=t.toLowerCase(),d.any(e,function(e){return-1!==e.toString().toLowerCase().indexOf(t.toLowerCase())})},search:function(e){var t=this;return d.filter(this.searchAttributes,function(i){return t.searchAttribute(i,e)})},matches:function(e){var t=e.split("=");if(t.length>=2){var i=t[0];return i=this.searchAliases[i]||i,this.searchAttribute(i,t[1])}return!!this.search(e).length},matchesAll:function(e){var t=this;return e=e.match(/(".*"|\w*=".*"|\S*)/g).filter(function(e){return!!e}),d.all(e,function(e){return e=e.replace(/"/g,""),t.matches(e)})}},y={hiddenUntilActivated:function(t,i){if(i=i||{},this.HUAVOptions={$elementShown:this.$el,showFn:e.prototype.toggle,showSpeed:"fast"},d.extend(this.HUAVOptions,i||{}),this.HUAVOptions.hasBeenShown=this.HUAVOptions.$elementShown.is(":visible"),this.hidden=this.isHidden(),t){var s=this;t.on("click",function(e){s.toggle(s.HUAVOptions.showSpeed)})}},isHidden:function(){return this.HUAVOptions.$elementShown.is(":hidden")},toggle:function(){return this.hidden?(this.HUAVOptions.hasBeenShown||d.isFunction(this.HUAVOptions.onshowFirstTime)&&(this.HUAVOptions.hasBeenShown=!0,this.HUAVOptions.onshowFirstTime.call(this)),d.isFunction(this.HUAVOptions.onshow)&&(this.HUAVOptions.onshow.call(this),this.trigger("hiddenUntilActivated:shown",this)),this.hidden=!1):(d.isFunction(this.HUAVOptions.onhide)&&(this.HUAVOptions.onhide.call(this),this.trigger("hiddenUntilActivated:hidden",this)),this.hidden=!0),this.HUAVOptions.showFn.apply(this.HUAVOptions.$elementShown,arguments)}},v={initialize:function(e){this.draggable=e.draggable||!1},$dragHandle:function(){return this.$(".title-bar")},toggleDraggable:function(){this.draggable?this.draggableOff():this.draggableOn()},draggableOn:function(){this.draggable=!0,this.dragStartHandler=d.bind(this._dragStartHandler,this),this.dragEndHandler=d.bind(this._dragEndHandler,this);var e=this.$dragHandle().attr("draggable",!0).get(0);e.addEventListener("dragstart",this.dragStartHandler,!1),e.addEventListener("dragend",this.dragEndHandler,!1)},draggableOff:function(){this.draggable=!1;var e=this.$dragHandle().attr("draggable",!1).get(0);e.removeEventListener("dragstart",this.dragStartHandler,!1),e.removeEventListener("dragend",this.dragEndHandler,!1)},_dragStartHandler:function(e){return e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text",JSON.stringify(this.model.toJSON())),this.trigger("draggable:dragstart",e,this),!1},_dragEndHandler:function(e){return this.trigger("draggable:dragend",e,this),!1}},w={initialize:function(e){this.selectable=e.selectable||!1,this.selected=e.selected||!1},$selector:function(){return this.$(".selector")},_renderSelected:function(){this.$selector().find("span").toggleClass("fa-check-square-o",this.selected).toggleClass("fa-square-o",!this.selected)},toggleSelector:function(){this.$selector().is(":visible")?this.hideSelector():this.showSelector()},showSelector:function(e){e=void 0!==e?e:this.fxSpeed,this.selectable=!0,this.trigger("selectable",!0,this),this._renderSelected(),e?this.$selector().show(e):this.$selector().show()},hideSelector:function(e){e=void 0!==e?e:this.fxSpeed,this.selectable=!1,this.trigger("selectable",!1,this),e?this.$selector().hide(e):this.$selector().hide()},toggleSelect:function(e){this.selected?this.deselect(e):this.select(e)},select:function(e){return this.selected||(this.trigger("selected",this,e),this.selected=!0,this._renderSelected()),!1},deselect:function(e){return this.selected&&(this.trigger("de-selected",this,e),this.selected=!1,this._renderSelected()),!1}};t.default={LoggableMixin:g,SessionStorageModel:m,mixin:r,SearchableModelMixin:b,HiddenUntilActivatedViewMixin:y,DraggableViewMixin:v,SelectableViewMixin:w,wrapTemplate:o,buildComparator:n}}).call(t,i(0))}},[298]);
\ No newline at end of file
diff --git a/static/scripts/mvc/library/library-foldertoolbar-view.js b/static/scripts/mvc/library/library-foldertoolbar-view.js
index 49072f43b33..3776c79fd30 100644
--- a/static/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/mvc/library/library-foldertoolbar-view.js
@@ -1 +1 @@
-define("mvc/library/library-foldertoolbar-view",["exports","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select","libs/jquery/jstree"],function(e,t,i,a,o){"use strict";function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0});var l=s(t),r=s(i),n=s(a),d=s(o),c=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=_.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=_.extend(this.options,e);var t=this.templateToolBar(),i={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(i.is_admin=Galaxy.user.isAdmin(),i.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(i.mutiple_add_dataset_options=!0)),this.$el.html(t(i))},renderPaginator:function(e){this.options=_.extend(this.options,e);var t=this.templatePaginator();$("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=_.extend(this.options,e),!0===this.options.can_add_library_item?$(".add-library-items").show():$(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?($(".dataset-manipulation").show(),$(".logged-dataset-manipulation").hide()):($(".logged-dataset-manipulation").show(),$(".dataset-manipulation").show()):($(".logged-dataset-manipulation").hide(),$(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,i=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:i(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var e=this.serialize_new_folder();if(this.validate_new_folder(e)){var t,i=new n.default.FolderAsModel,a=Backbone.history.fragment.split("/");t=a.indexOf("page")>-1?a[a.length-3]:a[a.length-1],i.url=i.urlRoot+t,i.save(e,{success:function(e){Galaxy.modal.hide(),r.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")}})}else r.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)r.default.info("You must select some datasets first.");else{var e=this;this.histories=new n.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)$.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,i){r.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var i=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=i;var a=$("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(i,a),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var i=[],a=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?a.push(e):i.push(e)});for(var o=[],s=i.length-1;s>=0;s--){var l=i[s];(d=new n.default.HistoryItem).url=d.urlRoot+e+"/contents",d.content=l,d.source="library",o.push(d)}for(s=a.length-1;s>=0;s--){var r=a[s],d=new n.default.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=r,d.source="library_folder",o.push(d)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),jQuery.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,$(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";$(".completion_span").text(e)},download:function(e,t){var i=[],a=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?a.push(e):i.push(e)});var o=Galaxy.root+"api/libraries/datasets/download/"+t,s={ld_ids:i,folder_ids:a};this.processDownload(o,s,"get")},processDownload:function(e,t,i){if(e&&t){t="string"==typeof t?t:$.param(t);var a="";$.each(t.split("&"),function(){var e=this.split("=");a+=''}),$('").appendTo("body").submit().remove(),r.default.info("Your download will begin soon.")}else r.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new n.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),$("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var i in t)e.list_extensions.push({id:t[i].extension,text:t[i].extension,description:t[i].description,description_url:t[i].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;c--){var p=n[c].trim();0!==p.length&&d.push(p)}this.initChainCallControl({length:d.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:d,preserve_dirs:e,link_data:t,space_to_tab:i,to_posix_lines:a,source:"admin_path",file_type:s,tag_using_filenames:o,dbkey:l})}else r.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var i=$("#jstree_browser").jstree().get_selected(!0),a=_.filter(i,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),s=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),n=this.modal.$el.find(".posix-checkbox").is(":checked"),d=this.select_extension.value(),c=this.select_genome.value(),p=this.modal.$el.find(".tag-files").is(":checked"),h=a[0].type,u=[];if(a.length<1)r.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var m=a.length-1;m>=0;m--)void 0!==a[m].li_attr.full_path&&u.push(a[m].li_attr.full_path);if(this.initChainCallControl({length:u.length,action:"adding_datasets"}),"folder"===h){f=t.source+"_folder";this.chainCallImportingFolders({paths:u,preserve_dirs:o,link_data:s,space_to_tab:l,to_posix_lines:n,source:f,file_type:d,dbkey:c,tag_using_filenames:p})}else if("file"===h){var f=t.source+"_file";this.chainCallImportingUserdirFiles({paths:u,file_type:d,dbkey:c,link_data:s,space_to_tab:l,to_posix_lines:n,source:f,tag_using_filenames:p})}}},fetchAndDisplayHistoryContents:function(e){var t=this;new n.default.HistoryContents({id:e}).fetch({success:function(i){var a=t.templateHistoryContents();t.histories.get(e).set({contents:i}),t.modal.$el.find("#selected_history_content").html(a({history_contents:i.models.reverse()})),t.modal.$el.find(".history-import-select-all").bind("click",function(){$("#selected_history_content [type=checkbox]").prop("checked",!0)}),t.modal.$el.find(".history-import-unselect-all").bind("click",function(){$("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],i=[],a=[];if(e.length<1)r.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=$(this).closest("li").data("id");if(e){var a=$(this).closest("li").data("name");t.push(e),i.push(a)}});for(var o=t.length-1;o>=0;o--){var s=t[o],l=new n.default.Item;l.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===i[o]?l.set({from_hdca_id:s}):l.set({from_hda_id:s}),a.push(l)}this.initChainCallControl({length:a.length,action:"adding_datasets"}),this.chainCallAddingHdas(a)}},chainCallImportingIntoHistory:function(e,t){var i=this,a=e.pop();if(void 0===a)return 0===this.options.chain_call_control.failed_number?r.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?r.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;l--){var d=new n.default.Item({id:e[l]});s.push(d)}for(l=t.length-1;l>=0;l--){var c=new n.default.FolderAsModel({id:t[l]});s.push(c)}this.options.chain_call_control.total_number=o,this.chainCallDeletingItems(s)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new n.default.Library({id:this.options.parent_library_id})).fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")}})},showLocInfoModal:function(e){var t=this,i=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:i({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),r.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return $("#folder_list_body").find(":checked")},templateToolBar:function(){return _.template(['
All files you select will be imported into the current folder ignoring their folder structure.
','
All files within the selected folders and their subfolders will be imported into the current folder.
','
','',' Choose Files',"",'',' Choose Folders',"","
",'
','','',"Preserve directory structure","",'','',"Link files instead of copying","",'','',"Convert line endings to POSIX","",'','',"Convert spaces to tabs","","
",'",'","",'
',"
","","
You can set extension type and genome for all imported datasets at once:
All files within the given folders and their subfolders will be imported into the current folder.
','
','','',"Preserve directory structure","",'','',"Link files instead of copying",""," ",'','',"Convert line endings to POSIX","",'','',"Convert spaces to tabs","","
",'',"","
You can set extension type and genome for all imported datasets at once:
","",' <%- items_shown %> items shown (change)',"",""," <%- total_items_count %> total",""].join(""))}});e.default={FolderToolbarView:c}});
\ No newline at end of file
+define("mvc/library/library-foldertoolbar-view",["exports","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select","libs/jquery/jstree"],function(e,t,i,a,o){"use strict";function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0});var l=s(t),r=s(i),n=s(a),d=s(o),c=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=_.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=_.extend(this.options,e);var t=this.templateToolBar(),i={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(i.is_admin=Galaxy.user.isAdmin(),i.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(i.mutiple_add_dataset_options=!0)),this.$el.html(t(i))},renderPaginator:function(e){this.options=_.extend(this.options,e);var t=this.templatePaginator();$("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=_.extend(this.options,e),!0===this.options.can_add_library_item?$(".add-library-items").show():$(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?($(".dataset-manipulation").show(),$(".logged-dataset-manipulation").hide()):($(".logged-dataset-manipulation").show(),$(".dataset-manipulation").show()):($(".logged-dataset-manipulation").hide(),$(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,i=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:i(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var e=this.serialize_new_folder();if(this.validate_new_folder(e)){var t,i=new n.default.FolderAsModel,a=Backbone.history.fragment.split("/");t=a.indexOf("page")>-1?a[a.length-3]:a[a.length-1],i.url=i.urlRoot+t,i.save(e,{success:function(e){Galaxy.modal.hide(),r.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")}})}else r.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)r.default.info("You must select some datasets first.");else{var e=this;this.histories=new n.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)$.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,i){r.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var i=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=i;var a=$("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(i,a),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var i=[],a=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?a.push(e):i.push(e)});for(var o=[],s=i.length-1;s>=0;s--){var l=i[s];(d=new n.default.HistoryItem).url=d.urlRoot+e+"/contents",d.content=l,d.source="library",o.push(d)}for(s=a.length-1;s>=0;s--){var r=a[s],d=new n.default.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=r,d.source="library_folder",o.push(d)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),jQuery.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,$(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";$(".completion_span").text(e)},download:function(e,t){var i=[],a=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?a.push(e):i.push(e)});var o=Galaxy.root+"api/libraries/datasets/download/"+t,s={ld_ids:i,folder_ids:a};this.processDownload(o,s,"get")},processDownload:function(e,t,i){if(e&&t){t="string"==typeof t?t:$.param(t);var a="";$.each(t.split("&"),function(){var e=this.split("=");a+=''}),$('").appendTo("body").submit().remove(),r.default.info("Your download will begin soon.")}else r.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new n.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),$("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var i in t)e.list_extensions.push({id:t[i].extension,text:t[i].extension,description:t[i].description,description_url:t[i].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;c--){var p=n[c].trim();0!==p.length&&d.push(p)}this.initChainCallControl({length:d.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:d,preserve_dirs:e,link_data:t,space_to_tab:i,to_posix_lines:a,source:"admin_path",file_type:s,tag_using_filenames:o,dbkey:l})}else r.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var i=$("#jstree_browser").jstree().get_selected(!0),a=_.filter(i,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),s=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),n=this.modal.$el.find(".posix-checkbox").is(":checked"),d=this.select_extension.value(),c=this.select_genome.value(),p=this.modal.$el.find(".tag-files").is(":checked"),h=a[0].type,u=[];if(a.length<1)r.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var m=a.length-1;m>=0;m--)void 0!==a[m].li_attr.full_path&&u.push(a[m].li_attr.full_path);if(this.initChainCallControl({length:u.length,action:"adding_datasets"}),"folder"===h){f=t.source+"_folder";this.chainCallImportingFolders({paths:u,preserve_dirs:o,link_data:s,space_to_tab:l,to_posix_lines:n,source:f,file_type:d,dbkey:c,tag_using_filenames:p})}else if("file"===h){var f=t.source+"_file";this.chainCallImportingUserdirFiles({paths:u,file_type:d,dbkey:c,link_data:s,space_to_tab:l,to_posix_lines:n,source:f,tag_using_filenames:p})}}},fetchAndDisplayHistoryContents:function(e){var t=this;new n.default.HistoryContents({id:e}).fetch({success:function(i){var a=t.templateHistoryContents();t.histories.get(e).set({contents:i}),t.modal.$el.find("#selected_history_content").html(a({history_contents:i.models.reverse()})),t.modal.$el.find(".history-import-select-all").bind("click",function(){$("#selected_history_content [type=checkbox]").prop("checked",!0)}),t.modal.$el.find(".history-import-unselect-all").bind("click",function(){$("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],i=[],a=[];if(e.length<1)r.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=$(this).closest("li").data("id");if(e){var a=$(this).closest("li").data("name");t.push(e),i.push(a)}});for(var o=t.length-1;o>=0;o--){var s=t[o],l=new n.default.Item;l.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===i[o]?l.set({from_hdca_id:s}):l.set({from_hda_id:s}),a.push(l)}this.initChainCallControl({length:a.length,action:"adding_datasets"}),this.chainCallAddingHdas(a)}},chainCallImportingIntoHistory:function(e,t){var i=this,a=e.pop();if(void 0===a)return 0===this.options.chain_call_control.failed_number?r.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?r.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;l--){var d=new n.default.Item({id:e[l]});s.push(d)}for(l=t.length-1;l>=0;l--){var c=new n.default.FolderAsModel({id:t[l]});s.push(c)}this.options.chain_call_control.total_number=o,this.chainCallDeletingItems(s)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new n.default.Library({id:this.options.parent_library_id})).fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?r.default.error(t.responseJSON.err_msg):r.default.error("An error occurred.")}})},showLocInfoModal:function(e){var t=this,i=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:i({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),r.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return $("#folder_list_body").find(":checked")},templateToolBar:function(){return _.template(['
All files you select will be imported into the current folder ignoring their folder structure.
','
All files within the selected folders and their subfolders will be imported into the current folder.
','
','',' Choose Files',"",'',' Choose Folders',"","
",'
','','',"Preserve directory structure","",'','',"Link files instead of copying","",'','',"Convert line endings to POSIX","",'','',"Convert spaces to tabs","","
",'",'","",'
',"
","","
You can set extension type and genome for all imported datasets at once:
All files within the given folders and their subfolders will be imported into the current folder.
','
','','',"Preserve directory structure","",'','',"Link files instead of copying",""," ",'','',"Convert line endings to POSIX","",'','',"Convert spaces to tabs","","
",'',"","
You can set extension type and genome for all imported datasets at once:
","",' <%- items_shown %> items shown (change)',"",""," <%- total_items_count %> total",""].join(""))}});e.default={FolderToolbarView:c}});
\ No newline at end of file