root/galaxy-central/database/compiled_templates/tool_form.mako.py @ 3

リビジョン 3, 22.0 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1from mako import runtime, filters, cache
2UNDEFINED = runtime.UNDEFINED
3__M_dict_builtin = dict
4__M_locals_builtin = locals
5_magic_number = 5
6_modified_time = 1287725781.101141
7_template_filename='templates/tool_form.mako'
8_template_uri='tool_form.mako'
9_template_cache=cache.Cache(__name__, _modified_time)
10_source_encoding=None
11_exports = ['do_inputs', 'row_for_param']
12
13
14def render_body(context,**pageargs):
15    context.caller_stack._push_frame()
16    try:
17        __M_locals = __M_dict_builtin(pageargs=pageargs)
18        add_frame = context.get('add_frame', UNDEFINED)
19        errors = context.get('errors', UNDEFINED)
20        h = context.get('h', UNDEFINED)
21        tool = context.get('tool', UNDEFINED)
22        def do_inputs(inputs,tool_state,errors,prefix,other_values=None):
23            return render_do_inputs(context.locals_(__M_locals),inputs,tool_state,errors,prefix,other_values)
24        len = context.get('len', UNDEFINED)
25        util = context.get('util', UNDEFINED)
26        unicode = context.get('unicode', UNDEFINED)
27        type = context.get('type', UNDEFINED)
28        tool_state = context.get('tool_state', UNDEFINED)
29        trans = context.get('trans', UNDEFINED)
30        AttributeError = context.get('AttributeError', UNDEFINED)
31        app = context.get('app', UNDEFINED)
32        __M_writer = context.writer()
33        # SOURCE LINE 1
34        __M_writer(u'<!-- -->\n<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n\n')
35        # SOURCE LINE 4
36
37        from galaxy.util.expressions import ExpressionContext
38       
39       
40        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['ExpressionContext'] if __M_key in __M_locals_builtin()]))
41        # SOURCE LINE 6
42        __M_writer(u'\n\n<html>\n\n<head>\n<title>Galaxy</title>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n')
43        # SOURCE LINE 13
44        __M_writer(unicode(h.css( "base", "autocomplete_tagging" )))
45        __M_writer(u'\n')
46        # SOURCE LINE 14
47        __M_writer(unicode(h.js( "jquery", "galaxy.base", "jquery.autocomplete" )))
48        __M_writer(u'\n<script type="text/javascript">\n$(function() {\n    $(window).bind("refresh_on_change", function() {\n        $(\':file\').each( function() {\n            var file = $(this);\n            var file_value = file.val();\n            if (file_value) {\n                // disable file input, since we don\'t want to upload the file on refresh\n                var file_name = $(this).attr("name");\n                file.attr( { name: \'replaced_file_input_\' + file_name, disabled: true } );\n                // create a new hidden field which stores the filename and has the original name of the file input\n                var new_file_input = $(document.createElement(\'input\'));\n                new_file_input.attr( { "type", "hidden", "value": file_value, "name": file_name } );\n                file.after(new_file_input);\n            }\n        });\n    });\n});\n\n')
49        # SOURCE LINE 34
50        if not add_frame.debug:
51            # SOURCE LINE 35
52            __M_writer(u'    if( window.name != "galaxy_main" ) {\n        location.replace( \'')
53            # SOURCE LINE 36
54            __M_writer(unicode(h.url_for( controller='root', action='index', tool_id=tool.id )))
55            __M_writer(u"' );\n    }\n")
56        # SOURCE LINE 39
57        __M_writer(u'function checkUncheckAll( name, check )\n{\n    if ( check == 0 )\n    {\n        $("input[name=" + name + "][type=\'checkbox\']").attr(\'checked\', false);\n    }\n    else\n    {\n        $("input[name=" + name + "][type=\'checkbox\']").attr(\'checked\', true );\n    }\n}\n\n</script>\n</head>\n\n<body>\n    ')
58        # SOURCE LINE 128
59        __M_writer(u'\n    \n    ')
60        # SOURCE LINE 169
61        __M_writer(u'\n    \n')
62        # SOURCE LINE 171
63        if add_frame.from_noframe:
64            # SOURCE LINE 172
65            __M_writer(u'        <div class="warningmessage">\n        <strong>Welcome to Galaxy</strong>\n        <hr/>\n        It appears that you found this tool from a link outside of Galaxy.\n        If you\'re not familiar with Galaxy, please consider visiting the\n        <a href="')
66            # SOURCE LINE 177
67            __M_writer(unicode(h.url_for( controller='root' )))
68            __M_writer(u'" target="_top">welcome page</a>.\n        To learn more about what Galaxy is and what it can do for you, please visit\n        the <a href="$add_frame.wiki_url" target="_top">Galaxy wiki</a>.\n        </div>\n        <br/>\n')
69        # SOURCE LINE 183
70        __M_writer(u'    \n')
71        # SOURCE LINE 186
72        __M_writer(u'    ')
73
74        try:   
75            tool_url = h.url_for(tool.action)
76        except AttributeError:
77            assert len(tool.action) == 2
78            tool_url = tool.action[0] + h.url_for(tool.action[1])
79           
80       
81        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['tool_url'] if __M_key in __M_locals_builtin()]))
82        # SOURCE LINE 192
83        __M_writer(u'<div class="toolForm" id="')
84        __M_writer(unicode(tool.id))
85        __M_writer(u'">\n')
86        # SOURCE LINE 193
87        if tool.has_multiple_pages:
88            # SOURCE LINE 194
89            __M_writer(u'            <div class="toolFormTitle">')
90            __M_writer(unicode(tool.name))
91            __M_writer(u' (step ')
92            __M_writer(unicode(tool_state.page+1))
93            __M_writer(u' of ')
94            __M_writer(unicode(tool.npages))
95            __M_writer(u')</div>\n')
96            # SOURCE LINE 195
97        else:
98            # SOURCE LINE 196
99            __M_writer(u'            <div class="toolFormTitle">')
100            __M_writer(unicode(tool.name))
101            __M_writer(u'</div>\n')
102        # SOURCE LINE 198
103        __M_writer(u'        <div class="toolFormBody">\n            <form id="tool_form" name="tool_form" action="')
104        # SOURCE LINE 199
105        __M_writer(unicode(tool_url))
106        __M_writer(u'" enctype="')
107        __M_writer(unicode(tool.enctype))
108        __M_writer(u'" target="')
109        __M_writer(unicode(tool.target))
110        __M_writer(u'" method="')
111        __M_writer(unicode(tool.method))
112        __M_writer(u'">\n                <input type="hidden" name="tool_id" value="')
113        # SOURCE LINE 200
114        __M_writer(unicode(tool.id))
115        __M_writer(u'">\n                <input type="hidden" name="tool_state" value="')
116        # SOURCE LINE 201
117        __M_writer(unicode(util.object_to_string( tool_state.encode( tool, app ) )))
118        __M_writer(u'">\n')
119        # SOURCE LINE 202
120        if tool.display_by_page[tool_state.page]:
121            # SOURCE LINE 203
122            __M_writer(u'                    ')
123            __M_writer(unicode(trans.fill_template_string( tool.display_by_page[tool_state.page], context=tool.get_param_html_map( trans, tool_state.page, tool_state.inputs ) )))
124            __M_writer(u'\n                    <input type="submit" class="primary-button" name="runtool_btn" value="Execute">\n')
125            # SOURCE LINE 205
126        else:
127            # SOURCE LINE 206
128            __M_writer(u'                    ')
129            __M_writer(unicode(do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, errors, "" )))
130            __M_writer(u'\n                    <div class="form-row">\n')
131            # SOURCE LINE 208
132            if tool_state.page == tool.last_page:
133                # SOURCE LINE 209
134                __M_writer(u'                            <input type="submit" class="primary-button" name="runtool_btn" value="Execute">\n')
135                # SOURCE LINE 210
136            else:
137                # SOURCE LINE 211
138                __M_writer(u'                            <input type="submit" class="primary-button" name="runtool_btn" value="Next step">\n')
139            # SOURCE LINE 213
140            __M_writer(u'                    </div>\n')
141        # SOURCE LINE 215
142        __M_writer(u'            </form>\n        </div>\n    </div>\n')
143        # SOURCE LINE 218
144        if tool.help:
145            # SOURCE LINE 219
146            __M_writer(u'        <div class="toolHelp">\n            <div class="toolHelpBody">\n                ')
147            # SOURCE LINE 221
148
149            if tool.has_multiple_pages:
150                tool_help = tool.help_by_page[tool_state.page]
151            else:
152                tool_help = tool.help
153           
154            # Convert to unicode to display non-ascii characters.
155            if type( tool_help ) is not unicode:
156                tool_help = unicode( tool_help, 'utf-8')
157                           
158           
159            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['tool_help'] if __M_key in __M_locals_builtin()]))
160            # SOURCE LINE 230
161            __M_writer(u'\n                ')
162            # SOURCE LINE 231
163            __M_writer(unicode(tool_help))
164            __M_writer(u'\n            </div>        \n        </div>\n')
165        # SOURCE LINE 235
166        __M_writer(u'</body>\n\n<script type="text/javascript">\n')
167        # SOURCE LINE 239
168        __M_writer(u"   $( function() {\n       $( 'li > ul' ).each( function( i ) {\n           if ( $( this )[0].className == 'toolParameterExpandableCollapsable' )\n           {\n               var parent_li = $( this ).parent( 'li' );\n               var sub_ul = $( this ).remove();\n               parent_li.find( 'span' ).wrapInner( '<a/>' ).find( 'a' ).click( function() {\n                 sub_ul.toggle();\n                 $( this )[0].innerHTML = ( sub_ul[0].style.display=='none' ) ? '[+]' : '[-]';\n               });\n               parent_li.append( sub_ul );\n           }\n       });\n       $( 'ul ul' ).each( function(i) {\n           if ( $( this )[0].className == 'toolParameterExpandableCollapsable' && this.attributes.getNamedItem( 'default_state' ).value == 'collapsed' )\n           {\n               $( this ).hide();\n           }\n       });\n   });\n\n")
169        # SOURCE LINE 261
170        __M_writer(u'$( function() {\n    $("div.checkUncheckAllPlaceholder").each( function( i ) {\n        $( this )[0].innerHTML = \'<a class="action-button" onclick="checkUncheckAll( \\\'\' + this.attributes.getNamedItem( \'checkbox_name\' ).value + \'\\\', 1 );"><span>Select All</span></a> <a class="action-button" onclick="checkUncheckAll( \\\'\' + this.attributes.getNamedItem( \'checkbox_name\' ).value + \'\\\', 0 );"><span>Unselect All</span></a>\';\n    });\n});\n\n</script>\n\n</html>\n')
171        return ''
172    finally:
173        context.caller_stack._pop_frame()
174
175
176def render_do_inputs(context,inputs,tool_state,errors,prefix,other_values=None):
177    context.caller_stack._push_frame()
178    try:
179        def row_for_param(prefix,param,parent_state,parent_errors,other_values):
180            return render_row_for_param(context,prefix,param,parent_state,parent_errors,other_values)
181        h = context.get('h', UNDEFINED)
182        def do_inputs(inputs,tool_state,errors,prefix,other_values=None):
183            return render_do_inputs(context,inputs,tool_state,errors,prefix,other_values)
184        len = context.get('len', UNDEFINED)
185        range = context.get('range', UNDEFINED)
186        dict = context.get('dict', UNDEFINED)
187        str = context.get('str', UNDEFINED)
188        enumerate = context.get('enumerate', UNDEFINED)
189        trans = context.get('trans', UNDEFINED)
190        ExpressionContext = context.get('ExpressionContext', UNDEFINED)
191        __M_writer = context.writer()
192        # SOURCE LINE 55
193        __M_writer(u'\n      ')
194        # SOURCE LINE 56
195        other_values = ExpressionContext( tool_state, other_values )
196       
197        __M_writer(u'\n')
198        # SOURCE LINE 57
199        for input_index, input in enumerate( inputs.itervalues() ):
200            # SOURCE LINE 58
201            if input.type == "repeat":
202                # SOURCE LINE 59
203                __M_writer(u'              <div class="repeat-group">\n                  <div class="form-title-row"><b>')
204                # SOURCE LINE 60
205                __M_writer(unicode(input.title_plural))
206                __M_writer(u'</b></div>\n                  ')
207                # SOURCE LINE 61
208                repeat_state = tool_state[input.name]
209               
210                __M_writer(u'\n')
211                # SOURCE LINE 62
212                for i in range( len( repeat_state ) ):
213                    # SOURCE LINE 63
214                    __M_writer(u'                    <div class="repeat-group-item">\n                    ')
215                    # SOURCE LINE 64
216
217                    if input.name in errors:
218                        rep_errors = errors[input.name][i]
219                    else:
220                        rep_errors = dict()
221                    index = repeat_state[i]['__index__']
222                   
223                   
224                    # SOURCE LINE 70
225                    __M_writer(u'\n                    <div class="form-title-row"><b>')
226                    # SOURCE LINE 71
227                    __M_writer(unicode(input.title))
228                    __M_writer(u' ')
229                    __M_writer(unicode(i + 1))
230                    __M_writer(u'</b></div>\n                    ')
231                    # SOURCE LINE 72
232                    __M_writer(unicode(do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )))
233                    __M_writer(u'\n                    <div class="form-row"><input type="submit" name="')
234                    # SOURCE LINE 73
235                    __M_writer(unicode(prefix))
236                    __M_writer(unicode(input.name))
237                    __M_writer(u'_')
238                    __M_writer(unicode(index))
239                    __M_writer(u'_remove" value="Remove ')
240                    __M_writer(unicode(input.title))
241                    __M_writer(u' ')
242                    __M_writer(unicode(i+1))
243                    __M_writer(u'"></div>\n                    </div>\n')
244                    # SOURCE LINE 75
245                    if rep_errors.has_key( '__index__' ):
246                        # SOURCE LINE 76
247                        __M_writer(u'                        <div><img style="vertical-align: middle;" src="')
248                        __M_writer(unicode(h.url_for('/static/style/error_small.png')))
249                        __M_writer(u'">&nbsp;<span style="vertical-align: middle;">')
250                        __M_writer(unicode(rep_errors['__index__']))
251                        __M_writer(u'</span></div>\n')
252                # SOURCE LINE 79
253                __M_writer(u'                  <div class="form-row"><input type="submit" name="')
254                __M_writer(unicode(prefix))
255                __M_writer(unicode(input.name))
256                __M_writer(u'_add" value="Add new ')
257                __M_writer(unicode(input.title))
258                __M_writer(u'"></div>\n              </div>\n')
259                # SOURCE LINE 81
260            elif input.type == "conditional":
261                # SOURCE LINE 82
262                __M_writer(u'                ')
263
264                group_state = tool_state[input.name]
265                group_errors = errors.get( input.name, {} )
266                current_case = group_state['__current_case__']
267                group_prefix = prefix + input.name + "|"
268               
269               
270                # SOURCE LINE 87
271                __M_writer(u'\n')
272                # SOURCE LINE 88
273                if input.value_ref_in_group:
274                    # SOURCE LINE 89
275                    __M_writer(u'                    ')
276                    __M_writer(unicode(row_for_param( group_prefix, input.test_param, group_state, group_errors, other_values )))
277                    __M_writer(u'\n')
278                # SOURCE LINE 91
279                __M_writer(u'                ')
280                __M_writer(unicode(do_inputs( input.cases[current_case].inputs, group_state, group_errors, group_prefix, other_values )))
281                __M_writer(u'\n')
282                # SOURCE LINE 92
283            elif input.type == "upload_dataset":
284                # SOURCE LINE 93
285                if input.get_datatype( trans, other_values ).composite_type is None: #have non-composite upload appear as before
286                    # SOURCE LINE 94
287                    __M_writer(u'                    ')
288
289                    if input.name in errors:
290                        rep_errors = errors[input.name][0]
291                    else:
292                        rep_errors = dict()
293                   
294                   
295                    # SOURCE LINE 99
296                    __M_writer(u'\n                  ')
297                    # SOURCE LINE 100
298                    __M_writer(unicode(do_inputs( input.inputs, tool_state[input.name][0], rep_errors, prefix + input.name + "_" + str( 0 ) + "|", other_values )))
299                    __M_writer(u'\n')
300                    # SOURCE LINE 101
301                else:
302                    # SOURCE LINE 102
303                    __M_writer(u'                    <div class="repeat-group">\n                        <div class="form-title-row"><b>')
304                    # SOURCE LINE 103
305                    __M_writer(unicode(input.group_title( other_values )))
306                    __M_writer(u'</b></div>\n                        ')
307                    # SOURCE LINE 104
308 
309                    repeat_state = tool_state[input.name]
310                   
311                   
312                    # SOURCE LINE 106
313                    __M_writer(u'\n')
314                    # SOURCE LINE 107
315                    for i in range( len( repeat_state ) ):
316                        # SOURCE LINE 108
317                        __M_writer(u'                          <div class="repeat-group-item">\n                          ')
318                        # SOURCE LINE 109
319
320                        if input.name in errors:
321                            rep_errors = errors[input.name][i]
322                        else:
323                            rep_errors = dict()
324                        index = repeat_state[i]['__index__']
325                       
326                       
327                        # SOURCE LINE 115
328                        __M_writer(u'\n                          <div class="form-title-row"><b>File Contents for ')
329                        # SOURCE LINE 116
330                        __M_writer(unicode(input.title_by_index( trans, i, other_values )))
331                        __M_writer(u'</b></div>\n                          ')
332                        # SOURCE LINE 117
333                        __M_writer(unicode(do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )))
334                        __M_writer(u'\n')
335                        # SOURCE LINE 119
336                        __M_writer(u'                          </div>\n')
337                    # SOURCE LINE 122
338                    __M_writer(u'                    </div>\n')
339                # SOURCE LINE 124
340            else:
341                # SOURCE LINE 125
342                __M_writer(u'                ')
343                __M_writer(unicode(row_for_param( prefix, input, tool_state, errors, other_values )))
344                __M_writer(u'\n')
345        # SOURCE LINE 128
346        __M_writer(u'    ')
347        return ''
348    finally:
349        context.caller_stack._pop_frame()
350
351
352def render_row_for_param(context,prefix,param,parent_state,parent_errors,other_values):
353    context.caller_stack._push_frame()
354    try:
355        h = context.get('h', UNDEFINED)
356        trans = context.get('trans', UNDEFINED)
357        type = context.get('type', UNDEFINED)
358        unicode = context.get('unicode', UNDEFINED)
359        __M_writer = context.writer()
360        # SOURCE LINE 130
361        __M_writer(u'\n        ')
362        # SOURCE LINE 131
363
364        if parent_errors.has_key( param.name ):
365            cls = "form-row form-row-error"
366        else:
367            cls = "form-row"
368       
369       
370        # SOURCE LINE 136
371        __M_writer(u'\n        <div class="')
372        # SOURCE LINE 137
373        __M_writer(unicode(cls))
374        __M_writer(u'">\n            ')
375        # SOURCE LINE 138
376        label = param.get_label()
377       
378        __M_writer(u'\n')
379        # SOURCE LINE 139
380        if label:
381            # SOURCE LINE 140
382            __M_writer(u'                <label>\n                    ')
383            # SOURCE LINE 141
384            __M_writer(unicode(label))
385            __M_writer(u':\n                </label>\n')
386        # SOURCE LINE 144
387        __M_writer(u'            ')
388
389        field = param.get_html_field( trans, parent_state[ param.name ], other_values )
390        field.refresh_on_change = param.refresh_on_change
391       
392        # Field may contain characters submitted by user and these characters may be unicode; handle non-ascii characters gracefully.
393        field_html = field.get_html( prefix )
394        if type( field_html ) is not unicode:
395            field_html = unicode( field_html, 'utf-8' )
396                   
397       
398        # SOURCE LINE 152
399        __M_writer(u'\n            <div class="form-row-input">')
400        # SOURCE LINE 153
401        __M_writer(unicode(field_html))
402        __M_writer(u'</div>\n')
403        # SOURCE LINE 154
404        if parent_errors.has_key( param.name ):
405            # SOURCE LINE 155
406            __M_writer(u'            <div class="form-row-error-message">\n                <div><img style="vertical-align: middle;" src="')
407            # SOURCE LINE 156
408            __M_writer(unicode(h.url_for('/static/style/error_small.png')))
409            __M_writer(u'">&nbsp;<span style="vertical-align: middle;">')
410            __M_writer(unicode(parent_errors[param.name]))
411            __M_writer(u'</span></div>\n            </div>\n')
412        # SOURCE LINE 159
413        __M_writer(u'            \n')
414        # SOURCE LINE 160
415        if param.help:
416            # SOURCE LINE 161
417            __M_writer(u'            <div class="toolParamHelp" style="clear: both;">\n                ')
418            # SOURCE LINE 162
419            __M_writer(unicode(param.help))
420            __M_writer(u'\n            </div>\n')
421        # SOURCE LINE 165
422        __M_writer(u'    \n            <div style="clear: both"></div>\n                    \n        </div>\n    ')
423        return ''
424    finally:
425        context.caller_stack._pop_frame()
426
427
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。