You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml

137 lines
5.5 KiB

@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.SabnzbdSettingsModel
<script type="text/javascript">
$(document).ready(function () {
var options = {
target: '#result',
beforeSubmit: showRequest,
success: showResponse,
type: 'post',
resetForm: false
};
$('#form').ajaxForm(options);
$('#save_button').attr('disabled', '');
});
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);
}
</script>
@using (Html.BeginForm("SaveSabnzbd", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
{
<fieldset>
<legend>SABnzbd</legend>
<button type="button" onclick="autoConfigureSab()">Auto-Configure</button>
<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>
<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>
</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>
<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>
</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>
<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>
</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>
<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>
</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>
<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>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabTvCategory)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabTvCategory)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabTvCategory)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SabTvCategory)</div>
</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>
<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>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<script type="text/javascript">
var autoConfigureSabUrl = '@Url.Action("AutoConfigureSab", "Settings")';
function autoConfigureSab() {
$.ajax({
type: "GET",
url: autoConfigureSabUrl,
//data: jQuery.param({ username: $('#SabUsername').val(), password: $('#SabPassword').val() }),
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);
}
}
</script>