2012-02-09 00:26:34 +00:00
|
|
|
@model String
|
2012-01-30 01:38:44 +00:00
|
|
|
@using NzbDrone.Common
|
2011-04-21 04:20:39 +00:00
|
|
|
@using NzbDrone.Web.Models
|
2011-12-09 04:57:23 +00:00
|
|
|
@using NzbDrone.Web.Helpers
|
2011-12-10 05:05:17 +00:00
|
|
|
@{ViewBag.Title = "History";}
|
2011-04-21 04:20:39 +00:00
|
|
|
@section ActionMenu{
|
2011-08-22 02:56:04 +00:00
|
|
|
<ul class="sub-menu">
|
2011-12-01 05:25:01 +00:00
|
|
|
<li>@Ajax.ActionLink("Trim History", "Trim", "History", new AjaxOptions { OnSuccess = "reloadHistoryGrid" })</li>
|
|
|
|
<li>@Ajax.ActionLink("Purge History", "Purge", "History", new AjaxOptions { OnSuccess = "reloadHistoryGrid" })</li>
|
2011-08-06 02:04:35 +00:00
|
|
|
</ul>
|
2011-04-21 04:20:39 +00:00
|
|
|
}
|
2011-12-09 04:57:23 +00:00
|
|
|
@section HeaderContent
|
|
|
|
{
|
|
|
|
@Html.IncludeCss("Grid.css")
|
|
|
|
}
|
2012-02-08 08:17:40 +00:00
|
|
|
|
2011-12-01 05:25:01 +00:00
|
|
|
<div class="grid-container">
|
2012-02-09 17:41:51 +00:00
|
|
|
<table id="historyGrid" class="dataTablesGrid hidden-grid">
|
2012-02-09 01:05:16 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>Series Title</th>
|
|
|
|
<th>Episode</th>
|
|
|
|
<th>Episode Title</th>
|
|
|
|
<th>Quality</th>
|
|
|
|
<th>Grabbed On</th>
|
2012-02-08 08:17:40 +00:00
|
|
|
|
2012-02-09 01:05:16 +00:00
|
|
|
@*Commands Column*@
|
|
|
|
<th>Actions</th>
|
2012-02-08 08:17:40 +00:00
|
|
|
|
2012-02-09 01:05:16 +00:00
|
|
|
@*Details Column*@
|
|
|
|
<th style="display: none;">Details</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2011-12-01 05:25:01 +00:00
|
|
|
</div>
|
2012-02-08 08:17:40 +00:00
|
|
|
|
2011-08-06 02:04:35 +00:00
|
|
|
<script type="text/javascript">
|
2011-08-27 00:59:51 +00:00
|
|
|
deleteHistoryRowUrl = '../History/Delete';
|
|
|
|
redownloadUrl = '../History/Redownload';
|
2011-08-06 02:04:35 +00:00
|
|
|
|
2011-08-22 01:00:12 +00:00
|
|
|
function reloadHistoryGrid() {
|
2011-08-27 00:59:51 +00:00
|
|
|
var grid = $('#history').data('tGrid');
|
2011-11-10 16:22:52 +00:00
|
|
|
grid.ajaxRequest();
|
2011-08-27 00:59:51 +00:00
|
|
|
}
|
2012-02-08 08:17:40 +00:00
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('#historyGrid').removeClass('hidden-grid');
|
|
|
|
|
2012-02-09 17:41:51 +00:00
|
|
|
oTable = $('.dataTablesGrid').dataTable({
|
2012-02-09 00:26:34 +00:00
|
|
|
//"sAjaxSource": "History/AjaxBinding",
|
|
|
|
//"bProcessing": true,
|
|
|
|
"bShowAll": false,
|
|
|
|
"aaData": @Html.Raw(Model),
|
2012-02-08 08:17:40 +00:00
|
|
|
"bPaginate": true,
|
|
|
|
"bLengthChange": false,
|
|
|
|
"bFilter": true,
|
|
|
|
"bSort": true,
|
|
|
|
"bInfo": true,
|
|
|
|
"bAutoWidth": false,
|
|
|
|
"iDisplayLength": 20,
|
|
|
|
"sPaginationType": "four_button",
|
|
|
|
"aoColumns": [
|
2012-02-09 00:26:34 +00:00
|
|
|
{ sWidth: '20px', "bSortable": false, "mDataProp": "Indexer", "fnRender": function (row) {
|
|
|
|
return "<img src=\"/Content/Images/Indexers/" + row.aData["Indexer"] + ".png\" alt=\"" + row.aData["Indexer"] + "\">";
|
|
|
|
}
|
|
|
|
}, //Image
|
|
|
|
{ sWidth: 'auto', "mDataProp": "SeriesTitle" }, //Series Title
|
|
|
|
{ sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering
|
|
|
|
{ sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
|
|
|
|
{ sWidth: '70px', "mDataProp": "Quality", "bSoratble": false }, //Quality
|
|
|
|
{ sWidth: '150px', "mDataProp": "Date" }, //Grabbed On
|
|
|
|
{ sWidth: '40px', "mDataProp": "HistoryId", "bSortable": false, "fnRender": function (row) {
|
|
|
|
var deleteImage = "<img src=\"../../Content/Images/X.png\" alt=\"Delete\" title=\"Delete from History\" class=\"searchImage\" onclick=\"deleteHistory(this.parentNode.parentNode, " + row.aData["HistoryId"] + ")\">";
|
|
|
|
var redownloadImage = "<img src=\"../../Content/Images/Downloading.png\" alt=\"Redownload\" title=\Redownload Episode\" class=\"searchImage\" onclick=\"redownloadHistory(this.parentNode.parentNode, " + row.aData["HistoryId"] + ", " + row.aData["EpisodeId"] + ")\">";
|
|
|
|
|
|
|
|
return deleteImage + redownloadImage;
|
|
|
|
//return createImageAjaxLink('/History/Delete?historyId=' + row.aData["HistoryId"], '../../Content/Images/X.png', 'Delete', 'Delete from History', 'searchImage');
|
|
|
|
}
|
|
|
|
}, //Actions
|
|
|
|
{ sWidth: 'auto', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) {
|
|
|
|
var result = "<b>Overview: </b>" + row.aData["EpisodeOverview"] + "<br/>" +
|
|
|
|
"<b>NZB Title: </b>" + row.aData["NzbTitle"] + "<br/>" +
|
|
|
|
"<b>Proper: </b>" + row.aData["IsProper"];
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
} //Details
|
2012-02-08 08:17:40 +00:00
|
|
|
],
|
2012-02-09 00:26:34 +00:00
|
|
|
"aaSorting": [[5, 'desc']]
|
2012-02-08 08:17:40 +00:00
|
|
|
});
|
|
|
|
});
|
2012-02-09 00:26:34 +00:00
|
|
|
|
|
|
|
function deleteHistory(row, historyId) {
|
|
|
|
//Delete from DB
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: deleteHistoryRowUrl,
|
|
|
|
data: { historyId: historyId },
|
|
|
|
success: function () {
|
|
|
|
oTable.fnDeleteRow(oTable.fnGetPosition(row));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function redownloadHistory(row, historyId, episodeId) {
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: redownloadUrl,
|
|
|
|
data: { historyId: historyId, episodeId: episodeId },
|
|
|
|
success: function () {
|
|
|
|
oTable.fnDeleteRow(oTable.fnGetPosition(row));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2011-12-01 05:25:01 +00:00
|
|
|
</script>
|