2012-01-30 02:38:44 +01:00
|
|
|
@using NzbDrone.Common
|
2011-12-12 22:52:29 +01:00
|
|
|
@using NzbDrone.Web.Helpers
|
2011-05-10 08:32:33 +02:00
|
|
|
@using NzbDrone.Web.Models;
|
2012-02-16 06:53:00 +01:00
|
|
|
@model string
|
2011-12-10 06:05:17 +01:00
|
|
|
@{ViewBag.Title = "NzbDrone";}
|
2011-12-12 22:52:29 +01:00
|
|
|
|
|
|
|
@section HeaderContent
|
|
|
|
{
|
|
|
|
@Html.IncludeCss("Settings.css")
|
2012-02-06 23:13:33 +01:00
|
|
|
@Html.IncludeCss("Grid.css")
|
2011-12-12 22:52:29 +01:00
|
|
|
}
|
2012-02-05 21:17:23 +01:00
|
|
|
<style>
|
|
|
|
.ui-progressbar
|
2011-06-25 03:20:52 +02:00
|
|
|
{
|
2012-02-05 21:17:23 +01:00
|
|
|
position:relative;
|
|
|
|
width: 125px;
|
2011-06-25 03:20:52 +02:00
|
|
|
height: 20px;
|
2012-02-05 21:17:23 +01:00
|
|
|
background-color: transparent;
|
|
|
|
border: 1px solid #065EFE;
|
|
|
|
margin: 2px;
|
2011-06-25 03:20:52 +02:00
|
|
|
}
|
2011-06-02 06:40:06 +02:00
|
|
|
|
2012-02-05 21:17:23 +01:00
|
|
|
.progressBarText
|
2011-06-25 03:20:52 +02:00
|
|
|
{
|
|
|
|
position: absolute;
|
2012-02-05 21:17:23 +01:00
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.ui-progressbar-value
|
|
|
|
{
|
2011-06-25 03:20:52 +02:00
|
|
|
overflow: hidden;
|
2012-02-05 21:17:23 +01:00
|
|
|
border: 1px solid #065EFE;
|
2011-06-25 03:20:52 +02:00
|
|
|
}
|
2012-02-05 21:17:23 +01:00
|
|
|
|
|
|
|
.ui-progressbar-value .progressBarText
|
2011-06-25 03:20:52 +02:00
|
|
|
{
|
2012-02-05 21:17:23 +01:00
|
|
|
position: relative;
|
|
|
|
font-weight: normal;
|
2011-06-25 03:20:52 +02:00
|
|
|
color: white;
|
|
|
|
}
|
2012-02-05 21:17:23 +01:00
|
|
|
|
|
|
|
/* Set the row height so it won't resize when the progress bar is created */
|
|
|
|
.seriesTable tr
|
2011-06-25 03:20:52 +02:00
|
|
|
{
|
2012-02-05 21:17:23 +01:00
|
|
|
height: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.editButton, .deleteButton
|
|
|
|
{
|
|
|
|
width: 18px;
|
|
|
|
height: 18px;
|
|
|
|
padding: 3px 1px;
|
|
|
|
margin: 0px;
|
|
|
|
vertical-align: middle;
|
2011-06-25 03:20:52 +02:00
|
|
|
}
|
2011-07-03 21:02:33 +02:00
|
|
|
|
2012-02-05 21:17:23 +01:00
|
|
|
.editButton:hover, .deleteButton:hover
|
2011-07-03 21:02:33 +02:00
|
|
|
{
|
2012-02-05 21:17:23 +01:00
|
|
|
background-color: #065EFE;
|
2011-07-03 21:02:33 +02:00
|
|
|
}
|
2012-02-05 21:23:37 +01:00
|
|
|
|
2012-02-07 09:24:44 +01:00
|
|
|
.commandsColumn, .statusColumn
|
2012-02-05 21:23:37 +01:00
|
|
|
{
|
|
|
|
text-align: center;
|
|
|
|
}
|
2012-02-05 22:36:57 +01:00
|
|
|
|
|
|
|
.ui-dialog-buttonpane .ui-dialog-buttonset .ui-delete-button
|
|
|
|
{
|
|
|
|
margin-right: 445px;
|
|
|
|
}
|
|
|
|
|
2011-06-02 05:36:30 +02:00
|
|
|
</style>
|
2011-04-21 09:14:47 +02:00
|
|
|
@section ActionMenu{
|
2011-08-22 04:56:04 +02:00
|
|
|
<ul class="sub-menu">
|
2011-08-06 04:04:35 +02:00
|
|
|
<li>@Html.ActionLink("Add Series", "Index", "AddSeries")</li>
|
|
|
|
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li>
|
|
|
|
</ul>
|
2011-04-21 09:14:47 +02:00
|
|
|
}
|
2012-02-05 21:17:23 +01:00
|
|
|
|
2012-02-18 20:41:29 +01:00
|
|
|
<table id="seriesGrid" class="dataTablesGrid hidden-grid">
|
2012-02-07 23:28:53 +01:00
|
|
|
<thead>
|
2012-02-05 21:17:23 +01:00
|
|
|
|
2012-02-07 23:28:53 +01:00
|
|
|
<tr>
|
2012-02-16 06:53:00 +01:00
|
|
|
<th style="width: 10px">Status</th>
|
|
|
|
<th style="width: auto">Title</th>
|
|
|
|
<th style="width: 100px">Seasons</th>
|
|
|
|
<th style="width: 100px">Quality</th>
|
|
|
|
<th style="width: 140px">Next Airing</th>
|
|
|
|
<th style="width: 100px">Episodes</th>
|
2012-02-07 04:48:26 +01:00
|
|
|
|
2012-02-07 23:28:53 +01:00
|
|
|
@*Commands Column*@
|
2012-02-16 06:53:00 +01:00
|
|
|
<th style="width: 80px">
|
2012-02-07 23:28:53 +01:00
|
|
|
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
2012-02-05 21:17:23 +01:00
|
|
|
</table>
|
|
|
|
|
2012-02-18 01:43:16 +01:00
|
|
|
<div style="visibility: hidden">
|
|
|
|
<div id="seriesEditor" title="Edit Series">
|
|
|
|
</div>
|
|
|
|
<div id="seriesDelete" title="Delete Series">
|
|
|
|
<input class="seriesId" type="hidden" value="" />
|
|
|
|
Are you sure you want to delete '<span class="seriesTitle"></span>'?
|
|
|
|
</div>
|
2012-02-05 21:17:23 +01:00
|
|
|
</div>
|
2011-06-28 03:23:22 +02:00
|
|
|
@section Scripts{
|
|
|
|
<script type="text/javascript">
|
2012-02-05 21:17:23 +01:00
|
|
|
var seriesEditorUrl = './Series/SeriesEditor';
|
|
|
|
var saveSeriesEditorUrl = './Series/SaveSeriesEditor';
|
|
|
|
var seriesDeleteUrl = './Series/DeleteSeries';
|
2012-02-16 06:53:00 +01:00
|
|
|
var pauseImage = '<img src="../../Content/Images/pause.png" width="24" height="24" alt="Paused" title="Not monitored" />';
|
|
|
|
var stopImage = '<img src="../../Content/Images/stop.png" width="24" height="24" alt="Ended" title="Ended" />';
|
|
|
|
var playImage = '<img src="../../Content/Images/play.png" width="24" height="24" alt="Active" title="Continuing" />';
|
2012-02-05 21:17:23 +01:00
|
|
|
|
|
|
|
$(document).ready(function () {
|
2012-02-16 06:53:00 +01:00
|
|
|
$('#seriesGrid').removeClass('hidden-grid');
|
|
|
|
|
|
|
|
oTable = $('.dataTablesGrid').dataTable({
|
|
|
|
"bShowAll": false,
|
|
|
|
"aaData": @Html.Raw(Model),
|
|
|
|
"bPaginate": false,
|
|
|
|
"bLengthChange": false,
|
|
|
|
"bFilter": false,
|
|
|
|
"bSort": true,
|
|
|
|
"bInfo": false,
|
|
|
|
"bAutoWidth": false,
|
2012-02-16 08:17:01 +01:00
|
|
|
"bStateSave": true,
|
2012-02-16 08:27:03 +01:00
|
|
|
"iCookieDuration": 60 * 60 *24 * 365, //1 year
|
2012-02-16 06:53:00 +01:00
|
|
|
"aoColumns": [
|
|
|
|
{ sWidth: '70px',
|
|
|
|
"sClass": "statusColumn",
|
|
|
|
"mDataProp": function (source, type, val) {
|
|
|
|
// 'display' and 'filter' use our fancy naming
|
|
|
|
if (type === 'display' || type === 'filter') {
|
|
|
|
var monitored = source["Monitored"];
|
|
|
|
var status = source["Status"];
|
|
|
|
|
|
|
|
if (!monitored) {
|
|
|
|
return pauseImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
if (status === "Ended"){
|
|
|
|
return stopImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
return playImage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 'sort' and 'type' both just use the raw data
|
|
|
|
return source["Status"];
|
|
|
|
}
|
|
|
|
}, //Status
|
|
|
|
{ sWidth: 'auto', "mDataProp": function (source, type, val) {
|
|
|
|
// 'display' and 'filter' use our fancy naming
|
|
|
|
if (type === 'display' || type === 'filter') {
|
2012-02-18 01:24:49 +01:00
|
|
|
return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["Title"] + "</a>";
|
2012-02-16 06:53:00 +01:00
|
|
|
}
|
|
|
|
// 'sort' and 'type' both just use the raw data
|
|
|
|
return source["TitleSorter"];
|
|
|
|
}
|
|
|
|
}, //Title
|
|
|
|
{ sWidth: '100px', "mDataProp": "SeasonsCount", "bSortable": false }, //Seasons
|
|
|
|
{ sWidth: '100px', "mDataProp": "QualityProfileName" }, //Quality
|
|
|
|
{ sWidth: '120px', "mDataProp": function (source, type, val) {
|
|
|
|
// 'display' and 'filter' use our fancy naming
|
|
|
|
if (type === 'display' || type === 'filter') {
|
|
|
|
return source["NextAiring"];
|
|
|
|
}
|
|
|
|
// 'sort' and 'type' both just use the raw data
|
|
|
|
return source["NextAiringSorter"];
|
|
|
|
}
|
|
|
|
}, //Next Airing
|
|
|
|
{ sWidth: '140px', "mDataProp": "Episodes", "bSortable": false, "fnRender": function (row) {
|
|
|
|
var progress = row.aData["EpisodeFileCount"] / row.aData["EpisodeCount"] * 100;
|
|
|
|
|
|
|
|
var result = "<div class='progressBar' rel='" + progress + "'>" +
|
|
|
|
"<span class='progressBarText'>" + row.aData["EpisodeFileCount"] + " / " + row.aData["EpisodeCount"] +"</span>" +
|
|
|
|
"</div>";
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}, //Episodes
|
|
|
|
{ sWidth: '50px', "mDataProp": "HasBanner", "bSortable": false, "fnRender": function (row) {
|
|
|
|
return "<img src='../../Content/Images/settings.png' class='editButton' value='" + row.aData["SeriesId"] + "' rel='" + row.aData["Title"] + "' />" +
|
|
|
|
"<img src='../../Content/Images/close.png' class='deleteButton' value='" + row.aData["SeriesId"] + "' rel='" + row.aData["Title"] + "'/>";
|
|
|
|
}
|
|
|
|
}, //Commands
|
|
|
|
{ sWidth: '60px', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) {
|
|
|
|
var result = "<b>Airs Day of Week: </b>" + row.aData["AirsDayOfWeek"] + "<br/>" +
|
|
|
|
"<b>Overview: </b>" + row.aData["Overview"] + "<br/>";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
} //Details
|
|
|
|
],
|
|
|
|
"aaSorting": [[1, 'asc']],
|
|
|
|
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
|
|
|
|
$(nRow).addClass(aData["SeriesId"].toString());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-02-05 21:17:23 +01:00
|
|
|
$(".progressBar").each(function () {
|
|
|
|
var element = this;
|
|
|
|
|
|
|
|
var progressbar = $(element).progressbar({
|
2012-02-07 08:38:31 +01:00
|
|
|
value: parseInt($(element).attr("rel"))
|
2011-06-23 08:56:17 +02:00
|
|
|
});
|
2012-02-07 08:09:02 +01:00
|
|
|
|
2012-02-05 21:17:23 +01:00
|
|
|
var label = progressbar.find('.progressBarText').clone().width(progressbar.width());
|
|
|
|
progressbar.find('.ui-progressbar-value').append(label);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#seriesEditor").dialog({
|
|
|
|
autoOpen: false,
|
2012-02-07 09:20:56 +01:00
|
|
|
height: 'auto',
|
2012-02-05 21:17:23 +01:00
|
|
|
width: 670,
|
|
|
|
resizable: false,
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
2012-02-05 22:36:57 +01:00
|
|
|
"Delete": {
|
|
|
|
text: "Delete",
|
|
|
|
class: "ui-delete-button",
|
|
|
|
click: function () {
|
|
|
|
var answer = confirm("Are you sure you want to delete this series?");
|
|
|
|
if (answer) {
|
|
|
|
var seriesId = $('#SeriesId').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: seriesDeleteUrl,
|
|
|
|
data: { seriesId: seriesId },
|
|
|
|
success: function (data) {
|
|
|
|
//Remove the row from the grid... along with the details row
|
|
|
|
$('.' + seriesId).hide();
|
|
|
|
$('.details_' + seriesId).hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2012-02-05 21:17:23 +01:00
|
|
|
"Save": function () {
|
|
|
|
//Save the form
|
|
|
|
$('#SeriesEditorForm').submit();
|
2012-02-10 09:16:14 +01:00
|
|
|
updateStatus();
|
|
|
|
|
2012-02-05 21:17:23 +01:00
|
|
|
$(this).dialog("close");
|
|
|
|
},
|
|
|
|
Cancel: function () {
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#seriesDelete").dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
resizable: false,
|
2012-02-07 09:20:56 +01:00
|
|
|
height: 'auto',
|
2012-02-05 21:17:23 +01:00
|
|
|
width: 450,
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Delete": function () {
|
|
|
|
var seriesId = $('.seriesId').val();
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: seriesDeleteUrl,
|
|
|
|
data: { seriesId: seriesId },
|
|
|
|
success: function (data) {
|
|
|
|
//Remove the row from the grid... along with the details row
|
|
|
|
$('.' + seriesId).hide();
|
|
|
|
$('.details_' + seriesId).hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(this).dialog("close");
|
|
|
|
},
|
|
|
|
Cancel: function () {
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".editButton")
|
|
|
|
.live('click', function () {
|
|
|
|
//Get the SeriesId and Title
|
|
|
|
var seriesId = parseInt($(this).attr("value"));
|
|
|
|
var title = $(this).attr("rel");
|
|
|
|
|
|
|
|
//Set the title of the dialog
|
2012-02-07 07:37:03 +01:00
|
|
|
$("#seriesEditor").dialog("option", "title", title);
|
2012-02-05 21:17:23 +01:00
|
|
|
|
|
|
|
//Pre-populate the view with ajax
|
|
|
|
$('#seriesEditor').html('<div style="text-align: center; width: 100%; height: 100%;"><img src="../../Content/Images/ajax-loader.gif" style="padding-top: 120px;" /></div>');
|
|
|
|
|
|
|
|
//Get the view
|
|
|
|
$.ajax({
|
|
|
|
url: seriesEditorUrl,
|
|
|
|
data: { seriesId: seriesId },
|
|
|
|
success: function (data) {
|
|
|
|
$('#seriesEditor').html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//Open the dialog
|
|
|
|
$("#seriesEditor").dialog("open");
|
|
|
|
});
|
|
|
|
|
2012-02-16 06:53:00 +01:00
|
|
|
$(".deleteButton")
|
2012-02-05 21:17:23 +01:00
|
|
|
.live('click', function () {
|
|
|
|
//Get the SeriesId and Title
|
|
|
|
var seriesId = parseInt($(this).attr("value"));
|
|
|
|
var title = $(this).attr("rel");
|
|
|
|
|
|
|
|
//Set the title of the dialog
|
|
|
|
//$("#seriesDelete").dialog("option", "title", "Delete Series: " + title);
|
|
|
|
|
|
|
|
//Fill in the view
|
|
|
|
$('#seriesDelete').children('.seriesId').val(seriesId);
|
|
|
|
$('#seriesDelete').children('.seriesTitle').html(title);
|
|
|
|
|
|
|
|
//Open the dialog
|
|
|
|
$("#seriesDelete").dialog("open");
|
|
|
|
});
|
2012-02-10 09:16:14 +01:00
|
|
|
|
|
|
|
function updateStatus() {
|
|
|
|
var monitored = $('#Monitored').attr('checked');
|
|
|
|
var seriesId = $('#SeriesId').val();
|
2012-02-16 06:53:00 +01:00
|
|
|
var status = $('#Status').val();
|
|
|
|
var imgContainer = $('.' + seriesId).children('.statusColumn');
|
|
|
|
|
|
|
|
if (!monitored) {
|
|
|
|
imgContainer.html(pauseImage);
|
2012-02-10 09:16:14 +01:00
|
|
|
}
|
2012-02-16 06:53:00 +01:00
|
|
|
|
|
|
|
else {
|
|
|
|
if (status === "Ended"){
|
|
|
|
imgContainer.html(stopImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
imgContainer.html(playImage);
|
2012-02-10 09:16:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-06-28 03:23:22 +02:00
|
|
|
</script>
|
|
|
|
}
|