\";\n }\n });\n if ( upgrade_message ) {\n window.show_modal( \"Issues loading this workflow\", \"Please review the following issues, possibly resulting from tool upgrades or changes.
\";\n for (var ot_key in node.output_terminals){\n var output = node.output_terminals[ot_key];\n if (node.isWorkflowOutput(output.name)) {\n new_content += \"
\"+output.name +\"
\";\n }\n else{\n new_content += \"
\"+output.name +\"
\";\n }\n }\n new_content += \"
\";\n }\n }\n $(\"#output-fill-area\").html(new_content);\n $(\"#output-fill-area input\").bind('click', function(){\n var node_id = this.name.split('|')[0];\n var workflowNode = this.workflow.nodes[node_id];\n var output_name = this.name.split('|')[1];\n if (this.checked){\n workflowNode.addWorkflowOutput(output_name);\n }else{\n workflowNode.removeWorkflowOutput(output_name);\n }\n self.workflow.has_changes = true;\n });\n $('#workflow-output-area').show();\n }\n\n function layout_editor() {\n self.workflow.layout();\n self.workflow.fit_canvas_to_nodes();\n self.scroll_to_nodes();\n self.canvas_manager.draw_overview();\n }\n\n // On load, set the size to the pref stored in local storage if it exists\n var overview_size = $.jStorage.get(\"overview-size\");\n if (overview_size !== undefined) {\n $(\"#overview-border\").css( {\n width: overview_size,\n height: overview_size\n });\n }\n\n // Show viewport on load unless pref says it's off\n if ($.jStorage.get(\"overview-off\")) {\n hide_overview();\n } else {\n show_overview();\n }\n\n // Stores the size of the overview into local storage when it's resized\n $(\"#overview-border\").bind( \"dragend\", function( e, d ) {\n var op = $(this).offsetParent();\n var opo = op.offset();\n var new_size = Math.max( op.width() - ( d.offsetX - opo.left ),\n op.height() - ( d.offsetY - opo.top ) );\n $.jStorage.set(\"overview-size\", new_size + \"px\");\n });\n\n function show_overview() {\n $.jStorage.set(\"overview-off\", false);\n $(\"#overview-border\").css(\"right\", \"0px\");\n $(\"#close-viewport\").css(\"background-position\", \"0px 0px\");\n }\n\n function hide_overview() {\n $.jStorage.set(\"overview-off\", true);\n $(\"#overview-border\").css(\"right\", \"20000px\");\n $(\"#close-viewport\").css(\"background-position\", \"12px 0px\");\n }\n\n // Lets the overview be toggled visible and invisible, adjusting the arrows accordingly\n $(\"#close-viewport\").click( function() {\n if ( $(\"#overview-border\").css(\"right\") === \"0px\" ) {\n hide_overview();\n } else {\n show_overview();\n }\n });\n\n // Unload handler\n window.onbeforeunload = function() {\n if ( workflow && self.workflow.has_changes ) {\n return \"There are unsaved changes to your workflow which will be lost.\";\n }\n };\n\n this.options.workflows.length > 0 && $( \"#left\" ).find( \".toolMenu\" ).append( this._buildToolPanelWorkflows() );\n\n // Tool menu\n $( \"div.toolSectionBody\" ).hide();\n $( \"div.toolSectionTitle > span\" ).wrap( \"\" );\n var last_expanded = null;\n $( \"div.toolSectionTitle\" ).each( function() {\n var body = $(this).next( \"div.toolSectionBody\" );\n $(this).click( function() {\n if ( body.is( \":hidden\" ) ) {\n if ( last_expanded ) last_expanded.slideUp( \"fast\" );\n last_expanded = body;\n body.slideDown( \"fast\" );\n }\n else {\n body.slideUp( \"fast\" );\n last_expanded = null;\n }\n });\n });\n\n // Rename async.\n async_save_text(\"workflow-name\", \"workflow-name\", self.urls.rename_async, \"new_name\");\n\n // Tag async. Simply have the workflow edit element generate a click on the tag element to activate tagging.\n $('#workflow-tag').click( function() {\n $('.tag-area').click();\n return false;\n });\n // Annotate async.\n async_save_text(\"workflow-annotation\", \"workflow-annotation\", self.urls.annotate_async, \"new_annotation\", 25, true, 4);\n },\n\n _buildToolPanelWorkflows: function() {\n var self = this;\n var $section = $( '
\";\n });\n if ( upgrade_message ) {\n window.show_modal( \"Subworkflow embedded with changes\",\n \"Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
\" + upgrade_message + \"
\",\n { \"Continue\" : hide_modal } );\n } else {\n hide_modal();\n }\n },\n beforeSubmit: function( data ) {\n show_message( \"Importing workflow\", \"progress\" );\n }\n });\n },\n\n // Global state for the whole workflow\n reset: function() {\n this.workflow && this.workflow.remove_all();\n this.workflow = Globals.workflow = new Workflow( this, $(\"#canvas-container\") );\n },\n\n scroll_to_nodes: function () {\n var cv = $(\"#canvas-viewport\");\n var cc = $(\"#canvas-container\");\n var top, left;\n if ( cc.width() < cv.width() ) {\n left = ( cv.width() - cc.width() ) / 2;\n } else {\n left = 0;\n }\n if ( cc.height() < cv.height() ) {\n top = ( cv.height() - cc.height() ) / 2;\n } else {\n top = 0;\n }\n cc.css( { left: left, top: top } );\n },\n\n _workflowLoadAjax: function(workflowId, options) {\n $.ajax(Utils.merge(options, {\n url: this.urls.load_workflow,\n data: { id: workflowId, \"_\": \"true\" },\n dataType: 'json',\n cache: false\n }));\n },\n\n _moduleInitAjax: function(node, request_data) {\n var self = this;\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/workflows/build_module',\n data : request_data,\n success : function( data ) {\n node.init_field_data( data );\n node.update_field_data( data );\n self.workflow.activate_node( node );\n }\n });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_tool: function ( id, title ) {\n var node = this.workflow.create_node( 'tool', title, id );\n this._moduleInitAjax(node, { type: \"tool\", tool_id: id, \"_\": \"true\" });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_subworkflow: function ( id, title ) {\n var node = this.workflow.create_node( 'subworkflow', title, id );\n this._moduleInitAjax(node, { type: \"subworkflow\", content_id: id, \"_\": \"true\" });\n },\n\n add_node_for_module: function ( type, title ) {\n var node = this.workflow.create_node( type, title );\n this._moduleInitAjax(node, { type: type, \"_\": \"true\" });\n },\n\n // This function preloads how to display known pja's.\n display_pja: function (pja, node) {\n // DBTODO SANITIZE INPUTS.\n var self = this;\n $(\"#pja_container\").append( get_pja_form(pja, node) );\n $(\"#pja_container>.toolForm:last>.toolFormTitle>.buttons\").click(function (){\n var action_to_rem = $(this).closest(\".toolForm\", \".action_tag\").children(\".action_tag:first\").text();\n $(this).closest(\".toolForm\").remove();\n delete self.workflow.active_node.post_job_actions[action_to_rem];\n self.workflow.active_form_has_changes = true;\n });\n },\n\n display_pja_list: function (){\n return pja_list;\n },\n\n display_file_list: function (node){\n var addlist = \"\";\n return addlist;\n },\n\n new_pja: function (action_type, target, node){\n if (node.post_job_actions === undefined){\n //New tool node, set up dict.\n node.post_job_actions = {};\n }\n if (node.post_job_actions[action_type+target] === undefined) {\n var new_pja = {};\n new_pja.action_type = action_type;\n new_pja.output_name = target;\n node.post_job_actions[action_type+target] = null;\n node.post_job_actions[action_type+target] = new_pja;\n display_pja(new_pja, node);\n this.workflow.active_form_has_changes = true;\n return true;\n } else {\n return false;\n }\n },\n\n showWorkflowParameters: function () {\n var parameter_re = /\\$\\{.+?\\}/g;\n var workflow_parameters = [];\n var wf_parm_container = $( '#workflow-parameters-container' );\n var wf_parm_box = $( '#workflow-parameters-box' );\n var new_parameter_content = '';\n var matches = [];\n $.each(this.workflow.nodes, function ( k, node ){\n if ( node.config_form && node.config_form.inputs ) {\n Utils.deepeach( node.config_form.inputs, function( d ) {\n if ( typeof d.value == 'string' ) {\n var form_matches = d.value.match( parameter_re );\n if ( form_matches ) {\n matches = matches.concat( form_matches );\n }\n }\n });\n }\n if (node.post_job_actions){\n $.each(node.post_job_actions, function(k, pja){\n if (pja.action_arguments){\n $.each(pja.action_arguments, function(k, action_argument){\n var arg_matches = action_argument.match(parameter_re);\n if (arg_matches){\n matches = matches.concat(arg_matches);\n }\n });\n }\n });\n }\n if (matches){\n $.each(matches, function(k, element){\n if ($.inArray(element, workflow_parameters) === -1){\n workflow_parameters.push(element);\n }\n });\n }\n });\n if (workflow_parameters && workflow_parameters.length !== 0){\n $.each(workflow_parameters, function(k, element){\n new_parameter_content += \"
\" + element.substring(2, element.length -1) + \"
\";\n });\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.show();\n }else{\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.hide();\n }\n },\n\n showAttributes: function() {\n $( '.right-content' ).hide();\n $( '#edit-attributes' ).show();\n },\n\n showForm: function ( content, node ) {\n var self = this;\n var cls = 'right-content';\n var id = cls + '-' + node.id;\n var $container = $( '#' + cls );\n if ( content && $container.find( '#' + id ).length == 0 ) {\n var $el = $( '' );\n content.node = node;\n content.workflow = this.workflow;\n content.datatypes = this.datatypes;\n content.icon = WorkflowIcons[ node.type ];\n content.cls = 'ui-portlet-narrow';\n if ( node ) {\n var form_type = ( node.type == 'tool' ? 'Tool' : 'Default' );\n $el.append( ( new FormWrappers[ form_type ]( content ) ).form.$el );\n $container.append( $el );\n } else {\n Galaxy.emit.debug('workflow-view::initialize()', 'Node not found in workflow.');\n }\n }\n $( '.' + cls ).hide();\n $container.find( '#' + id ).show();\n $container.show();\n $container.scrollTop();\n },\n\n isSubType: function ( child, parent ) {\n child = this.ext_to_type[child];\n parent = this.ext_to_type[parent];\n return ( this.type_to_type[child] ) && ( parent in this.type_to_type[child] );\n },\n\n prebuildNode: function ( type, title_text, content_id ) {\n var self = this;\n var $f = $(\"\");\n var $title = $(\"
\";\n }\n });\n if ( upgrade_message ) {\n window.show_modal( \"Issues loading this workflow\", \"Please review the following issues, possibly resulting from tool upgrades or changes.
\";\n for (var ot_key in node.output_terminals){\n var output = node.output_terminals[ot_key];\n if (node.isWorkflowOutput(output.name)) {\n new_content += \"
\"+output.name +\"
\";\n }\n else{\n new_content += \"
\"+output.name +\"
\";\n }\n }\n new_content += \"
\";\n }\n }\n $(\"#output-fill-area\").html(new_content);\n $(\"#output-fill-area input\").bind('click', function(){\n var node_id = this.name.split('|')[0];\n var workflowNode = this.workflow.nodes[node_id];\n var output_name = this.name.split('|')[1];\n if (this.checked){\n workflowNode.addWorkflowOutput(output_name);\n }else{\n workflowNode.removeWorkflowOutput(output_name);\n }\n self.workflow.has_changes = true;\n });\n $('#workflow-output-area').show();\n }\n\n function layout_editor() {\n self.workflow.layout();\n self.workflow.fit_canvas_to_nodes();\n self.scroll_to_nodes();\n self.canvas_manager.draw_overview();\n }\n\n // On load, set the size to the pref stored in local storage if it exists\n var overview_size = $.jStorage.get(\"overview-size\");\n if (overview_size !== undefined) {\n $(\"#overview-border\").css( {\n width: overview_size,\n height: overview_size\n });\n }\n\n // Show viewport on load unless pref says it's off\n if ($.jStorage.get(\"overview-off\")) {\n hide_overview();\n } else {\n show_overview();\n }\n\n // Stores the size of the overview into local storage when it's resized\n $(\"#overview-border\").bind( \"dragend\", function( e, d ) {\n var op = $(this).offsetParent();\n var opo = op.offset();\n var new_size = Math.max( op.width() - ( d.offsetX - opo.left ),\n op.height() - ( d.offsetY - opo.top ) );\n $.jStorage.set(\"overview-size\", new_size + \"px\");\n });\n\n function show_overview() {\n $.jStorage.set(\"overview-off\", false);\n $(\"#overview-border\").css(\"right\", \"0px\");\n $(\"#close-viewport\").css(\"background-position\", \"0px 0px\");\n }\n\n function hide_overview() {\n $.jStorage.set(\"overview-off\", true);\n $(\"#overview-border\").css(\"right\", \"20000px\");\n $(\"#close-viewport\").css(\"background-position\", \"12px 0px\");\n }\n\n // Lets the overview be toggled visible and invisible, adjusting the arrows accordingly\n $(\"#close-viewport\").click( function() {\n if ( $(\"#overview-border\").css(\"right\") === \"0px\" ) {\n hide_overview();\n } else {\n show_overview();\n }\n });\n\n // Unload handler\n window.onbeforeunload = function() {\n if ( workflow && self.workflow.has_changes ) {\n return \"There are unsaved changes to your workflow which will be lost.\";\n }\n };\n\n this.options.workflows.length > 0 && $( \"#left\" ).find( \".toolMenu\" ).append( this._buildToolPanelWorkflows() );\n\n // Tool menu\n $( \"div.toolSectionBody\" ).hide();\n $( \"div.toolSectionTitle > span\" ).wrap( \"\" );\n var last_expanded = null;\n $( \"div.toolSectionTitle\" ).each( function() {\n var body = $(this).next( \"div.toolSectionBody\" );\n $(this).click( function() {\n if ( body.is( \":hidden\" ) ) {\n if ( last_expanded ) last_expanded.slideUp( \"fast\" );\n last_expanded = body;\n body.slideDown( \"fast\" );\n }\n else {\n body.slideUp( \"fast\" );\n last_expanded = null;\n }\n });\n });\n\n // Rename async.\n async_save_text(\"workflow-name\", \"workflow-name\", self.urls.rename_async, \"new_name\");\n\n // Tag async. Simply have the workflow edit element generate a click on the tag element to activate tagging.\n $('#workflow-tag').click( function() {\n $('.tag-area').click();\n return false;\n });\n // Annotate async.\n async_save_text(\"workflow-annotation\", \"workflow-annotation\", self.urls.annotate_async, \"new_annotation\", 25, true, 4);\n },\n\n _buildToolPanelWorkflows: function() {\n var self = this;\n var $section = $( '
\";\n });\n if ( upgrade_message ) {\n window.show_modal( \"Subworkflow embedded with changes\",\n \"Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
\" + upgrade_message + \"
\",\n { \"Continue\" : hide_modal } );\n } else {\n hide_modal();\n }\n },\n beforeSubmit: function( data ) {\n show_message( \"Importing workflow\", \"progress\" );\n }\n });\n },\n\n // Global state for the whole workflow\n reset: function() {\n this.workflow && this.workflow.remove_all();\n this.workflow = Globals.workflow = new Workflow( this, $(\"#canvas-container\") );\n },\n\n scroll_to_nodes: function () {\n var cv = $(\"#canvas-viewport\");\n var cc = $(\"#canvas-container\");\n var top, left;\n if ( cc.width() < cv.width() ) {\n left = ( cv.width() - cc.width() ) / 2;\n } else {\n left = 0;\n }\n if ( cc.height() < cv.height() ) {\n top = ( cv.height() - cc.height() ) / 2;\n } else {\n top = 0;\n }\n cc.css( { left: left, top: top } );\n },\n\n _workflowLoadAjax: function(workflowId, options) {\n $.ajax(Utils.merge(options, {\n url: this.urls.load_workflow,\n data: { id: workflowId, \"_\": \"true\" },\n dataType: 'json',\n cache: false\n }));\n },\n\n _moduleInitAjax: function(node, request_data) {\n var self = this;\n Utils.request({\n type : 'POST',\n url : Galaxy.root + 'api/workflows/build_module',\n data : request_data,\n success : function( data ) {\n node.init_field_data( data );\n node.update_field_data( data );\n self.workflow.activate_node( node );\n }\n });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_tool: function ( id, title ) {\n var node = this.workflow.create_node( 'tool', title, id );\n this._moduleInitAjax(node, { type: \"tool\", tool_id: id, \"_\": \"true\" });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_subworkflow: function ( id, title ) {\n var node = this.workflow.create_node( 'subworkflow', title, id );\n this._moduleInitAjax(node, { type: \"subworkflow\", content_id: id, \"_\": \"true\" });\n },\n\n add_node_for_module: function ( type, title ) {\n var node = this.workflow.create_node( type, title );\n this._moduleInitAjax(node, { type: type, \"_\": \"true\" });\n },\n\n // This function preloads how to display known pja's.\n display_pja: function (pja, node) {\n // DBTODO SANITIZE INPUTS.\n var self = this;\n $(\"#pja_container\").append( get_pja_form(pja, node) );\n $(\"#pja_container>.toolForm:last>.toolFormTitle>.buttons\").click(function (){\n var action_to_rem = $(this).closest(\".toolForm\", \".action_tag\").children(\".action_tag:first\").text();\n $(this).closest(\".toolForm\").remove();\n delete self.workflow.active_node.post_job_actions[action_to_rem];\n self.workflow.active_form_has_changes = true;\n });\n },\n\n display_pja_list: function (){\n return pja_list;\n },\n\n display_file_list: function (node){\n var addlist = \"\";\n return addlist;\n },\n\n new_pja: function (action_type, target, node){\n if (node.post_job_actions === undefined){\n //New tool node, set up dict.\n node.post_job_actions = {};\n }\n if (node.post_job_actions[action_type+target] === undefined) {\n var new_pja = {};\n new_pja.action_type = action_type;\n new_pja.output_name = target;\n node.post_job_actions[action_type+target] = null;\n node.post_job_actions[action_type+target] = new_pja;\n display_pja(new_pja, node);\n this.workflow.active_form_has_changes = true;\n return true;\n } else {\n return false;\n }\n },\n\n showWorkflowParameters: function () {\n var parameter_re = /\\$\\{.+?\\}/g;\n var workflow_parameters = [];\n var wf_parm_container = $( '#workflow-parameters-container' );\n var wf_parm_box = $( '#workflow-parameters-box' );\n var new_parameter_content = '';\n var matches = [];\n $.each(this.workflow.nodes, function ( k, node ){\n if ( node.config_form && node.config_form.inputs ) {\n Utils.deepeach( node.config_form.inputs, function( d ) {\n if ( typeof d.value == 'string' ) {\n var form_matches = d.value.match( parameter_re );\n if ( form_matches ) {\n matches = matches.concat( form_matches );\n }\n }\n });\n }\n if (node.post_job_actions){\n $.each(node.post_job_actions, function(k, pja){\n if (pja.action_arguments){\n $.each(pja.action_arguments, function(k, action_argument){\n var arg_matches = action_argument.match(parameter_re);\n if (arg_matches){\n matches = matches.concat(arg_matches);\n }\n });\n }\n });\n }\n if (matches){\n $.each(matches, function(k, element){\n if ($.inArray(element, workflow_parameters) === -1){\n workflow_parameters.push(element);\n }\n });\n }\n });\n if (workflow_parameters && workflow_parameters.length !== 0){\n $.each(workflow_parameters, function(k, element){\n new_parameter_content += \"
\" + element.substring(2, element.length -1) + \"
\";\n });\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.show();\n }else{\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.hide();\n }\n },\n\n showAttributes: function() {\n $( '.right-content' ).hide();\n $( '#edit-attributes' ).show();\n },\n\n showForm: function ( content, node ) {\n var self = this;\n var cls = 'right-content';\n var id = cls + '-' + node.id;\n var $container = $( '#' + cls );\n if ( content && $container.find( '#' + id ).length == 0 ) {\n var $el = $( '' );\n content.node = node;\n content.workflow = this.workflow;\n content.datatypes = this.datatypes;\n content.icon = WorkflowIcons[ node.type ];\n content.cls = 'ui-portlet-narrow';\n if ( node ) {\n var form_type = ( node.type == 'tool' ? 'Tool' : 'Default' );\n $el.append( ( new FormWrappers[ form_type ]( content ) ).form.$el );\n $container.append( $el );\n } else {\n Galaxy.emit.debug('workflow-view::initialize()', 'Node not found in workflow.');\n }\n }\n $( '.' + cls ).hide();\n $container.find( '#' + id ).show();\n $container.show();\n $container.scrollTop();\n },\n\n isSubType: function ( child, parent ) {\n child = this.ext_to_type[child];\n parent = this.ext_to_type[parent];\n return ( this.type_to_type[child] ) && ( parent in this.type_to_type[child] );\n },\n\n prebuildNode: function ( type, title_text, content_id ) {\n var self = this;\n var $f = $(\"\");\n var $title = $(\"
")}),t?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.
"+t+"
",{Continue:hide_modal}):hide_modal(),s.showWorkflowParameters()},beforeSubmit:function(o){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu($("#workflow-options-button"),{Save:r,"Save As":function(){var o=$('');window.show_modal("Save As a New Workflow",o,{OK:function(){var o=$("#workflow_rename").val().length>0?$("#workflow_rename").val():"SavedAs_"+s.workflow.name,t=$("#wf_annotation").val().length>0?$("#wf_annotation").val():"";$.ajax({url:s.urls.workflow_save_as,type:"POST",data:{workflow_name:o,workflow_annotation:t,workflow_data:function(){return JSON.stringify(s.workflow.to_simple())}}}).done(function(o){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+o,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})},Run:function(){window.location=Galaxy.root+"workflow/run?id="+s.options.id},"Edit Attributes":function(){s.workflow.clear_active_node()},"Auto Re-layout":function(){s.workflow.layout(),s.workflow.fit_canvas_to_nodes(),s.scroll_to_nodes(),s.canvas_manager.draw_overview()},Close:function(){if(s.workflow.check_changes_in_active_form(),workflow&&s.workflow.has_changes){var o=function(){window.onbeforeunload=void 0,window.document.location=s.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){r(null,o)}},{"Don't Save":o})}else window.document.location=s.urls.workflow_index}});var d=$.jStorage.get("overview-size");void 0!==d&&$("#overview-border").css({width:d,height:d}),$.jStorage.get("overview-off")?a():n(),$("#overview-border").bind("dragend",function(o,t){var e=$(this).offsetParent(),i=e.offset(),n=Math.max(e.width()-(t.offsetX-i.left),e.height()-(t.offsetY-i.top));$.jStorage.set("overview-size",n+"px")}),$("#close-viewport").click(function(){"0px"===$("#overview-border").css("right")?a():n()}),window.onbeforeunload=function(){if(workflow&&s.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&$("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),$("div.toolSectionBody").hide(),$("div.toolSectionTitle > span").wrap("");var c=null;$("div.toolSectionTitle").each(function(){var o=$(this).next("div.toolSectionBody");$(this).click(function(){o.is(":hidden")?(c&&c.slideUp("fast"),c=o,o.slideDown("fast")):(o.slideUp("fast"),c=null)})}),l("workflow-name","workflow-name",s.urls.rename_async,"new_name"),$("#workflow-tag").click(function(){return $(".tag-area").click(),!1}),l("workflow-annotation","workflow-annotation",s.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var o=this,t=$('
');return _.each(this.options.workflows,function(e){if(e.id!==o.options.id){var i=new r.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){e.step_count<2?o.copy_into_workflow(e.id,e.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+e.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),o.copy_into_workflow(e.id,e.name)}}})}}),n=$("").attr("href","#").html(e.name).on("click",function(){o.add_node_for_subworkflow(e.latest_id,e.name)});t.find(".toolSectionBg").append($("").addClass("toolTitle").append(n).append(i.$el))}}),t},copy_into_workflow:function(o){var t=this;this._workflowLoadAjax(o,{success:function(o){t.workflow.from_simple(o,!1);var e="";$.each(o.upgrade_messages,function(o,i){e+="
"}),e?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
"}),i.html(a),n.show()):(i.html(a),n.hide())},showAttributes:function(){$(".right-content").hide(),$("#edit-attributes").show()},showForm:function(o,t){var e="right-content",i=e+"-"+t.id,n=$("#"+e);if(o&&0==n.find("#"+i).length){var r=$('');if(o.node=t,o.workflow=this.workflow,o.datatypes=this.datatypes,o.icon=a[t.type],o.cls="ui-portlet-narrow",t){var l="tool"==t.type?"Tool":"Default";r.append(new s[l](o).form.$el),n.append(r)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}$("."+e).hide(),n.find("#"+i).show(),n.show(),n.scrollTop()},isSubType:function(o,t){return o=this.ext_to_type[o],t=this.ext_to_type[t],this.type_to_type[o]&&t in this.type_to_type[o]},prebuildNode:function(o,t,e){var i=this,a=$(""),s=$("
")}),t?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.
"+t+"
",{Continue:hide_modal}):hide_modal(),s.showWorkflowParameters()},beforeSubmit:function(o){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu($("#workflow-options-button"),{Save:r,"Save As":function(){var o=$('');window.show_modal("Save As a New Workflow",o,{OK:function(){var o=$("#workflow_rename").val().length>0?$("#workflow_rename").val():"SavedAs_"+s.workflow.name,t=$("#wf_annotation").val().length>0?$("#wf_annotation").val():"";$.ajax({url:s.urls.workflow_save_as,type:"POST",data:{workflow_name:o,workflow_annotation:t,workflow_data:function(){return JSON.stringify(s.workflow.to_simple())}}}).done(function(o){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+o,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})},Run:function(){window.location=Galaxy.root+"workflow/run?id="+s.options.id},"Edit Attributes":function(){s.workflow.clear_active_node()},"Auto Re-layout":function(){s.workflow.layout(),s.workflow.fit_canvas_to_nodes(),s.scroll_to_nodes(),s.canvas_manager.draw_overview()},Close:function(){if(s.workflow.check_changes_in_active_form(),workflow&&s.workflow.has_changes){var o=function(){window.onbeforeunload=void 0,window.document.location=s.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){r(null,o)}},{"Don't Save":o})}else window.document.location=s.urls.workflow_index}});var w=$.jStorage.get("overview-size");void 0!==w&&$("#overview-border").css({width:w,height:w}),$.jStorage.get("overview-off")?a():n(),$("#overview-border").bind("dragend",function(o,t){var e=$(this).offsetParent(),i=e.offset(),n=Math.max(e.width()-(t.offsetX-i.left),e.height()-(t.offsetY-i.top));$.jStorage.set("overview-size",n+"px")}),$("#close-viewport").click(function(){"0px"===$("#overview-border").css("right")?a():n()}),window.onbeforeunload=function(){if(workflow&&s.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&$("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),$("div.toolSectionBody").hide(),$("div.toolSectionTitle > span").wrap("");var c=null;$("div.toolSectionTitle").each(function(){var o=$(this).next("div.toolSectionBody");$(this).click(function(){o.is(":hidden")?(c&&c.slideUp("fast"),c=o,o.slideDown("fast")):(o.slideUp("fast"),c=null)})}),l("workflow-name","workflow-name",s.urls.rename_async,"new_name"),$("#workflow-tag").click(function(){return $(".tag-area").click(),!1}),l("workflow-annotation","workflow-annotation",s.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var o=this,t=$('
');return _.each(this.options.workflows,function(e){if(e.id!==o.options.id){var i=new r.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){e.step_count<2?o.copy_into_workflow(e.id,e.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+e.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),o.copy_into_workflow(e.id,e.name)}}})}}),n=$("").attr("href","#").html(e.name).on("click",function(){o.add_node_for_subworkflow(e.latest_id,e.name)});t.find(".toolSectionBg").append($("").addClass("toolTitle").append(n).append(i.$el))}}),t},copy_into_workflow:function(o){var t=this;this._workflowLoadAjax(o,{success:function(o){t.workflow.from_simple(o,!1);var e="";$.each(o.upgrade_messages,function(o,i){e+="
"}),e?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
"}),i.html(a),n.show()):(i.html(a),n.hide())},showAttributes:function(){$(".right-content").hide(),$("#edit-attributes").show()},showForm:function(o,t){var e="right-content",i=e+"-"+t.id,n=$("#"+e);if(o&&0==n.find("#"+i).length){var r=$('');if(o.node=t,o.workflow=this.workflow,o.datatypes=this.datatypes,o.icon=a[t.type],o.cls="ui-portlet-narrow",t){var l="tool"==t.type?"Tool":"Default";r.append(new s[l](o).form.$el),n.append(r)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}$("."+e).hide(),n.find("#"+i).show(),n.show(),n.scrollTop()},isSubType:function(o,t){return o=this.ext_to_type[o],t=this.ext_to_type[t],this.type_to_type[o]&&t in this.type_to_type[o]},prebuildNode:function(o,t,e){var i=this,a=$(""),s=$("