diff --git a/src/Orchard.Tests.Modules/Indexing/LuceneIndexProviderTests.cs b/src/Orchard.Tests.Modules/Indexing/LuceneIndexProviderTests.cs index 250df2ff6..c1a16a748 100644 --- a/src/Orchard.Tests.Modules/Indexing/LuceneIndexProviderTests.cs +++ b/src/Orchard.Tests.Modules/Indexing/LuceneIndexProviderTests.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using Autofac; +using Lucene.Services; using NUnit.Framework; using Orchard.Environment.Configuration; using Orchard.FileSystems.AppData; diff --git a/src/Orchard.Tests.Modules/Indexing/LuceneSearchBuilderTests.cs b/src/Orchard.Tests.Modules/Indexing/LuceneSearchBuilderTests.cs index c7ba85220..59c9c0eaf 100644 --- a/src/Orchard.Tests.Modules/Indexing/LuceneSearchBuilderTests.cs +++ b/src/Orchard.Tests.Modules/Indexing/LuceneSearchBuilderTests.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using Autofac; +using Lucene.Services; using NUnit.Framework; using Orchard.Environment.Configuration; using Orchard.FileSystems.AppData; diff --git a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj index d683f24ca..0faae51d2 100644 --- a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj +++ b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj @@ -130,6 +130,10 @@ {9916839C-39FC-4CEB-A5AF-89CA7E87119F} Orchard.Core + + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D} + Lucene + {EA2B9121-EF54-40A6-A53E-6593C86EE696} Orchard.Indexing diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index b798985a9..e8bf3efd9 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -289,7 +289,9 @@ - + + + diff --git a/src/Orchard.Web/Modules/Lucene/Lucene.csproj b/src/Orchard.Web/Modules/Lucene/Lucene.csproj new file mode 100644 index 000000000..ac93a8f8e --- /dev/null +++ b/src/Orchard.Web/Modules/Lucene/Lucene.csproj @@ -0,0 +1,117 @@ + + + + Debug + AnyCPU + + + 2.0 + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D} + {F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Lucene + Lucene + v4.0 + false + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\..\..\..\lib\lucene.net\Lucene.Net.dll + + + + + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + 3.5 + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} + Orchard.Framework + + + + + + + + + + + + + False + True + 10461 + / + + + False + False + + + False + + + + + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Models/LuceneDocumentIndex.cs b/src/Orchard.Web/Modules/Lucene/Models/LuceneDocumentIndex.cs similarity index 95% rename from src/Orchard.Web/Modules/Orchard.Indexing/Models/LuceneDocumentIndex.cs rename to src/Orchard.Web/Modules/Lucene/Models/LuceneDocumentIndex.cs index 32cab14c3..d76964f51 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Models/LuceneDocumentIndex.cs +++ b/src/Orchard.Web/Modules/Lucene/Models/LuceneDocumentIndex.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; using Lucene.Net.Documents; +using Orchard; +using Orchard.Indexing; using Orchard.Localization; using Orchard.Utility.Extensions; -namespace Orchard.Indexing.Models { +namespace Lucene.Models { public class LuceneDocumentIndex : IDocumentIndex { diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Models/LuceneSearchHit.cs b/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs similarity index 92% rename from src/Orchard.Web/Modules/Orchard.Indexing/Models/LuceneSearchHit.cs rename to src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs index 2946b6553..ed44a73f6 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Models/LuceneSearchHit.cs +++ b/src/Orchard.Web/Modules/Lucene/Models/LuceneSearchHit.cs @@ -1,8 +1,9 @@ using Lucene.Net.Documents; using System.Globalization; using Lucene.Net.Util; +using Orchard.Indexing; -namespace Orchard.Indexing.Models { +namespace Lucene.Models { public class LuceneSearchHit : ISearchHit { private readonly Document _doc; private readonly float _score; diff --git a/src/Orchard.Web/Modules/Lucene/Module.txt b/src/Orchard.Web/Modules/Lucene/Module.txt new file mode 100644 index 000000000..421e8c791 --- /dev/null +++ b/src/Orchard.Web/Modules/Lucene/Module.txt @@ -0,0 +1,11 @@ +name: Lucene +antiforgery: enabled +author: The Orchard Team +website: http://orchardproject.net +version: 0.1 +orchardversion: 0.1.2010.0312 +description: The Lucene module enables the site to be indexed usin Lucene.NET. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site. +features: + Lucene: + Description: Lucene indexing services. + Category: Search \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..a2aa15936 --- /dev/null +++ b/src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Lucene")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Lucene")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ab8e1272-1749-4e27-a123-83c8d47e321a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Services/LuceneIndexProvider.cs b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs similarity index 96% rename from src/Orchard.Web/Modules/Orchard.Indexing/Services/LuceneIndexProvider.cs rename to src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs index 0333687fb..ff5b964ca 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Services/LuceneIndexProvider.cs +++ b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs @@ -2,22 +2,23 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Lucene.Models; using Lucene.Net.Analysis; using Lucene.Net.Analysis.Standard; using Lucene.Net.Documents; using Lucene.Net.Index; using Lucene.Net.Search; using Lucene.Net.Store; +using System.Xml.Linq; using Orchard.Environment.Configuration; using Orchard.FileSystems.AppData; -using Orchard.Indexing.Models; +using Orchard.Indexing; using Orchard.Localization; using Orchard.Logging; -using System.Xml.Linq; using Directory = Lucene.Net.Store.Directory; using Version = Lucene.Net.Util.Version; -namespace Orchard.Indexing.Services { +namespace Lucene.Services { /// /// Represents the default implementation of an IIndexProvider, based on Lucene /// diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Services/LuceneSearchBuilder.cs b/src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs similarity index 96% rename from src/Orchard.Web/Modules/Orchard.Indexing/Services/LuceneSearchBuilder.cs rename to src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs index 553f62632..b6c689e20 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Services/LuceneSearchBuilder.cs +++ b/src/Orchard.Web/Modules/Lucene/Services/LuceneSearchBuilder.cs @@ -2,16 +2,16 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using Lucene.Net.Analysis; +using Lucene.Models; using Lucene.Net.Index; using Lucene.Net.Search; using Lucene.Net.Store; -using Orchard.Indexing.Models; +using Orchard.Indexing; using Orchard.Logging; using Lucene.Net.Documents; using Lucene.Net.QueryParsers; -namespace Orchard.Indexing.Services { +namespace Lucene.Services { public class LuceneSearchBuilder : ISearchBuilder { private const int MaxResults = Int16.MaxValue; diff --git a/src/Orchard.Web/Modules/Lucene/Web.config b/src/Orchard.Web/Modules/Lucene/Web.config new file mode 100644 index 000000000..c654951f1 --- /dev/null +++ b/src/Orchard.Web/Modules/Lucene/Web.config @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/Commands/ScaffoldingCommands.cs b/src/Orchard.Web/Modules/Orchard.DevTools/Commands/ScaffoldingCommands.cs index 6a3a4fb12..ede0ec79b 100644 --- a/src/Orchard.Web/Modules/Orchard.DevTools/Commands/ScaffoldingCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.DevTools/Commands/ScaffoldingCommands.cs @@ -140,14 +140,6 @@ namespace Orchard.DevTools.Commands { CreateFilesFromTemplates(moduleName, projectGuid); // The string searches in solution/project files can be made aware of comment lines. if (IncludeInSolution) { - // Add project reference to Orchard.Web.csproj - string webProjectReference = string.Format( - "\r\n \r\n {{{1}}}\r\n {0}\r\n ", - moduleName, projectGuid); - string webProjectText = File.ReadAllText(rootWebProjectPath); - webProjectText = webProjectText.Insert(webProjectText.LastIndexOf("\r\n"), webProjectReference); - File.WriteAllText(rootWebProjectPath, webProjectText); - // Add project to Orchard.sln string solutionPath = Directory.GetParent(rootWebProjectPath).Parent.FullName + "\\Orchard.sln"; if (File.Exists(solutionPath)) { @@ -177,6 +169,12 @@ namespace Orchard.DevTools.Commands { Directory.CreateDirectory(modulePath); Directory.CreateDirectory(propertiesPath); + Directory.CreateDirectory(modulePath + "Controllers"); + Directory.CreateDirectory(modulePath + "Views"); + File.WriteAllText(modulePath + "\\Views\\Web.config", File.ReadAllText(templatesPath + "ViewsWebConfig.txt")); + Directory.CreateDirectory(modulePath + "Models"); + Directory.CreateDirectory(modulePath + "Scripts"); + string templateText = File.ReadAllText(templatesPath + "ModuleAssemblyInfo.txt"); templateText = templateText.Replace("$$ModuleName$$", moduleName); templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString()); diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj b/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj index 6f46b98f8..089d9b74b 100644 --- a/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj +++ b/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj @@ -97,6 +97,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ModuleCsProj.txt b/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ModuleCsProj.txt index d6b6dd2d3..d51ce1f02 100644 --- a/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ModuleCsProj.txt +++ b/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ModuleCsProj.txt @@ -70,6 +70,13 @@ + + + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ViewsWebConfig.txt b/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ViewsWebConfig.txt new file mode 100644 index 000000000..7022197d4 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.DevTools/ScaffoldingTemplates/ViewsWebConfig.txt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt b/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt index aa8c0044f..d1e3aaa7a 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Module.txt @@ -7,5 +7,5 @@ orchardversion: 0.1.2010.0312 description: The Indexing module enables the site to be indexed. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site. features: Orchard.Indexing: - Description: Indexing services based on Lucene. + Description: Indexing infrastructure. Requires an index implementation like the Lucene module. Category: Search \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Orchard.Indexing.csproj b/src/Orchard.Web/Modules/Orchard.Indexing/Orchard.Indexing.csproj index ccc3e3f4d..20add5d2e 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Orchard.Indexing.csproj +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Orchard.Indexing.csproj @@ -32,9 +32,6 @@ 4 - - ..\..\..\..\lib\lucene.net\Lucene.Net.dll - @@ -68,16 +65,13 @@ - + - - - diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexServiceNotificationProvider.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexServiceNotificationProvider.cs new file mode 100644 index 000000000..495b1adfa --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Services/IndexServiceNotificationProvider.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Orchard.Localization; +using Orchard.UI.Admin.Notification; +using Orchard.UI.Notify; + +namespace Orchard.Indexing.Services { + public class IndexServiceNotificationProvider: INotificationProvider { + private readonly IIndexManager _indexManager; + + public IndexServiceNotificationProvider(IIndexManager indexManager) { + _indexManager = indexManager; + T = NullLocalizer.Instance; + } + + public Localizer T { get; set; } + + public IEnumerable GetNotifications() { + + if(!_indexManager.HasIndexProvider()) { + yield return new NotifyEntry { Message = T("You need to enable an index implementation module like Lucene." ), Type = NotifyType.Warning}; + } + } + } +} diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Commands/FeatureCommand.cs b/src/Orchard.Web/Modules/Orchard.Modules/Commands/FeatureCommand.cs index b2a40e5eb..0f76e6fba 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Commands/FeatureCommand.cs +++ b/src/Orchard.Web/Modules/Orchard.Modules/Commands/FeatureCommand.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using Orchard.Commands; using Orchard.Utility.Extensions; @@ -35,7 +36,7 @@ namespace Orchard.Modules.Commands { Context.Output.WriteLine(T(" Description: {0}", feature.Descriptor.Description.OrDefault(""))); Context.Output.WriteLine(T(" Category: {0}", feature.Descriptor.Category.OrDefault(""))); Context.Output.WriteLine(T(" Module: {0}", feature.Descriptor.Extension.Name.OrDefault(""))); - Context.Output.WriteLine(T(" Dependencies: {0}", string.Join(",", feature.Descriptor.Dependencies).OrDefault(""))); + Context.Output.WriteLine(T(" Dependencies: {0}", feature.Descriptor.Dependencies == null ? "" : string.Join(",", feature.Descriptor.Dependencies).OrDefault(""))); } } } @@ -45,8 +46,28 @@ namespace Orchard.Modules.Commands { [CommandName("feature enable")] public void Enable(params string[] featureNames) { Context.Output.WriteLine(T("Enabling features {0}", string.Join(",", featureNames))); - _moduleService.EnableFeatures(featureNames); - Context.Output.WriteLine(T("Enabled features {0}", string.Join(",", featureNames))); + bool listAvailableFeatures = false; + List featuresToEnable = new List(); + string[] availableFeatures = _moduleService.GetAvailableFeatures().Select(x => x.Descriptor.Name).ToArray(); + foreach (var featureName in featureNames) { + if (availableFeatures.Contains(featureName)) { + featuresToEnable.Add(featureName); + } + else { + Context.Output.WriteLine(T("Could not find feature {0}", featureName)); + listAvailableFeatures = true; + } + } + if (featuresToEnable.Count != 0) { + _moduleService.EnableFeatures(featuresToEnable); + Context.Output.WriteLine(T("Enabled features {0}", string.Join(",", featuresToEnable))); + } + else { + Context.Output.WriteLine(T("Could not enable features: {0}", string.Join(",", featureNames))); + listAvailableFeatures = true; + } + if (listAvailableFeatures) + Context.Output.WriteLine(T("Available features are : {0}", string.Join(",", availableFeatures))); } [CommandHelp("feature disable ... \r\n\t" + "Disable one or more features")] diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index 9d077021b..0f1176d6b 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -18,6 +18,7 @@ using Orchard.Environment.Configuration; using Orchard.Environment.ShellBuilders; using Orchard.Environment.Descriptor; using Orchard.Environment.Descriptor.Models; +using Orchard.Indexing; using Orchard.Localization; using Orchard.Localization.Services; using Orchard.Security; @@ -172,9 +173,9 @@ namespace Orchard.Setup.Services { //hackInstallationGenerator.GenerateInstallEvents(); var contentDefinitionManager = environment.Resolve(); - contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg.DisplayedAs("Blog Post").WithPart("HasComments").WithPart("HasTags").WithPart("Localized")); - contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg.DisplayedAs("Page").WithPart("HasComments").WithPart("HasTags").WithPart("Localized")); - contentDefinitionManager.AlterTypeDefinition("SandboxPage", cfg => cfg.DisplayedAs("Sandbox Page").WithPart("HasComments").WithPart("HasTags").WithPart("Localized")); + contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg.DisplayedAs("Blog Post").WithPart("HasComments").WithPart("HasTags").WithPart("Localized").Indexed()); + contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg.DisplayedAs("Page").WithPart("HasComments").WithPart("HasTags").WithPart("Localized").Indexed()); + contentDefinitionManager.AlterTypeDefinition("SandboxPage", cfg => cfg.DisplayedAs("Sandbox Page").WithPart("HasComments").WithPart("HasTags").WithPart("Localized").Indexed()); contentDefinitionManager.AlterPartDefinition("BodyAspect", cfg => cfg.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault)); // create home page as a CMS page diff --git a/src/Orchard.sln b/src/Orchard.sln index 2b778a10d..7e6c723fe 100644 --- a/src/Orchard.sln +++ b/src/Orchard.sln @@ -71,6 +71,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ContentTypes", "Orc EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageIndexReferenceImplementation", "Tools\PackageIndexReferenceImplementation\PackageIndexReferenceImplementation.csproj", "{8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene", "Orchard.Web\Modules\Lucene\Lucene.csproj", "{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -201,6 +203,10 @@ Global {8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}.Release|Any CPU.Build.0 = Release|Any CPU + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -223,6 +229,7 @@ Global {4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} {EA2B9121-EF54-40A6-A53E-6593C86EE696} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} {0E7646E8-FE8F-43C1-8799-D97860925EC4} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} + {D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} {ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA} {F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA} {6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA} diff --git a/src/Orchard/Data/Migration/DataMigrationManager.cs b/src/Orchard/Data/Migration/DataMigrationManager.cs index 0cff7912a..f04487def 100644 --- a/src/Orchard/Data/Migration/DataMigrationManager.cs +++ b/src/Orchard/Data/Migration/DataMigrationManager.cs @@ -78,7 +78,6 @@ namespace Orchard.Data.Migration { } public void Update(string feature){ - Logger.Information("Updating {0}", feature); // proceed with dependent features first, whatever the module it's in @@ -146,7 +145,6 @@ namespace Orchard.Data.Migration { } public void Uninstall(string feature) { - var migrations = GetDataMigrations(feature); // apply update methods to each migration class for the module diff --git a/src/Orchard/Data/Migration/DataMigrationNotificationProvider.cs b/src/Orchard/Data/Migration/DataMigrationNotificationProvider.cs new file mode 100644 index 000000000..8c917bdcb --- /dev/null +++ b/src/Orchard/Data/Migration/DataMigrationNotificationProvider.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Orchard.Localization; +using Orchard.UI.Admin.Notification; +using Orchard.UI.Notify; + +namespace Orchard.Data.Migration { + public class DataMigrationNotificationProvider: INotificationProvider { + private readonly IDataMigrationManager _dataMigrationManager; + + public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager) { + _dataMigrationManager = dataMigrationManager; + T = NullLocalizer.Instance; + } + + public Localizer T { get; set; } + + public IEnumerable GetNotifications() { + var features = _dataMigrationManager.GetFeaturesThatNeedUpdate(); + + if(features.Any()) { + yield return new NotifyEntry { Message = T("Some features need to be upgraded: {0}", String.Join(", ", features)), Type = NotifyType.Warning}; + } + } + } +} diff --git a/src/Orchard/Indexing/MetaDataExtensions.cs b/src/Orchard/Indexing/MetaDataExtensions.cs new file mode 100644 index 000000000..e7a6490b1 --- /dev/null +++ b/src/Orchard/Indexing/MetaDataExtensions.cs @@ -0,0 +1,9 @@ +using Orchard.ContentManagement.MetaData.Builders; + +namespace Orchard.Indexing { + public static class MetaDataExtensions { + public static ContentTypeDefinitionBuilder Indexed(this ContentTypeDefinitionBuilder builder) { + return builder.WithSetting("TypeIndexing.Included", "true"); + } + } +} diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index b94b67613..3df3f3119 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -406,7 +406,13 @@ + + + + + + diff --git a/src/Orchard/UI/Admin/AdminFilter.cs b/src/Orchard/UI/Admin/AdminFilter.cs index 36b47c88d..fb4c82dbc 100644 --- a/src/Orchard/UI/Admin/AdminFilter.cs +++ b/src/Orchard/UI/Admin/AdminFilter.cs @@ -5,7 +5,9 @@ using System.Web.Mvc; using System.Web.Routing; using Orchard.Localization; using Orchard.Mvc.Filters; +using Orchard.Mvc.ViewModels; using Orchard.Security; +using Orchard.UI.Notify; namespace Orchard.UI.Admin { public class AdminFilter : FilterProvider, IAuthorizationFilter { @@ -65,5 +67,6 @@ namespace Orchard.UI.Admin { .Concat(descriptor.ControllerDescriptor.GetCustomAttributes(typeof(AdminAttribute), true)) .OfType(); } + } } \ No newline at end of file diff --git a/src/Orchard/UI/Admin/Notification/INotificationManager.cs b/src/Orchard/UI/Admin/Notification/INotificationManager.cs new file mode 100644 index 000000000..053adbb5a --- /dev/null +++ b/src/Orchard/UI/Admin/Notification/INotificationManager.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using Orchard.UI.Notify; + +namespace Orchard.UI.Admin.Notification { + public interface INotificationManager : IDependency { + /// + /// Returns all notifications to display per zone + /// + IEnumerable GetNotifications(); + } +} diff --git a/src/Orchard/UI/Admin/Notification/INotificationProvider.cs b/src/Orchard/UI/Admin/Notification/INotificationProvider.cs new file mode 100644 index 000000000..ee0c0429a --- /dev/null +++ b/src/Orchard/UI/Admin/Notification/INotificationProvider.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using Orchard.UI.Notify; + +namespace Orchard.UI.Admin.Notification { + public interface INotificationProvider : IDependency { + /// + /// Returns all notifications to display per zone + /// + IEnumerable GetNotifications(); + } +} diff --git a/src/Orchard/UI/Admin/Notification/NotificationFilter.cs b/src/Orchard/UI/Admin/Notification/NotificationFilter.cs new file mode 100644 index 000000000..0ee86cd74 --- /dev/null +++ b/src/Orchard/UI/Admin/Notification/NotificationFilter.cs @@ -0,0 +1,40 @@ +using System.Linq; +using System.Web.Mvc; +using Orchard.Mvc.Filters; +using Orchard.Mvc.ViewModels; + +namespace Orchard.UI.Admin.Notification { + public class AdminNotificationFilter : FilterProvider, IResultFilter { + private readonly INotificationManager _notificationManager; + + public AdminNotificationFilter(INotificationManager notificationManager) { + _notificationManager = notificationManager; + } + + public void OnResultExecuting(ResultExecutingContext filterContext) { + + if ( !AdminFilter.IsApplied(filterContext.RequestContext) ) { + return; + } + var viewResult = filterContext.Result as ViewResultBase; + + // if it's not a view result, a redirect for example + if ( viewResult == null ) + return; + + var baseViewModel = BaseViewModel.From(viewResult); + // if it's not a view model that holds messages, don't touch temp data either + if ( baseViewModel == null ) + return; + + var messageEntries = _notificationManager.GetNotifications().ToList(); + + baseViewModel.Messages = baseViewModel.Messages == null ? messageEntries : baseViewModel.Messages.Union(messageEntries).ToList(); + baseViewModel.Zones.AddRenderPartial("content:before", "Messages", baseViewModel.Messages); + } + + public void OnResultExecuted(ResultExecutedContext filterContext) { + + } + } +} diff --git a/src/Orchard/UI/Admin/Notification/NotificationManager.cs b/src/Orchard/UI/Admin/Notification/NotificationManager.cs new file mode 100644 index 000000000..bb15ac9c8 --- /dev/null +++ b/src/Orchard/UI/Admin/Notification/NotificationManager.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Orchard.UI.Notify; + +namespace Orchard.UI.Admin.Notification { + public class NotificationManager : INotificationManager { + private readonly IEnumerable _notificationProviders; + + public NotificationManager(IEnumerable notificationProviders) { + _notificationProviders = notificationProviders; + } + + public IEnumerable GetNotifications() { + return _notificationProviders + .SelectMany(n => n.GetNotifications()); + } + } +}