mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-24 03:06:38 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
commit
2fdc50b6bf
@ -2,6 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
|
using Lucene.Services;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.FileSystems.AppData;
|
using Orchard.FileSystems.AppData;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
|
using Lucene.Services;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.FileSystems.AppData;
|
using Orchard.FileSystems.AppData;
|
||||||
|
@ -130,6 +130,10 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Orchard.Web\Modules\Lucene\Lucene.csproj">
|
||||||
|
<Project>{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}</Project>
|
||||||
|
<Name>Lucene</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj">
|
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj">
|
||||||
<Project>{EA2B9121-EF54-40A6-A53E-6593C86EE696}</Project>
|
<Project>{EA2B9121-EF54-40A6-A53E-6593C86EE696}</Project>
|
||||||
<Name>Orchard.Indexing</Name>
|
<Name>Orchard.Indexing</Name>
|
||||||
|
@ -289,7 +289,9 @@
|
|||||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.Manage.ascx" />
|
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.Manage.ascx" />
|
||||||
<Content Include="Dashboard\Views\Web.config" />
|
<Content Include="Dashboard\Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Folder Include="Notification\" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App_Data\Localization\en-US\orchard.core.po" />
|
<None Include="App_Data\Localization\en-US\orchard.core.po" />
|
||||||
<None Include="App_Data\Localization\fr-FR\orchard.core.po" />
|
<None Include="App_Data\Localization\fr-FR\orchard.core.po" />
|
||||||
|
117
src/Orchard.Web/Modules/Lucene/Lucene.csproj
Normal file
117
src/Orchard.Web/Modules/Lucene/Lucene.csproj
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>
|
||||||
|
</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Lucene</RootNamespace>
|
||||||
|
<AssemblyName>Lucene</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<MvcBuildViews>false</MvcBuildViews>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Lucene.Net">
|
||||||
|
<HintPath>..\..\..\..\lib\lucene.net\Lucene.Net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Web.DynamicData" />
|
||||||
|
<Reference Include="System.Web.Entity" />
|
||||||
|
<Reference Include="System.Web.ApplicationServices" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Core">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.DataSetExtensions">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="System.Xml.Linq">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Web.Extensions">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Abstractions" />
|
||||||
|
<Reference Include="System.Web.Routing" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Web.Services" />
|
||||||
|
<Reference Include="System.EnterpriseServices" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Models\LuceneDocumentIndex.cs" />
|
||||||
|
<Compile Include="Models\LuceneSearchHit.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\LuceneIndexProvider.cs" />
|
||||||
|
<Compile Include="Services\LuceneSearchBuilder.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Module.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Web.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||||
|
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||||
|
<Name>Orchard.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</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.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target> -->
|
||||||
|
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
|
||||||
|
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
|
||||||
|
</Target>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<VisualStudio>
|
||||||
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||||
|
<WebProjectProperties>
|
||||||
|
<UseIIS>False</UseIIS>
|
||||||
|
<AutoAssignPort>True</AutoAssignPort>
|
||||||
|
<DevelopmentServerPort>10461</DevelopmentServerPort>
|
||||||
|
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||||
|
<IISUrl>
|
||||||
|
</IISUrl>
|
||||||
|
<NTLMAuthentication>False</NTLMAuthentication>
|
||||||
|
<UseCustomServer>False</UseCustomServer>
|
||||||
|
<CustomServerUrl>
|
||||||
|
</CustomServerUrl>
|
||||||
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
|
</WebProjectProperties>
|
||||||
|
</FlavorProperties>
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
|
</Project>
|
@ -1,10 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Lucene.Net.Documents;
|
using Lucene.Net.Documents;
|
||||||
|
using Orchard;
|
||||||
|
using Orchard.Indexing;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Utility.Extensions;
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Indexing.Models {
|
namespace Lucene.Models {
|
||||||
|
|
||||||
public class LuceneDocumentIndex : IDocumentIndex {
|
public class LuceneDocumentIndex : IDocumentIndex {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
using Lucene.Net.Documents;
|
using Lucene.Net.Documents;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Lucene.Net.Util;
|
using Lucene.Net.Util;
|
||||||
|
using Orchard.Indexing;
|
||||||
|
|
||||||
namespace Orchard.Indexing.Models {
|
namespace Lucene.Models {
|
||||||
public class LuceneSearchHit : ISearchHit {
|
public class LuceneSearchHit : ISearchHit {
|
||||||
private readonly Document _doc;
|
private readonly Document _doc;
|
||||||
private readonly float _score;
|
private readonly float _score;
|
11
src/Orchard.Web/Modules/Lucene/Module.txt
Normal file
11
src/Orchard.Web/Modules/Lucene/Module.txt
Normal file
@ -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
|
35
src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs
Normal file
35
src/Orchard.Web/Modules/Lucene/Properties/AssemblyInfo.cs
Normal file
@ -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")]
|
@ -2,22 +2,23 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Lucene.Models;
|
||||||
using Lucene.Net.Analysis;
|
using Lucene.Net.Analysis;
|
||||||
using Lucene.Net.Analysis.Standard;
|
using Lucene.Net.Analysis.Standard;
|
||||||
using Lucene.Net.Documents;
|
using Lucene.Net.Documents;
|
||||||
using Lucene.Net.Index;
|
using Lucene.Net.Index;
|
||||||
using Lucene.Net.Search;
|
using Lucene.Net.Search;
|
||||||
using Lucene.Net.Store;
|
using Lucene.Net.Store;
|
||||||
|
using System.Xml.Linq;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.FileSystems.AppData;
|
using Orchard.FileSystems.AppData;
|
||||||
using Orchard.Indexing.Models;
|
using Orchard.Indexing;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
using System.Xml.Linq;
|
|
||||||
using Directory = Lucene.Net.Store.Directory;
|
using Directory = Lucene.Net.Store.Directory;
|
||||||
using Version = Lucene.Net.Util.Version;
|
using Version = Lucene.Net.Util.Version;
|
||||||
|
|
||||||
namespace Orchard.Indexing.Services {
|
namespace Lucene.Services {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the default implementation of an IIndexProvider, based on Lucene
|
/// Represents the default implementation of an IIndexProvider, based on Lucene
|
||||||
/// </summary>
|
/// </summary>
|
@ -2,16 +2,16 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Lucene.Net.Analysis;
|
using Lucene.Models;
|
||||||
using Lucene.Net.Index;
|
using Lucene.Net.Index;
|
||||||
using Lucene.Net.Search;
|
using Lucene.Net.Search;
|
||||||
using Lucene.Net.Store;
|
using Lucene.Net.Store;
|
||||||
using Orchard.Indexing.Models;
|
using Orchard.Indexing;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
using Lucene.Net.Documents;
|
using Lucene.Net.Documents;
|
||||||
using Lucene.Net.QueryParsers;
|
using Lucene.Net.QueryParsers;
|
||||||
|
|
||||||
namespace Orchard.Indexing.Services {
|
namespace Lucene.Services {
|
||||||
public class LuceneSearchBuilder : ISearchBuilder {
|
public class LuceneSearchBuilder : ISearchBuilder {
|
||||||
|
|
||||||
private const int MaxResults = Int16.MaxValue;
|
private const int MaxResults = Int16.MaxValue;
|
60
src/Orchard.Web/Modules/Lucene/Web.config
Normal file
60
src/Orchard.Web/Modules/Lucene/Web.config
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!--
|
||||||
|
Note: As an alternative to hand editing this file you can use the
|
||||||
|
web admin tool to configure settings for your application. Use
|
||||||
|
the Website->Asp.Net Configuration option in Visual Studio.
|
||||||
|
A full list of settings and comments can be found in
|
||||||
|
machine.config.comments usually located in
|
||||||
|
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||||
|
-->
|
||||||
|
<configuration>
|
||||||
|
<appSettings/>
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
|
||||||
|
</connectionStrings>
|
||||||
|
<system.web>
|
||||||
|
<!--
|
||||||
|
Set compilation debug="true" to insert debugging
|
||||||
|
symbols into the compiled page. Because this
|
||||||
|
affects performance, set this value to true only
|
||||||
|
during development.
|
||||||
|
-->
|
||||||
|
<compilation debug="false" targetFramework="4.0">
|
||||||
|
<assemblies>
|
||||||
|
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||||
|
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
|
||||||
|
</compilation>
|
||||||
|
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
|
||||||
|
<namespaces>
|
||||||
|
<add namespace="System.Web.Mvc"/>
|
||||||
|
<add namespace="System.Web.Mvc.Ajax"/>
|
||||||
|
<add namespace="System.Web.Mvc.Html"/>
|
||||||
|
<add namespace="System.Web.Routing"/>
|
||||||
|
<add namespace="System.Linq"/>
|
||||||
|
<add namespace="System.Collections.Generic"/>
|
||||||
|
</namespaces>
|
||||||
|
</pages>
|
||||||
|
</system.web>
|
||||||
|
<system.web.extensions/>
|
||||||
|
<!--
|
||||||
|
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||||
|
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||||
|
-->
|
||||||
|
<system.webServer>
|
||||||
|
<modules runAllManagedModulesForAllRequests="true">
|
||||||
|
</modules>
|
||||||
|
<handlers>
|
||||||
|
<remove name="UrlRoutingHandler"/>
|
||||||
|
</handlers>
|
||||||
|
</system.webServer>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||||
|
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
@ -140,14 +140,6 @@ namespace Orchard.DevTools.Commands {
|
|||||||
CreateFilesFromTemplates(moduleName, projectGuid);
|
CreateFilesFromTemplates(moduleName, projectGuid);
|
||||||
// The string searches in solution/project files can be made aware of comment lines.
|
// The string searches in solution/project files can be made aware of comment lines.
|
||||||
if (IncludeInSolution) {
|
if (IncludeInSolution) {
|
||||||
// Add project reference to Orchard.Web.csproj
|
|
||||||
string webProjectReference = string.Format(
|
|
||||||
"</ProjectReference>\r\n <ProjectReference Include=\"Modules\\{0}\\{0}.csproj\">\r\n <Project>{{{1}}}</Project>\r\n <Name>{0}</Name>\r\n ",
|
|
||||||
moduleName, projectGuid);
|
|
||||||
string webProjectText = File.ReadAllText(rootWebProjectPath);
|
|
||||||
webProjectText = webProjectText.Insert(webProjectText.LastIndexOf("</ProjectReference>\r\n"), webProjectReference);
|
|
||||||
File.WriteAllText(rootWebProjectPath, webProjectText);
|
|
||||||
|
|
||||||
// Add project to Orchard.sln
|
// Add project to Orchard.sln
|
||||||
string solutionPath = Directory.GetParent(rootWebProjectPath).Parent.FullName + "\\Orchard.sln";
|
string solutionPath = Directory.GetParent(rootWebProjectPath).Parent.FullName + "\\Orchard.sln";
|
||||||
if (File.Exists(solutionPath)) {
|
if (File.Exists(solutionPath)) {
|
||||||
@ -177,6 +169,12 @@ namespace Orchard.DevTools.Commands {
|
|||||||
|
|
||||||
Directory.CreateDirectory(modulePath);
|
Directory.CreateDirectory(modulePath);
|
||||||
Directory.CreateDirectory(propertiesPath);
|
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");
|
string templateText = File.ReadAllText(templatesPath + "ModuleAssemblyInfo.txt");
|
||||||
templateText = templateText.Replace("$$ModuleName$$", moduleName);
|
templateText = templateText.Replace("$$ModuleName$$", moduleName);
|
||||||
templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString());
|
templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString());
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
<Content Include="ScaffoldingTemplates\ModuleCsProj.txt" />
|
<Content Include="ScaffoldingTemplates\ModuleCsProj.txt" />
|
||||||
<Content Include="ScaffoldingTemplates\ModuleManifest.txt" />
|
<Content Include="ScaffoldingTemplates\ModuleManifest.txt" />
|
||||||
<Content Include="ScaffoldingTemplates\ModuleWebConfig.txt" />
|
<Content Include="ScaffoldingTemplates\ModuleWebConfig.txt" />
|
||||||
|
<Content Include="ScaffoldingTemplates\ViewsWebConfig.txt" />
|
||||||
<Content Include="Views\Commands\Execute.ascx" />
|
<Content Include="Views\Commands\Execute.ascx" />
|
||||||
<Content Include="Views\DataMigration\Index.aspx" />
|
<Content Include="Views\DataMigration\Index.aspx" />
|
||||||
<Content Include="Views\DefinitionTemplates\DevToolsSettings.ascx" />
|
<Content Include="Views\DefinitionTemplates\DevToolsSettings.ascx" />
|
||||||
|
@ -70,6 +70,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
|
<Content Include="Views\Web.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Controllers\" />
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
<Folder Include="Scripts\" />
|
||||||
|
<Folder Include="Content\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
<system.web>
|
||||||
|
<httpHandlers>
|
||||||
|
<add path="*" verb="*"
|
||||||
|
type="System.Web.HttpNotFoundHandler"/>
|
||||||
|
</httpHandlers>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Enabling request validation in view pages would cause validation to occur
|
||||||
|
after the input has already been processed by the controller. By default
|
||||||
|
MVC performs request validation before a controller processes the input.
|
||||||
|
To change this behavior apply the ValidateInputAttribute to a
|
||||||
|
controller or action.
|
||||||
|
-->
|
||||||
|
<pages
|
||||||
|
validateRequest="false"
|
||||||
|
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||||
|
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||||
|
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||||
|
<controls>
|
||||||
|
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||||
|
</controls>
|
||||||
|
</pages>
|
||||||
|
</system.web>
|
||||||
|
|
||||||
|
<system.webServer>
|
||||||
|
<validation validateIntegratedModeConfiguration="false"/>
|
||||||
|
<handlers>
|
||||||
|
<remove name="BlockViewHandler"/>
|
||||||
|
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
||||||
|
</handlers>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
@ -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.
|
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:
|
features:
|
||||||
Orchard.Indexing:
|
Orchard.Indexing:
|
||||||
Description: Indexing services based on Lucene.
|
Description: Indexing infrastructure. Requires an index implementation like the Lucene module.
|
||||||
Category: Search
|
Category: Search
|
@ -32,9 +32,6 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Lucene.Net">
|
|
||||||
<HintPath>..\..\..\..\lib\lucene.net\Lucene.Net.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Web.DynamicData" />
|
<Reference Include="System.Web.DynamicData" />
|
||||||
<Reference Include="System.Web.Entity" />
|
<Reference Include="System.Web.Entity" />
|
||||||
@ -68,16 +65,13 @@
|
|||||||
<Compile Include="Handlers\CreateIndexingTaskHandler.cs" />
|
<Compile Include="Handlers\CreateIndexingTaskHandler.cs" />
|
||||||
<Compile Include="Models\IndexingTask.cs" />
|
<Compile Include="Models\IndexingTask.cs" />
|
||||||
<Compile Include="Models\IndexingTaskRecord.cs" />
|
<Compile Include="Models\IndexingTaskRecord.cs" />
|
||||||
<Compile Include="Models\LuceneDocumentIndex.cs" />
|
|
||||||
<Compile Include="Permissions.cs" />
|
<Compile Include="Permissions.cs" />
|
||||||
|
<Compile Include="Services\IndexServiceNotificationProvider.cs" />
|
||||||
<Compile Include="Services\IndexingBackgroundTask.cs" />
|
<Compile Include="Services\IndexingBackgroundTask.cs" />
|
||||||
<Compile Include="Services\IndexingTaskExecutor.cs" />
|
<Compile Include="Services\IndexingTaskExecutor.cs" />
|
||||||
<Compile Include="Services\IndexingTaskManager.cs" />
|
<Compile Include="Services\IndexingTaskManager.cs" />
|
||||||
<Compile Include="Services\IIndexService.cs" />
|
<Compile Include="Services\IIndexService.cs" />
|
||||||
<Compile Include="Services\IndexSynLock.cs" />
|
<Compile Include="Services\IndexSynLock.cs" />
|
||||||
<Compile Include="Services\LuceneIndexProvider.cs" />
|
|
||||||
<Compile Include="Services\LuceneSearchBuilder.cs" />
|
|
||||||
<Compile Include="Models\LuceneSearchHit.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\IndexService.cs" />
|
<Compile Include="Services\IndexService.cs" />
|
||||||
<Compile Include="Settings\EditorEvents.cs" />
|
<Compile Include="Settings\EditorEvents.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<NotifyEntry> GetNotifications() {
|
||||||
|
|
||||||
|
if(!_indexManager.HasIndexProvider()) {
|
||||||
|
yield return new NotifyEntry { Message = T("You need to enable an index implementation module like Lucene." ), Type = NotifyType.Warning};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Orchard.Commands;
|
using Orchard.Commands;
|
||||||
using Orchard.Utility.Extensions;
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ namespace Orchard.Modules.Commands {
|
|||||||
Context.Output.WriteLine(T(" Description: {0}", feature.Descriptor.Description.OrDefault("<none>")));
|
Context.Output.WriteLine(T(" Description: {0}", feature.Descriptor.Description.OrDefault("<none>")));
|
||||||
Context.Output.WriteLine(T(" Category: {0}", feature.Descriptor.Category.OrDefault("<none>")));
|
Context.Output.WriteLine(T(" Category: {0}", feature.Descriptor.Category.OrDefault("<none>")));
|
||||||
Context.Output.WriteLine(T(" Module: {0}", feature.Descriptor.Extension.Name.OrDefault("<none>")));
|
Context.Output.WriteLine(T(" Module: {0}", feature.Descriptor.Extension.Name.OrDefault("<none>")));
|
||||||
Context.Output.WriteLine(T(" Dependencies: {0}", string.Join(",", feature.Descriptor.Dependencies).OrDefault("<none>")));
|
Context.Output.WriteLine(T(" Dependencies: {0}", feature.Descriptor.Dependencies == null ? "<none>" : string.Join(",", feature.Descriptor.Dependencies).OrDefault("<none>")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,8 +46,28 @@ namespace Orchard.Modules.Commands {
|
|||||||
[CommandName("feature enable")]
|
[CommandName("feature enable")]
|
||||||
public void Enable(params string[] featureNames) {
|
public void Enable(params string[] featureNames) {
|
||||||
Context.Output.WriteLine(T("Enabling features {0}", string.Join(",", featureNames)));
|
Context.Output.WriteLine(T("Enabling features {0}", string.Join(",", featureNames)));
|
||||||
_moduleService.EnableFeatures(featureNames);
|
bool listAvailableFeatures = false;
|
||||||
Context.Output.WriteLine(T("Enabled features {0}", string.Join(",", featureNames)));
|
List<string> featuresToEnable = new List<string>();
|
||||||
|
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 <feature-name-1> ... <feature-name-n>\r\n\t" + "Disable one or more features")]
|
[CommandHelp("feature disable <feature-name-1> ... <feature-name-n>\r\n\t" + "Disable one or more features")]
|
||||||
|
@ -18,6 +18,7 @@ using Orchard.Environment.Configuration;
|
|||||||
using Orchard.Environment.ShellBuilders;
|
using Orchard.Environment.ShellBuilders;
|
||||||
using Orchard.Environment.Descriptor;
|
using Orchard.Environment.Descriptor;
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
|
using Orchard.Indexing;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Localization.Services;
|
using Orchard.Localization.Services;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
@ -172,9 +173,9 @@ namespace Orchard.Setup.Services {
|
|||||||
//hackInstallationGenerator.GenerateInstallEvents();
|
//hackInstallationGenerator.GenerateInstallEvents();
|
||||||
|
|
||||||
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
|
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
|
||||||
contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg.DisplayedAs("Blog Post").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"));
|
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"));
|
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));
|
contentDefinitionManager.AlterPartDefinition("BodyAspect", cfg => cfg.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
|
||||||
|
|
||||||
// create home page as a CMS page
|
// create home page as a CMS page
|
||||||
|
@ -71,6 +71,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ContentTypes", "Orc
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageIndexReferenceImplementation", "Tools\PackageIndexReferenceImplementation\PackageIndexReferenceImplementation.csproj", "{8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageIndexReferenceImplementation", "Tools\PackageIndexReferenceImplementation\PackageIndexReferenceImplementation.csproj", "{8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene", "Orchard.Web\Modules\Lucene\Lucene.csproj", "{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{8A4E42CE-79F8-4BE2-8B1E-A6B83432123B}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -223,6 +229,7 @@ Global
|
|||||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
{4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696} = {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}
|
{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}
|
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||||
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {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}
|
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||||
|
@ -78,7 +78,6 @@ namespace Orchard.Data.Migration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Update(string feature){
|
public void Update(string feature){
|
||||||
|
|
||||||
Logger.Information("Updating {0}", feature);
|
Logger.Information("Updating {0}", feature);
|
||||||
|
|
||||||
// proceed with dependent features first, whatever the module it's in
|
// proceed with dependent features first, whatever the module it's in
|
||||||
@ -146,7 +145,6 @@ namespace Orchard.Data.Migration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Uninstall(string feature) {
|
public void Uninstall(string feature) {
|
||||||
|
|
||||||
var migrations = GetDataMigrations(feature);
|
var migrations = GetDataMigrations(feature);
|
||||||
|
|
||||||
// apply update methods to each migration class for the module
|
// apply update methods to each migration class for the module
|
||||||
|
@ -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<NotifyEntry> 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};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
src/Orchard/Indexing/MetaDataExtensions.cs
Normal file
9
src/Orchard/Indexing/MetaDataExtensions.cs
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -406,7 +406,13 @@
|
|||||||
<Compile Include="Environment\Extensions\Compilers\CSharpExtensionBuildProviderShim.cs" />
|
<Compile Include="Environment\Extensions\Compilers\CSharpExtensionBuildProviderShim.cs" />
|
||||||
<Compile Include="Environment\Extensions\Compilers\ProjectFileDescriptor.cs" />
|
<Compile Include="Environment\Extensions\Compilers\ProjectFileDescriptor.cs" />
|
||||||
<Compile Include="Environment\Extensions\Compilers\IProjectFileParser.cs" />
|
<Compile Include="Environment\Extensions\Compilers\IProjectFileParser.cs" />
|
||||||
|
<Compile Include="Indexing\MetaDataExtensions.cs" />
|
||||||
<Compile Include="Localization\Commands\CultureCommands.cs" />
|
<Compile Include="Localization\Commands\CultureCommands.cs" />
|
||||||
|
<Compile Include="UI\Admin\Notification\NotificationFilter.cs" />
|
||||||
|
<Compile Include="Data\Migration\DataMigrationNotificationProvider.cs" />
|
||||||
|
<Compile Include="UI\Admin\Notification\INotificationManager.cs" />
|
||||||
|
<Compile Include="UI\Admin\Notification\INotificationProvider.cs" />
|
||||||
|
<Compile Include="UI\Admin\Notification\NotificationManager.cs" />
|
||||||
<Compile Include="Utility\DependencyOrderingUtility.cs" />
|
<Compile Include="Utility\DependencyOrderingUtility.cs" />
|
||||||
<Compile Include="Environment\IOrchardHostContainer.cs" />
|
<Compile Include="Environment\IOrchardHostContainer.cs" />
|
||||||
<Compile Include="Environment\IShim.cs" />
|
<Compile Include="Environment\IShim.cs" />
|
||||||
|
@ -5,7 +5,9 @@ using System.Web.Mvc;
|
|||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Mvc.Filters;
|
using Orchard.Mvc.Filters;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.UI.Admin {
|
namespace Orchard.UI.Admin {
|
||||||
public class AdminFilter : FilterProvider, IAuthorizationFilter {
|
public class AdminFilter : FilterProvider, IAuthorizationFilter {
|
||||||
@ -65,5 +67,6 @@ namespace Orchard.UI.Admin {
|
|||||||
.Concat(descriptor.ControllerDescriptor.GetCustomAttributes(typeof(AdminAttribute), true))
|
.Concat(descriptor.ControllerDescriptor.GetCustomAttributes(typeof(AdminAttribute), true))
|
||||||
.OfType<AdminAttribute>();
|
.OfType<AdminAttribute>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
11
src/Orchard/UI/Admin/Notification/INotificationManager.cs
Normal file
11
src/Orchard/UI/Admin/Notification/INotificationManager.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
|
namespace Orchard.UI.Admin.Notification {
|
||||||
|
public interface INotificationManager : IDependency {
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all notifications to display per zone
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<NotifyEntry> GetNotifications();
|
||||||
|
}
|
||||||
|
}
|
11
src/Orchard/UI/Admin/Notification/INotificationProvider.cs
Normal file
11
src/Orchard/UI/Admin/Notification/INotificationProvider.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
|
namespace Orchard.UI.Admin.Notification {
|
||||||
|
public interface INotificationProvider : IDependency {
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all notifications to display per zone
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<NotifyEntry> GetNotifications();
|
||||||
|
}
|
||||||
|
}
|
40
src/Orchard/UI/Admin/Notification/NotificationFilter.cs
Normal file
40
src/Orchard/UI/Admin/Notification/NotificationFilter.cs
Normal file
@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
src/Orchard/UI/Admin/Notification/NotificationManager.cs
Normal file
18
src/Orchard/UI/Admin/Notification/NotificationManager.cs
Normal file
@ -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<INotificationProvider> _notificationProviders;
|
||||||
|
|
||||||
|
public NotificationManager(IEnumerable<INotificationProvider> notificationProviders) {
|
||||||
|
_notificationProviders = notificationProviders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<NotifyEntry> GetNotifications() {
|
||||||
|
return _notificationProviders
|
||||||
|
.SelectMany(n => n.GetNotifications());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user