--HG--
branch : 1.x
This commit is contained in:
Suha Can
2011-04-06 11:50:49 -07:00
12 changed files with 26 additions and 16 deletions

View File

@@ -83,7 +83,7 @@ namespace Orchard.Modules.Controllers {
moduleEntry.IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(moduleEntry.Descriptor);
if (_extensionDisplayEventHandler != null) {
foreach (string notification in _extensionDisplayEventHandler.Displaying(moduleEntry.Descriptor)) {
foreach (string notification in _extensionDisplayEventHandler.Displaying(moduleEntry.Descriptor, ControllerContext.RequestContext)) {
moduleEntry.Notifications.Add(notification);
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Web.Routing;
using Orchard.Environment.Extensions.Models;
using Orchard.Events;
@@ -7,6 +8,6 @@ namespace Orchard.Modules.Events {
/// <summary>
/// Called before an extension is displayed
/// </summary>
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor);
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor, RequestContext requestContext);
}
}

View File

@@ -9,7 +9,7 @@
@if (Model.ContentPart.Notifications != null && Model.ContentPart.Notifications.Count > 0) {
<div class="notifications">
@foreach (string notification in Model.ContentPart.Notifications) {
<h5>@notification</h5>
<h5>@Html.Raw(notification)</h5>
}
</div>
}

View File

@@ -235,7 +235,7 @@ namespace Orchard.Packaging.Controllers {
packagings.Item2.Installed = true;
if (_extensionDisplayEventHandler != null) {
foreach (string notification in _extensionDisplayEventHandler.Displaying(packagings.Item1)) {
foreach (string notification in _extensionDisplayEventHandler.Displaying(packagings.Item1, ControllerContext.RequestContext)) {
packagings.Item2.Notifications.Add(notification);
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Orchard.DisplayManagement;
@@ -11,7 +10,6 @@ using Orchard.Logging;
using Orchard.Packaging.Models;
using Orchard.Packaging.Services;
using Orchard.Packaging.ViewModels;
using Orchard.Reports;
using Orchard.Reports.Services;
using Orchard.Security;
using Orchard.Themes;

View File

@@ -1,5 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;
@@ -26,7 +29,7 @@ namespace Orchard.Packaging.Events {
public Localizer T { get; set; }
public IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor) {
public IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor, RequestContext requestContext) {
// Get status from background task state or directly
_backgroundPackageUpdateStatus.Value =
_backgroundPackageUpdateStatus.Value ??
@@ -37,7 +40,12 @@ namespace Orchard.Packaging.Events {
if (updatePackageEntry != null) {
if (updatePackageEntry.NewVersionToInstall != null) {
yield return T("Version {0} is available.", updatePackageEntry.NewVersionToInstall.Version).ToString();
UrlHelper urlHelper = new UrlHelper(requestContext);
yield return T("Version {0} is available (See <a href=\"{1}\">Updates</a>).", updatePackageEntry.NewVersionToInstall.Version,
urlHelper.Action(DefaultExtensionTypes.IsTheme(updatePackageEntry.ExtensionsDescriptor.ExtensionType)
? "ThemesUpdates"
: "ModulesUpdates",
"GalleryUpdates")).ToString();
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Web.Routing;
using Orchard.Environment.Extensions.Models;
using Orchard.Events;
@@ -7,6 +8,6 @@ namespace Orchard.Packaging.Events {
/// <summary>
/// Called before an extension is displayed
/// </summary>
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor);
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor, RequestContext requestContext);
}
}

View File

@@ -51,7 +51,7 @@
@if (item.Notifications != null && item.Notifications.Count > 0) {
<div class="notifications">
@foreach (string notification in item.Notifications) {
<h5>@notification</h5>
<h5>@Html.Raw(notification)</h5>
}
</div>
}

View File

@@ -73,7 +73,7 @@
@if (item.Notifications != null && item.Notifications.Count > 0) {
<div class="notifications">
@foreach (string notification in item.Notifications) {
<h5>@notification</h5>
<h5>@Html.Raw(notification)</h5>
}
</div>
}

View File

@@ -92,7 +92,8 @@ namespace Orchard.Themes.Controllers {
};
if (_extensionDisplayEventHandler != null) {
foreach (string notification in _extensionDisplayEventHandler.Displaying(themeEntry.Descriptor)) {
foreach (string notification in _extensionDisplayEventHandler.Displaying(themeEntry.Descriptor, ControllerContext.RequestContext))
{
themeEntry.Notifications.Add(notification);
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Web.Routing;
using Orchard.Environment.Extensions.Models;
using Orchard.Events;
@@ -7,6 +8,6 @@ namespace Orchard.Themes.Events {
/// <summary>
/// Called before an extension is displayed
/// </summary>
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor);
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor, RequestContext requestContext);
}
}

View File

@@ -41,12 +41,12 @@
<button type="submit" class="disable" title="Disable">@T("Disable")</button>
}
}
else {
else {
using (Html.BeginFormAntiForgeryPost(Url.Action("Enable"), FormMethod.Post, new { @class = "inline link" })) {
@Html.Hidden("themeName", (string)Model.ContentPart.Descriptor.Id)
<button type="submit" class="enable" title="Enable">@T("Enable")</button>
}
}
}
@if (Model.ContentPart.NeedsUpdate) {
<span> | </span>