<!DOCTYPE html>
<html lang="en-us">
	<head>
		{% include "mini_buildd/includes/head.html" %}
		<title>mini-buildd ({{ mbd.daemon.get_title }}): {% block titledup %}{% endblock %}</title>
	</head>

	<body>
		<header class="mbd-grid-lcr {{ mbd.daemon.is_alive|yesno:',mbd-off' }}">
			<nav>
				<ul>
					<li class="{% if request.path == mbd.config.URIS.home.view.uri %}mbd-body-menu-active{% endif %}">
						<a href="{% url 'home' %}">
							<img class="mbd-icon" src="{% static 'mini_buildd.svg' %}" alt="Home" title="Home: {{ mbd.daemon.get_title }}">
						</a>
					</li>
					{% for name in mbd.config.MAIN_MENU_LEFT %}
						{% include "mini_buildd/includes/main_menu_item.html" %}
					{% endfor %}
				</ul>
			</nav>

			<nav>
				<ul>
					<li>{% mbd_api "ls" %}</li>
				</ul>
			</nav>

			<nav>
				<ul>
					{% for name in mbd.config.MAIN_MENU_RIGHT %}
						{% include "mini_buildd/includes/main_menu_item.html" %}
					{% endfor %}
					<li>&vert;</li>
					<li>
						<div class="{{ user.is_authenticated|yesno:',mbd-dim' }}">{{ user.username|default:"Logged Off" }}▼</div>
						<ul>
							{% if user.is_authenticated %}
								<li>{% mbd_accounts "logout" name="Logout" %}</li>
								<li>{% mbd_accounts "profile" name="Profile" %}</li>
								<li>{% mbd_accounts "password_change" name="Change Password" %}</li>
								<li>{% mbd_accounts "login" name="Change User" %}</li>
							{% else %}
								<li>{% mbd_accounts "login" name="Login" %}</li>
								<li>{% mbd_accounts "register" name="Register new account" %}</li>
								<li>{% mbd_accounts "password_reset" name="Reset password" %}</li>
							{% endif %}
						</ul>
					</li>
				</ul>
			</nav>
		</header>

		<noscript class="mbd-warning">JavaScript not available: <b>Usability limited</b></noscript>

		<main>
			{% include "mini_buildd/includes/popup.html" %}

			<header class="mbd-grid-lr">
				<h1 title="{% block tooltip %}{% endblock %}">{% block title %}{% endblock %}</h1>
				<nav>
					<ul>
						{% if path %}
							<li>
								<a href="{% url name %}">
									<img class="mbd-icon" src="{% static 'icons/actions/go-top.svg' %}" alt="Top">
								</a>
							</li>
							{% url name path|mbd_parent as up %}
							{% if up %}
								<li>
									<a href="{{ up }}">
										<img class="mbd-icon" src="{% static 'icons/actions/go-up.svg' %}" alt="Up">
									</a>
								</li>
							{% endif %}
						{% endif %}
						{% if view.mbd_dirview %}
							{% if not view.mbd_isfile %}
								{% url route path as view_uri %}
								{% if view_uri %}
									<li>
										<a href="{{ view_uri }}">
											<img class="mbd-icon" src="{% static 'icons/mimetypes/text-html.svg' %}" alt="htmlview" title="Switch To Standard View">
										</a>
									</li>
								{% endif %}
							{% endif %}
						{% else %}
							{% url route|add:'-dir' path as dir_uri %}
							{% if dir_uri %}
								<li>
									<a href="{{ dir_uri }}">
										<img class="mbd-icon" src="{% static 'icons/places/folder.svg' %}" alt="dirview" title="Switch to Directory View">
									</a>
								</li>
							{% endif %}
						{% endif %}
						{% block menu %}{% endblock %}
					</ul>
				</nav>
			</header>
			<section>
				{% block content %}{% endblock %}
			</section>
		</main>

		<footer class="mbd-grid-lcr">
			<div title="Version of mini-buildd">{{ mbd.version }}</div>
			<nav>
				<ul>
					<li title="Key id and fingerprint of instance">&raquo; <strong>{{ mbd.daemon.get_title }}</strong> ({{ mbd.daemon.gnupg.pub_key_id }})</li>
					<li>{% mbd_api_popup "pub_key" %}</li>
					<li>{% mbd_api_popup "sources_list" %}</li>
					<li>{% mbd_api_popup "dput_conf" %}</li>
				</ul>
			</nav>
			<nav>
				<ul>
					<li><a href="{% url "sitemap" %}">Sitemap</a></li>
					<li><a href="{{ mbd.config.URIS.homepage.view.uri }}">Homepage➚</a></li>
				</ul>
			</nav>
		</footer>
		{# <pre>{% debug %}</pre> #}
	</body>
</html>
