diff --git a/NzbDrone.Web/Content/Images/VideoFolder.png b/NzbDrone.Web/Content/Images/VideoFolder.png new file mode 100644 index 000000000..566c41eb7 Binary files /dev/null and b/NzbDrone.Web/Content/Images/VideoFolder.png differ diff --git a/NzbDrone.Web/Content/style.css b/NzbDrone.Web/Content/style.css index a4aee9077..157a35e79 100644 --- a/NzbDrone.Web/Content/style.css +++ b/NzbDrone.Web/Content/style.css @@ -260,6 +260,11 @@ button, input[type="button"], input[type="submit"], input[type="reset"] margin: 10px; } +button:active, input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active +{ + border-color: #0C48B6; +} + .listButton { padding: 2px 10px 2px 10px; @@ -334,4 +339,4 @@ button, input[type="button"], input[type="submit"], input[type="reset"] -khtml-opacity: 0.8; opacity: 0.8; line-height: 90% - } \ No newline at end of file + } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index e2ad88b50..5d8018609 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -3,16 +3,19 @@ using System.IO; using System.Web.Mvc; using System.Linq; +using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Jobs; +using NzbDrone.Core.Repository; using NzbDrone.Web.Models; namespace NzbDrone.Web.Controllers { public class AddSeriesController : Controller { + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly ConfigProvider _configProvider; private readonly QualityProvider _qualityProvider; private readonly RootDirProvider _rootFolderProvider; @@ -68,17 +71,25 @@ public ActionResult AddNew() return View(); } - public ActionResult Add() + public ActionResult Index() { - var unmappedList = new List(); + var rootDirs = _rootFolderProvider.GetAll(); var profiles = _qualityProvider.GetAllProfiles(); var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile); var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality); - ViewData["qualities"] = selectList; - foreach (var folder in _rootFolderProvider.GetAll()) + return View(rootDirs); + } + + public ActionResult AddExisting() + { + var rootDirs = _rootFolderProvider.GetAll(); + + var unmappedList = new List(); + + foreach (var folder in rootDirs) { unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path)); } @@ -109,15 +120,25 @@ public ActionResult RenderPartial(string path) [HttpPost] public JsonResult AddNewSeries(string rootPath, string seriesName, int seriesId, int qualityProfileId) { - var path = rootPath.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar).Replace('`', '\'') + - Path.DirectorySeparatorChar + EpisodeRenameHelper.CleanFilename(seriesName); + try + { + var path = + rootPath.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar).Replace( + '`', '\'') + + Path.DirectorySeparatorChar + EpisodeRenameHelper.CleanFilename(seriesName); - //Create the folder for the new series and then Add it - _diskProvider.CreateDirectory(path); + //Create the folder for the new series and then Add it + _diskProvider.CreateDirectory(path); - _seriesProvider.AddSeries(path, seriesId, qualityProfileId); - ScanNewSeries(); - return new JsonResult { Data = "ok" }; + _seriesProvider.AddSeries(path, seriesId, qualityProfileId); + ScanNewSeries(); + return new JsonResult {Data = "ok"}; + } + + catch(Exception ex) + { + return new JsonResult { Data = "failed" }; + } } public JsonResult AddSeries(string path, int seriesId, int qualityProfileId) @@ -157,5 +178,80 @@ public SelectList GetSuggestionList(string searchString) 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); + } } } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index b88d81708..1a00d24d9 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -62,21 +62,11 @@ public ActionResult Index(string viewName) ViewData["viewName"] = viewName; else - return RedirectToAction("General"); + return RedirectToAction("Indexers"); return View("Index"); } - public ActionResult General() - { - ViewData["viewName"] = "General"; - - return View("Index", new SettingsModel - { - Directories = _rootDirProvider.GetAll() - }); - } - public ActionResult Indexers() { ViewData["viewName"] = "Indexers"; @@ -236,40 +226,6 @@ public ActionResult GetQualityProfileView(QualityProfile 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() { return PartialView(); @@ -317,29 +273,6 @@ public JsonResult AutoConfigureSab() } } - 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] public ActionResult SaveGeneral(SettingsModel data) { diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index f2efa08af..4ae355cbf 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -683,7 +683,7 @@ - + @@ -715,10 +715,9 @@ - - + @@ -891,6 +890,9 @@ + + +