<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>

    <script>var lnt_url_base="{{ url_for('.index', _external=False) }}".replace(/\/$/, "");</script>
    <link href="{{ url_for('.static', filename='bootstrap/css/bootstrap.min.css')
                }}" rel="stylesheet" media="screen"/>
    <link href="{{ url_for('.static', filename='bootstrap/css/bootstrap-responsive.min.css')
                }}" rel="stylesheet"/>
    <link href="{{ url_for('.static', filename='narrow.css')
                }}" rel="stylesheet" media='screen and (max-width: 750px)'/>
    <link href="{{ url_for('.static', filename='wide.css')
                }}" rel="stylesheet" media='screen and (min-width: 750px)'/>
    <script src="{{ url_for('.static', filename='jquery/1.7.2/jquery-1.7.2.min.js')
                 }}"> </script>
    <script src="{{ url_for('.static', filename='jquery/jquery.dateFormat/jquery-dateFormat.min.js')
                 }}"> </script>

    <script src="{{ url_for('.static', filename='bootstrap/js/bootstrap.min.js')
                 }}"></script>
    <script src="{{ url_for('.static', filename='timedate.js')
                 }}"></script>

    <!-- DataTables CSS -->
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.8/css/jquery.dataTables.css" />

    <!-- DataTables -->
    <script type="text/javascript" charset="UTF-8" src="//cdn.datatables.net/1.10.8/js/jquery.dataTables.js">
    </script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/floatthead/1.4.2/jquery.floatThead.min.js"></script>

    <script src="{{ url_for('.static', filename='lnt.js') }}"></script>


  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

  <style type="text/css">
    /* Sticky footer styles ------------------------------------------------- */
    html,
    body {
      height: 100%;
      /* The html and body elements cannot have any padding or margin. */
    }

    /* Wrapper for page content to push down footer */
    #wrap {
      min-height: 100%;
      height: auto !important;
      height: 100%;
      /* Negative indent footer by it's height */
      margin: 0 auto -60px;
    }

    /*Set the fixed height of the header and footer here */
    #push,
    #header {
      height: 90px;
    }

    #footer {
      background-color: #f5f5f5;
    }

    /* Offset Navbar items away from window corner */
    #push,
    #lnt-instance { margin-left:20px; }
    #dbselect { margin-right : 20px; }
    {% if nosidebar is defined %}
        #page-content { margin-left:20px; width:100%}
    {% endif %}
    /* Lastly, apply responsive CSS fixes as necessary */
    @media (max-width: 767px) {
      #footer {
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
      }
    }

    /* Floating headers can't have clear backgrounds. */
    .floating_header thead {
        background-color: #FFFFFF;
    }
    
  </style>

  <link rel="icon" type="image/png" href="{{ url_for('.static', filename='favicon.ico') }}"/>

  <title>
    {{old_config.name}}{% for short_name,_ in components %} : {{short_name}}{% endfor %} - {{ self.title() }}
  </title>

  {% block head %}
  {% endblock %}

  <script type='text/javascript'>
    {% block javascript %}
    {% endblock %}


  </script>
</head>

{% set base_url=old_config.zorgURL %}

{% if self.onload is defined %}
<body onload="{{ self.onload() }}">
{% else %}
<body data-spy="scroll" data-target="#side-bar">
{% endif %}
    {# Top-Level Content (non-footer) #}
    <div id="wrap">
        {# Page Header #}
        <div id="header" class="navbar navbar-fixed-top">
            <div class="navbar-inner">
            {# LNT Instance Title #}
                <div id="lnt-instance">
                    <a class="brand" href="{{url_for('.index')}}">{{old_config.name}}</a>
                </div>
                {# Database Selector #}
                <ul class="nav">
                    {% if g.db_name is defined %}
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="dbselect" >Database <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            {% for name in old_config.databases.keys()|sort %}
                                <li><a href="{{ url_for('.select_db', db=name, path=request.path) }}">
                                {% if name == g.db_name %}
                                    <b>{{ name }}</b>
                                {% else %}
                                    {{ name }}
                                {% endif %}
                                </a></li>
                            {% endfor %}
                        </ul>
                    </li>
                    {% endif %}
                </ul>
                {% if g.db_name is defined %}
                <ul class="nav">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Suite<b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            {% for name in request.get_db().testsuite %}
                                <li><a href="{{db_url_for('.v4_recent_activity', testsuite_name=name)}}">{{name}}</a></li>
                            {% endfor %}
                        </ul>
                    </li>
                </ul>
                {% endif %}
                {# Test Suite #}
                {% if g.testsuite_name is defined %}
                    <ul class="nav">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{g.testsuite_name}}<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                              <li><a href="{{ v4_url_for('.v4_recent_activity') }}">Recent Activity</a></li>
                              <li><a href="{{ v4_url_for('.v4_global_status') }}">Global Status</a></li>
                              <li><a href="{{ v4_url_for('.v4_daily_report_overview') }}">Daily Report</a></li>
                              <li><a href="{{ v4_url_for('.v4_latest_runs_report') }}">Latest Runs Report</a></li>
                              <li><a href="{{ v4_url_for('.v4_machines') }}">All Machines</a></li>
                               <li class="divider"></li>
                              <li class="disabled"><a href="#">Changes</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=0) }}">Detected</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=1) }}">Staged</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=10) }}">Active</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=20) }}">NTBF</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=21) }}">Ignored</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=23) }}">Verify</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=22) }}">Fixed</a></li>
                              <li><a href="{{ v4_url_for('.v4_regression_list', state=-1) }}">All</a></li>
                              <li class="divider"></li>
                              <li class="disabled"><a href="#">Summary Report</a></li>
                              {#"{{ v4_url_for('.v4_summary_report') }}"#}
                            </ul>
                        </li>
                    </ul>
                        {% endif %}
                {% if baselines is defined %}
                <ul class="nav">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Baselines<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li class="nav-header">Select baseline:</li>
                                {% for b in baselines %}
                                {% set is_bold = b.id == baseline_id %}
                              <li><a href="{{ v4_url_for('.v4_set_baseline', id=b.id) }}">
                                  {% if is_bold %}
                                      <b>{{ b.name }}</b>
                                  {% else %}
                                      {{ b.name }}
                                  {% endif %}
                              </a><p></p></li>
                               {% endfor %}
                                <li class="divider"></li>
                            </ul>
                        </li>
                </ul>
                {% endif %}
                <ul class="nav pull-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">System<b class="caret"></b></a>
                        <ul class="dropdown-menu">
                          <li><a href="{{ url_for('.log') }}">Logs</a></li>
                          <li><a href="{{ url_for('.rules') }}">Rules</a></li>
                          <li><a href="{{ url_for('.profile_admin') }}">Profiles</a></li>
                          <li><a href="{{ url_for('.static', filename='docs/index.html') }}">Documentation</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div>
                {# Navigation Breadcrumbs #}
                <ul class="breadcrumb">
                    {% for short_name,path in components %}
                        <li><a href="{{ path }}">{{short_name}}</a><span class="divider">/</span></li>
                    {% endfor %}
                    <li class="active">{{self.title()}}</li>
                </ul>

            </div>
        </div>

        {# Include any database log, if present. #}
        {% if g.db_log is defined %}
        <div class="alert alert-info">
          <h4>SQL Log</h4>
          <pre>{{g.db_log.getvalue()}}</pre>
        </div>
        {% endif %}
        

        {# Page Content #}
        <div id="content" class="container-fluid">
            <div id="errors"></div>
            {% with messages = get_flashed_messages(with_categories=true) %}
                {% if messages %}
                    {% for category, message in messages %}
                        <div class="{{ category }}" role="alert">
                            {{ message }}  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                        </div>
                        {% endfor %}
                {% endif %}
            {% endwith %} 
        
            {% if nosidebar is defined %}
                <div class="row">
                    <div id="page-content" class="span12">
            {% else %}
                <div id ="side-bar" class="span3 bs-docs-sidebar ">
                 {% block sidebar %}{% endblock %} 
                </div>
                    <div id="page-content" class="span9">
            {% endif %}
          
                        {% block body %}{% endblock %}
                    </div>
                {% if nosidebar is defined %}
                </div>
                {% endif %}
            </div>
        </div>

        {# Force space for footer #}
        <div id="push"></div>

        {# Page Footer #}
        <div id="footer">
            <div class="container">
              <table class="table">
                <tr>
                  <td>LNT Version: {{ app.version }}</td>
                  <td>Server Started: <span class="utctime">{{ app.start_time|asisotime }}</span></td>
                  <td>Generated: <span class="utctime">{{ request.request_time|asisotime }}</span></td>
                  <td>Render Time: {{ "%.2fs" % request.elapsed_time() }}</td>
                </tr>
              </table>
            </div>
        </div>

</body>
</html>
