diff --git a/client/galaxy/scripts/apps/history-panel.js b/client/galaxy/scripts/apps/history-panel.js index c0b4611bb8c..7dcf94758d4 100644 --- a/client/galaxy/scripts/apps/history-panel.js +++ b/client/galaxy/scripts/apps/history-panel.js @@ -1,6 +1,6 @@ var RightPanel = require( 'layout/panel' ).RightPanel, Ui = require( 'mvc/ui/ui-misc' ), - historyOptionsMenu = require( 'mvc/history/options-menu' ); + historyOptionsMenu = require( 'mvc/history/options-menu' ), CurrentHistoryView = require( 'mvc/history/history-view-edit-current' ).CurrentHistoryView, _l = require( 'utils/localization' ); diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index 47956b385c5..6098c028a66 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -1,4 +1,4 @@ webpackJsonp([2,1],[,,,,,,function(e,t,i){"use strict";(function(n,s,o){var a,r;a=[i(4),i(41),i(94),i(40),i(90),i(17),i(8)],void 0!==(r=function(e,t,i,a,r,l,c){var d=n.View.extend({tagName:"label",initialize:function(e){this.model=e&&e.model||new n.Model(e),this.tagName=e.tagName||this.tagName,this.setElement(s("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},title:function(e){this.model.set("title",e)},value:function(){return this.model.get("title")},render:function(){return this.$el.removeClass().addClass("ui-label").addClass(this.model.get("cls")).html(this.model.get("title")),this}}),h=n.View.extend({initialize:function(e){this.model=e&&e.model||new n.Model({message:null,status:"info",cls:"",persistent:!1,fade:!0}).set(e),this.listenTo(this.model,"change",this.render,this),this.render()},update:function(e){this.model.set(e)},render:function(){this.$el.removeClass().addClass("ui-message").addClass(this.model.get("cls"));var e=this.model.get("status");if(this.model.get("large")?this.$el.addClass(("success"==e&&"done"||"danger"==e&&"error"||e)+"messagelarge"):this.$el.addClass("alert").addClass("alert-"+e),this.model.get("message")){if(this.$el.html(this.messageForDisplay()),this.$el[this.model.get("fade")?"fadeIn":"show"](),this.timeout&&window.clearTimeout(this.timeout),!this.model.get("persistent")){var t=this;this.timeout=window.setTimeout(function(){t.model.set("message","")},3e3)}}else this.$el.fadeOut();return this},messageForDisplay:function(){return o.escape(this.model.get("message"))}}),u=h.extend({messageForDisplay:function(){return this.model.get("message")}}),p=n.View.extend({initialize:function(e){this.model=e&&e.model||new n.Model({type:"text",placeholder:"",disabled:!1,readonly:!1,visible:!0,cls:"",area:!1,color:null,style:null}).set(e),this.tagName=this.model.get("area")?"textarea":"input",this.setElement(s("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},events:{input:"_onchange"},value:function(e){return void 0!==e&&this.model.set("value","string"==typeof e?e:""),this.model.get("value")},render:function(){var e=this;this.$el.removeClass().addClass("ui-"+this.tagName).addClass(this.model.get("cls")).addClass(this.model.get("style")).attr("id",this.model.id).attr("type",this.model.get("type")).attr("placeholder",this.model.get("placeholder")).css("color",this.model.get("color")||"").css("border-color",this.model.get("color")||"");var t=this.model.get("datalist");return s.isArray(t)&&t.length>0&&this.$el.autocomplete({source:function(t,i){i(e.model.get("datalist"))},change:function(){e._onchange()}}),this.model.get("value")!==this.$el.val()&&this.$el.val(this.model.get("value")),o.each(["readonly","disabled"],function(t){e.model.get(t)?e.$el.attr(t,!0):e.$el.removeAttr(t)}),this.$el[this.model.get("visible")?"show":"hide"](),this},_onchange:function(){this.value(this.$el.val()),this.model.get("onchange")&&this.model.get("onchange")(this.model.get("value"))}}),g=n.View.extend({initialize:function(e){this.model=e&&e.model||new n.Model(e),this.setElement(s("
").append(this.$info=s("")).append(this.$hidden=s(""))),this.listenTo(this.model,"change",this.render,this),this.render()},value:function(e){return void 0!==e&&this.model.set("value",e),this.model.get("value")},render:function(){return this.$el.attr("id",this.model.id),this.$hidden.val(this.model.get("value")),this.model.get("info")?this.$info.show().html(this.model.get("info")):this.$info.hide(),this}});return{Button:l.ButtonDefault,ButtonIcon:l.ButtonIcon,ButtonCheck:l.ButtonCheck,ButtonMenu:l.ButtonMenu,ButtonLink:l.ButtonLink,Input:p,Label:d,Message:h,UnescapedMessage:u,Modal:c,RadioButton:a.RadioButton,Checkbox:a.Checkbox,Radio:a.Radio,Select:t,Hidden:g,Slider:i,Drilldown:r}}.apply(t,a))&&(e.exports=r)}).call(t,i(2),i(0),i(1))},,,function(e,t,i){"use strict";var n,s;n=[],void 0!==(s=function(){var e={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};return e.READY_STATES=[e.OK,e.EMPTY,e.PAUSED,e.FAILED_METADATA,e.NOT_VIEWABLE,e.DISCARDED,e.ERROR],e.NOT_READY_STATES=[e.UPLOAD,e.QUEUED,e.RUNNING,e.SETTING_METADATA,e.NEW],e}.apply(t,n))&&(e.exports=s)},function(e,t,i){"use strict";(function(n,s,o){var a,r;a=[i(4)],void 0!==(r=function(e){return{View:n.View.extend({optionsDefault:{with_close:!0,title:null,placement:"top",container:"body",body:null},initialize:function(t){this.setElement(this._template()),this.uid=e.uid(),this.options=s.defaults(t||{},this.optionsDefault),this.options.container.parent().append(this.el),this.$title=this.$(".popover-title-label"),this.$close=this.$(".popover-close"),this.$body=this.$(".popover-content"),this.options.body&&this.append(this.options.body);var i=this;o("body").on("mousedown."+this.uid,function(e){i.visible&&!o(i.options.container).is(e.target)&&!o(i.el).is(e.target)&&0===o(i.el).has(e.target).length&&i.hide()})},render:function(){this.$title.html(this.options.title),this.$el.removeClass().addClass("ui-popover popover fade in").addClass(this.options.placement),this.$el.css(this._get_placement(this.options.placement));var e=this;this.options.with_close?this.$close.on("click",function(){e.hide()}).show():this.$close.off().hide()},title:function(e){void 0!==e&&(this.options.title=e,this.$title.html(e))},show:function(){this.render(),this.$el.show(),this.visible=!0},hide:function(){this.$el.hide(),this.visible=!1},append:function(e){this.$body.append(e)},empty:function(){this.$body.empty()},remove:function(){o("body").off("mousedown."+this.uid),this.$el.remove()},_get_placement:function(e){var t=this._get_width(this.$el),i=this.$el.height(),n=this.options.container,s=this._get_width(n),o=this._get_height(n),a=n.position(),r=left=0;if(-1!=["top","bottom"].indexOf(e))switch(left=a.left-t+(s+t)/2,e){case"top":r=a.top-i-5;break;case"bottom":r=a.top+o+5}else switch(r=a.top-i+(o+i)/2,e){case"right":left=a.left+s}return{top:r,left:left}},_get_width:function(e){return e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("margin-left"))+parseInt(e.css("padding-right"))+parseInt(e.css("margin-right"))},_get_height:function(e){return e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"))},_template:function(e){return'"+JSON.stringify(i.responseJSON)+"":content+=": "+n}t._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","change .hide-originals":"_changeHideOriginals","click .cancel-create":"_cancelCreate","click .create-collection":"_clickCreate"},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=o('');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=e.offset(),n=e.scrollTop(),s=t-i.top,o=i.top+e.outerHeight()-t;s>=0&&s
",d(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"
","",d(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join("")),invalidElements:s.template([d("The following selections could not be included due to problems:"),"<%= dataset.peek %>',"<% } %>","<% } %>","
| Name | Size | Created |
|---|
h)return 1}return 0}return e}.apply(t,n))&&(e.exports=s)},,,,,function(e,t,i){"use strict";(function(t){var n=i(7).RightPanel,s=(i(6),i(114));CurrentHistoryView=i(111).CurrentHistoryView,_l=i(3);var o=n.extend({title:_l("History"),initialize:function(e){n.prototype.initialize.call(this,e),this.options=t.pick(e,"userIsAnonymous","allow_user_dataset_purge","galaxyRoot"),this.historyView=new CurrentHistoryView({className:CurrentHistoryView.prototype.className+" middle",purgeAllowed:e.allow_user_dataset_purge,linkTarget:"galaxy_main"})},$toggleButton:function(){return this.$(".footer > .panel-collapse")},render:function(){n.prototype.render.call(this),this.optionsMenu=s(this.$("#history-options-button"),{anonymous:this.options.userIsAnonymous,purgeAllowed:this.options.allow_user_dataset_purge,root:this.options.galaxyRoot}),this.$("> .header .buttons [title]").tooltip({placement:"bottom"}),this.historyView.setElement(this.$(".history-panel")),this.$el.attr("class","history-right-panel")},_templateHeader:function(e){var i=this.options.galaxyRoot+"history",n=this.options.galaxyRoot+"history/view_multiple";return['
"].join("")},_templateBody:function(e){return[''].join("")},_templateFooter:function(e){return['You are using '+e.nice_total_disk_usage+" of disk space in this Galaxy instance. "+(Galaxy.config.enable_quotas?"Your disk quota is: "+e.quota+". ":"")+'Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.
'}}),Forms:n.View.extend({initialize:function(e){this.model=new i(e),this.page=this.model.get(e.form_id),this.setElement(""),this.render()},render:function(){var i=this;s.ajax({url:Galaxy.root+this.page.url,type:"GET"}).done(function(n){var o=s.extend({},i.page,n),a=new e({title:o.title,icon:o.icon,inputs:o.inputs,operations:{submit:new t.ButtonIcon({tooltip:o.submit_tooltip,title:o.submit_title||"Save settings",icon:o.submit_icon||"fa-save",onclick:function(){i._submit(a,o)}})}});i.$el.empty().append(a.$el)}).fail(function(e){i.$el.empty().append(new t.Message({message:"Failed to load resource "+i.page.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e,t){s.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(t){var i=!1;e.data.matchModel(t,function(t,n){e.field_list[n].value(t.value),i=!0}),e.message.update({message:t.message,status:"success"})}).fail(function(t){window.console.log(t),e.message.update({message:t.responseJSON.err_msg,status:"danger"})})}})}}.apply(t,a))&&(e.exports=r)}).call(t,i(2),i(0),i(1))},,,function(e,t,i){"use strict";(function(i,n,s){var o,a;o=[],void 0!==(a=function(){var e=i.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:!0,id:null,href:null,target:null,enabled:!0,visible:!0,tooltip_config:{}}}),t=i.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"},this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var e=this.template(this.model.toJSON());return e.tooltip(this.model.get("tooltip_config")),this.$el.replaceWith(e),this.setElement(e),this},events:{click:"click"},click:function(e){return!n.isFunction(this.model.get("on_click"))||(this.model.get("on_click")(e),!1)},template:function(e){var t='title="'+e.title+'" class="icon-button';return e.is_menu_button&&(t+=" menu-button"),t+=" "+e.icon_class,e.enabled||(t+="_disabled"),t+='"',e.id&&(t+=' id="'+e.id+'"'),t+=' href="'+e.href+'"',e.target&&(t+=' target="'+e.target+'"'),e.visible||(t+=' style="display: none;"'),t=e.enabled?"":"",s(t)}}),o=i.Collection.extend({model:e}),a=i.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var e=this;return this.collection.each(function(t){var i=s("").attr("href","javascript:void(0)").attr("title",t.attributes.title).addClass("icon-button menu-button").addClass(t.attributes.icon_class).appendTo(e.$el).click(t.attributes.on_click);t.attributes.tooltip_config&&i.tooltip(t.attributes.tooltip_config);var n=t.get("options");n&&make_popupmenu(i,n)}),this}});return{IconButton:e,IconButtonView:t,IconButtonCollection:o,IconButtonMenuView:a,create_icon_buttons_menu:function(t,i){i||(i={});var s=new o(n.map(t,function(t){return new e(n.extend(t,i))}));return new a({collection:s})}}}.apply(t,o))&&(e.exports=a)}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";(function(n,s){var o;void 0!==(o=function(){function e(e){e+="";for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}return{commatize:e,is_deferred:function(e){return"promise"in e},ServerStateDeferred:n.Model.extend({defaults:{ajax_settings:{},interval:1e3,success_fn:function(e){return!0}},go:function(){var e=s.Deferred(),t=this,i=t.get("ajax_settings"),n=t.get("success_fn"),o=t.get("interval");return function t(){s.ajax(i).success(function(i){n(i)?e.resolve(i):setTimeout(t,o)})}(),e}}),get_random_color:function(e){e||(e="#ffffff"),"string"==typeof e&&(e=[e]);for(var t=0;t"+this.formattedReference()+"
"),this},formattedReference:function(){var e=this.model,t=e.entryType(),i=e.fields(),n="",s=this._asSentence((i.author?i.author:"")+(i.year?" ("+i.year+")":""))+" ",o=i.title||"",a=i.pages?"pp. "+i.pages:"",r=i.address;if("article"==t){var l=(i.volume?i.volume:"")+(i.number?" ("+i.number+")":"")+(a?", "+a:"");n=s+this._asSentence(o)+(i.journal?"In "+i.journal+", ":"")+this._asSentence(l)+this._asSentence(i.address)+""}else n="inproceedings"==t||"proceedings"==t?s+this._asSentence(o)+(i.booktitle?"In "+i.booktitle+", ":"")+(a||"")+(r?", "+r:"")+".":"mastersthesis"==t||"phdthesis"==t?s+this._asSentence(o)+(i.howpublished?i.howpublished+". ":"")+(i.note?i.note+".":""):"techreport"==t?s+this._asSentence(o)+this._asSentence(i.institution)+this._asSentence(i.number)+this._asSentence(i.type):"book"==t||"inbook"==t||"incollection"==t?s+" "+this._formatBookInfo(i):s+" "+this._asSentence(o)+this._asSentence(i.howpublished)+this._asSentence(i.note);var c="";i.doi&&(c="http://dx.doi.org/"+i.doi,n+='[doi:'+i.doi+"]");var d=i.url||c;return d&&(n+='[Link]'),n},_formatBookInfo:function(e){var t="";return e.chapter&&(t+=e.chapter+" in "),e.title&&(t+=""+e.title+""),e.editor&&(t+=", Edited by "+e.editor+", "),e.publisher&&(t+=", "+e.publisher),e.pages&&(t+=", pp. "+e.pages),e.series&&(t+=", "+e.series+""),e.volume&&(t+=", Vol."+e.volume),e.issn&&(t+=", ISBN: "+e.issn),t+"."},_asSentence:function(e){return e&&e.trim()?e+". ":""}}),o=n.View.extend({el:"#citations",initialize:function(){this.listenTo(this.collection,"add",this.renderCitation)},events:{"click .citations-to-bibtex":"showBibtex","click .citations-to-formatted":"showFormatted"},renderCitation:function(e){var t=new s({model:e});this.$(".citations-formatted").append(t.render().el);var i=this.$(".citations-bibtex-text");i.val(i.val()+"\n\r"+e.attributes.content)},render:function(){this.$el.html(this.citationsElement()),this.collection.each(function(e){this.renderCitation(e)},this),this.showFormatted()},showBibtex:function(){this.$(".citations-to-formatted").show(),this.$(".citations-to-bibtex").hide(),this.$(".citations-bibtex").show(),this.$(".citations-formatted").hide(),this.$(".citations-bibtex-text").select()},showFormatted:function(){this.$(".citations-to-formatted").hide(),this.$(".citations-to-bibtex").show(),this.$(".citations-bibtex").hide(),this.$(".citations-formatted").show()},partialWarningElement:function(){return this.collection.partial?['"+JSON.stringify(e.responseJSON)+"":n+=": "+i),creator._showAlert(n,"alert-danger")},render:function(e,t){return this.$el.empty().html(this.templates.main()),this._renderHeader(e),this._renderMiddle(e),this._renderFooter(e),this._addPluginComponents(),this.trigger("rendered",this),this},_renderHeader:function(e,t){var i=this.$(".header").empty().html(this.templates.header()).find(".help-content").prepend(a(this.templates.helpContent()));return this._renderFilters(),i},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(e,t){var i=this.$(".middle").empty().html(this.templates.middle());return this.unpairedPanelHidden?this.$(".unpaired-columns").hide():this.pairedPanelHidden&&this.$(".paired-columns").hide(),this._renderUnpaired(),this._renderPaired(),i},_renderUnpaired:function(e,t){var i,n,s=this,o=[],a=this._splitByFilters();return this.$(".forward-column .title").text([a[0].length,l("unpaired forward")].join(" ")),this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-a[0].length)),this.$(".reverse-column .title").text([a[1].length,l("unpaired reverse")].join(" ")),this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-a[1].length)),this.$(".unpaired-columns .column-datasets").empty(),this.$(".autopair-link").toggle(0!==this.unpaired.length),0===this.unpaired.length?void this._renderUnpairedEmpty():(n=a[1].map(function(e,t){return void 0!==a[0][t]&&a[0][t]!==e&&o.push(s._renderPairButton()),s._renderUnpairedDataset(e)}),i=a[0].map(function(e){return s._renderUnpairedDataset(e)}),i.length||n.length?(this.$(".unpaired-columns .forward-column .column-datasets").append(i).add(this.$(".unpaired-columns .paired-column .column-datasets").append(o)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(n)),void this._adjUnpairedOnScrollbar()):void this._renderUnpairedNotShown())},_renderUnpairedDisplayStr:function(e){return["(",e," ",l("filtered out"),")"].join("")},_renderUnpairedDataset:function(e){return a("").attr("id","dataset-"+e.id).addClass("dataset unpaired").attr("draggable",!0).addClass(e.selected?"selected":"").append(a("").addClass("dataset-name").text(e.name)).data("dataset",e)},_renderPairButton:function(){return a("").addClass("dataset unpaired").append(a("").addClass("dataset-name").text(l("Pair these datasets")))},_renderUnpairedEmpty:function(){var e=a('').text("("+l("no remaining unpaired datasets")+")");return this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(e),e},_renderUnpairedNotShown:function(){var e=a('').text("("+l("no datasets were found matching the current filters")+")");return this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(e),e},_adjUnpairedOnScrollbar:function(){var e=this.$(".unpaired-columns").last(),t=this.$(".unpaired-columns .reverse-column .dataset").first();if(t.length){var i=e.offset().left+e.outerWidth(),n=t.offset().left+t.outerWidth(),s=Math.floor(i)-Math.floor(n);this.$(".unpaired-columns .forward-column").css("margin-left",s>0?s:0)}},_renderPaired:function(e,t){if(this.$(".paired-column-title .title").text([this.paired.length,l("paired")].join(" ")),this.$(".unpair-all-link").toggle(0!==this.paired.length),0===this.paired.length)return void this._renderPairedEmpty();this.$(".remove-extensions-link").show(),this.$(".paired-columns .column-datasets").empty();var i=this;this.paired.forEach(function(e,t){var n=new h({pair:e});i.$(".paired-columns .column-datasets").append(n.render().$el).append(['"].join(""))})},_renderPairedEmpty:function(){var e=a('').text("("+l("no paired datasets yet")+")");return this.$(".paired-columns .column-datasets").empty().prepend(e),e},footerSettings:{".hide-originals":"hideOriginals",".remove-extensions":"removeExtensions"},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link"),this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(e){function t(e,t){return['"].join("")}var i=a(s.template(['
",l(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"
","",l(['Unpaired datasets are shown in the unpaired section ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the paired section.',"
",l(["
",l(["To unpair individual dataset pairs, click the ",'unpair buttons ( ). ','Click the "Unpair all" link to unpair all pairs.'].join("")),"
","",l(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','"Remove file extensions from pair names?" control.'].join("")),"
","",l(['Once your collection is complete, enter a name and ','click "Create list". ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"
"].join(""))})}),p=function(e,t){var i,n=o.Deferred();if(t=s.defaults(t||{},{datasets:e,oncancel:function(){Galaxy.modal.hide(),n.reject("cancelled")},oncreate:function(e,t){Galaxy.modal.hide(),n.resolve(t)}}),!window.Galaxy||!Galaxy.modal)throw new Error("Galaxy or Galaxy.modal not found");return i=new u(t),Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:!0}),i.render(),window.creator=i,n};return{PairedCollectionCreator:u,pairedCollectionCreatorModal:p,createListOfPairsCollection:d}}.apply(t,r))&&(e.exports=l)}).call(t,i(2),i(1),i(0),i(0))},function(e,t,i){"use strict";(function(n,s,o){var a,r;a=[i(23),i(25),i(5),i(3)],void 0!==(r=function(e,t,i,a){function r(e,t){var i=e.toJSON();return h(i,{defaultHideSourceItems:t,creationFn:function(t,i,n){return t=[{name:"forward",src:"hda",id:t[0].id},{name:"reverse",src:"hda",id:t[1].id}],e.createHDCA(t,"paired",i,n)}})}var l=n.View.extend(i.LoggableMixin).extend({_logNamespace:"collections",tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.identifier=e.identifier},render:function(){return this.$el.attr("data-element-id",this.element.id).html(this.template({identifier:this.identifier,element:this.element})),this},template:s.template(['<%- identifier %>','<%- element.name %>'].join("")),destroy:function(){this.off(),this.$el.remove()},toString:function(){return"DatasetCollectionElementView()"}}),c=e.ListCollectionCreator,d=c.extend({elementViewClass:l,collectionClass:t.HistoryPairDatasetCollection,className:"pair-collection-creator collection-creator flex-row-container",_mangleDuplicateNames:function(){},render:function(e,t){return 2===this.workingElements.length?c.prototype.render.call(this,e,t):this._renderInvalid(e,t)},_renderList:function(e,t){var i=this,n=o(""),a=i.$list();s.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),n.append(i._createForwardElementView().$el),n.append(i._createReverseElementView().$el),a.empty().append(n.children()),s.invoke(i.elementViews,"render")},_createForwardElementView:function(){return this._createElementView(this.workingElements[0],{identifier:"forward"})},_createReverseElementView:function(){return this._createElementView(this.workingElements[1],{identifier:"reverse"})},_createElementView:function(e,t){var i=new this.elementViewClass(s.extend(t,{element:e}));return this.elementViews.push(i),i},swap:function(){this.workingElements=[this.workingElements[1],this.workingElements[0]],this._renderList()},events:s.extend(s.clone(c.prototype.events),{"click .swap":"swap"}),templates:s.extend(s.clone(c.prototype.templates),{middle:s.template(['",a(["Pair collections are permanent collections containing two datasets: one forward and one reverse. ","Often these are forward and reverse reads. The pair collections can be passed to tools and ","workflows in order to have analyses done on both datasets. This interface allows ","you to create a pair, name it, and swap which is forward and which reverse."].join("")),"
","",a(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join("")),invalidInitial:s.template([''+this.progressive+"...
";this.modal.$(".modal-body").empty().append(e).css({"margin-top":"8px"})},dialog:function(e,a,r){function l(){var i=e.$("#copy-modal-title").val();if(!i)return void e.$(".invalid-title").show();var n="copy-all"===e.$('input[name="copy-what"]:checked').val();e.$("button").prop("disabled",!0),c._showAjaxIndicator(),a.copy(!0,i,n).done(function(e){d.resolve(e)}).fail(function(e,s,o){var r={name:i,copyAllDatasets:n};t.ajaxErrorModal(a,e,r,c.errorMessage),d.rejectWith(d,arguments)}).done(function(){f&&e.hide()})}r=r||{};var c=this,d=s.Deferred(),h=r.nameFn||this.defaultName,u=h({name:a.get("name")}),p=r.allDatasets?"copy-all":"copy-non-deleted",g=!!n.isUndefined(r.allowAll)||r.allowAll,f=!!n.isUndefined(r.autoClose)||r.autoClose;this.modal=e;var m=r.closing_callback;return e.show(n.extend(r,{title:this.title({name:a.get("name")}),body:o(c._template({name:u,isAnon:Galaxy.user.isAnonymous(),allowAll:g,copyWhat:p,activeLabel:this.activeLabel,allLabel:this.allLabel,anonWarning:this.anonWarning})),buttons:n.object([[i("Cancel"),function(){e.hide()}],[this.submitLabel,l]]),height:"auto",closing_events:!0,closing_callback:function(e){e&&d.reject({cancelled:!0}),m&&m(e)}})),e.$("#copy-modal-title").focus().select(),e.$("#copy-modal-title").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),l())}),d}},r=n.extend({},a,{defaultName:n.template("imported: <%- name %>"),title:n.template(i("Importing history")+' "<%- name %>"'),submitLabel:i("Import"),errorMessage:i("History could not be imported."),progressive:i("Importing history"),activeLabel:i("Import only the active, non-deleted datasets"),allLabel:i("Import all datasets including deleted ones"),anonWarning:i("As an anonymous user, unless you login or register, you will lose your current history ")+i("after importing this history. ")});return function(t,i){i=i||{};var n=window.parent.Galaxy.modal||new e.View({});return i.useImport?r.dialog(n,t,i):a.dialog(n,t,i)}}.apply(t,a))&&(e.exports=r)}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(n,s){var o,a;o=[i(53),i(55),i(5),i(3)],void 0!==(a=function(e,t,i,o){var a=e.DatasetListItemEdit,r=a.extend({className:a.prototype.className+" history-content",_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):e.model.has("rerunnable")?n.when():e.model.fetch({silent:!0,data:{keys:["rerunnable","creating_job"].join(",")}})},events:s.extend(s.clone(a.prototype.events),{"click .unhide-link":function(e){return this.model.unhide(),!1}}),toString:function(){return"HDAListItemEdit("+(this.model?this.model+"":"(no model)")+")"}});return r.prototype.templates=function(){var e=s.extend({},a.prototype.templates.warnings,{hidden:i.wrapTemplate(["<% if( !dataset.visible ){ %>",'| Name | Size | Status |
|---|
| Description | Name | Size | Settings | Status |
|---|
| Name | Size | Type | Genome | Settings | Status |
|---|
h)return 1}return 0}return e}.apply(t,n))&&(e.exports=s)},,,,,function(e,t,i){"use strict";(function(t){var n=i(7).RightPanel,s=(i(6),i(114)),o=i(111).CurrentHistoryView,a=i(3),r=n.extend({title:a("History"),initialize:function(e){n.prototype.initialize.call(this,e),this.options=t.pick(e,"userIsAnonymous","allow_user_dataset_purge","galaxyRoot"),this.historyView=new o({className:o.prototype.className+" middle",purgeAllowed:e.allow_user_dataset_purge,linkTarget:"galaxy_main"})},$toggleButton:function(){return this.$(".footer > .panel-collapse")},render:function(){n.prototype.render.call(this),this.optionsMenu=s(this.$("#history-options-button"),{anonymous:this.options.userIsAnonymous,purgeAllowed:this.options.allow_user_dataset_purge,root:this.options.galaxyRoot}),this.$("> .header .buttons [title]").tooltip({placement:"bottom"}),this.historyView.setElement(this.$(".history-panel")),this.$el.attr("class","history-right-panel")},_templateHeader:function(e){var i=this.options.galaxyRoot+"history",n=this.options.galaxyRoot+"history/view_multiple";return['
"].join("")},_templateBody:function(e){return[''].join("")},_templateFooter:function(e){return['You are using '+e.nice_total_disk_usage+" of disk space in this Galaxy instance. "+(Galaxy.config.enable_quotas?"Your disk quota is: "+e.quota+". ":"")+'Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.
'}}),Forms:n.View.extend({initialize:function(e){this.model=new i(e),this.page=this.model.get(e.form_id),this.setElement(""),this.render()},render:function(){var i=this;s.ajax({url:Galaxy.root+this.page.url,type:"GET"}).done(function(n){var o=s.extend({},i.page,n),a=new e({title:o.title,icon:o.icon,inputs:o.inputs,operations:{submit:new t.ButtonIcon({tooltip:o.submit_tooltip,title:o.submit_title||"Save settings",icon:o.submit_icon||"fa-save",onclick:function(){i._submit(a,o)}})}});i.$el.empty().append(a.$el)}).fail(function(e){i.$el.empty().append(new t.Message({message:"Failed to load resource "+i.page.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e,t){s.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(t){var i=!1;e.data.matchModel(t,function(t,n){e.field_list[n].value(t.value),i=!0}),e.message.update({message:t.message,status:"success"})}).fail(function(t){window.console.log(t),e.message.update({message:t.responseJSON.err_msg,status:"danger"})})}})}}.apply(t,a))&&(e.exports=r)}).call(t,i(2),i(0),i(1))},,,function(e,t,i){"use strict";(function(i,n,s){var o,a;o=[],void 0!==(a=function(){var e=i.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:!0,id:null,href:null,target:null,enabled:!0,visible:!0,tooltip_config:{}}}),t=i.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"},this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var e=this.template(this.model.toJSON());return e.tooltip(this.model.get("tooltip_config")),this.$el.replaceWith(e),this.setElement(e),this},events:{click:"click"},click:function(e){return!n.isFunction(this.model.get("on_click"))||(this.model.get("on_click")(e),!1)},template:function(e){var t='title="'+e.title+'" class="icon-button';return e.is_menu_button&&(t+=" menu-button"),t+=" "+e.icon_class,e.enabled||(t+="_disabled"),t+='"',e.id&&(t+=' id="'+e.id+'"'),t+=' href="'+e.href+'"',e.target&&(t+=' target="'+e.target+'"'),e.visible||(t+=' style="display: none;"'),t=e.enabled?"":"",s(t)}}),o=i.Collection.extend({model:e}),a=i.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var e=this;return this.collection.each(function(t){var i=s("").attr("href","javascript:void(0)").attr("title",t.attributes.title).addClass("icon-button menu-button").addClass(t.attributes.icon_class).appendTo(e.$el).click(t.attributes.on_click);t.attributes.tooltip_config&&i.tooltip(t.attributes.tooltip_config);var n=t.get("options");n&&make_popupmenu(i,n)}),this}});return{IconButton:e,IconButtonView:t,IconButtonCollection:o,IconButtonMenuView:a,create_icon_buttons_menu:function(t,i){i||(i={});var s=new o(n.map(t,function(t){return new e(n.extend(t,i))}));return new a({collection:s})}}}.apply(t,o))&&(e.exports=a)}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";(function(n,s){var o;void 0!==(o=function(){function e(e){e+="";for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}return{commatize:e,is_deferred:function(e){return"promise"in e},ServerStateDeferred:n.Model.extend({defaults:{ajax_settings:{},interval:1e3,success_fn:function(e){return!0}},go:function(){var e=s.Deferred(),t=this,i=t.get("ajax_settings"),n=t.get("success_fn"),o=t.get("interval");return function t(){s.ajax(i).success(function(i){n(i)?e.resolve(i):setTimeout(t,o)})}(),e}}),get_random_color:function(e){e||(e="#ffffff"),"string"==typeof e&&(e=[e]);for(var t=0;t"+this.formattedReference()+"
"),this},formattedReference:function(){var e=this.model,t=e.entryType(),i=e.fields(),n="",s=this._asSentence((i.author?i.author:"")+(i.year?" ("+i.year+")":""))+" ",o=i.title||"",a=i.pages?"pp. "+i.pages:"",r=i.address;if("article"==t){var l=(i.volume?i.volume:"")+(i.number?" ("+i.number+")":"")+(a?", "+a:"");n=s+this._asSentence(o)+(i.journal?"In "+i.journal+", ":"")+this._asSentence(l)+this._asSentence(i.address)+""}else n="inproceedings"==t||"proceedings"==t?s+this._asSentence(o)+(i.booktitle?"In "+i.booktitle+", ":"")+(a||"")+(r?", "+r:"")+".":"mastersthesis"==t||"phdthesis"==t?s+this._asSentence(o)+(i.howpublished?i.howpublished+". ":"")+(i.note?i.note+".":""):"techreport"==t?s+this._asSentence(o)+this._asSentence(i.institution)+this._asSentence(i.number)+this._asSentence(i.type):"book"==t||"inbook"==t||"incollection"==t?s+" "+this._formatBookInfo(i):s+" "+this._asSentence(o)+this._asSentence(i.howpublished)+this._asSentence(i.note);var c="";i.doi&&(c="http://dx.doi.org/"+i.doi,n+='[doi:'+i.doi+"]");var d=i.url||c;return d&&(n+='[Link]'),n},_formatBookInfo:function(e){var t="";return e.chapter&&(t+=e.chapter+" in "),e.title&&(t+=""+e.title+""),e.editor&&(t+=", Edited by "+e.editor+", "),e.publisher&&(t+=", "+e.publisher),e.pages&&(t+=", pp. "+e.pages),e.series&&(t+=", "+e.series+""),e.volume&&(t+=", Vol."+e.volume),e.issn&&(t+=", ISBN: "+e.issn),t+"."},_asSentence:function(e){return e&&e.trim()?e+". ":""}}),o=n.View.extend({el:"#citations",initialize:function(){this.listenTo(this.collection,"add",this.renderCitation)},events:{"click .citations-to-bibtex":"showBibtex","click .citations-to-formatted":"showFormatted"},renderCitation:function(e){var t=new s({model:e});this.$(".citations-formatted").append(t.render().el);var i=this.$(".citations-bibtex-text");i.val(i.val()+"\n\r"+e.attributes.content)},render:function(){this.$el.html(this.citationsElement()),this.collection.each(function(e){this.renderCitation(e)},this),this.showFormatted()},showBibtex:function(){this.$(".citations-to-formatted").show(),this.$(".citations-to-bibtex").hide(),this.$(".citations-bibtex").show(),this.$(".citations-formatted").hide(),this.$(".citations-bibtex-text").select()},showFormatted:function(){this.$(".citations-to-formatted").hide(),this.$(".citations-to-bibtex").show(),this.$(".citations-bibtex").hide(),this.$(".citations-formatted").show()},partialWarningElement:function(){return this.collection.partial?['"+JSON.stringify(e.responseJSON)+"":n+=": "+i),creator._showAlert(n,"alert-danger")},render:function(e,t){return this.$el.empty().html(this.templates.main()),this._renderHeader(e),this._renderMiddle(e),this._renderFooter(e),this._addPluginComponents(),this.trigger("rendered",this),this},_renderHeader:function(e,t){var i=this.$(".header").empty().html(this.templates.header()).find(".help-content").prepend(a(this.templates.helpContent()));return this._renderFilters(),i},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(e,t){var i=this.$(".middle").empty().html(this.templates.middle());return this.unpairedPanelHidden?this.$(".unpaired-columns").hide():this.pairedPanelHidden&&this.$(".paired-columns").hide(),this._renderUnpaired(),this._renderPaired(),i},_renderUnpaired:function(e,t){var i,n,s=this,o=[],a=this._splitByFilters();return this.$(".forward-column .title").text([a[0].length,l("unpaired forward")].join(" ")),this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-a[0].length)),this.$(".reverse-column .title").text([a[1].length,l("unpaired reverse")].join(" ")),this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-a[1].length)),this.$(".unpaired-columns .column-datasets").empty(),this.$(".autopair-link").toggle(0!==this.unpaired.length),0===this.unpaired.length?void this._renderUnpairedEmpty():(n=a[1].map(function(e,t){return void 0!==a[0][t]&&a[0][t]!==e&&o.push(s._renderPairButton()),s._renderUnpairedDataset(e)}),i=a[0].map(function(e){return s._renderUnpairedDataset(e)}),i.length||n.length?(this.$(".unpaired-columns .forward-column .column-datasets").append(i).add(this.$(".unpaired-columns .paired-column .column-datasets").append(o)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(n)),void this._adjUnpairedOnScrollbar()):void this._renderUnpairedNotShown())},_renderUnpairedDisplayStr:function(e){return["(",e," ",l("filtered out"),")"].join("")},_renderUnpairedDataset:function(e){return a("").attr("id","dataset-"+e.id).addClass("dataset unpaired").attr("draggable",!0).addClass(e.selected?"selected":"").append(a("").addClass("dataset-name").text(e.name)).data("dataset",e)},_renderPairButton:function(){return a("").addClass("dataset unpaired").append(a("").addClass("dataset-name").text(l("Pair these datasets")))},_renderUnpairedEmpty:function(){var e=a('').text("("+l("no remaining unpaired datasets")+")");return this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(e),e},_renderUnpairedNotShown:function(){var e=a('').text("("+l("no datasets were found matching the current filters")+")");return this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(e),e},_adjUnpairedOnScrollbar:function(){var e=this.$(".unpaired-columns").last(),t=this.$(".unpaired-columns .reverse-column .dataset").first();if(t.length){var i=e.offset().left+e.outerWidth(),n=t.offset().left+t.outerWidth(),s=Math.floor(i)-Math.floor(n);this.$(".unpaired-columns .forward-column").css("margin-left",s>0?s:0)}},_renderPaired:function(e,t){if(this.$(".paired-column-title .title").text([this.paired.length,l("paired")].join(" ")),this.$(".unpair-all-link").toggle(0!==this.paired.length),0===this.paired.length)return void this._renderPairedEmpty();this.$(".remove-extensions-link").show(),this.$(".paired-columns .column-datasets").empty();var i=this;this.paired.forEach(function(e,t){var n=new h({pair:e});i.$(".paired-columns .column-datasets").append(n.render().$el).append(['"].join(""))})},_renderPairedEmpty:function(){var e=a('').text("("+l("no paired datasets yet")+")");return this.$(".paired-columns .column-datasets").empty().prepend(e),e},footerSettings:{".hide-originals":"hideOriginals",".remove-extensions":"removeExtensions"},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link"),this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(e){function t(e,t){return['"].join("")}var i=a(s.template(['
",l(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"
","",l(['Unpaired datasets are shown in the unpaired section ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the paired section.',"
",l(["
",l(["To unpair individual dataset pairs, click the ",'unpair buttons ( ). ','Click the "Unpair all" link to unpair all pairs.'].join("")),"
","",l(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','"Remove file extensions from pair names?" control.'].join("")),"
","",l(['Once your collection is complete, enter a name and ','click "Create list". ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"
"].join(""))})}),p=function(e,t){var i,n=o.Deferred();if(t=s.defaults(t||{},{datasets:e,oncancel:function(){Galaxy.modal.hide(),n.reject("cancelled")},oncreate:function(e,t){Galaxy.modal.hide(),n.resolve(t)}}),!window.Galaxy||!Galaxy.modal)throw new Error("Galaxy or Galaxy.modal not found");return i=new u(t),Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:!0}),i.render(),window.creator=i,n};return{PairedCollectionCreator:u,pairedCollectionCreatorModal:p,createListOfPairsCollection:d}}.apply(t,r))&&(e.exports=l)}).call(t,i(2),i(1),i(0),i(0))},function(e,t,i){"use strict";(function(n,s,o){var a,r;a=[i(23),i(25),i(5),i(3)],void 0!==(r=function(e,t,i,a){function r(e,t){var i=e.toJSON();return h(i,{defaultHideSourceItems:t,creationFn:function(t,i,n){return t=[{name:"forward",src:"hda",id:t[0].id},{name:"reverse",src:"hda",id:t[1].id}],e.createHDCA(t,"paired",i,n)}})}var l=n.View.extend(i.LoggableMixin).extend({_logNamespace:"collections",tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.identifier=e.identifier},render:function(){return this.$el.attr("data-element-id",this.element.id).html(this.template({identifier:this.identifier,element:this.element})),this},template:s.template(['<%- identifier %>','<%- element.name %>'].join("")),destroy:function(){this.off(),this.$el.remove()},toString:function(){return"DatasetCollectionElementView()"}}),c=e.ListCollectionCreator,d=c.extend({elementViewClass:l,collectionClass:t.HistoryPairDatasetCollection,className:"pair-collection-creator collection-creator flex-row-container",_mangleDuplicateNames:function(){},render:function(e,t){return 2===this.workingElements.length?c.prototype.render.call(this,e,t):this._renderInvalid(e,t)},_renderList:function(e,t){var i=this,n=o(""),a=i.$list();s.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),n.append(i._createForwardElementView().$el),n.append(i._createReverseElementView().$el),a.empty().append(n.children()),s.invoke(i.elementViews,"render")},_createForwardElementView:function(){return this._createElementView(this.workingElements[0],{identifier:"forward"})},_createReverseElementView:function(){return this._createElementView(this.workingElements[1],{identifier:"reverse"})},_createElementView:function(e,t){var i=new this.elementViewClass(s.extend(t,{element:e}));return this.elementViews.push(i),i},swap:function(){this.workingElements=[this.workingElements[1],this.workingElements[0]],this._renderList()},events:s.extend(s.clone(c.prototype.events),{"click .swap":"swap"}),templates:s.extend(s.clone(c.prototype.templates),{middle:s.template(['",a(["Pair collections are permanent collections containing two datasets: one forward and one reverse. ","Often these are forward and reverse reads. The pair collections can be passed to tools and ","workflows in order to have analyses done on both datasets. This interface allows ","you to create a pair, name it, and swap which is forward and which reverse."].join("")),"
","",a(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"
"].join("")),invalidInitial:s.template([''+this.progressive+"...
";this.modal.$(".modal-body").empty().append(e).css({"margin-top":"8px"})},dialog:function(e,a,r){function l(){var i=e.$("#copy-modal-title").val();if(!i)return void e.$(".invalid-title").show();var n="copy-all"===e.$('input[name="copy-what"]:checked').val();e.$("button").prop("disabled",!0),c._showAjaxIndicator(),a.copy(!0,i,n).done(function(e){d.resolve(e)}).fail(function(e,s,o){var r={name:i,copyAllDatasets:n};t.ajaxErrorModal(a,e,r,c.errorMessage),d.rejectWith(d,arguments)}).done(function(){f&&e.hide()})}r=r||{};var c=this,d=s.Deferred(),h=r.nameFn||this.defaultName,u=h({name:a.get("name")}),p=r.allDatasets?"copy-all":"copy-non-deleted",g=!!n.isUndefined(r.allowAll)||r.allowAll,f=!!n.isUndefined(r.autoClose)||r.autoClose;this.modal=e;var m=r.closing_callback;return e.show(n.extend(r,{title:this.title({name:a.get("name")}),body:o(c._template({name:u,isAnon:Galaxy.user.isAnonymous(),allowAll:g,copyWhat:p,activeLabel:this.activeLabel,allLabel:this.allLabel,anonWarning:this.anonWarning})),buttons:n.object([[i("Cancel"),function(){e.hide()}],[this.submitLabel,l]]),height:"auto",closing_events:!0,closing_callback:function(e){e&&d.reject({cancelled:!0}),m&&m(e)}})),e.$("#copy-modal-title").focus().select(),e.$("#copy-modal-title").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),l())}),d}},r=n.extend({},a,{defaultName:n.template("imported: <%- name %>"),title:n.template(i("Importing history")+' "<%- name %>"'),submitLabel:i("Import"),errorMessage:i("History could not be imported."),progressive:i("Importing history"),activeLabel:i("Import only the active, non-deleted datasets"),allLabel:i("Import all datasets including deleted ones"),anonWarning:i("As an anonymous user, unless you login or register, you will lose your current history ")+i("after importing this history. ")});return function(t,i){i=i||{};var n=window.parent.Galaxy.modal||new e.View({});return i.useImport?r.dialog(n,t,i):a.dialog(n,t,i)}}.apply(t,a))&&(e.exports=r)}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(n,s){var o,a;o=[i(53),i(55),i(5),i(3)],void 0!==(a=function(e,t,i,o){var a=e.DatasetListItemEdit,r=a.extend({className:a.prototype.className+" history-content",_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):e.model.has("rerunnable")?n.when():e.model.fetch({silent:!0,data:{keys:["rerunnable","creating_job"].join(",")}})},events:s.extend(s.clone(a.prototype.events),{"click .unhide-link":function(e){return this.model.unhide(),!1}}),toString:function(){return"HDAListItemEdit("+(this.model?this.model+"":"(no model)")+")"}});return r.prototype.templates=function(){var e=s.extend({},a.prototype.templates.warnings,{hidden:i.wrapTemplate(["<% if( !dataset.visible ){ %>",'| Name | Size | Status |
|---|
| Description | Name | Size | Settings | Status |
|---|
| Name | Size | Type | Genome | Settings | Status |
|---|
' + JSON.stringify(xhr.responseJSON) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert(content, 'alert-danger');\n },\n\n events: {\n // header\n 'click .more-help': '_clickMoreHelp',\n 'click .less-help': '_clickLessHelp',\n 'click .main-help': '_toggleHelp',\n 'click .header .alert button': '_hideAlert',\n\n 'click .reset': 'reset',\n 'click .clear-selected': 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements': 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements': '_dragoverElements',\n 'drop .collection-elements': '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements': '_elementDragstart',\n 'collection-element.dragend .collection-elements': '_elementDragend',\n\n // footer\n 'change .collection-name': '_changeName',\n 'keydown .collection-name': '_nameCheckForEnter',\n 'change .hide-originals': '_changeHideOriginals',\n 'click .cancel-create': '_cancelCreate',\n 'click .create-collection': '_clickCreate' //,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset: function reset() {\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements: function clearSelectedElements(ev) {\n this.$('.collection-elements .collection-element').removeClass('selected');\n this.$('.collection-elements-controls > .clear-selected').hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n //TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements: function _dragoverElements(ev) {\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll($list, ev.originalEvent.clientY);\n var $nearest = this._getNearestElement(ev.originalEvent.clientY);\n\n //TODO: no need to re-create - move instead\n this.$('.element-drop-placeholder').remove();\n var $placeholder = $('');\n if (!$nearest.length) {\n $list.append($placeholder);\n } else {\n $nearest.before($placeholder);\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll: function _checkForAutoscroll($element, y) {\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = offset.top + $element.outerHeight() - y;\n if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement: function _getNearestElement(y) {\n var WIGGLE = 4,\n lis = this.$('.collection-elements li.collection-element').toArray();\n for (var i = 0; i < lis.length; i++) {\n var $li = $(lis[i]),\n top = $li.offset().top,\n halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n if (top + halfHeight > y && top - halfHeight < y) {\n return $li;\n }\n }\n return $();\n },\n\n /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n _dropElements: function _dropElements(ev) {\n if (ev.originalEvent) {\n ev = ev.originalEvent;\n }\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n // insert before the nearest element or after the last.\n var $nearest = this._getNearestElement(ev.clientY);\n if ($nearest.length) {\n this.$dragging.insertBefore($nearest);\n } else {\n // no nearest before - insert after last element\n this.$dragging.insertAfter(this.$('.collection-elements .collection-element').last());\n }\n // resync the creator's list based on the new DOM order\n this._syncOrderToDom();\n return false;\n },\n\n /** resync the creator's list of elements based on the DOM order */\n _syncOrderToDom: function _syncOrderToDom() {\n var creator = this,\n newElements = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$('.collection-elements .collection-element').each(function () {\n var id = $(this).attr('data-element-id'),\n element = _.findWhere(creator.workingElements, { id: id });\n if (element) {\n newElements.push(element);\n } else {\n console.error('missing element: ', id);\n }\n });\n this.workingElements = newElements;\n this._renderList();\n },\n\n /** drag communication with element sub-views: dragstart */\n _elementDragstart: function _elementDragstart(ev, element) {\n // auto select the element causing the event and move all selected\n element.select(true);\n this.$dragging = this.$('.collection-elements .collection-element.selected');\n },\n\n /** drag communication with element sub-views: dragend - remove the placeholder */\n _elementDragend: function _elementDragend(ev, element) {\n $('.element-drop-placeholder').remove();\n this.$dragging = null;\n },\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header: _.template(['
', _l(['Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ', 'workflows in order to have analyses done on each member of the entire group. This interface allows ', 'you to create a collection and re-order the final collection.'].join('')), '
', '', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '
'].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements: _.template([_l('The following selections could not be included due to problems:'), '<%= dataset.peek %>', '<% } %>', '<% } %>', '
| ' + ' | Name | ' + 'Size | ' + 'Created | ' + '
|---|
' + 'You are using ' + options.nice_total_disk_usage + ' of disk space in this Galaxy instance. ' + (Galaxy.config.enable_quotas ? 'Your disk quota is: ' + options.quota + '. ' : '') + 'Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.' + '
';\n }\n });\n\n /** View of individual user forms */\n var Forms = Backbone.View.extend({\n\n initialize: function initialize(options) {\n this.model = new Model(options);\n this.page = this.model.get(options.form_id);\n this.setElement('');\n this.render();\n },\n\n render: function render() {\n var self = this;\n $.ajax({\n url: Galaxy.root + this.page.url,\n type: 'GET'\n }).done(function (response) {\n var options = $.extend({}, self.page, response);\n var form = new Form({\n title: options.title,\n icon: options.icon,\n inputs: options.inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip: options.submit_tooltip,\n title: options.submit_title || 'Save settings',\n icon: options.submit_icon || 'fa-save',\n onclick: function onclick() {\n self._submit(form, options);\n }\n })\n }\n });\n self.$el.empty().append(form.$el);\n }).fail(function (response) {\n self.$el.empty().append(new Ui.Message({\n message: 'Failed to load resource ' + self.page.url + '.',\n status: 'danger',\n persistent: true\n }).$el);\n });\n },\n\n _submit: function _submit(form, options) {\n var self = this;\n $.ajax({\n url: Galaxy.root + options.url,\n data: JSON.stringify(form.data.create()),\n type: 'PUT',\n contentType: 'application/json'\n }).done(function (response) {\n var updated_values = false;\n form.data.matchModel(response, function (input, input_id) {\n form.field_list[input_id].value(input.value);\n updated_values = true;\n });\n form.message.update({ message: response.message, status: 'success' });\n }).fail(function (response) {\n window.console.log(response);\n form.message.update({ message: response.responseJSON.err_msg, status: 'danger' });\n });\n }\n });\n\n return {\n View: View,\n Forms: Forms\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 76 */,\n/* 77 */,\n/* 78 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _, $) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n //jquery\n //backbone\n], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n //=============================================================================\n /**\n * backbone model for icon buttons\n */\n var IconButton = Backbone.Model.extend({\n defaults: {\n title: \"\",\n icon_class: \"\",\n on_click: null,\n menu_options: null,\n is_menu_button: true,\n id: null,\n href: null,\n target: null,\n enabled: true,\n visible: true,\n tooltip_config: {}\n }\n });\n\n /**\n * backbone view for icon buttons\n */\n var IconButtonView = Backbone.View.extend({\n\n initialize: function initialize() {\n // better rendering this way\n this.model.attributes.tooltip_config = { placement: 'bottom' };\n this.model.bind('change', this.render, this);\n },\n\n render: function render() {\n // hide tooltip\n this.$el.tooltip('hide');\n\n var new_elem = this.template(this.model.toJSON());\n // configure tooltip\n new_elem.tooltip(this.model.get('tooltip_config'));\n this.$el.replaceWith(new_elem);\n this.setElement(new_elem);\n return this;\n },\n\n events: {\n 'click': 'click'\n },\n\n click: function click(event) {\n // if on_click pass to that function\n if (_.isFunction(this.model.get('on_click'))) {\n this.model.get('on_click')(event);\n return false;\n }\n // otherwise, bubble up ( to href or whatever )\n return true;\n },\n\n // generate html element\n template: function template(options) {\n var buffer = 'title=\"' + options.title + '\" class=\"icon-button';\n\n if (options.is_menu_button) {\n buffer += ' menu-button';\n }\n\n buffer += ' ' + options.icon_class;\n\n if (!options.enabled) {\n buffer += '_disabled';\n }\n\n // close class tag\n buffer += '\"';\n\n if (options.id) {\n buffer += ' id=\"' + options.id + '\"';\n }\n\n buffer += ' href=\"' + options.href + '\"';\n // add target for href\n if (options.target) {\n buffer += ' target=\"' + options.target + '\"';\n }\n // set visibility\n if (!options.visible) {\n buffer += ' style=\"display: none;\"';\n }\n\n // enabled/disabled\n if (options.enabled) {\n buffer = '';\n } else {\n buffer = '';\n }\n\n // return element\n return $(buffer);\n }\n });\n\n // define collection\n var IconButtonCollection = Backbone.Collection.extend({\n model: IconButton\n });\n\n /**\n * menu with multiple icon buttons\n * views are not needed nor used for individual buttons\n */\n var IconButtonMenuView = Backbone.View.extend({\n\n tagName: 'div',\n\n initialize: function initialize() {\n this.render();\n },\n\n render: function render() {\n // initialize icon buttons\n var self = this;\n this.collection.each(function (button) {\n // create and add icon button to menu\n var elt = $('').attr('href', 'javascript:void(0)').attr('title', button.attributes.title).addClass('icon-button menu-button').addClass(button.attributes.icon_class).appendTo(self.$el).click(button.attributes.on_click);\n\n // configure tooltip\n if (button.attributes.tooltip_config) {\n elt.tooltip(button.attributes.tooltip_config);\n }\n\n // add popup menu to icon\n var menu_options = button.get('options');\n if (menu_options) {\n make_popupmenu(elt, menu_options);\n }\n });\n\n // return\n return this;\n }\n });\n\n /**\n * Returns an IconButtonMenuView for the provided configuration.\n * Configuration is a list of dictionaries where each dictionary\n * defines an icon button. Each dictionary must have the following\n * elements: icon_class, title, and on_click.\n */\n var create_icon_buttons_menu = function create_icon_buttons_menu(config, global_config) {\n // initialize global configuration\n if (!global_config) global_config = {};\n\n // create and initialize menu\n var buttons = new IconButtonCollection(_.map(config, function (button_config) {\n return new IconButton(_.extend(button_config, global_config));\n }));\n\n // return menu\n return new IconButtonMenuView({ collection: buttons });\n };\n\n //=============================================================================\n return {\n IconButton: IconButton,\n IconButtonView: IconButtonView,\n IconButtonCollection: IconButtonCollection,\n IconButtonMenuView: IconButtonMenuView,\n create_icon_buttons_menu: create_icon_buttons_menu\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(0)))\n\n/***/ }),\n/* 79 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, $) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\n /**\n * Stringifies a number adding commas for digit grouping as per North America.\n */\n function commatize(number) {\n number += ''; // Convert to string\n var rgx = /(\\d+)(\\d{3})/;\n while (rgx.test(number)) {\n number = number.replace(rgx, '$1' + ',' + '$2');\n }\n return number;\n }\n\n /**\n * Helper to determine if object is jQuery deferred.\n */\n var is_deferred = function is_deferred(d) {\n return 'promise' in d;\n };\n\n /**\n * Implementation of a server-state based deferred. Server is repeatedly polled, and when\n * condition is met, deferred is resolved.\n */\n var ServerStateDeferred = Backbone.Model.extend({\n defaults: {\n ajax_settings: {},\n interval: 1000,\n success_fn: function success_fn(result) {\n return true;\n }\n },\n\n /**\n * Returns a deferred that resolves when success function returns true.\n */\n go: function go() {\n var deferred = $.Deferred(),\n self = this,\n ajax_settings = self.get('ajax_settings'),\n success_fn = self.get('success_fn'),\n interval = self.get('interval'),\n _go = function _go() {\n $.ajax(ajax_settings).success(function (result) {\n if (success_fn(result)) {\n // Result is good, so resolve.\n deferred.resolve(result);\n } else {\n // Result not good, try again.\n setTimeout(_go, interval);\n }\n });\n };\n _go();\n return deferred;\n }\n });\n\n /**\n * Returns a random color in hexadecimal format that is sufficiently different from a single color\n * or set of colors.\n * @param colors a color or list of colors in the format '#RRGGBB'\n */\n var get_random_color = function get_random_color(colors) {\n // Default for colors is white.\n if (!colors) {\n colors = \"#ffffff\";\n }\n\n // If needed, create list of colors.\n if (typeof colors === \"string\") {\n colors = [colors];\n }\n\n // Convert colors to numbers.\n for (var i = 0; i < colors.length; i++) {\n colors[i] = parseInt(colors[i].slice(1), 16);\n }\n\n // -- Perceived brightness and difference formulas are from\n // -- http://www.w3.org/WAI/ER/WD-AERT/#color-contrast\n\n // Compute perceived color brightness (based on RGB-YIQ transformation):\n var brightness = function brightness(r, g, b) {\n return (r * 299 + g * 587 + b * 114) / 1000;\n };\n\n // Compute color difference:\n var difference = function difference(r1, g1, b1, r2, g2, b2) {\n return Math.max(r1, r2) - Math.min(r1, r2) + (Math.max(g1, g2) - Math.min(g1, g2)) + (Math.max(b1, b2) - Math.min(b1, b2));\n };\n\n // Create new random color.\n var new_color,\n nr,\n ng,\n nb,\n other_color,\n or,\n og,\n ob,\n n_brightness,\n o_brightness,\n diff,\n ok = false,\n num_tries = 0;\n do {\n // New color is never white b/c random in [0,1)\n new_color = Math.round(Math.random() * 0xffffff);\n nr = (new_color & 0xff0000) >> 16;\n ng = (new_color & 0x00ff00) >> 8;\n nb = new_color & 0x0000ff;\n n_brightness = brightness(nr, ng, nb);\n ok = true;\n for (i = 0; i < colors.length; i++) {\n other_color = colors[i];\n or = (other_color & 0xff0000) >> 16;\n og = (other_color & 0x00ff00) >> 8;\n ob = other_color & 0x0000ff;\n o_brightness = brightness(or, og, ob);\n diff = difference(nr, ng, nb, or, og, ob);\n // These thresholds may need to be adjusted. Brightness difference range is 125;\n // color difference range is 500.\n if (Math.abs(n_brightness - o_brightness) < 40 || diff < 200) {\n ok = false;\n break;\n }\n }\n\n num_tries++;\n } while (!ok && num_tries <= 10);\n\n // Add 0x1000000 to left pad number with 0s.\n return '#' + (0x1000000 + new_color).toString(16).substr(1, 6);\n };\n\n return {\n commatize: commatize,\n is_deferred: is_deferred,\n ServerStateDeferred: ServerStateDeferred,\n get_random_color: get_random_color\n };\n}.call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0)))\n\n/***/ }),\n/* 80 */\n/***/ (function(module, exports) {\n\n/**\n * Parser.js\n * Copyright 2012-13 Mayank Lahiri\n * mlahiri@gmail.com\n * Released under the BSD License.\n *\n * A forgiving Bibtex parser that can:\n * \n * (1) operate in streaming or block mode, extracting entries as dictionaries. \n * (2) convert Latex special characters to UTF-8.\n * (3) best-effort parse malformed entries.\n * (4) run in a CommonJS environment or a browser, without any dependencies.\n * (5) be advanced-compiled by Google Closure Compiler.\n * \n * Handwritten as a labor of love, not auto-generated from a grammar. \n *\n * Modes of usage:\n *\n * (1) Synchronous, string\n *\n * var entries = BibtexParser(text);\n * console.log(entries);\n *\n * (2) Asynchronous, stream\n *\n * var entryCallback = function(entry) { console.log(entry); }\n * var parser = new BibtexParser(entryCallback);\n * parser.parse(chunk1);\n * parser.parse(chunk2);\n * ...\n * \n * @param {text|function(Object)} arg Either a Bibtex string or callback \n * function for processing parsed entries.\n * @constructor\n */\nfunction BibtexParser(arg0) {\n // Determine how this function is to be used\n if (typeof arg0 == 'string') {\n // Passed a string, synchronous call without 'new'\n var tempStorage = {};\n var entries = [];\n function accumulator(entry) {\n entries.push(entry);\n }\n var parser = BibtexParser.call(tempStorage, accumulator);\n parser.parse(arg0);\n return {\n 'entries': entries,\n 'errors': parser.getErrors()\n }\n }\n if (typeof arg0 != 'function') {\n throw 'Invalid parser construction.';\n }\n\n /** @enum {number} */\n this.STATES_ = {\n ENTRY_OR_JUNK: 0,\n OBJECT_TYPE: 1,\n ENTRY_KEY: 2, \n KV_KEY: 3, \n EQUALS: 4,\n KV_VALUE: 5 \n }\n /** @private */ this.DATA_ = {};\n /** @private */ this.CALLBACK_ = arg0;\n /** @private */ this.CHAR_ = 0;\n /** @private */ this.LINE_ = 1;\n /** @private */ this.CHAR_IN_LINE_ = 0;\n /** @private */ this.SKIPWS_ = true;\n /** @private */ this.SKIPCOMMENT_ = true;\n /** @private */ this.PARSETMP_ = {};\n /** @private */ this.SKIPTILLEOL_ = false;\n /** @private */ this.VALBRACES_ = null;\n /** @private */ this.BRACETYPE_ = null;\n /** @private */ this.BRACECOUNT_ = 0;\n /** @private */ this.STATE_ = this.STATES_.ENTRY_OR_JUNK;\n /** @private */ this.ERRORS_ = [];\n /** @private */ this.ENTRY_TYPES_ = {\n 'inproceedings' : 1,\n 'proceedings' : 2,\n 'article' : 3,\n 'techreport' : 4,\n 'misc' : 5,\n 'mastersthesis' : 6,\n 'book' : 7,\n 'phdthesis' : 8,\n 'incollection' : 9,\n 'unpublished' : 10,\n 'inbook' : 11,\n 'manual' : 12,\n 'periodical' : 13,\n 'booklet' : 14,\n 'masterthesis' : 15,\n 'conference' : 16\n ,'online' : 998 // Galaxy MOD: Handle @online entries for preprints.\n ,'data' : 999 // Galaxy MOD: Handle @data citations coming from figshare.\n }\n /** @private */ this.MACROS_ = {\n 'jan' : 'January',\n 'feb' : 'February',\n 'mar' : 'March',\n 'apr' : 'April',\n 'may' : 'May',\n 'jun' : 'June',\n 'jul' : 'July',\n 'aug' : 'August',\n 'sep' : 'September',\n 'oct' : 'October',\n 'nov' : 'November',\n 'dec' : 'December',\n 'Jan' : 'January',\n 'Feb' : 'February',\n 'Mar' : 'March',\n 'Apr' : 'April',\n 'May' : 'May',\n 'Jun' : 'June',\n 'Jul' : 'July',\n 'Aug' : 'August',\n 'Sep' : 'September',\n 'Oct' : 'October',\n 'Nov' : 'November',\n 'Dec' : 'December'\n }\n\n /**\n * Gets an array of all errors encountered during parsing.\n * Array entries are of the format:\n * [ line number, character in line, character in stream, error text ]\n *\n * @returns Array\" + this.formattedReference() + \"
\");\n return this;\n },\n formattedReference: function formattedReference() {\n var model = this.model;\n var entryType = model.entryType();\n var fields = model.fields();\n\n var ref = \"\";\n // Code inspired by...\n // https://github.com/vkaravir/bib-publication-list/blob/master/src/bib-publication-list.js\n var authorsAndYear = this._asSentence((fields.author ? fields.author : \"\") + (fields.year ? \" (\" + fields.year + \")\" : \"\")) + \" \";\n var title = fields.title || \"\";\n var pages = fields.pages ? \"pp. \" + fields.pages : \"\";\n var address = fields.address;\n if (entryType == \"article\") {\n var volume = (fields.volume ? fields.volume : \"\") + (fields.number ? \" (\" + fields.number + \")\" : \"\") + (pages ? \", \" + pages : \"\");\n ref = authorsAndYear + this._asSentence(title) + (fields.journal ? \"In \" + fields.journal + \", \" : \"\") + this._asSentence(volume) + this._asSentence(fields.address) + \"<\\/em>\";\n } else if (entryType == \"inproceedings\" || entryType == \"proceedings\") {\n ref = authorsAndYear + this._asSentence(title) + (fields.booktitle ? \"In \" + fields.booktitle + \", \" : \"\") + (pages ? pages : \"\") + (address ? \", \" + address : \"\") + \".<\\/em>\";\n } else if (entryType == \"mastersthesis\" || entryType == \"phdthesis\") {\n ref = authorsAndYear + this._asSentence(title) + (fields.howpublished ? fields.howpublished + \". \" : \"\") + (fields.note ? fields.note + \".\" : \"\");\n } else if (entryType == \"techreport\") {\n ref = authorsAndYear + this._asSentence(title) + this._asSentence(fields.institution) + this._asSentence(fields.number) + this._asSentence(fields.type);\n } else if (entryType == \"book\" || entryType == \"inbook\" || entryType == \"incollection\") {\n ref = authorsAndYear + \" \" + this._formatBookInfo(fields);\n } else {\n ref = authorsAndYear + \" \" + this._asSentence(title) + this._asSentence(fields.howpublished) + this._asSentence(fields.note);\n }\n var doiUrl = \"\";\n if (fields.doi) {\n doiUrl = 'http://dx.doi.org/' + fields.doi;\n ref += '[doi:' + fields.doi + \"]\";\n }\n var url = fields.url || doiUrl;\n if (url) {\n ref += '[Link]';\n }\n return ref;\n },\n _formatBookInfo: function _formatBookInfo(fields) {\n var info = \"\";\n if (fields.chapter) {\n info += fields.chapter + \" in \";\n }\n if (fields.title) {\n info += \"\" + fields.title + \"<\\/em>\";\n }\n if (fields.editor) {\n info += \", Edited by \" + fields.editor + \", \";\n }\n if (fields.publisher) {\n info += \", \" + fields.publisher;\n }\n if (fields.pages) {\n info += \", pp. \" + fields.pages + \"\";\n }\n if (fields.series) {\n info += \", \" + fields.series + \"<\\/em>\";\n }\n if (fields.volume) {\n info += \", Vol.\" + fields.volume;\n }\n if (fields.issn) {\n info += \", ISBN: \" + fields.issn;\n }\n return info + \".\";\n },\n _asSentence: function _asSentence(str) {\n return str && str.trim() ? str + \". \" : \"\";\n }\n });\n\n var CitationListView = Backbone.View.extend({\n el: '#citations',\n /**\n * Set up view.\n */\n initialize: function initialize() {\n this.listenTo(this.collection, 'add', this.renderCitation);\n },\n\n events: {\n 'click .citations-to-bibtex': 'showBibtex',\n 'click .citations-to-formatted': 'showFormatted'\n },\n\n renderCitation: function renderCitation(citation) {\n var citationView = new CitationView({ model: citation });\n this.$(\".citations-formatted\").append(citationView.render().el);\n var rawTextarea = this.$(\".citations-bibtex-text\");\n rawTextarea.val(rawTextarea.val() + \"\\n\\r\" + citation.attributes.content);\n },\n\n render: function render() {\n this.$el.html(this.citationsElement());\n this.collection.each(function (item) {\n this.renderCitation(item);\n }, this);\n this.showFormatted();\n },\n\n showBibtex: function showBibtex() {\n this.$(\".citations-to-formatted\").show();\n this.$(\".citations-to-bibtex\").hide();\n this.$(\".citations-bibtex\").show();\n this.$(\".citations-formatted\").hide();\n this.$(\".citations-bibtex-text\").select();\n },\n\n showFormatted: function showFormatted() {\n this.$(\".citations-to-formatted\").hide();\n this.$(\".citations-to-bibtex\").show();\n this.$(\".citations-bibtex\").hide();\n this.$(\".citations-formatted\").show();\n },\n\n partialWarningElement: function partialWarningElement() {\n if (this.collection.partial) {\n return ['' + JSON.stringify(xhr.responseJSON) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert(content, 'alert-danger');\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render: function render(speed, callback) {\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html(this.templates.main());\n this._renderHeader(speed);\n this._renderMiddle(speed);\n this._renderFooter(speed);\n this._addPluginComponents();\n this.trigger('rendered', this);\n return this;\n },\n\n /** render the header section */\n _renderHeader: function _renderHeader(speed, callback) {\n //this.debug( '-- _renderHeader' );\n var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters: function _renderFilters() {\n return this.$('.forward-column .column-header input').val(this.filters[0]).add(this.$('.reverse-column .column-header input').val(this.filters[1]));\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle: function _renderMiddle(speed, callback) {\n var $middle = this.$('.middle').empty().html(this.templates.middle());\n\n // (re-) hide the un/paired panels based on instance vars\n if (this.unpairedPanelHidden) {\n this.$('.unpaired-columns').hide();\n } else if (this.pairedPanelHidden) {\n this.$('.paired-columns').hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired: function _renderUnpaired(speed, callback) {\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd,\n $rev,\n $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$('.forward-column .title').text([split[0].length, _l('unpaired forward')].join(' '));\n this.$('.forward-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[0].length));\n this.$('.reverse-column .title').text([split[1].length, _l('unpaired reverse')].join(' '));\n this.$('.reverse-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[1].length));\n\n this.$('.unpaired-columns .column-datasets').empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$('.autopair-link').toggle(this.unpaired.length !== 0);\n if (this.unpaired.length === 0) {\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map(function (dataset, i) {\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if (split[0][i] !== undefined && split[0][i] !== dataset) {\n $prd.push(creator._renderPairButton());\n }\n return creator._renderUnpairedDataset(dataset);\n });\n $fwd = split[0].map(function (dataset) {\n return creator._renderUnpairedDataset(dataset);\n });\n\n if (!$fwd.length && !$rev.length) {\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$('.unpaired-columns .forward-column .column-datasets').append($fwd).add(this.$('.unpaired-columns .paired-column .column-datasets').append($prd)).add(this.$('.unpaired-columns .reverse-column .column-datasets').append($rev));\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr: function _renderUnpairedDisplayStr(numFiltered) {\n return ['(', numFiltered, ' ', _l('filtered out'), ')'].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset: function _renderUnpairedDataset(dataset) {\n //TODO: to underscore template\n return $('').attr('id', 'dataset-' + dataset.id).addClass('dataset unpaired').attr('draggable', true).addClass(dataset.selected ? 'selected' : '').append($('').addClass('dataset-name').text(dataset.name))\n //??\n .data('dataset', dataset);\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton: function _renderPairButton() {\n //TODO: *not* a dataset - don't pretend like it is\n return $('').addClass('dataset unpaired').append($('').addClass('dataset-name').text(_l('Pair these datasets')));\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty: function _renderUnpairedEmpty() {\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $('').text('(' + _l('no remaining unpaired datasets') + ')');\n this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown: function _renderUnpairedNotShown() {\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $('').text('(' + _l('no datasets were found matching the current filters') + ')');\n this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar: function _adjUnpairedOnScrollbar() {\n var $unpairedColumns = this.$('.unpaired-columns').last(),\n $firstDataset = this.$('.unpaired-columns .reverse-column .dataset').first();\n if (!$firstDataset.length) {\n return;\n }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor(ucRight) - Math.floor(dsRight);\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$('.unpaired-columns .forward-column').css('margin-left', rightDiff > 0 ? rightDiff : 0);\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired: function _renderPaired(speed, callback) {\n //this.debug( '-- _renderPaired' );\n this.$('.paired-column-title .title').text([this.paired.length, _l('paired')].join(' '));\n // show/hide the unpair all link\n this.$('.unpair-all-link').toggle(this.paired.length !== 0);\n if (this.paired.length === 0) {\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$('.remove-extensions-link').show();\n }\n\n this.$('.paired-columns .column-datasets').empty();\n var creator = this;\n this.paired.forEach(function (pair, i) {\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$('.paired-columns .column-datasets').append(pairView.render().$el).append([''].join(''));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty: function _renderPairedEmpty() {\n var $msg = $('').text('(' + _l('no paired datasets yet') + ')');\n this.$('.paired-columns .column-datasets').empty().prepend($msg);\n return $msg;\n },\n\n footerSettings: {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents: function _addPluginComponents() {\n this._chooseFiltersPopover('.choose-filters-link');\n this.$('.help-content i').hoverhighlight('.collection-creator', 'rgba( 64, 255, 255, 1.0 )');\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover: function _chooseFiltersPopover(selector) {\n function filterChoice(val1, val2) {\n return [''].join('');\n }\n var $popoverContent = $(_.template(['
', _l(['Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ', 'These collections can be passed to tools and workflows in order to have analyses done on each member of ', 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ', 'and re-order the final collection.'].join('')), '
', '', _l(['Unpaired datasets are shown in the unpaired section ', '(hover over the underlined words to highlight below). ', 'Paired datasets are shown in the paired section.', '
', _l(['
', _l(['To unpair individual dataset pairs, click the ', 'unpair buttons ( ). ', 'Click the \"Unpair all\" link to unpair all pairs.'].join('')), '
', '', _l(['You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ', '\"Remove file extensions from pair names?\" control.'].join('')), '
', '', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\". ', '(Note: you do not have to pair all unpaired datasets to finish.)'].join('')), '
'].join(''))\n })\n });\n\n //=============================================================================\n /** a modal version of the paired collection creator */\n var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal(datasets, options) {\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults(options || {}, {\n datasets: datasets,\n oncancel: function oncancel() {\n Galaxy.modal.hide();\n deferred.reject('cancelled');\n },\n oncreate: function oncreate(creator, response) {\n Galaxy.modal.hide();\n deferred.resolve(response);\n }\n });\n\n if (!window.Galaxy || !Galaxy.modal) {\n throw new Error('Galaxy or Galaxy.modal not found');\n }\n\n creator = new PairedCollectionCreator(options);\n Galaxy.modal.show({\n title: 'Create a collection of paired datasets',\n body: creator.$el,\n width: '80%',\n height: '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n };\n\n //=============================================================================\n function createListOfPairsCollection(collection, defaultHideSourceItems) {\n var elements = collection.toJSON();\n //TODO: validate elements\n return pairedCollectionCreatorModal(elements, {\n historyId: collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n }\n\n //=============================================================================\n return {\n PairedCollectionCreator: PairedCollectionCreator,\n pairedCollectionCreatorModal: pairedCollectionCreatorModal,\n createListOfPairsCollection: createListOfPairsCollection\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(0), __webpack_require__(0)))\n\n/***/ }),\n/* 107 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(23), __webpack_require__(25), __webpack_require__(5), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_CREATOR, HDCA, BASE_MVC, _l) {\n\n 'use strict';\n\n var logNamespace = 'collections';\n /*==============================================================================\n TODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n \n ==============================================================================*/\n /** */\n var PairedDatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n _logNamespace: logNamespace,\n\n //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName: 'li',\n className: 'collection-element',\n\n initialize: function initialize(attributes) {\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render: function render() {\n this.$el.attr('data-element-id', this.element.id).html(this.template({ identifier: this.identifier, element: this.element }));\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template: _.template(['<%- identifier %>', '<%- element.name %>'].join('')),\n\n /** remove the DOM and any listeners */\n destroy: function destroy() {\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString: function toString() {\n return 'DatasetCollectionElementView()';\n }\n });\n\n // ============================================================================\n var _super = LIST_CREATOR.ListCollectionCreator;\n\n /** An interface for building collections.\n */\n var PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass: PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass: HDCA.HistoryPairDatasetCollection,\n className: 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames: function _mangleDuplicateNames() {},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render: function render(speed, callback) {\n if (this.workingElements.length === 2) {\n return _super.prototype.render.call(this, speed, callback);\n }\n return this._renderInvalid(speed, callback);\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList: function _renderList(speed, callback) {\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery(''),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each(this.elementViews, function (view) {\n view.destroy();\n creator.removeElementView(view);\n });\n $tmp.append(creator._createForwardElementView().$el);\n $tmp.append(creator._createReverseElementView().$el);\n $list.empty().append($tmp.children());\n _.invoke(creator.elementViews, 'render');\n },\n\n /** create the forward element view */\n _createForwardElementView: function _createForwardElementView() {\n return this._createElementView(this.workingElements[0], { identifier: 'forward' });\n },\n\n /** create the forward element view */\n _createReverseElementView: function _createReverseElementView() {\n return this._createElementView(this.workingElements[1], { identifier: 'reverse' });\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView: function _createElementView(element, options) {\n var elementView = new this.elementViewClass(_.extend(options, {\n element: element\n }));\n this.elementViews.push(elementView);\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap: function swap() {\n this.workingElements = [this.workingElements[1], this.workingElements[0]];\n this._renderList();\n },\n\n events: _.extend(_.clone(_super.prototype.events), {\n 'click .swap': 'swap'\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates: _.extend(_.clone(_super.prototype.templates), {\n /** the middle: element list */\n middle: _.template(['', _l(['Pair collections are permanent collections containing two datasets: one forward and one reverse. ', 'Often these are forward and reverse reads. The pair collections can be passed to tools and ', 'workflows in order to have analyses done on both datasets. This interface allows ', 'you to create a pair, name it, and swap which is forward and which reverse.'].join('')), '
', '', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '
'].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial: _.template(['' + this.progressive + '...
';\n this.modal.$('.modal-body').empty().append(indicator).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog: function _dialog(modal, history, options) {\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get('name') }),\n\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets ? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined(options.allowAll) ? options.allowAll : true,\n autoClose = !_.isUndefined(options.autoClose) ? options.autoClose : true;\n\n this.modal = modal;\n\n // validate the name and copy if good\n function checkNameAndCopy() {\n var name = modal.$('#copy-modal-title').val();\n if (!name) {\n modal.$('.invalid-title').show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$('input[name=\"copy-what\"]:checked').val() === 'copy-all';\n modal.$('button').prop('disabled', true);\n dialog._showAjaxIndicator();\n history.copy(true, name, copyAllDatasets).done(function (response) {\n deferred.resolve(response);\n }).fail(function (xhr, status, message) {\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal(history, xhr, options, dialog.errorMessage);\n deferred.rejectWith(deferred, arguments);\n }).done(function () {\n if (autoClose) {\n modal.hide();\n }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show(_.extend(options, {\n title: this.title({ name: history.get('name') }),\n body: $(dialog._template({\n name: defaultCopyName,\n isAnon: Galaxy.user.isAnonymous(),\n allowAll: allowAll,\n copyWhat: defaultCopyWhat,\n activeLabel: this.activeLabel,\n allLabel: this.allLabel,\n anonWarning: this.anonWarning\n })),\n buttons: _.object([[_l('Cancel'), function () {\n modal.hide();\n }], [this.submitLabel, checkNameAndCopy]]),\n height: 'auto',\n closing_events: true,\n closing_callback: function _historyCopyClose(cancelled) {\n if (cancelled) {\n deferred.reject({ cancelled: true });\n }\n if (originalClosingCallback) {\n originalClosingCallback(cancelled);\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$('#copy-modal-title').focus().select();\n modal.$('#copy-modal-title').on('keydown', function (ev) {\n if (ev.keyCode === 13) {\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n }\n };\n\n //==============================================================================\n // maintain the (slight) distinction between copy and import\n /**\n * Subclass CopyDialog to use the import language.\n */\n var ImportDialog = _.extend({}, CopyDialog, {\n defaultName: _.template(\"imported: <%- name %>\"),\n title: _.template(_l('Importing history') + ' \"<%- name %>\"'),\n submitLabel: _l('Import'),\n errorMessage: _l('History could not be imported.'),\n progressive: _l('Importing history'),\n activeLabel: _l('Import only the active, non-deleted datasets'),\n allLabel: _l('Import all datasets including deleted ones'),\n anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after importing this history. ')\n\n });\n\n //==============================================================================\n /**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name:| Name | ' + 'Size | ' + 'Status | ' + '' + ' |
|---|
| ' + ' | ' + ' | Description | ' + 'Name | ' + 'Size | ' + 'Settings | ' + 'Status | ' + '
|---|
| Name | ' + 'Size | ' + 'Type | ' + 'Genome | ' + 'Settings | ' + 'Status | ' + '' + ' |
|---|
' + JSON.stringify( xhr.responseJSON ) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n\n 'click .reset' : 'reset',\n 'click .clear-selected' : 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements' : 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements' : '_dragoverElements',\n 'drop .collection-elements' : '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements' : '_elementDragstart',\n 'collection-element.dragend .collection-elements' : '_elementDragend',\n\n // footer\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset : function(){\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements : function( ev ){\n this.$( '.collection-elements .collection-element' ).removeClass( 'selected' );\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n//TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements : function( ev ){\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n var $nearest = this._getNearestElement( ev.originalEvent.clientY );\n\n //TODO: no need to re-create - move instead\n this.$( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.collection-elements li.collection-element' ).toArray();\n for( var i=0; i
', _l([\n 'Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ',\n 'workflows in order to have analyses done on each member of the entire group. This interface allows ',\n 'you to create a collection and re-order the final collection.'\n ].join( '' )), '
',\n '', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '
'\n ].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements : _.template([\n _l( 'The following selections could not be included due to problems:' ),\n '<%= dataset.peek %>',\n '<% } %>',\n '<% } %>',\n '
| ' +\n ' | Name | ' +\n 'Size | ' +\n 'Created | ' +\n '
|---|
' +\n 'You are using ' + options.nice_total_disk_usage + ' of disk space in this Galaxy instance. ' +\n ( Galaxy.config.enable_quotas ? 'Your disk quota is: ' + options.quota + '. ' : '' ) +\n 'Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.' +\n '
';\n }\n });\n\n /** View of individual user forms */\n var Forms = Backbone.View.extend({\n\n initialize: function( options ) {\n this.model = new Model( options );\n this.page = this.model.get( options.form_id );\n this.setElement( '' );\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url : Galaxy.root + this.page.url,\n type : 'GET'\n }).done( function( response ) {\n var options = $.extend( {}, self.page, response );\n var form = new Form({\n title : options.title,\n icon : options.icon,\n inputs : options.inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip : options.submit_tooltip,\n title : options.submit_title || 'Save settings',\n icon : options.submit_icon || 'fa-save',\n onclick : function() { self._submit( form, options ) }\n })\n }\n });\n self.$el.empty().append( form.$el );\n }).fail( function( response ) {\n self.$el.empty().append( new Ui.Message({\n message : 'Failed to load resource ' + self.page.url + '.',\n status : 'danger',\n persistent : true\n }).$el );\n });\n },\n\n _submit: function( form, options ) {\n var self = this;\n $.ajax( {\n url : Galaxy.root + options.url,\n data : JSON.stringify( form.data.create() ),\n type : 'PUT',\n contentType : 'application/json'\n }).done( function( response ) {\n var updated_values = false;\n form.data.matchModel( response, function ( input, input_id ) {\n form.field_list[ input_id ].value( input.value );\n updated_values = true;\n });\n form.message.update( { message: response.message, status: 'success' } );\n }).fail( function( response ) {\n window.console.log( response );\n form.message.update( { message: response.responseJSON.err_msg, status: 'danger' } );\n });\n }\n });\n\n return {\n View : View,\n Forms : Forms\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/user/user-preferences.js","define([\n //jquery\n //backbone\n], function(){\n//=============================================================================\n/**\n * backbone model for icon buttons\n */\nvar IconButton = Backbone.Model.extend({\n defaults: {\n title : \"\",\n icon_class : \"\",\n on_click : null,\n menu_options : null,\n is_menu_button : true,\n id : null,\n href : null,\n target : null,\n enabled : true,\n visible : true,\n tooltip_config : {}\n }\n});\n\n/**\n * backbone view for icon buttons\n */\nvar IconButtonView = Backbone.View.extend({\n\n initialize : function(){\n // better rendering this way\n this.model.attributes.tooltip_config = { placement : 'bottom' };\n this.model.bind( 'change', this.render, this );\n },\n\n render : function( ){\n // hide tooltip\n this.$el.tooltip( 'hide' );\n\n var new_elem = this.template( this.model.toJSON() );\n // configure tooltip\n new_elem.tooltip( this.model.get( 'tooltip_config' ));\n this.$el.replaceWith( new_elem );\n this.setElement( new_elem );\n return this;\n },\n\n events : {\n 'click' : 'click'\n },\n\n click : function( event ){\n // if on_click pass to that function\n if( _.isFunction( this.model.get( 'on_click' ) ) ){\n this.model.get( 'on_click' )( event );\n return false;\n }\n // otherwise, bubble up ( to href or whatever )\n return true;\n },\n\n // generate html element\n template: function( options ){\n var buffer = 'title=\"' + options.title + '\" class=\"icon-button';\n\n if( options.is_menu_button ){\n buffer += ' menu-button';\n }\n\n buffer += ' ' + options.icon_class;\n\n if( !options.enabled ){\n buffer += '_disabled';\n }\n\n // close class tag\n buffer += '\"';\n\n if( options.id ){\n buffer += ' id=\"' + options.id + '\"';\n }\n\n buffer += ' href=\"' + options.href + '\"';\n // add target for href\n if( options.target ){\n buffer += ' target=\"' + options.target + '\"';\n }\n // set visibility\n if( !options.visible ){\n buffer += ' style=\"display: none;\"';\n }\n\n // enabled/disabled\n if ( options.enabled ){\n buffer = '';\n } else {\n buffer = '';\n }\n\n // return element\n return $( buffer );\n }\n} );\n\n// define collection\nvar IconButtonCollection = Backbone.Collection.extend({\n model: IconButton\n});\n\n/**\n * menu with multiple icon buttons\n * views are not needed nor used for individual buttons\n */\nvar IconButtonMenuView = Backbone.View.extend({\n\n tagName: 'div',\n\n initialize: function(){\n this.render();\n },\n\n render: function(){\n // initialize icon buttons\n var self = this;\n this.collection.each(function(button){\n // create and add icon button to menu\n var elt = $('')\n .attr('href', 'javascript:void(0)')\n .attr('title', button.attributes.title)\n .addClass('icon-button menu-button')\n .addClass(button.attributes.icon_class)\n .appendTo(self.$el)\n .click(button.attributes.on_click);\n\n // configure tooltip\n if (button.attributes.tooltip_config){\n elt.tooltip(button.attributes.tooltip_config);\n }\n\n // add popup menu to icon\n var menu_options = button.get('options');\n if (menu_options){\n make_popupmenu(elt, menu_options);\n }\n });\n\n // return\n return this;\n }\n});\n\n/**\n * Returns an IconButtonMenuView for the provided configuration.\n * Configuration is a list of dictionaries where each dictionary\n * defines an icon button. Each dictionary must have the following\n * elements: icon_class, title, and on_click.\n */\nvar create_icon_buttons_menu = function(config, global_config)\n{\n // initialize global configuration\n if (!global_config) global_config = {};\n\n // create and initialize menu\n var buttons = new IconButtonCollection(\n _.map(config, function(button_config){\n return new IconButton(_.extend(button_config, global_config));\n })\n );\n\n // return menu\n return new IconButtonMenuView( {collection: buttons} );\n};\n\n\n//=============================================================================\n return {\n IconButton : IconButton,\n IconButtonView : IconButtonView,\n IconButtonCollection : IconButtonCollection,\n IconButtonMenuView : IconButtonMenuView,\n create_icon_buttons_menu: create_icon_buttons_menu\n };\n})\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/ui/icon-button.js","define(function(){\n\n/**\n * Stringifies a number adding commas for digit grouping as per North America.\n */\nfunction commatize( number ) {\n number += ''; // Convert to string\n var rgx = /(\\d+)(\\d{3})/;\n while (rgx.test(number)) {\n number = number.replace(rgx, '$1' + ',' + '$2');\n }\n return number;\n}\n\n/**\n * Helper to determine if object is jQuery deferred.\n */\nvar is_deferred = function ( d ) {\n return ('promise' in d);\n};\n\n/**\n * Implementation of a server-state based deferred. Server is repeatedly polled, and when\n * condition is met, deferred is resolved.\n */\nvar ServerStateDeferred = Backbone.Model.extend({\n defaults: {\n ajax_settings: {},\n interval: 1000,\n success_fn: function(result) { return true; }\n },\n\n /**\n * Returns a deferred that resolves when success function returns true.\n */\n go: function() {\n var deferred = $.Deferred(),\n self = this,\n ajax_settings = self.get('ajax_settings'),\n success_fn = self.get('success_fn'),\n interval = self.get('interval'),\n _go = function() {\n $.ajax(ajax_settings).success(function(result) {\n if (success_fn(result)) {\n // Result is good, so resolve.\n deferred.resolve(result);\n }\n else {\n // Result not good, try again.\n setTimeout(_go, interval);\n }\n });\n };\n _go();\n return deferred;\n }\n});\n\n/**\n * Returns a random color in hexadecimal format that is sufficiently different from a single color\n * or set of colors.\n * @param colors a color or list of colors in the format '#RRGGBB'\n */\nvar get_random_color = function(colors) {\n // Default for colors is white.\n if (!colors) { colors = \"#ffffff\"; }\n\n // If needed, create list of colors.\n if ( typeof(colors) === \"string\" ) {\n colors = [ colors ];\n }\n\n // Convert colors to numbers.\n for (var i = 0; i < colors.length; i++) {\n colors[i] = parseInt( colors[i].slice(1), 16 );\n }\n\n // -- Perceived brightness and difference formulas are from\n // -- http://www.w3.org/WAI/ER/WD-AERT/#color-contrast\n\n // Compute perceived color brightness (based on RGB-YIQ transformation):\n var brightness = function(r, g, b) {\n return ( (r * 299) + (g * 587) + (b * 114) ) / 1000;\n };\n\n // Compute color difference:\n var difference = function(r1, g1, b1, r2, g2, b2) {\n return ( Math.max(r1, r2) - Math.min(r1, r2) ) +\n ( Math.max(g1, g2) - Math.min(g1, g2) ) +\n ( Math.max(b1, b2) - Math.min(b1, b2) );\n };\n\n // Create new random color.\n var new_color, nr, ng, nb,\n other_color, or, og, ob,\n n_brightness, o_brightness,\n diff, ok = false,\n num_tries = 0;\n do {\n // New color is never white b/c random in [0,1)\n new_color = Math.round( Math.random() * 0xffffff );\n nr = ( new_color & 0xff0000 ) >> 16;\n ng = ( new_color & 0x00ff00 ) >> 8;\n nb = new_color & 0x0000ff;\n n_brightness = brightness(nr, ng, nb);\n ok = true;\n for (i = 0; i < colors.length; i++) {\n other_color = colors[i];\n or = ( other_color & 0xff0000 ) >> 16;\n og = ( other_color & 0x00ff00 ) >> 8;\n ob = other_color & 0x0000ff;\n o_brightness = brightness(or, og, ob);\n diff = difference(nr, ng, nb, or, og, ob);\n // These thresholds may need to be adjusted. Brightness difference range is 125;\n // color difference range is 500.\n if ( ( Math.abs(n_brightness - o_brightness) < 40 ) ||\n ( diff < 200 ) ) {\n ok = false;\n break;\n }\n }\n\n num_tries++\n; } while (!ok && num_tries <= 10 );\n\n // Add 0x1000000 to left pad number with 0s.\n return '#' + ( 0x1000000 + new_color ).toString(16).substr(1,6);\n};\n\nreturn {\n commatize: commatize,\n is_deferred: is_deferred,\n ServerStateDeferred : ServerStateDeferred,\n get_random_color : get_random_color\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/viz/trackster/util.js","/**\n * Parser.js\n * Copyright 2012-13 Mayank Lahiri\n * mlahiri@gmail.com\n * Released under the BSD License.\n *\n * A forgiving Bibtex parser that can:\n * \n * (1) operate in streaming or block mode, extracting entries as dictionaries. \n * (2) convert Latex special characters to UTF-8.\n * (3) best-effort parse malformed entries.\n * (4) run in a CommonJS environment or a browser, without any dependencies.\n * (5) be advanced-compiled by Google Closure Compiler.\n * \n * Handwritten as a labor of love, not auto-generated from a grammar. \n *\n * Modes of usage:\n *\n * (1) Synchronous, string\n *\n * var entries = BibtexParser(text);\n * console.log(entries);\n *\n * (2) Asynchronous, stream\n *\n * var entryCallback = function(entry) { console.log(entry); }\n * var parser = new BibtexParser(entryCallback);\n * parser.parse(chunk1);\n * parser.parse(chunk2);\n * ...\n * \n * @param {text|function(Object)} arg Either a Bibtex string or callback \n * function for processing parsed entries.\n * @constructor\n */\nfunction BibtexParser(arg0) {\n // Determine how this function is to be used\n if (typeof arg0 == 'string') {\n // Passed a string, synchronous call without 'new'\n var tempStorage = {};\n var entries = [];\n function accumulator(entry) {\n entries.push(entry);\n }\n var parser = BibtexParser.call(tempStorage, accumulator);\n parser.parse(arg0);\n return {\n 'entries': entries,\n 'errors': parser.getErrors()\n }\n }\n if (typeof arg0 != 'function') {\n throw 'Invalid parser construction.';\n }\n\n /** @enum {number} */\n this.STATES_ = {\n ENTRY_OR_JUNK: 0,\n OBJECT_TYPE: 1,\n ENTRY_KEY: 2, \n KV_KEY: 3, \n EQUALS: 4,\n KV_VALUE: 5 \n }\n /** @private */ this.DATA_ = {};\n /** @private */ this.CALLBACK_ = arg0;\n /** @private */ this.CHAR_ = 0;\n /** @private */ this.LINE_ = 1;\n /** @private */ this.CHAR_IN_LINE_ = 0;\n /** @private */ this.SKIPWS_ = true;\n /** @private */ this.SKIPCOMMENT_ = true;\n /** @private */ this.PARSETMP_ = {};\n /** @private */ this.SKIPTILLEOL_ = false;\n /** @private */ this.VALBRACES_ = null;\n /** @private */ this.BRACETYPE_ = null;\n /** @private */ this.BRACECOUNT_ = 0;\n /** @private */ this.STATE_ = this.STATES_.ENTRY_OR_JUNK;\n /** @private */ this.ERRORS_ = [];\n /** @private */ this.ENTRY_TYPES_ = {\n 'inproceedings' : 1,\n 'proceedings' : 2,\n 'article' : 3,\n 'techreport' : 4,\n 'misc' : 5,\n 'mastersthesis' : 6,\n 'book' : 7,\n 'phdthesis' : 8,\n 'incollection' : 9,\n 'unpublished' : 10,\n 'inbook' : 11,\n 'manual' : 12,\n 'periodical' : 13,\n 'booklet' : 14,\n 'masterthesis' : 15,\n 'conference' : 16\n ,'online' : 998 // Galaxy MOD: Handle @online entries for preprints.\n ,'data' : 999 // Galaxy MOD: Handle @data citations coming from figshare.\n }\n /** @private */ this.MACROS_ = {\n 'jan' : 'January',\n 'feb' : 'February',\n 'mar' : 'March',\n 'apr' : 'April',\n 'may' : 'May',\n 'jun' : 'June',\n 'jul' : 'July',\n 'aug' : 'August',\n 'sep' : 'September',\n 'oct' : 'October',\n 'nov' : 'November',\n 'dec' : 'December',\n 'Jan' : 'January',\n 'Feb' : 'February',\n 'Mar' : 'March',\n 'Apr' : 'April',\n 'May' : 'May',\n 'Jun' : 'June',\n 'Jul' : 'July',\n 'Aug' : 'August',\n 'Sep' : 'September',\n 'Oct' : 'October',\n 'Nov' : 'November',\n 'Dec' : 'December'\n }\n\n /**\n * Gets an array of all errors encountered during parsing.\n * Array entries are of the format:\n * [ line number, character in line, character in stream, error text ]\n *\n * @returns Array\" + this.formattedReference() + \"
\" );\n return this;\n },\n formattedReference: function() {\n var model = this.model;\n var entryType = model.entryType();\n var fields = model.fields();\n\n var ref = \"\";\n // Code inspired by...\n // https://github.com/vkaravir/bib-publication-list/blob/master/src/bib-publication-list.js\n var authorsAndYear = this._asSentence( (fields.author ? fields.author : \"\") + (fields.year ? (\" (\" + fields.year + \")\") : \"\") ) + \" \";\n var title = fields.title || \"\";\n var pages = fields.pages ? (\"pp. \" + fields.pages) : \"\";\n var address = fields.address;\n if( entryType == \"article\" ) {\n var volume = (fields.volume ? fields.volume : \"\") +\n (fields.number ? ( \" (\" + fields.number + \")\" ) : \"\") +\n (pages ? \", \" + pages : \"\");\n ref = authorsAndYear + this._asSentence(title) +\n (fields.journal ? (\"In \" + fields.journal + \", \") : \"\") +\n this._asSentence(volume) + \n this._asSentence(fields.address) +\n \"<\\/em>\";\n } else if( entryType == \"inproceedings\" || entryType == \"proceedings\" ) {\n ref = authorsAndYear + \n this._asSentence(title) + \n (fields.booktitle ? (\"In \" + fields.booktitle + \", \") : \"\") +\n (pages ? pages : \"\") +\n (address ? \", \" + address : \"\") + \n \".<\\/em>\";\n } else if( entryType == \"mastersthesis\" || entryType == \"phdthesis\" ) {\n ref = authorsAndYear + this._asSentence(title) +\n (fields.howpublished ? fields.howpublished + \". \" : \"\") +\n (fields.note ? fields.note + \".\" : \"\");\n } else if( entryType == \"techreport\" ) {\n ref = authorsAndYear + this._asSentence(title) +\n this._asSentence(fields.institution) +\n this._asSentence(fields.number) +\n this._asSentence(fields.type);\n } else if( entryType == \"book\" || entryType == \"inbook\" || entryType == \"incollection\" ) {\n ref = authorsAndYear + \" \" + this._formatBookInfo(fields);\n } else {\n ref = authorsAndYear + \" \" + this._asSentence(title) +\n this._asSentence(fields.howpublished) +\n this._asSentence(fields.note);\n }\n var doiUrl = \"\";\n if( fields.doi ) {\n doiUrl = 'http://dx.doi.org/' + fields.doi;\n ref += '[doi:' + fields.doi + \"]\";\n }\n var url = fields.url || doiUrl;\n if( url ) {\n ref += '[Link]';\n }\n return ref;\n },\n _formatBookInfo: function(fields) {\n var info = \"\";\n if( fields.chapter ) {\n info += fields.chapter + \" in \";\n }\n if( fields.title ) {\n info += \"\" + fields.title + \"<\\/em>\";\n }\n if( fields.editor ) {\n info += \", Edited by \" + fields.editor + \", \";\n }\n if( fields.publisher) {\n info += \", \" + fields.publisher;\n }\n if( fields.pages ) {\n info += \", pp. \" + fields.pages + \"\";\n }\n if( fields.series ) {\n info += \", \" + fields.series + \"<\\/em>\";\n }\n if( fields.volume ) {\n info += \", Vol.\" + fields.volume;\n }\n if( fields.issn ) {\n info += \", ISBN: \" + fields.issn;\n }\n return info + \".\";\n },\n _asSentence: function(str) {\n return (str && str.trim()) ? str + \". \" : \"\";\n }\n});\n\nvar CitationListView = Backbone.View.extend({\n el: '#citations',\n /**\n * Set up view.\n */\n initialize: function() {\n this.listenTo( this.collection, 'add', this.renderCitation );\n },\n\n events: {\n 'click .citations-to-bibtex': 'showBibtex',\n 'click .citations-to-formatted': 'showFormatted'\n },\n\n renderCitation: function( citation ) {\n var citationView = new CitationView( { model: citation } );\n this.$(\".citations-formatted\").append( citationView.render().el );\n var rawTextarea = this.$(\".citations-bibtex-text\");\n rawTextarea.val( rawTextarea.val() + \"\\n\\r\" + citation.attributes.content );\n },\n\n render: function() {\n this.$el.html(this.citationsElement());\n this.collection.each(function( item ){\n this.renderCitation( item );\n }, this);\n this.showFormatted();\n },\n\n showBibtex: function() {\n this.$(\".citations-to-formatted\").show();\n this.$(\".citations-to-bibtex\").hide();\n this.$(\".citations-bibtex\").show();\n this.$(\".citations-formatted\").hide();\n this.$(\".citations-bibtex-text\").select();\n },\n\n showFormatted: function() {\n this.$(\".citations-to-formatted\").hide();\n this.$(\".citations-to-bibtex\").show();\n this.$(\".citations-bibtex\").hide();\n this.$(\".citations-formatted\").show();\n },\n\n partialWarningElement: function() {\n if( this.collection.partial ) {\n return [\n '' + JSON.stringify( xhr.responseJSON ) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n //this.debug( '-- _renderHeader' );\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters : function(){\n return this.$( '.forward-column .column-header input' ).val( this.filters[0] )\n .add( this.$( '.reverse-column .column-header input' ).val( this.filters[1] ) );\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n\n // (re-) hide the un/paired panels based on instance vars\n if( this.unpairedPanelHidden ){\n this.$( '.unpaired-columns' ).hide();\n } else if( this.pairedPanelHidden ){\n this.$( '.paired-columns' ).hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired : function( speed, callback ){\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd, $rev, $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$( '.forward-column .title' )\n .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n this.$( '.forward-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n this.$( '.reverse-column .title' )\n .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n this.$( '.reverse-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[1].length ) );\n\n this.$( '.unpaired-columns .column-datasets' ).empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$( '.autopair-link' ).toggle( this.unpaired.length !== 0 );\n if( this.unpaired.length === 0 ){\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map( function( dataset, i ){\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if( ( split[0][ i ] !== undefined )\n && ( split[0][ i ] !== dataset ) ){\n $prd.push( creator._renderPairButton() );\n }\n return creator._renderUnpairedDataset( dataset );\n });\n $fwd = split[0].map( function( dataset ){\n return creator._renderUnpairedDataset( dataset );\n });\n\n if( !$fwd.length && !$rev.length ){\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$( '.unpaired-columns .forward-column .column-datasets' ).append( $fwd )\n .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n .add( this.$( '.unpaired-columns .reverse-column .column-datasets' ).append( $rev ) );\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr : function( numFiltered ){\n return [ '(', numFiltered, ' ', _l( 'filtered out' ), ')' ].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset : function( dataset ){\n //TODO: to underscore template\n return $( '')\n .attr( 'id', 'dataset-' + dataset.id )\n .addClass( 'dataset unpaired' )\n .attr( 'draggable', true )\n .addClass( dataset.selected? 'selected': '' )\n .append( $( '' ).addClass( 'dataset-name' ).text( dataset.name ) )\n //??\n .data( 'dataset', dataset );\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton : function(){\n //TODO: *not* a dataset - don't pretend like it is\n return $( '').addClass( 'dataset unpaired' )\n .append( $( '' ).addClass( 'dataset-name' ).text( _l( 'Pair these datasets' ) ) );\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '' )\n .text( '(' + _l( 'no remaining unpaired datasets' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '' )\n .text( '(' + _l( 'no datasets were found matching the current filters' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar : function(){\n var $unpairedColumns = this.$( '.unpaired-columns' ).last(),\n $firstDataset = this.$( '.unpaired-columns .reverse-column .dataset' ).first();\n if( !$firstDataset.length ){ return; }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor( ucRight ) - Math.floor( dsRight );\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$( '.unpaired-columns .forward-column' )\n .css( 'margin-left', ( rightDiff > 0 )? rightDiff: 0 );\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired : function( speed, callback ){\n //this.debug( '-- _renderPaired' );\n this.$( '.paired-column-title .title' ).text([ this.paired.length, _l( 'paired' ) ].join( ' ' ) );\n // show/hide the unpair all link\n this.$( '.unpair-all-link' ).toggle( this.paired.length !== 0 );\n if( this.paired.length === 0 ){\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$( '.remove-extensions-link' ).show();\n }\n\n this.$( '.paired-columns .column-datasets' ).empty();\n var creator = this;\n this.paired.forEach( function( pair, i ){\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$( '.paired-columns .column-datasets' )\n .append( pairView.render().$el )\n .append([\n ''\n ].join( '' ));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty : function(){\n var $msg = $( '' )\n .text( '(' + _l( 'no paired datasets yet' ) + ')' );\n this.$( '.paired-columns .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this._chooseFiltersPopover( '.choose-filters-link' );\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', 'rgba( 64, 255, 255, 1.0 )' );\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover : function( selector ){\n function filterChoice( val1, val2 ){\n return [\n ''\n ].join('');\n }\n var $popoverContent = $( _.template([\n '
', _l([\n 'Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ',\n 'These collections can be passed to tools and workflows in order to have analyses done on each member of ',\n 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ',\n 'and re-order the final collection.'\n ].join( '' )), '
',\n '', _l([\n 'Unpaired datasets are shown in the unpaired section ',\n '(hover over the underlined words to highlight below). ',\n 'Paired datasets are shown in the paired section.',\n '
', _l([\n '
', _l([\n 'To unpair individual dataset pairs, click the ',\n 'unpair buttons ( ). ',\n 'Click the \"Unpair all\" link to unpair all pairs.'\n ].join( '' )), '
',\n '', _l([\n 'You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ',\n '\"Remove file extensions from pair names?\" control.'\n ].join( '' )), '
',\n '', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\". ',\n '(Note: you do not have to pair all unpaired datasets to finish.)'\n ].join( '' )), '
'\n ].join(''))\n })\n});\n\n//=============================================================================\n/** a modal version of the paired collection creator */\nvar pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults( options || {}, {\n datasets : datasets,\n oncancel : function(){\n Galaxy.modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n Galaxy.modal.hide();\n deferred.resolve( response );\n }\n });\n\n if( !window.Galaxy || !Galaxy.modal ){\n throw new Error( 'Galaxy or Galaxy.modal not found' );\n }\n\n creator = new PairedCollectionCreator( options );\n Galaxy.modal.show({\n title : 'Create a collection of paired datasets',\n body : creator.$el,\n width : '80%',\n height : '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n\n//=============================================================================\nfunction createListOfPairsCollection( collection, defaultHideSourceItems ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js","define([\n \"mvc/collection/list-collection-creator\",\n \"mvc/history/hdca-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/*==============================================================================\nTODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n\n==============================================================================*/\n/** */\nvar PairedDatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .html( this.template({ identifier: this.identifier, element: this.element }) );\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '<%- identifier %>',\n '<%- element.name %>',\n ].join('')),\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\nvar _super = LIST_CREATOR.ListCollectionCreator;\n\n/** An interface for building collections.\n */\nvar PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass : PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryPairDatasetCollection,\n className : 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames : function(){},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render : function( speed, callback ){\n if( this.workingElements.length === 2 ){\n return _super.prototype.render.call( this, speed, callback );\n }\n return this._renderInvalid( speed, callback );\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery( '' ),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n $tmp.append( creator._createForwardElementView().$el );\n $tmp.append( creator._createReverseElementView().$el );\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n },\n\n /** create the forward element view */\n _createForwardElementView : function(){\n return this._createElementView( this.workingElements[0], { identifier: 'forward' } );\n },\n\n /** create the forward element view */\n _createReverseElementView : function(){\n return this._createElementView( this.workingElements[1], { identifier: 'reverse' } );\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView : function( element, options ){\n var elementView = new this.elementViewClass( _.extend( options, {\n element : element,\n }));\n this.elementViews.push( elementView );\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap : function(){\n this.workingElements = [\n this.workingElements[1],\n this.workingElements[0],\n ];\n this._renderList();\n },\n\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .swap' : 'swap',\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend( _.clone( _super.prototype.templates ), {\n /** the middle: element list */\n middle : _.template([\n '', _l([\n 'Pair collections are permanent collections containing two datasets: one forward and one reverse. ',\n 'Often these are forward and reverse reads. The pair collections can be passed to tools and ',\n 'workflows in order to have analyses done on both datasets. This interface allows ',\n 'you to create a pair, name it, and swap which is forward and which reverse.'\n ].join( '' )), '
',\n '', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '
'\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '' + this.progressive + '...
';\n this.modal.$( '.modal-body' ).empty().append( indicator ).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog : function _dialog( modal, history, options ){\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined( options.allowAll )? options.allowAll : true,\n autoClose = !_.isUndefined( options.autoClose )? options.autoClose : true;\n\n this.modal = modal;\n\n\n // validate the name and copy if good\n function checkNameAndCopy(){\n var name = modal.$( '#copy-modal-title' ).val();\n if( !name ){\n modal.$( '.invalid-title' ).show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$( 'input[name=\"copy-what\"]:checked' ).val() === 'copy-all';\n modal.$( 'button' ).prop( 'disabled', true );\n dialog._showAjaxIndicator();\n history.copy( true, name, copyAllDatasets )\n .done( function( response ){\n deferred.resolve( response );\n })\n .fail( function( xhr, status, message ){\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal( history, xhr, options, dialog.errorMessage );\n deferred.rejectWith( deferred, arguments );\n })\n .done( function(){\n if( autoClose ){ modal.hide(); }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show( _.extend( options, {\n title : this.title({ name: history.get( 'name' ) }),\n body : $( dialog._template({\n name : defaultCopyName,\n isAnon : Galaxy.user.isAnonymous(),\n allowAll : allowAll,\n copyWhat : defaultCopyWhat,\n activeLabel : this.activeLabel,\n allLabel : this.allLabel,\n anonWarning : this.anonWarning,\n })),\n buttons : _.object([\n [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n [ this.submitLabel, checkNameAndCopy ]\n ]),\n height : 'auto',\n closing_events : true,\n closing_callback: function _historyCopyClose( cancelled ){\n if( cancelled ){\n deferred.reject({ cancelled : true });\n }\n if( originalClosingCallback ){\n originalClosingCallback( cancelled );\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$( '#copy-modal-title' ).focus().select();\n modal.$( '#copy-modal-title' ).on( 'keydown', function( ev ){\n if( ev.keyCode === 13 ){\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n },\n};\n\n//==============================================================================\n// maintain the (slight) distinction between copy and import\n/**\n * Subclass CopyDialog to use the import language.\n */\nvar ImportDialog = _.extend( {}, CopyDialog, {\n defaultName : _.template( \"imported: <%- name %>\" ),\n title : _.template( _l( 'Importing history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Import' ),\n errorMessage : _l( 'History could not be imported.' ),\n progressive : _l( 'Importing history' ),\n activeLabel : _l( 'Import only the active, non-deleted datasets' ),\n allLabel : _l( 'Import all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after importing this history. ' ),\n\n});\n\n//==============================================================================\n/**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name:| Name | ' +\n 'Size | ' +\n 'Status | ' +\n '' +\n ' |
|---|
| ' +\n ' | ' +\n ' | Description | ' +\n 'Name | ' +\n 'Size | ' +\n 'Settings | ' +\n 'Status | ' +\n '
|---|
| Name | ' +\n 'Size | ' +\n 'Type | ' +\n 'Genome | ' +\n 'Settings | ' +\n 'Status | ' +\n '' +\n ' |
|---|
' + JSON.stringify(xhr.responseJSON) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert(content, 'alert-danger');\n },\n\n events: {\n // header\n 'click .more-help': '_clickMoreHelp',\n 'click .less-help': '_clickLessHelp',\n 'click .main-help': '_toggleHelp',\n 'click .header .alert button': '_hideAlert',\n\n 'click .reset': 'reset',\n 'click .clear-selected': 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements': 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements': '_dragoverElements',\n 'drop .collection-elements': '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements': '_elementDragstart',\n 'collection-element.dragend .collection-elements': '_elementDragend',\n\n // footer\n 'change .collection-name': '_changeName',\n 'keydown .collection-name': '_nameCheckForEnter',\n 'change .hide-originals': '_changeHideOriginals',\n 'click .cancel-create': '_cancelCreate',\n 'click .create-collection': '_clickCreate' //,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset: function reset() {\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements: function clearSelectedElements(ev) {\n this.$('.collection-elements .collection-element').removeClass('selected');\n this.$('.collection-elements-controls > .clear-selected').hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n //TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements: function _dragoverElements(ev) {\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll($list, ev.originalEvent.clientY);\n var $nearest = this._getNearestElement(ev.originalEvent.clientY);\n\n //TODO: no need to re-create - move instead\n this.$('.element-drop-placeholder').remove();\n var $placeholder = $('');\n if (!$nearest.length) {\n $list.append($placeholder);\n } else {\n $nearest.before($placeholder);\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll: function _checkForAutoscroll($element, y) {\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = offset.top + $element.outerHeight() - y;\n if (upperDist >= 0 && upperDist < this.autoscrollDist) {\n $element.scrollTop(scrollTop - AUTOSCROLL_SPEED);\n } else if (lowerDist >= 0 && lowerDist < this.autoscrollDist) {\n $element.scrollTop(scrollTop + AUTOSCROLL_SPEED);\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement: function _getNearestElement(y) {\n var WIGGLE = 4,\n lis = this.$('.collection-elements li.collection-element').toArray();\n for (var i = 0; i < lis.length; i++) {\n var $li = $(lis[i]),\n top = $li.offset().top,\n halfHeight = Math.floor($li.outerHeight() / 2) + WIGGLE;\n if (top + halfHeight > y && top - halfHeight < y) {\n return $li;\n }\n }\n return $();\n },\n\n /** drop (dragged/selected elements) onto the list, re-ordering the internal list */\n _dropElements: function _dropElements(ev) {\n if (ev.originalEvent) {\n ev = ev.originalEvent;\n }\n // both required for firefox\n ev.preventDefault();\n ev.dataTransfer.dropEffect = 'move';\n\n // insert before the nearest element or after the last.\n var $nearest = this._getNearestElement(ev.clientY);\n if ($nearest.length) {\n this.$dragging.insertBefore($nearest);\n } else {\n // no nearest before - insert after last element\n this.$dragging.insertAfter(this.$('.collection-elements .collection-element').last());\n }\n // resync the creator's list based on the new DOM order\n this._syncOrderToDom();\n return false;\n },\n\n /** resync the creator's list of elements based on the DOM order */\n _syncOrderToDom: function _syncOrderToDom() {\n var creator = this,\n newElements = [];\n //TODO: doesn't seem wise to use the dom to store these - can't we sync another way?\n this.$('.collection-elements .collection-element').each(function () {\n var id = $(this).attr('data-element-id'),\n element = _.findWhere(creator.workingElements, { id: id });\n if (element) {\n newElements.push(element);\n } else {\n console.error('missing element: ', id);\n }\n });\n this.workingElements = newElements;\n this._renderList();\n },\n\n /** drag communication with element sub-views: dragstart */\n _elementDragstart: function _elementDragstart(ev, element) {\n // auto select the element causing the event and move all selected\n element.select(true);\n this.$dragging = this.$('.collection-elements .collection-element.selected');\n },\n\n /** drag communication with element sub-views: dragend - remove the placeholder */\n _elementDragend: function _elementDragend(ev, element) {\n $('.element-drop-placeholder').remove();\n this.$dragging = null;\n },\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates: _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, {\n\n /** the header (not including help text) */\n header: _.template(['
', _l(['Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ', 'workflows in order to have analyses done on each member of the entire group. This interface allows ', 'you to create a collection and re-order the final collection.'].join('')), '
', '', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '
'].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements: _.template([_l('The following selections could not be included due to problems:'), '<%= dataset.peek %>', '<% } %>', '<% } %>', '
| ' + ' | Name | ' + 'Size | ' + 'Created | ' + '
|---|
' + 'You are using ' + options.nice_total_disk_usage + ' of disk space in this Galaxy instance. ' + (Galaxy.config.enable_quotas ? 'Your disk quota is: ' + options.quota + '. ' : '') + 'Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.' + '
';\n }\n });\n\n /** View of individual user forms */\n var Forms = Backbone.View.extend({\n\n initialize: function initialize(options) {\n this.model = new Model(options);\n this.page = this.model.get(options.form_id);\n this.setElement('');\n this.render();\n },\n\n render: function render() {\n var self = this;\n $.ajax({\n url: Galaxy.root + this.page.url,\n type: 'GET'\n }).done(function (response) {\n var options = $.extend({}, self.page, response);\n var form = new Form({\n title: options.title,\n icon: options.icon,\n inputs: options.inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip: options.submit_tooltip,\n title: options.submit_title || 'Save settings',\n icon: options.submit_icon || 'fa-save',\n onclick: function onclick() {\n self._submit(form, options);\n }\n })\n }\n });\n self.$el.empty().append(form.$el);\n }).fail(function (response) {\n self.$el.empty().append(new Ui.Message({\n message: 'Failed to load resource ' + self.page.url + '.',\n status: 'danger',\n persistent: true\n }).$el);\n });\n },\n\n _submit: function _submit(form, options) {\n var self = this;\n $.ajax({\n url: Galaxy.root + options.url,\n data: JSON.stringify(form.data.create()),\n type: 'PUT',\n contentType: 'application/json'\n }).done(function (response) {\n var updated_values = false;\n form.data.matchModel(response, function (input, input_id) {\n form.field_list[input_id].value(input.value);\n updated_values = true;\n });\n form.message.update({ message: response.message, status: 'success' });\n }).fail(function (response) {\n window.console.log(response);\n form.message.update({ message: response.responseJSON.err_msg, status: 'danger' });\n });\n }\n });\n\n return {\n View: View,\n Forms: Forms\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 76 */,\n/* 77 */,\n/* 78 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _, $) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n //jquery\n //backbone\n], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n //=============================================================================\n /**\n * backbone model for icon buttons\n */\n var IconButton = Backbone.Model.extend({\n defaults: {\n title: \"\",\n icon_class: \"\",\n on_click: null,\n menu_options: null,\n is_menu_button: true,\n id: null,\n href: null,\n target: null,\n enabled: true,\n visible: true,\n tooltip_config: {}\n }\n });\n\n /**\n * backbone view for icon buttons\n */\n var IconButtonView = Backbone.View.extend({\n\n initialize: function initialize() {\n // better rendering this way\n this.model.attributes.tooltip_config = { placement: 'bottom' };\n this.model.bind('change', this.render, this);\n },\n\n render: function render() {\n // hide tooltip\n this.$el.tooltip('hide');\n\n var new_elem = this.template(this.model.toJSON());\n // configure tooltip\n new_elem.tooltip(this.model.get('tooltip_config'));\n this.$el.replaceWith(new_elem);\n this.setElement(new_elem);\n return this;\n },\n\n events: {\n 'click': 'click'\n },\n\n click: function click(event) {\n // if on_click pass to that function\n if (_.isFunction(this.model.get('on_click'))) {\n this.model.get('on_click')(event);\n return false;\n }\n // otherwise, bubble up ( to href or whatever )\n return true;\n },\n\n // generate html element\n template: function template(options) {\n var buffer = 'title=\"' + options.title + '\" class=\"icon-button';\n\n if (options.is_menu_button) {\n buffer += ' menu-button';\n }\n\n buffer += ' ' + options.icon_class;\n\n if (!options.enabled) {\n buffer += '_disabled';\n }\n\n // close class tag\n buffer += '\"';\n\n if (options.id) {\n buffer += ' id=\"' + options.id + '\"';\n }\n\n buffer += ' href=\"' + options.href + '\"';\n // add target for href\n if (options.target) {\n buffer += ' target=\"' + options.target + '\"';\n }\n // set visibility\n if (!options.visible) {\n buffer += ' style=\"display: none;\"';\n }\n\n // enabled/disabled\n if (options.enabled) {\n buffer = '';\n } else {\n buffer = '';\n }\n\n // return element\n return $(buffer);\n }\n });\n\n // define collection\n var IconButtonCollection = Backbone.Collection.extend({\n model: IconButton\n });\n\n /**\n * menu with multiple icon buttons\n * views are not needed nor used for individual buttons\n */\n var IconButtonMenuView = Backbone.View.extend({\n\n tagName: 'div',\n\n initialize: function initialize() {\n this.render();\n },\n\n render: function render() {\n // initialize icon buttons\n var self = this;\n this.collection.each(function (button) {\n // create and add icon button to menu\n var elt = $('').attr('href', 'javascript:void(0)').attr('title', button.attributes.title).addClass('icon-button menu-button').addClass(button.attributes.icon_class).appendTo(self.$el).click(button.attributes.on_click);\n\n // configure tooltip\n if (button.attributes.tooltip_config) {\n elt.tooltip(button.attributes.tooltip_config);\n }\n\n // add popup menu to icon\n var menu_options = button.get('options');\n if (menu_options) {\n make_popupmenu(elt, menu_options);\n }\n });\n\n // return\n return this;\n }\n });\n\n /**\n * Returns an IconButtonMenuView for the provided configuration.\n * Configuration is a list of dictionaries where each dictionary\n * defines an icon button. Each dictionary must have the following\n * elements: icon_class, title, and on_click.\n */\n var create_icon_buttons_menu = function create_icon_buttons_menu(config, global_config) {\n // initialize global configuration\n if (!global_config) global_config = {};\n\n // create and initialize menu\n var buttons = new IconButtonCollection(_.map(config, function (button_config) {\n return new IconButton(_.extend(button_config, global_config));\n }));\n\n // return menu\n return new IconButtonMenuView({ collection: buttons });\n };\n\n //=============================================================================\n return {\n IconButton: IconButton,\n IconButtonView: IconButtonView,\n IconButtonCollection: IconButtonCollection,\n IconButtonMenuView: IconButtonMenuView,\n create_icon_buttons_menu: create_icon_buttons_menu\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(0)))\n\n/***/ }),\n/* 79 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, $) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\n /**\n * Stringifies a number adding commas for digit grouping as per North America.\n */\n function commatize(number) {\n number += ''; // Convert to string\n var rgx = /(\\d+)(\\d{3})/;\n while (rgx.test(number)) {\n number = number.replace(rgx, '$1' + ',' + '$2');\n }\n return number;\n }\n\n /**\n * Helper to determine if object is jQuery deferred.\n */\n var is_deferred = function is_deferred(d) {\n return 'promise' in d;\n };\n\n /**\n * Implementation of a server-state based deferred. Server is repeatedly polled, and when\n * condition is met, deferred is resolved.\n */\n var ServerStateDeferred = Backbone.Model.extend({\n defaults: {\n ajax_settings: {},\n interval: 1000,\n success_fn: function success_fn(result) {\n return true;\n }\n },\n\n /**\n * Returns a deferred that resolves when success function returns true.\n */\n go: function go() {\n var deferred = $.Deferred(),\n self = this,\n ajax_settings = self.get('ajax_settings'),\n success_fn = self.get('success_fn'),\n interval = self.get('interval'),\n _go = function _go() {\n $.ajax(ajax_settings).success(function (result) {\n if (success_fn(result)) {\n // Result is good, so resolve.\n deferred.resolve(result);\n } else {\n // Result not good, try again.\n setTimeout(_go, interval);\n }\n });\n };\n _go();\n return deferred;\n }\n });\n\n /**\n * Returns a random color in hexadecimal format that is sufficiently different from a single color\n * or set of colors.\n * @param colors a color or list of colors in the format '#RRGGBB'\n */\n var get_random_color = function get_random_color(colors) {\n // Default for colors is white.\n if (!colors) {\n colors = \"#ffffff\";\n }\n\n // If needed, create list of colors.\n if (typeof colors === \"string\") {\n colors = [colors];\n }\n\n // Convert colors to numbers.\n for (var i = 0; i < colors.length; i++) {\n colors[i] = parseInt(colors[i].slice(1), 16);\n }\n\n // -- Perceived brightness and difference formulas are from\n // -- http://www.w3.org/WAI/ER/WD-AERT/#color-contrast\n\n // Compute perceived color brightness (based on RGB-YIQ transformation):\n var brightness = function brightness(r, g, b) {\n return (r * 299 + g * 587 + b * 114) / 1000;\n };\n\n // Compute color difference:\n var difference = function difference(r1, g1, b1, r2, g2, b2) {\n return Math.max(r1, r2) - Math.min(r1, r2) + (Math.max(g1, g2) - Math.min(g1, g2)) + (Math.max(b1, b2) - Math.min(b1, b2));\n };\n\n // Create new random color.\n var new_color,\n nr,\n ng,\n nb,\n other_color,\n or,\n og,\n ob,\n n_brightness,\n o_brightness,\n diff,\n ok = false,\n num_tries = 0;\n do {\n // New color is never white b/c random in [0,1)\n new_color = Math.round(Math.random() * 0xffffff);\n nr = (new_color & 0xff0000) >> 16;\n ng = (new_color & 0x00ff00) >> 8;\n nb = new_color & 0x0000ff;\n n_brightness = brightness(nr, ng, nb);\n ok = true;\n for (i = 0; i < colors.length; i++) {\n other_color = colors[i];\n or = (other_color & 0xff0000) >> 16;\n og = (other_color & 0x00ff00) >> 8;\n ob = other_color & 0x0000ff;\n o_brightness = brightness(or, og, ob);\n diff = difference(nr, ng, nb, or, og, ob);\n // These thresholds may need to be adjusted. Brightness difference range is 125;\n // color difference range is 500.\n if (Math.abs(n_brightness - o_brightness) < 40 || diff < 200) {\n ok = false;\n break;\n }\n }\n\n num_tries++;\n } while (!ok && num_tries <= 10);\n\n // Add 0x1000000 to left pad number with 0s.\n return '#' + (0x1000000 + new_color).toString(16).substr(1, 6);\n };\n\n return {\n commatize: commatize,\n is_deferred: is_deferred,\n ServerStateDeferred: ServerStateDeferred,\n get_random_color: get_random_color\n };\n}.call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0)))\n\n/***/ }),\n/* 80 */\n/***/ (function(module, exports) {\n\n/**\n * Parser.js\n * Copyright 2012-13 Mayank Lahiri\n * mlahiri@gmail.com\n * Released under the BSD License.\n *\n * A forgiving Bibtex parser that can:\n * \n * (1) operate in streaming or block mode, extracting entries as dictionaries. \n * (2) convert Latex special characters to UTF-8.\n * (3) best-effort parse malformed entries.\n * (4) run in a CommonJS environment or a browser, without any dependencies.\n * (5) be advanced-compiled by Google Closure Compiler.\n * \n * Handwritten as a labor of love, not auto-generated from a grammar. \n *\n * Modes of usage:\n *\n * (1) Synchronous, string\n *\n * var entries = BibtexParser(text);\n * console.log(entries);\n *\n * (2) Asynchronous, stream\n *\n * var entryCallback = function(entry) { console.log(entry); }\n * var parser = new BibtexParser(entryCallback);\n * parser.parse(chunk1);\n * parser.parse(chunk2);\n * ...\n * \n * @param {text|function(Object)} arg Either a Bibtex string or callback \n * function for processing parsed entries.\n * @constructor\n */\nfunction BibtexParser(arg0) {\n // Determine how this function is to be used\n if (typeof arg0 == 'string') {\n // Passed a string, synchronous call without 'new'\n var tempStorage = {};\n var entries = [];\n function accumulator(entry) {\n entries.push(entry);\n }\n var parser = BibtexParser.call(tempStorage, accumulator);\n parser.parse(arg0);\n return {\n 'entries': entries,\n 'errors': parser.getErrors()\n }\n }\n if (typeof arg0 != 'function') {\n throw 'Invalid parser construction.';\n }\n\n /** @enum {number} */\n this.STATES_ = {\n ENTRY_OR_JUNK: 0,\n OBJECT_TYPE: 1,\n ENTRY_KEY: 2, \n KV_KEY: 3, \n EQUALS: 4,\n KV_VALUE: 5 \n }\n /** @private */ this.DATA_ = {};\n /** @private */ this.CALLBACK_ = arg0;\n /** @private */ this.CHAR_ = 0;\n /** @private */ this.LINE_ = 1;\n /** @private */ this.CHAR_IN_LINE_ = 0;\n /** @private */ this.SKIPWS_ = true;\n /** @private */ this.SKIPCOMMENT_ = true;\n /** @private */ this.PARSETMP_ = {};\n /** @private */ this.SKIPTILLEOL_ = false;\n /** @private */ this.VALBRACES_ = null;\n /** @private */ this.BRACETYPE_ = null;\n /** @private */ this.BRACECOUNT_ = 0;\n /** @private */ this.STATE_ = this.STATES_.ENTRY_OR_JUNK;\n /** @private */ this.ERRORS_ = [];\n /** @private */ this.ENTRY_TYPES_ = {\n 'inproceedings' : 1,\n 'proceedings' : 2,\n 'article' : 3,\n 'techreport' : 4,\n 'misc' : 5,\n 'mastersthesis' : 6,\n 'book' : 7,\n 'phdthesis' : 8,\n 'incollection' : 9,\n 'unpublished' : 10,\n 'inbook' : 11,\n 'manual' : 12,\n 'periodical' : 13,\n 'booklet' : 14,\n 'masterthesis' : 15,\n 'conference' : 16\n ,'online' : 998 // Galaxy MOD: Handle @online entries for preprints.\n ,'data' : 999 // Galaxy MOD: Handle @data citations coming from figshare.\n }\n /** @private */ this.MACROS_ = {\n 'jan' : 'January',\n 'feb' : 'February',\n 'mar' : 'March',\n 'apr' : 'April',\n 'may' : 'May',\n 'jun' : 'June',\n 'jul' : 'July',\n 'aug' : 'August',\n 'sep' : 'September',\n 'oct' : 'October',\n 'nov' : 'November',\n 'dec' : 'December',\n 'Jan' : 'January',\n 'Feb' : 'February',\n 'Mar' : 'March',\n 'Apr' : 'April',\n 'May' : 'May',\n 'Jun' : 'June',\n 'Jul' : 'July',\n 'Aug' : 'August',\n 'Sep' : 'September',\n 'Oct' : 'October',\n 'Nov' : 'November',\n 'Dec' : 'December'\n }\n\n /**\n * Gets an array of all errors encountered during parsing.\n * Array entries are of the format:\n * [ line number, character in line, character in stream, error text ]\n *\n * @returns Array\" + this.formattedReference() + \"
\");\n return this;\n },\n formattedReference: function formattedReference() {\n var model = this.model;\n var entryType = model.entryType();\n var fields = model.fields();\n\n var ref = \"\";\n // Code inspired by...\n // https://github.com/vkaravir/bib-publication-list/blob/master/src/bib-publication-list.js\n var authorsAndYear = this._asSentence((fields.author ? fields.author : \"\") + (fields.year ? \" (\" + fields.year + \")\" : \"\")) + \" \";\n var title = fields.title || \"\";\n var pages = fields.pages ? \"pp. \" + fields.pages : \"\";\n var address = fields.address;\n if (entryType == \"article\") {\n var volume = (fields.volume ? fields.volume : \"\") + (fields.number ? \" (\" + fields.number + \")\" : \"\") + (pages ? \", \" + pages : \"\");\n ref = authorsAndYear + this._asSentence(title) + (fields.journal ? \"In \" + fields.journal + \", \" : \"\") + this._asSentence(volume) + this._asSentence(fields.address) + \"<\\/em>\";\n } else if (entryType == \"inproceedings\" || entryType == \"proceedings\") {\n ref = authorsAndYear + this._asSentence(title) + (fields.booktitle ? \"In \" + fields.booktitle + \", \" : \"\") + (pages ? pages : \"\") + (address ? \", \" + address : \"\") + \".<\\/em>\";\n } else if (entryType == \"mastersthesis\" || entryType == \"phdthesis\") {\n ref = authorsAndYear + this._asSentence(title) + (fields.howpublished ? fields.howpublished + \". \" : \"\") + (fields.note ? fields.note + \".\" : \"\");\n } else if (entryType == \"techreport\") {\n ref = authorsAndYear + this._asSentence(title) + this._asSentence(fields.institution) + this._asSentence(fields.number) + this._asSentence(fields.type);\n } else if (entryType == \"book\" || entryType == \"inbook\" || entryType == \"incollection\") {\n ref = authorsAndYear + \" \" + this._formatBookInfo(fields);\n } else {\n ref = authorsAndYear + \" \" + this._asSentence(title) + this._asSentence(fields.howpublished) + this._asSentence(fields.note);\n }\n var doiUrl = \"\";\n if (fields.doi) {\n doiUrl = 'http://dx.doi.org/' + fields.doi;\n ref += '[doi:' + fields.doi + \"]\";\n }\n var url = fields.url || doiUrl;\n if (url) {\n ref += '[Link]';\n }\n return ref;\n },\n _formatBookInfo: function _formatBookInfo(fields) {\n var info = \"\";\n if (fields.chapter) {\n info += fields.chapter + \" in \";\n }\n if (fields.title) {\n info += \"\" + fields.title + \"<\\/em>\";\n }\n if (fields.editor) {\n info += \", Edited by \" + fields.editor + \", \";\n }\n if (fields.publisher) {\n info += \", \" + fields.publisher;\n }\n if (fields.pages) {\n info += \", pp. \" + fields.pages + \"\";\n }\n if (fields.series) {\n info += \", \" + fields.series + \"<\\/em>\";\n }\n if (fields.volume) {\n info += \", Vol.\" + fields.volume;\n }\n if (fields.issn) {\n info += \", ISBN: \" + fields.issn;\n }\n return info + \".\";\n },\n _asSentence: function _asSentence(str) {\n return str && str.trim() ? str + \". \" : \"\";\n }\n });\n\n var CitationListView = Backbone.View.extend({\n el: '#citations',\n /**\n * Set up view.\n */\n initialize: function initialize() {\n this.listenTo(this.collection, 'add', this.renderCitation);\n },\n\n events: {\n 'click .citations-to-bibtex': 'showBibtex',\n 'click .citations-to-formatted': 'showFormatted'\n },\n\n renderCitation: function renderCitation(citation) {\n var citationView = new CitationView({ model: citation });\n this.$(\".citations-formatted\").append(citationView.render().el);\n var rawTextarea = this.$(\".citations-bibtex-text\");\n rawTextarea.val(rawTextarea.val() + \"\\n\\r\" + citation.attributes.content);\n },\n\n render: function render() {\n this.$el.html(this.citationsElement());\n this.collection.each(function (item) {\n this.renderCitation(item);\n }, this);\n this.showFormatted();\n },\n\n showBibtex: function showBibtex() {\n this.$(\".citations-to-formatted\").show();\n this.$(\".citations-to-bibtex\").hide();\n this.$(\".citations-bibtex\").show();\n this.$(\".citations-formatted\").hide();\n this.$(\".citations-bibtex-text\").select();\n },\n\n showFormatted: function showFormatted() {\n this.$(\".citations-to-formatted\").hide();\n this.$(\".citations-to-bibtex\").show();\n this.$(\".citations-bibtex\").hide();\n this.$(\".citations-formatted\").show();\n },\n\n partialWarningElement: function partialWarningElement() {\n if (this.collection.partial) {\n return ['' + JSON.stringify(xhr.responseJSON) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert(content, 'alert-danger');\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render: function render(speed, callback) {\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html(this.templates.main());\n this._renderHeader(speed);\n this._renderMiddle(speed);\n this._renderFooter(speed);\n this._addPluginComponents();\n this.trigger('rendered', this);\n return this;\n },\n\n /** render the header section */\n _renderHeader: function _renderHeader(speed, callback) {\n //this.debug( '-- _renderHeader' );\n var $header = this.$('.header').empty().html(this.templates.header()).find('.help-content').prepend($(this.templates.helpContent()));\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters: function _renderFilters() {\n return this.$('.forward-column .column-header input').val(this.filters[0]).add(this.$('.reverse-column .column-header input').val(this.filters[1]));\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle: function _renderMiddle(speed, callback) {\n var $middle = this.$('.middle').empty().html(this.templates.middle());\n\n // (re-) hide the un/paired panels based on instance vars\n if (this.unpairedPanelHidden) {\n this.$('.unpaired-columns').hide();\n } else if (this.pairedPanelHidden) {\n this.$('.paired-columns').hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired: function _renderUnpaired(speed, callback) {\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd,\n $rev,\n $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$('.forward-column .title').text([split[0].length, _l('unpaired forward')].join(' '));\n this.$('.forward-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[0].length));\n this.$('.reverse-column .title').text([split[1].length, _l('unpaired reverse')].join(' '));\n this.$('.reverse-column .unpaired-info').text(this._renderUnpairedDisplayStr(this.unpaired.length - split[1].length));\n\n this.$('.unpaired-columns .column-datasets').empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$('.autopair-link').toggle(this.unpaired.length !== 0);\n if (this.unpaired.length === 0) {\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map(function (dataset, i) {\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if (split[0][i] !== undefined && split[0][i] !== dataset) {\n $prd.push(creator._renderPairButton());\n }\n return creator._renderUnpairedDataset(dataset);\n });\n $fwd = split[0].map(function (dataset) {\n return creator._renderUnpairedDataset(dataset);\n });\n\n if (!$fwd.length && !$rev.length) {\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$('.unpaired-columns .forward-column .column-datasets').append($fwd).add(this.$('.unpaired-columns .paired-column .column-datasets').append($prd)).add(this.$('.unpaired-columns .reverse-column .column-datasets').append($rev));\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr: function _renderUnpairedDisplayStr(numFiltered) {\n return ['(', numFiltered, ' ', _l('filtered out'), ')'].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset: function _renderUnpairedDataset(dataset) {\n //TODO: to underscore template\n return $('').attr('id', 'dataset-' + dataset.id).addClass('dataset unpaired').attr('draggable', true).addClass(dataset.selected ? 'selected' : '').append($('').addClass('dataset-name').text(dataset.name))\n //??\n .data('dataset', dataset);\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton: function _renderPairButton() {\n //TODO: *not* a dataset - don't pretend like it is\n return $('').addClass('dataset unpaired').append($('').addClass('dataset-name').text(_l('Pair these datasets')));\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty: function _renderUnpairedEmpty() {\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $('').text('(' + _l('no remaining unpaired datasets') + ')');\n this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown: function _renderUnpairedNotShown() {\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $('').text('(' + _l('no datasets were found matching the current filters') + ')');\n this.$('.unpaired-columns .paired-column .column-datasets').empty().prepend($msg);\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar: function _adjUnpairedOnScrollbar() {\n var $unpairedColumns = this.$('.unpaired-columns').last(),\n $firstDataset = this.$('.unpaired-columns .reverse-column .dataset').first();\n if (!$firstDataset.length) {\n return;\n }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor(ucRight) - Math.floor(dsRight);\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$('.unpaired-columns .forward-column').css('margin-left', rightDiff > 0 ? rightDiff : 0);\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired: function _renderPaired(speed, callback) {\n //this.debug( '-- _renderPaired' );\n this.$('.paired-column-title .title').text([this.paired.length, _l('paired')].join(' '));\n // show/hide the unpair all link\n this.$('.unpair-all-link').toggle(this.paired.length !== 0);\n if (this.paired.length === 0) {\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$('.remove-extensions-link').show();\n }\n\n this.$('.paired-columns .column-datasets').empty();\n var creator = this;\n this.paired.forEach(function (pair, i) {\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$('.paired-columns .column-datasets').append(pairView.render().$el).append([''].join(''));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty: function _renderPairedEmpty() {\n var $msg = $('').text('(' + _l('no paired datasets yet') + ')');\n this.$('.paired-columns .column-datasets').empty().prepend($msg);\n return $msg;\n },\n\n footerSettings: {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents: function _addPluginComponents() {\n this._chooseFiltersPopover('.choose-filters-link');\n this.$('.help-content i').hoverhighlight('.collection-creator', 'rgba( 64, 255, 255, 1.0 )');\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover: function _chooseFiltersPopover(selector) {\n function filterChoice(val1, val2) {\n return [''].join('');\n }\n var $popoverContent = $(_.template(['
', _l(['Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ', 'These collections can be passed to tools and workflows in order to have analyses done on each member of ', 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ', 'and re-order the final collection.'].join('')), '
', '', _l(['Unpaired datasets are shown in the unpaired section ', '(hover over the underlined words to highlight below). ', 'Paired datasets are shown in the paired section.', '
', _l(['
', _l(['To unpair individual dataset pairs, click the ', 'unpair buttons ( ). ', 'Click the \"Unpair all\" link to unpair all pairs.'].join('')), '
', '', _l(['You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ', '\"Remove file extensions from pair names?\" control.'].join('')), '
', '', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\". ', '(Note: you do not have to pair all unpaired datasets to finish.)'].join('')), '
'].join(''))\n })\n });\n\n //=============================================================================\n /** a modal version of the paired collection creator */\n var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal(datasets, options) {\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults(options || {}, {\n datasets: datasets,\n oncancel: function oncancel() {\n Galaxy.modal.hide();\n deferred.reject('cancelled');\n },\n oncreate: function oncreate(creator, response) {\n Galaxy.modal.hide();\n deferred.resolve(response);\n }\n });\n\n if (!window.Galaxy || !Galaxy.modal) {\n throw new Error('Galaxy or Galaxy.modal not found');\n }\n\n creator = new PairedCollectionCreator(options);\n Galaxy.modal.show({\n title: 'Create a collection of paired datasets',\n body: creator.$el,\n width: '80%',\n height: '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n };\n\n //=============================================================================\n function createListOfPairsCollection(collection, defaultHideSourceItems) {\n var elements = collection.toJSON();\n //TODO: validate elements\n return pairedCollectionCreatorModal(elements, {\n historyId: collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n }\n\n //=============================================================================\n return {\n PairedCollectionCreator: PairedCollectionCreator,\n pairedCollectionCreatorModal: pairedCollectionCreatorModal,\n createListOfPairsCollection: createListOfPairsCollection\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(1), __webpack_require__(0), __webpack_require__(0)))\n\n/***/ }),\n/* 107 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _, jQuery) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(23), __webpack_require__(25), __webpack_require__(5), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (LIST_CREATOR, HDCA, BASE_MVC, _l) {\n\n 'use strict';\n\n var logNamespace = 'collections';\n /*==============================================================================\n TODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n \n ==============================================================================*/\n /** */\n var PairedDatasetCollectionElementView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({\n _logNamespace: logNamespace,\n\n //TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName: 'li',\n className: 'collection-element',\n\n initialize: function initialize(attributes) {\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render: function render() {\n this.$el.attr('data-element-id', this.element.id).html(this.template({ identifier: this.identifier, element: this.element }));\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template: _.template(['<%- identifier %>', '<%- element.name %>'].join('')),\n\n /** remove the DOM and any listeners */\n destroy: function destroy() {\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString: function toString() {\n return 'DatasetCollectionElementView()';\n }\n });\n\n // ============================================================================\n var _super = LIST_CREATOR.ListCollectionCreator;\n\n /** An interface for building collections.\n */\n var PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass: PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass: HDCA.HistoryPairDatasetCollection,\n className: 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames: function _mangleDuplicateNames() {},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render: function render(speed, callback) {\n if (this.workingElements.length === 2) {\n return _super.prototype.render.call(this, speed, callback);\n }\n return this._renderInvalid(speed, callback);\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList: function _renderList(speed, callback) {\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery(''),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each(this.elementViews, function (view) {\n view.destroy();\n creator.removeElementView(view);\n });\n $tmp.append(creator._createForwardElementView().$el);\n $tmp.append(creator._createReverseElementView().$el);\n $list.empty().append($tmp.children());\n _.invoke(creator.elementViews, 'render');\n },\n\n /** create the forward element view */\n _createForwardElementView: function _createForwardElementView() {\n return this._createElementView(this.workingElements[0], { identifier: 'forward' });\n },\n\n /** create the forward element view */\n _createReverseElementView: function _createReverseElementView() {\n return this._createElementView(this.workingElements[1], { identifier: 'reverse' });\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView: function _createElementView(element, options) {\n var elementView = new this.elementViewClass(_.extend(options, {\n element: element\n }));\n this.elementViews.push(elementView);\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap: function swap() {\n this.workingElements = [this.workingElements[1], this.workingElements[0]];\n this._renderList();\n },\n\n events: _.extend(_.clone(_super.prototype.events), {\n 'click .swap': 'swap'\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates: _.extend(_.clone(_super.prototype.templates), {\n /** the middle: element list */\n middle: _.template(['', _l(['Pair collections are permanent collections containing two datasets: one forward and one reverse. ', 'Often these are forward and reverse reads. The pair collections can be passed to tools and ', 'workflows in order to have analyses done on both datasets. This interface allows ', 'you to create a pair, name it, and swap which is forward and which reverse.'].join('')), '
', '', _l(['Once your collection is complete, enter a name and ', 'click \"Create list\".'].join('')), '
'].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial: _.template(['' + this.progressive + '...
';\n this.modal.$('.modal-body').empty().append(indicator).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog: function _dialog(modal, history, options) {\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get('name') }),\n\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets ? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined(options.allowAll) ? options.allowAll : true,\n autoClose = !_.isUndefined(options.autoClose) ? options.autoClose : true;\n\n this.modal = modal;\n\n // validate the name and copy if good\n function checkNameAndCopy() {\n var name = modal.$('#copy-modal-title').val();\n if (!name) {\n modal.$('.invalid-title').show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$('input[name=\"copy-what\"]:checked').val() === 'copy-all';\n modal.$('button').prop('disabled', true);\n dialog._showAjaxIndicator();\n history.copy(true, name, copyAllDatasets).done(function (response) {\n deferred.resolve(response);\n }).fail(function (xhr, status, message) {\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal(history, xhr, options, dialog.errorMessage);\n deferred.rejectWith(deferred, arguments);\n }).done(function () {\n if (autoClose) {\n modal.hide();\n }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show(_.extend(options, {\n title: this.title({ name: history.get('name') }),\n body: $(dialog._template({\n name: defaultCopyName,\n isAnon: Galaxy.user.isAnonymous(),\n allowAll: allowAll,\n copyWhat: defaultCopyWhat,\n activeLabel: this.activeLabel,\n allLabel: this.allLabel,\n anonWarning: this.anonWarning\n })),\n buttons: _.object([[_l('Cancel'), function () {\n modal.hide();\n }], [this.submitLabel, checkNameAndCopy]]),\n height: 'auto',\n closing_events: true,\n closing_callback: function _historyCopyClose(cancelled) {\n if (cancelled) {\n deferred.reject({ cancelled: true });\n }\n if (originalClosingCallback) {\n originalClosingCallback(cancelled);\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$('#copy-modal-title').focus().select();\n modal.$('#copy-modal-title').on('keydown', function (ev) {\n if (ev.keyCode === 13) {\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n }\n };\n\n //==============================================================================\n // maintain the (slight) distinction between copy and import\n /**\n * Subclass CopyDialog to use the import language.\n */\n var ImportDialog = _.extend({}, CopyDialog, {\n defaultName: _.template(\"imported: <%- name %>\"),\n title: _.template(_l('Importing history') + ' \"<%- name %>\"'),\n submitLabel: _l('Import'),\n errorMessage: _l('History could not be imported.'),\n progressive: _l('Importing history'),\n activeLabel: _l('Import only the active, non-deleted datasets'),\n allLabel: _l('Import all datasets including deleted ones'),\n anonWarning: _l('As an anonymous user, unless you login or register, you will lose your current history ') + _l('after importing this history. ')\n\n });\n\n //==============================================================================\n /**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name:| Name | ' + 'Size | ' + 'Status | ' + '' + ' |
|---|
| ' + ' | ' + ' | Description | ' + 'Name | ' + 'Size | ' + 'Settings | ' + 'Status | ' + '
|---|
| Name | ' + 'Size | ' + 'Type | ' + 'Genome | ' + 'Settings | ' + 'Status | ' + '' + ' |
|---|
' + JSON.stringify( xhr.responseJSON ) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n events : {\n // header\n 'click .more-help' : '_clickMoreHelp',\n 'click .less-help' : '_clickLessHelp',\n 'click .main-help' : '_toggleHelp',\n 'click .header .alert button' : '_hideAlert',\n\n 'click .reset' : 'reset',\n 'click .clear-selected' : 'clearSelectedElements',\n\n // elements - selection\n 'click .collection-elements' : 'clearSelectedElements',\n\n // elements - drop target\n // 'dragenter .collection-elements': '_dragenterElements',\n // 'dragleave .collection-elements': '_dragleaveElements',\n 'dragover .collection-elements' : '_dragoverElements',\n 'drop .collection-elements' : '_dropElements',\n\n // these bubble up from the elements as custom events\n 'collection-element.dragstart .collection-elements' : '_elementDragstart',\n 'collection-element.dragend .collection-elements' : '_elementDragend',\n\n // footer\n 'change .collection-name' : '_changeName',\n 'keydown .collection-name' : '_nameCheckForEnter',\n 'change .hide-originals' : '_changeHideOriginals',\n 'click .cancel-create' : '_cancelCreate',\n 'click .create-collection' : '_clickCreate'//,\n },\n\n // ........................................................................ elements\n /** reset all data to the initial state */\n reset : function(){\n this._instanceSetUp();\n this._elementsSetUp();\n this.render();\n },\n\n /** deselect all elements */\n clearSelectedElements : function( ev ){\n this.$( '.collection-elements .collection-element' ).removeClass( 'selected' );\n this.$( '.collection-elements-controls > .clear-selected' ).hide();\n },\n\n //_dragenterElements : function( ev ){\n // //this.debug( '_dragenterElements:', ev );\n //},\n//TODO: if selected are dragged out of the list area - remove the placeholder - cuz it won't work anyway\n // _dragleaveElements : function( ev ){\n // //this.debug( '_dragleaveElements:', ev );\n // },\n\n /** track the mouse drag over the list adding a placeholder to show where the drop would occur */\n _dragoverElements : function( ev ){\n //this.debug( '_dragoverElements:', ev );\n ev.preventDefault();\n\n var $list = this.$list();\n this._checkForAutoscroll( $list, ev.originalEvent.clientY );\n var $nearest = this._getNearestElement( ev.originalEvent.clientY );\n\n //TODO: no need to re-create - move instead\n this.$( '.element-drop-placeholder' ).remove();\n var $placeholder = $( '' );\n if( !$nearest.length ){\n $list.append( $placeholder );\n } else {\n $nearest.before( $placeholder );\n }\n },\n\n /** If the mouse is near enough to the list's top or bottom, scroll the list */\n _checkForAutoscroll : function( $element, y ){\n var AUTOSCROLL_SPEED = 2,\n offset = $element.offset(),\n scrollTop = $element.scrollTop(),\n upperDist = y - offset.top,\n lowerDist = ( offset.top + $element.outerHeight() ) - y;\n if( upperDist >= 0 && upperDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop - AUTOSCROLL_SPEED );\n } else if( lowerDist >= 0 && lowerDist < this.autoscrollDist ){\n $element.scrollTop( scrollTop + AUTOSCROLL_SPEED );\n }\n },\n\n /** get the nearest element based on the mouse's Y coordinate.\n * If the y is at the end of the list, return an empty jQuery object.\n */\n _getNearestElement : function( y ){\n var WIGGLE = 4,\n lis = this.$( '.collection-elements li.collection-element' ).toArray();\n for( var i=0; i
', _l([\n 'Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ',\n 'workflows in order to have analyses done on each member of the entire group. This interface allows ',\n 'you to create a collection and re-order the final collection.'\n ].join( '' )), '
',\n '', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '
'\n ].join('')),\n\n /** shown in list when all elements are discarded */\n invalidElements : _.template([\n _l( 'The following selections could not be included due to problems:' ),\n '<%= dataset.peek %>',\n '<% } %>',\n '<% } %>',\n '
| ' +\n ' | Name | ' +\n 'Size | ' +\n 'Created | ' +\n '
|---|
' +\n 'You are using ' + options.nice_total_disk_usage + ' of disk space in this Galaxy instance. ' +\n ( Galaxy.config.enable_quotas ? 'Your disk quota is: ' + options.quota + '. ' : '' ) +\n 'Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.' +\n '
';\n }\n });\n\n /** View of individual user forms */\n var Forms = Backbone.View.extend({\n\n initialize: function( options ) {\n this.model = new Model( options );\n this.page = this.model.get( options.form_id );\n this.setElement( '' );\n this.render();\n },\n\n render: function() {\n var self = this;\n $.ajax({\n url : Galaxy.root + this.page.url,\n type : 'GET'\n }).done( function( response ) {\n var options = $.extend( {}, self.page, response );\n var form = new Form({\n title : options.title,\n icon : options.icon,\n inputs : options.inputs,\n operations: {\n 'submit': new Ui.ButtonIcon({\n tooltip : options.submit_tooltip,\n title : options.submit_title || 'Save settings',\n icon : options.submit_icon || 'fa-save',\n onclick : function() { self._submit( form, options ) }\n })\n }\n });\n self.$el.empty().append( form.$el );\n }).fail( function( response ) {\n self.$el.empty().append( new Ui.Message({\n message : 'Failed to load resource ' + self.page.url + '.',\n status : 'danger',\n persistent : true\n }).$el );\n });\n },\n\n _submit: function( form, options ) {\n var self = this;\n $.ajax( {\n url : Galaxy.root + options.url,\n data : JSON.stringify( form.data.create() ),\n type : 'PUT',\n contentType : 'application/json'\n }).done( function( response ) {\n var updated_values = false;\n form.data.matchModel( response, function ( input, input_id ) {\n form.field_list[ input_id ].value( input.value );\n updated_values = true;\n });\n form.message.update( { message: response.message, status: 'success' } );\n }).fail( function( response ) {\n window.console.log( response );\n form.message.update( { message: response.responseJSON.err_msg, status: 'danger' } );\n });\n }\n });\n\n return {\n View : View,\n Forms : Forms\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/user/user-preferences.js","define([\n //jquery\n //backbone\n], function(){\n//=============================================================================\n/**\n * backbone model for icon buttons\n */\nvar IconButton = Backbone.Model.extend({\n defaults: {\n title : \"\",\n icon_class : \"\",\n on_click : null,\n menu_options : null,\n is_menu_button : true,\n id : null,\n href : null,\n target : null,\n enabled : true,\n visible : true,\n tooltip_config : {}\n }\n});\n\n/**\n * backbone view for icon buttons\n */\nvar IconButtonView = Backbone.View.extend({\n\n initialize : function(){\n // better rendering this way\n this.model.attributes.tooltip_config = { placement : 'bottom' };\n this.model.bind( 'change', this.render, this );\n },\n\n render : function( ){\n // hide tooltip\n this.$el.tooltip( 'hide' );\n\n var new_elem = this.template( this.model.toJSON() );\n // configure tooltip\n new_elem.tooltip( this.model.get( 'tooltip_config' ));\n this.$el.replaceWith( new_elem );\n this.setElement( new_elem );\n return this;\n },\n\n events : {\n 'click' : 'click'\n },\n\n click : function( event ){\n // if on_click pass to that function\n if( _.isFunction( this.model.get( 'on_click' ) ) ){\n this.model.get( 'on_click' )( event );\n return false;\n }\n // otherwise, bubble up ( to href or whatever )\n return true;\n },\n\n // generate html element\n template: function( options ){\n var buffer = 'title=\"' + options.title + '\" class=\"icon-button';\n\n if( options.is_menu_button ){\n buffer += ' menu-button';\n }\n\n buffer += ' ' + options.icon_class;\n\n if( !options.enabled ){\n buffer += '_disabled';\n }\n\n // close class tag\n buffer += '\"';\n\n if( options.id ){\n buffer += ' id=\"' + options.id + '\"';\n }\n\n buffer += ' href=\"' + options.href + '\"';\n // add target for href\n if( options.target ){\n buffer += ' target=\"' + options.target + '\"';\n }\n // set visibility\n if( !options.visible ){\n buffer += ' style=\"display: none;\"';\n }\n\n // enabled/disabled\n if ( options.enabled ){\n buffer = '';\n } else {\n buffer = '';\n }\n\n // return element\n return $( buffer );\n }\n} );\n\n// define collection\nvar IconButtonCollection = Backbone.Collection.extend({\n model: IconButton\n});\n\n/**\n * menu with multiple icon buttons\n * views are not needed nor used for individual buttons\n */\nvar IconButtonMenuView = Backbone.View.extend({\n\n tagName: 'div',\n\n initialize: function(){\n this.render();\n },\n\n render: function(){\n // initialize icon buttons\n var self = this;\n this.collection.each(function(button){\n // create and add icon button to menu\n var elt = $('')\n .attr('href', 'javascript:void(0)')\n .attr('title', button.attributes.title)\n .addClass('icon-button menu-button')\n .addClass(button.attributes.icon_class)\n .appendTo(self.$el)\n .click(button.attributes.on_click);\n\n // configure tooltip\n if (button.attributes.tooltip_config){\n elt.tooltip(button.attributes.tooltip_config);\n }\n\n // add popup menu to icon\n var menu_options = button.get('options');\n if (menu_options){\n make_popupmenu(elt, menu_options);\n }\n });\n\n // return\n return this;\n }\n});\n\n/**\n * Returns an IconButtonMenuView for the provided configuration.\n * Configuration is a list of dictionaries where each dictionary\n * defines an icon button. Each dictionary must have the following\n * elements: icon_class, title, and on_click.\n */\nvar create_icon_buttons_menu = function(config, global_config)\n{\n // initialize global configuration\n if (!global_config) global_config = {};\n\n // create and initialize menu\n var buttons = new IconButtonCollection(\n _.map(config, function(button_config){\n return new IconButton(_.extend(button_config, global_config));\n })\n );\n\n // return menu\n return new IconButtonMenuView( {collection: buttons} );\n};\n\n\n//=============================================================================\n return {\n IconButton : IconButton,\n IconButtonView : IconButtonView,\n IconButtonCollection : IconButtonCollection,\n IconButtonMenuView : IconButtonMenuView,\n create_icon_buttons_menu: create_icon_buttons_menu\n };\n})\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/ui/icon-button.js","define(function(){\n\n/**\n * Stringifies a number adding commas for digit grouping as per North America.\n */\nfunction commatize( number ) {\n number += ''; // Convert to string\n var rgx = /(\\d+)(\\d{3})/;\n while (rgx.test(number)) {\n number = number.replace(rgx, '$1' + ',' + '$2');\n }\n return number;\n}\n\n/**\n * Helper to determine if object is jQuery deferred.\n */\nvar is_deferred = function ( d ) {\n return ('promise' in d);\n};\n\n/**\n * Implementation of a server-state based deferred. Server is repeatedly polled, and when\n * condition is met, deferred is resolved.\n */\nvar ServerStateDeferred = Backbone.Model.extend({\n defaults: {\n ajax_settings: {},\n interval: 1000,\n success_fn: function(result) { return true; }\n },\n\n /**\n * Returns a deferred that resolves when success function returns true.\n */\n go: function() {\n var deferred = $.Deferred(),\n self = this,\n ajax_settings = self.get('ajax_settings'),\n success_fn = self.get('success_fn'),\n interval = self.get('interval'),\n _go = function() {\n $.ajax(ajax_settings).success(function(result) {\n if (success_fn(result)) {\n // Result is good, so resolve.\n deferred.resolve(result);\n }\n else {\n // Result not good, try again.\n setTimeout(_go, interval);\n }\n });\n };\n _go();\n return deferred;\n }\n});\n\n/**\n * Returns a random color in hexadecimal format that is sufficiently different from a single color\n * or set of colors.\n * @param colors a color or list of colors in the format '#RRGGBB'\n */\nvar get_random_color = function(colors) {\n // Default for colors is white.\n if (!colors) { colors = \"#ffffff\"; }\n\n // If needed, create list of colors.\n if ( typeof(colors) === \"string\" ) {\n colors = [ colors ];\n }\n\n // Convert colors to numbers.\n for (var i = 0; i < colors.length; i++) {\n colors[i] = parseInt( colors[i].slice(1), 16 );\n }\n\n // -- Perceived brightness and difference formulas are from\n // -- http://www.w3.org/WAI/ER/WD-AERT/#color-contrast\n\n // Compute perceived color brightness (based on RGB-YIQ transformation):\n var brightness = function(r, g, b) {\n return ( (r * 299) + (g * 587) + (b * 114) ) / 1000;\n };\n\n // Compute color difference:\n var difference = function(r1, g1, b1, r2, g2, b2) {\n return ( Math.max(r1, r2) - Math.min(r1, r2) ) +\n ( Math.max(g1, g2) - Math.min(g1, g2) ) +\n ( Math.max(b1, b2) - Math.min(b1, b2) );\n };\n\n // Create new random color.\n var new_color, nr, ng, nb,\n other_color, or, og, ob,\n n_brightness, o_brightness,\n diff, ok = false,\n num_tries = 0;\n do {\n // New color is never white b/c random in [0,1)\n new_color = Math.round( Math.random() * 0xffffff );\n nr = ( new_color & 0xff0000 ) >> 16;\n ng = ( new_color & 0x00ff00 ) >> 8;\n nb = new_color & 0x0000ff;\n n_brightness = brightness(nr, ng, nb);\n ok = true;\n for (i = 0; i < colors.length; i++) {\n other_color = colors[i];\n or = ( other_color & 0xff0000 ) >> 16;\n og = ( other_color & 0x00ff00 ) >> 8;\n ob = other_color & 0x0000ff;\n o_brightness = brightness(or, og, ob);\n diff = difference(nr, ng, nb, or, og, ob);\n // These thresholds may need to be adjusted. Brightness difference range is 125;\n // color difference range is 500.\n if ( ( Math.abs(n_brightness - o_brightness) < 40 ) ||\n ( diff < 200 ) ) {\n ok = false;\n break;\n }\n }\n\n num_tries++\n; } while (!ok && num_tries <= 10 );\n\n // Add 0x1000000 to left pad number with 0s.\n return '#' + ( 0x1000000 + new_color ).toString(16).substr(1,6);\n};\n\nreturn {\n commatize: commatize,\n is_deferred: is_deferred,\n ServerStateDeferred : ServerStateDeferred,\n get_random_color : get_random_color\n};\n\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/viz/trackster/util.js","/**\n * Parser.js\n * Copyright 2012-13 Mayank Lahiri\n * mlahiri@gmail.com\n * Released under the BSD License.\n *\n * A forgiving Bibtex parser that can:\n * \n * (1) operate in streaming or block mode, extracting entries as dictionaries. \n * (2) convert Latex special characters to UTF-8.\n * (3) best-effort parse malformed entries.\n * (4) run in a CommonJS environment or a browser, without any dependencies.\n * (5) be advanced-compiled by Google Closure Compiler.\n * \n * Handwritten as a labor of love, not auto-generated from a grammar. \n *\n * Modes of usage:\n *\n * (1) Synchronous, string\n *\n * var entries = BibtexParser(text);\n * console.log(entries);\n *\n * (2) Asynchronous, stream\n *\n * var entryCallback = function(entry) { console.log(entry); }\n * var parser = new BibtexParser(entryCallback);\n * parser.parse(chunk1);\n * parser.parse(chunk2);\n * ...\n * \n * @param {text|function(Object)} arg Either a Bibtex string or callback \n * function for processing parsed entries.\n * @constructor\n */\nfunction BibtexParser(arg0) {\n // Determine how this function is to be used\n if (typeof arg0 == 'string') {\n // Passed a string, synchronous call without 'new'\n var tempStorage = {};\n var entries = [];\n function accumulator(entry) {\n entries.push(entry);\n }\n var parser = BibtexParser.call(tempStorage, accumulator);\n parser.parse(arg0);\n return {\n 'entries': entries,\n 'errors': parser.getErrors()\n }\n }\n if (typeof arg0 != 'function') {\n throw 'Invalid parser construction.';\n }\n\n /** @enum {number} */\n this.STATES_ = {\n ENTRY_OR_JUNK: 0,\n OBJECT_TYPE: 1,\n ENTRY_KEY: 2, \n KV_KEY: 3, \n EQUALS: 4,\n KV_VALUE: 5 \n }\n /** @private */ this.DATA_ = {};\n /** @private */ this.CALLBACK_ = arg0;\n /** @private */ this.CHAR_ = 0;\n /** @private */ this.LINE_ = 1;\n /** @private */ this.CHAR_IN_LINE_ = 0;\n /** @private */ this.SKIPWS_ = true;\n /** @private */ this.SKIPCOMMENT_ = true;\n /** @private */ this.PARSETMP_ = {};\n /** @private */ this.SKIPTILLEOL_ = false;\n /** @private */ this.VALBRACES_ = null;\n /** @private */ this.BRACETYPE_ = null;\n /** @private */ this.BRACECOUNT_ = 0;\n /** @private */ this.STATE_ = this.STATES_.ENTRY_OR_JUNK;\n /** @private */ this.ERRORS_ = [];\n /** @private */ this.ENTRY_TYPES_ = {\n 'inproceedings' : 1,\n 'proceedings' : 2,\n 'article' : 3,\n 'techreport' : 4,\n 'misc' : 5,\n 'mastersthesis' : 6,\n 'book' : 7,\n 'phdthesis' : 8,\n 'incollection' : 9,\n 'unpublished' : 10,\n 'inbook' : 11,\n 'manual' : 12,\n 'periodical' : 13,\n 'booklet' : 14,\n 'masterthesis' : 15,\n 'conference' : 16\n ,'online' : 998 // Galaxy MOD: Handle @online entries for preprints.\n ,'data' : 999 // Galaxy MOD: Handle @data citations coming from figshare.\n }\n /** @private */ this.MACROS_ = {\n 'jan' : 'January',\n 'feb' : 'February',\n 'mar' : 'March',\n 'apr' : 'April',\n 'may' : 'May',\n 'jun' : 'June',\n 'jul' : 'July',\n 'aug' : 'August',\n 'sep' : 'September',\n 'oct' : 'October',\n 'nov' : 'November',\n 'dec' : 'December',\n 'Jan' : 'January',\n 'Feb' : 'February',\n 'Mar' : 'March',\n 'Apr' : 'April',\n 'May' : 'May',\n 'Jun' : 'June',\n 'Jul' : 'July',\n 'Aug' : 'August',\n 'Sep' : 'September',\n 'Oct' : 'October',\n 'Nov' : 'November',\n 'Dec' : 'December'\n }\n\n /**\n * Gets an array of all errors encountered during parsing.\n * Array entries are of the format:\n * [ line number, character in line, character in stream, error text ]\n *\n * @returns Array\" + this.formattedReference() + \"
\" );\n return this;\n },\n formattedReference: function() {\n var model = this.model;\n var entryType = model.entryType();\n var fields = model.fields();\n\n var ref = \"\";\n // Code inspired by...\n // https://github.com/vkaravir/bib-publication-list/blob/master/src/bib-publication-list.js\n var authorsAndYear = this._asSentence( (fields.author ? fields.author : \"\") + (fields.year ? (\" (\" + fields.year + \")\") : \"\") ) + \" \";\n var title = fields.title || \"\";\n var pages = fields.pages ? (\"pp. \" + fields.pages) : \"\";\n var address = fields.address;\n if( entryType == \"article\" ) {\n var volume = (fields.volume ? fields.volume : \"\") +\n (fields.number ? ( \" (\" + fields.number + \")\" ) : \"\") +\n (pages ? \", \" + pages : \"\");\n ref = authorsAndYear + this._asSentence(title) +\n (fields.journal ? (\"In \" + fields.journal + \", \") : \"\") +\n this._asSentence(volume) + \n this._asSentence(fields.address) +\n \"<\\/em>\";\n } else if( entryType == \"inproceedings\" || entryType == \"proceedings\" ) {\n ref = authorsAndYear + \n this._asSentence(title) + \n (fields.booktitle ? (\"In \" + fields.booktitle + \", \") : \"\") +\n (pages ? pages : \"\") +\n (address ? \", \" + address : \"\") + \n \".<\\/em>\";\n } else if( entryType == \"mastersthesis\" || entryType == \"phdthesis\" ) {\n ref = authorsAndYear + this._asSentence(title) +\n (fields.howpublished ? fields.howpublished + \". \" : \"\") +\n (fields.note ? fields.note + \".\" : \"\");\n } else if( entryType == \"techreport\" ) {\n ref = authorsAndYear + this._asSentence(title) +\n this._asSentence(fields.institution) +\n this._asSentence(fields.number) +\n this._asSentence(fields.type);\n } else if( entryType == \"book\" || entryType == \"inbook\" || entryType == \"incollection\" ) {\n ref = authorsAndYear + \" \" + this._formatBookInfo(fields);\n } else {\n ref = authorsAndYear + \" \" + this._asSentence(title) +\n this._asSentence(fields.howpublished) +\n this._asSentence(fields.note);\n }\n var doiUrl = \"\";\n if( fields.doi ) {\n doiUrl = 'http://dx.doi.org/' + fields.doi;\n ref += '[doi:' + fields.doi + \"]\";\n }\n var url = fields.url || doiUrl;\n if( url ) {\n ref += '[Link]';\n }\n return ref;\n },\n _formatBookInfo: function(fields) {\n var info = \"\";\n if( fields.chapter ) {\n info += fields.chapter + \" in \";\n }\n if( fields.title ) {\n info += \"\" + fields.title + \"<\\/em>\";\n }\n if( fields.editor ) {\n info += \", Edited by \" + fields.editor + \", \";\n }\n if( fields.publisher) {\n info += \", \" + fields.publisher;\n }\n if( fields.pages ) {\n info += \", pp. \" + fields.pages + \"\";\n }\n if( fields.series ) {\n info += \", \" + fields.series + \"<\\/em>\";\n }\n if( fields.volume ) {\n info += \", Vol.\" + fields.volume;\n }\n if( fields.issn ) {\n info += \", ISBN: \" + fields.issn;\n }\n return info + \".\";\n },\n _asSentence: function(str) {\n return (str && str.trim()) ? str + \". \" : \"\";\n }\n});\n\nvar CitationListView = Backbone.View.extend({\n el: '#citations',\n /**\n * Set up view.\n */\n initialize: function() {\n this.listenTo( this.collection, 'add', this.renderCitation );\n },\n\n events: {\n 'click .citations-to-bibtex': 'showBibtex',\n 'click .citations-to-formatted': 'showFormatted'\n },\n\n renderCitation: function( citation ) {\n var citationView = new CitationView( { model: citation } );\n this.$(\".citations-formatted\").append( citationView.render().el );\n var rawTextarea = this.$(\".citations-bibtex-text\");\n rawTextarea.val( rawTextarea.val() + \"\\n\\r\" + citation.attributes.content );\n },\n\n render: function() {\n this.$el.html(this.citationsElement());\n this.collection.each(function( item ){\n this.renderCitation( item );\n }, this);\n this.showFormatted();\n },\n\n showBibtex: function() {\n this.$(\".citations-to-formatted\").show();\n this.$(\".citations-to-bibtex\").hide();\n this.$(\".citations-bibtex\").show();\n this.$(\".citations-formatted\").hide();\n this.$(\".citations-bibtex-text\").select();\n },\n\n showFormatted: function() {\n this.$(\".citations-to-formatted\").hide();\n this.$(\".citations-to-bibtex\").show();\n this.$(\".citations-bibtex\").hide();\n this.$(\".citations-formatted\").show();\n },\n\n partialWarningElement: function() {\n if( this.collection.partial ) {\n return [\n '' + JSON.stringify( xhr.responseJSON ) + '';\n } else {\n content += ': ' + message;\n }\n }\n creator._showAlert( content, 'alert-danger' );\n },\n\n // ------------------------------------------------------------------------ rendering\n /** render the entire interface */\n render : function( speed, callback ){\n //this.debug( '-- _render' );\n //this.$el.empty().html( this.templates.main() );\n this.$el.empty().html( this.templates.main() );\n this._renderHeader( speed );\n this._renderMiddle( speed );\n this._renderFooter( speed );\n this._addPluginComponents();\n this.trigger( 'rendered', this );\n return this;\n },\n\n /** render the header section */\n _renderHeader : function( speed, callback ){\n //this.debug( '-- _renderHeader' );\n var $header = this.$( '.header' ).empty().html( this.templates.header() )\n .find( '.help-content' ).prepend( $( this.templates.helpContent() ) );\n\n this._renderFilters();\n return $header;\n },\n /** fill the filter inputs with the filter values */\n _renderFilters : function(){\n return this.$( '.forward-column .column-header input' ).val( this.filters[0] )\n .add( this.$( '.reverse-column .column-header input' ).val( this.filters[1] ) );\n },\n\n /** render the middle including unpaired and paired sections (which may be hidden) */\n _renderMiddle : function( speed, callback ){\n var $middle = this.$( '.middle' ).empty().html( this.templates.middle() );\n\n // (re-) hide the un/paired panels based on instance vars\n if( this.unpairedPanelHidden ){\n this.$( '.unpaired-columns' ).hide();\n } else if( this.pairedPanelHidden ){\n this.$( '.paired-columns' ).hide();\n }\n\n this._renderUnpaired();\n this._renderPaired();\n return $middle;\n },\n /** render the unpaired section, showing datasets accrd. to filters, update the unpaired counts */\n _renderUnpaired : function( speed, callback ){\n //this.debug( '-- _renderUnpaired' );\n var creator = this,\n $fwd, $rev, $prd = [],\n split = this._splitByFilters();\n // update unpaired counts\n this.$( '.forward-column .title' )\n .text([ split[0].length, _l( 'unpaired forward' ) ].join( ' ' ));\n this.$( '.forward-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[0].length ) );\n this.$( '.reverse-column .title' )\n .text([ split[1].length, _l( 'unpaired reverse' ) ].join( ' ' ));\n this.$( '.reverse-column .unpaired-info' )\n .text( this._renderUnpairedDisplayStr( this.unpaired.length - split[1].length ) );\n\n this.$( '.unpaired-columns .column-datasets' ).empty();\n\n // show/hide the auto pair button if any unpaired are left\n this.$( '.autopair-link' ).toggle( this.unpaired.length !== 0 );\n if( this.unpaired.length === 0 ){\n this._renderUnpairedEmpty();\n return;\n }\n\n // create the dataset dom arrays\n $rev = split[1].map( function( dataset, i ){\n // if there'll be a fwd dataset across the way, add a button to pair the row\n if( ( split[0][ i ] !== undefined )\n && ( split[0][ i ] !== dataset ) ){\n $prd.push( creator._renderPairButton() );\n }\n return creator._renderUnpairedDataset( dataset );\n });\n $fwd = split[0].map( function( dataset ){\n return creator._renderUnpairedDataset( dataset );\n });\n\n if( !$fwd.length && !$rev.length ){\n this._renderUnpairedNotShown();\n return;\n }\n // add to appropo cols\n //TODO: not the best way to render - consider rendering the entire unpaired-columns section in a fragment\n // and swapping out that\n this.$( '.unpaired-columns .forward-column .column-datasets' ).append( $fwd )\n .add( this.$( '.unpaired-columns .paired-column .column-datasets' ).append( $prd ) )\n .add( this.$( '.unpaired-columns .reverse-column .column-datasets' ).append( $rev ) );\n this._adjUnpairedOnScrollbar();\n },\n /** return a string to display the count of filtered out datasets */\n _renderUnpairedDisplayStr : function( numFiltered ){\n return [ '(', numFiltered, ' ', _l( 'filtered out' ), ')' ].join('');\n },\n /** return an unattached jQuery DOM element to represent an unpaired dataset */\n _renderUnpairedDataset : function( dataset ){\n //TODO: to underscore template\n return $( '')\n .attr( 'id', 'dataset-' + dataset.id )\n .addClass( 'dataset unpaired' )\n .attr( 'draggable', true )\n .addClass( dataset.selected? 'selected': '' )\n .append( $( '' ).addClass( 'dataset-name' ).text( dataset.name ) )\n //??\n .data( 'dataset', dataset );\n },\n /** render the button that may go between unpaired datasets, allowing the user to pair a row */\n _renderPairButton : function(){\n //TODO: *not* a dataset - don't pretend like it is\n return $( '').addClass( 'dataset unpaired' )\n .append( $( '' ).addClass( 'dataset-name' ).text( _l( 'Pair these datasets' ) ) );\n },\n /** a message to display when no unpaired left */\n _renderUnpairedEmpty : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '' )\n .text( '(' + _l( 'no remaining unpaired datasets' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** a message to display when no unpaired can be shown with the current filters */\n _renderUnpairedNotShown : function(){\n //this.debug( '-- renderUnpairedEmpty' );\n var $msg = $( '' )\n .text( '(' + _l( 'no datasets were found matching the current filters' ) + ')' );\n this.$( '.unpaired-columns .paired-column .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n /** try to detect if the unpaired section has a scrollbar and adjust left column for better centering of all */\n _adjUnpairedOnScrollbar : function(){\n var $unpairedColumns = this.$( '.unpaired-columns' ).last(),\n $firstDataset = this.$( '.unpaired-columns .reverse-column .dataset' ).first();\n if( !$firstDataset.length ){ return; }\n var ucRight = $unpairedColumns.offset().left + $unpairedColumns.outerWidth(),\n dsRight = $firstDataset.offset().left + $firstDataset.outerWidth(),\n rightDiff = Math.floor( ucRight ) - Math.floor( dsRight );\n //this.debug( 'rightDiff:', ucRight, '-', dsRight, '=', rightDiff );\n this.$( '.unpaired-columns .forward-column' )\n .css( 'margin-left', ( rightDiff > 0 )? rightDiff: 0 );\n },\n\n /** render the paired section and update counts of paired datasets */\n _renderPaired : function( speed, callback ){\n //this.debug( '-- _renderPaired' );\n this.$( '.paired-column-title .title' ).text([ this.paired.length, _l( 'paired' ) ].join( ' ' ) );\n // show/hide the unpair all link\n this.$( '.unpair-all-link' ).toggle( this.paired.length !== 0 );\n if( this.paired.length === 0 ){\n this._renderPairedEmpty();\n return;\n //TODO: would be best to return here (the $columns)\n } else {\n // show/hide 'remove extensions link' when any paired and they seem to have extensions\n this.$( '.remove-extensions-link' ).show();\n }\n\n this.$( '.paired-columns .column-datasets' ).empty();\n var creator = this;\n this.paired.forEach( function( pair, i ){\n //TODO: cache these?\n var pairView = new PairView({ pair: pair });\n creator.$( '.paired-columns .column-datasets' )\n .append( pairView.render().$el )\n .append([\n ''\n ].join( '' ));\n });\n },\n /** a message to display when none paired */\n _renderPairedEmpty : function(){\n var $msg = $( '' )\n .text( '(' + _l( 'no paired datasets yet' ) + ')' );\n this.$( '.paired-columns .column-datasets' ).empty().prepend( $msg );\n return $msg;\n },\n\n footerSettings : {\n '.hide-originals': 'hideOriginals',\n '.remove-extensions': 'removeExtensions'\n },\n\n /** add any jQuery/bootstrap/custom plugins to elements rendered */\n _addPluginComponents : function(){\n this._chooseFiltersPopover( '.choose-filters-link' );\n this.$( '.help-content i' ).hoverhighlight( '.collection-creator', 'rgba( 64, 255, 255, 1.0 )' );\n },\n\n /** build a filter selection popover allowing selection of common filter pairs */\n _chooseFiltersPopover : function( selector ){\n function filterChoice( val1, val2 ){\n return [\n ''\n ].join('');\n }\n var $popoverContent = $( _.template([\n '
', _l([\n 'Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ',\n 'These collections can be passed to tools and workflows in order to have analyses done on each member of ',\n 'the entire group. This interface allows you to create a collection, choose which datasets are paired, ',\n 'and re-order the final collection.'\n ].join( '' )), '
',\n '', _l([\n 'Unpaired datasets are shown in the unpaired section ',\n '(hover over the underlined words to highlight below). ',\n 'Paired datasets are shown in the paired section.',\n '
', _l([\n '
', _l([\n 'To unpair individual dataset pairs, click the ',\n 'unpair buttons ( ). ',\n 'Click the \"Unpair all\" link to unpair all pairs.'\n ].join( '' )), '
',\n '', _l([\n 'You can include or remove the file extensions (e.g. \".fastq\") from your pair names by toggling the ',\n '\"Remove file extensions from pair names?\" control.'\n ].join( '' )), '
',\n '', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\". ',\n '(Note: you do not have to pair all unpaired datasets to finish.)'\n ].join( '' )), '
'\n ].join(''))\n })\n});\n\n//=============================================================================\n/** a modal version of the paired collection creator */\nvar pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){\n\n var deferred = jQuery.Deferred(),\n creator;\n\n options = _.defaults( options || {}, {\n datasets : datasets,\n oncancel : function(){\n Galaxy.modal.hide();\n deferred.reject( 'cancelled' );\n },\n oncreate : function( creator, response ){\n Galaxy.modal.hide();\n deferred.resolve( response );\n }\n });\n\n if( !window.Galaxy || !Galaxy.modal ){\n throw new Error( 'Galaxy or Galaxy.modal not found' );\n }\n\n creator = new PairedCollectionCreator( options );\n Galaxy.modal.show({\n title : 'Create a collection of paired datasets',\n body : creator.$el,\n width : '80%',\n height : '800px',\n closing_events: true\n });\n creator.render();\n window.creator = creator;\n\n //TODO: remove modal header\n return deferred;\n};\n\n\n//=============================================================================\nfunction createListOfPairsCollection( collection, defaultHideSourceItems ){\n var elements = collection.toJSON();\n//TODO: validate elements\n return pairedCollectionCreatorModal( elements, {\n historyId : collection.historyId,\n defaultHideSourceItems: defaultHideSourceItems\n });\n}\n\n\n//=============================================================================\n return {\n PairedCollectionCreator : PairedCollectionCreator,\n pairedCollectionCreatorModal : pairedCollectionCreatorModal,\n createListOfPairsCollection : createListOfPairsCollection\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js","define([\n \"mvc/collection/list-collection-creator\",\n \"mvc/history/hdca-model\",\n \"mvc/base-mvc\",\n \"utils/localization\"\n], function( LIST_CREATOR, HDCA, BASE_MVC, _l ){\n\n'use strict';\n\nvar logNamespace = 'collections';\n/*==============================================================================\nTODO:\n the paired creator doesn't really mesh with the list creator as parent\n it may be better to make an abstract super class for both\n composites may inherit from this (or vis-versa)\n PairedDatasetCollectionElementView doesn't make a lot of sense\n\n==============================================================================*/\n/** */\nvar PairedDatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({\n _logNamespace : logNamespace,\n\n//TODO: use proper class (DatasetDCE or NestedDCDCE (or the union of both))\n tagName : 'li',\n className : 'collection-element',\n\n initialize : function( attributes ){\n this.element = attributes.element || {};\n this.identifier = attributes.identifier;\n },\n\n render : function(){\n this.$el\n .attr( 'data-element-id', this.element.id )\n .html( this.template({ identifier: this.identifier, element: this.element }) );\n return this;\n },\n\n //TODO: lots of unused space in the element - possibly load details and display them horiz.\n template : _.template([\n '<%- identifier %>',\n '<%- element.name %>',\n ].join('')),\n\n /** remove the DOM and any listeners */\n destroy : function(){\n this.off();\n this.$el.remove();\n },\n\n /** string rep */\n toString : function(){\n return 'DatasetCollectionElementView()';\n }\n});\n\n\n// ============================================================================\nvar _super = LIST_CREATOR.ListCollectionCreator;\n\n/** An interface for building collections.\n */\nvar PairCollectionCreator = _super.extend({\n\n /** the class used to display individual elements */\n elementViewClass : PairedDatasetCollectionElementView,\n /** the class this creator will create and save */\n collectionClass : HDCA.HistoryPairDatasetCollection,\n className : 'pair-collection-creator collection-creator flex-row-container',\n\n /** override to no-op */\n _mangleDuplicateNames : function(){},\n\n // TODO: this whole pattern sucks. There needs to be two classes of problem area:\n // bad inital choices and\n // when the user has painted his/her self into a corner during creation/use-of-the-creator\n /** render the entire interface */\n render : function( speed, callback ){\n if( this.workingElements.length === 2 ){\n return _super.prototype.render.call( this, speed, callback );\n }\n return this._renderInvalid( speed, callback );\n },\n\n // ------------------------------------------------------------------------ rendering elements\n /** render forward/reverse */\n _renderList : function( speed, callback ){\n //this.debug( '-- _renderList' );\n //precondition: there are two valid elements in workingElements\n var creator = this,\n $tmp = jQuery( '' ),\n $list = creator.$list();\n\n // lose the original views, create the new, append all at once, then call their renders\n _.each( this.elementViews, function( view ){\n view.destroy();\n creator.removeElementView( view );\n });\n $tmp.append( creator._createForwardElementView().$el );\n $tmp.append( creator._createReverseElementView().$el );\n $list.empty().append( $tmp.children() );\n _.invoke( creator.elementViews, 'render' );\n },\n\n /** create the forward element view */\n _createForwardElementView : function(){\n return this._createElementView( this.workingElements[0], { identifier: 'forward' } );\n },\n\n /** create the forward element view */\n _createReverseElementView : function(){\n return this._createElementView( this.workingElements[1], { identifier: 'reverse' } );\n },\n\n /** create an element view, cache in elementViews, and return */\n _createElementView : function( element, options ){\n var elementView = new this.elementViewClass( _.extend( options, {\n element : element,\n }));\n this.elementViews.push( elementView );\n return elementView;\n },\n\n /** swap the forward, reverse elements and re-render */\n swap : function(){\n this.workingElements = [\n this.workingElements[1],\n this.workingElements[0],\n ];\n this._renderList();\n },\n\n events : _.extend( _.clone( _super.prototype.events ), {\n 'click .swap' : 'swap',\n }),\n\n // ------------------------------------------------------------------------ templates\n //TODO: move to require text plugin and load these as text\n //TODO: underscore currently unnecc. bc no vars are used\n //TODO: better way of localizing text-nodes in long strings\n /** underscore template fns attached to class */\n templates : _.extend( _.clone( _super.prototype.templates ), {\n /** the middle: element list */\n middle : _.template([\n '', _l([\n 'Pair collections are permanent collections containing two datasets: one forward and one reverse. ',\n 'Often these are forward and reverse reads. The pair collections can be passed to tools and ',\n 'workflows in order to have analyses done on both datasets. This interface allows ',\n 'you to create a pair, name it, and swap which is forward and which reverse.'\n ].join( '' )), '
',\n '', _l([\n 'Once your collection is complete, enter a name and ',\n 'click \"Create list\".'\n ].join( '' )), '
'\n ].join('')),\n\n /** a simplified page communicating what went wrong and why the user needs to reselect something else */\n invalidInitial : _.template([\n '' + this.progressive + '...
';\n this.modal.$( '.modal-body' ).empty().append( indicator ).css({ 'margin-top': '8px' });\n },\n\n // (sorta) public interface - display the modal, render the form, and potentially copy the history\n // returns a jQuery.Deferred done->history copied, fail->user cancelled\n dialog : function _dialog( modal, history, options ){\n options = options || {};\n\n var dialog = this,\n deferred = jQuery.Deferred(),\n // TODO: getting a little byzantine here\n defaultCopyNameFn = options.nameFn || this.defaultName,\n defaultCopyName = defaultCopyNameFn({ name: history.get( 'name' ) }),\n // TODO: these two might be simpler as one 3 state option (all,active,no-choice)\n defaultCopyWhat = options.allDatasets? 'copy-all' : 'copy-non-deleted',\n allowAll = !_.isUndefined( options.allowAll )? options.allowAll : true,\n autoClose = !_.isUndefined( options.autoClose )? options.autoClose : true;\n\n this.modal = modal;\n\n\n // validate the name and copy if good\n function checkNameAndCopy(){\n var name = modal.$( '#copy-modal-title' ).val();\n if( !name ){\n modal.$( '.invalid-title' ).show();\n return;\n }\n // get further settings, shut down and indicate the ajax call, then hide and resolve/reject\n var copyAllDatasets = modal.$( 'input[name=\"copy-what\"]:checked' ).val() === 'copy-all';\n modal.$( 'button' ).prop( 'disabled', true );\n dialog._showAjaxIndicator();\n history.copy( true, name, copyAllDatasets )\n .done( function( response ){\n deferred.resolve( response );\n })\n .fail( function( xhr, status, message ){\n var options = { name: name, copyAllDatasets: copyAllDatasets };\n ERROR_MODAL.ajaxErrorModal( history, xhr, options, dialog.errorMessage );\n deferred.rejectWith( deferred, arguments );\n })\n .done( function(){\n if( autoClose ){ modal.hide(); }\n });\n }\n\n var originalClosingCallback = options.closing_callback;\n modal.show( _.extend( options, {\n title : this.title({ name: history.get( 'name' ) }),\n body : $( dialog._template({\n name : defaultCopyName,\n isAnon : Galaxy.user.isAnonymous(),\n allowAll : allowAll,\n copyWhat : defaultCopyWhat,\n activeLabel : this.activeLabel,\n allLabel : this.allLabel,\n anonWarning : this.anonWarning,\n })),\n buttons : _.object([\n [ _l( 'Cancel' ), function(){ modal.hide(); } ],\n [ this.submitLabel, checkNameAndCopy ]\n ]),\n height : 'auto',\n closing_events : true,\n closing_callback: function _historyCopyClose( cancelled ){\n if( cancelled ){\n deferred.reject({ cancelled : true });\n }\n if( originalClosingCallback ){\n originalClosingCallback( cancelled );\n }\n }\n }));\n\n // set the default dataset copy, autofocus the title, and set up for a simple return\n modal.$( '#copy-modal-title' ).focus().select();\n modal.$( '#copy-modal-title' ).on( 'keydown', function( ev ){\n if( ev.keyCode === 13 ){\n ev.preventDefault();\n checkNameAndCopy();\n }\n });\n\n return deferred;\n },\n};\n\n//==============================================================================\n// maintain the (slight) distinction between copy and import\n/**\n * Subclass CopyDialog to use the import language.\n */\nvar ImportDialog = _.extend( {}, CopyDialog, {\n defaultName : _.template( \"imported: <%- name %>\" ),\n title : _.template( _l( 'Importing history' ) + ' \"<%- name %>\"' ),\n submitLabel : _l( 'Import' ),\n errorMessage : _l( 'History could not be imported.' ),\n progressive : _l( 'Importing history' ),\n activeLabel : _l( 'Import only the active, non-deleted datasets' ),\n allLabel : _l( 'Import all datasets including deleted ones' ),\n anonWarning : _l( 'As an anonymous user, unless you login or register, you will lose your current history ' ) +\n _l( 'after importing this history. ' ),\n\n});\n\n//==============================================================================\n/**\n * Main interface for both history import and history copy dialogs.\n * @param {Backbone.Model} history the history to copy\n * @param {Object} options a hash\n * @return {jQuery.Deferred} promise that fails on close and succeeds on copy\n *\n * options:\n * (this object is also passed to the modal used to display the dialog and accepts modal options)\n * {Function} nameFn if defined, use this to build the default name shown to the user\n * (the fn is passed: {name:| Name | ' +\n 'Size | ' +\n 'Status | ' +\n '' +\n ' |
|---|
| ' +\n ' | ' +\n ' | Description | ' +\n 'Name | ' +\n 'Size | ' +\n 'Settings | ' +\n 'Status | ' +\n '
|---|
| Name | ' +\n 'Size | ' +\n 'Type | ' +\n 'Genome | ' +\n 'Settings | ' +\n 'Status | ' +\n '' +\n ' |
|---|