",
- 'This dataset is unrestricted so everybody with the link can access it. Just share this page.',
+ 'This dataset is unrestricted so everybody with the link can access it. Just share this page.',
"
',\n \"<% if (is_admin) { %>\",\n \"You are logged in as an administrator therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.\",\n \"<% } else { %>\",\n \"You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.\",\n \"<% } %>\",\n \"
\",\n '
',\n \"
Library-related permissions
\",\n \"
Roles that can modify the library item
\",\n '',\n '
User with any of these roles can modify name, metadata, and other information about this library item.
',\n \"\",\n \"
Dataset-related permissions
\",\n '
Changes made below will affect every library item that was created from this dataset and also every history this dataset is part of.
',\n '<% if (!item.get(\"is_unrestricted\")) { %>',\n '
',\n \"User has to have all these roles in order to access this dataset.\",\n \" Users without access permission cannot have other permissions on this dataset.\",\n \" If there are no access roles set on the dataset it is considered unrestricted.\",\n \"
\",\n \"
Roles that can manage permissions on the dataset
\",\n '',\n '
',\n \"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.\",\n \"
',\n \"<% if (is_admin) { %>\",\n \"You are logged in as an administrator therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.\",\n \"<% } else { %>\",\n \"You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.\",\n \"<% } %>\",\n \"
\",\n '
',\n \"
Library-related permissions
\",\n \"
Roles that can modify the library item
\",\n '',\n '
User with any of these roles can modify name, metadata, and other information about this library item.
',\n \"\",\n \"
Dataset-related permissions
\",\n '
Changes made below will affect every library item that was created from this dataset and also every history this dataset is part of.
',\n '<% if (!item.get(\"is_unrestricted\")) { %>',\n '
',\n \"User has to have all these roles in order to access this dataset.\",\n \" Users without access permission cannot have other permissions on this dataset.\",\n \" If there are no access roles set on the dataset it is considered unrestricted.\",\n \"
\",\n \"
Roles that can manage permissions on the dataset
\",\n '',\n '
',\n \"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.\",\n \"
',\n \"This folder is either empty or you do not have proper access permissions to see the contents. If you expected something to show up\",\n ' please consult the library security wikipage',\n ' or visit the Galaxy support site.',\n \"
\"\n ].join(\"\")\n );\n }\n });\n\n return {\n FolderListView: FolderListView\n };\n }\n);\n"]}
\ No newline at end of file
+{"version":3,"sources":["mvc/library/library-folderlist-view.js"],"names":["define","FolderListView","el","progress","folderContainer","mod_utils","sort","mod_library_model","events","mod_library_dataset_view","Backbone","View","extend","progressStep","include_deleted","show_page","click #select-all-checkboxes","click .dataset_row","click .folder_row","click .sort-folder-link","collection","defaults","page_count","initialize","options","this","fetchFolder","_","rowViews","Folder","renderOne","listenTo","rePaint","fetch","that","error","mod_toastr","response","responseJSON","onclick","FolderContainer","id","attributes","urlRoot","Galaxy","url","success","folder_container","template","render","model","err_msg","path","length","library_router","back","parent_library_id","upper_folder_id","libraries","templateFolder","$","paginate","metadata","full_path","total_items_count","ceil","items_to_render","order","items_shown","folderToolbarView","reset","dataset_id","row","renderAll","checkEmptiness","models","tooltip","css","postRender","fetched_metadata","Math","preferences","get","page_start","each","slice","contains_file_or_folder","set","find","removeAllRows","addAll","folderListView","add","sortColumnClicked","preventDefault","findWhere","type","sortFolder","configureElements","sort_by","rowView","mod_library_folderrow_view","FolderRowView","checked","after","removeOne","$el","filter","data","checkbox","source","target","makeWhiteRow","makeDarkRow","show","hide","$row","event","removeClass","addClass","renderSortIcon","sortByNameAsc","sortByNameDesc","selectAll","selected","closest","selectClickedRow","localName","join"],"mappings":"aAAAA,QAEQ,kBAeIC,cACAC,cACA,4BACAC,qCACA,oCAZR,SAeQC,EAbJC,EAeIC,EAbJC,EAeIC,EACIC,GAydR,OACIR,eAxdIS,SAAqBC,KAAAC,QACrBV,GAAA,wBAZJC,SAAU,EAEVU,aAAc,EAgBVC,gBAAiB,KAEjBC,KAAAA,MAZJP,QAeAQ,+BAAA,YAbIC,qBAAsB,mBACtBC,oBAAqB,mBACrBC,0BAA2B,qBAqB3BC,WAAA,KAEAC,UAjBAP,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O,GACAD,EAASN,QAAU,GACnB9E,KAAKuF,aAAaI,IACA,UAAXN,GACPrF,KAAKwF,YAAYG,GAGN,OAAXN,GACAD,EAASN,QAAU,WACnB9E,KAAKwF,YAAYG,IACC,UAAXN,GACPrF,KAAKuF,aAAaI,IAK9BH,YAAa,SAASG,GAClBA,EAAKE,YAAY,SAASC,SAAS,QACnCH,EACK5B,KAAK,KACL8B,YAAY,SACZC,SAAS,QACdH,EACK5B,KAAK,cACL8B,YAAY,aACZC,SAAS,WACdH,EACK5B,KAAK,gBACL8B,YAAY,eACZC,SAAS,cAGlBP,aAAc,SAASI,GACnBA,EAAKE,YAAY,QAAQC,SAAS,SAClCH,EACK5B,KAAK,KACL8B,YAAY,QACZC,SAAS,SACdH,EACK5B,KAAK,YACL8B,YAAY,WACZC,SAAS,aACdH,EACK5B,KAAK,cACL8B,YAAY,aACZC,SAAS,gBAGlBC,eAAgB,WACM,QAAd/F,KAAKnB,KACLsD,EAAE,cACG0D,YAAY,sBACZC,SAAS,qBAEd3D,EAAE,cACG0D,YAAY,qBACZC,SAAS,uBAItB5D,eAAgB,WACZ,OAAOhC,EAAEqB,UAGD,0BACA,6EACA,2CACA,kCACA,2GACA,iBACA,0FACA,UACA,YACA,QAGA,yFACA,UACA,mCACA,gKACA,oLACA,0CACA,uCACA,mCACA,mDACA,oCACA,kCACA,WACA,gCACA,8BACA,OACA,qKACA,QACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,QACA,WACA,WACA,2DACA,qIACA,oIACA,kGACA,UACFgF,KAAK","file":"../../../scripts/mvc/library/library-folderlist-view.js","sourcesContent":["define(\n [\n \"layout/masthead\",\n \"utils/utils\",\n \"libs/toastr\",\n \"mvc/library/library-model\",\n \"mvc/library/library-folderrow-view\",\n \"mvc/library/library-dataset-view\"\n ],\n function(\n mod_masthead,\n mod_utils,\n mod_toastr,\n mod_library_model,\n mod_library_folderrow_view,\n mod_library_dataset_view\n ) {\n var FolderListView = Backbone.View.extend({\n el: \"#folder_items_element\",\n // progress percentage\n progress: 0,\n // progress rate per one item\n progressStep: 1,\n\n folderContainer: null,\n\n sort: \"asc\",\n\n events: {\n \"click #select-all-checkboxes\": \"selectAll\",\n \"click .dataset_row\": \"selectClickedRow\",\n \"click .folder_row\": \"selectClickedRow\",\n \"click .sort-folder-link\": \"sortColumnClicked\"\n },\n\n collection: null,\n\n defaults: {\n include_deleted: false,\n page_count: null,\n show_page: null\n },\n\n /**\n * Initialize and fetch the folder from the server.\n * @param {object} options an object with options\n */\n initialize: function(options) {\n this.options = _.defaults(\n this.options || {},\n this.defaults,\n options\n );\n this.modal = null;\n // map of folder item ids to item views = cache\n this.rowViews = {};\n\n // create a collection of folder items for this view\n this.collection = new mod_library_model.Folder();\n\n // start to listen if someone modifies the collection\n this.listenTo(this.collection, \"add\", this.renderOne);\n this.listenTo(this.collection, \"remove\", this.removeOne);\n this.listenTo(this.collection, \"sort\", this.rePaint);\n this.listenTo(this.collection, \"reset\", this.rePaint);\n\n this.fetchFolder();\n },\n\n fetchFolder: function(options) {\n var options = options || {};\n this.options.include_deleted = options.include_deleted;\n var that = this;\n\n this.folderContainer = new mod_library_model.FolderContainer({\n id: this.options.id\n });\n this.folderContainer.url =\n this.folderContainer.attributes.urlRoot +\n this.options.id +\n \"/contents\";\n\n if (this.options.include_deleted) {\n this.folderContainer.url =\n this.folderContainer.url + \"?include_deleted=true\";\n }\n this.folderContainer.fetch({\n success: function(folder_container) {\n that.folder_container = folder_container;\n that.render();\n },\n error: function(model, response) {\n if (typeof response.responseJSON !== \"undefined\") {\n mod_toastr.error(\n response.responseJSON.err_msg +\n \" Click this to go back.\",\n \"\",\n {\n onclick: function() {\n Galaxy.libraries.library_router.back();\n }\n }\n );\n } else {\n mod_toastr.error(\n \"An error occurred. Click this to go back.\",\n \"\",\n {\n onclick: function() {\n Galaxy.libraries.library_router.back();\n }\n }\n );\n }\n }\n });\n },\n\n render: function(options) {\n this.options = _.extend(this.options, options);\n var template = this.templateFolder();\n $(\".tooltip\").hide();\n\n // find the upper id in the full path\n var path = this.folderContainer.attributes.metadata.full_path;\n var upper_folder_id;\n if (path.length === 1) {\n // the library is above us\n upper_folder_id = 0;\n } else {\n upper_folder_id = path[path.length - 2][0];\n }\n\n this.$el.html(\n template({\n path: this.folderContainer.attributes.metadata\n .full_path,\n parent_library_id: this.folderContainer.attributes\n .metadata.parent_library_id,\n id: this.options.id,\n upper_folder_id: upper_folder_id,\n order: this.sort\n })\n );\n\n // when dataset_id is present render its details too\n if (this.options.dataset_id) {\n var row = _.findWhere(that.rowViews, {\n id: this.options.dataset_id\n });\n if (row) {\n row.showDatasetDetails();\n } else {\n mod_toastr.error(\n \"Requested dataset not found. Showing folder instead.\"\n );\n }\n } else {\n if (\n this.options.show_page === null ||\n this.options.show_page < 1\n ) {\n this.options.show_page = 1;\n }\n this.paginate();\n }\n $(\"#center [data-toggle]\").tooltip();\n $(\"#center\").css(\"overflow\", \"auto\");\n },\n\n paginate: function(options) {\n this.options = _.extend(this.options, options);\n\n if (\n this.options.show_page === null ||\n this.options.show_page < 1\n ) {\n this.options.show_page = 1;\n }\n this.options.total_items_count = this.folder_container.get(\n \"folder\"\n ).models.length;\n this.options.page_count = Math.ceil(\n this.options.total_items_count /\n Galaxy.libraries.preferences.get(\"folder_page_size\")\n );\n var page_start =\n Galaxy.libraries.preferences.get(\"folder_page_size\") *\n (this.options.show_page - 1);\n var items_to_render = null;\n items_to_render = this.folder_container\n .get(\"folder\")\n .models.slice(\n page_start,\n page_start +\n Galaxy.libraries.preferences.get(\"folder_page_size\")\n );\n this.options.items_shown = items_to_render.length;\n // User requests page with no items\n if (\n Galaxy.libraries.preferences.get(\"folder_page_size\") *\n this.options.show_page >\n this.options.total_items_count +\n Galaxy.libraries.preferences.get(\"folder_page_size\")\n ) {\n items_to_render = [];\n }\n Galaxy.libraries.folderToolbarView.renderPaginator(\n this.options\n );\n this.collection.reset(items_to_render);\n },\n\n rePaint: function(options) {\n this.options = _.extend(this.options, options);\n this.removeAllRows();\n this.renderAll();\n this.checkEmptiness();\n },\n\n /**\n * Adds all given models to the collection.\n * @param {array of Item or FolderAsModel} array of models that should\n * be added to the view's collection.\n */\n addAll: function(models) {\n _.each(models, function(model) {\n Galaxy.libraries.folderListView.collection.add(model, {\n sort: false\n });\n });\n $(\"#center [data-toggle]\").tooltip();\n this.checkEmptiness();\n this.postRender();\n },\n\n /**\n * Call this after all models are added to the collection\n * to ensure that the folder toolbar will show proper options\n * and that event will be bound on all subviews.\n */\n postRender: function() {\n var fetched_metadata = this.folderContainer.attributes.metadata;\n fetched_metadata.contains_file_or_folder =\n typeof this.collection.findWhere({ type: \"file\" }) !==\n \"undefined\" ||\n typeof this.collection.findWhere({ type: \"folder\" }) !==\n \"undefined\";\n Galaxy.libraries.folderToolbarView.configureElements(\n fetched_metadata\n );\n },\n\n /**\n * Iterates this view's collection and calls the render\n * function for each. Also binds the hover behavior.\n */\n renderAll: function() {\n var that = this;\n _.each(this.collection.models.reverse(), function(model) {\n that.renderOne(model);\n });\n this.postRender();\n },\n\n /**\n * Creates a view for the given model and adds it to the folder view.\n * @param {Item or FolderAsModel} model of the view that will be rendered\n */\n renderOne: function(model) {\n this.options.contains_file_or_folder = true;\n //if (model.get('type') !== 'folder'){\n // model.set('readable_size', this.size_to_string(model.get('file_size')));\n //}\n model.set(\"folder_id\", this.id);\n var rowView = new mod_library_folderrow_view.FolderRowView({\n model: model\n });\n\n // save new rowView to cache\n this.rowViews[model.get(\"id\")] = rowView;\n\n this.$el.find(\"#first_folder_item\").after(rowView.el);\n },\n\n /**\n * Remove the view of the given model from the DOM.\n * @param {Item or FolderAsModel} model of the view that will be removed\n */\n removeOne: function(model) {\n this.$el\n .find(\"tr\")\n .filter(function() {\n return (\n $(this).data(\"id\") &&\n $(this).data(\"id\") === model.id\n );\n })\n .remove();\n },\n\n /**\n * Remove all dataset and folder row elements from the DOM.\n */\n removeAllRows: function() {\n $(\".library-row\").remove();\n },\n\n /** Checks whether the list is empty and adds/removes the message */\n checkEmptiness: function() {\n if (\n this.$el.find(\".dataset_row\").length === 0 &&\n this.$el.find(\".folder_row\").length === 0\n ) {\n this.$el.find(\".empty-folder-message\").show();\n } else {\n this.$el.find(\".empty-folder-message\").hide();\n }\n },\n\n /** User clicked the table heading = he wants to sort stuff */\n sortColumnClicked: function(event) {\n event.preventDefault();\n if (this.sort === \"asc\") {\n this.sortFolder(\"name\", \"desc\");\n this.sort = \"desc\";\n } else {\n this.sortFolder(\"name\", \"asc\");\n this.sort = \"asc\";\n }\n this.renderSortIcon();\n },\n\n /**\n * Sorts the underlying collection according to the parameters received.\n * Currently supports only sorting by name.\n */\n sortFolder: function(sort_by, order) {\n // default to asc sort by name\n if (sort_by === \"undefined\" && order === \"undefined\") {\n return this.collection.sortByNameAsc();\n }\n if (sort_by === \"name\") {\n if (order === \"asc\") {\n return this.collection.sortByNameAsc();\n } else if (order === \"desc\") {\n return this.collection.sortByNameDesc();\n }\n }\n },\n\n /**\n * User clicked the checkbox in the table heading\n * @param {context} event\n */\n selectAll: function(event) {\n var selected = event.target.checked;\n that = this;\n // Iterate each checkbox\n $(\":checkbox\", \"#folder_list_body\").each(function() {\n this.checked = selected;\n var $row = $(this).closest(\"tr\");\n // Change color of selected/unselected\n if (selected) {\n that.makeDarkRow($row);\n } else {\n that.makeWhiteRow($row);\n }\n });\n },\n\n /**\n * Check checkbox if user clicks on the whole row or\n * on the checkbox itself\n */\n selectClickedRow: function(event) {\n var checkbox = \"\";\n var $row;\n var source;\n $row = $(event.target).closest(\"tr\");\n if (event.target.localName === \"input\") {\n checkbox = event.target;\n source = \"input\";\n } else if (event.target.localName === \"td\") {\n checkbox = $row.find(\":checkbox\")[0];\n source = \"td\";\n }\n if (checkbox.checked) {\n if (source === \"td\") {\n checkbox.checked = \"\";\n this.makeWhiteRow($row);\n } else if (source === \"input\") {\n this.makeDarkRow($row);\n }\n } else {\n if (source === \"td\") {\n checkbox.checked = \"selected\";\n this.makeDarkRow($row);\n } else if (source === \"input\") {\n this.makeWhiteRow($row);\n }\n }\n },\n\n makeDarkRow: function($row) {\n $row.removeClass(\"light\").addClass(\"dark\");\n $row\n .find(\"a\")\n .removeClass(\"light\")\n .addClass(\"dark\");\n $row\n .find(\".fa-file-o\")\n .removeClass(\"fa-file-o\")\n .addClass(\"fa-file\");\n $row\n .find(\".fa-folder-o\")\n .removeClass(\"fa-folder-o\")\n .addClass(\"fa-folder\");\n },\n\n makeWhiteRow: function($row) {\n $row.removeClass(\"dark\").addClass(\"light\");\n $row\n .find(\"a\")\n .removeClass(\"dark\")\n .addClass(\"light\");\n $row\n .find(\".fa-file\")\n .removeClass(\"fa-file\")\n .addClass(\"fa-file-o\");\n $row\n .find(\".fa-folder\")\n .removeClass(\"fa-folder\")\n .addClass(\"fa-folder-o\");\n },\n\n renderSortIcon: function() {\n if (this.sort === \"asc\") {\n $(\".sort-icon\")\n .removeClass(\"fa-sort-alpha-desc\")\n .addClass(\"fa-sort-alpha-asc\");\n } else {\n $(\".sort-icon\")\n .removeClass(\"fa-sort-alpha-asc\")\n .addClass(\"fa-sort-alpha-desc\");\n }\n },\n\n templateFolder: function() {\n return _.template(\n [\n // BREADCRUMBS\n '',\n '
',\n \"This folder is either empty or you do not have proper access permissions to see the contents. If you expected something to show up\",\n ' please consult the library security wikipage',\n ' or visit the Galaxy support site.',\n \"
\"\n ].join(\"\")\n );\n }\n });\n\n return {\n FolderListView: FolderListView\n };\n }\n);\n"]}
\ No newline at end of file
diff --git a/static/maps/mvc/library/library-folderrow-view.js.map b/static/maps/mvc/library/library-folderrow-view.js.map
index 47408f267ef..5339009ddda 100644
--- a/static/maps/mvc/library/library-folderrow-view.js.map
+++ b/static/maps/mvc/library/library-folderrow-view.js.map
@@ -1 +1 @@
-{"version":3,"sources":["mvc/library/library-folderrow-view.js"],"names":["define","FolderRowView","events","mod_toastr","mod_library_model","mod_library_dataset_view","Backbone","View","extend","click .undelete_dataset_btn","click .undelete_folder_btn","click .edit_folder_btn","defaults","type","save_folder_btn","cancel_folder_btn","permission_folder_btn","edit_folder_btn","edit_mode","_","initialize","options","this","render","folder_item","model","template","prepareButtons","vis_config","get","templateRowFolder","templateRowDeletedFile","templateRowFile","Galaxy","error","setElement","button_config","emit","folder","visibility_config","datasetView","dataset_id","event","closest","dataset","folderListView","url","destroy","libraries","success","onclick","LibraryDatasetView","id","$","hide","target","data","collection","urlRoot","undeleteFolder","response","remove","add","updated_folder","responseJSON","folder_id","that","window","location","root","repaint","err_msg","is_changed","new_description","find","row_view","FolderAsModel","sortByNameAsc","info","startModifications","old_element","cancelModifications","saveModifications","$el","new_name","val","length","templateRowDeletedFolder","warning","set","save","patch","replaceWith","tooltip","join"],"mappings":"aAAAA,QAEQ,cAKIC,4BACAC,oCAEI,SAAAC,EAAAC,EAA8BC,GA4btC,OACIJ,cA5bIK,SAAAC,KAA0BC,QAC1BN,QACAO,8BAA0B,kBANOC,6BAAA,iBAIjCC,yBAA0B,qBAK9BC,2BAAU,sBACNC,yBADM,qBAIFC,UACAC,KAAAA,KACAC,mBANEC,iBAAA,EAQNC,iBAAW,EAjBsBH,mBAAA,EAe7BC,uBAAuB,GAM3BE,WAAeC,GADnBC,WAAY,SAASC,GAKbC,KAAAD,QAAAF,EAASE,SAASA,MAAAC,KAAAV,UACtBU,KAAKD,OAAUF,KAAEX,UADrBe,OAAQ,SAASF,GAMTG,KAAAA,QAAAL,EAAgBX,OAAhBc,KAA4BD,QAA5BA,GAGA,IAAAG,EAAAF,KAAoBD,QAApBI,MACAC,EAAKC,KAkDDC,MA/CG,WAFPJ,EAEOK,IAAA,SACH,kBAAAH,EAAWG,IAAKC,gBAEjBR,KACHE,QAAAA,KAAgB,SAKhBF,KAAKD,eAAeG,GAEhBE,EADAF,EAAgBK,IAAA,WACLP,KAAKS,2BAELT,KAAKU,qBAGF,SAAlBC,EAAYC,IAAM,SAKrB,qCAJGD,EAAYC,IACRV,gBAKK,mBADRW,EACDT,IAAAA,gBAEIR,KAAAA,QAAgBG,KAAQH,OAHhC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A,+CACA,QACA,oCACA,6CACA,QACA,OACA,mHACA,kCACA,MACA,QACA,8CACA,yDACA,0DACA,4DACA,OACA,mDACA,gIACA,UACA,8CACA,yHACA,UACA,6GACA,+HACA,UACA,8CACA,uGACA,uIACA,8BACA,YACA,OACA,UACA,QACA,SACFoE,KAAK,MAIf/D,uBAAwB,WACpB,OAAOZ,EAAEO,UAED,mFACA,OACA,+CACA,QACA,YACA,2BACA,kCACA,QACA,OACA,qCACA,QACA,OACA,gDACA,QACA,OACA,iDACA,QACA,OACA,mDACA,QACA,OACA,wHACA,iMACA,+BACA,iBACA,YACA,QACA,SACFoE,KAAK,MAIfP,yBAA0B,WACtB,OAAOpE,EAAEO,UAED,wFACA,OACA,gDACA,QACA,YACA,2BACA,kCACA,QACA,OACA,yCACA,QACA,OACA,SACA,QACA,YACA,OACA,mDACA,QACA,OACA,wHACA,gMACA,+BACA,iBACA,YACA,QACA,SACFoE,KAAK","file":"../../../scripts/mvc/library/library-folderrow-view.js","sourcesContent":["define(\n [\n \"libs/toastr\",\n \"mvc/library/library-model\",\n \"mvc/library/library-dataset-view\"\n ],\n function(mod_toastr, mod_library_model, mod_library_dataset_view) {\n var FolderRowView = Backbone.View.extend({\n events: {\n \"click .undelete_dataset_btn\": \"undeleteDataset\",\n \"click .undelete_folder_btn\": \"undeleteFolder\",\n \"click .edit_folder_btn\": \"startModifications\",\n \"click .cancel_folder_btn\": \"cancelModifications\",\n \"click .save_folder_btn\": \"saveModifications\"\n },\n\n defaults: {\n type: null,\n visibility_config: {\n edit_folder_btn: true,\n save_folder_btn: false,\n cancel_folder_btn: false,\n permission_folder_btn: true\n },\n edit_mode: false\n },\n\n initialize: function(options) {\n this.options = _.defaults(options || {}, this.defaults);\n this.render(this.options);\n },\n\n render: function(options) {\n this.options = _.extend(this.options, options);\n var folder_item = this.options.model;\n var template = null;\n\n if (\n folder_item.get(\"type\") === \"folder\" ||\n folder_item.get(\"model_class\") === \"LibraryFolder\"\n ) {\n this.options.type = \"folder\";\n this.prepareButtons(folder_item);\n if (folder_item.get(\"deleted\")) {\n template = this.templateRowDeletedFolder();\n } else {\n template = this.templateRowFolder();\n }\n } else if (\n folder_item.get(\"type\") === \"file\" ||\n folder_item.get(\"model_class\") ===\n \"LibraryDatasetDatasetAssociation\" ||\n folder_item.get(\"model_class\") === \"LibraryDataset\"\n ) {\n this.options.type = \"file\";\n if (folder_item.get(\"deleted\")) {\n template = this.templateRowDeletedFile();\n } else {\n template = this.templateRowFile();\n }\n } else {\n Galaxy.emit.error(\"Unknown library item type found.\");\n Galaxy.emit.error(\n folder_item.get(\"type\") ||\n folder_item.get(\"model_class\")\n );\n }\n this.setElement(\n template({\n content_item: folder_item,\n edit_mode: this.options.edit_mode,\n button_config: this.options.visibility_config\n })\n );\n this.$el.show();\n return this;\n },\n\n /**\n * Modify the visibility of buttons for\n * the filling of the row template of a given folder.\n */\n prepareButtons: function(folder) {\n var vis_config = this.options.visibility_config;\n if (this.options.edit_mode === false) {\n vis_config.save_folder_btn = false;\n vis_config.cancel_folder_btn = false;\n if (folder.get(\"deleted\") === true) {\n vis_config.edit_folder_btn = false;\n vis_config.permission_folder_btn = false;\n } else if (folder.get(\"deleted\") === false) {\n vis_config.save_folder_btn = false;\n vis_config.cancel_folder_btn = false;\n if (folder.get(\"can_modify\") === true) {\n vis_config.edit_folder_btn = true;\n }\n if (folder.get(\"can_manage\") === true) {\n vis_config.permission_folder_btn = true;\n }\n }\n } else if (this.options.edit_mode === true) {\n vis_config.edit_folder_btn = false;\n vis_config.permission_folder_btn = false;\n vis_config.save_folder_btn = true;\n vis_config.cancel_folder_btn = true;\n }\n this.options.visibility_config = vis_config;\n },\n\n /* Show the page with dataset details. */\n showDatasetDetails: function() {\n Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView(\n { id: this.id }\n );\n },\n\n /* Undelete the dataset on server and render the row again. */\n undeleteDataset: function(event) {\n $(\".tooltip\").hide();\n var that = this;\n var dataset_id = $(event.target)\n .closest(\"tr\")\n .data(\"id\");\n var dataset = Galaxy.libraries.folderListView.collection.get(\n dataset_id\n );\n dataset.url = dataset.urlRoot + dataset.id + \"?undelete=true\";\n dataset.destroy({\n success: function(model, response) {\n Galaxy.libraries.folderListView.collection.remove(\n dataset_id\n );\n var updated_dataset = new mod_library_model.Item(\n response\n );\n Galaxy.libraries.folderListView.collection.add(\n updated_dataset\n );\n Galaxy.libraries.folderListView.collection.sortByNameAsc();\n mod_toastr.success(\n \"Dataset undeleted. Click this to see it.\",\n \"\",\n {\n onclick: function() {\n var folder_id = that.model.get(\"folder_id\");\n window.location =\n Galaxy.root +\n \"library/list#folders/\" +\n folder_id +\n \"/datasets/\" +\n that.id;\n }\n }\n );\n },\n error: function(model, response) {\n if (typeof response.responseJSON !== \"undefined\") {\n mod_toastr.error(\n \"Dataset was not undeleted. \" +\n response.responseJSON.err_msg\n );\n } else {\n mod_toastr.error(\n \"An error occured! Dataset was not undeleted. Please try again.\"\n );\n }\n }\n });\n },\n\n /* Undelete the folder on server and render the row again. */\n undeleteFolder: function(event) {\n $(\".tooltip\").hide();\n var that = this;\n var folder_id = $(event.target)\n .closest(\"tr\")\n .data(\"id\");\n var folder = Galaxy.libraries.folderListView.collection.get(\n folder_id\n );\n folder.url = folder.urlRoot + folder.id + \"?undelete=true\";\n folder.destroy({\n success: function(model, response) {\n Galaxy.libraries.folderListView.collection.remove(\n folder_id\n );\n var updated_folder = new mod_library_model.FolderAsModel(\n response\n );\n Galaxy.libraries.folderListView.collection.add(\n updated_folder\n );\n Galaxy.libraries.folderListView.collection.sortByNameAsc();\n mod_toastr.success(\"Folder undeleted.\");\n },\n error: function(model, response) {\n if (typeof response.responseJSON !== \"undefined\") {\n mod_toastr.error(\n \"Folder was not undeleted. \" +\n response.responseJSON.err_msg\n );\n } else {\n mod_toastr.error(\n \"An error occured! Folder was not undeleted. Please try again.\"\n );\n }\n }\n });\n },\n\n /* User clicked the 'edit' button on row so render the row as editable. */\n startModifications: function() {\n this.options.edit_mode = true;\n this.repaint();\n },\n\n /* User clicked the 'cancel' button so render normal row */\n cancelModifications: function() {\n this.options.edit_mode = false;\n this.repaint();\n },\n\n saveModifications: function() {\n var folder = Galaxy.libraries.folderListView.collection.get(\n this.$el.data(\"id\")\n );\n var is_changed = false;\n var new_name = this.$el.find(\".input_folder_name\").val();\n if (\n typeof new_name !== \"undefined\" &&\n new_name !== folder.get(\"name\")\n ) {\n if (new_name.length > 2) {\n folder.set(\"name\", new_name);\n is_changed = true;\n } else {\n mod_toastr.warning(\n \"Folder name has to be at least 3 characters long.\"\n );\n return;\n }\n }\n var new_description = this.$el\n .find(\".input_folder_description\")\n .val();\n if (\n typeof new_description !== \"undefined\" &&\n new_description !== folder.get(\"description\")\n ) {\n folder.set(\"description\", new_description);\n is_changed = true;\n }\n if (is_changed) {\n var row_view = this;\n folder.save(null, {\n patch: true,\n success: function(folder) {\n row_view.options.edit_mode = false;\n row_view.repaint(folder);\n mod_toastr.success(\"Changes to folder saved.\");\n },\n error: function(model, response) {\n if (typeof response.responseJSON !== \"undefined\") {\n mod_toastr.error(response.responseJSON.err_msg);\n } else {\n mod_toastr.error(\n \"An error occured while attempting to update the folder.\"\n );\n }\n }\n });\n } else {\n this.options.edit_mode = false;\n this.repaint(folder);\n mod_toastr.info(\"Nothing has changed.\");\n }\n },\n\n repaint: function() {\n /* need to hide manually because of the element removal in setElement\n invoked in render() */\n $(\".tooltip\").hide();\n /* we need to store the old element to be able to replace it with\n new one */\n var old_element = this.$el;\n /* if user canceled the folder param is undefined,\n if user saved and succeeded the updated folder is rendered */\n this.render();\n old_element.replaceWith(this.$el);\n /* now we attach new tooltips to the newly created row element */\n this.$el.find(\"[data-toggle]\").tooltip();\n },\n\n templateRowFolder: function() {\n return _.template(\n [\n '
\"\n ].join(\"\")\n );\n }\n });\n\n return {\n LibraryToolbarView: LibraryToolbarView\n };\n});\n"]}
\ No newline at end of file
diff --git a/static/scripts/mvc/library/library-dataset-view.js b/static/scripts/mvc/library/library-dataset-view.js
index 518209b75af..1cd1d4a8b56 100644
--- a/static/scripts/mvc/library/library-dataset-view.js
+++ b/static/scripts/mvc/library/library-dataset-view.js
@@ -1,2 +1,2 @@
-"use strict";define(["libs/toastr","mvc/library/library-model","utils/utils","mvc/ui/ui-select"],function(t,e,s,i){return{LibraryDatasetView:Backbone.View.extend({el:"#center",model:null,options:{},defaults:{edit_mode:!1},events:{"click .toolbtn_modify_dataset":"enableModification","click .toolbtn_cancel_modifications":"render","click .toolbtn-download-dataset":"downloadDataset","click .toolbtn-import-dataset":"importIntoHistory","click .copy-link-to-clipboard":"copyToClipboard","click .make-private":"makeDatasetPrivate","click .remove-restrictions":"removeDatasetRestrictions","click .toolbtn_save_permissions":"savePermissions","click .toolbtn_save_modifications":"saveModifications"},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(t){this.options=_.extend(this.options,t),this.fetchExtAndGenomes(),this.options.id&&this.fetchDataset()},fetchDataset:function(s){this.options=_.extend(this.options,s),this.model=new e.Item({id:this.options.id});var i=this;this.model.fetch({success:function(){i.options.show_permissions?i.showPermissions():i.options.show_version?i.fetchVersion():i.render()},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):t.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},render:function(t){this.options=_.extend(this.options,t),$(".tooltip").remove();var e=this.templateDataset();this.$el.html(e({item:this.model})),$(".peek").html(this.model.get("peek")),$("#center [data-toggle]").tooltip()},fetchVersion:function(s){this.options=_.extend(this.options,s),that=this,this.options.ldda_id?(this.ldda=new e.Ldda({id:this.options.ldda_id}),this.ldda.url=this.ldda.urlRoot+this.model.id+"/versions/"+this.ldda.id,this.ldda.fetch({success:function(){that.renderVersion()},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg):t.error("An error occurred.")}})):(this.render(),t.error("Library dataset version requested but no id provided."))},renderVersion:function(){$(".tooltip").remove();var t=this.templateVersion();this.$el.html(t({item:this.model,ldda:this.ldda})),$(".peek").html(this.ldda.get("peek"))},enableModification:function(){$(".tooltip").remove();var t=this.templateModifyDataset();this.$el.html(t({item:this.model})),this.renderSelectBoxes({genome_build:this.model.get("genome_build"),file_ext:this.model.get("file_ext")}),$(".peek").html(this.model.get("peek")),$("#center [data-toggle]").tooltip()},downloadDataset:function(){var t=Galaxy.root+"api/libraries/datasets/download/uncompressed",e={ld_ids:this.id};this.processDownload(t,e)},processDownload:function(e,s,i){if(e&&s){s="string"==typeof s?s:$.param(s);var a="";$.each(s.split("&"),function(){var t=this.split("=");a+=''}),$('").appendTo("body").submit().remove(),t.info("Your download will begin soon.")}},importIntoHistory:function(){this.refreshUserHistoriesList(function(t){var e=t.templateBulkImportInModal();t.modal=Galaxy.modal,t.modal.show({closing_events:!0,title:"Import into History",body:e({histories:t.histories.models}),buttons:{Import:function(){t.importCurrentIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})},refreshUserHistoriesList:function(s){var i=this;this.histories=new e.GalaxyHistories,this.histories.fetch({success:function(e){0===e.length?t.warning("You have to create history first. Click this to do so.","",{onclick:function(){window.location=Galaxy.root}}):s(i)},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg):t.error("An error occurred.")}})},importCurrentIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),s=this;if(""!==e)$.post(Galaxy.root+"api/histories",{name:e}).done(function(t){s.processImportToHistory(t.id)}).fail(function(e,s,i){t.error("An error occurred.")}).always(function(){s.modal.enableButton("Import")});else{var i=$(this.modal.$el).find("select[name=dataset_import_single] option:selected").val();this.processImportToHistory(i),this.modal.enableButton("Import")}},processImportToHistory:function(s){var i=new e.HistoryItem;i.url=i.urlRoot+s+"/contents",jQuery.getJSON(Galaxy.root+"history/set_as_current?id="+s),i.save({content:this.id,source:"library"},{success:function(){Galaxy.modal.hide(),t.success("Dataset imported. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}})},error:function(e,s){void 0!==s.responseJSON?t.error("Dataset not imported. "+s.responseJSON.err_msg):t.error("An error occured. Dataset not imported. Please try again.")}})},showPermissions:function(e){var s=this.templateDatasetPermissions(),i=this;this.options=_.extend(this.options,e),$(".tooltip").remove(),void 0!==this.options.fetched_permissions&&(0===this.options.fetched_permissions.access_dataset_roles.length?this.model.set({is_unrestricted:!0}):this.model.set({is_unrestricted:!1})),this.$el.html(s({item:this.model,is_admin:Galaxy.config.is_admin_user})),$.get(Galaxy.root+"api/libraries/datasets/"+i.id+"/permissions?scope=current").done(function(t){i.prepareSelectBoxes({fetched_permissions:t,is_admin:Galaxy.config.is_admin_user})}).fail(function(){t.error("An error occurred while attempting to fetch dataset permissions.")}),$("#center [data-toggle]").tooltip(),$("#center").css("overflow","auto")},_serializeRoles:function(t){for(var e=[],s=0;s0))return void t.warning("Library dataset name has to be at least 1 character long.");i.set("name",a),s=!0}var o=this.$el.find(".input_dataset_misc_info").val();void 0!==o&&o!==i.get("misc_info")&&(i.set("misc_info",o),s=!0);var r=this.select_genome.$el.select2("data").id;void 0!==r&&r!==i.get("genome_build")&&(i.set("genome_build",r),s=!0);var n=this.select_extension.$el.select2("data").id;void 0!==n&&n!==i.get("file_ext")&&(i.set("file_ext",n),s=!0);var l=this;s?i.save(null,{patch:!0,success:function(e){l.render(),t.success("Changes to library dataset saved.")},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg):t.error("An error occured while attempting to update the library dataset.")}}):(l.render(),t.info("Nothing has changed."))},copyToClipboard:function(){var t=Backbone.history.location.href;-1!==t.lastIndexOf("/permissions")&&(t=t.substr(0,t.lastIndexOf("/permissions"))),window.prompt("Copy to clipboard: Ctrl+C, Enter",t)},makeDatasetPrivate:function(){var e=this;$.post(Galaxy.root+"api/libraries/datasets/"+e.id+"/permissions?action=make_private").done(function(s){e.model.set({is_unrestricted:!1}),e.showPermissions({fetched_permissions:s}),t.success("The dataset is now private to you.")}).fail(function(){t.error("An error occurred while attempting to make dataset private.")})},removeDatasetRestrictions:function(){var e=this;$.post(Galaxy.root+"api/libraries/datasets/"+e.id+"/permissions?action=remove_restrictions").done(function(s){e.model.set({is_unrestricted:!0}),e.showPermissions({fetched_permissions:s}),t.success("Access to this dataset is now unrestricted.")}).fail(function(){t.error("An error occurred while attempting to make dataset unrestricted.")})},_extractIds:function(t){for(var e=[],s=t.length-1;s>=0;s--)e.push(t[s].id);return e},savePermissions:function(e){var s=this,i=this._extractIds(this.accessSelectObject.$el.select2("data")),a=this._extractIds(this.manageSelectObject.$el.select2("data")),o=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post(Galaxy.root+"api/libraries/datasets/"+s.id+"/permissions?action=set_permissions",{"access_ids[]":i,"manage_ids[]":a,"modify_ids[]":o}).done(function(e){s.showPermissions({fetched_permissions:e}),t.success("Permissions saved.")}).fail(function(){t.error("An error occurred while attempting to set dataset permissions.")})},fetchExtAndGenomes:function(){var t=this;0==this.list_genomes.length&&s.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(e){for(var s in e)t.list_extensions.push({id:e[s].extension,text:e[s].extension,description:e[s].description,description_url:e[s].description_url});t.list_extensions.sort(function(t,e){return t.id>e.id?1:t.ide.id?1:t.id','
',"<% 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.","
"].join(""))}})}});
+"use strict";define(["libs/toastr","mvc/library/library-model","utils/utils","mvc/ui/ui-select"],function(t,e,s,i){return{LibraryDatasetView:Backbone.View.extend({el:"#center",model:null,options:{},defaults:{edit_mode:!1},events:{"click .toolbtn_modify_dataset":"enableModification","click .toolbtn_cancel_modifications":"render","click .toolbtn-download-dataset":"downloadDataset","click .toolbtn-import-dataset":"importIntoHistory","click .copy-link-to-clipboard":"copyToClipboard","click .make-private":"makeDatasetPrivate","click .remove-restrictions":"removeDatasetRestrictions","click .toolbtn_save_permissions":"savePermissions","click .toolbtn_save_modifications":"saveModifications"},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(t){this.options=_.extend(this.options,t),this.fetchExtAndGenomes(),this.options.id&&this.fetchDataset()},fetchDataset:function(s){this.options=_.extend(this.options,s),this.model=new e.Item({id:this.options.id});var i=this;this.model.fetch({success:function(){i.options.show_permissions?i.showPermissions():i.options.show_version?i.fetchVersion():i.render()},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):t.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},render:function(t){this.options=_.extend(this.options,t),$(".tooltip").remove();var e=this.templateDataset();this.$el.html(e({item:this.model})),$(".peek").html(this.model.get("peek")),$("#center [data-toggle]").tooltip()},fetchVersion:function(s){this.options=_.extend(this.options,s),that=this,this.options.ldda_id?(this.ldda=new e.Ldda({id:this.options.ldda_id}),this.ldda.url=this.ldda.urlRoot+this.model.id+"/versions/"+this.ldda.id,this.ldda.fetch({success:function(){that.renderVersion()},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg):t.error("An error occurred.")}})):(this.render(),t.error("Library dataset version requested but no id provided."))},renderVersion:function(){$(".tooltip").remove();var t=this.templateVersion();this.$el.html(t({item:this.model,ldda:this.ldda})),$(".peek").html(this.ldda.get("peek"))},enableModification:function(){$(".tooltip").remove();var t=this.templateModifyDataset();this.$el.html(t({item:this.model})),this.renderSelectBoxes({genome_build:this.model.get("genome_build"),file_ext:this.model.get("file_ext")}),$(".peek").html(this.model.get("peek")),$("#center [data-toggle]").tooltip()},downloadDataset:function(){var t=Galaxy.root+"api/libraries/datasets/download/uncompressed",e={ld_ids:this.id};this.processDownload(t,e)},processDownload:function(e,s,i){if(e&&s){s="string"==typeof s?s:$.param(s);var a="";$.each(s.split("&"),function(){var t=this.split("=");a+=''}),$('").appendTo("body").submit().remove(),t.info("Your download will begin soon.")}},importIntoHistory:function(){this.refreshUserHistoriesList(function(t){var e=t.templateBulkImportInModal();t.modal=Galaxy.modal,t.modal.show({closing_events:!0,title:"Import into History",body:e({histories:t.histories.models}),buttons:{Import:function(){t.importCurrentIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})},refreshUserHistoriesList:function(s){var i=this;this.histories=new e.GalaxyHistories,this.histories.fetch({success:function(e){0===e.length?t.warning("You have to create history first. Click this to do so.","",{onclick:function(){window.location=Galaxy.root}}):s(i)},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg):t.error("An error occurred.")}})},importCurrentIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),s=this;if(""!==e)$.post(Galaxy.root+"api/histories",{name:e}).done(function(t){s.processImportToHistory(t.id)}).fail(function(e,s,i){t.error("An error occurred.")}).always(function(){s.modal.enableButton("Import")});else{var i=$(this.modal.$el).find("select[name=dataset_import_single] option:selected").val();this.processImportToHistory(i),this.modal.enableButton("Import")}},processImportToHistory:function(s){var i=new e.HistoryItem;i.url=i.urlRoot+s+"/contents",jQuery.getJSON(Galaxy.root+"history/set_as_current?id="+s),i.save({content:this.id,source:"library"},{success:function(){Galaxy.modal.hide(),t.success("Dataset imported. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}})},error:function(e,s){void 0!==s.responseJSON?t.error("Dataset not imported. "+s.responseJSON.err_msg):t.error("An error occured. Dataset not imported. Please try again.")}})},showPermissions:function(e){var s=this.templateDatasetPermissions(),i=this;this.options=_.extend(this.options,e),$(".tooltip").remove(),void 0!==this.options.fetched_permissions&&(0===this.options.fetched_permissions.access_dataset_roles.length?this.model.set({is_unrestricted:!0}):this.model.set({is_unrestricted:!1})),this.$el.html(s({item:this.model,is_admin:Galaxy.config.is_admin_user})),$.get(Galaxy.root+"api/libraries/datasets/"+i.id+"/permissions?scope=current").done(function(t){i.prepareSelectBoxes({fetched_permissions:t,is_admin:Galaxy.config.is_admin_user})}).fail(function(){t.error("An error occurred while attempting to fetch dataset permissions.")}),$("#center [data-toggle]").tooltip(),$("#center").css("overflow","auto")},_serializeRoles:function(t){for(var e=[],s=0;s0))return void t.warning("Library dataset name has to be at least 1 character long.");i.set("name",a),s=!0}var o=this.$el.find(".input_dataset_misc_info").val();void 0!==o&&o!==i.get("misc_info")&&(i.set("misc_info",o),s=!0);var r=this.select_genome.$el.select2("data").id;void 0!==r&&r!==i.get("genome_build")&&(i.set("genome_build",r),s=!0);var n=this.select_extension.$el.select2("data").id;void 0!==n&&n!==i.get("file_ext")&&(i.set("file_ext",n),s=!0);var l=this;s?i.save(null,{patch:!0,success:function(e){l.render(),t.success("Changes to library dataset saved.")},error:function(e,s){void 0!==s.responseJSON?t.error(s.responseJSON.err_msg):t.error("An error occured while attempting to update the library dataset.")}}):(l.render(),t.info("Nothing has changed."))},copyToClipboard:function(t){t.preventDefault();var e=Backbone.history.location.href;-1!==e.lastIndexOf("/permissions")&&(e=e.substr(0,e.lastIndexOf("/permissions"))),window.prompt("Copy to clipboard: Ctrl+C, Enter",e)},makeDatasetPrivate:function(){var e=this;$.post(Galaxy.root+"api/libraries/datasets/"+e.id+"/permissions?action=make_private").done(function(s){e.model.set({is_unrestricted:!1}),e.showPermissions({fetched_permissions:s}),t.success("The dataset is now private to you.")}).fail(function(){t.error("An error occurred while attempting to make dataset private.")})},removeDatasetRestrictions:function(){var e=this;$.post(Galaxy.root+"api/libraries/datasets/"+e.id+"/permissions?action=remove_restrictions").done(function(s){e.model.set({is_unrestricted:!0}),e.showPermissions({fetched_permissions:s}),t.success("Access to this dataset is now unrestricted.")}).fail(function(){t.error("An error occurred while attempting to make dataset unrestricted.")})},_extractIds:function(t){for(var e=[],s=t.length-1;s>=0;s--)e.push(t[s].id);return e},savePermissions:function(e){var s=this,i=this._extractIds(this.accessSelectObject.$el.select2("data")),a=this._extractIds(this.manageSelectObject.$el.select2("data")),o=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post(Galaxy.root+"api/libraries/datasets/"+s.id+"/permissions?action=set_permissions",{"access_ids[]":i,"manage_ids[]":a,"modify_ids[]":o}).done(function(e){s.showPermissions({fetched_permissions:e}),t.success("Permissions saved.")}).fail(function(){t.error("An error occurred while attempting to set dataset permissions.")})},fetchExtAndGenomes:function(){var t=this;0==this.list_genomes.length&&s.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(e){for(var s in e)t.list_extensions.push({id:e[s].extension,text:e[s].extension,description:e[s].description,description_url:e[s].description_url});t.list_extensions.sort(function(t,e){return t.id>e.id?1:t.ide.id?1:t.id','
',"<% 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(""))}})}});
+"use strict";define(["layout/masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view","mvc/library/library-dataset-view"],function(e,t,i,s,o,r){return{FolderListView:Backbone.View.extend({el:"#folder_items_element",progress:0,progressStep:1,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .folder_row":"selectClickedRow","click .sort-folder-link":"sortColumnClicked"},collection:null,defaults:{include_deleted:!1,page_count:null,show_page:null},initialize:function(e){this.options=_.defaults(this.options||{},this.defaults,e),this.modal=null,this.rowViews={},this.collection=new s.Folder,this.listenTo(this.collection,"add",this.renderOne),this.listenTo(this.collection,"remove",this.removeOne),this.listenTo(this.collection,"sort",this.rePaint),this.listenTo(this.collection,"reset",this.rePaint),this.fetchFolder()},fetchFolder:function(e){var e=e||{};this.options.include_deleted=e.include_deleted;var t=this;this.folderContainer=new s.FolderContainer({id:this.options.id}),this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents",this.options.include_deleted&&(this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"),this.folderContainer.fetch({success:function(e){t.folder_container=e,t.render()},error:function(e,t){void 0!==t.responseJSON?i.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):i.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},render:function(e){this.options=_.extend(this.options,e);var t=this.templateFolder();$(".tooltip").hide();var s,o=this.folderContainer.attributes.metadata.full_path;if(s=1===o.length?0:o[o.length-2][0],this.$el.html(t({path:this.folderContainer.attributes.metadata.full_path,parent_library_id:this.folderContainer.attributes.metadata.parent_library_id,id:this.options.id,upper_folder_id:s,order:this.sort})),this.options.dataset_id){var r=_.findWhere(that.rowViews,{id:this.options.dataset_id});r?r.showDatasetDetails():i.error("Requested dataset not found. Showing folder instead.")}else(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.paginate();$("#center [data-toggle]").tooltip(),$("#center").css("overflow","auto")},paginate:function(e){this.options=_.extend(this.options,e),(null===this.options.show_page||this.options.show_page<1)&&(this.options.show_page=1),this.options.total_items_count=this.folder_container.get("folder").models.length,this.options.page_count=Math.ceil(this.options.total_items_count/Galaxy.libraries.preferences.get("folder_page_size"));var t=Galaxy.libraries.preferences.get("folder_page_size")*(this.options.show_page-1),i=null;i=this.folder_container.get("folder").models.slice(t,t+Galaxy.libraries.preferences.get("folder_page_size")),this.options.items_shown=i.length,Galaxy.libraries.preferences.get("folder_page_size")*this.options.show_page>this.options.total_items_count+Galaxy.libraries.preferences.get("folder_page_size")&&(i=[]),Galaxy.libraries.folderToolbarView.renderPaginator(this.options),this.collection.reset(i)},rePaint:function(e){this.options=_.extend(this.options,e),this.removeAllRows(),this.renderAll(),this.checkEmptiness()},addAll:function(e){_.each(e,function(e){Galaxy.libraries.folderListView.collection.add(e,{sort:!1})}),$("#center [data-toggle]").tooltip(),this.checkEmptiness(),this.postRender()},postRender:function(){var e=this.folderContainer.attributes.metadata;e.contains_file_or_folder=void 0!==this.collection.findWhere({type:"file"})||void 0!==this.collection.findWhere({type:"folder"}),Galaxy.libraries.folderToolbarView.configureElements(e)},renderAll:function(){var e=this;_.each(this.collection.models.reverse(),function(t){e.renderOne(t)}),this.postRender()},renderOne:function(e){this.options.contains_file_or_folder=!0,e.set("folder_id",this.id);var t=new o.FolderRowView({model:e});this.rowViews[e.get("id")]=t,this.$el.find("#first_folder_item").after(t.el)},removeOne:function(e){this.$el.find("tr").filter(function(){return $(this).data("id")&&$(this).data("id")===e.id}).remove()},removeAllRows:function(){$(".library-row").remove()},checkEmptiness:function(){0===this.$el.find(".dataset_row").length&&0===this.$el.find(".folder_row").length?this.$el.find(".empty-folder-message").show():this.$el.find(".empty-folder-message").hide()},sortColumnClicked:function(e){e.preventDefault(),"asc"===this.sort?(this.sortFolder("name","desc"),this.sort="desc"):(this.sortFolder("name","asc"),this.sort="asc"),this.renderSortIcon()},sortFolder:function(e,t){if("undefined"===e&&"undefined"===t)return this.collection.sortByNameAsc();if("name"===e){if("asc"===t)return this.collection.sortByNameAsc();if("desc"===t)return this.collection.sortByNameDesc()}},selectAll:function(e){var t=e.target.checked;that=this,$(":checkbox","#folder_list_body").each(function(){this.checked=t;var e=$(this).closest("tr");t?that.makeDarkRow(e):that.makeWhiteRow(e)})},selectClickedRow:function(e){var t,i,s="";t=$(e.target).closest("tr"),"input"===e.target.localName?(s=e.target,i="input"):"td"===e.target.localName&&(s=t.find(":checkbox")[0],i="td"),s.checked?"td"===i?(s.checked="",this.makeWhiteRow(t)):"input"===i&&this.makeDarkRow(t):"td"===i?(s.checked="selected",this.makeDarkRow(t)):"input"===i&&this.makeWhiteRow(t)},makeDarkRow:function(e){e.removeClass("light").addClass("dark"),e.find("a").removeClass("light").addClass("dark"),e.find(".fa-file-o").removeClass("fa-file-o").addClass("fa-file"),e.find(".fa-folder-o").removeClass("fa-folder-o").addClass("fa-folder")},makeWhiteRow:function(e){e.removeClass("dark").addClass("light"),e.find("a").removeClass("dark").addClass("light"),e.find(".fa-file").removeClass("fa-file").addClass("fa-file-o"),e.find(".fa-folder").removeClass("fa-folder").addClass("fa-folder-o")},renderSortIcon:function(){"asc"===this.sort?$(".sort-icon").removeClass("fa-sort-alpha-desc").addClass("fa-sort-alpha-asc"):$(".sort-icon").removeClass("fa-sort-alpha-asc").addClass("fa-sort-alpha-desc")},templateFolder:function(){return _.template(['','
',"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(""))}})}});
//# sourceMappingURL=../../../maps/mvc/library/library-folderlist-view.js.map
diff --git a/static/scripts/mvc/library/library-folderrow-view.js b/static/scripts/mvc/library/library-folderrow-view.js
index 8736c389c9a..bb466b796e8 100644
--- a/static/scripts/mvc/library/library-folderrow-view.js
+++ b/static/scripts/mvc/library/library-folderrow-view.js
@@ -1,2 +1,2 @@
-"use strict";define(["libs/toastr","mvc/library/library-model","mvc/library/library-dataset-view"],function(t,e,i){return{FolderRowView:Backbone.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:!0,save_folder_btn:!1,cancel_folder_btn:!1,permission_folder_btn:!0},edit_mode:!1},initialize:function(t){this.options=_.defaults(t||{},this.defaults),this.render(this.options)},render:function(t){this.options=_.extend(this.options,t);var e=this.options.model,i=null;return"folder"===e.get("type")||"LibraryFolder"===e.get("model_class")?(this.options.type="folder",this.prepareButtons(e),i=e.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===e.get("type")||"LibraryDatasetDatasetAssociation"===e.get("model_class")||"LibraryDataset"===e.get("model_class")?(this.options.type="file",i=e.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(e.get("type")||e.get("model_class"))),this.setElement(i({content_item:e,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(t){var e=this.options.visibility_config;!1===this.options.edit_mode?(e.save_folder_btn=!1,e.cancel_folder_btn=!1,!0===t.get("deleted")?(e.edit_folder_btn=!1,e.permission_folder_btn=!1):!1===t.get("deleted")&&(e.save_folder_btn=!1,e.cancel_folder_btn=!1,!0===t.get("can_modify")&&(e.edit_folder_btn=!0),!0===t.get("can_manage")&&(e.permission_folder_btn=!0))):!0===this.options.edit_mode&&(e.edit_folder_btn=!1,e.permission_folder_btn=!1,e.save_folder_btn=!0,e.cancel_folder_btn=!0),this.options.visibility_config=e},showDatasetDetails:function(){Galaxy.libraries.datasetView=new i.LibraryDatasetView({id:this.id})},undeleteDataset:function(i){$(".tooltip").hide();var o=this,a=$(i.target).closest("tr").data("id"),n=Galaxy.libraries.folderListView.collection.get(a);n.url=n.urlRoot+n.id+"?undelete=true",n.destroy({success:function(i,n){Galaxy.libraries.folderListView.collection.remove(a);var l=new e.Item(n);Galaxy.libraries.folderListView.collection.add(l),Galaxy.libraries.folderListView.collection.sortByNameAsc(),t.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var t=o.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+t+"/datasets/"+o.id}})},error:function(e,i){void 0!==i.responseJSON?t.error("Dataset was not undeleted. "+i.responseJSON.err_msg):t.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(i){$(".tooltip").hide();var o=$(i.target).closest("tr").data("id"),a=Galaxy.libraries.folderListView.collection.get(o);a.url=a.urlRoot+a.id+"?undelete=true",a.destroy({success:function(i,a){Galaxy.libraries.folderListView.collection.remove(o);var n=new e.FolderAsModel(a);Galaxy.libraries.folderListView.collection.add(n),Galaxy.libraries.folderListView.collection.sortByNameAsc(),t.success("Folder undeleted.")},error:function(e,i){void 0!==i.responseJSON?t.error("Folder was not undeleted. "+i.responseJSON.err_msg):t.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")),i=!1,o=this.$el.find(".input_folder_name").val();if(void 0!==o&&o!==e.get("name")){if(!(o.length>2))return void t.warning("Folder name has to be at least 3 characters long.");e.set("name",o),i=!0}var a=this.$el.find(".input_folder_description").val();if(void 0!==a&&a!==e.get("description")&&(e.set("description",a),i=!0),i){var n=this;e.save(null,{patch:!0,success:function(e){n.options.edit_mode=!1,n.repaint(e),t.success("Changes to folder saved.")},error:function(e,i){void 0!==i.responseJSON?t.error(i.responseJSON.err_msg):t.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),t.info("Nothing has changed.")},repaint:function(){$(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return _.template(['
"].join(""))}})}});
+"use strict";define(["libs/toastr","mvc/library/library-model","mvc/library/library-dataset-view"],function(t,e,i){return{FolderRowView:Backbone.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(t){this.options=_.defaults(t||{},this.defaults),this.render(this.options)},render:function(t){this.options=_.extend(this.options,t);var e=this.options.model,i=null;return"folder"===e.get("type")||"LibraryFolder"===e.get("model_class")?(this.options.type="folder",this.prepareButtons(e),i=e.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===e.get("type")||"LibraryDatasetDatasetAssociation"===e.get("model_class")||"LibraryDataset"===e.get("model_class")?(this.options.type="file",i=e.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(e.get("type")||e.get("model_class"))),this.setElement(i({content_item:e,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(t){var e=this.options.visibility_config;!1===this.options.edit_mode?(e.save_folder_btn=!1,e.cancel_folder_btn=!1,!0===t.get("deleted")?(e.edit_folder_btn=!1,e.permission_folder_btn=!1):!1===t.get("deleted")&&(e.save_folder_btn=!1,e.cancel_folder_btn=!1,!0===t.get("can_modify")&&(e.edit_folder_btn=!0),!0===t.get("can_manage")&&(e.permission_folder_btn=!0))):!0===this.options.edit_mode&&(e.edit_folder_btn=!1,e.permission_folder_btn=!1,e.save_folder_btn=!0,e.cancel_folder_btn=!0),this.options.visibility_config=e},showDatasetDetails:function(){Galaxy.libraries.datasetView=new i.LibraryDatasetView({id:this.id})},undeleteDataset:function(i){$(".tooltip").hide();var o=this,a=$(i.target).closest("tr").data("id"),n=Galaxy.libraries.folderListView.collection.get(a);n.url=n.urlRoot+n.id+"?undelete=true",n.destroy({success:function(i,n){Galaxy.libraries.folderListView.collection.remove(a);var l=new e.Item(n);Galaxy.libraries.folderListView.collection.add(l),Galaxy.libraries.folderListView.collection.sortByNameAsc(),t.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var t=o.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+t+"/datasets/"+o.id}})},error:function(e,i){void 0!==i.responseJSON?t.error("Dataset was not undeleted. "+i.responseJSON.err_msg):t.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(i){$(".tooltip").hide();var o=$(i.target).closest("tr").data("id"),a=Galaxy.libraries.folderListView.collection.get(o);a.url=a.urlRoot+a.id+"?undelete=true",a.destroy({success:function(i,a){Galaxy.libraries.folderListView.collection.remove(o);var n=new e.FolderAsModel(a);Galaxy.libraries.folderListView.collection.add(n),Galaxy.libraries.folderListView.collection.sortByNameAsc(),t.success("Folder undeleted.")},error:function(e,i){void 0!==i.responseJSON?t.error("Folder was not undeleted. "+i.responseJSON.err_msg):t.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")),i=!1,o=this.$el.find(".input_folder_name").val();if(void 0!==o&&o!==e.get("name")){if(!(o.length>2))return void t.warning("Folder name has to be at least 3 characters long.");e.set("name",o),i=!0}var a=this.$el.find(".input_folder_description").val();if(void 0!==a&&a!==e.get("description")&&(e.set("description",a),i=!0),i){var n=this;e.save(null,{patch:!0,success:function(e){n.options.edit_mode=!1,n.repaint(e),t.success("Changes to folder saved.")},error:function(e,i){void 0!==i.responseJSON?t.error(i.responseJSON.err_msg):t.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),t.info("Nothing has changed.")},repaint:function(){$(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return _.template(['
"].join(""))}})}});
//# sourceMappingURL=../../../maps/mvc/library/library-folderrow-view.js.map
diff --git a/static/scripts/mvc/library/library-foldertoolbar-view.js b/static/scripts/mvc/library/library-foldertoolbar-view.js
index f2e3887f72d..a97cc2078d2 100644
--- a/static/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/mvc/library/library-foldertoolbar-view.js
@@ -1,2 +1,2 @@
-"use strict";define(["layout/masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(e,t,i,o,s){return{FolderToolbarView: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}))},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,s=new o.FolderAsModel,a=Backbone.history.fragment.split("/");t=a.indexOf("page")>-1?a[a.length-3]:a[a.length-1],s.url=s.urlRoot+t,s.save(e,{success:function(e){Galaxy.modal.hide(),i.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?i.error(t.responseJSON.err_msg):i.error("An error occurred.")}})}else i.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)i.info("You must select some datasets first.");else{var e=this;this.histories=new o.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?i.error(t.responseJSON.err_msg):i.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,o){i.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var o=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=o;var s=$("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(o,s),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var i=[],s=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?s.push(e):i.push(e)});for(var a=[],l=i.length-1;l>=0;l--){var r=i[l];(d=new o.HistoryItem).url=d.urlRoot+e+"/contents",d.content=r,d.source="library",a.push(d)}for(l=s.length-1;l>=0;l--){var n=s[l],d=new o.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=n,d.source="library_folder",a.push(d)}this.initChainCallControl({length:a.length,action:"to_history",history_name:t}),jQuery.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(a,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=[],o=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?o.push(e):i.push(e)});var s=Galaxy.root+"api/libraries/datasets/download/"+t,a={ld_ids:i,folder_ids:o};this.processDownload(s,a,"get")},processDownload:function(e,t,o){if(e&&t){t="string"==typeof t?t:$.param(t);var s="";$.each(t.split("&"),function(){var e=this.split("=");s+=''}),$('").appendTo("body").submit().remove(),i.info("Your download will begin soon.")}else i.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new o.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?i.error(t.responseJSON.err_msg):i.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;t.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:o,to_posix_lines:s,source:"admin_path",file_type:l,tag_using_filenames:a,dbkey:r})}else i.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 o=$("#jstree_browser").jstree().get_selected(!0),s=_.filter(o,function(e){return 0==e.state.disabled}),a=this.modal.$el.find(".preserve-checkbox").is(":checked"),l=this.modal.$el.find(".link-checkbox").is(":checked"),r=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=s[0].type,m=[];if(s.length<1)i.info("Please select some items first.");else{this.modal.disableButton("Import");for(var u=s.length-1;u>=0;u--)void 0!==s[u].li_attr.full_path&&m.push(s[u].li_attr.full_path);if(this.initChainCallControl({length:m.length,action:"adding_datasets"}),"folder"===h){f=t.source+"_folder";this.chainCallImportingFolders({paths:m,preserve_dirs:a,link_data:l,space_to_tab:r,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:m,file_type:d,dbkey:c,link_data:l,space_to_tab:r,to_posix_lines:n,source:f,tag_using_filenames:p})}}},fetchAndDisplayHistoryContents:function(e){var t=this;new o.HistoryContents({id:e}).fetch({success:function(i){var o=t.templateHistoryContents();t.histories.get(e).set({contents:i}),t.modal.$el.find("#selected_history_content").html(o({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?i.error(t.responseJSON.err_msg):i.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],s=[],a=[];if(e.length<1)i.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 i=$(this).closest("li").data("name");t.push(e),s.push(i)}});for(var l=t.length-1;l>=0;l--){var r=t[l],n=new o.Item;n.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===s[l]?n.set({from_hdca_id:r}):n.set({from_hda_id:r}),a.push(n)}this.initChainCallControl({length:a.length,action:"adding_datasets"}),this.chainCallAddingHdas(a)}},chainCallImportingIntoHistory:function(e,t){var o=this,s=e.pop();if(void 0===s)return 0===this.options.chain_call_control.failed_number?i.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?i.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;n--){var d=new o.Item({id:e[n]});r.push(d)}for(n=t.length-1;n>=0;n--){var c=new o.FolderAsModel({id:t[n]});r.push(c)}this.options.chain_call_control.total_number=l,this.chainCallDeletingItems(r)}},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 o.Library({id:this.options.parent_library_id})).fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?i.error(t.responseJSON.err_msg):i.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(),i.error("Invalid import source.")}},showPageSizePrompt:function(){var e=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=e&&e==parseInt(e)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(e)}),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","","
",'',"Select all","",'',"Unselect all","","",'
',"
","","
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:
",""," showing ",'',"<%- items_shown %>",""," of <%- total_items_count %> items",""].join(""))}})}});
+"use strict";define(["layout/masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(e,t,i,o,s){return{FolderToolbarView: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,s=new o.FolderAsModel,a=Backbone.history.fragment.split("/");t=a.indexOf("page")>-1?a[a.length-3]:a[a.length-1],s.url=s.urlRoot+t,s.save(e,{success:function(e){Galaxy.modal.hide(),i.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?i.error(t.responseJSON.err_msg):i.error("An error occurred.")}})}else i.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)i.info("You must select some datasets first.");else{var e=this;this.histories=new o.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?i.error(t.responseJSON.err_msg):i.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,o){i.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var o=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=o;var s=$("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(o,s),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var i=[],s=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?s.push(e):i.push(e)});for(var a=[],l=i.length-1;l>=0;l--){var r=i[l];(d=new o.HistoryItem).url=d.urlRoot+e+"/contents",d.content=r,d.source="library",a.push(d)}for(l=s.length-1;l>=0;l--){var n=s[l],d=new o.HistoryItem;d.url=d.urlRoot+e+"/contents",d.content=n,d.source="library_folder",a.push(d)}this.initChainCallControl({length:a.length,action:"to_history",history_name:t}),jQuery.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(a,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=[],o=[];this.findCheckedRows().each(function(){var e=$(this).closest("tr").data("id");"F"==e.substring(0,1)?o.push(e):i.push(e)});var s=Galaxy.root+"api/libraries/datasets/download/"+t,a={ld_ids:i,folder_ids:o};this.processDownload(s,a,"get")},processDownload:function(e,t,o){if(e&&t){t="string"==typeof t?t:$.param(t);var s="";$.each(t.split("&"),function(){var e=this.split("=");s+=''}),$('").appendTo("body").submit().remove(),i.info("Your download will begin soon.")}else i.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new o.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?i.error(t.responseJSON.err_msg):i.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;t.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:o,to_posix_lines:s,source:"admin_path",file_type:l,tag_using_filenames:a,dbkey:r})}else i.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 o=$("#jstree_browser").jstree().get_selected(!0),s=_.filter(o,function(e){return 0==e.state.disabled}),a=this.modal.$el.find(".preserve-checkbox").is(":checked"),l=this.modal.$el.find(".link-checkbox").is(":checked"),r=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=s[0].type,m=[];if(s.length<1)i.info("Please select some items first.");else{this.modal.disableButton("Import");for(var u=s.length-1;u>=0;u--)void 0!==s[u].li_attr.full_path&&m.push(s[u].li_attr.full_path);if(this.initChainCallControl({length:m.length,action:"adding_datasets"}),"folder"===h){f=t.source+"_folder";this.chainCallImportingFolders({paths:m,preserve_dirs:a,link_data:l,space_to_tab:r,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:m,file_type:d,dbkey:c,link_data:l,space_to_tab:r,to_posix_lines:n,source:f,tag_using_filenames:p})}}},fetchAndDisplayHistoryContents:function(e){var t=this;new o.HistoryContents({id:e}).fetch({success:function(i){var o=t.templateHistoryContents();t.histories.get(e).set({contents:i}),t.modal.$el.find("#selected_history_content").html(o({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?i.error(t.responseJSON.err_msg):i.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],s=[],a=[];if(e.length<1)i.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 i=$(this).closest("li").data("name");t.push(e),s.push(i)}});for(var l=t.length-1;l>=0;l--){var r=t[l],n=new o.Item;n.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===s[l]?n.set({from_hdca_id:r}):n.set({from_hda_id:r}),a.push(n)}this.initChainCallControl({length:a.length,action:"adding_datasets"}),this.chainCallAddingHdas(a)}},chainCallImportingIntoHistory:function(e,t){var o=this,s=e.pop();if(void 0===s)return 0===this.options.chain_call_control.failed_number?i.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?i.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;n--){var d=new o.Item({id:e[n]});r.push(d)}for(n=t.length-1;n>=0;n--){var c=new o.FolderAsModel({id:t[n]});r.push(c)}this.options.chain_call_control.total_number=l,this.chainCallDeletingItems(r)}},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 o.Library({id:this.options.parent_library_id})).fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?i.error(t.responseJSON.err_msg):i.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(),i.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","","
",'',"Select all","",'',"Unselect all","","",'
',"
","","
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(""))}})}});
//# sourceMappingURL=../../../maps/mvc/library/library-foldertoolbar-view.js.map
diff --git a/static/scripts/mvc/library/library-libraryrow-view.js b/static/scripts/mvc/library/library-libraryrow-view.js
index 06a0d1166f7..bc8878bc622 100644
--- a/static/scripts/mvc/library/library-libraryrow-view.js
+++ b/static/scripts/mvc/library/library-libraryrow-view.js
@@ -1,2 +1,2 @@
-"use strict";define(["layout/masthead","utils/utils","libs/toastr"],function(t,e,i){return{LibraryRowView:Backbone.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:!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(t){this.render(t)},render:function(t){void 0===t&&(t=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(t);var e=this.templateRow();return this.setElement(e({library:t,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(t){$(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(t){var e=this.element_visibility_config;!1===this.edit_mode?(e.save_library_btn=!1,e.cancel_library_btn=!1,e.delete_library_btn=!1,!0===t.get("deleted")?(e.undelete_library_btn=!0,e.upload_library_btn=!1,e.edit_library_btn=!1,e.permission_library_btn=!1):!1===t.get("deleted")&&(e.save_library_btn=!1,e.cancel_library_btn=!1,e.undelete_library_btn=!1,!0===t.get("can_user_add")&&(e.upload_library_btn=!0),!0===t.get("can_user_modify")&&(e.edit_library_btn=!0),!0===t.get("can_user_manage")&&(e.permission_library_btn=!0))):!0===this.edit_mode&&(e.upload_library_btn=!1,e.edit_library_btn=!1,e.permission_library_btn=!1,e.save_library_btn=!0,e.cancel_library_btn=!0,e.delete_library_btn=!0,e.undelete_library_btn=!1),this.element_visibility_config=e},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 t=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),e=!1,r=this.$el.find(".input_library_name").val();if(void 0!==r&&r!==t.get("name")){if(!(r.length>2))return void i.warning("Library name has to be at least 3 characters long.");t.set("name",r),e=!0}var a=this.$el.find(".input_library_description").val();void 0!==a&&a!==t.get("description")&&(t.set("description",a),e=!0);var l=this.$el.find(".input_library_synopsis").val();if(void 0!==l&&l!==t.get("synopsis")&&(t.set("synopsis",l),e=!0),e){var n=this;t.save(null,{patch:!0,success:function(t){n.edit_mode=!1,n.repaint(t),i.success("Changes to library saved.")},error:function(t,e){void 0!==e.responseJSON?i.error(e.responseJSON.err_msg):i.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(t),i.info("Nothing has changed.")},delete_library:function(){var t=this;Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")).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")?($(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),i.success("Library has been marked deleted.")},error:function(t,e){void 0!==e.responseJSON?i.error(e.responseJSON.err_msg):i.error("An error occured during deleting the library.")}})},undelete_library:function(){var t=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),e=this;t.url=t.urlRoot+t.id+"?undelete=true",t.destroy({success:function(t){t.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(t),e.edit_mode=!1,e.repaint(t),i.success("Library has been undeleted.")},error:function(t,e){void 0!==e.responseJSON?i.error(e.responseJSON.err_msg):i.error("An error occured while undeleting the library.")}})},templateRow:function(){return _.template(['
"].join(""))}})}});
+"use strict";define(["layout/masthead","utils/utils","libs/toastr"],function(t,e,i){return{LibraryRowView:Backbone.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:!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(t){this.render(t)},render:function(t){void 0===t&&(t=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(t);var e=this.templateRow();return this.setElement(e({library:t,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(t){$(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(t){var e=this.element_visibility_config;!1===this.edit_mode?(e.save_library_btn=!1,e.cancel_library_btn=!1,e.delete_library_btn=!1,!0===t.get("deleted")?(e.undelete_library_btn=!0,e.upload_library_btn=!1,e.edit_library_btn=!1,e.permission_library_btn=!1):!1===t.get("deleted")&&(e.save_library_btn=!1,e.cancel_library_btn=!1,e.undelete_library_btn=!1,!0===t.get("can_user_add")&&(e.upload_library_btn=!0),!0===t.get("can_user_modify")&&(e.edit_library_btn=!0),!0===t.get("can_user_manage")&&(e.permission_library_btn=!0))):!0===this.edit_mode&&(e.upload_library_btn=!1,e.edit_library_btn=!1,e.permission_library_btn=!1,e.save_library_btn=!0,e.cancel_library_btn=!0,e.delete_library_btn=!0,e.undelete_library_btn=!1),this.element_visibility_config=e},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 t=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),e=!1,r=this.$el.find(".input_library_name").val();if(void 0!==r&&r!==t.get("name")){if(!(r.length>2))return void i.warning("Library name has to be at least 3 characters long.");t.set("name",r),e=!0}var a=this.$el.find(".input_library_description").val();void 0!==a&&a!==t.get("description")&&(t.set("description",a),e=!0);var l=this.$el.find(".input_library_synopsis").val();if(void 0!==l&&l!==t.get("synopsis")&&(t.set("synopsis",l),e=!0),e){var n=this;t.save(null,{patch:!0,success:function(t){n.edit_mode=!1,n.repaint(t),i.success("Changes to library saved.")},error:function(t,e){void 0!==e.responseJSON?i.error(e.responseJSON.err_msg):i.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(t),i.info("Nothing has changed.")},delete_library:function(){var t=this;Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")).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")?($(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),i.success("Library has been marked deleted.")},error:function(t,e){void 0!==e.responseJSON?i.error(e.responseJSON.err_msg):i.error("An error occured during deleting the library.")}})},undelete_library:function(){var t=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),e=this;t.url=t.urlRoot+t.id+"?undelete=true",t.destroy({success:function(t){t.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(t),e.edit_mode=!1,e.repaint(t),i.success("Library has been undeleted.")},error:function(t,e){void 0!==e.responseJSON?i.error(e.responseJSON.err_msg):i.error("An error occured while undeleting the library.")}})},templateRow:function(){return _.template(['
"].join(""))}})}});
+"use strict";define(["libs/toastr","mvc/library/library-model"],function(e,a){return{LibraryToolbarView:Backbone.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=_.defaults(this.options||{},e,this.defaults),this.render()},render:function(){var e=this.templateToolBar(),a=!1,i=!0;Galaxy.user&&(a=Galaxy.user.isAdmin(),i=Galaxy.user.isAnonymous()),this.$el.html(e({admin_user:a,anon_user:i})),a&&(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=_.extend(this.options,e);var a=this.templatePaginator();this.$el.find("#library_paginator").html(a({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 a=this;this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){a.createNewLibrary()},Close:function(){a.modal.hide()}}})},createNewLibrary:function(){var i=this.serializeNewLibrary();if(this.validateNewLibrary(i)){var r=this;(new a.Library).save(i,{success:function(a){Galaxy.libraries.libraryListView.collection.add(a),r.modal.hide(),r.clearLibraryModal(),Galaxy.libraries.libraryListView.render(),e.success("Library created.")},error:function(a,i){void 0!==i.responseJSON?e.error(i.responseJSON.err_msg):e.error("An error occured.")}})}else e.error("Library's name is missing.");return!1},showPageSizePrompt:function(e){e.preventDefault();var a=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));null!=a&&a==parseInt(a)&&(Galaxy.libraries.preferences.set({library_page_size:parseInt(a)}),Galaxy.libraries.libraryListView.render({show_page:1}))},clearLibraryModal:function(){$("input[name='Name']").val(""),$("input[name='Description']").val(""),$("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("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 a=$(".library-search-input").val();this.options.search_term=a,Galaxy.libraries.libraryListView.searchLibraries(a)},templateToolBar:function(){return _.template(['