Merge branch 'markus101'

pull/3113/head
kay.one 14 years ago
commit 25007c7807

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -260,6 +260,11 @@ button, input[type="button"], input[type="submit"], input[type="reset"]
margin: 10px; margin: 10px;
} }
button:active, input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active
{
border-color: #0C48B6;
}
.listButton .listButton
{ {
padding: 2px 10px 2px 10px; padding: 2px 10px 2px 10px;

@ -3,16 +3,19 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Web.Mvc; using System.Web.Mvc;
using System.Linq; using System.Linq;
using NLog;
using NzbDrone.Core.Helpers; using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Repository;
using NzbDrone.Web.Models; using NzbDrone.Web.Models;
namespace NzbDrone.Web.Controllers namespace NzbDrone.Web.Controllers
{ {
public class AddSeriesController : Controller public class AddSeriesController : Controller
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly ConfigProvider _configProvider; private readonly ConfigProvider _configProvider;
private readonly QualityProvider _qualityProvider; private readonly QualityProvider _qualityProvider;
private readonly RootDirProvider _rootFolderProvider; private readonly RootDirProvider _rootFolderProvider;
@ -68,17 +71,25 @@ namespace NzbDrone.Web.Controllers
return View(); return View();
} }
public ActionResult Add() public ActionResult Index()
{ {
var unmappedList = new List<String>(); var rootDirs = _rootFolderProvider.GetAll();
var profiles = _qualityProvider.GetAllProfiles(); var profiles = _qualityProvider.GetAllProfiles();
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile); var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality); var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality);
ViewData["qualities"] = selectList; ViewData["qualities"] = selectList;
foreach (var folder in _rootFolderProvider.GetAll()) return View(rootDirs);
}
public ActionResult AddExisting()
{
var rootDirs = _rootFolderProvider.GetAll();
var unmappedList = new List<String>();
foreach (var folder in rootDirs)
{ {
unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path)); unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path));
} }
@ -109,7 +120,11 @@ namespace NzbDrone.Web.Controllers
[HttpPost] [HttpPost]
public JsonResult AddNewSeries(string rootPath, string seriesName, int seriesId, int qualityProfileId) public JsonResult AddNewSeries(string rootPath, string seriesName, int seriesId, int qualityProfileId)
{ {
var path = rootPath.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar).Replace('`', '\'') + try
{
var path =
rootPath.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar).Replace(
'`', '\'') +
Path.DirectorySeparatorChar + EpisodeRenameHelper.CleanFilename(seriesName); Path.DirectorySeparatorChar + EpisodeRenameHelper.CleanFilename(seriesName);
//Create the folder for the new series and then Add it //Create the folder for the new series and then Add it
@ -117,7 +132,13 @@ namespace NzbDrone.Web.Controllers
_seriesProvider.AddSeries(path, seriesId, qualityProfileId); _seriesProvider.AddSeries(path, seriesId, qualityProfileId);
ScanNewSeries(); ScanNewSeries();
return new JsonResult { Data = "ok" }; return new JsonResult {Data = "ok"};
}
catch(Exception ex)
{
return new JsonResult { Data = "failed" };
}
} }
public JsonResult AddSeries(string path, int seriesId, int qualityProfileId) public JsonResult AddSeries(string path, int seriesId, int qualityProfileId)
@ -157,5 +178,80 @@ namespace NzbDrone.Web.Controllers
return new SelectList(dataVal, "Id", "SeriesName", selectId); return new SelectList(dataVal, "Id", "SeriesName", selectId);
} }
[HttpPost]
public JsonResult SaveRootDir(int id, string path)
{
try
{
_rootFolderProvider.Update(new RootDir { Id = id, Path = path });
}
catch (Exception ex)
{
Logger.Debug("Failed to save Root Dir");
Logger.DebugException(ex.Message, ex);
return new JsonResult { Data = "failed" };
}
return new JsonResult { Data = "ok" };
}
public ViewResult AddRootDir()
{
var rootDir = new RootDir { Path = String.Empty };
var id = _rootFolderProvider.Add(rootDir);
rootDir.Id = id;
ViewData["RootDirId"] = id;
return View("RootDir", rootDir);
}
public ActionResult GetRootDirView(RootDir rootDir)
{
ViewData["RootDirId"] = rootDir.Id;
return PartialView("RootDir", rootDir);
}
public JsonResult DeleteRootDir(int rootDirId)
{
try
{
_rootFolderProvider.Remove(rootDirId);
}
catch (Exception)
{
return new JsonResult { Data = "failed" };
}
return new JsonResult { Data = "ok" };
}
public JsonResult JsonAutoCompletePath(string term)
{
var windowsSep = term.LastIndexOf('\\');
if (windowsSep > -1)
{
var start = term.Substring(windowsSep + 1);
var dirs = _diskProvider.GetDirectories(term.Substring(0, windowsSep + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower())).Take(10);
return Json(dirs.ToArray(), JsonRequestBehavior.AllowGet);
}
var index = term.LastIndexOf('/');
if (index > -1)
{
var start = term.Substring(index + 1);
var dirs = _diskProvider.GetDirectories(term.Substring(0, index + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower())).Take(10);
return Json(dirs.ToArray(), JsonRequestBehavior.AllowGet);
}
return Json(new JsonResult(), JsonRequestBehavior.AllowGet);
}
} }
} }

@ -62,21 +62,11 @@ namespace NzbDrone.Web.Controllers
ViewData["viewName"] = viewName; ViewData["viewName"] = viewName;
else else
return RedirectToAction("General"); return RedirectToAction("Indexers");
return View("Index"); return View("Index");
} }
public ActionResult General()
{
ViewData["viewName"] = "General";
return View("Index", new SettingsModel
{
Directories = _rootDirProvider.GetAll()
});
}
public ActionResult Indexers() public ActionResult Indexers()
{ {
ViewData["viewName"] = "Indexers"; ViewData["viewName"] = "Indexers";
@ -236,40 +226,6 @@ namespace NzbDrone.Web.Controllers
return PartialView("QualityProfileItem", profile); return PartialView("QualityProfileItem", profile);
} }
public ViewResult AddRootDir()
{
var rootDir = new RootDir { Path = String.Empty };
var id = _rootDirProvider.Add(rootDir);
rootDir.Id = id;
ViewData["RootDirId"] = id;
return View("RootDir", rootDir);
}
public ActionResult GetRootDirView(RootDir rootDir)
{
ViewData["RootDirId"] = rootDir.Id;
return PartialView("RootDir", rootDir);
}
public JsonResult DeleteRootDir(int rootDirId)
{
try
{
_rootDirProvider.Remove(rootDirId);
}
catch (Exception)
{
return new JsonResult { Data = "failed" };
}
return new JsonResult { Data = "ok" };
}
public ActionResult SubMenu() public ActionResult SubMenu()
{ {
return PartialView(); return PartialView();
@ -317,29 +273,6 @@ namespace NzbDrone.Web.Controllers
} }
} }
public JsonResult JsonAutoCompletePath(string term)
{
var windowsSep = term.LastIndexOf('\\');
if (windowsSep > -1)
{
var start = term.Substring(windowsSep + 1);
var dirs = _diskProvider.GetDirectories(term.Substring(0, windowsSep + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower())).Take(10);
return Json(dirs.ToArray(), JsonRequestBehavior.AllowGet);
}
var index = term.LastIndexOf('/');
if (index > -1)
{
var start = term.Substring(index + 1);
var dirs = _diskProvider.GetDirectories(term.Substring(0, index + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower())).Take(10);
return Json(dirs.ToArray(), JsonRequestBehavior.AllowGet);
}
return Json(new JsonResult(), JsonRequestBehavior.AllowGet);
}
[HttpPost] [HttpPost]
public ActionResult SaveGeneral(SettingsModel data) public ActionResult SaveGeneral(SettingsModel data)
{ {

@ -683,7 +683,7 @@
<Content Include="Scripts\jquery-tgc-countdown-1.0.js" /> <Content Include="Scripts\jquery-tgc-countdown-1.0.js" />
<Content Include="Scripts\jquery.simpledropdown.js" /> <Content Include="Scripts\jquery.simpledropdown.js" />
<Content Include="Scripts\Notification.js" /> <Content Include="Scripts\Notification.js" />
<Content Include="Views\AddSeries\Add.cshtml" /> <Content Include="Views\AddSeries\Index.cshtml" />
<Content Include="Views\AddSeries\AddNew.cshtml" /> <Content Include="Views\AddSeries\AddNew.cshtml" />
<Content Include="Views\AddSeries\AddSeriesItem.cshtml" /> <Content Include="Views\AddSeries\AddSeriesItem.cshtml" />
<Content Include="Web.config"> <Content Include="Web.config">
@ -715,10 +715,9 @@
<Content Include="Views\System\Jobs.cshtml" /> <Content Include="Views\System\Jobs.cshtml" />
<Content Include="Views\Settings\Sabnzbd.cshtml" /> <Content Include="Views\Settings\Sabnzbd.cshtml" />
<Content Include="Views\Settings\EpisodeSorting.cshtml" /> <Content Include="Views\Settings\EpisodeSorting.cshtml" />
<Content Include="Views\Settings\General.cshtml" />
<Content Include="Views\Settings\Notifications.cshtml" /> <Content Include="Views\Settings\Notifications.cshtml" />
<Content Include="Views\Settings\Quality.cshtml" /> <Content Include="Views\Settings\Quality.cshtml" />
<Content Include="Views\Settings\RootDir.cshtml" /> <Content Include="Views\AddSeries\RootDir.cshtml" />
<Content Include="Views\Settings\SubMenu.cshtml" /> <Content Include="Views\Settings\SubMenu.cshtml" />
<Content Include="Views\Shared\SiteLayout.cshtml" /> <Content Include="Views\Shared\SiteLayout.cshtml" />
<Content Include="Views\Shared\Footer.cshtml" /> <Content Include="Views\Shared\Footer.cshtml" />
@ -891,6 +890,9 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\Series\SingleSeason.cshtml" /> <Content Include="Views\Series\SingleSeason.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Views\AddSeries\AddExisting.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

@ -1,70 +0,0 @@
@model IEnumerable<String>
<script type="text/javascript" src="../../Scripts/2011.1.315/telerik.window.min.js"></script>
@section TitleContent{
Add Series
}
@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();
}
@if (Model.Count() == 0)
{
@Html.DisplayText("No Series to Add");
}
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes(
new {style = "width: 100px; margin-left:5px;"}).ClientEvents(events => events.OnChange("masterChanged"))
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left:210px">Add New</button>
@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();
}
function closeAddNewSeries() {
var window = $('#Window').data("tWindow");
window.close();
}
function masterChanged() {
var masterQuality = $('#masterDropbox').data("tDropDownList").value();
var qualityDropbox = $(".qualityDropbox");
qualityDropbox.each(function () {
var child = $(this).children("[id^='qualityList']");
var comboBox = child.data("tDropDownList");
comboBox.value(masterQuality);
});
}
function testValue() {
var comboBox = $('#qualityList_tester').data("tDropDownList");
comboBox.value('2');
}
</script>

@ -0,0 +1,15 @@
@model IEnumerable<String>
@{
Layout = null;
}
@if (Model.Count() == 0)
{
@Html.DisplayText("No Series to Add");
}
@foreach (var path in Model)
{
Html.RenderAction("RenderPartial", "AddSeries", new {path});
}

@ -53,14 +53,18 @@
url: addNewSeriesUrl, url: addNewSeriesUrl,
data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }), data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }),
error: function (req, status, error) { error: function (req, status, error) {
alert("Sorry! We could not add " + path + " at this time. " + error); alert("Sorry! We could not add " + seriesName + " at this time. " + error);
}, },
success: function (){ success: function (data, textStatus, jqXHR){
//Clear the search box //Clear the search box
$("#seriesList_new").data("tComboBox").text(''); $("#seriesList_new").data("tComboBox").text('');
//Close the Window! //Through up an alert if we failed to add the series
closeAddNewSeries(); if (data != 'ok')
alert("Sorry! We could not add " + seriesName + ", does it already exist?");
else
closeAddNewSeries(); //Close the Window!
} }
}); });
} }

@ -5,39 +5,16 @@
<legend>@ViewData["path"].ToString()</legend> <legend>@ViewData["path"].ToString()</legend>
<div> <div>
@{Html.Telerik().ComboBox() @{Html.Telerik().ComboBox()
.Name("seriesList_" + ViewData["guid"].ToString()) .Name("seriesList_" + ViewData["guid"])
.BindTo(Model) .BindTo(Model)
.DataBinding(binding => binding.Ajax().Select("_textLookUp", "AddSeries").Delay(400)) .DataBinding(binding => binding.Ajax().Select("_textLookUp", "AddSeries").Delay(400))
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.Contains)) .Filterable(f => f.FilterMode(AutoCompleteFilterMode.Contains))
.HighlightFirstMatch(true) .HighlightFirstMatch(true)
.HtmlAttributes(new { style = "width: 300px;" }) .HtmlAttributes(new { style = "width: 300px;" })
.Render();} .Render();}
@Html.Telerik().DropDownList().Name("qualityList_" + ViewData["guid"].ToString()).BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" }) @Html.Telerik().DropDownList().Name("qualityList_" + ViewData["guid"]).BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" })
<button class="listButton" onclick="addSeries('@ViewData["guid"]','@ViewData["javaPath"].ToString()' )"> <button class="listButton" onclick="addSeries('@ViewData["guid"]','@ViewData["javaPath"].ToString()' )">
Add</button> Add</button>
</div> </div>
</fieldset> </fieldset>
</div> </div>
<script type="text/javascript" language="javascript">
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);
}
});
}
</script>

@ -0,0 +1,173 @@
@model List<RootDir>
@using NzbDrone.Core.Repository
<script type="text/javascript" src="../../Scripts/2011.1.315/telerik.window.min.js"></script>
<style>
.root_dir_text
{
width: 300px;
margin-top: 8px;
margin-left: 3px;
vertical-align: middle;
}
</style>
@section TitleContent{
Add Series
}
@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();
}
@{ Html.Telerik().PanelBar()
.Name("RootDirPanel")
.HtmlAttributes(new { style = "margin: 0px;" })
.ExpandMode(PanelBarExpandMode.Multiple)
.Items(panelItem =>
{
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 Model)
{
Html.RenderAction("GetRootDirView", root);
}
</div>
<button onclick="reloadExistingSeries()" style="padding: 2px 10px 2px 10px; margin: 5px; margin-bottom: 10px;">Refresh Unmapped</button>
</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"))
</div>
<div id="existingSeries">
@{ Html.RenderAction("AddExisting", "AddSeries"); }
</div>
}
<script type="text/javascript">
function openAddNewSeries() {
var windowElement = $('#Window');
windowElement.data('tWindow').center().open();
}
function closeAddNewSeries() {
var window = $('#Window').data("tWindow");
window.close();
}
function masterChanged() {
var masterQuality = $('#masterDropbox').data("tDropDownList").value();
var qualityDropbox = $(".qualityDropbox");
qualityDropbox.each(function () {
var child = $(this).children("[id^='qualityList']");
var comboBox = child.data("tDropDownList");
comboBox.value(masterQuality);
});
}
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);
}
});
}
function reloadExistingSeries() {
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")');
}
</script>

@ -0,0 +1,16 @@
@model NzbDrone.Core.Repository.RootDir
@{
Layout = null;
}
<div class="rootDirSection" id="rootDir_@(Model.Id)" style="padding: 7px; padding-left: 3px;">
<fieldset style="padding: 5px; height: 40px;">
@Html.TextBoxFor(m => m.Path, new { @class = "root_dir_text", id = "path_" + Model.Id })
<a href="#" class="deleteRow" onclick="deleteRootDir('@ViewData["RootDirId"]')">
<img src="../../Content/Images/X.png" alt="Delete" width="20px" height="20px" style="vertical-align: middle; margin-top: 7px;"/></a>
<button style="padding: 2px 10px 2px 10px; vertical-align: middle; margin: 0px; margin-top: 7px;" onclick="saveRootDir(@Model.Id)">Save</button>
@Html.HiddenFor(x => x.Id, new { id = "id_" + Model.Id })
</fieldset>
</div>

@ -2,7 +2,7 @@
@{Html.Telerik().Menu().Name("telerikGrid").Items(items => @{Html.Telerik().Menu().Name("telerikGrid").Items(items =>
{ {
items.Add().Text("Add Series").Action<AddSeriesController>(c => c.Add()); items.Add().Text("Add Series").Action<AddSeriesController>(c => c.Index());
items.Add().Text("Start RSS Sync").Action<SeriesController>(c => c.RssSync()); items.Add().Text("Start RSS Sync").Action<SeriesController>(c => c.RssSync());
items.Add().Text("Rename All").Action<SeriesController>(c => c.RenameAll()); items.Add().Text("Rename All").Action<SeriesController>(c => c.RenameAll());
}).Render();} }).Render();}

@ -1,88 +0,0 @@
@model NzbDrone.Web.Models.SettingsModel
<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', '');
$(".root_dir_text").autocomplete({ url: '@Url.Action("AutoCompletePath", "Settings")', paramName: 'path', minChars: 3, delay: 300, maxCacheLength: 1 });
$(".root_dir_text").autocomplete({
source: '@Url.Action("JsonAutoCompletePath", "Settings")',
minLength: 3
});
});
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("SaveGeneral", "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>General</legend>
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddRootDir", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Root Directory</h4></a>
</div>
<div id="root-dirs">
@foreach (var item in Model.Directories)
{
Html.RenderAction("GetRootDirView", item);
}
</div>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<script type="text/javascript">
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) { $("#root-dirs").append(html); }
});
return false;
});
var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "Settings")';
function deleteRootDir(id) {
sendToServer(id);
$("#div_" + id).remove();
}
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);
}
});
}
</script>

@ -63,140 +63,139 @@
.HtmlAttributes(new { style = "width: 300px; margin: 10px;" }) .HtmlAttributes(new { style = "width: 300px; margin: 10px;" })
.ExpandMode(PanelBarExpandMode.Single) .ExpandMode(PanelBarExpandMode.Single)
.SelectedIndex(0) .SelectedIndex(0)
.Items(item => .Items(indexerItem =>
{ {
item.Add() indexerItem.Add()
.Text("NZBs.org") .Text("NZBs.org")
.ImageUrl("~/Content/Images/Indexers/NzbsOrg.png") .ImageUrl("~/Content/Images/Indexers/NzbsOrg.png")
.Content( .Content(@<text>
"<div class=\"section_content\">" + <div class="section_content">
<div class="indexer_group">
"<div class=\"indexer_group\">" + <div class="indexer_left">
"<div class=\"indexer_left\">" + Enabled
"Enabled" + </div>
"</div>" + <div class="indexer_right">
"<div class=\"indexer_right\">" + @Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "indexer_checkbox" })
Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "indexer_checkbox" }) + </div>
"</div>" + </div>
"</div>" +
<div class="indexer_group">
"<div class=\"indexer_group\">" + <div class="indexer_left">
"<div class=\"indexer_left\">" + @Html.LabelFor(m => m.NzbsOrgUId)
Html.LabelFor(m => m.NzbsOrgUId) + </div>
"</div>" + <div class="indexer_right">
"<div class=\"indexer_right\">" + @Html.TextBoxFor(m => m.NzbsOrgUId)
Html.TextBoxFor(m => m.NzbsOrgUId) + </div>
"</div>" + </div>
"</div>" + <div class="indexer_group">
"<div class=\"indexer_group\">" + <div class="indexer_left">
"<div class=\"indexer_left\">" + @Html.LabelFor(m => m.NzbsOrgHash)
Html.LabelFor(m => m.NzbsOrgHash) + </div>
"</div>" + <div class="indexer_right">
"<div class=\"indexer_right\">" + @Html.TextBoxFor(m => m.NzbsOrgHash)
Html.TextBoxFor(m => m.NzbsOrgHash) + </div>
"</div>" + </div>
"</div>" + </div>
"</div>" </text>);
); indexerItem.Add()
item.Add()
.Text("NZB Matrix") .Text("NZB Matrix")
.ImageUrl("~/Content/Images/Indexers/NzbMatrix.png") .ImageUrl("~/Content/Images/Indexers/NzbMatrix.png")
.Content( .Content(@<text>
"<div class=\"section_content\">" + <div class="section_content">
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
"Enabled" + Enabled
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "indexer_checkbox" }) + @Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "indexer_checkbox" })
"</div>" + </div>
"</div>" + </div>
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
Html.LabelFor(m => m.NzbMatrixUsername) + @Html.LabelFor(m => m.NzbMatrixUsername)
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.TextBoxFor(m => m.NzbMatrixUsername) + @Html.TextBoxFor(m => m.NzbMatrixUsername)
"</div>" + </div>
"</div>" + </div>
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
Html.LabelFor(m => m.NzbMatrixApiKey) + @Html.LabelFor(m => m.NzbMatrixApiKey)
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.TextBoxFor(m => m.NzbMatrixApiKey) + @Html.TextBoxFor(m => m.NzbMatrixApiKey)
"</div>" + </div>
"</div>" + </div>
"</div>" </div>
); </text>);
item.Add() indexerItem.Add()
.Text("NZBsRus") .Text("NZBsRus")
.ImageUrl("~/Content/Images/Indexers/NzbsRus.png") .ImageUrl("~/Content/Images/Indexers/NzbsRus.png")
.Content( .Content(@<text>
"<div class=\"section_content\">" + <div class="section_content">
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
"Enabled" + Enabled
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "indexer_checkbox" }) + @Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "indexer_checkbox" })
"</div>" + </div>
"</div>" + </div>
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
Html.LabelFor(m => m.NzbsrusUId) + @Html.LabelFor(m => m.NzbsrusUId)
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.TextBoxFor(m => m.NzbsrusUId) + @Html.TextBoxFor(m => m.NzbsrusUId)
"</div>" + </div>
"</div>" + </div>
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
Html.LabelFor(m => m.NzbsrusHash) + @Html.LabelFor(m => m.NzbsrusHash)
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.TextBoxFor(m => m.NzbsrusHash) + @Html.TextBoxFor(m => m.NzbsrusHash)
"</div>" + </div>
"</div>" + </div>
"</div>" </div>
); </text>);
item.Add() indexerItem.Add()
.Text("Newzbin") .Text("Newzbin")
.ImageUrl("~/Content/Images/Indexers/Newzbin.png") .ImageUrl("~/Content/Images/Indexers/Newzbin.png")
.Content( .Content(@<text>
"<div class=\"section_content\">" + <div class="section_content">
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
"Enabled" + Enabled
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "indexer_checkbox" }) + @Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "indexer_checkbox" })
"</div>" + </div>
"</div>" + </div>
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
Html.LabelFor(m => m.NewzbinUsername) + @Html.LabelFor(m => m.NewzbinUsername)
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.TextBoxFor(m => m.NewzbinUsername) + @Html.TextBoxFor(m => m.NewzbinUsername)
"</div>" + </div>
"</div>" + </div>
"<div class=\"indexer_group\">" + <div class="indexer_group">
"<div class=\"indexer_left\">" + <div class="indexer_left">
Html.LabelFor(m => m.NewzbinPassword) + @Html.LabelFor(m => m.NewzbinPassword)
"</div>" + </div>
"<div class=\"indexer_right\">" + <div class="indexer_right">
Html.TextBoxFor(m => m.NewzbinPassword) + @Html.TextBoxFor(m => m.NewzbinPassword)
"</div>" + </div>
"</div>" + </div>
"</div>" </div>
); </text>);
}).Render(); }).Render();
} }
</div> </div>

@ -1,35 +0,0 @@
@model NzbDrone.Core.Repository.RootDir
@using NzbDrone.Web.Helpers;
@{
Layout = null;
}
<style type="text/css">
.root_dir_text
{
width: 300px;
}
</style>
@using (Html.BeginCollectionItem("Directories"))
{
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
<div class="rootDirSection" id="div_@(ViewData["RootDirId"])">
<fieldset>
<div class="ui-widget">
@Html.TextBoxFor(m => m.Path, new { @class = "root_dir_text" })
<a href="#" class="deleteRow" onclick="deleteRootDir('@ViewData["RootDirId"]')">
<img src="../../Content/Images/X.png" alt="Delete" /></a>
</div>
<div>
@Html.ValidationMessageFor(m => m.Path)
</div>
<div class="hiddenProfileDetails">
@Html.TextBoxFor(x => x.Id, new { @style = "display:none" })
</div>
</fieldset>
</div>
}
Loading…
Cancel
Save