Lidarr/NzbDrone.Web/Views/Settings/Indexers.cshtml

266 lines
12 KiB
Plaintext
Raw Normal View History

2011-07-01 20:33:03 +00:00
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.IndexerSettingsModel
@{ Layout = null; }
<style>
.indexerStatusContainer {
margin-left: 14px;
}
</style>
<div class="infoBox">
RSS feeds are checked every 25 minutes for new episodes.</div>
<div class="indexerStatusContainer">
@Html.CheckBox("nzbsOrgStatus", @Model.NzbsOrgEnabled, new{ @class = "indexerStatusButton" })
<label for="nzbsOrgStatus">Nzbs.Org</label>
@Html.CheckBox("nzbMatrixStatus", @Model.NzbMatrixEnabled, new { @class = "indexerStatusButton" })
<label for="nzbMatrixStatus">NZBMatrix</label>
@Html.CheckBox("nzbsRusStatus", @Model.NzbsRUsEnabled, new { @class = "indexerStatusButton" })
<label for="nzbsRusStatus">NZBsRus</label>
@Html.CheckBox("newzbinStatus", @Model.NewzbinEnabled, new { @class = "indexerStatusButton" })
<label for="newzbinStatus">Newzbin</label>
@Html.CheckBox("newznabStatus", @Model.NewznabEnabled, new { @class = "indexerStatusButton" })
<label for="newznabStatus">Newznab</label>
</div>
<div id="stylized">
2011-12-01 06:39:11 +00:00
@using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "IndexersForm", name = "IndexersForm", @class = "settingsForm" }))
{
<div class="jquery-accordion">
<h3>
<a href="#">NZBs.org</a></h3>
<div class="indexerPanel">
<label class="labelClass">
Enable <span class="small">@Html.DescriptionFor(m => m.NzbsOrgEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "inputClass checkClass enabledCheck" })
<label class="labelClass">@Html.LabelFor(m => m.NzbsOrgUId)
<span class="small">@Html.DescriptionFor(m => m.NzbsOrgUId)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NzbsOrgUId)</span>
</label>
@Html.TextBoxFor(m => m.NzbsOrgUId, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.NzbsOrgHash)
<span class="small">@Html.DescriptionFor(m => m.NzbsOrgHash)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NzbsOrgHash)</span>
</label>
@Html.TextBoxFor(m => m.NzbsOrgHash, new { @class = "inputClass" })
</div>
<h3>
<a href="#">NZBMatrix</a></h3>
<div class="indexerPanel">
<label class="labelClass">
Enable <span class="small">@Html.DescriptionFor(m => m.NzbMatrixEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "inputClass checkClass enabledCheck" })
<label class="labelClass">@Html.LabelFor(m => m.NzbMatrixUsername)
<span class="small">@Html.DescriptionFor(m => m.NzbMatrixUsername)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NzbMatrixUsername)</span>
</label>
@Html.TextBoxFor(m => m.NzbMatrixUsername, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.NzbMatrixApiKey)
<span class="small">@Html.DescriptionFor(m => m.NzbMatrixApiKey)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NzbMatrixApiKey)</span>
</label>
@Html.TextBoxFor(m => m.NzbMatrixApiKey, new { @class = "inputClass" })
</div>
<h3>
<a href="#">NZBsRus</a></h3>
<div class="indexerPanel">
<div class="warningBox">
NZBsRus does not support backlog searching</div>
<label class="labelClass">
Enable <span class="small">@Html.DescriptionFor(m => m.NzbsRUsEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "inputClass checkClass enabledCheck" })
<label class="labelClass">@Html.LabelFor(m => m.NzbsrusUId)
<span class="small">@Html.DescriptionFor(m => m.NzbsrusUId)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NzbsrusUId)</span>
</label>
@Html.TextBoxFor(m => m.NzbsrusUId, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.NzbsrusHash)
<span class="small">@Html.DescriptionFor(m => m.NzbsrusHash)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NzbsrusHash)</span>
</label>
@Html.TextBoxFor(m => m.NzbsrusHash, new { @class = "inputClass" })
</div>
<h3>
<a href="#">Newzbin</a></h3>
<div class="indexerPanel">
<label class="labelClass">
Enable <span class="small">@Html.DescriptionFor(m => m.NewzbinEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "inputClass checkClass enabledCheck" })
<label class="labelClass">@Html.LabelFor(m => m.NewzbinUsername)
<span class="small">@Html.DescriptionFor(m => m.NewzbinUsername)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NewzbinUsername)</span>
</label>
@Html.TextBoxFor(m => m.NewzbinUsername, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.NewzbinPassword)
<span class="small">@Html.DescriptionFor(m => m.NewzbinPassword)</span>
<span class="small">@Html.ValidationMessageFor(m => m.NewzbinPassword)</span>
</label>
@Html.TextBoxFor(m => m.NewzbinPassword, new { @class = "inputClass", type = "password" })
</div>
<h3>
<a href="#">Newznab</a></h3>
<div class="indexerPanel">
<label class="labelClass">
Enable <span class="small">@Html.DescriptionFor(m => m.NewznabEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NewznabEnabled, new { @class = "inputClass checkClass enabledCheck" })
<br />
<br />
<p>
</p>
<a id="addNewznab" href="@Url.Action("AddNewznabProvider", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add Newznab Provider" width="20px"
height="20px" />
Add Newznab Provider</a>
<div id="newznabProviders">
@foreach (var provider in Model.NewznabDefinitions)
{
Html.RenderAction("GetNewznabProviderView", provider);
}
</div>
</div>
</div>
<div class="retentionContainer">
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")
<label class="labelClass">@Html.LabelFor(m => m.Retention)
<span class="small">@Html.DescriptionFor(m => m.Retention)</span>
2012-02-25 21:21:41 +00:00
<span class="small">@Html.ValidationMessageFor(m => m.Retention)</span>
</label>
@Html.TextBoxFor(m => m.Retention, new { @class = "inputClass" })
</div>
<button type="submit" class="save_button" disabled="disabled">Save</button>
}
</div>
<script type="text/javascript">
$(document).ready(function () {
//Allow unobstrusive validation of the AJAX loaded form
$.validator.unobtrusive.parse("#IndexersForm");
//Make the buttons
$('.indexerStatusButton').button();
//Validator Settings
var settings = $.data($('#IndexersForm')[0], 'validator').settings;
settings.ignore = [];
settings.focusInvalid = false;
settings.onfocusout = function (element) { $(element).valid(); };
var oldHighlight = settings.highlight;
var oldUnhighlight = settings.unhighlight;
settings.highlight = function (element, errorClass, validClass) {
oldHighlight(element, errorClass, validClass);
2012-02-25 21:21:41 +00:00
$(element).parents('div.ui-accordion-content').prev('h3.ui-accordion-header').addClass('validation-error');
};
settings.unhighlight = function (element, errorClass, validClass) {
oldUnhighlight(element, errorClass, validClass);
2012-02-25 21:21:41 +00:00
var container = $(element).parents('div.ui-accordion-content');
if ($(container).children('.' + errorClass).length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
};
});
2012-02-25 21:21:41 +00:00
$(document).on('change', '.enabledCheck', function () {
var id = $(this).prop('id');
var checked = $(this).prop('checked');
if (id == 'NzbsOrgEnabled')
$('#nzbsOrgStatus').prop('checked', checked);
if (id == 'NzbMatrixEnabled')
$('#nzbMatrixStatus').prop('checked', checked);
if (id == 'NzbsRUsEnabled')
$('#nzbsRusStatus').prop('checked', checked);
if (id == 'NewzbinEnabled')
$('#newzbinStatus').prop('checked', checked);
if (id == 'NewznabEnabled')
$('#newznabStatus').prop('checked', checked);
$('.indexerStatusButton').button("refresh");
reValidate();
});
2012-02-25 21:21:41 +00:00
$(document).on('change', '.indexerStatusButton', function () {
var id = $(this).prop('id');
var checked = $(this).prop('checked');
if (id == 'nzbsOrgStatus')
$('#NzbsOrgEnabled').prop('checked', checked);
if (id == 'nzbMatrixStatus')
$('#NzbMatrixEnabled').prop('checked', checked);
if (id == 'nzbsRusStatus')
$('#NzbsRUsEnabled').prop('checked', checked);
if (id == 'newzbinStatus')
$('#NewzbinEnabled').prop('checked', checked);
if (id == 'newznabStatus')
$('#NewznabEnabled').prop('checked', checked);
reValidate();
});
function reValidate() {
$("#IndexersForm").validate().form();
2012-02-25 21:21:41 +00:00
var container = $('div.ui-accordion-content');
if ($(container).children('.input-validation-error').length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
}
//Newznab
$("#addNewznab").on('click', function (event) {
$.ajax({
url: this.href,
cache: false,
success: function (html) {
$("#newznabProviders").append(html);
}
});
event.preventDefault();
//event.stopPropagation();
});
var deleteNewznabProviderUrl = '@Url.Action("DeleteNewznabProvider", "Settings")';
function deleteProvider(id) {
$.ajax({
type: "POST",
url: deleteNewznabProviderUrl,
data: jQuery.param({ providerId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Provider at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
$("#provider_" + id).remove();
}
});
}
function getProviderId(obj) {
var parentProviderSection = $(obj).parents('.providerSection');
return parentProviderSection.children('.newznabProviderId').val();
}
$(".providerName_textbox").on('keyup', function () {
var value = $(this).val();
var profileId = getProviderId(this);
$("#title_" + profileId).text(value);
}).keyup();
</script>