mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 12:53:33 +08:00
Merge from dev branch
This commit is contained in:
10
.hgignore
Normal file
10
.hgignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
glob:bin
|
||||||
|
glob:obj
|
||||||
|
glob:App_Data
|
||||||
|
glob:_ReSharper*
|
||||||
|
glob:src/Orchard.suo
|
||||||
|
glob:*.user
|
||||||
|
glob:*.patch
|
||||||
|
glob:*.hg
|
||||||
|
glob:build
|
||||||
|
glob:*.sln.cache
|
24
ClickToBuild.cmd
Normal file
24
ClickToBuild.cmd
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
if "%WindowsSdkDir%" neq "" goto build
|
||||||
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" goto initialize2k8on64
|
||||||
|
if exist "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" goto initialize2k8
|
||||||
|
echo "Unable to detect suitable environment. Build may not succeed."
|
||||||
|
goto build
|
||||||
|
|
||||||
|
|
||||||
|
:initialize2k8
|
||||||
|
call "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
|
||||||
|
goto build
|
||||||
|
|
||||||
|
:initialize2k8on64
|
||||||
|
call "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
|
||||||
|
goto build
|
||||||
|
|
||||||
|
|
||||||
|
:build
|
||||||
|
call build
|
||||||
|
pause
|
||||||
|
goto end
|
||||||
|
|
||||||
|
|
||||||
|
:end
|
115
Orchard.proj
Normal file
115
Orchard.proj
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
|
<!-- Initialization -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<LibFolder>$(MSBuildProjectDirectory)\lib</LibFolder>
|
||||||
|
<SrcFolder>$(MSBuildProjectDirectory)\src</SrcFolder>
|
||||||
|
<BuildFolder>$(MSBuildProjectDirectory)\build</BuildFolder>
|
||||||
|
|
||||||
|
<CompileFolder>$(BuildFolder)\Compile</CompileFolder>
|
||||||
|
<WebSitesFolder>$(CompileFolder)\_PublishedWebsites</WebSitesFolder>
|
||||||
|
<StageFolder>$(BuildFolder)\Stage</StageFolder>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Import Project="$(LibFolder)\msbuild\MSBuild.Community.Tasks.Targets"/>
|
||||||
|
|
||||||
|
<!-- Coordinating Targets -->
|
||||||
|
|
||||||
|
<Target Name ="Build">
|
||||||
|
<CallTarget Targets="Clean"/>
|
||||||
|
<CallTarget Targets="Compile"/>
|
||||||
|
<CallTarget Targets="Test"/>
|
||||||
|
<CallTarget Targets="Package"/>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="Package">
|
||||||
|
<CallTarget Targets="Package-Stage"/>
|
||||||
|
<CallTarget Targets="Package-Zip"/>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Building -->
|
||||||
|
|
||||||
|
<Target Name="Clean">
|
||||||
|
<MSBuild Projects="$(SrcFolder)\Orchard.sln" Targets="Clean" />
|
||||||
|
<RemoveDir Directories="$(BuildFolder)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name ="Compile">
|
||||||
|
<MSBuild
|
||||||
|
Projects="$(SrcFolder)\Orchard.sln"
|
||||||
|
Targets="Build"
|
||||||
|
Properties="Configuration=Release;OutputPath=$(CompileFolder)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Testing -->
|
||||||
|
|
||||||
|
<Target Name ="Test">
|
||||||
|
<Exec Command="$(LibFolder)\nunit\nunit-console-x86.exe /xml=$(BuildFolder)\Orchard.Tests.xml $(CompileFolder)\Orchard.Core.Tests.dll $(CompileFolder)\Orchard.Tests.dll $(CompileFolder)\Orchard.Tests.Modules.dll $(CompileFolder)\Orchard.Web.Tests.dll $(CompileFolder)\MSBuild.Orchard.Tasks.Tests.dll" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Packaging -->
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(CompileFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.StageProjectAlteration" />
|
||||||
|
|
||||||
|
<Target Name="Package-Stage">
|
||||||
|
<ItemGroup>
|
||||||
|
<Stage-Bin-Exclude Include="$(WebSitesFolder)\**\bin\**\*" />
|
||||||
|
|
||||||
|
<Stage-Web Include="$(WebSitesFolder)\Orchard.Web\**\*;$(SrcFolder)\Orchard.Web\*.csproj" />
|
||||||
|
<Stage-Core Include="$(WebSitesFolder)\Orchard.Core\**\*" Exclude="@(Stage-Bin-Exclude)" />
|
||||||
|
<Stage-Modules Include="$(WebSitesFolder)\**\*" Exclude="@(Stage-Web);@(Stage-Core);@(Stage-Bin-Exclude)" />
|
||||||
|
<Stage-License Include="$(MSBuildProjectDirectory)\*.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Copy SourceFiles="@(Stage-Web);@(Stage-License)" DestinationFolder="$(StageFolder)\%(RecursiveDir)" />
|
||||||
|
<Copy SourceFiles="@(Stage-Core)" DestinationFolder="$(StageFolder)\Core\%(RecursiveDir)" />
|
||||||
|
<Copy SourceFiles="@(Stage-Modules)" DestinationFolder="$(StageFolder)\Modules\%(RecursiveDir)" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- extra processing of the staged csproj file -->
|
||||||
|
<StageProjectAlteration ProjectFileName="$(StageFolder)\Orchard.Web.csproj" AddContentFiles="
|
||||||
|
@(Stage-Modules->'Modules\%(RecursiveDir)%(Filename)%(Extension)');
|
||||||
|
@(Stage-Core->'Core\%(RecursiveDir)%(Filename)%(Extension)')">
|
||||||
|
<Output TaskParameter="ExtraFiles" ItemName="StageProjectAlteration-ExtraFiles"/>
|
||||||
|
</StageProjectAlteration>
|
||||||
|
|
||||||
|
<!-- move over extra non-content files the csproj referenced -->
|
||||||
|
<Copy SourceFiles="@(StageProjectAlteration-ExtraFiles->'$(SrcFolder)\Orchard.Web\%(Identity)')"
|
||||||
|
DestinationFolder="$(StageFolder)\%(RecursiveDir)"/>
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="Package-Zip">
|
||||||
|
<ItemGroup>
|
||||||
|
<Zip-Exclude Include="
|
||||||
|
$(MSBuildProjectDirectory)\src\**\bin\**\*;
|
||||||
|
$(MSBuildProjectDirectory)\src\**\obj\**\*;
|
||||||
|
$(MSBuildProjectDirectory)\**\App_Data\**\*;
|
||||||
|
$(MSBuildProjectDirectory)\**\_ReSharper*\**\*;
|
||||||
|
$(MSBuildProjectDirectory)\**\*.sln.cache;
|
||||||
|
$(MSBuildProjectDirectory)\**\*.suo;
|
||||||
|
$(MSBuildProjectDirectory)\**\*.user;
|
||||||
|
$(MSBuildProjectDirectory)\**\*.patch;
|
||||||
|
$(MSBuildProjectDirectory)\**\*.hg;
|
||||||
|
" />
|
||||||
|
|
||||||
|
<Zip-Stage Include="$(StageFolder)\**\*" />
|
||||||
|
|
||||||
|
<Zip-Source Include="
|
||||||
|
$(MSBuildProjectDirectory)\lib\**\*;
|
||||||
|
$(MSBuildProjectDirectory)\src\**\*;
|
||||||
|
$(MSBuildProjectDirectory)\*.txt;
|
||||||
|
" Exclude="@(Zip-Exclude)" />
|
||||||
|
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Zip Files="@(Zip-Stage)" WorkingDirectory="$(StageFolder)" ZipFileName="$(BuildFolder)\Orchard.Web.zip" />
|
||||||
|
<Zip Files="@(Zip-Source)" WorkingDirectory="$(MSBuildProjectDirectory)" ZipFileName="$(BuildFolder)\Orchard.Source.zip" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
BIN
lib/msbuild/ICSharpCode.SharpZipLib.dll
Normal file
BIN
lib/msbuild/ICSharpCode.SharpZipLib.dll
Normal file
Binary file not shown.
116
lib/msbuild/MSBuild.Community.Tasks.Targets
Normal file
116
lib/msbuild/MSBuild.Community.Tasks.Targets
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<!-- $Id: MSBuild.Community.Tasks.Targets 368 2007-11-22 18:22:00Z pcpatel $ -->
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<!--<MSBuildCommunityTasksPath Condition="'$(MSBuildCommunityTasksPath)' == ''">$(MSBuildExtensionsPath)\MSBuildCommunityTasks</MSBuildCommunityTasksPath>-->
|
||||||
|
<MSBuildCommunityTasksPath>.</MSBuildCommunityTasksPath>
|
||||||
|
<MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.AspNet.InstallAspNet" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.AssemblyInfo" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Attrib" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SqlExecute" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FileUpdate" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FtpUpload" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FxCop" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.GacUtil" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.GetSolutionProjects" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ILMerge" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Mail" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Move" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Ftp.FtpCreateRemoteDirectory" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Ftp.FtpDirectoryExists" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Ftp.FtpUploadDirectoryContent" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Add" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Divide" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Modulo" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Multiple" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Subtract" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.NDoc" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.NUnit" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Oracle.AddTnsName" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Prompt" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RegistryRead" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RegistryWrite" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RegexMatch" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RegexReplace" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RoboCopy" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Script" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ServiceController" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ServiceQuery" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Sleep" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.AppPoolController" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.AppPoolCreate" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.AppPoolDelete" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.WebDirectoryCreate" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.WebDirectoryDelete" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.WebDirectoryScriptMap" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.IIS.WebDirectorySetting" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Install.InstallAssembly" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Install.UninstallAssembly" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Schema.TaskSchema" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SqlServer.ExecuteDDL" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssAdd" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssCheckin" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssCheckout" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssClean" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssDiff" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssGet" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssHistory" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssLabel" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssUndoCheckout" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnCheckout" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnClient" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnCopy" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnCommit" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnExport" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnInfo" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnUpdate" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnVersion" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Tfs.TfsVersion" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.TemplateFile" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Time" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Unzip" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Version" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.WebDownload" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Xml.XmlMassUpdate" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Xml.XmlQuery" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.XmlRead" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.XmlUpdate" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Xslt" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Zip" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.JavaScript.JSCompress" />
|
||||||
|
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.User" />
|
||||||
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Computer" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<FxCopRuleAssemblies Include="UsageRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="SecurityRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="PortabilityRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="PerformanceRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="MobilityRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="InteroperabilityRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="GlobalizationRules.dll"/>
|
||||||
|
<FxCopRuleAssemblies Include="DesignRules.dll"/>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
BIN
lib/msbuild/MSBuild.Community.Tasks.dll
Normal file
BIN
lib/msbuild/MSBuild.Community.Tasks.dll
Normal file
Binary file not shown.
@@ -84,6 +84,7 @@
|
|||||||
<PredefinedRule Inspect="False" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
|
<PredefinedRule Inspect="False" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
|
||||||
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
|
||||||
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
|
||||||
|
<Abbreviation Text="SQ" />
|
||||||
</Naming2>
|
</Naming2>
|
||||||
</CodeStyleSettings>
|
</CodeStyleSettings>
|
||||||
</Configuration>
|
</Configuration>
|
@@ -14,7 +14,7 @@ using Orchard.ContentManagement;
|
|||||||
using Orchard.ContentManagement.Handlers;
|
using Orchard.ContentManagement.Handlers;
|
||||||
using Orchard.ContentManagement.Records;
|
using Orchard.ContentManagement.Records;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.Tests.Packages;
|
using Orchard.Tests.Modules;
|
||||||
|
|
||||||
namespace Orchard.Core.Tests.Common.Providers {
|
namespace Orchard.Core.Tests.Common.Providers {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
@@ -10,7 +10,7 @@ using Orchard.ContentManagement.Records;
|
|||||||
using Orchard.Core.Common.Models;
|
using Orchard.Core.Common.Models;
|
||||||
using Orchard.Core.Common.Records;
|
using Orchard.Core.Common.Records;
|
||||||
using Orchard.Core.Common.Services;
|
using Orchard.Core.Common.Services;
|
||||||
using Orchard.Tests.Packages;
|
using Orchard.Tests.Modules;
|
||||||
|
|
||||||
namespace Orchard.Core.Tests.Common.Services {
|
namespace Orchard.Core.Tests.Common.Services {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
@@ -19,7 +19,7 @@ using Orchard.Core.Feeds.Models;
|
|||||||
using Orchard.Core.Feeds.Rss;
|
using Orchard.Core.Feeds.Rss;
|
||||||
using Orchard.Core.Feeds.StandardBuilders;
|
using Orchard.Core.Feeds.StandardBuilders;
|
||||||
using Orchard.Mvc.Results;
|
using Orchard.Mvc.Results;
|
||||||
using Orchard.Tests.Packages;
|
using Orchard.Tests.Modules;
|
||||||
using Orchard.Tests.Stubs;
|
using Orchard.Tests.Stubs;
|
||||||
|
|
||||||
namespace Orchard.Core.Tests.Feeds.Controllers {
|
namespace Orchard.Core.Tests.Feeds.Controllers {
|
||||||
|
@@ -85,9 +85,9 @@
|
|||||||
<Compile Include="Scheduling\ScheduledTaskExecutorTests.cs" />
|
<Compile Include="Scheduling\ScheduledTaskExecutorTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Orchard.Tests.Packages\Orchard.Tests.Packages.csproj">
|
<ProjectReference Include="..\Orchard.Tests.Modules\Orchard.Tests.Modules.csproj">
|
||||||
<Project>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</Project>
|
<Project>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</Project>
|
||||||
<Name>Orchard.Tests.Packages</Name>
|
<Name>Orchard.Tests.Modules</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Orchard.Tests\Orchard.Tests.csproj">
|
<ProjectReference Include="..\Orchard.Tests\Orchard.Tests.csproj">
|
||||||
<Project>{ABC826D4-2FA1-4F2F-87DE-E6095F653810}</Project>
|
<Project>{ABC826D4-2FA1-4F2F-87DE-E6095F653810}</Project>
|
||||||
|
@@ -10,7 +10,7 @@ using Orchard.Core.Scheduling.Services;
|
|||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.Tasks;
|
using Orchard.Tasks;
|
||||||
using Orchard.Tasks.Scheduling;
|
using Orchard.Tasks.Scheduling;
|
||||||
using Orchard.Tests.Packages;
|
using Orchard.Tests.Modules;
|
||||||
|
|
||||||
namespace Orchard.Core.Tests.Scheduling {
|
namespace Orchard.Core.Tests.Scheduling {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
@@ -11,7 +11,7 @@ using Orchard.Core.Scheduling.Services;
|
|||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.Tasks;
|
using Orchard.Tasks;
|
||||||
using Orchard.Tasks.Scheduling;
|
using Orchard.Tasks.Scheduling;
|
||||||
using Orchard.Tests.Packages;
|
using Orchard.Tests.Modules;
|
||||||
|
|
||||||
namespace Orchard.Core.Tests.Scheduling {
|
namespace Orchard.Core.Tests.Scheduling {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
@@ -12,7 +12,7 @@ using Orchard.Services;
|
|||||||
using Orchard.Tests.Data;
|
using Orchard.Tests.Data;
|
||||||
using Orchard.Tests.Stubs;
|
using Orchard.Tests.Stubs;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages {
|
namespace Orchard.Tests.Modules {
|
||||||
public abstract class DatabaseEnabledTestsBase {
|
public abstract class DatabaseEnabledTestsBase {
|
||||||
|
|
||||||
protected IContainer _container;
|
protected IContainer _container;
|
@@ -8,8 +8,8 @@
|
|||||||
<ProjectGuid>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</ProjectGuid>
|
<ProjectGuid>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Orchard.Tests.Packages</RootNamespace>
|
<RootNamespace>Orchard.Tests.Modules</RootNamespace>
|
||||||
<AssemblyName>Orchard.Tests.Packages</AssemblyName>
|
<AssemblyName>Orchard.Tests.Modules</AssemblyName>
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -105,15 +105,15 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Orchard.Web\Packages\Orchard.Pages\Orchard.Pages.csproj">
|
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Pages\Orchard.Pages.csproj">
|
||||||
<Project>{4A9C04A6-0986-4A92-A610-5F59FF273FB9}</Project>
|
<Project>{4A9C04A6-0986-4A92-A610-5F59FF273FB9}</Project>
|
||||||
<Name>Orchard.Pages</Name>
|
<Name>Orchard.Pages</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Orchard.Web\Packages\Orchard.Roles\Orchard.Roles.csproj">
|
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Roles\Orchard.Roles.csproj">
|
||||||
<Project>{D10AD48F-407D-4DB5-A328-173EC7CB010F}</Project>
|
<Project>{D10AD48F-407D-4DB5-A328-173EC7CB010F}</Project>
|
||||||
<Name>Orchard.Roles</Name>
|
<Name>Orchard.Roles</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Orchard.Web\Packages\Orchard.Users\Orchard.Users.csproj">
|
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Users\Orchard.Users.csproj">
|
||||||
<Project>{79AED36E-ABD0-4747-93D3-8722B042454B}</Project>
|
<Project>{79AED36E-ABD0-4747-93D3-8722B042454B}</Project>
|
||||||
<Name>Orchard.Users</Name>
|
<Name>Orchard.Users</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Orchard.Tests.Packages")]
|
[assembly: AssemblyTitle("Orchard.Tests.Modules")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyProduct("Orchard")]
|
[assembly: AssemblyProduct("Orchard")]
|
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.Roles.Controllers {
|
namespace Orchard.Tests.Modules.Roles.Controllers {
|
||||||
class AdminControllerTests {
|
class AdminControllerTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -6,7 +6,7 @@ using NUnit.Framework;
|
|||||||
using Orchard.Roles.Records;
|
using Orchard.Roles.Records;
|
||||||
using Orchard.Roles.Services;
|
using Orchard.Roles.Services;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.Roles.Services {
|
namespace Orchard.Tests.Modules.Roles.Services {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class RoleServiceTests : DatabaseEnabledTestsBase{
|
public class RoleServiceTests : DatabaseEnabledTestsBase{
|
||||||
public override void Register(ContainerBuilder builder) {
|
public override void Register(ContainerBuilder builder) {
|
@@ -22,7 +22,7 @@ using Orchard.Users.Models;
|
|||||||
using Orchard.Users.Services;
|
using Orchard.Users.Services;
|
||||||
using Orchard.Users.ViewModels;
|
using Orchard.Users.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.Users.Controllers {
|
namespace Orchard.Tests.Modules.Users.Controllers {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AdminControllerTests : DatabaseEnabledTestsBase {
|
public class AdminControllerTests : DatabaseEnabledTestsBase {
|
||||||
private AdminController _controller;
|
private AdminController _controller;
|
@@ -16,7 +16,7 @@ using Orchard.Security;
|
|||||||
using Orchard.Users.Models;
|
using Orchard.Users.Models;
|
||||||
using Orchard.Users.Services;
|
using Orchard.Users.Services;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.Users.Services {
|
namespace Orchard.Tests.Modules.Users.Services {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class MembershipServiceTests {
|
public class MembershipServiceTests {
|
||||||
private IMembershipService _membershipService;
|
private IMembershipService _membershipService;
|
@@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages {
|
namespace Orchard.Tests.Modules {
|
||||||
public static class Values {
|
public static class Values {
|
||||||
public static IValueProvider From<T>(T obj) {
|
public static IValueProvider From<T>(T obj) {
|
||||||
if (obj is IDictionary<string,string>) {
|
if (obj is IDictionary<string,string>) {
|
@@ -7,7 +7,7 @@ using Orchard.Core.XmlRpc.Controllers;
|
|||||||
using Orchard.Core.XmlRpc.Models;
|
using Orchard.Core.XmlRpc.Models;
|
||||||
using Orchard.Core.XmlRpc.Services;
|
using Orchard.Core.XmlRpc.Services;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.XmlRpc.Controllers {
|
namespace Orchard.Tests.Modules.XmlRpc.Controllers {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class HomeControllerTests {
|
public class HomeControllerTests {
|
||||||
[Test]
|
[Test]
|
@@ -4,7 +4,7 @@ using NUnit.Framework;
|
|||||||
using Orchard.Core.XmlRpc.Models;
|
using Orchard.Core.XmlRpc.Models;
|
||||||
using Orchard.Core.XmlRpc.Services;
|
using Orchard.Core.XmlRpc.Services;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.XmlRpc.Services {
|
namespace Orchard.Tests.Modules.XmlRpc.Services {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class XmlRpcReaderTests {
|
public class XmlRpcReaderTests {
|
||||||
private IMapper<XElement, XRpcMethodCall> _methodCallMapper;
|
private IMapper<XElement, XRpcMethodCall> _methodCallMapper;
|
@@ -3,7 +3,7 @@ using NUnit.Framework;
|
|||||||
using Orchard.Core.XmlRpc.Models;
|
using Orchard.Core.XmlRpc.Models;
|
||||||
using Orchard.Core.XmlRpc.Services;
|
using Orchard.Core.XmlRpc.Services;
|
||||||
|
|
||||||
namespace Orchard.Tests.Packages.XmlRpc.Services {
|
namespace Orchard.Tests.Modules.XmlRpc.Services {
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class XmlRpcWriterTests {
|
public class XmlRpcWriterTests {
|
||||||
[Test]
|
[Test]
|
@@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Orchard.Data.Migrations;
|
||||||
|
using Orchard.Environment;
|
||||||
|
using Orchard.Tests.Records;
|
||||||
|
|
||||||
|
namespace Orchard.Tests.Data.Migrations {
|
||||||
|
[TestFixture]
|
||||||
|
public class DatabaseMigrationManagerTests {
|
||||||
|
private string _tempDataFolder;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Init() {
|
||||||
|
var tempFilePath = Path.GetTempFileName();
|
||||||
|
File.Delete(tempFilePath);
|
||||||
|
Directory.CreateDirectory(tempFilePath);
|
||||||
|
_tempDataFolder = tempFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDown]
|
||||||
|
public void Term() {
|
||||||
|
try { Directory.Delete(_tempDataFolder, true); }
|
||||||
|
catch (IOException) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CreateSqlServerDatabase(string databasePath) {
|
||||||
|
var databaseName = Path.GetFileNameWithoutExtension(databasePath);
|
||||||
|
using (var connection = new SqlConnection(
|
||||||
|
"Data Source=.\\SQLEXPRESS;Initial Catalog=tempdb;Integrated Security=true;User Instance=True;")) {
|
||||||
|
connection.Open();
|
||||||
|
using (var command = connection.CreateCommand()) {
|
||||||
|
command.CommandText =
|
||||||
|
"CREATE DATABASE " + databaseName +
|
||||||
|
" ON PRIMARY (NAME=" + databaseName +
|
||||||
|
", FILENAME='" + databasePath.Replace("'", "''") + "')";
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.CommandText =
|
||||||
|
"EXEC sp_detach_db '" + databaseName + "', 'true'";
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MigrationManagerShouldCreateEmptySQLiteDatabaseAtGivenLocation() {
|
||||||
|
var manager = (IDatabaseMigrationManager)new DatabaseMigrationManager();
|
||||||
|
var coordinator = manager.CreateCoordinator("SQLite", _tempDataFolder, "");
|
||||||
|
|
||||||
|
coordinator.CreateDatabase();
|
||||||
|
|
||||||
|
Assert.That(File.Exists(Path.Combine(_tempDataFolder, "Orchard.db")), Is.True);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, ExpectedException(typeof(NotImplementedException))]
|
||||||
|
public void MigrationManagerShouldNotImplementTheCreationOfSqlServer() {
|
||||||
|
var manager = (IDatabaseMigrationManager)new DatabaseMigrationManager();
|
||||||
|
var coordinator = manager.CreateCoordinator("SqlServer", _tempDataFolder, "");
|
||||||
|
|
||||||
|
coordinator.CreateDatabase();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CanConnectShouldBeFalseWhenSqlServerIsInvalid() {
|
||||||
|
var manager = (IDatabaseMigrationManager)new DatabaseMigrationManager();
|
||||||
|
var coordinator = manager.CreateCoordinator("SqlServer", _tempDataFolder, "Data Source=.\\SQLEXPRESS;Initial Catalog=Hello");
|
||||||
|
Assert.That(coordinator.CanConnect(), Is.False);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CanConnectShouldBeTrueWhenValidSqlServerMdfIsTargetted() {
|
||||||
|
var databasePath = Path.Combine(_tempDataFolder, "Orchard.mdf");
|
||||||
|
CreateSqlServerDatabase(databasePath);
|
||||||
|
|
||||||
|
var manager = (IDatabaseMigrationManager)new DatabaseMigrationManager();
|
||||||
|
var coordinator = manager.CreateCoordinator("SqlServer", _tempDataFolder, "Data Source=.\\SQLEXPRESS;AttachDbFileName=" + databasePath + ";Integrated Security=True;User Instance=True;");
|
||||||
|
Assert.That(coordinator.CanConnect(), Is.True);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SQLiteSchemaShouldBeGeneratedAndUsable() {
|
||||||
|
var manager = (IDatabaseMigrationManager) new DatabaseMigrationManager();
|
||||||
|
var coordinator = manager.CreateCoordinator("SQLite", _tempDataFolder, "");
|
||||||
|
|
||||||
|
var recordDescriptors = new[] {
|
||||||
|
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)}
|
||||||
|
};
|
||||||
|
|
||||||
|
coordinator.UpdateSchema(recordDescriptors);
|
||||||
|
|
||||||
|
var sessionFactory = coordinator.BuildSessionFactory(recordDescriptors);
|
||||||
|
|
||||||
|
var session = sessionFactory.OpenSession();
|
||||||
|
var foo = new Foo {Name = "hi there"};
|
||||||
|
session.Save(foo);
|
||||||
|
session.Flush();
|
||||||
|
session.Close();
|
||||||
|
|
||||||
|
Assert.That(foo, Is.Not.EqualTo(0));
|
||||||
|
|
||||||
|
sessionFactory.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SqlServerSchemaShouldBeGeneratedAndUsable() {
|
||||||
|
var databasePath = Path.Combine(_tempDataFolder, "Orchard.mdf");
|
||||||
|
CreateSqlServerDatabase(databasePath);
|
||||||
|
|
||||||
|
var manager = (IDatabaseMigrationManager)new DatabaseMigrationManager();
|
||||||
|
var coordinator = manager.CreateCoordinator("SqlServer", _tempDataFolder, "Data Source=.\\SQLEXPRESS;AttachDbFileName=" + databasePath + ";Integrated Security=True;User Instance=True;");
|
||||||
|
|
||||||
|
var recordDescriptors = new[] {
|
||||||
|
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)}
|
||||||
|
};
|
||||||
|
|
||||||
|
coordinator.UpdateSchema(recordDescriptors);
|
||||||
|
|
||||||
|
var sessionFactory = coordinator.BuildSessionFactory(recordDescriptors);
|
||||||
|
|
||||||
|
var session = sessionFactory.OpenSession();
|
||||||
|
var foo = new Foo { Name = "hi there" };
|
||||||
|
session.Save(foo);
|
||||||
|
session.Flush();
|
||||||
|
session.Close();
|
||||||
|
|
||||||
|
Assert.That(foo, Is.Not.EqualTo(0));
|
||||||
|
|
||||||
|
sessionFactory.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
@@ -11,6 +10,7 @@ using Autofac.Modules;
|
|||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Orchard.Environment;
|
using Orchard.Environment;
|
||||||
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Mvc;
|
using Orchard.Mvc;
|
||||||
using Orchard.Mvc.ModelBinders;
|
using Orchard.Mvc.ModelBinders;
|
||||||
using Orchard.Mvc.Routes;
|
using Orchard.Mvc.Routes;
|
||||||
@@ -46,9 +46,23 @@ namespace Orchard.Tests.Environment {
|
|||||||
builder.Register(new ViewEngineCollection { new WebFormViewEngine() });
|
builder.Register(new ViewEngineCollection { new WebFormViewEngine() });
|
||||||
builder.Register(new StuExtensionManager()).As<IExtensionManager>();
|
builder.Register(new StuExtensionManager()).As<IExtensionManager>();
|
||||||
builder.Register(new Mock<IHackInstallationGenerator>().Object);
|
builder.Register(new Mock<IHackInstallationGenerator>().Object);
|
||||||
|
builder.Register(new StubShellSettingsLoader()).As<IShellSettingsLoader>();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class StubShellSettingsLoader : IShellSettingsLoader {
|
||||||
|
private readonly List<IShellSettings> _shellSettings = new List<IShellSettings>
|
||||||
|
{new ShellSettings {Name = "testing"}};
|
||||||
|
|
||||||
|
public IEnumerable<IShellSettings> LoadSettings() {
|
||||||
|
return _shellSettings.AsEnumerable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSettings(IShellSettings settings) {
|
||||||
|
_shellSettings.Add(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class StuExtensionManager : IExtensionManager {
|
public class StuExtensionManager : IExtensionManager {
|
||||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||||
return Enumerable.Empty<ExtensionDescriptor>();
|
return Enumerable.Empty<ExtensionDescriptor>();
|
||||||
@@ -96,7 +110,7 @@ namespace Orchard.Tests.Environment {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DifferentShellInstanceShouldBeReturnedAfterEachCreate() {
|
public void DifferentShellInstanceShouldBeReturnedAfterEachCreate() {
|
||||||
var host = _container.Resolve<IOrchardHost>();
|
var host = (DefaultOrchardHost)_container.Resolve<IOrchardHost>();
|
||||||
var runtime1 = host.CreateShell();
|
var runtime1 = host.CreateShell();
|
||||||
var runtime2 = host.CreateShell();
|
var runtime2 = host.CreateShell();
|
||||||
Assert.That(runtime1, Is.Not.SameAs(runtime2));
|
Assert.That(runtime1, Is.Not.SameAs(runtime2));
|
||||||
|
@@ -37,7 +37,6 @@ namespace Orchard.Tests.Environment {
|
|||||||
new[] { modelBinderProvider1, modelBinderProvider2 },
|
new[] { modelBinderProvider1, modelBinderProvider2 },
|
||||||
modelBinderPublisher,
|
modelBinderPublisher,
|
||||||
new ViewEngineCollection { new WebFormViewEngine() },
|
new ViewEngineCollection { new WebFormViewEngine() },
|
||||||
new Moq.Mock<IExtensionManager>().Object,
|
|
||||||
Enumerable.Empty<IOrchardShellEvents>());
|
Enumerable.Empty<IOrchardShellEvents>());
|
||||||
|
|
||||||
runtime.Activate();
|
runtime.Activate();
|
||||||
|
@@ -0,0 +1,45 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using System.Web.Routing;
|
||||||
|
using Autofac;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Orchard.Environment;
|
||||||
|
using Orchard.Environment.ShellBuilders;
|
||||||
|
using Orchard.Mvc.Filters;
|
||||||
|
using Orchard.Mvc.ViewEngines;
|
||||||
|
|
||||||
|
namespace Orchard.Tests.Environment.ShellBuilders {
|
||||||
|
[TestFixture]
|
||||||
|
public class SetupShellContainerFactoryTests {
|
||||||
|
private IContainer _hostContainer;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Init() {
|
||||||
|
_hostContainer = OrchardStarter.CreateHostContainer(builder => {
|
||||||
|
builder.Register(new ViewEngineCollection());
|
||||||
|
builder.Register(new RouteCollection());
|
||||||
|
builder.Register(new ModelBinderDictionary());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FactoryShouldCreateContainerThatProvidesShell() {
|
||||||
|
|
||||||
|
var factory = new SafeModeShellContainerFactory(_hostContainer);
|
||||||
|
var shellContainer = factory.CreateContainer(null);
|
||||||
|
Assert.That(shellContainer, Is.Not.Null);
|
||||||
|
var shell = shellContainer.Resolve<IOrchardShell>();
|
||||||
|
Assert.That(shell, Is.Not.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ShellContainerShouldProvideLayoutViewEngine() {
|
||||||
|
var factory = new SafeModeShellContainerFactory(_hostContainer);
|
||||||
|
var shellContainer = factory.CreateContainer(null);
|
||||||
|
var viewEngineFilter = shellContainer.Resolve<IEnumerable<IFilterProvider>>()
|
||||||
|
.Single(f=>f is ViewEngineFilter);
|
||||||
|
Assert.That(viewEngineFilter, Is.Not.Null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -48,8 +48,8 @@ namespace Orchard.Tests.Extensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void NamesFromFoldersWithPackageTxtShouldBeListed() {
|
public void NamesFromFoldersWithModuleTxtShouldBeListed() {
|
||||||
var folders = new PackageFolders(new[] { _tempFolderName });
|
var folders = new ModuleFolders(new[] { _tempFolderName });
|
||||||
var names = folders.ListNames();
|
var names = folders.ListNames();
|
||||||
Assert.That(names.Count(), Is.EqualTo(2));
|
Assert.That(names.Count(), Is.EqualTo(2));
|
||||||
Assert.That(names, Has.Some.EqualTo("Sample1"));
|
Assert.That(names, Has.Some.EqualTo("Sample1"));
|
||||||
@@ -57,8 +57,8 @@ namespace Orchard.Tests.Extensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackageTxtShouldBeParsedAndReturnedAsYamlDocument() {
|
public void ModuleTxtShouldBeParsedAndReturnedAsYamlDocument() {
|
||||||
var folders = new PackageFolders(new[] { _tempFolderName });
|
var folders = new ModuleFolders(new[] { _tempFolderName });
|
||||||
var sample1 = folders.ParseManifest("Sample1");
|
var sample1 = folders.ParseManifest("Sample1");
|
||||||
var mapping = (Mapping)sample1.YamlDocument.Root;
|
var mapping = (Mapping)sample1.YamlDocument.Root;
|
||||||
var entities = mapping.Entities
|
var entities = mapping.Entities
|
||||||
|
@@ -135,12 +135,14 @@
|
|||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="DataUtility.cs" />
|
<Compile Include="DataUtility.cs" />
|
||||||
|
<Compile Include="Data\Migrations\DatabaseMigrationManagerTests.cs" />
|
||||||
<Compile Include="Data\RepositoryTests.cs" />
|
<Compile Include="Data\RepositoryTests.cs" />
|
||||||
<Compile Include="Data\StubLocator.cs" />
|
<Compile Include="Data\StubLocator.cs" />
|
||||||
<Compile Include="Environment\DefaultCompositionStrategyTests.cs" />
|
<Compile Include="Environment\DefaultCompositionStrategyTests.cs" />
|
||||||
<Compile Include="Environment\DefaultOrchardHostTests.cs" />
|
<Compile Include="Environment\DefaultOrchardHostTests.cs" />
|
||||||
<Compile Include="Environment\DefaultOrchardShellTests.cs" />
|
<Compile Include="Environment\DefaultOrchardShellTests.cs" />
|
||||||
<Compile Include="Environment\OrchardStarterTests.cs" />
|
<Compile Include="Environment\OrchardStarterTests.cs" />
|
||||||
|
<Compile Include="Environment\ShellBuilders\SetupShellContainerFactoryTests.cs" />
|
||||||
<Compile Include="Environment\TestDependencies\TestDependency.cs" />
|
<Compile Include="Environment\TestDependencies\TestDependency.cs" />
|
||||||
<Compile Include="EventsTests.cs" />
|
<Compile Include="EventsTests.cs" />
|
||||||
<Compile Include="Extensions\ExtensionFoldersTests.cs" />
|
<Compile Include="Extensions\ExtensionFoldersTests.cs" />
|
||||||
@@ -182,9 +184,9 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Extensions\FoldersData\Sample1\Package.txt" />
|
<EmbeddedResource Include="Extensions\FoldersData\Sample1\Module.txt" />
|
||||||
<EmbeddedResource Include="Extensions\FoldersData\Sample2\Two.txt" />
|
<EmbeddedResource Include="Extensions\FoldersData\Sample2\Two.txt" />
|
||||||
<EmbeddedResource Include="Extensions\FoldersData\Sample3\Package.txt" />
|
<EmbeddedResource Include="Extensions\FoldersData\Sample3\Module.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
@@ -6,7 +6,7 @@ namespace Orchard.Core.Common {
|
|||||||
public class Permissions : IPermissionProvider {
|
public class Permissions : IPermissionProvider {
|
||||||
public static readonly Permission ChangeOwner = new Permission { Name = "ChangeOwner", Description = "Change the owner of content items" };
|
public static readonly Permission ChangeOwner = new Permission { Name = "ChangeOwner", Description = "Change the owner of content items" };
|
||||||
|
|
||||||
public string PackageName {
|
public string ModuleName {
|
||||||
get { return "Common"; }
|
get { return "Common"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
src/Orchard.Web/Core/Navigation/AdminMenu.cs
Normal file
13
src/Orchard.Web/Core/Navigation/AdminMenu.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation {
|
||||||
|
public class AdminMenu : INavigationProvider {
|
||||||
|
public string MenuName { get { return "admin"; } }
|
||||||
|
|
||||||
|
public void GetNavigation(NavigationBuilder builder) {
|
||||||
|
builder.Add("Navigation", "12",
|
||||||
|
menu => menu
|
||||||
|
.Add("Manage Main Menu", "2.0", item => item.Action("Index", "Admin", new { area = "Navigation" }).Permission(Permissions.ManageMainMenu)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Core.Navigation.ViewModels;
|
||||||
|
using Orchard.Localization;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Controllers {
|
||||||
|
[ValidateInput(false)]
|
||||||
|
public class AdminController : Controller {
|
||||||
|
public IOrchardServices Services { get; private set; }
|
||||||
|
|
||||||
|
public AdminController(IOrchardServices services) {
|
||||||
|
Services = services;
|
||||||
|
T = NullLocalizer.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
|
public ActionResult Index() {
|
||||||
|
return View(new NavigationIndexViewModel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
src/Orchard.Web/Core/Navigation/Models/MenuItem.cs
Normal file
15
src/Orchard.Web/Core/Navigation/Models/MenuItem.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Core.Navigation.Records;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Models {
|
||||||
|
public class MenuItem : ContentPart<MenuItemRecord> {
|
||||||
|
[HiddenInput(DisplayValue = false)]
|
||||||
|
public int Id { get { return ContentItem.Id; } }
|
||||||
|
|
||||||
|
public string Url {
|
||||||
|
get { return Record.Url; }
|
||||||
|
set { Record.Url = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
src/Orchard.Web/Core/Navigation/Models/MenuItemDriver.cs
Normal file
29
src/Orchard.Web/Core/Navigation/Models/MenuItemDriver.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.ContentManagement.Drivers;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Models {
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class MenuItemDriver : ContentItemDriver<MenuItem> {
|
||||||
|
private readonly IOrchardServices _orchardServices;
|
||||||
|
|
||||||
|
public readonly static ContentType ContentType = new ContentType {
|
||||||
|
Name = "menuitem",
|
||||||
|
DisplayName = "Menu Item"
|
||||||
|
};
|
||||||
|
|
||||||
|
public MenuItemDriver(IOrchardServices orchardServices) {
|
||||||
|
_orchardServices = orchardServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ContentType GetContentType() {
|
||||||
|
return ContentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string Prefix { get { return ""; } }
|
||||||
|
|
||||||
|
protected override string GetDisplayText(MenuItem item) {
|
||||||
|
return item.Url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
src/Orchard.Web/Core/Navigation/Models/MenuItemHandler.cs
Normal file
15
src/Orchard.Web/Core/Navigation/Models/MenuItemHandler.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Orchard.Core.Navigation.Records;
|
||||||
|
using Orchard.Data;
|
||||||
|
using Orchard.ContentManagement.Handlers;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Models {
|
||||||
|
public class MenuItemHandler : ContentHandler {
|
||||||
|
private readonly IOrchardServices _orchardServices;
|
||||||
|
|
||||||
|
public MenuItemHandler(IRepository<MenuItemRecord> repository, IOrchardServices orchardServices) {
|
||||||
|
_orchardServices = orchardServices;
|
||||||
|
Filters.Add(new ActivatingFilter<MenuItem>(MenuItemDriver.ContentType.Name));
|
||||||
|
Filters.Add(StorageFilter.For(repository));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
src/Orchard.Web/Core/Navigation/Models/MenuPart.cs
Normal file
26
src/Orchard.Web/Core/Navigation/Models/MenuPart.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Core.Navigation.Records;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Models {
|
||||||
|
public class MenuPart : ContentPart<MenuPartRecord> {
|
||||||
|
[HiddenInput(DisplayValue = false)]
|
||||||
|
public int Id { get { return ContentItem.Id; } }
|
||||||
|
|
||||||
|
public bool OnMainMenu {
|
||||||
|
get { return Record.OnMainMenu; }
|
||||||
|
set { Record.OnMainMenu = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MenuText {
|
||||||
|
get { return Record.MenuText; }
|
||||||
|
set { Record.MenuText = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[HiddenInput(DisplayValue = false)]
|
||||||
|
public string MenuPosition {
|
||||||
|
get { return Record.MenuPosition; }
|
||||||
|
set { Record.MenuPosition = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
src/Orchard.Web/Core/Navigation/Models/MenuPartDriver.cs
Normal file
32
src/Orchard.Web/Core/Navigation/Models/MenuPartDriver.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.ContentManagement.Drivers;
|
||||||
|
using Orchard.Security;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Models {
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class MenuPartDriver : ContentPartDriver<MenuPart> {
|
||||||
|
private readonly IAuthorizationService _authorizationService;
|
||||||
|
|
||||||
|
public MenuPartDriver(IAuthorizationService authorizationService) {
|
||||||
|
_authorizationService = authorizationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IUser CurrentUser { get; set; }
|
||||||
|
|
||||||
|
protected override DriverResult Editor(MenuPart part) {
|
||||||
|
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location("primary", "9");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DriverResult Editor(MenuPart part, IUpdateModel updater) {
|
||||||
|
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
updater.TryUpdateModel(part, Prefix, null, null);
|
||||||
|
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location("primary", "9");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
src/Orchard.Web/Core/Navigation/Models/MenuPartHandler.cs
Normal file
22
src/Orchard.Web/Core/Navigation/Models/MenuPartHandler.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Orchard.ContentManagement.Handlers;
|
||||||
|
using Orchard.Core.Navigation.Records;
|
||||||
|
using Orchard.Data;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Models {
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class MenuPartHandler : ContentHandler {
|
||||||
|
public MenuPartHandler(IRepository<MenuPartRecord> menuPartRepository) {
|
||||||
|
Filters.Add(new ActivatingFilter<MenuPart>("blog"));
|
||||||
|
Filters.Add(new ActivatingFilter<MenuPart>("page"));
|
||||||
|
Filters.Add(new ActivatingFilter<MenuPart>("menuitem"));
|
||||||
|
Filters.Add(StorageFilter.For(menuPartRepository));
|
||||||
|
|
||||||
|
OnActivated<MenuPart>((ctx, x) => {
|
||||||
|
x.OnMainMenu = false;
|
||||||
|
x.MenuText = String.Empty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
src/Orchard.Web/Core/Navigation/Module.txt
Normal file
1
src/Orchard.Web/Core/Navigation/Module.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name: Navigation
|
27
src/Orchard.Web/Core/Navigation/Permissions.cs
Normal file
27
src/Orchard.Web/Core/Navigation/Permissions.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.Security.Permissions;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation {
|
||||||
|
public class Permissions : IPermissionProvider {
|
||||||
|
public static readonly Permission ManageMainMenu = new Permission { Name = "ManageMainMenu", Description = "Manage main menu" };
|
||||||
|
|
||||||
|
public string ModuleName {
|
||||||
|
get { return "Navigation"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Permission> GetPermissions() {
|
||||||
|
return new[] {
|
||||||
|
ManageMainMenu
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
||||||
|
return new[] {
|
||||||
|
new PermissionStereotype {
|
||||||
|
Name = "Administrators",
|
||||||
|
Permissions = new[] {ManageMainMenu}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
using Orchard.ContentManagement.Records;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Records {
|
||||||
|
public class MenuItemRecord : ContentPartRecord {
|
||||||
|
public virtual string Url { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
using Orchard.ContentManagement.Records;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Records {
|
||||||
|
public class MenuPartRecord : ContentPartRecord {
|
||||||
|
public virtual string MenuText { get; set; }
|
||||||
|
public virtual string MenuPosition { get; set; }
|
||||||
|
public virtual bool OnMainMenu { get; set; }
|
||||||
|
}
|
||||||
|
}
|
42
src/Orchard.Web/Core/Navigation/Services/MainMenu.cs
Normal file
42
src/Orchard.Web/Core/Navigation/Services/MainMenu.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Core.Navigation.Models;
|
||||||
|
using Orchard.Core.Navigation.Records;
|
||||||
|
using Orchard.UI.Navigation;
|
||||||
|
using MenuItem=Orchard.Core.Navigation.Models.MenuItem;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Services {
|
||||||
|
public class MainMenu : INavigationProvider {
|
||||||
|
private readonly IContentManager _contentManager;
|
||||||
|
|
||||||
|
public MainMenu(IContentManager contentManager) {
|
||||||
|
_contentManager = contentManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MenuName { get { return "mainmenu"; } }
|
||||||
|
|
||||||
|
public void GetNavigation(NavigationBuilder builder) {
|
||||||
|
IEnumerable<MenuPart> menuParts = _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||||
|
foreach (var menuPart in menuParts) {
|
||||||
|
if (menuPart != null ) {
|
||||||
|
MenuPart part = menuPart;
|
||||||
|
|
||||||
|
if (part.Is<MenuItem>())
|
||||||
|
builder.Add(menu => menu.Add(part.MenuText, part.MenuPosition, part.As<MenuItem>().Url));
|
||||||
|
else
|
||||||
|
builder.Add(
|
||||||
|
menu =>
|
||||||
|
menu.Add(part.MenuText, part.MenuPosition,
|
||||||
|
nib =>
|
||||||
|
nib.Action(
|
||||||
|
part.ContentItem.ContentManager.GetItemMetadata(part.ContentItem).
|
||||||
|
DisplayRouteValues["action"] as string,
|
||||||
|
part.ContentItem.ContentManager.GetItemMetadata(part.ContentItem).
|
||||||
|
DisplayRouteValues["controller"] as string,
|
||||||
|
part.ContentItem.ContentManager.GetItemMetadata(part.ContentItem).
|
||||||
|
DisplayRouteValues)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
src/Orchard.Web/Core/Navigation/Services/MainMenuFilter.cs
Normal file
30
src/Orchard.Web/Core/Navigation/Services/MainMenuFilter.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Mvc.Filters;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.Services {
|
||||||
|
public class MainMenuFilter : FilterProvider, IResultFilter {
|
||||||
|
private readonly INavigationManager _navigationManager;
|
||||||
|
|
||||||
|
public MainMenuFilter(INavigationManager navigationManager) {
|
||||||
|
_navigationManager = navigationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
|
var viewResult = filterContext.Result as ViewResult;
|
||||||
|
if (viewResult == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var baseViewModel = viewResult.ViewData.Model as BaseViewModel;
|
||||||
|
if (baseViewModel == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
baseViewModel.Menu = _navigationManager.BuildMenu("mainmenu");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Navigation.ViewModels {
|
||||||
|
public class NavigationIndexViewModel : AdminViewModel {
|
||||||
|
}
|
||||||
|
}
|
44
src/Orchard.Web/Core/Navigation/Views/Admin/Index.ascx
Normal file
44
src/Orchard.Web/Core/Navigation/Views/Admin/Index.ascx
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<NavigationIndexViewModel>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Core.Navigation.ViewModels"%>
|
||||||
|
<h1><%=Html.TitleForPage(T("Edit Main Menu").ToString())%></h1><%
|
||||||
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Text</td>
|
||||||
|
<td>Position</td>
|
||||||
|
<td>Url</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%-- loop over menu items --%>
|
||||||
|
<tr>
|
||||||
|
<td><input type="text" name="text" /></td>
|
||||||
|
<td><input type="text" name="position" /></td>
|
||||||
|
<td><input type="text" name="url" /></td>
|
||||||
|
<td>Delete Button</td>
|
||||||
|
</tr>
|
||||||
|
<%-- end loop --%>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td>Update All Button</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table><%
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><input type="text" name="addtext" /></td>
|
||||||
|
<td><input type="text" name="addposition" /></td>
|
||||||
|
<td><input type="text" name="addurl" /></td>
|
||||||
|
<td>Add Button</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table><%
|
||||||
|
} %>
|
@@ -0,0 +1,9 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<MenuPart>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Core.Navigation.Models"%>
|
||||||
|
<%@ Import Namespace="Orchard.Core.Navigation.ViewModels"%>
|
||||||
|
<fieldset>
|
||||||
|
<%=Html.EditorFor(m => m.OnMainMenu) %>
|
||||||
|
<label for="OnMainMenu" class="forcheckbox"><%=_Encoded("Add to the main menu") %></label>
|
||||||
|
<label for="MenuText"><%=_Encoded("Menu text") %></label>
|
||||||
|
<%=Html.TextBoxFor(m => m.MenuText, new { @class = "large text" })%>
|
||||||
|
</fieldset>
|
@@ -102,6 +102,20 @@
|
|||||||
<Compile Include="Feeds\Models\FeedResponse.cs" />
|
<Compile Include="Feeds\Models\FeedResponse.cs" />
|
||||||
<Compile Include="Feeds\Rss\RssFeedBuilder.cs" />
|
<Compile Include="Feeds\Rss\RssFeedBuilder.cs" />
|
||||||
<Compile Include="Feeds\Rss\RssResult.cs" />
|
<Compile Include="Feeds\Rss\RssResult.cs" />
|
||||||
|
<Compile Include="Navigation\AdminMenu.cs" />
|
||||||
|
<Compile Include="Navigation\Controllers\AdminController.cs" />
|
||||||
|
<Compile Include="Navigation\Models\MenuItem.cs" />
|
||||||
|
<Compile Include="Navigation\Models\MenuItemDriver.cs" />
|
||||||
|
<Compile Include="Navigation\Models\MenuItemHandler.cs" />
|
||||||
|
<Compile Include="Navigation\Models\MenuPart.cs" />
|
||||||
|
<Compile Include="Navigation\Models\MenuPartDriver.cs" />
|
||||||
|
<Compile Include="Navigation\Models\MenuPartHandler.cs" />
|
||||||
|
<Compile Include="Navigation\Permissions.cs" />
|
||||||
|
<Compile Include="Navigation\Records\MenuItemRecord.cs" />
|
||||||
|
<Compile Include="Navigation\Records\MenuPartRecord.cs" />
|
||||||
|
<Compile Include="Navigation\Services\MainMenu.cs" />
|
||||||
|
<Compile Include="Navigation\Services\MainMenuFilter.cs" />
|
||||||
|
<Compile Include="Navigation\ViewModels\NavigationIndexViewModel.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Scheduling\Records\ScheduledTaskRecord.cs" />
|
<Compile Include="Scheduling\Records\ScheduledTaskRecord.cs" />
|
||||||
<Compile Include="Scheduling\Services\PublishingTaskHandler.cs" />
|
<Compile Include="Scheduling\Services\PublishingTaskHandler.cs" />
|
||||||
@@ -149,11 +163,11 @@
|
|||||||
<Compile Include="XmlRpc\XmlRpcContext.cs" />
|
<Compile Include="XmlRpc\XmlRpcContext.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Common\Package.txt" />
|
<Content Include="Common\Module.txt" />
|
||||||
<Content Include="Settings\Package.txt" />
|
<Content Include="Settings\Module.txt" />
|
||||||
<Content Include="Settings\Views\Admin\Index.ascx" />
|
<Content Include="Settings\Views\Admin\Index.ascx" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="XmlRpc\Package.txt" />
|
<Content Include="XmlRpc\Module.txt" />
|
||||||
<Content Include="XmlRpc\Views\Home\Index.aspx" />
|
<Content Include="XmlRpc\Views\Home\Index.aspx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -170,7 +184,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Common\Views\Web.config" />
|
<Content Include="Common\Views\Web.config" />
|
||||||
<Content Include="Themes\Package.txt" />
|
<Content Include="Themes\Module.txt" />
|
||||||
<Content Include="Themes\Views\Admin\Index.aspx" />
|
<Content Include="Themes\Views\Admin\Index.aspx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -179,8 +193,9 @@
|
|||||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Routable.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Routable.ascx" />
|
||||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Body.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Body.ascx" />
|
||||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Owner.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Owner.ascx" />
|
||||||
<Content Include="Feeds\Package.txt" />
|
<Content Include="Feeds\Module.txt" />
|
||||||
<Content Include="Scheduling\Package.txt" />
|
<Content Include="Navigation\Module.txt" />
|
||||||
|
<Content Include="Scheduling\Module.txt" />
|
||||||
<Content Include="Settings\Views\EditorTemplates\Items\Settings.Site.ascx" />
|
<Content Include="Settings\Views\EditorTemplates\Items\Settings.Site.ascx" />
|
||||||
<Content Include="Themes\Scripts\jquery-1.4.1.js" />
|
<Content Include="Themes\Scripts\jquery-1.4.1.js" />
|
||||||
<Content Include="Themes\Scripts\jquery-1.4.1.min.js" />
|
<Content Include="Themes\Scripts\jquery-1.4.1.min.js" />
|
||||||
@@ -200,6 +215,11 @@
|
|||||||
<Content Include="Themes\Views\Menu.ascx" />
|
<Content Include="Themes\Views\Menu.ascx" />
|
||||||
<Content Include="Themes\Views\Web.config" />
|
<Content Include="Themes\Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Navigation\Views\Admin\Index.ascx" />
|
||||||
|
<Content Include="Navigation\Views\EditorTemplates\Parts\Navigation.EditMenuPart.ascx" />
|
||||||
|
<Content Include="Navigation\Views\Web.config" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Scheduling\Controllers\" />
|
<Folder Include="Scheduling\Controllers\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@@ -3,8 +3,6 @@ using Orchard.Core.Settings.Models;
|
|||||||
using Orchard.Core.Settings.ViewModels;
|
using Orchard.Core.Settings.ViewModels;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Security;
|
|
||||||
using Orchard.Security.Permissions;
|
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ namespace Orchard.Core.Settings {
|
|||||||
public static readonly Permission ManageSettings = new Permission { Name = "ManageSettings", Description = "Manage site settings" };
|
public static readonly Permission ManageSettings = new Permission { Name = "ManageSettings", Description = "Manage site settings" };
|
||||||
public static readonly Permission ChangeSuperuser = new Permission { Name = "ChangeSuperuser", Description = "Change the superuser for the site" };
|
public static readonly Permission ChangeSuperuser = new Permission { Name = "ChangeSuperuser", Description = "Change the superuser for the site" };
|
||||||
|
|
||||||
public string PackageName {
|
public string ModuleName {
|
||||||
get { return "Settings"; }
|
get { return "Settings"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,8 @@ namespace Orchard.Core.Settings.Services {
|
|||||||
item.Record.SiteName = "My Orchard Project Application";
|
item.Record.SiteName = "My Orchard Project Application";
|
||||||
item.Record.PageTitleSeparator = " - ";
|
item.Record.PageTitleSeparator = " - ";
|
||||||
});
|
});
|
||||||
|
// ensure subsequent calls will locate this object
|
||||||
|
_contentManager.Flush();
|
||||||
return site;
|
return site;
|
||||||
}
|
}
|
||||||
return _contentManager.Get<ISite>(record.Id);
|
return _contentManager.Get<ISite>(record.Id);
|
||||||
|
@@ -7,7 +7,7 @@ namespace Orchard.Core.Themes {
|
|||||||
public static readonly Permission ManageThemes = new Permission { Description = "Manage Themes", Name = "ManageThemes" };
|
public static readonly Permission ManageThemes = new Permission { Description = "Manage Themes", Name = "ManageThemes" };
|
||||||
public static readonly Permission ApplyTheme = new Permission { Description = "Apply a Theme", Name = "ApplyTheme" };
|
public static readonly Permission ApplyTheme = new Permission { Description = "Apply a Theme", Name = "ApplyTheme" };
|
||||||
|
|
||||||
public string PackageName {
|
public string ModuleName {
|
||||||
get {
|
get {
|
||||||
return "Themes";
|
return "Themes";
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,24 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<object>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BaseViewModel>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||||
|
<% var menu = Model.Menu.FirstOrDefault();
|
||||||
|
if (menu != null && menu.Items.Count() > 0) { %>
|
||||||
<div id="menucontainer">
|
<div id="menucontainer">
|
||||||
|
<%-- todo: (heskew) *really* need a better way of doing this. ...and this is really, really ugly :) --%>
|
||||||
<ul id="menu">
|
<ul id="menu">
|
||||||
<li><%= Html.ActionLink(T("Home").ToString(), "Index", "Home", new {Area = ""}, new {})%></li>
|
<%
|
||||||
<li><%= Html.ActionLink(T("Blogs").ToString(), "List", "Blog", new { Area = "Orchard.Blogs" }, new { })%></li>
|
int counter = 0, count = menu.Items.Count() - 1;
|
||||||
<li><%= Html.ActionLink(T("Admin").ToString(), "List", new { Area = "Orchard.Blogs", Controller = "BlogAdmin" })%></li>
|
foreach (var menuItem in menu.Items) {
|
||||||
|
var sbClass = new StringBuilder(10);
|
||||||
|
if (counter == 0)
|
||||||
|
sbClass.Append("first ");
|
||||||
|
if (counter == count)
|
||||||
|
sbClass.Append("last ");%>
|
||||||
|
<li class="<%=sbClass.ToString().TrimEnd() %>"><%=!string.IsNullOrEmpty(menuItem.Url)
|
||||||
|
? Html.Link(menuItem.Text, ResolveUrl(menuItem.Url))
|
||||||
|
: Html.ActionLink(menuItem.Text, (string)menuItem.RouteValues["action"], menuItem.RouteValues).ToHtmlString() %></li>
|
||||||
|
<%
|
||||||
|
++counter;
|
||||||
|
} %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
@@ -110,7 +110,7 @@
|
|||||||
<Compile Include="ViewModels\BlogEditViewModel.cs" />
|
<Compile Include="ViewModels\BlogEditViewModel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Package.txt" />
|
<Content Include="Module.txt" />
|
||||||
<Content Include="Scripts\archives.js" />
|
<Content Include="Scripts\archives.js" />
|
||||||
<Content Include="Scripts\jquery.ui.core.js" />
|
<Content Include="Scripts\jquery.ui.core.js" />
|
||||||
<Content Include="Scripts\jquery.ui.datepicker.js" />
|
<Content Include="Scripts\jquery.ui.datepicker.js" />
|
@@ -16,7 +16,7 @@ namespace Orchard.Blogs {
|
|||||||
public static readonly Permission MetaListOthersBlogs = new Permission { ImpliedBy = new[] { EditOthersBlogPost, PublishOthersBlogPost, DeleteOthersBlogPost } };
|
public static readonly Permission MetaListOthersBlogs = new Permission { ImpliedBy = new[] { EditOthersBlogPost, PublishOthersBlogPost, DeleteOthersBlogPost } };
|
||||||
public static readonly Permission MetaListBlogs = new Permission { ImpliedBy = new[] { EditBlogPost, PublishBlogPost, DeleteBlogPost } };
|
public static readonly Permission MetaListBlogs = new Permission { ImpliedBy = new[] { EditBlogPost, PublishBlogPost, DeleteBlogPost } };
|
||||||
|
|
||||||
public string PackageName {
|
public string ModuleName {
|
||||||
get {
|
get {
|
||||||
return "Blogs";
|
return "Blogs";
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user