2011-05-28 07:16:16 +00:00
|
|
|
@model IEnumerable<String>
|
2011-05-31 06:13:46 +00:00
|
|
|
@using NzbDrone.Core.Repository
|
2011-05-28 07:16:16 +00:00
|
|
|
|
|
|
|
<script type="text/javascript" src="../../Scripts/2011.1.315/telerik.window.min.js"></script>
|
|
|
|
|
2011-05-31 06:13:46 +00:00
|
|
|
<style>
|
|
|
|
.root_dir_text
|
|
|
|
{
|
|
|
|
width: 300px;
|
|
|
|
margin-top: 8px;
|
|
|
|
margin-left: 3px;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2011-05-28 07:16:16 +00:00
|
|
|
@section TitleContent{
|
2011-05-30 06:19:13 +00:00
|
|
|
Add Series
|
2011-05-28 07:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@section MainContent{
|
|
|
|
|
|
|
|
@{ Html.Telerik().Window()
|
|
|
|
.Name("Window")
|
|
|
|
.Title("Add New Series")
|
|
|
|
.Modal(true)
|
|
|
|
.Buttons(b => b.Close())
|
|
|
|
.Width(500)
|
|
|
|
.Height(200)
|
|
|
|
.Visible(false)
|
|
|
|
.Draggable(true)
|
|
|
|
.Resizable(resizing => resizing.Enabled(false))
|
|
|
|
.LoadContentFrom("AddNew", "AddSeries")
|
|
|
|
.Render();
|
|
|
|
}
|
2011-05-31 06:13:46 +00:00
|
|
|
|
|
|
|
@{ Html.Telerik().PanelBar()
|
|
|
|
.Name("RootDirPanel")
|
|
|
|
.HtmlAttributes(new { style = "margin: 0px;" })
|
|
|
|
.ExpandMode(PanelBarExpandMode.Multiple)
|
|
|
|
.Items(panelItem =>
|
2011-05-28 07:16:16 +00:00
|
|
|
{
|
2011-05-31 06:13:46 +00:00
|
|
|
panelItem.Add()
|
|
|
|
.Text("Root Directories")
|
|
|
|
.ImageUrl("~/Content/Images/VideoFolder.png")
|
|
|
|
.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 ViewData["RootDirs"] as List<RootDir>)
|
|
|
|
{
|
|
|
|
Html.RenderAction("GetRootDirView", root);
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</text>);
|
|
|
|
}).Render();
|
2011-05-28 07:16:16 +00:00
|
|
|
}
|
|
|
|
|
2011-05-31 06:46:24 +00:00
|
|
|
<div style="padding-bottom: 10px; padding-top: 15px;">
|
|
|
|
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left:5px">Add New</button>
|
2011-05-31 06:13:46 +00:00
|
|
|
|
2011-05-31 06:46:24 +00:00
|
|
|
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes(
|
|
|
|
new {style = "width: 100px; margin-left:224px;"}).ClientEvents(events => events.OnChange("masterChanged"))
|
2011-05-28 07:16:16 +00:00
|
|
|
|
2011-05-31 06:46:24 +00:00
|
|
|
</div>
|
2011-05-28 07:16:16 +00:00
|
|
|
|
2011-05-31 06:13:46 +00:00
|
|
|
@if (Model.Count() == 0)
|
|
|
|
{
|
|
|
|
@Html.DisplayText("No Series to Add");
|
|
|
|
}
|
|
|
|
|
2011-05-28 07:16:16 +00:00
|
|
|
@foreach (var path in Model)
|
|
|
|
{
|
|
|
|
Html.RenderAction("RenderPartial", "AddSeries", new {path});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function openAddNewSeries() {
|
|
|
|
var windowElement = $('#Window');
|
|
|
|
|
|
|
|
windowElement.data('tWindow').center().open();
|
2011-05-28 08:23:00 +00:00
|
|
|
}
|
2011-05-28 07:16:16 +00:00
|
|
|
|
|
|
|
function closeAddNewSeries() {
|
|
|
|
var window = $('#Window').data("tWindow");
|
|
|
|
window.close();
|
|
|
|
}
|
2011-05-28 08:23:00 +00:00
|
|
|
|
|
|
|
function masterChanged() {
|
|
|
|
var masterQuality = $('#masterDropbox').data("tDropDownList").value();
|
|
|
|
|
|
|
|
var qualityDropbox = $(".qualityDropbox");
|
2011-05-28 07:16:16 +00:00
|
|
|
|
2011-05-28 08:23:00 +00:00
|
|
|
qualityDropbox.each(function () {
|
|
|
|
var child = $(this).children("[id^='qualityList']");
|
|
|
|
var comboBox = child.data("tDropDownList");
|
|
|
|
comboBox.value(masterQuality);
|
|
|
|
});
|
|
|
|
}
|
2011-05-31 06:13:46 +00:00
|
|
|
|
|
|
|
var addSeriesUrl = '@Url.Action("AddSeries", "AddSeries")';
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#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(id) {
|
|
|
|
sendToServer(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendToServer(id) {
|
|
|
|
$.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_" + id).remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var saveRootDirUrl = '@Url.Action("SaveRootDir", "AddSeries")';
|
|
|
|
|
|
|
|
function saveRootDir(id) {
|
|
|
|
var path = $('#path_' + id).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 != 'ok')
|
|
|
|
alert("An error occurred while saving Root Directory: " + path);
|
|
|
|
}
|
|
|
|
});
|
2011-05-28 08:23:00 +00:00
|
|
|
}
|
2011-05-28 07:16:16 +00:00
|
|
|
</script>
|