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 * Fix updating of pull requests
* Add hidden cache debug page * Add hidden cache debug page
* Change autoProcessTV scripts python code quotes from " -> ' * 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] [develop changelog]
* Fix traceback error when using the menu item Manage/Update Kodi * Fix traceback error when using the menu item Manage/Update Kodi

View file

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

View file

@ -1,16 +1,15 @@
#import sickbeard #import sickbeard
#import datetime #import datetime
#from sickbeard import common #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 #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') #if $varExists('header')
<h1 class="header">$header</h1> <h1 class="header">$header</h1>
#else #else
@ -20,17 +19,16 @@
#if not $whichStatus or ($whichStatus and not $ep_counts): #if not $whichStatus or ($whichStatus and not $ep_counts):
#if $whichStatus: #if $whichStatus:
<h2>None of your episodes have status $common.statusStrings[$int($whichStatus)]</h2> <h3>None of your episodes have status <span class="grey-text">$common.statusStrings[$int($whichStatus)]</span></h3>
<br />
#end if #end if
<form action="$sbRoot/manage/episodeStatuses" method="get"> <form action="$sbRoot/manage/episodeStatuses" method="get">
Manage episodes with status <select name="whichStatus" class="form-control form-control-inline input-sm"> 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]: #for $curStatus in [$common.SKIPPED, $common.UNKNOWN, $common.SNATCHED, $common.WANTED, $common.ARCHIVED, $common.IGNORED]:
<option value="$curStatus">$common.statusStrings[$curStatus]</option> <option value="$curStatus">$common.statusStrings[$curStatus]</option>
#end for #end for
</select> </select>
<input class="btn btn-inline" type="submit" value="Manage" /> <input class="btn btn-inline" type="submit" value="Manage" />
</form> </form>
#else #else
@ -40,50 +38,49 @@ Manage episodes with status <select name="whichStatus" class="form-control form-
<form action="$sbRoot/manage/changeEpisodeStatuses" method="post"> <form action="$sbRoot/manage/changeEpisodeStatuses" method="post">
<input type="hidden" id="oldStatus" name="oldStatus" value="$whichStatus" /> <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> <h3>${len($sorted_show_ids)} Shows containing <span class="grey-text">$common.statusStrings[$int($whichStatus)]</span> episodes</h3>
<br />
#if $whichStatus in ($common.ARCHIVED, $common.IGNORED, $common.SNATCHED): #if $whichStatus in ($common.ARCHIVED, $common.IGNORED, $common.SNATCHED):
#set $row_class = "good" #set $row_class = 'good'
#else #else
#set $row_class = $common.Overview.overviewStrings[$whichStatus] #set $row_class = $common.Overview.overviewStrings[$whichStatus]
#end if #end if
<input type="hidden" id="row_class" value="$row_class" /> <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] #set $statusList = [$common.SKIPPED, $common.WANTED, $common.ARCHIVED, $common.IGNORED]
#if $int($whichStatus) in $statusList #if $int($whichStatus) in $statusList
$statusList.remove($int($whichStatus)) $statusList.remove($int($whichStatus))
#end if #end if
#if $int($whichStatus) in [$common.SNATCHED, $common.SNATCHED_PROPER] #if $int($whichStatus) in [$common.SNATCHED, $common.SNATCHED_PROPER]
$statusList.append($common.FAILED) $statusList.append($common.FAILED)
#end if #end if
#for $curStatus in $statusList: #for $curStatus in $statusList:
<option value="$curStatus">$common.statusStrings[$curStatus]</option> <option value="$curStatus">$common.statusStrings[$curStatus]</option>
#end for #end for
</select> </select>
<input class="btn btn-inline go" type="submit" value="Go" /> <input class="btn btn-inline go" type="submit" value="Go" />
</div>
<div>
<button type="button" class="btn btn-xs selectAllShows">Select all</a></button> <div class="form-group">
<button type="button" class="btn btn-xs unselectAllShows">Clear all</a></button> <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> </div>
<br />
<table class="sickbeardTable manageTable" cellspacing="1" border="0" cellpadding="0"> <table class="sickbeardTable manageTable" cellspacing="1" border="0" cellpadding="0">
#for $cur_indexer_id in $sorted_show_ids: #for $cur_indexer_id in $sorted_show_ids:
<tr id="$cur_indexer_id"> <tr id="$cur_indexer_id">
<th><input type="checkbox" class="allCheck" id="allCheck-$cur_indexer_id" name="$cur_indexer_id-all" /></th> <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> <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>
#end for #end for
</table> </table>
</form> </form>
#end if #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() { $(document).ready(function() {
function make_row(indexer_id, season, episode, name, checked) { function make_row(indexer_id, season, episode, name, checked) {
var checkedbox = (checked ? ' checked' : ''), var checkedbox = (checked ? ' checked' : ''),
row_class = $('#row_class').val(); row_class = $('#row_class').val();
return ' <tr class="' + row_class + '">' return ' <tr class="' + row_class + '">'
+ ' <td class="tableleft" align="center">' + ' <td class="tableleft" align="center">'
+ '<input type="checkbox"' + '<input type="checkbox"'
+ ' class="' + indexer_id + '-epcheck"' + ' class="' + indexer_id + '-epcheck"'
+ ' name="' + indexer_id + '-' + season + 'x' + episode + '"' + ' name="' + indexer_id + '-' + season + 'x' + episode + '"'
+ checkedbox+'></td>' + checkedbox+'></td>'
+ ' <td>' + season + 'x' + episode + '</td>' + ' <td>' + season + 'x' + episode + '</td>'
+ ' <td class="tableright" style="width: 100%">' + name + '</td>' + ' <td class="tableright" style="width: 100%">' + name + '</td>'
+ ' </tr>'; + ' </tr>';
} }
$('.go').click(function() { $('.go').click(function() {
var selected; 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)) $('.allCheck').click(function(){
alert('Please select at least one episode'); 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(){ $('.expandAll').click(function() {
var indexer_id = $(this).attr('id').split('-')[1]; $('.get_more_eps').each(function() {
$('.' + indexer_id + '-epcheck').prop('checked', $(this).prop('checked')); 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(){ $.getJSON(sbRoot + '/manage/showEpisodeStatuses',
var cur_indexer_id = $(this).attr('id'); {
var checked = $('#allCheck-' + cur_indexer_id).prop('checked'); indexer_id: cur_indexer_id,
var last_row = $('tr#' + cur_indexer_id); whichStatus: $('#oldStatus').val()
},
$.getJSON(sbRoot + '/manage/showEpisodeStatuses', function (data) {
{ $.each(data, function(season, eps) {
indexer_id: cur_indexer_id, $.each(eps, function(episode, name) {
whichStatus: $('#oldStatus').val() last_row.after(make_row(cur_indexer_id, season, episode, name, checked));
}, });
function (data) { });
$.each(data, function(season,eps){ });
$.each(eps, function(episode, name) { $(this).hide();
//alert(season+'x'+episode+': '+name); });
last_row.after(make_row(cur_indexer_id, season, episode, name, checked)); $(this).hide();
}); });
});
});
$(this).hide();
});
// selects all visible episode checkboxes. // selects all visible episode checkboxes.
$('.selectAllShows').click(function(){ $('.selectAllShows').click(function(){
$('.allCheck').each(function(){ $('.sickbeardTable input').each(function() {
this.checked = true; this.checked = true;
}); });
$('input[class*="-epcheck"]').each(function(){ });
this.checked = true;
});
});
// clears all visible episode checkboxes and the season selectors // clears all visible episode checkboxes and the season selectors
$('.unselectAllShows').click(function(){ $('.unselectAllShows').click(function(){
$('.allCheck').each(function(){ $('.sickbeardTable input').each(function() {
this.checked = false; this.checked = false;
}); });
$('input[class*="-epcheck"]').each(function(){ });
this.checked = false;
});
});
}); });