Updated IndexerSettingsModel with better descriptions.

Enable checkbox for Indexer is now labeled as such.
Removed jscript load for deleted script.
A user will now be unable to add a rootDir if the SabDropDir value is the same (ignoring case).
A user will also be unable to set their SabDropDir to the same value as an exiting RootDir (Ignoring case).
The last two changes prevent users from possibly causing all TV shows to be deleted.
This commit is contained in:
Mark McDowall 2011-09-22 17:18:41 -07:00
parent 3efe465114
commit 95b4250d5d
5 changed files with 21 additions and 10 deletions

View File

@ -153,6 +153,10 @@ namespace NzbDrone.Web.Controllers
if (String.IsNullOrWhiteSpace(path))
return new JsonResult { Data = "failed" };
//Don't let a user add a rootDir that is the same as their SABnzbd TV Directory
if (path.Equals(_configProvider.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase))
return new JsonResult { Data = "failed" };
try
{
_rootFolderProvider.Add(new RootDir { Path = path });

View File

@ -28,14 +28,16 @@ namespace NzbDrone.Web.Controllers
private readonly SeriesProvider _seriesProvider;
private readonly ExternalNotificationProvider _externalNotificationProvider;
private readonly QualityTypeProvider _qualityTypeProvider;
private readonly RootDirProvider _rootDirProvider;
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
QualityTypeProvider qualityTypeProvider)
QualityTypeProvider qualityTypeProvider, RootDirProvider rootDirProvider)
{
_externalNotificationProvider = externalNotificationProvider;
_qualityTypeProvider = qualityTypeProvider;
_rootDirProvider = rootDirProvider;
_configProvider = configProvider;
_indexerProvider = indexerProvider;
_qualityProvider = qualityProvider;
@ -315,6 +317,12 @@ namespace NzbDrone.Web.Controllers
{
if (ModelState.IsValid)
{
//Check to see if the TV Directory matches any RootDirs (Ignoring Case), if it does, return an error to the user
//This prevents a user from finding a way to delete their entire TV Library
var rootDirs = _rootDirProvider.GetAll();
if (rootDirs.Any(r => r.Path.Equals(data.SabDropDirectory, StringComparison.InvariantCultureIgnoreCase)))
Json(new NotificationResult { Title = "Failed", Text = "Invalid TV Directory", NotificationType = NotificationType.Error });
_configProvider.SabHost = data.SabHost;
_configProvider.SabPort = data.SabPort;
_configProvider.SabApiKey = data.SabApiKey;

View File

@ -57,19 +57,19 @@ namespace NzbDrone.Web.Models
public String NewzbinPassword { get; set; }
[DisplayName("NZBs.org")]
[Description("Scan Nzbs.org for new epsiodes")]
[Description("Enable downloading episodes from Nzbs.org")]
public bool NzbsOrgEnabled { get; set; }
[DisplayName("NZB Matrix")]
[Description("Scan NZB Matrix for new epsiodes")]
[Description("Enable downloading episodes from NZB Matrix")]
public bool NzbMatrixEnabled { get; set; }
[DisplayName("NZBsRUs")]
[Description("Scan NZBsRus for new epsiodes")]
[Description("Enable downloading episodes from NZBsRus")]
public bool NzbsRUsEnabled { get; set; }
[DisplayName("Newzbin")]
[Description("Scan Newzbin for new epsiodes")]
[Description("Enable downloading episodes from Newzbin")]
public bool NewzbinEnabled { get; set; }
}
}

View File

@ -42,7 +42,7 @@
.ImageUrl("~/Content/Images/Indexers/Nzbs.org.png")
.Content(@<text>
<div class="indexerPanel clearfix">
<label class="labelClass">@Html.LabelFor(m => m.NzbsOrgEnabled)
<label class="labelClass">Enable
<span class="small">@Html.DescriptionFor(m => m.NzbsOrgEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NzbsOrgEnabled, new { @class = "inputClass checkClass" })
@ -63,7 +63,7 @@
.ImageUrl("~/Content/Images/Indexers/NzbMatrix.png")
.Content(@<text>
<div class="indexerPanel clearfix">
<label class="labelClass">@Html.LabelFor(m => m.NzbMatrixEnabled)
<label class="labelClass">Enable
<span class="small">@Html.DescriptionFor(m => m.NzbMatrixEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NzbMatrixEnabled, new { @class = "inputClass checkClass" })
@ -84,7 +84,7 @@
.ImageUrl("~/Content/Images/Indexers/NzbsRus.png")
.Content(@<text>
<div class="indexerPanel clearfix">
<label class="labelClass">@Html.LabelFor(m => m.NzbsRUsEnabled)
<label class="labelClass">Enable
<span class="small">@Html.DescriptionFor(m => m.NzbsRUsEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NzbsRUsEnabled, new { @class = "inputClass checkClass" })
@ -105,7 +105,7 @@
.ImageUrl("~/Content/Images/Indexers/Newzbin.png")
.Content(@<text>
<div class="indexerPanel clearfix">
<label class="labelClass">@Html.LabelFor(m => m.NewzbinEnabled)
<label class="labelClass">Enable
<span class="small">@Html.DescriptionFor(m => m.NewzbinEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.NewzbinEnabled, new { @class = "inputClass checkClass" })

View File

@ -21,7 +21,6 @@
<script type="text/javascript" src="/Scripts/Plugins/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/MicrosoftMvcAjax.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/jquery.gritter.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/jquery.livequery.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/jquery.form.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/jquery-tgc-countdown-1.0.js"></script>
<script type="text/javascript" src="/Scripts/Plugins/jquery.watermark.min.js"></script>