from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1287725326.7917881
_template_filename=u'templates/webapps/galaxy/base_panels.mako'
_template_uri=u'/webapps/galaxy/base_panels.mako'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding=None
_exports = ['masthead', 'title']


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    pass
def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/base_panels.mako', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 4
        __M_writer(u'\n\n')
        # SOURCE LINE 172
        __M_writer(u'\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_masthead(context):
    context.caller_stack._push_frame()
    try:
        h = context.get('h', UNDEFINED)
        app = context.get('app', UNDEFINED)
        trans = context.get('trans', UNDEFINED)
        def tab(id,display,href,target='_parent',visible=True,extra_class='',menu_options=None):
            context.caller_stack._push_frame()
            try:
                self = context.get('self', UNDEFINED)
                len = context.get('len', UNDEFINED)
                __M_writer = context.writer()
                # SOURCE LINE 15
                __M_writer(u'\n')
                # SOURCE LINE 18
                __M_writer(u'    \n        ')
                # SOURCE LINE 19

                cls = "tab"
                if extra_class:
                    cls += " " + extra_class
                if self.active_view == id:
                    cls += " active"
                style = ""
                if not visible:
                    style = "display: none;"
                
                
                # SOURCE LINE 28
                __M_writer(u'\n        <td class="')
                # SOURCE LINE 29
                __M_writer(unicode(cls))
                __M_writer(u'" style="')
                __M_writer(unicode(style))
                __M_writer(u'">\n')
                # SOURCE LINE 30
                if href:
                    # SOURCE LINE 31
                    __M_writer(u'                <a target="')
                    __M_writer(unicode(target))
                    __M_writer(u'" href="')
                    __M_writer(unicode(href))
                    __M_writer(u'">')
                    __M_writer(unicode(display))
                    __M_writer(u'</a>\n')
                    # SOURCE LINE 32
                else:
                    # SOURCE LINE 33
                    __M_writer(u'                <a>')
                    __M_writer(unicode(display))
                    __M_writer(u'</a>\n')
                # SOURCE LINE 35
                if menu_options:
                    # SOURCE LINE 36
                    __M_writer(u'                <div class="submenu">\n                <ul>\n')
                    # SOURCE LINE 38
                    for menu_item in menu_options:
                        # SOURCE LINE 39
                        __M_writer(u'                        <li>\n')
                        # SOURCE LINE 40
                        if not menu_item:
                            # SOURCE LINE 41
                            __M_writer(u'                            <hr style="color: inherit; background-color: gray"/></li>\n')
                            # SOURCE LINE 42
                        else:
                            # SOURCE LINE 43
                            if len ( menu_item ) == 1:
                                # SOURCE LINE 44
                                __M_writer(u'                                ')
                                __M_writer(unicode(menu_item[0]))
                                __M_writer(u'\n')
                                # SOURCE LINE 45
                            elif len ( menu_item ) == 2:
                                # SOURCE LINE 46
                                __M_writer(u'                                ')
                                name, link = menu_item 
                                
                                __M_writer(u'\n                                <a href="')
                                # SOURCE LINE 47
                                __M_writer(unicode(link))
                                __M_writer(u'">')
                                __M_writer(unicode(name))
                                __M_writer(u'</a></li>\n')
                                # SOURCE LINE 48
                            else:
                                # SOURCE LINE 49
                                __M_writer(u'                                ')
                                name, link, target = menu_item 
                                
                                __M_writer(u'\n                                <a target="')
                                # SOURCE LINE 50
                                __M_writer(unicode(target))
                                __M_writer(u'" href="')
                                __M_writer(unicode(link))
                                __M_writer(u'">')
                                __M_writer(unicode(name))
                                __M_writer(u'</a></li>\n')
                    # SOURCE LINE 54
                    __M_writer(u'                </ul>\n                </div>\n')
                # SOURCE LINE 57
                __M_writer(u'        </td>\n    ')
                return ''
            finally:
                context.caller_stack._pop_frame()
        __M_writer = context.writer()
        # SOURCE LINE 7
        __M_writer(u'\n\n')
        # SOURCE LINE 10
        __M_writer(u'    <div style="position: absolute; top: 0; left: 0; width: 100%; text-align: center">\n    \n    <table class="tab-group" border="0" cellspacing="0" style="margin: auto;">\n    <tr>\n    \n    ')
        # SOURCE LINE 58
        __M_writer(u'\n    \n\n')
        # SOURCE LINE 62
        __M_writer(u'    ')
        __M_writer(unicode(tab( "analysis", "Analyze Data", h.url_for( controller='/root', action='index' ) )))
        __M_writer(u'\n    \n')
        # SOURCE LINE 65
        __M_writer(u'    ')
        __M_writer(unicode(tab( "workflow", "Workflow", h.url_for( controller='/workflow', action='index' ) )))
        __M_writer(u'\n    \n')
        # SOURCE LINE 68
        __M_writer(u'    ')

        menu_options = [ 
                        [ 'Data Libraries', h.url_for( controller='/library', action='index') ],
                        None,
                        [ 'Published Histories', h.url_for( controller='/history', action='list_published' ) ],
                        [ 'Published Workflows', h.url_for( controller='/workflow', action='list_published' ) ],
                        [ 'Published Visualizations', h.url_for( controller='/visualization', action='list_published' ) ],
                        [ 'Published Pages', h.url_for( controller='/page', action='list_published' ) ]
                       ]
        tab( "shared", "Shared Data", h.url_for( controller='/library', action='index'), menu_options=menu_options )
            
        
        # SOURCE LINE 78
        __M_writer(u'\n    \n')
        # SOURCE LINE 81
        __M_writer(u'    ')

        menu_options = [
                         [ 'Sequencing Requests', h.url_for( controller='/requests', action='index' ) ],
                         [ 'Find Samples', h.url_for( controller='/requests', action='find_samples_index' ) ],
                         [ 'Help', app.config.get( "lims_doc_url", "http://main.g2.bx.psu.edu/u/rkchak/p/sts" ), "galaxy_main" ]
                       ]
        tab( "lab", "Lab", None, menu_options=menu_options, visible=( trans.user and trans.user.requests ) )
            
        
        # SOURCE LINE 88
        __M_writer(u'\n\n')
        # SOURCE LINE 91
        if app.config.get_bool( 'enable_tracks', False ):
            # SOURCE LINE 92
            __M_writer(u'        ')

            menu_options = [
                             ['New Track Browser', h.url_for( controller='/tracks', action='index' ) ],
                             ['Saved Visualizations', h.url_for( controller='/visualization', action='list' ) ]
                           ]
            tab( "visualization", "Visualization", h.url_for( controller='/visualization', action='list'), menu_options=menu_options )
                    
            
            # SOURCE LINE 98
            __M_writer(u'\n')
        # SOURCE LINE 100
        __M_writer(u'\n')
        # SOURCE LINE 102
        __M_writer(u'    ')
        __M_writer(unicode(tab( "admin", "Admin", h.url_for( controller='/admin', action='index' ), extra_class="admin-only", visible=( trans.user and app.config.is_admin_user( trans.user ) ) )))
        __M_writer(u'\n    \n')
        # SOURCE LINE 105
        __M_writer(u'    ')

        menu_options = [
                            ['Email comments, bug reports, or suggestions', app.config.get( "bugs_email", "mailto:galaxy-bugs@bx.psu.edu"  ) ],
                            ['Galaxy Wiki', app.config.get( "wiki_url", "http://bitbucket.org/galaxy/galaxy-central/wiki" ), "_blank" ],
                            ['Video tutorials (screencasts)', app.config.get( "screencasts_url", "http://galaxycast.org" ), "_blank" ],
                            ['How to Cite Galaxy', app.config.get( "screencasts_url", "http://bitbucket.org/galaxy/galaxy-central/wiki/Citations" ), "_blank" ]
                        ]
        tab( "help", "Help", None, menu_options=menu_options)
            
        
        # SOURCE LINE 113
        __M_writer(u'\n    \n')
        # SOURCE LINE 116
        __M_writer(u'    ')
  
        # Menu for user who is not logged in.
        menu_options = [ [ "Login", h.url_for( controller='/user', action='login' ), "galaxy_main" ] ]
        if app.config.allow_user_creation:
            menu_options.append( [ "Register", h.url_for( controller='/user', action='create' ), "galaxy_main" ] ) 
        extra_class = "loggedout-only"
        visible = ( trans.user == None )
        tab( "user", "User", None, visible=visible, menu_options=menu_options )
        
        # Menu for user who is logged in.
        if trans.user:
            email = trans.user.email
        else:
            email = ""
        menu_options = [ [ '<li>Logged in as <span id="user-email">%s</span></li>' %  email ] ]
        if app.config.use_remote_user:
            if app.config.remote_user_logout_href:
                menu_options.append( [ 'Logout', app.config.remote_user_logout_href, "galaxy_main" ] )
        else:
            menu_options.append( [ 'Preferences', h.url_for( controller='/user', action='index' ), "galaxy_main" ] )
            if app.config.get_bool( 'enable_tracks', False ):
                menu_options.append( [ 'Custom Builds', h.url_for( controller='/user', action='dbkeys' ), "galaxy_main" ] )
            if app.config.require_login:
                logout_url = h.url_for( controller='/root', action='index', m_c='user', m_a='logout' )
            else:
                logout_url = h.url_for( controller='/user', action='logout' )
            menu_options.append( [ 'Logout', logout_url, "_top" ] )
            menu_options.append( None )
        menu_options.append( [ 'Saved Histories', h.url_for( controller='/history', action='list' ), "galaxy_main" ] )
        menu_options.append( [ 'Saved Datasets', h.url_for( controller='/dataset', action='list' ), "galaxy_main" ] )
        if app.config.get_bool( 'enable_pages', False ):
            menu_options.append( [ 'Saved Pages', h.url_for( controller='/page', action='list' ), "_top" ] )
        if app.config.enable_api:
            menu_options.append( [ 'API Keys', h.url_for( controller='/user', action='api_keys' ), "galaxy_main" ] )
            
        extra_class = "loggedin-only"
        visible = ( trans.user != None )
        tab( "user", "User", None, visible=visible, menu_options=menu_options )
            
        
        # SOURCE LINE 154
        __M_writer(u'\n    \n    </tr>\n    </table>\n    \n    </div>\n    \n')
        # SOURCE LINE 162
        __M_writer(u'    <div class="title" style="position: absolute; top: 0; left: 0;">\n        <a href="')
        # SOURCE LINE 163
        __M_writer(unicode(app.config.get( 'logo_url', '/' )))
        __M_writer(u'">\n        <img border="0" src="')
        # SOURCE LINE 164
        __M_writer(unicode(h.url_for('/static/images/galaxyIcon_noText.png')))
        __M_writer(u'" style="width: 26px; vertical-align: top;">\n        Galaxy\n')
        # SOURCE LINE 166
        if app.config.brand:
            # SOURCE LINE 167
            __M_writer(u"            <span class='brand'>/ ")
            __M_writer(unicode(app.config.brand))
            __M_writer(u'</span>\n')
        # SOURCE LINE 169
        __M_writer(u'        </a>\n    </div>\n    \n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_title(context):
    context.caller_stack._push_frame()
    try:
        __M_writer = context.writer()
        # SOURCE LINE 4
        __M_writer(u'Galaxy')
        return ''
    finally:
        context.caller_stack._pop_frame()


