Added debug_toolbar app to project.
[wolnelektury.git] / apps / debug_toolbar / templates / debug_toolbar / base.html
1 <script type="text/javascript">
2 var djDebugLastObj = null;
3 function djDebugToggle(tag) {
4     if (djDebugLastObj) {
5         djDebugLastObj.className = '';
6         document.getElementById(djDebugLastObj.getAttribute('rel')).style.display = 'none';
7     }
8     djDebugWindowClose();
9     var obj = document.getElementById(tag.getAttribute('rel'));
10     if (!obj) return;
11     if (djDebugLastObj == tag) {
12         djDebugLastObj = null;
13         return;
14     }
15     if (obj.style.display != 'block') {
16         obj.style.display = 'block';
17         tag.className = 'active';
18         djDebugLastObj = tag;
19     }
20 }
21 function djDebugClose() {
22     if (!djDebugLastObj) return;
23     djDebugLastObj.className = '';
24     document.getElementById(djDebugLastObj.getAttribute('rel')).style.display = 'none';
25     djDebugLastObj = null;
26 }
27 function djDebugWindowHtml(text) {
28     var obj = document.getElementById('djDebugWindow');
29     var frame = obj.getElementsByTagName('div')[1];
30     frame.innerHTML = text;
31 }
32 function djDebugWindow(url) {
33     var obj = document.getElementById('djDebugWindow');
34     djDebugWindowHtml('Loading request...');
35     djDebugHttp.open('get', url, true);
36
37     djDebugHttp.onreadystatechange = function() {
38       if (djDebugHttp.readyState == 4) {
39         // XXX: why does status return 0?
40         if (djDebugHttp.status == 200 || djDebugHttp.status == 0) {
41           djDebugWindowHtml(djDebugHttp.responseText);
42         }
43         else {
44           djDebugWindowHtml('There was an error loading the document.');
45         }
46       }
47     }
48     djDebugHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
49     try {
50       djDebugHttp.send(null);
51     }
52     catch (ex) {
53       djDebugWindowHtml('There was an error loading the document.');
54     }
55     obj.style.display = 'block';
56 }
57 function djDebugCreateXMLHttpRequest() {
58   var http;
59   if (window.XMLHttpRequest) { // Mozilla, Safari,...
60     http = new XMLHttpRequest();
61     if (http.overrideMimeType) {
62       // set type accordingly to anticipated content type
63       http.overrideMimeType('text/html');
64     }
65   }
66   else if (window.ActiveXObject) { // IE
67     try {
68       http = new ActiveXObject("Msxml2.XMLHTTP");
69     } catch (e) {
70       try {
71         http = new ActiveXObject("Microsoft.XMLHTTP");
72       } catch (e) {}
73     }
74   }
75   if (!http) {
76     alert('Cannot create XMLHTTP instance');
77     return false;
78   }
79   return http;
80 }
81 var djDebugHttp = djDebugCreateXMLHttpRequest();
82 function djDebugWindowClose() {
83     var obj = document.getElementById('djDebugWindow');
84     obj.style.display = 'none';
85 }
86 function djDebugCloseAll() {
87     djDebugClose();
88     djDebugWindowClose();
89 }
90 function djDebugHide() {
91     var obj = document.getElementById('djDebug');
92     obj.style.display = 'none';
93 }
94 </script>
95 <style type="text/css">
96 #djDebug * { font: normal 12px Arial, sans-serif; margin: 0; padding: 0; float: none; position: static; border: 0;  }
97 #djDebugToolbar {
98         height:22px;
99         background:#244035;
100         color:#90EF45;
101         text-transform:lowercase;
102         margin: 5px 0;
103         z-index:100000000;
104         border-top:1px solid #345447;
105         border-bottom:1px solid #10211a;
106 }
107 #djDebugToolbar ul { margin: 0; padding: 0 10px; }
108 #djDebugToolbar li { display: inline; height: 22px; float: left; }
109 #djDebugToolbar li span,
110 #djDebugToolbar li a { color: #FFE761; text-decoration: none; display: inline; width: auto; position: relative; float: none; margin: 0; height: 12px; line-height: 22px; padding: 4px 10px; border-left: 1px solid #345447; border-right: 1px solid #10211a; padding-right: 10px; }
111 #djDebugToolbar li a:hover, #djDebugToolbar li.active a { color: #fff; background-color: #2e4d41; }
112 #djDebugToolbar #djDebugButton span { border-left: 0; color: #fff; font-weight: bold; }
113 #djDebugToolbar #djDebugHide { float: right; }
114 #djDebugToolbar #djDebugHide a { border: 0; font-size: 93%; }
115 #djDebug .panelContent {
116         display:none;
117         position:absolute;
118         margin:0;
119         padding:10px;
120         top:43px;
121         width:auto;
122         left:10px;
123         right:10px;
124         bottom:10px;
125         background:#244035;
126         color:#fff;
127         z-index:1000000;
128         overflow:auto;
129         border:1px solid #345447;
130 }
131 #djDebug .panelContent * { color: #fff; }
132 #djDebug .panelContent a:hover { color: #FFE761; }
133 #djDebug .panelContent table { width: 100%; }
134 #djDebug .panelContent p { padding: 5px; }
135 #djDebug .panelContent p, #djDebug .panelContent table,
136 #djDebug .panelContent ul, #djDebug .panelContent dl,
137 #djDebug .panelContent .title { margin: 5px 0; }
138 #djDebug .panelContent dt, #djDebug .panelContent dd { display: block; }
139 #djDebug .panelContent dt { font-weight: bold; width: 100px; clear: left; float: left; }
140 #djDebug .panelContent dd { margin-left: 20px; margin-bottom: 5px; margin-left: 100px; }
141 #djDebug .panelContent th, #djDebug td { padding: 5px; }
142 #djDebug .panelContent td { background:#244035; }
143 #djDebug .panelContent th { font-weight: bold; text-align: left; background: transparent; color: #fff; }
144 #djDebug .panelContent thead th { border-bottom: 1px solid #2e4d41; color: #FFE761; }
145 #djDebug .panelContent .row2 td { background:#2e4d41; }
146 #djDebugWindow { z-index: 20000000; }
147 #djDebug .panelContent .title { font-weight: bold; font-size: 15px; color: #90EF45; }
148 #djDebug .panelContent .title a { float: right; font-weight: bold; font-size: 10px; }
149 #djDebug .panelContent .title .close { float: right; font-weight: bold; margin-left: 15px; }
150 </style>
151
152 <div id="djDebug">
153         <div id="djDebugToolbar">
154                 <ul id="djDebugPanelList">
155                         <li id="djDebugButton"><span>Django Debug</span></li>
156                         {% for panel in panels %}
157                                 <li rel="{{ panel.dom_id }}">
158                                         {% if panel.content %}
159                                                 <a href="{{ panel.url|default:"#" }}" onclick="djDebugToggle(this.parentNode)" title="{{ panel.title }}" class="{{ panel.dom_id }}">{{ panel.title }}</a>
160                                         {% else %}
161                                                 <span>{{ panel.title }}</span>
162                                         {% endif %}
163                                 </li>
164                         {% endfor %}
165                         <li id="djDebugHide"><a href="javascript:djDebugHide();">Hide Debug Toolbar</a></li>
166                 </ul>
167         </div>
168         {% for panel in panels %}
169                 {% with panel.content as content %}
170                         {% if content %}
171                                 <div id="{{ panel.dom_id }}" class="panelContent">
172                                         <div class="title">
173                                                 <a href="javascript:djDebugCloseAll()" class="close">Close</a>
174                                         <!-- <h1>{{ panel.title }}</h1> -->
175                                         </div>
176                                         <div class="content">
177                                             {{ content|safe }}
178                                         </div>
179                                 </div>
180                         {% endif %}
181                 {% endwith %}
182         {% endfor %}
183         <div id="djDebugWindow" class="panelContent">
184             <div class="title">
185                         <a href="javascript:djDebugCloseAll()" class="close">Close</a>
186                 <a href="javascript:djDebugWindowClose();" class="close">Back</a>
187             </div>
188             <div class="content">
189         </div>
190     </div>
191 </div>