{% extends "base.html" %}
{% load mini_buildd_tags %}

{% block page_header %}
	<div class="left">
		<div class="menu-title">
			Page
		</div>
		{% if api_cmd.args.package %}
			{% with api_cmd.args.package as package %}
				<a href="/mini_buildd/api?command=show&amp;package={{ package|urlencode }}" title="Show {{ package }} source package">Show package</a>
				<br />
				<a href="https://tracker.debian.org/pkg/{{ package|urlencode }}" title="Show {{ package }} source package in the Debian Package Tracker">Show Debian</a>
				(<a href="http://packages.qa.debian.org/common/index.html?src={{ package|urlencode }}" title="Show {{ package }} source package in the (traditional) Debian PTS">Old</a>)
				<br />
			{% endwith %}
		{% endif %}
		{% if api_cmd %}
			<hr />
			<a href="/mini_buildd/api?command={{ api_cmd.COMMAND|urlencode }}&amp;{% for k, v in api_cmd.args.items %}{{ k|urlencode }}={{ v|urlencode }}&amp;{% endfor %}output=plain" title="This API call with plain output">API: plain</a>
			<br />
			<a href="/mini_buildd/api?command={{ api_cmd.COMMAND|urlencode }}&amp;{% for k, v in api_cmd.args.items %}{{ k|urlencode }}={{ v|urlencode }}&amp;{% endfor %}output=python" title="This API call with python output">API: python</a>
			<br />
		{% endif %}
	</div>
	<div class="center">
		<div class="title">{% block page_title %}{% endblock %}</div><div class="sub-title">{% block page_sub_title %}{% endblock %}</div>
	</div>
	<div class="right">
		<div class="menu-title">
			Packages
		</div>
		<form action="/mini_buildd/api" method="get">
			<div>
				<input type="hidden" name="command" value="show" />
				<input type="text" name="package" size="12" value="{{ api_cmd.args.package }}" title="Source package name." />
				<input type="submit" value="Show" title="Show source package" style="width: 4em"/>
			</div>
		</form>
		<form action="/mini_buildd/api" method="get">
			<div>
				<input type="hidden" name="command" value="list" />
				<input type="text" name="pattern" size="12" value="{{ api_cmd.args.pattern }}" title="Source or binary package name pattern (shell-like glob)." />
				<input type="submit" value="List" title="List packages matching pattern" style="width: 4em" />
			</div>
		</form>
	</div>

	{% if api_cmd.args %}
		<div class="right">
			<b>{{ api_cmd.COMMAND }}</b> API call (<a id="mbd-current-api-command_header" href="javascript:mbdToggleElement('mbd-current-api-command','mbd-current-api-command_header','hide parameter','show parameter')">show parameter</a>)
			<div id="mbd-current-api-command">
				<form action="/mini_buildd/api" method="get">
					<div>
						<input type="hidden" name="command" value="{{ api_cmd.COMMAND }}" />
						{% for k, v in api_cmd.args.items %}
							<p>
								{% with help=api_cmd.args_help|mbd_dict_get:k %}
									<kbd>{{ k }}</kbd>=<input type="text" size="{{ v | length}}" name="{{ k }}" value="{{ v }}" />
									<kbd><small>{{ help }}</small></kbd>
								{% endwith %}
							</p>
						{% endfor %}
						<input type="submit" value="Refine" title="Refined API call" style="width: 4em" />
					</div>
				</form>
			</div>
		</div>
	{% endif %}

{% endblock %}
