mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge
--HG-- branch : 1.x
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
if ((int)Model.ContentItems.Items.Count == 0) {
|
||||
<div class="message notifications">@T("There are no content items.")</div>
|
||||
<div class="message info">@T("There are no content items.")</div>
|
||||
}
|
||||
else {
|
||||
<fieldset class="contentItems bulk-items">
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
</fieldset>
|
||||
|
||||
if ((int)Model.ContentItems.Items.Count == 0) {
|
||||
<div class="message notifications">@T("The '{0}' {1} has no content items.", Model.ContainerDisplayName, Model.ContainerContentType)</div>
|
||||
<div class="message info">@T("The '{0}' {1} has no content items.", Model.ContainerDisplayName, Model.ContainerContentType)</div>
|
||||
}
|
||||
else {
|
||||
<fieldset class="contentItems bulk-items">
|
||||
|
||||
@@ -75,9 +75,10 @@ namespace Orchard.Modules.Controllers {
|
||||
int totalItemCount = modules.Count();
|
||||
|
||||
if (pager.PageSize != 0) {
|
||||
modules = modules.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize).ToList();
|
||||
modules = modules.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize);
|
||||
}
|
||||
|
||||
modules = modules.ToList();
|
||||
foreach (ModuleEntry moduleEntry in modules) {
|
||||
moduleEntry.IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(moduleEntry.Descriptor);
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Packaging.Events;
|
||||
using Orchard.Packaging.Extensions;
|
||||
using Orchard.Packaging.Models;
|
||||
using Orchard.Packaging.Services;
|
||||
using Orchard.Packaging.ViewModels;
|
||||
@@ -18,7 +20,6 @@ using Orchard.UI.Navigation;
|
||||
using Orchard.UI.Notify;
|
||||
using Orchard.Utility.Extensions;
|
||||
using ILogger = Orchard.Logging.ILogger;
|
||||
using IPackageManager = Orchard.Packaging.Services.IPackageManager;
|
||||
using NullLogger = Orchard.Logging.NullLogger;
|
||||
|
||||
namespace Orchard.Packaging.Controllers {
|
||||
@@ -27,15 +28,20 @@ namespace Orchard.Packaging.Controllers {
|
||||
public class GalleryController : Controller {
|
||||
private readonly ShellSettings _shellSettings;
|
||||
private readonly IPackagingSourceManager _packagingSourceManager;
|
||||
private readonly IExtensionDisplayEventHandler _extensionDisplayEventHandler;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
|
||||
public GalleryController(
|
||||
IEnumerable<IExtensionDisplayEventHandler> extensionDisplayEventHandlers,
|
||||
ShellSettings shellSettings,
|
||||
IPackageManager packageManager,
|
||||
IPackagingSourceManager packagingSourceManager,
|
||||
IExtensionManager extensionManager,
|
||||
IOrchardServices services) {
|
||||
|
||||
_shellSettings = shellSettings;
|
||||
_packagingSourceManager = packagingSourceManager;
|
||||
_extensionDisplayEventHandler = extensionDisplayEventHandlers.FirstOrDefault();
|
||||
_extensionManager = extensionManager;
|
||||
Services = services;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
@@ -218,6 +224,23 @@ namespace Orchard.Packaging.Controllers {
|
||||
routeData.Values.Add("Options.SourceId", options.SourceId);
|
||||
pagerShape.RouteData(routeData);
|
||||
|
||||
extensions = extensions.ToList();
|
||||
|
||||
// Populate the notifications
|
||||
IEnumerable<Tuple<ExtensionDescriptor, PackagingEntry>> extensionDescriptors = _extensionManager.AvailableExtensions()
|
||||
.Join(extensions, extensionDescriptor => extensionDescriptor.Id, packaginEntry => packaginEntry.ExtensionId(),
|
||||
(extensionDescriptor, packagingEntry) => new Tuple<ExtensionDescriptor, PackagingEntry>(extensionDescriptor, packagingEntry));
|
||||
|
||||
foreach (Tuple<ExtensionDescriptor, PackagingEntry> packagings in extensionDescriptors) {
|
||||
packagings.Item2.Installed = true;
|
||||
|
||||
if (_extensionDisplayEventHandler != null) {
|
||||
foreach (string notification in _extensionDisplayEventHandler.Displaying(packagings.Item1)) {
|
||||
packagings.Item2.Notifications.Add(notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return View(packageType == DefaultExtensionTypes.Theme ? "Themes" : "Modules", new PackagingExtensionsViewModel {
|
||||
Extensions = extensions,
|
||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||
|
||||
@@ -7,13 +7,11 @@ using System.Web.Hosting;
|
||||
using System.Web.Mvc;
|
||||
using NuGet;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Modules.Services;
|
||||
using Orchard.Mvc.Extensions;
|
||||
using Orchard.Packaging.Models;
|
||||
using Orchard.Packaging.Services;
|
||||
using Orchard.Packaging.ViewModels;
|
||||
using Orchard.Recipes.Models;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using NuGet;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Packaging.Models;
|
||||
|
||||
namespace Orchard.Packaging.Extensions {
|
||||
public static class PackageExtensions {
|
||||
public static bool IsTheme(this IPackage package) {
|
||||
return IsTheme(package.Id);
|
||||
}
|
||||
|
||||
public static bool IsTheme(this PackagingEntry packagingEntry) {
|
||||
return IsTheme(packagingEntry.PackageId);
|
||||
}
|
||||
|
||||
public static string ExtensionFolder(this IPackage package) {
|
||||
return ExtensionFolder(package.IsTheme());
|
||||
}
|
||||
|
||||
public static string ExtensionFolder(this PackagingEntry packagingEntry) {
|
||||
return ExtensionFolder(packagingEntry.IsTheme());
|
||||
}
|
||||
|
||||
public static string ExtensionId(this IPackage package) {
|
||||
return ExtensionId(package.IsTheme(), package.Id);
|
||||
}
|
||||
|
||||
public static string ExtensionId(this PackagingEntry packagingEntry) {
|
||||
return ExtensionId(packagingEntry.IsTheme(), packagingEntry.PackageId);
|
||||
}
|
||||
|
||||
private static bool IsTheme(string packageId) {
|
||||
return packageId.StartsWith(Services.PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Theme));
|
||||
}
|
||||
|
||||
private static string ExtensionFolder(bool isTheme) {
|
||||
return isTheme ? "Themes" : "Modules";
|
||||
}
|
||||
|
||||
private static string ExtensionId(bool isTheme, string packageId) {
|
||||
return isTheme ?
|
||||
packageId.Substring(Services.PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Theme).Length) :
|
||||
packageId.Substring(Services.PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Module).Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.Packaging.Models {
|
||||
public class PackagingEntry {
|
||||
public PackagingEntry() {
|
||||
Notifications = new List<string>();
|
||||
}
|
||||
|
||||
public PackagingSource Source { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string PackageId { get; set; }
|
||||
@@ -17,5 +22,16 @@ namespace Orchard.Packaging.Models {
|
||||
public double Rating { get; set; }
|
||||
public int RatingsCount { get; set; }
|
||||
public int DownloadCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of package notifications.
|
||||
/// </summary>
|
||||
public List<string> Notifications { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean value indicating if any version of the same
|
||||
/// module has been previously installed.
|
||||
/// </summary>
|
||||
public bool Installed { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@
|
||||
<Compile Include="DefaultPackagingUpdater.cs" />
|
||||
<Compile Include="Events\ExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Extensions\PackageExtensions.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Models\PackagingSource.cs" />
|
||||
<Compile Include="Models\UpdatePackageEntry.cs" />
|
||||
@@ -169,6 +170,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\PackagingServices\InstallModuleDetails.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web.Hosting;
|
||||
using NuGet;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.VirtualPath;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Packaging.Extensions;
|
||||
using Orchard.Packaging.Models;
|
||||
using Orchard.UI.Notify;
|
||||
using NuGetPackageManager = NuGet.PackageManager;
|
||||
@@ -58,12 +58,11 @@ namespace Orchard.Packaging.Services {
|
||||
}
|
||||
|
||||
protected PackageInfo InstallPackage(IPackage package, IPackageRepository packageRepository, string location, string applicationPath) {
|
||||
InstallContext context = new InstallContext { Package = package };
|
||||
bool previousInstalled;
|
||||
|
||||
// 1. See if extension was previous installed and backup its folder if so
|
||||
try {
|
||||
previousInstalled = BackupExtensionFolder(context.ExtensionFolder, context.ExtensionId);
|
||||
previousInstalled = BackupExtensionFolder(package.ExtensionFolder(), package.ExtensionId());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new OrchardException(T("Unable to backup existing local package directory."), exception);
|
||||
@@ -72,7 +71,7 @@ namespace Orchard.Packaging.Services {
|
||||
if (previousInstalled) {
|
||||
// 2. If extension is installed, need to un-install first
|
||||
try {
|
||||
UninstallExtensionIfNeeded(context);
|
||||
UninstallExtensionIfNeeded(package);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
throw new OrchardException(T("Unable to un-install local package before updating."), exception);
|
||||
@@ -248,34 +247,14 @@ namespace Orchard.Packaging.Services {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UninstallExtensionIfNeeded(InstallContext context) {
|
||||
private void UninstallExtensionIfNeeded(IPackage package) {
|
||||
// Nuget requires to un-install the currently installed packages if the new
|
||||
// package is the same version or an older version
|
||||
try {
|
||||
Uninstall(context.Package.Id, _virtualPathProvider.MapPath("~\\"));
|
||||
_notifier.Information(T("Successfully un-installed local package {0}", context.ExtensionId));
|
||||
Uninstall(package.Id, _virtualPathProvider.MapPath("~\\"));
|
||||
_notifier.Information(T("Successfully un-installed local package {0}", package.ExtensionId()));
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
internal class InstallContext {
|
||||
public IPackage Package { get; set; }
|
||||
public bool IsTheme {
|
||||
get {
|
||||
return Package.Id.StartsWith(PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Theme));
|
||||
}
|
||||
}
|
||||
public string ExtensionFolder {
|
||||
get { return IsTheme ? "Themes" : "Modules"; }
|
||||
}
|
||||
|
||||
public string ExtensionId {
|
||||
get {
|
||||
return IsTheme ?
|
||||
Package.Id.Substring(PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Theme).Length) :
|
||||
Package.Id.Substring(PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Module).Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,13 @@
|
||||
</div>
|
||||
|
||||
<div class="properties">
|
||||
@if (item.Notifications != null && item.Notifications.Count > 0) {
|
||||
<div class="notifications">
|
||||
@foreach (string notification in item.Notifications) {
|
||||
<h5>@notification</h5>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<p>@(item.Description == null ? T("(No description").Text : item.Description)</p>
|
||||
<ul class="pageStatus group">
|
||||
<li>@T("Last Updated: {0}", item.LastUpdated)</li>
|
||||
|
||||
@@ -70,6 +70,13 @@
|
||||
</div>
|
||||
|
||||
<div class="properties">
|
||||
@if (item.Notifications != null && item.Notifications.Count > 0) {
|
||||
<div class="notifications">
|
||||
@foreach (string notification in item.Notifications) {
|
||||
<h5>@notification</h5>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<p>@(item.Description == null ? T("(No description").Text : item.Description)</p>
|
||||
<ul class="pageStatus group">
|
||||
<li>@T("Last Updated: {0}", item.LastUpdated)</li>
|
||||
|
||||
BIN
src/Orchard.Web/Themes/TheAdmin/Styles/images/info.gif
Normal file
BIN
src/Orchard.Web/Themes/TheAdmin/Styles/images/info.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 288 B |
@@ -119,6 +119,8 @@ body {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
iframe {border:1px solid #eee;}
|
||||
|
||||
/* Headings */
|
||||
h1,h2,h3,h4,h5,h6 { font-weight: normal;}
|
||||
|
||||
@@ -157,8 +159,8 @@ hr {border:0; height:1px; color:#e4e5e6; background-color:#e4e5e6;}
|
||||
min-height:100%;
|
||||
}
|
||||
#layout-main {
|
||||
display:inline;
|
||||
overflow:auto;
|
||||
/*display:inline;
|
||||
overflow:auto;*/
|
||||
float:right;
|
||||
margin-left:-240px;
|
||||
width:100%;
|
||||
@@ -508,6 +510,11 @@ span.message {
|
||||
background:#e68585; /* red */
|
||||
color:#fff;
|
||||
}
|
||||
.info {
|
||||
background: url(images/info.gif) no-repeat 5px 5px #fff;
|
||||
border:1px solid #e4e8ee; /* blue */
|
||||
padding-left:26px;
|
||||
}
|
||||
.message-Information, .notifications {
|
||||
background:#e6f1c9; /* green */
|
||||
border:1px solid #cfe493;
|
||||
@@ -534,7 +541,7 @@ span.message {
|
||||
/* Forms
|
||||
***************************************************************/
|
||||
|
||||
form { margin: 0; padding: 0; }
|
||||
form { margin: 0; padding: 0;}
|
||||
legend { font-size: 1.231em; font-weight: normal; border:none;}
|
||||
fieldset { padding:6px 0 0; margin:0 0 1em 0; border: 0px solid #dbdbdb; }
|
||||
label { font-weight:normal; display:block; padding: 0 0 0.3em 0; }
|
||||
@@ -551,7 +558,7 @@ form.inline fieldset {
|
||||
display:inline;
|
||||
height:auto;
|
||||
margin:0 4px 0 0;
|
||||
padding-top:0;
|
||||
padding:0 0 0 0;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:focus, input[type="radio"]:focus {
|
||||
@@ -597,7 +604,7 @@ input.textMedium {
|
||||
width:26em;
|
||||
}
|
||||
select {
|
||||
padding:1px;
|
||||
padding:1px;
|
||||
}
|
||||
select:focus, textarea:focus, input.text:focus, input.text-box:focus {
|
||||
border-color:#666d51;
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<Content Include="TheAdmin\Scripts\admin.js" />
|
||||
<Content Include="TheAdmin\Styles\ie.css" />
|
||||
<Content Include="TheAdmin\Styles\images\adminNavBackground.gif" />
|
||||
<Content Include="TheAdmin\Styles\images\info.gif" />
|
||||
<Content Include="TheAdmin\Styles\images\menu-default.png" />
|
||||
<Content Include="TheAdmin\Styles\images\menu-glyph.png" />
|
||||
<Content Include="TheAdmin\Styles\images\menuClosed.gif" />
|
||||
|
||||
Reference in New Issue
Block a user