2011-11-29 08:10:43 +03:00
|
|
|
@using NzbDrone.Core.Repository.Quality
|
|
|
|
@using NzbDrone.Web.Helpers;
|
2011-05-18 06:39:26 +03:00
|
|
|
@model NzbDrone.Web.Models.QualityModel
|
2011-12-01 08:04:44 +03:00
|
|
|
@{ Layout = "~/Views/Shared/_RefrenceLayout.cshtml"; }
|
2011-06-30 08:22:34 +03:00
|
|
|
@section HeaderContent{
|
2011-11-11 22:24:51 +03:00
|
|
|
<link rel="stylesheet" type="text/css" href="../../Content/Settings.css" />
|
|
|
|
<link href="../../Content/QualitySettings.css" rel="stylesheet" type="text/css" />
|
2011-06-30 08:22:34 +03:00
|
|
|
}
|
2011-12-01 08:04:44 +03:00
|
|
|
<div id="stylized">
|
2011-12-01 09:39:11 +03:00
|
|
|
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "QualityForm", name = "QualityForm" }))
|
2011-12-01 08:04:44 +03:00
|
|
|
{
|
|
|
|
<div id="top" class="settingsForm">
|
|
|
|
<label class="labelClass">@Html.LabelFor(m => m.DefaultQualityProfileId)
|
|
|
|
<span class="small">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</span>
|
|
|
|
</label>
|
|
|
|
@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList, new { @class = "inputClass" })
|
2011-12-08 11:19:07 +03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="jquery-accordion">
|
|
|
|
<h3><a href="#">Sizes</a></h3>
|
2011-12-01 08:04:44 +03:00
|
|
|
<div class="sliders">
|
|
|
|
<div class="slider-container">
|
|
|
|
<b>SDTV</b>
|
|
|
|
<div id="sdtv-slider" class="slider">
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
@Html.HiddenFor(m => m.SdtvMaxSize, new { @class = "slider-value" })
|
|
|
|
30 minute size: <span class="30-minute"></span>| 60 minute size: <span class="60-minute">
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="slider-container">
|
|
|
|
<b>DVD</b>
|
|
|
|
<div id="dvd-slider" class="slider">
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
@Html.HiddenFor(m => m.DvdMaxSize, new { @class = "slider-value" })
|
|
|
|
30 minute size: <span class="30-minute"></span>| 60 minute size: <span class="60-minute">
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="slider-container">
|
|
|
|
<b>HDTV</b>
|
|
|
|
<div id="hdtv-slider" class="slider">
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
@Html.HiddenFor(m => m.HdtvMaxSize, new { @class = "slider-value" })
|
|
|
|
30 minute size: <span class="30-minute"></span>| 60 minute size: <span class="60-minute">
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="slider-container">
|
|
|
|
<b>WEBDL</b>
|
|
|
|
<div id="webdl-slider" class="slider">
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
@Html.HiddenFor(m => m.WebdlMaxSize, new { @class = "slider-value" })
|
|
|
|
30 minute size: <span class="30-minute"></span>| 60 minute size: <span class="60-minute">
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="slider-container">
|
|
|
|
<b>Bluray 720p</b>
|
|
|
|
<div id="bluray720p-slider" class="slider">
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
@Html.HiddenFor(m => m.Bluray720pMaxSize, new { @class = "slider-value" })
|
|
|
|
30 minute size: <span class="30-minute"></span>| 60 minute size: <span class="60-minute">
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="slider-container">
|
|
|
|
<b>Bluray 1080p</b>
|
|
|
|
<div id="bluray1080p-slider" class="slider">
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
@Html.HiddenFor(m => m.Bluray1080pMaxSize, new { @class = "slider-value" })
|
|
|
|
30 minute size: <span class="30-minute"></span>| 60 minute size: <span class="60-minute">
|
|
|
|
</span>
|
2011-09-16 07:42:30 +03:00
|
|
|
</div>
|
2011-06-28 05:24:42 +03:00
|
|
|
</div>
|
2011-12-08 11:19:07 +03:00
|
|
|
<h3><a href="#">Profiles</a></h3>
|
2011-12-01 08:04:44 +03:00
|
|
|
<div id="profileContainer">
|
|
|
|
<div id="profileHeader">
|
|
|
|
<a id="addItem" href="@Url.Action("AddProfile", "Settings")">
|
|
|
|
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
|
|
|
|
Add New Profile</a>
|
|
|
|
</div>
|
|
|
|
<div id="profiles">
|
|
|
|
@foreach (var item in (List<QualityProfile>)ViewData["Profiles"])
|
|
|
|
{
|
|
|
|
Html.RenderAction("GetQualityProfileView", item);
|
|
|
|
}
|
2011-07-01 12:10:42 +03:00
|
|
|
</div>
|
2011-06-28 05:24:42 +03:00
|
|
|
</div>
|
2011-12-01 08:04:44 +03:00
|
|
|
</div>
|
2011-12-08 11:19:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<button type="submit" class="save_button" disabled="disabled">Save</button>
|
2011-12-01 08:04:44 +03:00
|
|
|
}
|
|
|
|
</div>
|
2011-06-30 08:22:34 +03:00
|
|
|
@section Scripts{
|
2011-11-11 05:56:33 +03:00
|
|
|
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
2011-12-01 09:39:11 +03:00
|
|
|
|
2011-06-30 08:22:34 +03:00
|
|
|
<script type="text/javascript">
|
2011-11-29 08:10:43 +03:00
|
|
|
var deleteQualityProfileUrl = '@Url.Action("DeleteQualityProfile", "Settings")';
|
|
|
|
|
2011-12-08 11:19:07 +03:00
|
|
|
$('.quality-selectee').livequery(function () {
|
|
|
|
$(this).button();
|
|
|
|
});
|
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
$(document).ready(function () {
|
|
|
|
setupSliders();
|
|
|
|
});
|
|
|
|
|
2011-07-01 23:44:29 +03:00
|
|
|
$("#addItem").live('click', function () {
|
2011-06-28 05:24:42 +03:00
|
|
|
$.ajax({
|
|
|
|
url: this.href,
|
|
|
|
cache: false,
|
|
|
|
success: function (html) {
|
|
|
|
$("#profiles").append(html);
|
2011-02-05 20:27:14 +02:00
|
|
|
|
2011-06-28 05:24:42 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
2011-02-05 20:27:14 +02:00
|
|
|
});
|
2011-04-22 03:30:19 +03:00
|
|
|
|
2011-06-28 05:24:42 +03:00
|
|
|
function deleteProfile(id) {
|
|
|
|
sendToServer(id);
|
|
|
|
}
|
|
|
|
|
2011-07-01 23:33:03 +03:00
|
|
|
function renameOption(text, value) {
|
|
|
|
$("#DefaultQualityProfileId option[value='" + value + "']").html(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2011-06-28 05:24:42 +03:00
|
|
|
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);
|
|
|
|
}
|
2011-05-29 07:07:11 +03:00
|
|
|
}
|
2011-06-28 05:24:42 +03:00
|
|
|
});
|
|
|
|
}
|
2011-07-04 01:32:36 +03:00
|
|
|
|
2011-07-01 12:10:42 +03:00
|
|
|
function getProfileId(obj) {
|
|
|
|
var parentProfileSection = $(obj).parents('.profileSection');
|
|
|
|
return parentProfileSection.children('.qualityProfileId').val();
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCleanId(obj) {
|
|
|
|
var parentProfileSection = $(obj).parents('.profileSection');
|
|
|
|
return parentProfileSection.children('.cleanId').val();
|
|
|
|
}
|
|
|
|
|
|
|
|
$(".profileName_textbox").live('keyup', function () {
|
|
|
|
var value = $(this).val();
|
|
|
|
var profileId = getProfileId(this);
|
|
|
|
$("#title_" + profileId).text(value);
|
|
|
|
renameOption(value, profileId);
|
|
|
|
}).keyup();
|
|
|
|
|
|
|
|
$('.quality-selectee').live('click', function () {
|
2011-11-29 08:10:43 +03:00
|
|
|
var id = $(this).attr('id');
|
2011-07-01 12:10:42 +03:00
|
|
|
var cleanId = getCleanId(this);
|
|
|
|
var cutoff = '#' + cleanId + '_Cutoff';
|
2011-11-29 08:10:43 +03:00
|
|
|
var name = jQuery('[for="' + id + '"]').children('.ui-button-text').text();
|
2011-07-01 12:10:42 +03:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
//Remove 'Unknown'
|
2011-07-01 12:10:42 +03:00
|
|
|
$(cutoff + ' option').each(function () { if ($(this).text().indexOf('Unknown') > -1) $(cutoff + ' option').remove(':contains("' + $(this).text() + '")'); });
|
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
//Add option to cutoff SelectList
|
|
|
|
if ($(this).attr('checked')) {
|
|
|
|
$('<option>' + name + '</option>').appendTo(cutoff);
|
|
|
|
}
|
2011-07-01 12:10:42 +03:00
|
|
|
|
2011-11-29 08:10:43 +03:00
|
|
|
//Remove option from cutoff SelectList
|
|
|
|
else {
|
2011-07-01 12:10:42 +03:00
|
|
|
$(cutoff + ' option').each(function () {
|
2011-11-29 08:10:43 +03:00
|
|
|
if ($(this).text().indexOf(name) > -1)
|
2011-07-01 12:10:42 +03:00
|
|
|
$(cutoff + ' option').remove(':contains("' + $(this).text() + '")');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2011-12-01 08:04:44 +03:00
|
|
|
|
2011-09-16 07:42:30 +03:00
|
|
|
var sliderOptions = {
|
|
|
|
min: 0,
|
2011-12-01 08:04:44 +03:00
|
|
|
max: 200,
|
2011-09-16 07:42:30 +03:00
|
|
|
value: 0,
|
2011-12-01 08:04:44 +03:00
|
|
|
step: 1,
|
|
|
|
create: function (event, ui) {
|
2011-09-16 07:42:30 +03:00
|
|
|
var startingValue = $(this).siblings('.slider-value').val();
|
2011-12-01 08:04:44 +03:00
|
|
|
$(this).siblings('.30-minute').text(startingValue * 30);
|
|
|
|
$(this).siblings('.60-minute').text(startingValue * 60);
|
|
|
|
},
|
|
|
|
slide: function (event, ui) {
|
|
|
|
$(this).siblings('.slider-value').val(ui.value);
|
|
|
|
$(this).siblings('.30-minute').text(ui.value * 30);
|
|
|
|
$(this).siblings('.60-minute').text(ui.value * 60);
|
|
|
|
}
|
2011-09-16 07:42:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
function setupSliders() {
|
2011-12-01 08:04:44 +03:00
|
|
|
$(".slider").each(function () {
|
2011-09-16 07:42:30 +03:00
|
|
|
var localOptions = sliderOptions;
|
|
|
|
localOptions["value"] = $(this).siblings('.slider-value').val();
|
2011-12-01 08:04:44 +03:00
|
|
|
|
|
|
|
$(this).empty().slider(localOptions);
|
|
|
|
});
|
2011-09-16 07:42:30 +03:00
|
|
|
}
|
2011-06-28 05:24:42 +03:00
|
|
|
</script>
|
|
|
|
}
|