Merge
@@ -345,11 +345,15 @@ namespace Orchard.Azure {
|
||||
}
|
||||
|
||||
public string GetPath() {
|
||||
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
|
||||
using (new HttpContextWeaver()) {
|
||||
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
|
||||
}
|
||||
}
|
||||
|
||||
public long GetSize() {
|
||||
return GetDirectorySize(_blob);
|
||||
using (new HttpContextWeaver()) {
|
||||
return GetDirectorySize(_blob);
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime GetLastUpdated() {
|
||||
@@ -357,8 +361,10 @@ namespace Orchard.Azure {
|
||||
}
|
||||
|
||||
public IStorageFolder GetParent() {
|
||||
if ( _blob.Parent != null ) {
|
||||
return new AzureBlobFolderStorage(_blob.Parent, _rootPath);
|
||||
using (new HttpContextWeaver()) {
|
||||
if (_blob.Parent != null) {
|
||||
return new AzureBlobFolderStorage(_blob.Parent, _rootPath);
|
||||
}
|
||||
}
|
||||
throw new ArgumentException("Directory " + _blob.Uri + " does not have a parent directory");
|
||||
}
|
||||
|
||||
40
src/Orchard.Azure/Logging/AzureAppender.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Microsoft.WindowsAzure;
|
||||
using Microsoft.WindowsAzure.Diagnostics.Management;
|
||||
using Microsoft.WindowsAzure.ServiceRuntime;
|
||||
using log4net.Appender;
|
||||
using log4net.Core;
|
||||
|
||||
namespace Orchard.Azure.Logging {
|
||||
|
||||
/// <summary>
|
||||
/// Azure specific implementation of a log4net appender.
|
||||
/// Uses DataConnectionString to define the location of the log.
|
||||
/// </summary>
|
||||
public class AzureAppender : AppenderSkeleton {
|
||||
private const string WadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
|
||||
|
||||
public AzureAppender() {
|
||||
|
||||
var cloudStorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(WadConnectionString));
|
||||
|
||||
var roleInstanceDiagnosticManager = cloudStorageAccount.CreateRoleInstanceDiagnosticManager(
|
||||
RoleEnvironment.DeploymentId,
|
||||
RoleEnvironment.CurrentRoleInstance.Role.Name,
|
||||
RoleEnvironment.CurrentRoleInstance.Id);
|
||||
|
||||
var diagnosticMonitorConfiguration = roleInstanceDiagnosticManager.GetCurrentConfiguration();
|
||||
diagnosticMonitorConfiguration.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1d);
|
||||
diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1d);
|
||||
|
||||
roleInstanceDiagnosticManager.SetCurrentConfiguration(diagnosticMonitorConfiguration);
|
||||
}
|
||||
|
||||
protected override void Append(LoggingEvent loggingEvent) {
|
||||
var formattedLog = RenderLoggingEvent(loggingEvent);
|
||||
|
||||
// this is the way to logging into Azure
|
||||
System.Diagnostics.Trace.WriteLine(formattedLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>1.3.0</ProductVersion>
|
||||
<ProductVersion>1.5.0</ProductVersion>
|
||||
<ProjectGuid>{03c5327d-4e8e-45a7-acd1-e18e7caa3c4a}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
@@ -45,7 +46,8 @@
|
||||
</ItemGroup>
|
||||
<!-- Import the target files for this project template -->
|
||||
<PropertyGroup>
|
||||
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\Cloud Service\1.0\Visual Studio 10.0\</CloudExtensionsDir>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\1.5\</CloudExtensionsDir>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(CloudExtensionsDir)Microsoft.CloudService.targets" />
|
||||
<Import Project="$(CloudExtensionsDir)Microsoft.WindowsAzure.targets" />
|
||||
</Project>
|
||||
@@ -4,6 +4,7 @@
|
||||
<Instances count="1" />
|
||||
<ConfigurationSettings>
|
||||
<Setting name="DataConnectionString" value="UseDevelopmentStorage=true" />
|
||||
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
|
||||
</ConfigurationSettings>
|
||||
</Role>
|
||||
</ServiceConfiguration>
|
||||
@@ -8,6 +8,9 @@
|
||||
</Bindings>
|
||||
</Site>
|
||||
</Sites>
|
||||
<Imports>
|
||||
<Import moduleName="Diagnostics" />
|
||||
</Imports>
|
||||
<ConfigurationSettings>
|
||||
<Setting name="DataConnectionString" />
|
||||
</ConfigurationSettings>
|
||||
|
||||
@@ -3,26 +3,25 @@
|
||||
<root>
|
||||
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
|
||||
<priority value="WARN" />
|
||||
<appender-ref ref="RollingLogFileAppender" />
|
||||
<appender-ref ref="AzureAppender" />
|
||||
</root>
|
||||
|
||||
<!--
|
||||
<logger name="Orchard.Localization">
|
||||
<priority value="WARN" />
|
||||
<appender-ref ref="RollingLogFileAppender" />
|
||||
</logger>
|
||||
-->
|
||||
|
||||
<logger name="Orchard.Data.SessionLocator">
|
||||
<priority value="INFO" />
|
||||
<appender-ref ref="RollingLogFileAppender" />
|
||||
</logger>
|
||||
|
||||
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="App_Data/Logs/orchard-debug.txt" />
|
||||
<appendToFile value="true" />
|
||||
<immediateFlush value="true" />
|
||||
<appender name="AzureAppender" type="Orchard.Logging.AzureAppender">
|
||||
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<!-- only error and fatal messages end up in this target, even if child loggers accept lower priority -->
|
||||
<levelMin value="ERROR" />
|
||||
</filter>
|
||||
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%logger - %message%newline" />
|
||||
<conversionPattern value="%date [%thread] %logger - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
</log4net>
|
||||
|
||||
@@ -85,11 +85,7 @@
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, PublicKeyToken=89845dcd8080cc91" />
|
||||
<Reference Include="System.Web.ApplicationServices">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
||||
@@ -36,6 +36,20 @@
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<system.diagnostics>
|
||||
<trace>
|
||||
<listeners>
|
||||
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,
|
||||
Microsoft.WindowsAzure.Diagnostics,
|
||||
Version=1.0.0.0,
|
||||
Culture=neutral,
|
||||
PublicKeyToken=31bf3856ad364e35"
|
||||
name="AzureDiagnostics">
|
||||
</add>
|
||||
</listeners>
|
||||
</trace>
|
||||
</system.diagnostics>
|
||||
|
||||
<!--
|
||||
Set default transaction timeout to 30 minutes so that interactive debugging
|
||||
|
||||
@@ -53,6 +53,11 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\..\lib\fluentnhibernate\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
@@ -76,6 +81,7 @@
|
||||
<Compile Include="HttpContextWeaver.cs" />
|
||||
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
|
||||
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
|
||||
<Compile Include="Logging\AzureAppender.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="AzureFileSystem.cs" />
|
||||
</ItemGroup>
|
||||
@@ -103,6 +109,7 @@
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Orchard.Core.Tests.Body {
|
||||
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
|
||||
builder.RegisterType<ThingHandler>().As<IContentHandler>();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ using Orchard.FileSystems.VirtualPath;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.Tasks.Scheduling;
|
||||
using Orchard.Tests.DisplayManagement;
|
||||
using Orchard.Tests.DisplayManagement.Descriptors;
|
||||
using Orchard.Tests.Modules;
|
||||
using System.Web.Mvc;
|
||||
@@ -66,7 +67,14 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
|
||||
builder.RegisterInstance(new RequestContext(new StubHttpContext(), new RouteData()));
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
|
||||
// IContentDisplay
|
||||
var workContext = new DefaultDisplayManagerTests.TestWorkContext {
|
||||
CurrentTheme = new ExtensionDescriptor { Id = "Hello" }
|
||||
};
|
||||
builder.RegisterInstance<DefaultDisplayManagerTests.TestWorkContextAccessor>(new DefaultDisplayManagerTests.TestWorkContextAccessor(workContext)).As<IWorkContextAccessor>();
|
||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||
|
||||
DefaultShapeTableManagerTests.TestShapeProvider.FeatureShapes = new Dictionary<Feature, IEnumerable<string>> {
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Orchard.Core.Tests.Routable.Services {
|
||||
builder.RegisterType<RoutableService>().As<IRoutableService>();
|
||||
builder.RegisterType<RoutablePathConstraint>().As<IRoutablePathConstraint>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
|
||||
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Orchard.Core.Tests.Scheduling {
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Orchard.Core.Tests.Scheduling {
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
|
||||
@@ -7,6 +7,7 @@ using Moq;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
@@ -204,6 +205,43 @@ namespace Orchard.Core.Tests.Settings.Metadata {
|
||||
Assert.That(manager.ListPartDefinitions().Count(), Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PartsCanBeDeleted() {
|
||||
var manager = _container.Resolve<IContentDefinitionManager>();
|
||||
manager.StoreTypeDefinition(
|
||||
new ContentTypeDefinitionBuilder()
|
||||
.Named("alpha")
|
||||
.WithPart("foo", pb => { })
|
||||
.WithPart("bar", pb => { })
|
||||
.Build());
|
||||
|
||||
AssertThatTypeHasParts("alpha", "foo", "bar");
|
||||
Assert.That(manager.ListPartDefinitions().Count(), Is.EqualTo(2));
|
||||
|
||||
manager.DeletePartDefinition("foo");
|
||||
ResetSession();
|
||||
|
||||
AssertThatTypeHasParts("alpha", "bar");
|
||||
Assert.That(manager.ListPartDefinitions().Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ContentTypesCanBeDeleted() {
|
||||
var manager = _container.Resolve<IContentDefinitionManager>();
|
||||
manager.StoreTypeDefinition(
|
||||
new ContentTypeDefinitionBuilder()
|
||||
.Named("alpha")
|
||||
.WithPart("foo", pb => { })
|
||||
.WithPart("bar", pb => { })
|
||||
.Build());
|
||||
|
||||
Assert.That(manager.GetTypeDefinition("alpha"), Is.Not.Null);
|
||||
manager.DeleteTypeDefinition("alpha");
|
||||
ResetSession();
|
||||
|
||||
Assert.That(manager.GetTypeDefinition("alpha"), Is.Null);
|
||||
}
|
||||
|
||||
private void AssertThatTypeHasParts(string typeName, params string[] partNames) {
|
||||
var type = _container.Resolve<IContentDefinitionManager>().GetTypeDefinition(typeName);
|
||||
Assert.That(type, Is.Not.Null);
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,HomePage,Navigation,Reports,Routable,Scheduling,Settings,Shapes,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine
|
||||
setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,HomePage,Navigation,Reports,Routable,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Orchard.Specs.Bindings {
|
||||
virtualDirectory,
|
||||
TableData(
|
||||
new { extension = "Module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Lists, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup" },
|
||||
new { extension = "Core", names = "Common, Containers, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
|
||||
new { extension = "Core", names = "Common, Containers, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc, Title" },
|
||||
new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
|
||||
|
||||
webApp.WhenIGoTo("Setup");
|
||||
|
||||
@@ -23,7 +23,9 @@ Scenario: I can create a new blog and blog post
|
||||
| Routable.Title | My Post |
|
||||
| Body.Text | Hi there. |
|
||||
And I hit "Publish Now"
|
||||
And I go to "my-blog"
|
||||
And I am redirected
|
||||
Then I should see "Your Blog Post has been created."
|
||||
When I go to "my-blog"
|
||||
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
|
||||
And I should see "<h1[^>]*>.*?My Post.*?</h1>"
|
||||
When I go to "my-blog/my-post"
|
||||
|
||||
294
src/Orchard.Specs/Blogs.feature.cs
generated
@@ -2,7 +2,7 @@
|
||||
// <auto-generated>
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.5.0.0
|
||||
// Runtime Version:4.0.30319.1
|
||||
// Runtime Version:4.0.30319.17011
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -113,16 +113,20 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 25
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 26
|
||||
testRunner.And("I go to \"my-blog\"");
|
||||
testRunner.And("I am redirected");
|
||||
#line 27
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
testRunner.Then("I should see \"Your Blog Post has been created.\"");
|
||||
#line 28
|
||||
testRunner.And("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.When("I go to \"my-blog\"");
|
||||
#line 29
|
||||
testRunner.When("I go to \"my-blog/my-post\"");
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
#line 30
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.And("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 31
|
||||
testRunner.When("I go to \"my-blog/my-post\"");
|
||||
#line 32
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 33
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -135,11 +139,11 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog with multiple blog posts each with the same title and uni" +
|
||||
"que slugs are generated or given for said posts", ((string[])(null)));
|
||||
#line 33
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 34
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 35
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 36
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 37
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -148,15 +152,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table3.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 36
|
||||
#line 38
|
||||
testRunner.And("I fill in", ((string)(null)), table3);
|
||||
#line 39
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 40
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 41
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 42
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 43
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 44
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -168,21 +172,21 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table4.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 43
|
||||
#line 45
|
||||
testRunner.And("I fill in", ((string)(null)), table4);
|
||||
#line 47
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 48
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 49
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 50
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 51
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 52
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
#line 53
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
#line 54
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 55
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -194,21 +198,21 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table5.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there, again."});
|
||||
#line 54
|
||||
#line 56
|
||||
testRunner.And("I fill in", ((string)(null)), table5);
|
||||
#line 58
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 59
|
||||
testRunner.And("I go to \"my-blog/my-post-2\"");
|
||||
#line 60
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 61
|
||||
testRunner.And("I should see \"Hi there, again.\"");
|
||||
testRunner.And("I go to \"my-blog/my-post-2\"");
|
||||
#line 62
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 63
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I should see \"Hi there, again.\"");
|
||||
#line 64
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
#line 65
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 66
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -223,15 +227,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table6.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Are you still there?"});
|
||||
#line 65
|
||||
#line 67
|
||||
testRunner.And("I fill in", ((string)(null)), table6);
|
||||
#line 70
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 71
|
||||
testRunner.And("I go to \"my-blog/my-post-3\"");
|
||||
#line 72
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 73
|
||||
testRunner.And("I go to \"my-blog/my-post-3\"");
|
||||
#line 74
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 75
|
||||
testRunner.And("I should see \"Are you still there?\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -244,11 +248,11 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog and blog post and when I change the slug of the blog the " +
|
||||
"path of the plog post is updated", ((string[])(null)));
|
||||
#line 75
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 76
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 77
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 78
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 79
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -257,19 +261,19 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table7.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 78
|
||||
#line 80
|
||||
testRunner.And("I fill in", ((string)(null)), table7);
|
||||
#line 81
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 82
|
||||
testRunner.And("I go to \"my-blog\"");
|
||||
#line 83
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 84
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
testRunner.And("I go to \"my-blog\"");
|
||||
#line 85
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
#line 86
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
#line 87
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 88
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -281,21 +285,21 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table8.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 87
|
||||
#line 89
|
||||
testRunner.And("I fill in", ((string)(null)), table8);
|
||||
#line 91
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 92
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 93
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 94
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 95
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 96
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
#line 97
|
||||
testRunner.When("I go to \"admin/blogs\"");
|
||||
#line 98
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 99
|
||||
testRunner.And("I follow \"Blog Properties\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -304,19 +308,19 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table9.AddRow(new string[] {
|
||||
"Routable.Slug",
|
||||
"my-other-blog"});
|
||||
#line 98
|
||||
#line 100
|
||||
testRunner.And("I fill in", ((string)(null)), table9);
|
||||
#line 101
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 102
|
||||
testRunner.And("I go to \"my-other-blog\"");
|
||||
#line 103
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 104
|
||||
testRunner.When("I go to \"my-other-blog/my-post\"");
|
||||
testRunner.And("I go to \"my-other-blog\"");
|
||||
#line 105
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
|
||||
#line 106
|
||||
testRunner.When("I go to \"my-other-blog/my-post\"");
|
||||
#line 107
|
||||
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
|
||||
#line 108
|
||||
testRunner.And("I should see \"Hi there.\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -327,11 +331,11 @@ this.ScenarioSetup(scenarioInfo);
|
||||
public virtual void WhenViewingABlogTheUserAgentIsGivenAnRSSFeedOfTheBlogSPosts()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("When viewing a blog the user agent is given an RSS feed of the blog\'s posts", ((string[])(null)));
|
||||
#line 108
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 109
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 110
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 111
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 112
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -340,15 +344,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table10.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 111
|
||||
#line 113
|
||||
testRunner.And("I fill in", ((string)(null)), table10);
|
||||
#line 114
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 115
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 116
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 117
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 118
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 119
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -360,15 +364,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table11.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 118
|
||||
#line 120
|
||||
testRunner.And("I fill in", ((string)(null)), table11);
|
||||
#line 122
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 123
|
||||
testRunner.And("I am redirected");
|
||||
#line 124
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 125
|
||||
testRunner.And("I am redirected");
|
||||
#line 126
|
||||
testRunner.And("I go to \"my-blog/my-post\"");
|
||||
#line 127
|
||||
testRunner.Then("I should see \"<link rel=\"alternate\" type=\"application/rss\\+xml\" title=\"My Blog\" h" +
|
||||
"ref=\"/rss\\?containerid=\\d+\" />\"");
|
||||
#line hidden
|
||||
@@ -382,15 +386,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Enabling remote blog publishing inserts the appropriate metaweblogapi markup into" +
|
||||
" the blog\'s page", ((string[])(null)));
|
||||
#line 128
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 129
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 130
|
||||
testRunner.And("I have enabled \"XmlRpc\"");
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 131
|
||||
testRunner.And("I have enabled \"Orchard.Blogs.RemotePublishing\"");
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 132
|
||||
testRunner.And("I have enabled \"XmlRpc\"");
|
||||
#line 133
|
||||
testRunner.And("I have enabled \"Orchard.Blogs.RemotePublishing\"");
|
||||
#line 134
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -399,23 +403,23 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table12.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 133
|
||||
#line 135
|
||||
testRunner.And("I fill in", ((string)(null)), table12);
|
||||
#line 136
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 137
|
||||
testRunner.And("I go to \"my-blog\"");
|
||||
#line 138
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 139
|
||||
testRunner.And("I go to \"my-blog\"");
|
||||
#line 140
|
||||
testRunner.Then("I should see \"<link href=\"[^\"]*/XmlRpc/LiveWriter/Manifest\" rel=\"wlwmanifest\" typ" +
|
||||
"e=\"application/wlwmanifest\\+xml\" />\"");
|
||||
#line 139
|
||||
testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\"");
|
||||
#line 140
|
||||
testRunner.Then("the content type should be \"\\btext/xml\\b\"");
|
||||
#line 141
|
||||
testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\"");
|
||||
#line 142
|
||||
testRunner.Then("the content type should be \"\\btext/xml\\b\"");
|
||||
#line 143
|
||||
testRunner.And("I should see \"<manifest xmlns=\"http\\://schemas\\.microsoft\\.com/wlw/manifest/weblo" +
|
||||
"g\">\"");
|
||||
#line 142
|
||||
#line 144
|
||||
testRunner.And("I should see \"<clientType>Metaweblog</clientType>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -428,13 +432,13 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when not at the root is reflected in the URL " +
|
||||
"example for the slug field when creating a blog or blog post", ((string[])(null)));
|
||||
#line 144
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 145
|
||||
testRunner.Given("I have installed Orchard at \"/OrchardLocal\"");
|
||||
#line 146
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 147
|
||||
testRunner.Given("I have installed Orchard at \"/OrchardLocal\"");
|
||||
#line 148
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line 149
|
||||
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/</span>\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -443,17 +447,17 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table13.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 148
|
||||
#line 150
|
||||
testRunner.When("I fill in", ((string)(null)), table13);
|
||||
#line 151
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 152
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 153
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 154
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 155
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 156
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line 157
|
||||
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/my-blog/</span>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -466,13 +470,13 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when at the root is reflected in the URL exam" +
|
||||
"ple for the slug field when creating a blog or blog post", ((string[])(null)));
|
||||
#line 157
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 158
|
||||
testRunner.Given("I have installed Orchard at \"/\"");
|
||||
#line 159
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 160
|
||||
testRunner.Given("I have installed Orchard at \"/\"");
|
||||
#line 161
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line 162
|
||||
testRunner.Then("I should see \"<span>http\\://localhost/</span>\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -481,17 +485,17 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table14.AddRow(new string[] {
|
||||
"Routable.Title",
|
||||
"My Blog"});
|
||||
#line 161
|
||||
#line 163
|
||||
testRunner.When("I fill in", ((string)(null)), table14);
|
||||
#line 164
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 165
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 166
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 167
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 168
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 169
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line 170
|
||||
testRunner.Then("I should see \"<span>http\\://localhost/my-blog/</span>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -504,11 +508,11 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I set my blog to be the content for the home page and the posts for the blog be r" +
|
||||
"ooted to the app", ((string[])(null)));
|
||||
#line 170
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 171
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 172
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 173
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 174
|
||||
testRunner.When("I go to \"admin/blogs/create\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -520,15 +524,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table15.AddRow(new string[] {
|
||||
"Routable.PromoteToHomePage",
|
||||
"true"});
|
||||
#line 173
|
||||
#line 175
|
||||
testRunner.And("I fill in", ((string)(null)), table15);
|
||||
#line 177
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 178
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 179
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 180
|
||||
testRunner.And("I go to \"admin/blogs\"");
|
||||
#line 181
|
||||
testRunner.And("I follow \"My Blog\"");
|
||||
#line 182
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -540,23 +544,23 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table16.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 181
|
||||
#line 183
|
||||
testRunner.And("I fill in", ((string)(null)), table16);
|
||||
#line 185
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 186
|
||||
testRunner.And("I am redirected");
|
||||
#line 187
|
||||
testRunner.And("I go to \"/\"");
|
||||
testRunner.And("I hit \"Publish Now\"");
|
||||
#line 188
|
||||
testRunner.Then("I should see \"<h1>My Blog</h1>\"");
|
||||
testRunner.And("I am redirected");
|
||||
#line 189
|
||||
testRunner.When("I go to \"/my-blog\"");
|
||||
testRunner.And("I go to \"/\"");
|
||||
#line 190
|
||||
testRunner.Then("the status should be 404 \"Not Found\"");
|
||||
testRunner.Then("I should see \"<h1>My Blog</h1>\"");
|
||||
#line 191
|
||||
testRunner.When("I go to \"/my-post\"");
|
||||
testRunner.When("I go to \"/my-blog\"");
|
||||
#line 192
|
||||
testRunner.Then("the status should be 404 \"Not Found\"");
|
||||
#line 193
|
||||
testRunner.When("I go to \"/my-post\"");
|
||||
#line 194
|
||||
testRunner.Then("I should see \"<h1>My Post</h1>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
|
||||
@@ -6,27 +6,27 @@
|
||||
</listeners>
|
||||
</trace>
|
||||
<sources>
|
||||
<source name="Default" switchValue="Warning">
|
||||
<source name="Default" switchValue="Error">
|
||||
<listeners>
|
||||
<add name="CaptureTraceMessages" />
|
||||
</listeners>
|
||||
</source>
|
||||
<source name="Orchard" switchValue="Verbose">
|
||||
<source name="Orchard" switchValue="Error">
|
||||
<listeners>
|
||||
<add name="CaptureTraceMessages" />
|
||||
</listeners>
|
||||
</source>
|
||||
<source name="Orchard.Data.SessionLocator" switchValue="Information">
|
||||
<source name="Orchard.Data.SessionLocator" switchValue="Error">
|
||||
<listeners>
|
||||
<add name="CaptureTraceMessages" />
|
||||
</listeners>
|
||||
</source>
|
||||
<source name="NHibernate.SQL" switchValue="Verbose">
|
||||
<source name="NHibernate.SQL" switchValue="Error">
|
||||
<listeners>
|
||||
<add name="CaptureTraceMessages" />
|
||||
</listeners>
|
||||
</source>
|
||||
<source name="Orchard.Mvc.ViewEngines.WebFormViewEngineProvider" switchValue="Warning">
|
||||
<source name="Orchard.Mvc.ViewEngines.WebFormViewEngineProvider" switchValue="Error">
|
||||
<listeners>
|
||||
<add name="CaptureTraceMessages" />
|
||||
</listeners>
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
@@ -7,7 +7,7 @@ Scenario: Root request shows setup form
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
||||
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode |
|
||||
When I go to "/"
|
||||
Then I should see "Welcome to Orchard"
|
||||
@@ -18,7 +18,7 @@ Scenario: Setup folder also shows setup form
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
||||
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode |
|
||||
When I go to "/Setup"
|
||||
Then I should see "Welcome to Orchard"
|
||||
@@ -29,7 +29,7 @@ Scenario: Some of the initial form values are required
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
||||
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode |
|
||||
When I go to "/Setup"
|
||||
And I hit "Finish Setup"
|
||||
@@ -40,7 +40,7 @@ Scenario: Calling setup on a brand new install
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Lists, Orchard.ContentTypes, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.Scripting, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce, Orchard.Blogs, Orchard.Tags, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup |
|
||||
| Core | Common, Containers, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||
| Core | Common, Containers, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode, TheThemeMachine |
|
||||
And I am on "/Setup"
|
||||
When I fill in
|
||||
|
||||
10
src/Orchard.Specs/Setup.feature.cs
generated
@@ -2,7 +2,7 @@
|
||||
// <auto-generated>
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.5.0.0
|
||||
// Runtime Version:4.0.30319.225
|
||||
// Runtime Version:4.0.30319.17011
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -71,7 +71,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table1.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||
"ettings, Shapes, XmlRpc"});
|
||||
"ettings, Shapes, XmlRpc, Title"});
|
||||
table1.AddRow(new string[] {
|
||||
"Theme",
|
||||
"SafeMode"});
|
||||
@@ -107,7 +107,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table2.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||
"ettings, Shapes, XmlRpc"});
|
||||
"ettings, Shapes, XmlRpc, Title"});
|
||||
table2.AddRow(new string[] {
|
||||
"Theme",
|
||||
"SafeMode"});
|
||||
@@ -143,7 +143,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table3.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||
"ettings, Shapes, XmlRpc"});
|
||||
"ettings, Shapes, XmlRpc, Title"});
|
||||
table3.AddRow(new string[] {
|
||||
"Theme",
|
||||
"SafeMode"});
|
||||
@@ -180,7 +180,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table4.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Containers, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, S" +
|
||||
"cheduling, Settings, Shapes, XmlRpc"});
|
||||
"cheduling, Settings, Shapes, XmlRpc, Title"});
|
||||
table4.AddRow(new string[] {
|
||||
"Theme",
|
||||
"SafeMode, TheThemeMachine"});
|
||||
|
||||
@@ -32,8 +32,8 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
// Enable web application to call this assembly in Full Trust
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
|
||||
@@ -7,7 +7,6 @@ using NUnit.Framework;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Indexing;
|
||||
using Orchard.Indexing.Services;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
|
||||
namespace Orchard.Tests.Modules.Indexing {
|
||||
@@ -46,7 +45,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider = _container.Resolve<IIndexProvider>();
|
||||
}
|
||||
|
||||
private ISearchBuilder _searchBuilder { get { return _provider.CreateSearchBuilder("default"); } }
|
||||
private ISearchBuilder SearchBuilder { get { return _provider.CreateSearchBuilder("default"); } }
|
||||
|
||||
[Test]
|
||||
public void SearchTermsShouldBeFoundInMultipleFields() {
|
||||
@@ -74,9 +73,9 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(3));
|
||||
|
||||
|
||||
Assert.That(_searchBuilder.Get(1).ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.Get(2).ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.Get(3).ContentItemId, Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Get(1).ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.Get(2).ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.Get(3).ContentItemId, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -87,11 +86,93 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(3).Add("title", "cat"));
|
||||
|
||||
|
||||
Assert.That(_searchBuilder.WithField("title", "cat").Search().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("title", "cat").Search().Any(hit => new[] { 1, 3 }.Contains(hit.ContentItemId)), Is.True);
|
||||
|
||||
Assert.That(SearchBuilder.WithField("title", "cat").Search().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("title", "cat").Search().Any(hit => new[] { 1, 3 }.Contains(hit.ContentItemId)), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSearchByBooleanWhateverIndexingScheme() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("foo", true));
|
||||
_provider.Store("default", _provider.New(2).Add("foo", true).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("foo", true).Analyze());
|
||||
_provider.Store("default", _provider.New(4).Add("foo", true).Store().Analyze());
|
||||
_provider.Store("default", _provider.New(5).Add("foo", false));
|
||||
_provider.Store("default", _provider.New(6).Add("foo", false).Store());
|
||||
_provider.Store("default", _provider.New(7).Add("foo", false).Analyze());
|
||||
_provider.Store("default", _provider.New(8).Add("foo", false).Store().Analyze());
|
||||
|
||||
Assert.That(SearchBuilder.WithField("foo", false).Search().Count(), Is.EqualTo(4));
|
||||
Assert.That(SearchBuilder.WithField("foo", true).Search().Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSearchByStringWhateverIndexingScheme() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("foo", "abc"));
|
||||
_provider.Store("default", _provider.New(2).Add("foo", "abc").Store());
|
||||
_provider.Store("default", _provider.New(3).Add("foo", "abc").Analyze());
|
||||
_provider.Store("default", _provider.New(4).Add("foo", "abc").Store().Analyze());
|
||||
_provider.Store("default", _provider.New(5).Add("foo", "def"));
|
||||
_provider.Store("default", _provider.New(6).Add("foo", "def").Store());
|
||||
_provider.Store("default", _provider.New(7).Add("foo", "def").Analyze());
|
||||
_provider.Store("default", _provider.New(8).Add("foo", "def").Store().Analyze());
|
||||
|
||||
Assert.That(SearchBuilder.WithField("foo", "abc").Search().Count(), Is.EqualTo(4));
|
||||
Assert.That(SearchBuilder.WithField("foo", "def").Search().Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSearchByIntegerWhateverIndexingScheme() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("foo", 1));
|
||||
_provider.Store("default", _provider.New(2).Add("foo", 1).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("foo", 1).Analyze());
|
||||
_provider.Store("default", _provider.New(4).Add("foo", 1).Store().Analyze());
|
||||
_provider.Store("default", _provider.New(5).Add("foo", 2));
|
||||
_provider.Store("default", _provider.New(6).Add("foo", 2).Store());
|
||||
_provider.Store("default", _provider.New(7).Add("foo", 2).Analyze());
|
||||
_provider.Store("default", _provider.New(8).Add("foo", 2).Store().Analyze());
|
||||
|
||||
Assert.That(SearchBuilder.WithField("foo", 1).Search().Count(), Is.EqualTo(4));
|
||||
Assert.That(SearchBuilder.WithField("foo", 2).Search().Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSearchByFloatWhateverIndexingScheme() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("foo", 1.1));
|
||||
_provider.Store("default", _provider.New(2).Add("foo", 1.1).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("foo", 1.1).Analyze());
|
||||
_provider.Store("default", _provider.New(4).Add("foo", 1.1).Store().Analyze());
|
||||
_provider.Store("default", _provider.New(5).Add("foo", 2.1));
|
||||
_provider.Store("default", _provider.New(6).Add("foo", 2.1).Store());
|
||||
_provider.Store("default", _provider.New(7).Add("foo", 2.1).Analyze());
|
||||
_provider.Store("default", _provider.New(8).Add("foo", 2.1).Store().Analyze());
|
||||
|
||||
Assert.That(SearchBuilder.WithField("foo", 1.1).Search().Count(), Is.EqualTo(4));
|
||||
Assert.That(SearchBuilder.WithField("foo", 2.1).Search().Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSearchByDateTimeWhateverIndexingScheme() {
|
||||
var date1 = DateTime.Today;
|
||||
var date2 = DateTime.Today.AddDays(1);
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("foo", date1));
|
||||
_provider.Store("default", _provider.New(2).Add("foo", date1).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("foo", date1).Analyze());
|
||||
_provider.Store("default", _provider.New(4).Add("foo", date1).Store().Analyze());
|
||||
_provider.Store("default", _provider.New(5).Add("foo", date2));
|
||||
_provider.Store("default", _provider.New(6).Add("foo", date2).Store());
|
||||
_provider.Store("default", _provider.New(7).Add("foo", date2).Analyze());
|
||||
_provider.Store("default", _provider.New(8).Add("foo", date2).Store().Analyze());
|
||||
|
||||
Assert.That(SearchBuilder.WithField("foo", date1).Search().Count(), Is.EqualTo(4));
|
||||
Assert.That(SearchBuilder.WithField("foo", date2).Search().Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ShouldCountResultsOnly() {
|
||||
_provider.CreateIndex("default");
|
||||
@@ -99,8 +180,8 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(2).Add("title", "dog"));
|
||||
_provider.Store("default", _provider.New(3).Add("title", "cat"));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("title", "dog").Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("title", "cat").Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("title", "dog").Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("title", "cat").Count(), Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -110,12 +191,12 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(2).Add("date", new DateTime(2010, 05, 28, 12, 30, 30)));
|
||||
_provider.Store("default", _provider.New(3).Add("date", new DateTime(2010, 05, 28, 12, 30, 45)));
|
||||
|
||||
Assert.That(_searchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 15), DateTime.MaxValue).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.WithinRange("date", DateTime.MinValue, new DateTime(2010, 05, 28, 12, 30, 45)).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 15), new DateTime(2010, 05, 28, 12, 30, 45)).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 16), new DateTime(2010, 05, 28, 12, 30, 44)).Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 46), DateTime.MaxValue).Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithinRange("date", DateTime.MinValue, new DateTime(2010, 05, 28, 12, 30, 1)).Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 15), DateTime.MaxValue).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.WithinRange("date", DateTime.MinValue, new DateTime(2010, 05, 28, 12, 30, 45)).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 15), new DateTime(2010, 05, 28, 12, 30, 45)).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 16), new DateTime(2010, 05, 28, 12, 30, 44)).Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithinRange("date", new DateTime(2010, 05, 28, 12, 30, 46), DateTime.MaxValue).Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithinRange("date", DateTime.MinValue, new DateTime(2010, 05, 28, 12, 30, 1)).Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -128,16 +209,16 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(55555));
|
||||
|
||||
|
||||
Assert.That(_searchBuilder.Count(), Is.EqualTo(5));
|
||||
Assert.That(_searchBuilder.Slice(0, 3).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.Slice(1, 3).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.Slice(3, 3).Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.Count(), Is.EqualTo(5));
|
||||
Assert.That(SearchBuilder.Slice(0, 3).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Slice(1, 3).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Slice(3, 3).Count(), Is.EqualTo(2));
|
||||
|
||||
// Count() and Search() should return the same results
|
||||
Assert.That(_searchBuilder.Search().Count(), Is.EqualTo(5));
|
||||
Assert.That(_searchBuilder.Slice(0, 3).Search().Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.Slice(1, 3).Search().Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.Slice(3, 3).Search().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.Search().Count(), Is.EqualTo(5));
|
||||
Assert.That(SearchBuilder.Slice(0, 3).Search().Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Slice(1, 3).Search().Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Slice(3, 3).Search().Count(), Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -149,12 +230,12 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(4).Add("body", "a dog is pursuing a cat").Analyze());
|
||||
_provider.Store("default", _provider.New(5).Add("body", "the elephant can't catch up the dog").Analyze());
|
||||
|
||||
var michael = _searchBuilder.WithField("body", "michael").Search().ToList();
|
||||
var michael = SearchBuilder.WithField("body", "michael").Search().ToList();
|
||||
Assert.That(michael.Count(), Is.EqualTo(2));
|
||||
Assert.That(michael[0].Score >= michael[1].Score, Is.True);
|
||||
|
||||
// Sorting on score is always descending
|
||||
michael = _searchBuilder.WithField("body", "michael").Ascending().Search().ToList();
|
||||
michael = SearchBuilder.WithField("body", "michael").Ascending().Search().ToList();
|
||||
Assert.That(michael.Count(), Is.EqualTo(2));
|
||||
Assert.That(michael[0].Score >= michael[1].Score, Is.True);
|
||||
}
|
||||
@@ -162,37 +243,77 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
[Test]
|
||||
public void ShouldSortByDate() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("date", new DateTime(2010, 05, 28, 12, 30, 15)).Store());
|
||||
_provider.Store("default", _provider.New(2).Add("date", new DateTime(2010, 05, 28, 12, 30, 30)).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("date", new DateTime(2010, 05, 28, 12, 30, 45)).Store());
|
||||
_provider.Store("default", _provider.New(1).Add("date", new DateTime(2010, 05, 28, 12, 30, 30)));
|
||||
_provider.Store("default", _provider.New(2).Add("date", DateTime.MinValue));
|
||||
_provider.Store("default", _provider.New(3).Add("date", DateTime.MaxValue));
|
||||
|
||||
var date = _searchBuilder.SortByDateTime("date").Search().ToList();
|
||||
var date = SearchBuilder.SortByDateTime("date").Search().ToList();
|
||||
Assert.That(date.Count(), Is.EqualTo(3));
|
||||
Assert.That(date[0].GetDateTime("date") > date[1].GetDateTime("date"), Is.True);
|
||||
Assert.That(date[1].GetDateTime("date") > date[2].GetDateTime("date"), Is.True);
|
||||
Assert.That(date[0].ContentItemId, Is.EqualTo(3));
|
||||
Assert.That(date[1].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(date[2].ContentItemId, Is.EqualTo(2));
|
||||
|
||||
date = _searchBuilder.SortByDateTime("date").Ascending().Search().ToList();
|
||||
Assert.That(date.Count(), Is.EqualTo(3));
|
||||
Assert.That(date[0].GetDateTime("date") < date[1].GetDateTime("date"), Is.True);
|
||||
Assert.That(date[1].GetDateTime("date") < date[2].GetDateTime("date"), Is.True);
|
||||
date = SearchBuilder.SortByDateTime("date").Ascending().Search().ToList();
|
||||
Assert.That(date[0].ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(date[1].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(date[2].ContentItemId, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSortByNumber() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("downloads", 111).Store());
|
||||
_provider.Store("default", _provider.New(2).Add("downloads", 2222).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("downloads", 3).Store());
|
||||
_provider.Store("default", _provider.New(1).Add("downloads", 111));
|
||||
_provider.Store("default", _provider.New(2).Add("downloads", int.MaxValue));
|
||||
_provider.Store("default", _provider.New(3).Add("downloads", int.MinValue));
|
||||
|
||||
var number = _searchBuilder.SortByInteger("downloads").Search().ToList();
|
||||
var number = SearchBuilder.SortByInteger("downloads").Search().ToList();
|
||||
Assert.That(number.Count(), Is.EqualTo(3));
|
||||
Assert.That(number[0].GetInt("downloads") > number[1].GetInt("downloads"), Is.True);
|
||||
Assert.That(number[1].GetInt("downloads") > number[2].GetInt("downloads"), Is.True);
|
||||
Assert.That(number[0].ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(number[1].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(number[2].ContentItemId, Is.EqualTo(3));
|
||||
|
||||
number = _searchBuilder.SortByInteger("downloads").Ascending().Search().ToList();
|
||||
number = SearchBuilder.SortByInteger("downloads").Ascending().Search().ToList();
|
||||
Assert.That(number.Count(), Is.EqualTo(3));
|
||||
Assert.That(number[0].GetInt("downloads") < number[1].GetInt("downloads"), Is.True);
|
||||
Assert.That(number[1].GetInt("downloads") < number[2].GetInt("downloads"), Is.True);
|
||||
Assert.That(number[0].ContentItemId, Is.EqualTo(3));
|
||||
Assert.That(number[1].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(number[2].ContentItemId, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSortByBoolean() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("active", true));
|
||||
_provider.Store("default", _provider.New(2).Add("active", false));
|
||||
|
||||
var number = SearchBuilder.SortByBoolean("active").Search().ToList();
|
||||
Assert.That(number.Count(), Is.EqualTo(2));
|
||||
Assert.That(number[0].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(number[1].ContentItemId, Is.EqualTo(2));
|
||||
|
||||
number = SearchBuilder.SortByBoolean("active").Ascending().Search().ToList();
|
||||
Assert.That(number.Count(), Is.EqualTo(2));
|
||||
Assert.That(number[0].ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(number[1].ContentItemId, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldSortByDouble() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("rating", 111.111));
|
||||
_provider.Store("default", _provider.New(2).Add("rating", double.MaxValue));
|
||||
_provider.Store("default", _provider.New(3).Add("rating", double.MinValue));
|
||||
|
||||
var number = SearchBuilder.SortByDouble("rating").Search().ToList();
|
||||
Assert.That(number.Count(), Is.EqualTo(3));
|
||||
Assert.That(number[0].ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(number[1].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(number[2].ContentItemId, Is.EqualTo(3));
|
||||
|
||||
number = SearchBuilder.SortByDouble("rating").Ascending().Search().ToList();
|
||||
Assert.That(number.Count(), Is.EqualTo(3));
|
||||
Assert.That(number[0].ContentItemId, Is.EqualTo(3));
|
||||
Assert.That(number[1].ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(number[2].ContentItemId, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -201,10 +322,10 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(1).Add("body", "Orchard has been developped in C#").Analyze());
|
||||
_provider.Store("default", _provider.New(2).Add("body", "Windows has been developped in C++").Analyze());
|
||||
|
||||
var cs = _searchBuilder.Parse("body", "C#").Search().ToList();
|
||||
var cs = SearchBuilder.Parse("body", "C#").Search().ToList();
|
||||
Assert.That(cs.Count(), Is.EqualTo(2));
|
||||
|
||||
var cpp = _searchBuilder.Parse("body", "C++").Search().ToList();
|
||||
var cpp = SearchBuilder.Parse("body", "C++").Search().ToList();
|
||||
Assert.That(cpp.Count(), Is.EqualTo(2));
|
||||
|
||||
}
|
||||
@@ -215,10 +336,10 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(1).Add("body", "Orchard has been developped in C#").Analyze());
|
||||
_provider.Store("default", _provider.New(2).Add("body", "Windows has been developped in C++").Analyze());
|
||||
|
||||
Assert.That(_searchBuilder.WithField("body", "develop").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "develop").WithField("body", "Orchard").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "develop").WithField("body", "Orchard").Mandatory().Search().ToList().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("body", "develop").WithField("body", "Orchard").Mandatory().Search().First().ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("body", "develop").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "develop").WithField("body", "Orchard").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "develop").WithField("body", "Orchard").Mandatory().Search().ToList().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("body", "develop").WithField("body", "Orchard").Mandatory().Search().First().ContentItemId, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -227,10 +348,10 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(1).Add("body", "Orchard has been developped in C#").Analyze());
|
||||
_provider.Store("default", _provider.New(2).Add("body", "Windows has been developped in C++").Analyze());
|
||||
|
||||
Assert.That(_searchBuilder.WithField("body", "developped").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "developped").WithField("body", "Orchard").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "developped").WithField("body", "Orchard").Forbidden().Search().ToList().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("body", "developped").WithField("body", "Orchard").Forbidden().Search().First().ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "developped").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "developped").WithField("body", "Orchard").Search().ToList().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "developped").WithField("body", "Orchard").Forbidden().Search().ToList().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("body", "developped").WithField("body", "Orchard").Forbidden().Search().First().ContentItemId, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -239,7 +360,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(1).Add("body", "Orchard has been developped in C#").Analyze());
|
||||
_provider.Store("default", _provider.New(2).Add("body", "Windows has been developped in C++").Analyze());
|
||||
|
||||
Assert.That(_searchBuilder.WithField("body", "developped").WithField("body", "Orchard").Weighted(2).Search().First().ContentItemId, Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("body", "developped").WithField("body", "Orchard").Weighted(2).Search().First().ContentItemId, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -249,14 +370,14 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(2).Add("body", "Renaud is also in the kitchen.").Analyze().Add("title", "A love affair").Analyze());
|
||||
_provider.Store("default", _provider.New(3).Add("body", "Bertrand is a little bit jealous.").Analyze().Add("title", "Soap opera").Analyze());
|
||||
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body"}, "kitchen", false).Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body"}, "kitchen bertrand", false).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body"}, "kitchen +bertrand", false).Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body"}, "+kitchen +bertrand", false).Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body"}, "kit", false).Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body"}, "kit*", false).Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body", "title"}, "bradley love^3 soap", false).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.Parse(new[] {"body", "title"}, "bradley love^3 soap", false).Search().First().ContentItemId, Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body"}, "kitchen", false).Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body"}, "kitchen bertrand", false).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body"}, "kitchen +bertrand", false).Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body"}, "+kitchen +bertrand", false).Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body"}, "kit", false).Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body"}, "kit*", false).Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body", "title"}, "bradley love^3 soap", false).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.Parse(new[] {"body", "title"}, "bradley love^3 soap", false).Search().First().ContentItemId, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
[Test]
|
||||
@@ -267,11 +388,11 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(3).Add("body", "Bertrand is a little bit jealous.").Analyze().Add("title", "Soap opera").Analyze());
|
||||
|
||||
// specifying a field to match
|
||||
Assert.That(_searchBuilder.Parse(new[] { "body" }, "title:bradley", false).Search().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.Parse(new[] { "body" }, "title:s*", false).Search().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.Parse(new[] { "body" }, "title:bradley", false).Search().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.Parse(new[] { "body" }, "title:s*", false).Search().Count(), Is.EqualTo(1));
|
||||
|
||||
// checking terms fall back to the default fields
|
||||
Assert.That(_searchBuilder.Parse(new[] { "body" }, "title:bradley bradley", false).Search().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.Parse(new[] { "body" }, "title:bradley bradley", false).Search().Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -281,13 +402,13 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(2).Add("field", 22));
|
||||
_provider.Store("default", _provider.New(3).Add("field", 333));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("field", 1).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("field", 22).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("field", 333).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field", 1).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field", 22).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field", 333).ExactMatch().Count(), Is.EqualTo(1));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("field", 0).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("field", 2).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("field", 3).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field", 0).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field", 2).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field", 3).ExactMatch().Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -297,13 +418,13 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(2).Add("field", 22).Store());
|
||||
_provider.Store("default", _provider.New(3).Add("field", 333).Store());
|
||||
|
||||
Assert.That(_searchBuilder.WithField("field", 1).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("field", 22).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("field", 333).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field", 1).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field", 22).ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field", 333).ExactMatch().Count(), Is.EqualTo(1));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("field", 0).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("field", 2).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("field", 3).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field", 0).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field", 2).ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field", 3).ExactMatch().Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -324,21 +445,21 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(2).Add("body", "Windows a été développé par Microsoft en C++").Analyze().Add("culture", 1036));
|
||||
_provider.Store("default", _provider.New(3).Add("title", "Home").Analyze().Add("culture", 1033));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("body", "Microsoft").Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "Microsoft").WithField("culture", 1033).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.WithField("body", "Microsoft").WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("body", "Microsoft").Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "Microsoft").WithField("culture", 1033).Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.WithField("body", "Microsoft").WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(1));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("body", "Orchard").WithField("culture", 1036).Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "Orchard").WithField("culture", 1036).AsFilter().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("body", "Orchard").WithField("culture", 1036).Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "Orchard").WithField("culture", 1036).AsFilter().Count(), Is.EqualTo(0));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("culture", 1033).Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("culture", 1033).Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(2));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("body", "blabla").WithField("culture", 1033).Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("body", "blabla").WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("body", "blabla").WithField("culture", 1033).Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("body", "blabla").WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(0));
|
||||
|
||||
Assert.That(_searchBuilder.Parse("title", "home").Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.Parse("title", "home").WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.Parse("title", "home").Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.Parse("title", "home").WithField("culture", 1033).AsFilter().Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -346,7 +467,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("body", "foo.bar").Analyze());
|
||||
|
||||
Assert.That(_searchBuilder.Parse("body", "*@!woo*@!").Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.Parse("body", "*@!woo*@!").Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -362,17 +483,17 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
|
||||
_provider.Store("default", documentIndex);
|
||||
|
||||
Assert.That(_searchBuilder.WithField("tag-id", 0).Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("tag-id", 1).Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-id", 2).Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-id", 3).Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-id", 0).Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("tag-id", 1).Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-id", 2).Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-id", 3).Count(), Is.EqualTo(1));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag").ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag2").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag3").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag").ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag2").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag3").ExactMatch().Count(), Is.EqualTo(1));
|
||||
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag").Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag").Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -385,12 +506,12 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", documentIndex);
|
||||
|
||||
// trying in prefix mode
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag").Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "Tag").Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag").Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "Tag").Count(), Is.EqualTo(1));
|
||||
|
||||
// trying in full word match mode
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-value", "Tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-value", "Tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -404,12 +525,12 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", documentIndex);
|
||||
|
||||
// a value which is not analyzed, is not lowered cased in the index
|
||||
Assert.That(_searchBuilder.WithField("tag-valueL", "tag").Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-valueU", "tag").Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("tag-valueL", "Tag").Count(), Is.EqualTo(1)); // queried term is lower cased
|
||||
Assert.That(_searchBuilder.WithField("tag-valueU", "Tag").Count(), Is.EqualTo(0)); // queried term is lower cased
|
||||
Assert.That(_searchBuilder.WithField("tag-valueL", "tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(_searchBuilder.WithField("tag-valueU", "tag1").ExactMatch().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("tag-valueL", "tag").Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-valueU", "tag").Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("tag-valueL", "Tag").Count(), Is.EqualTo(1)); // queried term is lower cased
|
||||
Assert.That(SearchBuilder.WithField("tag-valueU", "Tag").Count(), Is.EqualTo(0)); // queried term is lower cased
|
||||
Assert.That(SearchBuilder.WithField("tag-valueL", "tag1").ExactMatch().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("tag-valueU", "tag1").ExactMatch().Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -419,7 +540,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(i).Add("term-id", i).Store());
|
||||
}
|
||||
|
||||
Assert.That(_searchBuilder.Count(), Is.EqualTo(99));
|
||||
Assert.That(SearchBuilder.Count(), Is.EqualTo(99));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -429,12 +550,12 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_provider.Store("default", _provider.New(i).Add("term-id", i / 10).Store());
|
||||
}
|
||||
|
||||
Assert.That(_searchBuilder.Count(), Is.EqualTo(49));
|
||||
Assert.That(_searchBuilder.WithField("term-id", 0).ExactMatch().AsFilter().Count(), Is.EqualTo(9));
|
||||
Assert.That(_searchBuilder.WithField("term-id", 1).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(_searchBuilder.WithField("term-id", 2).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(_searchBuilder.WithField("term-id", 3).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(_searchBuilder.WithField("term-id", 4).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(SearchBuilder.Count(), Is.EqualTo(49));
|
||||
Assert.That(SearchBuilder.WithField("term-id", 0).ExactMatch().AsFilter().Count(), Is.EqualTo(9));
|
||||
Assert.That(SearchBuilder.WithField("term-id", 1).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(SearchBuilder.WithField("term-id", 2).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(SearchBuilder.WithField("term-id", 3).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
Assert.That(SearchBuilder.WithField("term-id", 4).ExactMatch().AsFilter().Count(), Is.EqualTo(10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -462,10 +583,10 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
);
|
||||
|
||||
|
||||
Assert.That(_searchBuilder.WithField("field1", 0).Mandatory().Count(), Is.EqualTo(0));
|
||||
Assert.That(_searchBuilder.WithField("field1", 1).Mandatory().Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.WithField("field1", 1).Mandatory().WithField("field2", 2).Mandatory().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("field1", 1).Mandatory().WithField("field2", 2).Mandatory().WithField("field3", 3).Mandatory().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field1", 0).Mandatory().Count(), Is.EqualTo(0));
|
||||
Assert.That(SearchBuilder.WithField("field1", 1).Mandatory().Count(), Is.EqualTo(3));
|
||||
Assert.That(SearchBuilder.WithField("field1", 1).Mandatory().WithField("field2", 2).Mandatory().Count(), Is.EqualTo(2));
|
||||
Assert.That(SearchBuilder.WithField("field1", 1).Mandatory().WithField("field2", 2).Mandatory().WithField("field3", 3).Mandatory().Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -492,9 +613,18 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
.Add("field3", 3)
|
||||
);
|
||||
|
||||
Assert.That(_searchBuilder.WithField("field1", 1).Count(), Is.EqualTo(3));
|
||||
Assert.That(_searchBuilder.WithField("field1", 1).WithField("field2", 2).AsFilter().Count(), Is.EqualTo(2));
|
||||
Assert.That(_searchBuilder.WithField("field1", 1).WithField("field2", 2).Mandatory().AsFilter().WithField("field3", 3).Mandatory().AsFilter().Count(), Is.EqualTo(1));
|
||||
Assert.That(SearchBuilder.WithField("field1", 1).Count(), Is.EqualTo(3));
|
||||
|
||||
Assert.That(SearchBuilder
|
||||
.WithField("field1", 1)
|
||||
.WithField("field2", 2).AsFilter()
|
||||
.Count(), Is.EqualTo(2));
|
||||
|
||||
Assert.That(SearchBuilder
|
||||
.WithField("field1", 1)
|
||||
.WithField("field2", 2).Mandatory().AsFilter()
|
||||
.WithField("field3", 3).Mandatory().AsFilter()
|
||||
.Count(), Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
@@ -10,6 +10,7 @@ using Orchard.Core.Settings.Descriptor;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
using Orchard.Core.Settings.State;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
@@ -45,6 +46,8 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
|
||||
}
|
||||
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
builder.RegisterInstance(new ShellSettings { Name = "Default" });
|
||||
|
||||
_folders = new ExtensionManagerTests.StubFolders();
|
||||
builder.RegisterInstance(_folders).As<IExtensionFolders>();
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
|
||||
@@ -10,6 +10,7 @@ using Orchard.Core.Settings.Descriptor;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
using Orchard.Core.Settings.State;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
@@ -48,6 +49,8 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
var _testVirtualPathProvider = new StylesheetBindingStrategyTests.TestVirtualPathProvider();
|
||||
|
||||
builder.RegisterInstance(new ShellSettings { Name = "Default" });
|
||||
|
||||
_folders = new ExtensionManagerTests.StubFolders();
|
||||
builder.RegisterInstance(_folders).As<IExtensionFolders>();
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
|
||||
@@ -3,6 +3,6 @@ Author: Bertrand Le Roy
|
||||
Description:
|
||||
This plug-in replaces
|
||||
'the' with 'le'
|
||||
Version: 1.2.41
|
||||
Version: 1.3.0
|
||||
Tags: plug-in, français, the, le
|
||||
homepage: http://weblogs.asp.net/bleroy
|
||||
|
||||
@@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using Orchard.Core.Settings.State;
|
||||
using Orchard.Core.Settings.Descriptor;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.State;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
@@ -16,6 +17,8 @@ namespace Orchard.Tests.Modules.Settings.Blueprint {
|
||||
[TestFixture]
|
||||
public class ShellDescriptorManagerTests : DatabaseEnabledTestsBase {
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
builder.RegisterInstance(new ShellSettings { Name = "Default" });
|
||||
|
||||
builder.RegisterType<ShellDescriptorManager>().As<IShellDescriptorManager>().SingleInstance();
|
||||
builder.RegisterType<ShellStateManager>().As<IShellStateManager>().SingleInstance();
|
||||
builder.RegisterType<StubEventBus>().As<IEventBus>().SingleInstance();
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
builder.RegisterType<TransactionManager>().As<ITransactionManager>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<SiteSettingsPartHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<RegistrationSettingsPartHandler>().As<IContentHandler>();
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace Orchard.Tests.ContentManagement {
|
||||
builder.RegisterType<FlavoredPartHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace Orchard.Tests.ContentManagement {
|
||||
builder.RegisterType<FlavoredPartHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
|
||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||
builder.RegisterType<TestShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<TestWorkContextAccessor>().As<IWorkContextAccessor>();
|
||||
builder.RegisterType<TestDisplayEvents>().As<IShapeDisplayEvents>()
|
||||
.As<TestDisplayEvents>()
|
||||
|
||||
@@ -10,7 +10,7 @@ using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.DisplayManagement {
|
||||
[TestFixture]
|
||||
public class DefaultShapeBuilderTests {
|
||||
public class ShapeFactoryTests {
|
||||
private IContainer _container;
|
||||
|
||||
[SetUp]
|
||||
@@ -18,6 +18,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<StubParallelCacheContext>().As<IParallelCacheContext>();
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<StubParallelCacheContext>().As<IParallelCacheContext>();
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterModule(new ShapeAttributeBindingModule());
|
||||
builder.RegisterType<ShapeAttributeBindingStrategy>().As<IShapeTableProvider>();
|
||||
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
|
||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||
|
||||
@@ -139,7 +139,8 @@ namespace Orchard.Tests.Environment {
|
||||
public void NormalDependenciesShouldBeUniquePerRequestContainer() {
|
||||
var host = _lifetime.Resolve<IOrchardHost>();
|
||||
var container1 = host.CreateShellContainer_Obsolete();
|
||||
((IShellDescriptorManagerEventHandler)host).Changed(null);
|
||||
((IShellDescriptorManagerEventHandler)host).Changed(null, ShellSettings.DefaultName);
|
||||
host.BeginRequest(); // force reloading the shell
|
||||
var container2 = host.CreateShellContainer_Obsolete();
|
||||
var requestContainer1a = container1.BeginLifetimeScope();
|
||||
var requestContainer1b = container1.BeginLifetimeScope();
|
||||
|
||||
@@ -3,6 +3,6 @@ Author: Bertrand Le Roy
|
||||
Description:
|
||||
This plug-in replaces
|
||||
'the' with 'le'
|
||||
Version: 1.2.41
|
||||
Version: 1.3.0
|
||||
Tags: plug-in, français, the, le
|
||||
homepage: http://weblogs.asp.net/bleroy
|
||||
|
||||
@@ -8,6 +8,7 @@ using Orchard.Caching;
|
||||
using Orchard.Core.Settings.Descriptor;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
using Orchard.Core.Settings.State;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
@@ -45,6 +46,8 @@ namespace Orchard.Tests.Environment.Features {
|
||||
builder.RegisterType<ShellStateManager>().As<IShellStateManager>().SingleInstance();
|
||||
builder.RegisterType<StubEventBus>().As<IEventBus>().SingleInstance();
|
||||
builder.RegisterSource(new EventsRegistrationSource());
|
||||
|
||||
builder.RegisterInstance(new ShellSettings { Name = "Default" });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -34,5 +34,5 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace Orchard.Core.Common.Drivers {
|
||||
return Combined(
|
||||
ContentShape("Parts_Common_Body",
|
||||
() => {
|
||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text));
|
||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
||||
return shapeHelper.Parts_Common_Body(ContentPart: part, Html: new HtmlString(bodyText));
|
||||
}),
|
||||
ContentShape("Parts_Common_Body_Summary",
|
||||
() => {
|
||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text));
|
||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
||||
return shapeHelper.Parts_Common_Body_Summary(ContentPart: part, Html: new HtmlString(bodyText));
|
||||
})
|
||||
);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The common module introduces content parts that are going to be used by most content types (common, body and routable).
|
||||
FeatureDescription: Core content parts.
|
||||
Dependencies: Settings
|
||||
|
||||
@@ -39,8 +39,10 @@ namespace Orchard.Core.Common.OwnerEditor {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
var settings = part.TypePartDefinition.Settings.GetModel<OwnerEditorSettings>();
|
||||
if (!settings.ShowOwnerEditor) {
|
||||
part.Owner = currentUser;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Orchard.Services;
|
||||
|
||||
namespace Orchard.Core.Common.Services {
|
||||
public class BbcodeFilter : IHtmlFilter {
|
||||
public string ProcessContent(string text) {
|
||||
public string ProcessContent(string text, string flavor) {
|
||||
return BbcodeReplace(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Containers.Extensions;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Mvc;
|
||||
@@ -18,16 +20,19 @@ namespace Orchard.Core.Containers.Controllers {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IContainersPathConstraint _containersPathConstraint;
|
||||
private readonly ISiteService _siteService;
|
||||
private readonly IFeedManager _feedManager;
|
||||
|
||||
public ItemController(
|
||||
IContentManager contentManager,
|
||||
IContainersPathConstraint containersPathConstraint,
|
||||
IShapeFactory shapeFactory,
|
||||
ISiteService siteService) {
|
||||
ISiteService siteService,
|
||||
IFeedManager feedManager) {
|
||||
|
||||
_contentManager = contentManager;
|
||||
_containersPathConstraint = containersPathConstraint;
|
||||
_siteService = siteService;
|
||||
_feedManager = feedManager;
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
@@ -61,6 +66,8 @@ namespace Orchard.Core.Containers.Controllers {
|
||||
var descendingOrder = container.As<ContainerPart>().Record.OrderByDirection == (int) OrderByDirection.Descending;
|
||||
query = query.OrderBy(container.As<ContainerPart>().Record.OrderByProperty, descendingOrder);
|
||||
|
||||
_feedManager.Register(container.As<RoutePart>().Title, "rss", new RouteValueDictionary { { "containerid", container.Id } });
|
||||
|
||||
Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
|
||||
pager.PageSize = pagerParameters.PageSize != null && container.As<ContainerPart>().Record.Paginated
|
||||
? pager.PageSize
|
||||
|
||||
@@ -63,5 +63,6 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
return shapeHelper.EditorTemplate(TemplateName: "Containable", Model: model, Prefix: "Containable");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
? new[] {new SelectListItem {Text = T("(None - create container enabled items first)").Text, Value = "0"}}
|
||||
: containers.Select(x => new SelectListItem {
|
||||
Value = Convert.ToString(x.Id),
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + x.As<IRoutableAspect>().Title,
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + _contentManager.GetItemMetadata(x.ContentItem).DisplayText,
|
||||
Selected = x.Id == model.Part.Record.ContainerId,
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Title.Models;
|
||||
|
||||
namespace Orchard.Core.Containers.Extensions
|
||||
{
|
||||
@@ -11,6 +12,11 @@ namespace Orchard.Core.Containers.Extensions
|
||||
public static IContentQuery<T> OrderBy<T>(this IContentQuery<T> query, string partAndProperty, bool descendingOrder) where T : IContent {
|
||||
//todo: (heskew) order by custom part properties
|
||||
switch (partAndProperty) {
|
||||
case "TitlePart.Title":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<TitlePartRecord, string>(record => record.Title)
|
||||
: query.OrderBy<TitlePartRecord, string>(record => record.Title);
|
||||
break;
|
||||
case "RoutePart.Title":
|
||||
query = descendingOrder
|
||||
? query.OrderByDescending<RoutePartRecord, string>(record => record.Title)
|
||||
@@ -61,6 +67,10 @@ namespace Orchard.Core.Containers.Extensions
|
||||
|
||||
// convoluted: yes; quick and works for now: yes; technical debt: not much
|
||||
private static readonly Dictionary<string, Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>> _filters = new Dictionary<string, Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>> {
|
||||
{"TitlePart.Title|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<TitlePartRecord>(r => true /* CompareTo is not implemented - r.Title.CompareTo(s) == -1*/))},
|
||||
{"TitlePart.Title|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<TitlePartRecord>(r => true /* CompareTo is not implemented - r.Title.CompareTo(s) == 1*/))},
|
||||
{"TitlePart.Title|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<TitlePartRecord>(r => r.Title.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"TitlePart.Title|^=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<TitlePartRecord>(r => r.Title.StartsWith(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
{"RoutePart.Title|<", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => true /* CompareTo is not implemented - r.Title.CompareTo(s) == -1*/))},
|
||||
{"RoutePart.Title|>", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => true /* CompareTo is not implemented - r.Title.CompareTo(s) == 1*/))},
|
||||
{"RoutePart.Title|=", new Func<IContentQuery<ContentItem>, string, IContentQuery<ContentItem>>((q, s) => q.Where<RoutePartRecord>(r => r.Title.Equals(s, StringComparison.OrdinalIgnoreCase)))},
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The containers module introduces container and containable behaviors for content items.
|
||||
FeatureDescription: Container and containable parts to enable parent-child relationships between content items.
|
||||
Dependencies: Contents, Routable
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<select id="@Html.FieldIdFor(m => m.Part.Record.OrderByProperty)" name="@Html.FieldNameFor(m => m.Part.Record.OrderByProperty)">
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.CreatedUtc", T("Date Created").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "TitlePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Title", T("Routable Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
<select id="@Html.FieldIdFor(m => m.Part.Record.OrderByProperty)" name="@Html.FieldNameFor(m => m.Part.Record.OrderByProperty)">
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.CreatedUtc", T("Date Created").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "TitlePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Title", T("Routable Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@@ -39,7 +40,8 @@
|
||||
<select id="@Html.FieldIdFor(m => m.Part.Record.FilterByProperty)" name="@Html.FieldNameFor(m => m.Part.Record.FilterByProperty)">
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CommonPart.CreatedUtx", T("Date Created").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "TitlePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Title", T("Routable Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
model.Options.SelectedFilter = model.TypeName;
|
||||
model.Options.FilterOptions = GetCreatableTypes(false)
|
||||
.Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
|
||||
.ToList().OrderBy(kvp => kvp.Key);
|
||||
.ToList().OrderBy(kvp => kvp.Value);
|
||||
|
||||
var pagerShape = Shape.Pager(pager).TotalItemCount(query.Count());
|
||||
var pageOfContentItems = query.Slice(pager.GetStartIndex(), pager.PageSize).ToList();
|
||||
@@ -191,7 +191,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
|
||||
var contentItem = _contentManager.New(id);
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Cannot create content")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Cannot create content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
if (containerId.HasValue && contentItem.Is<ContainablePart>()) {
|
||||
@@ -218,7 +218,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
[HttpPost, ActionName("Create")]
|
||||
[FormValueRequired("submit.Publish")]
|
||||
public ActionResult CreateAndPublishPOST(string id, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't create content")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.PublishOwnContent, T("Couldn't create content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
return CreatePOST(id, returnUrl, contentItem => _contentManager.Publish(contentItem));
|
||||
@@ -227,7 +227,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
private ActionResult CreatePOST(string id, string returnUrl, Action<ContentItem> conditionallyPublish) {
|
||||
var contentItem = _contentManager.New(id);
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't create content")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Couldn't create content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
_contentManager.Create(contentItem, VersionOptions.Draft);
|
||||
|
||||
@@ -24,6 +24,10 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
// /Contents/Item/Display/72
|
||||
public ActionResult Display(int id) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
||||
|
||||
if (contentItem == null)
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
return new ShapeResult(this, model);
|
||||
}
|
||||
@@ -32,12 +36,16 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
// /Contents/Item/Preview/72?version=5
|
||||
public ActionResult Preview(int id, int? version) {
|
||||
var versionOptions = VersionOptions.Latest;
|
||||
|
||||
if (version != null)
|
||||
versionOptions = VersionOptions.Number((int)version);
|
||||
|
||||
var contentItem = _contentManager.Get(id, versionOptions);
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Cannot edit content")))
|
||||
if (contentItem == null)
|
||||
return HttpNotFound();
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Cannot preview content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
|
||||
40
src/Orchard.Web/Core/Contents/Handlers/RulesHandler.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.Core.Contents.Handlers {
|
||||
|
||||
public interface IRulesManager : IEventHandler {
|
||||
void TriggerEvent(string category, string type, Func<Dictionary<string, object>> tokensContext);
|
||||
}
|
||||
|
||||
[OrchardFeature("Contents.Rules")]
|
||||
public class RulePartHandler : ContentHandler {
|
||||
public RulePartHandler(IRulesManager rulesManager) {
|
||||
|
||||
OnPublished<ContentPart>(
|
||||
(context, part) =>
|
||||
rulesManager.TriggerEvent("Content", "Published",
|
||||
() => new Dictionary<string, object> { { "Content", context.ContentItem } }));
|
||||
|
||||
OnRemoved<ContentPart>(
|
||||
(context, part) =>
|
||||
rulesManager.TriggerEvent("Content", "Removed",
|
||||
() => new Dictionary<string, object> { { "Content", context.ContentItem } }));
|
||||
|
||||
OnVersioned<ContentPart>(
|
||||
(context, part1, part2) =>
|
||||
rulesManager.TriggerEvent("Content", "Versioned",
|
||||
() => new Dictionary<string, object> { { "Content", part1.ContentItem } }));
|
||||
|
||||
OnCreated<ContentPart>(
|
||||
(context, part) =>
|
||||
rulesManager.TriggerEvent("Content", "Created",
|
||||
() => new Dictionary<string, object> { { "Content", context.ContentItem } }));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,16 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The contents module enables the creation of custom content types.
|
||||
FeatureDescription: Default custom content type definition, creation and management.
|
||||
Category: Core
|
||||
Features:
|
||||
Contents
|
||||
Name: Contents
|
||||
Description: Default custom content type definition, creation and management.
|
||||
Category: Core
|
||||
Contents.Rules:
|
||||
Name: Contents Rules
|
||||
Description: Rules for the Contents modules
|
||||
Category: Rules
|
||||
Dependencies: Orchard.Rules, Contents
|
||||
|
||||
@@ -6,11 +6,7 @@ namespace Orchard.Core.Contents {
|
||||
public class Permissions : IPermissionProvider {
|
||||
|
||||
// Note - in code you should demand PublishContent, EditContent, or DeleteContent
|
||||
// Do not demand the "Own" variation - those are applied automatically when you demand the main three
|
||||
|
||||
// Also - the internal name EditContent is used instead of EditOthersContent
|
||||
// because demanding "EditContent" is correct and looks right,
|
||||
// but demanding "EditOthersContent" looks wrong so wasn't used when it should have been
|
||||
// Do not demand the "Own" variations - those are applied automatically when you demand the main ones
|
||||
|
||||
public static readonly Permission PublishContent = new Permission { Description = "Publish or unpublish content for others", Name = "PublishContent" };
|
||||
public static readonly Permission PublishOwnContent = new Permission { Description = "Publish or unpublish own content", Name = "PublishOwnContent", ImpliedBy = new[] { PublishContent } };
|
||||
|
||||
55
src/Orchard.Web/Core/Contents/Rules/ContentEvents.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Events;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.Contents.Rules {
|
||||
public interface IEventProvider : IEventHandler {
|
||||
void Describe(dynamic describe);
|
||||
}
|
||||
|
||||
[OrchardFeature("Contents.Rules")]
|
||||
public class ContentEvents : IEventProvider {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void Describe(dynamic describe) {
|
||||
Func<dynamic, bool> contentHasPart = ContentHasPart;
|
||||
|
||||
describe.For("Content", T("Content Items"), T("Content Items"))
|
||||
.Element("Created", T("Content Created"), T("Content is actually created."), contentHasPart, (Func<dynamic, LocalizedString>)(context => T("When content with types ({0}) is created.", FormatPartsList(context))), "SelectContentTypes")
|
||||
.Element("Versioned", T("Content Versioned"), T("Content is actually versioned."), contentHasPart, (Func<dynamic, LocalizedString>)(context => T("When content with types ({0}) is versioned.", FormatPartsList(context))), "SelectContentTypes")
|
||||
.Element("Published", T("Content Published"), T("Content is actually published."), contentHasPart, (Func<dynamic, LocalizedString>)(context => T("When content with types ({0}) is published.", FormatPartsList(context))), "SelectContentTypes")
|
||||
.Element("Removed", T("Content Removed"), T("Content is actually removed."), contentHasPart, (Func<dynamic, LocalizedString>)(context => T("When content with types ({0}) is removed.", FormatPartsList(context))), "SelectContentTypes");
|
||||
}
|
||||
|
||||
private string FormatPartsList(dynamic context) {
|
||||
var contenttypes = context.Properties["contenttypes"];
|
||||
|
||||
if (String.IsNullOrEmpty(contenttypes)) {
|
||||
return T("Any").Text;
|
||||
}
|
||||
|
||||
return contenttypes;
|
||||
}
|
||||
|
||||
private static bool ContentHasPart(dynamic context) {
|
||||
string contenttypes = context.Properties["contenttypes"];
|
||||
var content = context.Tokens["Content"] as IContent;
|
||||
|
||||
// "" means 'any'
|
||||
if (String.IsNullOrEmpty(contenttypes)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (content == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var contentTypes = contenttypes.Split(new[] { ',' });
|
||||
|
||||
return contentTypes.Any(contentType => content.ContentItem.TypeDefinition.Name == contentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/Orchard.Web/Core/Contents/Rules/ContentForms.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Events;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.Contents.Rules {
|
||||
public interface IFormProvider : IEventHandler {
|
||||
void Describe(dynamic context);
|
||||
}
|
||||
|
||||
[OrchardFeature("Contents.Rules")]
|
||||
public class ContentForms : IFormProvider {
|
||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||
protected dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ContentForms(
|
||||
IShapeFactory shapeFactory,
|
||||
IContentDefinitionManager contentDefinitionManager) {
|
||||
_contentDefinitionManager = contentDefinitionManager;
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
public void Describe(dynamic context) {
|
||||
Func<IShapeFactory, dynamic> form =
|
||||
shape => {
|
||||
|
||||
var f = Shape.Form(
|
||||
Id: "AnyOfContentTypes",
|
||||
_Parts: Shape.SelectList(
|
||||
Id: "contenttypes", Name: "contenttypes",
|
||||
Title: T("Content types"),
|
||||
Description: T("Select some content types."),
|
||||
Size: 10,
|
||||
Multiple: true
|
||||
)
|
||||
);
|
||||
|
||||
f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });
|
||||
|
||||
foreach (var contentType in _contentDefinitionManager.ListTypeDefinitions()) {
|
||||
f._Parts.Add(new SelectListItem { Value = contentType.Name, Text = contentType.DisplayName });
|
||||
}
|
||||
|
||||
return f;
|
||||
};
|
||||
|
||||
context.Form("SelectContentTypes", form);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,25 @@
|
||||
ContentPart contentPart = Model.ContentPart;
|
||||
}
|
||||
@if (contentPart.HasPublished()) {
|
||||
@Html.ItemDisplayLink(T("View").Text, (ContentItem)Model.ContentPart.ContentItem)
|
||||
@T(" | ")
|
||||
@Html.ItemDisplayLink(T("View").Text, (ContentItem)Model.ContentPart.ContentItem)
|
||||
@T(" | ")
|
||||
|
||||
if (contentPart.HasDraft()) {
|
||||
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" })
|
||||
@T(" | ")
|
||||
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" })
|
||||
@T(" | ")
|
||||
|
||||
@Html.ActionLink(T("Preview").Text, "Preview", "Item", new { area = "Contents", id = ((ContentItem)Model.ContentPart.ContentItem).Id }, new { })
|
||||
@T(" | ")
|
||||
}
|
||||
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnpublishUrl UnsafeUrl" })
|
||||
@T(" | ")
|
||||
|
||||
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnpublishUrl UnsafeUrl" })
|
||||
@T(" | ")
|
||||
} else {
|
||||
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" })
|
||||
@T(" | ")
|
||||
if ( contentPart.HasDraft() ) {
|
||||
@Html.ActionLink(T("Preview").Text, "Preview", "Item", new { area = "Contents", id = ((ContentItem)Model.ContentPart.ContentItem).Id }, new { })
|
||||
@T(" | ")
|
||||
}
|
||||
|
||||
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" })
|
||||
@T(" | ")
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The dashboard module is providing the dashboard screen of the admininstration UI of the application.
|
||||
FeatureDescription: Standard admin dashboard.
|
||||
Category: Core
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The Feeds module is providing RSS feeds to content items.
|
||||
FeatureDescription: RSS feeds for content items.
|
||||
Category: Syndication
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The HomePage module enables the promotion of a content item or container to be the home page of the site.
|
||||
FeatureDescription: Standard site home page that allows a specified content type or container to *be* the home page.
|
||||
Category: Core
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The navigation module creates and manages a simple navigation menu for the front-end of the application and allows you to add content items to the admin menu.
|
||||
FeatureDescription: Menu management.
|
||||
Category: Core
|
||||
|
||||
@@ -103,6 +103,9 @@
|
||||
<Compile Include="Containers\ViewModels\ContainableViewModel.cs" />
|
||||
<Compile Include="Containers\ViewModels\ContainerWidgetViewModel.cs" />
|
||||
<Compile Include="Containers\ViewModels\ContainerViewModel.cs" />
|
||||
<Compile Include="Contents\Handlers\RulesHandler.cs" />
|
||||
<Compile Include="Contents\Rules\ContentEvents.cs" />
|
||||
<Compile Include="Contents\Rules\ContentForms.cs" />
|
||||
<Compile Include="Contents\Security\AuthorizationEventHandler.cs" />
|
||||
<Compile Include="Common\Services\BbcodeFilter.cs" />
|
||||
<Compile Include="Common\Services\ICommonService.cs" />
|
||||
@@ -239,6 +242,11 @@
|
||||
<Compile Include="Shapes\ResourceManifest.cs" />
|
||||
<Compile Include="Shapes\CoreShapes.cs" />
|
||||
<Compile Include="Shapes\DateTimeShapes.cs" />
|
||||
<Compile Include="Title\Drivers\TitlePartDriver.cs" />
|
||||
<Compile Include="Title\Handlers\TitlePartHandler.cs" />
|
||||
<Compile Include="Title\Migrations.cs" />
|
||||
<Compile Include="Title\Models\TitlePart.cs" />
|
||||
<Compile Include="Title\Models\TitlePartRecord.cs" />
|
||||
<Compile Include="XmlRpc\Controllers\HomeController.cs" />
|
||||
<Compile Include="XmlRpc\Controllers\LiveWriterController.cs" />
|
||||
<Compile Include="XmlRpc\IXmlRpcDriver.cs" />
|
||||
@@ -315,6 +323,7 @@
|
||||
<Content Include="Shapes\Views\HeadPreload.cshtml" />
|
||||
<Content Include="Shapes\Views\Message.cshtml" />
|
||||
<Content Include="Shapes\Views\NotFound.cshtml" />
|
||||
<Content Include="Title\Module.txt" />
|
||||
<Content Include="XmlRpc\Module.txt" />
|
||||
<Content Include="Settings\Views\EditorTemplates\Parts.Settings.SiteSettingsPart.cshtml" />
|
||||
</ItemGroup>
|
||||
@@ -454,6 +463,24 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Common\Views\DefinitionTemplates\OwnerEditorSettings.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Title\Placement.info" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Title\Views\EditorTemplates\Parts.Title.TitlePart.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Title\Views\Parts.Title.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Title\Views\Parts.Title_Summary.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Title\Views\Parts.Title_SummaryAdmin.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Title\Views\Web.config" />
|
||||
</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.
|
||||
|
||||
@@ -30,6 +30,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.2.41")]
|
||||
[assembly: AssemblyFileVersion("1.2.41")]
|
||||
[assembly: AssemblyVersion("1.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0")]
|
||||
[assembly: SecurityTransparent]
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The dashboard module is providing the reports screen of the application.
|
||||
FeatureDescription: Reports management.
|
||||
Category: Core
|
||||
|
||||
@@ -1,65 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Contents;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Routable.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Services;
|
||||
using Orchard.Themes;
|
||||
|
||||
namespace Orchard.Core.Routable.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class ItemController : Controller, IUpdateModel {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly ITransactionManager _transactionManager;
|
||||
private readonly IRoutablePathConstraint _routablePathConstraint;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly IHomePageProvider _routableHomePageProvider;
|
||||
|
||||
public ItemController(
|
||||
IContentManager contentManager,
|
||||
ITransactionManager transactionManager,
|
||||
IRoutablePathConstraint routablePathConstraint,
|
||||
IShapeFactory shapeFactory,
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
IEnumerable<IHomePageProvider> homePageProviders) {
|
||||
_contentManager = contentManager;
|
||||
IOrchardServices services
|
||||
) {
|
||||
_transactionManager = transactionManager;
|
||||
_routablePathConstraint = routablePathConstraint;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_routableHomePageProvider = homePageProviders.SingleOrDefault(p => p.GetProviderName() == RoutableHomePageProvider.Name);
|
||||
Shape = shapeFactory;
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
dynamic Shape { get; set; }
|
||||
public IOrchardServices Services { get; private set; }
|
||||
|
||||
[Themed]
|
||||
public ActionResult Display(string path) {
|
||||
var matchedPath = _routablePathConstraint.FindPath(path);
|
||||
|
||||
if (matchedPath == null) {
|
||||
throw new ApplicationException(T("404 - should not have passed path constraint").Text);
|
||||
return HttpNotFound(T("Should not have passed path constraint").Text);
|
||||
}
|
||||
|
||||
var hits = _contentManager
|
||||
var hits = Services.ContentManager
|
||||
.Query<RoutePart, RoutePartRecord>(VersionOptions.Published)
|
||||
.Where(r => r.Path == matchedPath)
|
||||
.Slice(0, 2);
|
||||
.Slice(0, 2)
|
||||
.ToList();
|
||||
|
||||
if (hits.Count() == 0) {
|
||||
throw new ApplicationException(T("404 - should not have passed path constraint").Text);
|
||||
}
|
||||
if (hits.Count() != 1) {
|
||||
throw new ApplicationException(T("Ambiguous content").Text);
|
||||
return HttpNotFound(T("Should not have passed path constraint").Text);
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(hits.Single());
|
||||
if (hits.Count() != 1) {
|
||||
return HttpNotFound(T("Ambiguous content").Text);
|
||||
}
|
||||
|
||||
dynamic model = Services.ContentManager.BuildDisplay(hits.Single());
|
||||
return new ShapeResult(this, model);
|
||||
}
|
||||
|
||||
@@ -71,19 +64,19 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
return Json(slug);
|
||||
|
||||
if (id != null)
|
||||
contentItem = _contentManager.Get((int)id, VersionOptions.Latest);
|
||||
contentItem = Services.ContentManager.Get((int)id, VersionOptions.Latest);
|
||||
|
||||
if (contentItem == null) {
|
||||
contentItem = _contentManager.Create(contentType, VersionOptions.Draft);
|
||||
contentItem = Services.ContentManager.Create(contentType, VersionOptions.Draft);
|
||||
|
||||
if (containerId != null) {
|
||||
var containerItem = _contentManager.Get((int)containerId);
|
||||
var containerItem = Services.ContentManager.Get((int)containerId);
|
||||
contentItem.As<ICommonPart>().Container = containerItem;
|
||||
}
|
||||
}
|
||||
|
||||
_contentManager.UpdateEditor(contentItem, this);
|
||||
_contentManager.Publish(contentItem);
|
||||
Services.ContentManager.UpdateEditor(contentItem, this);
|
||||
Services.ContentManager.Publish(contentItem);
|
||||
_transactionManager.Cancel();
|
||||
|
||||
return Json(contentItem.As<IRoutableAspect>().GetEffectiveSlug() ?? slug);
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace Orchard.Core.Routable.Handlers {
|
||||
_routablePathConstraint.AddPath(route.Path);
|
||||
}
|
||||
};
|
||||
|
||||
OnPublished<RoutePart>(handler);
|
||||
OnUnpublished<RoutePart>(handler);
|
||||
|
||||
@@ -140,10 +141,8 @@ namespace Orchard.Core.Routable.Handlers {
|
||||
if (routable == null)
|
||||
return;
|
||||
|
||||
context.Metadata.DisplayText = routable.Title;
|
||||
|
||||
// set the display route values if it hasn't been set or only has been set by the Contents module.
|
||||
// allows other modules to set their own display. probably not common enough to warrant some priority implemntation
|
||||
// allows other modules to set their own display. probably not common enough to warrant some priority implementation
|
||||
if (context.Metadata.DisplayRouteValues == null || context.Metadata.DisplayRouteValues["Area"] as string == "Contents") {
|
||||
var itemPath = routable.Id == _routableHomePageProvider.GetHomePageId(_workContextAccessor.GetContext().CurrentSite.HomePage)
|
||||
? ""
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The routable module enables content items to be accessed through a friendly human-readable URL.
|
||||
FeatureDescription: Routable content part.
|
||||
Dependencies: Settings
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The scheduling module enables background task scheduling.
|
||||
FeatureDescription: Scheduled background tasks.
|
||||
Category: Core
|
||||
|
||||
@@ -2,20 +2,25 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.Settings.Descriptor {
|
||||
public class ShellDescriptorManager : IShellDescriptorManager {
|
||||
private readonly IRepository<ShellDescriptorRecord> _shellDescriptorRepository;
|
||||
private readonly IShellDescriptorManagerEventHandler _events;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
|
||||
public ShellDescriptorManager(
|
||||
IRepository<ShellDescriptorRecord> shellDescriptorRepository,
|
||||
IShellDescriptorManagerEventHandler events) {
|
||||
IShellDescriptorManagerEventHandler events,
|
||||
ShellSettings shellSettings) {
|
||||
_shellDescriptorRepository = shellDescriptorRepository;
|
||||
_events = events;
|
||||
_shellSettings = shellSettings;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
@@ -82,9 +87,7 @@ namespace Orchard.Core.Settings.Descriptor {
|
||||
});
|
||||
}
|
||||
|
||||
_events.Changed(GetShellDescriptorFromRecord(shellDescriptorRecord));
|
||||
_events.Changed(GetShellDescriptorFromRecord(shellDescriptorRecord), _shellSettings.Name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,39 @@ namespace Orchard.Core.Settings.Metadata {
|
||||
Apply(contentPartDefinition, Acquire(contentPartDefinition));
|
||||
}
|
||||
|
||||
public void DeleteTypeDefinition(string name) {
|
||||
var record = _typeDefinitionRepository.Fetch(x => x.Name == name).SingleOrDefault();
|
||||
|
||||
// deletes the content type record associated
|
||||
if (record != null) {
|
||||
_typeDefinitionRepository.Delete(record);
|
||||
}
|
||||
|
||||
// invalidates the cache
|
||||
TriggerContentDefinitionSignal();
|
||||
}
|
||||
|
||||
public void DeletePartDefinition(string name) {
|
||||
// remove parts from current types
|
||||
var typesWithPart = ListTypeDefinitions().Where(typeDefinition => typeDefinition.Parts.Any(part => part.PartDefinition.Name == name));
|
||||
|
||||
foreach (var typeDefinition in typesWithPart) {
|
||||
this.AlterTypeDefinition(typeDefinition.Name, builder => builder.RemovePart(name));
|
||||
}
|
||||
|
||||
// delete part
|
||||
var record = _partDefinitionRepository.Fetch(x => x.Name == name).SingleOrDefault();
|
||||
|
||||
if (record != null) {
|
||||
_partDefinitionRepository.Delete(record);
|
||||
}
|
||||
|
||||
// invalidates the cache
|
||||
TriggerContentDefinitionSignal();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void MonitorContentDefinitionSignal(AcquireContext<string> ctx) {
|
||||
ctx.Monitor(_signals.When(ContentDefinitionSignal));
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The settings module creates site settings that other modules can contribute to.
|
||||
FeatureDescription: Site settings.
|
||||
Category: Core
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The shapes module contains core shape templates and display hooks.
|
||||
FeatureDescription: Core shape templates and display hooks.
|
||||
Category: Core
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1011 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -1,5 +1,5 @@
|
||||
.switch-for-switchable {
|
||||
margin:0 0 -8px;
|
||||
margin:0 0;
|
||||
overflow:auto;
|
||||
}
|
||||
.switch-for-switchable .switch-button-group {
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
@using Orchard.UI.Resources;
|
||||
@{
|
||||
RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/modules/orchard.themes/Content/orchard.ico")});
|
||||
//todo: (heskew) get conditions (as in conditional comments) hooked up for script tags too
|
||||
Script.Include("html5.js").AtLocation(ResourceLocation.Head);
|
||||
Script.Include("html5.js").AtHead();
|
||||
|
||||
//a bit opinionated - only the site name on the homepage
|
||||
var title = (Request.Path.TrimEnd('/') != Request.ApplicationPath && HasText(Model.Title)
|
||||
? Model.Title + WorkContext.CurrentSite.PageTitleSeparator
|
||||
: "") +
|
||||
WorkContext.CurrentSite.SiteName;
|
||||
string title = Convert.ToString(Model.Title);
|
||||
string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="static @Html.ClassForPage()">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>@title</title>
|
||||
<title>@Html.Title(title, siteName)</title>
|
||||
@Display(Model.Head)
|
||||
<script>(function(d){d.className="dyn"+d.className.substring(6,d.className.length);})(document.documentElement);</script>
|
||||
</head>
|
||||
|
||||
@@ -40,7 +40,12 @@
|
||||
</li>
|
||||
}
|
||||
if(Model.Page > 1) {
|
||||
routeData["page"] = Model.Page - 1;
|
||||
routeData["page"] = Model.Page - 1;
|
||||
|
||||
// don't render the page parameter as default is 1
|
||||
if (Model.Page - 1 == 1) {
|
||||
routeData.Remove("page");
|
||||
}
|
||||
<li class="page-previous">
|
||||
@Html.ActionLink((string)previousText, (string)routeData["action"], (string)routeData["controller"], routeData, null)
|
||||
</li>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</span>
|
||||
<span class="user-actions">
|
||||
@Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl })
|
||||
@Html.ActionLink("Dashboard", "Index", new { Area = "Dashboard", Controller = "Admin" })
|
||||
@Html.ActionLink(T("Dashboard").ToString(), "Index", new { Area = "Dashboard", Controller = "Admin" })
|
||||
</span>
|
||||
} else {
|
||||
<span class="user-actions">@Html.ActionLink(T("Sign In").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = (Request.QueryString["ReturnUrl"] ?? Request.RawUrl) })</span>
|
||||
|
||||
52
src/Orchard.Web/Core/Title/Drivers/TitlePartDriver.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Title.Models;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.Title.Drivers {
|
||||
public class TitlePartDriver : ContentPartDriver<TitlePart> {
|
||||
|
||||
private const string TemplateName = "Parts.Title.TitlePart";
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override string Prefix {
|
||||
get { return "Title"; }
|
||||
}
|
||||
|
||||
protected override DriverResult Display(TitlePart part, string displayType, dynamic shapeHelper) {
|
||||
return Combined(
|
||||
ContentShape("Parts_Title",
|
||||
() => shapeHelper.Parts_Title(ContentPart: part, Title: part.Title)),
|
||||
ContentShape("Parts_Title_Summary",
|
||||
() => shapeHelper.Parts_Title_Summary(ContentPart: part, Title: part.Title)),
|
||||
ContentShape("Parts_Title_SummaryAdmin",
|
||||
() => shapeHelper.Parts_Title_SummaryAdmin(ContentPart: part, Title: part.Title))
|
||||
);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(TitlePart part, dynamic shapeHelper) {
|
||||
|
||||
return ContentShape("Parts_Title_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(TitlePart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
updater.TryUpdateModel(part, Prefix, null, null);
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(TitlePart part, ImportContentContext context) {
|
||||
var title = context.Attribute(part.PartDefinition.Name, "Title");
|
||||
if (title != null) {
|
||||
part.Title = title;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(TitlePart part, ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/Orchard.Web/Core/Title/Handlers/TitlePartHandler.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Title.Models;
|
||||
using Orchard.Data;
|
||||
|
||||
namespace Orchard.Core.Title.Handlers {
|
||||
public class TitlePartHandler : ContentHandler {
|
||||
|
||||
public TitlePartHandler(IRepository<TitlePartRecord> repository) {
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/Orchard.Web/Core/Title/Migrations.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.Title {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("TitlePartRecord",
|
||||
table => table
|
||||
.ContentPartVersionRecord()
|
||||
.Column<string>("Title", column => column.WithLength(1024))
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("TitlePart", builder => builder.Attachable());
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Orchard.Web/Core/Title/Models/TitlePart.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
|
||||
namespace Orchard.Core.Title.Models {
|
||||
public class TitlePart : ContentPart<TitlePartRecord>, ITitleAspect {
|
||||
[Required]
|
||||
public string Title {
|
||||
get { return Record.Title; }
|
||||
set { Record.Title = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/Orchard.Web/Core/Title/Models/TitlePartRecord.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Core.Title.Models {
|
||||
public class TitlePartRecord : ContentPartVersionRecord {
|
||||
[StringLength(1024)]
|
||||
public virtual string Title { get; set; }
|
||||
}
|
||||
}
|
||||
9
src/Orchard.Web/Core/Title/Module.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Name: Title
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The title module enables content items to have titles.
|
||||
FeatureDescription: Title content part.
|
||||
Category: Core
|
||||
15
src/Orchard.Web/Core/Title/Placement.info
Normal file
@@ -0,0 +1,15 @@
|
||||
<Placement>
|
||||
<!-- available display shapes -->
|
||||
<!--
|
||||
Parts_Title
|
||||
Parts_Title_Summary
|
||||
Parts_Title_SummaryAdmin
|
||||
-->
|
||||
<Place Parts_Title_Edit="Content:before.5"/>
|
||||
<Match DisplayType="Detail">
|
||||
<Place Parts_Title="Header:5"/>
|
||||
</Match>
|
||||
<Match DisplayType="Summary">
|
||||
<Place Parts_Title_Summary="Header:5"/>
|
||||
</Match>
|
||||
</Placement>
|
||||
@@ -0,0 +1,6 @@
|
||||
@model Orchard.Core.Title.Models.TitlePart
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.Title, T("Title"))
|
||||
@Html.TextBoxFor(m => m.Title, new { @class = "large text" })
|
||||
</fieldset>
|
||||
1
src/Orchard.Web/Core/Title/Views/Parts.Title.cshtml
Normal file
@@ -0,0 +1 @@
|
||||
<h1>@Model.Title</h1>
|
||||
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem;
|
||||
string title = Model.Title.ToString();
|
||||
}
|
||||
|
||||
<h1>@Html.ItemDisplayLink(title, contentItem)</h1>
|
||||
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem;
|
||||
string title = Model.Title.ToString();
|
||||
}
|
||||
|
||||
<h1>@Html.ItemEditLink(title, contentItem)</h1>
|
||||
41
src/Orchard.Web/Core/Title/Views/Web.config
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
</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=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -2,8 +2,8 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.2.41
|
||||
OrchardVersion: 1.2.41
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The XmlRpc module enables creation of contents from client applications such as LiveWriter.
|
||||
FeatureDescription: XML-RPC opt-in implementation.
|
||||
Category: Content Publishing
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Lucene.Models {
|
||||
}
|
||||
|
||||
public IDocumentIndex Add(string name, bool value) {
|
||||
return Add(name, value.ToString());
|
||||
return Add(name, value ? 1 : 0);
|
||||
}
|
||||
|
||||
public IDocumentIndex Add(string name, double value) {
|
||||
|
||||