<% from galaxy.tools.parameters import DataToolParameter, RuntimeValue from galaxy.util.expressions import ExpressionContext %> <%def name="do_inputs( inputs, values, errors, prefix, ctx=None )"> <% ctx = ExpressionContext( values, ctx ) %> %for input_index, input in enumerate( inputs.itervalues() ): %if input.type == "repeat":
${input.title_plural}
<% repeat_values = values[input.name] %> %for i in range( len( repeat_values ) ): <% if input.name in errors: rep_errors = errors[input.name][i] else: rep_errors = dict() index = repeat_values[i]['__index__'] %>
${input.title} ${i + 1}
${do_inputs( input.inputs, repeat_values[ i ], rep_errors, prefix + input.name + "_" + str(index) + "|", ctx )}
%endfor
%elif input.type == "conditional": <% group_values = values[input.name] %> <% current_case = group_values['__current_case__'] %> <% group_prefix = prefix + input.name + "|" %> <% group_errors = errors.get( input.name, {} ) %> ${row_for_param( input.test_param, group_values[ input.test_param.name ], group_errors, group_prefix, ctx, allow_runtime=False )} ${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, group_prefix, ctx )} %else: %if input.name in values: ${row_for_param( input, values[ input.name ], errors, prefix, ctx )} %else: <% errors[ input.name ] = 'Value not stored, displaying default' %> ${row_for_param( input, input.get_initial_value( trans, values ), errors, prefix, ctx )} %endif %endif %endfor <%def name="row_for_param( param, value, error_dict, prefix, ctx, allow_runtime=True )"> %if error_dict.has_key( param.name ): <% cls = "form-row form-row-error" %> %else: <% cls = "form-row" %> %endif
## Data parameters are very special since their value / runtime state ## comes from connectors %if type( param ) is DataToolParameter:
Data input '${param.name}' (${" or ".join( param.extensions )})
%else: %if isinstance( value, RuntimeValue ):
To be set at runtime
%else:
${param.get_html_field( trans, value, ctx ).get_html( prefix )}
%endif %if error_dict.has_key( param.name ):
 ${error_dict[param.name]}
%endif %endif
Tool: ${tool.name}
%for i, inputs in enumerate( tool.inputs_by_page ): %if tool.has_multiple_pages:
Page ${i+1}
%endif ${do_inputs( inputs, values, errors, "" )} %endfor