root/galaxy-central/templates/workflow/display.mako @ 2

リビジョン 2, 4.2 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1<%inherit file="/display_base.mako"/>
2
3<%!
4    from galaxy.tools.parameters import DataToolParameter, RuntimeValue
5    from galaxy.web import form_builder
6%>
7
8<%def name="stylesheets()">
9    ${parent.stylesheets()}
10    ${h.css( "workflow" )}
11</%def>
12
13<%def name="do_inputs( inputs, values, prefix, step, other_values=None )">
14  %for input_index, input in enumerate( inputs.itervalues() ):
15    %if input.type == "repeat":
16      <div class="repeat-group">
17          <div class="form-title-row"><b>${input.title_plural}</b></div>
18          <% repeat_values = values[input.name] %>
19          %for i in range( len( repeat_values ) ):
20            <div class="repeat-group-item">
21                <% index = repeat_values[i]['__index__'] %>
22                <div class="form-title-row"><b>${input.title} ${i + 1}</b></div>
23                ${do_inputs( input.inputs, repeat_values[ i ], prefix + input.name + "_" + str(index) + "|", step, other_values )}
24            </div>
25          %endfor
26      </div>
27    %elif input.type == "conditional":
28      <% group_values = values[input.name] %>
29      <% current_case = group_values['__current_case__'] %>
30      <% new_prefix = prefix + input.name + "|" %>
31      ${row_for_param( input.test_param, group_values[ input.test_param.name ], other_values, prefix, step )}
32      ${do_inputs( input.cases[ current_case ].inputs, group_values, new_prefix, step, other_values )}
33    %else:
34      ${row_for_param( input, values[ input.name ], other_values, prefix, step )}
35    %endif
36  %endfor
37</%def>
38
39<%def name="row_for_param( param, value, other_values, prefix, step )">
40    <% cls = "form-row" %>
41    <div class="${cls}">
42        <label>${param.get_label()}</label>
43        <div>
44            %if isinstance( param, DataToolParameter ):
45                %if ( prefix + param.name ) in step.input_connections_by_name:
46                    <%
47                        conn = step.input_connections_by_name[ prefix + param.name ]
48                    %>
49                    Output dataset '${conn.output_name}' from step ${int(conn.output_step.order_index)+1}
50                %else:
51                    <i>select at runtime</i>
52                %endif
53            %else:
54                ${param.value_to_display_text( value, app )}
55            %endif
56        </div>
57    </div>
58</%def>
59
60
61<%def name="render_item_links( workflow )">
62    <a
63        href="${h.url_for( controller='/workflow', action='imp', id=trans.security.encode_id(workflow.id) )}"
64        class="icon-button import"
65        ## Needed to overwide initial width so that link is floated left appropriately.
66        style="width: 100%"
67        title="Import workflow">Import workflow</a>
68</%def>
69
70<%def name="render_item( workflow, steps )">
71    <%
72        # HACK: Rendering workflow steps requires that trans have a history; however, if it's  user's first visit to Galaxy is here, he won't have a history
73        # and an error will occur. To prevent this error, make sure user has a history.
74        trans.get_history( create=True )
75    %>
76    <table class="annotated-item">
77        <tr><th>Step</th><th class="annotation">Annotation</th></tr>
78        %for i, step in enumerate( steps ):
79            <tr><td>
80            %if step.type == 'tool' or step.type is None:
81              <% tool = app.toolbox.tools_by_id[step.tool_id] %>
82              <div class="toolForm">
83                  <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${tool.name}</div>
84                  <div class="toolFormBody">
85                    ${do_inputs( tool.inputs, step.state.inputs, "", step )}
86                  </div>
87              </div>
88            %else:
89            ## TODO: always input dataset?
90            <% module = step.module %>
91              <div class="toolForm">
92                  <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${module.name}</div>
93                  <div class="toolFormBody">
94                    ${do_inputs( module.get_runtime_inputs(), step.state.inputs, "", step )}
95                  </div>
96              </div>
97            %endif
98            </td>
99            <td class="annotation">
100                %if hasattr( step, "annotation") and step.annotation is not None:
101                    ${step.annotation}
102                %endif               
103            </td>
104            </tr>
105        %endfor
106    </table>
107</%def>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。