Compare commits
210 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d4d21c18b2 | |||
| f809dec874 | |||
| 2477500045 | |||
| ca1b05e30d | |||
| 5c09ba9a2d | |||
| 5f67e85471 | |||
| d9228c368f | |||
| 41b8de09b7 | |||
| bbf06cd13d | |||
| 639cb17741 | |||
| 50035eae49 | |||
| 2d857a8635 | |||
| 3040d362ef | |||
| 1ec7cd3b89 | |||
| 368954226a | |||
| b01b4f7aa7 | |||
| 49a699c858 | |||
| 22cf59345c | |||
| 16a46a4ea4 | |||
| c0df3e0202 | |||
| 507c6c23b9 | |||
| 3daf936623 | |||
| 033f981718 | |||
| 76358e3e13 | |||
| 35c0eb3b0c | |||
| 7fad8ca98b | |||
| a2da27121e | |||
| 23ec07276a | |||
| 96cec0b407 | |||
| 47b94e68e3 | |||
| 0f4b1752e0 | |||
| b2c604f7b3 | |||
| 818d22ba61 | |||
| 27fdb1ebab | |||
| 86ce48ddc8 | |||
| 2161ec98b0 | |||
| 52292cab60 | |||
| a6768263d3 | |||
| e66306978a | |||
| 7f22809ebf | |||
| 302ebde422 | |||
| cf5624f377 | |||
| f386c9d024 | |||
| 530fcf0ea3 | |||
| 26e4091f28 | |||
| 32f86f750e | |||
| b8304c03ee | |||
| aaa4469def | |||
| baa0069262 | |||
| 9ac4c7aef5 | |||
| cb2a35594f | |||
| dd501d0198 | |||
| b724d8fb32 | |||
| 7c6aee17e9 | |||
| 5e2c3a0a8b | |||
| f5121bd183 | |||
| 51b5334126 | |||
| 120bdca9eb | |||
| a5041aa34e | |||
| d3780848dc | |||
| 9d15228c68 | |||
| c9c3623457 | |||
| e0a483ca48 | |||
| 95eb00a81c | |||
| 3921b0974e | |||
| 2cd07c841f | |||
| 8f80f0e95c | |||
| 73ac2c0309 | |||
| a5ddb6c818 | |||
| 458e61e049 | |||
| 0815842640 | |||
| 53b31a5c1b | |||
| a4098b5d25 | |||
| 33ff82e766 | |||
| 5fd90e1c13 | |||
| a6eaec9ecb | |||
| f5553bcc06 | |||
| e0c68a8e1c | |||
| 5212d17f49 | |||
| dc2554c6d0 | |||
| 159d605434 | |||
| 5c0c33a46b | |||
| a1ee352514 | |||
| a8ad8c2a43 | |||
| afbe3ca3b9 | |||
| 32d6f2e50c | |||
| 9909f5b6be | |||
| 6281268954 | |||
| 8e1c45e981 | |||
| 4a7ee52d63 | |||
| b4d88b0361 | |||
| b41cf37dd5 | |||
| fc32100142 | |||
| 7ecbc3b391 | |||
| c3c44df52e | |||
| 13a86624ff | |||
| 2f61bc27c8 | |||
| e7d157a209 | |||
| d3ed90c23e | |||
| b916360771 | |||
| db4b93dbc3 | |||
| 40868ac361 | |||
| f399a9f52b | |||
| 562851b93e | |||
| e61b567ee1 | |||
| 4ce22b836e | |||
| f5bf05a6f5 | |||
| e50569597b | |||
| 071f3dcc01 | |||
| 6943a454f3 | |||
| 532f407260 | |||
| 834d04f8ed | |||
| f36ab37f6a | |||
| aeff33d0a6 | |||
| 5cfe9e57ce | |||
| 4863e657df | |||
| c0e1be4df9 | |||
| a93e562f14 | |||
| 822cac5d87 | |||
| d58487fafc | |||
| ea9653fa83 | |||
| 8cca1b77b3 | |||
| 53e4308c29 | |||
| 6f26f7b57c | |||
| bda2614290 | |||
| efc482511e | |||
| 40b90b8a58 | |||
| a009dfe2a1 | |||
| 41e87fca98 | |||
| f23c6c53cc | |||
| 0762decd92 | |||
| 0b58c1c03c | |||
| 38c6a21896 | |||
| 15bff44ec1 | |||
| a626efa9b6 | |||
| 54d2258634 | |||
| 25be0621b2 | |||
| cba09ed817 | |||
| d5d00553b4 | |||
| c52669fb05 | |||
| c4a071523e | |||
| ca99319ead | |||
| 81360f629e | |||
| aa36c66f39 | |||
| 09e31d6595 | |||
| f9fc2619fa | |||
| 5d8cfa5efb | |||
| 297f8e2a0b | |||
| 8ddfb5f6ad | |||
| 9387544865 | |||
| 66ddb21ef8 | |||
| 9d19ed9463 | |||
| df62697477 | |||
| f0cacf0d52 | |||
| d501fcb679 | |||
| f5994d8442 | |||
| 4295cba915 | |||
| 6d66fc6cb8 | |||
| 4484f83caa | |||
| 3ada1770eb | |||
| 0b6f05e630 | |||
| 2170380f7b | |||
| a8ab7e4c35 | |||
| c20c9c638f | |||
| 43b2a2185e | |||
| 2423bdd623 | |||
| bcb90d64a5 | |||
| 7d448d0959 | |||
| 53fe02db7e | |||
| af51465a6a | |||
| a03dd7b11e | |||
| 6d994f48ac | |||
| f0e8252e38 | |||
| ad06aded1b | |||
| 0ca52fcc60 | |||
| c53342ba4c | |||
| 25eea8d599 | |||
| 22498649b1 | |||
| 25ce7baa7d | |||
| e885384678 | |||
| 528209f8da | |||
| 153fe248a7 | |||
| 7fc4822bbe | |||
| d65bee76b2 | |||
| 385d6396b0 | |||
| 46858af1ed | |||
| 34163625fe | |||
| c2057656bc | |||
| 09a4e33f3f | |||
| e53b388a5e | |||
| 4fb4af0b4f | |||
| 461f032777 | |||
| ab37f9ae35 | |||
| a3347c0037 | |||
| f3835d1ca3 | |||
| d30c4791fe | |||
| 7ee9b9ebcc | |||
| b4caf109f7 | |||
| 0e8ffe528a | |||
| a8029d1dc5 | |||
| c12f9d0272 | |||
| d2d1843e03 | |||
| a89a122b09 | |||
| e5e22f75fc | |||
| cab21e9d48 | |||
| 2e7c26fcc0 | |||
| 0f6c41679c | |||
| 777d397ae7 | |||
| 41258104f6 | |||
| 08a8e6b816 |
+81
@@ -0,0 +1,81 @@
|
||||
*.obj
|
||||
*.pdb
|
||||
*.user
|
||||
*.aps
|
||||
*.pch
|
||||
*.vspscc
|
||||
[Bb]in
|
||||
[Db]ebug*/
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
_NCrunch_*/
|
||||
*.ncrunchsolution
|
||||
*.ncrunchsolution.user
|
||||
*.ncrunchproject
|
||||
*.crunchsolution.cache
|
||||
[Tt]est[Rr]esult*
|
||||
[Bb]uild[Ll]og.*
|
||||
*.[Pp]ublish.xml
|
||||
*.suo
|
||||
[sS]ource
|
||||
[sS]andbox
|
||||
umbraco.config
|
||||
*.vs10x
|
||||
App_Data/TEMP/*
|
||||
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
|
||||
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
|
||||
[Uu]mbraco/[Pp]resentation/[Ss]cripts/*
|
||||
[Uu]mbraco/[Pp]resentation/[Ff]onts/*
|
||||
[Uu]mbraco/[Pp]resentation/[Cc]ss/*
|
||||
|
||||
src/Umbraco.Web.UI/[Cc]ss/*
|
||||
src/Umbraco.Web.UI/App_Code/*
|
||||
src/Umbraco.Web.UI/App_Data/*
|
||||
src/Umbraco.Tests/App_Data/*
|
||||
src/Umbraco.Web.UI/[Mm]edia/*
|
||||
src/Umbraco.Web.UI/[Mm]aster[Pp]ages/*
|
||||
src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/*
|
||||
src/Umbraco.Web.UI/[Xx]slt/*
|
||||
src/Umbraco.Web.UI/[Ii]mages/*
|
||||
src/Umbraco.Web.UI/[Ss]cripts/*
|
||||
src/Umbraco.Web.UI/Web.*.config.transformed
|
||||
|
||||
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
|
||||
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
|
||||
_BuildOutput/*
|
||||
build/UmbracoCms.AllBinaries*zip
|
||||
build/UmbracoCms.WebPI*zip
|
||||
build/UmbracoCms*zip
|
||||
build/*.nupkg
|
||||
src/Umbraco.Tests/config/applications.config
|
||||
src/Umbraco.Tests/config/trees.config
|
||||
src/Umbraco.Web.UI/web.config
|
||||
*.orig
|
||||
src/Umbraco.Tests/config/404handlers.config
|
||||
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
|
||||
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
|
||||
src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config
|
||||
src/Umbraco.Web.UI/[Vv]iews/*
|
||||
src/packages/
|
||||
src/packages/repositories.config
|
||||
|
||||
src/Umbraco.Web.UI/[Ww]eb.config
|
||||
*.transformed
|
||||
webpihash.txt
|
||||
|
||||
node_modules
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
|
||||
src/Umbraco.Web.UI.Client/[Bb]uild/*
|
||||
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
|
||||
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
|
||||
build/_BuildOutput/
|
||||
tools/NDepend/
|
||||
@@ -1,70 +0,0 @@
|
||||
syntax: regexp
|
||||
^src/packages/(?!repositories.config$)
|
||||
web.Template.[a-zA-Z0-9]*.Debug.config
|
||||
|
||||
syntax: glob
|
||||
*.obj
|
||||
*.pdb
|
||||
*.user
|
||||
*.aps
|
||||
*.pch
|
||||
*.vspscc
|
||||
[Bb]in
|
||||
[Db]ebug*/
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
_NCrunch_*/
|
||||
*.ncrunchsolution
|
||||
*.ncrunchsolution.user
|
||||
*.ncrunchproject
|
||||
*.crunchsolution.cache
|
||||
[Tt]est[Rr]esult*
|
||||
[Bb]uild[Ll]og.*
|
||||
*.[Pp]ublish.xml
|
||||
*.suo
|
||||
[sS]ource
|
||||
[sS]andbox
|
||||
umbraco.config
|
||||
*.vs10x
|
||||
App_Data\TEMP\*
|
||||
umbraco\presentation\umbraco\plugins\*
|
||||
umbraco\presentation\usercontrols\*
|
||||
umbraco\presentation\scripts\*
|
||||
umbraco\presentation\fonts\*
|
||||
umbraco\presentation\css\*
|
||||
|
||||
src\Umbraco.Web.UI\[Cc]ss\*
|
||||
src\Umbraco.Web.UI\App_Code\*
|
||||
src\Umbraco.Web.UI\App_Data\*
|
||||
src\Umbraco.Tests\App_Data\*
|
||||
src\Umbraco.Web.UI\[Mm]edia\*
|
||||
src\Umbraco.Web.UI\[Mm]aster[Pp]ages\*
|
||||
src\Umbraco.Web.UI\[Mm]acro[Ss]cripts\*
|
||||
src\Umbraco.Web.UI\[Xx]slt\*
|
||||
src\Umbraco.Web.UI\[Ii]mages\*
|
||||
src\Umbraco.Web.UI\[Ss]cripts\*
|
||||
src\Umbraco.Web.UI\Web.*.config.transformed
|
||||
|
||||
umbraco\presentation\umbraco\plugins\uComponents\uComponentsInstaller.ascx
|
||||
umbraco\presentation\packages\uComponents\MultiNodePicker\CustomTreeService.asmx
|
||||
_BuildOutput/*
|
||||
*.ncrunchsolution
|
||||
build/UmbracoCms.AllBinaries*zip
|
||||
build/UmbracoCms.WebPI*zip
|
||||
build/UmbracoCms*zip
|
||||
build/*.nupkg
|
||||
src/Umbraco.Tests/config/applications.config
|
||||
src/Umbraco.Tests/config/trees.config
|
||||
src/Umbraco.Web.UI/web.config
|
||||
*.orig
|
||||
src/Umbraco.Tests/config/404handlers.config
|
||||
src/Umbraco.Web.UI/Views/*.cshtml
|
||||
src/Umbraco.Web.UI/Views/*.vbhtml
|
||||
src/Umbraco.Tests/config/umbracoSettings.config
|
||||
src/Umbraco.Web.UI/App_Plugins/*
|
||||
src/Umbraco.Web.UI/Views/*
|
||||
src/packages/
|
||||
|
||||
src\Umbraco.Web.UI\[W]eb.config
|
||||
*.transformed
|
||||
@@ -1,31 +0,0 @@
|
||||
d0aba247db91d1b70c39c6397b965ca370a67497 Sprint-Juno-A
|
||||
0b8f67be2ca8faf008151d87f232c698de69e735 Release-4.5.0
|
||||
5960c073250926d202861a09472f5f334da6e283 Sprint-Juno-B
|
||||
f15d4ff81a8368e9d42788f7e0ae726f7a70a3b1 Release-4.0.3
|
||||
283065df4d3c27245267709dd2644a479c4f62a5 Release-4.0.4.2
|
||||
ffc34b23e1a03785e4098afa4290d8c03cf10115 Release-4.5.2
|
||||
d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
|
||||
1809f7b2593270c192cd47bdcfdb392100686f79 4.7.2
|
||||
488779dec0ceb1d2874bcef906241b919325c904 4.8.0-beta
|
||||
096f20bb0575d6199f20fcb3147b63554e765a74 Release-4.8.0
|
||||
8f8a203857886b373148af29edd57460a42940be Release-4.8.1
|
||||
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
|
||||
8d7d8609e2e4b971da99cd97f72132ce85ce3333 Release-4.9.1
|
||||
f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.0
|
||||
20e4dff821d8ac2527a5353618fa1a23ea1d8b34 Release-4.11.0
|
||||
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
|
||||
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
|
||||
6eb5f2fb5a88aa29ea544499df9160a1b31b5638 Release-4.11.1
|
||||
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
|
||||
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
|
||||
0000000000000000000000000000000000000000 4.11.2
|
||||
73711b806a4044dbf0d7d7c095ddfdda23b09932 Release-4.11.2
|
||||
77db220b89e166b3c0736ed321ecfd6416cddbcd Release-4.11.2.1
|
||||
54cde33b809dcb3a1f7e7ae0d5375f6dd0d89c8d Release-4.11.2.2
|
||||
ff3bb24ea0c915878396a6ae27f1ff164e8ac150 Release-6.0.0-beta
|
||||
56015ac26f5ab60e3c61b1d09075297b660afa07 Release-6.0.0-RC
|
||||
1719fbd857f28b376639ac2aa0abada0ef2e7560 Release-6.0.0
|
||||
e02f5aebb87e3f07d27376647756caa9762931d8 Release-4.11.4
|
||||
14338b0ab1738fbd8987677ecdb9a73d79fc229d release-4.11.6
|
||||
b247b35d821144849f551e02da8ba719f91d5fb0 Release-6.0.2
|
||||
aed55cba29009ad3db48880a7cfb66407ce9805f release-6.0.3
|
||||
@@ -0,0 +1,33 @@
|
||||
Umbraco CMS
|
||||
===========
|
||||
## Watch a five minute introduction video ##
|
||||
|
||||
[](http://umbraco.org/help-and-support/video-tutorials/getting-started/what-is-umbraco)
|
||||
|
||||
## Umbraco - the simple, flexible and friendly ASP.NET CMS ##
|
||||
|
||||
**More than 177,000 sites trust Umbraco**
|
||||
|
||||
For the first time on the Microsoft platform a free user and developer friendly CMS that makes it quick and easy to create websites - or a breeze to build complex web applications. Umbraco has award-winning integration capabilities and supports your ASP.NET User and Custom Controls out of the box. It's a developers dream and your users will love it too.
|
||||
|
||||
Used by more than 177,000 active websites including [http://daviscup.com](http://daviscup.com), [http://heinz.com](http://heinz.com), [http://peugeot.com](http://peugeot.com), [http://www.hersheys.com/](http://www.hersheys.com/) and **The Official ASP.NET and IIS.NET website from Microsoft** ([http://asp.net](http://asp.net) / [http://iis.net](http://iis.net)) you can be sure that the technology is proven, stable and scales.
|
||||
|
||||
To view more examples please visit [http://umbraco.com/why-umbraco/#caseStudies](http://umbraco.com/why-umbraco/#caseStudies)
|
||||
|
||||
## Downloading ##
|
||||
|
||||
The downloadable Umbraco releases live at [http://our.umbraco.org/contribute/releases](http://our.umbraco.org/contribute/releases).
|
||||
|
||||
## Forums ##
|
||||
|
||||
We have a forum running on [http://our.umbraco.org](http://our.umbraco.org). The discussions group on [Google Groups](https://groups.google.com/forum/#!forum/umbraco-dev) is for discussions on developing the core, and not on Umbraco-implementations or extensions in general. For those topics, please use [http://our.umbraco.org](http://our.umbraco.org).
|
||||
|
||||
## Contribute to Umbraco ##
|
||||
|
||||
If you want to contribute back to Umbraco you should check out our [guide to contributing](http://our.umbraco.org/contribute).
|
||||
|
||||
## Found a bug? ##
|
||||
|
||||
Another way you can contribute to Umbraco is by providing issue reports, for information on how to submit an issue report refer to our [online guide for reporting issues](http://our.umbraco.org/contribute/report-an-issue-or-request-a-feature).
|
||||
|
||||
To view existing issues please visit [http://issues.umbraco.org](http://issues.umbraco.org)
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
@ECHO OFF
|
||||
SET release=6.0.4
|
||||
SET release=6.0.7
|
||||
SET comment=
|
||||
SET version=%release%
|
||||
|
||||
IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
|
||||
|
||||
ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %release%
|
||||
|
||||
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment%
|
||||
|
||||
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
|
||||
|
||||
+20
-1
@@ -82,6 +82,7 @@
|
||||
<SolutionBinFolder>$(BuildFolder)bin\</SolutionBinFolder>
|
||||
<WebAppFolder>$(BuildFolder)WebApp\</WebAppFolder>
|
||||
<WebPiFolder>$(BuildFolder)WebPi\</WebPiFolder>
|
||||
<ConfigsFolder>$(BuildFolder)Configs\</ConfigsFolder>
|
||||
<SolutionBinFolderRelativeToProjects>$(BuildFolderRelativeToProjects)bin\</SolutionBinFolderRelativeToProjects>
|
||||
<SolutionBinFolderAbsolutePath>$(BuildFolderAbsolutePath)bin\</SolutionBinFolderAbsolutePath>
|
||||
<WebAppFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebApp\</WebAppFolderRelativeToProjects>
|
||||
@@ -194,7 +195,7 @@
|
||||
</Target>
|
||||
|
||||
<!-- Copy the transformed web.config file to the root -->
|
||||
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyXmlDocumentation">
|
||||
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyTransformedConfig">
|
||||
<ItemGroup>
|
||||
<WebConfigFile Include="..\src\Umbraco.Web.UI\web.$(BuildConfiguration).Config.transformed" />
|
||||
</ItemGroup>
|
||||
@@ -205,6 +206,24 @@
|
||||
SkipUnchangedFiles="false" />
|
||||
</Target>
|
||||
|
||||
<!-- Copy the config files and rename them to *.config.transform -->
|
||||
<Target Name="CopyTransformedConfig" DependsOnTargets="CopyXmlDocumentation">
|
||||
<ItemGroup>
|
||||
<ConfigFiles Include="$(WebAppFolder)config\*.config" />
|
||||
<WebConfigTransformFile Include="$(WebAppFolder)Web.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<Copy SourceFiles="@(ConfigFiles)"
|
||||
DestinationFiles="@(ConfigFiles->'$(ConfigsFolder)\%(RecursiveDir)%(Filename)%(Extension)')"
|
||||
OverwriteReadOnlyFiles="true"
|
||||
SkipUnchangedFiles="false" />
|
||||
|
||||
<Copy SourceFiles="@(WebConfigTransformFile)"
|
||||
DestinationFiles="$(ConfigsFolder)Web.config.transform"
|
||||
OverwriteReadOnlyFiles="true"
|
||||
SkipUnchangedFiles="false" />
|
||||
</Target>
|
||||
|
||||
<!-- Copy the xml documentation to the bin folder -->
|
||||
<Target Name="CopyXmlDocumentation" DependsOnTargets="CompileProjects">
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>UmbracoCms.Core</id>
|
||||
<version>6.0.0-alpha</version>
|
||||
<version>6.0.7</version>
|
||||
<title>Umbraco Cms Core Binaries</title>
|
||||
<authors>Morten Christensen</authors>
|
||||
<owners>Umbraco HQ</owners>
|
||||
@@ -15,9 +15,13 @@
|
||||
<language>en-US</language>
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.20710.0]" />
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="4.0" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.21" />
|
||||
<dependency id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" />
|
||||
<dependency id="HtmlAgilityPack" version="1.4.5" />
|
||||
<dependency id="Lucene.Net" version="[2.9.4.1]" />
|
||||
<dependency id="SharpZipLib" version="0.86.0" />
|
||||
<dependency id="MySql.Data" version="[6.6,6.7)" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
@@ -31,16 +35,11 @@
|
||||
<file src="..\_BuildOutput\WebApp\bin\controls.xml" target="lib\controls.xml" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\CookComputing.XmlRpcV2.dll" target="lib\CookComputing.XmlRpcV2.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Examine.dll" target="lib\Examine.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\HtmlAgilityPack.dll" target="lib\HtmlAgilityPack.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\ICSharpCode.SharpZipLib.dll" target="lib\ICSharpCode.SharpZipLib.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\interfaces.dll" target="lib\interfaces.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\interfaces.xml" target="lib\interfaces.xml" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\log4net.dll" target="lib\log4net.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Lucene.Net.dll" target="lib\Lucene.Net.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Lucene.Net.xml" target="lib\Lucene.Net.xml" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Microsoft.Web.Helpers.dll" target="lib\Microsoft.Web.Helpers.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\MySql.Data.dll" target="lib\MySql.Data.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.47x.dll" target="lib\Our.Umbraco.uGoLive.47x.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.Checks.dll" target="lib\Our.Umbraco.uGoLive.Checks.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.dll" target="lib\Our.Umbraco.uGoLive.dll" />
|
||||
@@ -63,8 +62,6 @@
|
||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.providers.dll" target="lib\umbraco.providers.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.providers.xml" target="lib\umbraco.providers.xml" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Web.UI.dll" target="lib\Umbraco.Web.UI.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.webservices.dll" target="lib\umbraco.webservices.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.webservices.xml" target="lib\umbraco.webservices.xml" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\umbraco.XmlSerializers.dll" target="lib\umbraco.XmlSerializers.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\UrlRewritingNet.UrlRewriter.dll" target="lib\UrlRewritingNet.UrlRewriter.dll" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>UmbracoCms</id>
|
||||
<version>6.0.0-alpha</version>
|
||||
<version>6.0.7</version>
|
||||
<title>Umbraco Cms</title>
|
||||
<authors>Morten Christensen</authors>
|
||||
<owners>Umbraco HQ</owners>
|
||||
@@ -21,14 +21,14 @@
|
||||
<files>
|
||||
<file src="..\_BuildOutput\WebApp\bin\amd64\**" target="Content\bin\amd64" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\x86\**" target="Content\bin\x86" />
|
||||
<file src="..\_BuildOutput\WebApp\config\*.config" target="Content\config" />
|
||||
<file src="..\_BuildOutput\Configs\**" target="Content\config" exclude="..\_BuildOutput\Configs\Web.config.transform" />
|
||||
<file src="..\_BuildOutput\WebApp\css\**" target="Content\css" />
|
||||
<file src="..\_BuildOutput\WebApp\macroScripts\**" target="Content\macroScripts" />
|
||||
<file src="..\_BuildOutput\WebApp\masterpages\**" target="Content\masterpages" />
|
||||
<file src="..\_BuildOutput\WebApp\media\**" target="Content\media" />
|
||||
<file src="..\_BuildOutput\WebApp\scripts\**" target="Content\scripts" />
|
||||
<file src="..\_BuildOutput\WebApp\usercontrols\**" target="Content\usercontrols" />
|
||||
<file src="..\_BuildOutput\WebApp\Views\**" target="Content\Views" />
|
||||
<file src="..\_BuildOutput\WebApp\Views\**" target="Content\Views" exclude="..\_BuildOutput\WebApp\Views\Web.config" />
|
||||
<file src="..\_BuildOutput\WebApp\xslt\**" target="Content\xslt" />
|
||||
<file src="..\_BuildOutput\WebApp\default.aspx" target="Content\default.aspx" />
|
||||
<file src="..\_BuildOutput\WebApp\Web.config" target="Content\Web.config" />
|
||||
@@ -36,7 +36,7 @@
|
||||
<file src="..\_BuildOutput\WebApp\App_Code\**" target="UmbracoFiles\App_Code" />
|
||||
<file src="..\_BuildOutput\WebApp\App_Data\**" target="UmbracoFiles\App_Data" />
|
||||
<file src="..\_BuildOutput\WebApp\App_Plugins\**" target="UmbracoFiles\App_Plugins" />
|
||||
<file src="..\_BuildOutput\WebApp\config\**" target="UmbracoFiles\config" />
|
||||
<file src="..\_BuildOutput\WebApp\config\splashes\**" target="UmbracoFiles\config\splashes" />
|
||||
<file src="..\_BuildOutput\WebApp\install\**" target="UmbracoFiles\install" />
|
||||
<file src="..\_BuildOutput\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
|
||||
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
A note about running Umbraco from Visual Studio.
|
||||
|
||||
When upgrading your website using nuget a backup of config files and web.config will be created and the files will
|
||||
be overwritten with those from the current release. This means that you'll have to merge the files if you made any
|
||||
changes to the previous config files.
|
||||
When upgrading your website using nuget a backup of config files and web.config will be created. Only the web.config will
|
||||
be overwritten by default to ensure that it has the necessary settings from the current release. This means that you'll
|
||||
have to merge the files if you made any changes to the previous config files.
|
||||
The config files found in the config folder will usually not be changed for patch releases, so they can usually be skipped,
|
||||
but the web.config will have to have its previous "umbracoConfigurationStatus"-appsetting and "umbracoDbDSN" connection string
|
||||
copied over (as a minimum).
|
||||
|
||||
It's not possible to create a deploy package from Visual Studio, which contains everything out of the box. This is
|
||||
due to a number of files and folders that are not added to the Visual Studio project. These folders include:
|
||||
install, umbraco and umbraco_client.
|
||||
A custom deploy script will be added in a later release.
|
||||
|
||||
Please read the release notes on Codeplex:
|
||||
http://umbraco.codeplex.com/releases
|
||||
Please read the release notes on our.umbraco.org:
|
||||
http://our.umbraco.org/contribute/releases
|
||||
|
||||
- Umbraco
|
||||
Binary file not shown.
Binary file not shown.
@@ -17,7 +17,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(PackageSources)' == '' ">
|
||||
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
|
||||
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
|
||||
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
|
||||
<!--
|
||||
<PackageSource Include="https://nuget.org/api/v2/" />
|
||||
<PackageSource Include="https://my-nuget-source/nuget/" />
|
||||
@@ -54,10 +55,10 @@
|
||||
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
|
||||
|
||||
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
||||
<ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
|
||||
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
|
||||
RestorePackages;
|
||||
$(ResolveReferencesDependsOn);
|
||||
</ResolveReferencesDependsOn>
|
||||
$(BuildDependsOn);
|
||||
</BuildDependsOn>
|
||||
|
||||
<!-- Make the build depend on restore packages -->
|
||||
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
||||
@@ -75,7 +76,7 @@
|
||||
This effectively acts as a lock that makes sure that the download operation will only happen once and all
|
||||
parallel builds will have to wait for it to complete.
|
||||
-->
|
||||
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
|
||||
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_DownloadNuGet">
|
||||
|
||||
@@ -19,7 +19,41 @@ namespace Umbraco.Core
|
||||
return new FileInfo(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Returns true if the assembly is the App_Code assembly
|
||||
/// </summary>
|
||||
/// <param name="assembly"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsAppCodeAssembly(this Assembly assembly)
|
||||
{
|
||||
if (assembly.FullName.StartsWith("App_Code"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Assembly.Load("App_Code");
|
||||
return true;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
//this will occur if it cannot load the assembly
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the assembly is the compiled global asax.
|
||||
/// </summary>
|
||||
/// <param name="assembly"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsGlobalAsaxAssembly(this Assembly assembly)
|
||||
{
|
||||
//only way I can figure out how to test is by the name
|
||||
return assembly.FullName.StartsWith("App_global.asax");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the file used to load the assembly
|
||||
/// </summary>
|
||||
/// <param name="assemblyName"></param>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
private static readonly Version Version = new Version("6.0.4");
|
||||
private static readonly Version Version = new Version("6.0.7");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current version of Umbraco.
|
||||
|
||||
@@ -5,12 +5,11 @@ using System.Text;
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
internal class FileSystemProviderAttribute : Attribute
|
||||
public class FileSystemProviderAttribute : Attribute
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
public string Alias { get; private set; }
|
||||
|
||||
public FileSystemProviderAttribute(string alias)
|
||||
{
|
||||
|
||||
+1
-2
@@ -6,8 +6,7 @@ using Umbraco.Core.CodeAnnotations;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal class FileSystemProvider
|
||||
internal class FileSystemProviderConstants
|
||||
{
|
||||
public const string Media = "media";
|
||||
}
|
||||
@@ -9,9 +9,8 @@ using Umbraco.Core.CodeAnnotations;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal class FileSystemProviderManager
|
||||
{
|
||||
public class FileSystemProviderManager
|
||||
{
|
||||
private readonly FileSystemProvidersSection _config;
|
||||
|
||||
@@ -28,7 +27,7 @@ namespace Umbraco.Core.IO
|
||||
|
||||
#region Constructors
|
||||
|
||||
public FileSystemProviderManager()
|
||||
internal FileSystemProviderManager()
|
||||
{
|
||||
_config = (FileSystemProvidersSection)ConfigurationManager.GetSection("FileSystemProviders");
|
||||
}
|
||||
@@ -48,7 +47,15 @@ namespace Umbraco.Core.IO
|
||||
private readonly ConcurrentDictionary<string, ProviderConstructionInfo> _providerLookup = new ConcurrentDictionary<string, ProviderConstructionInfo>();
|
||||
private readonly ConcurrentDictionary<Type, string> _wrappedProviderLookup = new ConcurrentDictionary<Type, string>();
|
||||
|
||||
public IFileSystem GetFileSystemProvider(string alias)
|
||||
/// <summary>
|
||||
/// Returns the underlying (non-typed) file system provider for the alias specified
|
||||
/// </summary>
|
||||
/// <param name="alias"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// It is recommended to use the typed GetFileSystemProvider method instead to get a strongly typed provider instance.
|
||||
/// </remarks>
|
||||
public IFileSystem GetUnderlyingFileSystemProvider(string alias)
|
||||
{
|
||||
//either get the constructor info from cache or create it and add to cache
|
||||
var ctorInfo = _providerLookup.GetOrAdd(alias, s =>
|
||||
@@ -88,6 +95,11 @@ namespace Umbraco.Core.IO
|
||||
return fs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the strongly typed file system provider
|
||||
/// </summary>
|
||||
/// <typeparam name="TProviderTypeFilter"></typeparam>
|
||||
/// <returns></returns>
|
||||
public TProviderTypeFilter GetFileSystemProvider<TProviderTypeFilter>()
|
||||
where TProviderTypeFilter : FileSystemWrapper
|
||||
{
|
||||
@@ -111,7 +123,7 @@ namespace Umbraco.Core.IO
|
||||
return attr.Alias;
|
||||
});
|
||||
|
||||
var innerFs = GetFileSystemProvider(alias);
|
||||
var innerFs = GetUnderlyingFileSystemProvider(alias);
|
||||
var outputFs = Activator.CreateInstance(typeof (TProviderTypeFilter), innerFs);
|
||||
return (TProviderTypeFilter)outputFs;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
@@ -14,11 +15,56 @@ using Umbraco.Core.Media;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
public static class ContentExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if the IContentBase has children
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// This is a bit of a hack because we need to type check!
|
||||
/// </remarks>
|
||||
internal static bool HasChildren(IContentBase content, ServiceContext services)
|
||||
{
|
||||
if (content is IContent)
|
||||
{
|
||||
return services.ContentService.HasChildren(content.Id);
|
||||
}
|
||||
if (content is IMedia)
|
||||
{
|
||||
return services.MediaService.HasChildren(content.Id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the children for the content base item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// This is a bit of a hack because we need to type check!
|
||||
/// </remarks>
|
||||
internal static IEnumerable<IContentBase> Children(IContentBase content, ServiceContext services)
|
||||
{
|
||||
if (content is IContent)
|
||||
{
|
||||
return services.ContentService.GetChildren(content.Id);
|
||||
}
|
||||
if (content is IMedia)
|
||||
{
|
||||
return services.MediaService.GetChildren(content.Id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set property values by alias with an annonymous object
|
||||
/// </summary>
|
||||
|
||||
@@ -408,6 +408,15 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a PropertyGroup from the current ContentType
|
||||
/// </summary>
|
||||
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
|
||||
public void RemovePropertyGroup(string propertyGroupName)
|
||||
{
|
||||
PropertyGroups.RemoveItem(propertyGroupName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the ParentId from the lazy integer id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent</param>
|
||||
|
||||
@@ -20,8 +20,10 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
}
|
||||
|
||||
protected ContentTypeCompositionBase(IContentTypeBase parent) : base(parent)
|
||||
protected ContentTypeCompositionBase(IContentTypeComposition parent)
|
||||
: base(parent)
|
||||
{
|
||||
AddContentType(parent);
|
||||
}
|
||||
|
||||
private static readonly PropertyInfo ContentTypeCompositionSelector =
|
||||
@@ -73,7 +75,7 @@ namespace Umbraco.Core.Models
|
||||
if (contentType.ContentTypeComposition.Any(x => x.CompositionAliases().Any(ContentTypeCompositionExists)))
|
||||
return false;
|
||||
|
||||
if (!ContentTypeCompositionExists(contentType.Alias))
|
||||
if (ContentTypeCompositionExists(contentType.Alias) == false)
|
||||
{
|
||||
_contentTypeComposition.Add(contentType);
|
||||
OnPropertyChanged(ContentTypeCompositionSelector);
|
||||
|
||||
@@ -65,6 +65,12 @@ namespace Umbraco.Core.Models
|
||||
void RemovePropertyType(string propertyTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a PropertyGroup from the current ContentType
|
||||
/// </summary>
|
||||
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
|
||||
void RemovePropertyGroup(string propertyGroupName);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the ParentId from the lazy integer id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent</param>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
@@ -10,7 +11,7 @@ namespace Umbraco.Core.Models
|
||||
/// <remarks>
|
||||
/// A replacement for INode which needs to occur since INode doesn't contain the document type alias
|
||||
/// and INode is poorly formatted with mutable properties (i.e. Lists instead of IEnumerable)
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
public interface IPublishedContent
|
||||
{
|
||||
int Id { get; }
|
||||
|
||||
@@ -97,6 +97,14 @@ namespace Umbraco.Core.Models
|
||||
return this.Any(x => x.Name == groupName);
|
||||
}
|
||||
|
||||
public void RemoveItem(string propertyGroupName)
|
||||
{
|
||||
var key = IndexOfKey(propertyGroupName);
|
||||
//Only removes an item if the key was found
|
||||
if (key != -1)
|
||||
RemoveItem(key);
|
||||
}
|
||||
|
||||
public int IndexOfKey(string key)
|
||||
{
|
||||
for (var i = 0; i < this.Count; i++)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
@@ -16,7 +17,12 @@ namespace Umbraco.Core.Persistence
|
||||
private readonly string _connectionStringName;
|
||||
private readonly string _connectionString;
|
||||
private readonly string _providerName;
|
||||
private static volatile UmbracoDatabase _globalInstance = null;
|
||||
|
||||
//very important to have ThreadStatic:
|
||||
// see: http://issues.umbraco.org/issue/U4-2172
|
||||
[ThreadStatic]
|
||||
private static volatile UmbracoDatabase _nonHttpInstance;
|
||||
|
||||
private static readonly object Locker = new object();
|
||||
|
||||
/// <summary>
|
||||
@@ -55,27 +61,27 @@ namespace Umbraco.Core.Persistence
|
||||
//no http context, create the singleton global object
|
||||
if (HttpContext.Current == null)
|
||||
{
|
||||
if (_globalInstance == null)
|
||||
if (_nonHttpInstance == null)
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
//double check
|
||||
if (_globalInstance == null)
|
||||
if (_nonHttpInstance == null)
|
||||
{
|
||||
_globalInstance = string.IsNullOrEmpty(_providerName) == false && string.IsNullOrEmpty(_providerName) == false
|
||||
_nonHttpInstance = string.IsNullOrEmpty(_connectionString) == false && string.IsNullOrEmpty(_providerName) == false
|
||||
? new UmbracoDatabase(_connectionString, _providerName)
|
||||
: new UmbracoDatabase(_connectionStringName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _globalInstance;
|
||||
return _nonHttpInstance;
|
||||
}
|
||||
|
||||
//we have an http context, so only create one per request
|
||||
if (!HttpContext.Current.Items.Contains(typeof(DefaultDatabaseFactory)))
|
||||
if (HttpContext.Current.Items.Contains(typeof(DefaultDatabaseFactory)) == false)
|
||||
{
|
||||
HttpContext.Current.Items.Add(typeof (DefaultDatabaseFactory),
|
||||
string.IsNullOrEmpty(_providerName) == false && string.IsNullOrEmpty(_providerName) == false
|
||||
string.IsNullOrEmpty(_connectionString) == false && string.IsNullOrEmpty(_providerName) == false
|
||||
? new UmbracoDatabase(_connectionString, _providerName)
|
||||
: new UmbracoDatabase(_connectionStringName));
|
||||
}
|
||||
@@ -86,7 +92,7 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
if (HttpContext.Current == null)
|
||||
{
|
||||
_globalInstance.Dispose();
|
||||
_nonHttpInstance.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -66,17 +66,18 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
if (property.HasIdentity)
|
||||
dto.Id = property.Id;
|
||||
|
||||
if (property.DataTypeDatabaseType == DataTypeDatabaseType.Integer && property.Value != null && string.IsNullOrWhiteSpace(property.Value.ToString()) == false)
|
||||
if (property.DataTypeDatabaseType == DataTypeDatabaseType.Integer)
|
||||
{
|
||||
if (property.Value is bool)
|
||||
if (property.Value is bool || property.PropertyType.DataTypeId == new Guid("38b352c1-e9f8-4fd8-9324-9a2eab06d97a"))
|
||||
{
|
||||
int val = Convert.ToInt32(property.Value);
|
||||
dto.Integer = val;
|
||||
dto.Integer = property.Value != null && string.IsNullOrEmpty(property.Value.ToString())
|
||||
? 0
|
||||
: Convert.ToInt32(property.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
int val;
|
||||
if (int.TryParse(property.Value.ToString(), out val))
|
||||
if ((property.Value != null && string.IsNullOrWhiteSpace(property.Value.ToString()) == false) && int.TryParse(property.Value.ToString(), out val))
|
||||
{
|
||||
dto.Integer = val;
|
||||
}
|
||||
|
||||
@@ -455,9 +455,12 @@ namespace Umbraco.Core.Persistence.Querying
|
||||
if (fieldType == typeof(decimal))
|
||||
return ((decimal)value).ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
if(fieldType == typeof(DateTime))
|
||||
if (fieldType == typeof(DateTime))
|
||||
return "'" + EscapeParam(((DateTime)value).ToString(CultureInfo.InvariantCulture)) + "'";
|
||||
|
||||
|
||||
if (fieldType == typeof(bool))
|
||||
return ((bool)value) ? Convert.ToString(1, CultureInfo.InvariantCulture) : Convert.ToString(0, CultureInfo.InvariantCulture);
|
||||
|
||||
return ShouldQuoteValue(fieldType)
|
||||
? "'" + EscapeParam(value) + "'"
|
||||
: value.ToString();
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
_contentTypeRepository = contentTypeRepository;
|
||||
_templateRepository = templateRepository;
|
||||
|
||||
EnsureUniqueNaming = true;
|
||||
}
|
||||
|
||||
public ContentRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository)
|
||||
@@ -34,8 +36,12 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
_contentTypeRepository = contentTypeRepository;
|
||||
_templateRepository = templateRepository;
|
||||
|
||||
EnsureUniqueNaming = true;
|
||||
}
|
||||
|
||||
public bool EnsureUniqueNaming { get; set; }
|
||||
|
||||
#region Overrides of RepositoryBase<IContent>
|
||||
|
||||
protected override IContent PerformGet(int id)
|
||||
@@ -180,6 +186,9 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
((Content)entity).AddingEntity();
|
||||
|
||||
//Ensure unique name on the same level
|
||||
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name);
|
||||
|
||||
var factory = new ContentFactory(NodeObjectTypeId, entity.Id);
|
||||
var dto = factory.BuildDto(entity);
|
||||
|
||||
@@ -260,6 +269,9 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
entity.UpdateDate = DateTime.Now;
|
||||
}
|
||||
|
||||
//Ensure unique name on the same level
|
||||
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name, entity.Id);
|
||||
|
||||
//Look up parent to get and set the correct Path and update SortOrder if ParentId has changed
|
||||
if (((ICanBeDirty)entity).IsPropertyDirty("ParentId"))
|
||||
{
|
||||
@@ -487,5 +499,77 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
return new PropertyCollection(properties);
|
||||
}
|
||||
|
||||
private string EnsureUniqueNodeName(int parentId, string nodeName, int id = 0)
|
||||
{
|
||||
if (EnsureUniqueNaming == false)
|
||||
return nodeName;
|
||||
|
||||
var sql = new Sql();
|
||||
sql.Select("*")
|
||||
.From<NodeDto>()
|
||||
.Where<NodeDto>(x => x.ParentId == parentId && x.Text.StartsWith(nodeName));
|
||||
|
||||
int uniqueNumber = 1;
|
||||
var currentName = nodeName;
|
||||
|
||||
var dtos = Database.Fetch<NodeDto>(sql);
|
||||
if (dtos.Any())
|
||||
{
|
||||
var results = dtos.OrderBy(x => x.Text, new SimilarNodeNameComparer());
|
||||
foreach (var dto in results)
|
||||
{
|
||||
if(id != 0 && id == dto.NodeId) continue;
|
||||
|
||||
if (dto.Text.ToLowerInvariant().Equals(currentName.ToLowerInvariant()))
|
||||
{
|
||||
currentName = nodeName + string.Format(" ({0})", uniqueNumber);
|
||||
uniqueNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comparer that takes into account the duplicate index of a node name
|
||||
/// This is needed as a normal alphabetic sort would go Page (1), Page (10), Page (2) etc.
|
||||
/// </summary>
|
||||
private class SimilarNodeNameComparer : IComparer<string>
|
||||
{
|
||||
public int Compare(string x, string y)
|
||||
{
|
||||
if (x.LastIndexOf(')') == x.Length - 1 && y.LastIndexOf(')') == y.Length - 1)
|
||||
{
|
||||
if (x.ToLower().Substring(0, x.LastIndexOf('(')) == y.ToLower().Substring(0, y.LastIndexOf('(')))
|
||||
{
|
||||
int xDuplicateIndex = ExtractDuplicateIndex(x);
|
||||
int yDuplicateIndex = ExtractDuplicateIndex(y);
|
||||
|
||||
if (xDuplicateIndex != 0 && yDuplicateIndex != 0)
|
||||
{
|
||||
return xDuplicateIndex.CompareTo(yDuplicateIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
return String.Compare(x.ToLower(), y.ToLower(), StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private int ExtractDuplicateIndex(string text)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
if (text.LastIndexOf('(') != -1 && text.LastIndexOf('(') < text.Length - 2)
|
||||
{
|
||||
int startPos = text.LastIndexOf('(') + 1;
|
||||
int length = text.Length - 1 - startPos;
|
||||
|
||||
int.TryParse(text.Substring(startPos, length), out index);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
.Where<NodeDto>(x => x.NodeObjectType == new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"))
|
||||
.Where<ContentDto>(x => x.ContentTypeId == entity.Id);
|
||||
|
||||
var contentDtos = Database.Fetch<DocumentDto, ContentVersionDto, ContentDto, NodeDto>(sql);
|
||||
var contentDtos = Database.Fetch<ContentDto, NodeDto>(sql);
|
||||
//Loop through all tracked keys, which corresponds to the ContentTypes that has been removed from the composition
|
||||
foreach (var key in compositionBase.RemovedContentTypeKeyTracker)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Umbraco.Core.Persistence
|
||||
uow,
|
||||
RuntimeCacheProvider.Current,
|
||||
CreateContentTypeRepository(uow),
|
||||
CreateTemplateRepository(uow));
|
||||
CreateTemplateRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.UmbracoSettings.EnsureUniqueNaming };
|
||||
}
|
||||
|
||||
public virtual IContentTypeRepository CreateContentTypeRepository(IDatabaseUnitOfWork uow)
|
||||
|
||||
@@ -29,11 +29,11 @@ using System.Security.Permissions;
|
||||
[assembly: InternalsVisibleTo("businesslogic")]
|
||||
[assembly: InternalsVisibleTo("cms")]
|
||||
[assembly: InternalsVisibleTo("umbraco.editorControls")]
|
||||
[assembly: InternalsVisibleTo("umbraco.webservices")]
|
||||
[assembly: InternalsVisibleTo("umbraco.datalayer")]
|
||||
[assembly: InternalsVisibleTo("umbraco.MacroEngines")]
|
||||
|
||||
[assembly: InternalsVisibleTo("umbraco.editorControls")]
|
||||
[assembly: InternalsVisibleTo("umbraco.webservices")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Core")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Web")]
|
||||
|
||||
@@ -56,8 +56,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content is based on.
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IContent without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new content objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
@@ -66,7 +71,7 @@ namespace Umbraco.Core.Services
|
||||
public IContent CreateContent(string name, int parentId, string contentTypeAlias, int userId = 0)
|
||||
{
|
||||
var contentType = FindContentTypeByAlias(contentTypeAlias);
|
||||
var content = new Content(name, parentId, contentType); ;
|
||||
var content = new Content(name, parentId, contentType);
|
||||
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IContent>(content, contentTypeAlias, parentId), this))
|
||||
{
|
||||
@@ -86,8 +91,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content is based on.
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IContent without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new content objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parent">Parent <see cref="IContent"/> object for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
@@ -114,6 +124,86 @@ namespace Umbraco.Core.Services
|
||||
return content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates and saves an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IContent"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the content</param>
|
||||
/// <returns><see cref="IContent"/></returns>
|
||||
public IContent CreateContentWithIdentity(string name, int parentId, string contentTypeAlias, int userId = 0)
|
||||
{
|
||||
var contentType = FindContentTypeByAlias(contentTypeAlias);
|
||||
var content = new Content(name, parentId, contentType);
|
||||
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IContent>(content, contentTypeAlias, parentId), this))
|
||||
{
|
||||
content.WasCancelled = true;
|
||||
return content;
|
||||
}
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(uow))
|
||||
{
|
||||
content.CreatorId = userId;
|
||||
content.WriterId = userId;
|
||||
repository.AddOrUpdate(content);
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
Created.RaiseEvent(new NewEventArgs<IContent>(content, false, contentTypeAlias, parentId), this);
|
||||
|
||||
Audit.Add(AuditTypes.New, "", content.CreatorId, content.Id);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates and saves an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IContent"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parent">Parent <see cref="IContent"/> object for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the content</param>
|
||||
/// <returns><see cref="IContent"/></returns>
|
||||
public IContent CreateContentWithIdentity(string name, IContent parent, string contentTypeAlias, int userId = 0)
|
||||
{
|
||||
var contentType = FindContentTypeByAlias(contentTypeAlias);
|
||||
var content = new Content(name, parent, contentType);
|
||||
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IContent>(content, contentTypeAlias, parent), this))
|
||||
{
|
||||
content.WasCancelled = true;
|
||||
return content;
|
||||
}
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(uow))
|
||||
{
|
||||
content.CreatorId = userId;
|
||||
content.WriterId = userId;
|
||||
repository.AddOrUpdate(content);
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
Created.RaiseEvent(new NewEventArgs<IContent>(content, false, contentTypeAlias, parent), this);
|
||||
|
||||
Audit.Add(AuditTypes.New, "", content.CreatorId, content.Id);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IContent"/> object by Id
|
||||
/// </summary>
|
||||
@@ -211,7 +301,7 @@ namespace Umbraco.Core.Services
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(_uowProvider.GetUnitOfWork()))
|
||||
{
|
||||
var query = Query<IContent>.Builder.Where(x => x.ParentId == id);
|
||||
var contents = repository.GetByQuery(query);
|
||||
var contents = repository.GetByQuery(query).OrderBy(x => x.SortOrder);
|
||||
|
||||
return contents;
|
||||
}
|
||||
@@ -862,7 +952,10 @@ namespace Umbraco.Core.Services
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(uow))
|
||||
{
|
||||
content.WriterId = userId;
|
||||
// Update the create author and last edit author
|
||||
copy.CreatorId = userId;
|
||||
copy.WriterId = userId;
|
||||
|
||||
repository.AddOrUpdate(copy);
|
||||
uow.Commit();
|
||||
|
||||
@@ -937,7 +1030,7 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
//Look for children and copy those as well
|
||||
var children = GetChildren(content.Id).OrderBy(x => x.SortOrder);
|
||||
var children = GetChildren(content.Id);
|
||||
foreach (var child in children)
|
||||
{
|
||||
Copy(child, copy.Id, relateToOriginal, userId);
|
||||
@@ -998,6 +1091,7 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
content.WriterId = userId;
|
||||
content.CreatorId = userId;
|
||||
content.ChangePublishedState(PublishedState.Unpublished);
|
||||
|
||||
repository.AddOrUpdate(content);
|
||||
uow.Commit();
|
||||
@@ -1010,6 +1104,92 @@ namespace Umbraco.Core.Services
|
||||
return content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IContent"/> objects by updating the SortOrder according
|
||||
/// to the ordering of items in the passed in <see cref="IEnumerable{T}"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Using this method will ensure that the Published-state is maintained upon sorting
|
||||
/// so the cache is updated accordingly - as needed.
|
||||
/// </remarks>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
public bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true)
|
||||
{
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IContent>(items), this))
|
||||
return false;
|
||||
}
|
||||
|
||||
var shouldBePublished = new List<IContent>();
|
||||
var shouldBeSaved = new List<IContent>();
|
||||
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(uow))
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var content in items)
|
||||
{
|
||||
//If the current sort order equals that of the content
|
||||
//we don't need to update it, so just increment the sort order
|
||||
//and continue.
|
||||
if (content.SortOrder == i)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
content.SortOrder = i;
|
||||
content.WriterId = userId;
|
||||
i++;
|
||||
|
||||
if (content.Published)
|
||||
{
|
||||
var published = _publishingStrategy.Publish(content, userId);
|
||||
shouldBePublished.Add(content);
|
||||
}
|
||||
else
|
||||
shouldBeSaved.Add(content);
|
||||
|
||||
repository.AddOrUpdate(content);
|
||||
}
|
||||
|
||||
uow.Commit();
|
||||
|
||||
foreach (var content in shouldBeSaved)
|
||||
{
|
||||
//Create and Save PreviewXml DTO
|
||||
var xml = content.ToXml();
|
||||
CreateAndSavePreviewXml(xml, content.Id, content.Version, uow.Database);
|
||||
}
|
||||
|
||||
foreach (var content in shouldBePublished)
|
||||
{
|
||||
//Create and Save PreviewXml DTO
|
||||
var xml = content.ToXml();
|
||||
CreateAndSavePreviewXml(xml, content.Id, content.Version, uow.Database);
|
||||
//Create and Save ContentXml DTO
|
||||
CreateAndSaveContentXml(xml, content.Id, uow.Database);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
Saved.RaiseEvent(new SaveEventArgs<IContent>(items, false), this);
|
||||
|
||||
if(shouldBePublished.Any())
|
||||
_publishingStrategy.PublishingFinalized(shouldBePublished, false);
|
||||
|
||||
Audit.Add(AuditTypes.Sort, "Sorting content performed by user", userId, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -1096,9 +1276,11 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
if (!contentTypeIds.Any())
|
||||
{
|
||||
//since we're updating all records, it will be much faster to just clear the table first
|
||||
uow.Database.TruncateTable("cmsContentXml");
|
||||
|
||||
//Remove all Document records from the cmsContentXml table (DO NOT REMOVE Media/Members!)
|
||||
uow.Database.Execute(@"DELETE FROM cmsContentXml WHERE nodeId IN
|
||||
(SELECT DISTINCT cmsContentXml.nodeId FROM cmsContentXml
|
||||
INNER JOIN cmsDocument ON cmsContentXml.nodeId = cmsDocument.nodeId)");
|
||||
|
||||
//get all content items that are published
|
||||
// Consider creating a Path query instead of recursive method:
|
||||
// var query = Query<IContent>.Builder.Where(x => x.Path.StartsWith("-1"));
|
||||
@@ -1268,28 +1450,8 @@ namespace Umbraco.Core.Services
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
//Has this content item previously been published? If so, we don't need to refresh the children
|
||||
var previouslyPublished = HasPublishedVersion(content.Id);
|
||||
var validForPublishing = true;
|
||||
|
||||
//Check if parent is published (although not if its a root node) - if parent isn't published this Content cannot be published
|
||||
if (content.ParentId != -1 && content.ParentId != -20 && IsPublishable(content) == false)
|
||||
{
|
||||
LogHelper.Info<ContentService>(
|
||||
string.Format(
|
||||
"Content '{0}' with Id '{1}' could not be published because its parent is not published.",
|
||||
content.Name, content.Id));
|
||||
validForPublishing = false;
|
||||
}
|
||||
|
||||
//Content contains invalid property values and can therefore not be published - fire event?
|
||||
if (!content.IsValid())
|
||||
{
|
||||
LogHelper.Info<ContentService>(
|
||||
string.Format(
|
||||
"Content '{0}' with Id '{1}' could not be published because of invalid properties.",
|
||||
content.Name, content.Id));
|
||||
validForPublishing = false;
|
||||
}
|
||||
var previouslyPublished = content.HasIdentity && HasPublishedVersion(content.Id);
|
||||
var validForPublishing = CheckAndLogIsPublishable(content) && CheckAndLogIsValid(content);
|
||||
|
||||
//Publish and then update the database with new status
|
||||
bool published = validForPublishing && _publishingStrategy.Publish(content, userId);
|
||||
@@ -1306,37 +1468,12 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var xml = content.ToXml();
|
||||
//Preview Xml
|
||||
var previewPoco = new PreviewXmlDto
|
||||
{
|
||||
NodeId = content.Id,
|
||||
Timestamp = DateTime.Now,
|
||||
VersionId = content.Version,
|
||||
Xml = xml.ToString(SaveOptions.None)
|
||||
};
|
||||
var previewExists =
|
||||
uow.Database.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsPreviewXml WHERE nodeId = @Id AND versionId = @Version",
|
||||
new { Id = content.Id, Version = content.Version }) != 0;
|
||||
int previewResult = previewExists
|
||||
? uow.Database.Update<PreviewXmlDto>(
|
||||
"SET xml = @Xml, timestamp = @Timestamp WHERE nodeId = @Id AND versionId = @Version",
|
||||
new
|
||||
{
|
||||
Xml = previewPoco.Xml,
|
||||
Timestamp = previewPoco.Timestamp,
|
||||
Id = previewPoco.NodeId,
|
||||
Version = previewPoco.VersionId
|
||||
})
|
||||
: Convert.ToInt32(uow.Database.Insert(previewPoco));
|
||||
CreateAndSavePreviewXml(xml, content.Id, content.Version, uow.Database);
|
||||
|
||||
if (published)
|
||||
{
|
||||
//Content Xml
|
||||
var contentPoco = new ContentXmlDto { NodeId = content.Id, Xml = xml.ToString(SaveOptions.None) };
|
||||
var contentExists = uow.Database.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsContentXml WHERE nodeId = @Id", new { Id = content.Id }) != 0;
|
||||
int contentResult = contentExists
|
||||
? uow.Database.Update(contentPoco)
|
||||
: Convert.ToInt32(uow.Database.Insert(contentPoco));
|
||||
|
||||
CreateAndSaveContentXml(xml, content.Id, uow.Database);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,6 +1593,68 @@ namespace Umbraco.Core.Services
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CheckAndLogIsPublishable(IContent content)
|
||||
{
|
||||
//Check if parent is published (although not if its a root node) - if parent isn't published this Content cannot be published
|
||||
if (content.ParentId != -1 && content.ParentId != -20 && IsPublishable(content) == false)
|
||||
{
|
||||
LogHelper.Info<ContentService>(
|
||||
string.Format(
|
||||
"Content '{0}' with Id '{1}' could not be published because its parent is not published.",
|
||||
content.Name, content.Id));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CheckAndLogIsValid(IContent content)
|
||||
{
|
||||
//Content contains invalid property values and can therefore not be published - fire event?
|
||||
if (content.IsValid() == false)
|
||||
{
|
||||
LogHelper.Info<ContentService>(
|
||||
string.Format(
|
||||
"Content '{0}' with Id '{1}' could not be published because of invalid properties.",
|
||||
content.Name, content.Id));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateAndSavePreviewXml(XElement xml, int id, Guid version, UmbracoDatabase db)
|
||||
{
|
||||
var previewPoco = new PreviewXmlDto
|
||||
{
|
||||
NodeId = id,
|
||||
Timestamp = DateTime.Now,
|
||||
VersionId = version,
|
||||
Xml = xml.ToString(SaveOptions.None)
|
||||
};
|
||||
var previewExists =
|
||||
db.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsPreviewXml WHERE nodeId = @Id AND versionId = @Version",
|
||||
new { Id = id, Version = version }) != 0;
|
||||
int previewResult = previewExists
|
||||
? db.Update<PreviewXmlDto>(
|
||||
"SET xml = @Xml, timestamp = @Timestamp WHERE nodeId = @Id AND versionId = @Version",
|
||||
new
|
||||
{
|
||||
Xml = previewPoco.Xml,
|
||||
Timestamp = previewPoco.Timestamp,
|
||||
Id = previewPoco.NodeId,
|
||||
Version = previewPoco.VersionId
|
||||
})
|
||||
: Convert.ToInt32(db.Insert(previewPoco));
|
||||
}
|
||||
|
||||
private void CreateAndSaveContentXml(XElement xml, int id, UmbracoDatabase db)
|
||||
{
|
||||
var contentPoco = new ContentXmlDto { NodeId = id, Xml = xml.ToString(SaveOptions.None) };
|
||||
var contentExists = db.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsContentXml WHERE nodeId = @Id", new { Id = id }) != 0;
|
||||
int contentResult = contentExists ? db.Update(contentPoco) : Convert.ToInt32(db.Insert(contentPoco));
|
||||
}
|
||||
|
||||
private IContentType FindContentTypeByAlias(string contentTypeAlias)
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateContentTypeRepository(_uowProvider.GetUnitOfWork()))
|
||||
@@ -1463,7 +1662,7 @@ namespace Umbraco.Core.Services
|
||||
var query = Query<IContentType>.Builder.Where(x => x.Alias == contentTypeAlias);
|
||||
var types = repository.GetByQuery(query);
|
||||
|
||||
if (!types.Any())
|
||||
if (types.Any() == false)
|
||||
throw new Exception(
|
||||
string.Format("No ContentType matching the passed in Alias: '{0}' was found",
|
||||
contentTypeAlias));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
@@ -12,8 +11,13 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content is based on.
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IContent without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new content objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
@@ -23,8 +27,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content is based on.
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IContent without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new content objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parent">Parent <see cref="IContent"/> object for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
@@ -288,5 +297,49 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="content"><see cref="IContent"/> to check if anscestors are published</param>
|
||||
/// <returns>True if the Content can be published, otherwise False</returns>
|
||||
bool IsPublishable(IContent content);
|
||||
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IContent"/> objects by updating the SortOrder according
|
||||
/// to the ordering of items in the passed in <see cref="IEnumerable{T}"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Using this method will ensure that the Published-state is maintained upon sorting
|
||||
/// so the cache is updated accordingly - as needed.
|
||||
/// </remarks>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Creates and saves an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IContent"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parent">Parent <see cref="IContent"/> object for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the content</param>
|
||||
/// <returns><see cref="IContent"/></returns>
|
||||
IContent CreateContentWithIdentity(string name, IContent parent, string contentTypeAlias, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Creates and saves an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
|
||||
/// that this Content should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IContent"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Content object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Content</param>
|
||||
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the content</param>
|
||||
/// <returns><see cref="IContent"/></returns>
|
||||
IContent CreateContentWithIdentity(string name, int parentId, string contentTypeAlias, int userId = 0);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,13 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media is based on.
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
@@ -22,8 +27,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media is based on.
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
@@ -184,5 +194,45 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="mediaPath">Path of the media item to retreive (for example: /media/1024/koala_403x328.jpg)</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetMediaByPath(string mediaPath);
|
||||
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IMedia"/> objects by updating the SortOrder according
|
||||
/// to the ordering of items in the passed in <see cref="IEnumerable{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0);
|
||||
}
|
||||
}
|
||||
@@ -37,8 +37,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media is based on.
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
@@ -46,25 +51,7 @@ namespace Umbraco.Core.Services
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0)
|
||||
{
|
||||
IMediaType mediaType;
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaTypeRepository(uow))
|
||||
{
|
||||
var query = Query<IMediaType>.Builder.Where(x => x.Alias == mediaTypeAlias);
|
||||
var mediaTypes = repository.GetByQuery(query);
|
||||
|
||||
if (!mediaTypes.Any())
|
||||
throw new Exception(string.Format("No MediaType matching the passed in Alias: '{0}' was found",
|
||||
mediaTypeAlias));
|
||||
|
||||
mediaType = mediaTypes.First();
|
||||
|
||||
if (mediaType == null)
|
||||
throw new Exception(string.Format("MediaType matching the passed in Alias: '{0}' was null",
|
||||
mediaTypeAlias));
|
||||
}
|
||||
|
||||
var mediaType = FindMediaTypeByAlias(mediaTypeAlias);
|
||||
var media = new Models.Media(name, parentId, mediaType);
|
||||
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IMedia>(media, mediaTypeAlias, parentId), this))
|
||||
@@ -84,8 +71,13 @@ namespace Umbraco.Core.Services
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media is based on.
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
@@ -93,25 +85,7 @@ namespace Umbraco.Core.Services
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0)
|
||||
{
|
||||
IMediaType mediaType;
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaTypeRepository(uow))
|
||||
{
|
||||
var query = Query<IMediaType>.Builder.Where(x => x.Alias == mediaTypeAlias);
|
||||
var mediaTypes = repository.GetByQuery(query);
|
||||
|
||||
if (!mediaTypes.Any())
|
||||
throw new Exception(string.Format("No MediaType matching the passed in Alias: '{0}' was found",
|
||||
mediaTypeAlias));
|
||||
|
||||
mediaType = mediaTypes.First();
|
||||
|
||||
if (mediaType == null)
|
||||
throw new Exception(string.Format("MediaType matching the passed in Alias: '{0}' was null",
|
||||
mediaTypeAlias));
|
||||
}
|
||||
|
||||
var mediaType = FindMediaTypeByAlias(mediaTypeAlias);
|
||||
var media = new Models.Media(name, parent, mediaType);
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IMedia>(media, mediaTypeAlias, parent), this))
|
||||
{
|
||||
@@ -128,6 +102,94 @@ namespace Umbraco.Core.Services
|
||||
return media;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0)
|
||||
{
|
||||
var mediaType = FindMediaTypeByAlias(mediaTypeAlias);
|
||||
var media = new Models.Media(name, parentId, mediaType);
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IMedia>(media, mediaTypeAlias, parentId), this))
|
||||
{
|
||||
media.WasCancelled = true;
|
||||
return media;
|
||||
}
|
||||
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaRepository(uow))
|
||||
{
|
||||
media.CreatorId = userId;
|
||||
repository.AddOrUpdate(media);
|
||||
uow.Commit();
|
||||
|
||||
var xml = media.ToXml();
|
||||
CreateAndSaveMediaXml(xml, media.Id, uow.Database);
|
||||
}
|
||||
}
|
||||
|
||||
Created.RaiseEvent(new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parentId), this);
|
||||
|
||||
Audit.Add(AuditTypes.New, "", media.CreatorId, media.Id);
|
||||
|
||||
return media;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0)
|
||||
{
|
||||
var mediaType = FindMediaTypeByAlias(mediaTypeAlias);
|
||||
var media = new Models.Media(name, parent, mediaType);
|
||||
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IMedia>(media, mediaTypeAlias, parent), this))
|
||||
{
|
||||
media.WasCancelled = true;
|
||||
return media;
|
||||
}
|
||||
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaRepository(uow))
|
||||
{
|
||||
media.CreatorId = userId;
|
||||
repository.AddOrUpdate(media);
|
||||
uow.Commit();
|
||||
|
||||
var xml = media.ToXml();
|
||||
CreateAndSaveMediaXml(xml, media.Id, uow.Database);
|
||||
}
|
||||
}
|
||||
|
||||
Created.RaiseEvent(new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parent), this);
|
||||
|
||||
Audit.Add(AuditTypes.New, "", media.CreatorId, media.Id);
|
||||
|
||||
return media;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object by Id
|
||||
/// </summary>
|
||||
@@ -598,18 +660,14 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
var xml = media.ToXml();
|
||||
var poco = new ContentXmlDto {NodeId = media.Id, Xml = xml.ToString(SaveOptions.None)};
|
||||
var exists = uow.Database.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new {Id = media.Id}) != null;
|
||||
int result = exists
|
||||
? uow.Database.Update(poco)
|
||||
: Convert.ToInt32(uow.Database.Insert(poco));
|
||||
CreateAndSaveMediaXml(xml, media.Id, uow.Database);
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
Saved.RaiseEvent(new SaveEventArgs<IMedia>(media, false), this);
|
||||
|
||||
Audit.Add(AuditTypes.Save, "Save Media performed by user", media.CreatorId, media.Id);
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
Saved.RaiseEvent(new SaveEventArgs<IMedia>(media, false), this);
|
||||
|
||||
Audit.Add(AuditTypes.Save, "Save Media performed by user", userId, media.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -626,6 +684,7 @@ namespace Umbraco.Core.Services
|
||||
return;
|
||||
}
|
||||
|
||||
var mediaXml = new Dictionary<int, Lazy<XElement>>();
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaRepository(uow))
|
||||
{
|
||||
@@ -637,6 +696,11 @@ namespace Umbraco.Core.Services
|
||||
|
||||
//commit the whole lot in one go
|
||||
uow.Commit();
|
||||
|
||||
foreach (var media in medias)
|
||||
{
|
||||
CreateAndSaveMediaXml(media.ToXml(), media.Id, uow.Database);
|
||||
}
|
||||
}
|
||||
|
||||
if(raiseEvents)
|
||||
@@ -645,6 +709,67 @@ namespace Umbraco.Core.Services
|
||||
Audit.Add(AuditTypes.Save, "Save Media items performed by user", userId, -1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IMedia"/> objects by updating the SortOrder according
|
||||
/// to the ordering of items in the passed in <see cref="IEnumerable{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
public bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true)
|
||||
{
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IMedia>(items), this))
|
||||
return false;
|
||||
}
|
||||
|
||||
var shouldBeCached = new List<IMedia>();
|
||||
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaRepository(uow))
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var media in items)
|
||||
{
|
||||
//If the current sort order equals that of the media
|
||||
//we don't need to update it, so just increment the sort order
|
||||
//and continue.
|
||||
if (media.SortOrder == i)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
media.SortOrder = i;
|
||||
i++;
|
||||
|
||||
repository.AddOrUpdate(media);
|
||||
shouldBeCached.Add(media);
|
||||
}
|
||||
|
||||
uow.Commit();
|
||||
|
||||
foreach (var content in shouldBeCached)
|
||||
{
|
||||
//Create and Save ContentXml DTO
|
||||
var xml = content.ToXml();
|
||||
CreateAndSaveMediaXml(xml, content.Id, uow.Database);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
Saved.RaiseEvent(new SaveEventArgs<IMedia>(items, false), this);
|
||||
|
||||
Audit.Add(AuditTypes.Sort, "Sorting Media performed by user", userId, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the Path and Level on a collection of <see cref="IMedia"/> objects
|
||||
/// based on the Parent's Path and Level.
|
||||
@@ -671,6 +796,35 @@ namespace Umbraco.Core.Services
|
||||
return list;
|
||||
}
|
||||
|
||||
private void CreateAndSaveMediaXml(XElement xml, int id, UmbracoDatabase db)
|
||||
{
|
||||
var poco = new ContentXmlDto { NodeId = id, Xml = xml.ToString(SaveOptions.None) };
|
||||
var exists = db.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new { Id = id }) != null;
|
||||
int result = exists ? db.Update(poco) : Convert.ToInt32(db.Insert(poco));
|
||||
}
|
||||
|
||||
private IMediaType FindMediaTypeByAlias(string mediaTypeAlias)
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaTypeRepository(uow))
|
||||
{
|
||||
var query = Query<IMediaType>.Builder.Where(x => x.Alias == mediaTypeAlias);
|
||||
var mediaTypes = repository.GetByQuery(query);
|
||||
|
||||
if (mediaTypes.Any() == false)
|
||||
throw new Exception(string.Format("No MediaType matching the passed in Alias: '{0}' was found",
|
||||
mediaTypeAlias));
|
||||
|
||||
var mediaType = mediaTypes.First();
|
||||
|
||||
if (mediaType == null)
|
||||
throw new Exception(string.Format("MediaType matching the passed in Alias: '{0}' was null",
|
||||
mediaTypeAlias));
|
||||
|
||||
return mediaType;
|
||||
}
|
||||
}
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -321,9 +321,10 @@ namespace Umbraco.Core.Services
|
||||
foreach (var templateElement in allowedTemplatesElement.Elements("Template"))
|
||||
{
|
||||
var alias = templateElement.Value;
|
||||
var template = _fileService.GetTemplate(alias);
|
||||
var template = _fileService.GetTemplate(alias.ToSafeAlias());
|
||||
if (template != null)
|
||||
{
|
||||
if(allowedTemplates.Any(x => x.Id == template.Id)) continue;
|
||||
allowedTemplates.Add(template);
|
||||
}
|
||||
else
|
||||
@@ -340,7 +341,7 @@ namespace Umbraco.Core.Services
|
||||
|
||||
if (string.IsNullOrEmpty(defaultTemplateElement.Value) == false)
|
||||
{
|
||||
var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value);
|
||||
var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value.ToSafeAlias());
|
||||
if (defaultTemplate != null)
|
||||
{
|
||||
contentType.SetDefaultTemplate(defaultTemplate);
|
||||
|
||||
@@ -870,5 +870,34 @@ namespace Umbraco.Core
|
||||
|
||||
return alias;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An extension method that returns a new string in which all occurrences of a
|
||||
/// specified string in the current instance are replaced with another specified string.
|
||||
/// StringComparison specifies the type of search to use for the specified string.
|
||||
/// </summary>
|
||||
/// <param name="source">Current instance of the string</param>
|
||||
/// <param name="oldString">Specified string to replace</param>
|
||||
/// <param name="newString">Specified string to inject</param>
|
||||
/// <param name="stringComparison">String Comparison object to specify search type</param>
|
||||
/// <returns>Updated string</returns>
|
||||
public static string Replace(this string source, string oldString, string newString, StringComparison stringComparison)
|
||||
{
|
||||
var index = source.IndexOf(oldString, stringComparison);
|
||||
|
||||
// Determine if we found a match
|
||||
var matchFound = index >= 0;
|
||||
|
||||
if (matchFound)
|
||||
{
|
||||
// Remove the old text
|
||||
source = source.Remove(index, oldString.Length);
|
||||
|
||||
// Add the replacemenet text
|
||||
source = source.Insert(index, newString);
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+179
-65
@@ -19,8 +19,6 @@ using Umbraco.Core.IO;
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
|
||||
//TODO: Get the App_Code stuff in here from the old one
|
||||
|
||||
/// <summary>
|
||||
/// A utility class to find all classes of a certain type by reflection in the current bin folder
|
||||
/// of the web application.
|
||||
@@ -143,7 +141,8 @@ namespace Umbraco.Core
|
||||
{
|
||||
try
|
||||
{
|
||||
var foundAssembly = safeDomainAssemblies.FirstOrDefault(a => a.GetAssemblyFile() == assemblyName.GetAssemblyFile());
|
||||
var foundAssembly =
|
||||
safeDomainAssemblies.FirstOrDefault(a => a.GetAssemblyFile() == assemblyName.GetAssemblyFile());
|
||||
if (foundAssembly != null)
|
||||
{
|
||||
binFolderAssemblies.Add(foundAssembly);
|
||||
@@ -236,7 +235,7 @@ namespace Umbraco.Core
|
||||
"umbraco.interfaces,",
|
||||
"umbraco.providers,",
|
||||
"Umbraco.Web.UI,",
|
||||
"umbraco.webservices",
|
||||
"umbraco.webservices",
|
||||
"Lucene.",
|
||||
"Examine,",
|
||||
"Examine.",
|
||||
@@ -248,36 +247,66 @@ namespace Umbraco.Core
|
||||
"CookComputing."
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Finds any classes derived from the type T that contain the attribute TAttribute
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TAttribute"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>()
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
return FindClassesOfTypeWithAttribute<T, TAttribute>(GetAssembliesWithKnownExclusions(), true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds any classes derived from the type T that contain the attribute TAttribute
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TAttribute"></typeparam>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>(IEnumerable<Assembly> assemblies)
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
return FindClassesOfTypeWithAttribute<T, TAttribute>(assemblies, true);
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>(IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
where TAttribute : Attribute
|
||||
/// <summary>
|
||||
/// Finds any classes derived from the type T that contain the attribute TAttribute
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TAttribute"></typeparam>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <param name="onlyConcreteClasses"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>(
|
||||
IEnumerable<Assembly> assemblies,
|
||||
bool onlyConcreteClasses)
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
return FindClassesOfTypeWithAttribute<TAttribute>(typeof (T), assemblies, onlyConcreteClasses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds any classes derived from the assignTypeFrom Type that contain the attribute TAttribute
|
||||
/// </summary>
|
||||
/// <typeparam name="TAttribute"></typeparam>
|
||||
/// <param name="assignTypeFrom"></param>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <param name="onlyConcreteClasses"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<TAttribute>(
|
||||
Type assignTypeFrom,
|
||||
IEnumerable<Assembly> assemblies,
|
||||
bool onlyConcreteClasses)
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
|
||||
var l = new List<Type>();
|
||||
foreach(var a in assemblies)
|
||||
{
|
||||
var types = from t in GetTypesWithFormattedException(a)
|
||||
where !t.IsInterface
|
||||
&& typeof (T).IsAssignableFrom(t)
|
||||
&& t.GetCustomAttributes<TAttribute>(false).Any()
|
||||
&& (!onlyConcreteClasses || (t.IsClass && !t.IsAbstract))
|
||||
select t;
|
||||
l.AddRange(types);
|
||||
}
|
||||
|
||||
return l;
|
||||
|
||||
return GetClasses(assignTypeFrom, assemblies, onlyConcreteClasses,
|
||||
//the additional filter will ensure that any found types also have the attribute applied.
|
||||
t => t.GetCustomAttributes<TAttribute>(false).Any());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -301,7 +330,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
|
||||
return GetAssignablesFromType<T>(assemblies, onlyConcreteClasses);
|
||||
return GetClasses(typeof(T), assemblies, onlyConcreteClasses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -328,32 +357,50 @@ namespace Umbraco.Core
|
||||
return FindClassesWithAttribute(typeof(T), assemblies, onlyConcreteClasses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the classes with attribute.
|
||||
/// </summary>
|
||||
/// <param name="type">The attribute type </param>
|
||||
/// <param name="assemblies">The assemblies.</param>
|
||||
/// <param name="onlyConcreteClasses">if set to <c>true</c> only concrete classes.</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesWithAttribute(Type type, IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
if (!TypeHelper.IsTypeAssignableFrom<Attribute>(type))
|
||||
throw new ArgumentException("The type specified: " + type + " is not an Attribute type");
|
||||
/// <summary>
|
||||
/// Finds any classes with the attribute.
|
||||
/// </summary>
|
||||
/// <param name="attributeType">The attribute type </param>
|
||||
/// <param name="assemblies">The assemblies.</param>
|
||||
/// <param name="onlyConcreteClasses">if set to <c>true</c> only concrete classes.</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesWithAttribute(
|
||||
Type attributeType,
|
||||
IEnumerable<Assembly> assemblies,
|
||||
bool onlyConcreteClasses)
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
|
||||
var l = new List<Type>();
|
||||
foreach (var a in assemblies)
|
||||
{
|
||||
var types = from t in GetTypesWithFormattedException(a)
|
||||
where !t.IsInterface && t.GetCustomAttributes(type, false).Any() && (!onlyConcreteClasses || (t.IsClass && !t.IsAbstract))
|
||||
select t;
|
||||
l.AddRange(types);
|
||||
}
|
||||
if (TypeHelper.IsTypeAssignableFrom<Attribute>(attributeType) == false)
|
||||
throw new ArgumentException("The type specified: " + attributeType + " is not an Attribute type");
|
||||
|
||||
return l;
|
||||
}
|
||||
var foundAssignableTypes = new List<Type>();
|
||||
|
||||
/// <summary>
|
||||
var assemblyList = assemblies.ToArray();
|
||||
|
||||
//find all assembly references that are referencing the attribute type's assembly since we
|
||||
//should only be scanning those assemblies because any other assembly will definitely not
|
||||
//contain a class that has this attribute.
|
||||
var referencedAssemblies = TypeHelper.GetReferencedAssemblies(attributeType, assemblyList);
|
||||
|
||||
foreach (var a in referencedAssemblies)
|
||||
{
|
||||
//get all types in the assembly that are sub types of the current type
|
||||
var allTypes = GetTypesWithFormattedException(a).ToArray();
|
||||
|
||||
var types = allTypes.Where(t => TypeHelper.IsNonStaticClass(t)
|
||||
&& (onlyConcreteClasses == false || t.IsAbstract == false)
|
||||
//the type must have this attribute
|
||||
&& t.GetCustomAttributes(attributeType, false).Any());
|
||||
|
||||
foundAssignableTypes.AddRange(types);
|
||||
}
|
||||
|
||||
return foundAssignableTypes;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds the classes with attribute.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
@@ -379,29 +426,96 @@ namespace Umbraco.Core
|
||||
|
||||
#region Private methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of assignables of type T from a collection of assemblies
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <param name="onlyConcreteClasses"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<Type> GetAssignablesFromType<T>(IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
/// <summary>
|
||||
/// Finds types that are assignable from the assignTypeFrom parameter and will scan for these types in the assembly
|
||||
/// list passed in, however we will only scan assemblies that have a reference to the assignTypeFrom Type or any type
|
||||
/// deriving from the base type.
|
||||
/// </summary>
|
||||
/// <param name="assignTypeFrom"></param>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <param name="onlyConcreteClasses"></param>
|
||||
/// <param name="additionalFilter">An additional filter to apply for what types will actually be included in the return value</param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<Type> GetClasses(
|
||||
Type assignTypeFrom,
|
||||
IEnumerable<Assembly> assemblies,
|
||||
bool onlyConcreteClasses,
|
||||
Func<Type, bool> additionalFilter = null)
|
||||
{
|
||||
return GetTypes(typeof(T), assemblies, onlyConcreteClasses);
|
||||
}
|
||||
//the default filter will always return true.
|
||||
if (additionalFilter == null)
|
||||
{
|
||||
additionalFilter = type => true;
|
||||
}
|
||||
|
||||
var foundAssignableTypes = new List<Type>();
|
||||
|
||||
var assemblyList = assemblies.ToArray();
|
||||
|
||||
//find all assembly references that are referencing the current type's assembly since we
|
||||
//should only be scanning those assemblies because any other assembly will definitely not
|
||||
//contain sub type's of the one we're currently looking for
|
||||
var referencedAssemblies = TypeHelper.GetReferencedAssemblies(assignTypeFrom, assemblyList);
|
||||
|
||||
//get a list of non-referenced assemblies (we'll use this when we recurse below)
|
||||
var otherAssemblies = assemblyList.Where(x => referencedAssemblies.Contains(x) == false).ToArray();
|
||||
|
||||
//loop through the referenced assemblies
|
||||
foreach (var a in referencedAssemblies)
|
||||
{
|
||||
//get all types in the assembly that are sub types of the current type
|
||||
var allSubTypes = GetTypesWithFormattedException(a)
|
||||
.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)
|
||||
&& (onlyConcreteClasses == false || t.IsAbstract == false)
|
||||
&& additionalFilter(t)))
|
||||
.ToArray();
|
||||
|
||||
//add the types to our list to return
|
||||
foundAssignableTypes.AddRange(filteredTypes);
|
||||
|
||||
//now we need to include types that may be inheriting from sub classes of the type being searched for
|
||||
//so we will search in assemblies that reference those types too.
|
||||
foreach (var subTypesInAssembly in allSubTypes.GroupBy(x => x.Assembly))
|
||||
{
|
||||
|
||||
//So that we are not scanning too much, we need to group the sub types:
|
||||
// * if there is more than 1 sub type in the same assembly then we should only search on the 'lowest base' type.
|
||||
// * We should also not search for sub types if the type is sealed since you cannot inherit from a sealed class
|
||||
// * We should not search for sub types if the type is static since you cannot inherit from them.
|
||||
var subTypeList = subTypesInAssembly
|
||||
.Where(t => t.IsSealed == false && TypeHelper.IsStaticClass(t) == false)
|
||||
.ToArray();
|
||||
|
||||
var baseClassAttempt = TypeHelper.GetLowestBaseType(subTypeList);
|
||||
|
||||
//if there's a base class amongst the types then we'll only search for that type.
|
||||
//otherwise we'll have to search for all of them.
|
||||
var subTypesToSearch = new List<Type>();
|
||||
if (baseClassAttempt.Success)
|
||||
{
|
||||
subTypesToSearch.Add(baseClassAttempt.Result);
|
||||
}
|
||||
else
|
||||
{
|
||||
subTypesToSearch.AddRange(subTypeList);
|
||||
}
|
||||
|
||||
foreach (var typeToSearch in subTypesToSearch)
|
||||
{
|
||||
//recursively find the types inheriting from this sub type in the other non-scanned assemblies.
|
||||
var foundTypes = GetClasses(typeToSearch, otherAssemblies, onlyConcreteClasses, additionalFilter);
|
||||
foundAssignableTypes.AddRange(foundTypes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypes(Type assignTypeFrom, IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
{
|
||||
var l = new List<Type>();
|
||||
foreach (var a in assemblies)
|
||||
{
|
||||
var types = from t in GetTypesWithFormattedException(a)
|
||||
where !t.IsInterface && assignTypeFrom.IsAssignableFrom(t) && (!onlyConcreteClasses || (t.IsClass && !t.IsAbstract))
|
||||
select t;
|
||||
l.AddRange(types);
|
||||
}
|
||||
return l;
|
||||
return foundAssignableTypes;
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypesWithFormattedException(Assembly a)
|
||||
@@ -420,7 +534,7 @@ namespace Umbraco.Core
|
||||
sb.AppendLine("Could not load types from assembly " + a.FullName + ", errors:");
|
||||
foreach (var loaderException in ex.LoaderExceptions.WhereNotNull())
|
||||
{
|
||||
sb.AppendLine("Exception: " + loaderException.ToString());
|
||||
sb.AppendLine("Exception: " + loaderException);
|
||||
}
|
||||
throw new ReflectionTypeLoadException(ex.Types, ex.LoaderExceptions, sb.ToString());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -11,12 +12,113 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
internal static class TypeHelper
|
||||
{
|
||||
private static readonly ConcurrentDictionary<Tuple<Type, Type>, bool> TypeCheckCache = new ConcurrentDictionary<Tuple<Type, Type>, bool>();
|
||||
private static readonly ConcurrentDictionary<Type, bool> ValueTypeCache = new ConcurrentDictionary<Type, bool>();
|
||||
private static readonly ConcurrentDictionary<Type, bool> ImplicitValueTypeCache = new ConcurrentDictionary<Type, bool>();
|
||||
|
||||
private static readonly ConcurrentDictionary<Type, FieldInfo[]> GetFieldsCache = new ConcurrentDictionary<Type, FieldInfo[]>();
|
||||
private static readonly ConcurrentDictionary<Tuple<Type, bool, bool, bool>, PropertyInfo[]> GetPropertiesCache = new ConcurrentDictionary<Tuple<Type, bool, bool, bool>, PropertyInfo[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Find all assembly references that are referencing the assignTypeFrom Type's assembly found in the assemblyList
|
||||
/// </summary>
|
||||
/// <param name="assignTypeFrom"></param>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// If the assembly of the assignTypeFrom Type is in the App_Code assembly, then we return nothing since things cannot
|
||||
/// reference that assembly, same with the global.asax assembly.
|
||||
/// </remarks>
|
||||
public static Assembly[] GetReferencedAssemblies(Type assignTypeFrom, IEnumerable<Assembly> assemblies)
|
||||
{
|
||||
//check if it is the app_code assembly.
|
||||
//check if it is App_global.asax assembly
|
||||
if (assignTypeFrom.Assembly.IsAppCodeAssembly() || assignTypeFrom.Assembly.IsGlobalAsaxAssembly())
|
||||
{
|
||||
return Enumerable.Empty<Assembly>().ToArray();
|
||||
}
|
||||
|
||||
//find all assembly references that are referencing the current type's assembly since we
|
||||
//should only be scanning those assemblies because any other assembly will definitely not
|
||||
//contain sub type's of the one we're currently looking for
|
||||
return assemblies
|
||||
.Where(assembly =>
|
||||
assembly == assignTypeFrom.Assembly || HasReferenceToAssemblyWithName(assembly, assignTypeFrom.Assembly.GetName().Name))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// checks if the assembly has a reference with the same name as the expected assembly name.
|
||||
/// </summary>
|
||||
/// <param name="assembly"></param>
|
||||
/// <param name="expectedAssemblyName"></param>
|
||||
/// <returns></returns>
|
||||
private static bool HasReferenceToAssemblyWithName(Assembly assembly, string expectedAssemblyName)
|
||||
{
|
||||
return assembly
|
||||
.GetReferencedAssemblies()
|
||||
.Select(a => a.Name)
|
||||
.Contains(expectedAssemblyName, StringComparer.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the type is a class and is not static
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsNonStaticClass(Type t)
|
||||
{
|
||||
return t.IsClass && IsStaticClass(t) == false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the type is a static class
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// In IL a static class is abstract and sealed
|
||||
/// see: http://stackoverflow.com/questions/1175888/determine-if-a-type-is-static
|
||||
/// </remarks>
|
||||
public static bool IsStaticClass(Type type)
|
||||
{
|
||||
return type.IsAbstract && type.IsSealed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a lowest base class amongst a collection of types
|
||||
/// </summary>
|
||||
/// <param name="types"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// The term 'lowest' refers to the most base class of the type collection.
|
||||
/// If a base type is not found amongst the type collection then an invalid attempt is returned.
|
||||
/// </remarks>
|
||||
public static Attempt<Type> GetLowestBaseType(params Type[] types)
|
||||
{
|
||||
if (types.Length == 0)
|
||||
{
|
||||
return Attempt<Type>.False;
|
||||
}
|
||||
if (types.Length == 1)
|
||||
{
|
||||
return new Attempt<Type>(true, types[0]);
|
||||
}
|
||||
|
||||
foreach (var curr in types)
|
||||
{
|
||||
var others = types.Except(new[] {curr});
|
||||
|
||||
//is the curr type a common denominator for all others ?
|
||||
var isBase = others.All(curr.IsAssignableFrom);
|
||||
|
||||
//if this type is the base for all others
|
||||
if (isBase)
|
||||
{
|
||||
return new Attempt<Type>(true, curr);
|
||||
}
|
||||
}
|
||||
|
||||
return Attempt<Type>.False;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the type <paramref name="implementation"/> is assignable from the specified implementation <typeparamref name="TContract"/>,
|
||||
/// and caches the result across the application using a <see cref="ConcurrentDictionary{TKey,TValue}"/>.
|
||||
@@ -28,8 +130,7 @@ namespace Umbraco.Core
|
||||
/// </returns>
|
||||
public static bool IsTypeAssignableFrom(Type contract, Type implementation)
|
||||
{
|
||||
// NOTE The use of a Tuple<,> here is because its Equals / GetHashCode implementation is literally 10.5x faster than KeyValuePair<,>
|
||||
return TypeCheckCache.GetOrAdd(new Tuple<Type, Type>(contract, implementation), x => x.Item1.IsAssignableFrom(x.Item2));
|
||||
return contract.IsAssignableFrom(implementation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,7 +150,7 @@ namespace Umbraco.Core
|
||||
/// <param name="implementation">The implementation.</param>
|
||||
public static bool IsValueType(Type implementation)
|
||||
{
|
||||
return ValueTypeCache.GetOrAdd(implementation, x => x.IsValueType || x.IsPrimitive);
|
||||
return implementation.IsValueType || implementation.IsPrimitive;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,7 +159,7 @@ namespace Umbraco.Core
|
||||
/// <param name="implementation">The implementation.</param>
|
||||
public static bool IsImplicitValueType(Type implementation)
|
||||
{
|
||||
return ImplicitValueTypeCache.GetOrAdd(implementation, x => IsValueType(implementation) || implementation.IsEnum || implementation == typeof(string));
|
||||
return IsValueType(implementation) || implementation.IsEnum || implementation == typeof (string);
|
||||
}
|
||||
|
||||
public static bool IsTypeAssignableFrom<TContract>(object implementation)
|
||||
|
||||
@@ -675,7 +675,7 @@
|
||||
<Compile Include="IfExtensions.cs" />
|
||||
<Compile Include="PluginManager.cs" />
|
||||
<Compile Include="IO\FileSecurityException.cs" />
|
||||
<Compile Include="IO\FileSystemProvider.cs" />
|
||||
<Compile Include="IO\FileSystemProviderConstants.cs" />
|
||||
<Compile Include="IO\FileSystemProviderManager.cs" />
|
||||
<Compile Include="IO\IFileSystem.cs" />
|
||||
<Compile Include="IO\IOHelper.cs" />
|
||||
@@ -696,7 +696,6 @@
|
||||
<Compile Include="Xml\DynamicContext.cs" />
|
||||
<Compile Include="Xml\XmlNamespaces.cs" />
|
||||
<Compile Include="Xml\XmlNodeListFactory.cs" />
|
||||
<Compile Include="Xml\XmlNodeExtensions.cs" />
|
||||
<Compile Include="Xml\XPathVariable.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Mvc;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core
|
||||
@@ -27,6 +28,9 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
internal void StartApplication(object sender, EventArgs e)
|
||||
{
|
||||
//don't output the MVC version header (security)
|
||||
MvcHandler.DisableMvcResponseHeader = true;
|
||||
|
||||
//boot up the application
|
||||
GetBootManager()
|
||||
.Initialize()
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
// source: mvpxml.codeplex.com
|
||||
|
||||
namespace Umbraco.Core.Xml
|
||||
{
|
||||
internal static class XmlNodeExtensions
|
||||
{
|
||||
static XPathNodeIterator Select(string expression, XPathNavigator source, params XPathVariable[] variables)
|
||||
{
|
||||
var expr = source.Compile(expression);
|
||||
var context = new DynamicContext();
|
||||
foreach (var variable in variables)
|
||||
context.AddVariable(variable.Name, variable.Value);
|
||||
expr.SetContext(context);
|
||||
return source.Select(expr);
|
||||
}
|
||||
|
||||
public static XmlNodeList SelectNodes(this XmlNode source, string expression, IEnumerable<XPathVariable> variables)
|
||||
{
|
||||
var av = variables == null ? null : variables.ToArray();
|
||||
return SelectNodes(source, expression, av);
|
||||
}
|
||||
|
||||
public static XmlNodeList SelectNodes(this XmlNode source, string expression, params XPathVariable[] variables)
|
||||
{
|
||||
if (variables == null || variables.Length == 0 || variables[0] == null)
|
||||
return source.SelectNodes(expression);
|
||||
|
||||
var iterator = Select(expression, source.CreateNavigator(), variables);
|
||||
return XmlNodeListFactory.CreateNodeList(iterator);
|
||||
}
|
||||
|
||||
public static XmlNode SelectSingleNode(this XmlNode source, string expression, IEnumerable<XPathVariable> variables)
|
||||
{
|
||||
var av = variables == null ? null : variables.ToArray();
|
||||
return SelectSingleNode(source, expression, av);
|
||||
}
|
||||
|
||||
public static XmlNode SelectSingleNode(this XmlNode source, string expression, params XPathVariable[] variables)
|
||||
{
|
||||
if (variables == null || variables.Length == 0 || variables[0] == null)
|
||||
return source.SelectSingleNode(expression);
|
||||
|
||||
return SelectNodes(source, expression, variables).Cast<XmlNode>().FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Umbraco.Core.Xml;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -9,6 +13,45 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
internal static class XmlExtensions
|
||||
{
|
||||
static XPathNodeIterator Select(string expression, XPathNavigator source, params XPathVariable[] variables)
|
||||
{
|
||||
var expr = source.Compile(expression);
|
||||
var context = new DynamicContext();
|
||||
foreach (var variable in variables)
|
||||
context.AddVariable(variable.Name, variable.Value);
|
||||
expr.SetContext(context);
|
||||
return source.Select(expr);
|
||||
}
|
||||
|
||||
public static XmlNodeList SelectNodes(this XmlNode source, string expression, IEnumerable<XPathVariable> variables)
|
||||
{
|
||||
var av = variables == null ? null : variables.ToArray();
|
||||
return SelectNodes(source, expression, av);
|
||||
}
|
||||
|
||||
public static XmlNodeList SelectNodes(this XmlNode source, string expression, params XPathVariable[] variables)
|
||||
{
|
||||
if (variables == null || variables.Length == 0 || variables[0] == null)
|
||||
return source.SelectNodes(expression);
|
||||
|
||||
var iterator = Select(expression, source.CreateNavigator(), variables);
|
||||
return XmlNodeListFactory.CreateNodeList(iterator);
|
||||
}
|
||||
|
||||
public static XmlNode SelectSingleNode(this XmlNode source, string expression, IEnumerable<XPathVariable> variables)
|
||||
{
|
||||
var av = variables == null ? null : variables.ToArray();
|
||||
return SelectSingleNode(source, expression, av);
|
||||
}
|
||||
|
||||
public static XmlNode SelectSingleNode(this XmlNode source, string expression, params XPathVariable[] variables)
|
||||
{
|
||||
if (variables == null || variables.Length == 0 || variables[0] == null)
|
||||
return source.SelectSingleNode(expression);
|
||||
|
||||
return SelectNodes(source, expression, variables).Cast<XmlNode>().FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from an XDocument to an XmlDocument
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,72 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public class XmlHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a specified string contains only xml whitespace characters.
|
||||
/// </summary>
|
||||
/// <param name="s">The string.</param>
|
||||
/// <returns><c>true</c> if the string contains only xml whitespace characters.</returns>
|
||||
/// <remarks>As per XML 1.1 specs, space, \t, \r and \n.</remarks>
|
||||
public static bool IsXmlWhitespace(string s)
|
||||
{
|
||||
// as per xml 1.1 specs - anything else is significant whitespace
|
||||
s = s.Trim(' ', '\t', '\r', '\n');
|
||||
return s.Length == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <c>XPathDocument</c> from an xml string.
|
||||
/// </summary>
|
||||
/// <param name="xml">The xml string.</param>
|
||||
/// <returns>An <c>XPathDocument</c> created from the xml string.</returns>
|
||||
public static XPathDocument CreateXPathDocument(string xml)
|
||||
{
|
||||
return new XPathDocument(new XmlTextReader(new StringReader(xml)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to create a new <c>XPathDocument</c> from an xml string.
|
||||
/// </summary>
|
||||
/// <param name="xml">The xml string.</param>
|
||||
/// <param name="doc">The XPath document.</param>
|
||||
/// <returns>A value indicating whether it has been possible to create the document.</returns>
|
||||
public static bool TryCreateXPathDocument(string xml, out XPathDocument doc)
|
||||
{
|
||||
try
|
||||
{
|
||||
doc = new XPathDocument(new XmlTextReader(new StringReader(xml)));
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
doc = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to create a new <c>XPathDocument</c> from a property value.
|
||||
/// </summary>
|
||||
/// <param name="alias">The alias of the property.</param>
|
||||
/// <param name="value">The value of the property.</param>
|
||||
/// <param name="doc">The XPath document.</param>
|
||||
/// <returns>A value indicating whether it has been possible to create the document.</returns>
|
||||
public static bool TryCreateXPathDocumentFromPropertyValue(string alias, object value, out XPathDocument doc)
|
||||
{
|
||||
// In addition, DynamicNode strips dashes in elements or attributes
|
||||
// names but really, this is ugly enough, and using dashes should be
|
||||
// illegal in content type or property aliases anyway.
|
||||
|
||||
doc = null;
|
||||
var xml = value as string;
|
||||
if (xml == null) return false;
|
||||
xml = xml.Trim();
|
||||
if (xml.StartsWith("<") == false || xml.EndsWith(">") == false || xml.Contains('/') == false) return false;
|
||||
if (UmbracoSettings.NotDynamicXmlDocumentElements.Any(x => x.InvariantEquals(alias))) return false;
|
||||
return TryCreateXPathDocument(xml, out doc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the children of the parentNode that match the xpath selector
|
||||
/// </summary>
|
||||
/// <param name="parentNode"></param>
|
||||
@@ -72,7 +137,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static string StripDashesInElementOrAttributeNames(string xml)
|
||||
{
|
||||
using (var outputms = new MemoryStream())
|
||||
@@ -126,6 +191,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Imports a XML node from text.
|
||||
/// </summary>
|
||||
@@ -222,11 +288,11 @@ namespace Umbraco.Core
|
||||
/// </returns>
|
||||
public static bool CouldItBeXml(string xml)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(xml))
|
||||
if (string.IsNullOrEmpty(xml) == false)
|
||||
{
|
||||
xml = xml.Trim();
|
||||
|
||||
if (xml.StartsWith("<") && xml.EndsWith(">"))
|
||||
if (xml.StartsWith("<") && xml.EndsWith(">") && xml.Contains("/"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Xml;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Routing;
|
||||
@@ -11,7 +12,7 @@ using umbraco.BusinessLogic;
|
||||
namespace Umbraco.Tests.ContentStores
|
||||
{
|
||||
[TestFixture]
|
||||
public class PublishContentStoreTests
|
||||
public class PublishContentStoreTests
|
||||
{
|
||||
private FakeHttpContextFactory _httpContextFactory;
|
||||
private UmbracoContext _umbracoContext;
|
||||
@@ -74,6 +75,8 @@ namespace Umbraco.Tests.ContentStores
|
||||
_umbracoContext = new UmbracoContext(_httpContextFactory.HttpContext,
|
||||
new ApplicationContext(),
|
||||
new DefaultRoutesCache(false));
|
||||
|
||||
UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
|
||||
_umbracoContext.GetXmlDelegate = () =>
|
||||
{
|
||||
|
||||
@@ -7,16 +7,34 @@ using umbraco.BusinessLogic;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class EnumerableExtensionsTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Flatten_List()
|
||||
{
|
||||
var hierarchy = new TestItem()
|
||||
{
|
||||
Children = new List<TestItem>()
|
||||
[Test]
|
||||
public void Flatten_List_2()
|
||||
{
|
||||
var hierarchy = new TestItem()
|
||||
{
|
||||
Children = new List<TestItem>()
|
||||
{
|
||||
new TestItem(),
|
||||
new TestItem(),
|
||||
new TestItem()
|
||||
}
|
||||
};
|
||||
|
||||
var flattened = hierarchy.Children.FlattenList(x => x.Children);
|
||||
|
||||
Assert.AreEqual(3, flattened.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Flatten_List()
|
||||
{
|
||||
var hierarchy = new TestItem()
|
||||
{
|
||||
Children = new List<TestItem>()
|
||||
{
|
||||
new TestItem()
|
||||
{
|
||||
@@ -65,12 +83,12 @@ namespace Umbraco.Tests
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var flattened = hierarchy.Children.FlattenList(x => x.Children);
|
||||
var flattened = hierarchy.Children.FlattenList(x => x.Children);
|
||||
|
||||
Assert.AreEqual(10, flattened.Count());
|
||||
}
|
||||
}
|
||||
|
||||
private class TestItem
|
||||
{
|
||||
@@ -78,7 +96,7 @@ namespace Umbraco.Tests
|
||||
{
|
||||
Children = Enumerable.Empty<TestItem>();
|
||||
}
|
||||
public IEnumerable<TestItem> Children { get; set; }
|
||||
public IEnumerable<TestItem> Children { get; set; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void Can_Get_Base_File_System()
|
||||
{
|
||||
var fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
|
||||
var fs = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider(FileSystemProviderConstants.Media);
|
||||
|
||||
Assert.NotNull(fs);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace Umbraco.Tests
|
||||
public void Resolves_DataTypes()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveDataTypes();
|
||||
Assert.AreEqual(37, types.Count());
|
||||
Assert.AreEqual(38, types.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -317,7 +317,7 @@ namespace Umbraco.Tests
|
||||
public void Resolves_RestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRestExtensions();
|
||||
Assert.AreEqual(2, types.Count());
|
||||
Assert.AreEqual(3, types.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
if (propertyAlias.InvariantEquals("content"))
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
|
||||
@@ -222,6 +222,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var propVal2 = doc.GetPropertyValue<IHtmlString>("content");
|
||||
Assert.IsTrue(TypeHelper.IsTypeAssignableFrom<IHtmlString>(propVal2.GetType()));
|
||||
Assert.AreEqual("<div>This is some content</div>", propVal2.ToString());
|
||||
|
||||
var propVal3 = doc.GetPropertyValue("Content");
|
||||
Assert.IsTrue(TypeHelper.IsTypeAssignableFrom<IHtmlString>(propVal3.GetType()));
|
||||
Assert.AreEqual("<div>This is some content</div>", propVal3.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
@@ -218,6 +219,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerDisplay("Content Id: {Id}, Name: {Name}")]
|
||||
public class PublishedContentWrapper : IPublishedContent, IOwnerCollectionAware<IPublishedContent>
|
||||
{
|
||||
protected IPublishedContent WrappedContent { get; private set; }
|
||||
|
||||
@@ -68,7 +68,141 @@ namespace Umbraco.Tests.Services
|
||||
Assert.That(ctHomePage.HasIdentity, Is.True);
|
||||
Assert.That(homeDoc.HasIdentity, Is.True);
|
||||
Assert.That(homeDoc.ContentTypeId, Is.EqualTo(ctHomePage.Id));
|
||||
Assert.That(addedContentType, Is.True);
|
||||
Assert.That(addedContentType, Is.False);//False because its already added via the ContentType ctor
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Remove_ContentType_Composition_From_ContentType()
|
||||
{
|
||||
//Test for U4-2234
|
||||
var cts = ServiceContext.ContentTypeService;
|
||||
//Arrange
|
||||
var component = CreateComponent();
|
||||
cts.Save(component);
|
||||
var banner = CreateBannerComponent(component);
|
||||
cts.Save(banner);
|
||||
var site = CreateSite();
|
||||
cts.Save(site);
|
||||
var homepage = CreateHomepage(site);
|
||||
cts.Save(homepage);
|
||||
|
||||
//Add banner to homepage
|
||||
var added = homepage.AddContentType(banner);
|
||||
cts.Save(homepage);
|
||||
|
||||
//Assert composition
|
||||
var bannerExists = homepage.ContentTypeCompositionExists(banner.Alias);
|
||||
var bannerPropertyExists = homepage.CompositionPropertyTypes.Any(x => x.Alias.Equals("bannerName"));
|
||||
Assert.That(added, Is.True);
|
||||
Assert.That(bannerExists, Is.True);
|
||||
Assert.That(bannerPropertyExists, Is.True);
|
||||
Assert.That(homepage.CompositionPropertyTypes.Count(), Is.EqualTo(6));
|
||||
|
||||
//Remove banner from homepage
|
||||
var removed = homepage.RemoveContentType(banner.Alias);
|
||||
cts.Save(homepage);
|
||||
|
||||
//Assert composition
|
||||
var bannerStillExists = homepage.ContentTypeCompositionExists(banner.Alias);
|
||||
var bannerPropertyStillExists = homepage.CompositionPropertyTypes.Any(x => x.Alias.Equals("bannerName"));
|
||||
Assert.That(removed, Is.True);
|
||||
Assert.That(bannerStillExists, Is.False);
|
||||
Assert.That(bannerPropertyStillExists, Is.False);
|
||||
Assert.That(homepage.CompositionPropertyTypes.Count(), Is.EqualTo(4));
|
||||
}
|
||||
|
||||
private ContentType CreateComponent()
|
||||
{
|
||||
var component = new ContentType(-1)
|
||||
{
|
||||
Alias = "component",
|
||||
Name = "Component",
|
||||
Description = "ContentType used for Component grouping",
|
||||
Icon = ".sprTreeDoc3",
|
||||
Thumbnail = "doc.png",
|
||||
SortOrder = 1,
|
||||
CreatorId = 0,
|
||||
Trashed = false
|
||||
};
|
||||
|
||||
var contentCollection = new PropertyTypeCollection();
|
||||
contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "componentGroup", Name = "Component Group", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
|
||||
component.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Component", SortOrder = 1 });
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
private ContentType CreateBannerComponent(ContentType parent)
|
||||
{
|
||||
var banner = new ContentType(parent)
|
||||
{
|
||||
Alias = "banner",
|
||||
Name = "Banner Component",
|
||||
Description = "ContentType used for Banner Component",
|
||||
Icon = ".sprTreeDoc3",
|
||||
Thumbnail = "doc.png",
|
||||
SortOrder = 1,
|
||||
CreatorId = 0,
|
||||
Trashed = false
|
||||
};
|
||||
|
||||
var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext)
|
||||
{
|
||||
Alias = "bannerName",
|
||||
Name = "Banner Name",
|
||||
Description = "",
|
||||
HelpText = "",
|
||||
Mandatory = false,
|
||||
SortOrder = 2,
|
||||
DataTypeDefinitionId = -88
|
||||
};
|
||||
banner.AddPropertyType(propertyType, "Component");
|
||||
return banner;
|
||||
}
|
||||
|
||||
private ContentType CreateSite()
|
||||
{
|
||||
var site = new ContentType(-1)
|
||||
{
|
||||
Alias = "site",
|
||||
Name = "Site",
|
||||
Description = "ContentType used for Site inheritence",
|
||||
Icon = ".sprTreeDoc3",
|
||||
Thumbnail = "doc.png",
|
||||
SortOrder = 2,
|
||||
CreatorId = 0,
|
||||
Trashed = false
|
||||
};
|
||||
|
||||
var contentCollection = new PropertyTypeCollection();
|
||||
contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "hostname", Name = "Hostname", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
|
||||
site.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Site Settings", SortOrder = 1 });
|
||||
|
||||
return site;
|
||||
}
|
||||
|
||||
private ContentType CreateHomepage(ContentType parent)
|
||||
{
|
||||
var contentType = new ContentType(parent)
|
||||
{
|
||||
Alias = "homepage",
|
||||
Name = "Homepage",
|
||||
Description = "ContentType used for the Homepage",
|
||||
Icon = ".sprTreeDoc3",
|
||||
Thumbnail = "doc.png",
|
||||
SortOrder = 1,
|
||||
CreatorId = 0,
|
||||
Trashed = false
|
||||
};
|
||||
|
||||
var contentCollection = new PropertyTypeCollection();
|
||||
contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
|
||||
contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 });
|
||||
contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 });
|
||||
|
||||
contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 });
|
||||
|
||||
return contentType;
|
||||
}
|
||||
|
||||
private IEnumerable<IContentType> CreateContentTypeHierarchy()
|
||||
|
||||
@@ -162,6 +162,30 @@ namespace Umbraco.Tests.Services.Importing
|
||||
Assert.That(contentMaster.PropertyGroups["SEO"].PropertyTypes.Any(x => x.PropertyGroupId.Value != propertyGroupId), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PackagingService_Can_Import_StandardMvc_ContentTypes_And_Templates_Xml()
|
||||
{
|
||||
// Arrange
|
||||
string strXml = ImportResources.StandardMvc_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()
|
||||
{
|
||||
|
||||
@@ -1,25 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Compilation;
|
||||
using NUnit.Framework;
|
||||
using SqlCE4Umbraco;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Tests;
|
||||
using Umbraco.Tests.PartialTrust;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.BaseRest;
|
||||
using umbraco;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.MacroEngines;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.editorControls.tags;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.uicontrols;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Full Trust benchmark tests for typefinder and the old typefinder
|
||||
|
||||
/// <summary>
|
||||
/// Tests for typefinder
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class TypeFinderTests
|
||||
@@ -50,45 +62,580 @@ namespace Umbraco.Tests
|
||||
typeof(System.Web.Mvc.ActionResult).Assembly,
|
||||
typeof(TypeFinder).Assembly,
|
||||
typeof(ISqlHelper).Assembly,
|
||||
typeof(ICultureDictionary).Assembly
|
||||
typeof(ICultureDictionary).Assembly,
|
||||
typeof(Tag).Assembly,
|
||||
typeof(UmbracoExamine.BaseUmbracoIndexer).Assembly
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class MyTestAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract class TestEditor
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MyTestAttribute]
|
||||
public class BenchmarkTestEditor : TestEditor
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MyTestAttribute]
|
||||
public class MyOtherTestEditor : TestEditor
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Type_With_Attribute()
|
||||
public void Find_Class_Of_Type_With_Attribute()
|
||||
{
|
||||
|
||||
var typesFound = TypeFinder.FindClassesOfTypeWithAttribute<TestEditor, MyTestAttribute>(_assemblies);
|
||||
|
||||
Assert.AreEqual(2, typesFound.Count());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void Find_Classes_Of_Type()
|
||||
{
|
||||
var typesFound = TypeFinder.FindClassesOfType<IApplicationStartupHandler>(_assemblies);
|
||||
var originalTypesFound = TypeFinderOriginal.FindClassesOfType<IApplicationStartupHandler>(_assemblies);
|
||||
|
||||
Assert.AreEqual(originalTypesFound.Count(), typesFound.Count());
|
||||
Assert.AreEqual(6, typesFound.Count());
|
||||
Assert.AreEqual(6, originalTypesFound.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Find_Classes_With_Attribute()
|
||||
{
|
||||
var typesFound = TypeFinder.FindClassesWithAttribute<RestExtensionAttribute>(_assemblies);
|
||||
Assert.AreEqual(1, typesFound.Count());
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Benchmark_Original_Finder()
|
||||
{
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting test", "Finished test"))
|
||||
{
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting FindClassesOfType", "Finished FindClassesOfType"))
|
||||
{
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Assert.Greater(TypeFinderOriginal.FindClassesOfType<DisposableObject>(_assemblies).Count(), 0);
|
||||
}
|
||||
}
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting FindClassesOfTypeWithAttribute", "Finished FindClassesOfTypeWithAttribute"))
|
||||
{
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Assert.Greater(TypeFinderOriginal.FindClassesOfTypeWithAttribute<TestEditor, MyTestAttribute>(_assemblies).Count(), 0);
|
||||
}
|
||||
}
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting FindClassesWithAttribute", "Finished FindClassesWithAttribute"))
|
||||
{
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Assert.Greater(TypeFinderOriginal.FindClassesWithAttribute<XsltExtensionAttribute>(_assemblies).Count(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Benchmark_New_Finder()
|
||||
{
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting test", "Finished test"))
|
||||
{
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting FindClassesOfType", "Finished FindClassesOfType"))
|
||||
{
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Assert.Greater(TypeFinder.FindClassesOfType<DisposableObject>(_assemblies).Count(), 0);
|
||||
}
|
||||
}
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting FindClassesOfTypeWithAttribute", "Finished FindClassesOfTypeWithAttribute"))
|
||||
{
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Assert.Greater(TypeFinder.FindClassesOfTypeWithAttribute<TestEditor, MyTestAttribute>(_assemblies).Count(), 0);
|
||||
}
|
||||
}
|
||||
using (DisposableTimer.TraceDuration<TypeFinderTests>("Starting FindClassesWithAttribute", "Finished FindClassesWithAttribute"))
|
||||
{
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Assert.Greater(TypeFinder.FindClassesWithAttribute<XsltExtensionAttribute>(_assemblies).Count(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MyTag : ITag
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string TagCaption { get; private set; }
|
||||
public string Group { get; private set; }
|
||||
}
|
||||
|
||||
public class MySuperTag : MyTag
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class MyTestAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract class TestEditor
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MyTestAttribute]
|
||||
public class BenchmarkTestEditor : TestEditor
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MyTestAttribute]
|
||||
public class MyOtherTestEditor : TestEditor
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//USED FOR THE ABOVE TESTS
|
||||
// see this issue for details: http://issues.umbraco.org/issue/U4-1187
|
||||
internal static class TypeFinderOriginal
|
||||
{
|
||||
|
||||
private static readonly ConcurrentBag<Assembly> LocalFilteredAssemblyCache = new ConcurrentBag<Assembly>();
|
||||
private static readonly ReaderWriterLockSlim LocalFilteredAssemblyCacheLocker = new ReaderWriterLockSlim();
|
||||
private static ReadOnlyCollection<Assembly> _allAssemblies = null;
|
||||
private static ReadOnlyCollection<Assembly> _binFolderAssemblies = null;
|
||||
private static readonly ReaderWriterLockSlim Locker = new ReaderWriterLockSlim();
|
||||
|
||||
/// <summary>
|
||||
/// lazily load a reference to all assemblies and only local assemblies.
|
||||
/// This is a modified version of: http://www.dominicpettifer.co.uk/Blog/44/how-to-get-a-reference-to-all-assemblies-in-the--bin-folder
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We do this because we cannot use AppDomain.Current.GetAssemblies() as this will return only assemblies that have been
|
||||
/// loaded in the CLR, not all assemblies.
|
||||
/// See these threads:
|
||||
/// http://issues.umbraco.org/issue/U5-198
|
||||
/// http://stackoverflow.com/questions/3552223/asp-net-appdomain-currentdomain-getassemblies-assemblies-missing-after-app
|
||||
/// http://stackoverflow.com/questions/2477787/difference-between-appdomain-getassemblies-and-buildmanager-getreferencedassembl
|
||||
/// </remarks>
|
||||
internal static IEnumerable<Assembly> GetAllAssemblies()
|
||||
{
|
||||
if (_allAssemblies == null)
|
||||
{
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
List<Assembly> assemblies = null;
|
||||
try
|
||||
{
|
||||
var isHosted = HttpContext.Current != null;
|
||||
|
||||
try
|
||||
{
|
||||
if (isHosted)
|
||||
{
|
||||
assemblies = new List<Assembly>(BuildManager.GetReferencedAssemblies().Cast<Assembly>());
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
if (!(e.InnerException is SecurityException))
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
if (assemblies == null)
|
||||
{
|
||||
//NOTE: we cannot use AppDomain.CurrentDomain.GetAssemblies() because this only returns assemblies that have
|
||||
// already been loaded in to the app domain, instead we will look directly into the bin folder and load each one.
|
||||
var binFolder = Assembly.GetExecutingAssembly().GetAssemblyFile().Directory;
|
||||
var binAssemblyFiles = Directory.GetFiles(binFolder.FullName, "*.dll", SearchOption.TopDirectoryOnly).ToList();
|
||||
assemblies = new List<Assembly>();
|
||||
foreach (var a in binAssemblyFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
var assName = AssemblyName.GetAssemblyName(a);
|
||||
var ass = Assembly.Load(assName);
|
||||
assemblies.Add(ass);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is SecurityException || e is BadImageFormatException)
|
||||
{
|
||||
//swallow these exceptions
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if for some reason they are still no assemblies, then use the AppDomain to load in already loaded assemblies.
|
||||
if (!assemblies.Any())
|
||||
{
|
||||
assemblies.AddRange(AppDomain.CurrentDomain.GetAssemblies().ToList());
|
||||
}
|
||||
|
||||
//here we are trying to get the App_Code assembly
|
||||
var fileExtensions = new[] { ".cs", ".vb" }; //only vb and cs files are supported
|
||||
var appCodeFolder = new DirectoryInfo(IOHelper.MapPath(IOHelper.ResolveUrl("~/App_code")));
|
||||
//check if the folder exists and if there are any files in it with the supported file extensions
|
||||
if (appCodeFolder.Exists && (fileExtensions.Any(x => appCodeFolder.GetFiles("*" + x).Any())))
|
||||
{
|
||||
var appCodeAssembly = Assembly.Load("App_Code");
|
||||
if (!assemblies.Contains(appCodeAssembly)) // BuildManager will find App_Code already
|
||||
assemblies.Add(appCodeAssembly);
|
||||
}
|
||||
|
||||
//now set the _allAssemblies
|
||||
_allAssemblies = new ReadOnlyCollection<Assembly>(assemblies);
|
||||
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
if (!(e.InnerException is SecurityException))
|
||||
throw;
|
||||
|
||||
_binFolderAssemblies = _allAssemblies;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _allAssemblies;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns only assemblies found in the bin folder that have been loaded into the app domain.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// This will be used if we implement App_Plugins from Umbraco v5 but currently it is not used.
|
||||
/// </remarks>
|
||||
internal static IEnumerable<Assembly> GetBinAssemblies()
|
||||
{
|
||||
|
||||
if (_binFolderAssemblies == null)
|
||||
{
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var assemblies = GetAssembliesWithKnownExclusions().ToArray();
|
||||
var binFolder = Assembly.GetExecutingAssembly().GetAssemblyFile().Directory;
|
||||
var binAssemblyFiles = Directory.GetFiles(binFolder.FullName, "*.dll", SearchOption.TopDirectoryOnly).ToList();
|
||||
var domainAssemblyNames = binAssemblyFiles.Select(AssemblyName.GetAssemblyName);
|
||||
var safeDomainAssemblies = new List<Assembly>();
|
||||
var binFolderAssemblies = new List<Assembly>();
|
||||
|
||||
foreach (var a in assemblies)
|
||||
{
|
||||
try
|
||||
{
|
||||
//do a test to see if its queryable in med trust
|
||||
var assemblyFile = a.GetAssemblyFile();
|
||||
safeDomainAssemblies.Add(a);
|
||||
}
|
||||
catch (SecurityException)
|
||||
{
|
||||
//we will just ignore this because this will fail
|
||||
//in medium trust for system assemblies, we get an exception but we just want to continue until we get to
|
||||
//an assembly that is ok.
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var assemblyName in domainAssemblyNames)
|
||||
{
|
||||
try
|
||||
{
|
||||
var foundAssembly = safeDomainAssemblies.FirstOrDefault(a => a.GetAssemblyFile() == assemblyName.GetAssemblyFile());
|
||||
if (foundAssembly != null)
|
||||
{
|
||||
binFolderAssemblies.Add(foundAssembly);
|
||||
}
|
||||
}
|
||||
catch (SecurityException)
|
||||
{
|
||||
//we will just ignore this because if we are trying to do a call to:
|
||||
// AssemblyName.ReferenceMatchesDefinition(a.GetName(), assemblyName)))
|
||||
//in medium trust for system assemblies, we get an exception but we just want to continue until we get to
|
||||
//an assembly that is ok.
|
||||
}
|
||||
}
|
||||
|
||||
_binFolderAssemblies = new ReadOnlyCollection<Assembly>(binFolderAssemblies);
|
||||
}
|
||||
}
|
||||
return _binFolderAssemblies;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of found local Assemblies excluding the known assemblies we don't want to scan
|
||||
/// and exluding the ones passed in and excluding the exclusion list filter, the results of this are
|
||||
/// cached for perforance reasons.
|
||||
/// </summary>
|
||||
/// <param name="excludeFromResults"></param>
|
||||
/// <returns></returns>
|
||||
internal static IEnumerable<Assembly> GetAssembliesWithKnownExclusions(
|
||||
IEnumerable<Assembly> excludeFromResults = null)
|
||||
{
|
||||
if (LocalFilteredAssemblyCache.Any()) return LocalFilteredAssemblyCache;
|
||||
using (new WriteLock(LocalFilteredAssemblyCacheLocker))
|
||||
{
|
||||
var assemblies = GetFilteredAssemblies(excludeFromResults, KnownAssemblyExclusionFilter);
|
||||
assemblies.ForEach(LocalFilteredAssemblyCache.Add);
|
||||
}
|
||||
return LocalFilteredAssemblyCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of found local Assemblies and exluding the ones passed in and excluding the exclusion list filter
|
||||
/// </summary>
|
||||
/// <param name="excludeFromResults"></param>
|
||||
/// <param name="exclusionFilter"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<Assembly> GetFilteredAssemblies(
|
||||
IEnumerable<Assembly> excludeFromResults = null,
|
||||
string[] exclusionFilter = null)
|
||||
{
|
||||
if (excludeFromResults == null)
|
||||
excludeFromResults = new List<Assembly>();
|
||||
if (exclusionFilter == null)
|
||||
exclusionFilter = new string[] { };
|
||||
|
||||
return GetAllAssemblies()
|
||||
.Where(x => !excludeFromResults.Contains(x)
|
||||
&& !x.GlobalAssemblyCache
|
||||
&& !exclusionFilter.Any(f => x.FullName.StartsWith(f)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this is our assembly filter to filter out known types that def dont contain types we'd like to find or plugins
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// NOTE the comma vs period... comma delimits the name in an Assembly FullName property so if it ends with comma then its an exact name match
|
||||
/// </remarks>
|
||||
internal static readonly string[] KnownAssemblyExclusionFilter = new[]
|
||||
{
|
||||
"mscorlib,",
|
||||
"System.",
|
||||
"Antlr3.",
|
||||
"Autofac.",
|
||||
"Autofac,",
|
||||
"Castle.",
|
||||
"ClientDependency.",
|
||||
"DataAnnotationsExtensions.",
|
||||
"DataAnnotationsExtensions,",
|
||||
"Dynamic,",
|
||||
"HtmlDiff,",
|
||||
"Iesi.Collections,",
|
||||
"log4net,",
|
||||
"Microsoft.",
|
||||
"Newtonsoft.",
|
||||
"NHibernate.",
|
||||
"NHibernate,",
|
||||
"NuGet.",
|
||||
"RouteDebugger,",
|
||||
"SqlCE4Umbraco,",
|
||||
"umbraco.datalayer,",
|
||||
"umbraco.interfaces,",
|
||||
"umbraco.providers,",
|
||||
"Umbraco.Web.UI,",
|
||||
"umbraco.webservices",
|
||||
"Lucene.",
|
||||
"Examine,",
|
||||
"Examine.",
|
||||
"ServiceStack.",
|
||||
"MySql.",
|
||||
"HtmlAgilityPack.",
|
||||
"TidyNet.",
|
||||
"ICSharpCode.",
|
||||
"CookComputing.",
|
||||
/* Mono */
|
||||
"MonoDevelop.NUnit"
|
||||
};
|
||||
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>()
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
return FindClassesOfTypeWithAttribute<T, TAttribute>(GetAssembliesWithKnownExclusions(), true);
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>(IEnumerable<Assembly> assemblies)
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
return FindClassesOfTypeWithAttribute<T, TAttribute>(assemblies, true);
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> FindClassesOfTypeWithAttribute<T, TAttribute>(IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
where TAttribute : Attribute
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
|
||||
var l = new List<Type>();
|
||||
foreach (var a in assemblies)
|
||||
{
|
||||
var types = from t in GetTypesWithFormattedException(a)
|
||||
where !t.IsInterface
|
||||
&& typeof(T).IsAssignableFrom(t)
|
||||
&& t.GetCustomAttributes<TAttribute>(false).Any()
|
||||
&& (!onlyConcreteClasses || (t.IsClass && !t.IsAbstract))
|
||||
select t;
|
||||
l.AddRange(types);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches all filtered local assemblies specified for classes of the type passed in.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfType<T>()
|
||||
{
|
||||
return FindClassesOfType<T>(GetAssembliesWithKnownExclusions(), true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all types found of in the assemblies specified of type T
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <param name="onlyConcreteClasses"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfType<T>(IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
|
||||
return GetAssignablesFromType<T>(assemblies, onlyConcreteClasses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all types found of in the assemblies specified of type T
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesOfType<T>(IEnumerable<Assembly> assemblies)
|
||||
{
|
||||
return FindClassesOfType<T>(assemblies, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the classes with attribute.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="assemblies">The assemblies.</param>
|
||||
/// <param name="onlyConcreteClasses">if set to <c>true</c> only concrete classes.</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesWithAttribute<T>(IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
where T : Attribute
|
||||
{
|
||||
return FindClassesWithAttribute(typeof(T), assemblies, onlyConcreteClasses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the classes with attribute.
|
||||
/// </summary>
|
||||
/// <param name="type">The attribute type </param>
|
||||
/// <param name="assemblies">The assemblies.</param>
|
||||
/// <param name="onlyConcreteClasses">if set to <c>true</c> only concrete classes.</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesWithAttribute(Type type, IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
{
|
||||
if (assemblies == null) throw new ArgumentNullException("assemblies");
|
||||
if (!TypeHelper.IsTypeAssignableFrom<Attribute>(type))
|
||||
throw new ArgumentException("The type specified: " + type + " is not an Attribute type");
|
||||
|
||||
var l = new List<Type>();
|
||||
foreach (var a in assemblies)
|
||||
{
|
||||
var types = from t in GetTypesWithFormattedException(a)
|
||||
where !t.IsInterface && t.GetCustomAttributes(type, false).Any() && (!onlyConcreteClasses || (t.IsClass && !t.IsAbstract))
|
||||
select t;
|
||||
l.AddRange(types);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the classes with attribute.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="assemblies">The assemblies.</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesWithAttribute<T>(IEnumerable<Assembly> assemblies)
|
||||
where T : Attribute
|
||||
{
|
||||
return FindClassesWithAttribute<T>(assemblies, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the classes with attribute in filtered local assemblies
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Type> FindClassesWithAttribute<T>()
|
||||
where T : Attribute
|
||||
{
|
||||
return FindClassesWithAttribute<T>(GetAssembliesWithKnownExclusions());
|
||||
}
|
||||
|
||||
|
||||
#region Private methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of assignables of type T from a collection of assemblies
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="assemblies"></param>
|
||||
/// <param name="onlyConcreteClasses"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<Type> GetAssignablesFromType<T>(IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
{
|
||||
return GetTypes(typeof(T), assemblies, onlyConcreteClasses);
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypes(Type assignTypeFrom, IEnumerable<Assembly> assemblies, bool onlyConcreteClasses)
|
||||
{
|
||||
var l = new List<Type>();
|
||||
foreach (var a in assemblies)
|
||||
{
|
||||
var types = from t in GetTypesWithFormattedException(a)
|
||||
where !t.IsInterface && assignTypeFrom.IsAssignableFrom(t) && (!onlyConcreteClasses || (t.IsClass && !t.IsAbstract))
|
||||
select t;
|
||||
l.AddRange(types);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypesWithFormattedException(Assembly a)
|
||||
{
|
||||
//if the assembly is dynamic, do not try to scan it
|
||||
if (a.IsDynamic)
|
||||
return Enumerable.Empty<Type>();
|
||||
|
||||
try
|
||||
{
|
||||
return a.GetExportedTypes();
|
||||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("Could not load types from assembly " + a.FullName + ", errors:");
|
||||
foreach (var loaderException in ex.LoaderExceptions.WhereNotNull())
|
||||
{
|
||||
sb.AppendLine("Exception: " + loaderException.ToString());
|
||||
}
|
||||
throw new ReflectionTypeLoadException(ex.Types, ex.LoaderExceptions, sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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.Tests.PartialTrust;
|
||||
using Umbraco.Web;
|
||||
using UmbracoExamine;
|
||||
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 : AbstractPartialTrustFixture<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(UmbracoEventManager));
|
||||
Assert.IsTrue(t5.Success);
|
||||
Assert.AreEqual(typeof(UmbracoEventManager), t5.Result);
|
||||
|
||||
var t6 = TypeHelper.GetLowestBaseType(typeof (IApplicationEventHandler),
|
||||
typeof (LegacyScheduledTasks),
|
||||
typeof(CacheHelperExtensions.CacheHelperApplicationEventListener));
|
||||
Assert.IsTrue(t6.Success);
|
||||
Assert.AreEqual(typeof(IApplicationEventHandler), t6.Result);
|
||||
|
||||
}
|
||||
|
||||
public override void TestSetup()
|
||||
{
|
||||
}
|
||||
|
||||
public override void TestTearDown()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,6 +306,7 @@
|
||||
<Compile Include="TestHelpers\Entities\MockedEntity.cs" />
|
||||
<Compile Include="TestHelpers\Entities\MockedMedia.cs" />
|
||||
<Compile Include="TestHelpers\ExamineHelpers\IndexInitializer.cs" />
|
||||
<Compile Include="TypeHelperTests.cs" />
|
||||
<Compile Include="UriUtilityTests.cs" />
|
||||
<Compile Include="Resolvers\MacroFieldEditorsResolverTests.cs" />
|
||||
<Compile Include="MacroEngineFactoryTests.cs" />
|
||||
|
||||
@@ -236,10 +236,6 @@
|
||||
<Project>{511F6D8D-7717-440A-9A57-A507E9A8B27F}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\umbraco.webservices\umbraco.webservices.csproj">
|
||||
<Project>{CBDB56AC-FF02-4421-9FD4-ED82E339D8E2}</Project>
|
||||
<Name>umbraco.webservices</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Umbraco.Web\Umbraco.Web.csproj">
|
||||
<Project>{651E1350-91B6-44B7-BD60-7207006D7003}</Project>
|
||||
<Name>Umbraco.Web</Name>
|
||||
@@ -327,10 +323,24 @@
|
||||
<Compile Include="Umbraco\Developer\Packages\StarterKits.aspx.designer.cs">
|
||||
<DependentUpon>StarterKits.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Developer\Python\EditPython.aspx.cs">
|
||||
<DependentUpon>editPython.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Developer\Python\EditPython.aspx.designer.cs">
|
||||
<DependentUpon>editPython.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Dialogs\EditMacro.aspx.cs">
|
||||
<DependentUpon>EditMacro.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Dialogs\MoveOrCopy.aspx.cs">
|
||||
<DependentUpon>moveOrCopy.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Dialogs\MoveOrCopy.aspx.designer.cs">
|
||||
<DependentUpon>moveOrCopy.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\dialogs\Sort.aspx.cs">
|
||||
<DependentUpon>sort.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -374,6 +384,20 @@
|
||||
<Compile Include="Umbraco\Settings\EditTemplate.aspx.designer.cs">
|
||||
<DependentUpon>editTemplate.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\settings\Stylesheet\editstylesheet.aspx.cs">
|
||||
<DependentUpon>editstylesheet.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\settings\Stylesheet\editstylesheet.aspx.designer.cs">
|
||||
<DependentUpon>editstylesheet.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\settings\Stylesheet\Property\EditStyleSheetProperty.aspx.cs">
|
||||
<DependentUpon>EditStyleSheetProperty.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\settings\Stylesheet\Property\EditStyleSheetProperty.aspx.designer.cs">
|
||||
<DependentUpon>EditStyleSheetProperty.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Settings\Views\EditView.aspx.cs">
|
||||
<DependentUpon>EditView.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -518,13 +542,6 @@
|
||||
<Content Include="Umbraco\Plugins\UGoLive\throbber.gif" />
|
||||
<Content Include="Umbraco\Plugins\UGoLive\tick.png" />
|
||||
<Content Include="Umbraco\Settings\Views\EditView.aspx" />
|
||||
<Content Include="Umbraco\Webservices\Api\DocumentService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\FileService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\MaintanceService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\MediaService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\MemberService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\StylesheetService.asmx" />
|
||||
<Content Include="Umbraco\Webservices\Api\TemplateService.asmx" />
|
||||
<Content Include="Umbraco_Client\CodeMirror\Js\Lib\codemirror.css" />
|
||||
<Content Include="Umbraco_Client\CodeMirror\Js\Lib\codemirror.js" />
|
||||
<Content Include="Umbraco_Client\CodeMirror\Js\Lib\Util\closetag.js" />
|
||||
@@ -693,7 +710,13 @@
|
||||
<Content Include="umbraco_Client\Editors\DirectoryBrowser.css" />
|
||||
<Content Include="Umbraco_Client\Dialogs\EditMacro.js" />
|
||||
<Content Include="Umbraco_Client\Dialogs\UmbracoField.js" />
|
||||
<Content Include="Umbraco_Client\Editors\EditMacroScripts.js" />
|
||||
<Content Include="Umbraco_Client\Editors\EditXslt.css" />
|
||||
<Content Include="Umbraco_Client\Editors\EditXslt.js" />
|
||||
<Content Include="Umbraco_Client\Editors\EditScript.js" />
|
||||
<Content Include="Umbraco_Client\Editors\EditMacro.css" />
|
||||
<Content Include="Umbraco_Client\Editors\EditStyleSheet.js" />
|
||||
<Content Include="Umbraco_Client\Editors\EditTemplate.js" />
|
||||
<Content Include="Umbraco_Client\Editors\EditView.js" />
|
||||
<Content Include="Umbraco_Client\FileUploader\Js\jquery.fileUploader.js" />
|
||||
<Content Include="Umbraco_Client\FolderBrowser\Css\folderbrowser.css" />
|
||||
@@ -1882,7 +1905,9 @@
|
||||
<Content Include="Config\feedProxy.config" />
|
||||
<Content Include="Umbraco_Client\ui\ui-lightness\jquery-ui.custom.css" />
|
||||
<Content Include="Config\applications.config" />
|
||||
<Content Include="Config\trees.config" />
|
||||
<Content Include="Config\trees.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="Config\applications.Release.config">
|
||||
<DependentUpon>applications.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -2335,7 +2360,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Content Include="Config\404handlers.config" />
|
||||
<Content Include="Config\Dashboard.config" />
|
||||
<Content Include="Config\Dashboard.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Config\metablogConfig.config" />
|
||||
<Content Include="Config\restExtensions.config">
|
||||
<SubType>Designer</SubType>
|
||||
@@ -2381,9 +2408,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>61637</DevelopmentServerPort>
|
||||
<DevelopmentServerPort>6070</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:61639/</IISUrl>
|
||||
<IISUrl>http://localhost:6070</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<!--
|
||||
For full details of the client dependency framework, visit
|
||||
the CodePlex site @ http://clientdependency.codeplex.com
|
||||
https://github.com/Shandem/ClientDependency
|
||||
It manages CSS and JS file dependencies per control without having to worry about duplicates.
|
||||
It also manages the combination, compression and minification of all JS & CSS files.
|
||||
|
||||
@@ -12,24 +12,38 @@ NOTES:
|
||||
-->
|
||||
<clientDependency version="1" fileDependencyExtensions=".js,.css">
|
||||
|
||||
<!--
|
||||
This section is used for Web Forms only, the enableCompositeFiles="true" is optional and by default is set to true.
|
||||
The LoaderControlProvider is set to default, the javascriptPlaceHolderId, cssPlaceHolderId attributes are optional and default to what is listed below. If using
|
||||
this provider, then you must specify both PlaceHolder controls on your page in order to render the JS/CSS.
|
||||
-->
|
||||
<fileRegistration defaultProvider="LoaderControlProvider">
|
||||
<providers>
|
||||
<add name="PageHeaderProvider" type="ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider, ClientDependency.Core"/>
|
||||
<add name="LazyLoadProvider" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadProvider, ClientDependency.Core"/>
|
||||
<add name="LoaderControlProvider" type="ClientDependency.Core.FileRegistration.Providers.LoaderControlProvider, ClientDependency.Core"/>
|
||||
<add name="PageHeaderProvider" type="ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider, ClientDependency.Core" />
|
||||
<add name="LazyLoadProvider" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadProvider, ClientDependency.Core" />
|
||||
<add name="LoaderControlProvider" type="ClientDependency.Core.FileRegistration.Providers.LoaderControlProvider, ClientDependency.Core" />
|
||||
<add name="PlaceHolderProvider" type="ClientDependency.Core.FileRegistration.Providers.PlaceHolderProvider, ClientDependency.Core" enableCompositeFiles="true" javascriptPlaceHolderId="JavaScriptPlaceHolder" cssPlaceHolderId="CssPlaceHolder" />
|
||||
<!-- Used for loading dependencies in Canvas mode -->
|
||||
<add name="CanvasProvider" type="umbraco.presentation.LiveEditing.CanvasClientDependencyProvider, umbraco" />
|
||||
</providers>
|
||||
</fileRegistration>
|
||||
|
||||
<!--
|
||||
The composite file section configures the compression/combination/minification of files.
|
||||
You can enable/disable minification of either JS/CSS files and you can enable/disable the
|
||||
persistence of composite files. By default, minification and persistence is enabled. Persisting files
|
||||
means that the system is going to save the output of the compressed/combined/minified files
|
||||
to disk so that on any subsequent request (when output cache expires) that these files don't have
|
||||
to be recreated again and will be based on the persisted file on disk. This saves on processing time.
|
||||
-->
|
||||
<!-- This section is used for MVC only -->
|
||||
<mvc defaultRenderer="StandardRenderer">
|
||||
<renderers>
|
||||
<add name="StandardRenderer" type="ClientDependency.Core.FileRegistration.Providers.StandardRenderer, ClientDependency.Core" />
|
||||
<add name="LazyLoadRenderer" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadRenderer, ClientDependency.Core" />
|
||||
</renderers>
|
||||
</mvc>
|
||||
|
||||
<!--
|
||||
The composite file section configures the compression/combination/minification of files.
|
||||
You can enable/disable minification of either JS/CSS files and you can enable/disable the
|
||||
persistence of composite files. By default, minification and persistence is enabled. Persisting files
|
||||
means that the system is going to save the output of the compressed/combined/minified files
|
||||
to disk so that on any subsequent request (when output cache expires) that these files don't have
|
||||
to be recreated again and will be based on the persisted file on disk. This saves on processing time.
|
||||
-->
|
||||
<compositeFiles defaultProvider="defaultFileProcessingProvider" compositeFileHandlerPath="~/DependencyHandler.axd">
|
||||
<fileProcessingProviders>
|
||||
<add name="CompositeFileProcessor"
|
||||
@@ -38,30 +52,42 @@ NOTES:
|
||||
enableJsMinify="true"
|
||||
persistFiles="true"
|
||||
compositeFilePath="~/App_Data/TEMP/ClientDependency"
|
||||
urlType="Base64QueryStrings" />
|
||||
bundleDomains="localhost:123456"
|
||||
urlType="Base64QueryStrings"
|
||||
pathUrlFormat="{dependencyId}/{version}/{type}"/>
|
||||
</fileProcessingProviders>
|
||||
|
||||
<!-- A file map provider stores references to dependency files by an id to be used in the handler URL when using the MappedId Url type -->
|
||||
<fileMapProviders>
|
||||
<add name="XmlFileMap"
|
||||
type="ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper, ClientDependency.Core"
|
||||
mapPath="~/App_Data/TEMP/ClientDependency" />
|
||||
</fileMapProviders>
|
||||
|
||||
<!--
|
||||
Defines the mime types to compress when requested by the client.
|
||||
Path is a regex selector, or a * can be used as in place of 'any'.
|
||||
Generally mime types are only set by client browsers in the request for things
|
||||
such as JSON or XML ajax requests.
|
||||
-->
|
||||
Defines the mime types to compress when requested by the client.
|
||||
Path is a regex selector, or a * can be used as in place of 'any'.
|
||||
Generally mime types are only set by client browsers in the request for things
|
||||
such as JSON or XML ajax requests.
|
||||
-->
|
||||
<mimeTypeCompression>
|
||||
<!-- Compress all json requests for the tree -->
|
||||
<add type="application/json" path="^.*?/webservices/Tree.*" />
|
||||
</mimeTypeCompression>
|
||||
|
||||
<!--
|
||||
Defines the paths to match on to enable rogue file compression.
|
||||
Path is a regex selector, or a * can be used as in place of 'any'.
|
||||
jsExt and cssExt are comma seperated list of extensions to match to have the dependencies
|
||||
replaced with the composite file handler. You can even include ASP.Net web service JS proxies.
|
||||
-->
|
||||
<rogueFileCompression>
|
||||
<!--<add path="*" compressJs="true" compressCss="true" jsExt=".js,asmx/js" cssExt=".css">
|
||||
<exclusions>
|
||||
<add path="^.*test.aspx.*"/>
|
||||
</exclusions>
|
||||
</add>-->
|
||||
</rogueFileCompression>
|
||||
|
||||
</compositeFiles>
|
||||
|
||||
<!-- ClientDependency also supports the ASP.Net MVC framework, see codeplex URL for full details -->
|
||||
<!--
|
||||
<mvc defaultRenderer="StandardRenderer">
|
||||
<renderers>
|
||||
<add name="StandardRenderer" type="ClientDependency.Core.Mvc.Providers.StandardRenderer, ClientDependency.Core"/>
|
||||
<add name="LazyLoadRenderer" type="ClientDependency.Core.Mvc.Providers.LazyLoadRenderer, ClientDependency.Core"/>
|
||||
</renderers>
|
||||
</mvc>
|
||||
-->
|
||||
|
||||
</clientDependency>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<!--
|
||||
For full details of the client dependency framework, visit
|
||||
the CodePlex site @ http://clientdependency.codeplex.com
|
||||
https://github.com/Shandem/ClientDependency
|
||||
It manages CSS and JS file dependencies per control without having to worry about duplicates.
|
||||
It also manages the combination, compression and minification of all JS & CSS files.
|
||||
|
||||
@@ -10,8 +10,13 @@ NOTES:
|
||||
* Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config
|
||||
* A new version will invalidate both client and server cache and create new persisted files
|
||||
-->
|
||||
<clientDependency version="2" fileDependencyExtensions=".js,.css">
|
||||
<clientDependency version="7" fileDependencyExtensions=".js,.css">
|
||||
|
||||
<!--
|
||||
This section is used for Web Forms only, the enableCompositeFiles="true" is optional and by default is set to true.
|
||||
The LoaderControlProvider is set to default, the javascriptPlaceHolderId, cssPlaceHolderId attributes are optional and default to what is listed below. If using
|
||||
this provider, then you must specify both PlaceHolder controls on your page in order to render the JS/CSS.
|
||||
-->
|
||||
<fileRegistration defaultProvider="LoaderControlProvider">
|
||||
<providers>
|
||||
<add name="PageHeaderProvider" type="ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider, ClientDependency.Core" />
|
||||
@@ -31,17 +36,17 @@ NOTES:
|
||||
</renderers>
|
||||
</mvc>
|
||||
|
||||
<!--
|
||||
The composite file section configures the compression/combination/minification of files.
|
||||
You can enable/disable minification of either JS/CSS files and you can enable/disable the
|
||||
persistence of composite files. By default, minification and persistence is enabled. Persisting files
|
||||
means that the system is going to save the output of the compressed/combined/minified files
|
||||
to disk so that on any subsequent request (when output cache expires) that these files don't have
|
||||
to be recreated again and will be based on the persisted file on disk. This saves on processing time.
|
||||
-->
|
||||
<compositeFiles defaultProvider="defaultFileProcessingProvider" compositeFileHandlerPath="~/DependencyHandler.axd">
|
||||
<!--
|
||||
The composite file section configures the compression/combination/minification of files.
|
||||
You can enable/disable minification of either JS/CSS files and you can enable/disable the
|
||||
persistence of composite files. By default, minification and persistence is enabled. Persisting files
|
||||
means that the system is going to save the output of the compressed/combined/minified files
|
||||
to disk so that on any subsequent request (when output cache expires) that these files don't have
|
||||
to be recreated again and will be based on the persisted file on disk. This saves on processing time.
|
||||
-->
|
||||
<compositeFiles defaultProvider="defaultFileProcessingProvider" compositeFileHandlerPath="~/DependencyHandler.axd">
|
||||
<fileProcessingProviders>
|
||||
<add name="CompositeFileProcessor" type="ClientDependency.Core.CompositeFiles.Providers.CompositeFileProcessingProvider, ClientDependency.Core" enableCssMinify="true" enableJsMinify="true" persistFiles="true" compositeFilePath="~/App_Data/TEMP/ClientDependency" urlType="Base64QueryStrings" />
|
||||
<add name="CompositeFileProcessor" type="ClientDependency.Core.CompositeFiles.Providers.CompositeFileProcessingProvider, ClientDependency.Core" enableCssMinify="true" enableJsMinify="true" persistFiles="true" compositeFilePath="~/App_Data/TEMP/ClientDependency" bundleDomains="localhost:123456" urlType="Base64QueryStrings" pathUrlFormat="{dependencyId}/{version}/{type}" />
|
||||
</fileProcessingProviders>
|
||||
|
||||
<!-- A file map provider stores references to dependency files by an id to be used in the handler URL when using the MappedId Url type -->
|
||||
@@ -49,17 +54,31 @@ NOTES:
|
||||
<add name="XmlFileMap" type="ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper, ClientDependency.Core" mapPath="~/App_Data/TEMP/ClientDependency" />
|
||||
</fileMapProviders>
|
||||
|
||||
<!--
|
||||
Defines the mime types to compress when requested by the client.
|
||||
Path is a regex selector, or a * can be used as in place of 'any'.
|
||||
Generally mime types are only set by client browsers in the request for things
|
||||
such as JSON or XML ajax requests.
|
||||
-->
|
||||
<!--
|
||||
Defines the mime types to compress when requested by the client.
|
||||
Path is a regex selector, or a * can be used as in place of 'any'.
|
||||
Generally mime types are only set by client browsers in the request for things
|
||||
such as JSON or XML ajax requests.
|
||||
-->
|
||||
<mimeTypeCompression>
|
||||
<!-- Compress all json requests for the tree -->
|
||||
<add type="application/json" path="^.*?/webservices/Tree.*" />
|
||||
</mimeTypeCompression>
|
||||
|
||||
</compositeFiles>
|
||||
<!--
|
||||
Defines the paths to match on to enable rogue file compression.
|
||||
Path is a regex selector, or a * can be used as in place of 'any'.
|
||||
jsExt and cssExt are comma seperated list of extensions to match to have the dependencies
|
||||
replaced with the composite file handler. You can even include ASP.Net web service JS proxies.
|
||||
-->
|
||||
<rogueFileCompression>
|
||||
<!--<add path="*" compressJs="true" compressCss="true" jsExt=".js,asmx/js" cssExt=".css">
|
||||
<exclusions>
|
||||
<add path="^.*test.aspx.*"/>
|
||||
</exclusions>
|
||||
</add>-->
|
||||
</rogueFileCompression>
|
||||
|
||||
</compositeFiles>
|
||||
|
||||
</clientDependency>
|
||||
|
||||
@@ -22,4 +22,8 @@ More information and documentation can be found on CodePlex: http://umbracoexami
|
||||
<add Name="nodeTypeAlias" />
|
||||
</IndexAttributeFields>
|
||||
</IndexSet>
|
||||
|
||||
<!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
|
||||
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
|
||||
|
||||
</ExamineLuceneIndexSets>
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
|
||||
<rewrites>
|
||||
<!--
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
|
||||
<rewrites>
|
||||
<!--
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<microsoft.scripting>
|
||||
<languages>
|
||||
<language names="IronPython;Python;py" extensions=".py" displayName="IronPython 2.6" type="IronPython.Runtime.PythonContext, IronPython, Version=2.6.10920.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<microsoft.scripting>
|
||||
<languages>
|
||||
<language names="IronPython;Python;py" extensions=".py" displayName="IronPython 2.6" type="IronPython.Runtime.PythonContext, IronPython, Version=2.6.10920.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<div class="row">
|
||||
<asp:label AssociatedControlID="tb_email" runat="server">Email:</asp:label>
|
||||
<span><asp:TextBox ID="tb_email" CssClass="text" type="text" Text="admin@domain.com" runat="server" /></span>
|
||||
<span><asp:TextBox ID="tb_email" CssClass="text" type="text" Text="admin@example.com" runat="server" /></span>
|
||||
<asp:RequiredFieldValidator Display="Dynamic" CssClass="invalidaing" ControlToValidate="tb_email" runat="server" ErrorMessage="Email is a mandatory field" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -432,13 +432,13 @@ Dette er en automatisk mail for at fortælle at handlingen '%1%'
|
||||
er blevet udført på siden '%2%'
|
||||
af brugeren '%3%'
|
||||
|
||||
Gå til http://%4%/umbraco/default.aspx?section=content&id=%5% for at redigere.
|
||||
Gå til http://%4%/default.aspx?section=content&id=%5% for at redigere.
|
||||
|
||||
Ha' en dejlig dag!
|
||||
|
||||
Mange hilsner fra umbraco robotten
|
||||
]]></key>
|
||||
<key alias="mailBodyHtml"><![CDATA[<p>Hej %0%</p> <p>Dette er en automatisk mail for at informere dig om at opgaven <strong>'%1%'</strong> er blevet udførtpå siden <a href="%7%"><strong>'%2%'</strong></a> af brugeren <strong>'%3%'</strong> </p> <div style="margin: 8px 0; padding: 8px; display: block;"> <br /> <a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLISÉr </a> <a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> RET </a> <a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> SLET </a> <br /> </div> <p> <h3>Opdateringssammendrag:</h3> <table style="width: 100%;"> %6% </table> </p> <div style="margin: 8px 0; padding: 8px; display: block;"> <br /> <a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLISÉR </a> <a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> RET </a> <a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> SLET </a> <br /> </div> <p>Hav en fortsat god dag!<br /><br /> De bedste hilsner fra umbraco robotten </p>]]></key>
|
||||
<key alias="mailBodyHtml"><![CDATA[<p>Hej %0%</p> <p>Dette er en automatisk mail for at informere dig om at opgaven <strong>'%1%'</strong> er blevet udførtpå siden <a href="%7%"><strong>'%2%'</strong></a> af brugeren <strong>'%3%'</strong> </p> <div style="margin: 8px 0; padding: 8px; display: block;"> <br /> <a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLISÉr </a> <a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%"> RET </a> <a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%"> SLET </a> <br /> </div> <p> <h3>Opdateringssammendrag:</h3> <table style="width: 100%;"> %6% </table> </p> <div style="margin: 8px 0; padding: 8px; display: block;"> <br /> <a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLISÉR </a> <a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%"> RET </a> <a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%"> SLET </a> <br /> </div> <p>Hav en fortsat god dag!<br /><br /> De bedste hilsner fra umbraco robotten </p>]]></key>
|
||||
<key alias="mailSubject">[%0%] Notificering om %1% udført på %2%</key>
|
||||
<key alias="notifications">Notificeringer</key>
|
||||
</area>
|
||||
|
||||
@@ -463,7 +463,7 @@ Hallo %0%,
|
||||
|
||||
die Aufgabe '%1%' (von Benutzer '%3%') an der Seite '%2%' wurde ausgeführt.
|
||||
|
||||
Zum Bearbeiten verwenden Sie bitte diesen Link: http://%4%/umbraco/actions/editContent.aspx?id=%5%
|
||||
Zum Bearbeiten verwenden Sie bitte diesen Link: http://%4%/actions/editContent.aspx?id=%5%
|
||||
|
||||
Einen schönen Tag wünscht
|
||||
Ihr freundlicher Umbraco-Robot
|
||||
@@ -474,9 +474,9 @@ Ihr freundlicher Umbraco-Robot
|
||||
<p>die Aufgabe <strong>'%1%'</strong> (von Benutzer '%3%') an der Seite <a href="%7%"><strong>'%2%'</strong></a> wurde ausgeführt.</p>
|
||||
<div style="margin: 8px 0; padding: 8px; display: block;">
|
||||
<br />
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> VERÖFFENTLICHEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> BEARBEITEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> LÖSCHEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%"> VERÖFFENTLICHEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%"> BEARBEITEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%"> LÖSCHEN </a>
|
||||
<br />
|
||||
</div>
|
||||
<p>
|
||||
@@ -487,9 +487,9 @@ Ihr freundlicher Umbraco-Robot
|
||||
</p>
|
||||
<div style="margin: 8px 0; padding: 8px; display: block;">
|
||||
<br />
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> VERÖFFENTLICHEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> BEARBEITEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> LÖSCHEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%"> VERÖFFENTLICHEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%"> BEARBEITEN </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%"> LÖSCHEN </a>
|
||||
<br />
|
||||
</div>
|
||||
<p>Einen schönen Tag wünscht<br />Ihr freundlicher Umbraco-Robot</p>
|
||||
|
||||
@@ -627,6 +627,7 @@ To manage your website, simply open the umbraco back office and start adding con
|
||||
<key alias="packageUpgradeInstructions">Upgrade instructions</key>
|
||||
<key alias="packageUpgradeText"> There's an upgrade available for this package. You can download it directly from the umbraco package repository.</key>
|
||||
<key alias="packageVersion">Package version</key>
|
||||
<key alias="packageVersionHistory">Package version history</key>
|
||||
<key alias="viewPackageWebsite">View package website</key>
|
||||
</area>
|
||||
<area alias="paste">
|
||||
|
||||
@@ -534,7 +534,7 @@ Pour gerer votre site, accéder simplement au back office et commencez à contri
|
||||
|
||||
Ceci est un email automatique pour vous informer que la tâche '%1%' a été activée sur la page '%2%' par l'utilisateur '%3%'
|
||||
|
||||
Allez à http://%4%/umbraco/actions/editContent.aspx?id=%5% pour éditer.
|
||||
Allez à http://%4%/actions/editContent.aspx?id=%5% pour éditer.
|
||||
|
||||
Bonne journée!
|
||||
|
||||
@@ -550,9 +550,9 @@ Pour gerer votre site, accéder simplement au back office et commencez à contri
|
||||
</p>
|
||||
<div class="buttons">
|
||||
<br />
|
||||
<a class="buttonPublish" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLIER </a>
|
||||
<a class="buttonEdit" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> EDITER </a>
|
||||
<a class="buttonDelete" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> SUPPRIMER </a>
|
||||
<a class="buttonPublish" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLIER </a>
|
||||
<a class="buttonEdit" href="http://%4%/actions/editContent.aspx?id=%5%"> EDITER </a>
|
||||
<a class="buttonDelete" href="http://%4%/actions/delete.aspx?id=%5%"> SUPPRIMER </a>
|
||||
<br />
|
||||
</div>
|
||||
<p>
|
||||
@@ -564,9 +564,9 @@ Pour gerer votre site, accéder simplement au back office et commencez à contri
|
||||
|
||||
<div class="buttons">
|
||||
<br />
|
||||
<a class="buttonPublish" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLIER </a>
|
||||
<a class="buttonEdit" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> EDITER </a>
|
||||
<a class="buttonDelete" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> SUPPRIMER </a>
|
||||
<a class="buttonPublish" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLIER </a>
|
||||
<a class="buttonEdit" href="http://%4%/actions/editContent.aspx?id=%5%"> EDITER </a>
|
||||
<a class="buttonDelete" href="http://%4%/actions/delete.aspx?id=%5%"> SUPPRIMER </a>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -452,9 +452,9 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je
|
||||
</p>
|
||||
<div class="buttons">
|
||||
<br />
|
||||
<a class="buttonPublish" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLISH </a>
|
||||
<a class="buttonEdit" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> EDIT </a>
|
||||
<a class="buttonDelete" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> DELETE </a>
|
||||
<a class="buttonPublish" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLISH </a>
|
||||
<a class="buttonEdit" href="http://%4%/actions/editContent.aspx?id=%5%"> EDIT </a>
|
||||
<a class="buttonDelete" href="http://%4%/actions/delete.aspx?id=%5%"> DELETE </a>
|
||||
<br />
|
||||
</div>
|
||||
<p>
|
||||
@@ -466,9 +466,9 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je
|
||||
|
||||
<div class="buttons">
|
||||
<br />
|
||||
<a class="buttonPublish" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLISH </a>
|
||||
<a class="buttonEdit" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> EDIT </a>
|
||||
<a class="buttonDelete" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> DELETE </a>
|
||||
<a class="buttonPublish" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLISH </a>
|
||||
<a class="buttonEdit" href="http://%4%/actions/editContent.aspx?id=%5%"> EDIT </a>
|
||||
<a class="buttonDelete" href="http://%4%/actions/delete.aspx?id=%5%"> DELETE </a>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ Dette er en automatisk mail for å informere om at handlingen '%1%'
|
||||
er utført på siden '%2%'
|
||||
av brukeren '%3%'
|
||||
|
||||
Gå til http://%4%/umbraco/default.aspx?section=content&id=%5% for å redigere.
|
||||
Gå til http://%4%/default.aspx?section=content&id=%5% for å redigere.
|
||||
|
||||
Ha en fin dag!
|
||||
|
||||
@@ -447,9 +447,9 @@ Vennlig hilsen umbraco roboten
|
||||
</p>
|
||||
<div style="margin: 8px 0; padding: 8px; display: block;">
|
||||
<br />
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLISER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> REDIGER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> SLETT </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLISER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%"> REDIGER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%"> SLETT </a>
|
||||
<br />
|
||||
</div>
|
||||
<p>
|
||||
@@ -461,9 +461,9 @@ Vennlig hilsen umbraco roboten
|
||||
|
||||
<div style="margin: 8px 0; padding: 8px; display: block;">
|
||||
<br />
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/umbraco/actions/publish.aspx?id=%5%"> PUBLISER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/umbraco/actions/editContent.aspx?id=%5%"> REDIGER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/umbraco/actions/delete.aspx?id=%5%"> SLETT </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%"> PUBLISER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%"> REDIGER </a>
|
||||
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%"> SLETT </a>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div style="margin-right: 15px;">
|
||||
<asp:Button id="sbmt" Runat="server" style="Width: 90px; margin-right: 6px;" onclick="sbmt_Click"></asp:Button>
|
||||
<em> or </em>
|
||||
<em> <%= umbraco.ui.Text("or") %> </em>
|
||||
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -56,7 +56,17 @@
|
||||
|
||||
|
||||
</cc2:Pane>
|
||||
|
||||
|
||||
<cc2:Pane ID="pane_versions" runat="server" Text="Package version history" Visible="false">
|
||||
<cc2:PropertyPanel ID="pp_versions" runat="server">
|
||||
<asp:Repeater ID="rptr_versions" runat="server">
|
||||
<HeaderTemplate><ul></HeaderTemplate>
|
||||
<ItemTemplate><li><a href="installedPackage.aspx?id=<%# ((umbraco.cms.businesslogic.packager.InstalledPackage)Container.DataItem).Data.Id %>"><%# ((umbraco.cms.businesslogic.packager.InstalledPackage)Container.DataItem).Data.Version %></a></li></ItemTemplate>
|
||||
<FooterTemplate></ul></FooterTemplate>
|
||||
</asp:Repeater>
|
||||
</cc2:PropertyPanel>
|
||||
</cc2:Pane>
|
||||
|
||||
<cc2:Pane ID="pane_options" runat="server" Text="Package options">
|
||||
<table border="0" style="width: 100%;">
|
||||
<tr><td class="propertyHeader" valign="top">
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Developer.Python
|
||||
{
|
||||
public partial class EditPython : global::umbraco.cms.presentation.developer.editPython
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Developer.Python {
|
||||
|
||||
|
||||
public partial class EditPython {
|
||||
|
||||
/// <summary>
|
||||
/// JsInclude2 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::ClientDependency.Core.Controls.JsInclude JsInclude2;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +1,35 @@
|
||||
<%@ Page ValidateRequest="false" Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master"
|
||||
CodeBehind="editPython.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.developer.editPython" %>
|
||||
CodeBehind="editPython.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Developer.Python.EditPython" %>
|
||||
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
|
||||
<asp:Content ID="DocTypeContent" ContentPlaceHolderID="DocType" runat="server">
|
||||
<!DOCTYPE html>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="cp0" runat="server" ContentPlaceHolderID="head">
|
||||
|
||||
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="Editors/EditMacroScripts.js" PathNameAlias="UmbracoClient" />
|
||||
|
||||
<script type="text/javascript">
|
||||
function closeErrorDiv() {
|
||||
jQuery('#errorDiv').hide();
|
||||
}
|
||||
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
var editor = new Umbraco.Editors.EditMacroScripts({
|
||||
nameTxtBox: $('#<%= pythonFileName.ClientID %>'),
|
||||
originalFileName: '<%= pythonFileName.Text %>',
|
||||
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
|
||||
editorSourceElement: $('#<%= pythonFileName.ClientID %>'),
|
||||
skipTestingCheckBox: $("#<%= SkipTesting.ClientID %>"),
|
||||
});
|
||||
editor.init();
|
||||
|
||||
function doSubmit() {
|
||||
closeErrorDiv();
|
||||
|
||||
var codeVal = jQuery('#<%= pythonSource.ClientID %>').val();
|
||||
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof (CodeMirror) != "undefined") {
|
||||
codeVal = UmbEditor.GetCode();
|
||||
}
|
||||
|
||||
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveDLRScript(jQuery('#<%= pythonFileName.ClientID %>').val(), '<%= pythonFileName.Text %>', codeVal, document.getElementById('<%= SkipTesting.ClientID %>').checked, submitSucces, submitFailure);
|
||||
}
|
||||
|
||||
function submitSucces(t) {
|
||||
if (t != 'true') {
|
||||
top.UmbSpeechBubble.ShowMessage('error', 'Saving scripting file failed', '');
|
||||
jQuery('#errorDiv').html('<p><a href="#" style="position: absolute; right: 10px; top: 10px;" onclick=\'closeErrorDiv()\'>Hide Errors</a><strong>Error occured</strong></p><p>' + t + '</p>');
|
||||
jQuery('#errorDiv').slideDown('fast');
|
||||
}
|
||||
else {
|
||||
top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', '')
|
||||
}
|
||||
}
|
||||
|
||||
function submitFailure(t) {
|
||||
top.UmbSpeechBubble.ShowMessage('warning', 'Scripting file could not be saved', '')
|
||||
}
|
||||
|
||||
|
||||
function showError() {
|
||||
var id = "#errorDiv";
|
||||
if (jQuery(id).is(":visible")) {
|
||||
jQuery(id).hide();
|
||||
}
|
||||
}
|
||||
//bind save shortcut
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="cp1" runat="server" ContentPlaceHolderID="body">
|
||||
@@ -69,9 +50,4 @@
|
||||
OffSetY="55" runat="server" />
|
||||
</cc1:Pane>
|
||||
</cc1:UmbracoPanel>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditRelationType.aspx.cs" Inherits="umbraco.cms.presentation.developer.RelationTypes.EditRelationType" MasterPageFile="/umbraco/masterpages/umbracoPage.Master" %>
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditRelationType.aspx.cs" Inherits="umbraco.cms.presentation.developer.RelationTypes.EditRelationType" MasterPageFile="../../masterpages/umbracoPage.Master" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewRelationType.aspx.cs" Inherits="umbraco.cms.presentation.developer.RelationTypes.NewRelationType" MasterPageFile="/umbraco/masterpages/umbracoPage.Master"%>
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewRelationType.aspx.cs" Inherits="umbraco.cms.presentation.developer.RelationTypes.NewRelationType" MasterPageFile="../../masterpages/umbracoPage.Master"%>
|
||||
<%@ Register TagPrefix="umb" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
|
||||
|
||||
@@ -9,54 +9,30 @@
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server" ID="cp2">
|
||||
<style type="text/css">
|
||||
#errorDiv
|
||||
{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#errorDiv a
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
.propertyItemheader
|
||||
{
|
||||
width: 200px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="Editors/EditXslt.js" PathNameAlias="UmbracoClient" />
|
||||
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="Editors/EditXslt.css" PathNameAlias="UmbracoClient" />
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var xsltSnippet = "";
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
var editor = new Umbraco.Editors.EditXslt({
|
||||
nameTxtBox: $('#<%= xsltFileName.ClientID %>'),
|
||||
originalFileName: '<%= xsltFileName.Text %>',
|
||||
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
|
||||
editorSourceElement: $('#<%= editorSource.ClientID %>'),
|
||||
skipTestingCheckBox: $("#<%= SkipTesting.ClientID %>"),
|
||||
});
|
||||
editor.init();
|
||||
|
||||
function closeErrorDiv() {
|
||||
jQuery('#errorDiv').hide();
|
||||
}
|
||||
|
||||
function doSubmit() {
|
||||
closeErrorDiv();
|
||||
|
||||
var codeVal = jQuery('#<%= editorSource.ClientID %>').val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof (CodeMirror) != "undefined") {
|
||||
codeVal = UmbEditor.GetCode();
|
||||
}
|
||||
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveXslt(jQuery('#<%= xsltFileName.ClientID %>').val(), '<%= xsltFileName.Text %>', codeVal, document.getElementById('<%= SkipTesting.ClientID %>').checked, submitSucces, submitFailure);
|
||||
}
|
||||
|
||||
function submitSucces(t) {
|
||||
if (t != 'true') {
|
||||
top.UmbSpeechBubble.ShowMessage('error', 'Saving Xslt file failed', '');
|
||||
jQuery('#errorDiv').html('<p><a href="#" onclick=\'closeErrorDiv()\'>Hide Errors</a><strong>Error occured</strong></p><p>' + t + '</p>');
|
||||
jQuery('#errorDiv').slideDown('fast');
|
||||
}
|
||||
else {
|
||||
top.UmbSpeechBubble.ShowMessage('save', 'Xslt file saved', '')
|
||||
}
|
||||
}
|
||||
function submitFailure(t) {
|
||||
top.UmbSpeechBubble.ShowMessage('warning', 'Xslt file could not be saved', '')
|
||||
}
|
||||
//bind save shortcut
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
//TODO: Move these to EditXslt.js one day
|
||||
var xsltSnippet = "";
|
||||
function xsltVisualize() {
|
||||
|
||||
xsltSnippet = UmbEditor.IsSimpleEditor
|
||||
@@ -71,7 +47,6 @@
|
||||
}
|
||||
|
||||
UmbClientMgr.openModalWindow('<%= umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>/developer/xslt/xsltVisualize.aspx', 'Visualize XSLT', true, 550, 650);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -92,15 +67,9 @@
|
||||
<div id="errorDiv" style="display: none;" class="error">
|
||||
test</div>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:CodeArea ID="editorSource" CodeBase="XML" ClientSaveMethod="doSubmit" runat="server"
|
||||
AutoResize="true" OffSetX="47" OffSetY="55" />
|
||||
<cc1:CodeArea ID="editorSource" CodeBase="XML" runat="server" AutoResize="true" OffSetX="47" OffSetY="55" />
|
||||
</cc1:Pane>
|
||||
</cc1:UmbracoPanel>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="footer" runat="server">
|
||||
<asp:Literal ID="editorJs" runat="server"></asp:Literal>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Dialogs
|
||||
{
|
||||
public partial class MoveOrCopy : global::umbraco.dialogs.moveOrCopy
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Dialogs {
|
||||
|
||||
|
||||
public partial class MoveOrCopy {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<%@ Page Language="c#" CodeBehind="moveOrCopy.aspx.cs" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="umbraco.dialogs.moveOrCopy" %>
|
||||
<%@ Page Language="c#" CodeBehind="moveOrCopy.aspx.cs" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Dialogs.MoveOrCopy" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
<%@ Register Src="../controls/Tree/TreeControl.ascx" TagName="TreeControl" TagPrefix="umbraco" %>
|
||||
|
||||
@@ -34,7 +34,7 @@ UmbracoSpeechBubble.prototype.ShowMessage = function (icon, header, message, don
|
||||
if (!dontAutoHide) {
|
||||
jQuery("#" + this.id).fadeIn("slow").animate({ opacity: 1.0 }, 5000).fadeOut("fast");
|
||||
} else {
|
||||
speechBubble.jQuery(".speechClose").show();
|
||||
jQuery(".speechClose").show();
|
||||
jQuery("#" + this.id).fadeIn("slow");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<body>
|
||||
<form id="Form1" method="post" runat="server">
|
||||
<cc1:UmbracoPanel Style="text-align: left;" ID="Panel1" runat="server" Height="347px"
|
||||
Width="340px" Text="Umbraco 4 login" AutoResize="false">
|
||||
Width="340px" Text="Umbraco login" AutoResize="false">
|
||||
<div style="padding: 70px 0px 0px 0px;">
|
||||
<p style="margin: 0px; padding: 5px 0px 20px 0px; color: #999">
|
||||
<asp:Literal ID="TopText" runat="server"></asp:Literal>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
@* Get the property alias we want to filter on from the macro parameter *@
|
||||
var propertyAlias = Parameter.propertyAlias;
|
||||
var selection = Model.Children.Where("Visible").OrderBy(propertyAlias)
|
||||
var selection = Model.Children.Where("Visible").OrderBy(propertyAlias);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-1
@@ -10,9 +10,15 @@
|
||||
|
||||
@{
|
||||
@*Build a query and return the visible items *@
|
||||
var selection= Model.Textpages.Where(query).Where("Visible");
|
||||
var selection= Model.Textpages.Where("Visible");
|
||||
|
||||
@*
|
||||
Example of more querying, if you have a true/false property with the alias of shouldBeFeatured:
|
||||
var selection= Model.Textpages.Where("shouldBeFeatured == true").Where("Visible");
|
||||
*@
|
||||
}
|
||||
|
||||
|
||||
@*Determine if there are any nodes in the selection, then render list *@
|
||||
@if(selection.Any()){
|
||||
|
||||
|
||||
+7
-11
@@ -1,25 +1,21 @@
|
||||
@inherits PartialViewMacroPage
|
||||
@using Umbraco.Cms.Web
|
||||
@using Umbraco.Cms.Web.Macros
|
||||
@using Umbraco.Framework
|
||||
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
|
||||
@if (CurrentPage.Children.Where("umbracoNaviHide != @0", "True").Any())
|
||||
@if (Model.Children.Where("Visible").Any())
|
||||
{
|
||||
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
|
||||
var naviLevel = CurrentPage.Children.Where("umbracoNaviHide != @0", "True").First().Level;
|
||||
var naviLevel = Model.Children.Where("Visible").First().Level;
|
||||
|
||||
@* Add in level for a CSS hook *@
|
||||
<ul class="level-@naviLevel">
|
||||
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
|
||||
@foreach (var childPage in CurrentPage.Children.Where("umbracoNaviHide != @0", "True"))
|
||||
@foreach (var childPage in Model.Children.Where("Visible"))
|
||||
{
|
||||
<li>
|
||||
<a href="@childPage.Url">@childPage.Name</a>
|
||||
|
||||
@* if the current page has any children, where the property umbracoNaviHide is not True *@
|
||||
@if (childPage.Children.Where("umbracoNaviHide != @0", "True").Any())
|
||||
@if (childPage.Children.Where("Visible").Any())
|
||||
{
|
||||
@* Call our helper to display the children *@
|
||||
@childPages(childPage.Children)
|
||||
@@ -40,13 +36,13 @@
|
||||
|
||||
@* Add in level for a CSS hook *@
|
||||
<ul class="level-@(naviLevel)">
|
||||
@foreach (var page in pages.Where("umbracoNaviHide != @0", "True"))
|
||||
@foreach (var page in pages.Where("Visible"))
|
||||
{
|
||||
<li>
|
||||
<a href="@page.Url">@page.Name</a>
|
||||
|
||||
@* if the current page has any children, where the property umbracoNaviHide is not True *@
|
||||
@if (page.Children.Where("umbracoNaviHide != @0", "True").Any())
|
||||
@if (page.Children.Where("Visible").Any())
|
||||
{
|
||||
@* Call our helper to display the children *@
|
||||
@childPages(page.Children)
|
||||
|
||||
@@ -11,5 +11,14 @@ namespace Umbraco.Web.UI.Umbraco.Settings {
|
||||
|
||||
|
||||
public partial class EditTemplate {
|
||||
|
||||
/// <summary>
|
||||
/// JsInclude1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,162 +11,91 @@
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="splitbutton/splitbutton.css" PathNameAlias="UmbracoClient" />
|
||||
<umb:JsInclude ID="JsInclude" runat="server" FilePath="splitbutton/jquery.splitbutton.js" PathNameAlias="UmbracoClient" />
|
||||
|
||||
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="Editors/EditTemplate.js" PathNameAlias="UmbracoClient" />
|
||||
<script type="text/javascript">
|
||||
//this needs to be a global object for the doSubmit() to work
|
||||
var editor;
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
//macro split button
|
||||
jQuery('#sbMacro').splitbutton({menu:'#macroMenu'});
|
||||
jQuery("#splitButtonMacro").appendTo("#splitButtonMacroPlaceHolder");
|
||||
|
||||
////razor macro split button
|
||||
jQuery('#sb').splitbutton({menu:'#codeTemplateMenu'});
|
||||
jQuery("#splitButton").appendTo("#splitButtonPlaceHolder");
|
||||
|
||||
jQuery(".macro").click(function(){
|
||||
var alias = jQuery(this).attr("rel");
|
||||
if(jQuery(this).attr("params") == "1")
|
||||
{
|
||||
openMacroModal(alias);
|
||||
}
|
||||
else
|
||||
{
|
||||
insertMacro(alias);
|
||||
//create the editor
|
||||
editor = new Umbraco.Editors.EditTemplate({
|
||||
umbracoPath: '<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>',
|
||||
editorClientId: '<%= editorSource.ClientID %>',
|
||||
useMasterPages: <%=umbraco.UmbracoSettings.UseAspNetMasterPages.ToString().ToLower()%>,
|
||||
templateId: <%= Request.QueryString["templateID"] %>,
|
||||
masterTemplateId: jQuery('#<%= MasterTemplate.ClientID %>').val(),
|
||||
treeSyncPath: '<%=TemplateTreeSyncPath%>',
|
||||
text: {
|
||||
templateErrorHeader: "<%= umbraco.ui.Text("speechBubbles", "templateErrorHeader") %>",
|
||||
templateSavedHeader: "<%= umbraco.ui.Text("speechBubbles", "templateSavedHeader") %>",
|
||||
templateErrorText: "<%= umbraco.ui.Text("speechBubbles", "templateErrorText") %>",
|
||||
templateSavedText: "<%= umbraco.ui.Text("speechBubbles", "templateSavedText") %>"
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(".codeTemplate").click(function(){
|
||||
insertCodeBlockFromTemplate(jQuery(this).attr("rel"));
|
||||
});
|
||||
|
||||
editor.init();
|
||||
});
|
||||
|
||||
|
||||
function doSubmit() {
|
||||
var codeVal = UmbEditor.GetCode();
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveTemplate(jQuery('#<%= NameTxt.ClientID %>').val(), jQuery('#<%= AliasTxt.ClientID %>').val(), codeVal, '<%= Request.QueryString["templateID"] %>', jQuery('#<%= MasterTemplate.ClientID %>').val(), submitSucces, submitFailure);
|
||||
}
|
||||
|
||||
function submitSucces(t)
|
||||
{
|
||||
if(t != 'true')
|
||||
{
|
||||
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "templateErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "templateErrorText") %>');
|
||||
}
|
||||
else
|
||||
{
|
||||
top.UmbSpeechBubble.ShowMessage('save', '<%= umbraco.ui.Text("speechBubbles", "templateSavedHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "templateSavedText") %>')
|
||||
}
|
||||
}
|
||||
function submitFailure(t)
|
||||
{
|
||||
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "templateErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "templateErrorText") %>')
|
||||
//this is called when the save button is clicked or invoked
|
||||
editor.save(jQuery('#<%= NameTxt.ClientID %>').val(), jQuery('#<%= AliasTxt.ClientID %>').val(), UmbEditor.GetCode());
|
||||
}
|
||||
|
||||
//TODO: the below should be refactored into being part of the EditTemplate.js class but have left it here for now since i don't have time.
|
||||
|
||||
function umbracoTemplateInsertMasterPageContentContainer() {
|
||||
var master = document.getElementById('<%= MasterTemplate.ClientID %>')[document.getElementById('<%= MasterTemplate.ClientID %>').selectedIndex].value;
|
||||
if (master == "") master = 0;
|
||||
umbraco.presentation.webservices.legacyAjaxCalls.TemplateMasterPageContentContainer(<%=Request["templateID"] %>, master, umbracoTemplateInsertMasterPageContentContainerDo);
|
||||
}
|
||||
|
||||
function umbracoTemplateInsertMasterPageContentContainerDo(result) {
|
||||
UmbEditor.Insert(result + '\n', '\n</asp\:Content>\n', '<%= editorSource.ClientID%>');
|
||||
}
|
||||
|
||||
function changeMasterPageFile(){
|
||||
|
||||
function umbracoTemplateInsertMasterPageContentContainerDo(result) {
|
||||
UmbEditor.Insert(result + '\n', '\n</asp\:Content>\n', '<%= editorSource.ClientID%>');
|
||||
}
|
||||
|
||||
function changeMasterPageFile() {
|
||||
var editor = document.getElementById("<%= editorSource.ClientID %>");
|
||||
var templateDropDown = document.getElementById("<%= MasterTemplate.ClientID %>");
|
||||
|
||||
|
||||
var templateCode = UmbEditor.GetCode();
|
||||
var selectedTemplate = templateDropDown.options[templateDropDown.selectedIndex].id;
|
||||
var masterTemplate = "<%= umbraco.IO.SystemDirectories.Masterpages%>/" + selectedTemplate + ".master";
|
||||
|
||||
if(selectedTemplate == "")
|
||||
masterTemplate = "<%= umbraco.IO.SystemDirectories.Umbraco%>/masterpages/default.master";
|
||||
|
||||
var regex = /MasterPageFile=[~a-z0-9/._"-]+/im;
|
||||
|
||||
if (templateCode.match(regex)) {
|
||||
templateCode = templateCode.replace(regex, 'MasterPageFile="' + masterTemplate + '"');
|
||||
|
||||
UmbEditor.SetCode(templateCode);
|
||||
|
||||
} else {
|
||||
//todo, spot if a directive is there, and if not suggest that the user inserts it..
|
||||
alert("Master directive not found...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function insertContentElement(id){
|
||||
|
||||
//nasty hack to avoid asp.net freaking out because of the markup...
|
||||
var cp = 'asp:Content ContentPlaceHolderId="' + id + '"';
|
||||
cp += ' runat="server"';
|
||||
cp += '>\n\t<!-- Insert "' + id + '" markup here -->';
|
||||
|
||||
UmbEditor.Insert('\n<' + cp, '\n</asp:Content' + '>\n', '<%= editorSource.ClientID %>');
|
||||
}
|
||||
|
||||
function insertPlaceHolderElement(id){
|
||||
|
||||
var cp = 'asp:ContentPlaceHolder Id="' + id + '"';
|
||||
cp += ' runat="server"';
|
||||
cp += '>\n\t<!-- Insert default "' + id + '" markup here -->';
|
||||
if (selectedTemplate == "")
|
||||
masterTemplate = "<%= umbraco.IO.SystemDirectories.Umbraco%>/masterpages/default.master";
|
||||
|
||||
UmbEditor.Insert('\n<' + cp, '\n</asp:ContentPlaceHolder' + '>\n', '<%= editorSource.ClientID %>');
|
||||
}
|
||||
|
||||
function insertCodeBlock()
|
||||
{
|
||||
var snip = umbracoInsertSnippet();
|
||||
UmbEditor.Insert(snip.BeginTag, snip.EndTag, '<%= editorSource.ClientID %>');
|
||||
}
|
||||
var regex = /MasterPageFile=[~a-z0-9/._"-]+/im;
|
||||
|
||||
function umbracoInsertSnippet() {
|
||||
var snip = new UmbracoCodeSnippet();
|
||||
var cp = 'umbraco:Macro runat="server" language="cshtml"';
|
||||
snip.BeginTag = '\n<' + cp + '>\n';
|
||||
snip.EndTag = '\n<' + '/umbraco:Macro' + '>\n';
|
||||
snip.TargetId = "<%= editorSource.ClientID %>";
|
||||
return snip;
|
||||
}
|
||||
if (templateCode.match(regex)) {
|
||||
templateCode = templateCode.replace(regex, 'MasterPageFile="' + masterTemplate + '"');
|
||||
|
||||
function insertCodeBlockFromTemplate(templateId)
|
||||
{
|
||||
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: "../webservices/templates.asmx/GetCodeSnippet",
|
||||
data: "{templateId: '" + templateId + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function(msg) {
|
||||
|
||||
var cp = 'umbraco:Macro runat="server" language="cshtml"';
|
||||
UmbEditor.Insert('\n<' + cp +'>\n' + msg.d,'\n</umbraco:Macro' + '>\n', '<%= editorSource.ClientID %>');
|
||||
UmbEditor.SetCode(templateCode);
|
||||
|
||||
}
|
||||
});
|
||||
else {
|
||||
//todo, spot if a directive is there, and if not suggest that the user inserts it..
|
||||
alert("Master directive not found...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function insertContentElement(id) {
|
||||
|
||||
function insertMacro(alias)
|
||||
{
|
||||
<%if (umbraco.UmbracoSettings.UseAspNetMasterPages) { %>
|
||||
var macroElement = "umbraco:Macro";
|
||||
<%}else{ %>
|
||||
var macroElement = "?UMBRACO_MACRO";
|
||||
<%}%>
|
||||
//nasty hack to avoid asp.net freaking out because of the markup...
|
||||
var cp = 'asp:Content ContentPlaceHolderId="' + id + '"';
|
||||
cp += ' runat="server"';
|
||||
cp += '>\n\t<!-- Insert "' + id + '" markup here -->';
|
||||
|
||||
var cp = macroElement + ' Alias="'+ alias +'" runat="server"';
|
||||
UmbEditor.Insert('<' + cp +' />','', '<%= editorSource.ClientID %>');
|
||||
}
|
||||
function openMacroModal(alias)
|
||||
{
|
||||
var t = "";
|
||||
if(alias != null && alias != ""){
|
||||
t = "&alias="+alias;
|
||||
}
|
||||
UmbClientMgr.openModalWindow('<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>/dialogs/editMacro.aspx?renderingEngine=Webforms&objectId=<%= editorSource.ClientID %>' + t, 'Insert Macro', true, 470, 530, 0, 0, '', '');
|
||||
UmbEditor.Insert('\n<' + cp, '\n</asp:Content' + '>\n', '<%= editorSource.ClientID %>');
|
||||
}
|
||||
|
||||
function insertPlaceHolderElement(id) {
|
||||
|
||||
var cp = 'asp:ContentPlaceHolder Id="' + id + '"';
|
||||
cp += ' runat="server"';
|
||||
cp += '>\n\t<!-- Insert default "' + id + '" markup here -->';
|
||||
|
||||
UmbEditor.Insert('\n<' + cp, '\n</asp:ContentPlaceHolder' + '>\n', '<%= editorSource.ClientID %>');
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -190,7 +119,7 @@ function insertMacro(alias)
|
||||
</cc1:Pane>
|
||||
</cc1:UmbracoPanel>
|
||||
<div id="splitButton" style="display: inline; height: 23px; vertical-align: top;">
|
||||
<a href="javascript:insertCodeBlock();" id="sb" class="sbLink">
|
||||
<a href="#" id="sb" class="sbLink">
|
||||
<img alt="Insert Inline Razor Macro" src="../images/editor/insRazorMacro.png" title="Insert Inline Razor Macro"
|
||||
style="vertical-align: top;">
|
||||
</a>
|
||||
@@ -205,7 +134,7 @@ function insertMacro(alias)
|
||||
</asp:Repeater>
|
||||
</div>
|
||||
<div id="splitButtonMacro" style="display: inline; height: 23px; vertical-align: top;">
|
||||
<a href="javascript:openMacroModal();" id="sbMacro" class="sbLink">
|
||||
<a href="#" id="sbMacro" class="sbLink">
|
||||
<img alt="Insert Macro" src="../images/editor/insMacroSB.png" title="Insert Macro"
|
||||
style="vertical-align: top;">
|
||||
</a>
|
||||
|
||||
@@ -3,34 +3,39 @@
|
||||
ValidateRequest="False" %>
|
||||
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
|
||||
<asp:Content ID="DocTypeContent" ContentPlaceHolderID="DocType" runat="server">
|
||||
<!DOCTYPE html>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server">
|
||||
|
||||
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="Editors/EditScript.js" PathNameAlias="UmbracoClient" />
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function doSubmit() {
|
||||
var codeVal = jQuery('#<%= editorSource.ClientID %>').val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof (CodeMirror) != "undefined") {
|
||||
codeVal = UmbEditor.GetCode();
|
||||
}
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveScript(jQuery('#<%= NameTxt.ClientID %>').val(), '<%= NameTxt.Text %>', codeVal, submitSucces, submitFailure);
|
||||
}
|
||||
|
||||
function submitSucces(t) {
|
||||
if (t != 'true') {
|
||||
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "fileErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "fileErrorText") %>');
|
||||
}
|
||||
else {
|
||||
top.UmbSpeechBubble.ShowMessage('save', '<%= umbraco.ui.Text("speechBubbles", "fileSavedHeader") %>', '')
|
||||
}
|
||||
}
|
||||
function submitFailure(t) {
|
||||
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "fileErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "fileErrorText") %>')
|
||||
}
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
var editor = new Umbraco.Editors.EditScript({
|
||||
nameTxtBox: $('#<%= NameTxt.ClientID %>'),
|
||||
originalFileName: '<%= NameTxt.Text %>',
|
||||
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
|
||||
editorSourceElement: $('#<%= editorSource.ClientID %>'),
|
||||
text: {
|
||||
fileErrorHeader: '<%= umbraco.ui.Text("speechBubbles", "fileErrorHeader") %>',
|
||||
fileSavedHeader: '<%= umbraco.ui.Text("speechBubbles", "fileSavedHeader") %>',
|
||||
fileSavedText: '',
|
||||
fileErrorText: '<%= umbraco.ui.Text("speechBubbles", "fileErrorText") %>',
|
||||
}
|
||||
});
|
||||
editor.init();
|
||||
|
||||
//bind save shortcut
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
@@ -48,9 +53,5 @@
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
</cc1:UmbracoPanel>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" Codebehind="editstylesheet.aspx.cs" AutoEventWireup="True"
|
||||
Inherits="umbraco.cms.presentation.settings.stylesheet.editstylesheet" ValidateRequest="False" %>
|
||||
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" CodeBehind="editstylesheet.aspx.cs" AutoEventWireup="True"
|
||||
Inherits="Umbraco.Web.UI.Umbraco.Settings.Stylesheet.EditStyleSheet" ValidateRequest="False" %>
|
||||
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
<%@ Register TagPrefix="cdf" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server">
|
||||
<script type="text/javascript">
|
||||
|
||||
function doSubmit() {
|
||||
var codeVal = jQuery('#<%= editorSource.ClientID %>').val();
|
||||
//if CodeMirror is not defined, then the code editor is disabled.
|
||||
if (typeof(CodeMirror) != "undefined") {
|
||||
codeVal = UmbEditor.GetCode();
|
||||
}
|
||||
umbraco.presentation.webservices.codeEditorSave.SaveCss(jQuery('#<%= NameTxt.ClientID %>').val(), '<%= NameTxt.Text %>', codeVal, '<%= Request.QueryString["id"] %>', submitSucces, submitFailure);
|
||||
}
|
||||
<cdf:JsInclude runat="server" FilePath="Editors/EditStyleSheet.js" PathNameAlias="UmbracoClient"></cdf:JsInclude>
|
||||
|
||||
function submitSucces(t) {
|
||||
if (t != 'true') {
|
||||
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "CssErrorHeader") %>', 'Please make sure that you have permissions set correctly');
|
||||
}
|
||||
else {
|
||||
top.UmbSpeechBubble.ShowMessage('save', '<%= umbraco.ui.Text("speechBubbles", "cssSavedHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "cssSavedText") %>')
|
||||
}
|
||||
}
|
||||
function submitFailure(t) {
|
||||
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "CssErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "CssErrorText") %>')
|
||||
}
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
var editor = new Umbraco.Editors.EditStyleSheet({
|
||||
nameTxtBox: $('#<%= NameTxt.ClientID %>'),
|
||||
originalFileName: '<%= NameTxt.Text %>',
|
||||
cssId: '<%= Request.QueryString["id"] %>',
|
||||
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
|
||||
editorSourceElement: $('#<%= editorSource.ClientID %>'),
|
||||
text: {
|
||||
cssErrorHeader: '<%= umbraco.ui.Text("speechBubbles", "cssErrorHeader") %>',
|
||||
cssSavedHeader: '<%= umbraco.ui.Text("speechBubbles", "cssSavedHeader") %>',
|
||||
cssSavedText: '<%= umbraco.ui.Text("speechBubbles", "cssSavedText") %>',
|
||||
cssErrorText: 'Please make sure that you have permissions set correctly',
|
||||
}
|
||||
});
|
||||
editor.init();
|
||||
});
|
||||
|
||||
//bind save shortcut
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
<cc1:UmbracoPanel ID="Panel1" runat="server" CssClass="panel" hasMenu="true">
|
||||
<cc1:Pane ID="Pane7" CssClass="pane" runat="server">
|
||||
<cc1:PropertyPanel ID="pp_name" runat="server">
|
||||
<asp:TextBox ID="NameTxt" Width="350px" runat="server"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_path" runat="server">
|
||||
<asp:Literal ID="lttPath" runat="server"></asp:Literal>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel id="pp_source" runat="server">
|
||||
<cc1:CodeArea id="editorSource" CodeBase="Css" ClientSaveMethod="doSubmit" OffSetX="37" OffSetY="54" AutoResize="true" runat="server" />
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
<cc1:Pane ID="Pane7" CssClass="pane" runat="server">
|
||||
<cc1:PropertyPanel ID="pp_name" runat="server">
|
||||
<asp:TextBox ID="NameTxt" Width="350px" runat="server"></asp:TextBox>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_path" runat="server">
|
||||
<asp:Literal ID="lttPath" runat="server"></asp:Literal>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_source" runat="server">
|
||||
<cc1:CodeArea ID="editorSource" CodeBase="Css" OffSetX="37" OffSetY="54" AutoResize="true" runat="server" />
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
</cc1:UmbracoPanel>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
</asp:Content>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Settings.Stylesheet
|
||||
{
|
||||
public partial class EditStyleSheet : global::umbraco.cms.presentation.settings.stylesheet.editstylesheet
|
||||
{
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Settings.Stylesheet {
|
||||
|
||||
|
||||
public partial class EditStyleSheet {
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<%@ Page Language="c#" MasterPageFile="../../../masterpages/umbracoPage.Master" CodeBehind="EditStyleSheetProperty.aspx.cs"
|
||||
AutoEventWireup="True" Inherits="umbraco.cms.presentation.settings.stylesheet.EditStyleSheetProperty"
|
||||
AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Settings.Stylesheet.Property.EditStyleSheetProperty"
|
||||
ValidateRequest="False" %>
|
||||
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
<cc1:UmbracoPanel ID="Panel1" runat="server" Text="Edit stylesheet property" Width="432px"
|
||||
Height="176px" hasMenu="true">
|
||||
<cc1:UmbracoPanel ID="Panel1" runat="server" Text="Edit stylesheet property" Width="432px" Height="176px" hasMenu="true">
|
||||
<cc1:Pane ID="Pane7" CssClass="pane" runat="server">
|
||||
<table cellspacing="0" cellpadding="4" border="0">
|
||||
<tr>
|
||||
@@ -57,9 +57,11 @@
|
||||
</table>
|
||||
</cc1:Pane>
|
||||
</cc1:UmbracoPanel>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
});
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Settings.Stylesheet.Property
|
||||
{
|
||||
public partial class EditStyleSheetProperty : global::umbraco.cms.presentation.settings.stylesheet.EditStyleSheetProperty
|
||||
{
|
||||
}
|
||||
}
|
||||
Generated
+15
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Settings.Stylesheet.Property {
|
||||
|
||||
|
||||
public partial class EditStyleSheetProperty {
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@
|
||||
$(document).ready(function () {
|
||||
//create and assign a new EditView object
|
||||
editViewEditor = new Umbraco.Editors.EditView({
|
||||
treeSyncPath: "<%=TemplateTreeSyncPath%>",
|
||||
currentTreeType: "<%=CurrentTreeType%>",
|
||||
editorType: "<%= EditorType.ToString() %>",
|
||||
originalFileName: "<%=OriginalFileName %>",
|
||||
restServiceLocation: "<%= Url.GetSaveFileServicePath() %>",
|
||||
|
||||
@@ -45,6 +45,23 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
|
||||
get { return _template == null ? ViewEditorType.PartialView : ViewEditorType.Template; }
|
||||
}
|
||||
|
||||
protected string TemplateTreeSyncPath { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This view is shared between different trees so we'll look for the query string
|
||||
/// </summary>
|
||||
protected string CurrentTreeType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Request.QueryString["treeType"].IsNullOrWhiteSpace())
|
||||
{
|
||||
return TreeDefinitionCollection.Instance.FindTree<PartialViewsTree>().Tree.Alias;
|
||||
}
|
||||
return Request.QueryString["treeType"];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the original file name that the editor was loaded with
|
||||
/// </summary>
|
||||
@@ -89,9 +106,6 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
|
||||
AliasTxt.Text = _template.Alias;
|
||||
editorSource.Text = _template.Design;
|
||||
|
||||
ClientTools
|
||||
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<PartialViewsTree>().Tree.Alias)
|
||||
.SyncTree("-1,init," + _template.Path.Replace("-1,", ""), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -105,13 +119,13 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
|
||||
var s = sr.ReadToEnd();
|
||||
editorSource.Text = s;
|
||||
}
|
||||
|
||||
//string path = DeepLink.GetTreePathFromFilePath(file);
|
||||
//ClientTools
|
||||
// .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadPython>().Tree.Alias)
|
||||
// .SyncTree(path, false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ClientTools
|
||||
.SetActiveTreeType(CurrentTreeType)
|
||||
.SyncTree(TemplateTreeSyncPath, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +136,14 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
|
||||
//check if a templateId is assigned, meaning we are editing a template
|
||||
if (!Request.QueryString["templateID"].IsNullOrWhiteSpace())
|
||||
{
|
||||
_template = new Template(int.Parse(Request.QueryString["templateID"]));
|
||||
_template = new Template(int.Parse(Request.QueryString["templateID"]));
|
||||
TemplateTreeSyncPath = "-1,init," + _template.Path.Replace("-1,", "");
|
||||
}
|
||||
else if (!Request.QueryString["file"].IsNullOrWhiteSpace())
|
||||
{
|
||||
//we are editing a view (i.e. partial view)
|
||||
OriginalFileName = HttpUtility.UrlDecode(Request.QueryString["file"]);
|
||||
TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<%@ WebService Language="C#" CodeBehind="DocumentService.asmx.cs" Class="umbraco.webservices.documents.documentService" %>
|
||||
@@ -1 +0,0 @@
|
||||
<%@ WebService Language="C#" CodeBehind="FileService.asmx.cs" Class="umbraco.webservices.files.fileService" %>
|
||||
@@ -1 +0,0 @@
|
||||
<%@ WebService Language="C#" CodeBehind="MaintanceService.asmx.cs" Class="umbraco.webservices.maintenance.maintenanceService" %>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user