{% extends "basic/layout.html" %}

{% set theme_css_files = []%}
{% if theme_bootstrap_version == "3" %}
  {% set bootstrap_version, bootstrap_additional_css, navbar_version = "3.1.0", "theme", "" %}
  {% set bs_span_prefix = "col-md-" %}
{% else %}
  {% set bootstrap_version, bootstrap_additional_css, navbar_version = "2.3.2", "responsive", "-2" %}
  {% set bs_span_prefix = "span" %}
{% endif %}

{% if theme_bootswatch_theme %}
  {# BS2 needs "bootstrap-responsive.css". BS3 doesn't. #}
  {% if theme_bootstrap_version == "3" %}
    {% set theme_css_files = theme_css_files + [
        '_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css',
        '_static/bootstrap-sphinx.css'
      ]
    %}
  {% else %}
    {% set theme_css_files = theme_css_files + [
        '_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css',
        '_static/bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css',
        '_static/bootstrap-sphinx.css'
      ]
    %}
  {% endif %}
{% else %}
  {% set theme_css_files = theme_css_files + ['_static/main.min.css', '_static/styles.css']
  %}
{% endif %}

{% if not bootswatch_css_custom %}
  {% set bootswatch_css_custom = [] %}
{% endif %}
{% set css_files = css_files + theme_css_files + bootswatch_css_custom %}

{% set script_files = script_files + [
    '_static/js/jquery-1.11.0.min.js',
    '_static/js/jquery-fix.js',
    '_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js',
    '_static/bootstrap-sphinx.js'
  ]
%}

{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and sidebars %}

{%- set bs_content_width = render_sidebar and "9" or "12"%}

{%- block doctype -%}
<!DOCTYPE html>
{%- endblock %}

{# Sidebar: Rework into our Bootstrap nav section. #}
{% macro navBar() %}
<header class="banner navbar navbar-default navbar-static-top" role="banner">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
       <a class="brand" href="http://owncloud.org/" rel="home" title="ownCloud.org"><img class="logo" src="{{ pathto('_static/img/logo_owncloud.svg', 1) }}" itemprop="logo"></a>
    </div>

    <nav class="collapse navbar-collapse" role="navigation">
      <ul id="menu-header" class="nav navbar-nav">
        <li class="menu-news"><a href="http://owncloud.org/news/">News</a></li>
        <li class="menu-features"><a href="http://owncloud.org/features/">Features</a></li>
        <li class="menu-demo"><a href="http://demo.owncloud.org">Demo</a></li>
        <li class="menu-documentation"><a href="http://doc.owncloud.org">Documentation</a></li>
        <li class="menu-contribute"><a href="http://owncloud.org/contribute/">Contribute</a>
        <li class="menu-commercial"><a target="_blank" href="https://owncloud.com">Enterprise Edition</a></li>
        <li class="menu-install"><a href="http://owncloud.org/install/">Install</a></li>
      </ul>
    </nav>
  </div>
</header>
{% endmacro %}

{% if theme_bootstrap_version == "3" %}
  {%- macro bsidebar() %}
      {%- if render_sidebar %}
      <div class="{{ bs_span_prefix }}3">
        <div id="sidebar" class="bs-sidenav" role="complementary">
          {%- for sidebartemplate in sidebars %}
            {%- include sidebartemplate %}
          {%- endfor %}
        </div>
      </div>
      {%- endif %}
  {%- endmacro %}
{% else %}
  {%- macro bsidebar() %}
      {%- if render_sidebar %}
      <div class="{{ bs_span_prefix }}3">
        <div id="sidebar" class="bs-sidenav well" data-spy="affix">
          {%- for sidebartemplate in sidebars %}
            {%- include sidebartemplate %}
          {%- endfor %}
        </div>
      </div>
      {%- endif %}
  {%- endmacro %}
{% endif %}

{%- block extrahead %}
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
{% endblock %}

{# Silence the sidebar's, relbar's #}
{% block header %}{% endblock %}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebarsourcelink %}{% endblock %}

{%- block content %}
{{ navBar() }}
<div class="wrap container not-front">
  <div class="content row">
  <main class="main">
    <div class="row page-content-header">
      <div class="col-md-6">
        <h1><a href="{{ pathto(master_doc) }}">{{ project|e }}</a></h1>
      </div>
      <div class="col-md-5 col-md-offset-1">
      {% if theme_show_search %}
        <form class="headersearch" style="margin-bottom:-3px;" action="{{ pathto('search') }}" method="get">
        <input type="text" value="" name="q" id="q" class="form-control" /> 
        <button  class="btn btn-default" type="submit" id="searchsubmit">Search</button>
        </form>
      {% endif %}
      </div>
    </div>
    {% block sidebartoc %}
			<div class="row">
				<div class="col-md-3">
					<div class="sidebar">
							<div class="menu-support-container">
								<ul id="menu-support" class="menu">
									<ul>
										<li><a href="{{ pathto(master_doc) }}">Overview</a></li>
									</ul>
                  {{ toctree(maxdepth=3) }}
								</ul>
							</div>
					</div>
				</div>
        {% endblock %}

				<div class="col-md-9">
					<div class="page-content">
            {% include "relations.html" %}
						{% block body %}{% endblock %}
            {% include "relations.html" %}
					</div>
				</div>
			</div>
  </main>  
  </div>
</div>
{%- endblock %}

{%- block footer %}
<footer class="content-info" role="contentinfo">
<div class="container">   
   <div class="row">
     <div class="col-sm-4">
        <div class="footer-nav">
          <h4>About ownCloud</h4>
          <ul id="menu-about" class="menu">
            <li class="menu-contact"><a href="http://owncloud.org//contact/">Contact</a></li>
            <li class="menu-history"><a href="http://owncloud.org//history/">History</a></li>
          </ul>
        </div>
     </div>
     <div class="col-sm-4">
        <div class="footer-nav">
          <h4>Support &#38; Documentation</h4>
          <ul id="menu-support-and-documentation" class="menu">
            <li class="menu-admin-manual"><a href="http://doc.owncloud.org/server/6.0/admin_manual/">Admin manual</a></li>
            <li class="menu-user-manual"><a href="http://doc.owncloud.org/server/6.0/user_manual/">User manual</a></li>
            <li class="menu-security"><a href="http://owncloud.org//security/">Security</a></li>
            <li class="dropdown menu-resources"><a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Resources <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li class="menu-irc-channel"><a href="http://webchat.freenode.net/?channels=owncloud">IRC Channel</a></li>
                <li class="menu-mailing-list"><a href="https://mail.kde.org/mailman/listinfo/owncloud">Mailing List</a></li>
                <li class="menu-forums"><a href="http://forum.owncloud.org/">Forums</a></li>
                <li class="menu-bug-tracker"><a href="https://github.com/owncloud/core/issues">Bug Tracker</a></li>
              </ul>
            </li>
          </ul>
        </div>
     </div> 
     <div class="col-sm-4">
        <div class="footer-nav">
          <h4>Developer Resources</h4>
          <ul id="menu-developer" class="menu">
            <li class="menu-contribute"><a href="http://owncloud.org//contribute/">Contribute</a></li>
            <li class="menu-security"><a href="http://owncloud.org//security/">Security</a></li>
            <li class="menu-design"><a href="http://owncloud.org//contribute/design/">Design</a></li>
            <li class="menu-developer-docs"><a href="http://doc.owncloud.org/server/6.0/developer_manual/">Developer docs</a></li>
          </ul>
        </div>
     </div>
   </div>
      <p>
    {%- if show_copyright %}
      {%- if hasdoc('copyright') %}
        {% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}<br/>
      {%- else %}
        {% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}<br/>
      {%- endif %}
    {%- endif %}
    {%- if last_updated %}
      {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}<br/>
    {%- endif %}
    {%- if show_sphinx %}
      {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}<br/>
    {%- endif %}
    </p>
  </div>
</footer>
{%- endblock %}
