Compare commits

..

104 Commits

Author SHA1 Message Date
Emil Wangaa d51082f651 Bumps version 2017-03-30 10:27:54 +02:00
Stephan f2fb275b34 Fix post-merge issues 2017-03-30 09:58:27 +02:00
Shannon c5f388f6bc Merge remote-tracking branch 'origin/dev-v7' into dev-v7.6
# Conflicts:
#	build/NuSpecs/UmbracoCms.Core.nuspec
#	src/Umbraco.Tests/packages.config
#	src/Umbraco.Web/Umbraco.Web.csproj
#	src/Umbraco.Web/packages.config
#	src/UmbracoExamine/UmbracoExamine.csproj
#	src/umbraco.MacroEngines/packages.config
#	src/umbraco.MacroEngines/umbraco.MacroEngines.csproj
2017-03-30 17:03:51 +11:00
Shannon 4419af427b Merge branch 'dev-v7.6' of https://github.com/umbraco/Umbraco-CMS into dev-v7.6 2017-03-30 17:02:04 +11:00
Shannon dbdee5fc2c U4-9655 Html Agility pack assembly binding needs to be updated via code, just in case 2017-03-30 17:01:30 +11:00
Shannon 25f5179b29 updates nuspec 2017-03-30 16:36:54 +11:00
Shannon 1a03bd9624 Logs an error if the index is rebuilding due to being corrupt 2017-03-30 15:49:45 +11:00
Shannon 6a1d60c5a7 U4-9692 Update to Examine 0.1.82 2017-03-30 15:43:06 +11:00
Shannon 4fef17190f adds notes 2017-03-30 11:03:07 +11:00
Warren Buckley 143b9c605b Merge pull request #1841 from umbraco/temp-CON-1296
Adds support for loading uninitialized trees in the treepicker
2017-03-29 13:31:44 +01:00
Emil Wangaa db809f30fe Reverted hideHeader value to true in treepicker.controller.js - should not have been changed 2017-03-29 14:00:36 +02:00
Claus dcb50d10c4 Merge pull request #1842 from umbraco/temp-U4-9685
fixes: U4-9685 Disable picking folders in the partial view picker
2017-03-29 13:28:33 +02:00
Mads Rasmussen a91a67ed8d fixes: U4-9685 Disable picking folders in the partial view picker 2017-03-29 11:37:30 +02:00
Shannon 1f3e568a0d fixes merge issues 2017-03-29 19:11:55 +11:00
Shannon cb539e82d0 Merge remote-tracking branch 'origin/dev-v7' into dev-v7.6
# Conflicts:
#	build/UmbracoVersion.txt
#	src/SolutionInfo.cs
#	src/Umbraco.Core/Configuration/UmbracoVersion.cs
#	src/Umbraco.Core/Persistence/Repositories/DataTypeDefinitionRepository.cs
#	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
#	src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
#	src/UmbracoExamine/UmbracoMemberIndexer.cs
2017-03-29 18:11:51 +11:00
Shannon Deminick 1432d602ba Merge pull request #1838 from umbraco/temp-u4-9665
u4-9665
2017-03-29 18:06:28 +11:00
Shannon 841d2a7010 ensure change tracking is turned off on the dialog so the warning doesn't pop up 2017-03-29 17:51:31 +11:00
Shannon 7cdb48b6c9 bumps version 2017-03-29 16:35:37 +11:00
Shannon Deminick a667058422 Merge pull request #1828 from umbraco/temp-u4-9655
U4-9655 - update HtmlAgilityPack version in config
2017-03-29 16:33:37 +11:00
Shannon Deminick 4ffa6bb41b Merge pull request #1824 from umbraco/temp-u4-9617
U4-9617 - perf for published date
2017-03-29 16:29:31 +11:00
Shannon 77af16db55 Merge branch 'dev-v7' into temp-u4-9617
# Conflicts:
#	src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
2017-03-29 16:29:18 +11:00
Emil Wangaa 2a44b73056 Adds support for loading uninitialized trees in the treepicker - is needed for CON-1296 to work 2017-03-28 21:19:12 +02:00
Stephan 85d85fa587 Merge pull request #1819 from umbraco/temp-u4-9623
U4-9323 - fix DataTypeDefinitionRepository prevalues cache
2017-03-28 17:37:04 +02:00
Stephan bd27ed739d Merge pull request #1810 from umbraco/temp-U4-9633
Fixes: U4-9633 Update the offline dashboard to new content and styles
2017-03-28 17:28:47 +02:00
Stephan 3938868115 U4-9665 - create partial view macro with file 2017-03-28 17:22:18 +02:00
Claus 140792430f Merge pull request #1823 from umbraco/temp-U4-9647
fixes: U4-9647 7.6.0-beta: New template editor not set $dirty on code…
2017-03-28 15:15:43 +02:00
Claus c04cf1fe2e Merge pull request #1822 from umbraco/temp-U4-9654
fixes: U4-9654 7.6.0-beta: Legacy icons are not resolved in new listv…
2017-03-28 14:32:48 +02:00
Claus d1d83c84a0 fixes icons on listviews. 2017-03-28 14:27:05 +02:00
Claus 98acc50e13 Merge pull request #1830 from abryukhov/patch-7
Adding new UI keys for v7.6 features
2017-03-28 13:56:46 +02:00
Claus 1a0a02463e Merge pull request #1835 from umbraco/temp-U4-9680
fixes: U4-9680 The font change has made the tiny editor boxes a littl…
2017-03-28 13:53:23 +02:00
Claus 96c499a47e Merge pull request #1833 from umbraco/temp-U4-9679
fixes: U4-9679 Inserting partial views in the new template editor is …
2017-03-28 13:46:24 +02:00
Claus f7e8aefeab Merge pull request #1834 from umbraco/temp-u4-9666
U4-9666 - hide deprecated prop editors for macro params
2017-03-28 13:38:42 +02:00
Claus dfa803293f Merge pull request #1826 from umbraco/temp-U4-9671
Fixes: U4-9671 Fix failing client side unit tests for the content picker and template editor
2017-03-28 13:23:55 +02:00
Claus 7ade64f855 Merge pull request #1802 from umbraco/temp-U4-9637
U4-9637 addDashboardSection package action shouldn't add the dashboar…
2017-03-28 13:12:26 +02:00
Shannon Deminick 346e8dcaf0 Merge pull request #1820 from umbraco/temp-u4-9615
U4-9615 - implement way to find listviews in path fast
2017-03-28 16:05:25 +11:00
Shannon ddfd07bf4a Fixes count query 2017-03-28 16:04:06 +11:00
Shannon a9fe46da0c makes HasContainerInPath public 2017-03-28 15:55:45 +11:00
Shannon aca1f0d186 Adds comments 2017-03-28 15:46:33 +11:00
Shannon 9eb415d398 U4-9682 Repository's have a double nested DeepCloneRuntimeCacheProvider set which means all entities are double deep cloned in and out of the cache and ensures that PreValueCollections are not also manually deep cloned. 2017-03-28 15:41:55 +11:00
Shannon 8f6b728534 Moves paging value to a constant 2017-03-28 13:37:10 +11:00
Shannon Deminick 2e0c09ab39 Merge pull request #1827 from umbraco/temp-u4-9598
U4-9598 - fix paging in UmbracoContentIndexer
2017-03-28 13:31:37 +11:00
Shannon Deminick f211344786 Merge pull request #1825 from umbraco/temp-u4-9604
U4-9604 - fix current HttpContext in ManyObjectsResolverBase
2017-03-28 13:11:09 +11:00
Mads Rasmussen f8764cdd20 fixes: U4-9680 The font change has made the tiny editor boxes a little to small. 2017-03-27 13:05:46 +02:00
Stephan 1d17bfd59a U4-9666 - hide deprecated prop editors for macro params 2017-03-27 12:25:58 +02:00
Mads Rasmussen 98ad6ad366 fixes: U4-9679 Inserting partial views in the new template editor is broken 2017-03-27 11:27:58 +02:00
Stephan 68702b98f5 U4-9604 - add nullcheck 2017-03-27 08:52:10 +02:00
Stephan f93caf277b Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into temp-u4-9604 2017-03-27 08:47:40 +02:00
Shannon Deminick 32db674397 Merge pull request #1813 from umbraco/temp-U4-9645
Fixes: U4-9645 RTE link dialogs should use the new picker dialog
2017-03-27 14:25:07 +11:00
Shannon Deminick e0a7698780 Merge pull request #1821 from andyneil/dev-v7-lang-fixes
Dev v7 lang fixes
2017-03-27 14:20:41 +11:00
Shannon Deminick 783c74d3ba Merge pull request #1829 from abryukhov/patch-6
Adding missing keys before v7.6
2017-03-27 14:12:08 +11:00
Alexander Bryukhov 96d7bc3898 Adding new UI keys for v7.6 features 2017-03-24 22:10:09 +07:00
Alexander Bryukhov 21963c03a2 Adding missing keys before v7.6 2017-03-24 21:59:02 +07:00
Stephan a2a9794fdb U4-9655 - update HtmlAgilityPack version in config 2017-03-24 14:47:27 +01:00
Stephan 879a132077 U4-9598 - fix paging in UmbracoContentIndexer 2017-03-24 13:05:06 +01:00
Mads Rasmussen 9650d314c6 fix failing unit tests for template editor 2017-03-24 11:35:44 +01:00
Mads Rasmussen fcc0c452bb add mock for getEntitiesByIds POST request 2017-03-24 11:34:08 +01:00
Stephan 606ebcae92 U4-9604 - fix current HttpContext in ManyObjectsResolverBase 2017-03-24 11:07:15 +01:00
Stephan af10ae9e34 U4-9617 - fix 2017-03-23 18:00:58 +01:00
Stephan a23c150738 U4-9617 - fix 2017-03-23 17:51:30 +01:00
Stephan 085a678266 U4-9617 - perf for published date 2017-03-23 17:44:07 +01:00
Mads Rasmussen c73fb6144b fixes: U4-9647 7.6.0-beta: New template editor not set $dirty on code change 2017-03-23 16:31:50 +01:00
mikkelhm bfd201efcc Bump version to 7.6-Beta5 2017-03-23 15:46:18 +01:00
Mads Rasmussen 5a2b4f031b fixes: U4-9654 7.6.0-beta: Legacy icons are not resolved in new listview picker 2017-03-23 15:00:30 +01:00
andyneil cf7cafeb4c Update wording to be more grammatically correct 2017-03-23 13:41:48 +00:00
andyneil 870657affa Update wording to be more grammatically correct 2017-03-23 13:41:23 +00:00
Stephan fe11d4770d U4-9615 - implement way to find listviews in path fast 2017-03-23 14:07:45 +01:00
Mads Rasmussen ac75d8148d fix color on tree header checkmark 2017-03-23 11:46:51 +01:00
Mads Rasmussen 4a32cddf08 make tree search box full width 2017-03-23 11:37:13 +01:00
Mads Rasmussen 7461e7c55b align styling of error and success messages for content (move/copy) and media (move) 2017-03-23 11:36:51 +01:00
Stephan c8fe9030c7 U4-9323 - fix DataTypeDefinitionRepository prevalues cache 2017-03-23 10:39:28 +01:00
Shannon 2ae236e98d Adds xml transform for partial view tree types 2017-03-23 18:48:41 +11:00
Shannon 802fb95784 Fixes issue with renaming PartialViewMacro and PartialViewTree controller names - this also fixes an issue that we were looking up these types over and over again and now we just do it once. 2017-03-23 18:44:28 +11:00
Shannon 0297fdb32f Fixes a bunch of the JS unit tests 2017-03-23 13:19:37 +11:00
Shannon Deminick 5bede4bf9f Merge pull request #1816 from umbraco/temp-u4-9664
u4-9664 - Enables HasAccess on the MediaTreeController to use a udi for checkin…
2017-03-23 12:54:11 +11:00
Shannon d37106576d Adds null checks to the ContentTreeController too 2017-03-23 12:53:48 +11:00
Shannon ed0f0f7942 Merge remote-tracking branch 'origin/dev-v7' into dev-v7.6
# Conflicts:
#	src/Umbraco.Core/Configuration/CoreDebug.cs
#	src/Umbraco.Core/Publishing/PublishingStrategy.cs
#	src/Umbraco.Core/Umbraco.Core.csproj
2017-03-23 12:24:16 +11:00
Shannon Deminick 3d81c73495 Merge pull request #1814 from umbraco/temp-u4-9658
U4-9658 - detect umbraco.config rogue content types, and fix
2017-03-23 12:16:10 +11:00
Shannon e7a540e717 Proper Exception handling 2017-03-23 12:15:14 +11:00
Shannon Deminick bb886c237e Merge pull request #1815 from umbraco/temp-u4-9610
U4-9610 - fix nullref in BulkPublishController
2017-03-23 11:28:03 +11:00
Shannon 6c1e271fa8 Fixes styling and fixing error message quotes to make it more clear 2017-03-23 11:27:46 +11:00
Shannon Deminick 4c1b807e4f Merge pull request #1812 from umbraco/temp-u4-6811
U4-6811 - fix preview set deletion
2017-03-23 11:06:33 +11:00
Shannon 3b22c0cdd7 Catches correct expected exception type, we'll log for other non expected errors. 2017-03-23 11:06:06 +11:00
mikkelhm 31d8f49d3b Enables HasAccess on the MediaTreeController to use a udi for checking access 2017-03-22 20:25:15 +01:00
Stephan 631404743f U4-9610 - fix nullref in BulkPublishController 2017-03-22 14:44:39 +01:00
Stephan d5c9639170 U4-9658 - detect umbraco.config rogue content types, and fix 2017-03-22 13:58:40 +01:00
Mads Rasmussen b90cccbfff implement mini list view for media copy 2017-03-22 13:45:09 +01:00
Stephan 94b7c36d62 U4-6811 - fix preview set deletion 2017-03-22 12:16:33 +01:00
Mads Rasmussen 22f0641c54 implement mini list view for url picker 2017-03-22 11:58:11 +01:00
Mads Rasmussen e465a937c5 Implement mini list view for generic move overlay 2017-03-22 11:26:53 +01:00
Mads Rasmussen d2164bc94d Implement mini list view for generic copy overlay 2017-03-22 11:26:08 +01:00
Mads Rasmussen df9d09725b add entity helper so we don't have to hard code these values all over the place 2017-03-22 11:25:00 +01:00
Mads Rasmussen 0a56f46b12 Implement mini list view for content copy dialog 2017-03-22 10:44:55 +01:00
Mads Rasmussen 972f9b3546 implement mini list view for content move dialog 2017-03-22 10:43:10 +01:00
Mads Rasmussen 28ab176466 Fixes: U4-9633 Update the offline dashboard to new content and styles 2017-03-21 15:28:55 +01:00
Claus 532b177d2e Merge pull request #1793 from Phosworks/U4-8418
Fixes jquery selector bug, http://issues.umbraco.org/issue/U4-8418
2017-03-20 14:43:43 +01:00
Shannon 4093fd9b79 U4-9637 addDashboardSection package action shouldn't add the dashboard if it already exists 2017-03-18 16:52:30 +11:00
Shannon 3d6f91cbef Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2017-03-18 15:47:56 +11:00
Shannon fffd508bb2 missing null check 2017-03-18 15:44:57 +11:00
Stephan 333b35d8b9 U4-9606 - hard cap of 8 minidump files 2017-03-16 15:51:19 +01:00
Claus 890673a197 Merge pull request #1797 from umbraco/temp-u4-9606
U4-9606 - New DumpOnTimeoutThreadAbort debug option
2017-03-16 15:38:01 +01:00
Stephan 27539d4aad U4-9606 - always minidump on Monitor.ReliableEnter exceptions 2017-03-16 14:04:28 +01:00
Stephan f7f23015d0 U4-9606 - missing file 2017-03-15 09:39:35 +01:00
Stephan e432b7061d U4-9606 - New DumpOnTimeoutThreadAbort debug option 2017-03-14 19:02:33 +01:00
Wincent fc92d40b3a Fixes jquery selector bug, http://issues.umbraco.org/issue/U4-8418 2017-03-13 11:25:02 +01:00
116 changed files with 1761 additions and 925 deletions
+1 -1
View File
@@ -33,7 +33,7 @@
<dependency id="ClientDependency-Mvc5" version="[1.8.0.0, 2.0.0)" />
<dependency id="AutoMapper" version="[3.3.1, 4.0.0)" />
<dependency id="Newtonsoft.Json" version="[9.0.1, 10.0.0)" />
<dependency id="Examine" version="[0.1.81, 1.0.0)" />
<dependency id="Examine" version="[0.1.82, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.5.2, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.8.2, 5.0.0)" />
<dependency id="semver" version="[2.0.4, 3.0.0)" />
+2 -2
View File
@@ -58,7 +58,7 @@
<httpRuntime xdt:Transform="InsertIfMissing" />
<httpRuntime maxRequestLength="51200" fcnMode="Single" xdt:Transform="SetAttributes(fcnMode,maxRequestLength)" />
<httpRuntime targetFramework="4.5" xdt:Locator="Condition(count(@targetFramework) != 1)" xdt:Transform="SetAttributes(targetFramework)" />
<membership defaultProvider="DefaultMembershipProvider" xdt:Locator="Match(defaultProvider)" xdt:Transform="Remove" />
<roleManager defaultProvider="DefaultRoleProvider" xdt:Locator="Match(defaultProvider)" xdt:Transform="Remove"/>
<profile defaultProvider="DefaultProfileProvider" xdt:Locator="Match(defaultProvider)" xdt:Transform="Remove"/>>
@@ -337,7 +337,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Insert">
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.9.0" newVersion="1.4.9.0" />
<bindingRedirect oldVersion="0.0.0.0-1.4.9.5" newVersion="1.4.9.5" />
</dependentAssembly>
<dependentAssembly xdt:Transform="Insert">
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
+17 -7
View File
@@ -34,10 +34,15 @@
xdt:Transform="SetAttributes()" />
<add application="settings" alias="templates" title="Templates" type="Umbraco.Web.Trees.TemplatesTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder-open" sortOrder="1"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="settings" alias="partialViews" title="Partial Views" silent="false" initialize="true" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.PartialViewsTree, umbraco" sortOrder="2"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
xdt:Transform="SetAttributes()" />
<add application="settings" alias="partialViews" type="Umbraco.Web.Trees.PartialViewsTree, umbraco"
xdt:Locator="Match(application,alias,type)"
xdt:Transform="Remove()" />
<add application="settings" alias="partialViews" title="Partial Views" silent="false" initialize="true" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.PartialViewsTreeController, umbraco" sortOrder="2"
xdt:Locator="Match(application,alias)"
xdt:Transform="InsertIfMissing" />
<add application="settings" alias="scripts" title="Scripts" type="umbraco.loadScripts, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
@@ -84,9 +89,14 @@
<add application="developer" alias="xslt" title="XSLT Files" type="umbraco.loadXslt, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="5"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTree, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTree, umbraco"
xdt:Locator="Match(application,alias,type)"
xdt:Transform="Remove()" />
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTreeController, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder"
xdt:Locator="Match(application,alias)"
xdt:Transform="InsertIfMissing" />
<add application="developer" alias="python"
xdt:Locator="Match(application,alias)"
xdt:Transform="Remove" />
+1 -1
View File
@@ -1,3 +1,3 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.6.0
beta04
beta06
+1 -1
View File
@@ -12,4 +12,4 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.6.0")]
[assembly: AssemblyInformationalVersion("7.6.0-beta04")]
[assembly: AssemblyInformationalVersion("7.6.0-beta06")]
+12 -4
View File
@@ -17,9 +17,12 @@ namespace Umbraco.Core
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
private static readonly Regex Log4NetAssemblyPattern = new Regex("log4net, Version=([\\d\\.]+?), Culture=neutral, PublicKeyToken=null", RegexOptions.Compiled);
private static readonly Regex Log4NetAssemblyPattern = new Regex("log4net, Version=([\\d\\.]+?), Culture=neutral, PublicKeyToken=null");
private const string Log4NetReplacement = "log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a";
private static readonly Regex HtmlAgilityAssemblyPattern = new Regex("HtmlAgilityPack, Version=([\\d\\.]+?), Culture=neutral, PublicKeyToken=bd319b19eaf3b43a");
private const string HtmlAgilityReplacement = "HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a";
/// <summary>
/// This is used to do an assembly binding redirect via code - normally required due to signature changes in assemblies
/// </summary>
@@ -28,13 +31,18 @@ namespace Umbraco.Core
/// <returns></returns>
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
//log4net:
// Use regex to match and replace
//log4net:
if (Log4NetAssemblyPattern.IsMatch(args.Name) && args.Name != Log4NetReplacement)
{
return Assembly.Load(Log4NetAssemblyPattern.Replace(args.Name, Log4NetReplacement));
}
//HtmlAgility:
if (HtmlAgilityAssemblyPattern.IsMatch(args.Name) && args.Name != HtmlAgilityReplacement)
{
return Assembly.Load(HtmlAgilityAssemblyPattern.Replace(args.Name, HtmlAgilityReplacement));
}
//AutoMapper:
// ensure the assembly is indeed AutoMapper and that the PublicKeyToken is null before trying to Load again
// do NOT just replace this with 'return Assembly', as it will cause an infinite loop -> stackoverflow
@@ -26,6 +26,9 @@ namespace Umbraco.Core.Cache
public DeepCloneRuntimeCacheProvider(IRuntimeCacheProvider innerProvider)
{
if (innerProvider.GetType() == typeof(DeepCloneRuntimeCacheProvider))
throw new InvalidOperationException("A " + typeof(DeepCloneRuntimeCacheProvider) + " cannot wrap another instance of " + typeof(DeepCloneRuntimeCacheProvider));
InnerProvider = innerProvider;
}
@@ -105,9 +108,11 @@ namespace Umbraco.Core.Cache
var value = result.Value; // force evaluation now - this may throw if cacheItem throws, and then nothing goes into cache
if (value == null) return null; // do not store null values (backward compat)
//Clone/reset to go into the cache
return CheckCloneableAndTracksChanges(value);
}, timeout, isSliding, priority, removedCallback, dependentFiles);
//Clone/reset to go out of the cache
return CheckCloneableAndTracksChanges(cached);
}
@@ -18,10 +18,14 @@ namespace Umbraco.Core.Configuration
{
var appSettings = System.Configuration.ConfigurationManager.AppSettings;
LogUncompletedScopes = string.Equals("true", appSettings["Umbraco.CoreDebug.LogUncompletedScopes"], StringComparison.OrdinalIgnoreCase);
DumpOnTimeoutThreadAbort = string.Equals("true", appSettings["Umbraco.CoreDebug.DumpOnTimeoutThreadAbort"], StringComparison.OrdinalIgnoreCase);
}
// when true, Scope logs the stack trace for any scope that gets disposed without being completed.
// this helps troubleshooting rogue scopes that we forget to complete
public bool LogUncompletedScopes { get; private set; }
// when true, the Logger creates a minidump of w3wp in ~/App_Data/MiniDump whenever it logs
// an error due to a ThreadAbortException that is due to a timeout.
public bool DumpOnTimeoutThreadAbort { get; private set; }
}
}
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return "beta04"; } }
public static string CurrentComment { get { return "beta06"; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
+135
View File
@@ -0,0 +1,135 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Umbraco.Core.IO;
namespace Umbraco.Core.Diagnostics
{
// taken from https://blogs.msdn.microsoft.com/dondu/2010/10/24/writing-minidumps-in-c/
// and https://blogs.msdn.microsoft.com/dondu/2010/10/31/writing-minidumps-from-exceptions-in-c/
// which itself got it from http://blog.kalmbach-software.de/2008/12/13/writing-minidumps-in-c/
internal static class MiniDump
{
private static readonly object LockO = new object();
[Flags]
public enum Option : uint
{
// From dbghelp.h:
Normal = 0x00000000,
WithDataSegs = 0x00000001,
WithFullMemory = 0x00000002,
WithHandleData = 0x00000004,
FilterMemory = 0x00000008,
ScanMemory = 0x00000010,
WithUnloadedModules = 0x00000020,
WithIndirectlyReferencedMemory = 0x00000040,
FilterModulePaths = 0x00000080,
WithProcessThreadData = 0x00000100,
WithPrivateReadWriteMemory = 0x00000200,
WithoutOptionalData = 0x00000400,
WithFullMemoryInfo = 0x00000800,
WithThreadInfo = 0x00001000,
WithCodeSegs = 0x00002000,
WithoutAuxiliaryState = 0x00004000,
WithFullAuxiliaryState = 0x00008000,
WithPrivateWriteCopyMemory = 0x00010000,
IgnoreInaccessibleMemory = 0x00020000,
ValidTypeFlags = 0x0003ffff,
}
//typedef struct _MINIDUMP_EXCEPTION_INFORMATION {
// DWORD ThreadId;
// PEXCEPTION_POINTERS ExceptionPointers;
// BOOL ClientPointers;
//} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
[StructLayout(LayoutKind.Sequential, Pack = 4)] // Pack=4 is important! So it works also for x64!
public struct MiniDumpExceptionInformation
{
public uint ThreadId;
public IntPtr ExceptionPointers;
[MarshalAs(UnmanagedType.Bool)]
public bool ClientPointers;
}
//BOOL
//WINAPI
//MiniDumpWriteDump(
// __in HANDLE hProcess,
// __in DWORD ProcessId,
// __in HANDLE hFile,
// __in MINIDUMP_TYPE DumpType,
// __in_opt PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
// __in_opt PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
// __in_opt PMINIDUMP_CALLBACK_INFORMATION CallbackParam
// );
// Overload requiring MiniDumpExceptionInformation
[DllImport("dbghelp.dll", EntryPoint = "MiniDumpWriteDump", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
private static extern bool MiniDumpWriteDump(IntPtr hProcess, uint processId, SafeHandle hFile, uint dumpType, ref MiniDumpExceptionInformation expParam, IntPtr userStreamParam, IntPtr callbackParam);
// Overload supporting MiniDumpExceptionInformation == NULL
[DllImport("dbghelp.dll", EntryPoint = "MiniDumpWriteDump", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
private static extern bool MiniDumpWriteDump(IntPtr hProcess, uint processId, SafeHandle hFile, uint dumpType, IntPtr expParam, IntPtr userStreamParam, IntPtr callbackParam);
[DllImport("kernel32.dll", EntryPoint = "GetCurrentThreadId", ExactSpelling = true)]
private static extern uint GetCurrentThreadId();
private static bool Write(SafeHandle fileHandle, Option options, bool withException = false)
{
var currentProcess = Process.GetCurrentProcess();
var currentProcessHandle = currentProcess.Handle;
var currentProcessId = (uint)currentProcess.Id;
MiniDumpExceptionInformation exp;
exp.ThreadId = GetCurrentThreadId();
exp.ClientPointers = false;
exp.ExceptionPointers = IntPtr.Zero;
if (withException)
exp.ExceptionPointers = Marshal.GetExceptionPointers();
var bRet = exp.ExceptionPointers == IntPtr.Zero
? MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint) options, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)
: MiniDumpWriteDump(currentProcessHandle, currentProcessId, fileHandle, (uint) options, ref exp, IntPtr.Zero, IntPtr.Zero);
return bRet;
}
public static bool Dump(Option options = Option.WithFullMemory, bool withException = false)
{
lock (LockO)
{
// work around "stack trace is not available while minidump debugging",
// by making sure a local var (that we can inspect) contains the stack trace.
// getting the call stack before it is unwound would require a special exception
// filter everywhere in our code = not!
var stacktrace = withException ? Environment.StackTrace : string.Empty;
var filepath = IOHelper.MapPath("~/App_Data/MiniDump");
if (Directory.Exists(filepath) == false)
Directory.CreateDirectory(filepath);
var filename = Path.Combine(filepath, string.Format("{0:yyyyMMddTHHmmss}.{1}.dmp", DateTime.UtcNow, Guid.NewGuid().ToString("N").Substring(0, 4)));
using (var stream = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.Write))
{
return Write(stream.SafeFileHandle, options, withException);
}
}
}
public static bool OkToDump()
{
lock (LockO)
{
var filepath = IOHelper.MapPath("~/App_Data/MiniDump");
if (Directory.Exists(filepath) == false) return true;
var count = Directory.GetFiles(filepath, "*.dmp").Length;
return count < 8;
}
}
}
}
+39 -5
View File
@@ -7,6 +7,8 @@ using System.Threading;
using System.Web;
using log4net;
using log4net.Config;
using Umbraco.Core.Configuration;
using Umbraco.Core.Diagnostics;
namespace Umbraco.Core.Logging
{
@@ -57,23 +59,55 @@ namespace Umbraco.Core.Logging
internal ILog LoggerFor(object getTypeFromInstance)
{
if (getTypeFromInstance == null) throw new ArgumentNullException("getTypeFromInstance");
return LogManager.GetLogger(getTypeFromInstance.GetType());
}
public void Error(Type callingType, string message, Exception exception)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null) return;
var dump = false;
if (IsTimeoutThreadAbortException(exception))
{
message += "\r\nThe thread has been aborted, because the request has timed out.";
// dump if configured, or if stacktrace contains Monitor.ReliableEnter
dump = UmbracoConfig.For.CoreDebug().DumpOnTimeoutThreadAbort || IsMonitorEnterThreadAbortException(exception);
// dump if it is ok to dump (might have a cap on number of dump...)
dump &= MiniDump.OkToDump();
}
logger.Error(message, exception);
if (dump)
{
try
{
var dumped = MiniDump.Dump(withException: true);
message += dumped
? "\r\nA minidump was created in App_Data/MiniDump"
: "\r\nFailed to create a minidump";
}
catch (Exception e)
{
message += string.Format("\r\nFailed to create a minidump ({0}: {1})", e.GetType().FullName, e.Message);
}
}
logger.Error(message, exception);
}
private static bool IsMonitorEnterThreadAbortException(Exception exception)
{
var abort = exception as ThreadAbortException;
if (abort == null) return false;
var stacktrace = abort.StackTrace;
return stacktrace.Contains("System.Threading.Monitor.ReliableEnter");
}
private static bool IsTimeoutThreadAbortException(Exception exception)
{
var abort = exception as ThreadAbortException;
@@ -105,7 +139,7 @@ namespace Umbraco.Core.Logging
if (showHttpTrace && HttpContext.Current != null)
{
HttpContext.Current.Trace.Warn(callingType.Name, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()));
}
}
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsWarnEnabled == false) return;
@@ -122,7 +156,7 @@ namespace Umbraco.Core.Logging
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsWarnEnabled == false) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.WarnFormat((message) + ". Exception: " + e, executedParams);
logger.WarnFormat((message) + ". Exception: " + e, executedParams);
}
/// <summary>
+54 -4
View File
@@ -1,5 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Models
{
@@ -84,16 +86,64 @@ namespace Umbraco.Core.Models
public string Type { get; set; }
private Type _runtimeType;
/// <summary>
/// Returns the CLR type based on it's assembly name stored in the config
/// </summary>
/// <returns></returns>
public Type GetRuntimeType()
{
return _runtimeType ?? (_runtimeType = System.Type.GetType(Type));
}
if (_runtimeType != null)
return _runtimeType;
_runtimeType = TryGetType(Type);
return _runtimeType;
}
/// <summary>
/// Used to try to get and cache the tree type
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
internal static Type TryGetType(string type)
{
try
{
return ResolvedTypes.GetOrAdd(type, s =>
{
var result = System.Type.GetType(type);
if (result != null)
{
return result;
}
//we need to implement a bit of a hack here due to some trees being renamed and backwards compat
var parts = type.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 2)
{
if (parts[1].Trim() == "umbraco" && parts[0].StartsWith("Umbraco.Web.Trees") && parts[0].EndsWith("Controller") == false)
{
//if it's one of our controllers but it's not suffixed with "Controller" then add it and try again
var tempType = parts[0] + "Controller, umbraco";
result = System.Type.GetType(tempType);
if (result != null)
{
return result;
}
}
}
throw new InvalidOperationException("Could not resolve type");
});
}
catch (InvalidOperationException)
{
//swallow, this is our own exception, couldn't find the type
return null;
}
}
private static readonly ConcurrentDictionary<string, Type> ResolvedTypes = new ConcurrentDictionary<string, Type>();
}
}
+3
View File
@@ -274,6 +274,9 @@ namespace Umbraco.Core.Models
/// </summary>
public bool HasPublishedVersion { get { return PublishedVersionGuid != default(Guid); } }
[IgnoreDataMember]
internal DateTime PublishedDate { get; set; }
/// <summary>
/// Changes the Trashed state of the content object
/// </summary>
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Models.PublishedContent
}
if (contentType == null)
throw new Exception(string.Format("ContentTypeService failed to find a {0} type with alias \"{1}\".",
throw new InvalidOperationException(string.Format("ContentTypeService failed to find a {0} type with alias \"{1}\".",
itemType.ToString().ToLower(), alias));
return new PublishedContentType(contentType);
@@ -19,5 +19,8 @@ namespace Umbraco.Core.Models.Rdbms
[Column("newest")]
public bool Newest { get; set; }
[Column("updateDate")]
public DateTime VersionDate { get; set; }
}
}
@@ -22,6 +22,7 @@ namespace Umbraco.Core.ObjectResolution
private readonly string _httpContextKey;
private readonly List<Type> _instanceTypes = new List<Type>();
private IEnumerable<TResolved> _sortedValues;
private readonly Func<HttpContextBase> _httpContextGetter;
private int _defaultPluginWeight = 100;
@@ -42,12 +43,7 @@ namespace Umbraco.Core.ObjectResolution
if (logger == null) throw new ArgumentNullException("logger");
CanResolveBeforeFrozen = false;
if (scope == ObjectLifetimeScope.HttpRequest)
{
if (HttpContext.Current == null)
throw new InvalidOperationException("Use alternative constructor accepting a HttpContextBase object in order to set the lifetime scope to HttpRequest when HttpContext.Current is null");
CurrentHttpContext = new HttpContextWrapper(HttpContext.Current);
}
_httpContextGetter = () => new HttpContextWrapper(HttpContext.Current);
ServiceProvider = serviceProvider;
Logger = logger;
@@ -84,7 +80,7 @@ namespace Umbraco.Core.ObjectResolution
LifetimeScope = ObjectLifetimeScope.HttpRequest;
_httpContextKey = GetType().FullName;
ServiceProvider = serviceProvider;
CurrentHttpContext = httpContext;
_httpContextGetter = () => httpContext;
_instanceTypes = new List<Type>();
InitializeAppInstances();
@@ -160,7 +156,16 @@ namespace Umbraco.Core.ObjectResolution
/// Gets or sets the <see cref="HttpContextBase"/> used to initialize this object, if any.
/// </summary>
/// <remarks>If not null, then <c>LifetimeScope</c> will be <c>ObjectLifetimeScope.HttpRequest</c>.</remarks>
protected HttpContextBase CurrentHttpContext { get; private set; }
protected HttpContextBase CurrentHttpContext
{
get
{
var context = _httpContextGetter == null ? null : _httpContextGetter();
if (context == null)
throw new InvalidOperationException("Cannot use this resolver with lifetime 'HttpRequest' when there is no current HttpContext. Either use the ctor accepting an HttpContextBase, or use the resolver from within a request exclusively.");
return context;
}
}
/// <summary>
/// Returns the service provider used to instantiate objects
@@ -196,7 +201,7 @@ namespace Umbraco.Core.ObjectResolution
/// <summary>
/// Gets or sets the default type weight.
/// </summary>
/// <remarks>Determines the weight of types that do not have a <c>WeightAttribute</c> set on
/// <remarks>Determines the weight of types that do not have a <c>WeightAttribute</c> set on
/// them, when calling <c>GetSortedValues</c>.</remarks>
protected virtual int DefaultPluginWeight
{
@@ -276,7 +281,7 @@ namespace Umbraco.Core.ObjectResolution
/// Removes a type.
/// </summary>
/// <param name="value">The type to remove.</param>
/// <exception cref="InvalidOperationException">the resolver does not support removing types, or
/// <exception cref="InvalidOperationException">the resolver does not support removing types, or
/// the type is not a valid type for the resolver.</exception>
public virtual void RemoveType(Type value)
{
@@ -296,7 +301,7 @@ namespace Umbraco.Core.ObjectResolution
/// Removes a type.
/// </summary>
/// <typeparam name="T">The type to remove.</typeparam>
/// <exception cref="InvalidOperationException">the resolver does not support removing types, or
/// <exception cref="InvalidOperationException">the resolver does not support removing types, or
/// the type is not a valid type for the resolver.</exception>
public void RemoveType<T>()
where T : TResolved
@@ -309,7 +314,7 @@ namespace Umbraco.Core.ObjectResolution
/// </summary>
/// <param name="types">The types to add.</param>
/// <remarks>The types are appended at the end of the list.</remarks>
/// <exception cref="InvalidOperationException">the resolver does not support adding types, or
/// <exception cref="InvalidOperationException">the resolver does not support adding types, or
/// a type is not a valid type for the resolver, or a type is already in the collection of types.</exception>
protected void AddTypes(IEnumerable<Type> types)
{
@@ -336,7 +341,7 @@ namespace Umbraco.Core.ObjectResolution
/// </summary>
/// <param name="value">The type to add.</param>
/// <remarks>The type is appended at the end of the list.</remarks>
/// <exception cref="InvalidOperationException">the resolver does not support adding types, or
/// <exception cref="InvalidOperationException">the resolver does not support adding types, or
/// the type is not a valid type for the resolver, or the type is already in the collection of types.</exception>
public virtual void AddType(Type value)
{
@@ -362,7 +367,7 @@ namespace Umbraco.Core.ObjectResolution
/// </summary>
/// <typeparam name="T">The type to add.</typeparam>
/// <remarks>The type is appended at the end of the list.</remarks>
/// <exception cref="InvalidOperationException">the resolver does not support adding types, or
/// <exception cref="InvalidOperationException">the resolver does not support adding types, or
/// the type is not a valid type for the resolver, or the type is already in the collection of types.</exception>
public void AddType<T>()
where T : TResolved
@@ -404,7 +409,7 @@ namespace Umbraco.Core.ObjectResolution
/// </summary>
/// <param name="index">The zero-based index at which the type should be inserted.</param>
/// <param name="value">The type to insert.</param>
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// the type is not a valid type for the resolver, or the type is already in the collection of types.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is out of range.</exception>
public virtual void InsertType(int index, Type value)
@@ -430,7 +435,7 @@ namespace Umbraco.Core.ObjectResolution
/// Inserts a type at the beginning of the list.
/// </summary>
/// <param name="value">The type to insert.</param>
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// the type is not a valid type for the resolver, or the type is already in the collection of types.</exception>
public virtual void InsertType(Type value)
{
@@ -464,7 +469,7 @@ namespace Umbraco.Core.ObjectResolution
/// </summary>
/// <param name="existingType">The existing type before which to insert.</param>
/// <param name="value">The type to insert.</param>
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// one of the types is not a valid type for the resolver, or the existing type is not in the collection,
/// or the new type is already in the collection of types.</exception>
public virtual void InsertTypeBefore(Type existingType, Type value)
@@ -498,7 +503,7 @@ namespace Umbraco.Core.ObjectResolution
/// </summary>
/// <typeparam name="TExisting">The existing type before which to insert.</typeparam>
/// <typeparam name="T">The type to insert.</typeparam>
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// <exception cref="InvalidOperationException">the resolver does not support inserting types, or
/// one of the types is not a valid type for the resolver, or the existing type is not in the collection,
/// or the new type is already in the collection of types.</exception>
public void InsertTypeBefore<TExisting, T>()
@@ -72,6 +72,9 @@ namespace Umbraco.Core.Persistence.Factories
content.PublishedVersionGuid = publishedDto == null
? (dto.DocumentPublishedReadOnlyDto == null ? default(Guid) : dto.DocumentPublishedReadOnlyDto.VersionId)
: publishedDto.VersionId;
content.PublishedDate = publishedDto == null
? (dto.DocumentPublishedReadOnlyDto == null ? default(DateTime) : dto.DocumentPublishedReadOnlyDto.VersionDate)
: publishedDto.VersionDate;
//on initial construction we don't want to have dirty properties tracked
// http://issues.umbraco.org/issue/U4-1946
@@ -513,11 +513,13 @@ namespace Umbraco.Core.Persistence.Repositories
dto.DocumentPublishedReadOnlyDto = new DocumentPublishedReadOnlyDto
{
VersionId = dto.VersionId,
VersionDate = dto.UpdateDate,
Newest = true,
NodeId = dto.NodeId,
Published = true
Published = true
};
((Content)entity).PublishedVersionGuid = dto.VersionId;
((Content) entity).PublishedVersionGuid = dto.VersionId;
((Content) entity).PublishedDate = dto.UpdateDate;
}
entity.ResetDirtyProperties();
@@ -688,22 +690,26 @@ namespace Umbraco.Core.Persistence.Repositories
dto.DocumentPublishedReadOnlyDto = new DocumentPublishedReadOnlyDto
{
VersionId = dto.VersionId,
VersionDate = dto.UpdateDate,
Newest = true,
NodeId = dto.NodeId,
Published = true
};
((Content)entity).PublishedVersionGuid = dto.VersionId;
((Content) entity).PublishedVersionGuid = dto.VersionId;
((Content) entity).PublishedDate = dto.UpdateDate;
}
else if (publishedStateChanged)
{
dto.DocumentPublishedReadOnlyDto = new DocumentPublishedReadOnlyDto
{
VersionId = default(Guid),
VersionId = default (Guid),
VersionDate = default (DateTime),
Newest = false,
NodeId = dto.NodeId,
Published = false
};
((Content)entity).PublishedVersionGuid = default(Guid);
((Content) entity).PublishedVersionGuid = default(Guid);
((Content) entity).PublishedDate = default (DateTime);
}
entity.ResetDirtyProperties();
@@ -975,7 +981,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
}
//order by update date DESC, if there is corrupted published flags we only want the latest!
var publishedSql = new Sql(@"SELECT cmsDocument.nodeId, cmsDocument.published, cmsDocument.versionId, cmsDocument.newest
var publishedSql = new Sql(@"SELECT cmsDocument.nodeId, cmsDocument.published, cmsDocument.versionId, cmsDocument.updateDate, cmsDocument.newest
FROM cmsDocument INNER JOIN cmsContentVersion ON cmsContentVersion.VersionId = cmsDocument.versionId
WHERE cmsDocument.published = 1 AND cmsDocument.nodeId IN
(" + parsedOriginalSql + @")
@@ -1252,5 +1252,19 @@ WHERE cmsContentType." + aliasColumn + @" LIKE @pattern",
while (aliases.Contains(test = alias + i)) i++;
return test;
}
/// <summary>
/// Given the path of a content item, this will return true if the content item exists underneath a list view content item
/// </summary>
/// <param name="contentPath"></param>
/// <returns></returns>
public bool HasContainerInPath(string contentPath)
{
var ids = contentPath.Split(',').Select(int.Parse);
var sql = new Sql(@"SELECT COUNT(*) FROM cmsContentType
INNER JOIN cmsContent ON cmsContentType.nodeId=cmsContent.contentType
WHERE cmsContent.nodeId IN (@ids) AND cmsContentType.isContainer=@isContainer", new { ids, isContainer = true });
return Database.ExecuteScalar<int>(sql) > 0;
}
}
}
@@ -276,47 +276,33 @@ AND umbracoNode.id <> @id",
public PreValueCollection GetPreValuesCollectionByDataTypeId(int dataTypeId)
{
var cached = IsolatedCache.GetCacheItemsByKeySearch<PreValueCollection>(GetPrefixedCacheKey(dataTypeId));
if (cached != null && cached.Any())
{
//return from the cache, ensure it's a cloned result
return (PreValueCollection)cached.First().DeepClone();
}
return GetAndCachePreValueCollection(dataTypeId);
}
internal static string GetCacheKeyRegex(int preValueId)
{
return CacheKeys.DataTypePreValuesCacheKey + @"[-\d]+-([\d]*,)*" + preValueId + @"(?!\d)[,\d$]*";
var collection = GetCachedPreValueCollection(dataTypeId);
return collection;
}
/// <summary>
/// Gets a specific PreValue by its Id
/// </summary>
/// <param name="preValueId">Id of the PreValue to retrieve the value from</param>
/// <returns>PreValue as a string</returns>
public string GetPreValueAsString(int preValueId)
{
//We need to see if we can find the cached PreValueCollection based on the cache key above
var collections = IsolatedCache.GetCacheItemsByKeySearch<PreValueCollection>(CacheKeys.DataTypePreValuesCacheKey + "_");
var cached = IsolatedCache.GetCacheItemsByKeyExpression<PreValueCollection>(GetCacheKeyRegex(preValueId));
if (cached != null && cached.Any())
{
//return from the cache
var collection = cached.First();
var preVal = collection.FormatAsDictionary().Single(x => x.Value.Id == preValueId);
return preVal.Value.Value;
}
var preValue = collections.SelectMany(x => x.FormatAsDictionary().Values).FirstOrDefault(x => x.Id == preValueId);
if (preValue != null)
return preValue.Value;
//go and find the data type id for the pre val id passed in
var dto = Database.FirstOrDefault<DataTypePreValueDto>("WHERE id = @preValueId", new { preValueId = preValueId });
var dto = Database.FirstOrDefault<DataTypePreValueDto>("WHERE id = @preValueId", new { preValueId });
if (dto == null)
{
return string.Empty;
}
// go cache the collection
var preVals = GetAndCachePreValueCollection(dto.DataTypeNodeId);
//return the single value for this id
var pv = preVals.FormatAsDictionary().Single(x => x.Value.Id == preValueId);
return pv.Value.Value;
var collection = GetCachedPreValueCollection(dto.DataTypeNodeId);
if (collection == null)
return string.Empty;
preValue = collection.FormatAsDictionary().Values.FirstOrDefault(x => x.Id == preValueId);
return preValue == null ? string.Empty : preValue.Value;
}
public void AddOrUpdatePreValues(int dataTypeId, IDictionary<string, PreValue> values)
@@ -441,40 +427,28 @@ AND umbracoNode.id <> @id",
sortOrder++;
}
}
private string GetPrefixedCacheKey(int dataTypeId)
private static string GetPrefixedCacheKey(int dataTypeId)
{
return CacheKeys.DataTypePreValuesCacheKey + dataTypeId + "-";
return CacheKeys.DataTypePreValuesCacheKey + "_" + dataTypeId;
}
private PreValueCollection GetAndCachePreValueCollection(int dataTypeId)
private PreValueCollection GetCachedPreValueCollection(int datetypeId)
{
//go get the data
var dtos = Database.Fetch<DataTypePreValueDto>("WHERE datatypeNodeId = @Id", new { Id = dataTypeId });
var list = dtos.Select(x => new Tuple<PreValue, string, int>(new PreValue(x.Id, x.Value, x.SortOrder), x.Alias, x.SortOrder)).ToList();
var collection = PreValueConverter.ConvertToPreValuesCollection(list);
//now create the cache key, this needs to include all pre-value ids so that we can use this cached item in the GetPreValuesAsString method
//the key will be: "UmbracoPreValDATATYPEID-CSVOFPREVALIDS
var key = GetPrefixedCacheKey(dataTypeId)
+ string.Join(",", collection.FormatAsDictionary().Select(x => x.Value.Id).ToArray());
//store into cache
IsolatedCache.InsertCacheItem(key, () => collection,
//30 mins
new TimeSpan(0, 0, 30),
//sliding is true
true);
return collection;
var key = GetPrefixedCacheKey(datetypeId);
return IsolatedCache.GetCacheItem<PreValueCollection>(key, () =>
{
var dtos = Database.Fetch<DataTypePreValueDto>("WHERE datatypeNodeId = @Id", new { Id = datetypeId });
var list = dtos.Select(x => new Tuple<PreValue, string, int>(new PreValue(x.Id, x.Value, x.SortOrder), x.Alias, x.SortOrder)).ToList();
var collection = PreValueConverter.ConvertToPreValuesCollection(list);
return collection;
}, TimeSpan.FromMinutes(20), isSliding: true);
}
private string EnsureUniqueNodeName(string nodeName, int id = 0)
{
var sql = new Sql();
sql.Select("*")
@@ -575,7 +549,7 @@ AND umbracoNode.id <> @id",
}
//NOTE: We used to check that the Alias was unique for the given DataTypeNodeId prevalues list, BUT
// in reality there is no need to check the uniqueness of this alias because the only way that this code executes is
// in reality there is no need to check the uniqueness of this alias because the only way that this code executes is
// based on an IDictionary<string, PreValue> dictionary being passed to this repository and a dictionary
// must have unique aliases by definition, so there is no need for this additional check
@@ -595,10 +569,10 @@ AND umbracoNode.id <> @id",
{
throw new InvalidOperationException("Cannot update a pre value for a data type that has no identity");
}
//NOTE: We used to check that the Alias was unique for the given DataTypeNodeId prevalues list, BUT
// this causes issues when sorting the pre-values (http://issues.umbraco.org/issue/U4-5670) but in reality
// there is no need to check the uniqueness of this alias because the only way that this code executes is
// there is no need to check the uniqueness of this alias because the only way that this code executes is
// based on an IDictionary<string, PreValue> dictionary being passed to this repository and a dictionary
// must have unique aliases by definition, so there is no need for this additional check
@@ -613,7 +587,7 @@ AND umbracoNode.id <> @id",
Database.Update(dto);
}
}
internal static class PreValueConverter
@@ -8,6 +8,13 @@ namespace Umbraco.Core.Persistence.Repositories
{
public interface IContentTypeRepository : IContentTypeCompositionRepository<IContentType>
{
/// <summary>
/// Given the path of a content item, this will return true if the content item exists underneath a list view content item
/// </summary>
/// <param name="contentPath"></param>
/// <returns></returns>
bool HasContainerInPath(string contentPath);
/// <summary>
/// Gets all entities of the specified <see cref="PropertyType"/> query
/// </summary>
@@ -49,7 +49,12 @@ namespace Umbraco.Core.Persistence
_cacheHelper.IsolatedRuntimeCache.CacheFactory = type =>
{
var cache = origFactory(type);
return new DeepCloneRuntimeCacheProvider(cache);
//if the result is already a DeepCloneRuntimeCacheProvider then return it, otherwise
//wrap the result with a DeepCloneRuntimeCacheProvider
return cache is DeepCloneRuntimeCacheProvider
? cache
: new DeepCloneRuntimeCacheProvider(cache);
};
}
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
using Umbraco.Core.ObjectResolution;
@@ -17,11 +19,13 @@ namespace Umbraco.Core.PropertyEditors
internal class ParameterEditorResolver : LazyManyObjectsResolverBase<ParameterEditorResolver, IParameterEditor>
{
private readonly ManifestBuilder _builder;
private readonly IContentSection _contentSection;
public ParameterEditorResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> typeListProducerList, ManifestBuilder builder)
: base(serviceProvider, logger, typeListProducerList, ObjectLifetimeScope.Application)
{
_builder = builder;
_contentSection = UmbracoConfig.For.UmbracoSettings().Content;
}
/// <summary>
@@ -31,20 +35,27 @@ namespace Umbraco.Core.PropertyEditors
{
get
{
//This will by default include all property editors and parameter editors but we need to filter this
//list to ensure that none of the property editors that do not have the IsParameterEditor flag set to true
//are filtered.
var filtered = Values.Select(x => x as PropertyEditor)
.WhereNotNull()
.Where(x => x.IsParameterEditor == false);
return Values
//exclude the non parameter editor c# property editors
.Except(filtered)
//include the manifest parameter editors
.Union(_builder.ParameterEditors)
//include the manifest prop editors that are parameter editors
// all property editors and parameter editors
// except property editors where !IsParameterEditor
var values = Values
.Where(x => x is PropertyEditor == false || ((PropertyEditor) x).IsParameterEditor);
// union all manifest parameter editors
values = values
.Union(_builder.ParameterEditors);
// union all manifest property editors where IsParameterEditor
values = values
.Union(_builder.PropertyEditors.Where(x => x.IsParameterEditor));
if (_contentSection.ShowDeprecatedPropertyEditors == false)
{
// except deprecated property editors
values = values
.Where(x => x is PropertyEditor == false || ((PropertyEditor) x).IsDeprecated == false);
}
return values;
}
}
+4 -3
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
@@ -12,7 +13,8 @@ namespace Umbraco.Core.Publishing
{
public PublishStatus(IContent content, PublishStatusType statusType, EventMessages eventMessages)
: base(content, statusType, eventMessages)
{
{
InvalidProperties = Enumerable.Empty<Property>();
}
/// <summary>
@@ -20,8 +22,7 @@ namespace Umbraco.Core.Publishing
/// </summary>
public PublishStatus(IContent content, EventMessages eventMessages)
: this(content, PublishStatusType.Success, eventMessages)
{
}
{ }
public IContent ContentItem
{
@@ -51,7 +51,7 @@ namespace Umbraco.Core.Publishing
/// </summary>
/// <param name="uow"></param>
/// <param name="content"><see cref="IContent"/> to publish</param>
/// <param name="userId">Id of the User issueing the publish operation</param>
/// <param name="userId">Id of the User issueing the publish operation</param>
Attempt<PublishStatus> IPublishingStrategy2.Publish(IScopeUnitOfWork uow, IContent content, int userId)
{
var evtMsgs = _eventMessagesFactory.Get();
@@ -124,26 +124,26 @@ namespace Umbraco.Core.Publishing
/// By default this is set to true which means that it will publish any content item in the list that is completely unpublished and
/// not visible on the front-end. If set to false, this will only publish content that is live on the front-end but has new versions
/// that have yet to be published.
/// </param>
/// </param>
/// <returns></returns>
/// <remarks>
///
///
/// This method becomes complex once we start to be able to cancel events or stop publishing a content item in any way because if a
/// content item is not published then it's children shouldn't be published either. This rule will apply for the following conditions:
/// * If a document fails to be published, do not proceed to publish it's children if:
/// ** The document does not have a publish version
/// ** The document does have a published version but the includeUnpublishedDocuments = false
///
///
/// In order to do this, we will order the content by level and begin by publishing each item at that level, then proceed to the next
/// level and so on. If we detect that the above rule applies when the document publishing is cancelled we'll add it to the list of
/// level and so on. If we detect that the above rule applies when the document publishing is cancelled we'll add it to the list of
/// parentsIdsCancelled so that it's children don't get published.
///
///
/// Its important to note that all 'root' documents included in the list *will* be published regardless of the rules mentioned
/// above (unless it is invalid)!! By 'root' documents we are referring to documents in the list with the minimum value for their 'level'.
/// In most cases the 'root' documents will only be one document since under normal circumstance we only publish one document and
/// above (unless it is invalid)!! By 'root' documents we are referring to documents in the list with the minimum value for their 'level'.
/// In most cases the 'root' documents will only be one document since under normal circumstance we only publish one document and
/// its children. The reason we have to do this is because if a user is publishing a document and it's children, it is implied that
/// the user definitely wants to publish it even if it has never been published before.
///
///
/// </remarks>
IEnumerable<Attempt<PublishStatus>> IPublishingStrategy2.PublishWithChildren(IScopeUnitOfWork uow,
IEnumerable<IContent> content, int userId, bool includeUnpublishedDocuments)
@@ -157,7 +157,7 @@ namespace Umbraco.Core.Publishing
//group by levels and iterate over the sorted ascending level.
//TODO: This will cause all queries to execute, they will not be lazy but I'm not really sure being lazy actually made
// much difference because we iterate over them all anyways?? Morten?
// much difference because we iterate over them all anyways?? Morten?
// Because we're grouping I think this will execute all the queries anyways so need to fetch it all first.
var fetchedContent = content.ToArray();
@@ -174,7 +174,7 @@ namespace Umbraco.Core.Publishing
var levelGroups = fetchedContent.GroupBy(x => x.Level);
foreach (var level in levelGroups.OrderBy(x => x.Key))
{
//set the first level flag, used to ensure that all documents at the first level will
//set the first level flag, used to ensure that all documents at the first level will
//be published regardless of the rules mentioned in the remarks.
if (!firstLevel.HasValue)
{
@@ -224,7 +224,10 @@ namespace Umbraco.Core.Publishing
_logger.Info<PublishingStrategy>(
string.Format("Content '{0}' with Id '{1}' will not be published because some of it's content is not passing validation rules.",
item.Name, item.Id));
statuses.Add(Attempt.Fail(new PublishStatus(item, PublishStatusType.FailedContentInvalid, evtMsgs)));
statuses.Add(Attempt.Fail(new PublishStatus(item, PublishStatusType.FailedContentInvalid, evtMsgs)
{
InvalidProperties = ((ContentBase)item).LastInvalidProperties
}));
//Does this document apply to our rule to cancel it's children being published?
CheckCancellingOfChildPublishing(item, parentsIdsCancelled, includeUnpublishedDocuments);
@@ -296,11 +299,11 @@ namespace Umbraco.Core.Publishing
/// <param name="includeUnpublishedDocuments"></param>
/// <remarks>
/// See remarks on method: PublishWithChildrenInternal
/// </remarks>
/// </remarks>
private void CheckCancellingOfChildPublishing(IContent content, List<int> parentsIdsCancelled, bool includeUnpublishedDocuments)
{
//Does this document apply to our rule to cancel it's children being published?
//TODO: We're going back to the service layer here... not sure how to avoid this? And this will add extra overhead to
//TODO: We're going back to the service layer here... not sure how to avoid this? And this will add extra overhead to
// any document that fails to publish...
var hasPublishedVersion = ApplicationContext.Current.Services.ContentService.HasPublishedVersion(content.Id);
@@ -358,9 +358,8 @@ namespace Umbraco.Core.Services
{
var applicationAlias = (string)addElement.Attribute("application");
var type = (string)addElement.Attribute("type");
var assembly = (string)addElement.Attribute("assembly");
var clrType = Type.GetType(type);
var clrType = ApplicationTree.TryGetType(type);
if (clrType == null)
{
_logger.Warn<ApplicationTreeService>("The tree definition: " + addElement.ToString() + " could not be resolved to a .Net object type");
@@ -5,6 +5,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Services
@@ -74,5 +75,20 @@ namespace Umbraco.Core.Services
{
return Enumerable.Empty<IContentTypeBase>();
}
/// <summary>
/// Given the path of a content item, this will return true if the content item exists underneath a list view content item
/// </summary>
/// <param name="contentPath"></param>
/// <returns></returns>
public bool HasContainerInPath(string contentPath)
{
using (var uow = UowProvider.GetUnitOfWork())
{
// can use same repo for both content and media
var repository = RepositoryFactory.CreateContentTypeRepository(uow);
return repository.HasContainerInPath(contentPath);
}
}
}
}
@@ -11,6 +11,13 @@ namespace Umbraco.Core.Services
/// </summary>
public interface IContentTypeService : IService
{
/// <summary>
/// Given the path of a content item, this will return true if the content item exists underneath a list view content item
/// </summary>
/// <param name="contentPath"></param>
/// <returns></returns>
bool HasContainerInPath(string contentPath);
int CountContentTypes();
int CountMediaTypes();
+2 -1
View File
@@ -199,6 +199,7 @@
<Compile Include="Configuration\BaseRest\ExtensionElementCollection.cs" />
<Compile Include="Configuration\BaseRest\MethodElement.cs" />
<Compile Include="Configuration\ContentXmlStorage.cs" />
<Compile Include="Configuration\CoreDebug.cs" />
<Compile Include="Configuration\Dashboard\AccessElement.cs" />
<Compile Include="Configuration\Dashboard\AccessItem.cs" />
<Compile Include="Configuration\Dashboard\AccessType.cs" />
@@ -219,7 +220,6 @@
<Compile Include="Configuration\Dashboard\SectionElement.cs" />
<Compile Include="Configuration\Dashboard\TabCollection.cs" />
<Compile Include="Configuration\Dashboard\TabElement.cs" />
<Compile Include="Configuration\CoreDebug.cs" />
<Compile Include="Configuration\FileSystemProviderElement.cs" />
<Compile Include="Configuration\FileSystemProviderElementCollection.cs" />
<Compile Include="Configuration\FileSystemProvidersSection.cs" />
@@ -323,6 +323,7 @@
<Compile Include="DateTimeExtensions.cs" />
<Compile Include="DecimalExtensions.cs" />
<Compile Include="DelegateExtensions.cs" />
<Compile Include="Diagnostics\MiniDump.cs" />
<Compile Include="Deploy\ArtifactBase.cs" />
<Compile Include="Deploy\ArtifactDependency.cs" />
<Compile Include="Deploy\ArtifactDependencyCollection.cs" />
@@ -46,23 +46,6 @@ namespace Umbraco.Tests.Persistence.Repositories
return new EntityContainerRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Mock.Of<ILogger>(), SqlSyntax, Constants.ObjectTypes.DataTypeContainerGuid);
}
[TestCase("UmbracoPreVal87-21,3,48", 3, true)]
[TestCase("UmbracoPreVal87-21,33,48", 3, false)]
[TestCase("UmbracoPreVal87-21,33,48", 33, true)]
[TestCase("UmbracoPreVal87-21,3,48", 33, false)]
[TestCase("UmbracoPreVal87-21,3,48", 21, true)]
[TestCase("UmbracoPreVal87-21,3,48", 48, true)]
[TestCase("UmbracoPreVal87-22,33,48", 2, false)]
[TestCase("UmbracoPreVal87-22,33,48", 22, true)]
[TestCase("UmbracoPreVal87-22,33,44", 4, false)]
[TestCase("UmbracoPreVal87-22,33,44", 44, true)]
[TestCase("UmbracoPreVal87-22,333,44", 33, false)]
[TestCase("UmbracoPreVal87-22,333,44", 333, true)]
public void Pre_Value_Cache_Key_Tests(string cacheKey, int preValueId, bool outcome)
{
Assert.AreEqual(outcome, Regex.IsMatch(cacheKey, DataTypeDefinitionRepository.GetCacheKeyRegex(preValueId)));
}
[Test]
public void Can_Move()
{
@@ -537,7 +520,7 @@ namespace Umbraco.Tests.Persistence.Repositories
}
var cached = cache.IsolatedRuntimeCache.GetCache<IDataTypeDefinition>().Result
.GetCacheItemsByKeySearch<PreValueCollection>(CacheKeys.DataTypePreValuesCacheKey + dtd.Id + "-");
.GetCacheItemsByKeySearch<PreValueCollection>(CacheKeys.DataTypePreValuesCacheKey + "_" + dtd.Id);
Assert.IsNotNull(cached);
Assert.AreEqual(1, cached.Count());
@@ -581,7 +564,7 @@ namespace Umbraco.Tests.Persistence.Repositories
}
var cached = cache.IsolatedRuntimeCache.GetCache<IDataTypeDefinition>().Result
.GetCacheItemsByKeySearch<PreValueCollection>(CacheKeys.DataTypePreValuesCacheKey + dtd.Id + "-");
.GetCacheItemsByKeySearch<PreValueCollection>(CacheKeys.DataTypePreValuesCacheKey + "_" + dtd.Id);
Assert.IsNotNull(cached);
Assert.AreEqual(1, cached.Count());
+2 -2
View File
@@ -58,8 +58,8 @@
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
</Reference>
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
<Reference Include="Examine, Version=0.1.82.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Examine.0.1.82\lib\net45\Examine.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
+1 -1
View File
@@ -2,7 +2,7 @@
<packages>
<package id="AspNetWebApi.SelfHost" version="4.0.20710.0" targetFramework="net45" />
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
<package id="Examine" version="0.1.81" targetFramework="net45" />
<package id="Examine" version="0.1.82" targetFramework="net45" />
<package id="log4net" version="2.0.5" targetFramework="net45" />
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
@@ -163,13 +163,13 @@ angular.module('umbraco.directives')
}
// ignore clicks on dialog from old dialog service
var oldDialog = $(el).parents("#old-dialog-service");
var oldDialog = $(event.target).parents("#old-dialog-service");
if (oldDialog.length === 1) {
return;
}
// ignore clicks in tinyMCE dropdown(floatpanel)
var floatpanel = $(el).parents(".mce-floatpanel");
var floatpanel = $(event.target).closest(".mce-floatpanel");
if (floatpanel.length === 1) {
return;
}
@@ -17,6 +17,7 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
hideheader: '@',
cachekey: '@',
isdialog: '@',
onlyinitialized: '@',
//Custom query string arguments to pass in to the tree as a string, example: "startnodeid=123&something=value"
customtreeparams: '@',
eventhandler: '=',
@@ -252,7 +253,7 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
deleteAnimations = false;
//default args
var args = { section: scope.section, tree: scope.treealias, cacheKey: scope.cachekey, isDialog: scope.isdialog ? scope.isdialog : false };
var args = { section: scope.section, tree: scope.treealias, cacheKey: scope.cachekey, isDialog: scope.isdialog ? scope.isdialog : false, onlyinitialized: scope.onlyinitialized };
//add the extra query string params if specified
if (scope.customtreeparams) {
@@ -305,7 +306,7 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
scope.selectEnabledNodeClass = function (node) {
return node ?
node.selected ?
'icon umb-tree-icon sprTree icon-check blue temporary' :
'icon umb-tree-icon sprTree icon-check green temporary' :
'' :
'';
};
@@ -1,7 +1,7 @@
(function () {
'use strict';
function MiniListViewDirective(entityResource) {
function MiniListViewDirective(entityResource, iconHelper) {
function link(scope, el, attr, ctrl) {
@@ -19,6 +19,11 @@
function open(node) {
// convert legacy icon for node
if(node && node.icon) {
node.icon = iconHelper.convertFromLegacyIcon(node.icon);
}
goingForward = true;
var miniListView = {
@@ -58,6 +63,11 @@
// update children
miniListView.children = data.items;
_.each(miniListView.children, function(c) {
// convert legacy icon for node
if(c.icon) {
c.icon = iconHelper.convertFromLegacyIcon(c.icon);
}
// set published state for content
if (c.metaData) {
c.hasChildren = c.metaData.HasChildren;
if(scope.entityType === "Document") {
@@ -1,7 +1,7 @@
(function () {
'use strict';
function TableDirective() {
function TableDirective(iconHelper) {
function link(scope, el, attr, ctrl) {
@@ -43,6 +43,10 @@
}
};
scope.getIcon = function (entry) {
return iconHelper.convertFromLegacyIcon(entry.icon);
};
}
var directive = {
@@ -343,8 +343,13 @@ angular.module('umbraco.mocks').
{
results.push(decodeURIComponent(match[1].replace(/\+/g, " ")));
}
return results;
},
getObjectPropertyFromJsonString: function(data, name) {
var obj = JSON.parse(data);
return obj[name];
}
};
}]);
@@ -21,8 +21,27 @@ angular.module('umbraco.mocks').
if (!mocksUtils.checkAuth()) {
return [401, null, null];
}
var ids = mocksUtils.getParametersByName(data, "ids") || [1234, 23324, 2323, 23424];
var nodes = [];
$(ids).each(function (i, id) {
var _id = parseInt(id, 10);
nodes.push(mocksUtils.getMockEntity(_id));
});
return [200, nodes, null];
}
function returnEntitybyIdsPost(method, url, data, headers) {
if (!mocksUtils.checkAuth()) {
return [401, null, null];
}
var ids = mocksUtils.getObjectPropertyFromJsonString(data, "ids") || [1234, 23324, 2323, 23424];
var nodes = [];
$(ids).each(function (i, id) {
@@ -50,6 +69,10 @@ angular.module('umbraco.mocks').
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/Entity/GetByIds'))
.respond(returnEntitybyIds);
$httpBackend
.whenPOST(mocksUtils.urlRegex('/umbraco/UmbracoApi/Entity/GetByIds'))
.respond(returnEntitybyIdsPost);
$httpBackend
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/Entity/GetAncestors'))
.respond(returnEntitybyIds);
@@ -2,13 +2,13 @@
* @ngdoc service
* @name umbraco.resources.macroResource
* @description Deals with data for macros
*
*
**/
function macroResource($q, $http, umbRequestHelper) {
//the factory object returned
return {
/**
* @ngdoc method
* @name umbraco.resources.macroResource#getMacroParameters
@@ -20,7 +20,7 @@ function macroResource($q, $http, umbRequestHelper) {
* @param {int} macroId The macro id to get parameters for
*
*/
getMacroParameters: function (macroId) {
getMacroParameters: function (macroId) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
@@ -29,7 +29,7 @@ function macroResource($q, $http, umbRequestHelper) {
[{ macroId: macroId }])),
'Failed to retrieve macro parameters for macro with id ' + macroId);
},
/**
* @ngdoc method
* @name umbraco.resources.macroResource#getMacroResult
@@ -55,6 +55,27 @@ function macroResource($q, $http, umbRequestHelper) {
macroParams: macroParamDictionary
}),
'Failed to retrieve macro result for macro with alias ' + macroAlias);
},
/**
*
* @param {} filename
* @returns {}
*/
createPartialViewMacroWithFile: function(parent, filename) {
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl(
"macroApiBaseUrl",
"CreatePartialViewMacroWithFile"), {
parent: parent,
filename: filename
}
),
'Failed to create macro "' + filename + '"'
);
}
};
}
@@ -51,10 +51,15 @@ function treeResource($q, $http, umbRequestHelper) {
if (!options.isDialog) {
options.isDialog = false;
}
//create the query string for the tree request, these are the mandatory options:
var query = "application=" + options.section + "&tree=" + options.tree + "&isDialog=" + options.isDialog;
//if you need to load a not initialized tree set this value to false - default is true
if (options.onlyinitialized) {
query += "&onlyInitialized=" + options.onlyinitialized;
}
//the options can contain extra query string parameters
if (options.queryString) {
query += "&" + options.queryString;
@@ -0,0 +1,29 @@
(function() {
'use strict';
function entityHelper() {
function getEntityTypeFromSection(section) {
if (section === "member") {
return "Member";
}
else if (section === "media") {
return "Media";
} else {
return "Document";
}
}
////////////
var service = {
getEntityTypeFromSection: getEntityTypeFromSection
};
return service;
}
angular.module('umbraco.services').factory('entityHelper', entityHelper);
})();
@@ -8,8 +8,15 @@
return "@Umbraco.GetDictionaryValue(\"" + nodeName + "\")";
}
function getInsertPartialSnippet(nodeName) {
return "@Html.Partial(\"" + nodeName + "\")";
function getInsertPartialSnippet(parentId, nodeName) {
var partialViewName = nodeName.replace(".cshtml", "");
if(parentId) {
partialViewName = parentId + "/" + partialViewName;
}
return "@Html.Partial(\"" + partialViewName + "\")";
}
function getQuerySnippet(queryExpression) {
@@ -139,6 +139,7 @@
//page specific styles
@import "pages/document-type-editor.less";
@import "pages/login.less";
@import "pages/welcome-dashboard.less";
//used for property editors
@@ -138,16 +138,6 @@ input.umb-group-builder__group-title-input {
display: flex;
align-items: center;
margin-left: 10px;
position: relative;
top: 2px;
}
input.umb-group-builder__group-sort-value {
font-size: 12px;
padding: 0px 0 0px 5px;
width: 40px;
margin-bottom: 0;
border-color: @gray-8;
}
/* ---------- PROPERTIES ---------- */
@@ -0,0 +1,118 @@
// Title
.welcome-dashboard__intro {
margin-top: 20px;
margin-bottom: 30px;
}
.welcome-dashboard__title {
font-size: 30px;
color: @gray-2;
line-height: 1.3em;
text-align: center;
max-width: 750px;
margin-left: auto;
margin-right: auto;
margin-bottom: 15px;
font-weight: bold;
}
.welcome-dashboard__intro-text {
font-size: 18px;
text-align: center;
max-width: 750px;
margin-left: auto;
margin-right: auto;
line-height: 1.6em;
}
// Info box
.welcome-dashboard__info-box-boxes {
display: flex;
margin-bottom: 30px;
}
.welcome-dashboard__info-box {
background-color: @turquoise-washed;
border-radius: 3px;
border: 2px solid transparent;
padding: 25px;
text-decoration: none;
display: block;
margin: 10px;
}
.welcome-dashboard__info-box:hover {
border: 2px solid @turquoise;
cursor: pointer;
transition: border-color 150ms ease-in-out;
text-decoration: none;
}
.welcome-dashboard__info-box:active,
.welcome-dashboard__info-box:focus {
text-decoration: none;
}
.welcome-dashboard__info-box-title {
color: @turquoise-d1;
font-size: 16px;
text-align: center;
margin-bottom: 5px;
font-weight: bold;
}
.welcome-dashboard__info-box-description {
text-align: center;
line-height: 1.4em;
}
// Articles
.welcome-dashboard__cards {
display: flex;
margin-bottom: 30px;
}
.welcome-dashboard__card {
background-color: @gray-10;
border-radius: 3px;
margin: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
}
.welcome-dashboard__card-image-wrapper {
flex: 0 0 auto;
width: 100%;
margin-bottom: 30px;
max-height: 225px;
overflow: hidden;
}
.welcome-dashboard__card-image {
cursor: pointer;
border-radius: 3px 3px 0 0;
width: 100%;
}
.welcome-dashboard__card-image-wrapper + .welcome-dashboard__card-content {
padding-top: 0px;
}
.welcome-dashboard__card-content {
padding: 30px;
}
.welcome-dashboard__card-title {
color: @gray-2;
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
line-height: 1.6em;
}
.welcome-dashboard__card-teaser {
font-size: 14px;
margin-bottom: 15px;
}
@@ -6,7 +6,7 @@
}
.umb-editor-tiny {
width: 50px;
width: 60px;
}
.umb-editor-small {
@@ -1,7 +1,7 @@
(function() {
"use strict";
function CopyOverlay($scope, localizationService, eventsService) {
function CopyOverlay($scope, localizationService, eventsService, entityHelper) {
var vm = this;
@@ -32,54 +32,30 @@
selectedSearchResults: []
};
// get entity type based on the section
$scope.entityType = entityHelper.getEntityTypeFromSection(dialogOptions.section);
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
vm.searchInfo.showSearch = true;
vm.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
vm.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
}
else {
//eventsService.emit("editors.content.copyController.select", args);
if ($scope.model.target) {
//un-select if there's a current one selected
$scope.model.target.selected = false;
}
$scope.model.target = args.node;
$scope.model.target.selected = true;
if(args && args.event) {
args.event.preventDefault();
args.event.stopPropagation();
}
//eventsService.emit("editors.content.copyController.select", args);
if ($scope.model.target) {
//un-select if there's a current one selected
$scope.model.target.selected = false;
}
$scope.model.target = args.node;
$scope.model.target.selected = true;
}
function nodeExpandedHandler(ev, args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add a custom
// child: A node to activate the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon umb-tree-icon sprTree icon-search",
cssClasses: ["not-published"]
}
];
}
});
// open mini list view for list views
if (args.node.metaData.isContainer) {
openMiniListView(args.node);
}
}
@@ -110,6 +86,20 @@
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
});
// Mini list view
$scope.selectListViewNode = function (node) {
node.selected = node.selected === true ? false : true;
nodeSelectHandler({}, { node: node });
};
$scope.closeMiniListView = function () {
$scope.miniListView = undefined;
};
function openMiniListView(node) {
$scope.miniListView = node;
}
}
@@ -1,34 +1,47 @@
<div ng-controller="Umbraco.Overlays.CopyOverlay as vm">
<div class="umb-control-group">
<umb-tree-search-box
hide-search-callback="vm.hideSearch"
search-callback="vm.onSearchResults"
search-from-id="{{vm.searchInfo.searchFromId}}"
search-from-name="{{vm.searchInfo.searchFromName}}"
show-search="{{vm.searchInfo.showSearch}}"
section="{{model.section}}">
</umb-tree-search-box>
</div>
<div ng-hide="miniListView">
<div class="umb-control-group">
<umb-tree-search-box
hide-search-callback="vm.hideSearch"
search-callback="vm.onSearchResults"
search-from-id="{{vm.searchInfo.searchFromId}}"
search-from-name="{{vm.searchInfo.searchFromName}}"
show-search="{{vm.searchInfo.showSearch}}"
section="{{model.section}}">
</umb-tree-search-box>
</div>
<div class="umb-control-group" ng-show="vm.searchInfo.showSearch">
<umb-tree-search-results
ng-if="vm.searchInfo.showSearch"
results="vm.searchInfo.results"
select-result-callback="vm.selectResult">
</umb-tree-search-results>
</div>
<div class="umb-control-group" ng-show="vm.searchInfo.showSearch">
<umb-tree-search-results
ng-if="vm.searchInfo.showSearch"
results="vm.searchInfo.results"
select-result-callback="vm.selectResult">
</umb-tree-search-results>
</div>
<div class="umb-control-group -no-border" ng-hide="vm.searchInfo.showSearch">
<umb-tree
section="{{model.section}}"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablelistviewexpand="true"
enablecheckboxes="true">
</umb-tree>
</div>
<div class="umb-control-group -no-border" ng-hide="vm.searchInfo.showSearch">
<umb-tree
section="{{model.section}}"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablecheckboxes="true">
</umb-tree>
</div>
<div ng-if="miniListView" class="umb-control-group">
<umb-mini-list-view
node="miniListView"
entity-type="{{entityType}}"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
</div>
<div class="umb-control-group -no-border">
<label>
@@ -104,13 +104,18 @@
function openPartialOverlay() {
vm.partialItemOverlay = {
view: "treepicker",
section: "settings",
section: "settings",
treeAlias: "partialViews",
entityType: "partialView",
multiPicker: false,
show: true,
filter: function(i) {
if(i.name.indexOf(".cshtml") === -1 && i.name.indexOf(".vbhtml") === -1) {
return true;
}
},
filterCssClass: "not-allowed",
title: localizationService.localize("template_insertPartialView"),
show: true,
select: function(node){
$scope.model.insert = {
@@ -47,69 +47,44 @@ angular.module("umbraco").controller("Umbraco.Overlays.LinkPickerController",
}
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
if(args && args.event) {
args.event.preventDefault();
args.event.stopPropagation();
}
$scope.searchInfo.showSearch = true;
$scope.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
$scope.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
}
else {
eventsService.emit("dialogs.linkPicker.select", args);
eventsService.emit("dialogs.linkPicker.select", args);
if ($scope.currentNode) {
//un-select if there's a current one selected
$scope.currentNode.selected = false;
}
if ($scope.currentNode) {
//un-select if there's a current one selected
$scope.currentNode.selected = false;
}
$scope.currentNode = args.node;
$scope.currentNode.selected = true;
$scope.model.target.id = args.node.id;
$scope.model.target.udi = args.node.udi;
$scope.model.target.name = args.node.name;
$scope.currentNode = args.node;
$scope.currentNode.selected = true;
$scope.model.target.id = args.node.id;
$scope.model.target.udi = args.node.udi;
$scope.model.target.name = args.node.name;
if (args.node.id < 0) {
$scope.model.target.url = "/";
}
else {
contentResource.getNiceUrl(args.node.id).then(function (url) {
$scope.model.target.url = url;
});
}
if (args.node.id < 0) {
$scope.model.target.url = "/";
}
else {
contentResource.getNiceUrl(args.node.id).then(function (url) {
$scope.model.target.url = url;
});
}
if (!angular.isUndefined($scope.model.target.isMedia)) {
delete $scope.model.target.isMedia;
}
}
if (!angular.isUndefined($scope.model.target.isMedia)) {
delete $scope.model.target.isMedia;
}
}
function nodeExpandedHandler(ev, args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add a custom
// child: A node to activate the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon umb-tree-icon sprTree icon-search",
cssClasses: ["not-published"]
}
];
}
});
}
// open mini list view for list views
if (args.node.metaData.isContainer) {
openMiniListView(args.node);
}
}
$scope.switchToMediaPicker = function () {
@@ -160,4 +135,19 @@ angular.module("umbraco").controller("Umbraco.Overlays.LinkPickerController",
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
});
// Mini list view
$scope.selectListViewNode = function (node) {
node.selected = node.selected === true ? false : true;
nodeSelectHandler({}, { node: node });
};
$scope.closeMiniListView = function () {
$scope.miniListView = undefined;
};
function openMiniListView(node) {
$scope.miniListView = node;
}
});
@@ -28,34 +28,45 @@
<localize key="defaultdialogs_linkToPage">Link to page</localize>
</h5>
<umb-tree-search-box
hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<div ng-hide="miniListView">
<umb-tree-search-box
hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<br/>
<br/>
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch">
<umb-tree
section="content"
hideheader="true"
hideoptions="true"
eventhandler="dialogTreeEventHandler"
isdialog="true"
enablecheckboxes="true">
</umb-tree>
<div ng-hide="searchInfo.showSearch">
<umb-tree
section="content"
hideheader="true"
hideoptions="true"
eventhandler="dialogTreeEventHandler"
enablelistviewexpand="true"
isdialog="true"
enablecheckboxes="true">
</umb-tree>
</div>
</div>
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="Document"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
</div>
<div class="umb-control-group">
@@ -1,7 +1,7 @@
(function() {
"use strict";
function MoveOverlay($scope, localizationService, eventsService) {
function MoveOverlay($scope, localizationService, eventsService, entityHelper) {
var vm = this;
@@ -32,54 +32,32 @@
selectedSearchResults: []
};
// get entity type based on the section
$scope.entityType = entityHelper.getEntityTypeFromSection(dialogOptions.section);
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
vm.searchInfo.showSearch = true;
vm.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
vm.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
if(args && args.event) {
args.event.preventDefault();
args.event.stopPropagation();
}
else {
//eventsService.emit("editors.content.copyController.select", args);
if ($scope.model.target) {
//un-select if there's a current one selected
$scope.model.target.selected = false;
}
//eventsService.emit("editors.content.copyController.select", args);
$scope.model.target = args.node;
$scope.model.target.selected = true;
if ($scope.model.target) {
//un-select if there's a current one selected
$scope.model.target.selected = false;
}
$scope.model.target = args.node;
$scope.model.target.selected = true;
}
function nodeExpandedHandler(ev, args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add a custom
// child: A node to activate the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon umb-tree-icon sprTree icon-search",
cssClasses: ["not-published"]
}
];
}
});
// open mini list view for list views
if (args.node.metaData.isContainer) {
openMiniListView(args.node);
}
}
@@ -110,6 +88,19 @@
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
});
// Mini list view
$scope.selectListViewNode = function (node) {
node.selected = node.selected === true ? false : true;
nodeSelectHandler({}, { node: node });
};
$scope.closeMiniListView = function () {
$scope.miniListView = undefined;
};
function openMiniListView(node) {
$scope.miniListView = node;
}
}
@@ -1,33 +1,43 @@
<div ng-controller="Umbraco.Overlays.MoveOverlay as vm">
<div ng-hide="miniListView">
<div class="umb-control-group">
<umb-tree-search-box
hide-search-callback="vm.hideSearch"
search-callback="vm.onSearchResults"
search-from-id="{{vm.searchInfo.searchFromId}}"
search-from-name="{{vm.searchInfo.searchFromName}}"
show-search="{{vm.searchInfo.showSearch}}"
section="{{model.section}}">
</umb-tree-search-box>
</div>
<div class="umb-control-group">
<umb-tree-search-box
hide-search-callback="vm.hideSearch"
search-callback="vm.onSearchResults"
search-from-id="{{vm.searchInfo.searchFromId}}"
search-from-name="{{vm.searchInfo.searchFromName}}"
show-search="{{vm.searchInfo.showSearch}}"
section="{{model.section}}">
</umb-tree-search-box>
<div class="umb-control-group" ng-show="vm.searchInfo.showSearch">
<umb-tree-search-results
ng-if="vm.searchInfo.showSearch"
results="vm.searchInfo.results"
select-result-callback="vm.selectResult">
</umb-tree-search-results>
</div>
<div class="umb-control-group -no-border" ng-hide="vm.searchInfo.showSearch">
<umb-tree
section="{{model.section}}"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablelistviewexpand="true"
enablecheckboxes="true">
</umb-tree>
</div>
</div>
<div class="umb-control-group" ng-show="vm.searchInfo.showSearch">
<umb-tree-search-results
ng-if="vm.searchInfo.showSearch"
results="vm.searchInfo.results"
select-result-callback="vm.selectResult">
</umb-tree-search-results>
</div>
<div class="umb-control-group -no-border" ng-hide="vm.searchInfo.showSearch">
<umb-tree
section="{{model.section}}"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablecheckboxes="true">
</umb-tree>
</div>
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="{{entityType}}"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
</div>
@@ -10,6 +10,8 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
$scope.treeAlias = dialogOptions.treeAlias;
$scope.multiPicker = dialogOptions.multiPicker;
$scope.hideHeader = true;
// if you need to load a not initialized tree set this value to false - default is true
$scope.onlyInitialized = dialogOptions.onlyInitialized;
$scope.searchInfo = {
searchFromId: dialogOptions.startNodeId,
searchFromName: null,
@@ -27,6 +27,7 @@
hideheader="{{hideHeader}}"
hideoptions="true"
isdialog="true"
onlyinitialized="{{onlyInitialized}}"
customtreeparams="{{customTreeParams}}"
eventhandler="dialogTreeEventHandler"
enablelistviewsearch="true"
@@ -3,7 +3,7 @@
<a class="icon icon-arrow-left" ng-if="showSearch == 'true'" title="Back" ng-click="hideSearch()"></a>
<input type="text"
ng-model="term"
class="umb-search-field search-query"
class="umb-search-field search-query -full-width-input"
placeholder="{{searchPlaceholderText}}"
focus-when="{{showSearch}}">
<h4 ng-if="showSearch && searchFromName">
@@ -87,7 +87,7 @@
<ng-form name="groupSortOrderForm">
<div class="umb-group-builder__group-sort-order" ng-if="sortingMode">
<input name="groupSortOrder" type="number" class="umb-group-builder__group-sort-value" ng-model="tab.sortOrder" ng-disabled="tab.inherited" on-blur="changeSortOrderValue(tab)" required />
<input name="groupSortOrder" type="number" class="umb-editor-tiny" style="margin-bottom: 0;" ng-model="tab.sortOrder" ng-disabled="tab.inherited" on-blur="changeSortOrderValue(tab)" required />
<div class="umb-validation-label -arrow-left" ng-if="groupSortOrderForm.groupSortOrder.$error.required && tab.showSortOrderMissing"><localize key="required"></localize></div>
<div class="umb-validation-label -arrow-left" ng-if="!tab.showSortOrderMissing" val-msg-for="groupSortOrder" val-toggle-msg="required"><localize key="required"></localize></div>
</div>
@@ -22,54 +22,29 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.CopyController",
var node = dialogOptions.currentNode;
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
if(args && args.event) {
args.event.preventDefault();
args.event.stopPropagation();
}
$scope.searchInfo.showSearch = true;
$scope.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
$scope.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
}
else {
eventsService.emit("editors.content.copyController.select", args);
eventsService.emit("editors.content.copyController.select", args);
if ($scope.target) {
//un-select if there's a current one selected
$scope.target.selected = false;
}
if ($scope.target) {
//un-select if there's a current one selected
$scope.target.selected = false;
}
$scope.target = args.node;
$scope.target.selected = true;
}
$scope.target = args.node;
$scope.target.selected = true;
}
function nodeExpandedHandler(ev, args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add a custom
// child: A node to activate the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon umb-tree-icon sprTree icon-search",
cssClasses: ["not-published"]
}
];
}
});
}
// open mini list view for list views
if (args.node.metaData.isContainer) {
openMiniListView(args.node);
}
}
$scope.hideSearch = function () {
@@ -136,4 +111,19 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.CopyController",
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
});
// Mini list view
$scope.selectListViewNode = function (node) {
node.selected = node.selected === true ? false : true;
nodeSelectHandler({}, { node: node });
};
$scope.closeMiniListView = function () {
$scope.miniListView = undefined;
};
function openMiniListView(node) {
$scope.miniListView = node;
}
});
@@ -20,53 +20,29 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.MoveController",
var node = dialogOptions.currentNode;
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if (args.node.metaData.listViewNode) {
//check if list view 'search' node was selected
if(args && args.event) {
args.event.preventDefault();
args.event.stopPropagation();
}
$scope.searchInfo.showSearch = true;
$scope.searchInfo.searchFromId = args.node.metaData.listViewNode.id;
$scope.searchInfo.searchFromName = args.node.metaData.listViewNode.name;
}
else {
eventsService.emit("editors.content.moveController.select", args);
eventsService.emit("editors.content.moveController.select", args);
if ($scope.target) {
//un-select if there's a current one selected
$scope.target.selected = false;
}
if ($scope.target) {
//un-select if there's a current one selected
$scope.target.selected = false;
}
$scope.target = args.node;
$scope.target.selected = true;
$scope.target = args.node;
$scope.target.selected = true;
}
}
function nodeExpandedHandler(ev, args) {
if (angular.isArray(args.children)) {
//iterate children
_.each(args.children, function (child) {
//check if any of the items are list views, if so we need to add a custom
// child: A node to activate the search
if (child.metaData.isContainer) {
child.hasChildren = true;
child.children = [
{
level: child.level + 1,
hasChildren: false,
name: searchText,
metaData: {
listViewNode: child,
},
cssClass: "icon umb-tree-icon sprTree icon-search",
cssClasses: ["not-published"]
}
];
}
});
}
// open mini list view for list views
if (args.node.metaData.isContainer) {
openMiniListView(args.node);
}
}
$scope.hideSearch = function () {
@@ -136,4 +112,19 @@ angular.module("umbraco").controller("Umbraco.Editors.Content.MoveController",
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
});
// Mini list view
$scope.selectListViewNode = function (node) {
node.selected = node.selected === true ? false : true;
nodeSelectHandler({}, { node: node });
};
$scope.closeMiniListView = function () {
$scope.miniListView = undefined;
};
function openMiniListView(node) {
$scope.miniListView = node;
}
});
@@ -1,6 +1,22 @@
<div ng-controller="Umbraco.Editors.Content.CopyController">
<div class="umb-dialog-body form-horizontal">
<div class="umb-dialog-body form-horizontal" ng-cloak>
<div class="umb-pane">
<div ng-show="error">
<div class="alert alert-error">
<div><strong>{{error.errorMsg}}</strong></div>
<div>{{error.data.message}}</div>
</div>
</div>
<div ng-show="success">
<div class="alert alert-success">
<strong>{{currentNode.name}}</strong> was copied to
<strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<p class="abstract" ng-hide="success">
Choose where to copy <strong>{{currentNode.name}}</strong> to in the tree structure below
</p>
@@ -9,52 +25,51 @@
<div class="umb-loader"></div>
</div>
<div ng-show="error">
<h5 class="text-error">{{error.errorMsg}}</h5>
<p class="text-error">{{error.data.message}}</p>
</div>
<div class="alert alert-success" ng-show="success">
<p>
<strong>{{currentNode.name}}</strong> was copied to
<strong>{{target.name}}</strong>
</p>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<div ng-hide="success">
<umb-tree-search-box hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<div ng-hide="miniListView">
<umb-tree-search-box
hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<br />
<br />
<umb-tree-search-results ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch">
<umb-tree section="content"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablecheckboxes="true">
</umb-tree>
<div ng-hide="searchInfo.showSearch">
<umb-tree
section="content"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablelistviewexpand="true"
enablecheckboxes="true">
</umb-tree>
</div>
</div>
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="Document"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
<umb-pane>
<umb-control-group localize="label" label="@defaultdialogs_relateToOriginalLabel">
<input type="checkbox" ng-model="$parent.$parent.relateToOriginal"/>
</umb-control-group>
</umb-pane>
<umb-pane>
@@ -1,7 +1,21 @@
<div ng-controller="Umbraco.Editors.Content.MoveController">
<div class="umb-dialog-body">
<div class="umb-dialog-body" ng-cloak>
<div class="umb-pane">
<div ng-show="error">
<div class="alert alert-error">
<div><strong>{{error.errorMsg}}</strong></div>
<div>{{error.data.message}}</div>
</div>
</div>
<div ng-show="success">
<div class="alert alert-success">
<strong>{{currentNode.name}}</strong> was moved underneath&nbsp;<strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<p class="abstract" ng-hide="success">
<localize key="actions_chooseWhereToMove">Choose where to move</localize>
<strong>{{currentNode.name}}</strong>
@@ -12,43 +26,47 @@
<div class="umb-loader"></div>
</div>
<div ng-show="error">
<h5 class="text-error">{{error.errorMsg}}</h5>
<p class="text-error">{{error.data.message}}</p>
</div>
<div ng-show="success">
<h5 class="text-success"><strong>{{currentNode.name}}</strong> was moved underneath&nbsp;<strong>{{target.name}}</strong></h5>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<div ng-hide="success">
<umb-tree-search-box hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<div ng-hide="miniListView">
<umb-tree-search-box
hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<br />
<br />
<umb-tree-search-results ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch">
<umb-tree section="content"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablecheckboxes="true">
</umb-tree>
<div ng-hide="searchInfo.showSearch">
<umb-tree
section="content"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablelistviewexpand="true"
enablecheckboxes="true">
</umb-tree>
</div>
</div>
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="Document"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
</div>
</div>
</div>
@@ -22,6 +22,51 @@ function startUpDynamicContentController(dashboardResource, assetsService) {
var vm = this;
vm.loading = true;
vm.showDefault = false;
// default dashboard content
vm.defaultDashboard = {
infoBoxes: [
{
title: "Documentation",
description: "Find the answers to your Umbraco questions",
url: "https://our.umbraco.org/documentation/?utm_source=core&utm_medium=dashboard&utm_content=text&utm_campaign=documentation/"
},
{
title: "Community",
description: "Find the answers or ask your Umbraco questions",
url: "https://our.umbraco.org/?utm_source=core&utm_medium=dashboard&utm_content=text&utm_campaign=our_forum"
},
{
title: "Umbraco.tv",
description: "Tutorial videos (some are free, some are on subscription)",
url: "https://umbraco.tv/?utm_source=core&utm_medium=dashboard&utm_content=text&utm_campaign=tutorial_videos"
},
{
title: "Training",
description: "Real-life training and official Umbraco certifications",
url: "https://umbraco.com/training/?utm_source=core&utm_medium=dashboard&utm_content=text&utm_campaign=training"
}
],
articles: [
{
title: "Umbraco.TV - Learn from the source!",
description: "Umbraco.TV will help you go from zero to Umbraco hero at a pace that suits you. Our easy to follow online training videos will give you the fundamental knowledge to start building awesome Umbraco websites.",
img: "views/dashboard/default/umbracotv.jpg",
url: "https://umbraco.tv/?utm_source=core&utm_medium=dashboard&utm_content=image&utm_campaign=tv",
altText: "Umbraco.TV - Hours of Umbraco Video Tutorials",
buttonText: "Visit Umbraco.TV"
},
{
title: "Our Umbraco - The Friendliest Community",
description: "Our Umbraco - the official community site is your one stop for everything Umbraco. Whether you need a question answered or looking for cool plugins, the world's best and friendliest community is just a click away.",
img: "views/dashboard/default/ourumbraco.jpg",
url: "https://our.umbraco.org/?utm_source=core&utm_medium=dashboard&utm_content=image&utm_campaign=our",
altText: "Our Umbraco",
buttonText: "Visit Our Umbraco"
}
]
};
//proxy remote css through the local server
assetsService.loadCss( dashboardResource.getRemoteDashboardCssUrl("content") );
@@ -38,58 +38,34 @@
<!-- Default content in case we cannot fetch content from the outside -->
<div style="max-width: 1200px" ng-if="vm.showDefault">
<h3><strong>Welcome to The Friendly CMS</strong></h3>
<p style="font-size: 16px; line-height: 1.5; margin-bottom: 30px; max-width: 760px;">
<span>Thank you for choosing Umbraco - we think this could be the beginning of something beautiful. While it may feel overwhelming at first, we've done a lot to make the learning curve as smooth and fast as possible.</span>
</p>
<h4>Find out more:</h4>
<ul>
<li>Find the answers to your Umbraco questions in <a href="https://our.umbraco.org/documentation/" target="_blank" class="btn-link-underline">our Documentation</a></li>
<li>Ask a question in the <a href="https://our.umbraco.org" target="_blank" class="btn-link-underline">Community Forum</a></li>
<li>Find <a href="https://our.umbraco.org/projects" target="_blank" class="btn-link-underline">an add-on package</a> to help you get going quickly</li>
<li>Watch <a href="https://umbraco.tv" class="btn-link-underline">our tutorial videos</a> (some are free, some require a subscription)</li>
<li>Find out about <a href="https://umbraco.com/products-and-support" target="_blank" class="btn-link-underline">our productivity boosting tools and commercial support</a></li>
<li>Find out about <a href="https://umbraco.com/products/training" target="_blank" class="btn-link-underline">real-life training and certification opportunities</a></li>
</ul>
<div class="row">
<div class="span4">
<a href="https://umbraco.tv/?utm_source=core&utm_medium=dashboard&utm_content=image&utm_campaign=tv" target="_blank" class="nounderline">
<img src="views/dashboard/default/umbracotv.png" alt="Umbraco.TV - Hours of Umbraco Video Tutorials" style="margin: 10px 0 10px 0" />
</a>
<div class="welcome-dashboard__intro">
<h1 class="welcome-dashboard__title">Welcome to The Friendly CMS</h1>
<p class="welcome-dashboard__intro-text">Thank you for choosing Umbraco - we think this could be the beginning of something beautiful. While it may feel overwhelming at first, we've done a lot to make the learning curve as smooth and fast as possible.</p>
</div>
<div class="welcome-dashboard__info-box-boxes">
<a ng-href="{{infoBox.url}}" target="_blank" class="welcome-dashboard__info-box" ng-repeat="infoBox in vm.defaultDashboard.infoBoxes">
<div class="welcome-dashboard__info-box-title">{{ infoBox.title }}</div>
<div class="welcome-dashboard__info-box-description">{{ infoBox.description }}</div>
</a>
</div>
<a href="https://umbraco.tv/?utm_source=core&utm_medium=dashboard&utm_content=header&utm_campaign=tv" target="_blank" class="btn-link -underline">
<h4> <strong>Umbraco.TV - Learn from the source!</strong> </h4>
</a>
<p style="line-height: 1.5;">
Umbraco.TV will help you go from zero to Umbraco
hero at a pace that suits you. Our easy to follow
online training videos will give you the fundamental
knowledge to start building awesome Umbraco websites.
</p>
</div>
<div class="span4 offset1">
<a href="https://our.umbraco.org/?utm_source=core&utm_medium=dashboard&utm_content=image&utm_campaign=our" target="_blank" class="nounderline">
<img src="views/dashboard/default/ourumbraco.png" alt="Our Umbraco" style="margin: 10px 0 10px 0" />
</a>
<a href="https://our.umbraco.org/?utm_source=core&utm_medium=dashboard&utm_content=header&utm_campaign=our" target="_blank" class="btn-link -underline">
<h4><strong>Our Umbraco - The Friendliest Community</strong></h4>
</a>
<p style="line-height: 1.5;">
Our Umbraco - the official community site is your one
stop for everything Umbraco. Whether you need a
question answered or looking for cool plugins, the
worlds best community is just a click away.
</p>
<div class="welcome-dashboard__cards">
<div class="welcome-dashboard__card" ng-repeat="article in vm.defaultDashboard.articles">
<div class="welcome-dashboard__card-image-wrapper">
<a ng-href="{{article.url}}" target="_blank">
<img class="welcome-dashboard__card-image" ng-src="{{article.img}}" alt="{{ article.altText }}" />
</a>
</div>
<div class="welcome-dashboard__card-content">
<h2 class="welcome-dashboard__card-title">{{ article.title }}</h2>
<div class="welcome-dashboard__card-teaser">{{ article.description }}</div>
<a class="btn btn-success" ng-href="{{article.url}}" target="_blank">{{article.buttonText}}</a>
</div>
</div>
</div>
</div>
</div>
</div>
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

@@ -7,8 +7,11 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
var node = dialogOptions.currentNode;
function nodeSelectHandler(ev, args) {
args.event.preventDefault();
args.event.stopPropagation();
if(args && args.event) {
args.event.preventDefault();
args.event.stopPropagation();
}
eventsService.emit("editors.media.moveController.select", args);
@@ -21,8 +24,15 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
$scope.target.selected = true;
}
$scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
function nodeExpandedHandler(ev, args) {
// open mini list view for list views
if (args.node.metaData.isContainer) {
openMiniListView(args.node);
}
}
$scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", nodeExpandedHandler);
$scope.move = function () {
mediaResource.move({ parentId: $scope.target.id, id: node.id })
@@ -55,5 +65,21 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
$scope.$on('$destroy', function () {
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
});
// Mini list view
$scope.selectListViewNode = function (node) {
node.selected = node.selected === true ? false : true;
nodeSelectHandler({}, { node: node });
};
$scope.closeMiniListView = function () {
$scope.miniListView = undefined;
};
function openMiniListView(node) {
$scope.miniListView = node;
}
});
@@ -1,33 +1,49 @@
<div ng-controller="Umbraco.Editors.Media.MoveController">
<div class="umb-dialog-body">
<div class="umb-dialog-body" ng-cloak>
<div class="umb-pane">
<div ng-show="error">
<div class="alert alert-error">
<div><strong>{{error.errorMsg}}</strong></div>
<div>{{error.data.message}}</div>
</div>
</div>
<div ng-show="success">
<div class="alert alert-success">
<strong>{{currentNode.name}}</strong> was moved underneath <strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<p class="abstract" ng-hide="success">
<localize key="actions_chooseWhereToMove">Choose where to move</localize>
<strong>{{currentNode.name}}</strong>
<localize key="actions_toInTheTreeStructureBelow">to in the tree structure below</localize>
</p>
<div class="alert alert-error" ng-show="error" ng-cloak>
<h4>{{error.errorMsg}}</h4>
<p>{{error.data.Message}}</p>
</div>
<div class="alert alert-success" ng-show="success" ng-cloak>
<p><strong>{{currentNode.name}}</strong> was moved underneath
<strong>{{target.name}}</strong></p>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<div ng-hide="success">
<umb-tree section="media"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablecheckboxes="true">
</umb-tree>
<div ng-hide="miniListView">
<umb-tree
section="media"
hideheader="false"
hideoptions="true"
isdialog="true"
eventhandler="dialogTreeEventHandler"
enablelistviewexpand="true"
enablecheckboxes="true">
</umb-tree>
</div>
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="Media"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
</div>
</div>
</div>
@@ -1,47 +1,42 @@
(function () {
"use strict";
function PartialViewMacrosCreateController($scope, codefileResource, $location, navigationService, formHelper, localizationService, appState) {
function PartialViewMacrosCreateController($scope, codefileResource, macroResource, $location, navigationService, formHelper, localizationService, appState) {
var vm = this;
var node = $scope.dialogOptions.currentNode;
var localizeCreateFolder = localizationService.localize("defaultdialog_createFolder");
vm.snippets = [];
vm.showSnippets = false;
vm.creatingFolder = false;
vm.snippet = "Empty";
vm.createMacro = false;
vm.createFolderError = "";
vm.folderName = "";
vm.fileName = "";
vm.creatingFolder = false;
vm.creatingFile = false;
vm.createPartialViewMacro = createPartialViewMacro;
vm.showCreateFolder = showCreateFolder;
vm.showCreateFile = showCreateFile;
vm.createFolder = createFolder;
vm.showCreateFromSnippet = showCreateFromSnippet;
vm.createFile = createFile;
function onInit() {
codefileResource.getSnippets('partialViewMacros')
.then(function(snippets) {
.then(function (snippets) {
vm.snippets = snippets;
});
}
function createPartialViewMacro(selectedSnippet) {
var snippet = null;
if(selectedSnippet && selectedSnippet.fileName) {
snippet = selectedSnippet.fileName;
}
$location.path("/developer/partialviewmacros/edit/" + node.id).search("create", "true").search("snippet", snippet);
navigationService.hideMenu();
}
function showCreateFolder() {
vm.creatingFolder = true;
}
function showCreateFile() {
vm.creatingFile = true;
}
function createFolder(form) {
if (formHelper.submitForm({scope: $scope, formCtrl: form, statusMessage: localizeCreateFolder})) {
@@ -75,11 +70,32 @@
});
}
}
function showCreateFromSnippet() {
vm.showSnippets = true;
function createFile(form) {
if (formHelper.submitForm({ scope: $scope, formCtrl: form, statusMessage: 'create file' })) {
if (vm.createMacro) {
var path = decodeURIComponent(node.id);
macroResource.createPartialViewMacroWithFile(path, vm.fileName).then(function(created) {
$location.path("/developer/partialviewmacros/edit/" + node.id).search("create", "true").search("name", vm.fileName).search("snippet", vm.snippet);
navigationService.hideMenu();
}, function(err) {
vm.createFileError = err;
//show any notifications
if (angular.isArray(err.data.notifications)) {
for (var i = 0; i < err.data.notifications.length; i++) {
notificationsService.showNotification(err.data.notifications[i]);
}
}
});
} else {
$location.path("/developer/partialviewmacros/edit/" + node.id).search("create", "true").search("name", vm.fileName).search("snippet", vm.snippet);
navigationService.hideMenu();
}
}
}
onInit();
}
@@ -2,46 +2,61 @@
<div class="umbracoDialog umb-dialog-body with-footer">
<div class="umb-pane" ng-if="!vm.creatingFolder">
<div class="umb-pane" ng-if="!vm.creatingFolder && !vm.creatingFile">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>
<!-- Main options -->
<div ng-if="!vm.showSnippets">
<ul class="umb-actions umb-actions-child">
<li>
<a href="" ng-click="vm.createPartialViewMacro()" umb-auto-focus>
<i class="large icon-article"></i>
<span class="menu-label"><localize key="create_newEmptyPartialViewMacro">New empty partial view macro</localize></span>
</a>
</li>
<li>
<a href="" ng-click="vm.showCreateFromSnippet()">
<i class="large icon-article"></i>
<span class="menu-label"><localize key="create_newPartialViewMacroFromSnippet">New partial view macro from snippet</localize></span>
</a>
</li>
<li>
<a href="" ng-click="vm.showCreateFolder()">
<i class="large icon-folder"></i>
<span class="menu-label"><localize key="general_folder"></localize></span>
</a>
</li>
</ul>
</div>
<ul class="umb-actions umb-actions-child">
<li>
<a href="" ng-click="vm.showCreateFile()" umb-auto-focus>
<i class="large icon-article"></i>
<span class="menu-label"><localize key="create_newPartialViewMacro">New partial view macro</localize></span>
</a>
</li>
<li>
<a href="" ng-click="vm.showCreateFolder()">
<i class="large icon-folder"></i>
<span class="menu-label"><localize key="general_folder"></localize></span>
</a>
</li>
</ul>
<!-- Snippets list -->
<div ng-if="vm.showSnippets">
<ul class="umb-actions umb-actions-child">
<li ng-repeat="snippet in vm.snippets">
<a href="" ng-click="vm.createPartialViewMacro(snippet)" style="padding-top: 6px; padding-bottom: 6px;">
<i class="icon-article" style="font-size: 20px;"></i>
<span class="menu-label" style="margin-left: 0; padding-left: 5px;">{{ snippet.name }}</span>
</a>
</li>
</ul>
</div>
</div>
<!-- Create file -->
<div class="umb-pane" ng-if="vm.creatingFile">
<form novalidate name="createFileForm"
ng-submit="vm.createFile(createFileForm)"
val-form-manager>
<div ng-show="vm.createFileError">
<h5 class="text-error">{{vm.createFileError.errorMsg}}</h5>
<p class="text-error">{{vm.createFileError.data.message}}</p>
</div>
<umb-control-group label="Enter a file name" hide-label="false">
<input type="text" name="fileName" ng-model="vm.fileName" class="umb-textstring textstring input-block-level" umb-auto-focus required no-dirty-check />
<div>
<label class="checkbox">
<input type="checkbox" name="createMacro" ng-model="vm.createMacro" ng-true-value="true" ng-false-value="false" no-dirty-check/>
Create corresponding macro
</label>
</div>
</umb-control-group>
<umb-control-group label="Select a snippet (or create an empty file)" hide-label="false">
<select name="snippet"
class="umb-editor umb-dropdown"
ng-model="vm.snippet"
ng-options="snippet.fileName as snippet.name for snippet in vm.snippets"></select>
</umb-control-group>
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
</form>
</div>
<!-- Create folder -->
@@ -49,14 +64,14 @@
<form novalidate name="createFolderForm"
ng-submit="vm.createFolder(createFolderForm)"
val-form-manager>
<div ng-show="vm.createFolderError">
<h5 class="text-error">{{vm.createFolderError.errorMsg}}</h5>
<p class="text-error">{{vm.createFolderError.data.message}}</p>
</div>
<umb-control-group label="Enter a folder name" hide-label="false">
<input type="text" name="folderName" ng-model="vm.folderName" class="umb-textstring textstring input-block-level" umb-auto-focus required />
<input type="text" name="folderName" ng-model="vm.folderName" class="umb-textstring textstring input-block-level" umb-auto-focus required no-dirty-check />
</umb-control-group>
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
@@ -26,7 +26,7 @@
/* Functions bound to view model */
function save() {
vm.page.saveButtonState = "busy";
vm.partialViewMacro.content = vm.editor.getValue();
@@ -70,7 +70,7 @@
}, function (err) {
vm.page.saveButtonState = "error";
localizationService.localize("speechBubbles_validationFailedHeader").then(function (headerValue) {
localizationService.localize("speechBubbles_validationFailedMessage").then(function(msgValue) {
notificationsService.error(headerValue, msgValue);
@@ -104,7 +104,7 @@
var code = templateHelper.getInsertDictionarySnippet(model.insert.node.name);
insert(code);
break;
case "umbracoField":
insert(model.insert.umbracoField);
break;
@@ -169,7 +169,7 @@
vm.pageFieldOverlay.show = false;
vm.pageFieldOverlay = null;
// focus editor
vm.editor.focus();
vm.editor.focus();
}
};
}
@@ -212,7 +212,7 @@
var code = templateHelper.getQuerySnippet(model.result.queryExpression);
insert(code);
vm.queryBuilderOverlay.show = false;
vm.queryBuilderOverlay = null;
},
@@ -222,7 +222,7 @@
vm.queryBuilderOverlay.show = false;
vm.queryBuilderOverlay = null;
// focus editor
vm.editor.focus();
vm.editor.focus();
}
};
}
@@ -232,9 +232,9 @@
function init() {
//we need to load this somewhere, for now its here.
assetsService.loadCss("lib/ace-razor-mode/theme/razor_chrome.css");
if ($routeParams.create) {
var snippet = "Empty";
if($routeParams.snippet) {
@@ -242,6 +242,9 @@
}
codefileResource.getScaffold("partialViewMacros", $routeParams.id, snippet).then(function (partialViewMacro) {
if ($routeParams.name) {
partialViewMacro.name = $routeParams.name;
}
ready(partialViewMacro, false);
});
@@ -276,7 +279,7 @@
},
onLoad: function(_editor) {
vm.editor = _editor;
// initial cursor placement
// Keep cursor in name field if we are create a new template
// else set the cursor at the bottom of the code editor
@@ -291,6 +294,8 @@
//change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);
}
}
@@ -309,8 +314,12 @@
vm.currentPosition = vm.editor.getCursorPosition();
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form
var currentForm = angularHelper.getCurrentForm($scope);
@@ -322,7 +331,7 @@
}
}
init();
}
@@ -367,6 +367,8 @@
//change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);
}
}
@@ -385,6 +387,10 @@
vm.currentPosition = vm.editor.getCursorPosition();
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form
@@ -30,10 +30,10 @@
<div class="control-group">
<label>Size</label>
<input name="newItem.width" type="number" placeholder="Width"
ng-model="newItem.width" class="umb-editor-tiny" val-highlight="{{hasError}}" />
ng-model="newItem.width" class="umb-editor-small" val-highlight="{{hasError}}" />
&times;
<input name="newItem.height" type="number" placeholder="Height"
ng-model="newItem.height" class="umb-editor-tiny" val-highlight="{{hasError}}" />
ng-model="newItem.height" class="umb-editor-small" val-highlight="{{hasError}}" />
</div>
<div class="control-group">
@@ -1,7 +1,7 @@
(function () {
"use strict";
function ScriptsEditController($scope, $routeParams, $timeout, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService, templateHelper) {
function ScriptsEditController($scope, $routeParams, $timeout, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService, templateHelper, angularHelper) {
var vm = this;
var currentPosition = null;
@@ -169,9 +169,29 @@
});
}
vm.editor.on("change", changeAceEditor);
}
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form
var currentForm = angularHelper.getCurrentForm($scope);
// set state
if(state === "dirty") {
currentForm.$setDirty();
} else if(state === "pristine") {
currentForm.$setPristine();
}
}
}
init();
@@ -264,6 +264,7 @@
//change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);
}
}
@@ -308,7 +309,7 @@
break;
case "partial":
var code = templateHelper.getInsertPartialSnippet(model.insert.node.name);
var code = templateHelper.getInsertPartialSnippet(model.insert.node.parentId, model.insert.node.name);
insert(code);
break;
@@ -418,9 +419,15 @@
multiPicker: false,
show: true,
title: localizationService.localize("template_insertPartialView"),
filter: function(i) {
if(i.name.indexOf(".cshtml") === -1 && i.name.indexOf(".vbhtml") === -1) {
return true;
}
},
filterCssClass: "not-allowed",
select: function(node){
var code = templateHelper.getInsertPartialSnippet(node.name);
var code = templateHelper.getInsertPartialSnippet(node.parentId, node.name);
insert(code);
vm.partialItemOverlay.show = false;
@@ -632,6 +639,10 @@
vm.currentPosition = vm.editor.getCursorPosition();
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form
@@ -49,7 +49,11 @@
setValue: function() {},
focus: function() {},
clearSelection: function() {},
navigateFileStart: function() {}
navigateFileStart: function() {},
commands: {
bindKey: function() {},
addCommands: function() {}
}
};
controller = createController();
@@ -107,7 +111,10 @@
getInsertPartialSnippet: function() { return ""; },
getQuerySnippet: function() { return ""; },
getRenderBodySnippet: function() { return ""; },
getRenderSectionSnippet: function() { return ""; }
getRenderSectionSnippet: function() { return ""; },
getGeneralShortcuts: function() { return ""; },
getEditorShortcuts: function() { return ""; },
getTemplateEditorShortcuts: function() { return ""; }
}
});
}
@@ -23,9 +23,32 @@ describe('service: templateHelper', function () {
describe('getInsertPartialSnippet', function () {
it('should return the snippet for inserting a partial', function () {
var snippet = '@Html.Partial("nodeName")';
expect(templateHelper.getInsertPartialSnippet("nodeName")).toBe(snippet);
it('should return the snippet for inserting a partial from the root', function () {
var parentId = "";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});
it('should return the snippet for inserting a partial from a folder', function () {
var parentId = "Folder";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Folder/Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});
it('should return the snippet for inserting a partial from a nested folder', function () {
var parentId = "Folder/NestedFolder";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Folder/NestedFolder/Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});
it('should return the snippet for inserting a partial from a folder with spaces in its name', function () {
var parentId = "Folder with spaces";
var nodeName = "Footer.cshtml";
var snippet = '@Html.Partial("Folder with spaces/Footer")';
expect(templateHelper.getInsertPartialSnippet(parentId, nodeName)).toBe(snippet);
});
});
+2 -2
View File
@@ -127,8 +127,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\dotless.1.4.1.0\lib\dotless.Core.dll</HintPath>
</Reference>
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
<Reference Include="Examine, Version=0.1.82.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Examine.0.1.82\lib\net45\Examine.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
+1 -1
View File
@@ -4,7 +4,7 @@
<package id="ClientDependency" version="1.9.2" targetFramework="net45" />
<package id="ClientDependency-Mvc5" version="1.8.0.0" targetFramework="net45" />
<package id="dotless" version="1.4.1.0" targetFramework="net45" />
<package id="Examine" version="0.1.81" targetFramework="net45" />
<package id="Examine" version="0.1.82" targetFramework="net45" />
<package id="ImageProcessor" version="2.5.2" targetFramework="net45" />
<package id="ImageProcessor.Web" version="4.8.2" targetFramework="net45" />
<package id="ImageProcessor.Web.Config" version="2.3.0" targetFramework="net45" />
@@ -201,6 +201,7 @@
<key alias="newDataType">New data type</key>
<key alias="newJavascriptFile">New javascript file</key>
<key alias="newEmptyPartialView">New empty partial view</key>
<key alias="newPartialViewMacro">New partial view macro</key>
<key alias="newPartialViewFromSnippet">New partial view from snippet</key>
<key alias="newEmptyPartialViewMacro">New empty partial view macro</key>
<key alias="newPartialViewMacroFromSnippet">New partial view macro from snippet</key>
@@ -992,7 +993,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="dictionaryItemSaved">Dictionary item saved</key>
<key alias="editContentPublishedFailedByParent">Publishing failed because the parent page isn't published</key>
<key alias="editContentPublishedHeader">Content published</key>
<key alias="editContentPublishedText">and visible at the website</key>
<key alias="editContentPublishedText">and visible on the website</key>
<key alias="editContentSavedHeader">Content saved</key>
<key alias="editContentSavedText">Remember to publish to make changes visible</key>
<key alias="editContentSendToPublish">Sent For Approval</key>
@@ -982,7 +982,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="dictionaryItemSaved">Dictionary item saved</key>
<key alias="editContentPublishedFailedByParent">Publishing failed because the parent page isn't published</key>
<key alias="editContentPublishedHeader">Content published</key>
<key alias="editContentPublishedText">and visible at the website</key>
<key alias="editContentPublishedText">and visible on the website</key>
<key alias="editContentSavedHeader">Content saved</key>
<key alias="editContentSavedText">Remember to publish to make changes visible</key>
<key alias="editContentSendToPublish">Sent For Approval</key>
+122 -7
View File
@@ -123,7 +123,6 @@
<key alias="saveListView">Сохранить список</key>
<key alias="select">Выбрать</key>
<key alias="selectCurrentFolder">Выбрать текущую папку</key>
<key alias="selected">выбранные</key>
<key alias="showPage">Предварительный просмотр</key>
<key alias="showPageDisabled">Предварительный просмотр запрещен, так как документу не сопоставлен шаблон</key>
<key alias="somethingElse">Другие действия</key>
@@ -993,6 +992,7 @@
<key alias="installStateInstalling">Установка...</key>
<key alias="installStateRestarting">Перезапуск, подождите, пожалуйста...</key>
<key alias="installStateComplete">Все готово, сейчас браузер перезагрузит страницу, подождите, пожалуйста...</key>
<key alias="installStateCompleted">Пожалуйста, нажмите кнопку 'finish' для завершения установки и перезагрузки страницы.</key>
</area>
<area alias="paste">
<key alias="doNothing">Вставить, полностью сохранив форматирование (не рекомендуется)</key>
@@ -1119,9 +1119,9 @@
<key alias="statistics">Статистика</key>
<key alias="translation">Перевод</key>
<key alias="users">Пользователи</key>
<key alias="addIcon">Добавить значок</key>
</area>
<area alias="settings">
<key alias="addIcon">Добавить значок</key>
<key alias="asAContentMasterType">в качестве родительского типа. Вкладки родительского типа не показаны и могут быть изменены непосредственно в родительском типе</key>
<key alias="contentTypeEnabled">Родительский тип контента разрешен</key>
<key alias="contentTypeUses">Данный тип контента использует</key>
@@ -1158,6 +1158,16 @@
<key alias="toggleListView">В формате списка</key>
<key alias="toggleAllowAsRoot">Разрешить в качестве корневого</key>
<key alias="commentLine">Закомментировать/раскомментировать строки</key>
<key alias="removeLine">Удалить строку</key>
<key alias="copyLineUp">Копировать строки вверх</key>
<key alias="copyLineDown">Копировать строки вниз</key>
<key alias="moveLineUp">Переместить строки вверх</key>
<key alias="moveLineDown">Переместить строки вниз</key>
<key alias="generalHeader">Общее</key>
<key alias="editorHeader">Редактор</key>
</area>
<area alias="sort">
<key alias="sortOrder">Порядок сортировки</key>
@@ -1178,6 +1188,7 @@
<key alias="contentTypeTabDeletedText">Вкладка с идентификатором (id): %0% удалена</key>
<key alias="contentUnpublished">Документ скрыт (публикация отменена)</key>
<key alias="cssErrorHeader">Стиль CSS не сохранен</key>
<key alias="cssErrorText">При сохранении файла произошла ошибка.</key>
<key alias="cssSavedHeader">Стиль CSS сохранен</key>
<key alias="cssSavedText">Стиль CSS сохранен без ошибок</key>
<key alias="dataTypeSaved">Тип данных сохранен</key>
@@ -1202,9 +1213,13 @@
<key alias="fileErrorText">Файл не может быть сохранен. Пожалуйста, проверьте установки файловых разрешений</key>
<key alias="fileSavedHeader">Файл сохранен</key>
<key alias="fileSavedText">Файл сохранен без ошибок</key>
<key alias="invalidUserPermissionsText">У текущего пользователя недостаточно прав, невозможно завершить операцию</key>
<key alias="languageSaved">Язык сохранен</key>
<key alias="mediaTypeSavedHeader">Тип медиа сохранен</key>
<key alias="memberTypeSavedHeader">Тип участника сохранен</key>
<key alias="operationCancelledHeader">Отменено</key>
<key alias="operationCancelledText">Операция отменена установленным сторонним расширением или блоком кода</key>
<key alias="operationFailedHeader">Ошибка</key>
<key alias="partialViewErrorHeader">Представление не сохранено</key>
<key alias="partialViewErrorText">Произошла ошибка при сохранении файла</key>
<key alias="partialViewSavedHeader">Представление сохранено</key>
@@ -1213,10 +1228,16 @@
<key alias="pythonErrorText">Cкрипт Python не может быть сохранен в связи с ошибками</key>
<key alias="pythonSavedHeader">Cкрипт Python сохранен</key>
<key alias="pythonSavedText">Cкрипт Python сохранен без ошибок</key>
<key alias="scriptErrorHeader">Скрипт не сохранен</key>
<key alias="scriptErrorText">При сохранении файла скрипта произошла ошибка</key>
<key alias="scriptSavedHeader">Скрипт сохранен</key>
<key alias="scriptSavedText">Файл скрипта сохранен без ошибок</key>
<key alias="templateErrorHeader">Шаблон не сохранен</key>
<key alias="templateErrorText">Пожалуйста, проверьте, что нет двух шаблонов с одним и тем же алиасом (названием)</key>
<key alias="templateSavedHeader">Шаблон сохранен</key>
<key alias="templateSavedText">Шаблон сохранен без ошибок</key>
<key alias="validationFailedHeader">Проверка значений</key>
<key alias="validationFailedMessage">Ошибки, найденные при проверке значений, должны быть исправлены, чтобы было возможно сохранить документ</key>
<key alias="xsltErrorHeader">XSLT-документ не сохранен</key>
<key alias="xsltErrorText">XSLT-документ содержит одну или несколько ошибок</key>
<key alias="xsltPermissionErrorText">XSLT-документ не может быть сохранен, проверьте установки файловых разрешений</key>
@@ -1232,14 +1253,106 @@
<key alias="styles">Стили</key>
</area>
<area alias="template">
<key alias="edittemplate">Править шаблон</key>
<key alias="edittemplate">Изменить шаблон</key>
<key alias="insertSections">Секции</key>
<key alias="insertContentArea">Вставить контент-область</key>
<key alias="insertContentAreaPlaceHolder">Вставить контейнер (placeholder)</key>
<key alias="insertDictionaryItem">Вставить статью словаря</key>
<key alias="insertMacro">Вставить макрос</key>
<key alias="insertPageField">Вставить поле документа</key>
<key alias="insert">Вставить</key>
<key alias="insertDesc">Выберите, что хотите вставить в шаблон</key>
<key alias="insertDictionaryItem">Статью словаря</key>
<key alias="insertDictionaryItemDesc">Статья словаря - это контейнер для части текста, переводимой на разные языки, это позволяет упростить создание многоязычных сайтов.</key>
<key alias="insertMacro">Макрос</key>
<key alias="insertMacroDesc">
Макросы - это настраиваемые компоненты, которые хорошо подходят для
реализации переиспользуемых блоков, (особенно, если необходимо менять их внешний вид и/или поведение при помощи параметров)
таких как галереи, формы, списки и т.п.
</key>
<key alias="insertPageField">Значение поля</key>
<key alias="insertPageFieldDesc">Отображает значение указанного поля данных текущей страницы,
с возможностью указать альтернативные поля и/или подстановку константы.
</key>
<key alias="insertPartialView">Частичное представление</key>
<key alias="insertPartialViewDesc">
Частичное представление - это шаблон в отдельном файле, который может быть вызван для отображения внутри
другого шаблона, хорошо подходит для реализации переиспользуемых фрагментов разметки или для разбиения сложных шаблонов на составные части.
</key>
<key alias="mastertemplate">Мастер-шаблон</key>
<key alias="quickGuide">Краткая справка по тэгам шаблонов Umbraco</key>
<key alias="noMastertemplate">Без мастер-шаблона</key>
<key alias="noMaster">Не выбран</key>
<key alias="renderBody">Вставить дочерний шаблон</key>
<key alias="renderBodyDesc">
<![CDATA[
Отображает содержимое дочернего шаблона, при помощи вставки конструкции
<code>@RenderBody()</code> в выбранном месте.
]]>
</key>
<key alias="defineSection">Определить именованную секцию</key>
<key alias="defineSectionDesc">
<![CDATA[
Определяет специальную область шаблона как именованную секцию путем оборачивания ее в конструкцию
<code>@section { ... }</code>. Такая секци может быть отображена в нужном месте родительского шаблона
при помощи конструкции <code>@RenderSection</code>.
]]>
</key>
<key alias="renderSection">Вставить именованную секцию</key>
<key alias="renderSectionDesc">
<![CDATA[
Отображает содержимое именованной области дочернего шаблона, при помощи вставки конструкции <code>@RenderSection(name)</code>.
Таким образом из дочернего шаблона отображается содержимое внутри конструкции <code>@section [name]{ ... }</code>.
]]>
</key>
<key alias="sectionName">Название секции</key>
<key alias="sectionMandatory">Секция обязательна</key>
<key alias="sectionMandatoryDesc">
Если секция помечена как обязательная, то дочерний шаблон должен обязательно содержать ее определение <code>@section</code>, в противном случае генерируется ошибка.
</key>
<key alias="queryBuilder">Генератор запросов</key>
<key alias="itemsReturned">элементов в результате, за</key>
<key alias="iWant">Мне нужны</key>
<key alias="allContent">все документы</key>
<key alias="contentOfType">документы типа &quot;%0%&quot;</key>
<key alias="from">из</key>
<key alias="websiteRoot">всего сайта</key>
<key alias="where">где</key>
<key alias="and">и</key>
<key alias="is">равна</key>
<key alias="isNot">не равна</key>
<key alias="before">до</key>
<key alias="beforeIncDate">до (включая выбранную дату)</key>
<key alias="after">после</key>
<key alias="afterIncDate">после (включая выбранную дату)</key>
<key alias="equals">равно</key>
<key alias="doesNotEqual">не равно</key>
<key alias="contains">содержит</key>
<key alias="doesNotContain">не содержит</key>
<key alias="greaterThan">больше, чем</key>
<key alias="greaterThanEqual">больше или равно</key>
<key alias="lessThan">меньше, чем</key>
<key alias="lessThanEqual">меньше или равно</key>
<key alias="id">Id</key>
<key alias="name">Название</key>
<key alias="createdDate">Создан</key>
<key alias="lastUpdatedDate">Обновлен</key>
<key alias="orderBy">сортировать</key>
<key alias="ascending">по возрастанию</key>
<key alias="descending">по убыванию</key>
<key alias="template">Шаблон</key>
</area>
<area alias="templateEditor">
@@ -1343,6 +1456,7 @@
<key alias="packager">Пакеты дополнений</key>
<key alias="packages">Пакеты дополнений</key>
<key alias="python">Скрипты Python</key>
<key alias="relationTypes">Типы связей</key>
<key alias="repositories">Установить из репозитория</key>
<key alias="runway">Установить Runway</key>
<key alias="runwayModules">Модули Runway </key>
@@ -1361,6 +1475,7 @@
<area alias="user">
<key alias="administrators">Администратор</key>
<key alias="categoryField">Поле категории</key>
<key alias="change">Изменить</key>
<key alias="changePassword">Изменить пароль</key>
<key alias="changePasswordDescription">Вы можете сменить свой пароль для доступа к административной панели Umbraco, заполнив нижеследующие поля и нажав на кнопку 'Изменить пароль'</key>
<key alias="confirmNewPassword">Подтверждение нового пароля</key>
@@ -80,7 +80,7 @@
<div id="feedbackMsg" data-bind="visible: processStatus() == 'complete'">
<div data-bind="css: { success: isSuccessful(), error: !isSuccessful() }">
<div data-bind="css: { 'text-success': isSuccessful(), 'text-error': !isSuccessful() }">
<span data-bind="text: resultMessage, visible: resultMessages().length == 0"></span>
<ul data-bind="foreach: resultMessages, visible: resultMessages().length > 1">
<li data-bind="text: message"></li>
+4 -4
View File
@@ -112,7 +112,7 @@
<add path="GoogleSpellChecker.ashx" xdt:Transform="Remove" xdt:Locator="Match(path)" />
</httpHandlers>
</system.web>
<system.web>
<compilation xdt:Transform="InsertIfMissing" />
<compilation>
@@ -308,10 +308,10 @@
<add name=" UmbracoModule" xdt:Locator="Match(name)" xdt:Transform="Remove" />
<add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
</httpModules>
</system.web>
<system.web.extensions xdt:Transform="Remove" />
<system.codedom xdt:Transform="Remove" />
@@ -386,7 +386,7 @@
xdt:Locator="Condition(_defaultNamespace:assemblyIdentity[@name='HtmlAgilityPack']])" />
<dependentAssembly xdt:Transform="Insert">
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="1.4.5.0-1.4.6.0" newVersion="1.4.6.0" />
<bindingRedirect oldVersion="1.4.5.0-1.4.9.5" newVersion="1.4.9.5" />
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove"
+4 -4
View File
@@ -176,7 +176,7 @@
<remove assembly="System.Threading.Tasks.Parallel" />
<remove assembly="System.Xml.ReaderWriter" />
<remove assembly="System.Xml.XDocument" />
<remove assembly="System.Xml.XmlSerializer" />
<remove assembly="System.Xml.XmlSerializer" />
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Umbraco.ModelsBuilder"/>
@@ -229,7 +229,7 @@
<add assembly="System.Threading.Tasks.Parallel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Xml.ReaderWriter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Xml.XDocument, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Xml.XmlSerializer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Xml.XmlSerializer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
<buildProviders>
<add extension=".cshtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
@@ -383,7 +383,7 @@
<!-- Ensure correct version of HtmlAgilityPack -->
<dependentAssembly>
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.9.0" newVersion="1.4.9.0" />
<bindingRedirect oldVersion="0.0.0.0-1.4.9.5" newVersion="1.4.9.5" />
</dependentAssembly>
<dependentAssembly>
@@ -395,7 +395,7 @@
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="9.0.0.0" />
@@ -103,13 +103,13 @@ namespace Umbraco.Web.Cache
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey);
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey);
var dataTypeCache = ApplicationContext.Current.ApplicationCache.IsolatedRuntimeCache.GetCache<IDataTypeDefinition>();
payloads.ForEach(payload =>
{
//clears the prevalue cache
var dataTypeCache = ApplicationContext.Current.ApplicationCache.IsolatedRuntimeCache.GetCache<IDataTypeDefinition>();
if (dataTypeCache)
dataTypeCache.Result.ClearCacheByKeySearch(string.Format("{0}{1}", CacheKeys.DataTypePreValuesCacheKey, payload.Id));
dataTypeCache.Result.ClearCacheByKeySearch(string.Format("{0}_{1}", CacheKeys.DataTypePreValuesCacheKey, payload.Id));
PublishedContentType.ClearDataType(payload.Id);
});
@@ -254,7 +254,7 @@ namespace Umbraco.Web.Editors
},
{
"treeApplicationApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<ApplicationTreeController>(
controller => controller.GetApplicationTrees(null, null, null))
controller => controller.GetApplicationTrees(null, null, null, true))
},
{
"contentTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<ContentTypeController>(
+25 -4
View File
@@ -10,6 +10,7 @@ using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using umbraco;
using Umbraco.Core;
using Umbraco.Core.Models;
namespace Umbraco.Web.Editors
{
@@ -29,7 +30,7 @@ namespace Umbraco.Web.Editors
/// </summary>
/// <returns></returns>
/// <remarks>
/// Note that ALL logged in users have access to this method because editors will need to isnert macros into rte (content/media/members) and it's used for
/// Note that ALL logged in users have access to this method because editors will need to isnert macros into rte (content/media/members) and it's used for
/// inserting into templates/views/etc... it doesn't expose any sensitive data.
/// </remarks>
public IEnumerable<MacroParameter> GetMacroParameters(int macroId)
@@ -50,9 +51,9 @@ namespace Umbraco.Web.Editors
/// <param name="pageId"></param>
/// <param name="macroParams">
/// To send a dictionary as a GET parameter the query should be structured like:
///
///
/// ?macroAlias=Test&pageId=3634&macroParams[0].key=myKey&macroParams[0].value=myVal&macroParams[1].key=anotherKey&macroParams[1].value=anotherVal
///
///
/// </param>
/// <returns></returns>
[HttpGet]
@@ -129,6 +130,26 @@ namespace Umbraco.Web.Editors
"text/html");
return result;
}
[HttpPost]
public HttpResponseMessage CreatePartialViewMacroWithFile(CreatePartialViewMacroWithFileModel model)
{
var macro = new Macro
{
Alias = model.Filename,
Name = model.Filename, // will be "aliased"
ScriptPath = "~/Views/MacroPartials/" + model.Parent + "/" + model.Filename + ".cshtml"
};
Services.MacroService.Save(macro); // may throw
return new HttpResponseMessage(HttpStatusCode.OK);
}
public class CreatePartialViewMacroWithFileModel
{
public string Parent { get; set; }
public string Filename { get; set; }
}
}
}
@@ -64,7 +64,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
var url = HealthCheckContext.HttpContext.Request.Url;
// Access the site home page and check for the click-jack protection header or meta tag
var useSsl = GlobalSettings.UseSSL || HealthCheckContext.HttpContext.Request.ServerVariables["SERVER_PORT"] == "443";
var serverVariables = HealthCheckContext.HttpContext.Request.ServerVariables;
var useSsl = GlobalSettings.UseSSL || serverVariables["SERVER_PORT"] == "443";
var address = string.Format("http{0}://{1}:{2}", useSsl ? "s" : "", url.Host.ToLower(), url.Port);
var request = WebRequest.Create(address);
request.Method = "GET";
@@ -49,7 +49,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
var url = HealthCheckContext.HttpContext.Request.Url;
// Access the site home page and check for the headers
var useSsl = GlobalSettings.UseSSL || HealthCheckContext.HttpContext.Request.ServerVariables["SERVER_PORT"] == "443";
var serverVariables = HealthCheckContext.HttpContext.Request.ServerVariables;
var useSsl = GlobalSettings.UseSSL || serverVariables["SERVER_PORT"] == "443";
var address = string.Format("http{0}://{1}:{2}", useSsl ? "s" : "", url.Host.ToLower(), url.Port);
var request = WebRequest.Create(address);
request.Method = "HEAD";
@@ -48,12 +48,22 @@ namespace Umbraco.Web.HealthCheck
return healthCheckGroups;
}
[HttpGet]
public object GetStatus(Guid id)
{
var check = _healthCheckResolver.HealthChecks.FirstOrDefault(x => x.Id == id);
if (check == null) throw new InvalidOperationException("No health check found with ID " + id);
return check.GetStatus();
try
{
//Core.Logging.LogHelper.Debug<HealthCheckController>("Running health check: " + check.Name);
return check.GetStatus();
}
catch (Exception e)
{
Core.Logging.LogHelper.Error<HealthCheckController>("Exception in health check: " + check.Name, e);
throw;
}
}
[HttpPost]
@@ -19,7 +19,7 @@ namespace Umbraco.Web.HealthCheck
/// </remarks>
internal class HealthCheckResolver : LazyManyObjectsResolverBase<HealthCheckResolver, HealthCheck>, IHealthCheckResolver
{
public HealthCheckResolver(ILogger logger, Func<IEnumerable<Type>> lazyTypeList)
public HealthCheckResolver(ILogger logger, Func<IEnumerable<Type>> lazyTypeList)
: base(new HealthCheckServiceProvider(), logger, lazyTypeList, ObjectLifetimeScope.HttpRequest)
{
}
@@ -51,7 +51,7 @@ namespace Umbraco.Web.HealthCheck
new HealthCheckContext(new HttpContextWrapper(HttpContext.Current), UmbracoContext.Current)
});
}
//use normal ctor
return Activator.CreateInstance(serviceType);
}
@@ -37,7 +37,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(display => display.IsContainer, expression => expression.MapFrom(content => content.ContentType.IsContainer))
.ForMember(display => display.IsChildOfListView, expression => expression.Ignore())
.ForMember(display => display.Trashed, expression => expression.MapFrom(content => content.Trashed))
.ForMember(display => display.PublishDate, expression => expression.MapFrom(content => GetPublishedDate(content, applicationContext)))
.ForMember(display => display.PublishDate, expression => expression.MapFrom(content => GetPublishedDate(content)))
.ForMember(display => display.TemplateAlias, expression => expression.MapFrom(content => content.Template.Alias))
.ForMember(display => display.HasPublishedVersion, expression => expression.MapFrom(content => content.HasPublishedVersion))
.ForMember(display => display.Urls,
@@ -78,6 +78,12 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(dto => dto.Alias, expression => expression.Ignore());
}
private static DateTime? GetPublishedDate(IContent content)
{
var date = ((Content) content).PublishedDate;
return date == default (DateTime) ? (DateTime?) null : date;
}
/// <summary>
/// Maps the generic tab with custom properties for content
/// </summary>
@@ -89,31 +95,9 @@ namespace Umbraco.Web.Models.Mapping
private static void AfterMap(IContent content, ContentItemDisplay display, IDataTypeService dataTypeService,
ILocalizedTextService localizedText, IContentTypeService contentTypeService)
{
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
//TODO: Fix this shorthand .Ancestors() lookup, at least have an overload to use the current
if (content.HasIdentity)
{
var ancesctorListView = content.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
display.IsChildOfListView = ancesctorListView != null;
}
else
{
//it's new so it doesn't have a path, so we need to look this up by it's parent + ancestors
var parent = content.Parent();
if (parent == null)
{
display.IsChildOfListView = false;
}
else if (parent.ContentType.IsContainer)
{
display.IsChildOfListView = true;
}
else
{
var ancesctorListView = parent.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
display.IsChildOfListView = ancesctorListView != null;
}
}
// map the IsChildOfListView (this is actually if it is a descendant of a list view!)
var parent = content.Parent();
display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path));
//map the tree node url
if (HttpContext.Current != null)
@@ -229,26 +213,7 @@ namespace Umbraco.Web.Models.Mapping
}
/// <summary>
/// Gets the published date value for the IContent object
/// </summary>
/// <param name="content"></param>
/// <param name="applicationContext"></param>
/// <returns></returns>
private static DateTime? GetPublishedDate(IContent content, ApplicationContext applicationContext)
{
if (content.Published)
{
return content.UpdateDate;
}
if (content.HasPublishedVersion)
{
var published = applicationContext.Services.ContentService.GetPublishedVersion(content.Id);
return published.UpdateDate;
}
return null;
}
/// <summary>
//TODO: This is horribly inneficient
/// Creates the list of action buttons allowed for this user - Publish, Send to publish, save, unpublish returned as the button's 'letter'
/// </summary>
private class ActionButtonsResolver : ValueResolver<IContent, IEnumerable<char>>
@@ -42,7 +42,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(display => display.IsContainer, expression => expression.Ignore())
.ForMember(display => display.HasPublishedVersion, expression => expression.Ignore())
.ForMember(display => display.Tabs, expression => expression.ResolveUsing(new TabsAndPropertiesResolver(applicationContext.Services.TextService)))
.AfterMap((media, display) => AfterMap(media, display, applicationContext.Services.DataTypeService, applicationContext.Services.TextService, applicationContext.ProfilingLogger.Logger));
.AfterMap((media, display) => AfterMap(media, display, applicationContext.Services.DataTypeService, applicationContext.Services.TextService, applicationContext.Services.ContentTypeService, applicationContext.ProfilingLogger.Logger));
//FROM IMedia TO ContentItemBasic<ContentPropertyBasic, IMedia>
config.CreateMap<IMedia, ContentItemBasic<ContentPropertyBasic, IMedia>>()
@@ -67,34 +67,12 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(dto => dto.HasPublishedVersion, expression => expression.Ignore());
}
private static void AfterMap(IMedia media, MediaItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText, ILogger logger)
private static void AfterMap(IMedia media, MediaItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText, IContentTypeService contentTypeService, ILogger logger)
{
// Adapted from ContentModelMapper
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
//TODO: Fix this shorthand .Ancestors() lookup, at least have an overload to use the current
if (media.HasIdentity)
{
var ancesctorListView = media.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
display.IsChildOfListView = ancesctorListView != null;
}
else
{
//it's new so it doesn't have a path, so we need to look this up by it's parent + ancestors
var parent = media.Parent();
if (parent == null)
{
display.IsChildOfListView = false;
}
else if (parent.ContentType.IsContainer)
{
display.IsChildOfListView = true;
}
else
{
var ancesctorListView = parent.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
display.IsChildOfListView = ancesctorListView != null;
}
}
var parent = media.Parent();
display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path));
//map the tree node url
if (HttpContext.Current != null)
+1
View File
@@ -175,6 +175,7 @@ namespace Umbraco.Web.Mvc
public IModelBinder GetBinder(Type modelType)
{
// can bind to RenderModel (exact type match)
// You might be tempted to change this to IRenderModel but do not change this: http://issues.umbraco.org/issue/U4-8216
if (modelType == typeof(RenderModel)) return this;
// can bind to RenderModel<TContent> (exact generic type match)
@@ -4,6 +4,7 @@ using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.XPath;
using umbraco;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models;
@@ -315,9 +316,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
private void InitializeNode()
{
InitializeNode(_xmlNode, UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema, _isPreviewing,
out _id, out _key, out _template, out _sortOrder, out _name, out _writerName,
out _urlName, out _creatorName, out _creatorId, out _writerId, out _docTypeAlias, out _docTypeId, out _path,
InitializeNode(_xmlNode, UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema, _isPreviewing,
out _id, out _key, out _template, out _sortOrder, out _name, out _writerName,
out _urlName, out _creatorName, out _creatorId, out _writerId, out _docTypeAlias, out _docTypeId, out _path,
out _version, out _createDate, out _updateDate, out _level, out _isDraft, out _contentType, out _properties,
PublishedContentType.Get);
@@ -345,7 +346,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
//return if this is null
if (xmlNode == null)
{
{
return;
}
@@ -407,8 +408,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
//dictionary to store the property node data
var propertyNodes = new Dictionary<string, XmlNode>();
var propertyNodes = new Dictionary<string, XmlNode>();
foreach (XmlNode n in xmlNode.ChildNodes)
{
var e = n as XmlElement;
@@ -432,7 +433,22 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
//lookup the content type and create the properties collection
contentType = getPublishedContentType(PublishedItemType.Content, docTypeAlias);
try
{
contentType = getPublishedContentType(PublishedItemType.Content, docTypeAlias);
}
catch (InvalidOperationException e)
{
content.Instance.RefreshContentFromDatabase();
throw new InvalidOperationException(
string.Format("{0}. This usually indicates that the content cache is corrupt; the content cache has been rebuilt in an attempt to self-fix the issue.",
//keep the original message but don't use this as an inner exception because we want the above message to be displayed, if we use the inner exception
//we can keep the stack trace but the header message will be the original message and the one we really want to display will be hidden below the fold.
e.Message));
}
properties = new Dictionary<string, IPublishedProperty>(StringComparer.OrdinalIgnoreCase);
//fill in the property collection
@@ -30,16 +30,17 @@ namespace Umbraco.Web.Trees
/// <param name="application">The application to load tree for</param>
/// <param name="tree">An optional single tree alias, if specified will only load the single tree for the request app</param>
/// <param name="queryStrings"></param>
/// <param name="onlyInitialized">An optional bool (defaults to true), if set to false it will also load uninitialized trees</param>
/// <returns></returns>
[HttpQueryStringFilter("queryStrings")]
public async Task<SectionRootNode> GetApplicationTrees(string application, string tree, FormDataCollection queryStrings)
public async Task<SectionRootNode> GetApplicationTrees(string application, string tree, FormDataCollection queryStrings, bool onlyInitialized = true)
{
if (string.IsNullOrEmpty(application)) throw new HttpResponseException(HttpStatusCode.NotFound);
var rootId = Constants.System.Root.ToString(CultureInfo.InvariantCulture);
//find all tree definitions that have the current application alias
var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, true).ToArray();
var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, onlyInitialized).ToArray();
if (appTrees.Count() == 1 || string.IsNullOrEmpty(tree) == false )
{
@@ -207,7 +207,11 @@ namespace Umbraco.Web.Trees
return false;
}
IContent content = Services.ContentService.GetById(entity.Id);
var content = Services.ContentService.GetById(entity.Id);
if (content == null)
{
return false;
}
return Security.CurrentUser.HasPathAccess(content);
}
@@ -308,7 +308,7 @@ namespace Umbraco.Web.Trees
{
IUmbracoEntity entity;
Guid idGuid = Guid.Empty;
Guid idGuid;
int idInt;
Udi idUdi;

Some files were not shown because too many files have changed in this diff Show More