Re-insert classic tool form

This commit is contained in:
guerler
2015-04-10 01:07:36 -04:00
parent 388587de1c
commit 182fac5ad6
4 changed files with 460 additions and 20 deletions
@@ -200,6 +200,13 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
inputs : this.options.inputs
});
// switch to classic tool form mako if the form definition is incompatible
if (this.incompatible) {
this.$el.hide();
$('#tool-form-classic').show();
return;
}
// create portlet
this.portlet = new Portlet.View({
icon : 'fa-wrench',
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"form-view.js","sources":["../../../src/mvc/form/form-view.js"],"names":["define","Utils","Portlet","Ui","FormSection","FormData","Backbone","View","extend","initialize","options","this","optionsDefault","is_dynamic","narrow","initial_errors","cls","merge","console","debug","galaxy","parent","Galaxy","modal","Modal","setElement","_build","update","new_model","self","data","matchModel","input_id","node","input","input_list","_","isEqual","field","field_list","new_options","indexOf","type","i","opt","length","push","label","value","trigger","wait","active","unwait","reciept","$el","empty","append","highlight","message","silent","input_element","element_list","error","$","animate","scrollTop","offset","top","errors","error_messages","matchResponse","off","_renderForm","create","current_check","checksum","on","new_check","onchange","reset","Message","section","inputs","portlet","icon","title","operations","buttons","addClass","persistent","status"],"mappings":"AAGAA,QAAQ,cAAe,oBAAqB,iBACpC,wBAAyB,sBAC7B,SAASC,EAAOC,EAASC,EAAIC,EAAaC,GAG1C,MAAOC,UAASC,KAAKC,QAEjBC,WAAY,SAASC,GAEjBC,KAAKC,gBAEDC,YAAkB,EAElBC,QAAkB,EAElBC,gBAAkB,EAElBC,IAAkB,sBAItBL,KAAKD,QAAUT,EAAMgB,MAAMP,EAASC,KAAKC,gBAGzCM,QAAQC,MAAMR,KAAKD,QAGnB,IAAIU,GAASC,OAAOC,MAEhBX,MAAKY,MADLH,GAAUA,EAAOG,MACJH,EAAOG,MAEP,GAAIpB,GAAGqB,MAAMjB,KAI9BI,KAAKc,WAAW,UAGhBd,KAAKe,UAITC,OAAQ,SAASC,GACb,GAAIC,GAAOlB,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/B,QACT8D,YAAc,EACdC,OAAc,UACdhC,QAAc/C,KAAKD,QAAQgD,UAKnCxC,QAAQC,MAAM"}
{"version":3,"file":"form-view.js","sources":["../../../src/mvc/form/form-view.js"],"names":["define","Utils","Portlet","Ui","FormSection","FormData","Backbone","View","extend","initialize","options","this","optionsDefault","is_dynamic","narrow","initial_errors","cls","merge","console","debug","galaxy","parent","Galaxy","modal","Modal","setElement","_build","update","new_model","self","data","matchModel","input_id","node","input","input_list","_","isEqual","field","field_list","new_options","indexOf","type","i","opt","length","push","label","value","trigger","wait","active","unwait","reciept","$el","empty","append","highlight","message","silent","input_element","element_list","error","$","animate","scrollTop","offset","top","errors","error_messages","matchResponse","off","_renderForm","create","current_check","checksum","on","new_check","onchange","reset","Message","section","inputs","incompatible","hide","show","portlet","icon","title","operations","buttons","addClass","persistent","status"],"mappings":"AAGAA,QAAQ,cAAe,oBAAqB,iBACpC,wBAAyB,sBAC7B,SAASC,EAAOC,EAASC,EAAIC,EAAaC,GAG1C,MAAOC,UAASC,KAAKC,QAEjBC,WAAY,SAASC,GAEjBC,KAAKC,gBAEDC,YAAkB,EAElBC,QAAkB,EAElBC,gBAAkB,EAElBC,IAAkB,sBAItBL,KAAKD,QAAUT,EAAMgB,MAAMP,EAASC,KAAKC,gBAGzCM,QAAQC,MAAMR,KAAKD,QAGnB,IAAIU,GAASC,OAAOC,MAEhBX,MAAKY,MADLH,GAAUA,EAAOG,MACJH,EAAOG,MAEP,GAAIpB,GAAGqB,MAAMjB,KAI9BI,KAAKc,WAAW,UAGhBd,KAAKe,UAITC,OAAQ,SAASC,GACb,GAAIC,GAAOlB,IACXA,MAAKmB,KAAKC,WAAWH,EAAW,SAASI,EAAUC,GAC/C,GAAIC,GAAQL,EAAKM,WAAWH,EAC5B,IAAIE,GAASA,EAAMxB,UACV0B,EAAEC,QAAQH,EAAMxB,QAASuB,EAAKvB,SAAU,CAEzCwB,EAAMxB,QAAUuB,EAAKvB,OAGrB,IAAI4B,GAAQT,E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-misc","mvc/form/form-section","mvc/form/form-data"],function(a,b,c,d,e){return Backbone.View.extend({initialize:function(b){this.optionsDefault={is_dynamic:!0,narrow:!1,initial_errors:!1,cls:"ui-portlet-limited"},this.options=a.merge(b,this.optionsDefault),console.debug(this.options);var d=parent.Galaxy;this.modal=d&&d.modal?d.modal:new c.Modal.View,this.setElement("<div/>"),this._build()},update:function(a){var b=this;this.data.matchModel(a,function(a,c){var d=b.input_list[a];if(d&&d.options&&!_.isEqual(d.options,c.options)){d.options=c.options;var e=b.field_list[a];if(e.update){var f=[];if(-1!=["data","data_collection","drill_down"].indexOf(d.type))f=d.options;else for(var g in c.options){var h=c.options[g];h.length>2&&f.push({label:h[0],value:h[1]})}e.update(f),e.trigger("change"),console.debug("Updating options for "+a)}}})},wait:function(a){for(var b in this.input_list){var c=this.field_list[b],d=this.input_list[b];d.is_dynamic&&c.wait&&c.unwait&&(a?c.wait():c.unwait())}},reciept:function(a){this.$el.empty(),this.$el.append(a)},highlight:function(a,b,c){var d=this.element_list[a];d&&(d.error(b||"Please verify this parameter."),c||$("html, body").animate({scrollTop:d.$el.offset().top-20},500))},errors:function(a){if(this.trigger("reset"),a&&a.errors){var b=this.data.matchResponse(a.errors);for(var c in this.element_list){{this.element_list[c]}b[c]&&this.highlight(c,b[c],!0)}}},_build:function(){var a=this;this.off("change"),this.off("reset"),this.field_list={},this.input_list={},this.element_list={},this.data=new e(this),this._renderForm(),this.data.create(),this.options.initial_errors&&this.errors(this.options);var b=this.data.checksum();this.on("change",function(){var c=a.data.checksum();c!=b&&(b=c,a.options.onchange&&a.options.onchange())}),this.on("reset",function(){for(var a in this.element_list)this.element_list[a].reset()})},_renderForm:function(){this.message=new c.Message,this.section=new d.View(this,{inputs:this.options.inputs}),this.portlet=new b.View({icon:"fa-wrench",title:this.options.title,cls:this.options.cls,operations:this.options.operations,buttons:this.options.buttons}),this.portlet.append(this.message.$el.addClass("ui-margin-top")),this.portlet.append(this.section.$el),this.$el.empty(),this.$el.append(this.portlet.$el),this.options.message&&this.message.update({persistent:!0,status:"warning",message:this.options.message}),console.debug("tools-form-base::initialize() - Completed.")}})});
define(["utils/utils","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/form/form-section","mvc/form/form-data"],function(a,b,c,d,e){return Backbone.View.extend({initialize:function(b){this.optionsDefault={is_dynamic:!0,narrow:!1,initial_errors:!1,cls:"ui-portlet-limited"},this.options=a.merge(b,this.optionsDefault),console.debug(this.options);var d=parent.Galaxy;this.modal=d&&d.modal?d.modal:new c.Modal.View,this.setElement("<div/>"),this._build()},update:function(a){var b=this;this.data.matchModel(a,function(a,c){var d=b.input_list[a];if(d&&d.options&&!_.isEqual(d.options,c.options)){d.options=c.options;var e=b.field_list[a];if(e.update){var f=[];if(-1!=["data","data_collection","drill_down"].indexOf(d.type))f=d.options;else for(var g in c.options){var h=c.options[g];h.length>2&&f.push({label:h[0],value:h[1]})}e.update(f),e.trigger("change"),console.debug("Updating options for "+a)}}})},wait:function(a){for(var b in this.input_list){var c=this.field_list[b],d=this.input_list[b];d.is_dynamic&&c.wait&&c.unwait&&(a?c.wait():c.unwait())}},reciept:function(a){this.$el.empty(),this.$el.append(a)},highlight:function(a,b,c){var d=this.element_list[a];d&&(d.error(b||"Please verify this parameter."),c||$("html, body").animate({scrollTop:d.$el.offset().top-20},500))},errors:function(a){if(this.trigger("reset"),a&&a.errors){var b=this.data.matchResponse(a.errors);for(var c in this.element_list){{this.element_list[c]}b[c]&&this.highlight(c,b[c],!0)}}},_build:function(){var a=this;this.off("change"),this.off("reset"),this.field_list={},this.input_list={},this.element_list={},this.data=new e(this),this._renderForm(),this.data.create(),this.options.initial_errors&&this.errors(this.options);var b=this.data.checksum();this.on("change",function(){var c=a.data.checksum();c!=b&&(b=c,a.options.onchange&&a.options.onchange())}),this.on("reset",function(){for(var a in this.element_list)this.element_list[a].reset()})},_renderForm:function(){return this.message=new c.Message,this.section=new d.View(this,{inputs:this.options.inputs}),this.incompatible?(this.$el.hide(),void $("#tool-form-classic").show()):(this.portlet=new b.View({icon:"fa-wrench",title:this.options.title,cls:this.options.cls,operations:this.options.operations,buttons:this.options.buttons}),this.portlet.append(this.message.$el.addClass("ui-margin-top")),this.portlet.append(this.section.$el),this.$el.empty(),this.$el.append(this.portlet.$el),this.options.message&&this.message.update({persistent:!0,status:"warning",message:this.options.message}),void console.debug("tools-form-base::initialize() - Completed."))}})});
//# sourceMappingURL=../../../maps/mvc/form/form-view.js.map
+451 -18
View File
@@ -3,22 +3,455 @@
${h.js("libs/bibtex", "libs/jquery/jquery-ui")}
${h.css('base', 'jquery-ui/smoothness/jquery-ui')}
<%
## TEMPORARY: create tool dictionary in mako while both tool forms are in use.
## This avoids making two separate requests since the classic form requires the mako anyway.
params = dict(trans.request.params)
params['__dataset_id__'] = params.get('id', None)
self.form_config = tool.to_json(trans, params)
self.form_config.update({
'id' : tool.id,
'job_id' : trans.security.encode_id( job.id ) if job else None,
'history_id' : trans.security.encode_id( trans.history.id )
})
%>
<script>
require(['mvc/tools/tools-form'], function(ToolsForm){
$(function(){
var form = new ToolsForm.View(${ h.dumps(self.form_config) });
## skip new tool form code if disabled
%if util.string_as_bool(trans.app.config.get('toolform_upgrade', True)):
<%
## TEMPORARY: create tool dictionary in mako while both tool forms are in use.
## This avoids making two separate requests since the classic form requires the mako anyway.
params = dict(trans.request.params)
params['__dataset_id__'] = params.get('id', None)
self.form_config = tool.to_json(trans, params)
self.form_config.update({
'id' : tool.id,
'job_id' : trans.security.encode_id( job.id ) if job else None,
'history_id' : trans.security.encode_id( trans.history.id )
})
%>
<script>
require(['mvc/tools/tools-form'], function(ToolsForm){
$(function(){
var form = new ToolsForm.View(${ h.dumps(self.form_config) });
});
});
});
</script>
</script>
<div id="tool-form-classic" style="display: none;">
%else:
<div id="tool-form-classic">
%endif
<%namespace file="/message.mako" import="render_msg" />
<%namespace file="/base_panels.mako" import="overlay" />
<% import galaxy.util %>
<%def name="stylesheets()">
${h.css( "autocomplete_tagging", "base", "library" )}
<style type="text/css">
html, body {
background-color: #fff;
}
</style>
</%def>
<%def name="javascripts()">
${parent.javascripts()}
${h.js( "galaxy.panels", "libs/jquery/jstorage" )}
${h.js( "libs/bibtex" )}
<script type="text/javascript">
require( [ "galaxy.tools" ] );
window.enhanced_galaxy_tools = true;
</script>
<script type="text/javascript">
$(function() {
$(window).bind("refresh_on_change", function() {
$(':file').each( function() {
var file = $(this);
var file_value = file.val();
if (file_value) {
// disable file input, since we don't want to upload the file on refresh
var file_name = $(this).attr("name");
file.attr( { name: 'replaced_file_input_' + file_name, disabled: true } );
// create a new hidden field which stores the filename and has the original name of the file input
var new_file_input = $(document.createElement('input'));
new_file_input.attr( { "type": "hidden", "value": file_value, "name": file_name } );
file.after(new_file_input);
}
});
});
// For drilldown parameters: add expand/collapse buttons and collapse initially-collapsed elements
$( 'div.drilldown-container' ).each( function() {
$(this).find('span.form-toggle' ).each( function() {
var show_hide_click_elt = $(this);
var group_id = show_hide_click_elt.attr('id').substring( 0, show_hide_click_elt.attr('id').lastIndexOf( '-click' ) );
$('#' + group_id + '-container').each( function() {
var show_hide_elt = $(this);
if ( show_hide_click_elt.hasClass( 'toggle-expand' ) ) {
show_hide_elt.hide();
}
show_hide_click_elt.click( function() {
if ( show_hide_click_elt.hasClass("toggle") ){
show_hide_click_elt.addClass("toggle-expand");
show_hide_click_elt.removeClass("toggle");
show_hide_elt.slideUp( 'fast' );
}
else {
show_hide_click_elt.addClass("toggle");
show_hide_click_elt.removeClass("toggle-expand");
show_hide_elt.slideDown( 'fast' );
}
});
});
});
});
$(".add-librarydataset").click(function() {
var link = $(this);
$.ajax({
url: "/visualization/list_libraries",
error: function(xhr, ajaxOptions, thrownError) { alert( "Grid failed" ); console.log(xhr, ajaxOptions, thrownError); },
success: function(table_html) {
show_modal(
"Select Library Dataset",
table_html, {
"Cancel": function() {
hide_modal();
},
"Select": function() {
var names = [];
var ids = [];
counter = 1;
$('input[name=ldda_ids]:checked').each(function() {
var name = $.trim( $(this).siblings("label").text() );
var id = $(this).val();
names.push( counter + ". " + name );
counter += 1;
ids.push(id);
});
link.html( names.join("<br/>") );
link.siblings("input[type=hidden]").val( ids.join("||") );
hide_modal();
}
}
);
}
});
});
});
%if not add_frame.debug:
if( window.name != "galaxy_main" ) {
location.replace( '${h.url_for( controller='root', action='index', tool_id=tool.id )}' );
}
%endif
</script>
</%def>
<%def name="do_inputs( inputs, tool_state, errors, prefix, other_values=None )">
<%
from galaxy.util.expressions import ExpressionContext
other_values = ExpressionContext( tool_state, other_values )
%>
%for input_index, input in enumerate( inputs.itervalues() ):
%if not input.visible:
<% pass %>
%elif input.type == "repeat":
<div class="repeat-group">
<div class="form-title-row"><strong>${input.title_plural}</strong>
%if input.help:
<div class="toolParamHelp" style="clear: both;">
${input.help}
</div>
%endif
</div>
<%
repeat_state = tool_state[input.name]
num_repeats = len( repeat_state )
%>
%for i in range( num_repeats ):
<div class="repeat-group-item">
<%
if input.name in errors:
rep_errors = errors[input.name][i]
else:
rep_errors = dict()
index = repeat_state[i]['__index__']
%>
<div class="form-title-row"><strong>${input.title} ${i + 1}</strong></div>
${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
%if input.min < num_repeats:
<div class="form-row"><input type="submit" class="btn" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
%endif
</div>
%if rep_errors.has_key( '__index__' ):
<div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}">&nbsp;<span style="vertical-align: middle;">${rep_errors['__index__']}</span></div>
%endif
%endfor
%if input.max > num_repeats:
<div class="form-row"><input type="submit" class="btn" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div>
%endif
</div>
%elif input.type == "conditional":
<%
group_state = tool_state[input.name]
group_errors = errors.get( input.name, {} )
current_case = group_state['__current_case__']
group_prefix = prefix + input.name + "|"
%>
%if input.value_ref_in_group:
${row_for_param( group_prefix, input.test_param, group_state, group_errors, other_values )}
%endif
${do_inputs( input.cases[current_case].inputs, group_state, group_errors, group_prefix, other_values )}
%elif input.type == "upload_dataset":
%if input.get_datatype( trans, other_values ).composite_type is None: #have non-composite upload appear as before
<%
if input.name in errors:
rep_errors = errors[input.name][0]
else:
rep_errors = dict()
%>
${do_inputs( input.inputs, tool_state[input.name][0], rep_errors, prefix + input.name + "_" + str( 0 ) + "|", other_values )}
%else:
<div class="repeat-group">
<div class="form-title-row"><strong>${input.group_title( other_values )}</strong></div>
<%
repeat_state = tool_state[input.name]
%>
%for i in range( len( repeat_state ) ):
<div class="repeat-group-item">
<%
if input.name in errors:
rep_errors = errors[input.name][i]
else:
rep_errors = dict()
index = repeat_state[i]['__index__']
%>
<div class="form-title-row"><strong>File Contents for ${input.title_by_index( trans, i, other_values )}</strong></div>
${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
##<div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
</div>
%endfor
##<div class="form-row"><input type="submit" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div>
</div>
%endif
%elif input.type != "section":
${row_for_param( prefix, input, tool_state, errors, other_values )}
%endif
%endfor
</%def>
<%def name="row_for_param( prefix, param, parent_state, parent_errors, other_values )">
<%
if parent_errors.has_key( param.name ):
cls = "form-row form-row-error"
else:
cls = "form-row"
field = param.get_html_field( trans, parent_state[ param.name ], other_values )
field.refresh_on_change = param.refresh_on_change
# Field may contain characters submitted by user and these characters may
# be unicode; handle non-ascii characters gracefully.
field_html = field.get_html( prefix )
if type( field_html ) is not unicode:
field_html = unicode( field_html, 'utf-8', 'replace' )
if param.type == "hidden":
return field_html
%>
<div class="${cls}">
${label_for_param( param )}
${input_for_param( param, field_html )}
${errors_for_param( param, parent_errors )}
${help_for_param( param )}
<div style="clear: both;"></div>
</div>
</%def>
<%def name="input_for_param( param, field_html )">
<div class="form-row-input">${field_html}</div>
</%def>
<%def name="label_for_param( param )">
<% label = param.get_label()%>
%if label:
<label for="${param.name}">${label}:</label>
%endif
</%def>
<%def name="errors_for_param( param, parent_errors )">
%if parent_errors.has_key( param.name ):
<div class="form-row-error-message">
<div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}">&nbsp;<span style="vertical-align: middle;">${parent_errors[param.name]}</span></div>
</div>
%endif
</%def>
<%def name="help_for_param( param )">
%if param.help:
<div class="toolParamHelp" style="clear: both;">
${param.help}
</div>
%endif
</%def>
<%def name="row_for_rerun()">
%if trans.app.config.track_jobs_in_database and tool_state.rerun_remap_job_id is not None:
<div id="remap-row" class="form-row">
<input type="checkbox" name="rerun_remap_job_id" value="${tool_state.rerun_remap_job_id}"> Resume dependencies from this job
<div class="toolParamHelp" style="clear: both;">
The previous run of this tool failed and other tools were waiting for it to finish successfully, use this option to resume those tools using the outputs of this tool run.
</div>
</div>
<div style="clear: both;"></div>
%endif
</%def>
<% overlay(visible=False) %>
%if add_frame.from_noframe:
<div class="warningmessage">
<strong>Welcome to Galaxy</strong>
<hr/>
It appears that you found this tool from a link outside of Galaxy.
If you're not familiar with Galaxy, please consider visiting the
<a href="${h.url_for( controller='root' )}" target="_top">welcome page</a>.
To learn more about what Galaxy is and what it can do for you, please visit
the <a href="${add_frame.wiki_url}" target="_top">Galaxy wiki</a>.
</div>
<br/>
%endif
<%
# Render an error message if a dynamically generated select list is missing a required
# index file or entry in the tool_data_table_conf.xml file.
message = ""
params_with_missing_data_table_entry = tool.params_with_missing_data_table_entry
params_with_missing_index_file = tool.params_with_missing_index_file
if params_with_missing_data_table_entry:
param = params_with_missing_data_table_entry[0]
message += "Data table named '%s' is required by tool but not configured. " % param.options.missing_tool_data_table_name
if tool.params_with_missing_index_file:
param = params_with_missing_index_file[0]
message += "Index file named '%s' is required by tool but not available. " % param.options.missing_index_file
# Handle calculating the redirect url for the special case where we have nginx proxy
# upload and need to do url_for on the redirect portion of the tool action.
try:
tool_url = h.url_for(tool.action)
except AttributeError:
assert len(tool.action) == 2
tool_url = tool.action[0] + h.url_for(tool.action[1])
%>
<%
# Name of the tool in lower case
low_tool_name = tool.name.lower()
%>
%if tool_id_version_message:
${render_msg( tool_id_version_message, 'warning' )}
%endif
<div class="toolForm" id="${tool.id}">
<form id="tool_form" name="tool_form" action="${tool_url}" enctype="${tool.enctype}" target="${tool.target}" method="${tool.method}">
%if tool.has_multiple_pages:
<div class="toolFormTitle">${tool.name} (step ${tool_state.page+1} of ${tool.npages})
%elif not tool_version_select_field:
<div class="toolFormTitle">${tool.name} (Galaxy tool version ${tool.version})
%else:
<div class="toolFormTitle">${tool.name} ${tool_version_select_field.get_html()}
%endif
## Show information button with underlying requirements and their versions
%if tool.requirements:
<a href="#" class="icon-btn" title="Underlying versions" tabindex="0" data-toggle="popover" data-placement="bottom" data-content=
"
%for i, requirement in enumerate( tool.requirements ):
${ requirement.name } ${ ('v ' + requirement.version ) if requirement.version else ' ' } ${ '' if i + 1 == len( tool.requirements ) else ' | ' }
%endfor
"
onclick="$(function () {
$( '[ data-toggle=\'popover\' ]' ).popover();
$( this ).popover( 'show' );
})">
<span class="fa fa-info-circle"></span>
</a>
%endif
<span class="pull-right">
%if trans.app.config.biostar_url:
## BioStar links
Help from Biostar
<div class="icon-btn-group">
<a href="${h.url_for( controller='biostar', action='biostar_tool_tag_redirect', tool_id=tool.id )}"
target="_blank" class="icon-btn" title="Search for this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-search"></span></a>
<a href="${h.url_for( controller='biostar', action='biostar_tool_question_redirect', tool_id=tool.id )}"
target="_blank" class="icon-btn" title="Ask a question about this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-question-circle"></a>
</div>
%endif
<div class="icon-btn-group">
<a href="#" data-link="${h.url_for( controller='root', action='index', tool_id=tool.id, qualified=True )}"
class="icon-btn tool-share-link" title="Share this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-share"></span></a>
</div>
</span>
</div>
<div class="toolFormBody">
<input type="hidden" name="refresh" value="refresh">
<input type="hidden" name="tool_id" value="${tool.id}">
<input type="hidden" name="tool_state" value="${util.object_to_string( tool_state.encode( tool, app ) )}">
%if tool.display_by_page[tool_state.page]:
${trans.fill_template_string( tool.display_by_page[tool_state.page], context=tool.get_param_html_map( trans, tool_state.page, tool_state.inputs ) )}
${row_for_rerun()}
<input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">
%else:
${do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, errors, "" )}
%if tool_state.page == tool.last_page:
${row_for_rerun()}
%endif
<div class="form-row form-actions">
%if tool_state.page == tool.last_page:
<input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">
%else:
<input type="submit" class="btn btn-primary" name="runtool_btn" value="Next step">
%endif
</div>
%endif
</div>
</form>
</div>
%if tool.help:
<div class="toolHelp">
<div class="toolHelpBody">
<%
if tool.has_multiple_pages:
tool_help = tool.help_by_page[tool_state.page]
else:
tool_help = tool.help
# Help is Mako template, so render using current static path.
tool_help = tool_help.render( static_path=h.url_for( '/static' ), host_url=h.url_for('/', qualified=True) )
# Convert to unicode to display non-ascii characters.
if type( tool_help ) is not unicode:
tool_help = unicode( tool_help, 'utf-8')
%>
${tool_help}
</div>
</div>
%endif
%if tool.tool_shed_repository:
<% tool_url = tool.tool_shed_repository.get_sharable_url( tool.app ) %>
%if tool_url:
<br/>
${ render_msg( 'This tool was installed from a ToolShed, you may be able to find additional information by following this link: <a href="%s" target="_blank">%s</a>' % ( tool_url, tool_url ), 'info' ) }
%endif
%endif
%if tool.citations:
<script>
require(["mvc/citation/citation-model", "mvc/citation/citation-view"
], function( citationModel, citationView ){
$(function() {
var citations = new citationModel.ToolCitationCollection();
citations.tool_id = "${tool.id}";
var citation_list_view = new citationView.CitationListView({ collection: citations } );
citation_list_view.render();
citations.fetch();
} );
} );
</script>
<div id="citations">
</div>
%endif
</div>