Fix for bug 17588

--HG--
branch : 1.x
extra : transplant_source : %B0G5%2A%21%ED%B8%F0Z%B2%9E%AB%7D%C2%0Ad%C5%DAn%81
This commit is contained in:
Jonas@JONAS-DATOR.JOAN.local
2011-09-06 18:39:14 +02:00
parent c01df84e95
commit 5b76da2837

View File

@@ -1,27 +1,37 @@
using System.Collections.Generic;
using System.Web.Mvc;
using Orchard.ContentManagement;
using Orchard.Localization;
using Orchard.Email.Models;
using Orchard.Localization;
using Orchard.UI.Admin.Notification;
using Orchard.UI.Notify;
namespace Orchard.Email.Services {
public class MissingSettingsBanner: INotificationProvider {
namespace Orchard.Email.Services
{
public class MissingSettingsBanner : INotificationProvider
{
private readonly IOrchardServices _orchardServices;
private readonly WorkContext _workContext;
public MissingSettingsBanner(IOrchardServices orchardServices) {
public MissingSettingsBanner(IOrchardServices orchardServices, WorkContext workContext)
{
_orchardServices = orchardServices;
_workContext = workContext;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
public IEnumerable<NotifyEntry> GetNotifications() {
public IEnumerable<NotifyEntry> GetNotifications()
{
var smtpSettings = _orchardServices.WorkContext.CurrentSite.As<SmtpSettingsPart>();
if ( smtpSettings == null || !smtpSettings.IsValid() ) {
yield return new NotifyEntry { Message = T("The SMTP settings needs to be configured." ), Type = NotifyType.Warning};
if (smtpSettings == null || !smtpSettings.IsValid())
{
var urlHelper = new UrlHelper(_workContext.HttpContext.Request.RequestContext);
var url = urlHelper.Action("Email", "Admin", new { Area = "Settings" });
yield return new NotifyEntry { Message = T("The <a href=\"{0}\">SMTP settings</a> needs to be configured.", url), Type = NotifyType.Warning };
}
}
}