2011-04-27 05:09:24 +00:00
|
|
|
@using NzbDrone.Web.Helpers;
|
|
|
|
@model NzbDrone.Web.Models.DownloadSettingsModel
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function () {
|
2011-04-25 18:21:53 +00:00
|
|
|
selectDownloadOptionAtStart(); //Load either SAB or Blackhole div
|
2011-04-21 01:43:09 +00:00
|
|
|
var options = {
|
|
|
|
target: '#result',
|
|
|
|
beforeSubmit: showRequest,
|
|
|
|
success: showResponse,
|
|
|
|
type: 'post',
|
|
|
|
resetForm: false
|
|
|
|
};
|
|
|
|
$('#form').ajaxForm(options);
|
|
|
|
$('#save_button').attr('disabled', '');
|
|
|
|
});
|
2011-04-25 18:21:53 +00:00
|
|
|
|
|
|
|
function selectDownloadOptionAtStart() {
|
|
|
|
var checked = $('UseBlackHole').val();
|
2011-04-25 19:02:29 +00:00
|
|
|
var $radios = $('input[name="UseBlackhole"]');
|
2011-04-25 18:21:53 +00:00
|
|
|
$radios.filter('[value=' + checked + ']').attr('checked', true);
|
|
|
|
selectDownloadOption();
|
|
|
|
}
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
function selectDownloadOption() {
|
2011-04-25 18:21:53 +00:00
|
|
|
var selected = $("input[name='UseBlackhole']:checked").val();
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
if (selected == "True") {
|
2011-04-25 18:21:53 +00:00
|
|
|
$('#UseBlackHole').attr('checked', true);
|
2011-04-21 01:43:09 +00:00
|
|
|
document.getElementById('blackhole').style.display = 'block';
|
|
|
|
document.getElementById('sab').style.display = 'none';
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
2011-04-25 18:21:53 +00:00
|
|
|
$('#UseBlackHole').attr('checked', false);
|
2011-04-21 01:43:09 +00:00
|
|
|
document.getElementById('sab').style.display = 'block';
|
|
|
|
document.getElementById('blackhole').style.display = 'none';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function showRequest(formData, jqForm, options) {
|
|
|
|
$("#result").empty().html('Saving...');
|
|
|
|
$("#form :input").attr("disabled", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function showResponse(responseText, statusText, xhr, $form) {
|
|
|
|
$("#result").empty().html(responseText);
|
|
|
|
$("#form :input").attr("disabled", false);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(".blackhole_radio").live("change", function () {
|
|
|
|
selectDownloadOption(); //Load either SAB or Blackhole div
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@using (Html.BeginForm("SaveDownloads", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
|
|
|
|
{
|
|
|
|
<fieldset>
|
|
|
|
<legend>Download Settings</legend>
|
|
|
|
|
|
|
|
<fieldset class="sub-field">
|
|
|
|
<legend>Usenet Variables</legend>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SyncFrequency)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SyncFrequency)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SyncFrequency)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SyncFrequency)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.DownloadPropers)</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-value">@Html.CheckBoxFor(m => m.DownloadPropers, new { @class = "config-checkbox" })</div>
|
|
|
|
</div>
|
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.DownloadPropers)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.DownloadPropers)</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.Retention)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.Retention)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.Retention)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.Retention)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
|
2011-04-21 01:43:09 +00:00
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<b>@Html.LabelFor(m => m.UseBlackHole)</b>
|
2011-04-25 19:02:29 +00:00
|
|
|
@Html.CheckBoxFor(m => m.UseBlackHole, new { style="display:none" })
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
<div>
|
2011-04-25 18:21:53 +00:00
|
|
|
@Html.RadioButton("UseBlackhole", true, new { @class="blackhole_radio" })Blackhole
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
<div>
|
2011-04-25 18:21:53 +00:00
|
|
|
@Html.RadioButton("UseBlackhole", false, new { @class="blackhole_radio" })SABnzbd
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="sab" style="display:none">
|
|
|
|
<fieldset class="sub-field">
|
|
|
|
<legend>SABnzbd</legend>
|
|
|
|
|
2011-05-11 06:46:26 +00:00
|
|
|
<button type="button" onclick="autoConfigureSab()">Auto-Configure</button>
|
2011-04-25 07:42:29 +00:00
|
|
|
|
2011-04-21 01:43:09 +00:00
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabHost)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SabHost)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabHost)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabHost)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabPort)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SabPort)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabPort)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabPort)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabApiKey)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SabApiKey)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabApiKey)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabApiKey)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabUsername)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SabUsername)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabUsername)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabUsername)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabPassword)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SabPassword)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabPassword)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabPassword)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabTvCategory)</div>
|
2011-05-01 08:02:58 +00:00
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.SabTvCategory)</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
</div>
|
|
|
|
<div class="config-group2">
|
2011-05-01 08:02:58 +00:00
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabTvCategory)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabTvCategory)</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.SabTvPriority)</div>
|
|
|
|
<div class="config-value">@Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabTvPriority)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.SabTvPriority)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="blackhole" style="display:none">
|
|
|
|
<fieldset class="sub-field">
|
|
|
|
<legend>Blackhole</legend>
|
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
|
|
|
<div class="config-title">@Html.LabelFor(m => m.BlackholeDirectory)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(m => m.BlackholeDirectory)</div>
|
|
|
|
</div>
|
2011-04-27 05:09:24 +00:00
|
|
|
<div class="config-group2">
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.BlackholeDirectory)</div>
|
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.BlackholeDirectory)</div>
|
|
|
|
</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<input type="submit" id="save_button" value="Save" disabled="disabled" />
|
2011-04-27 05:09:24 +00:00
|
|
|
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
</fieldset>
|
|
|
|
}
|
2011-05-13 04:46:26 +00:00
|
|
|
<div id="result" class="hiddenResult"></div>
|
2011-04-25 07:42:29 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
var autoConfigureSabUrl = '@Url.Action("AutoConfigureSab", "Settings")';
|
|
|
|
|
|
|
|
function autoConfigureSab() {
|
|
|
|
$.ajax({
|
2011-05-11 06:46:26 +00:00
|
|
|
type: "GET",
|
2011-04-25 07:42:29 +00:00
|
|
|
url: autoConfigureSabUrl,
|
2011-05-11 06:46:26 +00:00
|
|
|
//data: jQuery.param({ username: $('#SabUsername').val(), password: $('#SabPassword').val() }),
|
2011-04-25 07:42:29 +00:00
|
|
|
error: function (req, status, error) {
|
|
|
|
alert("Sorry! We could not autoconfigure SABnzbd for you");
|
|
|
|
},
|
|
|
|
success: autoConfigureSuccess
|
|
|
|
});
|
|
|
|
|
|
|
|
function autoConfigureSuccess(data) {
|
2011-05-11 06:46:26 +00:00
|
|
|
$('#SabHost').val(data.Host);
|
2011-04-25 07:42:29 +00:00
|
|
|
$('#SabPort').val(data.Port);
|
2011-05-11 06:46:26 +00:00
|
|
|
$('#SabApiKey').val(data.ApiKey);
|
2011-04-25 07:42:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|