1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-24 16:51:42 +00:00
mylar/data/interfaces/default/importresults.html

275 lines
15 KiB
HTML
Executable file

<%inherit file="base.html" />
<%!
import mylar
from mylar import db
from mylar.helpers import checked
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<div id="subhead_menu">
<a id="menu_link_refresh" onclick="doAjaxCall('flushImports', $(this),'table')" data-success="Import Results Flushed">Flush all Imports</a>
<a id="menu_link_refresh" onclick="doAjaxCall('markImports?action=massimport', $(this),'table')" data-success="Successfully started Mass Import of Non-Imported items.">Mass Import</a>
</div>
</div>
</%def>
<%def name="body()">
<div id="paddingheader">
<h1 class="clearfix">Ultron Import Results</h1>
</div>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Import Results</a></li>
</ul>
<div id="tabs-1" class="configtable">
<table>
<tr>
<span style="position:right">
<img src="interfaces/default/images/ultron.png" style="float:right" height="125" width="125" />
<fieldset>
<div class="row checkbox">
<input type="checkbox" name="autoadd" style="vertical-align: middle; margin: 3px; margin-top: -1px;" id="autoadd" value="1" ${checked(mylar.CONFIG.ADD_COMICS)}><label>Auto-add new series</label>
</div>
<div class="row checkbox">
<input type="checkbox" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="imp_move" id="imp_move" value="1" ${checked(mylar.CONFIG.IMP_MOVE)}><label>Move files</label>
</div>
%if mylar.CONFIG.RENAME_FILES:
<div class="row checkbox">
<input type="checkbox" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="imp_rename" id="imp_rename" value="1" ${checked(mylar.CONFIG.IMP_RENAME)}><label>Rename Files </label>
<small>(After importing, Rename the files to configuration settings)</small>
<label>${mylar.CONFIG.FOLDER_FORMAT}/${mylar.CONFIG.FILE_FORMAT}</label>
</div>
%endif
<div class="row checkbox">
<input type="checkbox" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="imp_metadata" id="imp_metadata" value="1" ${checked(mylar.CONFIG.IMP_METADATA)}><label>Use Existing Metadata</label>
<small>(Use existing Metadata to better locate series for import)</small>
</div>
%if mylar.IMPORTLOCK:
<div class="row checkbox">
<input type="checkbox" onclick="<%mylar.IMPORTLOCK = False%>" style="vertical-align: middle; margin: 3px; margin-top: -1px;"><label>Existing Import running. Force next run?</label>
</div>
%endif
</fieldset>
</span>
</tr>
</table>
</div>
</div>
<div class="table_wrapper">
<form action="markImports" method="get" id="markImports">
<div id="markcomic">
<select name="action" onChange="doAjaxCall('markImports',$(this),'table',true);" data-error="You didn't select any comics">
<option disabled="disabled" selected="selected">Choose...</option>
<option value="importselected">Start Import</option>
<option value="removeimport">Remove</option>
</select>
<input type="hidden" value="Go">
</div>
<table class="display" id="impresults_table">
<tr/><tr/>
<tr><center><h3>To be Imported</h3></center></tr>
<thead>
<tr>
<th id="select" align="left"><input type="checkbox" onClick="toggle(this)" name="results" class="checkbox" /></th>
<th id="comicname">Comic Name</th>
<th id="comicyear">Year</th>
<th id="issues">Issues</th>
<th id="status">Status</th>
<th id="importdate">Import Date</th>
<th id="addcomic">Options</th>
</tr>
</thead>
<tbody>
%if results:
%for result in results:
<%
if result['Status'] == 'Imported':
grade = 'X'
elif result['Status'] == 'Manual Intervention':
grade = 'C'
else:
grade = 'Z'
if result['DisplayName'] is None:
displayname = result['ComicName']
else:
displayname = result['DisplayName']
displayline = displayname
if result['AnnualCount'] > 0:
displayline += '(+' + str(result['AnnualCount']) + ' Annuals)'
if all([result['Volume'] is not None, result['Volume'] != 'None']):
displayline += ' (' + str(result['Volume']) + ')'
%>
<tr class="${result['Status']} grade${grade}">
<td id="select"><input type="checkbox" style="vertical-align: middle; margin: 3px; margin-top: -1px;" name="${result['ComicName']}[${result['Volume']}]" value="${result['DynamicName']}" class="checkbox" />
<td id="comicname">${displayline}
%if result['Status'] != 'Imported':
<a href="#issue-box" onclick="return runMetaIssue('${result['ComicName'] |u}','${result['DynamicName']}','${result['Volume']}');" class="issue-window"><img src="interfaces/default/images/files.png" height="15 width="15" title="View files in this group" class="highqual" /></a>
<div id="issue-box" class="issue-popup">
<a href="#" class="close"><img src="interfaces/default/images/close_pop.png" class="btn_close" title="Close Window" alt="Close" class="highqual" /></a>
<div id="responsethis">
<label><strong>[ NODATA ]</strong></label></br>
</div>
</div>
%endif
%if result['ComicID'] is not None:
[${result['ComicID']}]
%endif
</td>
<td id="comicyear"><title="${result['ComicYear']}">${result['ComicYear']}</td>
<td id="comicissues"><title="${result['IssueCount']}">${result['IssueCount']}</td>
<td id="status">
%if result['ComicID'] and result['Status'] == 'Imported':
<a href="comicDetails?ComicID=${result['ComicID']}">${result['Status']}</a>
%else:
${result['Status']}
%endif
%if result['WatchMatch'] is not None:
<img src="interfaces/default/images/green-circle.png" height="10" width="10"/>
%endif
</td>
<td id="importdate">${result['ImportDate']}</td>
<td id="addcomic">
%if result['Status'] == 'Not Imported' and result['SRID'] is None:
[<a href="#" title="Import ${result['ComicName']} into your watchlist" onclick="doAjaxCall('preSearchit?ComicName=${result['ComicName']| u}&displaycomic=${displayname| u}&comicid=${result['ComicID']}&volume=${result['Volume']}&dynamicname=${result['DynamicName']}&displayline=${displayline| u}',$(this),'table')" data-success="Imported ${result['ComicName']}">Import</a>]
%endif
[<a href="deleteimport?ComicName=${result['ComicName']| u}&volume=${result['Volume']}&DynamicName=${result['DynamicName']}&Status=${result['Status']}">Remove</a>]
%if result['SRID'] is not None and result['Status'] != 'Imported':
[<a title="Manual intervention is required - more than one result when attempting to import" href="importresults_popup?SRID=${result['SRID']}&ComicName=${result['ComicName'] |u}&imported=yes&ogcname=${result['ComicName'] |u}&DynamicName=${result['DynamicName']}&Volume=${result['Volume']}">Select</a>]
%endif
</td>
</tr>
%endfor
%else:
<tr>
<td colspan="6">
<center><legend>There are no results to display</legend></center>
</td>
</tr>
%endif
</tbody>
</table>
</form>
</div>
</%def>
<%def name="headIncludes()">
<link rel="stylesheet" href="interfaces/default/css/data_table.css">
</%def>
<%def name="javascriptIncludes()">
<script src="js/libs/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('a.issue-window').click(function() {
//Getting the variable's value from a link
var issueBox = $(this).attr('href');
//Fade in the Popup
$(issueBox).fadeIn(300);
//Set the center alignment padding + border see css style
var popMargTop = ($(issueBox).height() + 24) / 2;
var popMargLeft = ($(issueBox).width() + 24) / 2;
$(issueBox).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
// Add the mask to body
$('body').append('<div id="mask"></div>');
$('#mask').fadeIn(300);
return false;
});
// When clicking on the button close or the mask layer the popup closed
$('a.close, #mask').on('click', function() {
$('#mask , .issue-popup').fadeOut(300 , function() {
$('#mask').remove();
});
return false;
});
});
</script>
<script>
function runMetaIssue(comicname, dynamicname, volume) {
//alert(comicname);
$.ajax({
type: "GET",
url: "ImportFilelisting",
data: { comicname: comicname, dynamicname: dynamicname, volume: volume },
success: function(response) {
//alert(response)
var names = response
$('#responsethis').html(response);
},
error: function(data)
{
alert('ERROR'+data.responseText);
},
});
}
</script>
<script>
$('.showlog').click(function (event) {
var width = 575,
height = 400,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
url = this.href,
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
window.open(url, 'twitte', opts);
return false;
});
</script>
<script>
function initThisPage() {
jQuery( "#tabs" ).tabs();
initActions();
$('#impresults_table').dataTable(
{
"bDestroy": true,
//"aoColumnDefs": [
// { 'bSortable': false, 'aTargets': [ 0 , 2 ] },
// { 'bVisible': false, 'aTargets': [2] },
// { 'sType': 'numeric', 'aTargets': [2] },
// { 'iDataSort': [2], 'aTargets': [3] }
//],
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, 'All' ]],
"oLanguage": {
"sLengthMenu":"Show _MENU_ results per page",
"sEmptyTable": "No results",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ results",
"sInfoEmpty":"Showing 0 to 0 of 0 results",
"sInfoFiltered":"(filtered from _MAX_ total results)",
"sSearch" : ""},
"bStateSave": true,
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"aaSorting": [2, 'desc']
});
resetFilters("result");
}
$(document).ready(function(){
initThisPage();
});
$(window).load(function(){
initFancybox();
});
</script>
</%def>