|
|
|
@using NzbDrone.Web.Helpers;
|
|
|
|
@model NzbDrone.Web.Models.SabnzbdSettingsModel
|
|
|
|
|
|
|
|
@section HeaderContent{
|
|
|
|
<link rel="stylesheet" type="text/css" href="../../Content/Settings.css" />
|
|
|
|
}
|
|
|
|
|
|
|
|
@section TitleContent{
|
|
|
|
Settings
|
|
|
|
}
|
|
|
|
|
|
|
|
@section ActionMenu{
|
|
|
|
@{Html.RenderPartial("SubMenu");}
|
|
|
|
}
|
|
|
|
|
|
|
|
@section MainContent{
|
|
|
|
<div id="stylized">
|
|
|
|
|
|
|
|
@using (Html.BeginForm("SaveSabnzbd", "Settings", FormMethod.Post, new { id = "form", name = "form", @class = "settingsForm" }))
|
|
|
|
{
|
|
|
|
<h1>SABnzbd</h1>
|
|
|
|
<p></p>
|
|
|
|
|
|
|
|
<label>Auto-Configure
|
|
|
|
<span class="small">If no Username and Password is set and SABnzbd is on the same system as NzbDrone, you cna auto-configure it</span>
|
|
|
|
</label>
|
|
|
|
<input type="button" onclick="autoConfigureSab(); return false;" value="Auto-Configure" />
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabHost)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabHost)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabHost)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabPort)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabPort)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabPort)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabApiKey)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabApiKey)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabApiKey)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabUsername)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabUsername)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabUsername)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabPassword)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabPassword)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabPassword)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabTvCategory)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabTvCategory)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabTvCategory)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabTvPriority)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabTvPriority)</span>
|
|
|
|
</label>
|
|
|
|
@Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList)
|
|
|
|
|
|
|
|
<label>@Html.LabelFor(m => m.SabDropDirectory)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.SabDropDirectory)</span>
|
|
|
|
</label>
|
|
|
|
@Html.TextBoxFor(m => m.SabDropDirectory)
|
|
|
|
|
|
|
|
<button type="submit" id="save_button" >Save</button><img src="../../Content/Images/ajax-loader.gif" alt="Loader" id="saveAjax"/>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="result" class="hiddenResult"></div>
|
|
|
|
}
|
|
|
|
|
|
|
|
@section Scripts{
|
|
|
|
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
|
|
|
<script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
<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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
var options = {
|
|
|
|
target: '#result',
|
|
|
|
beforeSubmit: showRequest,
|
|
|
|
success: showResponse,
|
|
|
|
type: 'post',
|
|
|
|
resetForm: false
|
|
|
|
};
|
|
|
|
$('#form').ajaxForm(options);
|
|
|
|
});
|
|
|
|
|
|
|
|
function showRequest(formData, jqForm, options) {
|
|
|
|
$("#result").empty().html('Saving...');
|
|
|
|
$("#form :input").attr("disabled", true);
|
|
|
|
$('#saveAjax').show();
|
|
|
|
}
|
|
|
|
|
|
|
|
function showResponse(responseText, statusText, xhr, $form) {
|
|
|
|
$("#result").empty().html(responseText);
|
|
|
|
$("#form :input").attr("disabled", false);
|
|
|
|
$('#saveAjax').hide();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
}
|