root/galaxy-central/templates/workflow/run.mako @ 3

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

import galaxy-central

行番号 
1<%inherit file="/base.mako"/>
2
3<%def name="javascripts()">
4    ${parent.javascripts()}
5    ${h.js( "jquery.autocomplete" )}
6    <script type="text/javascript">       
7        $( function() {
8            $( "select[refresh_on_change='true']").change( function() {
9                $( "#tool_form" ).submit();
10            });
11        });
12    </script>
13</%def>
14
15<%def name="stylesheets()">
16    ${parent.stylesheets()}
17    ${h.css( "autocomplete_tagging" )}
18    <style type="text/css">
19    div.toolForm{
20        margin-top: 10px;
21        margin-bottom: 10px;
22    }
23    </style>
24</%def>
25
26<%
27from galaxy.tools.parameters import DataToolParameter, RuntimeValue
28from galaxy.jobs.actions.post import ActionBox
29%>
30
31<%def name="do_inputs( inputs, values, errors, prefix, step, other_values = None )">
32  %if other_values is None:
33      <% other_values = values %>
34  %endif
35  %for input_index, input in enumerate( inputs.itervalues() ):
36    %if input.type == "repeat":
37      <div class="repeat-group">
38          <div class="form-title-row"><b>${input.title_plural}</b></div>
39          <% repeat_values = values[input.name] %>
40          %for i in range( len( repeat_values ) ):
41            %if input.name in errors:
42                <% rep_errors = errors[input.name][i] %>
43            %else:
44                <% rep_errors = dict() %>
45            %endif
46            <div class="repeat-group-item">
47            <% index = repeat_values[i]['__index__'] %>
48            <div class="form-title-row"><b>${input.title} ${i + 1}</b></div>
49            ${do_inputs( input.inputs, repeat_values[ i ], rep_errors,  prefix + input.name + "_" + str(index) + "|", step, other_values )}
50            ## <div class="form-row"><input type="submit" name="${step.id}|${prefix}${input.name}_${i}_remove" value="Remove ${input.title} ${i+1}" /></div>
51            </div>
52          %endfor
53          ## <div class="form-row"><input type="submit" name="${step.id}|${prefix}${input.name}_add" value="Add new ${input.title}" /></div>
54      </div>
55    %elif input.type == "conditional":
56      <% group_values = values[input.name] %>
57      <% current_case = group_values['__current_case__'] %>
58      <% new_prefix = prefix + input.name + "|" %>
59      <% group_errors = errors.get( input.name, {} ) %>
60      ${row_for_param( input.test_param, group_values[ input.test_param.name ], other_values, group_errors, prefix, step )}
61      ${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, new_prefix, step, other_values )}
62    %else:
63      ${row_for_param( input, values[ input.name ], other_values, errors, prefix, step )}
64    %endif
65  %endfor 
66</%def>
67
68<%def name="row_for_param( param, value, other_values, error_dict, prefix, step )">
69    ## -- ${param.name} -- ${step.state.inputs} --
70    %if error_dict.has_key( param.name ):
71        <% cls = "form-row form-row-error" %>
72    %else:
73        <% cls = "form-row" %>
74    %endif
75    <div class="${cls}">
76        <label>${param.get_label()}</label>
77        <div>
78            %if isinstance( param, DataToolParameter ):
79                %if ( prefix + param.name ) in step.input_connections_by_name:
80                    <%
81                        conn = step.input_connections_by_name[ prefix + param.name ]
82                    %>
83                    Output dataset '${conn.output_name}' from step ${int(conn.output_step.order_index)+1}
84                %else:
85                    ## FIXME: Initialize in the controller
86                    <%
87                    if value is None:
88                        value = other_values[ param.name ] = param.get_initial_value( t, other_values )
89                    %>
90                    ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )}
91                    <input type="hidden" name="${step.id}|__force_update__${prefix}${param.name}" value="true" />
92                %endif
93            %elif isinstance( value, RuntimeValue ) or ( str(step.id) + '|__runtime__' + prefix + param.name ) in incoming:
94                ## On the first load we may see a RuntimeValue, so we write
95                ## an input field using the initial value for the param.
96                ## Subsequents posts will no longer have the runtime value
97                ## (since an actualy value will be posted) so we add a hidden
98                ## field so we know to continue drawing form for this param.
99                ## FIXME: This logic shouldn't be in the template. The
100                ## controller should go through the inputs on the first
101                ## load, fill in initial values where needed, and mark
102                ## all that are runtime modifiable in some way.
103                <% value = other_values[ param.name ] = param.get_initial_value( t, other_values ) %>
104                ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )}
105                <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" />
106            %else:
107                ${param.value_to_display_text( value, app )}
108            %endif
109        </div>
110        %if step.upgrade_messages and param.name in step.upgrade_messages:
111        <div class="warningmark">${step.upgrade_messages[param.name]}</div>
112        %endif
113        %if error_dict.has_key( param.name ):
114        <div style="color: red; font-weight: bold; padding-top: 1px; padding-bottom: 3px;">
115            <div style="width: 300px;"><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}">&nbsp;<span style="vertical-align: middle;">${error_dict[param.name]}</span></div>
116        </div>
117        %endif
118        <div style="clear: both"></div>       
119    </div>
120</%def>
121
122<h2>Running workflow "${h.to_unicode( workflow.name )}"</h2>
123
124%if has_upgrade_messages:
125<div class="warningmessage">
126    Problems were encourered when loading this workflow, likely due to tool
127    version changes. Missing parameter values have been replaced with default.
128    Please review the parameter values below.
129</div>
130%endif
131
132<form id="tool_form" name="tool_form" method="POST">
133## <input type="hidden" name="workflow_name" value="${h.to_unicode( workflow.name ) | h}" />
134%for i, step in enumerate( steps ):   
135    %if step.type == 'tool' or step.type is None:
136      <% tool = app.toolbox.tools_by_id[step.tool_id] %>
137      <input type="hidden" name="${step.id}|tool_state" value="${step.state.encode( tool, app )}">
138      <div class="toolForm">
139          <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${tool.name}</div>
140          <div class="toolFormBody">
141              ${do_inputs( tool.inputs, step.state.inputs, errors.get( step.id, dict() ), "", step )}
142                        % if step.post_job_actions:
143                                <hr/>
144                                <div class='form-row'>
145                                % if len(step.post_job_actions) > 1:
146                                        <label>Actions:</label>
147                                % else:
148                                        <label>Action:</label>
149                                % endif
150                                ${'<br/>'.join([ActionBox.get_short_str(pja) for pja in step.post_job_actions])}
151                                </div>
152                        % endif
153                % if step.annotations:
154                        <hr/>
155                        <div class='form-row'>
156                        <label>Annotation:</label> ${h.to_unicode( step.annotations[0].annotation )}
157                        </div>
158                % endif
159          </div>
160      </div>
161    %else:
162    <% module = step.module %>
163      <input type="hidden" name="${step.id}|tool_state" value="${module.encode_runtime_state( t, step.state )}">
164      <div class="toolForm">
165          <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${module.name}</div>
166          <div class="toolFormBody">
167              ${do_inputs( module.get_runtime_inputs(), step.state.inputs, errors.get( step.id, dict() ), "", step )}
168                        % if step.annotations:
169                                <hr/>
170                                <div class='form-row'>
171                                <label>Annotation:</label> ${step.annotations[0].annotation}
172                                </div>
173                        % endif
174          </div>
175      </div>
176    %endif
177%endfor
178<input type="submit" name="run_workflow" value="Run workflow" />
179</form>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。