mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
Merge branch 'markus101'
This commit is contained in:
commit
25007c7807
BIN
NzbDrone.Web/Content/Images/VideoFolder.png
Normal file
BIN
NzbDrone.Web/Content/Images/VideoFolder.png
Normal file
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;
|
||||
}
|
||||
|
||||
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%
|
||||
}
|
||||
}
|
@ -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<String>();
|
||||
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<String>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
@ -683,7 +683,7 @@
|
||||
<Content Include="Scripts\jquery-tgc-countdown-1.0.js" />
|
||||
<Content Include="Scripts\jquery.simpledropdown.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\AddSeriesItem.cshtml" />
|
||||
<Content Include="Web.config">
|
||||
@ -715,10 +715,9 @@
|
||||
<Content Include="Views\System\Jobs.cshtml" />
|
||||
<Content Include="Views\Settings\Sabnzbd.cshtml" />
|
||||
<Content Include="Views\Settings\EpisodeSorting.cshtml" />
|
||||
<Content Include="Views\Settings\General.cshtml" />
|
||||
<Content Include="Views\Settings\Notifications.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\Shared\SiteLayout.cshtml" />
|
||||
<Content Include="Views\Shared\Footer.cshtml" />
|
||||
@ -891,6 +890,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Series\SingleSeason.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\AddSeries\AddExisting.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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.
|
||||
|
@ -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>
|
15
NzbDrone.Web/Views/AddSeries/AddExisting.cshtml
Normal file
15
NzbDrone.Web/Views/AddSeries/AddExisting.cshtml
Normal file
@ -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,
|
||||
data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }),
|
||||
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
|
||||
$("#seriesList_new").data("tComboBox").text('');
|
||||
|
||||
//Close the Window!
|
||||
closeAddNewSeries();
|
||||
//Through up an alert if we failed to add the series
|
||||
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>
|
||||
<div>
|
||||
@{Html.Telerik().ComboBox()
|
||||
.Name("seriesList_" + ViewData["guid"].ToString())
|
||||
.Name("seriesList_" + ViewData["guid"])
|
||||
.BindTo(Model)
|
||||
.DataBinding(binding => binding.Ajax().Select("_textLookUp", "AddSeries").Delay(400))
|
||||
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.Contains))
|
||||
.HighlightFirstMatch(true)
|
||||
.HtmlAttributes(new { style = "width: 300px;" })
|
||||
.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()' )">
|
||||
Add</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</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>
|
||||
</div>
|
173
NzbDrone.Web/Views/AddSeries/Index.cshtml
Normal file
173
NzbDrone.Web/Views/AddSeries/Index.cshtml
Normal file
@ -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>
|
16
NzbDrone.Web/Views/AddSeries/RootDir.cshtml
Normal file
16
NzbDrone.Web/Views/AddSeries/RootDir.cshtml
Normal file
@ -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 =>
|
||||
{
|
||||
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("Rename All").Action<SeriesController>(c => c.RenameAll());
|
||||
}).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;" })
|
||||
.ExpandMode(PanelBarExpandMode.Single)
|
||||
.SelectedIndex(0)
|
||||
.Items(item =>
|
||||
.Items(indexerItem =>
|
||||
{
|
||||
item.Add()
|
||||
indexerItem.Add()
|
||||
.Text("NZBs.org")
|
||||
.ImageUrl("~/Content/Images/Indexers/NzbsOrg.png")
|
||||
.Content(
|
||||
"<div class=\"section_content\">" +
|
||||
.Content(@<text>
|
||||
<div class="section_content">
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
Enabled
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "indexer_checkbox" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
"Enabled" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "indexer_checkbox" }) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NzbsOrgUId) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NzbsOrgUId) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NzbsOrgHash) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NzbsOrgHash) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>"
|
||||
);
|
||||
item.Add()
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NzbsOrgUId)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NzbsOrgUId)
|
||||
</div>
|
||||
</div>
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NzbsOrgHash)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NzbsOrgHash)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</text>);
|
||||
indexerItem.Add()
|
||||
.Text("NZB Matrix")
|
||||
.ImageUrl("~/Content/Images/Indexers/NzbMatrix.png")
|
||||
.Content(
|
||||
"<div class=\"section_content\">" +
|
||||
.Content(@<text>
|
||||
<div class="section_content">
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
"Enabled" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "indexer_checkbox" }) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
Enabled
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "indexer_checkbox" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NzbMatrixUsername) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NzbMatrixUsername) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NzbMatrixApiKey) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NzbMatrixApiKey) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>"
|
||||
);
|
||||
item.Add()
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NzbMatrixUsername)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NzbMatrixUsername)
|
||||
</div>
|
||||
</div>
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NzbMatrixApiKey)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NzbMatrixApiKey)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</text>);
|
||||
indexerItem.Add()
|
||||
.Text("NZBsRus")
|
||||
.ImageUrl("~/Content/Images/Indexers/NzbsRus.png")
|
||||
.Content(
|
||||
"<div class=\"section_content\">" +
|
||||
.Content(@<text>
|
||||
<div class="section_content">
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
"Enabled" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "indexer_checkbox" }) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
Enabled
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "indexer_checkbox" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NzbsrusUId) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NzbsrusUId) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NzbsrusHash) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NzbsrusHash) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>"
|
||||
);
|
||||
item.Add()
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NzbsrusUId)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NzbsrusUId)
|
||||
</div>
|
||||
</div>
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NzbsrusHash)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NzbsrusHash)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</text>);
|
||||
indexerItem.Add()
|
||||
.Text("Newzbin")
|
||||
.ImageUrl("~/Content/Images/Indexers/Newzbin.png")
|
||||
.Content(
|
||||
"<div class=\"section_content\">" +
|
||||
.Content(@<text>
|
||||
<div class="section_content">
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
"Enabled" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "indexer_checkbox" }) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
Enabled
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "indexer_checkbox" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NewzbinUsername) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NewzbinUsername) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_group\">" +
|
||||
"<div class=\"indexer_left\">" +
|
||||
Html.LabelFor(m => m.NewzbinPassword) +
|
||||
"</div>" +
|
||||
"<div class=\"indexer_right\">" +
|
||||
Html.TextBoxFor(m => m.NewzbinPassword) +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>"
|
||||
);
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NewzbinUsername)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NewzbinUsername)
|
||||
</div>
|
||||
</div>
|
||||
<div class="indexer_group">
|
||||
<div class="indexer_left">
|
||||
@Html.LabelFor(m => m.NewzbinPassword)
|
||||
</div>
|
||||
<div class="indexer_right">
|
||||
@Html.TextBoxFor(m => m.NewzbinPassword)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</text>);
|
||||
}).Render();
|
||||
}
|
||||
</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…
Reference in New Issue
Block a user