{% extends "admin/change_form.html" %}

{% load i18n admin_modify adminmedia %}

{% block extrahead %}
	{{ block.super }}
	<style type="text/css">
    html * { padding:0; margin:0; }
    body * { padding:10px 20px; }
    body * * { padding:0; }
    body { font:small sans-serif; }
    body>div { border-bottom:1px solid #ddd; }
    h1 { font-weight:normal; }
    h2 { margin-bottom:.8em; }
    h2 span { font-size:80%; color:#666; font-weight:normal; }
    h3 { margin:1em 0 .5em 0; }
    h4 { margin:0 0 .5em 0; font-weight: normal; }
    table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; }
    tbody td, tbody th { vertical-align:top; padding:2px 3px; }
    thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; }
    tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; }
    table.vars { margin:5px 0 2px 40px; }
    table.vars td, table.req td { font-family:monospace; }
    table td.code { width:100%; }
    table td.code div { overflow:hidden; }
    table.source th { color:#666; }
    table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
    ul.traceback { list-style-type:none; }
    ul.traceback li.frame { margin-bottom:1em; }
    div.context { margin: 10px 0; }
    div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; }
    div.context ol li { font-family:monospace; white-space:pre; color:#666; cursor:pointer; }
    div.context ol.context-line li { color:black; background-color:#ccc; }
    div.context ol.context-line li span { float: right; }
    div.commands { margin-left: 40px; }
    div.commands a { color:black; text-decoration:none; }
    #summary { background: #ffc; }
    #summary h2 { font-weight: normal; color: #666; }
    #explanation { background:#eee; }
    #template, #template-not-exist { background:#f6f6f6; }
    #template-not-exist ul { margin: 0 0 0 20px; }
    #unicode-hint { background:#eee; }
    #traceback { background:#eee; }
    #requestinfo { background:#f6f6f6; padding-left:120px; }
    #summary table { border:none; background:transparent; }
    #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
    #requestinfo h3 { margin-bottom:-1em; }
    .error { background: #ffc; }
    .specific { color:#cc3300; font-weight:bold; }
    h2 span.commands { font-size:.7em;}
    span.commands a:link {color:#5E5694;}
    pre.exception_value { font-family: sans-serif; color: #666; font-size: 1.5em; margin: 10px 0 10px 0; }
  </style>
  <script type="text/javascript">
  //<!--
    function getElementsByClassName(oElm, strTagName, strClassName){
        // Written by Jonathan Snook, http://www.snook.ca/jon; Add-ons by Robert Nyman, http://www.robertnyman.com
        var arrElements = (strTagName == "*" && document.all)? document.all :
        oElm.getElementsByTagName(strTagName);
        var arrReturnElements = new Array();
        strClassName = strClassName.replace(/\-/g, "\\-");
        var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
        var oElement;
        for(var i=0; i<arrElements.length; i++){
            oElement = arrElements[i];
            if(oRegExp.test(oElement.className)){
                arrReturnElements.push(oElement);
            }
        }
        return (arrReturnElements)
    }
    function hideAll(elems) {
      for (var e = 0; e < elems.length; e++) {
        elems[e].style.display = 'none';
      }
    }
    window.onload = function() {
      hideAll(getElementsByClassName(document, 'table', 'vars'));
      hideAll(getElementsByClassName(document, 'ol', 'pre-context'));
      hideAll(getElementsByClassName(document, 'ol', 'post-context'));
      hideAll(getElementsByClassName(document, 'div', 'pastebin'));
    }
    function toggle() {
      for (var i = 0; i < arguments.length; i++) {
        var e = document.getElementById(arguments[i]);
        if (e) {
          e.style.display = e.style.display == 'none' ? 'block' : 'none';
        }
      }
      return false;
    }
    function varToggle(link, id) {
      toggle('v' + id);
      var s = link.getElementsByTagName('span')[0];
      var uarr = String.fromCharCode(0x25b6);
      var darr = String.fromCharCode(0x25bc);
      s.innerHTML = s.innerHTML == uarr ? darr : uarr;
      return false;
    }
    function switchPastebinFriendly(link) {
      s1 = "Switch to copy-and-paste view";
      s2 = "Switch back to interactive view";
      link.innerHTML = link.innerHTML == s1 ? s2 : s1;
      toggle('browserTraceback', 'pastebinTraceback');
      return false;
    }
    //-->
  </script>
	<style type="text/css">
	#reporter_body { 
		padding: 8px;
		background: none repeat scroll 0 0 #FFFFCC
	}
	#reporter_body #traceback li { list-style-type: inherit; }
	#reporter_body #traceback { padding: 8px; margin-top: 10px; }
	#reporter_body td, #reporter_body th { border-bottom: 0; font:small sans-serif; line-height: auto; }
	#content { margin: 0; }
	</style>
	<style type="text/css">
	#meta { border-top: 0; }
	#meta th, #meta td { border: 0; padding: 8px; }
	#meta th { text-align: left; }
	.submit-row { display: none; }
	</style>
{% endblock %}

{% block content_title %}{% endblock %}

{% block content %}
	<table id="meta">
		<colgroup>
			<col style="width:15%"/>
			<col style="width:35%"/>
			<col style="width:15%"/>
			<col style="width:35%"/>
		</colgroup>
		<tfoot>
			<tr>
				<td colspan="4">
					{% if show_traceback %}
						{% if has_traceback %}
							<a href="?raw">&rsaquo; View plain traceback information</a>
						{% else %}
							<em>Enhanced traceback is not available for this message</em>
						{% endif %}
					{% else %}
						{% if has_traceback %}
							<a href="./">&rsaquo; View enhanced traceback information</a>
						{% else %}
							<em>Enhanced traceback is not available for this message</em>
						{% endif %}
					{% endif %}
				</td>
			</tr>
		</tfoot>
		<tbody>
			<tr>
				<th>URL:</th>
				<td>{% if instance.url %}<a href="{{ instance.full_url }}">{{ instance.full_url }}</a>{% else %}<em>Not available</em>{% endif %}</td>
				<th>Level:</th>
				<td><a href="../?level={{ instance.level }}">{{ instance.get_level_display }}</a> (<a href="../?logger={{ instance.logger }}">{{ instance.logger }}</a>, <a href="../?logger={{ instance.logger }}&amp;level={{ instance.level }}">{{ instance.logger }}:{{ instance.get_level_display }}</a>)</td>
			</tr>
			<tr>
				<th>Server:</th>
				<td><a href="../?server_name={{ instance.server_name }}">{{ instance.server_name }}</a></td>
				<th>Date:</th>
				<td>{{ instance.datetime }}</td>
			</tr>
		</tbody>
	</table>
	{% if tb_error %}
		<div style="padding:10px;border-top: 1px solid #ddd; background: #eee;">
			<p>An error occurred within DBLog while trying to render the enhanced traceback:</p>
			<br/>
			<pre>{{ tb_error }}</pre>
		</div>
	{% endif %}
	{% if show_traceback and has_traceback %}
		<div id="reporter_body">
			{{ error_body }}
		</div>
	{% else %}
		{{ block.super }}
	{% endif %}
{% endblock %}