mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
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:
@@ -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 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user