2012-02-09 03:26:34 +03:00
|
|
|
@model String
|
2011-12-10 08:05:17 +03:00
|
|
|
@{ViewBag.Title = "History";}
|
2011-04-21 07:20:39 +03:00
|
|
|
@section ActionMenu{
|
2011-08-22 05:56:04 +03:00
|
|
|
<ul class="sub-menu">
|
2012-03-06 22:25:57 +03:00
|
|
|
<li>@Ajax.ActionLink("Trim History", "Trim", "History", null, new AjaxOptions{ OnSuccess = "reloadGrid", Confirm = "Delete history items older than 30 days?"})</li>
|
2012-03-06 11:03:20 +03:00
|
|
|
<li>@Ajax.ActionLink("Purge History", "Purge", "History", null, new AjaxOptions{ OnSuccess = "reloadGrid", Confirm = "Purge all history items?" })</li>
|
2011-08-06 05:04:35 +03:00
|
|
|
</ul>
|
2011-04-21 07:20:39 +03:00
|
|
|
}
|
2012-02-08 11:17:40 +03:00
|
|
|
|
2011-12-01 08:25:01 +03:00
|
|
|
<div class="grid-container">
|
2012-02-09 20:41:51 +03:00
|
|
|
<table id="historyGrid" class="dataTablesGrid hidden-grid">
|
2012-02-09 04:05:16 +03: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 11:17:40 +03:00
|
|
|
|
2012-02-09 04:05:16 +03:00
|
|
|
@*Commands Column*@
|
|
|
|
<th>Actions</th>
|
2012-02-08 11:17:40 +03:00
|
|
|
|
2012-02-09 04:05:16 +03:00
|
|
|
@*Details Column*@
|
|
|
|
<th style="display: none;">Details</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2011-12-01 08:25:01 +03:00
|
|
|
</div>
|
2012-02-08 11:17:40 +03:00
|
|
|
|
2012-02-10 08:26:30 +03:00
|
|
|
@section Scripts{
|
|
|
|
<script type="text/javascript">
|
|
|
|
deleteHistoryRowUrl = '../History/Delete';
|
|
|
|
redownloadUrl = '../History/Redownload';
|
2011-08-06 05:04:35 +03:00
|
|
|
|
2012-02-10 08:26:30 +03:00
|
|
|
function reloadHistoryGrid() {
|
|
|
|
var grid = $('#history').data('tGrid');
|
|
|
|
grid.ajaxRequest();
|
|
|
|
}
|
2012-02-08 11:17:40 +03:00
|
|
|
|
2012-02-10 08:26:30 +03:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('#historyGrid').removeClass('hidden-grid');
|
2012-02-08 11:17:40 +03:00
|
|
|
|
2012-02-11 08:00:22 +03:00
|
|
|
oTable = $('#historyGrid').dataTable({
|
|
|
|
"sAjaxSource": "History/AjaxBinding",
|
|
|
|
"bServerSide": false,
|
|
|
|
"bProcessing": true,
|
2012-02-10 08:26:30 +03:00
|
|
|
"bShowAll": false,
|
2012-02-11 08:00:22 +03:00
|
|
|
"bPaginate": true,
|
|
|
|
"bLengthChange": false,
|
|
|
|
"bFilter": true,
|
|
|
|
"bSort": true,
|
|
|
|
"bInfo": true,
|
|
|
|
"bAutoWidth": false,
|
|
|
|
"iDisplayLength": 20,
|
|
|
|
"sPaginationType": "four_button",
|
|
|
|
"aoColumns": [
|
|
|
|
{ sWidth: '20px', "bSortable": false, "mDataProp": "Indexer", "fnRender": function (row) {
|
2012-02-25 19:35:27 +03:00
|
|
|
return "<img src='/Content/Images/Indexers/" + row.aData['Indexer'] + ".png' alt=" + row.aData["Indexer"] + ">";
|
2012-02-11 08:00:22 +03:00
|
|
|
}
|
|
|
|
}, //Image
|
2012-02-27 07:47:49 +03:00
|
|
|
{ sWidth: 'auto', "mDataProp": function (source, type, val) {
|
|
|
|
// 'display' and 'filter' use our fancy naming
|
|
|
|
if (type === 'display' || type === 'filter') {
|
|
|
|
return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["SeriesTitle"] + "</a>";
|
|
|
|
}
|
|
|
|
// 'sort' and 'type' both just use the raw data
|
|
|
|
return source["SeriesTitleSorter"];
|
|
|
|
}
|
|
|
|
}, //Series Title
|
2012-02-11 08:00:22 +03:00
|
|
|
{ sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering
|
|
|
|
{ sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
|
|
|
|
{ sWidth: '70px', "mDataProp": "Quality", "bSortable": false }, //Quality
|
2012-02-14 21:48:13 +03:00
|
|
|
{ sWidth: '150px', "mDataProp": function (source, type, val) {
|
|
|
|
// 'display' and 'filter' use our fancy naming
|
|
|
|
if (type === 'display' || type === 'filter') {
|
|
|
|
return source["Date"];
|
|
|
|
}
|
|
|
|
// 'sort' and 'type' both just use the raw data
|
|
|
|
return source["DateSorter"];
|
|
|
|
}
|
|
|
|
}, //Date
|
2012-02-11 08:00:22 +03:00
|
|
|
{ sWidth: '40px', "mDataProp": "HistoryId", "bSortable": false, "fnRender": function (row) {
|
2012-02-25 22:41:48 +03:00
|
|
|
var deleteImage = "<img src=\"../../Content/Images/X.png\" alt=\"Delete\" title=\"Delete from History\" class=\"gridAction\" onclick=\"deleteHistory(this.parentNode.parentNode, " + row.aData["HistoryId"] + ")\">";
|
|
|
|
var redownloadImage = "<img src=\"../../Content/Images/redownload.png\" alt=\"Redownload\" title=\Redownload Episode\" class=\"gridAction\" onclick=\"redownloadHistory(this.parentNode.parentNode, " + row.aData["HistoryId"] + ", " + row.aData["EpisodeId"] + ")\">";
|
2012-02-09 03:26:34 +03:00
|
|
|
|
2012-02-11 08:00:22 +03:00
|
|
|
return deleteImage + redownloadImage;
|
|
|
|
}
|
|
|
|
}, //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
|
|
|
|
],
|
|
|
|
"aaSorting": [[5, 'desc']]
|
2012-02-10 08:26:30 +03: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));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
}
|