Compare commits
248 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 788a0241d8 | |||
| 25237995eb | |||
| ed75109829 | |||
| 6738a25bfa | |||
| aa9c753455 | |||
| 0e5f9b92e8 | |||
| 77fd4d383b | |||
| 98a03a0127 | |||
| 464130a102 | |||
| dfb324b003 | |||
| 966b8565ba | |||
| 2b774dbdf2 | |||
| cae600ac2f | |||
| 5e4702a4ab | |||
| 8442b2e8e7 | |||
| 64efd0abbc | |||
| b8f3f93d83 | |||
| ce9e851087 | |||
| 53d9a34996 | |||
| 2f79d4a71d | |||
| 98d72da622 | |||
| c563629756 | |||
| acb3ecbbf7 | |||
| 2cbe6f5543 | |||
| 9beaaa825e | |||
| bf90edb5be | |||
| 94a506f8e8 | |||
| 4f68941f98 | |||
| 25de56a98b | |||
| b11135a096 | |||
| d4db32c0f2 | |||
| d54f35f5f7 | |||
| f163381399 | |||
| 86cb3e8695 | |||
| dcc50c3b53 | |||
| 0209b71182 | |||
| 6b92e47631 | |||
| 36ffebbb49 | |||
| d0bafc6184 | |||
| 801828df70 | |||
| 953c371580 | |||
| 83d3882b9a | |||
| c37777b289 | |||
| ef6a4139de | |||
| 98ceabaf7e | |||
| 85bcb7ad2b | |||
| adea6dd2f6 | |||
| cad0650223 | |||
| d8909fe09c | |||
| bf5acf6724 | |||
| 9bf33f0eea | |||
| 0155a094b1 | |||
| 08432e8b23 | |||
| 717f67874a | |||
| dc27368397 | |||
| de7900cd2e | |||
| c288c2b9a3 | |||
| 26032e46dd | |||
| caee5c6baf | |||
| ea9c37d500 | |||
| a1c223bc2b | |||
| 6afd9b37a6 | |||
| 1930022f19 | |||
| bece953fa3 | |||
| a41d37b1cf | |||
| 31603f7063 | |||
| 4520c06454 | |||
| 9f0c00827d | |||
| 2a66f95873 | |||
| 3330c617b4 | |||
| 0df0b78b90 | |||
| c6b6685dc7 | |||
| 2db45eaca3 | |||
| b876e34586 | |||
| 935436203e | |||
| 9580c8965f | |||
| 7c3c477f18 | |||
| d7cc626396 | |||
| e2cc342adf | |||
| ea785a6585 | |||
| 46a8e586ce | |||
| fa0f15f5c4 | |||
| 6a15c2603d | |||
| 9d50a4d2a5 | |||
| 60263c9040 | |||
| ba6a5825fa | |||
| 321e2f9de0 | |||
| 4e68380c32 | |||
| 9834352de2 | |||
| da87ba8bc7 | |||
| d34255b1fc | |||
| 9b6ab24890 | |||
| 2341622243 | |||
| 956a51ab67 | |||
| 0fdf69be8b | |||
| ee040eb04f | |||
| e358d3b170 | |||
| 752ce55cfa | |||
| d1e684cb40 | |||
| e6d6d3dd69 | |||
| 98b41256c1 | |||
| bc446a63fe | |||
| dca14f3eb4 | |||
| 1abdca2432 | |||
| 8a214b5181 | |||
| 6db4fedcad | |||
| 3e66235932 | |||
| 91f087141b | |||
| 1ab321c7b1 | |||
| dffcf10032 | |||
| 6265354327 | |||
| 054033c73f | |||
| 4fcd23d8dc | |||
| 86f39aee03 | |||
| 9190930f49 | |||
| 11ec43c5c1 | |||
| 1b83c5c180 | |||
| 8a98b66cfd | |||
| 9638bd8bd2 | |||
| 362717c05d | |||
| 16d9b9f527 | |||
| 3ae57100c8 | |||
| 6d33cf6c69 | |||
| 209ccb9ae7 | |||
| 2850c8aa05 | |||
| 87a9a57e6d | |||
| 3e6273d073 | |||
| 8d98813440 | |||
| d0b409341e | |||
| 84489f612b | |||
| ee6c9a3b05 | |||
| d12162cca5 | |||
| 1117f96597 | |||
| d3f3e161e0 | |||
| 90d78d1b60 | |||
| 5673b1907b | |||
| bc9ebb24f9 | |||
| 084e9e00ce | |||
| 96e4f723b1 | |||
| 163a03986c | |||
| 7007389505 | |||
| 2336905dae | |||
| a2164819f5 | |||
| 6b345bfc75 | |||
| a699f32178 | |||
| e597886d0f | |||
| 10e53de029 | |||
| c9336ba32f | |||
| 55190b7318 | |||
| 0328ba1aec | |||
| 1accc6275a | |||
| ce80c9a244 | |||
| 2d9bd394ae | |||
| b3c291206a | |||
| f3f6504398 | |||
| 52629f829d | |||
| 3496c5aece | |||
| 613f56107d | |||
| c47d59a257 | |||
| 8fe0e4223b | |||
| 9abda14530 | |||
| 9df2979d7d | |||
| f4a81bfc04 | |||
| bff7aba778 | |||
| ade7278724 | |||
| f5835baa27 | |||
| d7f6bd0d20 | |||
| d92e5ca2e3 | |||
| 94465892ed | |||
| 4b59caf18f | |||
| a0994ff105 | |||
| 9b3a7b8abc | |||
| bb93f0a4a2 | |||
| 3c8be919da | |||
| 168893a888 | |||
| eb4076399e | |||
| d61d6008da | |||
| 47a78c1bcb | |||
| dfdf85fc0b | |||
| 8862b99e6a | |||
| a1a1b9ebb5 | |||
| 403f64eeed | |||
| 5a26a52157 | |||
| 5aa29cc150 | |||
| 9be3bdb8a5 | |||
| c0baac2b38 | |||
| 31903c8ead | |||
| e59b14b7e7 | |||
| cb869b9064 | |||
| b20fc22577 | |||
| df0c297f55 | |||
| e36dc368d9 | |||
| 656ba98b1b | |||
| 5c17201006 | |||
| d86a1946a7 | |||
| 18bf4a87b4 | |||
| 91475c7103 | |||
| 88934a3f14 | |||
| 80b5c99111 | |||
| 658a045168 | |||
| ccd438ba26 | |||
| 71863f8ba1 | |||
| 6df6e3bdad | |||
| 9019c49ee8 | |||
| 74ebf67aef | |||
| 33036f80fe | |||
| 0688550143 | |||
| d43b673092 | |||
| 4ec37b9d3a | |||
| a5240a852e | |||
| c74c269b9a | |||
| 0cbdebc9b0 | |||
| 4f655acda5 | |||
| 0cb396825f | |||
| 4eb0981552 | |||
| 4257a89cc1 | |||
| 7300316780 | |||
| 94da555fea | |||
| ed8cc2ad0d | |||
| ae47ad882d | |||
| 10bc7d0c1e | |||
| aa11d3504d | |||
| 6903ebda1f | |||
| 6c6e398c53 | |||
| bccb9655d0 | |||
| dd143681f1 | |||
| b1d4a99510 | |||
| 79d9412b31 | |||
| f6c39362cd | |||
| 48fb2a2fcc | |||
| 4562237a96 | |||
| 3420694cca | |||
| c68067eb09 | |||
| a8c73296ea | |||
| 805c1bf8d0 | |||
| 15119fc8d0 | |||
| e2f8a73561 | |||
| 4d9f6ccd22 | |||
| 9112c05477 | |||
| c0c624d62e | |||
| ca951aa56b | |||
| 6ea7b32363 | |||
| c35fa7c975 | |||
| 419531f373 | |||
| 3457768646 | |||
| 69c3962f21 | |||
| 6c2750b0cc | |||
| abc672e348 |
@@ -128,3 +128,4 @@ src/*.boltdata/
|
||||
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js
|
||||
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js
|
||||
src/umbraco.sln.ide/*
|
||||
build/UmbracoCms.*/
|
||||
|
||||
+29
-15
@@ -2,9 +2,18 @@
|
||||
IF NOT EXIST UmbracoVersion.txt (
|
||||
ECHO UmbracoVersion.txt missing!
|
||||
GOTO :showerror
|
||||
)
|
||||
SET /p release=<UmbracoVersion.txt
|
||||
SET comment=beta2
|
||||
)
|
||||
|
||||
REM Get the version and comment from UmbracoVersion.txt lines 2 and 3
|
||||
SET "release="
|
||||
SET "comment="
|
||||
FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED release SET "release=%%i"
|
||||
FOR /F "skip=2 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED comment SET "comment=%%i"
|
||||
|
||||
REM If there's arguments on the command line overrule UmbracoVersion.txt and use that as the version
|
||||
IF [%1] NEQ [] (SET release=%1)
|
||||
IF [%2] NEQ [] (SET comment=%2) ELSE (IF [%1] NEQ [] (SET "comment="))
|
||||
|
||||
SET version=%release%
|
||||
|
||||
IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
|
||||
@@ -14,8 +23,11 @@ ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %rel
|
||||
|
||||
ECHO Installing the Microsoft.Bcl.Build package before anything else, otherwise you'd have to run build.cmd twice
|
||||
SET nuGetFolder=%CD%\..\src\packages\
|
||||
..\src\.nuget\NuGet.exe sources Remove -Name MyGetUmbracoCore
|
||||
..\src\.nuget\NuGet.exe sources Add -Name MyGetUmbracoCore -Source https://www.myget.org/F/umbracocore/api/v2/ >NUL
|
||||
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Web.UI\packages.config -OutputDirectory %nuGetFolder%
|
||||
..\src\.nuget\NuGet.exe install ..\src\umbraco.businesslogic\packages.config -OutputDirectory %nuGetFolder%
|
||||
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Core\packages.config -OutputDirectory %nuGetFolder%
|
||||
|
||||
ECHO Removing the belle build folder to make sure everything is clean as a whistle
|
||||
RD ..\src\Umbraco.Web.UI.Client\build /Q /S
|
||||
@@ -33,20 +45,22 @@ ECHO Performing MSBuild and producing Umbraco binaries zip files
|
||||
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment%
|
||||
|
||||
ECHO Adding dummy files to include in the NuGet package so that empty folders actually get created
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Code\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Data\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Plugins\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\css\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\masterpages\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\media\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\scripts\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\usercontrols\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\Views\Partials\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\Views\MacroPartials\dummy.txt
|
||||
SET dummytext=This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete.
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\App_Code\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\App_Data\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\App_Plugins\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\css\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\masterpages\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\media\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\scripts\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\usercontrols\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\Views\Partials\dummy.txt
|
||||
ECHO %dummytext% > .\_BuildOutput\WebApp\Views\MacroPartials\dummy.txt
|
||||
|
||||
ECHO Adding Web.config transform files to the NuGet package
|
||||
ren .\_BuildOutput\WebApp\Views\Web.config Web.config.transform
|
||||
ren .\_BuildOutput\WebApp\Xslt\Web.config Web.config.transform
|
||||
REN .\_BuildOutput\WebApp\MacroScripts\Web.config Web.config.transform
|
||||
REN .\_BuildOutput\WebApp\Views\Web.config Web.config.transform
|
||||
REN .\_BuildOutput\WebApp\Xslt\Web.config Web.config.transform
|
||||
|
||||
ECHO Packing the NuGet release files
|
||||
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
|
||||
|
||||
+2
-2
@@ -156,8 +156,8 @@
|
||||
<Target Name="ZipWebApp" DependsOnTargets="ZipUmbracoExaminePDF" >
|
||||
<Message Text="Starting to zip to $(buildDate)-$(BuildZipFileName)" Importance="high" />
|
||||
|
||||
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameBin)%22 %22$(SolutionBinFolderAbsolutePath)*%22" />
|
||||
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileName)%22 %22$(WebAppFolderAbsolutePath)*%22" />
|
||||
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameBin)%22 %22$(SolutionBinFolderAbsolutePath)*%22 -x!dotLess.Core.dll" />
|
||||
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileName)%22 %22$(WebAppFolderAbsolutePath)*%22 -x!dotLess.Core.dll" />
|
||||
|
||||
<Message Text="Finished zipping to build\$(BuildFolder)\$(buildDate)-$(BuildZipFileName)" Importance="high" />
|
||||
</Target>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<language>en-US</language>
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.40804.0,5.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.30506.0,5.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebApi" version="[4.0.30506,5.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebApi.WebHost" version="[4.0.30506, 5.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebApi.Core" version="[4.0.30506, 5.0.0)" />
|
||||
@@ -33,8 +33,8 @@
|
||||
<dependency id="AutoMapper" version="[3.0.0, 4.0.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[6.0.5, 7.0.0)" />
|
||||
<dependency id="Examine" version="[0.1.57, 1.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[1.9.5, 2.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[3.3.1, 4.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[1.9.5, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[3.3.1, 5.0.0)" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
@@ -26,11 +26,15 @@
|
||||
views/dashboard/developer/developerdashboardvideos.html
|
||||
</control>
|
||||
</tab>
|
||||
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
|
||||
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
</section>
|
||||
|
||||
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)">
|
||||
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
|
||||
<control>
|
||||
views/dashboard/developer/examinemanagement.html
|
||||
</control>
|
||||
</tab>
|
||||
</tab>
|
||||
</section>
|
||||
|
||||
<section alias="StartupMediaDashboardSection" xdt:Locator="Match(alias)">
|
||||
|
||||
@@ -2,24 +2,22 @@ A note about running Umbraco from Visual Studio.
|
||||
|
||||
Don't forget to build!
|
||||
|
||||
BETA Notice: We've done our best to transform your config files, we are testing this in 7.2 beta and would love to
|
||||
hear back if it didn't work so we can improve this feature. We'd love to see your before and after config files
|
||||
(make sure to delete sensitive data like passwords and API keys) in the issue tracker at http://issues.umbraco.org/
|
||||
Remember, we backed up your files in App_Data\NuGetBackup so you can find the original file before it was transformed.
|
||||
|
||||
When upgrading your website using NuGet you should answer "No" to the questions to overwrite the Web.config
|
||||
file (and config files in the config folder).
|
||||
|
||||
We've overwritten all the files in the Umbraco and Umbraco_Client folder, these have been backed up in
|
||||
App_Data\NuGetBackup. We didn't overwrite the UI.xml file nor did we remove any files or folders that you or a package
|
||||
might have added. Only the existing files were overwritten. If you customized anything then make sure to do a compare
|
||||
and merge with the NuGetBackup folder.
|
||||
We've done our best to transform your configuration files but in case something is not quite right: remember we
|
||||
backed up your files in App_Data\NuGetBackup so you can find the original files before they were transformed.
|
||||
|
||||
This nuget package includes build targets that extends the creation of a deploy package, which is generated by
|
||||
We've overwritten all the files in the Umbraco and Umbraco_Client folder, these have been backed up in
|
||||
App_Data\NuGetBackup. We didn't overwrite the UI.xml file nor did we remove any files or folders that you or
|
||||
a package might have added. Only the existing files were overwritten. If you customized anything then make
|
||||
sure to do a compare and merge with the NuGetBackup folder.
|
||||
|
||||
This NuGet package includes build targets that extend the creation of a deploy package, which is generated by
|
||||
Publishing from Visual Studio. The targets will only work once Publishing is configured, so if you don't use
|
||||
Publish this won't affect you.
|
||||
These things will now be automatically included when creating a deploy package or publishing to the file system:
|
||||
umbraco, umbraco_client, config\splashes and global.asax.
|
||||
The following items will now be automatically included when creating a deploy package or publishing to the file
|
||||
system: umbraco, umbraco_client, config\splashes and global.asax.
|
||||
|
||||
Please read the release notes on our.umbraco.org:
|
||||
http://our.umbraco.org/contribute/releases
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
<section name="FileSystemProviders" xdt:Locator="Match(name)" xdt:Transform="Remove" />
|
||||
<section name="ExamineLuceneIndexSets" type="Examine.LuceneEngine.Config.IndexSets, Examine" requirePermission="false" xdt:Locator="Match(name)" xdt:Transform="SetAttributes(type,requirePermission)" />
|
||||
|
||||
<sectionGroup name="applicationSettings" xdt:Locator="Match(name)" xdt:Transform="Remove" />
|
||||
<sectionGroup name="applicationSettings" xdt:Locator="Match(name)">
|
||||
<section name="umbraco.presentation.Properties.Settings" xdt:Locator="Match(name)" xdt:Transform="Remove" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="system.web.webPages.razor" xdt:Locator="Match(name)" xdt:Transform="Remove" />
|
||||
<sectionGroup name="umbracoConfiguration" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing">
|
||||
<section name="settings" type="Umbraco.Core.Configuration.UmbracoSettings.UmbracoSettingsSection, Umbraco.Core" requirePermission="false" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||
@@ -154,10 +156,25 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
<system.web.webPages.razor xdt:Transform="Remove" />
|
||||
|
||||
<location path="umbraco" xdt:Locator="Match(path)" xdt:Transform="InsertIfMissing" />
|
||||
<location path="umbraco" xdt:Locator="Match(path)">
|
||||
<system.webServer xdt:Transform="InsertIfMissing">
|
||||
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" xdt:Transform="SetAttributes(doStaticCompression,doDynamicCompression,dynamicCompressionBeforeCache)" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
|
||||
<location path="App_Plugins" xdt:Locator="Match(path)" xdt:Transform="InsertIfMissing" />
|
||||
<location path="App_Plugins" xdt:Locator="Match(path)">
|
||||
<system.webServer xdt:Transform="InsertIfMissing">
|
||||
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" xdt:Transform="SetAttributes(doStaticCompression,doDynamicCompression,dynamicCompressionBeforeCache)" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
|
||||
</configuration>
|
||||
@@ -1 +1,2 @@
|
||||
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
|
||||
7.2.0
|
||||
@@ -229,5 +229,17 @@ namespace SqlCE4Umbraco
|
||||
return new SqlCeDataReaderHelper(SqlCeApplicationBlock.ExecuteReader(ConnectionString, CommandType.Text,
|
||||
commandText, parameters));
|
||||
}
|
||||
|
||||
|
||||
internal IRecordsReader ExecuteReader(string commandText)
|
||||
{
|
||||
return ExecuteReader(commandText, new SqlCEParameter(string.Empty, string.Empty));
|
||||
}
|
||||
|
||||
|
||||
internal int ExecuteNonQuery(string commandText)
|
||||
{
|
||||
return ExecuteNonQuery(commandText, new SqlCEParameter(string.Empty, string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Umbraco.Core
|
||||
/// <returns></returns>
|
||||
private bool ShouldExecute(ApplicationContext applicationContext)
|
||||
{
|
||||
if (applicationContext.IsConfigured && applicationContext.DatabaseContext.IsDatabaseConfigured)
|
||||
if (applicationContext.IsConfigured && applicationContext.DatabaseContext.CanConnect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace Umbraco.Core
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!applicationContext.DatabaseContext.IsDatabaseConfigured && ExecuteWhenDatabaseNotConfigured)
|
||||
if (!applicationContext.DatabaseContext.CanConnect && ExecuteWhenDatabaseNotConfigured)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
public interface IScheduledTasksSection : IUmbracoConfigurationSection
|
||||
{
|
||||
IEnumerable<IScheduledTask> Tasks { get; }
|
||||
|
||||
string BaseUrl { get; }
|
||||
}
|
||||
}
|
||||
@@ -16,5 +16,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
get { return Tasks; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("baseUrl", IsRequired = false, DefaultValue = null)]
|
||||
public string BaseUrl
|
||||
{
|
||||
get { return (string)base["baseUrl"]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// Gets the version comment (like beta or RC).
|
||||
/// </summary>
|
||||
/// <value>The version comment.</value>
|
||||
public static string CurrentComment { get { return "beta2"; } }
|
||||
public static string CurrentComment { get { return ""; } }
|
||||
|
||||
// Get the version of the umbraco.dll by looking at a class in that dll
|
||||
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace Umbraco.Core
|
||||
{
|
||||
private readonly IDatabaseFactory _factory;
|
||||
private bool _configured;
|
||||
private bool _canConnect;
|
||||
private volatile bool _connectCheck = false;
|
||||
private readonly object _locker = new object();
|
||||
private string _connectionString;
|
||||
private string _providerName;
|
||||
private DatabaseSchemaResult _result;
|
||||
@@ -56,6 +59,32 @@ namespace Umbraco.Core
|
||||
get { return _configured; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the db can be connected to
|
||||
/// </summary>
|
||||
public bool CanConnect
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsDatabaseConfigured == false) return false;
|
||||
|
||||
//double check lock so that it is only checked once and is fast
|
||||
if (_connectCheck == false)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
if (_canConnect == false)
|
||||
{
|
||||
_canConnect = DbConnectionExtensions.IsConnectionAvailable(ConnectionString, DatabaseProvider);
|
||||
_connectCheck = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _canConnect;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configured umbraco db connection string.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// Helper class for mandating values, for example on method parameters.
|
||||
/// </summary>
|
||||
internal static class Mandate
|
||||
public static class Mandate
|
||||
{
|
||||
/// <summary>
|
||||
/// Mandates that the specified parameter is not null.
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models
|
||||
/// <summary>
|
||||
/// Constuctor for creating a ContentType with the parent's id.
|
||||
/// </summary>
|
||||
/// <remarks>You usually only want to use this for creating ContentTypes at the root.</remarks>
|
||||
/// <remarks>Only use this for creating ContentTypes at the root (with ParentId -1).</remarks>
|
||||
/// <param name="parentId"></param>
|
||||
public ContentType(int parentId) : base(parentId)
|
||||
{
|
||||
@@ -31,11 +31,22 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
/// <remarks>Use this to ensure inheritance from parent.</remarks>
|
||||
/// <param name="parent"></param>
|
||||
public ContentType(IContentType parent) : base(parent)
|
||||
public ContentType(IContentType parent) : this(parent, null)
|
||||
{
|
||||
_allowedTemplates = new List<ITemplate>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constuctor for creating a ContentType with the parent as an inherited type.
|
||||
/// </summary>
|
||||
/// <remarks>Use this to ensure inheritance from parent.</remarks>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="alias"></param>
|
||||
public ContentType(IContentType parent, string alias)
|
||||
: base(parent, alias)
|
||||
{
|
||||
_allowedTemplates = new List<ITemplate>();
|
||||
}
|
||||
|
||||
private static readonly PropertyInfo DefaultTemplateSelector = ExpressionHelper.GetPropertyInfo<ContentType, int>(x => x.DefaultTemplateId);
|
||||
private static readonly PropertyInfo AllowedTemplatesSelector = ExpressionHelper.GetPropertyInfo<ContentType, IEnumerable<ITemplate>>(x => x.AllowedTemplates);
|
||||
|
||||
|
||||
@@ -48,17 +48,22 @@ namespace Umbraco.Core.Models
|
||||
_additionalData = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
protected ContentTypeBase(IContentTypeBase parent)
|
||||
protected ContentTypeBase(IContentTypeBase parent) : this(parent, null)
|
||||
{
|
||||
Mandate.ParameterNotNull(parent, "parent");
|
||||
}
|
||||
|
||||
_parentId = new Lazy<int>(() => parent.Id);
|
||||
_allowedContentTypes = new List<ContentTypeSort>();
|
||||
_propertyGroups = new PropertyGroupCollection();
|
||||
protected ContentTypeBase(IContentTypeBase parent, string alias)
|
||||
{
|
||||
Mandate.ParameterNotNull(parent, "parent");
|
||||
|
||||
_alias = alias;
|
||||
_parentId = new Lazy<int>(() => parent.Id);
|
||||
_allowedContentTypes = new List<ContentTypeSort>();
|
||||
_propertyGroups = new PropertyGroupCollection();
|
||||
_propertyTypes = new PropertyTypeCollection();
|
||||
_propertyTypes.CollectionChanged += PropertyTypesChanged;
|
||||
_additionalData = new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Name);
|
||||
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.ParentId);
|
||||
|
||||
@@ -22,11 +22,16 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
protected ContentTypeCompositionBase(IContentTypeComposition parent)
|
||||
: base(parent)
|
||||
: this(parent, null)
|
||||
{
|
||||
AddContentType(parent);
|
||||
}
|
||||
|
||||
protected ContentTypeCompositionBase(IContentTypeComposition parent, string alias)
|
||||
: base(parent, alias)
|
||||
{
|
||||
AddContentType(parent);
|
||||
}
|
||||
|
||||
private static readonly PropertyInfo ContentTypeCompositionSelector =
|
||||
ExpressionHelper.GetPropertyInfo<ContentTypeCompositionBase, IEnumerable<IContentTypeComposition>>(
|
||||
x => x.ContentTypeComposition);
|
||||
@@ -76,6 +81,9 @@ namespace Umbraco.Core.Models
|
||||
if (contentType.ContentTypeComposition.Any(x => x.CompositionAliases().Any(ContentTypeCompositionExists)))
|
||||
return false;
|
||||
|
||||
if (string.IsNullOrEmpty(Alias) == false && Alias.Equals(contentType.Alias))
|
||||
return false;
|
||||
|
||||
if (ContentTypeCompositionExists(contentType.Alias) == false)
|
||||
{
|
||||
//Before we actually go ahead and add the ContentType as a Composition we ensure that we don't
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Models
|
||||
/// <summary>
|
||||
/// Constuctor for creating a MediaType with the parent's id.
|
||||
/// </summary>
|
||||
/// <remarks>You usually only want to use this for creating MediaTypes at the root.</remarks>
|
||||
/// <remarks>Only use this for creating MediaTypes at the root (with ParentId -1).</remarks>
|
||||
/// <param name="parentId"></param>
|
||||
public MediaType(int parentId) : base(parentId)
|
||||
{
|
||||
@@ -24,10 +24,21 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
/// <remarks>Use this to ensure inheritance from parent.</remarks>
|
||||
/// <param name="parent"></param>
|
||||
public MediaType(IMediaType parent) : base(parent)
|
||||
public MediaType(IMediaType parent) : this(parent, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constuctor for creating a MediaType with the parent as an inherited type.
|
||||
/// </summary>
|
||||
/// <remarks>Use this to ensure inheritance from parent.</remarks>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="alias"></param>
|
||||
public MediaType(IMediaType parent, string alias)
|
||||
: base(parent, alias)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to call when Entity is being saved
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -21,7 +20,12 @@ namespace Umbraco.Core.Models
|
||||
MemberTypePropertyTypes = new Dictionary<string, MemberTypePropertyProfileAccess>();
|
||||
}
|
||||
|
||||
public MemberType(IContentTypeComposition parent) : base(parent)
|
||||
public MemberType(IContentTypeComposition parent) : this(parent, null)
|
||||
{
|
||||
}
|
||||
|
||||
public MemberType(IContentTypeComposition parent, string alias)
|
||||
: base(parent, alias)
|
||||
{
|
||||
MemberTypePropertyTypes = new Dictionary<string, MemberTypePropertyProfileAccess>();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
|
||||
[Column("uniqueID")]
|
||||
[NullSetting(NullSetting = NullSettings.Null)]
|
||||
[Index(IndexTypes.NonClustered, Name = "IX_umbracoNodeUniqueID")]
|
||||
public Guid? UniqueId { get; set; }
|
||||
|
||||
[Column("text")]
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Umbraco.Core.Persistence
|
||||
connection.Open();
|
||||
connection.Close();
|
||||
}
|
||||
catch (SqlException)
|
||||
catch (DbException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
+5
-6
@@ -33,7 +33,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
|
||||
}
|
||||
else
|
||||
{
|
||||
//If we are on SQLServer, we need to delete constraints by name, older versions of umbraco did not name these default constraints
|
||||
//If we are on SQLServer, we need to delete default constraints by name, older versions of umbraco did not name these default constraints
|
||||
// consistently so we need to look up the constraint name to delete, this only pertains to SQL Server and this issue:
|
||||
// http://issues.umbraco.org/issue/U4-4133
|
||||
var sqlServerSyntaxProvider = new SqlServerSyntaxProvider();
|
||||
@@ -51,16 +51,15 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
|
||||
|
||||
Delete.Column("macroPropertyHidden").FromTable("cmsMacroProperty");
|
||||
|
||||
if (Context.CurrentDatabaseProvider != DatabaseProviders.SqlServer)
|
||||
if (Context.CurrentDatabaseProvider == DatabaseProviders.MySql)
|
||||
{
|
||||
Delete.ForeignKey().FromTable("cmsMacroProperty").ForeignColumn("macroPropertyType").ToTable("cmsMacroPropertyType").PrimaryColumn("id");
|
||||
}
|
||||
else
|
||||
{
|
||||
//If we are on SQLServer, we need to delete constraints by name, older versions of umbraco did not name these key constraints
|
||||
// consistently so we need to look up the constraint name to delete, this only pertains to SQL Server and this issue:
|
||||
// http://issues.umbraco.org/issue/U4-4133
|
||||
|
||||
//Before we try to delete this constraint, we'll see if it exists first, some older schemas never had it and some older schema's had this named
|
||||
// differently than the default.
|
||||
|
||||
var keyConstraints = SqlSyntaxContext.SqlSyntaxProvider.GetConstraintsPerColumn(Context.Database).Distinct();
|
||||
var constraint = keyConstraints
|
||||
.SingleOrDefault(x => x.Item1 == "cmsMacroProperty" && x.Item2 == "macroPropertyType" && x.Item3.InvariantStartsWith("PK_") == false);
|
||||
|
||||
+9
-21
@@ -31,15 +31,14 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
|
||||
Alter.Table("cmsTagRelationship").AddColumn("propertyTypeId").AsInt32().Nullable();
|
||||
|
||||
//drop the foreign key on umbracoNode. Must drop foreign key first before primary key can be removed in MySql.
|
||||
if (Context.CurrentDatabaseProvider != DatabaseProviders.SqlServer)
|
||||
if (Context.CurrentDatabaseProvider == DatabaseProviders.MySql)
|
||||
{
|
||||
Delete.ForeignKey().FromTable("cmsTagRelationship").ForeignColumn("nodeId").ToTable("umbracoNode").PrimaryColumn("id");
|
||||
}
|
||||
else
|
||||
{
|
||||
//If we are on SQLServer, we need to delete constraints by name, older versions of umbraco did not name these key constraints
|
||||
// consistently so we need to look up the constraint name to delete, this only pertains to SQL Server and this issue:
|
||||
// http://issues.umbraco.org/issue/U4-4133
|
||||
//Before we try to delete this constraint, we'll see if it exists first, some older schemas never had it and some older schema's had this named
|
||||
// differently than the default.
|
||||
|
||||
var constraint = constraints
|
||||
.SingleOrDefault(x => x.Item1 == "cmsTagRelationship" && x.Item2 == "nodeId" && x.Item3.InvariantStartsWith("PK_") == false);
|
||||
@@ -62,7 +61,12 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
|
||||
}
|
||||
else
|
||||
{
|
||||
Delete.PrimaryKey("PK_cmsTagRelationship").FromTable("cmsTagRelationship");
|
||||
//lookup the PK by name
|
||||
var pkName = constraints.FirstOrDefault(x => x.Item1.InvariantEquals("cmsTagRelationship") && x.Item3.InvariantStartsWith("PK_"));
|
||||
if (pkName != null)
|
||||
{
|
||||
Delete.PrimaryKey(pkName.Item3).FromTable("cmsTagRelationship");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -137,22 +141,6 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
|
||||
.OnDelete(Rule.None)
|
||||
.OnUpdate(Rule.None);
|
||||
|
||||
//Some very old schemas don't have an index on the cmsContent.nodeId column, I'm not actually sure when it was added but
|
||||
// it is absolutely required to exist in order to add this foreign key, so we'll need to check it's existence
|
||||
// this came to light from this issue: http://issues.umbraco.org/issue/U4-4133
|
||||
var dbIndexes = SqlSyntaxContext.SqlSyntaxProvider.GetDefinedIndexes(Context.Database)
|
||||
.Select(x => new DbIndexDefinition()
|
||||
{
|
||||
TableName = x.Item1,
|
||||
IndexName = x.Item2,
|
||||
ColumnName = x.Item3,
|
||||
IsUnique = x.Item4
|
||||
}).ToArray();
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsContent")) == false)
|
||||
{
|
||||
Create.Index("IX_cmsContent").OnTable("cmsContent").OnColumn("nodeId").Ascending().WithOptions().Unique();
|
||||
}
|
||||
|
||||
//now we need to add a foreign key to the nodeId column to cmsContent (intead of the original umbracoNode)
|
||||
Create.ForeignKey("FK_cmsTagRelationship_cmsContent")
|
||||
.FromTable("cmsTagRelationship")
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
|
||||
{
|
||||
/// <summary>
|
||||
/// I'm not actually sure how this is possible but I've come across one install that was missing these PKs
|
||||
/// and it wasn't a MySQL install.
|
||||
/// see: http://issues.umbraco.org/issue/U4-5707
|
||||
/// </summary>
|
||||
[Migration("7.0.0", 0, GlobalSettings.UmbracoMigrationName)]
|
||||
public class AssignMissingKeysAndIndexes : MigrationBase
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
|
||||
//Some very old schemas don't have an index on the cmsContent.nodeId column, I'm not actually sure when it was added but
|
||||
// it is absolutely required to exist in order to have it as a foreign key reference, so we'll need to check it's existence
|
||||
// this came to light from this issue: http://issues.umbraco.org/issue/U4-4133
|
||||
var dbIndexes = SqlSyntaxContext.SqlSyntaxProvider.GetDefinedIndexes(Context.Database)
|
||||
.Select(x => new DbIndexDefinition()
|
||||
{
|
||||
TableName = x.Item1,
|
||||
IndexName = x.Item2,
|
||||
ColumnName = x.Item3,
|
||||
IsUnique = x.Item4
|
||||
}).ToArray();
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsContent")) == false)
|
||||
{
|
||||
Create.Index("IX_cmsContent").OnTable("cmsContent").OnColumn("nodeId").Ascending().WithOptions().Unique();
|
||||
}
|
||||
|
||||
if (Context.CurrentDatabaseProvider == DatabaseProviders.SqlServer
|
||||
|| Context.CurrentDatabaseProvider == DatabaseProviders.SqlServerCE)
|
||||
{
|
||||
var constraints = SqlSyntaxContext.SqlSyntaxProvider.GetConstraintsPerColumn(Context.Database).Distinct().ToArray();
|
||||
|
||||
//This should be 2 because this table has 2 keys
|
||||
if (constraints.Count(x => x.Item1.InvariantEquals("cmsPreviewXml") && x.Item3.InvariantStartsWith("PK_")) == 0)
|
||||
{
|
||||
Create.PrimaryKey("PK_cmsContentPreviewXml")
|
||||
.OnTable("cmsPreviewXml")
|
||||
.Columns(new[] { "nodeId", "versionId" });
|
||||
}
|
||||
|
||||
if (constraints.Count(x => x.Item1.InvariantEquals("cmsTags") && x.Item3.InvariantStartsWith("PK_")) == 0)
|
||||
{
|
||||
Create.PrimaryKey("PK_cmsTags")
|
||||
.OnTable("cmsTags")
|
||||
.Columns(new[] { "id" });
|
||||
}
|
||||
|
||||
if (constraints.Count(x => x.Item1.InvariantEquals("cmsStylesheetProperty") && x.Item3.InvariantStartsWith("PK_")) == 0)
|
||||
{
|
||||
Create.PrimaryKey("PK_cmsStylesheetProperty")
|
||||
.OnTable("cmsStylesheetProperty")
|
||||
.Columns(new[] { "nodeId" });
|
||||
}
|
||||
|
||||
if (constraints.Count(x => x.Item1.InvariantEquals("cmsStylesheet") && x.Item3.InvariantStartsWith("PK_")) == 0)
|
||||
{
|
||||
Create.PrimaryKey("PK_cmsStylesheet")
|
||||
.OnTable("cmsStylesheet")
|
||||
.Columns(new[] { "nodeId" });
|
||||
|
||||
Create.ForeignKey("FK_cmsStylesheet_umbracoNode_id").FromTable("cmsStylesheet").ForeignColumn("nodeId")
|
||||
.ToTable("umbracoNode").PrimaryColumn("id").OnDeleteOrUpdate(Rule.None);
|
||||
}
|
||||
|
||||
if (constraints.Count(x => x.Item1.InvariantEquals("cmsMember") && x.Item3.InvariantStartsWith("PK_")) == 0)
|
||||
{
|
||||
Create.PrimaryKey("PK_cmsMember")
|
||||
.OnTable("cmsMember")
|
||||
.Columns(new[] { "nodeId" });
|
||||
|
||||
Create.ForeignKey("FK_cmsMember_umbracoNode_id").FromTable("cmsMember").ForeignColumn("nodeId")
|
||||
.ToTable("umbracoNode").PrimaryColumn("id").OnDeleteOrUpdate(Rule.None);
|
||||
|
||||
Create.ForeignKey("FK_cmsMember_cmsContent_nodeId").FromTable("cmsMember").ForeignColumn("nodeId")
|
||||
.ToTable("cmsContent").PrimaryColumn("nodeId").OnDeleteOrUpdate(Rule.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
//don't do anything, these keys should have always existed!
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero
|
||||
{
|
||||
[Migration("7.2.0", 3, GlobalSettings.UmbracoMigrationName)]
|
||||
public class AddIndexToUmbracoNodeTable : MigrationBase
|
||||
{
|
||||
private readonly bool _skipIndexCheck;
|
||||
|
||||
internal AddIndexToUmbracoNodeTable(bool skipIndexCheck)
|
||||
{
|
||||
_skipIndexCheck = skipIndexCheck;
|
||||
}
|
||||
|
||||
public AddIndexToUmbracoNodeTable()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
var dbIndexes = _skipIndexCheck ? new DbIndexDefinition[] { } : SqlSyntaxContext.SqlSyntaxProvider.GetDefinedIndexes(Context.Database)
|
||||
.Select(x => new DbIndexDefinition
|
||||
{
|
||||
TableName = x.Item1,
|
||||
IndexName = x.Item2,
|
||||
ColumnName = x.Item3,
|
||||
IsUnique = x.Item4
|
||||
}).ToArray();
|
||||
|
||||
//make sure it doesn't already exist
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID")) == false)
|
||||
{
|
||||
Create.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode").OnColumn("uniqueID").Ascending().WithOptions().NonClustered();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
Delete.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode");
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-3
@@ -1,3 +1,5 @@
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
@@ -11,9 +13,20 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
//To text
|
||||
var textType = SqlSyntaxContext.SqlSyntaxProvider.GetSpecialDbType(SpecialDbTypes.NTEXT);
|
||||
Alter.Table("cmsDataTypePreValues").AlterColumn("value").AsCustom(textType).Nullable();
|
||||
var columns = SqlSyntaxContext.SqlSyntaxProvider.GetColumnsInSchema(Context.Database).Distinct().ToArray();
|
||||
|
||||
//Check if it's already text
|
||||
if (columns.Any(x => x.ColumnName.InvariantEquals("value") && x.TableName.InvariantEquals("cmsDataTypePreValues")
|
||||
//mysql check
|
||||
&& (x.DataType.InvariantEquals("longtext") == false
|
||||
//sql server check
|
||||
&& x.DataType.InvariantEquals("ntext") == false)))
|
||||
{
|
||||
//To text
|
||||
var textType = SqlSyntaxContext.SqlSyntaxProvider.GetSpecialDbType(SpecialDbTypes.NTEXT);
|
||||
Alter.Table("cmsDataTypePreValues").AlterColumn("value").AsCustom(textType).Nullable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
|
||||
@@ -562,7 +562,14 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
object val = cmd.ExecuteScalarWithRetry();
|
||||
OnExecutedCommand(cmd);
|
||||
return (T)Convert.ChangeType(val, typeof(T));
|
||||
|
||||
if (val == null || val == DBNull.Value)
|
||||
return default(T);
|
||||
|
||||
Type t = typeof(T);
|
||||
Type u = Nullable.GetUnderlyingType(t);
|
||||
|
||||
return (T)Convert.ChangeType(val, u ?? t);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -843,7 +850,7 @@ namespace Umbraco.Core.Persistence
|
||||
public IEnumerable<T1> Query<T1, T2, T3, T4>(Sql sql) { return Query<T1>(new Type[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) }, null, sql.SQL, sql.Arguments); }
|
||||
|
||||
// Automagically guess the property relationships between various POCOs and create a delegate that will set them up
|
||||
object GetAutoMapper(Type[] types)
|
||||
Delegate GetAutoMapper(Type[] types)
|
||||
{
|
||||
// Build a key
|
||||
var kb = new StringBuilder();
|
||||
@@ -858,7 +865,7 @@ namespace Umbraco.Core.Persistence
|
||||
RWLock.EnterReadLock();
|
||||
try
|
||||
{
|
||||
object mapper;
|
||||
Delegate mapper;
|
||||
if (AutoMappers.TryGetValue(key, out mapper))
|
||||
return mapper;
|
||||
}
|
||||
@@ -872,7 +879,7 @@ namespace Umbraco.Core.Persistence
|
||||
try
|
||||
{
|
||||
// Try again
|
||||
object mapper;
|
||||
Delegate mapper;
|
||||
if (AutoMappers.TryGetValue(key, out mapper))
|
||||
return mapper;
|
||||
|
||||
@@ -945,22 +952,53 @@ namespace Umbraco.Core.Persistence
|
||||
throw new InvalidOperationException(string.Format("Couldn't find split point between {0} and {1}", typeThis, typeNext));
|
||||
}
|
||||
|
||||
|
||||
// Instance data used by the Multipoco factory delegate - essentially a list of the nested poco factories to call
|
||||
public class MultiPocoFactory
|
||||
{
|
||||
public List<Delegate> m_Delegates;
|
||||
public Delegate GetItem(int index) { return m_Delegates[index]; }
|
||||
|
||||
public MultiPocoFactory(IEnumerable<Delegate> dels)
|
||||
{
|
||||
Delegates = new List<Delegate>(dels);
|
||||
}
|
||||
private List<Delegate> Delegates { get; set; }
|
||||
private Delegate GetItem(int index) { return Delegates[index]; }
|
||||
|
||||
/// <summary>
|
||||
/// Calls the delegate at the specified index and returns its values
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="reader"></param>
|
||||
/// <returns></returns>
|
||||
private object CallDelegate(int index, IDataReader reader)
|
||||
{
|
||||
var d = GetItem(index);
|
||||
var output = d.DynamicInvoke(reader);
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls the callback delegate and passes in the output of all delegates as the parameters
|
||||
/// </summary>
|
||||
/// <typeparam name="TRet"></typeparam>
|
||||
/// <param name="callback"></param>
|
||||
/// <param name="dr"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <returns></returns>
|
||||
public TRet CallCallback<TRet>(Delegate callback, IDataReader dr, int count)
|
||||
{
|
||||
var args = new List<object>();
|
||||
for(var i = 0;i<count;i++)
|
||||
{
|
||||
args.Add(CallDelegate(i, dr));
|
||||
}
|
||||
return (TRet)callback.DynamicInvoke(args.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
// Create a multi-poco factory
|
||||
Func<IDataReader, object, TRet> CreateMultiPocoFactory<TRet>(Type[] types, string sql, IDataReader r)
|
||||
{
|
||||
var m = new DynamicMethod("petapoco_multipoco_factory", typeof(TRet), new Type[] { typeof(MultiPocoFactory), typeof(IDataReader), typeof(object) }, typeof(MultiPocoFactory));
|
||||
var il = m.GetILGenerator();
|
||||
|
||||
// Load the callback
|
||||
il.Emit(OpCodes.Ldarg_2);
|
||||
|
||||
Func<IDataReader, Delegate, TRet> CreateMultiPocoFactory<TRet>(Type[] types, string sql, IDataReader r)
|
||||
{
|
||||
// Call each delegate
|
||||
var dels = new List<Delegate>();
|
||||
int pos = 0;
|
||||
@@ -969,33 +1007,19 @@ namespace Umbraco.Core.Persistence
|
||||
// Add to list of delegates to call
|
||||
var del = FindSplitPoint(types[i], i + 1 < types.Length ? types[i + 1] : null, sql, r, ref pos);
|
||||
dels.Add(del);
|
||||
|
||||
// Get the delegate
|
||||
il.Emit(OpCodes.Ldarg_0); // callback,this
|
||||
il.Emit(OpCodes.Ldc_I4, i); // callback,this,Index
|
||||
il.Emit(OpCodes.Callvirt, typeof(MultiPocoFactory).GetMethod("GetItem")); // callback,Delegate
|
||||
il.Emit(OpCodes.Ldarg_1); // callback,delegate, datareader
|
||||
|
||||
// Call Invoke
|
||||
var tDelInvoke = del.GetType().GetMethod("Invoke");
|
||||
il.Emit(OpCodes.Callvirt, tDelInvoke); // Poco left on stack
|
||||
}
|
||||
|
||||
// By now we should have the callback and the N pocos all on the stack. Call the callback and we're done
|
||||
il.Emit(OpCodes.Callvirt, Expression.GetFuncType(types.Concat(new Type[] { typeof(TRet) }).ToArray()).GetMethod("Invoke"));
|
||||
il.Emit(OpCodes.Ret);
|
||||
|
||||
// Finish up
|
||||
return (Func<IDataReader, object, TRet>)m.CreateDelegate(typeof(Func<IDataReader, object, TRet>), new MultiPocoFactory() { m_Delegates = dels });
|
||||
var mpFactory = new MultiPocoFactory(dels);
|
||||
return (reader, arg3) => mpFactory.CallCallback<TRet>(arg3, reader, types.Length);
|
||||
}
|
||||
|
||||
// Various cached stuff
|
||||
static Dictionary<string, object> MultiPocoFactories = new Dictionary<string, object>();
|
||||
static Dictionary<string, object> AutoMappers = new Dictionary<string, object>();
|
||||
static Dictionary<string, Delegate> AutoMappers = new Dictionary<string, Delegate>();
|
||||
static System.Threading.ReaderWriterLockSlim RWLock = new System.Threading.ReaderWriterLockSlim();
|
||||
|
||||
// Get (or create) the multi-poco factory for a query
|
||||
Func<IDataReader, object, TRet> GetMultiPocoFactory<TRet>(Type[] types, string sql, IDataReader r)
|
||||
// Get (or create) the multi-poco factory for a query
|
||||
Func<IDataReader, Delegate, TRet> GetMultiPocoFactory<TRet>(Type[] types, string sql, IDataReader r)
|
||||
{
|
||||
// Build a key string (this is crap, should address this at some point)
|
||||
var kb = new StringBuilder();
|
||||
@@ -1017,7 +1041,10 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
object oFactory;
|
||||
if (MultiPocoFactories.TryGetValue(key, out oFactory))
|
||||
return (Func<IDataReader, object, TRet>)oFactory;
|
||||
{
|
||||
//mpFactory = oFactory;
|
||||
return (Func<IDataReader, Delegate, TRet>)oFactory;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1029,15 +1056,17 @@ namespace Umbraco.Core.Persistence
|
||||
try
|
||||
{
|
||||
// Check again
|
||||
object oFactory;
|
||||
object oFactory; ;
|
||||
if (MultiPocoFactories.TryGetValue(key, out oFactory))
|
||||
return (Func<IDataReader, object, TRet>)oFactory;
|
||||
{
|
||||
return (Func<IDataReader, Delegate, TRet>)oFactory;
|
||||
}
|
||||
|
||||
// Create the factory
|
||||
var factory = CreateMultiPocoFactory<TRet>(types, sql, r);
|
||||
|
||||
// Create the factory
|
||||
var Factory = CreateMultiPocoFactory<TRet>(types, sql, r);
|
||||
|
||||
MultiPocoFactories.Add(key, Factory);
|
||||
return Factory;
|
||||
MultiPocoFactories.Add(key, factory);
|
||||
return factory;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1047,7 +1076,7 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
|
||||
// Actual implementation of the multi-poco query
|
||||
public IEnumerable<TRet> Query<TRet>(Type[] types, object cb, string sql, params object[] args)
|
||||
public IEnumerable<TRet> Query<TRet>(Type[] types, Delegate cb, string sql, params object[] args)
|
||||
{
|
||||
OpenSharedConnection();
|
||||
try
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
@@ -24,11 +25,17 @@ namespace Umbraco.Core.Persistence
|
||||
public static Sql Where<T>(this Sql sql, Expression<Func<T, bool>> predicate)
|
||||
{
|
||||
var expresionist = new PocoToSqlExpressionHelper<T>();
|
||||
string whereExpression = expresionist.Visit(predicate);
|
||||
|
||||
var whereExpression = expresionist.Visit(predicate);
|
||||
return sql.Where(whereExpression, expresionist.GetSqlParameters());
|
||||
}
|
||||
|
||||
public static Sql WhereIn<T>(this Sql sql, Expression<Func<T, object>> fieldSelector, IEnumerable values)
|
||||
{
|
||||
var expresionist = new PocoToSqlExpressionHelper<T>();
|
||||
var fieldExpression = expresionist.Visit(fieldSelector);
|
||||
return sql.Where(fieldExpression + " IN (@values)", new {@values = values});
|
||||
}
|
||||
|
||||
public static Sql OrderBy<TColumn>(this Sql sql, Expression<Func<TColumn, object>> columnMember)
|
||||
{
|
||||
var column = ExpressionHelper.FindProperty(columnMember) as PropertyInfo;
|
||||
|
||||
@@ -728,7 +728,6 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
Func<Tuple<string, object[]>> filterCallback = () => new Tuple<string, object[]>(sbWhere.ToString(), args.ToArray());
|
||||
|
||||
|
||||
return GetPagedResultsByQuery<DocumentDto, Content>(query, pageIndex, pageSize, out totalRecords,
|
||||
new Tuple<string, string>("cmsDocument", "nodeId"),
|
||||
ProcessQuery, orderBy, orderDirection,
|
||||
|
||||
@@ -375,16 +375,15 @@ AND umbracoNode.id <> @id",
|
||||
var existing = existingByIds.FirstOrDefault(valueDto => valueDto.Id == pre.Value.Id);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.Value = pre.Value.Value;
|
||||
existing.SortOrder = sortOrder;
|
||||
_preValRepository.AddOrUpdate(new PreValueEntity
|
||||
{
|
||||
//setting an id will update it
|
||||
Id = existing.Id,
|
||||
Alias = existing.Alias,
|
||||
SortOrder = existing.SortOrder,
|
||||
Value = existing.Value,
|
||||
DataType = dataType,
|
||||
//These are the new values to update
|
||||
Alias = pre.Key,
|
||||
SortOrder = sortOrder,
|
||||
Value = pre.Value.Value
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -308,7 +308,11 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
IEnumerable<TEntity> result;
|
||||
var pagedResult = Database.Page<TDto>(pageIndex + 1, pageSize, sqlNodeIdsWithSort);
|
||||
totalRecords = Convert.ToInt32(pagedResult.TotalItems);
|
||||
if (totalRecords > 0)
|
||||
|
||||
//NOTE: We need to check the actual items returned, not the 'totalRecords', that is because if you request a page number
|
||||
// that doesn't actually have any data on it, the totalRecords will still indicate there are records but there are none in
|
||||
// the pageResult, then the GetAll will actually return ALL records in the db.
|
||||
if (pagedResult.Items.Any())
|
||||
{
|
||||
//Crete the inner paged query that was used above to get the paged result, we'll use that as the inner sub query
|
||||
var args = sqlNodeIdsWithSort.Arguments;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Umbraco.Core.Events;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Cache;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
@@ -15,15 +16,18 @@ namespace Umbraco.Core.Services
|
||||
internal class ApplicationTreeService : IApplicationTreeService
|
||||
{
|
||||
private readonly CacheHelper _cache;
|
||||
private IEnumerable<ApplicationTree> _allAvailableTrees;
|
||||
private volatile bool _isInitialized = false;
|
||||
internal const string TreeConfigFileName = "trees.config";
|
||||
private static string _treeConfig;
|
||||
private static readonly object Locker = new object();
|
||||
|
||||
public ApplicationTreeService(CacheHelper cache)
|
||||
{
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
internal const string TreeConfigFileName = "trees.config";
|
||||
private static string _treeConfig;
|
||||
private static readonly object Locker = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// gets/sets the trees.config file path
|
||||
@@ -45,74 +49,101 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The cache storage for all application trees
|
||||
/// The main entry point to get application trees
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This lazily on first access will scan for plugin trees and ensure the trees.config is up-to-date with the plugins. If plugins
|
||||
/// haven't changed on disk then the file will not be saved. The trees are all then loaded from this config file into cache and returned.
|
||||
/// </remarks>
|
||||
private List<ApplicationTree> GetAppTrees()
|
||||
{
|
||||
return _cache.GetCacheItem(
|
||||
return _cache.RuntimeCache.GetCacheItem<List<ApplicationTree>>(
|
||||
CacheKeys.ApplicationTreeCacheKey,
|
||||
() =>
|
||||
{
|
||||
var list = ReadFromXmlAndSort();
|
||||
|
||||
//On first access we need to do some initialization
|
||||
if (_isInitialized == false)
|
||||
{
|
||||
var list = new List<ApplicationTree>();
|
||||
|
||||
LoadXml(doc =>
|
||||
lock (Locker)
|
||||
{
|
||||
if (_isInitialized == false)
|
||||
{
|
||||
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
|
||||
{
|
||||
var sortOrderAttr = x.Attribute("sortOrder");
|
||||
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
|
||||
}))
|
||||
//now we can check the non-volatile flag
|
||||
if (_allAvailableTrees != null)
|
||||
{
|
||||
var applicationAlias = (string) addElement.Attribute("application");
|
||||
var type = (string) addElement.Attribute("type");
|
||||
var assembly = (string) addElement.Attribute("assembly");
|
||||
var hasChanges = false;
|
||||
|
||||
var clrType = Type.GetType(type);
|
||||
if (clrType == null)
|
||||
LoadXml(doc =>
|
||||
{
|
||||
LogHelper.Warn<ApplicationTreeService>("The tree definition: " + addElement.ToString() + " could not be resolved to a .Net object type");
|
||||
continue;
|
||||
}
|
||||
//Now, load in the xml structure and update it with anything that is not declared there and save the file.
|
||||
|
||||
//check if the tree definition (applicationAlias + type + assembly) is already in the list
|
||||
//NOTE: On the first iteration here, it will lazily scan all trees, etc... this is because this ienumerable is lazy
|
||||
// based on the ApplicationTreeRegistrar - and as noted there this is not an ideal way to do things but were stuck like this
|
||||
// currently because of the legacy assemblies and types not in the Core.
|
||||
|
||||
if (list.Any(tree => tree.ApplicationAlias.InvariantEquals(applicationAlias) && tree.GetRuntimeType() == clrType) == false)
|
||||
//Get all the trees not registered in the config
|
||||
var unregistered = _allAvailableTrees
|
||||
.Where(x => list.Any(l => l.Alias == x.Alias) == false)
|
||||
.ToArray();
|
||||
|
||||
hasChanges = unregistered.Any();
|
||||
|
||||
if (hasChanges == false) return false;
|
||||
|
||||
//add the unregistered ones to the list and re-save the file if any changes were found
|
||||
var count = 0;
|
||||
foreach (var tree in unregistered)
|
||||
{
|
||||
doc.Root.Add(new XElement("add",
|
||||
new XAttribute("initialize", tree.Initialize),
|
||||
new XAttribute("sortOrder", tree.SortOrder),
|
||||
new XAttribute("alias", tree.Alias),
|
||||
new XAttribute("application", tree.ApplicationAlias),
|
||||
new XAttribute("title", tree.Title),
|
||||
new XAttribute("iconClosed", tree.IconClosed),
|
||||
new XAttribute("iconOpen", tree.IconOpened),
|
||||
new XAttribute("type", tree.Type)));
|
||||
count++;
|
||||
}
|
||||
|
||||
//don't save if there's no changes
|
||||
return count > 0;
|
||||
}, true);
|
||||
|
||||
if (hasChanges)
|
||||
{
|
||||
list.Add(new ApplicationTree(
|
||||
addElement.Attribute("initialize") == null || Convert.ToBoolean(addElement.Attribute("initialize").Value),
|
||||
addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte) 0,
|
||||
addElement.Attribute("application").Value,
|
||||
addElement.Attribute("alias").Value,
|
||||
addElement.Attribute("title").Value,
|
||||
addElement.Attribute("iconClosed").Value,
|
||||
addElement.Attribute("iconOpen").Value,
|
||||
addElement.Attribute("type").Value));
|
||||
//If there were changes, we need to re-read the structures from the XML
|
||||
list = ReadFromXmlAndSort();
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
return list;
|
||||
});
|
||||
_isInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void Intitialize(IEnumerable<ApplicationTree> existingTrees)
|
||||
/// <summary>
|
||||
/// Initializes the service with any trees found in plugins
|
||||
/// </summary>
|
||||
/// <param name="allAvailableTrees">
|
||||
/// A collection of all available tree found in assemblies in the application
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// This will update the trees.config with the found tree plugins that are not currently listed in the file when the first
|
||||
/// access is made to resolve the tree collection
|
||||
/// </remarks>
|
||||
public void Intitialize(IEnumerable<ApplicationTree> allAvailableTrees)
|
||||
{
|
||||
LoadXml(doc =>
|
||||
{
|
||||
foreach (var tree in existingTrees)
|
||||
{
|
||||
doc.Root.Add(new XElement("add",
|
||||
new XAttribute("initialize", tree.Initialize),
|
||||
new XAttribute("sortOrder", tree.SortOrder),
|
||||
new XAttribute("alias", tree.Alias),
|
||||
new XAttribute("application", tree.ApplicationAlias),
|
||||
new XAttribute("title", tree.Title),
|
||||
new XAttribute("iconClosed", tree.IconClosed),
|
||||
new XAttribute("iconOpen", tree.IconOpened),
|
||||
new XAttribute("type", tree.Type)));
|
||||
}
|
||||
|
||||
}, true);
|
||||
_allAvailableTrees = allAvailableTrees;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -134,16 +165,19 @@ namespace Umbraco.Core.Services
|
||||
|
||||
if (el == null)
|
||||
{
|
||||
doc.Root.Add(new XElement("add",
|
||||
new XAttribute("initialize", initialize),
|
||||
new XAttribute("sortOrder", sortOrder),
|
||||
new XAttribute("alias", alias),
|
||||
new XAttribute("application", applicationAlias),
|
||||
new XAttribute("title", title),
|
||||
new XAttribute("iconClosed", iconClosed),
|
||||
new XAttribute("iconOpen", iconOpened),
|
||||
new XAttribute("type", type)));
|
||||
doc.Root.Add(new XElement("add",
|
||||
new XAttribute("initialize", initialize),
|
||||
new XAttribute("sortOrder", sortOrder),
|
||||
new XAttribute("alias", alias),
|
||||
new XAttribute("application", applicationAlias),
|
||||
new XAttribute("title", title),
|
||||
new XAttribute("iconClosed", iconClosed),
|
||||
new XAttribute("iconOpen", iconOpened),
|
||||
new XAttribute("type", type)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, true);
|
||||
|
||||
OnNew(new ApplicationTree(initialize, sortOrder, applicationAlias, alias, title, iconClosed, iconOpened, type), new EventArgs());
|
||||
@@ -161,7 +195,7 @@ namespace Umbraco.Core.Services
|
||||
if (el != null)
|
||||
{
|
||||
el.RemoveAttributes();
|
||||
|
||||
|
||||
el.Add(new XAttribute("initialize", tree.Initialize));
|
||||
el.Add(new XAttribute("sortOrder", tree.SortOrder));
|
||||
el.Add(new XAttribute("alias", tree.Alias));
|
||||
@@ -172,6 +206,8 @@ namespace Umbraco.Core.Services
|
||||
el.Add(new XAttribute("type", tree.Type));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, true);
|
||||
|
||||
OnUpdated(tree, new EventArgs());
|
||||
@@ -181,11 +217,16 @@ namespace Umbraco.Core.Services
|
||||
/// Deletes this instance.
|
||||
/// </summary>
|
||||
public void DeleteTree(ApplicationTree tree)
|
||||
{
|
||||
{
|
||||
LoadXml(doc =>
|
||||
{
|
||||
doc.Root.Elements("add").Where(x => x.Attribute("application") != null && x.Attribute("application").Value == tree.ApplicationAlias &&
|
||||
x.Attribute("alias") != null && x.Attribute("alias").Value == tree.Alias).Remove();
|
||||
doc.Root.Elements("add")
|
||||
.Where(x => x.Attribute("application") != null
|
||||
&& x.Attribute("application").Value == tree.ApplicationAlias
|
||||
&& x.Attribute("alias") != null && x.Attribute("alias").Value == tree.Alias).Remove();
|
||||
|
||||
return true;
|
||||
|
||||
}, true);
|
||||
|
||||
OnDeleted(tree, new EventArgs());
|
||||
@@ -231,31 +272,44 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
var list = GetAppTrees().FindAll(
|
||||
t =>
|
||||
{
|
||||
if (onlyInitialized)
|
||||
return (t.ApplicationAlias == applicationAlias && t.Initialize);
|
||||
return (t.ApplicationAlias == applicationAlias);
|
||||
}
|
||||
{
|
||||
if (onlyInitialized)
|
||||
return (t.ApplicationAlias == applicationAlias && t.Initialize);
|
||||
return (t.ApplicationAlias == applicationAlias);
|
||||
}
|
||||
);
|
||||
|
||||
return list.OrderBy(x => x.SortOrder).ToArray();
|
||||
}
|
||||
|
||||
internal void LoadXml(Action<XDocument> callback, bool saveAfterCallback)
|
||||
/// <summary>
|
||||
/// Loads in the xml structure from disk if one is found, otherwise loads in an empty xml structure, calls the
|
||||
/// callback with the xml document and saves the structure back to disk if saveAfterCallback is true.
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
/// <param name="saveAfterCallbackIfChanges"></param>
|
||||
internal void LoadXml(Func<XDocument, bool> callback, bool saveAfterCallbackIfChanges)
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
var doc = File.Exists(TreeConfigFilePath)
|
||||
? XDocument.Load(TreeConfigFilePath)
|
||||
: XDocument.Parse("<?xml version=\"1.0\"?><trees />");
|
||||
|
||||
if (doc.Root != null)
|
||||
{
|
||||
callback.Invoke(doc);
|
||||
var hasChanges = callback.Invoke(doc);
|
||||
|
||||
if (saveAfterCallback)
|
||||
if (saveAfterCallbackIfChanges && hasChanges
|
||||
//Don't save it if it is empty, in some very rare cases if the app domain get's killed in the middle of this process
|
||||
// in some insane way the file saved will be empty. I'm pretty sure it's not actually anything to do with the xml doc and
|
||||
// more about the IO trying to save the XML doc, but it doesn't hurt to check.
|
||||
&& doc.Root != null && doc.Root.Elements().Any())
|
||||
{
|
||||
//ensures the folder exists
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(TreeConfigFilePath));
|
||||
|
||||
//saves it
|
||||
doc.Save(TreeConfigFilePath);
|
||||
|
||||
//remove the cache now that it has changed SD: I'm leaving this here even though it
|
||||
@@ -266,6 +320,54 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
private List<ApplicationTree> ReadFromXmlAndSort()
|
||||
{
|
||||
var list = new List<ApplicationTree>();
|
||||
|
||||
//read in the xml file containing trees and convert them all to ApplicationTree instances
|
||||
LoadXml(doc =>
|
||||
{
|
||||
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
|
||||
{
|
||||
var sortOrderAttr = x.Attribute("sortOrder");
|
||||
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
|
||||
}))
|
||||
{
|
||||
var applicationAlias = (string)addElement.Attribute("application");
|
||||
var type = (string)addElement.Attribute("type");
|
||||
var assembly = (string)addElement.Attribute("assembly");
|
||||
|
||||
var clrType = Type.GetType(type);
|
||||
if (clrType == null)
|
||||
{
|
||||
LogHelper.Warn<ApplicationTreeService>("The tree definition: " + addElement.ToString() + " could not be resolved to a .Net object type");
|
||||
continue;
|
||||
}
|
||||
|
||||
//check if the tree definition (applicationAlias + type + assembly) is already in the list
|
||||
|
||||
if (list.Any(tree => tree.ApplicationAlias.InvariantEquals(applicationAlias) && tree.GetRuntimeType() == clrType) == false)
|
||||
{
|
||||
list.Add(new ApplicationTree(
|
||||
addElement.Attribute("initialize") == null || Convert.ToBoolean(addElement.Attribute("initialize").Value),
|
||||
addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte)0,
|
||||
addElement.Attribute("application").Value,
|
||||
addElement.Attribute("alias").Value,
|
||||
addElement.Attribute("title").Value,
|
||||
addElement.Attribute("iconClosed").Value,
|
||||
addElement.Attribute("iconOpen").Value,
|
||||
addElement.Attribute("type").Value));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}, false);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
internal static event TypedEventHandler<ApplicationTree, EventArgs> Deleted;
|
||||
private static void OnDeleted(ApplicationTree app, EventArgs args)
|
||||
{
|
||||
|
||||
@@ -507,7 +507,7 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var query = Query<IContent>.Builder;
|
||||
//if the id is -1, then just get all
|
||||
if (id > 0)
|
||||
if (id != -1)
|
||||
{
|
||||
query.Where(x => x.ParentId == id);
|
||||
}
|
||||
@@ -537,7 +537,7 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var query = Query<IContent>.Builder;
|
||||
//if the id is -1, then just get all
|
||||
if (id > 0)
|
||||
if (id != -1)
|
||||
{
|
||||
query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
|
||||
}
|
||||
|
||||
@@ -200,8 +200,22 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="userId">Id of the user issueing the save</param>
|
||||
public void Save(IEnumerable<IDataTypeDefinition> dataTypeDefinitions, int userId = 0)
|
||||
{
|
||||
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions), this))
|
||||
return;
|
||||
Save(dataTypeDefinitions, userId, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="IDataTypeDefinition"/>
|
||||
/// </summary>
|
||||
/// <param name="dataTypeDefinitions"><see cref="IDataTypeDefinition"/> to save</param>
|
||||
/// <param name="userId">Id of the user issueing the save</param>
|
||||
/// <param name="raiseEvents">Boolean indicating whether or not to raise events</param>
|
||||
public void Save(IEnumerable<IDataTypeDefinition> dataTypeDefinitions, int userId, bool raiseEvents)
|
||||
{
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions), this))
|
||||
return;
|
||||
}
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateDataTypeDefinitionRepository(uow))
|
||||
@@ -213,7 +227,8 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
uow.Commit();
|
||||
|
||||
Saved.RaiseEvent(new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions, false), this);
|
||||
if (raiseEvents)
|
||||
Saved.RaiseEvent(new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions, false), this);
|
||||
}
|
||||
|
||||
Audit.Add(AuditTypes.Save, string.Format("Save DataTypeDefinition performed by user"), userId, -1);
|
||||
@@ -229,30 +244,27 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
//TODO: Should we raise an event here since we are really saving values for the data type?
|
||||
|
||||
using (new WriteLock(Locker))
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
using (var transaction = uow.Database.GetTransaction())
|
||||
{
|
||||
using (var transaction = uow.Database.GetTransaction())
|
||||
var sortOrderObj =
|
||||
uow.Database.ExecuteScalar<object>(
|
||||
"SELECT max(sortorder) FROM cmsDataTypePreValues WHERE datatypeNodeId = @DataTypeId", new { DataTypeId = dataTypeId });
|
||||
int sortOrder;
|
||||
if (sortOrderObj == null || int.TryParse(sortOrderObj.ToString(), out sortOrder) == false)
|
||||
{
|
||||
var sortOrderObj =
|
||||
uow.Database.ExecuteScalar<object>(
|
||||
"SELECT max(sortorder) FROM cmsDataTypePreValues WHERE datatypeNodeId = @DataTypeId", new { DataTypeId = dataTypeId });
|
||||
int sortOrder;
|
||||
if (sortOrderObj == null || int.TryParse(sortOrderObj.ToString(), out sortOrder) == false)
|
||||
{
|
||||
sortOrder = 1;
|
||||
}
|
||||
|
||||
foreach (var value in values)
|
||||
{
|
||||
var dto = new DataTypePreValueDto { DataTypeNodeId = dataTypeId, Value = value, SortOrder = sortOrder };
|
||||
uow.Database.Insert(dto);
|
||||
sortOrder++;
|
||||
}
|
||||
|
||||
transaction.Complete();
|
||||
sortOrder = 1;
|
||||
}
|
||||
|
||||
foreach (var value in values)
|
||||
{
|
||||
var dto = new DataTypePreValueDto { DataTypeNodeId = dataTypeId, Value = value, SortOrder = sortOrder };
|
||||
uow.Database.Insert(dto);
|
||||
sortOrder++;
|
||||
}
|
||||
|
||||
transaction.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,9 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
var tab = new XElement("Tab",
|
||||
new XElement("Id", propertyGroup.Id.ToString(CultureInfo.InvariantCulture)),
|
||||
new XElement("Caption", propertyGroup.Name));
|
||||
new XElement("Caption", propertyGroup.Name),
|
||||
new XElement("SortOrder", propertyGroup.SortOrder));
|
||||
|
||||
tabs.Add(tab);
|
||||
}
|
||||
|
||||
@@ -309,9 +311,17 @@ namespace Umbraco.Core.Services
|
||||
new XElement("AllowAtRoot", contentType.AllowedAsRoot.ToString()),
|
||||
new XElement("IsListView", contentType.IsContainer.ToString()));
|
||||
|
||||
var masterContentType = contentType.CompositionAliases().FirstOrDefault();
|
||||
if (masterContentType != null)
|
||||
info.Add(new XElement("Master", masterContentType));
|
||||
var masterContentType = contentType.ContentTypeComposition.FirstOrDefault(x => x.Id == contentType.ParentId);
|
||||
if(masterContentType != null)
|
||||
info.Add(new XElement("Master", masterContentType.Alias));
|
||||
|
||||
var compositionsElement = new XElement("Compositions");
|
||||
var compositions = contentType.ContentTypeComposition;
|
||||
foreach (var composition in compositions)
|
||||
{
|
||||
compositionsElement.Add(new XElement("Composition", composition.Alias));
|
||||
}
|
||||
info.Add(compositionsElement);
|
||||
|
||||
var allowedTemplates = new XElement("AllowedTemplates");
|
||||
foreach (var template in contentType.AllowedTemplates)
|
||||
@@ -319,6 +329,7 @@ namespace Umbraco.Core.Services
|
||||
allowedTemplates.Add(new XElement("Template", template.Alias));
|
||||
}
|
||||
info.Add(allowedTemplates);
|
||||
|
||||
if (contentType.DefaultTemplate != null && contentType.DefaultTemplate.Id != 0)
|
||||
info.Add(new XElement("DefaultTemplate", contentType.DefaultTemplate.Alias));
|
||||
else
|
||||
@@ -356,7 +367,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
var tab = new XElement("Tab",
|
||||
new XElement("Id", propertyGroup.Id.ToString(CultureInfo.InvariantCulture)),
|
||||
new XElement("Caption", propertyGroup.Name));
|
||||
new XElement("Caption", propertyGroup.Name),
|
||||
new XElement("SortOrder", propertyGroup.SortOrder));
|
||||
tabs.Add(tab);
|
||||
}
|
||||
|
||||
|
||||
@@ -391,10 +391,17 @@ namespace Umbraco.Core.Services
|
||||
internal IEnumerable<string> GetPartialViewSnippetNames(params string[] filterNames)
|
||||
{
|
||||
var snippetPath = IOHelper.MapPath(string.Format("{0}/PartialViewMacros/Templates/", SystemDirectories.Umbraco));
|
||||
return Directory.GetFiles(snippetPath, "*.cshtml")
|
||||
var files = Directory.GetFiles(snippetPath, "*.cshtml")
|
||||
.Select(Path.GetFileNameWithoutExtension)
|
||||
.Except(filterNames, StringComparer.InvariantCultureIgnoreCase)
|
||||
.ToArray();
|
||||
|
||||
//Ensure the ones that are called 'Empty' are at the top
|
||||
var empty = files.Where(x => Path.GetFileName(x).InvariantStartsWith("Empty"))
|
||||
.OrderBy(x => x.Length)
|
||||
.ToArray();
|
||||
|
||||
return empty.Union(files.Except(empty));
|
||||
}
|
||||
|
||||
internal void DeletePartialViewFolder(string folderPath)
|
||||
@@ -515,7 +522,10 @@ namespace Umbraco.Core.Services
|
||||
.ToFirstUpperInvariant()
|
||||
.ToSafeAlias(false);
|
||||
|
||||
repository.AddOrUpdate(new Macro(name, name) { ScriptPath = partialView.Path });
|
||||
//The partial view path to be saved with the macro must be a fully qualified virtual path
|
||||
var virtualPath = string.Format("{0}/{1}/{2}", SystemDirectories.MvcViews, "MacroPartials", partialView.Path);
|
||||
|
||||
repository.AddOrUpdate(new Macro(name, name) { ScriptPath = virtualPath });
|
||||
}
|
||||
|
||||
//commit both - ensure that the macro is created if one was added
|
||||
|
||||
@@ -5,7 +5,17 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
public interface IApplicationTreeService
|
||||
{
|
||||
void Intitialize(IEnumerable<ApplicationTree> existingTrees);
|
||||
/// <summary>
|
||||
/// Initializes the service with any trees found in plugins
|
||||
/// </summary>
|
||||
/// <param name="allAvailableTrees">
|
||||
/// A collection of all available tree found in assemblies in the application
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// This will update the trees.config with the found tree plugins that are not currently listed in the file when the first
|
||||
/// access is made to resolve the tree collection
|
||||
/// </remarks>
|
||||
void Intitialize(IEnumerable<ApplicationTree> allAvailableTrees);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new application tree.
|
||||
|
||||
@@ -52,6 +52,14 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="userId">Id of the user issueing the save</param>
|
||||
void Save(IEnumerable<IDataTypeDefinition> dataTypeDefinitions, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="IDataTypeDefinition"/>
|
||||
/// </summary>
|
||||
/// <param name="dataTypeDefinitions"><see cref="IDataTypeDefinition"/> to save</param>
|
||||
/// <param name="userId">Id of the user issueing the save</param>
|
||||
/// <param name="raiseEvents">Boolean indicating whether or not to raise events</param>
|
||||
void Save(IEnumerable<IDataTypeDefinition> dataTypeDefinitions, int userId, bool raiseEvents);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an <see cref="IDataTypeDefinition"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -6,10 +6,15 @@ namespace Umbraco.Core.Services
|
||||
public interface ISectionService
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures all available sections exist in the storage medium
|
||||
/// Initializes the service with all available application plugins
|
||||
/// </summary>
|
||||
/// <param name="existingSections"></param>
|
||||
void Initialize(IEnumerable<Section> existingSections);
|
||||
/// <param name="allAvailableSections">
|
||||
/// All application plugins found in assemblies
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// This is used to populate the app.config file with any applications declared in plugins that don't exist in the file
|
||||
/// </remarks>
|
||||
void Initialize(IEnumerable<Section> allAvailableSections);
|
||||
|
||||
/// <summary>
|
||||
/// The cache storage for all applications
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
var query = Query<IMedia>.Builder;
|
||||
//if the id is -1, then just get all
|
||||
if (id > 0)
|
||||
if (id != -1)
|
||||
{
|
||||
query.Where(x => x.ParentId == id);
|
||||
}
|
||||
@@ -443,7 +443,7 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var query = Query<IMedia>.Builder;
|
||||
//if the id is -1, then just get all
|
||||
if (id > 0)
|
||||
if (id != -1)
|
||||
{
|
||||
query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Umbraco.Core.Services
|
||||
public XElement Export(IContent content, bool deep = false, bool raiseEvents = true)
|
||||
{
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (ExportingContent.IsRaisedEventCancelled(new ExportEventArgs<IContent>(content, nodeName), this))
|
||||
@@ -86,13 +86,13 @@ namespace Umbraco.Core.Services
|
||||
var exporter = new EntityXmlSerializer();
|
||||
var xml = exporter.Serialize(_contentService, _dataTypeService, _userService, content, deep);
|
||||
|
||||
if(raiseEvents)
|
||||
if (raiseEvents)
|
||||
ExportedContent.RaiseEvent(new ExportEventArgs<IContent>(content, xml, false), this);
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Imports and saves package xml as <see cref="IContent"/>
|
||||
@@ -109,7 +109,7 @@ namespace Umbraco.Core.Services
|
||||
if (ImportingContent.IsRaisedEventCancelled(new ImportEventArgs<IContent>(element), this))
|
||||
return Enumerable.Empty<IContent>();
|
||||
}
|
||||
|
||||
|
||||
var name = element.Name.LocalName;
|
||||
if (name.Equals("DocumentSet"))
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace Umbraco.Core.Services
|
||||
if (contents.Any())
|
||||
_contentService.Save(contents, userId);
|
||||
|
||||
if(raiseEvents)
|
||||
if (raiseEvents)
|
||||
ImportedContent.RaiseEvent(new ImportEventArgs<IContent>(contents, element, false), this);
|
||||
return contents;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ namespace Umbraco.Core.Services
|
||||
if (contents.Any())
|
||||
_contentService.Save(contents, userId);
|
||||
|
||||
if(raiseEvents)
|
||||
if (raiseEvents)
|
||||
ImportedContent.RaiseEvent(new ImportEventArgs<IContent>(contents, element, false), this);
|
||||
return contents;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ namespace Umbraco.Core.Services
|
||||
|
||||
//TODO: We need to refactor this so the packager isn't making direct db calls for an 'edge' case
|
||||
var database = ApplicationContext.Current.DatabaseContext.Database;
|
||||
var dtos = database.Fetch<DataTypePreValueDto>("WHERE datatypeNodeId = @Id", new {Id = propertyType.DataTypeDefinitionId});
|
||||
var dtos = database.Fetch<DataTypePreValueDto>("WHERE datatypeNodeId = @Id", new { Id = propertyType.DataTypeDefinitionId });
|
||||
|
||||
var propertyValueList = new List<string>();
|
||||
foreach (var preValue in propertyValue.Split(','))
|
||||
@@ -332,11 +332,62 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
_importedContentTypes = new Dictionary<string, IContentType>();
|
||||
var documentTypes = name.Equals("DocumentTypes")
|
||||
var unsortedDocumentTypes = name.Equals("DocumentTypes")
|
||||
? (from doc in element.Elements("DocumentType") select doc).ToList()
|
||||
: new List<XElement> { element };
|
||||
//NOTE it might be an idea to sort the doctype XElements based on dependencies
|
||||
//before creating the doc types - should also allow for a better structure/inheritance support.
|
||||
|
||||
//When you are importing a single doc type we have to assume that the depedencies are already there.
|
||||
//Otherwise something like uSync won't work.
|
||||
var fields = new List<TopologicalSorter.DependencyField<XElement>>();
|
||||
var isSingleDocTypeImport = unsortedDocumentTypes.Count == 1;
|
||||
if (isSingleDocTypeImport == false)
|
||||
{
|
||||
//NOTE Here we sort the doctype XElements based on dependencies
|
||||
//before creating the doc types - this should also allow for a better structure/inheritance support.
|
||||
foreach (var documentType in unsortedDocumentTypes)
|
||||
{
|
||||
var elementCopy = documentType;
|
||||
var infoElement = elementCopy.Element("Info");
|
||||
var dependencies = new List<string>();
|
||||
|
||||
//Add the Master as a dependency
|
||||
if (elementCopy.Element("Master") != null &&
|
||||
string.IsNullOrEmpty(elementCopy.Element("Master").Value) == false)
|
||||
{
|
||||
dependencies.Add(elementCopy.Element("Master").Value);
|
||||
}
|
||||
|
||||
//Add compositions as dependencies
|
||||
var compositionsElement = infoElement.Element("Compositions");
|
||||
if (compositionsElement != null && compositionsElement.HasElements)
|
||||
{
|
||||
var compositions = compositionsElement.Elements("Composition");
|
||||
if (compositions.Any())
|
||||
{
|
||||
foreach (var composition in compositions)
|
||||
{
|
||||
dependencies.Add(composition.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var field = new TopologicalSorter.DependencyField<XElement>
|
||||
{
|
||||
Alias = infoElement.Element("Alias").Value,
|
||||
Item = new Lazy<XElement>(() => elementCopy),
|
||||
DependsOn = dependencies.ToArray()
|
||||
};
|
||||
|
||||
fields.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
//Sorting the Document Types based on dependencies - if its not a single doc type import ref. #U4-5921
|
||||
var documentTypes = isSingleDocTypeImport
|
||||
? unsortedDocumentTypes.ToList()
|
||||
: TopologicalSorter.GetSortedItems(fields).ToList();
|
||||
|
||||
//Iterate the sorted document types and create them as IContentType objects
|
||||
foreach (var documentType in documentTypes)
|
||||
{
|
||||
var alias = documentType.Element("Info").Element("Alias").Value;
|
||||
@@ -349,9 +400,12 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
//Save the newly created/updated IContentType objects
|
||||
var list = _importedContentTypes.Select(x => x.Value).ToList();
|
||||
_contentTypeService.Save(list, userId);
|
||||
|
||||
//Now we can finish the import by updating the 'structure',
|
||||
//which requires the doc types to be saved/available in the db
|
||||
if (importStructure)
|
||||
{
|
||||
var updatedContentTypes = new List<IContentType>();
|
||||
@@ -392,15 +446,10 @@ namespace Umbraco.Core.Services
|
||||
: _contentTypeService.GetContentType(masterAlias);
|
||||
}
|
||||
|
||||
var alias = infoElement.Element("Alias").Value;
|
||||
var contentType = parent == null
|
||||
? new ContentType(-1)
|
||||
{
|
||||
Alias = infoElement.Element("Alias").Value
|
||||
}
|
||||
: new ContentType(parent)
|
||||
{
|
||||
Alias = infoElement.Element("Alias").Value
|
||||
};
|
||||
? new ContentType(-1) { Alias = alias }
|
||||
: new ContentType(parent, alias);
|
||||
|
||||
if (parent != null)
|
||||
contentType.AddContentType(parent);
|
||||
@@ -417,15 +466,47 @@ namespace Umbraco.Core.Services
|
||||
contentType.Icon = infoElement.Element("Icon").Value;
|
||||
contentType.Thumbnail = infoElement.Element("Thumbnail").Value;
|
||||
contentType.Description = infoElement.Element("Description").Value;
|
||||
|
||||
//NOTE AllowAtRoot is a new property in the package xml so we need to verify it exists before using it.
|
||||
var allowAtRoot = infoElement.Element("AllowAtRoot");
|
||||
if (allowAtRoot != null)
|
||||
contentType.AllowedAsRoot = allowAtRoot.Value.InvariantEquals("true");
|
||||
|
||||
//NOTE IsListView is a new property in the package xml so we need to verify it exists before using it.
|
||||
var isListView = infoElement.Element("IsListView");
|
||||
if (isListView != null)
|
||||
contentType.IsContainer = isListView.Value.InvariantEquals("true");
|
||||
|
||||
//Name of the master corresponds to the parent and we need to ensure that the Parent Id is set
|
||||
var masterElement = infoElement.Element("Master");
|
||||
if (masterElement != null)
|
||||
{
|
||||
var masterAlias = masterElement.Value;
|
||||
IContentType parent = _importedContentTypes.ContainsKey(masterAlias)
|
||||
? _importedContentTypes[masterAlias]
|
||||
: _contentTypeService.GetContentType(masterAlias);
|
||||
|
||||
contentType.SetLazyParentId(new Lazy<int>(() => parent.Id));
|
||||
}
|
||||
|
||||
//Update Compositions on the ContentType to ensure that they are as is defined in the package xml
|
||||
var compositionsElement = infoElement.Element("Compositions");
|
||||
if (compositionsElement != null && compositionsElement.HasElements)
|
||||
{
|
||||
var compositions = compositionsElement.Elements("Composition");
|
||||
if (compositions.Any())
|
||||
{
|
||||
foreach (var composition in compositions)
|
||||
{
|
||||
var compositionAlias = composition.Value;
|
||||
var compositionContentType = _importedContentTypes.ContainsKey(compositionAlias)
|
||||
? _importedContentTypes[compositionAlias]
|
||||
: _contentTypeService.GetContentType(compositionAlias);
|
||||
var added = contentType.AddContentType(compositionContentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateContentTypesAllowedTemplates(contentType, infoElement.Element("AllowedTemplates"), defaultTemplateElement);
|
||||
UpdateContentTypesTabs(contentType, documentType.Element("Tabs"));
|
||||
UpdateContentTypesProperties(contentType, documentType.Element("GenericProperties"));
|
||||
@@ -492,13 +573,13 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
contentType.AddPropertyGroup(caption);
|
||||
|
||||
int sortOrder;
|
||||
if(tab.Element("SortOrder") != null &&
|
||||
int.TryParse(tab.Element("SortOrder").Value, out sortOrder))
|
||||
{
|
||||
// Override the sort order with the imported value
|
||||
contentType.PropertyGroups[caption].SortOrder = sortOrder;
|
||||
}
|
||||
}
|
||||
|
||||
int sortOrder;
|
||||
if (tab.Element("SortOrder") != null && int.TryParse(tab.Element("SortOrder").Value, out sortOrder))
|
||||
{
|
||||
// Override the sort order with the imported value
|
||||
contentType.PropertyGroups[caption].SortOrder = sortOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -550,7 +631,7 @@ namespace Umbraco.Core.Services
|
||||
dataTypeDefinition = dataTypeDefinitions.First();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// For backwards compatibility, if no datatype with that ID can be found, we're letting this fail silently.
|
||||
// This means that the property will not be created.
|
||||
if (dataTypeDefinition == null)
|
||||
@@ -765,9 +846,15 @@ namespace Umbraco.Core.Services
|
||||
var list = dataTypes.Select(x => x.Value).ToList();
|
||||
if (list.Any())
|
||||
{
|
||||
_dataTypeService.Save(list, userId);
|
||||
//NOTE: As long as we have to deal with the two types of PreValue lists (with/without Keys)
|
||||
//this is a bit of a pain to handle while ensuring that the imported DataTypes has PreValues
|
||||
//place when triggering the save event.
|
||||
|
||||
SavePrevaluesFromXml(list, dataTypeElements);
|
||||
_dataTypeService.Save(list, userId, false);//Save without raising events
|
||||
|
||||
SavePrevaluesFromXml(list, dataTypeElements);//Save the PreValues for the current list of DataTypes
|
||||
|
||||
_dataTypeService.Save(list, userId, true);//Re-save and raise events
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
@@ -787,15 +874,15 @@ namespace Umbraco.Core.Services
|
||||
var dataTypeDefinition = dataTypes.First(x => x.Name == dataTypeDefinitionName);
|
||||
|
||||
var valuesWithoutKeys = prevaluesElement.Elements("PreValue")
|
||||
.Where(x => ((string) x.Attribute("Alias")).IsNullOrWhiteSpace())
|
||||
.Where(x => ((string)x.Attribute("Alias")).IsNullOrWhiteSpace())
|
||||
.Select(x => x.Attribute("Value").Value);
|
||||
|
||||
var valuesWithKeys = prevaluesElement.Elements("PreValue")
|
||||
.Where(x => ((string) x.Attribute("Alias")).IsNullOrWhiteSpace() == false)
|
||||
.Where(x => ((string)x.Attribute("Alias")).IsNullOrWhiteSpace() == false)
|
||||
.ToDictionary(
|
||||
key => (string) key.Attribute("Alias"),
|
||||
val => new PreValue((string) val.Attribute("Value")));
|
||||
|
||||
key => (string)key.Attribute("Alias"),
|
||||
val => new PreValue((string)val.Attribute("Value")));
|
||||
|
||||
//save the values with keys
|
||||
_dataTypeService.SavePreValues(dataTypeDefinition, valuesWithKeys);
|
||||
|
||||
@@ -842,7 +929,7 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var exporter = new EntityXmlSerializer();
|
||||
var xml = exporter.Serialize(dictionaryItem);
|
||||
|
||||
|
||||
if (includeChildren)
|
||||
{
|
||||
var children = _localizationService.GetDictionaryItemChildren(dictionaryItem.Key);
|
||||
@@ -1116,7 +1203,7 @@ namespace Umbraco.Core.Services
|
||||
dontRender = bool.Parse(dontRenderElement.Value);
|
||||
}
|
||||
|
||||
var existingMacro = _macroService.GetByAlias(macroAlias) as Macro;
|
||||
var existingMacro = _macroService.GetByAlias(macroAlias) as Macro;
|
||||
var macro = existingMacro ?? new Macro(macroAlias, macroName, controlType, controlAssembly, xsltPath, scriptPath,
|
||||
cacheByPage, cacheByMember, dontRender, useInEditor, cacheDuration);
|
||||
|
||||
@@ -1211,7 +1298,7 @@ namespace Umbraco.Core.Services
|
||||
public XElement Export(IMedia media, bool deep = false, bool raiseEvents = true)
|
||||
{
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (ExportingMedia.IsRaisedEventCancelled(new ExportEventArgs<IMedia>(media, nodeName), this))
|
||||
@@ -1221,7 +1308,7 @@ namespace Umbraco.Core.Services
|
||||
var exporter = new EntityXmlSerializer();
|
||||
var xml = exporter.Serialize(_mediaService, _dataTypeService, _userService, media, deep);
|
||||
|
||||
if(raiseEvents)
|
||||
if (raiseEvents)
|
||||
ExportedMedia.RaiseEvent(new ExportEventArgs<IMedia>(media, xml, false), this);
|
||||
|
||||
return xml;
|
||||
@@ -1335,7 +1422,7 @@ namespace Umbraco.Core.Services
|
||||
if (templates.Any())
|
||||
_fileService.SaveTemplate(templates, userId);
|
||||
|
||||
if(raiseEvents)
|
||||
if (raiseEvents)
|
||||
ImportedTemplate.RaiseEvent(new ImportEventArgs<ITemplate>(templates, element, false), this);
|
||||
|
||||
return templates;
|
||||
@@ -1353,10 +1440,10 @@ namespace Umbraco.Core.Services
|
||||
|
||||
IEnumerable<IFile> styleSheets = Enumerable.Empty<IFile>();
|
||||
|
||||
if(element.Elements().Any())
|
||||
if (element.Elements().Any())
|
||||
throw new NotImplementedException("This needs to be implimentet");
|
||||
|
||||
|
||||
|
||||
if (raiseEvents)
|
||||
ImportingStylesheets.RaiseEvent(new ImportEventArgs<IFile>(styleSheets, element, false), this);
|
||||
|
||||
@@ -1481,7 +1568,7 @@ namespace Umbraco.Core.Services
|
||||
/// </summary>
|
||||
public static event TypedEventHandler<IPackagingService, ImportEventArgs<IContent>> ImportedContent;
|
||||
|
||||
|
||||
|
||||
public static event TypedEventHandler<IPackagingService, ExportEventArgs<IContent>> ExportingContent;
|
||||
|
||||
/// <summary>
|
||||
@@ -1608,7 +1695,7 @@ namespace Umbraco.Core.Services
|
||||
/// Occurs before Importing Stylesheets
|
||||
/// </summary>
|
||||
public static event TypedEventHandler<IPackagingService, ImportEventArgs<IFile>> ImportingStylesheets;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs after Template is Imported and Saved
|
||||
/// </summary>
|
||||
@@ -1623,7 +1710,7 @@ namespace Umbraco.Core.Services
|
||||
/// Occurs after Template is Exported to Xml
|
||||
/// </summary>
|
||||
public static event TypedEventHandler<IPackagingService, ExportEventArgs<ITemplate>> ExportedTemplate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs before Importing umbraco package
|
||||
/// </summary>
|
||||
|
||||
@@ -17,12 +17,19 @@ namespace Umbraco.Core.Services
|
||||
internal class SectionService : ISectionService
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private IEnumerable<Section> _allAvailableSections;
|
||||
private readonly IApplicationTreeService _applicationTreeService;
|
||||
private readonly IDatabaseUnitOfWorkProvider _uowProvider;
|
||||
private readonly CacheHelper _cache;
|
||||
internal const string AppConfigFileName = "applications.config";
|
||||
private static string _appConfig;
|
||||
private volatile bool _isInitialized = false;
|
||||
private static readonly object Locker = new object();
|
||||
|
||||
public SectionService(
|
||||
IUserService userService,
|
||||
IApplicationTreeService applicationTreeService,
|
||||
IApplicationTreeService applicationTreeService,
|
||||
IDatabaseUnitOfWorkProvider uowProvider,
|
||||
CacheHelper cache)
|
||||
{
|
||||
if (applicationTreeService == null) throw new ArgumentNullException("applicationTreeService");
|
||||
@@ -30,12 +37,11 @@ namespace Umbraco.Core.Services
|
||||
|
||||
_userService = userService;
|
||||
_applicationTreeService = applicationTreeService;
|
||||
_uowProvider = uowProvider;
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
internal const string AppConfigFileName = "applications.config";
|
||||
private static string _appConfig;
|
||||
private static readonly object Locker = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// gets/sets the application.config file path
|
||||
@@ -57,22 +63,17 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures all available sections exist in the storage medium
|
||||
/// Initializes the service with all available application plugins
|
||||
/// </summary>
|
||||
/// <param name="existingSections"></param>
|
||||
public void Initialize(IEnumerable<Section> existingSections)
|
||||
/// <param name="allAvailableSections">
|
||||
/// All application plugins found in assemblies
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// This is used to populate the app.config file with any applications declared in plugins that don't exist in the file
|
||||
/// </remarks>
|
||||
public void Initialize(IEnumerable<Section> allAvailableSections)
|
||||
{
|
||||
LoadXml(doc =>
|
||||
{
|
||||
foreach (var attr in existingSections)
|
||||
{
|
||||
doc.Root.Add(new XElement("add",
|
||||
new XAttribute("alias", attr.Alias),
|
||||
new XAttribute("name", attr.Name),
|
||||
new XAttribute("icon", attr.Icon),
|
||||
new XAttribute("sortOrder", attr.SortOrder)));
|
||||
}
|
||||
}, true);
|
||||
_allAvailableSections = allAvailableSections;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,7 +81,7 @@ namespace Umbraco.Core.Services
|
||||
/// </summary>
|
||||
public IEnumerable<Section> GetSections()
|
||||
{
|
||||
return _cache.GetCacheItem(
|
||||
return _cache.RuntimeCache.GetCacheItem<IEnumerable<Section>>(
|
||||
CacheKeys.ApplicationsCacheKey,
|
||||
() =>
|
||||
{
|
||||
@@ -88,28 +89,66 @@ namespace Umbraco.Core.Services
|
||||
//if (_testApps != null)
|
||||
// return _testApps;
|
||||
|
||||
var tmp = new List<Section>();
|
||||
var list = ReadFromXmlAndSort();
|
||||
|
||||
LoadXml(doc =>
|
||||
//On first access we need to do some initialization
|
||||
if (_isInitialized == false)
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
|
||||
{
|
||||
var sortOrderAttr = x.Attribute("sortOrder");
|
||||
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
|
||||
}))
|
||||
if (_isInitialized == false)
|
||||
{
|
||||
var sortOrderAttr = addElement.Attribute("sortOrder");
|
||||
tmp.Add(new Section(addElement.Attribute("name").Value,
|
||||
addElement.Attribute("alias").Value,
|
||||
addElement.Attribute("icon").Value,
|
||||
sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0));
|
||||
//now we can check the non-volatile flag
|
||||
if (_allAvailableSections != null)
|
||||
{
|
||||
var hasChanges = false;
|
||||
|
||||
LoadXml(doc =>
|
||||
{
|
||||
//Now, load in the xml structure and update it with anything that is not declared there and save the file.
|
||||
|
||||
//NOTE: On the first iteration here, it will lazily scan all apps, etc... this is because this ienumerable is lazy
|
||||
// based on the ApplicationRegistrar - and as noted there this is not an ideal way to do things but were stuck like this
|
||||
// currently because of the legacy assemblies and types not in the Core.
|
||||
|
||||
//Get all the trees not registered in the config
|
||||
var unregistered = _allAvailableSections
|
||||
.Where(x => list.Any(l => l.Alias == x.Alias) == false)
|
||||
.ToArray();
|
||||
|
||||
hasChanges = unregistered.Any();
|
||||
|
||||
var count = 0;
|
||||
foreach (var attr in unregistered)
|
||||
{
|
||||
doc.Root.Add(new XElement("add",
|
||||
new XAttribute("alias", attr.Alias),
|
||||
new XAttribute("name", attr.Name),
|
||||
new XAttribute("icon", attr.Icon),
|
||||
new XAttribute("sortOrder", attr.SortOrder)));
|
||||
count++;
|
||||
}
|
||||
|
||||
//don't save if there's no changes
|
||||
return count > 0;
|
||||
}, true);
|
||||
|
||||
if (hasChanges)
|
||||
{
|
||||
//If there were changes, we need to re-read the structures from the XML
|
||||
list = ReadFromXmlAndSort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
internal void LoadXml(Action<XDocument> callback, bool saveAfterCallback)
|
||||
internal void LoadXml(Func<XDocument, bool> callback, bool saveAfterCallbackIfChanged)
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
@@ -119,9 +158,9 @@ namespace Umbraco.Core.Services
|
||||
|
||||
if (doc.Root != null)
|
||||
{
|
||||
callback.Invoke(doc);
|
||||
var changed = callback.Invoke(doc);
|
||||
|
||||
if (saveAfterCallback)
|
||||
if (saveAfterCallbackIfChanged && changed)
|
||||
{
|
||||
//ensure the folder is created!
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(AppConfigFilePath));
|
||||
@@ -194,6 +233,7 @@ namespace Umbraco.Core.Services
|
||||
new XAttribute("name", name),
|
||||
new XAttribute("icon", icon),
|
||||
new XAttribute("sortOrder", sortOrder)));
|
||||
return true;
|
||||
}, true);
|
||||
|
||||
//raise event
|
||||
@@ -209,7 +249,7 @@ namespace Umbraco.Core.Services
|
||||
lock (Locker)
|
||||
{
|
||||
//delete the assigned applications
|
||||
ApplicationContext.Current.DatabaseContext.Database.Execute(
|
||||
_uowProvider.GetUnitOfWork().Database.Execute(
|
||||
"delete from umbracoUser2App where app = @appAlias",
|
||||
new { appAlias = section.Alias });
|
||||
|
||||
@@ -222,7 +262,10 @@ namespace Umbraco.Core.Services
|
||||
|
||||
LoadXml(doc =>
|
||||
{
|
||||
doc.Root.Elements("add").Where(x => x.Attribute("alias") != null && x.Attribute("alias").Value == section.Alias).Remove();
|
||||
doc.Root.Elements("add").Where(x => x.Attribute("alias") != null && x.Attribute("alias").Value == section.Alias)
|
||||
.Remove();
|
||||
|
||||
return true;
|
||||
}, true);
|
||||
|
||||
//raise event
|
||||
@@ -230,6 +273,30 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
private List<Section> ReadFromXmlAndSort()
|
||||
{
|
||||
var tmp = new List<Section>();
|
||||
|
||||
LoadXml(doc =>
|
||||
{
|
||||
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
|
||||
{
|
||||
var sortOrderAttr = x.Attribute("sortOrder");
|
||||
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
|
||||
}))
|
||||
{
|
||||
var sortOrderAttr = addElement.Attribute("sortOrder");
|
||||
tmp.Add(new Section(addElement.Attribute("name").Value,
|
||||
addElement.Attribute("alias").Value,
|
||||
addElement.Attribute("icon").Value,
|
||||
sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0));
|
||||
}
|
||||
return false;
|
||||
}, false);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
internal static event TypedEventHandler<Section, EventArgs> Deleted;
|
||||
private static void OnDeleted(Section app, EventArgs args)
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Umbraco.Core.Services
|
||||
_treeService = new Lazy<IApplicationTreeService>(() => new ApplicationTreeService(cache));
|
||||
|
||||
if (_sectionService == null)
|
||||
_sectionService = new Lazy<ISectionService>(() => new SectionService(_userService.Value, _treeService.Value, cache));
|
||||
_sectionService = new Lazy<ISectionService>(() => new SectionService(_userService.Value, _treeService.Value, provider, cache));
|
||||
|
||||
if (_macroService == null)
|
||||
_macroService = new Lazy<IMacroService>(() => new MacroService(provider, repositoryFactory.Value));
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
@@ -19,28 +20,24 @@ namespace Umbraco.Core.Sync
|
||||
/// </summary>
|
||||
/// <returns>The full base url including schema (i.e. http://myserver:80/umbraco ) - or <c>null</c> if the url
|
||||
/// cannot be determined at the moment (usually because the first request has not properly completed yet).</returns>
|
||||
public static string GetCurrentServerUmbracoBaseUrl()
|
||||
public static string GetCurrentServerUmbracoBaseUrl(ApplicationContext appContext, IUmbracoSettingsSection settings)
|
||||
{
|
||||
var status = GetStatus();
|
||||
var status = GetStatus(settings);
|
||||
|
||||
if (status == CurrentServerEnvironmentStatus.Single)
|
||||
{
|
||||
// single install, return null if no original url, else use original url as base
|
||||
// single install, return null if no config/original url, else use config/original url as base
|
||||
// use http or https as appropriate
|
||||
return string.IsNullOrWhiteSpace(ApplicationContext.Current.OriginalRequestUrl)
|
||||
? null // not initialized yet
|
||||
: string.Format("http{0}://{1}", GlobalSettings.UseSSL ? "s" : "", ApplicationContext.Current.OriginalRequestUrl);
|
||||
return GetBaseUrl(appContext, settings);
|
||||
}
|
||||
|
||||
var servers = UmbracoConfig.For.UmbracoSettings().DistributedCall.Servers.ToArray();
|
||||
var servers = settings.DistributedCall.Servers.ToArray();
|
||||
|
||||
if (servers.Any() == false)
|
||||
{
|
||||
// cannot be determined, return null if no original url, else use original url as base
|
||||
// cannot be determined, return null if no config/original url, else use config/original url as base
|
||||
// use http or https as appropriate
|
||||
return string.IsNullOrWhiteSpace(ApplicationContext.Current.OriginalRequestUrl)
|
||||
? null // not initialized yet
|
||||
: string.Format("http{0}://{1}", GlobalSettings.UseSSL ? "s" : "", ApplicationContext.Current.OriginalRequestUrl);
|
||||
return GetBaseUrl(appContext, settings);
|
||||
}
|
||||
|
||||
foreach (var server in servers)
|
||||
@@ -65,25 +62,23 @@ namespace Umbraco.Core.Sync
|
||||
}
|
||||
}
|
||||
|
||||
// cannot be determined, return null if no original url, else use original url as base
|
||||
// cannot be determined, return null if no config/original url, else use config/original url as base
|
||||
// use http or https as appropriate
|
||||
return string.IsNullOrWhiteSpace(ApplicationContext.Current.OriginalRequestUrl)
|
||||
? null // not initialized yet
|
||||
: string.Format("http{0}://{1}", GlobalSettings.UseSSL ? "s" : "", ApplicationContext.Current.OriginalRequestUrl);
|
||||
return GetBaseUrl(appContext, settings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current environment status for the current server
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static CurrentServerEnvironmentStatus GetStatus()
|
||||
public static CurrentServerEnvironmentStatus GetStatus(IUmbracoSettingsSection settings)
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled == false)
|
||||
if (settings.DistributedCall.Enabled == false)
|
||||
{
|
||||
return CurrentServerEnvironmentStatus.Single;
|
||||
}
|
||||
|
||||
var servers = UmbracoConfig.For.UmbracoSettings().DistributedCall.Servers.ToArray();
|
||||
var servers = settings.DistributedCall.Servers.ToArray();
|
||||
|
||||
if (servers.Any() == false)
|
||||
{
|
||||
@@ -118,5 +113,21 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
return CurrentServerEnvironmentStatus.Slave;
|
||||
}
|
||||
|
||||
private static string GetBaseUrl(ApplicationContext appContext, IUmbracoSettingsSection settings)
|
||||
{
|
||||
return (
|
||||
// is config empty?
|
||||
settings.ScheduledTasks.BaseUrl.IsNullOrWhiteSpace()
|
||||
// is the orig req empty?
|
||||
? appContext.OriginalRequestUrl.IsNullOrWhiteSpace()
|
||||
// we've got nothing
|
||||
? null
|
||||
//the orig req url is not null, use that
|
||||
: string.Format("http{0}://{1}", GlobalSettings.UseSSL ? "s" : "", appContext.OriginalRequestUrl)
|
||||
// the config has been specified, use that
|
||||
: string.Format("http{0}://{1}", GlobalSettings.UseSSL ? "s" : "", settings.ScheduledTasks.BaseUrl))
|
||||
.EnsureEndsWith('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using System.Web.Compilation;
|
||||
using System.Web.Hosting;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -450,14 +451,23 @@ namespace Umbraco.Core
|
||||
var allTypes = GetTypesWithFormattedException(a)
|
||||
.ToArray();
|
||||
|
||||
//now filter the types based on the onlyConcreteClasses flag, not interfaces, not static classes but have
|
||||
//the specified attribute
|
||||
var attributedTypes = allTypes
|
||||
.Where(t => (TypeHelper.IsNonStaticClass(t)
|
||||
&& (onlyConcreteClasses == false || t.IsAbstract == false))
|
||||
//the type must have this attribute
|
||||
&& t.GetCustomAttributes(attributeType, false).Any())
|
||||
.ToArray();
|
||||
var attributedTypes = new Type[] {};
|
||||
try
|
||||
{
|
||||
//now filter the types based on the onlyConcreteClasses flag, not interfaces, not static classes but have
|
||||
//the specified attribute
|
||||
attributedTypes = allTypes
|
||||
.Where(t => (TypeHelper.IsNonStaticClass(t)
|
||||
&& (onlyConcreteClasses == false || t.IsAbstract == false))
|
||||
//the type must have this attribute
|
||||
&& t.GetCustomAttributes(attributeType, false).Any())
|
||||
.ToArray();
|
||||
}
|
||||
catch (TypeLoadException ex)
|
||||
{
|
||||
LogHelper.Error(typeof(TypeFinder), string.Format("Could not query types on {0} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", a), ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
//add the types to our list to return
|
||||
foreach (var t in attributedTypes)
|
||||
@@ -583,16 +593,25 @@ namespace Umbraco.Core
|
||||
.Where(assignTypeFrom.IsAssignableFrom)
|
||||
.ToArray();
|
||||
|
||||
//now filter the types based on the onlyConcreteClasses flag, not interfaces, not static classes
|
||||
var filteredTypes = allSubTypes
|
||||
.Where(t => (TypeHelper.IsNonStaticClass(t)
|
||||
//Do not include nested private classes - since we are in full trust now this will find those too!
|
||||
&& t.IsNestedPrivate == false
|
||||
&& (onlyConcreteClasses == false || t.IsAbstract == false)
|
||||
//Do not include classes that are flagged to hide from the type finder
|
||||
&& t.GetCustomAttribute<HideFromTypeFinderAttribute>() == null
|
||||
&& additionalFilter(t)))
|
||||
.ToArray();
|
||||
var filteredTypes = new Type[] { };
|
||||
try
|
||||
{
|
||||
//now filter the types based on the onlyConcreteClasses flag, not interfaces, not static classes
|
||||
filteredTypes = allSubTypes
|
||||
.Where(t => (TypeHelper.IsNonStaticClass(t)
|
||||
//Do not include nested private classes - since we are in full trust now this will find those too!
|
||||
&& t.IsNestedPrivate == false
|
||||
&& (onlyConcreteClasses == false || t.IsAbstract == false)
|
||||
//Do not include classes that are flagged to hide from the type finder
|
||||
&& t.GetCustomAttribute<HideFromTypeFinderAttribute>() == null
|
||||
&& additionalFilter(t)))
|
||||
.ToArray();
|
||||
}
|
||||
catch (TypeLoadException ex)
|
||||
{
|
||||
LogHelper.Error(typeof(TypeFinder), string.Format("Could not query types on {0} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", a), ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
//add the types to our list to return
|
||||
foreach (var t in filteredTypes)
|
||||
|
||||
@@ -99,9 +99,9 @@
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
@@ -393,7 +393,9 @@
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\AddMissingForeignKeyForContentType.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\AlterDataTypePreValueTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenOneZero\AssignMissingPrimaryForMySqlKeys.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\AddIndexToUmbracoNodeTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\RemoveCmsDocumentAliasColumn.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSeven\AssignMissingKeysAndIndexes.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSixTwoZero\AssignMissingPrimaryForMySqlKeys.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSixTwoZero\AssignMissingPrimaryForMySqlKeys2.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSixTwoZero\ChangePasswordColumn.cs" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<package id="AutoMapper" version="3.0.0" targetFramework="net45" />
|
||||
<package id="HtmlAgilityPack" version="1.4.6" targetFramework="net45" />
|
||||
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net40" />
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
|
||||
+118
-119
@@ -1,120 +1,119 @@
|
||||
using System.Configuration;
|
||||
using System.Web.Routing;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class GlobalSettingsTests : BaseWebTest
|
||||
{
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
//ensure this is reset
|
||||
SystemDirectories.Root = null;
|
||||
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||
//reset the app config
|
||||
base.TearDown();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Is_Debug_Mode()
|
||||
{
|
||||
Assert.That(Umbraco.Core.Configuration.GlobalSettings.DebugMode, Is.EqualTo(true));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Is_Version_From_Assembly_Correct()
|
||||
{
|
||||
Assert.That(UmbracoVersion.Current.ToString(3), Is.EqualTo("6.0.0"));
|
||||
}
|
||||
|
||||
[TestCase("~/umbraco", "/", "umbraco")]
|
||||
[TestCase("~/umbraco", "/MyVirtualDir", "umbraco")]
|
||||
[TestCase("~/customPath", "/MyVirtualDir/", "custompath")]
|
||||
[TestCase("~/some-wacky/nestedPath", "/MyVirtualDir", "some-wacky-nestedpath")]
|
||||
[TestCase("~/some-wacky/nestedPath", "/MyVirtualDir/NestedVDir/", "some-wacky-nestedpath")]
|
||||
public void Umbraco_Mvc_Area(string path, string rootPath, string outcome)
|
||||
{
|
||||
SettingsForTests.UmbracoPath = path;
|
||||
SystemDirectories.Root = rootPath;
|
||||
Assert.AreEqual(outcome, Umbraco.Core.Configuration.GlobalSettings.UmbracoMvcArea);
|
||||
}
|
||||
|
||||
[TestCase("/umbraco/umbraco.aspx")]
|
||||
[TestCase("/umbraco/editContent.aspx")]
|
||||
[TestCase("/install/default.aspx")]
|
||||
[TestCase("/install/")]
|
||||
[TestCase("/install")]
|
||||
[TestCase("/install/?installStep=asdf")]
|
||||
[TestCase("/install/test.aspx")]
|
||||
[TestCase("/config/splashes/booting.aspx")]
|
||||
public void Is_Reserved_Path_Or_Url(string url)
|
||||
{
|
||||
Assert.IsTrue(Umbraco.Core.Configuration.GlobalSettings.IsReservedPathOrUrl(url));
|
||||
}
|
||||
|
||||
[TestCase("/umbraco_client/Tree/treeIcons.css")]
|
||||
[TestCase("/umbraco_client/Tree/Themes/umbraco/style.css")]
|
||||
[TestCase("/umbraco_client/scrollingmenu/style.css")]
|
||||
[TestCase("/base/somebasehandler")]
|
||||
[TestCase("/")]
|
||||
[TestCase("/home.aspx")]
|
||||
[TestCase("/umbraco-test")]
|
||||
[TestCase("/install-test")]
|
||||
[TestCase("/install.aspx")]
|
||||
public void Is_Not_Reserved_Path_Or_Url(string url)
|
||||
{
|
||||
Assert.IsFalse(Umbraco.Core.Configuration.GlobalSettings.IsReservedPathOrUrl(url));
|
||||
}
|
||||
|
||||
|
||||
[TestCase("/Do/Not/match", false)]
|
||||
[TestCase("/Umbraco/RenderMvcs", false)]
|
||||
[TestCase("/Umbraco/RenderMvc", true)]
|
||||
[TestCase("/Umbraco/RenderMvc/Index", true)]
|
||||
[TestCase("/Umbraco/RenderMvc/Index/1234", true)]
|
||||
[TestCase("/Umbraco/RenderMvc/Index/1234/9876", false)]
|
||||
[TestCase("/api", true)]
|
||||
[TestCase("/api/WebApiTest", true)]
|
||||
[TestCase("/api/WebApiTest/1234", true)]
|
||||
[TestCase("/api/WebApiTest/Index/1234", false)]
|
||||
public void Is_Reserved_By_Route(string url, bool shouldMatch)
|
||||
{
|
||||
//reset the app config, we only want to test routes not the hard coded paths
|
||||
Umbraco.Core.Configuration.GlobalSettings.ReservedPaths = "";
|
||||
Umbraco.Core.Configuration.GlobalSettings.ReservedUrls = "";
|
||||
|
||||
var routes = new RouteCollection();
|
||||
|
||||
routes.MapRoute(
|
||||
"Umbraco_default",
|
||||
"Umbraco/RenderMvc/{action}/{id}",
|
||||
new { controller = "RenderMvc", action = "Index", id = UrlParameter.Optional });
|
||||
routes.MapRoute(
|
||||
"WebAPI",
|
||||
"api/{controller}/{id}",
|
||||
new { controller = "WebApiTestController", action = "Index", id = UrlParameter.Optional });
|
||||
|
||||
|
||||
var context = new FakeHttpContextFactory(url);
|
||||
|
||||
|
||||
Assert.AreEqual(
|
||||
shouldMatch,
|
||||
Umbraco.Core.Configuration.GlobalSettings.IsReservedPathOrUrl(url, context.HttpContext, routes));
|
||||
}
|
||||
}
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.Configurations
|
||||
{
|
||||
[TestFixture]
|
||||
public class GlobalSettingsTests : BaseWebTest
|
||||
{
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
//ensure this is reset
|
||||
SystemDirectories.Root = null;
|
||||
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||
//reset the app config
|
||||
base.TearDown();
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Is_Debug_Mode()
|
||||
{
|
||||
Assert.That(Umbraco.Core.Configuration.GlobalSettings.DebugMode, Is.EqualTo(true));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Is_Version_From_Assembly_Correct()
|
||||
{
|
||||
Assert.That(UmbracoVersion.Current.ToString(3), Is.EqualTo("6.0.0"));
|
||||
}
|
||||
|
||||
[TestCase("~/umbraco", "/", "umbraco")]
|
||||
[TestCase("~/umbraco", "/MyVirtualDir", "umbraco")]
|
||||
[TestCase("~/customPath", "/MyVirtualDir/", "custompath")]
|
||||
[TestCase("~/some-wacky/nestedPath", "/MyVirtualDir", "some-wacky-nestedpath")]
|
||||
[TestCase("~/some-wacky/nestedPath", "/MyVirtualDir/NestedVDir/", "some-wacky-nestedpath")]
|
||||
public void Umbraco_Mvc_Area(string path, string rootPath, string outcome)
|
||||
{
|
||||
SettingsForTests.UmbracoPath = path;
|
||||
SystemDirectories.Root = rootPath;
|
||||
Assert.AreEqual(outcome, Umbraco.Core.Configuration.GlobalSettings.UmbracoMvcArea);
|
||||
}
|
||||
|
||||
[TestCase("/umbraco/umbraco.aspx")]
|
||||
[TestCase("/umbraco/editContent.aspx")]
|
||||
[TestCase("/install/default.aspx")]
|
||||
[TestCase("/install/")]
|
||||
[TestCase("/install")]
|
||||
[TestCase("/install/?installStep=asdf")]
|
||||
[TestCase("/install/test.aspx")]
|
||||
[TestCase("/config/splashes/booting.aspx")]
|
||||
public void Is_Reserved_Path_Or_Url(string url)
|
||||
{
|
||||
Assert.IsTrue(Umbraco.Core.Configuration.GlobalSettings.IsReservedPathOrUrl(url));
|
||||
}
|
||||
|
||||
[TestCase("/umbraco_client/Tree/treeIcons.css")]
|
||||
[TestCase("/umbraco_client/Tree/Themes/umbraco/style.css")]
|
||||
[TestCase("/umbraco_client/scrollingmenu/style.css")]
|
||||
[TestCase("/base/somebasehandler")]
|
||||
[TestCase("/")]
|
||||
[TestCase("/home.aspx")]
|
||||
[TestCase("/umbraco-test")]
|
||||
[TestCase("/install-test")]
|
||||
[TestCase("/install.aspx")]
|
||||
public void Is_Not_Reserved_Path_Or_Url(string url)
|
||||
{
|
||||
Assert.IsFalse(Umbraco.Core.Configuration.GlobalSettings.IsReservedPathOrUrl(url));
|
||||
}
|
||||
|
||||
|
||||
[TestCase("/Do/Not/match", false)]
|
||||
[TestCase("/Umbraco/RenderMvcs", false)]
|
||||
[TestCase("/Umbraco/RenderMvc", true)]
|
||||
[TestCase("/Umbraco/RenderMvc/Index", true)]
|
||||
[TestCase("/Umbraco/RenderMvc/Index/1234", true)]
|
||||
[TestCase("/Umbraco/RenderMvc/Index/1234/9876", false)]
|
||||
[TestCase("/api", true)]
|
||||
[TestCase("/api/WebApiTest", true)]
|
||||
[TestCase("/api/WebApiTest/1234", true)]
|
||||
[TestCase("/api/WebApiTest/Index/1234", false)]
|
||||
public void Is_Reserved_By_Route(string url, bool shouldMatch)
|
||||
{
|
||||
//reset the app config, we only want to test routes not the hard coded paths
|
||||
Umbraco.Core.Configuration.GlobalSettings.ReservedPaths = "";
|
||||
Umbraco.Core.Configuration.GlobalSettings.ReservedUrls = "";
|
||||
|
||||
var routes = new RouteCollection();
|
||||
|
||||
routes.MapRoute(
|
||||
"Umbraco_default",
|
||||
"Umbraco/RenderMvc/{action}/{id}",
|
||||
new { controller = "RenderMvc", action = "Index", id = UrlParameter.Optional });
|
||||
routes.MapRoute(
|
||||
"WebAPI",
|
||||
"api/{controller}/{id}",
|
||||
new { controller = "WebApiTestController", action = "Index", id = UrlParameter.Optional });
|
||||
|
||||
|
||||
var context = new FakeHttpContextFactory(url);
|
||||
|
||||
|
||||
Assert.AreEqual(
|
||||
shouldMatch,
|
||||
Umbraco.Core.Configuration.GlobalSettings.IsReservedPathOrUrl(url, context.HttpContext, routes));
|
||||
}
|
||||
}
|
||||
}
|
||||
+87
-90
@@ -1,90 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Tests.Surface
|
||||
{
|
||||
[TestFixture]
|
||||
public class PluginControllerAreaTests : BaseWebTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Ensure_Same_Area1()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
new PluginControllerArea(new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin2Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin3Controller)) //not same area
|
||||
}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Same_Area3()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
new PluginControllerArea(new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin2Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin4Controller)) //no area assigned
|
||||
}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Same_Area2()
|
||||
{
|
||||
var area = new PluginControllerArea(new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin2Controller))
|
||||
});
|
||||
Assert.Pass();
|
||||
}
|
||||
|
||||
#region Test classes
|
||||
|
||||
[PluginController("Area1")]
|
||||
public class Plugin1Controller : PluginController
|
||||
{
|
||||
public Plugin1Controller(UmbracoContext umbracoContext) : base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[PluginController("Area1")]
|
||||
public class Plugin2Controller : PluginController
|
||||
{
|
||||
public Plugin2Controller(UmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[PluginController("Area2")]
|
||||
public class Plugin3Controller : PluginController
|
||||
{
|
||||
public Plugin3Controller(UmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Plugin4Controller : PluginController
|
||||
{
|
||||
public Plugin4Controller(UmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Tests.Controllers
|
||||
{
|
||||
[TestFixture]
|
||||
public class PluginControllerAreaTests : BaseWebTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Ensure_Same_Area1()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
new PluginControllerArea(new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin2Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin3Controller)) //not same area
|
||||
}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Same_Area3()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
new PluginControllerArea(new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin2Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin4Controller)) //no area assigned
|
||||
}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Same_Area2()
|
||||
{
|
||||
var area = new PluginControllerArea(new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
PluginController.GetMetadata(typeof(Plugin2Controller))
|
||||
});
|
||||
Assert.Pass();
|
||||
}
|
||||
|
||||
#region Test classes
|
||||
|
||||
[PluginController("Area1")]
|
||||
public class Plugin1Controller : PluginController
|
||||
{
|
||||
public Plugin1Controller(UmbracoContext umbracoContext) : base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[PluginController("Area1")]
|
||||
public class Plugin2Controller : PluginController
|
||||
{
|
||||
public Plugin2Controller(UmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[PluginController("Area2")]
|
||||
public class Plugin3Controller : PluginController
|
||||
{
|
||||
public Plugin3Controller(UmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Plugin4Controller : PluginController
|
||||
{
|
||||
public Plugin4Controller(UmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
+209
-210
@@ -1,211 +1,210 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Web.Cache;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Sync
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures that calls to DistributedCache methods carry through to the IServerMessenger correctly
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class DistributedCacheTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ServerRegistrarResolver.Current = new ServerRegistrarResolver(
|
||||
new TestServerRegistrar());
|
||||
ServerMessengerResolver.Current = new ServerMessengerResolver(
|
||||
new TestServerMessenger());
|
||||
CacheRefreshersResolver.Current = new CacheRefreshersResolver(() => new[] { typeof(TestCacheRefresher) });
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
ServerRegistrarResolver.Reset();
|
||||
ServerMessengerResolver.Reset();
|
||||
CacheRefreshersResolver.Reset();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshIntId()
|
||||
{
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
DistributedCache.Instance.Refresh(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), i);
|
||||
}
|
||||
Assert.AreEqual(10, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).IntIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshIntIdFromObject()
|
||||
{
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
DistributedCache.Instance.Refresh(
|
||||
Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"),
|
||||
x => x.Id,
|
||||
new TestObjectWithId{Id = i});
|
||||
}
|
||||
Assert.AreEqual(10, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).IntIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshGuidId()
|
||||
{
|
||||
for (var i = 0; i < 11; i++)
|
||||
{
|
||||
DistributedCache.Instance.Refresh(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), Guid.NewGuid());
|
||||
}
|
||||
Assert.AreEqual(11, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).GuidIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveIds()
|
||||
{
|
||||
for (var i = 1; i < 13; i++)
|
||||
{
|
||||
DistributedCache.Instance.Remove(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), i);
|
||||
}
|
||||
Assert.AreEqual(12, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).IntIdsRemoved.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FullRefreshes()
|
||||
{
|
||||
for (var i = 0; i < 13; i++)
|
||||
{
|
||||
DistributedCache.Instance.RefreshAll(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"));
|
||||
}
|
||||
Assert.AreEqual(13, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).CountOfFullRefreshes);
|
||||
}
|
||||
|
||||
#region internal test classes
|
||||
|
||||
internal class TestObjectWithId
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
internal class TestCacheRefresher : ICacheRefresher
|
||||
{
|
||||
public Guid UniqueIdentifier
|
||||
{
|
||||
get { return Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"); }
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get { return "Test"; }
|
||||
}
|
||||
public void RefreshAll()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Refresh(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Remove(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Refresh(Guid id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal class TestServerMessenger : IServerMessenger
|
||||
{
|
||||
//used for tests
|
||||
public List<int> IntIdsRefreshed = new List<int>();
|
||||
public List<Guid> GuidIdsRefreshed = new List<Guid>();
|
||||
public List<int> IntIdsRemoved = new List<int>();
|
||||
public List<string> PayloadsRemoved = new List<string>();
|
||||
public List<string> PayloadsRefreshed = new List<string>();
|
||||
public int CountOfFullRefreshes = 0;
|
||||
|
||||
|
||||
public void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, string jsonPayload)
|
||||
{
|
||||
PayloadsRefreshed.Add(jsonPayload);
|
||||
}
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
IntIdsRefreshed.AddRange(instances.Select(getNumericId));
|
||||
}
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances)
|
||||
{
|
||||
GuidIdsRefreshed.AddRange(instances.Select(getGuidId));
|
||||
}
|
||||
|
||||
public void PerformRemove(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, string jsonPayload)
|
||||
{
|
||||
PayloadsRemoved.Add(jsonPayload);
|
||||
}
|
||||
|
||||
public void PerformRemove<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
IntIdsRemoved.AddRange(instances.Select(getNumericId));
|
||||
}
|
||||
|
||||
public void PerformRemove(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params int[] numericIds)
|
||||
{
|
||||
IntIdsRemoved.AddRange(numericIds);
|
||||
}
|
||||
|
||||
public void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params int[] numericIds)
|
||||
{
|
||||
IntIdsRefreshed.AddRange(numericIds);
|
||||
}
|
||||
|
||||
public void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params Guid[] guidIds)
|
||||
{
|
||||
GuidIdsRefreshed.AddRange(guidIds);
|
||||
}
|
||||
|
||||
public void PerformRefreshAll(IEnumerable<IServerAddress> servers, ICacheRefresher refresher)
|
||||
{
|
||||
CountOfFullRefreshes++;
|
||||
}
|
||||
}
|
||||
|
||||
internal class TestServerRegistrar : IServerRegistrar
|
||||
{
|
||||
public IEnumerable<IServerAddress> Registrations
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<IServerAddress>()
|
||||
{
|
||||
new TestServerAddress("localhost")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TestServerAddress : IServerAddress
|
||||
{
|
||||
public TestServerAddress(string address)
|
||||
{
|
||||
ServerAddress = address;
|
||||
}
|
||||
public string ServerAddress { get; private set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using Umbraco.Core.Sync;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests.DistributedCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures that calls to DistributedCache methods carry through to the IServerMessenger correctly
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class DistributedCacheTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ServerRegistrarResolver.Current = new ServerRegistrarResolver(
|
||||
new TestServerRegistrar());
|
||||
ServerMessengerResolver.Current = new ServerMessengerResolver(
|
||||
new TestServerMessenger());
|
||||
CacheRefreshersResolver.Current = new CacheRefreshersResolver(() => new[] { typeof(TestCacheRefresher) });
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
ServerRegistrarResolver.Reset();
|
||||
ServerMessengerResolver.Reset();
|
||||
CacheRefreshersResolver.Reset();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshIntId()
|
||||
{
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
Web.Cache.DistributedCache.Instance.Refresh(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), i);
|
||||
}
|
||||
Assert.AreEqual(10, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).IntIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshIntIdFromObject()
|
||||
{
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
Web.Cache.DistributedCache.Instance.Refresh(
|
||||
Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"),
|
||||
x => x.Id,
|
||||
new TestObjectWithId{Id = i});
|
||||
}
|
||||
Assert.AreEqual(10, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).IntIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshGuidId()
|
||||
{
|
||||
for (var i = 0; i < 11; i++)
|
||||
{
|
||||
Web.Cache.DistributedCache.Instance.Refresh(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), Guid.NewGuid());
|
||||
}
|
||||
Assert.AreEqual(11, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).GuidIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveIds()
|
||||
{
|
||||
for (var i = 1; i < 13; i++)
|
||||
{
|
||||
Web.Cache.DistributedCache.Instance.Remove(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), i);
|
||||
}
|
||||
Assert.AreEqual(12, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).IntIdsRemoved.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FullRefreshes()
|
||||
{
|
||||
for (var i = 0; i < 13; i++)
|
||||
{
|
||||
Web.Cache.DistributedCache.Instance.RefreshAll(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"));
|
||||
}
|
||||
Assert.AreEqual(13, ((TestServerMessenger)ServerMessengerResolver.Current.Messenger).CountOfFullRefreshes);
|
||||
}
|
||||
|
||||
#region internal test classes
|
||||
|
||||
internal class TestObjectWithId
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
internal class TestCacheRefresher : ICacheRefresher
|
||||
{
|
||||
public Guid UniqueIdentifier
|
||||
{
|
||||
get { return Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"); }
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get { return "Test"; }
|
||||
}
|
||||
public void RefreshAll()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Refresh(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Remove(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Refresh(Guid id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal class TestServerMessenger : IServerMessenger
|
||||
{
|
||||
//used for tests
|
||||
public List<int> IntIdsRefreshed = new List<int>();
|
||||
public List<Guid> GuidIdsRefreshed = new List<Guid>();
|
||||
public List<int> IntIdsRemoved = new List<int>();
|
||||
public List<string> PayloadsRemoved = new List<string>();
|
||||
public List<string> PayloadsRefreshed = new List<string>();
|
||||
public int CountOfFullRefreshes = 0;
|
||||
|
||||
|
||||
public void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, string jsonPayload)
|
||||
{
|
||||
PayloadsRefreshed.Add(jsonPayload);
|
||||
}
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
IntIdsRefreshed.AddRange(instances.Select(getNumericId));
|
||||
}
|
||||
|
||||
public void PerformRefresh<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, Guid> getGuidId, params T[] instances)
|
||||
{
|
||||
GuidIdsRefreshed.AddRange(instances.Select(getGuidId));
|
||||
}
|
||||
|
||||
public void PerformRemove(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, string jsonPayload)
|
||||
{
|
||||
PayloadsRemoved.Add(jsonPayload);
|
||||
}
|
||||
|
||||
public void PerformRemove<T>(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, Func<T, int> getNumericId, params T[] instances)
|
||||
{
|
||||
IntIdsRemoved.AddRange(instances.Select(getNumericId));
|
||||
}
|
||||
|
||||
public void PerformRemove(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params int[] numericIds)
|
||||
{
|
||||
IntIdsRemoved.AddRange(numericIds);
|
||||
}
|
||||
|
||||
public void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params int[] numericIds)
|
||||
{
|
||||
IntIdsRefreshed.AddRange(numericIds);
|
||||
}
|
||||
|
||||
public void PerformRefresh(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, params Guid[] guidIds)
|
||||
{
|
||||
GuidIdsRefreshed.AddRange(guidIds);
|
||||
}
|
||||
|
||||
public void PerformRefreshAll(IEnumerable<IServerAddress> servers, ICacheRefresher refresher)
|
||||
{
|
||||
CountOfFullRefreshes++;
|
||||
}
|
||||
}
|
||||
|
||||
internal class TestServerRegistrar : IServerRegistrar
|
||||
{
|
||||
public IEnumerable<IServerAddress> Registrations
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<IServerAddress>()
|
||||
{
|
||||
new TestServerAddress("localhost")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TestServerAddress : IServerAddress
|
||||
{
|
||||
public TestServerAddress(string address)
|
||||
{
|
||||
ServerAddress = address;
|
||||
}
|
||||
public string ServerAddress { get; private set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+158
-162
@@ -1,162 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Dynamics;
|
||||
using Umbraco.Web.Dynamics;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Tests.Dynamics
|
||||
{
|
||||
//NOTE: there's libraries in both Umbraco.Core.Dynamics and Umbraco.Web.Dynamics - the reason for this is that the Web.Dynamics
|
||||
// started with the razor macro implementation and is modified with hard coded references to dynamic node and dynamic null, though it seems
|
||||
// to still work for other regular classes I don't want to move it to the core without removing these references but that would require a lot of work.
|
||||
|
||||
[TestFixture]
|
||||
public class QueryableExtensionTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Order_By_Test_Int()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().OrderBy("Age").ToArray();
|
||||
|
||||
Assert.AreEqual(10, result.ElementAt(0).Age);
|
||||
Assert.AreEqual(11, result.ElementAt(1).Age);
|
||||
Assert.AreEqual(12, result.ElementAt(2).Age);
|
||||
Assert.AreEqual(20, result.ElementAt(3).Age);
|
||||
Assert.AreEqual(31, result.ElementAt(4).Age);
|
||||
Assert.AreEqual(55, result.ElementAt(5).Age);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Order_By_Test_String()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().OrderBy("Name").ToArray();
|
||||
|
||||
Assert.AreEqual("anothertest", result.ElementAt(0).Name);
|
||||
Assert.AreEqual("blah", result.ElementAt(1).Name);
|
||||
Assert.AreEqual("someguy", result.ElementAt(2).Name);
|
||||
Assert.AreEqual("test1", result.ElementAt(3).Name);
|
||||
Assert.AreEqual("test2", result.ElementAt(4).Name);
|
||||
Assert.AreEqual("test3", result.ElementAt(5).Name);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_String()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().Where("Name = \"test1\"").ToArray();
|
||||
|
||||
Assert.AreEqual(1, result.Count());
|
||||
Assert.AreEqual("test1", result.ElementAt(0).Name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_String_With_Params()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
//NOTE: Currently the object query structure is not supported
|
||||
//var result = items.AsQueryable().Where("Name = @name", new {name = "test1"}).ToArray();
|
||||
var result = items.AsQueryable().Where("Name = @Name", new Dictionary<string, object> { { "Name", "test1" } }).ToArray();
|
||||
|
||||
Assert.AreEqual(1, result.Count());
|
||||
Assert.AreEqual("test1", result.ElementAt(0).Name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_Int_With_Params()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().Where("Age = @Age", new Dictionary<string, object> { { "Age", 10 } }).ToArray();
|
||||
|
||||
Assert.AreEqual(1, result.Count());
|
||||
Assert.AreEqual("test1", result.ElementAt(0).Name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_Bool_With_Params()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().Where("Female = @Female", new Dictionary<string, object> { { "Female", true } }).ToArray();
|
||||
|
||||
Assert.AreEqual(2, result.Count());
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class TestModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Age { get; set; }
|
||||
public bool Female { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Dynamics;
|
||||
using Umbraco.Web.Dynamics;
|
||||
|
||||
namespace Umbraco.Tests.DynamicsAndReflection
|
||||
{
|
||||
//NOTE: there's libraries in both Umbraco.Core.Dynamics and Umbraco.Web.Dynamics - the reason for this is that the Web.Dynamics
|
||||
// started with the razor macro implementation and is modified with hard coded references to dynamic node and dynamic null, though it seems
|
||||
// to still work for other regular classes I don't want to move it to the core without removing these references but that would require a lot of work.
|
||||
|
||||
[TestFixture]
|
||||
public class QueryableExtensionTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Order_By_Test_Int()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().OrderBy("Age").ToArray();
|
||||
|
||||
Assert.AreEqual(10, result.ElementAt(0).Age);
|
||||
Assert.AreEqual(11, result.ElementAt(1).Age);
|
||||
Assert.AreEqual(12, result.ElementAt(2).Age);
|
||||
Assert.AreEqual(20, result.ElementAt(3).Age);
|
||||
Assert.AreEqual(31, result.ElementAt(4).Age);
|
||||
Assert.AreEqual(55, result.ElementAt(5).Age);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Order_By_Test_String()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().OrderBy("Name").ToArray();
|
||||
|
||||
Assert.AreEqual("anothertest", result.ElementAt(0).Name);
|
||||
Assert.AreEqual("blah", result.ElementAt(1).Name);
|
||||
Assert.AreEqual("someguy", result.ElementAt(2).Name);
|
||||
Assert.AreEqual("test1", result.ElementAt(3).Name);
|
||||
Assert.AreEqual("test2", result.ElementAt(4).Name);
|
||||
Assert.AreEqual("test3", result.ElementAt(5).Name);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_String()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().Where("Name = \"test1\"").ToArray();
|
||||
|
||||
Assert.AreEqual(1, result.Count());
|
||||
Assert.AreEqual("test1", result.ElementAt(0).Name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_String_With_Params()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
//NOTE: Currently the object query structure is not supported
|
||||
//var result = items.AsQueryable().Where("Name = @name", new {name = "test1"}).ToArray();
|
||||
var result = items.AsQueryable().Where("Name = @Name", new Dictionary<string, object> { { "Name", "test1" } }).ToArray();
|
||||
|
||||
Assert.AreEqual(1, result.Count());
|
||||
Assert.AreEqual("test1", result.ElementAt(0).Name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_Int_With_Params()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().Where("Age = @Age", new Dictionary<string, object> { { "Age", 10 } }).ToArray();
|
||||
|
||||
Assert.AreEqual(1, result.Count());
|
||||
Assert.AreEqual("test1", result.ElementAt(0).Name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Where_Test_Bool_With_Params()
|
||||
{
|
||||
var items = new List<TestModel>
|
||||
{
|
||||
new TestModel {Age = 10, Name = "test1", Female = false},
|
||||
new TestModel {Age = 31, Name = "someguy", Female = true},
|
||||
new TestModel {Age = 11, Name = "test2", Female = true},
|
||||
new TestModel {Age = 20, Name = "anothertest", Female = false},
|
||||
new TestModel {Age = 55, Name = "blah", Female = false},
|
||||
new TestModel {Age = 12, Name = "test3", Female = false}
|
||||
};
|
||||
|
||||
var result = items.AsQueryable().Where("Female = @Female", new Dictionary<string, object> { { "Female", true } }).ToArray();
|
||||
|
||||
Assert.AreEqual(2, result.Count());
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class TestModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Age { get; set; }
|
||||
public bool Female { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+138
-138
@@ -1,139 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using umbraco.cms.businesslogic.macro;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MacroEngineFactoryTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
|
||||
//this ensures its reset
|
||||
PluginManager.Current = new PluginManager(false);
|
||||
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
{
|
||||
this.GetType().Assembly
|
||||
};
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
PluginManager.Current = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_All()
|
||||
{
|
||||
var engines = MacroEngineFactory.GetAll();
|
||||
Assert.AreEqual(2, engines.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Engine()
|
||||
{
|
||||
var engine1 = MacroEngineFactory.GetEngine("MacroEngine1");
|
||||
Assert.IsNotNull(engine1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_By_Filename()
|
||||
{
|
||||
var engine1 = MacroEngineFactory.GetByFilename("test.me1");
|
||||
var engine2 = MacroEngineFactory.GetByFilename("test.me2");
|
||||
Assert.IsNotNull(engine1);
|
||||
Assert.IsNotNull(engine2);
|
||||
Assert.Throws<MacroEngineException>(() => MacroEngineFactory.GetByFilename("test.blah"));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_By_Extension()
|
||||
{
|
||||
var engine1 = MacroEngineFactory.GetByExtension("me1");
|
||||
var engine2 = MacroEngineFactory.GetByExtension("me2");
|
||||
Assert.IsNotNull(engine1);
|
||||
Assert.IsNotNull(engine2);
|
||||
Assert.Throws<MacroEngineException>(() => MacroEngineFactory.GetByExtension("blah"));
|
||||
}
|
||||
|
||||
#region Classes for tests
|
||||
public class MacroEngine1 : IMacroEngine
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "MacroEngine1"; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedExtensions
|
||||
{
|
||||
get { return new[] {"me1"}; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedUIExtensions
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public Dictionary<string, IMacroGuiRendering> SupportedProperties
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool Validate(string code, string tempFileName, INode currentPage, out string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string Execute(MacroModel macro, INode currentPage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class MacroEngine2 : IMacroEngine
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "MacroEngine2"; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedExtensions
|
||||
{
|
||||
get { return new[] { "me2" }; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedUIExtensions
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public Dictionary<string, IMacroGuiRendering> SupportedProperties
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool Validate(string code, string tempFileName, INode currentPage, out string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string Execute(MacroModel macro, INode currentPage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using umbraco.cms.businesslogic.macro;
|
||||
using Umbraco.Core;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.Macros
|
||||
{
|
||||
[TestFixture]
|
||||
public class MacroEngineFactoryTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
|
||||
//this ensures its reset
|
||||
PluginManager.Current = new PluginManager(false);
|
||||
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
{
|
||||
this.GetType().Assembly
|
||||
};
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
PluginManager.Current = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_All()
|
||||
{
|
||||
var engines = MacroEngineFactory.GetAll();
|
||||
Assert.AreEqual(2, engines.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Engine()
|
||||
{
|
||||
var engine1 = MacroEngineFactory.GetEngine("MacroEngine1");
|
||||
Assert.IsNotNull(engine1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_By_Filename()
|
||||
{
|
||||
var engine1 = MacroEngineFactory.GetByFilename("test.me1");
|
||||
var engine2 = MacroEngineFactory.GetByFilename("test.me2");
|
||||
Assert.IsNotNull(engine1);
|
||||
Assert.IsNotNull(engine2);
|
||||
Assert.Throws<MacroEngineException>(() => MacroEngineFactory.GetByFilename("test.blah"));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_By_Extension()
|
||||
{
|
||||
var engine1 = MacroEngineFactory.GetByExtension("me1");
|
||||
var engine2 = MacroEngineFactory.GetByExtension("me2");
|
||||
Assert.IsNotNull(engine1);
|
||||
Assert.IsNotNull(engine2);
|
||||
Assert.Throws<MacroEngineException>(() => MacroEngineFactory.GetByExtension("blah"));
|
||||
}
|
||||
|
||||
#region Classes for tests
|
||||
public class MacroEngine1 : IMacroEngine
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "MacroEngine1"; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedExtensions
|
||||
{
|
||||
get { return new[] {"me1"}; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedUIExtensions
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public Dictionary<string, IMacroGuiRendering> SupportedProperties
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool Validate(string code, string tempFileName, INode currentPage, out string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string Execute(MacroModel macro, INode currentPage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class MacroEngine2 : IMacroEngine
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "MacroEngine2"; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedExtensions
|
||||
{
|
||||
get { return new[] { "me2" }; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> SupportedUIExtensions
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public Dictionary<string, IMacroGuiRendering> SupportedProperties
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool Validate(string code, string tempFileName, INode currentPage, out string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string Execute(MacroModel macro, INode currentPage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Web;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
@@ -418,7 +419,7 @@ namespace Umbraco.Tests.Models
|
||||
Assert.That(content.Properties["title"], Is.Not.Null);
|
||||
Assert.That(content.Properties["title"].Alias, Is.EqualTo("title"));
|
||||
Assert.That(content.Properties["title"].Value, Is.EqualTo("This is the new title"));
|
||||
Assert.That(content.Properties["metaDescription"].Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
Assert.That(content.Properties["description"].Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -612,9 +613,9 @@ namespace Umbraco.Tests.Models
|
||||
// Assert
|
||||
Assert.That(content.Properties.Contains("author"), Is.True);
|
||||
Assert.That(content.Properties.Contains("keywords"), Is.True);
|
||||
Assert.That(content.Properties.Contains("metaDescription"), Is.True);
|
||||
Assert.That(content.Properties.Contains("description"), Is.True);
|
||||
Assert.That(content.Properties["keywords"].Value, Is.EqualTo("text,page,meta"));
|
||||
Assert.That(content.Properties["metaDescription"].Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
Assert.That(content.Properties["description"].Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -631,7 +632,7 @@ namespace Umbraco.Tests.Models
|
||||
// Assert
|
||||
Assert.That(content.Properties.Contains("author"), Is.True);
|
||||
Assert.That(content.Properties.Contains("keywords"), Is.False);
|
||||
Assert.That(content.Properties.Contains("metaDescription"), Is.False);
|
||||
Assert.That(content.Properties.Contains("description"), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -828,7 +829,7 @@ namespace Umbraco.Tests.Models
|
||||
public void Can_Avoid_Circular_Dependencies_In_Composition()
|
||||
{
|
||||
var textPage = MockedContentTypes.CreateTextpageContentType();
|
||||
var parent = MockedContentTypes.CreateSimpleContentType("parent", "Parent");
|
||||
var parent = MockedContentTypes.CreateSimpleContentType("parent", "Parent", null, true);
|
||||
var meta = MockedContentTypes.CreateMetaContentType();
|
||||
var mixin1 = MockedContentTypes.CreateSimpleContentType("mixin1", "Mixin1", new PropertyTypeCollection(
|
||||
new List<PropertyType>
|
||||
@@ -863,7 +864,9 @@ namespace Umbraco.Tests.Models
|
||||
var addedMetaMixin2 = mixin2.AddContentType(meta);
|
||||
var addedMixin2 = mixin1.AddContentType(mixin2);
|
||||
var addedMeta = parent.AddContentType(meta);
|
||||
|
||||
var addedMixin1 = parent.AddContentType(mixin1);
|
||||
|
||||
var addedMixin1Textpage = textPage.AddContentType(mixin1);
|
||||
var addedTextpageParent = parent.AddContentType(textPage);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Umbraco.Tests.Models
|
||||
Assert.AreEqual(content.Properties["title"].Value.ToString(), element.Elements("title").Single().Value);
|
||||
Assert.AreEqual(content.Properties["bodyText"].Value.ToString(), element.Elements("bodyText").Single().Value);
|
||||
Assert.AreEqual(content.Properties["keywords"].Value.ToString(), element.Elements("keywords").Single().Value);
|
||||
Assert.AreEqual(content.Properties["metaDescription"].Value.ToString(), element.Elements("metaDescription").Single().Value);
|
||||
Assert.AreEqual(content.Properties["description"].Value.ToString(), element.Elements("description").Single().Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
-32
@@ -1,33 +1,33 @@
|
||||
using System.Web.Mvc;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class HtmlHelperExtensionMethodsTests
|
||||
{
|
||||
[SetUp]
|
||||
public virtual void Initialize()
|
||||
{
|
||||
//create an empty htmlHelper
|
||||
_htmlHelper = new HtmlHelper(new ViewContext(), new ViewPage());
|
||||
}
|
||||
|
||||
private HtmlHelper _htmlHelper;
|
||||
|
||||
[Test]
|
||||
public void Wrap_Simple()
|
||||
{
|
||||
var output = _htmlHelper.Wrap("div", "hello world");
|
||||
Assert.AreEqual("<div>hello world</div>", output.ToHtmlString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Wrap_Object_Attributes()
|
||||
{
|
||||
var output = _htmlHelper.Wrap("div", "hello world", new {style = "color:red;", onclick = "void();"});
|
||||
Assert.AreEqual("<div style=\"color:red;\" onclick=\"void();\">hello world</div>", output.ToHtmlString());
|
||||
}
|
||||
}
|
||||
using System.Web.Mvc;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests.Mvc
|
||||
{
|
||||
[TestFixture]
|
||||
public class HtmlHelperExtensionMethodsTests
|
||||
{
|
||||
[SetUp]
|
||||
public virtual void Initialize()
|
||||
{
|
||||
//create an empty htmlHelper
|
||||
_htmlHelper = new HtmlHelper(new ViewContext(), new ViewPage());
|
||||
}
|
||||
|
||||
private HtmlHelper _htmlHelper;
|
||||
|
||||
[Test]
|
||||
public void Wrap_Simple()
|
||||
{
|
||||
var output = _htmlHelper.Wrap("div", "hello world");
|
||||
Assert.AreEqual("<div>hello world</div>", output.ToHtmlString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Wrap_Object_Attributes()
|
||||
{
|
||||
var output = _htmlHelper.Wrap("div", "hello world", new {style = "color:red;", onclick = "void();"});
|
||||
Assert.AreEqual("<div style=\"color:red;\" onclick=\"void();\">hello world</div>", output.ToHtmlString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,7 +408,7 @@ namespace Umbraco.Tests.Mvc
|
||||
var ctx = new UmbracoContext(
|
||||
GetHttpContextFactory(url, routeData).HttpContext,
|
||||
appCtx,
|
||||
new PublishedCaches(cache, new PublishedMediaCache()),
|
||||
new PublishedCaches(cache, new PublishedMediaCache(appCtx)),
|
||||
new WebSecurity(http, appCtx));
|
||||
|
||||
//if (setSingleton)
|
||||
|
||||
@@ -193,8 +193,8 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var ctMain = MockedContentTypes.CreateSimpleContentType();
|
||||
var ctChild1 = MockedContentTypes.CreateSimpleContentType("child1", "Child 1", ctMain);
|
||||
var ctChild2 = MockedContentTypes.CreateSimpleContentType("child2", "Child 2", ctChild1);
|
||||
var ctChild1 = MockedContentTypes.CreateSimpleContentType("child1", "Child 1", ctMain, true);
|
||||
var ctChild2 = MockedContentTypes.CreateSimpleContentType("child2", "Child 2", ctChild1, true);
|
||||
|
||||
repository.AddOrUpdate(ctMain);
|
||||
repository.AddOrUpdate(ctChild1);
|
||||
@@ -282,14 +282,14 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
var contentType = repository.Get(NodeDto.NodeIdSeed + 1);
|
||||
|
||||
// Act
|
||||
contentType.PropertyGroups["Meta"].PropertyTypes.Remove("metaDescription");
|
||||
contentType.PropertyGroups["Meta"].PropertyTypes.Remove("description");
|
||||
repository.AddOrUpdate(contentType);
|
||||
unitOfWork.Commit();
|
||||
|
||||
var result = repository.Get(NodeDto.NodeIdSeed + 1);
|
||||
|
||||
// Assert
|
||||
Assert.That(result.PropertyTypes.Any(x => x.Alias == "metaDescription"), Is.False);
|
||||
Assert.That(result.PropertyTypes.Any(x => x.Alias == "description"), Is.False);
|
||||
Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(result.PropertyGroups.Count));
|
||||
Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(result.PropertyTypes.Count()));
|
||||
}
|
||||
@@ -434,7 +434,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
// Assert
|
||||
Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(3));
|
||||
Assert.That(contentType.PropertyTypes.Any(x => x.Alias == "keywords"), Is.False);
|
||||
Assert.That(subpage.Properties.First(x => x.Alias == "metaDescription").Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
Assert.That(subpage.Properties.First(x => x.Alias == "description").Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
//Assert
|
||||
var updated = contentRepository.Get(subpage.Id);
|
||||
Assert.That(updated.GetValue("metaAuthor").ToString(), Is.EqualTo("John Doe"));
|
||||
Assert.That(updated.Properties.First(x => x.Alias == "metaDescription").Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
Assert.That(updated.Properties.First(x => x.Alias == "description").Value, Is.EqualTo("This is the meta description for a textpage"));
|
||||
|
||||
Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(4));
|
||||
Assert.That(contentType.PropertyTypes.Any(x => x.Alias == "metaAuthor"), Is.True);
|
||||
|
||||
+16
-16
@@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Used for PluginTypeResolverTests
|
||||
/// </summary>
|
||||
internal static class PluginManagerExtensions
|
||||
{
|
||||
public static IEnumerable<Type> ResolveFindMeTypes(this PluginManager resolver)
|
||||
{
|
||||
return resolver.ResolveTypes<PluginManagerTests.IFindMe>();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.Plugins
|
||||
{
|
||||
/// <summary>
|
||||
/// Used for PluginTypeResolverTests
|
||||
/// </summary>
|
||||
internal static class PluginManagerExtensions
|
||||
{
|
||||
public static IEnumerable<Type> ResolveFindMeTypes(this PluginManager resolver)
|
||||
{
|
||||
return resolver.ResolveTypes<PluginManagerTests.IFindMe>();
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-13
@@ -1,30 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web.Compilation;
|
||||
using NUnit.Framework;
|
||||
using SqlCE4Umbraco;
|
||||
using umbraco;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.cms.businesslogic;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.editorControls;
|
||||
using umbraco.MacroEngines;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using umbraco.uicontrols;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using umbraco;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.MacroEngines;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.editorControls;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.uicontrols;
|
||||
using umbraco.cms;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
namespace Umbraco.Tests.Plugins
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
@@ -285,7 +281,7 @@ namespace Umbraco.Tests
|
||||
public void Resolves_Attributed_Trees()
|
||||
{
|
||||
var trees = PluginManager.Current.ResolveAttributedTrees();
|
||||
Assert.AreEqual(18, trees.Count());
|
||||
Assert.AreEqual(19, trees.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
+637
-640
File diff suppressed because it is too large
Load Diff
+71
-78
@@ -1,79 +1,72 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.Common;
|
||||
using System.Data.Odbc;
|
||||
using System.Data.OleDb;
|
||||
using System.Data.SqlClient;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.Scheduling;
|
||||
using UmbracoExamine;
|
||||
using UmbracoExamine.DataServices;
|
||||
using umbraco;
|
||||
using umbraco.presentation;
|
||||
using umbraco.presentation.nodeFactory;
|
||||
using umbraco.presentation.umbraco.Search;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for TypeHelper
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class TypeHelperTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Is_Static_Class()
|
||||
{
|
||||
Assert.IsTrue(TypeHelper.IsStaticClass(typeof(TypeHelper)));
|
||||
Assert.IsFalse(TypeHelper.IsStaticClass(typeof(TypeHelperTests)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Find_Common_Base_Class()
|
||||
{
|
||||
var t1 = TypeHelper.GetLowestBaseType(typeof (OleDbCommand),
|
||||
typeof (OdbcCommand),
|
||||
typeof (SqlCommand));
|
||||
Assert.IsFalse(t1.Success);
|
||||
|
||||
var t2 = TypeHelper.GetLowestBaseType(typeof (OleDbCommand),
|
||||
typeof (OdbcCommand),
|
||||
typeof (SqlCommand),
|
||||
typeof (Component));
|
||||
Assert.IsTrue(t2.Success);
|
||||
Assert.AreEqual(typeof(Component), t2.Result);
|
||||
|
||||
var t3 = TypeHelper.GetLowestBaseType(typeof (OleDbCommand),
|
||||
typeof (OdbcCommand),
|
||||
typeof (SqlCommand),
|
||||
typeof (Component),
|
||||
typeof (Component).BaseType);
|
||||
Assert.IsTrue(t3.Success);
|
||||
Assert.AreEqual(typeof(MarshalByRefObject), t3.Result);
|
||||
|
||||
var t4 = TypeHelper.GetLowestBaseType(typeof(OleDbCommand),
|
||||
typeof(OdbcCommand),
|
||||
typeof(SqlCommand),
|
||||
typeof(Component),
|
||||
typeof(Component).BaseType,
|
||||
typeof(int));
|
||||
Assert.IsFalse(t4.Success);
|
||||
|
||||
var t5 = TypeHelper.GetLowestBaseType(typeof(PropertyAliasDto));
|
||||
Assert.IsTrue(t5.Success);
|
||||
Assert.AreEqual(typeof(PropertyAliasDto), t5.Result);
|
||||
|
||||
var t6 = TypeHelper.GetLowestBaseType(typeof (IApplicationEventHandler),
|
||||
typeof (Scheduler),
|
||||
typeof(CacheRefresherEventHandler));
|
||||
Assert.IsTrue(t6.Success);
|
||||
Assert.AreEqual(typeof(IApplicationEventHandler), t6.Result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.Odbc;
|
||||
using System.Data.OleDb;
|
||||
using System.Data.SqlClient;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.Scheduling;
|
||||
using UmbracoExamine.DataServices;
|
||||
|
||||
namespace Umbraco.Tests.Plugins
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for TypeHelper
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class TypeHelperTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Is_Static_Class()
|
||||
{
|
||||
Assert.IsTrue(TypeHelper.IsStaticClass(typeof(TypeHelper)));
|
||||
Assert.IsFalse(TypeHelper.IsStaticClass(typeof(TypeHelperTests)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Find_Common_Base_Class()
|
||||
{
|
||||
var t1 = TypeHelper.GetLowestBaseType(typeof (OleDbCommand),
|
||||
typeof (OdbcCommand),
|
||||
typeof (SqlCommand));
|
||||
Assert.IsFalse(t1.Success);
|
||||
|
||||
var t2 = TypeHelper.GetLowestBaseType(typeof (OleDbCommand),
|
||||
typeof (OdbcCommand),
|
||||
typeof (SqlCommand),
|
||||
typeof (Component));
|
||||
Assert.IsTrue(t2.Success);
|
||||
Assert.AreEqual(typeof(Component), t2.Result);
|
||||
|
||||
var t3 = TypeHelper.GetLowestBaseType(typeof (OleDbCommand),
|
||||
typeof (OdbcCommand),
|
||||
typeof (SqlCommand),
|
||||
typeof (Component),
|
||||
typeof (Component).BaseType);
|
||||
Assert.IsTrue(t3.Success);
|
||||
Assert.AreEqual(typeof(MarshalByRefObject), t3.Result);
|
||||
|
||||
var t4 = TypeHelper.GetLowestBaseType(typeof(OleDbCommand),
|
||||
typeof(OdbcCommand),
|
||||
typeof(SqlCommand),
|
||||
typeof(Component),
|
||||
typeof(Component).BaseType,
|
||||
typeof(int));
|
||||
Assert.IsFalse(t4.Success);
|
||||
|
||||
var t5 = TypeHelper.GetLowestBaseType(typeof(PropertyAliasDto));
|
||||
Assert.IsTrue(t5.Success);
|
||||
Assert.AreEqual(typeof(PropertyAliasDto), t5.Result);
|
||||
|
||||
var t6 = TypeHelper.GetLowestBaseType(typeof (IApplicationEventHandler),
|
||||
typeof (Scheduler),
|
||||
typeof(CacheRefresherEventHandler));
|
||||
Assert.IsTrue(t6.Success);
|
||||
Assert.AreEqual(typeof(IApplicationEventHandler), t6.Result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -92,9 +92,9 @@ namespace Umbraco.Tests.PublishedCache
|
||||
|
||||
_umbracoContext = new UmbracoContext(
|
||||
_httpContextFactory.HttpContext,
|
||||
ApplicationContext.Current,
|
||||
new PublishedCaches(cache, new PublishedMediaCache()),
|
||||
new WebSecurity(_httpContextFactory.HttpContext, ApplicationContext.Current));
|
||||
ApplicationContext,
|
||||
new PublishedCaches(cache, new PublishedMediaCache(ApplicationContext)),
|
||||
new WebSecurity(_httpContextFactory.HttpContext, ApplicationContext));
|
||||
|
||||
_cache = _umbracoContext.ContentCache;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.PublishedCache
|
||||
var mChild2 = global::umbraco.cms.businesslogic.media.Media.MakeNew("Child2", mType, user, mRoot2.Id);
|
||||
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application), ctx);
|
||||
var roots = cache.GetAtRoot();
|
||||
Assert.AreEqual(2, roots.Count());
|
||||
Assert.IsTrue(roots.Select(x => x.Id).ContainsAll(new[] {mRoot1.Id, mRoot2.Id}));
|
||||
@@ -126,6 +126,8 @@ namespace Umbraco.Tests.PublishedCache
|
||||
[Test]
|
||||
public void Convert_From_Search_Result()
|
||||
{
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
|
||||
var result = new SearchResult()
|
||||
{
|
||||
Id = 1234,
|
||||
@@ -144,7 +146,7 @@ namespace Umbraco.Tests.PublishedCache
|
||||
result.Fields.Add("updateDate", "2012-07-16T10:34:09");
|
||||
result.Fields.Add("writerName", "Shannon");
|
||||
|
||||
var store = new PublishedMediaCache();
|
||||
var store = new PublishedMediaCache(ctx.Application);
|
||||
var doc = store.ConvertFromSearchResult(result);
|
||||
|
||||
DoAssert(doc, 1234, 0, 0, "", "Image", 0, "Shannon", "", 0, 0, "-1,1234", default(DateTime), DateTime.Parse("2012-07-16T10:34:09"), 2);
|
||||
@@ -154,9 +156,11 @@ namespace Umbraco.Tests.PublishedCache
|
||||
[Test]
|
||||
public void Convert_From_XPath_Navigator()
|
||||
{
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
|
||||
var xmlDoc = GetMediaXml();
|
||||
var navigator = xmlDoc.SelectSingleNode("/root/Image").CreateNavigator();
|
||||
var cache = new PublishedMediaCache();
|
||||
var cache = new PublishedMediaCache(ctx.Application);
|
||||
var doc = cache.ConvertFromXPathNavigator(navigator);
|
||||
|
||||
DoAssert(doc, 2000, 0, 2, "image1", "Image", 2044, "Shannon", "Shannon2", 22, 33, "-1,2000", DateTime.Parse("2012-06-12T14:13:17"), DateTime.Parse("2012-07-20T18:50:43"), 1);
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
});
|
||||
|
||||
PublishedCachesResolver.Current = new PublishedCachesResolver(new PublishedCaches(
|
||||
new PublishedContentCache(), new PublishedMediaCache()));
|
||||
new PublishedContentCache(), new PublishedMediaCache(ApplicationContext)));
|
||||
|
||||
if (PublishedContentModelFactoryResolver.HasCurrent == false)
|
||||
PublishedContentModelFactoryResolver.Current = new PublishedContentModelFactoryResolver();
|
||||
|
||||
@@ -11,6 +11,7 @@ using Examine.LuceneEngine;
|
||||
using Examine.LuceneEngine.Providers;
|
||||
using Lucene.Net.Analysis.Standard;
|
||||
using Lucene.Net.Store;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
@@ -60,7 +61,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
internal static IPublishedContent GetNode(int id, UmbracoContext umbracoContext)
|
||||
{
|
||||
var ctx = umbracoContext;
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application), ctx);
|
||||
var doc = cache.GetById(id);
|
||||
Assert.IsNotNull(doc);
|
||||
return doc;
|
||||
@@ -112,7 +113,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -141,7 +142,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//ensure it is found
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -181,7 +182,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -203,7 +204,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -225,7 +226,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -247,7 +248,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -266,7 +267,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
indexer.RebuildIndex();
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var searcher = IndexInitializer.GetUmbracoSearcher(luceneDir);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(searcher, indexer), ctx);
|
||||
var cache = new ContextualPublishedMediaCache(new PublishedMediaCache(ctx.Application, searcher, indexer), ctx);
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -412,6 +413,100 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Assert.IsTrue(publishedSubChild1.AncestorsOrSelf().Select(x => x.Id).ContainsAll(
|
||||
new[] { mSubChild1.Id, mChild1.Id, mRoot.Id }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Convert_From_Legacy_Xml()
|
||||
{
|
||||
var config = SettingsForTests.GenerateMockSettings();
|
||||
|
||||
var contentMock = Mock.Get(config.Content);
|
||||
contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(true);
|
||||
|
||||
SettingsForTests.ConfigureSettings(config);
|
||||
|
||||
var nodeId = 2112;
|
||||
|
||||
var xml = XElement.Parse(@"<node id=""2112"" version=""5b3e46ab-3e37-4cfa-ab70-014234b5bd39"" parentID=""2222"" level=""3"" writerID=""0"" nodeType=""1032"" template=""0"" sortOrder=""1"" createDate=""2010-05-19T17:32:46"" updateDate=""2010-05-19T17:32:46"" nodeName=""Sam's Umbraco Image"" urlName=""acnestressscrub"" writerName=""Administrator"" nodeTypeAlias=""Image"" path=""-1,1111,2222,2112"">
|
||||
<data alias=""umbracoFile""><![CDATA[/media/1234/blah.pdf]]></data>
|
||||
<data alias=""umbracoWidth"">115</data>
|
||||
<data alias=""umbracoHeight"">268</data>
|
||||
<data alias=""umbracoBytes"">10726</data>
|
||||
<data alias=""umbracoExtension"">jpg</data>
|
||||
<node id=""3113"" version=""5b3e46ab-3e37-4cfa-ab70-014234b5bd33"" parentID=""2112"" level=""4"" writerID=""0"" nodeType=""1032"" template=""0"" sortOrder=""2"" createDate=""2010-05-19T17:32:46"" updateDate=""2010-05-19T17:32:46"" nodeName=""Another Umbraco Image"" urlName=""acnestressscrub"" writerName=""Administrator"" nodeTypeAlias=""Image"" path=""-1,1111,2222,2112,3113"">
|
||||
<data alias=""umbracoFile""><![CDATA[/media/1234/blah.pdf]]></data>
|
||||
<data alias=""umbracoWidth"">115</data>
|
||||
<data alias=""umbracoHeight"">268</data>
|
||||
<data alias=""umbracoBytes"">10726</data>
|
||||
<data alias=""umbracoExtension"">jpg</data>
|
||||
</node>
|
||||
</node>");
|
||||
var node = xml.DescendantsAndSelf("node").Single(x => (int) x.Attribute("id") == nodeId);
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(ApplicationContext);
|
||||
|
||||
var nav = node.CreateNavigator();
|
||||
|
||||
var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/node"), nodeId);
|
||||
|
||||
Assert.AreEqual(nodeId, converted.Id);
|
||||
Assert.AreEqual(3, converted.Level);
|
||||
Assert.AreEqual(1, converted.SortOrder);
|
||||
Assert.AreEqual("Sam's Umbraco Image", converted.Name);
|
||||
Assert.AreEqual("-1,1111,2222,2112", converted.Path);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Convert_From_Standard_Xml()
|
||||
{
|
||||
var config = SettingsForTests.GenerateMockSettings();
|
||||
|
||||
var contentMock = Mock.Get(config.Content);
|
||||
contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(true);
|
||||
|
||||
SettingsForTests.ConfigureSettings(config);
|
||||
|
||||
var nodeId = 2112;
|
||||
|
||||
var xml = XElement.Parse(@"<Image id=""2112"" version=""5b3e46ab-3e37-4cfa-ab70-014234b5bd39"" parentID=""2222"" level=""3"" writerID=""0"" nodeType=""1032"" template=""0"" sortOrder=""1"" createDate=""2010-05-19T17:32:46"" updateDate=""2010-05-19T17:32:46"" nodeName=""Sam's Umbraco Image"" urlName=""acnestressscrub"" writerName=""Administrator"" nodeTypeAlias=""Image"" path=""-1,1111,2222,2112"" isDoc="""">
|
||||
<umbracoFile><![CDATA[/media/1234/blah.pdf]]></umbracoFile>
|
||||
<umbracoWidth>115</umbracoWidth>
|
||||
<umbracoHeight>268</umbracoHeight>
|
||||
<umbracoBytes>10726</umbracoBytes>
|
||||
<umbracoExtension>jpg</umbracoExtension>
|
||||
<Image id=""3113"" version=""5b3e46ab-3e37-4cfa-ab70-014234b5bd33"" parentID=""2112"" level=""4"" writerID=""0"" nodeType=""1032"" template=""0"" sortOrder=""2"" createDate=""2010-05-19T17:32:46"" updateDate=""2010-05-19T17:32:46"" nodeName=""Another Umbraco Image"" urlName=""acnestressscrub"" writerName=""Administrator"" nodeTypeAlias=""Image"" path=""-1,1111,2222,2112,3113"" isDoc="""">
|
||||
<umbracoFile><![CDATA[/media/1234/blah.pdf]]></umbracoFile>
|
||||
<umbracoWidth>115</umbracoWidth>
|
||||
<umbracoHeight>268</umbracoHeight>
|
||||
<umbracoBytes>10726</umbracoBytes>
|
||||
<umbracoExtension>jpg</umbracoExtension>
|
||||
</Image>
|
||||
</Image>");
|
||||
var node = xml.DescendantsAndSelf("Image").Single(x => (int)x.Attribute("id") == nodeId);
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(ApplicationContext);
|
||||
|
||||
var nav = node.CreateNavigator();
|
||||
|
||||
var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/Image"), nodeId);
|
||||
|
||||
Assert.AreEqual(nodeId, converted.Id);
|
||||
Assert.AreEqual(3, converted.Level);
|
||||
Assert.AreEqual(1, converted.SortOrder);
|
||||
Assert.AreEqual("Sam's Umbraco Image", converted.Name);
|
||||
Assert.AreEqual("-1,1111,2222,2112", converted.Path);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Detects_Error_In_Xml()
|
||||
{
|
||||
var errorXml = new XElement("error", string.Format("No media is maching '{0}'", 1234));
|
||||
var nav = errorXml.CreateNavigator();
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(ApplicationContext);
|
||||
var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/"), 1234);
|
||||
|
||||
Assert.IsNull(converted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Scheduling;
|
||||
|
||||
namespace Umbraco.Tests.Scheduling
|
||||
{
|
||||
[TestFixture]
|
||||
public class BackgroundTaskRunnerTests
|
||||
{
|
||||
|
||||
|
||||
[Test]
|
||||
public void Startup_And_Shutdown()
|
||||
{
|
||||
BackgroundTaskRunner<IBackgroundTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<IBackgroundTask>(true, true))
|
||||
{
|
||||
tManager.StartUp();
|
||||
}
|
||||
|
||||
NUnit.Framework.Assert.IsFalse(tManager.IsRunning);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Startup_Starts_Automatically()
|
||||
{
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(true, true))
|
||||
{
|
||||
tManager.Add(new MyTask());
|
||||
NUnit.Framework.Assert.IsTrue(tManager.IsRunning);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Task_Runs()
|
||||
{
|
||||
var myTask = new MyTask();
|
||||
var waitHandle = new ManualResetEvent(false);
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(true, true))
|
||||
{
|
||||
tManager.TaskCompleted += (sender, task) => waitHandle.Set();
|
||||
|
||||
tManager.Add(myTask);
|
||||
|
||||
//wait for ITasks to complete
|
||||
waitHandle.WaitOne();
|
||||
|
||||
NUnit.Framework.Assert.IsTrue(myTask.Ended != default(DateTime));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Many_Tasks_Run()
|
||||
{
|
||||
var tasks = new Dictionary<BaseTask, ManualResetEvent>();
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
tasks.Add(new MyTask(), new ManualResetEvent(false));
|
||||
}
|
||||
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(true, true))
|
||||
{
|
||||
tManager.TaskCompleted += (sender, task) => tasks[task.Task].Set();
|
||||
|
||||
tasks.ForEach(t => tManager.Add(t.Key));
|
||||
|
||||
//wait for all ITasks to complete
|
||||
WaitHandle.WaitAll(tasks.Values.Select(x => (WaitHandle)x).ToArray());
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
NUnit.Framework.Assert.IsTrue(task.Key.Ended != default(DateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Tasks_Can_Keep_Being_Added_And_Will_Execute()
|
||||
{
|
||||
Func<Dictionary<BaseTask, ManualResetEvent>> getTasks = () =>
|
||||
{
|
||||
var newTasks = new Dictionary<BaseTask, ManualResetEvent>();
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
newTasks.Add(new MyTask(), new ManualResetEvent(false));
|
||||
}
|
||||
return newTasks;
|
||||
};
|
||||
|
||||
IDictionary<BaseTask, ManualResetEvent> tasks = getTasks();
|
||||
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(true, true))
|
||||
{
|
||||
tManager.TaskCompleted += (sender, task) => tasks[task.Task].Set();
|
||||
|
||||
//execute first batch
|
||||
tasks.ForEach(t => tManager.Add(t.Key));
|
||||
|
||||
//wait for all ITasks to complete
|
||||
WaitHandle.WaitAll(tasks.Values.Select(x => (WaitHandle)x).ToArray());
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
NUnit.Framework.Assert.IsTrue(task.Key.Ended != default(DateTime));
|
||||
}
|
||||
|
||||
//execute another batch after a bit
|
||||
Thread.Sleep(2000);
|
||||
|
||||
tasks = getTasks();
|
||||
tasks.ForEach(t => tManager.Add(t.Key));
|
||||
|
||||
//wait for all ITasks to complete
|
||||
WaitHandle.WaitAll(tasks.Values.Select(x => (WaitHandle)x).ToArray());
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
NUnit.Framework.Assert.IsTrue(task.Key.Ended != default(DateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Task_Queue_Will_Be_Completed_Before_Shutdown()
|
||||
{
|
||||
var tasks = new Dictionary<BaseTask, ManualResetEvent>();
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
tasks.Add(new MyTask(), new ManualResetEvent(false));
|
||||
}
|
||||
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(true, true))
|
||||
{
|
||||
tManager.TaskCompleted += (sender, task) => tasks[task.Task].Set();
|
||||
|
||||
tasks.ForEach(t => tManager.Add(t.Key));
|
||||
|
||||
////wait for all ITasks to complete
|
||||
//WaitHandle.WaitAll(tasks.Values.Select(x => (WaitHandle)x).ToArray());
|
||||
|
||||
tManager.Stop(false);
|
||||
//immediate stop will block until complete - but since we are running on
|
||||
// a single thread this doesn't really matter as the above will just process
|
||||
// until complete.
|
||||
tManager.Stop(true);
|
||||
|
||||
NUnit.Framework.Assert.AreEqual(0, tManager.TaskCount);
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE: These tests work in .Net 4.5 but in this current version we don't have the correct
|
||||
// async/await signatures with GetAwaiter, so am just commenting these out in this version
|
||||
|
||||
[Test]
|
||||
public async void Non_Persistent_Runner_Will_End_After_Queue_Empty()
|
||||
{
|
||||
var tasks = new List<BaseTask>();
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
tasks.Add(new MyTask());
|
||||
}
|
||||
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(persistentThread: false, dedicatedThread:true))
|
||||
{
|
||||
tasks.ForEach(t => tManager.Add(t));
|
||||
|
||||
//wait till the thread is done
|
||||
await tManager;
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
Assert.IsTrue(task.Ended != default(DateTime));
|
||||
}
|
||||
|
||||
Assert.AreEqual(TaskStatus.RanToCompletion, tManager.TaskStatus);
|
||||
Assert.IsFalse(tManager.IsRunning);
|
||||
Assert.IsFalse(tManager.IsDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async void Non_Persistent_Runner_Will_Start_New_Threads_When_Required()
|
||||
{
|
||||
Func<List<BaseTask>> getTasks = () =>
|
||||
{
|
||||
var newTasks = new List<BaseTask>();
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
newTasks.Add(new MyTask());
|
||||
}
|
||||
return newTasks;
|
||||
};
|
||||
|
||||
List<BaseTask> tasks = getTasks();
|
||||
|
||||
BackgroundTaskRunner<BaseTask> tManager;
|
||||
using (tManager = new BackgroundTaskRunner<BaseTask>(persistentThread: false, dedicatedThread: true))
|
||||
{
|
||||
tasks.ForEach(t => tManager.Add(t));
|
||||
|
||||
//wait till the thread is done
|
||||
await tManager;
|
||||
|
||||
Assert.AreEqual(TaskStatus.RanToCompletion, tManager.TaskStatus);
|
||||
Assert.IsFalse(tManager.IsRunning);
|
||||
Assert.IsFalse(tManager.IsDisposed);
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
Assert.IsTrue(task.Ended != default(DateTime));
|
||||
}
|
||||
|
||||
//create more tasks
|
||||
tasks = getTasks();
|
||||
|
||||
//add more tasks
|
||||
tasks.ForEach(t => tManager.Add(t));
|
||||
|
||||
//wait till the thread is done
|
||||
await tManager;
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
Assert.IsTrue(task.Ended != default(DateTime));
|
||||
}
|
||||
|
||||
Assert.AreEqual(TaskStatus.RanToCompletion, tManager.TaskStatus);
|
||||
Assert.IsFalse(tManager.IsRunning);
|
||||
Assert.IsFalse(tManager.IsDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
private class MyTask : BaseTask
|
||||
{
|
||||
public MyTask()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Run()
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseTask : IBackgroundTask
|
||||
{
|
||||
public Guid UniqueId { get; protected set; }
|
||||
|
||||
public abstract void Run();
|
||||
public abstract void Cancel();
|
||||
|
||||
public DateTime Queued { get; set; }
|
||||
public DateTime Started { get; set; }
|
||||
public DateTime Ended { get; set; }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
Ended = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ServerEnvironmentHelperTests
|
||||
{
|
||||
[Test]
|
||||
public void Get_Base_Url_Single_Server_Orig_Request_Url_No_SSL()
|
||||
{
|
||||
var appContext = new ApplicationContext(null)
|
||||
{
|
||||
OriginalRequestUrl = "test.com"
|
||||
};
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseSSL", "false");
|
||||
|
||||
var result = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl(
|
||||
appContext,
|
||||
Mock.Of<IUmbracoSettingsSection>(
|
||||
section =>
|
||||
section.DistributedCall == Mock.Of<IDistributedCallSection>(callSection => callSection.Servers == Enumerable.Empty<IServer>())
|
||||
&& section.ScheduledTasks == Mock.Of<IScheduledTasksSection>()));
|
||||
|
||||
|
||||
Assert.AreEqual("http://test.com/", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Base_Url_Single_Server_Orig_Request_Url_With_SSL()
|
||||
{
|
||||
var appContext = new ApplicationContext(null)
|
||||
{
|
||||
OriginalRequestUrl = "test.com"
|
||||
};
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseSSL", "true");
|
||||
|
||||
var result = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl(
|
||||
appContext,
|
||||
Mock.Of<IUmbracoSettingsSection>(
|
||||
section =>
|
||||
section.DistributedCall == Mock.Of<IDistributedCallSection>(callSection => callSection.Servers == Enumerable.Empty<IServer>())
|
||||
&& section.ScheduledTasks == Mock.Of<IScheduledTasksSection>()));
|
||||
|
||||
|
||||
Assert.AreEqual("https://test.com/", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Base_Url_Single_Server_Via_Config_Url_No_SSL()
|
||||
{
|
||||
var appContext = new ApplicationContext(null);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseSSL", "false");
|
||||
|
||||
var result = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl(
|
||||
appContext,
|
||||
Mock.Of<IUmbracoSettingsSection>(
|
||||
section =>
|
||||
section.DistributedCall == Mock.Of<IDistributedCallSection>(callSection => callSection.Servers == Enumerable.Empty<IServer>())
|
||||
&& section.ScheduledTasks == Mock.Of<IScheduledTasksSection>(tasksSection => tasksSection.BaseUrl == "mycoolhost.com/hello/world")));
|
||||
|
||||
|
||||
Assert.AreEqual("http://mycoolhost.com/hello/world/", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Base_Url_Single_Server_Via_Config_Url_With_SSL()
|
||||
{
|
||||
var appContext = new ApplicationContext(null);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseSSL", "true");
|
||||
|
||||
var result = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl(
|
||||
appContext,
|
||||
Mock.Of<IUmbracoSettingsSection>(
|
||||
section =>
|
||||
section.DistributedCall == Mock.Of<IDistributedCallSection>(callSection => callSection.Servers == Enumerable.Empty<IServer>())
|
||||
&& section.ScheduledTasks == Mock.Of<IScheduledTasksSection>(tasksSection => tasksSection.BaseUrl == "mycoolhost.com/hello/world")));
|
||||
|
||||
|
||||
Assert.AreEqual("https://mycoolhost.com/hello/world/", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1335,7 +1335,7 @@ namespace Umbraco.Tests.Services
|
||||
//MCH: I'm guessing this is an issue because of the format the date is actually stored as, right? Cause we don't do any formatting when saving or loading
|
||||
Assert.That(sut.GetValue<DateTime>("dateTime").ToString("G"), Is.EqualTo(content.GetValue<DateTime>("dateTime").ToString("G")));
|
||||
Assert.That(sut.GetValue<string>("colorPicker"), Is.EqualTo("black"));
|
||||
Assert.That(sut.GetValue<string>("folderBrowser"), Is.Empty);
|
||||
Assert.That(sut.GetValue<string>("folderBrowser"), Is.Null);
|
||||
Assert.That(sut.GetValue<string>("ddlMultiple"), Is.EqualTo("1234,1235"));
|
||||
Assert.That(sut.GetValue<string>("rbList"), Is.EqualTo("random"));
|
||||
Assert.That(sut.GetValue<DateTime>("date").ToString("G"), Is.EqualTo(content.GetValue<DateTime>("date").ToString("G")));
|
||||
|
||||
@@ -339,10 +339,10 @@ namespace Umbraco.Tests.Services
|
||||
|
||||
var parentContentType1 = MockedContentTypes.CreateSimpleContentType("parent1", "Parent1");
|
||||
service.Save(parentContentType1);
|
||||
var parentContentType2 = MockedContentTypes.CreateSimpleContentType("parent2", "Parent2");
|
||||
var parentContentType2 = MockedContentTypes.CreateSimpleContentType("parent2", "Parent2", null, true);
|
||||
service.Save(parentContentType2);
|
||||
|
||||
var simpleContentType = MockedContentTypes.CreateSimpleContentType("category", "Category", parentContentType1);
|
||||
var simpleContentType = MockedContentTypes.CreateSimpleContentType("category", "Category", parentContentType1, true);
|
||||
service.Save(simpleContentType);
|
||||
|
||||
// Act
|
||||
@@ -371,8 +371,8 @@ namespace Umbraco.Tests.Services
|
||||
Assert.AreNotEqual(clonedContentType.Key, originalContentType.Key);
|
||||
Assert.AreNotEqual(clonedContentType.Path, originalContentType.Path);
|
||||
|
||||
Assert.AreNotEqual(clonedContentType.PropertyTypes.First(x => x.Alias.Equals("title")).Id, originalContentType.PropertyTypes.First(x => x.Alias.Equals("title")).Id);
|
||||
Assert.AreNotEqual(clonedContentType.PropertyGroups.First(x => x.Name.Equals("Content")).Id, originalContentType.PropertyGroups.First(x => x.Name.Equals("Content")).Id);
|
||||
Assert.AreNotEqual(clonedContentType.PropertyTypes.First(x => x.Alias.StartsWith("title")).Id, originalContentType.PropertyTypes.First(x => x.Alias.StartsWith("title")).Id);
|
||||
Assert.AreNotEqual(clonedContentType.PropertyGroups.First(x => x.Name.StartsWith("Content")).Id, originalContentType.PropertyGroups.First(x => x.Name.StartsWith("Content")).Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -432,10 +432,10 @@ namespace Umbraco.Tests.Services
|
||||
|
||||
var parentContentType1 = MockedContentTypes.CreateSimpleContentType("parent1", "Parent1");
|
||||
service.Save(parentContentType1);
|
||||
var parentContentType2 = MockedContentTypes.CreateSimpleContentType("parent2", "Parent2");
|
||||
var parentContentType2 = MockedContentTypes.CreateSimpleContentType("parent2", "Parent2", null, true);
|
||||
service.Save(parentContentType2);
|
||||
|
||||
var simpleContentType = MockedContentTypes.CreateSimpleContentType("category", "Category", parentContentType1);
|
||||
var simpleContentType = MockedContentTypes.CreateSimpleContentType("category", "Category", parentContentType1, true);
|
||||
service.Save(simpleContentType);
|
||||
|
||||
// Act
|
||||
@@ -460,8 +460,8 @@ namespace Umbraco.Tests.Services
|
||||
Assert.AreNotEqual(clonedContentType.Key, originalContentType.Key);
|
||||
Assert.AreNotEqual(clonedContentType.Path, originalContentType.Path);
|
||||
|
||||
Assert.AreNotEqual(clonedContentType.PropertyTypes.First(x => x.Alias.Equals("title")).Id, originalContentType.PropertyTypes.First(x => x.Alias.Equals("title")).Id);
|
||||
Assert.AreNotEqual(clonedContentType.PropertyGroups.First(x => x.Name.Equals("Content")).Id, originalContentType.PropertyGroups.First(x => x.Name.Equals("Content")).Id);
|
||||
Assert.AreNotEqual(clonedContentType.PropertyTypes.First(x => x.Alias.StartsWith("title")).Id, originalContentType.PropertyTypes.First(x => x.Alias.StartsWith("title")).Id);
|
||||
Assert.AreNotEqual(clonedContentType.PropertyGroups.First(x => x.Name.StartsWith("Content")).Id, originalContentType.PropertyGroups.First(x => x.Name.StartsWith("Content")).Id);
|
||||
}
|
||||
|
||||
private ContentType CreateComponent()
|
||||
@@ -571,7 +571,7 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
var contentType = MockedContentTypes.CreateSimpleContentType("childType" + i, "ChildType" + i,
|
||||
//make the last entry in the list, this one's parent
|
||||
list.Last());
|
||||
list.Last(), true);
|
||||
|
||||
list.Add(contentType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<umbPackage>
|
||||
<files />
|
||||
<info>
|
||||
<package>
|
||||
<name>Composite Test</name>
|
||||
<version>dfsfd</version>
|
||||
<license url="http://opensource.org/licenses/MIT">MIT License</license>
|
||||
<url>ddsff</url>
|
||||
<requirements>
|
||||
<major>3</major>
|
||||
<minor>0</minor>
|
||||
<patch>0</patch>
|
||||
</requirements>
|
||||
</package>
|
||||
<author>
|
||||
<name>fsdfds</name>
|
||||
<website>sfdf</website>
|
||||
</author>
|
||||
<readme><![CDATA[sdffds]]></readme>
|
||||
</info>
|
||||
<Documents>
|
||||
<DocumentSet importMode="root">
|
||||
<CompositeTest id="1083" parentID="-1" level="1" creatorID="0" sortOrder="1" createDate="2014-11-26T15:02:43" updateDate="2014-11-26T15:02:43" nodeName="Composite test" urlName="composite-test" path="-1,1083" isDoc="" nodeType="1082" creatorName="Niels Hartvig" writerName="Niels Hartvig" writerID="0" template="1081" nodeTypeAlias="CompositeTest">
|
||||
<description><![CDATA[Description]]></description>
|
||||
<tags><![CDATA[umbraco,7.2]]></tags>
|
||||
<fancy><![CDATA[Fancy pancy]]></fancy>
|
||||
<content><![CDATA[<p>Hello World</p>]]></content>
|
||||
</CompositeTest>
|
||||
</DocumentSet>
|
||||
</Documents>
|
||||
<DocumentTypes>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Composite Test</Name>
|
||||
<Alias>CompositeTest</Alias>
|
||||
<Icon>.sprTreeFolder</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions>
|
||||
<Composition>Meta</Composition>
|
||||
<Composition>Seo</Composition>
|
||||
<Composition>Content</Composition>
|
||||
</Compositions>
|
||||
<AllowedTemplates>
|
||||
<Template>CompositeTest</Template>
|
||||
</AllowedTemplates>
|
||||
<DefaultTemplate>CompositeTest</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties />
|
||||
<Tabs />
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Content</Name>
|
||||
<Alias>Content</Alias>
|
||||
<Icon>.sprTreeFolder</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions />
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate />
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Content</Name>
|
||||
<Alias>content</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>21</Id>
|
||||
<Caption>Content</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Meta</Name>
|
||||
<Alias>Meta</Alias>
|
||||
<Icon>.sprTreeFolder</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions />
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate />
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Description</Name>
|
||||
<Alias>description</Alias>
|
||||
<Type>Umbraco.TextboxMultiple</Type>
|
||||
<Definition>c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3</Definition>
|
||||
<Tab>Meta</Tab>
|
||||
<Mandatory>True</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[Enter a description]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Tags</Name>
|
||||
<Alias>tags</Alias>
|
||||
<Type>Umbraco.Tags</Type>
|
||||
<Definition>b6b73142-b9c1-4bf8-a16d-e1c23320b549</Definition>
|
||||
<Tab>Meta</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>19</Id>
|
||||
<Caption>Meta</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>SEO</Name>
|
||||
<Alias>Seo</Alias>
|
||||
<Icon>.sprTreeFolder</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions />
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate />
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Fancy</Name>
|
||||
<Alias>fancy</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>SEO</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>20</Id>
|
||||
<Caption>SEO</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
</DocumentTypes>
|
||||
<Templates />
|
||||
<Stylesheets />
|
||||
<Macros />
|
||||
<DictionaryItems />
|
||||
<Languages />
|
||||
<DataTypes />
|
||||
</umbPackage>
|
||||
@@ -0,0 +1,924 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<umbPackage>
|
||||
<files />
|
||||
<info>
|
||||
<package>
|
||||
<name>Compositions Packaged</name>
|
||||
<version>1.0</version>
|
||||
<license url="http://opensource.org/licenses/MIT">MIT License</license>
|
||||
<url>http://blog.sitereactor.dk</url>
|
||||
<requirements>
|
||||
<major>3</major>
|
||||
<minor>0</minor>
|
||||
<patch>0</patch>
|
||||
</requirements>
|
||||
</package>
|
||||
<author>
|
||||
<name>Morten Christensen</name>
|
||||
<website>http://blog.sitereactor.dk</website>
|
||||
</author>
|
||||
<readme><![CDATA[This is a test of packaging compositions]]></readme>
|
||||
</info>
|
||||
<Documents>
|
||||
<DocumentSet importMode="root">
|
||||
<umbHomePage id="1068" parentID="-1" level="1" creatorID="0" sortOrder="0" createDate="2014-11-26T12:52:35" updateDate="2014-11-26T12:52:36" nodeName="Home" urlName="home" path="-1,1068" isDoc="" nodeType="1056" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1051" nodeTypeAlias="umbHomePage">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<title><![CDATA[Txt: A responsive starter kit for Umbraco]]></title>
|
||||
<facebookLink><![CDATA[http://facebook.com/Umbraco]]></facebookLink>
|
||||
<twitterLink><![CDATA[http://twitter.com/UmbracoProject]]></twitterLink>
|
||||
<rssLink><![CDATA[http://feeds.feedburner.com/umbracoblog]]></rssLink>
|
||||
<googleLink><![CDATA[https://google.com/+Umbraco]]></googleLink>
|
||||
<hideBanner>0</hideBanner>
|
||||
<bannerHeader><![CDATA[This is some text that needs to pop]]></bannerHeader>
|
||||
<bannerSubheader><![CDATA[It will lead to a call-to-action, just click the button...]]></bannerSubheader>
|
||||
<bannerLinkText><![CDATA[You know you want to click me]]></bannerLinkText>
|
||||
<bannerLink>1054</bannerLink>
|
||||
<bannerBackgroundImage><![CDATA[/media/SampleImages/1008/banner.jpg]]></bannerBackgroundImage>
|
||||
<aboutTitle><![CDATA[What's this about?]]></aboutTitle>
|
||||
<aboutText><![CDATA[<p>This is <a href="http://html5up.net/txt/">TXT</a>, a free site template designed by <a href="http://n33.co">n33</a> for <a href="http://html5up.net/">HTML5 UP</a>. It's built on the <a href="http://skeljs.org">skelJS</a> framework, uses well-thought out HTML5 and CSS3, and is fully responsive making it a great starting point for your own projects. And, like everything else we make, it's also free to use for pretty much any personal or commercial work under the <a href="http://html5up.net/license/">Creative Commons Attribution</a> license, so go ahead and use it – just don't forget to credit us!</p>]]></aboutText>
|
||||
<siteName><![CDATA[Umbraco Txt]]></siteName>
|
||||
<byline><![CDATA[A responsive starter kit for Umbraco]]></byline>
|
||||
<copyright><![CDATA[Umbraco]]></copyright>
|
||||
<umbTextPage id="1069" parentID="1068" level="2" creatorID="0" sortOrder="0" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="Getting Started" urlName="getting-started" path="-1,1068,1069" isDoc="" nodeType="1059" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1054" nodeTypeAlias="umbTextPage">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<featuredPage>1</featuredPage>
|
||||
<image><![CDATA[/media/SampleImages/1063/pic01.jpg]]></image>
|
||||
<bodyText>
|
||||
<![CDATA[<p>You've installed Umbraco and the "Txt" Starter Kit.</p>
|
||||
<p>Edit the text on the homepage and create a site structure by adding new texpages to your site. This is all done in the <strong>Content</strong> section.</p>
|
||||
<p>If you find the editing options provided by the Txt site too limited for you needs, simply add more properties to the page by going to the <strong>Settings</strong> section, expanding the <strong>Document Types</strong> item and adding new properties on the <strong>Generic Properties</strong> tab. You can find more information about <a href="http://umbraco.org/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/document-types" title="About Umbraco Document Types">document types and properties</a> at the <a href="http://umbraco.com" title="The Umbraco Website">Umbraco website</a>.</p>
|
||||
<p>You'll probably want to personalize your site by changing the current design. This is also done in the <strong>Settings</strong> section, by editing the CSS styles and HTML templates. Umbraco uses master templates, so the main, common markup is placed in the <strong>Starterkit Master</strong> template, while the Homeage and Textpage have separate templates for their unique layouts. You can find more information about <a href="http://umbraco.org/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/templates" title="Umbraco Templates and Stylesheets">templates and css</a> in umbraco at the umbraco website.</p>
|
||||
<p>Once you're happy with your site's design, you might want to add more functionality, such as maps, image galleries or forms. This is done by <a href="http://umbraco.org/help-and-support/video-tutorials/getting-started" title="Umbraco Modules">installing Umbraco modules</a>.</p>]]>
|
||||
</bodyText>
|
||||
</umbTextPage>
|
||||
<umbTextPage id="1070" parentID="1068" level="2" creatorID="0" sortOrder="1" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="Go Further" urlName="go-further" path="-1,1068,1070" isDoc="" nodeType="1059" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1054" nodeTypeAlias="umbTextPage">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<featuredPage>1</featuredPage>
|
||||
<image><![CDATA[/media/SampleImages/1060/pic02.jpg]]></image>
|
||||
<bodyText>
|
||||
<![CDATA[<p>The Txt Starter Kit only scratches the surface of what's possible with Umbraco. Below the Txt Starter Kit and its modules lies a great architecture that lets you implement whatever you need.</p>
|
||||
<p>With Umbraco you've finally got a solid, open and reliable platform for websites as basic as the Txt site, and Umbraco can be rapidly expanded to support multi-language websites, collaboration platforms and intra/extranets, to name just a few.</p>
|
||||
<p>Advanced functionality is created with Umbraco macros, built with Umbraco's award-winning .NET integration, including full support for any .NET User or Custom control and ASP.NET MVC. Create and integrate your own .NET macros in mere minutes with point and click simplicity. Simply copy your controls to the Umbraco website, go to the <strong>Developer</strong> section and create a new macro, selecting your control from the list.</p>
|
||||
<p>You can also use <a href="http://umbraco.org/help-and-support/video-tutorials/getting-started/working-with-webmatrix" title="Working with Razor">Microsoft's Razor</a> syntax to quickly add dynamic functionality to your site.</p>
|
||||
<p>We've also gathered the best community macros into a repository that's also accessed from the <strong>Developer</strong> section, in the <strong>Packages</strong> area. You can find more information <a href="http://umbraco.org/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/what-are-macros" title="About creating Umbraco macros">about creating macros</a>, on the Umbraco website.</p>
|
||||
<p>The sky is the limit with Umbraco, and you have the benefit a friendly community, training, and guaranteed support. Find out how to <a href="http://umbraco.org/help-and-support" title="Get Umbraco Support">get help</a>.</p>]]>
|
||||
</bodyText>
|
||||
</umbTextPage>
|
||||
<umbTextPage id="1071" parentID="1068" level="2" creatorID="0" sortOrder="2" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="Installing Modules" urlName="installing-modules" path="-1,1068,1071" isDoc="" nodeType="1059" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1054" nodeTypeAlias="umbTextPage">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<featuredPage>1</featuredPage>
|
||||
<image><![CDATA[/media/SampleImages/1061/pic04.jpg]]></image>
|
||||
<bodyText>
|
||||
<![CDATA[<p>Umbraco modules encapsulate specific bits of advanced functionality that are easily added to your website.</p>
|
||||
<p>Once installed, Umbraco modules are open source and easy to customize if you want to modify the behavior for your specific needs.</p>
|
||||
<p>Because Umbraco modules are provided under the MIT license you are free to use and modify them any way you want, with no strings attached.</p>
|
||||
<p>To add Umbraco modules to your website, go to the <strong>Settings</strong> section, expand the <strong>Templates</strong> item, select the <strong>Starterkit Master</strong> template, then click the <strong>Customize Skin</strong> button on the toolbar.</p>
|
||||
<p>Umbraco modules are available for various kinds of navigation, a sitemap, social media feeds, and a contact form. The list of available Umbraco modules is growing rapidly and is automatically updated from a central source, always fresh and current.</p>
|
||||
<p><a href="http://umbraco.org/get-started" title="Get Started with Umbraco">Get more information</a> about the umbraco way.</p>]]>
|
||||
</bodyText>
|
||||
</umbTextPage>
|
||||
<umbTextPage id="1072" parentID="1068" level="2" creatorID="0" sortOrder="3" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="About" urlName="about" path="-1,1068,1072" isDoc="" nodeType="1059" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1054" nodeTypeAlias="umbTextPage">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<featuredPage>1</featuredPage>
|
||||
<image><![CDATA[/media/SampleImages/1001/pic03.jpg]]></image>
|
||||
<bodyText>
|
||||
<![CDATA[<p>The Txt Starter Kit gives you a small website that introduces you to a set of well-defined conventions for building an Umbraco website.</p>
|
||||
<p>Now that you know what the Txt Starter Kit is, it is time to get started using Umbraco.</p>]]>
|
||||
</bodyText>
|
||||
</umbTextPage>
|
||||
<umbNewsOverview id="1073" parentID="1068" level="2" creatorID="0" sortOrder="4" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="News" urlName="news" path="-1,1068,1073" isDoc="" nodeType="1058" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1053" nodeTypeAlias="umbNewsOverview">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<title><![CDATA[Adventure log]]></title>
|
||||
<umbNewsItem id="1074" parentID="1073" level="3" creatorID="0" sortOrder="0" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="The 10 remarkable features of object" urlName="the-10-remarkable-features-of-object" path="-1,1068,1073,1074" isDoc="" nodeType="1057" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1052" nodeTypeAlias="umbNewsItem">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<bodyText>
|
||||
<![CDATA[<p>Ita prorsus, inquam; Hanc ergo intuens debet institutum illud quasi signum absolvere. Ergo adhuc, quantum equidem intellego, causa non videtur fuisse mutandi nominis. Quia dolori non voluptas contraria est, sed doloris privatio. Nos autem non solum beatae vitae istam esse oblectationem videmus, sed etiam levamentum miseriarum. Quodsi ipsam honestatem undique pertectam atque absolutam. Nos cum te, M. Quod vestri non item.</p>
|
||||
<p>Cum id quoque, ut cupiebat, audivisset, evelli iussit eam, qua erat transfixus, hastam. Quarum ambarum rerum cum medicinam pollicetur, luxuriae licentiam pollicetur. Quid iudicant sensus? Quo tandem modo?</p>]]>
|
||||
</bodyText>
|
||||
</umbNewsItem>
|
||||
<umbNewsItem id="1075" parentID="1073" level="3" creatorID="0" sortOrder="1" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="This is a wonderful news item" urlName="this-is-a-wonderful-news-item" path="-1,1068,1073,1075" isDoc="" nodeType="1057" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1052" nodeTypeAlias="umbNewsItem">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<bodyText>
|
||||
<![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Commoda autem et incommoda in eo genere sunt, quae praeposita et reiecta diximus; Bestiarum vero nullum iudicium puto. Est enim effectrix multarum et magnarum voluptatum. Duo Reges: constructio interrete. Claudii libidini, qui tum erat summo ne imperio, dederetur. Quarum ambarum rerum cum medicinam pollicetur, luxuriae licentiam pollicetur. Sed virtutem ipsam inchoavit, nihil amplius.</p>
|
||||
<p>Ita redarguitur ipse a sese, convincunturque scripta eius probitate ipsius ac moribus. Istam voluptatem, inquit, Epicurus ignorat? Sed venio ad inconstantiae crimen, ne saepius dicas me aberrare; Sic, et quidem diligentius saepiusque ista loquemur inter nos agemusque communiter. Primum in nostrane potestate est, quid meminerimus? Consequens enim est et post oritur, ut dixi. Hoc mihi cum tuo fratre convenit. Immo videri fortasse. Itaque in rebus minime obscuris non multus est apud eos disserendi labor. Aliud igitur esse censet gaudere, aliud non dolere.</p>]]>
|
||||
</bodyText>
|
||||
</umbNewsItem>
|
||||
<umbNewsItem id="1076" parentID="1073" level="3" creatorID="0" sortOrder="2" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="You really need to read this!" urlName="you-really-need-to-read-this" path="-1,1068,1073,1076" isDoc="" nodeType="1057" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1052" nodeTypeAlias="umbNewsItem">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<bodyText>
|
||||
<![CDATA[<p><span>Ut aliquid scire se gaudeant? Hanc ergo intuens debet institutum illud quasi signum absolvere. Vestri haec verecundius, illi fortasse constantius. Itaque sensibus rationem adiunxit et ratione effecta sensus non reliquit. Sed ea mala virtuti magnitudine obruebantur. Quasi ego id curem, quid ille aiat aut neget. Verum tamen cum de rebus grandioribus dicas, ipsae res verba rapiunt; Apparet statim, quae sint officia, quae actiones.</span></p>
|
||||
<p><span><span>Virtutibus igitur rectissime mihi videris et ad consuetudinem nostrae orationis vitia posuisse contraria. Nonne videmus quanta perturbatio rerum omnium consequatur, quanta confusio? Sed eum qui audiebant, quoad poterant, defendebant sententiam suam. Ut necesse sit omnium rerum, quae natura vigeant, similem esse finem, non eundem.</span></span></p>]]>
|
||||
</bodyText>
|
||||
</umbNewsItem>
|
||||
<umbNewsItem id="1077" parentID="1073" level="3" creatorID="0" sortOrder="3" createDate="2014-11-26T12:52:36" updateDate="2014-11-26T12:52:36" nodeName="Txt Starter Kit For Umbraco Released" urlName="txt-starter-kit-for-umbraco-released" path="-1,1068,1073,1077" isDoc="" nodeType="1057" creatorName="Morten Christensen" writerName="Morten Christensen" writerID="0" template="1052" nodeTypeAlias="umbNewsItem">
|
||||
<umbracoNaviHide>0</umbracoNaviHide>
|
||||
<publishDate>2021-09-20T00:00:00</publishDate>
|
||||
<image><![CDATA[/media/SampleImages/1077/pic05.jpg]]></image>
|
||||
<subheader><![CDATA[In all it's MVC Views goodness]]></subheader>
|
||||
<bodyText>
|
||||
<![CDATA[<p><span>Sed ad haec, nisi molestum est, habeo quae velim. Neque enim disputari sine reprehensione nec cum iracundia aut pertinacia recte disputari potest. Nec vero alia sunt quaerenda contra Carneadeam illam sententiam. Deinde disputat, quod cuiusque generis animantium statui deceat extremum. Facit igitur Lucius noster prudenter, qui audire de summo bono potissimum velit; Quis non odit sordidos, vanos, leves, futtiles?</span></p>
|
||||
<p><span><span>Negat enim summo bono afferre incrementum diem. Haec mihi videtur delicatior, ut ita dicam, molliorque ratio, quam virtutis vis gravitasque postulat. Haec quo modo conveniant, non sane intellego. Quis enim confidit semper sibi illud stabile et firmum permansurum, quod fragile et caducum sit? Multoque hoc melius nos veriusque quam Stoici. Igitur neque stultorum quisquam beatus neque sapientium non beatus. De hominibus dici non necesse est. Non enim iam stirpis bonum quaeret, sed animalis. Nobis Heracleotes ille Dionysius flagitiose descivisse videtur a Stoicis propter oculorum dolorem. At, illa, ut vobis placet, partem quandam tuetur, reliquam deserit.</span></span></p>]]>
|
||||
</bodyText>
|
||||
</umbNewsItem>
|
||||
</umbNewsOverview>
|
||||
</umbHomePage>
|
||||
</DocumentSet>
|
||||
</Documents>
|
||||
<DocumentTypes>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Master</Name>
|
||||
<Alias>umbMaster</Alias>
|
||||
<Icon>folder.gif</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions />
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate />
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Hide in navigation?</Name>
|
||||
<Alias>umbracoNaviHide</Alias>
|
||||
<Type>Umbraco.TrueFalse</Type>
|
||||
<Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
|
||||
<Tab />
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[If set to "Yes", this page will be hidden from the navigation menu at the top.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Page title</Name>
|
||||
<Alias>title</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[The page title overrules the name this page was given. So if the page name is "About us" the title could be "About Our Company Name".]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>12</Id>
|
||||
<Caption>Content</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Home</Name>
|
||||
<Alias>umbHomePage</Alias>
|
||||
<Icon>.sprTreeSettingDomain</Icon>
|
||||
<Thumbnail>docWithImage.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Master>umbMaster</Master>
|
||||
<Compositions>
|
||||
<Composition>umbMaster</Composition>
|
||||
</Compositions>
|
||||
<AllowedTemplates>
|
||||
<Template>umbHomePage</Template>
|
||||
</AllowedTemplates>
|
||||
<DefaultTemplate>umbHomePage</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure>
|
||||
<DocumentType>umbTextPage</DocumentType>
|
||||
</Structure>
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Facebook link</Name>
|
||||
<Alias>facebookLink</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Social</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Twitter link</Name>
|
||||
<Alias>twitterLink</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Social</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Rss link</Name>
|
||||
<Alias>rssLink</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Social</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Dribbble link</Name>
|
||||
<Alias>dribbbleLink</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Social</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>LinkedIn link</Name>
|
||||
<Alias>linkedInLink</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Social</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Google+ link</Name>
|
||||
<Alias>googleLink</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Social</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Hide banner?</Name>
|
||||
<Alias>hideBanner</Alias>
|
||||
<Type>Umbraco.TrueFalse</Type>
|
||||
<Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
|
||||
<Tab>Banner</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Banner Header</Name>
|
||||
<Alias>bannerHeader</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Banner</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Banner Subheader</Name>
|
||||
<Alias>bannerSubheader</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Banner</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Banner link text</Name>
|
||||
<Alias>bannerLinkText</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Banner</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Banner link</Name>
|
||||
<Alias>bannerLink</Alias>
|
||||
<Type>Umbraco.ContentPickerAlias</Type>
|
||||
<Definition>a6857c73-d6e9-480c-b6e6-f15f6ad11125</Definition>
|
||||
<Tab>Banner</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Banner background image</Name>
|
||||
<Alias>bannerBackgroundImage</Alias>
|
||||
<Type>Umbraco.UploadField</Type>
|
||||
<Definition>84c6b441-31df-4ffe-b67e-67d5bc3ae65a</Definition>
|
||||
<Tab>Banner</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>About Title</Name>
|
||||
<Alias>aboutTitle</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>About</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>AboutText</Name>
|
||||
<Alias>aboutText</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>About</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Site Name</Name>
|
||||
<Alias>siteName</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Byline</Name>
|
||||
<Alias>byline</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Copyright</Name>
|
||||
<Alias>copyright</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>13</Id>
|
||||
<Caption>Social</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>14</Id>
|
||||
<Caption>Banner</Caption>
|
||||
<SortOrder>1</SortOrder>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>15</Id>
|
||||
<Caption>About</Caption>
|
||||
<SortOrder>2</SortOrder>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<Id>16</Id>
|
||||
<Caption>Content</Caption>
|
||||
<SortOrder>3</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Meta</Name>
|
||||
<Alias>Meta</Alias>
|
||||
<Icon>icon-truck</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions />
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate />
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Meta Keywords</Name>
|
||||
<Alias>metaKeywords</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Meta</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>19</Id>
|
||||
<Caption>Meta</Caption>
|
||||
<SortOrder>9</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>News Item</Name>
|
||||
<Alias>umbNewsItem</Alias>
|
||||
<Icon>.sprTreeDocPic</Icon>
|
||||
<Thumbnail>docWithImage.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Master>umbMaster</Master>
|
||||
<Compositions>
|
||||
<Composition>umbMaster</Composition>
|
||||
</Compositions>
|
||||
<AllowedTemplates>
|
||||
<Template>umbNewsItem</Template>
|
||||
</AllowedTemplates>
|
||||
<DefaultTemplate>umbNewsItem</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Publish date</Name>
|
||||
<Alias>publishDate</Alias>
|
||||
<Type>Umbraco.DateTime</Type>
|
||||
<Definition>e4d66c0f-b935-4200-81f0-025f7256b89a</Definition>
|
||||
<Tab />
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[You can overrule the date shown on the site by changing it here. If you don't set a date explicitly here then the news item's create date will be shown.]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Image</Name>
|
||||
<Alias>image</Alias>
|
||||
<Type>Umbraco.UploadField</Type>
|
||||
<Definition>84c6b441-31df-4ffe-b67e-67d5bc3ae65a</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Subheader</Name>
|
||||
<Alias>subheader</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Content</Name>
|
||||
<Alias>bodyText</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>17</Id>
|
||||
<Caption>Content</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>News Overview</Name>
|
||||
<Alias>umbNewsOverview</Alias>
|
||||
<Icon>package.png</Icon>
|
||||
<Thumbnail>folder_media.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Master>umbMaster</Master>
|
||||
<Compositions>
|
||||
<Composition>umbMaster</Composition>
|
||||
</Compositions>
|
||||
<AllowedTemplates>
|
||||
<Template>umbNewsOverview</Template>
|
||||
</AllowedTemplates>
|
||||
<DefaultTemplate>umbNewsOverview</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure>
|
||||
<DocumentType>umbNewsItem</DocumentType>
|
||||
</Structure>
|
||||
<GenericProperties />
|
||||
<Tabs />
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Seo</Name>
|
||||
<Alias>Seo</Alias>
|
||||
<Icon>icon-wifi</Icon>
|
||||
<Thumbnail>folder.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Compositions />
|
||||
<AllowedTemplates />
|
||||
<DefaultTemplate />
|
||||
</Info>
|
||||
<Structure />
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Seo Pimp Title</Name>
|
||||
<Alias>seoPimpTitle</Alias>
|
||||
<Type>Umbraco.Textbox</Type>
|
||||
<Definition>0cc0eba1-9960-42c9-bf9b-60e150b429ae</Definition>
|
||||
<Tab>Seo</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>20</Id>
|
||||
<Caption>Seo</Caption>
|
||||
<SortOrder>10</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
<DocumentType>
|
||||
<Info>
|
||||
<Name>Text Page</Name>
|
||||
<Alias>umbTextyPage</Alias>
|
||||
<Icon>.sprTreeDoc</Icon>
|
||||
<Thumbnail>doc.png</Thumbnail>
|
||||
<Description />
|
||||
<AllowAtRoot>False</AllowAtRoot>
|
||||
<IsListView>False</IsListView>
|
||||
<Master>umbMaster</Master>
|
||||
<Compositions>
|
||||
<Composition>umbMaster</Composition>
|
||||
<Composition>Meta</Composition>
|
||||
<Composition>Seo</Composition>
|
||||
</Compositions>
|
||||
<AllowedTemplates>
|
||||
<Template>umbTextyPage</Template>
|
||||
</AllowedTemplates>
|
||||
<DefaultTemplate>umbTextyPage</DefaultTemplate>
|
||||
</Info>
|
||||
<Structure>
|
||||
<DocumentType>umbTextyPage</DocumentType>
|
||||
</Structure>
|
||||
<GenericProperties>
|
||||
<GenericProperty>
|
||||
<Name>Featured Page?</Name>
|
||||
<Alias>featuredPage</Alias>
|
||||
<Type>Umbraco.TrueFalse</Type>
|
||||
<Definition>92897bc6-a5f3-4ffe-ae27-f2e7e33dda49</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[Is this a page that should be featured on the home page?]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Image</Name>
|
||||
<Alias>image</Alias>
|
||||
<Type>Umbraco.UploadField</Type>
|
||||
<Definition>84c6b441-31df-4ffe-b67e-67d5bc3ae65a</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
<GenericProperty>
|
||||
<Name>Content</Name>
|
||||
<Alias>bodyText</Alias>
|
||||
<Type>Umbraco.TinyMCEv3</Type>
|
||||
<Definition>ca90c950-0aff-4e72-b976-a30b1ac57dad</Definition>
|
||||
<Tab>Content</Tab>
|
||||
<Mandatory>False</Mandatory>
|
||||
<Validation />
|
||||
<Description><![CDATA[]]></Description>
|
||||
</GenericProperty>
|
||||
</GenericProperties>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Id>18</Id>
|
||||
<Caption>Content</Caption>
|
||||
<SortOrder>0</SortOrder>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</DocumentType>
|
||||
</DocumentTypes>
|
||||
<Templates>
|
||||
<Template>
|
||||
<Name>HomePage</Name>
|
||||
<Alias>umbHomePage</Alias>
|
||||
<Master>umbLayout</Master>
|
||||
<Design>
|
||||
<![CDATA[@inherits UmbracoTemplatePage
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
}
|
||||
@{ Html.RenderPartial("umbHomepageBanner"); }
|
||||
<!-- Main -->
|
||||
<div id="main-wrapper">
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbFeatures"); }
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbNewsOverviewWidget"); }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main -->
|
||||
]]>
|
||||
</Design>
|
||||
</Template>
|
||||
<Template>
|
||||
<Name>Layout</Name>
|
||||
<Alias>umbLayout</Alias>
|
||||
<Design>
|
||||
<![CDATA[@inherits UmbracoTemplatePage
|
||||
@{
|
||||
Layout = null;
|
||||
}<!DOCTYPE html>
|
||||
<!--
|
||||
TXT 2.0 by HTML5 UP
|
||||
html5up.net | twitter.com/n33co
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>@Umbraco.Field("title", altFieldAlias: "pageName") | @Umbraco.Field("siteName", recursive: true)</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700|Open+Sans+Condensed:700" rel="stylesheet" />
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="/js/config.js"></script>
|
||||
<script src="/js/skel.min.js"></script>
|
||||
<script src="/js/skel-panels.min.js"></script>
|
||||
<noscript>
|
||||
<link rel="stylesheet" href="/css/skel-noscript.css" />
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
<link rel="stylesheet" href="/css/style-desktop.css" />
|
||||
</noscript>
|
||||
<!--[if lte IE 9]><link rel="stylesheet" href="/css/ie9.css" /><![endif]-->
|
||||
<!--[if lte IE 8]><script src="/js/html5shiv.js"></script><link rel="stylesheet" href="/css/ie8.css" /><![endif]-->
|
||||
<!--[if lte IE 7]><link rel="stylesheet" href="/css/ie7.css" /><![endif]-->
|
||||
</head>
|
||||
<body class="homepage">
|
||||
<!-- Header -->
|
||||
<header id="header">
|
||||
<div class="logo">
|
||||
<div>
|
||||
<h1><a href="/" id="logo">@Umbraco.Field("siteName", recursive: true)</a></h1>
|
||||
<span class="byline">@Umbraco.Field("byline", recursive: true)</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<!-- /Header -->
|
||||
@{ Html.RenderPartial("umbTopNavigation"); }
|
||||
|
||||
@RenderBody()
|
||||
|
||||
<!-- Footer -->
|
||||
<footer id="footer" class="container">
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbAbout"); }
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbSocial"); }
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Copyright -->
|
||||
<div id="copyright">
|
||||
© @DateTime.Now.Year @Umbraco.Field("copyright", recursive: true) | Images: <a href="http://fotogrph.com">fotogrph</a> + <a href="http://iconify.it">Iconify.it</a> | Design: <a href="http://html5up.net/">HTML5 UP</a>
|
||||
</div>
|
||||
<!-- /Copyright -->
|
||||
</div>
|
||||
</footer>
|
||||
<!-- /Footer -->
|
||||
</body>
|
||||
</html>]]>
|
||||
</Design>
|
||||
</Template>
|
||||
<Template>
|
||||
<Name>News Item</Name>
|
||||
<Alias>umbNewsItem</Alias>
|
||||
<Master>umbLayout</Master>
|
||||
<Design>
|
||||
<![CDATA[@inherits UmbracoTemplatePage
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
|
||||
? CurrentPage.Name
|
||||
: CurrentPage.Title;
|
||||
}
|
||||
<div id="main-wrapper">
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="9u skel-cell-mainContent">
|
||||
<div class="content content-left">
|
||||
<!-- Content -->
|
||||
<article class="is-page-content">
|
||||
<header>
|
||||
<h2>@pageTitle</h2>
|
||||
</header>
|
||||
<section>
|
||||
@if (string.IsNullOrWhiteSpace(CurrentPage.Image) == false)
|
||||
{
|
||||
<span class="image image-full"><img src="@CurrentPage.Image" alt="" /></span>
|
||||
}
|
||||
|
||||
@CurrentPage.BodyText
|
||||
</section>
|
||||
</article>
|
||||
<!-- /Content -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="3u">
|
||||
<div class="sidebar">
|
||||
<!-- Sidebar -->
|
||||
@{ Html.RenderPartial("umbLatestNewsWidget"); }
|
||||
<!-- /Sidebar -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbFeatures"); }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main -->]]>
|
||||
</Design>
|
||||
</Template>
|
||||
<Template>
|
||||
<Name>News Overview</Name>
|
||||
<Alias>umbNewsOverview</Alias>
|
||||
<Master>umbLayout</Master>
|
||||
<Design>
|
||||
<![CDATA[@inherits UmbracoTemplatePage
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
|
||||
? CurrentPage.Name
|
||||
: CurrentPage.Title;
|
||||
|
||||
// Model.Content is the current page that we're on
|
||||
// AncestorsOrSelf is all of the ancestors this page has in the tree
|
||||
// (1) means: go up to level 1 and stop looking for more ancestors when you get there
|
||||
// First() gets the first ancestor found (the home page, on level 1)
|
||||
var homePage = CurrentPage.AncestorsOrSelf(1).First();
|
||||
|
||||
// Find all pages with document type alias umbNewsOverview
|
||||
// We do that using the plural, umbNewsOverviews (note the extra "s" in the end)
|
||||
// Then take the first one, as we know there will only be on news overview page
|
||||
var newsOverview = homePage.umbNewsOverviews.First();
|
||||
|
||||
// Similar to above: find all pages with document type umbNewsItem under the news overview page
|
||||
// Then order them, first by publishDate (a property the editor can explicitly set on the news item)
|
||||
// and then by createDate, which is set by Umbraco automatically when a page gets created.
|
||||
var newsItems = newsOverview.umbNewsItems.OrderBy("publishDate desc, createDate desc").Take(5);
|
||||
|
||||
}
|
||||
<!-- Main -->
|
||||
<div id="main-wrapper">
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="12u skel-cell-mainContent">
|
||||
<div class="content">
|
||||
<!-- Content -->
|
||||
<article class="is-page-content">
|
||||
<header>
|
||||
<h2>@pageTitle</h2>
|
||||
</header>
|
||||
|
||||
@foreach (var item in newsItems)
|
||||
{
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var title = string.IsNullOrWhiteSpace(item.Title)
|
||||
? item.Name
|
||||
: item.Title;
|
||||
|
||||
|
||||
// If the editor has not explicitly set the publishDate property then show the create date
|
||||
var dateTime = item.PublishDate == default(DateTime)
|
||||
? item.CreateDate
|
||||
: item.PublishDate;
|
||||
|
||||
<section>
|
||||
<h3><a href="@item.Url">@title</a></h3>
|
||||
<span class="byline">@item.SubHeader</span>
|
||||
<ul class="meta">
|
||||
<li class="timestamp">@dateTime.ToString("f")</li>
|
||||
</ul>
|
||||
|
||||
@if (string.IsNullOrWhiteSpace(item.Image) == false)
|
||||
{
|
||||
<a href="@item.Url" class="image image-full"><img src="@item.Image" alt="" /></a>
|
||||
}
|
||||
|
||||
@Umbraco.Truncate(item.BodyText, 200)
|
||||
|
||||
<a href="@item.Url" class="button">Continue Reading</a>
|
||||
</section>
|
||||
}
|
||||
</article>
|
||||
<!-- /Content -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbFeatures"); }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main -->
|
||||
]]>
|
||||
</Design>
|
||||
</Template>
|
||||
<Template>
|
||||
<Name>Text Page</Name>
|
||||
<Alias>umbTextyPage</Alias>
|
||||
<Master>umbLayout</Master>
|
||||
<Design>
|
||||
<![CDATA[@inherits UmbracoTemplatePage
|
||||
@{
|
||||
Layout = "umbLayout.cshtml";
|
||||
|
||||
// If the editor has not explicitly provided the "Page title" property page
|
||||
// then just show the name of the page otherwise show the provided title
|
||||
var pageTitle = string.IsNullOrWhiteSpace(CurrentPage.Title)
|
||||
? CurrentPage.Name
|
||||
: CurrentPage.Title;
|
||||
}
|
||||
<div id="main-wrapper">
|
||||
<div id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="9u skel-cell-mainContent">
|
||||
<div class="content content-left">
|
||||
<!-- Content -->
|
||||
<article class="is-page-content">
|
||||
<header>
|
||||
<h2>@pageTitle</h2>
|
||||
</header>
|
||||
<section>
|
||||
@if (string.IsNullOrWhiteSpace(CurrentPage.Image) == false)
|
||||
{
|
||||
<span class="image image-full"><img src="@CurrentPage.Image" alt="" /></span>
|
||||
}
|
||||
|
||||
@CurrentPage.BodyText
|
||||
</section>
|
||||
</article>
|
||||
<!-- /Content -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="3u">
|
||||
<div class="sidebar">
|
||||
<!-- Sidebar -->
|
||||
@{ Html.RenderPartial("umbLatestNewsWidget"); }
|
||||
<!-- /Sidebar -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="12u">
|
||||
@{ Html.RenderPartial("umbFeatures"); }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main -->]]>
|
||||
</Design>
|
||||
</Template>
|
||||
</Templates>
|
||||
<Stylesheets />
|
||||
<Macros />
|
||||
<DictionaryItems />
|
||||
<Languages />
|
||||
<DataTypes />
|
||||
</umbPackage>
|
||||
File diff suppressed because one or more lines are too long
+103
-21
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -88,6 +88,88 @@ namespace Umbraco.Tests.Services.Importing {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
/// <files />
|
||||
/// <info>
|
||||
/// <package>
|
||||
/// <name>CheckboxListTest</name>
|
||||
/// <version>1</version>
|
||||
/// <license url="http://www.opensource.org/licenses/mit-license.php">MIT license</license>
|
||||
/// <url>1</url>
|
||||
/// <requirements>
|
||||
/// <major>3</major>
|
||||
/// <minor>0</minor>
|
||||
/// <patch>0</patch>
|
||||
/// </requirements>
|
||||
/// </package>
|
||||
/// <author>
|
||||
/// <name>1</name>
|
||||
/// <website>1</website>
|
||||
/// </author>
|
||||
/// <r [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string CheckboxList_Content_Package_LegacyIds {
|
||||
get {
|
||||
return ResourceManager.GetString("CheckboxList_Content_Package_LegacyIds", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
/// <files />
|
||||
/// <info>
|
||||
/// <package>
|
||||
/// <name>Compositions Packaged</name>
|
||||
/// <version>1.0</version>
|
||||
/// <license url="http://opensource.org/licenses/MIT">MIT License</license>
|
||||
/// <url>http://blog.sitereactor.dk</url>
|
||||
/// <requirements>
|
||||
/// <major>3</major>
|
||||
/// <minor>0</minor>
|
||||
/// <patch>0</patch>
|
||||
/// </requirements>
|
||||
/// </package>
|
||||
/// <author>
|
||||
/// <name>Morten Christensen</name>
|
||||
/// <website>h [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string CompositionsTestPackage {
|
||||
get {
|
||||
return ResourceManager.GetString("CompositionsTestPackage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
/// <files />
|
||||
/// <info>
|
||||
/// <package>
|
||||
/// <name>Composite Test</name>
|
||||
/// <version>dfsfd</version>
|
||||
/// <license url="http://opensource.org/licenses/MIT">MIT License</license>
|
||||
/// <url>ddsff</url>
|
||||
/// <requirements>
|
||||
/// <major>3</major>
|
||||
/// <minor>0</minor>
|
||||
/// <patch>0</patch>
|
||||
/// </requirements>
|
||||
/// </package>
|
||||
/// <author>
|
||||
/// <name>fsdfds</name>
|
||||
/// <website>sfdf</website>
|
||||
/// </author>
|
||||
/// <rea [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string CompositionsTestPackage_Random {
|
||||
get {
|
||||
return ResourceManager.GetString("CompositionsTestPackage_Random", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?>
|
||||
///<umbPackage>
|
||||
@@ -117,28 +199,28 @@ namespace Umbraco.Tests.Services.Importing {
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
///<umbPackage>
|
||||
/// <files />
|
||||
/// <info>
|
||||
/// <package>
|
||||
/// <name>CheckboxListTest</name>
|
||||
/// <version>1</version>
|
||||
/// <license url="http://www.opensource.org/licenses/mit-license.php">MIT license</license>
|
||||
/// <url>1</url>
|
||||
/// <requirements>
|
||||
/// <major>3</major>
|
||||
/// <minor>0</minor>
|
||||
/// <patch>0</patch>
|
||||
/// </requirements>
|
||||
/// </package>
|
||||
/// <author>
|
||||
/// <name>1</name>
|
||||
/// <website>1</website>
|
||||
/// </author>
|
||||
/// <r [rest of string was truncated]";.
|
||||
/// <files>
|
||||
/// <file>
|
||||
/// <guid>bootstrap.min.js</guid>
|
||||
/// <orgPath>/js</orgPath>
|
||||
/// <orgName>bootstrap.min.js</orgName>
|
||||
/// </file>
|
||||
/// <file>
|
||||
/// <guid>jquery.min.js</guid>
|
||||
/// <orgPath>/js</orgPath>
|
||||
/// <orgName>jquery.min.js</orgName>
|
||||
/// </file>
|
||||
/// <file>
|
||||
/// <guid>top-image.jpg</guid>
|
||||
/// <orgPath>/Media/1001</orgPath>
|
||||
/// <orgName>top-image.jpg</orgName>
|
||||
/// </file>
|
||||
/// <file>
|
||||
/// <guid>top-im [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string CheckboxList_Content_Package_LegacyIds {
|
||||
internal static string Fanoe_Package {
|
||||
get {
|
||||
return ResourceManager.GetString("CheckboxList_Content_Package_LegacyIds", resourceCulture);
|
||||
return ResourceManager.GetString("Fanoe_Package", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,4 +148,13 @@
|
||||
<data name="Dictionary_Package" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>dictionary-package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="CompositionsTestPackage" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>compositionstestpackage.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="CompositionsTestPackage_Random" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>compositionstestpackage-random.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="Fanoe_Package" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>fanoe-package.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using NUnit.Framework;
|
||||
@@ -210,6 +211,30 @@ namespace Umbraco.Tests.Services.Importing
|
||||
Assert.That(templates.Any(), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Fanoe_Starterkit_ContentTypes_And_Templates_Xml()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.Fanoe_Package;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||
var templateElement = xml.Descendants("Templates").First();
|
||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||
|
||||
// Act
|
||||
var dataTypeDefinitions = ServiceContext.PackagingService.ImportDataTypeDefinitions(dataTypeElement);
|
||||
var templates = ServiceContext.PackagingService.ImportTemplates(templateElement);
|
||||
var contentTypes = ServiceContext.PackagingService.ImportContentTypes(docTypeElement);
|
||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||
|
||||
//Assert - Re-Import contenttypes doesn't throw
|
||||
Assert.DoesNotThrow(() => ServiceContext.PackagingService.ImportContentTypes(docTypeElement));
|
||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
||||
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
||||
Assert.That(templates.Any(), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Content_Package_Xml()
|
||||
{
|
||||
@@ -554,6 +579,60 @@ namespace Umbraco.Tests.Services.Importing
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Package_With_Compositions()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.CompositionsTestPackage;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var templateElement = xml.Descendants("Templates").First();
|
||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||
var packagingService = ServiceContext.PackagingService;
|
||||
|
||||
// Act
|
||||
var templates = packagingService.ImportTemplates(templateElement);
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||
|
||||
// Assert
|
||||
Assert.That(contentTypes, Is.Not.Null);
|
||||
Assert.That(contentTypes.Any(), Is.True);
|
||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||
Assert.That(contentTypes.Count(x => x.ParentId == -1), Is.EqualTo(3));
|
||||
|
||||
var textpage = contentTypes.First(x => x.Alias.Equals("umbTextyPage"));
|
||||
Assert.That(textpage.ParentId, Is.Not.EqualTo(-1));
|
||||
Assert.That(textpage.ContentTypeComposition.Count(), Is.EqualTo(3));
|
||||
Assert.That(textpage.ContentTypeCompositionExists("umbMaster"), Is.True);
|
||||
Assert.That(textpage.ContentTypeCompositionExists("Meta"), Is.True);
|
||||
Assert.That(textpage.ContentTypeCompositionExists("Seo"), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_Package_With_Compositions_Ordered()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.CompositionsTestPackage_Random;
|
||||
var xml = XElement.Parse(strXml);
|
||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||
var packagingService = ServiceContext.PackagingService;
|
||||
|
||||
// Act
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||
|
||||
// Assert
|
||||
Assert.That(contentTypes, Is.Not.Null);
|
||||
Assert.That(contentTypes.Any(), Is.True);
|
||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||
|
||||
var testContentType = contentTypes.First(x => x.Alias.Equals("CompositeTest"));
|
||||
Assert.That(testContentType.ContentTypeComposition.Count(), Is.EqualTo(3));
|
||||
Assert.That(testContentType.ContentTypeCompositionExists("Content"), Is.True);
|
||||
Assert.That(testContentType.ContentTypeCompositionExists("Meta"), Is.True);
|
||||
Assert.That(testContentType.ContentTypeCompositionExists("Seo"), Is.True);
|
||||
}
|
||||
|
||||
private void AddLanguages()
|
||||
{
|
||||
var norwegian = new Core.Models.Language("nb-NO");
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
var ctx = new UmbracoContext(
|
||||
httpContext,
|
||||
ApplicationContext,
|
||||
new PublishedCaches(cache, new PublishedMediaCache()),
|
||||
new PublishedCaches(cache, new PublishedMediaCache(ApplicationContext)),
|
||||
new WebSecurity(httpContext, ApplicationContext));
|
||||
|
||||
if (setSingleton)
|
||||
|
||||
@@ -19,10 +19,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
[SetUp]
|
||||
public virtual void Initialize()
|
||||
{
|
||||
using (DisposableTimer.TraceDuration<BaseUmbracoConfigurationTest>("init"))
|
||||
{
|
||||
SettingsForTests.Reset();
|
||||
}
|
||||
SettingsForTests.Reset();
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +27,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
public virtual void TearDown()
|
||||
{
|
||||
//reset settings
|
||||
using (DisposableTimer.TraceDuration<BaseUmbracoConfigurationTest>("teardown"))
|
||||
{
|
||||
SettingsForTests.Reset();
|
||||
}
|
||||
SettingsForTests.Reset();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
title = name + " textpage",
|
||||
bodyText = string.Format("This is a textpage based on the {0} ContentType", contentType.Alias),
|
||||
keywords = "text,page,meta",
|
||||
metaDescription = "This is the meta description for a textpage"
|
||||
description = "This is the meta description for a textpage"
|
||||
};
|
||||
|
||||
content.PropertyValues(obj);
|
||||
@@ -121,7 +121,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
title = name + " title",
|
||||
bodyText = string.Format("This is a textpage based on the {0} ContentType", contentType.Alias),
|
||||
keywords = "text,page,meta",
|
||||
metaDescription = "This is the meta description for a textpage"
|
||||
description = "This is the meta description for a textpage"
|
||||
};
|
||||
|
||||
content.PropertyValues(obj);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers.Entities
|
||||
{
|
||||
@@ -29,7 +28,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
|
||||
var metaCollection = new PropertyTypeCollection();
|
||||
metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "keywords", Name = "Meta Keywords", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
|
||||
metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metaDescription", Name = "Meta Description", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -89 });
|
||||
metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "description", Name = "Meta Description", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -89 });
|
||||
|
||||
contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 });
|
||||
contentType.PropertyGroups.Add(new PropertyGroup(metaCollection) { Name = "Meta", SortOrder = 2 });
|
||||
@@ -93,7 +92,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public static ContentType CreateSimpleContentType(string alias, string name, IContentType parent = null)
|
||||
public static ContentType CreateSimpleContentType(string alias, string name, IContentType parent = null, bool randomizeAliases = false)
|
||||
{
|
||||
var contentType = parent == null ? new ContentType(-1) : new ContentType(parent);
|
||||
|
||||
@@ -107,9 +106,9 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
contentType.Trashed = false;
|
||||
|
||||
var contentCollection = new PropertyTypeCollection();
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.TinyMCEAlias, DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = RandomAlias("title", randomizeAliases), Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.TinyMCEAlias, DataTypeDatabaseType.Ntext) { Alias = RandomAlias("bodyText", randomizeAliases), Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 });
|
||||
contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = RandomAlias("author", randomizeAliases) , Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 });
|
||||
|
||||
contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 });
|
||||
|
||||
@@ -307,5 +306,15 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
|
||||
return contentType;
|
||||
}
|
||||
|
||||
private static string RandomAlias(string alias, bool randomizeAliases)
|
||||
{
|
||||
if (randomizeAliases)
|
||||
{
|
||||
return string.Concat(alias, Guid.NewGuid().ToString("N"));
|
||||
}
|
||||
|
||||
return alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
+123
-127
@@ -1,127 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
|
||||
namespace Umbraco.Tests.Trees
|
||||
{
|
||||
[TestFixture]
|
||||
public class BaseContentTreeTests
|
||||
{
|
||||
|
||||
[TearDown]
|
||||
public void TestTearDown()
|
||||
{
|
||||
BaseTree.AfterTreeRender -= EventHandler;
|
||||
BaseTree.BeforeTreeRender -= EventHandler;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Run_Optimized()
|
||||
{
|
||||
var tree1 = new MyOptimizedContentTree1("content");
|
||||
var tree2 = new MyOptimizedContentTree2("content");
|
||||
|
||||
Assert.IsTrue(tree1.UseOptimizedRendering);
|
||||
Assert.IsTrue(tree2.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_AfterRender()
|
||||
{
|
||||
var tree = new MyOptimizedContentTree1("content");
|
||||
|
||||
BaseTree.AfterTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_BeforeRender()
|
||||
{
|
||||
var tree = new MyOptimizedContentTree1("content");
|
||||
|
||||
BaseTree.BeforeTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Overriden_Method()
|
||||
{
|
||||
var tree = new MyNotOptimizedContentTree("content");
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
private void EventHandler(object sender, TreeEventArgs treeEventArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//optimized because we are not overriding OnRenderNode
|
||||
public class MyOptimizedContentTree1 : BaseContentTree
|
||||
{
|
||||
public MyOptimizedContentTree1(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class MyOptimizedContentTree2 : BaseContentTree
|
||||
{
|
||||
public MyOptimizedContentTree2(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool LoadMinimalDocument
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//even if we override it will still be optimized because of the LoadMinimalDocument flag
|
||||
protected override void OnRenderNode(ref XmlTreeNode xNode, umbraco.cms.businesslogic.web.Document doc)
|
||||
{
|
||||
base.OnRenderNode(ref xNode, doc);
|
||||
}
|
||||
}
|
||||
|
||||
public class MyNotOptimizedContentTree : BaseContentTree
|
||||
{
|
||||
public MyNotOptimizedContentTree(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool LoadMinimalDocument
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
protected override void OnRenderNode(ref XmlTreeNode xNode, umbraco.cms.businesslogic.web.Document doc)
|
||||
{
|
||||
base.OnRenderNode(ref xNode, doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
using NUnit.Framework;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
|
||||
namespace Umbraco.Tests.TreesAndSections
|
||||
{
|
||||
[TestFixture]
|
||||
public class BaseContentTreeTests
|
||||
{
|
||||
|
||||
[TearDown]
|
||||
public void TestTearDown()
|
||||
{
|
||||
BaseTree.AfterTreeRender -= EventHandler;
|
||||
BaseTree.BeforeTreeRender -= EventHandler;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Run_Optimized()
|
||||
{
|
||||
var tree1 = new MyOptimizedContentTree1("content");
|
||||
var tree2 = new MyOptimizedContentTree2("content");
|
||||
|
||||
Assert.IsTrue(tree1.UseOptimizedRendering);
|
||||
Assert.IsTrue(tree2.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_AfterRender()
|
||||
{
|
||||
var tree = new MyOptimizedContentTree1("content");
|
||||
|
||||
BaseTree.AfterTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_BeforeRender()
|
||||
{
|
||||
var tree = new MyOptimizedContentTree1("content");
|
||||
|
||||
BaseTree.BeforeTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Overriden_Method()
|
||||
{
|
||||
var tree = new MyNotOptimizedContentTree("content");
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
private void EventHandler(object sender, TreeEventArgs treeEventArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//optimized because we are not overriding OnRenderNode
|
||||
public class MyOptimizedContentTree1 : BaseContentTree
|
||||
{
|
||||
public MyOptimizedContentTree1(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class MyOptimizedContentTree2 : BaseContentTree
|
||||
{
|
||||
public MyOptimizedContentTree2(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool LoadMinimalDocument
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//even if we override it will still be optimized because of the LoadMinimalDocument flag
|
||||
protected override void OnRenderNode(ref XmlTreeNode xNode, umbraco.cms.businesslogic.web.Document doc)
|
||||
{
|
||||
base.OnRenderNode(ref xNode, doc);
|
||||
}
|
||||
}
|
||||
|
||||
public class MyNotOptimizedContentTree : BaseContentTree
|
||||
{
|
||||
public MyNotOptimizedContentTree(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool LoadMinimalDocument
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
protected override void OnRenderNode(ref XmlTreeNode xNode, umbraco.cms.businesslogic.web.Document doc)
|
||||
{
|
||||
base.OnRenderNode(ref xNode, doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+64
-64
@@ -1,65 +1,65 @@
|
||||
using NUnit.Framework;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
|
||||
namespace Umbraco.Tests.Trees
|
||||
{
|
||||
[TestFixture]
|
||||
public class BaseMediaTreeTests
|
||||
{
|
||||
|
||||
[TearDown]
|
||||
public void TestTearDown()
|
||||
{
|
||||
BaseTree.AfterTreeRender -= EventHandler;
|
||||
BaseTree.BeforeTreeRender -= EventHandler;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Run_Optimized()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
Assert.IsTrue(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_AfterRender()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
BaseTree.AfterTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_BeforeRender()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
BaseTree.BeforeTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
private void EventHandler(object sender, TreeEventArgs treeEventArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class MyOptimizedMediaTree : BaseMediaTree
|
||||
{
|
||||
public MyOptimizedMediaTree(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
using NUnit.Framework;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
|
||||
namespace Umbraco.Tests.TreesAndSections
|
||||
{
|
||||
[TestFixture]
|
||||
public class BaseMediaTreeTests
|
||||
{
|
||||
|
||||
[TearDown]
|
||||
public void TestTearDown()
|
||||
{
|
||||
BaseTree.AfterTreeRender -= EventHandler;
|
||||
BaseTree.BeforeTreeRender -= EventHandler;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Run_Optimized()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
Assert.IsTrue(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_AfterRender()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
BaseTree.AfterTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Not_Optimized_Events_BeforeRender()
|
||||
{
|
||||
var tree = new MyOptimizedMediaTree("media");
|
||||
|
||||
BaseTree.BeforeTreeRender += EventHandler;
|
||||
|
||||
Assert.IsFalse(tree.UseOptimizedRendering);
|
||||
}
|
||||
|
||||
private void EventHandler(object sender, TreeEventArgs treeEventArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class MyOptimizedMediaTree : BaseMediaTree
|
||||
{
|
||||
public MyOptimizedMediaTree(string application)
|
||||
: base(application)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -132,9 +132,9 @@
|
||||
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
@@ -282,7 +282,7 @@
|
||||
<Compile Include="Controllers\WebApiEditors\FilterAllowedOutgoingContentAttributeTests.cs" />
|
||||
<Compile Include="Controllers\WebApiEditors\MediaControllerUnitTests.cs" />
|
||||
<Compile Include="CoreXml\FrameworkXmlTests.cs" />
|
||||
<Compile Include="Dynamics\QueryableExtensionTests.cs" />
|
||||
<Compile Include="DynamicsAndReflection\QueryableExtensionTests.cs" />
|
||||
<Compile Include="DynamicsAndReflection\ExtensionMethodFinderTests.cs" />
|
||||
<Compile Include="DynamicsAndReflection\ReflectionTests.cs" />
|
||||
<Compile Include="Integration\CreateContent.cs" />
|
||||
@@ -318,6 +318,8 @@
|
||||
<Compile Include="PublishedContent\StronglyTypedModels\Textpage.cs" />
|
||||
<Compile Include="PublishedContent\StronglyTypedModels\TypedModelBase.cs" />
|
||||
<Compile Include="PublishedContent\StronglyTypedModels\UmbracoTemplatePage`T.cs" />
|
||||
<Compile Include="Scheduling\BackgroundTaskRunnerTests.cs" />
|
||||
<Compile Include="ServerEnvironmentHelperTests.cs" />
|
||||
<Compile Include="Services\TagServiceTests.cs" />
|
||||
<Compile Include="Services\LocalizationServiceTests.cs" />
|
||||
<Compile Include="Resolvers\XsltExtensionsResolverTests.cs" />
|
||||
@@ -382,7 +384,7 @@
|
||||
<Compile Include="PublishedContent\PublishedContentTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedMediaTests.cs" />
|
||||
<Compile Include="HashCodeCombinerTests.cs" />
|
||||
<Compile Include="HtmlHelperExtensionMethodsTests.cs" />
|
||||
<Compile Include="Mvc\HtmlHelperExtensionMethodsTests.cs" />
|
||||
<Compile Include="IO\IOHelperTest.cs" />
|
||||
<Compile Include="LibraryTests.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyEditorValueConverterTests.cs" />
|
||||
@@ -470,15 +472,15 @@
|
||||
<DependentUpon>ImportResources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\ThreadSafetyServiceTest.cs" />
|
||||
<Compile Include="Surface\PluginControllerAreaTests.cs" />
|
||||
<Compile Include="Sync\DistributedCacheTests.cs" />
|
||||
<Compile Include="Controllers\PluginControllerAreaTests.cs" />
|
||||
<Compile Include="DistributedCache\DistributedCacheTests.cs" />
|
||||
<Compile Include="Templates\MasterPageHelperTests.cs" />
|
||||
<Compile Include="TestHelpers\BaseDatabaseFactoryTest.cs" />
|
||||
<Compile Include="TestHelpers\BaseRoutingTest.cs" />
|
||||
<Compile Include="TestHelpers\BaseUmbracoApplicationTest.cs" />
|
||||
<Compile Include="TestHelpers\DatabaseBehavior.cs" />
|
||||
<Compile Include="TestHelpers\SettingsForTests.cs" />
|
||||
<Compile Include="GlobalSettingsTests.cs" />
|
||||
<Compile Include="Configurations\GlobalSettingsTests.cs" />
|
||||
<Compile Include="Routing\ContentFinderByAliasTests.cs" />
|
||||
<Compile Include="Routing\ContentFinderByIdTests.cs" />
|
||||
<Compile Include="Routing\ContentFinderByNiceUrlAndTemplateTests.cs" />
|
||||
@@ -496,11 +498,11 @@
|
||||
<Compile Include="TestHelpers\Entities\MockedEntity.cs" />
|
||||
<Compile Include="TestHelpers\Entities\MockedMedia.cs" />
|
||||
<Compile Include="TestHelpers\DisposableUmbracoTest.cs" />
|
||||
<Compile Include="Trees\BaseContentTreeTests.cs" />
|
||||
<Compile Include="Trees\BaseMediaTreeTests.cs" />
|
||||
<Compile Include="TreesAndSections\BaseContentTreeTests.cs" />
|
||||
<Compile Include="TreesAndSections\BaseMediaTreeTests.cs" />
|
||||
<Compile Include="UmbracoExamine\ContentServiceTest.cs" />
|
||||
<Compile Include="UmbracoExamine\EventsTest.cs" />
|
||||
<Compile Include="TypeHelperTests.cs" />
|
||||
<Compile Include="Plugins\TypeHelperTests.cs" />
|
||||
<Compile Include="UmbracoExamine\ExamineBaseTest.cs" />
|
||||
<Compile Include="UmbracoExamine\IndexInitializer.cs" />
|
||||
<Compile Include="UmbracoExamine\IndexTest.cs" />
|
||||
@@ -520,11 +522,11 @@
|
||||
<Compile Include="UriExtensionsTests.cs" />
|
||||
<Compile Include="UriUtilityTests.cs" />
|
||||
<Compile Include="Resolvers\MacroFieldEditorsResolverTests.cs" />
|
||||
<Compile Include="MacroEngineFactoryTests.cs" />
|
||||
<Compile Include="Macros\MacroEngineFactoryTests.cs" />
|
||||
<Compile Include="MediaFactoryTests.cs" />
|
||||
<Compile Include="Resolvers\PackageActionsResolverTests.cs" />
|
||||
<Compile Include="PluginManagerExtensions.cs" />
|
||||
<Compile Include="PluginManagerTests.cs" />
|
||||
<Compile Include="Plugins\PluginManagerExtensions.cs" />
|
||||
<Compile Include="Plugins\PluginManagerTests.cs" />
|
||||
<Compile Include="TestHelpers\Stubs\FakeLastChanceFinder.cs" />
|
||||
<Compile Include="TestHelpers\TestHelper.cs" />
|
||||
<Compile Include="EnumerableExtensionsTests.cs" />
|
||||
@@ -534,7 +536,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="CoreStrings\StringExtensionsTests.cs" />
|
||||
<Compile Include="TestHelpers\FakeHttpContextFactory.cs" />
|
||||
<Compile Include="TypeFinderTests.cs" />
|
||||
<Compile Include="Plugins\TypeFinderTests.cs" />
|
||||
<Compile Include="Routing\UmbracoModuleTests.cs" />
|
||||
<Compile Include="XmlExtensionsTests.cs" />
|
||||
<Compile Include="XmlHelperTests.cs" />
|
||||
@@ -692,7 +694,10 @@
|
||||
<Content Include="Services\Importing\CheckboxList-Content-Package.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Services\Importing\CompositionsTestPackage-Random.xml" />
|
||||
<Content Include="Services\Importing\CompositionsTestPackage.xml" />
|
||||
<Content Include="Services\Importing\Dictionary-Package.xml" />
|
||||
<Content Include="Services\Importing\Fanoe-Package.xml" />
|
||||
<Content Include="UmbracoExamine\TestFiles\media.xml" />
|
||||
<Content Include="Services\Importing\InheritedDocTypes-Package.xml" />
|
||||
<Content Include="Services\Importing\SingleDocType.xml" />
|
||||
@@ -704,9 +709,7 @@
|
||||
<Content Include="Services\Importing\uBlogsy-Package.xml" />
|
||||
<Content Include="Services\Importing\XsltSearch-Package.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Install\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<package id="Examine" version="0.1.57.2941" targetFramework="net40" />
|
||||
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net40" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.1" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
tinymce.PluginManager.add("code",function(e){function o(){e.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:e.getParam("code_dialog_width",600),minHeight:e.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),value:e.getContent({source_view:!0}),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(o){e.focus(),e.undoManager.transact(function(){e.setContent(o.data.code)}),e.selection.setCursorLocation(),e.nodeChanged()}})}e.addCommand("mceCodeEditor",o),e.addButton("code",{icon:"code",tooltip:"Source code",onclick:o}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:o})});
|
||||
tinymce.PluginManager.add("code", function(e) {
|
||||
function o() {
|
||||
e.windowManager.open({ title: "Source code", body: { type: "textbox", name: "code", multiline: !0, minWidth: e.getParam("code_dialog_width", 600), minHeight: e.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)), value: e.getContent({ source_view: !0 }), spellcheck: !1, style: "direction: ltr; text-align: left" }, onSubmit: function(o) { e.focus(), e.undoManager.transact(function() { e.setContent(o.data.code) }), e.selection.setCursorLocation(), e.nodeChanged() } })
|
||||
}
|
||||
|
||||
e.addCommand("mceCodeEditor", o), e.addButton("code", { icon: "code", tooltip: "Source code", onclick: o }), e.addMenuItem("code", { icon: "code", text: "Source code", context: "tools", onclick: o })
|
||||
});
|
||||
@@ -1,3 +1,24 @@
|
||||
tinymce.PluginManager.requireLangPack("codemirror");
|
||||
tinymce.PluginManager.add("codemirror",function(a,c){function b(){a.focus();a.selection.collapse(!0);a.selection.setContent('<span class="CmCaReT" style="display:none">�</span>');var b=a.windowManager.open({title:"Source code",url:c+"/source.html",width: a.getParam("code_dialog_width", 600),height: a.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)),resizable:!0,maximizable:!0,buttons:[{text:"Ok",subtype:"primary",onclick:function(){document.querySelectorAll(".mce-container-body>iframe")[0].contentWindow.submit();b.close()}},{text:"Cancel",onclick:"close"}]})}a.addButton("code",
|
||||
{title:"Source code",icon:"code",onclick:b});a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})});
|
||||
tinymce.PluginManager.add("codemirror", function(a, c) {
|
||||
function b() {
|
||||
a.focus();
|
||||
a.selection.collapse(!0);
|
||||
a.selection.setContent('<span class="CmCaReT" style="display:none">�</span>');
|
||||
var b = a.windowManager.open({
|
||||
title: "Source code", url: c + "/source.html", width: a.getParam("code_dialog_width", 600), height: a.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)), resizable: !0, maximizable: !0,
|
||||
buttons: [
|
||||
{
|
||||
text: "Ok", subtype: "primary",
|
||||
onclick: function() {
|
||||
document.querySelectorAll(".mce-container-body>iframe")[0].contentWindow.submit();
|
||||
b.close()
|
||||
}
|
||||
}, { text: "Cancel", onclick: "close" }
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
a.addButton("codemirror",
|
||||
{ title: "Source code", icon: "code", onclick: b });
|
||||
a.addMenuItem("codemirror", { icon: "code", text: "Source code", context: "tools", onclick: b })
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
abbr,address,article,aside,audio,b,blockquote,body,canvas,caption,cite,code,dd,del,details,dfn,div,dl,dt,em,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,samp,section,small,span,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,ul,var,video{margin:0;padding:0;outline:0;border:0;background:0 0;vertical-align:baseline;font-size:100%}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}nav ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}a{margin:0;padding:0;background:0 0;vertical-align:baseline;font-size:100%}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-weight:700;font-style:italic}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-spacing:0;border-collapse:collapse}hr{display:block;margin:1em 0;padding:0;height:1px;border:0;border-top:1px solid #ccc}input,select{vertical-align:middle}html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,:after,:before{box-sizing:border-box}body,html{height:100%;width:100%;color:#fff;font-family:'Open Sans',sans-serif;font-weight:400;font-size:.9375em;line-height:1.5}h1{font-size:1.7em;margin:40px auto 10px;font-weight:700}h2{font-size:1.35em;margin:0 auto .4em;font-weight:700}h3{font-size:1em;font-weight:400;font-style:italic}p{font-size:1em;line-height:1.6}p+a{margin-top:1rem;display:inline-block}a,a:active,a:visited{text-decoration:none}.cta{margin:4.5em auto 1.5em;padding-bottom:4.5em}.button,.button:visited{padding:.9375em 1.875em;border-radius:.1em;font-weight:600;font-size:1.2em;background:#2e99f4;color:#fff;display:inline-block;border:none;transition:all 200ms ease-in-out}.button:hover,.button:visited:hover{border-bottom:none;background:#0c80e3}section{background:url(../img/nonodesbg.jpg) center center/cover;height:100%;width:100%;display:table;padding:3em 1.75em}section a,section a:focus,section a:visited{color:#46a5f5;font-size:1.1625em;border-bottom:1px solid transparent;transition:border-bottom 100ms ease-in-out}section a:focus:hover,section a:hover,section a:visited:hover{border-bottom:1px solid}section:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.17);background:linear-gradient(45deg,rgba(85,98,112,.1) 10%,rgba(255,107,107,.1) 95%);z-index:0}section article{display:table-cell;vertical-align:middle;margin:0 auto;text-align:center;position:relative;z-index:100}section article>div{max-width:60em;margin:0 auto}section .logo{background:url(../img/logo.png) no-repeat;width:91px;height:91px;margin:0 auto}section .row{overflow:hidden}section .row .col{text-align:left;width:100%}section .row .col:nth-child(2){margin-top:3em}@media screen and (min-width:48em){body,html{font-size:1em}h1{font-size:2.5em;margin:70px auto 0;letter-spacing:.5px}h2{font-size:1.4375em;margin:0 auto 1em}h3{font-size:1.2em}a{font-size:1.1rem;font-weight:600}p+a{margin-top:3rem}.cta{margin:7.5em auto 2.5em;border-bottom:1px solid rgba(255,255,255,.5);padding-bottom:7.5em}section{padding:0 15px}section .row .col{float:left;width:50%;padding-right:5%;display:inline-block}section .row .col:nth-child(2){padding-right:0;padding-left:5%;margin-top:0}.button{font-size:1.1625em}}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 685 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 309 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 232 KiB |
@@ -0,0 +1,16 @@
|
||||
angular.module("umbraco.directives")
|
||||
.directive('umbAutoFocus', function($timeout) {
|
||||
|
||||
return function(scope, element, attr){
|
||||
var update = function() {
|
||||
//if it uses its default naming
|
||||
if(element.val() === ""){
|
||||
element.focus();
|
||||
}
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
update();
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
angular.module("umbraco.directives")
|
||||
.directive('umbAutoResize', function($timeout) {
|
||||
|
||||
return function(scope, element, attr){
|
||||
var domEl = element[0];
|
||||
var update = function(force) {
|
||||
|
||||
if(force === true){
|
||||
element.height(0);
|
||||
}
|
||||
|
||||
if(domEl.scrollHeight !== domEl.clientHeight){
|
||||
element.height(domEl.scrollHeight);
|
||||
}
|
||||
};
|
||||
|
||||
element.bind('keyup keydown keypress change', update);
|
||||
element.bind('blur', function(){ update(true); });
|
||||
|
||||
$timeout(function() {
|
||||
update(true);
|
||||
}, 200);
|
||||
|
||||
|
||||
//I hate bootstrap tabs
|
||||
$('a[data-toggle="tab"]').on('shown', update);
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
$('a[data-toggle="tab"]').unbind("shown", update);
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -33,6 +33,14 @@ angular.module("umbraco.directives.html")
|
||||
else {
|
||||
scope.labelstring = scope.label;
|
||||
}
|
||||
|
||||
if (scope.description && scope.description[0] === "@") {
|
||||
scope.descriptionstring = localizationService.localize(scope.description.substring(1));
|
||||
}
|
||||
else {
|
||||
scope.descriptionstring = scope.description;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -49,6 +49,8 @@ angular.module("umbraco.directives")
|
||||
if(scope.center){
|
||||
scope.dimensions.left = scope.center.left * scope.dimensions.width -10;
|
||||
scope.dimensions.top = scope.center.top * scope.dimensions.height -10;
|
||||
}else{
|
||||
scope.center = { left: 0.5, top: 0.5 };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ angular.module("umbraco.directives")
|
||||
scope.height,
|
||||
scope.maxSize,
|
||||
scope.maxSize,
|
||||
true);
|
||||
false);
|
||||
|
||||
//so if we have a max size, override the thumb sizes
|
||||
scope.width = ratioCalculation.width;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user