more javascript fixes,

UI is still pretty much fucked.
This commit is contained in:
kay.one 2011-06-27 19:24:42 -07:00
parent 3d961654d8
commit 206144d7e3
9 changed files with 728 additions and 784 deletions

View File

@ -1,27 +1,24 @@
@using NzbDrone.Web.Models
@{
Layout = null;
}
<div>
<fieldset>
<legend>Root Directory</legend>
@{int d = 0;
foreach (var dir in ViewData["RootDirs"] as List<RootDirModel>)
{
<div>
@Html.RadioButton("selectedRootDir", dir.CleanPath, d == 0, new { @class = "dirList examplePart", id = "dirRadio_" + d })
@Html.Label(dir.Path)
@{ d++; }
</div>
}
<div>
@Html.RadioButton("selectedRootDir", dir.CleanPath, d == 0, new { @class = "dirList examplePart", id = "dirRadio_" + d })
@Html.Label(dir.Path)
@{ d++; }
</div>
}
}
</fieldset>
</div>
<br/>
<br />
<div>
@{Html.Telerik().ComboBox()
.Name("seriesList_new")
@ -34,37 +31,38 @@
<button class="listButton" onclick="addNewSeries()">
Add</button>
</div>
@section Scripts{
<script type="text/javascript" language="javascript">
var addNewSeriesUrl = '@Url.Action("AddNewSeries", "AddSeries")';
<script type="text/javascript" language="javascript">
var addNewSeriesUrl = '@Url.Action("AddNewSeries", "AddSeries")';
function addNewSeries() {
var seriesComboBox = $("#seriesList_new").data("tComboBox");
var qualityComboBox = $("#qualityList_new").data("tDropDownList");
var path = $("input[name='selectedRootDir']:checked").val();
function addNewSeries() {
var seriesComboBox = $("#seriesList_new").data("tComboBox");
var qualityComboBox = $("#qualityList_new").data("tDropDownList");
var path = $("input[name='selectedRootDir']:checked").val();
sendToServerNew(seriesComboBox.value(), path, seriesComboBox.text(), qualityComboBox.value());
}
sendToServerNew(seriesComboBox.value(), path, seriesComboBox.text(), qualityComboBox.value());
}
function sendToServerNew(id, rootPath, seriesName, quality) {
$.ajax({
type: "POST",
url: addNewSeriesUrl,
data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }),
error: function (req, status, error) {
alert("Sorry! We could not add " + seriesName + " at this time. " + error);
},
success: function (data, textStatus, jqXHR){
//Clear the search box
$("#seriesList_new").data("tComboBox").text('');
//Through up an alert if we failed to add the series
if (data != 'ok')
alert("Sorry! We could not add " + seriesName + ", does it already exist?");
else
closeAddNewSeries(); //Close the Window!
}
});
}
</script>
function sendToServerNew(id, rootPath, seriesName, quality) {
$.ajax({
type: "POST",
url: addNewSeriesUrl,
data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }),
error: function (req, status, error) {
alert("Sorry! We could not add " + seriesName + " at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
//Clear the search box
$("#seriesList_new").data("tComboBox").text('');
//Through up an alert if we failed to add the series
if (data != 'ok')
alert("Sorry! We could not add " + seriesName + ", does it already exist?");
else
closeAddNewSeries(); //Close the Window!
}
});
}
</script>
}

View File

@ -1,30 +1,18 @@
@model List<RootDir>
@using NzbDrone.Core.Repository
@{ Html.Telerik().ScriptRegistrar().DefaultGroup(group => group
.Add("telerik.common.js")
.Add("telerik.draganddrop.js")
.Add("telerik.window.js")
.Add("telerik.panelbar.js")
.Add("telerik.list.js")
.Add("telerik.combobox.js")); }
<style>
.root_dir_text
{
width: 300px;
margin-top: 8px;
margin-left: 3px;
vertical-align: middle;
}
.root_dir_text
{
width: 300px;
margin-top: 8px;
margin-left: 3px;
vertical-align: middle;
}
</style>
@section TitleContent{
Add Series
Add Series
}
@section MainContent{
@{ Html.Telerik().Window()
.Name("Window")
.Title("Add New Series")
@ -37,8 +25,7 @@
.Resizable(resizing => resizing.Enabled(false))
.LoadContentFrom("AddNew", "AddSeries")
.Render();
}
}
@{ Html.Telerik().PanelBar()
.Name("RootDirPanel")
.HtmlAttributes(new { style = "margin: 0px;" })
@ -51,142 +38,146 @@
.Selected((bool)ViewData["ShowRootDirs"])
.Expanded((bool)ViewData["ShowRootDirs"])
.Content(@<text>
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddRootDir", "AddSeries")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Root Directory</h4></a>
</div>
<div id="root-dirs">
@foreach (var root in Model)
{
Html.RenderAction("GetRootDirView", root);
}
</div>
<button onclick="reloadExistingSeries()" style="padding: 2px 10px 2px 10px; margin: 5px; margin-bottom: 10px;">Refresh Unmapped</button>
<span id="reloadAjax" style="display: none"><img src="../../Content/Images/ajax-loader.gif" width="22px" height="22px" style="margin-bottom: -6px;"/></span>
</div>
</text>);
}).Render();
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddRootDir", "AddSeries")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
<h4 style="margin-left: 3px; display: inline; color: Black;">
Add New Root Directory</h4>
</a>
</div>
<div id="root-dirs">
@foreach (var root in Model)
{
Html.RenderAction("GetRootDirView", root);
}
</div>
<button onclick="reloadExistingSeries()" style="padding: 2px 10px 2px 10px; margin: 5px;
margin-bottom: 10px;">
Refresh Unmapped</button>
<span id="reloadAjax" style="display: none">
<img src="../../Content/Images/ajax-loader.gif" width="22px" height="22px" style="margin-bottom: -6px;" /></span>
</div>
</text>);
}).Render();
}
<div style="padding-bottom: 10px; padding-top: 15px;">
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left:5px">Add New</button>
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes(
new {style = "width: 100px; margin-left:224px;"}).ClientEvents(events => events.OnChange("masterChanged"))
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left: 5px">
Add New</button>
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(
new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged"))
</div>
<div id="existingSeries">
@{ Html.RenderAction("AddExisting", "AddSeries"); }
</div>
}
<script type="text/javascript">
function openAddNewSeries() {
var window = $('#Window').data('tWindow');
window.center().open();
window.refresh();
@section Scripts
{
<script type="text/javascript">
function openAddNewSeries() {
var window = $('#Window').data('tWindow');
window.center().open();
window.refresh();
}
}
function closeAddNewSeries() {
var window = $('#Window').data("tWindow");
window.close();
}
function masterChanged() {
var masterQuality = $('#masterDropbox').data("tDropDownList").value();
var qualityDropbox = $(".qualityDropbox");
function closeAddNewSeries() {
var window = $('#Window').data("tWindow");
window.close();
}
qualityDropbox.each(function () {
var child = $(this).children("[id^='qualityList']");
var comboBox = child.data("tDropDownList");
comboBox.value(masterQuality);
});
}
function masterChanged() {
var masterQuality = $('#masterDropbox').data("tDropDownList").value();
var addSeriesUrl = '@Url.Action("AddSeries", "AddSeries")';
var qualityDropbox = $(".qualityDropbox");
function addSeries(guid, path) {
var seriesComboBox = $("#seriesList_" + guid).data("tComboBox");
var qualityComboBox = $("#qualityList_" + guid).data("tDropDownList");
sendToServer(seriesComboBox.value(), path, qualityComboBox.value());
$("#div_" + guid).hide();
}
qualityDropbox.each(function () {
var child = $(this).children("[id^='qualityList']");
var comboBox = child.data("tDropDownList");
comboBox.value(masterQuality);
});
}
function sendToServer(id, path, quality) {
$.ajax({
type: "POST",
url: addSeriesUrl,
data: jQuery.param({ path: path, seriesId: id, qualityProfileId: quality }),
error: function (req, status, error) {
alert("Sorry! We could not add " + path + " at this time. " + error);
}
});
}
var addSeriesUrl = '@Url.Action("AddSeries", "AddSeries")';
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) { $("#root-dirs").append(html); }
});
return false;
});
function addSeries(guid, path) {
var seriesComboBox = $("#seriesList_" + guid).data("tComboBox");
var qualityComboBox = $("#qualityList_" + guid).data("tDropDownList");
sendToServer(seriesComboBox.value(), path, qualityComboBox.value());
$("#div_" + guid).hide();
}
var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "AddSeries")';
function deleteRootDir(guid) {
var id = $('#id_' + guid).val();
sendDeleteToServer(id, guid);
}
function sendDeleteToServer(id, guid) {
$.ajax({
type: "POST",
url: deleteRootDirUrl,
data: jQuery.param({ rootDirId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Root Directory at this time. " + error);
},
success: function () {
$("#rootDir_" + guid).remove();
}
});
}
var saveRootDirUrl = '@Url.Action("SaveRootDir", "AddSeries")';
function saveRootDir(guid) {
var path = $("#path_" + guid).data("tComboBox").value();
var id = $("#id_" + guid).val();
$.ajax({
type: "POST",
url: saveRootDirUrl,
data: jQuery.param({ id: id, path: path }),
error: function (req, status, error) {
alert("Sorry! We could not save " + path + " at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data == 'failed')
alert("An error occurred while saving Root Directory: " + path);
else {
$("#id_" + guid).val(data);
function sendToServer(id, path, quality) {
$.ajax({
type: "POST",
url: addSeriesUrl,
data: jQuery.param({ path: path, seriesId: id, qualityProfileId: quality }),
error: function (req, status, error) {
alert("Sorry! We could not add " + path + " at this time. " + error);
}
}
});
}
});
}
function reloadExistingSeries() {
$('#reloadAjax').show();
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")',
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) { $("#root-dirs").append(html); }
});
return false;
});
var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "AddSeries")';
function deleteRootDir(guid) {
var id = $('#id_' + guid).val();
sendDeleteToServer(id, guid);
}
function sendDeleteToServer(id, guid) {
$.ajax({
type: "POST",
url: deleteRootDirUrl,
data: jQuery.param({ rootDirId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Root Directory at this time. " + error);
},
success: function () {
$("#rootDir_" + guid).remove();
}
});
}
var saveRootDirUrl = '@Url.Action("SaveRootDir", "AddSeries")';
function saveRootDir(guid) {
var path = $("#path_" + guid).data("tComboBox").value();
var id = $("#id_" + guid).val();
$.ajax({
type: "POST",
url: saveRootDirUrl,
data: jQuery.param({ id: id, path: path }),
error: function (req, status, error) {
alert("Sorry! We could not save " + path + " at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data == 'failed')
alert("An error occurred while saving Root Directory: " + path);
else {
$("#id_" + guid).val(data);
}
}
});
}
function reloadExistingSeries() {
$('#reloadAjax').show();
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")',
function (responseText, textStatus, XMLHttpRequest) {
$('#reloadAjax').hide();
});
}
</script>
}
</script>
}

View File

@ -1,37 +1,36 @@
@using NzbDrone.Web.Models;
@model List<SeasonEditModel>
@{
Layout = null;
}
<div style="vertical-align: middle">
@foreach (var season in Model)
{
Html.RenderAction("GetSingleSeasonView", "Series", season);
}
</div>
@section Scripts{
<script type="text/javascript">
var lastChecked = null;
<script type="text/javascript">
var lastChecked = null;
$(document).ready(function () {
$('.chkbox').click(function (event) {
if (!lastChecked) {
lastChecked = this;
return;
}
if (event.shiftKey) {
var start = $('.chkbox').index(this);
var end = $('.chkbox').index(lastChecked);
for (i = Math.min(start, end); i <= Math.max(start, end); i++) {
$('.chkbox')[i].checked = lastChecked.checked;
$(document).ready(function () {
$('.chkbox').click(function (event) {
if (!lastChecked) {
lastChecked = this;
return;
}
}
lastChecked = this;
if (event.shiftKey) {
var start = $('.chkbox').index(this);
var end = $('.chkbox').index(lastChecked);
for (i = Math.min(start, end); i <= Math.max(start, end); i++) {
$('.chkbox')[i].checked = lastChecked.checked;
}
}
lastChecked = this;
});
});
});
</script>
</script>
}

View File

@ -1,253 +1,242 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeSortingModel
<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', '');
createExamples();
});
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("SaveEpisodeSorting", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
{
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")
<fieldset>
<legend>Episode Sorting</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeriesName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.SeriesName)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeriesName)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeriesName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeriesName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.SeriesName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.EpisodeName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.EpisodeName)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.EpisodeName)</div>
<div class="config-description">@Html.DescriptionFor(m => m.EpisodeName)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeriesName)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeriesName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.ReplaceSpaces)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.ReplaceSpaces)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.ReplaceSpaces)</div>
<div class="config-description">@Html.DescriptionFor(m => m.ReplaceSpaces)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.EpisodeName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.EpisodeName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.AppendQuality)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.AppendQuality)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.AppendQuality)</div>
<div class="config-description">@Html.DescriptionFor(m => m.AppendQuality)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.EpisodeName)</div>
<div class="config-description">@Html.DescriptionFor(m => m.EpisodeName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolders)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.SeasonFolders)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolders)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeasonFolders)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.ReplaceSpaces)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.ReplaceSpaces)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolderFormat)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SeasonFolderFormat)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolderFormat)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeasonFolderFormat)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.ReplaceSpaces)</div>
<div class="config-description">@Html.DescriptionFor(m => m.ReplaceSpaces)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeparatorStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeparatorStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeparatorStyle)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.AppendQuality)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.AppendQuality)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.NumberStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.NumberStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.NumberStyle)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.AppendQuality)</div>
<div class="config-description">@Html.DescriptionFor(m => m.AppendQuality)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.MultiEpisodeStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.MultiEpisodeStyle)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolders)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.SeasonFolders)</div>
</div>
<div id="singleEpisodeExample"></div>
<div id="multiEpisodeExample"></div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolders)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeasonFolders)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolderFormat)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SeasonFolderFormat)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolderFormat)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeasonFolderFormat)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeparatorStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeparatorStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeparatorStyle)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.NumberStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.NumberStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.NumberStyle)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.MultiEpisodeStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.MultiEpisodeStyle)</div>
</div>
</div>
<div id="singleEpisodeExample">
</div>
<div id="multiEpisodeExample">
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<div id="result" class="hiddenResult">
</div>
@section Scripts{
<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', '');
createExamples();
});
<script type="text/javascript">
$('#SeriesName').live('change', function () { createExamples(); });
$('#EpisodeName').live('change', function () { createExamples(); });
$('#ReplaceSpaces').live('change', function () { createExamples(); });
$('#AppendQuality').live('change', function () { createExamples(); });
$('#SeparatorStyle').live('change', function () { createExamples(); });
$('#NumberStyle').live('change', function () { createExamples(); });
$('#MultiEpisodeStyle').live('change', function () { createExamples(); });
function createExamples() {
createSingleEpisodeExample();
createMultiEpisodeExample();
}
function createSingleEpisodeExample() {
var result = '';
var separator = ' - ';
if ($("#SeparatorStyle option:selected").val() == 1)
separator = ' ';
if ($('#SeriesName').attr('checked')) {
result += 'Series Name';
result += separator;
}
result += $("#NumberStyle option:selected").text();
if ($('#EpisodeName').attr('checked')) {
result += separator;
result += 'Episode Name';
function showRequest(formData, jqForm, options) {
$("#result").empty().html('Saving...');
$("#form :input").attr("disabled", true);
}
if ($('#AppendQuality').attr('checked'))
result += ' [TV]';
if ($('#ReplaceSpaces').attr('checked'))
result = result.replace(/\s/g, '.');
result = '<b>Single Episode Example: </b>' + result;
$('#singleEpisodeExample').html(result);
}
function createMultiEpisodeExample() {
var result = '';
var separator = ' - ';
if ($("#SeparatorStyle option:selected").val() == 1)
separator = ' ';
if ($('#SeriesName').attr('checked')) {
result += 'Series Name';
result += separator;
}
var numberStyle = $("#NumberStyle option:selected").text();
var numberId = $("#NumberStyle option:selected").val();
var style = $("#MultiEpisodeStyle option:selected").val();
result += numberStyle;
if (style == 0)
result += '-06';
if (style == 1) {
result += separator;
result += numberStyle.replace('5', '6');
}
if (style == 2) {
if (numberId <= 1)
result += 'x06';
if (numberId == 2)
result += 'E06';
if (numberId == 3)
result += 'e06';
function showResponse(responseText, statusText, xhr, $form) {
$("#result").empty().html(responseText);
$("#form :input").attr("disabled", false);
}
if (style == 3) {
if (numberId <= 1)
result += '-x06';
$('#SeriesName').live('change', function () { createExamples(); });
$('#EpisodeName').live('change', function () { createExamples(); });
$('#ReplaceSpaces').live('change', function () { createExamples(); });
$('#AppendQuality').live('change', function () { createExamples(); });
$('#SeparatorStyle').live('change', function () { createExamples(); });
$('#NumberStyle').live('change', function () { createExamples(); });
$('#MultiEpisodeStyle').live('change', function () { createExamples(); });
if (numberId == 2)
result += '-E06';
if (numberId == 3)
result += '-e06';
function createExamples() {
createSingleEpisodeExample();
createMultiEpisodeExample();
}
if ($('#EpisodeName').attr('checked')) {
result += separator;
result += 'Episode Name';
function createSingleEpisodeExample() {
var result = '';
var separator = ' - ';
if ($("#SeparatorStyle option:selected").val() == 1)
separator = ' ';
if ($('#SeriesName').attr('checked')) {
result += 'Series Name';
result += separator;
}
result += $("#NumberStyle option:selected").text();
if ($('#EpisodeName').attr('checked')) {
result += separator;
result += 'Episode Name';
}
if ($('#AppendQuality').attr('checked'))
result += ' [TV]';
if ($('#ReplaceSpaces').attr('checked'))
result = result.replace(/\s/g, '.');
result = '<b>Single Episode Example: </b>' + result;
$('#singleEpisodeExample').html(result);
}
if ($('#AppendQuality').attr('checked'))
result += ' [TV]';
function createMultiEpisodeExample() {
var result = '';
if ($('#ReplaceSpaces').attr('checked'))
result = result.replace(/\s/g, '.');
var separator = ' - ';
result = '<b>Multi-Episode Example: </b>' + result;
if ($("#SeparatorStyle option:selected").val() == 1)
separator = ' ';
$('#multiEpisodeExample').html(result);
}
</script>
if ($('#SeriesName').attr('checked')) {
result += 'Series Name';
result += separator;
}
var numberStyle = $("#NumberStyle option:selected").text();
var numberId = $("#NumberStyle option:selected").val();
var style = $("#MultiEpisodeStyle option:selected").val();
result += numberStyle;
if (style == 0)
result += '-06';
if (style == 1) {
result += separator;
result += numberStyle.replace('5', '6');
}
if (style == 2) {
if (numberId <= 1)
result += 'x06';
if (numberId == 2)
result += 'E06';
if (numberId == 3)
result += 'e06';
}
if (style == 3) {
if (numberId <= 1)
result += '-x06';
if (numberId == 2)
result += '-E06';
if (numberId == 3)
result += '-e06';
}
if ($('#EpisodeName').attr('checked')) {
result += separator;
result += 'Episode Name';
}
if ($('#AppendQuality').attr('checked'))
result += ' [TV]';
if ($('#ReplaceSpaces').attr('checked'))
result = result.replace(/\s/g, '.');
result = '<b>Multi-Episode Example: </b>' + result;
$('#multiEpisodeExample').html(result);
}
</script>
}

View File

@ -1,28 +1,5 @@
@model NzbDrone.Web.Models.IndexerSettingsModel
<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>
<style>
@ -193,4 +170,32 @@
</div>
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<div id="result" class="hiddenResult"></div>
@section Scripts{
<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>
}

View File

@ -1,161 +1,136 @@
@model NzbDrone.Web.Models.NotificationSettingsModel
<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("SaveNotifications", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
@using (Html.BeginForm("SaveNotifications", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
{
<fieldset>
<legend>Notification Settings</legend>
<fieldset class="sub-field">
<legend>XBMC</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcEnabled)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcEnabled)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcEnabled)</div>
<legend>Notification Settings</legend>
<fieldset class="sub-field">
<legend>XBMC</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcEnabled)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcEnabled)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnGrab)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnGrab)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnGrab)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcEnabled)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnGrab)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnGrab)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnDownload)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnDownload)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnGrab)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnRename)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnRename)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotificationImage)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotificationImage)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotificationImage)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotificationImage)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotificationImage)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcDisplayTime)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcDisplayTime)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcDisplayTime)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotificationImage)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcDisplayTime)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcDisplayTime)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUpdateOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcUpdateOnDownload)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUpdateOnDownload)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcDisplayTime)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUpdateOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcUpdateOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUpdateOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcUpdateOnRename)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUpdateOnRename)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUpdateOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUpdateOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcUpdateOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcFullUpdate)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcFullUpdate)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcFullUpdate)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUpdateOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcFullUpdate)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcFullUpdate)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcCleanOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcCleanOnDownload)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcCleanOnDownload)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcFullUpdate)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcCleanOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcCleanOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcCleanOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcCleanOnRename)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcCleanOnRename)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcCleanOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcCleanOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcCleanOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcHosts)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcHosts)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcHosts)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcCleanOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcHosts)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcHosts)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUsername)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcUsername)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUsername)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcHosts)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUsername)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcUsername)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcPassword)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcPassword)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcPassword)</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUsername)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcPassword)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcPassword)</div>
</div>
</fieldset>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcPassword)</div>
</div>
</fieldset>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<div id="result" class="hiddenResult">
</div>
@section Scripts{
<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>
}

View File

@ -1,122 +1,121 @@
@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.QualityModel
<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);
}
function addOption(text, value) {
var myCombo = $('#DefaultQualityProfileId');
var exists = $("#DefaultQualityProfileId option[value='" + value + "']");
if (exists.length == 0)
myCombo.append($('\<option\> \</option\>').val(value).html(text));
}
function removeOption(value) {
$("#DefaultQualityProfileId option[value='" + value + "']").remove();
}
function renameOption(text, value) {
$("#DefaultQualityProfileId option[value='" + value + "']").html(text);
}
</script>
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
{
<fieldset style="position: relative;">
<legend>Quality</legend>
<div id="top">
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.DefaultQualityProfileId)</div>
<div class="config-value">@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)</div>
<div class="config-description">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</div>
</div>
</div>
<fieldset style="position: relative;">
<legend>Quality</legend>
<div id="top">
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.DefaultQualityProfileId)</div>
<div class="config-value">@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList)</div>
</div>
<div id="bottom" style="float: left; padding-bottom: 55px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddProfile", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a>
</div>
<div id="profiles">
@foreach (var item in Model.Profiles)
{
Html.RenderAction("GetQualityProfileView", item);
}
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)</div>
<div class="config-description">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</div>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" style="position: absolute; bottom: 0px; display: block; padding-left: 5px;"/>
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<script type="text/javascript">
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) {
$("#profiles").append(html);
}
});
return false;
});
var deleteQualityProfileUrl = '@Url.Action("DeleteQualityProfile", "Settings")';
function deleteProfile(id) {
sendToServer(id);
}
function sendToServer(id) {
$.ajax({
type: "POST",
url: deleteQualityProfileUrl,
data: jQuery.param({ profileId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Profile at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data == "ok") {
$("#profile_" + id).remove();
removeOption(id);
</div>
</div>
<div id="bottom" style="float: left; padding-bottom: 55px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddProfile", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
<h4 style="margin-left: 3px; display: inline; color: Black;">
Add New Profile</h4>
</a>
</div>
<div id="profiles">
@foreach (var item in Model.Profiles)
{
Html.RenderAction("GetQualityProfileView", item);
}
else {
alert(data);
}
}
</div>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" style="position: absolute;
bottom: 0px; display: block; padding-left: 5px;" />
</fieldset>
}
<div id="result" class="hiddenResult">
</div>
@section Scripts{
<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', '');
});
}
</script>
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);
}
function addOption(text, value) {
var myCombo = $('#DefaultQualityProfileId');
var exists = $("#DefaultQualityProfileId option[value='" + value + "']");
if (exists.length == 0)
myCombo.append($('\<option\> \</option\>').val(value).html(text));
}
function removeOption(value) {
$("#DefaultQualityProfileId option[value='" + value + "']").remove();
}
function renameOption(text, value) {
$("#DefaultQualityProfileId option[value='" + value + "']").html(text);
}
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) {
$("#profiles").append(html);
}
});
return false;
});
var deleteQualityProfileUrl = '@Url.Action("DeleteQualityProfile", "Settings")';
function deleteProfile(id) {
sendToServer(id);
}
function sendToServer(id) {
$.ajax({
type: "POST",
url: deleteQualityProfileUrl,
data: jQuery.param({ profileId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Profile at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data == "ok") {
$("#profile_" + id).remove();
removeOption(id);
}
else {
alert(data);
}
}
});
}
</script>
}

View File

@ -1,48 +1,21 @@
@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>
<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-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>
@ -53,7 +26,6 @@
<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>
@ -64,7 +36,6 @@
<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>
@ -75,7 +46,6 @@
<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>
@ -86,7 +56,6 @@
<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>
@ -97,7 +66,6 @@
<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>
@ -108,48 +76,71 @@
<div class="config-description">@Html.DescriptionFor(m => m.SabTvPriority)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabDropDirectory)</div>
<div class="config-value">@{Html.Telerik().ComboBoxFor(m => m.SabDropDirectory)
<div class="config-value">
@{Html.Telerik().ComboBoxFor(m => m.SabDropDirectory)
.BindTo(Model.SabDropDirectorySelectList)
.DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(false))
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith))
.HighlightFirstMatch(true)
.HtmlAttributes(new { style = "margin-left: -2px; width: 220px;" })
.Render();}</div>
.Render();}
</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabDropDirectory)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SabDropDirectory)</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")';
<div id="result" class="hiddenResult">
</div>
@section Scripts{
<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 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);
$('#save_button').attr('disabled', '');
});
function autoConfigureSuccess(data) {
$('#SabHost').val(data.Host);
$('#SabPort').val(data.Port);
$('#SabApiKey').val(data.ApiKey);
function showRequest(formData, jqForm, options) {
$("#result").empty().html('Saving...');
$("#form :input").attr("disabled", true);
}
}
</script>
function showResponse(responseText, statusText, xhr, $form) {
$("#result").empty().html(responseText);
$("#form :input").attr("disabled", false);
}
</script>
}

View File

@ -51,26 +51,23 @@
<div id="msgBox">
<span id="msgText">Scanning Series Folder...</span>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js" />
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.common.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.textbox.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.grid.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.grid.filtering.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.grid.grouping.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.tabstrip.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.panelbar.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.list.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.combobox.min.js" />
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/mvcz/2011.1.414/telerik.menu.min.js" />
<script type="text/javascript" src="/Scripts/jquery-tgc-countdown-1.0.js" />
<script type="text/javascript" src="/Scripts/jquery.form.js" />
<script type="text/javascript" src="/Scripts/jquery.jgrowl.js" />
<script type="text/javascript" src="/Scripts/Notification.js" />
<script type="text/javascript" src="/Scripts/MicrosoftMvcValidation.js" />
<script type="text/javascript" src="/Scripts/episodeSearch.js" />
@(Html.Telerik().ScriptRegistrar().jQuery(true).Scripts(
c => c.AddGroup("CDN", group => group
.Add("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js")
.Add("http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"))
.AddGroup("3rdParty", group => group
.Add("jquery.form.js")
.Add("jquery.jgrowl.js")
.Add("jquery-tgc-countdown-1.0.js")
.Add("MicrosoftMvcValidation.js").Combined(true).Compress(true))
.AddGroup("NzbDrone", group => group
.Add("Notification.js")
.Add("gridLoad.js")
.Add("episodeSearch.js"))
))
<script type="text/javascript">
jQuery(document).ready(function () {