|
|
@ -1,4 +1,5 @@
|
|
|
|
@model NzbDrone.Core.Repository.Quality.QualityProfile
|
|
|
|
@model NzbDrone.Core.Repository.Quality.QualityProfile
|
|
|
|
|
|
|
|
@using System.Collections
|
|
|
|
@using NzbDrone.Core.Repository.Quality
|
|
|
|
@using NzbDrone.Core.Repository.Quality
|
|
|
|
@using NzbDrone.Web.Helpers
|
|
|
|
@using NzbDrone.Web.Helpers
|
|
|
|
|
|
|
|
|
|
|
@ -17,123 +18,92 @@
|
|
|
|
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
|
|
|
|
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
|
|
|
|
var ugly = ViewData.TemplateInfo.HtmlFieldPrefix;
|
|
|
|
var ugly = ViewData.TemplateInfo.HtmlFieldPrefix;
|
|
|
|
|
|
|
|
|
|
|
|
string sortable1 = String.Format("{0}_sortable1", idClean);
|
|
|
|
string selectable = String.Format("{0}_selectable", idClean);
|
|
|
|
string sortable2 = String.Format("{0}_sortable2", idClean);
|
|
|
|
|
|
|
|
string allowedStringName = String.Format("{0}_AllowedString", idClean);
|
|
|
|
string allowedStringName = String.Format("{0}_AllowedString", idClean);
|
|
|
|
string connectedSortable = String.Format("connected{0}", idClean);
|
|
|
|
|
|
|
|
string title = String.Format("{0}_Title", idClean);
|
|
|
|
string title = String.Format("{0}_Title", idClean);
|
|
|
|
string nameBox = String.Format("{0}_Name", idClean);
|
|
|
|
string nameBox = String.Format("{0}_Name", idClean);
|
|
|
|
string cutoff = String.Format("{0}.Cutoff", ugly);
|
|
|
|
string cutoff = String.Format("{0}.Cutoff", ugly);
|
|
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
<style>
|
|
|
|
.sortable1, .sortable2 { list-style-type: none; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; padding-top: 0px; padding-bottom: 6px; width: 117px; margin-bottom: 3px; }
|
|
|
|
.selectableList .ui-selecting { background: #85AEF9; }
|
|
|
|
.allowedQualities, .otherQualities { list-style-type: none; float: left; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; padding-top:6px; width: 122px; -khtml-border-radius:8px;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px; }
|
|
|
|
.selectableList .ui-selected { background: #065EFE; color: white; }
|
|
|
|
.sortable1 li, .sortable2 li { margin: 5px; margin-left: 0px; padding: 0px; font-size: 1.2em; width: 110px; -khtml-border-radius:8px;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px; }
|
|
|
|
.selectableList { list-style-type: none; margin: 0; padding: 0; }
|
|
|
|
.sortable1 li { background: #ddd; }
|
|
|
|
.selectableList li { margin: 3px; margin-left: 10px; padding-left: 0.4em; padding-bottom: 1.5em; padding-top: 0em; float: left; font-size: 1.2em; width: 110px; height: 6px; }
|
|
|
|
.sortable2 li { background: #DAA2A2; }
|
|
|
|
|
|
|
|
.sortableHeader { margin:2px; margin-left:12px }
|
|
|
|
|
|
|
|
.sortable1 li.ui-state-highlight, .sortable2 li.ui-state-highlight { background: #fbf5d0; border-color: #065EFE; }
|
|
|
|
|
|
|
|
.removeDiv { float: left; display:block; }
|
|
|
|
|
|
|
|
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function () {
|
|
|
|
$(function () {
|
|
|
|
$("#@sortable1, #@sortable2").sortable({
|
|
|
|
$("#@selectable").selectable({
|
|
|
|
connectWith: ".@connectedSortable",
|
|
|
|
create: function () {
|
|
|
|
placeholder: "ui-state-highlight",
|
|
|
|
var result = "";
|
|
|
|
dropOnEmpty: true,
|
|
|
|
$(".ui-selected", this).each(function () {
|
|
|
|
|
|
|
|
result += this.id + ",";
|
|
|
|
create: function (event, ui) {
|
|
|
|
});
|
|
|
|
var order = $('#@sortable1').sortable("toArray");
|
|
|
|
$("#@allowedStringName").empty().val(result);
|
|
|
|
$("#@allowedStringName").val(order);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
update: function (event, ui) {
|
|
|
|
stop: function () {
|
|
|
|
var order = $('#@sortable1').sortable("toArray");
|
|
|
|
var result = "";
|
|
|
|
$("#@allowedStringName").val(order);
|
|
|
|
$(".ui-selected", this).each(function () {
|
|
|
|
|
|
|
|
result += this.id + ",";
|
|
|
|
//If this is the first QualityType added to the Profile select it as the cutoff value (in-case the user forgets)
|
|
|
|
});
|
|
|
|
var $list = $('#@sortable1 li');
|
|
|
|
$("#@allowedStringName").empty().val(result);
|
|
|
|
if ($list.length == 1) {
|
|
|
|
|
|
|
|
var $radios = $('input[name="@cutoff"]');
|
|
|
|
|
|
|
|
$radios.filter('[value=' + order + ']').attr('checked', true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).disableSelection();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="profileSectionEditor" id="div_@(ViewData["ProfileId"])">
|
|
|
|
<div class="profileSectionEditor" id="div_@(ViewData["ProfileId"])">
|
|
|
|
|
|
|
|
|
|
|
|
<fieldset style="width:285px; max-width:285px; margin:5px; margin-top: 0px; border-color:#CCCCCD">
|
|
|
|
<fieldset style="width:264px; margin:5px; margin-top: 0px; border-color:#CCCCCD">
|
|
|
|
<div id="tester"></div>
|
|
|
|
<div class="header">
|
|
|
|
|
|
|
|
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
|
|
|
|
|
|
|
|
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="@title">@{Html.DisplayTextFor(m => m.Name);}</h2>
|
|
|
|
|
|
|
|
<a href="#" id="@Model.QualityProfileId" class="deleteRow" onclick="deleteProfile('@ViewData["ProfileId"]'); return false;" style="float:right; padding-top:15px; padding-right: 5px;"><img src="../../Content/Images/X.png" alt="Delete"/></a>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
|
|
|
|
<div class="config-group" style="width: 255px; margin-bottom: 5px; margin-left: 5px;">
|
|
|
|
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="@title">@{Html.DisplayTextFor(m => m.Name);}</h2>
|
|
|
|
<div class="config-title">@Html.LabelFor(x => x.Name)</div>
|
|
|
|
<a href="#" id="@Model.QualityProfileId" class="deleteRow" onclick="deleteProfile('@ViewData["ProfileId"]'); return false;" style="float:right; padding-top:15px;"><img src="../../Content/Images/X.png" alt="Delete"/></a>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(x => x.Name, new { maxlength = 16 })</div>
|
|
|
|
</div>
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(x => x.Name)</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="config-group" style="width: 270px; margin-bottom: 5px; margin-left: 5px;">
|
|
|
|
<div class="config-group" style="width: 255px; margin-bottom: 5px; margin-left: 5px;">
|
|
|
|
<div class="config-title">@Html.LabelFor(x => x.Name)</div>
|
|
|
|
<div class="config-title">@Html.LabelFor(x => x.Cutoff)</div>
|
|
|
|
<div class="config-value">@Html.TextBoxFor(x => x.Name, new { maxlength = 16})</div>
|
|
|
|
<div class="config-value">@Html.DropDownListFor(m => m.Cutoff, new SelectList(ViewData["Qualities"] as IEnumerable, Model.Cutoff))</div>
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(x => x.Name)</div>
|
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(x => x.Cutoff)</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="sortablesDiv" style="margin: 0px;">
|
|
|
|
<div class="selectableDiv" style="margin-top: 30px;">
|
|
|
|
<div class="allowedQualities">
|
|
|
|
<ol id="@selectable" class="selectableList">
|
|
|
|
<h4 class="sortableHeader">Allowed</h4>
|
|
|
|
|
|
|
|
<ul id="@sortable1" class="@connectedSortable sortable1">
|
|
|
|
@{var qualitiesList = (List<QualityTypes>)ViewData["Qualities"];}
|
|
|
|
@if (Model.Allowed != null)
|
|
|
|
|
|
|
|
|
|
|
|
@for (int i = 0; i < qualitiesList.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Model.Allowed != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < Model.Allowed.Count(); i++)
|
|
|
|
if (Model.Allowed.Contains(qualitiesList[i]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
<li class="ui-state-default" id="@Model.Allowed[i].ToString()">
|
|
|
|
<li class="ui-widget-content ui-selected" id="@qualitiesList[i].ToString()">
|
|
|
|
@Html.RadioButtonFor(x => x.Cutoff, Model.Allowed[i])
|
|
|
|
@Html.Label(qualitiesList[i].ToString())
|
|
|
|
@Html.DisplayTextFor(c => c.Allowed[i])
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="otherQualities">
|
|
|
|
<li class="ui-widget-content" id="@qualitiesList[i].ToString()">
|
|
|
|
<h4 class="sortableHeader">Not-Allowed</h4>
|
|
|
|
@Html.Label(qualitiesList[i].ToString())
|
|
|
|
<ul id="@sortable2" class="@connectedSortable sortable2">
|
|
|
|
</li>
|
|
|
|
|
|
|
|
}
|
|
|
|
@{var qualitiesList = (List<QualityTypes>)ViewData["Qualities"];}
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
|
|
@for (int i = 0; i < qualitiesList.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Skip Unknown and any item that is in the allowed list
|
|
|
|
|
|
|
|
//if (qualitiesList[i].ToString() == "Unknown")
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Model.Allowed != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Model.Allowed.Contains(qualitiesList[i]))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="ui-state-default" id="@qualitiesList[i].ToString()">
|
|
|
|
|
|
|
|
@Html.RadioButtonFor(x => x.Cutoff, qualitiesList[i])
|
|
|
|
|
|
|
|
@Html.Label(qualitiesList[i].ToString())
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
@Html.ValidationMessageFor(x => x.Cutoff)
|
|
|
|
<div class="hiddenProfileDetails2">
|
|
|
|
|
|
|
|
@Html.HiddenFor(x => x.QualityProfileId)
|
|
|
|
<div class="hiddenProfileDetails">
|
|
|
|
@Html.HiddenFor(x => x.UserProfile)
|
|
|
|
@Html.TextBoxFor(x => x.QualityProfileId, new { @style = "display:none" })
|
|
|
|
@Html.HiddenFor(m => m.AllowedString)
|
|
|
|
@Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" })
|
|
|
|
|
|
|
|
@Html.TextBoxFor(m => m.AllowedString, new { @style = "display:none" })
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|