예제 #1
0
def exec_before_job( app, inp_data, out_data, param_dict, tool=None):
    """Build a temp file with errors in it"""
    errors = []
    for name, data in inp_data.items():
        validation_errors = data.validation_errors
        for error in validation_errors:
            # build dummy class
            try:
                temp = eval(error.err_type)()
            except:
                temp = object()
            # stuff attributes
            temp.__dict__ = util.string_to_object( error.attributes )
            errors.append(temp)
    # There *should* only be 1 input, so we assume there is and continue
    # base64 pickel
    errors_str = util.object_to_string( errors )
    # write
    database_tmp = "./database/tmp" # globaly visible path
    error_file = tempfile.NamedTemporaryFile(mode="w", dir=database_tmp, suffix=".b64")
    error_file_name = error_file.name
    error_file.close()
    error_file = open(error_file_name, "w")
    error_file.write(errors_str)
    error_file.close()
    param_dict["errorsfile"] = error_file_name
예제 #2
0
def main():
    options, args = doc_optparse.parse( __doc__ )

    try:
        extension = options.ext
    except:
        doc_optparse.exception()

    # create datatype
    data = model.Dataset( extension=extension, id=int( args[0] ) )
    data.file_path = "/home/ian/trunk/database/files/"
    
    if options.metadata:
        data.metadata = util.string_to_object( options.metadata )

    errors = data.datatype.validate( data )
    print util.object_to_string(errors)
class UCSCProxy( BaseUIController ):

    def create_display(self, store):
        """Creates a more meaningulf display name"""
        track  = store.get('hgta_track','no track')
        table  = store.get('hgta_table','no table')
        region = store.get('hgta_regionType','')
        if region not in [ 'genome', 'encode']:
            region = store.get('position','')
        if track == table:
            display = 'UCSC: %s (%s)' % (track, region) 
        else:
            display = 'UCSC: %s, %s (%s)' % (track, table, region)                 
        return display            
            
    @web.expose 
    def index(self, trans, init=False, **kwd):
        base_url = None
        params = dict(kwd)
        try:
            store = params.get("__GALAXY__", None)
            if store:
                store = util.string_to_object(store)
            else:
                store = {}
            UCSC_URL = 'UCSC_URL'
            base_url = store.get(UCSC_URL, "http://genome.ucsc.edu/cgi-bin/hgTables?")
            params   = dict(kwd)
            params['init'] = init
                   
            if not init:
                for key, value in kwd.items():
                    store[key] = value
                try: del store["__GALAXY__"]
                except: pass
            else:
                store = {}
            
            if init == "1":
                base_url = "http://genome.ucsc.edu/cgi-bin/hgTables?"
                params['db'] = 'hg17'
            if init == "2":
                base_url = "http://genome-test.cse.ucsc.edu/cgi-bin/hgTables?"
                params['db'] = 'hg17'
            if init == "3":
                base_url = "http://archaea.ucsc.edu/cgi-bin/hgTables?"

            store[UCSC_URL] = base_url
            
            try: del params["__GALAXY__"]
            except: pass
            url = base_url + urllib.urlencode(params)
            
            page = urllib.urlopen(url)
            content = page.info().get('Content-type', '')
        except Exception, exc:
            trans.log_event( "Proxy Error -> %s" % str(exc) )
            msg = 'There has been a problem connecting to <i>%s</i> <p> <b>%s<b>' % (base_url, exc)
            return msg

        if content.startswith('text/plain'):
            params['display'] = self.create_display(store)
            params['dbkey']   = store.get('db', '*')
            params['tool_id'] = 'ucsc_proxy'
            params['proxy_url'] = base_url
            params['runtool_btn'] = 'T'
            #url = "/echo?" + urllib.urlencode(params)
            url = "/tool_runner/index?" + urllib.urlencode(params)
            trans.response.send_redirect(url)
        else:
            try:        
                text = page.read()
                
                # Serialize store into a form element
                store_text = "<INPUT TYPE=\"HIDDEN\" NAME=\"__GALAXY__\" ID=\"__GALAXY__\" VALUE=\"" \
                             + util.object_to_string(store) + "\" \>"
                
                # Remove text regions that should not be exposed
                for key,value in altered_regions.items():
                    text = text.replace(key,value)
                # Capture only the forms
                newtext = beginning
                for form in re.finditer("(?s)(<FORM.*?)(</FORM>)",text):
                    newtext = newtext + form.group(1) + store_text + form.group(2)
                if 'hgta_doLookupPosition' in params:
                    lookup = re.search("(?s).*?(<H2>.*</PRE>)",text)
                    if lookup:
                        newtext = newtext + lookup.group(1)
                # if these keys are in the params, then pass the content through
                passthruContent = ['hgta_doSummaryStats', 'hgta_doSchema', 'hgta_doSchemaDb']
                for k in passthruContent:
                    if k in params:
                        content = re.search("(?s)CONTENT TABLES.*?-->(.*/TABLE>)",text)
                        if content:
                            newtext = newtext + "<TABLE>" + content.group(1)

                newtext = newtext + ending
                return newtext
            except KeyError, exc:
                log.error(str(exc))
                trans.log_event( "Proxy Error -> %s" % str(exc) )
                msg = 'There has been a problem connecting to <i>%s</i> <p> <b>%s<b>' % (base_url, exc)
                return msg
예제 #4
0
 def __state_to_string(self, tool_state):
     return object_to_string(tool_state.encode(self.tool, self.app))
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        _import_ns = {}
        _mako_get_namespace(context, '__anon_0x2302d290')._populate(_import_ns, [u'overlay'])
        _mako_get_namespace(context, '__anon_0x2302d150')._populate(_import_ns, [u'render_msg'])
        add_frame = _import_ns.get('add_frame', context.get('add_frame', UNDEFINED))
        errors = _import_ns.get('errors', context.get('errors', UNDEFINED))
        render_msg = _import_ns.get('render_msg', context.get('render_msg', UNDEFINED))
        unicode = _import_ns.get('unicode', context.get('unicode', UNDEFINED))
        overlay = _import_ns.get('overlay', context.get('overlay', UNDEFINED))
        h = _import_ns.get('h', context.get('h', UNDEFINED))
        app = _import_ns.get('app', context.get('app', UNDEFINED))
        def do_inputs(inputs,tool_state,errors,prefix,other_values=None):
            return render_do_inputs(context.locals_(__M_locals),inputs,tool_state,errors,prefix,other_values)
        len = _import_ns.get('len', context.get('len', UNDEFINED))
        util = _import_ns.get('util', context.get('util', UNDEFINED))
        tool_id_version_message = _import_ns.get('tool_id_version_message', context.get('tool_id_version_message', UNDEFINED))
        def row_for_rerun():
            return render_row_for_rerun(context.locals_(__M_locals))
        type = _import_ns.get('type', context.get('type', UNDEFINED))
        tool_state = _import_ns.get('tool_state', context.get('tool_state', UNDEFINED))
        trans = _import_ns.get('trans', context.get('trans', UNDEFINED))
        AttributeError = _import_ns.get('AttributeError', context.get('AttributeError', UNDEFINED))
        tool = _import_ns.get('tool', context.get('tool', UNDEFINED))
        tool_version_select_field = _import_ns.get('tool_version_select_field', context.get('tool_version_select_field', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n')
        # SOURCE LINE 2
        __M_writer(u'\n')
        # SOURCE LINE 3
        __M_writer(u'\n\n')
        # SOURCE LINE 5
        import galaxy.util 
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['galaxy'] if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n\n')
        # SOURCE LINE 14
        __M_writer(u'\n\n')
        # SOURCE LINE 110
        __M_writer(u'\n\n')
        # SOURCE LINE 203
        __M_writer(u'\n\n')
        # SOURCE LINE 231
        __M_writer(u'\n\n')
        # SOURCE LINE 235
        __M_writer(u'\n\n')
        # SOURCE LINE 242
        __M_writer(u'\n\n')
        # SOURCE LINE 250
        __M_writer(u'\n\n')
        # SOURCE LINE 258
        __M_writer(u'\n\n')
        # SOURCE LINE 270
        __M_writer(u'\n\n')
        # SOURCE LINE 272
        overlay(visible=False) 
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in [] if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n\n')
        # SOURCE LINE 274
        if add_frame.from_noframe:
            # SOURCE LINE 275
            __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="')
            # SOURCE LINE 280
            __M_writer(unicode(h.url_for( controller='root' )))
            __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="')
            # SOURCE LINE 282
            __M_writer(unicode(add_frame.wiki_url))
            __M_writer(u'" target="_top">Galaxy wiki</a>.\n    </div>\n    <br/>\n')
            pass
        # SOURCE LINE 286
        __M_writer(u'\n')
        # SOURCE LINE 287

    # 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])
        
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool_url','message','params_with_missing_data_table_entry','params_with_missing_index_file','param'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 307
        __M_writer(u'\n\n')
        # SOURCE LINE 309

    # Name of the tool in lower case
        low_tool_name = tool.name.lower()
        
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['low_tool_name'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 312
        __M_writer(u'\n\n')
        # SOURCE LINE 314
        if tool_id_version_message:
            # SOURCE LINE 315
            __M_writer(u'    ')
            __M_writer(unicode(render_msg( tool_id_version_message, 'warning' )))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 317
        __M_writer(u'\n<div class="toolForm" id="')
        # SOURCE LINE 318
        __M_writer(unicode(tool.id))
        __M_writer(u'">\n    <form id="tool_form" name="tool_form" action="')
        # SOURCE LINE 319
        __M_writer(unicode(tool_url))
        __M_writer(u'" enctype="')
        __M_writer(unicode(tool.enctype))
        __M_writer(u'" target="')
        __M_writer(unicode(tool.target))
        __M_writer(u'" method="')
        __M_writer(unicode(tool.method))
        __M_writer(u'">\n')
        # SOURCE LINE 320
        if tool.has_multiple_pages:
            # SOURCE LINE 321
            __M_writer(u'            <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' (step ')
            __M_writer(unicode(tool_state.page+1))
            __M_writer(u' of ')
            __M_writer(unicode(tool.npages))
            __M_writer(u')\n')
            # SOURCE LINE 322
        elif not tool_version_select_field:
            # SOURCE LINE 323
            __M_writer(u'            <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' (version ')
            __M_writer(unicode(tool.version))
            __M_writer(u')\n')
            # SOURCE LINE 324
        else:
            # SOURCE LINE 325
            __M_writer(u'            <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' ')
            __M_writer(unicode(tool_version_select_field.get_html()))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 327
        __M_writer(u'\n        <span class="pull-right">\n')
        # SOURCE LINE 329
        if trans.app.config.biostar_url:
            # SOURCE LINE 331
            __M_writer(u'                Help from Biostar\n                <div class="icon-btn-group">\n                    <a href="')
            # SOURCE LINE 333
            __M_writer(unicode(h.url_for( controller='biostar', action='biostar_tool_tag_redirect', tool_id=tool.id )))
            __M_writer(u'"\n                        target="_blank" class="icon-btn" title="Search for this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-search"></span></a>\n                    <a href="')
            # SOURCE LINE 335
            __M_writer(unicode(h.url_for( controller='biostar', action='biostar_tool_question_redirect', tool_id=tool.id )))
            __M_writer(u'"\n                        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>\n                </div>\n')
            pass
        # SOURCE LINE 339
        __M_writer(u'            <div class="icon-btn-group">\n                <a href="#" data-link="')
        # SOURCE LINE 340
        __M_writer(unicode(h.url_for( controller='root', action='index', tool_id=tool.id )))
        __M_writer(u'"\n                    class="icon-btn tool-share-link" title="Share this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-share"></span></a>\n            </div>\n        </span>\n        </div>\n        <div class="toolFormBody">\n            <input type="hidden" name="refresh" value="refresh">\n            <input type="hidden" name="tool_id" value="')
        # SOURCE LINE 347
        __M_writer(unicode(tool.id))
        __M_writer(u'">\n            <input type="hidden" name="tool_state" value="')
        # SOURCE LINE 348
        __M_writer(unicode(util.object_to_string( tool_state.encode( tool, app ) )))
        __M_writer(u'">\n')
        # SOURCE LINE 349
        if tool.display_by_page[tool_state.page]:
            # SOURCE LINE 350
            __M_writer(u'                ')
            __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 ) )))
            __M_writer(u'\n                ')
            # SOURCE LINE 351
            __M_writer(unicode(row_for_rerun()))
            __M_writer(u'\n                <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n')
            # SOURCE LINE 353
        else:
            # SOURCE LINE 354
            __M_writer(u'                ')
            __M_writer(unicode(do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, errors, "" )))
            __M_writer(u'\n')
            # SOURCE LINE 355
            if tool_state.page == tool.last_page:
                # SOURCE LINE 356
                __M_writer(u'                    ')
                __M_writer(unicode(row_for_rerun()))
                __M_writer(u'\n')
                pass
            # SOURCE LINE 358
            __M_writer(u'                <div class="form-row form-actions">\n')
            # SOURCE LINE 359
            if tool_state.page == tool.last_page:
                # SOURCE LINE 360
                __M_writer(u'                        <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n')
                # SOURCE LINE 361
            else:
                # SOURCE LINE 362
                __M_writer(u'                        <input type="submit" class="btn btn-primary" name="runtool_btn" value="Next step">\n')
                pass
            # SOURCE LINE 364
            __M_writer(u'                </div>\n')
            pass
        # SOURCE LINE 366
        __M_writer(u'        </div>\n    </form>\n</div>\n')
        # SOURCE LINE 369
        if tool.help:
            # SOURCE LINE 370
            __M_writer(u'    <div class="toolHelp">\n        <div class="toolHelpBody">\n            ')
            # SOURCE LINE 372

            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')
                        
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool_help'] if __M_key in __M_locals_builtin_stored]))
            # SOURCE LINE 384
            __M_writer(u'\n            ')
            # SOURCE LINE 385
            __M_writer(unicode(tool_help))
            __M_writer(u'\n        </div>\n    </div>\n')
            pass
        # SOURCE LINE 389
        if tool.tool_shed_repository:
            # SOURCE LINE 390
            __M_writer(u'    ')
            tool_url = tool.tool_shed_repository.get_sharable_url( tool.app ) 
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool_url'] if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n')
            # SOURCE LINE 391
            if tool_url:
                # SOURCE LINE 392
                __M_writer(u'        <br/>\n        ')
                # SOURCE LINE 393
                __M_writer(unicode( 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' ) ))
                __M_writer(u'\n')
                pass
            pass
        # SOURCE LINE 396
        if tool.citations:
            # SOURCE LINE 397
            __M_writer(u'    <script>\n    require(["mvc/citation/citation-model", "mvc/citation/citation-view"\n    ], function( citationModel, citationView ){\n        $(function() {\n            var citations = new citationModel.ToolCitationCollection();\n            citations.tool_id = "')
            # SOURCE LINE 402
            __M_writer(unicode(tool.id))
            __M_writer(u'";\n            var citation_list_view = new citationView.CitationListView({ collection: citations } );\n            citation_list_view.render();\n            citations.fetch();\n        } );\n    } );\n    </script>\n    <div id="citations">\n    </div>\n')
            pass
        # SOURCE LINE 412
        __M_writer(u'\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
예제 #6
0
 def __state_to_string( self, tool_state ):
     return object_to_string( tool_state.encode( self.tool, self.app ) )
def render_body(context, **pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        _import_ns = {}
        _mako_get_namespace(context, '__anon_0x2302d290')._populate(
            _import_ns, [u'overlay'])
        _mako_get_namespace(context, '__anon_0x2302d150')._populate(
            _import_ns, [u'render_msg'])
        add_frame = _import_ns.get('add_frame',
                                   context.get('add_frame', UNDEFINED))
        errors = _import_ns.get('errors', context.get('errors', UNDEFINED))
        render_msg = _import_ns.get('render_msg',
                                    context.get('render_msg', UNDEFINED))
        unicode = _import_ns.get('unicode', context.get('unicode', UNDEFINED))
        overlay = _import_ns.get('overlay', context.get('overlay', UNDEFINED))
        h = _import_ns.get('h', context.get('h', UNDEFINED))
        app = _import_ns.get('app', context.get('app', UNDEFINED))

        def do_inputs(inputs, tool_state, errors, prefix, other_values=None):
            return render_do_inputs(context.locals_(__M_locals), inputs,
                                    tool_state, errors, prefix, other_values)

        len = _import_ns.get('len', context.get('len', UNDEFINED))
        util = _import_ns.get('util', context.get('util', UNDEFINED))
        tool_id_version_message = _import_ns.get(
            'tool_id_version_message',
            context.get('tool_id_version_message', UNDEFINED))

        def row_for_rerun():
            return render_row_for_rerun(context.locals_(__M_locals))

        type = _import_ns.get('type', context.get('type', UNDEFINED))
        tool_state = _import_ns.get('tool_state',
                                    context.get('tool_state', UNDEFINED))
        trans = _import_ns.get('trans', context.get('trans', UNDEFINED))
        AttributeError = _import_ns.get(
            'AttributeError', context.get('AttributeError', UNDEFINED))
        tool = _import_ns.get('tool', context.get('tool', UNDEFINED))
        tool_version_select_field = _import_ns.get(
            'tool_version_select_field',
            context.get('tool_version_select_field', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n')
        # SOURCE LINE 2
        __M_writer(u'\n')
        # SOURCE LINE 3
        __M_writer(u'\n\n')
        # SOURCE LINE 5
        import galaxy.util

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                              for __M_key in ['galaxy']
                              if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n\n')
        # SOURCE LINE 14
        __M_writer(u'\n\n')
        # SOURCE LINE 110
        __M_writer(u'\n\n')
        # SOURCE LINE 203
        __M_writer(u'\n\n')
        # SOURCE LINE 231
        __M_writer(u'\n\n')
        # SOURCE LINE 235
        __M_writer(u'\n\n')
        # SOURCE LINE 242
        __M_writer(u'\n\n')
        # SOURCE LINE 250
        __M_writer(u'\n\n')
        # SOURCE LINE 258
        __M_writer(u'\n\n')
        # SOURCE LINE 270
        __M_writer(u'\n\n')
        # SOURCE LINE 272
        overlay(visible=False)

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                              for __M_key in []
                              if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n\n')
        # SOURCE LINE 274
        if add_frame.from_noframe:
            # SOURCE LINE 275
            __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="'
            )
            # SOURCE LINE 280
            __M_writer(unicode(h.url_for(controller='root')))
            __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="'
            )
            # SOURCE LINE 282
            __M_writer(unicode(add_frame.wiki_url))
            __M_writer(
                u'" target="_top">Galaxy wiki</a>.\n    </div>\n    <br/>\n')
            pass
        # SOURCE LINE 286
        __M_writer(u'\n')
        # SOURCE LINE 287

        # 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])

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                              for __M_key in [
                                  'tool_url', 'message',
                                  'params_with_missing_data_table_entry',
                                  'params_with_missing_index_file', 'param'
                              ] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 307
        __M_writer(u'\n\n')
        # SOURCE LINE 309

        # Name of the tool in lower case
        low_tool_name = tool.name.lower()

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                              for __M_key in ['low_tool_name']
                              if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 312
        __M_writer(u'\n\n')
        # SOURCE LINE 314
        if tool_id_version_message:
            # SOURCE LINE 315
            __M_writer(u'    ')
            __M_writer(unicode(render_msg(tool_id_version_message, 'warning')))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 317
        __M_writer(u'\n<div class="toolForm" id="')
        # SOURCE LINE 318
        __M_writer(unicode(tool.id))
        __M_writer(u'">\n    <form id="tool_form" name="tool_form" action="')
        # SOURCE LINE 319
        __M_writer(unicode(tool_url))
        __M_writer(u'" enctype="')
        __M_writer(unicode(tool.enctype))
        __M_writer(u'" target="')
        __M_writer(unicode(tool.target))
        __M_writer(u'" method="')
        __M_writer(unicode(tool.method))
        __M_writer(u'">\n')
        # SOURCE LINE 320
        if tool.has_multiple_pages:
            # SOURCE LINE 321
            __M_writer(u'            <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' (step ')
            __M_writer(unicode(tool_state.page + 1))
            __M_writer(u' of ')
            __M_writer(unicode(tool.npages))
            __M_writer(u')\n')
            # SOURCE LINE 322
        elif not tool_version_select_field:
            # SOURCE LINE 323
            __M_writer(u'            <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' (version ')
            __M_writer(unicode(tool.version))
            __M_writer(u')\n')
            # SOURCE LINE 324
        else:
            # SOURCE LINE 325
            __M_writer(u'            <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' ')
            __M_writer(unicode(tool_version_select_field.get_html()))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 327
        __M_writer(u'\n        <span class="pull-right">\n')
        # SOURCE LINE 329
        if trans.app.config.biostar_url:
            # SOURCE LINE 331
            __M_writer(
                u'                Help from Biostar\n                <div class="icon-btn-group">\n                    <a href="'
            )
            # SOURCE LINE 333
            __M_writer(
                unicode(
                    h.url_for(controller='biostar',
                              action='biostar_tool_tag_redirect',
                              tool_id=tool.id)))
            __M_writer(
                u'"\n                        target="_blank" class="icon-btn" title="Search for this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-search"></span></a>\n                    <a href="'
            )
            # SOURCE LINE 335
            __M_writer(
                unicode(
                    h.url_for(controller='biostar',
                              action='biostar_tool_question_redirect',
                              tool_id=tool.id)))
            __M_writer(
                u'"\n                        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>\n                </div>\n'
            )
            pass
        # SOURCE LINE 339
        __M_writer(
            u'            <div class="icon-btn-group">\n                <a href="#" data-link="'
        )
        # SOURCE LINE 340
        __M_writer(
            unicode(
                h.url_for(controller='root', action='index', tool_id=tool.id)))
        __M_writer(
            u'"\n                    class="icon-btn tool-share-link" title="Share this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-share"></span></a>\n            </div>\n        </span>\n        </div>\n        <div class="toolFormBody">\n            <input type="hidden" name="refresh" value="refresh">\n            <input type="hidden" name="tool_id" value="'
        )
        # SOURCE LINE 347
        __M_writer(unicode(tool.id))
        __M_writer(
            u'">\n            <input type="hidden" name="tool_state" value="')
        # SOURCE LINE 348
        __M_writer(unicode(util.object_to_string(tool_state.encode(tool,
                                                                   app))))
        __M_writer(u'">\n')
        # SOURCE LINE 349
        if tool.display_by_page[tool_state.page]:
            # SOURCE LINE 350
            __M_writer(u'                ')
            __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))))
            __M_writer(u'\n                ')
            # SOURCE LINE 351
            __M_writer(unicode(row_for_rerun()))
            __M_writer(
                u'\n                <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n'
            )
            # SOURCE LINE 353
        else:
            # SOURCE LINE 354
            __M_writer(u'                ')
            __M_writer(
                unicode(
                    do_inputs(tool.inputs_by_page[tool_state.page],
                              tool_state.inputs, errors, "")))
            __M_writer(u'\n')
            # SOURCE LINE 355
            if tool_state.page == tool.last_page:
                # SOURCE LINE 356
                __M_writer(u'                    ')
                __M_writer(unicode(row_for_rerun()))
                __M_writer(u'\n')
                pass
            # SOURCE LINE 358
            __M_writer(
                u'                <div class="form-row form-actions">\n')
            # SOURCE LINE 359
            if tool_state.page == tool.last_page:
                # SOURCE LINE 360
                __M_writer(
                    u'                        <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n'
                )
                # SOURCE LINE 361
            else:
                # SOURCE LINE 362
                __M_writer(
                    u'                        <input type="submit" class="btn btn-primary" name="runtool_btn" value="Next step">\n'
                )
                pass
            # SOURCE LINE 364
            __M_writer(u'                </div>\n')
            pass
        # SOURCE LINE 366
        __M_writer(u'        </div>\n    </form>\n</div>\n')
        # SOURCE LINE 369
        if tool.help:
            # SOURCE LINE 370
            __M_writer(
                u'    <div class="toolHelp">\n        <div class="toolHelpBody">\n            '
            )
            # SOURCE LINE 372

            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')

            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(
                __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                                  for __M_key in ['tool_help']
                                  if __M_key in __M_locals_builtin_stored]))
            # SOURCE LINE 384
            __M_writer(u'\n            ')
            # SOURCE LINE 385
            __M_writer(unicode(tool_help))
            __M_writer(u'\n        </div>\n    </div>\n')
            pass
        # SOURCE LINE 389
        if tool.tool_shed_repository:
            # SOURCE LINE 390
            __M_writer(u'    ')
            tool_url = tool.tool_shed_repository.get_sharable_url(tool.app)

            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(
                __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                                  for __M_key in ['tool_url']
                                  if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n')
            # SOURCE LINE 391
            if tool_url:
                # SOURCE LINE 392
                __M_writer(u'        <br/>\n        ')
                # SOURCE LINE 393
                __M_writer(
                    unicode(
                        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')))
                __M_writer(u'\n')
                pass
            pass
        # SOURCE LINE 396
        if tool.citations:
            # SOURCE LINE 397
            __M_writer(
                u'    <script>\n    require(["mvc/citation/citation-model", "mvc/citation/citation-view"\n    ], function( citationModel, citationView ){\n        $(function() {\n            var citations = new citationModel.ToolCitationCollection();\n            citations.tool_id = "'
            )
            # SOURCE LINE 402
            __M_writer(unicode(tool.id))
            __M_writer(
                u'";\n            var citation_list_view = new citationView.CitationListView({ collection: citations } );\n            citation_list_view.render();\n            citations.fetch();\n        } );\n    } );\n    </script>\n    <div id="citations">\n    </div>\n'
            )
            pass
        # SOURCE LINE 412
        __M_writer(u'\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
예제 #8
0
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        _import_ns = {}
        _mako_get_namespace(context, '__anon_0x11b84b190')._populate(_import_ns, [u'render_msg'])
        _mako_get_namespace(context, '__anon_0x1120963d0')._populate(_import_ns, [u'overlay'])
        render_msg = _import_ns.get('render_msg', context.get('render_msg', UNDEFINED))
        app = _import_ns.get('app', context.get('app', UNDEFINED))
        unicode = _import_ns.get('unicode', context.get('unicode', UNDEFINED))
        enumerate = _import_ns.get('enumerate', context.get('enumerate', UNDEFINED))
        errors = _import_ns.get('errors', context.get('errors', UNDEFINED))
        overlay = _import_ns.get('overlay', context.get('overlay', UNDEFINED))
        self = _import_ns.get('self', context.get('self', UNDEFINED))
        dict = _import_ns.get('dict', context.get('dict', UNDEFINED))
        tool_id_version_message = _import_ns.get('tool_id_version_message', context.get('tool_id_version_message', UNDEFINED))
        tool_version_select_field = _import_ns.get('tool_version_select_field', context.get('tool_version_select_field', UNDEFINED))
        type = _import_ns.get('type', context.get('type', UNDEFINED))
        tool = _import_ns.get('tool', context.get('tool', UNDEFINED))
        len = _import_ns.get('len', context.get('len', UNDEFINED))
        util = _import_ns.get('util', context.get('util', UNDEFINED))
        job = _import_ns.get('job', context.get('job', UNDEFINED))
        tool_state = _import_ns.get('tool_state', context.get('tool_state', UNDEFINED))
        add_frame = _import_ns.get('add_frame', context.get('add_frame', UNDEFINED))
        h = _import_ns.get('h', context.get('h', UNDEFINED))
        def do_inputs(inputs,tool_state,errors,prefix,other_values=None):
            return render_do_inputs(context.locals_(__M_locals),inputs,tool_state,errors,prefix,other_values)
        def row_for_rerun():
            return render_row_for_rerun(context.locals_(__M_locals))
        trans = _import_ns.get('trans', context.get('trans', UNDEFINED))
        AttributeError = _import_ns.get('AttributeError', context.get('AttributeError', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 3
        __M_writer(unicode(h.js("libs/bibtex", "libs/jquery/jquery-ui")))
        __M_writer(u'\n')
        # SOURCE LINE 4
        __M_writer(unicode(h.css('base', 'jquery-ui/smoothness/jquery-ui')))
        __M_writer(u'\n\n')
        # SOURCE LINE 7
        if util.string_as_bool(trans.app.config.get('toolform_upgrade',  True)):
            # SOURCE LINE 8
            __M_writer(u'    ')

        ## 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)
            params['__job_id__'] = params.get('job_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 )
            })
                
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['params'] if __M_key in __M_locals_builtin_stored]))
            # SOURCE LINE 20
            __M_writer(u"\n    <script>\n        require(['mvc/tools/tools-form'], function(ToolsForm){\n            $(function(){\n                var form = new ToolsForm.View(")
            # SOURCE LINE 24
            __M_writer(unicode( h.dumps(self.form_config) ))
            __M_writer(u');\n                $(\'body\').append(form.$el);\n            });\n        });\n    </script>\n    <div id="tool-form-classic" style="display: none;">\n')
            # SOURCE LINE 30
        else:
            # SOURCE LINE 31
            __M_writer(u'    <div id="tool-form-classic">\n')
            pass
        # SOURCE LINE 33
        __M_writer(u'\n    ')
        # SOURCE LINE 34
        __M_writer(u'\n    ')
        # SOURCE LINE 35
        __M_writer(u'\n\n    ')
        # SOURCE LINE 37
        import galaxy.util 
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['galaxy'] if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n\n    ')
        # SOURCE LINE 46
        __M_writer(u'\n\n    ')
        # SOURCE LINE 142
        __M_writer(u'\n\n    ')
        # SOURCE LINE 235
        __M_writer(u'\n\n    ')
        # SOURCE LINE 263
        __M_writer(u'\n\n    ')
        # SOURCE LINE 267
        __M_writer(u'\n\n    ')
        # SOURCE LINE 274
        __M_writer(u'\n\n    ')
        # SOURCE LINE 282
        __M_writer(u'\n\n    ')
        # SOURCE LINE 290
        __M_writer(u'\n\n    ')
        # SOURCE LINE 302
        __M_writer(u'\n\n    ')
        # SOURCE LINE 304
        overlay(visible=False) 
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in [] if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n\n')
        # SOURCE LINE 306
        if add_frame.from_noframe:
            # SOURCE LINE 307
            __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="')
            # SOURCE LINE 312
            __M_writer(unicode(h.url_for( controller='root' )))
            __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="')
            # SOURCE LINE 314
            __M_writer(unicode(add_frame.wiki_url))
            __M_writer(u'" target="_top">Galaxy wiki</a>.\n        </div>\n        <br/>\n')
            pass
        # SOURCE LINE 318
        __M_writer(u'\n    ')
        # SOURCE LINE 319

        # 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])
            
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool_url','message','params_with_missing_data_table_entry','params_with_missing_index_file','param'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 339
        __M_writer(u'\n\n    ')
        # SOURCE LINE 341

        # Name of the tool in lower case
        low_tool_name = tool.name.lower()
            
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['low_tool_name'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 344
        __M_writer(u'\n\n')
        # SOURCE LINE 346
        if tool_id_version_message:
            # SOURCE LINE 347
            __M_writer(u'        ')
            __M_writer(unicode(render_msg( tool_id_version_message, 'warning' )))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 349
        __M_writer(u'\n    <div class="toolForm" id="')
        # SOURCE LINE 350
        __M_writer(unicode(tool.id))
        __M_writer(u'">\n        <form id="tool_form" name="tool_form" action="')
        # SOURCE LINE 351
        __M_writer(unicode(tool_url))
        __M_writer(u'" enctype="')
        __M_writer(unicode(tool.enctype))
        __M_writer(u'" target="')
        __M_writer(unicode(tool.target))
        __M_writer(u'" method="')
        __M_writer(unicode(tool.method))
        __M_writer(u'">\n')
        # SOURCE LINE 352
        if tool.has_multiple_pages:
            # SOURCE LINE 353
            __M_writer(u'                <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' (step ')
            __M_writer(unicode(tool_state.page+1))
            __M_writer(u' of ')
            __M_writer(unicode(tool.npages))
            __M_writer(u')\n')
            # SOURCE LINE 354
        elif not tool_version_select_field:
            # SOURCE LINE 355
            __M_writer(u'                <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' (Galaxy tool version ')
            __M_writer(unicode(tool.version))
            __M_writer(u')\n')
            # SOURCE LINE 356
        else:
            # SOURCE LINE 357
            __M_writer(u'                <div class="toolFormTitle">')
            __M_writer(unicode(tool.name))
            __M_writer(u' ')
            __M_writer(unicode(tool_version_select_field.get_html()))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 360
        if tool.requirements:
            # SOURCE LINE 361
            __M_writer(u'                <a href="#" class="icon-btn" title="Underlying versions" tabindex="0" data-toggle="popover" data-placement="bottom" data-content=\n                "\n')
            # SOURCE LINE 363
            for i, requirement in enumerate( tool.requirements ):
                # SOURCE LINE 364
                __M_writer(u'                    ')
                __M_writer(unicode( requirement.name ))
                __M_writer(u' ')
                __M_writer(unicode( ('v ' + requirement.version ) if requirement.version else ' ' ))
                __M_writer(u' ')
                __M_writer(unicode( '' if i + 1 == len( tool.requirements ) else ' | ' ))
                __M_writer(u' \n')
                pass
            # SOURCE LINE 366
            __M_writer(u'                "\n                 onclick="$(function () {\n                              $( \'[ data-toggle=\\\'popover\\\' ]\' ).popover();\n                              $( this ).popover( \'show\' );\n                          })">\n                    <span class="fa fa-info-circle"></span>\n                </a>\n')
            pass
        # SOURCE LINE 374
        __M_writer(u'\n            <span class="pull-right">\n')
        # SOURCE LINE 376
        if trans.app.config.biostar_url:
            # SOURCE LINE 378
            __M_writer(u'                    Help from Biostar\n                    <div class="icon-btn-group">\n                        <a href="')
            # SOURCE LINE 380
            __M_writer(unicode(h.url_for( controller='biostar', action='biostar_tool_tag_redirect', tool_id=tool.id )))
            __M_writer(u'"\n                            target="_blank" class="icon-btn" title="Search for this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-search"></span></a>\n                        <a href="')
            # SOURCE LINE 382
            __M_writer(unicode(h.url_for( controller='biostar', action='biostar_tool_question_redirect', tool_id=tool.id )))
            __M_writer(u'"\n                            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>\n                    </div>\n')
            pass
        # SOURCE LINE 386
        __M_writer(u'                <div class="icon-btn-group">\n                    <a href="#" data-link="')
        # SOURCE LINE 387
        __M_writer(unicode(h.url_for( controller='root', action='index', tool_id=tool.id, qualified=True )))
        __M_writer(u'"\n                        class="icon-btn tool-share-link" title="Share this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-share"></span></a>\n                </div>\n            </span>\n            </div>\n            <div class="toolFormBody">\n                <input type="hidden" name="refresh" value="refresh">\n                <input type="hidden" name="tool_id" value="')
        # SOURCE LINE 394
        __M_writer(unicode(tool.id))
        __M_writer(u'">\n                <input type="hidden" name="tool_state" value="')
        # SOURCE LINE 395
        __M_writer(unicode(util.object_to_string( tool_state.encode( tool, app ) )))
        __M_writer(u'">\n')
        # SOURCE LINE 396
        if tool.display_by_page[tool_state.page]:
            # SOURCE LINE 397
            __M_writer(u'                    ')
            __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 ) )))
            __M_writer(u'\n                    ')
            # SOURCE LINE 398
            __M_writer(unicode(row_for_rerun()))
            __M_writer(u'\n                    <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n')
            # SOURCE LINE 400
        else:
            # SOURCE LINE 401
            __M_writer(u'                    ')
            __M_writer(unicode(do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, errors, "" )))
            __M_writer(u'\n')
            # SOURCE LINE 402
            if tool_state.page == tool.last_page:
                # SOURCE LINE 403
                __M_writer(u'                        ')
                __M_writer(unicode(row_for_rerun()))
                __M_writer(u'\n')
                pass
            # SOURCE LINE 405
            __M_writer(u'                    <div class="form-row form-actions">\n')
            # SOURCE LINE 406
            if tool_state.page == tool.last_page:
                # SOURCE LINE 407
                __M_writer(u'                            <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">\n')
                # SOURCE LINE 408
            else:
                # SOURCE LINE 409
                __M_writer(u'                            <input type="submit" class="btn btn-primary" name="runtool_btn" value="Next step">\n')
                pass
            # SOURCE LINE 411
            __M_writer(u'                    </div>\n')
            pass
        # SOURCE LINE 413
        __M_writer(u'            </div>\n        </form>\n    </div>\n')
        # SOURCE LINE 416
        if tool.help:
            # SOURCE LINE 417
            __M_writer(u'        <div class="toolHelp">\n            <div class="toolHelpBody">\n                ')
            # SOURCE LINE 419

            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')
                            
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool_help'] if __M_key in __M_locals_builtin_stored]))
            # SOURCE LINE 431
            __M_writer(u'\n                ')
            # SOURCE LINE 432
            __M_writer(unicode(tool_help))
            __M_writer(u'\n            </div>\n        </div>\n')
            pass
        # SOURCE LINE 436
        if tool.tool_shed_repository:
            # SOURCE LINE 437
            __M_writer(u'        ')
            tool_url = tool.tool_shed_repository.get_sharable_url( tool.app ) 
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool_url'] if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n')
            # SOURCE LINE 438
            if tool_url:
                # SOURCE LINE 439
                __M_writer(u'            <br/>\n            ')
                # SOURCE LINE 440
                __M_writer(unicode( 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' ) ))
                __M_writer(u'\n')
                pass
            pass
        # SOURCE LINE 443
        if tool.citations:
            # SOURCE LINE 444
            __M_writer(u'        <script>\n        require(["mvc/citation/citation-model", "mvc/citation/citation-view"\n        ], function( citationModel, citationView ){\n            $(function() {\n                var citations = new citationModel.ToolCitationCollection();\n                citations.tool_id = "')
            # SOURCE LINE 449
            __M_writer(unicode(tool.id))
            __M_writer(u'";\n                var citation_list_view = new citationView.CitationListView({ collection: citations } );\n                citation_list_view.render();\n                citations.fetch();\n            } );\n        } );\n        </script>\n        <div id="citations">\n        </div>\n')
            pass
        # SOURCE LINE 459
        __M_writer(u'</div>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()