Files
LazyLibrarian/data/interfaces/bookstrap/issues.html
2018-09-20 09:16:35 +02:00

158 lines
7.1 KiB
HTML

<%inherit file="base.html" />
<%!
import lazylibrarian
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<div id="subhead_menu">
%if perm&lazylibrarian.perm_force:
<a href="forceSearch?source=magazines&title=${title | u}" class="button btn btn-sm btn-primary"><i class="fa fa-search"></i> Search</a>
<a href="forceProcess?source=magazines" class="button btn btn-sm btn-primary"><i class="fa fa-cogs"></i> Run Post-Processor</a>
<a href="magazineScan?title=${title | u}"" class="button btn btn-sm btn-primary"><i class="fa fa-bolt"></i> Library Scan</a>
<a href="pastIssues?mag=${title | u}" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-alt"></i> Past Issues</a>
%endif
<a href="magWall?title=${title | u}" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-check"></i> Recent Issues</a>
</div>
</div>
</%def>
<%def name="body()">
<h1>${title}</h1>
%if lazylibrarian.MAG_UPDATE == True:
<p>
<button onclick="" id="myAlert" title=""><i class="fa fa-circle-notch fa-spin"></i> Libraryscan in progress ...</button>
</p>
%endif
<form name="markIssues" id="markIssues" action="markIssues" method="get" class="form-inline" onsubmit="return false;">
<div class="form-group">
<label for="action" class="control-label">Selected issues:</label>
<select name="action" id="action" class="form-control input-sm">
<option value="Remove" selected>Remove</option>
<option value="Delete">Delete</option>
<option value="reCover1">Cover Page 1</option>
<option value="reCover2">Cover Page 2</option>
</select>
<button type="submit" class=" btn btn-m btn-primary" onclick="validateForm()">Go</button>
%if lazylibrarian.CONFIG['TOGGLES'] == True:
&nbsp;&nbsp;Toggle: <a class="toggle-vis" data-column="1">Cover</a> - <a class="toggle-vis" data-column="2">Issue</a> - <a class="toggle-vis" data-column="3">Added</a> - <a class="toggle-vis" data-column="4">Select</a>
%endif
</div>
<p>&nbsp;</p>
<div class="table-responsive">
<table class="table table-striped table-hover table-bordered" id="book_table">
<thead>
<tr>
%if perm&lazylibrarian.perm_status:
<th class="select text-center no-sort"><input type="checkbox" onClick="toggleAll(this)" /></th>
%else:
<th class="hidden"></th>
%endif
% if covercount > 0:
<th class="bookart text-center no-sort" width=20%>Cover</th>
% else:
<th class="bookart hidden">Cover</th>
% endif
<th class="issuedate text-center">Issue</th>
<th class="lastacquired text-center">Added</th>
<th class="issue text-center">Select</th>
</tr>
</thead>
</table>
</div>
</form>
</%def>
<%def name="headIncludes()">
%if lazylibrarian.MAG_UPDATE == True:
<meta http-equiv="refresh" content="10">
%endif
</%def>
<%def name="javascriptIncludes()">
<script type="text/javascript">
$(document).ready(function()
{
var show = ""+${lazylibrarian.CONFIG['MAG_IMG']};
if ( show != '1' ) { showimg = false }
else { showimg = true }
var table = $('#book_table').DataTable(
{
"bAutoWidth": false,
"stateSave": true,
"order": [[ 2, 'desc']],
"columnDefs": [{ targets: 'no-sort', orderable: false },
{ targets: [0],
'class': 'text-center',
'render': function(data, type, row) {
return '<input type="checkbox" name="' + row[4] + '" class="checkbox" />';} },
{ targets: [1],
'class': 'text-center',
'visible': showimg,
'render': function(data, type, row) {
return '<a href="' + data + '" target="_blank" rel="noreferrer"><img src="' + data + '" alt="Cover" class="bookcover-sm img-responsive"></a>';} },
{ targets: [2, 3],
'class': 'text-center'},
{ targets: [4],
'class': 'text-center',
'render': function(data, type, row) {
btn = '<a class="button green btn btn-xs btn-warning" href="openMag?bookid=' + data +
'" target="_self"><i class="fa fa-book"></i> Open</a>'
return btn;} },
],
"oLanguage": {
"sSearch": "Filter: ",
"sLengthMenu":"Show _MENU_ issues per page",
"sEmptyTable": "No issues found",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ results",
"sInfoEmpty":"Showing 0 to 0 of 0 issues",
"sInfoFiltered":"(filtered from _MAX_ total issues)"},
"sPaginationType": "full_numbers",
"aaSorting": [[2, 'desc']],
"bServerSide": true,
"sAjaxSource": 'getIssues?title=${title | u}',
"aLengthMenu": [[5, 10, 15, 25, 50, 100, -1], [5, 10, 15, 25, 50, 100, "All"]],
"iDisplayLength": ${lazylibrarian.CONFIG['DISPLAYLENGTH']},
"bFilter": true,
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
%if perm&lazylibrarian.perm_status == 0:
$('td', nRow).eq(0).addClass("hidden");
%endif
return nRow;
},
});
$('.dataTables_filter input').attr("placeholder", "Results filter");
$('a.toggle-vis').click(function (e) {
e.preventDefault();
var column = table.column( $(this).attr('data-column') );
column.visible( ! column.visible() );
} );
});
function validateForm() {
var x = document.forms["markIssues"]["action"].value;
var c = (document.querySelectorAll('input[class="checkbox"]:checked').length);
if (c > 0 && x == "Delete") {
if (c == 1) {msg = "Are you sure you want to permanently delete the selected issue?"}
if (c > 1) {msg = "Are you sure you want to permanently delete the " + c + " selected issues?"}
bootbox.confirm({
message: msg,
buttons: {
confirm: {
label: 'Yes',
className: 'btn-success'
},
cancel: {
label: 'No',
className: 'btn-danger'
}
},
callback: function (result) {
if (result) { document.getElementById("markIssues").submit(); }
}
});
return false;
}
else { document.getElementById("markIssues").submit(); }
}
</script>
</%def>