Merge pull request #218 from Supremicus/feature/EpisodeStatusChanges

Episode Status Management tweaks
This commit is contained in:
adam111316 2015-02-28 12:09:02 +08:00
commit 81de63c0f5
4 changed files with 111 additions and 97 deletions

View file

@ -14,6 +14,9 @@
* Fix updating of pull requests
* Add hidden cache debug page
* Change autoProcessTV scripts python code quotes from " -> '
* Add expand all button to Episode Status Management
* Add Unknown status query to Episode Status Management
* Fix Episode Status Management error popup from coming up when show is selected without expanding
[develop changelog]
* Fix traceback error when using the menu item Manage/Update Kodi

View file

@ -6197,4 +6197,3 @@ button.close {
display: none !important;
}
}
/*# sourceMappingURL=bootstrap.css.map */

View file

@ -1,16 +1,15 @@
#import sickbeard
#import datetime
#from sickbeard import common
#set global $title="Episode Overview"
#set global $header="Episode Overview"
#set global $sbPath=".."
#set global $title = 'Episode Overview'
#set global $header = 'Episode Overview'
#set global $sbPath = '..'
#set global $topmenu = 'manage'
#set global $topmenu="manage"#
#import os.path
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_top.tmpl")
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
<div id="content960">
#if $varExists('header')
<h1 class="header">$header</h1>
#else
@ -20,17 +19,16 @@
#if not $whichStatus or ($whichStatus and not $ep_counts):
#if $whichStatus:
<h2>None of your episodes have status $common.statusStrings[$int($whichStatus)]</h2>
<br />
<h3>None of your episodes have status <span class="grey-text">$common.statusStrings[$int($whichStatus)]</span></h3>
#end if
<form action="$sbRoot/manage/episodeStatuses" method="get">
Manage episodes with status <select name="whichStatus" class="form-control form-control-inline input-sm">
#for $curStatus in [$common.SKIPPED, $common.SNATCHED, $common.WANTED, $common.ARCHIVED, $common.IGNORED]:
<option value="$curStatus">$common.statusStrings[$curStatus]</option>
Manage episodes with status <select name="whichStatus" class="form-control form-control-inline input-sm">
#for $curStatus in [$common.SKIPPED, $common.UNKNOWN, $common.SNATCHED, $common.WANTED, $common.ARCHIVED, $common.IGNORED]:
<option value="$curStatus">$common.statusStrings[$curStatus]</option>
#end for
</select>
<input class="btn btn-inline" type="submit" value="Manage" />
</select>
<input class="btn btn-inline" type="submit" value="Manage" />
</form>
#else
@ -40,50 +38,49 @@ Manage episodes with status <select name="whichStatus" class="form-control form-
<form action="$sbRoot/manage/changeEpisodeStatuses" method="post">
<input type="hidden" id="oldStatus" name="oldStatus" value="$whichStatus" />
<h2><span class="grey-text">Shows containing</span> $common.statusStrings[$int($whichStatus)] <span class="grey-text">episodes</span></h2>
<br />
<h3>${len($sorted_show_ids)} Shows containing <span class="grey-text">$common.statusStrings[$int($whichStatus)]</span> episodes</h3>
#if $whichStatus in ($common.ARCHIVED, $common.IGNORED, $common.SNATCHED):
#set $row_class = "good"
#set $row_class = 'good'
#else
#set $row_class = $common.Overview.overviewStrings[$whichStatus]
#set $row_class = $common.Overview.overviewStrings[$whichStatus]
#end if
<input type="hidden" id="row_class" value="$row_class" />
Set checked shows/episodes to <select name="newStatus" class="form-control form-control-inline input-sm">
<div class="form-group">
Set checked shows/episodes to <select name="newStatus" class="form-control form-control-inline input-sm">
#set $statusList = [$common.SKIPPED, $common.WANTED, $common.ARCHIVED, $common.IGNORED]
#if $int($whichStatus) in $statusList
$statusList.remove($int($whichStatus))
$statusList.remove($int($whichStatus))
#end if
#if $int($whichStatus) in [$common.SNATCHED, $common.SNATCHED_PROPER]
$statusList.append($common.FAILED)
$statusList.append($common.FAILED)
#end if
#for $curStatus in $statusList:
<option value="$curStatus">$common.statusStrings[$curStatus]</option>
<option value="$curStatus">$common.statusStrings[$curStatus]</option>
#end for
</select>
<input class="btn btn-inline go" type="submit" value="Go" />
<div>
<button type="button" class="btn btn-xs selectAllShows">Select all</a></button>
<button type="button" class="btn btn-xs unselectAllShows">Clear all</a></button>
</select>
<input class="btn btn-inline go" type="submit" value="Go" />
</div>
<div class="form-group">
<input type="button" class="btn btn-xs selectAllShows" value="Select all">
<input type="button" class="btn btn-xs unselectAllShows" value="Clear all">
<input type="button" class="btn btn-xs expandAll" value="Expand All Shows">
</div>
<br />
<table class="sickbeardTable manageTable" cellspacing="1" border="0" cellpadding="0">
#for $cur_indexer_id in $sorted_show_ids:
<tr id="$cur_indexer_id">
<th><input type="checkbox" class="allCheck" id="allCheck-$cur_indexer_id" name="$cur_indexer_id-all" /></th>
<th colspan="2" style="width: 100%; text-align: left;"><a class="whitelink" href="$sbRoot/home/displayShow?show=$cur_indexer_id">$show_names[$cur_indexer_id]</a> ($ep_counts[$cur_indexer_id]) <input type="button" class="pull-right get_more_eps btn" id="$cur_indexer_id" value="Expand" /></th>
</tr>
<tr id="$cur_indexer_id">
<th><input type="checkbox" class="allCheck" id="allCheck-$cur_indexer_id" name="$cur_indexer_id-all" /></th>
<th colspan="2" style="width: 100%; text-align: left;"><a class="whitelink" href="$sbRoot/home/displayShow?show=$cur_indexer_id">$show_names[$cur_indexer_id]</a> ($ep_counts[$cur_indexer_id]) <input type="button" class="pull-right get_more_eps btn" id="$cur_indexer_id" value="Expand" /></th>
</tr>
#end for
</table>
</form>
#end if
</div>
#include $os.path.join($sickbeard.PROG_DIR,"gui/slick/interfaces/default/inc_bottom.tmpl")
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')

View file

@ -1,73 +1,88 @@
$(document).ready(function() {
function make_row(indexer_id, season, episode, name, checked) {
var checkedbox = (checked ? ' checked' : ''),
row_class = $('#row_class').val();
function make_row(indexer_id, season, episode, name, checked) {
var checkedbox = (checked ? ' checked' : ''),
row_class = $('#row_class').val();
return ' <tr class="' + row_class + '">'
+ ' <td class="tableleft" align="center">'
+ '<input type="checkbox"'
+ ' class="' + indexer_id + '-epcheck"'
+ ' name="' + indexer_id + '-' + season + 'x' + episode + '"'
+ checkedbox+'></td>'
+ ' <td>' + season + 'x' + episode + '</td>'
+ ' <td class="tableright" style="width: 100%">' + name + '</td>'
+ ' </tr>';
}
return ' <tr class="' + row_class + '">'
+ ' <td class="tableleft" align="center">'
+ '<input type="checkbox"'
+ ' class="' + indexer_id + '-epcheck"'
+ ' name="' + indexer_id + '-' + season + 'x' + episode + '"'
+ checkedbox+'></td>'
+ ' <td>' + season + 'x' + episode + '</td>'
+ ' <td class="tableright" style="width: 100%">' + name + '</td>'
+ ' </tr>';
}
$('.go').click(function() {
var selected;
$('.go').click(function() {
if ($('input[class*="-epcheck"]:checked').length === 0 && $('input[id*="allCheck-"]:checked').length === 0) {
alert('Please select at least one Show or Episode');
return false
}
});
if (selected = (0 === $('input[class*="-epcheck"]:checked').length))
alert('Please select at least one episode');
$('.allCheck').click(function(){
var indexer_id = $(this).attr('id').split('-')[1];
$('.' + indexer_id + '-epcheck').prop('checked', $(this).prop('checked'));
});
return !selected
});
$('.get_more_eps').click(function(){
var cur_indexer_id = $(this).attr('id');
var checked = $('#allCheck-' + cur_indexer_id).prop('checked');
var last_row = $('tr#' + cur_indexer_id);
$.getJSON(sbRoot + '/manage/showEpisodeStatuses',
{
indexer_id: cur_indexer_id,
whichStatus: $('#oldStatus').val()
},
function (data) {
$.each(data, function(season,eps){
$.each(eps, function(episode, name) {
last_row.after(make_row(cur_indexer_id, season, episode, name, checked));
});
});
});
$(this).hide();
($('.get_more_eps:visible').length == 0 ? $('.expandAll').hide() : '');
});
$('.allCheck').click(function(){
var indexer_id = $(this).attr('id').split('-')[1];
$('.' + indexer_id + '-epcheck').prop('checked', $(this).prop('checked'));
});
$('.expandAll').click(function() {
$('.get_more_eps').each(function() {
var cur_indexer_id = $(this).attr('id');
var checked = $('#allCheck-' + cur_indexer_id).prop('checked');
var last_row = $('tr#' + cur_indexer_id);
$('.get_more_eps').click(function(){
var cur_indexer_id = $(this).attr('id');
var checked = $('#allCheck-' + cur_indexer_id).prop('checked');
var last_row = $('tr#' + cur_indexer_id);
$.getJSON(sbRoot + '/manage/showEpisodeStatuses',
{
indexer_id: cur_indexer_id,
whichStatus: $('#oldStatus').val()
},
function (data) {
$.each(data, function(season,eps){
$.each(eps, function(episode, name) {
//alert(season+'x'+episode+': '+name);
last_row.after(make_row(cur_indexer_id, season, episode, name, checked));
});
});
});
$(this).hide();
});
$.getJSON(sbRoot + '/manage/showEpisodeStatuses',
{
indexer_id: cur_indexer_id,
whichStatus: $('#oldStatus').val()
},
function (data) {
$.each(data, function(season, eps) {
$.each(eps, function(episode, name) {
last_row.after(make_row(cur_indexer_id, season, episode, name, checked));
});
});
});
$(this).hide();
});
$(this).hide();
});
// selects all visible episode checkboxes.
$('.selectAllShows').click(function(){
$('.allCheck').each(function(){
this.checked = true;
});
$('input[class*="-epcheck"]').each(function(){
this.checked = true;
});
});
// selects all visible episode checkboxes.
$('.selectAllShows').click(function(){
$('.sickbeardTable input').each(function() {
this.checked = true;
});
});
// clears all visible episode checkboxes and the season selectors
$('.unselectAllShows').click(function(){
$('.allCheck').each(function(){
this.checked = false;
});
$('input[class*="-epcheck"]').each(function(){
this.checked = false;
});
});
// clears all visible episode checkboxes and the season selectors
$('.unselectAllShows').click(function(){
$('.sickbeardTable input').each(function() {
this.checked = false;
});
});
});