admin based on bootstrap, thanks Paolo

This commit is contained in:
mdipierro
2012-12-24 13:49:06 -06:00
parent 9981ae4d5f
commit ebda5cb2bc
112 changed files with 6839 additions and 1371 deletions
+115 -133
View File
@@ -1,142 +1,124 @@
{{extend 'layout.html'}}
{{import os, stat, time}}
{{block sectionclass}}errors{{end}}
<style>
table.sortable {
border-spacing:0px;
}
table.sortable td, table.sortable th {
padding: 2px 5px 2px 5px;
}
table.sortable thead {
background-color:#eee;
color:#666666;
font-weight: bold;
cursor: default;
}
tr.error_ticket:hover {
background-color: #eee;
}
.controls a.button.unavailable {
color: #ff0000;
}
</style>
<script language="JavaScript">
function check(){
for (var i = 0; i < document.myform.elements.length; i++) {
var e = document.myform.elements[i];
if (e.type == 'checkbox') e.checked = true;
}
}
function uncheck(){
for (var i = 0; i < document.myform.elements.length; i++) {
var e = document.myform.elements[i];
if (e.type == 'checkbox') e.checked = false;
}
}
jQuery(document).ready(function() { jQuery('.traceback').hide(); });
</script>
<!-- begin "errors" block -->
{{if db_ready['status'] == False:
switchbutton = A(SPAN("switch to : db"), _href=db_ready['errlink'], _class="button unavailable", _title="%s" % (db_ready['errmessage']))
switchbutton = A(SPAN("switch to : db"), _href=db_ready['errlink'], _class="button unavailable btn btn-danger", _title="%s" % (db_ready['errmessage']))
else:
switchbutton = A(SPAN("switch to : db"), _href=URL(args=[app, 'dbnew']), _class="button")
switchbutton = A(SPAN("switch to : db"), _href=URL(args=[app, 'dbnew']), _class="button btn")
pass}}
<h2>{{=T('Error logs for "%(app)s"',dict(app=app))}}</h2>
<div class="errorform">
<form name="myform" method="post">
<input name="CheckAll" value="{{=T('check all')}}"
onclick="check()" type="button">
<input name="CheckAll" value="{{=T('uncheck all')}}"
onclick="uncheck()" type="button">
<input value="{{=T('delete all checked')}}" type="submit"><br><br>
{{ if 'new' in method: }}
{{base_url = 'db' in method and 'ticketdb' or 'ticket' }}
<h3>{{=T('Click row to expand traceback')}}</h3>
<p class="controls">
{{if 'db' in method:}}
source : db
<a class="button" href="{{=URL(args=[app, 'new'])}}"><span>switch to : filesystem</span></a>
<a class="button" href="{{=URL(args=[app, 'dbold'])}}"><span>lists by ticket</span></a>
{{else:}}
source : filesystem
{{=switchbutton}}
<a class="button" href="{{=URL(args=[app, 'old'])}}"><span>lists by ticket</span></a>
{{pass}}
</p>
<table id="trck_errors" class="sortable">
<thead>
<tr>
<th>{{=T("Delete")}}</th>
<th>{{=T("Count")}}</th>
<th>{{=T("File")}}</th>
<th>{{=T("Error")}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{for e in errors:}}
<tr class="error_ticket">
<td><input type="checkbox" name="delete_{{=e['hash']}}" /></td>
<td>{{=e['count']}}</td>
<td>{{=e['causer']}}</td>
<td>{{=A(e['last_line'],_href="#",_onclick="collapse('%s');"%e['hash'])}}</td>
<td>+</td>
<td>{{=A(T('details'),_href=URL(base_url,args=[app,e['ticket']]))}}</td>
</tr>
<tr id="{{=e['hash']}}" class="traceback">
<td colspan="6">
<div>
{{=CODE(e['pickel']['traceback'])}}
</div>
</td>
</tr>
{{pass}}
</tbody>
</table>
{{ else: }}
<h3>{{=T('Click row to view a ticket')}}</h3>
<p class="controls">
{{if 'db' in method:}}
source : db
<a class="button" href="{{=URL(args=[app, 'old'])}}"><span>switch to : filesystem</span></a>
<a class="button" href="{{=URL(args=[app, 'dbnew'])}}"><span>lists by exception</span></a>
{{else:}}
source : filesystem
{{=switchbutton}}
<a class="button" href="{{=URL(args=[app, 'new'])}}"><span>lists by exception</span></a>
{{pass}}
</p>
<table class="sortable">
<thead>
<tr>
<th>{{=T("Delete")}}</th>
<th>{{=T("Ticket")}}</th>
<th>{{=T("Date and Time")}}</th>
</tr>
</thead>
<tbody>
{{for ticket in tickets:}}
<tr>
<td><input type="checkbox" name="delete_{{=ticket}}"/></td>
{{if 'db' in method:}}
<td><a href="{{=URL('ticketdb',args=[app,ticket])}}">{{=ticket}}</a></td>
<td>{{=time.strftime('%Y-%m-%d %H:%M:%S',times[ticket].timetuple())}}</td>
{{else:}}
<td><a href="{{=URL('ticket',args=[app,ticket])}}">{{=ticket}}</a></td>
<td>{{=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(os.stat(os.path.join(request.folder,'../%s/errors/%s' % (app,ticket)))[stat.ST_CTIME]))}}</td>
{{pass}}
</tr>
{{pass}}
</tbody>
</table>
{{ pass }}
</form>
<form name="myform" method="post">
{{ if 'new' in method: }}
{{base_url = 'db' in method and 'ticketdb' or 'ticket' }}
<p class="controls row-fluid">
<div class="controls controls-row">
{{if 'db' in method:}}
<span class="uneditable-input">source : db</span>
<a class="button btn" href="{{=URL(args=[app, 'new'])}}"><span>switch to : filesystem</span></a>
<a class="button btn" href="{{=URL(args=[app, 'dbold'])}}"><span>lists by ticket</span></a>
{{else:}}
<span class="uneditable-input">source : filesystem</span>
{{=switchbutton}}
<a class="button btn" href="{{=URL(args=[app, 'old'])}}"><span>lists by ticket</span></a>
{{pass}}
</div>
</p>
<div class="tablebar">
<input value="{{=T('delete all checked')}}" type="submit" class="btn"/>
<span class="help label label-info">{{=T('Click row to expand traceback')}}</span>
</div>
<div class="row-fluid">
<div class="span6">
<table id="trck_errors" class="sortable table table-hover table-condensed">
<thead>
<tr>
<th class="column1 cbcentered"><input type="checkbox" name="delete_all}" /></th>
<th class="column2">{{=T("Count")}}</th>
<th class="column3">{{=T("File")}}</th>
<th>{{=T("Error")}}</th>
<th class="columnN"></th>
</tr>
</thead>
<tbody>
{{for e in errors:}}
<tr class="error_ticket">
<td class="cbcentered"><input type="checkbox" name="delete_{{=e['hash']}}" /></td>
<td>{{=e['count']}}</td>
<td>{{=e['causer']}}</td>
<td>{{=A(e['last_line'],_href="#",_onclick="collapse('%s');return false;"%e['hash'])}}</td>
<td>+&nbsp;{{=A(T('details'),_href=URL(base_url,args=[app,e['ticket']]))}}</td>
</tr>
<tr id="{{=e['hash']}}" class="traceback">
<td colspan="5">
<div class="ticket_code">
{{=CODE(e['pickel']['traceback'])}}
</div>
</td>
</tr>
{{pass}}
</tbody>
</table>
</div>
</div>
{{ else: }}
<p class="controls row-fluid">
<div class="controls controls-row">
{{if 'db' in method:}}
<span class="uneditable-input">source : db</span>
<a class="button btn" href="{{=URL(args=[app, 'old'])}}"><span>switch to : filesystem</span></a>
<a class="button btn" href="{{=URL(args=[app, 'dbnew'])}}"><span>lists by exception</span></a>
{{else:}}
<span class="uneditable-input">source : filesystem</span>
{{=switchbutton}}
<a class="button btn" href="{{=URL(args=[app, 'new'])}}"><span>lists by exception</span></a>
{{pass}}
</div>
</p>
<div class="tablebar">
<input value="{{=T('delete all checked')}}" type="submit" class="btn"/>
<span class="help label label-info">{{=T('Click row to expand traceback')}}</span>
</div>
<div class="row-fluid">
<div class="span6">
<table id="trck_errors" class="sortable table table-hover table-condensed">
<thead>
<tr>
<th class="column1 cbcentered"><input type="checkbox" name="delete_all}" /></th>
<th>{{=T("Ticket")}}</th>
<th class="columnN1">{{=T("Date and Time")}}</th>
</tr>
</thead>
<tbody>
{{for ticket in tickets:}}
<tr>
<td class="cbcentered"><input type="checkbox" name="delete_{{=ticket}}"/></td>
{{if 'db' in method:}}
<td><a href="{{=URL('ticketdb',args=[app,ticket])}}">{{=ticket}}</a></td>
<td>{{=time.strftime('%Y-%m-%d %H:%M:%S',times[ticket].timetuple())}}</td>
{{else:}}
<td><a href="{{=URL('ticket',args=[app,ticket])}}">{{=ticket}}</a></td>
<td>{{=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(os.stat(os.path.join(request.folder,'../%s/errors/%s' % (app,ticket)))[stat.ST_CTIME]))}}</td>
{{pass}}
</tr>
{{pass}}
</tbody>
</table>
</div>
</div>
{{ pass }}
</form><!-- /errorform -->
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.traceback').hide();
jQuery("#trck_errors thead tr th:first input[type=checkbox]").click(function() {
var checkedStatus = this.checked;
jQuery("#trck_errors tbody tr td:first-child input[type=checkbox]").each(function() {
this.checked = checkedStatus;
});
});
});
</script>
<!-- end "errors" block -->