Skip to content

Commit

Permalink
Refresh for Orchard 1.10.x
Browse files Browse the repository at this point in the history
  • Loading branch information
bleroy committed Jul 8, 2016
1 parent 980fa76 commit 9c27d3a
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
*.csproj.user
bin
obj
6 changes: 0 additions & 6 deletions .hgignore

This file was deleted.

8 changes: 7 additions & 1 deletion Filters/SplashScreenFilter.cs
Expand Up @@ -12,6 +12,12 @@
namespace Vandelay.Industries.Filters {
[OrchardFeature("Vandelay.SplashScreen")]
public class SplashScreenFilter : FilterProvider, IResultFilter {
private IWorkContextAccessor _workContextAccessor;

public SplashScreenFilter(IWorkContextAccessor workContextAccessor) {
_workContextAccessor = workContextAccessor;
}

public void OnResultExecuting(ResultExecutingContext filterContext) {
// Splash screen itself is not subject to filtering
var routeValues = filterContext.RouteData.Values;
Expand Down Expand Up @@ -45,7 +51,7 @@ public class SplashScreenFilter : FilterProvider, IResultFilter {
.Cookies[SplashScreenSettingsPart.CookieName];
// If cookie exists, the user has been here and has accepted the terms of use.
if (splashScreenCookie != null && !String.IsNullOrWhiteSpace(splashScreenCookie.Value)) return;
var config = filterContext.GetWorkContext().CurrentSite.As<SplashScreenSettingsPart>();
var config = _workContextAccessor.GetContext().CurrentSite.As<SplashScreenSettingsPart>();
if (config == null || !config.Enabled) return;

// If request is for an ignored URL, don't display a splash screen
Expand Down
19 changes: 9 additions & 10 deletions Vandelay.Industries.Test/ExtractLocalizedStringsTest.cs
Expand Up @@ -13,11 +13,11 @@ public class ExtractLocalizedStringsTest {
var what = T(""And another with C \""escapes\""."");
";
var strings = LocalizationManagementService.FindLocalizedStrings(code);
AssertHelper.AreEquivalent(new[] {
Assert.That(strings, Is.EquivalentTo(new[] {
"This is a string",
"This is \"\"another\"\" with weird \"\"\"\" quotes.\"\"",
"And another with C \\\"escapes\\\"."
}, strings);
}));
}

[Test]
Expand All @@ -29,11 +29,11 @@ public class ExtractLocalizedStringsTest {
var what = Something.Custom(""And another with C \""escapes\""."");
";
var strings = LocalizationManagementService.FindLocalizedStrings(code, "Something.Custom(");
AssertHelper.AreEquivalent(new[] {
Assert.That(strings, Is.EquivalentTo(new[] {
"This is a string",
"This is \"\"another\"\" with weird \"\"\"\" quotes.\"\"",
"And another with C \\\"escapes\\\"."
}, strings);
}));
}

[Test]
Expand All @@ -45,18 +45,18 @@ public class ExtractLocalizedStringsTest {
var what = T.Plural(""And another with C \""escapes\""."", ""...and its \""plural\"" form."", 44);
";
var strings = LocalizationManagementService.FindLocalizedStrings(code, "T.Plural(", true);
AssertHelper.AreEquivalent(new[] {
Assert.That(strings, Is.EquivalentTo(new[] {
"This is a string", "and its plural form",
"This is \"\"another\"\" with weird \"\"\"\" quotes.\"\"", "And its \"\"plural\"\" form.",
"And another with C \\\"escapes\\\".", "...and its \\\"plural\\\" form."
}, strings);
}));
}

[Test]
public void NoQuotesInT() {
const string code = @"ModelState.AddModelError(""_FORM"", T(ErrorCodeToString(/*createStatus*/MembershipCreateStatus.ProviderError)));";
var strings = LocalizationManagementService.FindLocalizedStrings(code);
AssertHelper.AreEquivalent(new string[0], strings);
Assert.That(strings, Is.EquivalentTo(new string[0]));
}

[Test]
Expand Down Expand Up @@ -143,16 +143,15 @@ public class UserMessagesAlteration : IMessageEventHandler {
}
}
";
AssertHelper.AreEquivalent(new[] {
Assert.That(LocalizationManagementService.FindLocalizedStrings(code), Is.EquivalentTo(new[] {
"New account",
"The user <b>{0}</b> with email <b>{1}</b> has requested a new account. This user won't be able to log while his account has not been approved.",
"Verification E-Mail",
"Thank you for registering with {0}.<br/><br/><br/><b>Final Step</b><br/>To verify that you own this e-mail address, please click the following link:<br/><a href=\\\"{1}\\\">{1}</a><br/><br/><b>Troubleshooting:</b><br/>If clicking on the link above does not work, try the following:<br/><br/>Select and copy the entire link.<br/>Open a browser window and paste the link in the address bar.<br/>Click <b>Go</b> or, on your keyboard, press <b>Enter</b> or <b>Return</b>.",
"<br/><br/>If you continue to have access problems or want to report other issues, please <a href=\\\"mailto:{0}\\\">Contact Us</a>.",
"Lost password",
"Dear {0}, please <a href=\\\"{1}\\\">click here</a> to change your password.",
},
LocalizationManagementService.FindLocalizedStrings(code));
}));
}
}
}
10 changes: 10 additions & 0 deletions Vandelay.Industries.Test/Stubs/StubWorkContextAccessor.cs
Expand Up @@ -95,6 +95,16 @@ public class StubSite : ContentPart, ISite {
public override void SetState<T>(string name, T value) {
_contextDictonary[name] = value;
}

public override object Resolve(Type serviceType)
{
throw new NotImplementedException();
}

public override bool TryResolve(Type serviceType, out object service)
{
throw new NotImplementedException();
}
}

public WorkContext GetContext(HttpContextBase httpContext) {
Expand Down
13 changes: 8 additions & 5 deletions Vandelay.Industries.Test/Vandelay.Industries.Test.csproj
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Vandelay.Industries.Test</RootNamespace>
<AssemblyName>Vandelay.Industries.Test</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand All @@ -34,8 +34,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\..\..\..\lib\nunit\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -47,10 +48,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssertHelperTest.cs" />
<Compile Include="ExtractLocalizedStringsTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AssertHelper.cs" />
<Compile Include="RelativeUrlHtmlFilterTest.cs" />
<Compile Include="Stubs\StubWorkContextAccessor.cs" />
</ItemGroup>
Expand All @@ -67,6 +66,10 @@
<Name>Vandelay.Industries</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</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.
Expand Down
23 changes: 23 additions & 0 deletions Vandelay.Industries.Test/app.config
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 4 additions & 0 deletions Vandelay.Industries.Test/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.2.0" targetFramework="net452" />
</packages>
70 changes: 47 additions & 23 deletions Vandelay.Industries.csproj
Expand Up @@ -12,7 +12,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Vandelay.Industries</RootNamespace>
<AssemblyName>Vandelay.Industries</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<FileUpgradeFlags>
</FileUpgradeFlags>
Expand All @@ -25,6 +25,7 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -48,45 +49,65 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Fluent.IO">
<HintPath>Libraries\Fluent.IO.dll</HintPath>
<Reference Include="Fluent.IO, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentPath.1.2.1\lib\net4\Fluent.IO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Fluent.Zip">
<HintPath>Libraries\Fluent.Zip.dll</HintPath>
<Reference Include="Fluent.Zip, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentPathZip.1.2.1\lib\net4\Fluent.Zip.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>Libraries\HtmlAgilityPack.dll</HintPath>
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\dotnetzip\Ionic.Zip.dll</HintPath>
<HintPath>..\..\..\packages\Unofficial.Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MarkdownSharp">
<HintPath>..\..\..\..\lib\markdown\MarkdownSharp.dll</HintPath>
<Reference Include="MarkdownSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetwebapi\System.Web.Http.dll</HintPath>
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="Ionic.Zip.xml" />
<Content Include="Scripts\admin-custom-sort.min.js.map">
<DependentUpon>admin-custom-sort.js</DependentUpon>
</Content>
Expand Down Expand Up @@ -119,7 +140,7 @@
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
<Project>{66FCCD76-2761-47E3-8D11-B45D0001DDAA}</Project>
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.MediaLibrary\Orchard.MediaLibrary.csproj">
Expand Down Expand Up @@ -249,6 +270,9 @@
<ItemGroup>
<Content Include="Scripts\Web.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
Expand Down

0 comments on commit 9c27d3a

Please sign in to comment.