Files
LazyLibrarian/data/interfaces/default/author.html
2014-05-15 16:33:21 +10:00

215 lines
9.1 KiB
HTML
Executable File

<%inherit file="base.html"/>
<%!
from lazylibrarian import database
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="refreshAuthor?AuthorName=${author['AuthorName']}" id="button"> Refresh Author </a></li>
<li><a href="deleteAuthor?AuthorID=${author['AuthorID']}" id="button"> Delete Author </a></li>
%if author['Status'] == 'Paused':
<li><a href="resumeAuthor?AuthorID=${author['AuthorID']}" id="button"> Resume Author</a></li>
%else:
<li><a href="pauseAuthor?AuthorID=${author['AuthorID']}" id="button"> Pause Author</a></li>
%endif
<li><a href="authorPage?AuthorName=${author['AuthorName']}&Ignored=True" id="button"> Ignored Books </a></li>
%if len(languages) >= 1:
<li>Language:&nbsp</li>
<li><select onchange="window.location = 'authorPage?AuthorName=${author['AuthorName']}&BookLang=' + this.options[this.selectedIndex].value">
<option>Select</option>
%for language in languages:
<option value="${language['BookLang']}">${language['BookLang']}</option>
%endfor
</select></li>
%endif
</ul>
</div>
</%def>
<%def name="body()">
<br>
<div id="authorart_container">
<ul id="authorart_menu">
<li><img src="${author['AuthorImg']}" height="100"></li>
</ul>
</div>
<div id="authorhead_container">
<ul id="authorhead_menu">
<li><a href="${author['AuthorLink']}" target="_new">${author['AuthorName']}</a></li></br>
%if author['AuthorDeath']:
<li>${author['AuthorBorn']} - ${author['AuthorDeath']}</li><br>
%else:
<li>${author['AuthorBorn']}</li><br>
%endif
%if author['Status'] == 'Loading':
<li>(Fetching information for this author ...)</li><br>
%endif
<li>Totalbooks: ${author['TotalBooks']}</li><br><br>
<%
totalbooks = author['UnignoredBooks']
havebooks = author['HaveBooks']
if not havebooks:
havebooks = 0
try:
percent = (havebooks*100.0)/totalbooks
if percent > 100:
percent = 100
if percent <= 100:
css = "<div class=\"progress-container success\" style=\"width:150px;\">"
if percent <= 75:
css = "<div class=\"progress-container info\" style=\"width:150px;\">"
if percent <= 50:
css = "<div class=\"progress-container warning\" style=\"width:150px;\">"
if percent <= 25:
css = "<div class=\"progress-container danger\" style=\"width:150px;\">"
except (ZeroDivisionError, TypeError):
percent = 0
totalbooks = '?'
css = "<div class=\"progress-container danger\" style=\"width:150px;\">"
%>
<span title="${percent}"></span>${css}
<div style="width:${percent}%"><span class="progressbar-front-text">${havebooks}/${totalbooks}</span></div></div>
</div>
<!-- <table class="display">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>-->
<p class="indented">
<form action="markBooks" method="get"><input type="hidden" name="AuthorName" value="${author['AuthorName']}">
<input type="hidden" name="redirect" value="author">
<select class="markBooks" name="action" style="margin-left:30px;margin-top:15px;margin-bottom:15px;">
<option value="Wanted">Wanted</option>
<option value="Have">Have</option>
<option value="Skipped">Skipped</option>
<option value="Ignored">Ignored</option>
</select>
<input type="submit" class="markBooks" value="Go">
</p>
<!-- </th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- </table>-->
<table class="display" id="book_table">
<thead>
<tr>
<th id="select"><input type="checkbox" onClick="toggleAll(this)" /></th>
<th id="bookart">Cover</th>
<th id="bookname">Title</th>
<th id="series">Series</th>
<th id="seriesOrder">Num.</th>
<th id="stars">Rating</th>
<th id="date">Released</th>
<th id="language">Language</th>
<th id="status">Status</th>
</tr>
</thead>
<tbody>
%for result in books:
<%
if result['bookrate'] < 0.5:
starimg = '0-stars.png'
elif result['bookrate'] >= 0.5 and result['bookrate'] < 1.5:
starimg = '1-stars.png'
elif result['bookrate'] >= 1.5 and result['bookrate'] < 2.5:
starimg = '2-stars.png'
elif result['bookrate'] >= 2.5 and result['bookrate'] < 3.5:
starimg = '3-stars.png'
elif result['bookrate'] >= 3.5 and result['bookrate'] < 4.5:
starimg = '4-stars.png'
elif result['bookrate'] >= 4.5:
starimg = '5-stars.png'
else:
starimg = '0-stars.png'
%>
<tr class="gradeZ">
<td id="select"><input type="checkbox" name="${result['BookID']}" class="checkbox" /></td>
<td id="bookart"><a href="${result['bookimg']}" target="_new"><img src="${result['bookimg']}" height="75" width="50"></a></td>
%if result['booksub']:
<td id="bookname"><a href="${result['booklink']}" target="_new">${result['bookname']}</a><br>
<i class="smalltext">${result['booksub']}</i></td>
%else:
<td id="bookname"><a href="${result['booklink']}" target="_new">${result['bookname']}</a></td>
%endif
<td id="series">${result['Series']}</td>
<td id="seriesOrder">${result['SeriesOrder']}</td>
<td id="stars"><img src="images/${starimg}" width="50" height="10"></td>
<td id="date">${result['BookDate']}</td>
<td id="language">${result['booklang']}</td>
%if result['Status'] == 'Open':
<td id="status"><a class="button green" href="openBook?bookid=${result['bookID']}" target="_self">${result['Status']}</a></td>
%else:
%if result['Status'] == 'Wanted':
<td id="status"><a class="button red" href="searchForBook?bookid=${result['bookID']}" target="_self"><span class="a">${result['Status']}</span><span class="b">Search</span></a></td>
%else:
%if result['Status'] == 'Snatched':
<td id="status"><a class="button">${result['Status']}</a></td>
%else:
<td id="status"><a class="button grey">${result['Status']}</a></td>
%endif
%endif
%endif
</tr>
%endfor
</tbody>
</table>
<br /><br /><br />
</form>
</%def>
<%def name="headIncludes()">
<link rel="stylesheet" href="css/data_table.css">
%if author['Status'] == 'Loading':
<meta http-equiv="refresh" content="12">
<script>
$(document).ready(function () {
showMsg("Getting Author's Books", true);
});
</script>
%endif
</%def>
<%def name="javascriptIncludes()">
<script src="js/libs/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function()
{
$('#book_table').dataTable(
{
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"oLanguage": {
"sLengthMenu":"Show _MENU_ books per page",
"sEmptyTable": "No books found",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ results",
"sInfoEmpty":"Showing 0 to 0 of 0 books",
"sInfoFiltered":"(filtered from _MAX_ total books)"},
"sPaginationType": "full_numbers",
"bStateSave": true,
"aLengthMenu": [[5, 10, 15, 25, 50, 100, -1], [5, 10, 15, 25, 50, 100, "All"]],
"iDisplayLength": 10,
});
$('.dataTables_filter input').attr("placeholder", "Seach table here");
});
</script>
</%def>