Added Growl Settings to GUI.

This commit is contained in:
Mark McDowall 2011-11-02 00:09:52 -07:00
parent ee90564519
commit be64822f08
6 changed files with 78 additions and 2 deletions

View File

@ -354,7 +354,7 @@ namespace NzbDrone.Core.Providers.Core
public virtual string GrowlHost public virtual string GrowlHost
{ {
get { return GetValue("GrowlHost", String.Empty); } get { return GetValue("GrowlHost", "localhost:23053"); }
set { SetValue("GrowlHost", value); } set { SetValue("GrowlHost", value); }
} }

View File

@ -173,7 +173,12 @@ namespace NzbDrone.Web.Controllers
SmtpToAddresses = _configProvider.SmtpToAddresses, SmtpToAddresses = _configProvider.SmtpToAddresses,
TwitterEnabled = _externalNotificationProvider.GetSettings(typeof(Twitter)).Enable, TwitterEnabled = _externalNotificationProvider.GetSettings(typeof(Twitter)).Enable,
TwitterNotifyOnGrab = _configProvider.TwitterNotifyOnGrab, TwitterNotifyOnGrab = _configProvider.TwitterNotifyOnGrab,
TwitterNotifyOnDownload = _configProvider.TwitterNotifyOnDownload TwitterNotifyOnDownload = _configProvider.TwitterNotifyOnDownload,
GrowlEnabled = _externalNotificationProvider.GetSettings(typeof(Growl)).Enable,
GrowlNotifyOnGrab = _configProvider.GrowlNotifyOnGrab,
GrowlNotifyOnDownload = _configProvider.GrowlNotifyOnDownload,
GrowlHost = _configProvider.GrowlHost,
GrowlPassword = _configProvider.GrowlPassword
}; };
return View(model); return View(model);
@ -469,6 +474,16 @@ namespace NzbDrone.Web.Controllers
_configProvider.TwitterNotifyOnGrab = data.TwitterNotifyOnGrab; _configProvider.TwitterNotifyOnGrab = data.TwitterNotifyOnGrab;
_configProvider.TwitterNotifyOnDownload = data.TwitterNotifyOnDownload; _configProvider.TwitterNotifyOnDownload = data.TwitterNotifyOnDownload;
//Growl
var growlSettings = _externalNotificationProvider.GetSettings(typeof(Growl));
growlSettings.Enable = data.GrowlEnabled;
_externalNotificationProvider.SaveSettings(growlSettings);
_configProvider.GrowlNotifyOnGrab = data.GrowlNotifyOnGrab;
_configProvider.GrowlNotifyOnDownload = data.GrowlNotifyOnDownload;
_configProvider.GrowlHost = data.GrowlHost;
_configProvider.GrowlPassword = data.GrowlPassword;
return GetSuccessResult(); return GetSuccessResult();
} }

View File

@ -110,5 +110,26 @@ namespace NzbDrone.Web.Models
[DisplayName("Notify on Download")] [DisplayName("Notify on Download")]
[Description("Send notification when episode is downloaded?")] [Description("Send notification when episode is downloaded?")]
public bool TwitterNotifyOnDownload { get; set; } public bool TwitterNotifyOnDownload { get; set; }
//Growl
[DisplayName("Enabled")]
[Description("Enable notifications for Growl?")]
public bool GrowlEnabled { get; set; }
[DisplayName("Notify on Grab")]
[Description("Send notification when episode is sent to SABnzbd?")]
public bool GrowlNotifyOnGrab { get; set; }
[DisplayName("Notify on Download")]
[Description("Send notification when episode is downloaded?")]
public bool GrowlNotifyOnDownload { get; set; }
[DisplayName("Host running Growl")]
[Description("Host or IP Address:Port")]
public string GrowlHost { get; set; }
[DisplayName("Growl host Password")]
[Description("Password is required if Growl is running on another system")]
public string GrowlPassword { get; set; }
} }
} }

View File

@ -945,6 +945,9 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\Settings\Twitter.cshtml" /> <Content Include="Views\Settings\Twitter.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\Growl.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.

View File

@ -0,0 +1,33 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.NotificationSettingsModel
@{
Layout = null;
}
<div id="growl" class="notifier clearfix">
<label class="labelClass">@Html.LabelFor(m => m.GrowlEnabled)
<span class="small">@Html.DescriptionFor(m => m.GrowlEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.GrowlEnabled, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.GrowlNotifyOnGrab)
<span class="small">@Html.DescriptionFor(m => m.GrowlNotifyOnGrab)</span>
</label>
@Html.CheckBoxFor(m => m.GrowlNotifyOnGrab, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.GrowlNotifyOnDownload)
<span class="small">@Html.DescriptionFor(m => m.GrowlNotifyOnDownload)</span>
</label>
@Html.CheckBoxFor(m => m.GrowlNotifyOnDownload, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.GrowlHost)
<span class="small">@Html.DescriptionFor(m => m.GrowlHost)</span>
</label>
@Html.TextBoxFor(m => m.GrowlHost, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.GrowlPassword)
<span class="small">@Html.DescriptionFor(m => m.GrowlPassword)</span>
</label>
@Html.TextBoxFor(m => m.GrowlPassword, new { @class = "inputClass" })
</div>

View File

@ -57,6 +57,7 @@
<li><a href="#tabs-xbmc">XBMC</a></li> <li><a href="#tabs-xbmc">XBMC</a></li>
<li><a href="#tabs-smtp">SMTP</a></li> <li><a href="#tabs-smtp">SMTP</a></li>
<li><a href="#tabs-twitter">Twitter</a></li> <li><a href="#tabs-twitter">Twitter</a></li>
<li><a href="#tabs-growl">Growl</a></li>
</ul> </ul>
<div id="tabs-xbmc"> <div id="tabs-xbmc">
@{Html.RenderPartial("Xbmc", Model);} @{Html.RenderPartial("Xbmc", Model);}
@ -67,6 +68,9 @@
<div id="tabs-twitter"> <div id="tabs-twitter">
@{Html.RenderPartial("Twitter", Model);} @{Html.RenderPartial("Twitter", Model);}
</div> </div>
<div id="tabs-growl">
@{Html.RenderPartial("Growl", Model);}
</div>
</div> </div>
<button type="submit" id="save_button" disabled="disabled">Save</button> <button type="submit" id="save_button" disabled="disabled">Save</button>