From e388b2d3b151f077951b4db78e6eb3c85c730b00 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 25 Apr 2011 12:02:29 -0700 Subject: [PATCH] Fixed display bug for Settings/Downloads, it will now show the correct Div for Blackhole/SABnzbd. --- NzbDrone.Core/NzbDrone.Core.csproj | 1 + .../Providers/Core/ConfigProvider.cs | 1 - .../Controllers/SettingsController.cs | 60 ++++++++----------- NzbDrone.Web/Views/Settings/Downloads.cshtml | 3 +- 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index ebd2c3da9..0f9621696 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -166,6 +166,7 @@ + diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index c124a966e..a026123e9 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -201,7 +201,6 @@ public virtual int DefaultQualityProfile set { SetValue("DefaultQualityProfile", value); } } - private string GetValue(string key) { return GetValue(key, String.Empty, false); diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index f145d09be..a327d17f4 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -64,10 +64,8 @@ public ActionResult Indexers() return View("Index", new IndexerSettingsModel { - NzbMatrixUsername = - _configProvider.GetValue("NzbMatrixUsername", String.Empty, true), - NzbMatrixApiKey = - _configProvider.GetValue("NzbMatrixApiKey", String.Empty, true), + NzbMatrixUsername = _configProvider.NzbMatrixUsername, + NzbMatrixApiKey = _configProvider.NzbMatrixApiKey, NzbsrusUId = _configProvider.NzbsrusUId, NzbsrusHash = _configProvider.NzbsrusHash, @@ -91,22 +89,21 @@ public ActionResult Downloads() var model = new DownloadSettingsModel { - SyncFrequency = Convert.ToInt32(_configProvider.GetValue("SyncFrequency", "15", true)), - DownloadPropers = - Convert.ToBoolean(_configProvider.GetValue("DownloadPropers", "false", true)), - Retention = Convert.ToInt32(_configProvider.GetValue("Retention", "500", true)), - SabHost = _configProvider.GetValue("SabHost", "localhost", true), - SabPort = Convert.ToInt32(_configProvider.GetValue("SabPort", "8080", true)), - SabApiKey = _configProvider.GetValue("SabApiKey", String.Empty, true), - SabUsername = _configProvider.GetValue("SabUsername", String.Empty, true), - SabPassword = _configProvider.GetValue("SabPassword", String.Empty, true), - SabTvCategory = _configProvider.GetValue("SabTvCategory", String.Empty, true), + SyncFrequency = Convert.ToInt32(_configProvider.SyncFrequency), + DownloadPropers = Convert.ToBoolean(_configProvider.DownloadPropers), + Retention = Convert.ToInt32(_configProvider.Retention), + SabHost = _configProvider.SabHost, + SabPort = Convert.ToInt32(_configProvider.SabPort), + SabApiKey = _configProvider.SabApiKey, + SabUsername = _configProvider.SabUsername, + SabPassword = _configProvider.SabPassword, + SabTvCategory = _configProvider.SabTvCategory, SabTvPriority = (SabnzbdPriorityType) Enum.Parse(typeof(SabnzbdPriorityType), - _configProvider.GetValue("SabTvPriority", "Normal", true)), - UseBlackHole = Convert.ToBoolean(_configProvider.GetValue("UseBlackHole", true, true)), - BlackholeDirectory = _configProvider.GetValue("BlackholeDirectory", String.Empty, true) + _configProvider.SabTvPriority), + UseBlackHole = Convert.ToBoolean(_configProvider.UseBlackhole), + BlackholeDirectory = _configProvider.BlackholeDirectory }; return View("Index", model); @@ -129,7 +126,7 @@ public ActionResult Quality() var profiles = _qualityProvider.GetAllProfiles().ToList(); var defaultQualityQualityProfileId = - Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId, true)); + Convert.ToInt32(_configProvider.DefaultQualityProfile); var selectList = new SelectList(profiles, "QualityProfileId", "Name"); @@ -151,25 +148,16 @@ public ActionResult Notifications() var model = new NotificationSettingsModel { XbmcEnabled = Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)), - XbmcNotifyOnGrab = - Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)), - XbmcNotifyOnDownload = - Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)), - XbmcNotifyOnRename = - Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)), - XbmcNotificationImage = - Convert.ToBoolean(_configProvider.GetValue("XbmcNotificationImage", false, true)), + XbmcNotifyOnGrab = Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)), + XbmcNotifyOnDownload = Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)), + XbmcNotifyOnRename = Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)), + XbmcNotificationImage = Convert.ToBoolean(_configProvider.GetValue("XbmcNotificationImage", false, true)), XbmcDisplayTime = Convert.ToInt32(_configProvider.GetValue("XbmcDisplayTime", 3, true)), - XbmcUpdateOnDownload = - Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload ", false, true)), - XbmcUpdateOnRename = - Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)), - XbmcFullUpdate = - Convert.ToBoolean(_configProvider.GetValue("XbmcFullUpdate", false, true)), - XbmcCleanOnDownload = - Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)), - XbmcCleanOnRename = - Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)), + XbmcUpdateOnDownload = Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload ", false, true)), + XbmcUpdateOnRename = Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)), + XbmcFullUpdate = Convert.ToBoolean(_configProvider.GetValue("XbmcFullUpdate", false, true)), + XbmcCleanOnDownload = Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)), + XbmcCleanOnRename = Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)), XbmcHosts = _configProvider.GetValue("XbmcHosts", "localhost:80", true), XbmcUsername = _configProvider.GetValue("XbmcUsername", String.Empty, true), XbmcPassword = _configProvider.GetValue("XbmcPassword", String.Empty, true) diff --git a/NzbDrone.Web/Views/Settings/Downloads.cshtml b/NzbDrone.Web/Views/Settings/Downloads.cshtml index 968b6da3e..9dd5a7467 100644 --- a/NzbDrone.Web/Views/Settings/Downloads.cshtml +++ b/NzbDrone.Web/Views/Settings/Downloads.cshtml @@ -16,6 +16,7 @@ function selectDownloadOptionAtStart() { var checked = $('UseBlackHole').val(); + var $radios = $('input[name="UseBlackhole"]'); $radios.filter('[value=' + checked + ']').attr('checked', true); selectDownloadOption(); } @@ -89,7 +90,7 @@
@Html.LabelFor(m => m.UseBlackHole) - @Html.CheckBoxFor(m => m.UseBlackHole, new { style="display:block" }) + @Html.CheckBoxFor(m => m.UseBlackHole, new { style="display:none" })
@Html.RadioButton("UseBlackhole", true, new { @class="blackhole_radio" })Blackhole