2011-05-18 05:39:26 +02:00
|
|
|
@using NzbDrone.Web.Helpers;
|
|
|
|
@model NzbDrone.Web.Models.SabnzbdSettingsModel
|
2011-12-10 05:15:38 +01:00
|
|
|
@{ Layout = "~/Views/Shared/_ReferenceLayout.cshtml"; }
|
2011-06-30 07:22:34 +02:00
|
|
|
@section HeaderContent{
|
2011-12-09 05:57:23 +01:00
|
|
|
@Html.IncludeCss("Settings.css")
|
2011-06-30 07:22:34 +02:00
|
|
|
}
|
2011-12-01 06:04:44 +01:00
|
|
|
<div id="stylized">
|
2011-12-01 07:39:11 +01:00
|
|
|
@using (Html.BeginForm("SaveSabnzbd", "Settings", FormMethod.Post, new { id = "SabForm", name = "SabForm", @class = "settingsForm" }))
|
2011-06-30 07:22:34 +02:00
|
|
|
{
|
2011-12-01 06:04:44 +01:00
|
|
|
<label class="labelClass">
|
|
|
|
Auto-Configure <span class="small">If access to SABnzbd doesn't require a username +
|
|
|
|
password and is on the same system as NzbDrone, you can auto-configure it</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-12-01 06:04:44 +01:00
|
|
|
<input type="button" onclick="autoConfigureSab(); return false;" value="Auto-Configure"
|
|
|
|
class="inputClass" />
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabHost)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabHost)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-07-01 11:10:42 +02:00
|
|
|
@Html.TextBoxFor(m => m.SabHost, new { @class = "inputClass" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabPort)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabPort)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-07-01 11:10:42 +02:00
|
|
|
@Html.TextBoxFor(m => m.SabPort, new { @class = "inputClass" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabApiKey)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabApiKey)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-07-01 11:10:42 +02:00
|
|
|
@Html.TextBoxFor(m => m.SabApiKey, new { @class = "inputClass" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabUsername)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabUsername)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-07-01 11:10:42 +02:00
|
|
|
@Html.TextBoxFor(m => m.SabUsername, new { @class = "inputClass" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabPassword)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabPassword)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2012-01-23 19:57:15 +01:00
|
|
|
@Html.TextBoxFor(m => m.SabPassword, new { @class = "inputClass", type = "password" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabTvCategory)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabTvCategory)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-08-26 19:45:59 +02:00
|
|
|
@Html.DropDownListFor(m => m.SabTvCategory, Model.SabTvCategorySelectList, new { @class = "inputClass selectClass" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabTvPriority)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabTvPriority)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-07-01 11:10:42 +02:00
|
|
|
@Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList, new { @class = "inputClass selectClass" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-07-01 11:10:42 +02:00
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.SabDropDirectory)
|
2011-12-01 06:04:44 +01:00
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabDropDirectory)</span>
|
2011-06-30 07:22:34 +02:00
|
|
|
</label>
|
2011-07-28 00:59:48 +02:00
|
|
|
@Html.TextBoxFor(m => m.SabDropDirectory, new { @class = "inputClass folderLookup" })
|
2011-06-30 07:22:34 +02:00
|
|
|
|
2011-12-01 07:39:11 +01:00
|
|
|
<button type="submit" class="save_button" disabled="disabled">
|
2011-12-01 06:04:44 +01:00
|
|
|
Save</button>
|
2011-06-30 07:22:34 +02:00
|
|
|
}
|
2011-12-01 06:04:44 +01:00
|
|
|
</div>
|
|
|
|
<div id="result" class="hiddenResult">
|
|
|
|
</div>
|
2011-06-28 04:24:42 +02:00
|
|
|
@section Scripts{
|
2011-12-01 07:39:11 +01:00
|
|
|
|
2011-06-28 04:24:42 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
var autoConfigureSabUrl = '@Url.Action("AutoConfigureSab", "Settings")';
|
|
|
|
|
|
|
|
function autoConfigureSab() {
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: autoConfigureSabUrl,
|
|
|
|
error: function (req, status, error) {
|
|
|
|
alert("Sorry! We could not autoconfigure SABnzbd for you");
|
|
|
|
},
|
|
|
|
success: autoConfigureSuccess
|
|
|
|
});
|
|
|
|
|
|
|
|
function autoConfigureSuccess(data) {
|
|
|
|
$('#SabHost').val(data.Host);
|
|
|
|
$('#SabPort').val(data.Port);
|
|
|
|
$('#SabApiKey').val(data.ApiKey);
|
|
|
|
}
|
|
|
|
}
|
2011-08-26 19:45:59 +02:00
|
|
|
var sabCategoryUrl = '../Command/GetSabnzbdCategories';
|
|
|
|
|
|
|
|
$('#SabTvCategory').focus(function () {
|
|
|
|
var host = $('#SabHost').val();
|
|
|
|
var port = $('#SabPort').val();
|
|
|
|
var apiKey = $('#SabApiKey').val();
|
|
|
|
var username = $('#SabUsername').val();
|
|
|
|
var password = $('#SabPassword').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: sabCategoryUrl,
|
|
|
|
data: jQuery.param({ host: host, port: port, apiKey: apiKey, username: username, password: password }),
|
|
|
|
error: function (req, status, error) {
|
|
|
|
$.each($('#SabTvCategory option'), function () {
|
|
|
|
$(this).remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#SabTvCategory').append($('<option />').val('tv').text('Please check your SABnzbd Settings'));
|
|
|
|
},
|
|
|
|
success: function (data, textStatus, jqXHR) {
|
|
|
|
//Get the current value
|
|
|
|
var currentlySelected = $('#SabTvCategory').val();
|
|
|
|
|
|
|
|
//Remove all existing options
|
|
|
|
$.each($('#SabTvCategory option'), function () {
|
|
|
|
$(this).remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
//Add the new ones
|
|
|
|
$.each(data.categories, function () {
|
|
|
|
$('#SabTvCategory').append($('<option />').val(this.toString()).text(this.toString()));
|
|
|
|
});
|
|
|
|
|
|
|
|
//Attempt to reset to the preiously selected value (change to lower-case)
|
|
|
|
$("#SabTvCategory").val(currentlySelected.toLowerCase());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2011-06-28 04:24:42 +02:00
|
|
|
</script>
|
|
|
|
}
|