Compare commits

...

240 Commits

Author SHA1 Message Date
Sebastiaan Janssen 7a181bd281 Bump version to 7.8.3 2018-04-20 10:59:13 +02:00
Sebastiaan Janssen 4a0cd87a38 U4-11253 New Chrome 66 trimStart function is overriding the Umbraco Core trimStart polyfill 2018-04-20 10:51:28 +02:00
Sebastiaan Janssen 1e2598a3a3 Bumps version to 7.8.2 2018-04-12 16:36:41 +02:00
Sebastiaan Janssen 19241995e8 Cherry picked - Fix scope leaks caused by database messenger [U4-11207] #2580 2018-04-12 16:23:33 +02:00
Sebastiaan Jansssen 3097a46ab3 Merge remote-tracking branch 'origin/dev-v7' into dev-v7.8
# Conflicts:
#	src/SolutionInfo.cs
#	src/Umbraco.Core/Configuration/UmbracoVersion.cs
2018-02-09 09:57:00 +01:00
Sebastiaan Jansssen c63156fcd8 Bump version to 7.7.11
(cherry picked from commit 0c25c36af0)
2018-02-09 09:53:52 +01:00
Stephan 84a90884e3 Merge pull request #2433 from umbraco/temp-U4-10947
Fix for not being able to save decimal value
2018-02-09 08:14:51 +01:00
Shannon d29b7311fa reverts the convertible2 back to what it was before 2018-02-09 10:08:25 +11:00
Shannon 17b59cc20f Updates the ObjectExtensions TryConvertTo code and moved all unit tests to ObjectExtensionsTests which now all pass 2018-02-09 10:02:51 +11:00
Robert 4423571eaa Added ConvertToNullableDecimalTest and check that fixes the decimal save issue 2018-02-08 16:21:09 +01:00
Sebastiaan Jansssen 28eb4ff03a Bump version to 7.8.1 2018-02-08 14:08:38 +01:00
Sebastiaan Jansssen 79517f171c Update UI.xml when upgrading 2018-02-08 14:07:54 +01:00
Stephan e76c42f874 Merge pull request #2434 from umbraco/temp-U4-U4-10950
Fix checkbox in nested content
2018-02-08 13:42:42 +01:00
Robert 151c35bc47 Moving check to TryToConvertValueToCrlType 2018-02-08 13:15:43 +01:00
Robert 84265a9716 Fix checkbox in nested content 2018-02-08 12:18:51 +01:00
Robert 6618388973 Fix for not being able to save decimal value 2018-02-08 12:10:57 +01:00
Warren Buckley b280bf73aa Merge pull request #2429 from umbraco/temp-U4-10937
U4-10937 Datepicker on Info tabe and dates on audit trail do not work…
2018-02-07 12:13:19 +00:00
Shannon a6d57a5f6d Updates the dateHelper when converting to a local date, we need to check if the current string format is in UTC format and ensure that it's loaded that way 2018-02-07 12:51:15 +11:00
Shannon 6b7a83c6c9 Updates logic for setting the scheduled publishing date/times to ensure that the local date/time is displayed but the server time is persisted 2018-02-07 11:17:02 +11:00
Sebastiaan Jansssen eb5f2e29a3 U4-10937 Datepicker on Info tabe and dates on audit trail do not work if server time needs offsetting 2018-02-06 19:15:15 +01:00
Mikkel Holck Madsen cf86409e3f Merge pull request #2427 from umbraco/temp-U4-10935
fixes: U4-10935 Intro tour doesn't start automatically on cloud
2018-02-06 11:04:02 +01:00
Mads Rasmussen 134f5e2601 fixes: U4-10935 Intro tour doesn't start automatically on cloud 2018-02-06 10:14:30 +01:00
Sebastiaan Jansssen 37ac524e8e Don't enable tours for upgraders 2018-02-05 22:37:47 +01:00
Sebastiaan Jansssen 43af2f8e55 Fix UI docs generator 2018-02-05 21:12:25 +01:00
Sebastiaan Jansssen a20584e3de Not beta009, Final! 2018-02-01 16:18:49 +01:00
Sebastiaan Jansssen 19ec26fef9 Merge remote-tracking branch 'origin/dev-v7' into dev-v7.8 2018-02-01 15:20:13 +01:00
Claus 527f98189a Merge pull request #2423 from umbraco/temp-u4-10897
temp U4-10897
2018-02-01 13:29:45 +01:00
Sebastiaan Janssen 78c289a559 Merge pull request #2425 from umbraco/mittonp-dev-v7
Mittonp dev v7
2018-02-01 08:59:35 +01:00
Sebastiaan Jansssen 646abb3aea Merge branch 'dev-v7' of https://github.com/mittonp/Umbraco-CMS into mittonp-dev-v7
# Conflicts:
#	src/Umbraco.Web.UI/umbraco/config/lang/da.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/en.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/es.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/fr.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/nl.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/pl.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/zh.xml
2018-02-01 08:57:47 +01:00
Sebastiaan Janssen 2af59471a2 Merge pull request #973 from mattbrailsford/dev-v7-insertmacrofix
Updated insert macro dialog to prevent closing on enter key
2018-02-01 08:28:59 +01:00
Sebastiaan Jansssen b76b09026b Merge branch 'dev-v7' into dev-v7.8
# Conflicts:
#	src/SolutionInfo.cs
#	src/Umbraco.Core/Configuration/UmbracoVersion.cs
#	src/Umbraco.Web.UI.Client/src/assets/img/installer.jpg
#	src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour.directive.js
#	src/Umbraco.Web.UI.Client/src/common/services/tour.service.js
#	src/Umbraco.Web.UI.Client/src/controllers/search.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/tours/umbintrocreatedoctype/doctypename/doctypename.controller.js
#	src/Umbraco.Web.UI.Client/src/views/users/views/user/details.html
#	src/Umbraco.Web.UI/config/BackOfficeTours/getting-started.json
#	src/Umbraco.Web/Editors/TourController.cs
#	src/Umbraco.Web/Models/BackOfficeTour.cs
#	src/Umbraco.Web/Models/BackOfficeTourStep.cs
#	src/Umbraco.Web/Models/Mapping/UserModelMapper.cs
#	src/Umbraco.Web/TourFilterResolver.cs
#	src/Umbraco.Web/Trees/MacroTreeController.cs
#	src/Umbraco.Web/WebApi/Filters/FeatureAuthorizeAttribute.cs
#	src/umbraco.cms/businesslogic/Packager/Installer.cs
#	src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs
2018-01-31 17:02:03 +01:00
Sebastiaan Janssen 090f89e5b6 Merge pull request #2223 from kgiszewski/fix/U4-6309
U4-6309: Fix black bars that appear on a RTE image resize
2018-01-31 10:43:29 +01:00
Stephan 4870afd2d3 U4-10897 - change enlisting priorities 2018-01-30 14:27:58 +01:00
Stephan 80257b6684 Revert "U4-10897 - change enlisting priorities"
This reverts commit 8f3a0b6919.
2018-01-30 14:26:59 +01:00
Stephan 8f3a0b6919 U4-10897 - change enlisting priorities 2018-01-30 14:25:43 +01:00
Stephan 9fd2f34343 U4-10897 - defer Examine indexing until scope is all done 2018-01-30 13:53:37 +01:00
Stephan e774717346 U4-10897 - expose enlisted mutable Xml in events 2018-01-30 13:14:01 +01:00
Warren Buckley 5f5759c8a3 Merge pull request #2422 from umbraco/temp-U4-10869
U4-10869 Make sure the getting started tour is only shown to the right users
2018-01-30 09:10:12 +00:00
Robert 0b90097aad "requiredSections" tour property documentation
Added a few words about "requiredSections" tour property
2018-01-30 10:00:54 +01:00
Sebastiaan Jansssen 7cd540c37e Remove additional premature uses of C#7 features 2018-01-29 14:35:30 +01:00
Sebastiaan Jansssen 83595ecaf5 Don't rely on C# 7 features 2018-01-29 14:06:25 +01:00
Robert e07c5e6ff8 Removed unused using directives 2018-01-29 13:18:11 +01:00
Robert 67ff827d67 Tours will only load if the current user has access to the same sections the tours has access to 2018-01-29 13:13:43 +01:00
Sebastiaan Jansssen 3f7159797f U4-10880 Update install background 2018-01-29 09:49:16 +01:00
Robert 6f81b7fe24 'getting-started' tour only available to admins 2018-01-25 12:10:34 +01:00
Stephan f2819f61e5 Merge pull request #2417 from umbraco/temp-u4-10846
U4-10846 - fix member group cache
2018-01-25 11:06:17 +01:00
Sebastiaan Janssen 2107e9d9e3 Merge pull request #2420 from PerplexDaniel/patch-1
Fix NullReferenceException when HttpContext is not available
2018-01-25 10:18:32 +01:00
Daniël Knippers c623b448ba Fix NullReferenceException when HttpContext is null
This method will throw a NullReferenceException in contexts without an HttpContext, like is the case in background threads. As HttpContext is only used to set an isDebug flag, it seems more sensible to not throw in cases without an HttpContext, but simply set isDebug to false instead. If this is not acceptable behavior, could we perhaps look at something other than HttpContext.Current.IsDebuggingEnabled to decide whether isDebug should be set?
2018-01-25 08:56:46 +01:00
Sebastiaan Janssen 8bb49f57e8 Merge pull request #2419 from umbraco/redmorello-U4-10864_close_back_office_search_results
Redmorello u4 10864 close back office search results
2018-01-24 17:47:44 +01:00
Sebastiaan Jansssen da0b1c2f23 Merge branch 'U4-10864_close_back_office_search_results' of https://github.com/redmorello/Umbraco-CMS into redmorello-U4-10864_close_back_office_search_results
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/components/application/umb-navigation.html
2018-01-24 17:43:19 +01:00
Sebastiaan Jansssen a288fc62eb Workaround: keep the cache we used to have but clear all cache for membergroups when a member group changes 2018-01-24 17:26:21 +01:00
Sebastiaan Jansssen 82e50ccd3a Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2018-01-24 16:13:31 +01:00
Sebastiaan Jansssen 15b0dc9f29 Merge branch 'dev-v7.8' of https://github.com/kristoffer-tvera/Umbraco-CMS into kristoffer-tvera-dev-v7.8 2018-01-24 16:12:06 +01:00
Sebastiaan Janssen 8057d09fc2 Merge pull request #2416 from PeteDuncanson/patch-1
Prevent Pinterest messing with media in the back office
2018-01-24 15:53:40 +01:00
Sebastiaan Jansssen 8877100bf0 Merge branch 'dev-v7' into temp-u4-10846 2018-01-24 15:50:08 +01:00
Stephan 41c96e6e26 Merge pull request #2398 from leekelleher/issue/U4-10756
Proposed patch for U4-10756 - Guid TypedContent performance
2018-01-24 15:27:43 +01:00
Sebastiaan Jansssen abdd117264 Fixes bug in MB 3.0.9 2018-01-24 15:26:40 +01:00
Sebastiaan Jansssen 6272dac698 Use string.Format instead of interpolation 2018-01-24 14:34:21 +01:00
Sebastiaan Jansssen 7a4b5fa796 Bump version to 7.7.10 2018-01-24 14:34:03 +01:00
Sebastiaan Jansssen c962132ee0 Update to ModelsBuilder 3.0.9 2018-01-24 14:33:32 +01:00
leekelleher 0780979469 Eagerly populating the Guid lookup
as per @Shazwazza's comment: https://github.com/umbraco/Umbraco-CMS/pull/2398#issuecomment-358752346

Tested against 12,000 nodes (in the XML cache), profiling showed it took 55ms.
2018-01-24 11:53:52 +00:00
leekelleher a42e568fdf Initialized the ConcurrentDictionary statically
as per @JimBobSquarePants's comment: https://github.com/umbraco/Umbraco-CMS/pull/2398#discussion_r162799543
2018-01-24 11:51:53 +00:00
Robert e62661cc6a Merge pull request #2397 from leekelleher/issue/U4-10845
U4-10845 MNTP value-converter - trashed content causes database lookups
2018-01-24 12:48:29 +01:00
leekelleher 6841b2ac61 Amended the lookup dictionary setter,
as per @JimBobSquarePants's comment: https://github.com/umbraco/Umbraco-CMS/pull/2398#discussion_r162522998
2018-01-24 10:29:23 +00:00
leekelleher f7f4276485 Removed the need for the UseLegacyXmlSchema check
The enhancement in PR #2367 removed the `"@isDoc"` check,
which was the main difference between the legacy and current XML schema.

Reducing the XPath to `"//*[@key=$guid]"` will perform the same for both types of schema.
_(and saves on a couple of allocations)_
2018-01-24 10:29:23 +00:00
leekelleher bb9e23ca3e Proposed patch for U4-10756 - Guid TypedContent performance
This is a proposal for a temporary workaround to issue U4-10756.

It uses a local static ConcurrentDictionary to store a lookup of Guid/int values.
If the Guid isn't in the lookup, then the traditional XPath is used, which would add the resulting node ID (int) to the lookup.
If the lookup contains the Guid, then the returned int value will be used to perform a more efficient retrieval.

<http://issues.umbraco.org/issue/U4-10756>
2018-01-24 10:29:23 +00:00
Warren Buckley 10db9363f4 Merge pull request #2411 from umbraco/temp-U4-10757
Can navigate trough global search results
2018-01-24 09:35:07 +00:00
Sebastiaan Janssen 7d5d69e2e3 Merge pull request #2418 from abjerner/patch-36
Nested Content should use the new turquoise/purple colors as the rest of the backoffice
2018-01-23 22:02:16 +01:00
Sebastiaan Janssen 06897aa8c6 Merge pull request #2413 from umbraco/temp-u4-10853
U4-10853 - fix (scheduled) unpublishing issues
2018-01-23 21:55:53 +01:00
Anders Bjerner ee75158dd0 Nested Content should use the new turquoise/purple colors as the rest of the backoffice 2018-01-23 21:55:15 +01:00
Stephan c022397d86 U4-10846 - fix member group cache 2018-01-23 20:54:47 +01:00
Shannon e25f6e82ed Merge branch 'dev-v7' into dev-v7.8
# Conflicts:
#	src/SolutionInfo.cs
#	src/Umbraco.Core/Configuration/UmbracoVersion.cs
#	src/Umbraco.Web/Models/Mapping/UserModelMapper.cs
2018-01-23 11:42:14 -07:00
Shannon d104525a50 Updates core to use latest CDF version 2018-01-23 11:15:37 -07:00
Sebastiaan Janssen b0a64aa4b5 Merge pull request #2384 from umbraco/temp-u4-10822
U4-10822 - refactor view models binding error handling
2018-01-23 16:24:08 +01:00
Pete Duncanson ca86385269 Prevent Pinterest messing with media in the back office
Fixes: http://issues.umbraco.org/issue/U4-10865
2018-01-23 15:10:09 +00:00
Robert fb8368267e Merge pull request #2410 from umbraco/temp-U4-10851
Fixes U4-10851 - Unzip Umbraco packages into a flat structure
2018-01-23 16:06:41 +01:00
Claus ef4322a9b3 Merge pull request #2414 from umbraco/temp-u4-10844
U4-10844 - delete blueprints with content types
2018-01-23 15:15:15 +01:00
Stephan 7032e137b8 U4-10853 - refactor 2018-01-23 15:02:12 +01:00
Warren Buckley e99643ecfd Merge pull request #2415 from umbraco/temp-U4-10847
Removed authorize attribute from TourControlle
2018-01-23 13:44:52 +00:00
Robert a325529eb8 Merge pull request #2412 from umbraco/temp-U4-10840
Added in the create XML for the legacy UserControl based Create Dialog
2018-01-23 14:38:25 +01:00
Robert c68f832be6 Fixed anoying lower case delete action on macro context tree 2018-01-23 14:34:03 +01:00
Sebastiaan Janssen 4ab1c51327 Merge pull request #2392 from umbraco/temp-u4-10829
U4-10829 - fix tree controller
2018-01-23 14:13:39 +01:00
Robert 6f39bac32a Removed authorize attribute from TourControlle 2018-01-23 13:47:57 +01:00
Stephan e007a37c36 U4-10844 - delete blueprints with content types 2018-01-23 13:41:36 +01:00
Stephan ab9e029525 U4-10853 - fix (scheduled) unpublishing issues 2018-01-23 13:04:57 +01:00
Warren Buckley d298388a7b Update the UI.Release XML too 2018-01-23 11:47:59 +00:00
Warren Buckley 4463abe9bb Added in the create XML for the legacy UserControl based Create Dialog 2018-01-23 11:39:12 +00:00
Warren Buckley d1db38182f Fixes U4-10851 - Unzip Umbraco packages into a flat structure, so it supports packages that have files at the root, along with some packages that have the files nested insider another guid folder 2018-01-23 10:38:41 +00:00
Robert e808360653 Can navigate trough global search results 2018-01-23 10:46:02 +01:00
Mads Rasmussen c5df712471 Merge pull request #2405 from umbraco/temp-U4-10852
Fixes U4-10852 Where the ZipArchive stream was closed
2018-01-23 09:50:29 +01:00
Sebastiaan Janssen 2f67008987 Merge pull request #2407 from abjerner/patch-34
Removed unnecessary &nbsp;
2018-01-23 09:42:30 +01:00
Sebastiaan Janssen 1672e284c5 Merge pull request #2406 from abjerner/patch-33
Minor casing change
2018-01-23 09:41:46 +01:00
Ian Houghton 60ce36a7f2 U4-10864 add button when search returns no results, to clear the search 2018-01-22 22:03:35 +00:00
Mads Rasmussen 05c12d1f27 Merge pull request #2404 from umbraco/temp-U4-10843
Fixes U4-10843 and allows user detail page to upload a new avatar
2018-01-22 20:21:57 +01:00
Anders Bjerner 72e2cacc87 Removed unnecessary &nbsp; 2018-01-22 18:16:42 +01:00
Anders Bjerner 4285102422 Minor casing change 2018-01-22 18:08:37 +01:00
Warren Buckley 5ffdf4dd60 Fixes U4-10852 Where the ZipArchive stream was closed - 'Cannot access a closed Stream' 2018-01-22 14:20:01 +00:00
Mads Rasmussen abbcf0e26b Merge pull request #2358 from abjerner/patch-28
Triggers the save button to momentarily show an error icon
2018-01-22 14:55:10 +01:00
Sebastiaan Janssen 347b25472f Merge pull request #2403 from JimBobSquarePants/housekeeping-gitattributes
Add default gitattributes and cleanup editorconfig
2018-01-22 14:38:40 +01:00
Mads Rasmussen b745948dc6 Merge pull request #2361 from bjarnef/dev-v7-U4-10791
U4-10791 - Fix collapsed columns listview settings
2018-01-22 13:48:58 +01:00
Mads Rasmussen 8007c8869f Merge pull request #2401 from umbraco/temp-U4-10835
U4-10835 Adds context menu items to the User tree
2018-01-22 13:25:59 +01:00
Stephan b51a328ead Merge pull request #2402 from JimBobSquarePants/perf-tryconvertto
Performance - 8x Faster TryConvertTo
2018-01-22 13:22:22 +01:00
Warren Buckley f61437cc7c Fixes U4-10843 and allows user detail page to upload a new avatar 2018-01-22 12:09:28 +00:00
James Jackson-South f3b8f2eb5f Add default gitattributes and cleanup editorconfig 2018-01-22 21:44:08 +11:00
James Jackson-South de4628f450 Add perf explanation 2018-01-22 20:58:15 +11:00
James Jackson-South b0a64655b4 Fastest dictionary lookups 2018-01-22 16:43:02 +11:00
Stephan 48d88ec8fa Deal fix FIXME 2018-01-21 10:29:06 +01:00
Stephan 7ca151a3fa Use concurrent dictionaries 2018-01-21 10:18:13 +01:00
Stephan 363c8fab2c Cleanup 2018-01-21 10:03:17 +01:00
Stephan 8d4fd9d1cf Merge branch 'perf-tryconvertto' of https://github.com/JimBobSquarePants/Umbraco-CMS into perf-tryconvertto 2018-01-21 10:01:12 +01:00
James Jackson-South 24071eb3b1 Faster TryConvertTo 2018-01-20 14:54:52 +11:00
James Jackson-South 62ffbe7cf0 Cleanup benchmarks and add TryCOnvertTo 2018-01-20 13:00:10 +11:00
Warren Buckley f2d6b47e47 Update labels for context menu items to be just 'Create' & 'Invite' to keep the same consistency throughout the UI as other context menu items do not include the verb 2018-01-19 14:24:57 +00:00
Warren Buckley f3541908c7 Update Users tree context menu to include two new items that navigate directly to an Angular Location/Path which loads the Invite or Create User views as needed 2018-01-19 14:07:23 +00:00
Sebastiaan Jansssen 4e57e1cc18 Nicer variable name, thank to Lee Kelleher! 2018-01-19 12:50:45 +01:00
Sebastiaan Jansssen 410afffaa9 Optimizing use of newlines array 2018-01-19 12:42:04 +01:00
Claus 936e94789d adding to tinyMceConfig.Release.config. 2018-01-19 12:21:57 +01:00
Claus 468a56e5de Merge branch 'karltynan-dev-v7' into dev-v7 2018-01-19 11:11:53 +01:00
Claus 468ec8824a Merge branch 'dev-v7' of git://github.com/karltynan/Umbraco-CMS into karltynan-dev-v7 2018-01-19 11:11:13 +01:00
Sebastiaan Jansssen cad913b7a1 U4-10857 Update to ClientDependency 1.9.5 2018-01-19 08:26:34 +01:00
Sebastiaan Jansssen 382103d99d Bump version to 7.7.9 2018-01-19 08:26:33 +01:00
Sebastiaan Janssen cbb6b9bca0 Merge pull request #2310 from matthew-darby/U4-10495
U4-10495 - Install and customize buttons disabled
2018-01-18 18:38:37 +01:00
Sebastiaan Janssen a1b90a50cd Merge pull request #2343 from soreng/patch-5
Fix for U4-10733
2018-01-18 18:28:34 +01:00
Sebastiaan Janssen 9ea5855073 Merge pull request #2360 from janvanhelvoort/U4-10785
U4-10785 - Filtering of Grid Editors
2018-01-18 18:20:11 +01:00
Sebastiaan Janssen 4a37433042 Merge pull request #2372 from bjarnef/dev-v7-U4-10809
Fix checkmark tree icon, when custom font icon is used for tree icon
2018-01-18 18:00:53 +01:00
Sebastiaan Janssen 91469812d3 Merge pull request #2383 from MMasey/U4-10727
U4 10727 - If nodes with an empty name exist, it's not possible to empty recycle bin
2018-01-18 17:54:40 +01:00
Sebastiaan Janssen 68a8eb7f3f Merge pull request #2375 from redmorello/U4-10762
U4-10762 Fix issue with empty name when registering new members from …
2018-01-18 17:40:05 +01:00
Sebastiaan Janssen 2e7baabb94 Merge pull request #2394 from umbraco/temp-u4-10813
U4-10813 - fix error with groups having a large number of permissions
2018-01-18 17:27:11 +01:00
Sebastiaan Janssen 57745fe71d Merge pull request #2396 from leekelleher/issue/U4-10842
U4-10842 LegacyMediaPickerPropertyConverter null-reference check
2018-01-18 17:17:45 +01:00
Sebastiaan Janssen de6f9236e7 Merge pull request #2399 from leekelleher/issue/U4-8712
U4-8712 MultipleTextstring value newline delimiter changes
2018-01-18 17:13:46 +01:00
Sebastiaan Janssen a00c59e8b5 Merge pull request #2393 from umbraco/temp-u4-10079
U4-10079 - remove default template
2018-01-18 16:54:22 +01:00
Stephan 05c2da807f U4-10079 - fix test 2018-01-18 15:58:51 +01:00
leekelleher 0fd8ca43d6 U4-8712 MultipleTextstring value newline delimiter changes
PR #2185 goes towards resolving this, but doesn't handle the impromptu switch between the `\r\n` and `\n` newline delimiters when republishing a content node.

Using an explicit array of newline chars will resolve this, e.g. `Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)`

<http://issues.umbraco.org/issue/U4-8712>
2018-01-18 12:18:51 +00:00
leekelleher 87f09b2ee6 U4-10845 MultiNodeTreePickerPropertyConverter - trashed content causes database lookups
If the first ID in the MNTP value is a trashed content node, then the `ConvertSourceToObject` method would
check if the ID is a media or member node, both of these incur a database call.

This can cause a detrimental performance impact on the website.

This patch uses the `startNode.type` prevalue to detect the node type, (e.g. Content, Media or Member).
The prevalue is cached in a private `ConcurrentDictionary` and refreshed using the `DataTypeCacheRefresher` event.
> _Following the same caching-pattern as the Slider, Tags and MediaPicker value-converters._

<http://issues.umbraco.org/issue/U4-10845>
2018-01-18 10:49:18 +00:00
leekelleher e466878925 U4-10842 LegacyMediaPickerPropertyConverter ConvertDataToSource null-reference check
If a selected media node has been trashed on the source environment,
when Deploy comes to transfer the node ID, because it can't transfer the media dependency,
the node ID value is set to `null`.

This causes an issue for the `LegacyMediaPickerPropertyConverter`
and `ConvertDataToSource` throws a null-reference exception.

This patch adds in a null-reference check for the `source` value.

<http://issues.umbraco.org/issue/U4-10842>
2018-01-18 10:04:55 +00:00
Claus 7adf917570 Merge pull request #2395 from umbraco/temp-U4-10836
U4-10836 ContentService.GetPagedDescendants() is not returning any re…
2018-01-18 07:27:12 +01:00
Stephan 7c41db4bcc U4-10836 - fix a couple issues with the PR, and optimize 2018-01-17 17:14:26 +01:00
Stephan 5caaef7795 Merge branch origin/dev-v7.8 into temp-U4-10836 2018-01-17 16:54:28 +01:00
Claus 3b72945b1f applying path fix for MediaService. 2018-01-17 15:57:53 +01:00
Mads Rasmussen 71eb22d0e8 Merge branch 'dev-v7.8' of https://github.com/umbraco/Umbraco-CMS into dev-v7.8 2018-01-17 15:51:25 +01:00
Mads Rasmussen 9d780a2e8f fixes: U4-10837 CMS getting started tour can't create Home page 2018-01-17 15:50:01 +01:00
Claus 55b00069cb U4-10836 ContentService.GetPagedDescendants() is not returning any results 2018-01-17 15:40:25 +01:00
Robert b304728f4e Merge pull request #2390 from umbraco/temp-U4-10828
fixes: U4-10828 Add documentation to tour component and service
2018-01-17 14:27:01 +01:00
Mikulas Tomanka 319acc199e Merge pull request #2391 from matthew-darby/U4-10825
U4-10825 Search member by email in member section
2018-01-17 14:18:43 +01:00
Stephan 2a982f21a7 U4-10813 - fix error with groups having a large number of permissions 2018-01-17 13:07:03 +01:00
Stephan 3ff455f11d U4-10079 - remove default template 2018-01-17 11:36:08 +01:00
Stephan 41ad1bf27b U4-10829 - fix tree controller 2018-01-17 10:47:35 +01:00
Matt Darby f49d939a2d U4-10825 Search member by email in member section 2018-01-16 23:06:15 +08:00
Mads Rasmussen c7e80fc532 remove all client side code related to registering tours in the service. It should be done through .json files. 2018-01-16 13:40:57 +01:00
Mads Rasmussen b47d691841 add documentation to the tour component 2018-01-16 13:31:13 +01:00
Shannon 7e1e83b493 Fixes PackageInstaller event args to make sure the package metadata is passed through 2018-01-16 19:18:08 +11:00
Shannon f6971185f8 bumps version 2018-01-16 19:15:34 +11:00
Shannon 244429b972 Fixes PackageInstaller event args to make sure the package metadata is passed through 2018-01-16 19:15:01 +11:00
Shannon 80ceba36dc Merge branch 'dev-v7.8' of https://github.com/umbraco/Umbraco-CMS into dev-v7.8 2018-01-15 20:41:47 +11:00
Shannon d33b617851 bumps version, checks for feature resolver 2018-01-15 20:40:40 +11:00
Warren Buckley 2b5f370c92 Merge pull request #2351 from umbraco/temp-U4-9291
U4-9291 TypedSearch should have an overload specifying pager values, …
2018-01-15 09:38:51 +00:00
Shannon 4a0cf81d7d fixes test 2018-01-15 18:19:23 +11:00
Shannon fef743517f Allows for passing in an Unknown object type to the IEntityService.GetIdForKey and GetKeyForId methods 2018-01-15 18:05:52 +11:00
Shannon b3cbcebf5b Merge remote-tracking branch 'origin/dev-v7' into dev-v7.8
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/editorpicker/editorpicker.html
#	src/Umbraco.Web.UI.Client/src/views/components/application/umb-navigation.html
2018-01-15 16:27:29 +11:00
Shannon 3d90c2b83f oops, fixed returned type not picked up by compiler due to dynamics 2018-01-15 16:11:56 +11:00
Shannon 3b8b5b6dfa Merge branch 'dev-v7.8' into temp-U4-9291 2018-01-15 15:51:40 +11:00
Shannon Deminick 85f95cf067 Merge pull request #2386 from umbraco/temp-U4-10824
U4-10824 Helper methods for adding filters to tours
2018-01-15 14:30:48 +11:00
Sebastiaan Janssen 23be0134e7 Merge pull request #1605 from jobf/dev-v7
fix U4-8792 override overflow
2018-01-13 17:57:49 +01:00
Sebastiaan Janssen 355fb64d8b Merge pull request #1573 from drbldgtl/dev-v7-U4-6415
Renamed SerializeToCropDataSet to DeserializeToCropDataSet
2018-01-13 17:33:44 +01:00
Stephan 42959a1db5 U4-10822 - fix breaking change 2018-01-12 13:51:06 +01:00
Mads Rasmussen 5b754b3958 adding missing fieds to tour step model 2018-01-12 13:33:46 +01:00
Claus cba31986fe adding dynamic customProperties field to steps. 2018-01-12 11:46:13 +01:00
Claus 07b0267668 Merge pull request #2385 from umbraco/temp-U4-10804
Removed unused tour code from tour.service.js
2018-01-12 10:54:27 +01:00
Claus a83291cc6e tabs-spaces and stuff. 2018-01-12 10:54:10 +01:00
Kristoffer Tverå a1cd22208b Extra check before assigning value to currentColor
In version 7.7.7 with the latest version of LeBlender (1.0.9.2), colorpickers will throw a javascript error in console. Applying this small check will resolve that issue.
ref: https://our.umbraco.org/forum/contributing-to-umbraco-cms/88890-color-picker-cannot-read-property-hasownproperty-of-null
2018-01-12 10:45:59 +01:00
Claus 59d75277c2 fixing up helpers to match exact strings as this is what people will be using. If they need more advanced regex matches they should register by a regex instead. 2018-01-12 09:52:52 +01:00
Claus 69e193e887 U4-10824 Helper methods for adding filters to tours 2018-01-12 09:23:40 +01:00
Mads Rasmussen c3116d5df7 remove moment resolution for bower.json 2018-01-12 08:52:13 +01:00
Shannon Deminick b0b874212e Merge pull request #2381 from umbraco/temp-U4-10803
U4-10803: remove dependency on angular-moment
2018-01-12 14:43:06 +11:00
Shannon 19086ab3a1 Merge remote-tracking branch 'origin/dev-v7.8' into temp-U4-10803
# Conflicts:
#	src/Umbraco.Web.UI.Client/bower.json
2018-01-12 14:32:54 +11:00
Shannon Deminick 069594c3ac Merge pull request #2380 from umbraco/U4-10815
U4-10815 Make DisposableObjectSlim
2018-01-12 12:43:47 +11:00
Stephan 0bc4c7e2aa U4-10822 - refactor view models binding error handling 2018-01-11 16:42:20 +01:00
Stephan 7f12cff3bd Minor build cleanup 2018-01-11 16:25:18 +01:00
Robert 56adab43d6 Removed unused tour code from tour.service.js 2018-01-11 15:03:55 +01:00
Shannon 83294b6594 bump version 2018-01-12 00:32:00 +11:00
Shannon e0c89eb1ea Merge branch 'dev-v7.8' of https://github.com/umbraco/Umbraco-CMS into dev-v7.8 2018-01-12 00:20:21 +11:00
Shannon 9ad8e6a876 fixes nuspec for tour files 2018-01-12 00:20:06 +11:00
Mads Rasmussen 14b58386e5 fix tour backdropOpacity 2018-01-11 14:14:03 +01:00
Robert e26cbccfe0 Reverted DisposableObject.cs to its original state 2018-01-11 13:22:23 +01:00
Shannon 7dc06c1bea bumps version 2018-01-11 22:29:25 +11:00
Shannon Deminick effa984bdc Merge pull request #2371 from umbraco/temp-U4-10707
fixes: U4-10707 Config to order tour groups
2018-01-11 22:04:24 +11:00
Robert fa058f348d Forgot to removed TODO 2018-01-11 11:02:05 +01:00
Mads Rasmussen 62d9a1a132 Merge pull request #2379 from umbraco/mzajkowski-U4-4902
U4-4902 Enable 'discard changes' alert throughout the UI
2018-01-11 10:59:22 +01:00
Robert 9284269428 TODO's for DisposableObject and DisposableObjectSlim done 2018-01-11 10:53:45 +01:00
Mads Rasmussen f8c4481eb1 Merge branch 'dev-v7' into mzajkowski-U4-4902 2018-01-11 10:28:28 +01:00
Shannon d7f2041ee9 Makes the TourFilterResolver a real resolver 2018-01-11 18:00:42 +11:00
Mike 9f6e6e4701 Add tests to SimilarNodeNameTests to check for null and "" values. 2018-01-10 20:58:10 +00:00
Mike 34ba3f3351 Merge remote-tracking branch 'upstream/dev-v7' into U4-10727 2018-01-10 20:48:28 +00:00
Mike dcfb8b94d8 Refactor SimilarNodeName to account for null nodeName values. 2018-01-10 20:44:30 +00:00
Mads Rasmussen 0876004d9a U4-10803: remove dependency on angular-moment 2018-01-10 16:00:32 +01:00
Ilham Boulghallat 700b71f9fb Merge pull request #2377 from abjerner/patch-32
A few fixes for the Danish translation
2018-01-10 15:14:27 +01:00
Robert bba58ea0c0 Replaced all usages of DisposableObject with DisposableObjectSlim 2018-01-10 13:48:55 +01:00
Robert d0d4885812 Created slim version of DisposableObject and fixed some code indentation
DisposableObjectSlim has no finalizer
2018-01-10 13:36:53 +01:00
Claus ce11a377e6 refactor 2018-01-10 11:37:37 +01:00
Claus c6443c477f no need to log when throwing - that gets logged. 2018-01-10 11:13:28 +01:00
Claus eb94572361 updating pr to fit with base. 2018-01-10 10:55:46 +01:00
Claus fd8317493e Merge branch 'dev-v7.8' into temp-U4-10707
# Conflicts:
#	src/Umbraco.Web/Editors/TourController.cs
#	src/Umbraco.Web/Umbraco.Web.csproj
2018-01-10 10:10:19 +01:00
Robert 3642ff72a4 Removed console.log 2018-01-10 10:03:26 +01:00
Robert 6e830c1171 Wrapping the watch in the elm.focus
Seems to bring the watch calls way down.
2018-01-10 10:03:02 +01:00
Robert ab523baf4f Changed no-dirty-check directive to use scope.$watch to change $pristine to false 2018-01-10 09:24:42 +01:00
Claus 2dec03f441 Merge pull request #2374 from umbraco/temp-U4-10810
U4-10810 Update CDF to support storing TEMP files in environment %tem…
2018-01-10 09:04:58 +01:00
Claus 9ada0d9c97 reverting committed iis settings. 2018-01-10 09:03:35 +01:00
Shannon df553140e8 Updates to latest 1.9.4 of CDF and updates Nuspec 2018-01-10 12:25:24 +11:00
Anders Bjerner 0b898f2e32 A few fixes for the Danish translation 2018-01-09 22:54:48 +01:00
Ian Houghton f5f3676a56 U4-10762 Fix issue with empty name when registering new members from snippet 2018-01-09 15:51:32 +00:00
Mads Rasmussen f69f68e2b5 Merge branch 'temp-U4-10707' of https://github.com/umbraco/Umbraco-CMS into temp-U4-10707 2018-01-09 16:17:07 +01:00
Mads Rasmussen 3858656015 clear tours before registering new tours 2018-01-09 16:15:38 +01:00
Claus a5ec5f46ac filtering out tours. 2018-01-09 15:49:19 +01:00
Mads Rasmussen ea70e18a91 set "Getting Started"-tour group to order 100 so it is possible be add groups before and after 2018-01-09 14:13:27 +01:00
Mads Rasmussen 0cfd5773c3 set groupOrder on group so we don't order the tours in each group 2018-01-09 14:12:33 +01:00
Mads Rasmussen b15def99c7 format as json 2018-01-09 11:53:21 +01:00
Shannon bc828fc6f3 U4-10810 Update CDF to support storing TEMP files in environment %temp% location 2018-01-09 13:52:52 +11:00
Mike dc7b83ca6c Add initial test fix for SimilarNodeName when a node has no name. 2018-01-08 17:30:11 +00:00
Robert 8188e4ff55 Merge branch 'U4-4902' of git://github.com/mzajkowski/Umbraco-CMS into mzajkowski-U4-4902 2018-01-08 15:39:29 +01:00
Bjarne Fyrstenborg fcf9dcd803 Fix checkmark tree icon, when custom font icon is used for tree icon, e.g. in UCommerce 2018-01-08 14:40:31 +01:00
Mads Rasmussen 070fa11f8c fixes: U4-10707 Config to order tour groups 2018-01-08 14:11:53 +01:00
Sebastiaan Jansssen 3556043b55 Update to latest modelsbuilder 2018-01-08 12:44:29 +01:00
Bjarne Fyrstenborg fef9e3fde0 Ensure placeholder is same height as original rows 2017-12-29 22:49:06 +01:00
Bjarne Fyrstenborg e849d2d0d0 Add required ng-model to ui-sortable 2017-12-29 22:48:14 +01:00
Bjarne Fyrstenborg 9a6123579f Fix collapsed columns in row when sorting 2017-12-29 22:47:29 +01:00
Jan van Helvoort 591a881283 Filtering of Grid Editors
If there are more than 15 items, 5 rows of 3, then show the filter.
2017-12-24 15:48:16 +01:00
Anders Bjerner 1554d52ea9 Triggers the save button to momentarily show an error icon 2017-12-20 21:51:59 +01:00
Shannon 60924d93fb U4-9291 TypedSearch should have an overload specifying pager values, page size, page index, and with an out param to return the total number of results 2017-12-15 17:24:54 +11:00
Søren Gregersen 50335723b0 Fix for U4-10733 2017-12-06 10:09:40 +01:00
Karl Tynan 58697eaa04 Merge pull request #1 from karltynan/karltynan-patch-1
Added small to allowed TinyMCE valid elements
2017-11-21 15:20:06 +00:00
Karl Tynan ce58ad91b5 Added `small` to allowed TinyMCE valid elements
We use ``small`` a lot in the RTE, and ``small`` is now considered a really useful tag in HTML5. I would like to see this in the default valid elements list for people to use out-of-the box.
2017-11-21 15:18:42 +00:00
Marcin Zajkowski e14aba3875 More no-dirty-checks and code polishment 2017-11-07 23:21:50 +01:00
Matt Darby 77162e4b51 Move val-email attribute before required attribute 2017-11-07 19:17:42 +07:00
Marcin Zajkowski 0df7767f4a Added no-dirty-check to search fields in all dialogs 2017-11-02 17:32:20 +01:00
Kevin Giszewski 6c172702be Fix for U4-6309 2017-09-27 11:32:36 -04:00
jf 7566546fd7 fix U4-8792 override overflow 2016-11-03 17:32:24 +00:00
Shane Marsden 59b8b397b7 Renamed SerializeToCropDataSet to DeserializeToCropDataSet 2016-11-03 11:33:00 +00:00
Mitton 7c72e70967 Added grid editor names for localization. 2016-05-05 05:42:33 +02:00
Mitton 75b74a6687 Enabled localization of grid editor names 2016-05-05 05:12:33 +02:00
mattbrailsford 7dcb4435d8 Updated insert macro dialog to prevent closing on enter key 2015-12-22 11:18:32 +00:00
188 changed files with 4876 additions and 2892 deletions
+11 -5
View File
@@ -1,10 +1,16 @@
root=true
# editorconfig.org
# top-most EditorConfig file
root = true
# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.{cs,cshtml,csx,vb,vbx,vbhtml,fs,fsx,txt,ps1,sql}]
indent_size = 4
# Trim trailing whitespace, limited support.
# https://github.com/editorconfig/editorconfig/wiki/Property-research:-Trim-trailing-spaces
trim_trailing_whitespace = true
+49
View File
@@ -0,0 +1,49 @@
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.jpg binary
*.png binary
*.gif binary
*.cs text=auto diff=csharp
*.vb text=auto
*.c text=auto
*.cpp text=auto
*.cxx text=auto
*.h text=auto
*.hxx text=auto
*.py text=auto
*.rb text=auto
*.java text=auto
*.html text=auto
*.htm text=auto
*.css text=auto
*.scss text=auto
*.sass text=auto
*.less text=auto
*.js text=auto
*.lisp text=auto
*.clj text=auto
*.sql text=auto
*.php text=auto
*.lua text=auto
*.m text=auto
*.asm text=auto
*.erl text=auto
*.fs text=auto
*.fsx text=auto
*.hs text=auto
*.csproj text=auto merge=union
*.vbproj text=auto merge=union
*.fsproj text=auto merge=union
*.dbproj text=auto merge=union
*.sln text=auto eol=crlf merge=union
@@ -44,7 +44,7 @@ function Build-UmbracoDocs
# change baseUrl
$baseUrl = "https://our.umbraco.org/apidocs/ui/"
$indexPath = "$src/Umbraco.Web.UI.Client/docs/api/index.html"
(Get-Content $indexPath).Replace("location.href.replace(rUrl, indexFile)", "'$baseUrl'") `
(Get-Content $indexPath).Replace("origin + location.href.substr(origin.length).replace(rUrl, indexFile)", "'$baseUrl'") `
| Set-Content $indexPath
# restore
@@ -100,8 +100,9 @@ function Get-DocFx($uenv, $buildTemp)
$docFx = "$buildTemp\docfx"
if (-not (test-path $docFx))
{
Write-Host "Download DocFx..."
$source = "https://github.com/dotnet/docfx/releases/download/v2.19.2/docfx.zip"
Write-Host "Download DocFx from $source"
Invoke-WebRequest $source -OutFile "$buildTemp\docfx.zip"
&$uenv.Zip x "$buildTemp\docfx.zip" -o"$buildTemp\docfx" -aos > $nul
@@ -239,18 +239,18 @@ function Prepare-Tests
# data
Write-Host "Copy data files"
if( -Not (Test-Path -Path "$tmp\tests\Packaging" ) )
if (-Not (Test-Path -Path "$tmp\tests\Packaging" ) )
{
Write-Host "Create packaging directory"
New-Item -ItemType directory -Path "$tmp\tests\Packaging"
mkdir "$tmp\tests\Packaging" > $null
}
Copy-Files "$src\Umbraco.Tests\Packaging\Packages" "*" "$tmp\tests\Packaging\Packages"
# required for package install tests
if( -Not (Test-Path -Path "$tmp\tests\bin" ) )
if (-Not (Test-Path -Path "$tmp\tests\bin" ) )
{
Write-Host "Create bin directory"
New-Item -ItemType directory -Path "$tmp\tests\bin"
mkdir "$tmp\tests\bin" > $null
}
}
+1 -1
View File
@@ -28,7 +28,7 @@
<dependency id="HtmlAgilityPack" version="[1.4.9.5, 2.0.0)" />
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
<dependency id="MySql.Data" version="[6.9.9, 7.0.0)" />
<dependency id="ClientDependency" version="[1.9.2, 2.0.0)" />
<dependency id="ClientDependency" version="[1.9.6, 2.0.0)" />
<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="[10.0.2, 11.0.0)" />
+2 -2
View File
@@ -17,7 +17,7 @@
<dependencies>
<dependency id="UmbracoCms.Core" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[10.0.2, 11.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.8, 4.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.10, 4.0.0)" />
<dependency id="Microsoft.AspNet.SignalR.Core" version="[2.2.1, 3.0.0)" />
<dependency id="ImageProcessor.Web.Config" version="[2.3.1, 3.0.0)" />
</dependencies>
@@ -32,7 +32,7 @@
<file src="$BuildTmp$\WebApp\bin\amd64\**" target="UmbracoFiles\bin\amd64" />
<file src="$BuildTmp$\WebApp\bin\x86\**" target="UmbracoFiles\bin\x86" />
<file src="$BuildTmp$\WebApp\config\splashes\**" target="UmbracoFiles\Config\splashes" />
<file src="$BuildTmp$\WebApp\config\BackOfficeTours\**" target="UmbracoFiles\Config\BackOfficeTours" />
<file src="$BuildTmp$\WebApp\config\BackOfficeTours\**" target="Content\Config\BackOfficeTours" />
<file src="$BuildTmp$\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
<file src="$BuildTmp$\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
<file src="$BuildTmp$\WebApp\Media\Web.config" target="Content\Media\Web.config" />
+41
View File
@@ -98,10 +98,51 @@ if ($project) {
$umbracoUIXMLDestination = Join-Path $projectPath "Umbraco\Config\Create\UI.xml"
Copy-Item $umbracoUIXMLSource $umbracoUIXMLDestination -Force
} else {
# This part only runs for upgrades
$upgradeViewSource = Join-Path $umbracoFolderSource "Views\install\*"
$upgradeView = Join-Path $umbracoFolder "Views\install\"
Write-Host "Copying2 ${upgradeViewSource} to ${upgradeView}"
Copy-Item $upgradeViewSource $upgradeView -Force
Try
{
# Disable tours for upgrades, presumably Umbraco experience is already available
$umbracoSettingsConfigPath = Join-Path $configFolder "umbracoSettings.config"
$content = (Get-Content $umbracoSettingsConfigPath).Replace('<tours enable="true">','<tours enable="false">')
# Saves with UTF-8 encoding without BOM which makes sure Umbraco can still read it
# Reference: https://stackoverflow.com/a/32951824/5018
[IO.File]::WriteAllLines($umbracoSettingsConfigPath, $content)
}
Catch
{
# Not a big problem if this fails, let it go
}
Try
{
$uiXmlConfigPath = Join-Path $umbracoFolder -ChildPath "Config" | Join-Path -ChildPath "create" | Join-Path -ChildPath "UI.xml"
$uiXmlFile = Join-Path $umbracoFolder -ChildPath "Config" | Join-Path -ChildPath "create" | Join-Path -ChildPath "UI.xml"
$uiXml = New-Object System.Xml.XmlDocument
$uiXml.PreserveWhitespace = $true
$uiXml.Load($uiXmlFile)
$createExists = $uiXml.SelectNodes("//nodeType[@alias='macros']/tasks/create")
if($createExists.Count -eq 0)
{
$macrosTasksNode = $uiXml.SelectNodes("//nodeType[@alias='macros']/tasks")
#Creating: <create assembly="umbraco" type="macroTasks" />
$createNode = $uiXml.CreateElement("create")
$createNode.SetAttribute("assembly", "umbraco")
$createNode.SetAttribute("type", "macroTasks")
$macrosTasksNode.AppendChild($createNode)
$uiXml.Save($uiXmlFile)
}
}
Catch { }
}
$installFolder = Join-Path $projectPath "Install"
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.8.0")]
[assembly: AssemblyInformationalVersion("7.8.0-beta003")]
[assembly: AssemblyFileVersion("7.8.3")]
[assembly: AssemblyInformationalVersion("7.8.3")]
@@ -146,7 +146,7 @@ namespace Umbraco.Core.Cache
#region Insert
#endregion
private class NoopLocker : DisposableObject
private class NoopLocker : DisposableObjectSlim
{
protected override void DisposeResources()
{ }
@@ -0,0 +1,61 @@
using System;
namespace Umbraco.Core.Collections
{
/// <summary>
/// Represents a composite key of (Type, Type) for fast dictionaries.
/// </summary>
internal struct CompositeTypeTypeKey : IEquatable<CompositeTypeTypeKey>
{
/// <summary>
/// Initializes a new instance of the <see cref="CompositeTypeTypeKey"/> struct.
/// </summary>
public CompositeTypeTypeKey(Type type1, Type type2) : this()
{
Type1 = type1;
Type2 = type2;
}
/// <summary>
/// Gets the first type.
/// </summary>
public Type Type1 { get; private set; }
/// <summary>
/// Gets the second type.
/// </summary>
public Type Type2 { get; private set; }
/// <inheritdoc/>
public bool Equals(CompositeTypeTypeKey other)
{
return Type1 == other.Type1 && Type2 == other.Type2;
}
/// <inheritdoc/>
public override bool Equals(object obj)
{
var other = obj is CompositeTypeTypeKey ? (CompositeTypeTypeKey)obj : default(CompositeTypeTypeKey);
return Type1 == other.Type1 && Type2 == other.Type2;
}
public static bool operator ==(CompositeTypeTypeKey key1, CompositeTypeTypeKey key2)
{
return key1.Type1 == key2.Type1 && key1.Type2 == key2.Type2;
}
public static bool operator !=(CompositeTypeTypeKey key1, CompositeTypeTypeKey key2)
{
return key1.Type1 != key2.Type1 || key1.Type2 != key2.Type2;
}
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (Type1.GetHashCode() * 397) ^ Type2.GetHashCode();
}
}
}
}
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.8.0");
private static readonly Version Version = new Version("7.8.3");
/// <summary>
/// Gets the current version of Umbraco.
+37 -1
View File
@@ -11,17 +11,53 @@
/// The integer identifier for global system root node.
/// </summary>
public const int Root = -1;
/// <summary>
/// The string identifier for global system root node.
/// </summary>
/// <remarks>Use this instead of re-creating the string everywhere.</remarks>
public const string RootString = "-1";
/// <summary>
/// The integer identifier for content's recycle bin.
/// </summary>
public const int RecycleBinContent = -20;
/// <summary>
/// The string identifier for content's recycle bin.
/// </summary>
/// <remarks>Use this instead of re-creating the string everywhere.</remarks>
public const string RecycleBinContentString = "-20";
/// <summary>
/// The string path prefix of the content's recycle bin.
/// </summary>
/// <remarks>
/// <para>Everything that is in the content recycle bin, has a path that starts with the prefix.</para>
/// <para>Use this instead of re-creating the string everywhere.</para>
/// </remarks>
public const string RecycleBinContentPathPrefix = "-1,-20,";
/// <summary>
/// The integer identifier for media's recycle bin.
/// </summary>
public const int RecycleBinMedia = -21;
/// <summary>
/// The string identifier for media's recycle bin.
/// </summary>
/// <remarks>Use this instead of re-creating the string everywhere.</remarks>
public const string RecycleBinMediaString = "-21";
/// <summary>
/// The string path prefix of the media's recycle bin.
/// </summary>
/// <remarks>
/// <para>Everything that is in the media recycle bin, has a path that starts with the prefix.</para>
/// <para>Use this instead of re-creating the string everywhere.</para>
/// </remarks>
public const string RecycleBinMediaPathPrefix = "-1,-21,";
public const int DefaultContentListViewDataTypeId = -95;
public const int DefaultMediaListViewDataTypeId = -96;
public const int DefaultMembersListViewDataTypeId = -97;
@@ -29,6 +65,6 @@
public const string UmbracoConnectionName = "umbracoDbDSN";
public const string UmbracoMigrationName = "Umbraco";
}
}
}
+34 -34
View File
@@ -21,9 +21,9 @@ namespace Umbraco.Core
public static DateTime TruncateTo(this DateTime dt, DateTruncate truncateTo)
{
if (truncateTo == DateTruncate.Year)
return new DateTime(dt.Year, 0, 0);
return new DateTime(dt.Year, 1, 1);
if (truncateTo == DateTruncate.Month)
return new DateTime(dt.Year, dt.Month, 0);
return new DateTime(dt.Year, dt.Month, 1);
if (truncateTo == DateTruncate.Day)
return new DateTime(dt.Year, dt.Month, dt.Day);
if (truncateTo == DateTruncate.Hour)
@@ -41,43 +41,43 @@ namespace Umbraco.Core
Hour,
Minute,
Second
}
}
/// <summary>
/// Calculates the number of minutes from a date time, on a rolling daily basis (so if
/// Calculates the number of minutes from a date time, on a rolling daily basis (so if
/// date time is before the time, calculate onto next day)
/// </summary>
/// <param name="fromDateTime">Date to start from</param>
/// <param name="scheduledTime">Time to compare against (in Hmm form, e.g. 330, 2200)</param>
/// <returns></returns>
public static int PeriodicMinutesFrom(this DateTime fromDateTime, string scheduledTime)
{
// Ensure time provided is 4 digits long
if (scheduledTime.Length == 3)
{
scheduledTime = "0" + scheduledTime;
}
var scheduledHour = int.Parse(scheduledTime.Substring(0, 2));
var scheduledMinute = int.Parse(scheduledTime.Substring(2));
DateTime scheduledDateTime;
if (IsScheduledInRemainingDay(fromDateTime, scheduledHour, scheduledMinute))
{
scheduledDateTime = new DateTime(fromDateTime.Year, fromDateTime.Month, fromDateTime.Day, scheduledHour, scheduledMinute, 0);
}
else
{
var nextDay = fromDateTime.AddDays(1);
scheduledDateTime = new DateTime(nextDay.Year, nextDay.Month, nextDay.Day, scheduledHour, scheduledMinute, 0);
}
return (int)(scheduledDateTime - fromDateTime).TotalMinutes;
}
private static bool IsScheduledInRemainingDay(DateTime fromDateTime, int scheduledHour, int scheduledMinute)
{
return scheduledHour > fromDateTime.Hour || (scheduledHour == fromDateTime.Hour && scheduledMinute >= fromDateTime.Minute);
/// <returns></returns>
public static int PeriodicMinutesFrom(this DateTime fromDateTime, string scheduledTime)
{
// Ensure time provided is 4 digits long
if (scheduledTime.Length == 3)
{
scheduledTime = "0" + scheduledTime;
}
var scheduledHour = int.Parse(scheduledTime.Substring(0, 2));
var scheduledMinute = int.Parse(scheduledTime.Substring(2));
DateTime scheduledDateTime;
if (IsScheduledInRemainingDay(fromDateTime, scheduledHour, scheduledMinute))
{
scheduledDateTime = new DateTime(fromDateTime.Year, fromDateTime.Month, fromDateTime.Day, scheduledHour, scheduledMinute, 0);
}
else
{
var nextDay = fromDateTime.AddDays(1);
scheduledDateTime = new DateTime(nextDay.Year, nextDay.Month, nextDay.Day, scheduledHour, scheduledMinute, 0);
}
return (int)(scheduledDateTime - fromDateTime).TotalMinutes;
}
private static bool IsScheduledInRemainingDay(DateTime fromDateTime, int scheduledHour, int scheduledMinute)
{
return scheduledHour > fromDateTime.Hour || (scheduledHour == fromDateTime.Hour && scheduledMinute >= fromDateTime.Minute);
}
}
}
+43 -43
View File
@@ -2,60 +2,60 @@ using System;
using System.Threading;
namespace Umbraco.Core
{
/// <summary>
/// Abstract implementation of IDisposable.
/// </summary>
/// <remarks>
/// Can also be used as a pattern for when inheriting is not possible.
///
{
/// <summary>
/// Abstract implementation of IDisposable.
/// </summary>
/// <remarks>
/// Can also be used as a pattern for when inheriting is not possible.
///
/// See also: https://msdn.microsoft.com/en-us/library/b1yfkh5e%28v=vs.110%29.aspx
/// See also: https://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/
///
/// Note: if an object's ctor throws, it will never be disposed, and so if that ctor
/// has allocated disposable objects, it should take care of disposing them.
/// </remarks>
public abstract class DisposableObject : IDisposable
{
private bool _disposed;
private readonly object _locko = new object();
// gets a value indicating whether this instance is disposed.
/// </remarks>
public abstract class DisposableObject : IDisposable
{
private bool _disposed;
private readonly object _locko = new object();
// gets a value indicating whether this instance is disposed.
// for internal tests only (not thread safe)
//TODO make this internal + rename "Disposed" when we can break compatibility
public bool IsDisposed { get { return _disposed; } }
// implements IDisposable
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
// finalizer
~DisposableObject()
{
Dispose(false);
}
public bool IsDisposed { get { return _disposed; } }
// implements IDisposable
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
// finalizer
~DisposableObject()
{
Dispose(false);
}
//TODO make this private, non-virtual when we can break compatibility
protected virtual void Dispose(bool disposing)
{
lock (_locko)
{
if (_disposed) return;
_disposed = true;
}
protected virtual void Dispose(bool disposing)
{
lock (_locko)
{
if (_disposed) return;
_disposed = true;
}
DisposeUnmanagedResources();
if (disposing)
DisposeResources();
}
protected abstract void DisposeResources();
protected virtual void DisposeUnmanagedResources()
{ }
}
DisposeResources();
}
protected abstract void DisposeResources();
protected virtual void DisposeUnmanagedResources()
{ }
}
}
+38
View File
@@ -0,0 +1,38 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// This should not be use if there are ubmanaged resources to be disposed, use DisposableObject instead
/// </summary>
public abstract class DisposableObjectSlim : IDisposable
{
private bool _disposed;
private readonly object _locko = new object();
// gets a value indicating whether this instance is disposed.
// for internal tests only (not thread safe)
internal bool Disposed { get { return _disposed; } }
// implements IDisposable
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
lock (_locko)
{
if (_disposed) return;
_disposed = true;
}
if (disposing)
DisposeResources();
}
protected abstract void DisposeResources();
}
}
+8 -8
View File
@@ -11,8 +11,8 @@ namespace Umbraco.Core
/// <summary>
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
/// </summary>
public class DisposableTimer : DisposableObject
{
public class DisposableTimer : DisposableObjectSlim
{
private readonly ILogger _logger;
private readonly LogType? _logType;
private readonly IProfiler _profiler;
@@ -209,13 +209,13 @@ namespace Umbraco.Core
loggerType,
startMessage(),
completeMessage());
}
}
#endregion
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
/// </summary>
protected override void DisposeResources()
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObjectSlim"/> which handles common required locking logic.
/// </summary>
protected override void DisposeResources()
{
if (_profiler != null)
{
+1 -1
View File
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Events
/// <summary>
/// Event messages collection
/// </summary>
public sealed class EventMessages : DisposableObject
public sealed class EventMessages : DisposableObjectSlim
{
private readonly List<EventMessage> _msgs = new List<EventMessage>();
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Umbraco.Core.Packaging.Models;
namespace Umbraco.Core.Events
@@ -7,18 +8,27 @@ namespace Umbraco.Core.Events
public class ImportPackageEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>, IEquatable<ImportPackageEventArgs<TEntity>>
{
private readonly MetaData _packageMetaData;
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the overload specifying packageMetaData instead")]
public ImportPackageEventArgs(TEntity eventObject, bool canCancel)
: base(new[] { eventObject }, canCancel)
{
}
public ImportPackageEventArgs(TEntity eventObject, MetaData packageMetaData)
: base(new[] { eventObject })
public ImportPackageEventArgs(TEntity eventObject, MetaData packageMetaData, bool canCancel)
: base(new[] { eventObject }, canCancel)
{
if (packageMetaData == null) throw new ArgumentNullException("packageMetaData");
_packageMetaData = packageMetaData;
}
public ImportPackageEventArgs(TEntity eventObject, MetaData packageMetaData)
: this(eventObject, packageMetaData, true)
{
}
public MetaData PackageMetaData
{
get { return _packageMetaData; }
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Umbraco.Core
/// This will use the crypto libs to generate the hash and will try to ensure that
/// strings, etc... are not re-allocated so it's not consuming much memory.
/// </remarks>
internal class HashGenerator : DisposableObject
internal class HashGenerator : DisposableObjectSlim
{
public HashGenerator()
{
+1 -1
View File
@@ -6,7 +6,7 @@ using Umbraco.Core.Logging;
namespace Umbraco.Core.Manifest
{
internal class ManifestWatcher : DisposableObject
internal class ManifestWatcher : DisposableObjectSlim
{
private readonly ILogger _logger;
private readonly List<FileSystemWatcher> _fws = new List<FileSystemWatcher>();
+4 -2
View File
@@ -95,8 +95,10 @@ namespace Umbraco.Core.Models
get { return _allowedTemplates; }
set
{
SetPropertyValueAndDetectChanges(value, ref _allowedTemplates, Ps.Value.AllowedTemplatesSelector,
Ps.Value.TemplateComparer);
SetPropertyValueAndDetectChanges(value, ref _allowedTemplates, Ps.Value.AllowedTemplatesSelector, Ps.Value.TemplateComparer);
if (_allowedTemplates.Any(x => x.Id == _defaultTemplate) == false)
DefaultTemplateId = 0;
}
}
File diff suppressed because it is too large Load Diff
@@ -394,7 +394,7 @@ namespace Umbraco.Core.ObjectResolution
/// WARNING! Do not use this unless you know what you are doing, clear all types registered and instances
/// created. Typically only used if a resolver is no longer used in an application and memory is to be GC'd
/// </summary>
internal void ResetCollections()
internal virtual void ResetCollections()
{
using (new WriteLock(_lock))
{
@@ -12,7 +12,7 @@ namespace Umbraco.Core.Persistence
/// it will create one per context, otherwise it will be a global singleton object which is NOT thread safe
/// since we need (at least) a new instance of the database object per thread.
/// </remarks>
internal class DefaultDatabaseFactory : DisposableObject, IDatabaseFactory2
internal class DefaultDatabaseFactory : DisposableObjectSlim, IDatabaseFactory2
{
private readonly string _connectionStringName;
private readonly ILogger _logger;
+7 -8
View File
@@ -402,7 +402,7 @@ namespace Umbraco.Core.Persistence
}
// Helper to handle named parameters from object properties
static Regex rxParams = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
static readonly Regex rxParams = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
public static string ProcessParams(string _sql, object[] args_src, List<object> args_dest)
{
return rxParams.Replace(_sql, m =>
@@ -545,7 +545,7 @@ namespace Umbraco.Core.Persistence
}
// Create a command
static Regex rxParamsPrefix = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
static readonly Regex rxParamsPrefix = new Regex(@"(?<!@)@\w+", RegexOptions.Compiled);
public IDbCommand CreateCommand(IDbConnection connection, string sql, params object[] args)
{
// Perform named argument replacements
@@ -666,8 +666,8 @@ namespace Umbraco.Core.Persistence
return ExecuteScalar<T>(sql.SQL, sql.Arguments);
}
Regex rxSelect = new Regex(@"\A\s*(SELECT|EXECUTE|CALL)\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
Regex rxFrom = new Regex(@"\A\s*FROM\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
static readonly Regex rxSelect = new Regex(@"\A\s*(SELECT|EXECUTE|CALL)\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
static readonly Regex rxFrom = new Regex(@"\A\s*FROM\s", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);
string AddSelectClause<T>(string sql)
{
if (sql.StartsWith(";"))
@@ -701,9 +701,9 @@ namespace Umbraco.Core.Persistence
return Fetch<T>(sql.SQL, sql.Arguments);
}
static Regex rxColumns = new Regex(@"\A\s*SELECT\s+((?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|.)*?)(?<!,\s+)\bFROM\b", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
static Regex rxOrderBy = new Regex(@"\bORDER\s+BY\s+(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?(?:\s*,\s*(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?)*", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
static Regex rxDistinct = new Regex(@"\ADISTINCT\s", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
static readonly Regex rxColumns = new Regex(@"\A\s*SELECT\s+((?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|.)*?)(?<!,\s+)\bFROM\b", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
static readonly Regex rxOrderBy = new Regex(@"\bORDER\s+BY\s+(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?(?:\s*,\s*(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|[\w\(\)\.])+(?:\s+(?:ASC|DESC))?)*", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
static readonly Regex rxDistinct = new Regex(@"\ADISTINCT\s", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled);
public static bool SplitSqlForPaging(string sql, out string sqlCount, out string sqlSelectRemoved, out string sqlOrderBy)
{
sqlSelectRemoved = null;
@@ -2546,5 +2546,4 @@ namespace Umbraco.Core.Persistence
}
}
}
}
@@ -18,7 +18,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// <remarks>
/// This is limited to objects that are based in the umbracoNode-table.
/// </remarks>
internal class EntityRepository : DisposableObject, IEntityRepository
internal class EntityRepository : DisposableObjectSlim, IEntityRepository
{
private readonly IDatabaseUnitOfWork _work;
@@ -9,7 +9,7 @@ using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
internal abstract class FileRepository<TId, TEntity> : DisposableObject, IUnitOfWorkRepository, IRepository<TId, TEntity>
internal abstract class FileRepository<TId, TEntity> : DisposableObjectSlim, IUnitOfWorkRepository, IRepository<TId, TEntity>
where TEntity : IFile
{
private IUnitOfWork _work;
@@ -10,7 +10,7 @@ using Umbraco.Core.Scoping;
namespace Umbraco.Core.Persistence.Repositories
{
internal abstract class RepositoryBase : DisposableObject
internal abstract class RepositoryBase : DisposableObjectSlim
{
private readonly IScopeUnitOfWork _work;
private readonly CacheHelper _globalCache;
@@ -20,6 +20,12 @@ namespace Umbraco.Core.Persistence.Repositories
var name = Name;
// cater for instances where node has no name.
if(string.IsNullOrWhiteSpace(name))
{
return _numPos;
}
if (name[name.Length - 1] != ')')
return _numPos = -1;
@@ -106,7 +112,7 @@ namespace Umbraco.Core.Persistence.Repositories
}
}
return uniqueing ? string.Concat(nodeName, " (", uniqueNumber.ToString(), ")") : nodeName;
return uniqueing || string.IsNullOrWhiteSpace(nodeName) ? string.Concat(nodeName, " (", uniqueNumber.ToString(), ")") : nodeName;
}
}
}
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Persistence.UnitOfWork
/// <summary>
/// Represents a scoped unit of work.
/// </summary>
internal class ScopeUnitOfWork : DisposableObject, IScopeUnitOfWork
internal class ScopeUnitOfWork : DisposableObjectSlim, IScopeUnitOfWork
{
private readonly Queue<Operation> _operations = new Queue<Operation>();
private readonly IsolationLevel _isolationLevel;
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
using Umbraco.Core.Models;
@@ -176,6 +176,12 @@ namespace Umbraco.Core.PropertyEditors
/// <returns></returns>
internal Attempt<object> TryConvertValueToCrlType(object value)
{
var jv = value as JValue;
if (jv != null)
{
value = value.ToString();
}
//this is a custom check to avoid any errors, if it's a string and it's empty just make it null
var s = value as string;
if (s != null)
@@ -391,4 +397,4 @@ namespace Umbraco.Core.PropertyEditors
}
}
}
}
}
@@ -18,6 +18,8 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
return Constants.PropertyEditors.MultipleTextstringAlias.Equals(propertyType.PropertyEditorAlias);
}
private static readonly string[] NewLineDelimiters = { "\r\n", "\r", "\n" };
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
// data is (both in database and xml):
@@ -53,7 +55,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
// Fall back on normal behaviour
if (values.Any() == false)
{
return sourceString.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
return sourceString.Split(NewLineDelimiters, StringSplitOptions.None);
}
return values.ToArray();
@@ -401,9 +401,10 @@ namespace Umbraco.Core.Publishing
content.Name, content.Id));
}
// if newest is published, unpublish
if (content.Published)
content.ChangePublishedState(PublishedState.Unpublished);
// make sure we dirty .Published and always unpublish
// the version we have here could be the newest, !Published
content.ChangePublishedState(PublishedState.Published);
content.ChangePublishedState(PublishedState.Unpublished);
_logger.Info<PublishingStrategy>(
string.Format("Content '{0}' with Id '{1}' has been unpublished.",
+3
View File
@@ -20,6 +20,7 @@ namespace Umbraco.Core.Scoping
public NoScope(ScopeProvider scopeProvider)
{
_scopeProvider = scopeProvider;
Timestamp = DateTime.Now;
#if DEBUG_SCOPES
_scopeProvider.RegisterScope(this);
#endif
@@ -28,6 +29,8 @@ namespace Umbraco.Core.Scoping
private readonly Guid _instanceId = Guid.NewGuid();
public Guid InstanceId { get { return _instanceId; } }
public DateTime Timestamp { get; }
/// <inheritdoc />
public bool CallContext { get { return false; } }
+1 -1
View File
@@ -374,7 +374,7 @@ namespace Umbraco.Core.Scoping
}
var parent = ParentScope;
_scopeProvider.AmbientScope = parent;
_scopeProvider.AmbientScope = parent; // might be null = this is how scopes are removed from context objects
#if DEBUG_SCOPES
_scopeProvider.Disposed(this);
+14
View File
@@ -116,5 +116,19 @@ namespace Umbraco.Core.Scoping
Enlisted[key] = enlistedOfT;
return enlistedOfT.Item;
}
public T GetEnlisted<T>(string key)
{
var enlistedObjects = _enlisted;
if (enlistedObjects == null) return default (T);
IEnlistedObject enlisted;
if (enlistedObjects.TryGetValue(key, out enlisted) == false)
return default (T);
var enlistedAs = enlisted as EnlistedObject<T>;
if (enlistedAs == null) throw new InvalidOperationException("An item with the key exists, but with a different type.");
return enlistedAs.Item;
}
}
}
+51 -6
View File
@@ -2,10 +2,12 @@
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Web;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
#if DEBUG_SCOPES
using System.Linq;
@@ -66,22 +68,38 @@ namespace Umbraco.Core.Scoping
// tests, any other things (see https://msdn.microsoft.com/en-us/library/dn458353(v=vs.110).aspx),
// but we don't want to make all of our objects serializable since they are *not* meant to be
// used in cross-AppDomain scenario anyways.
//
// in addition, whatever goes into the logical call context is serialized back and forth any
// time cross-AppDomain code executes, so if we put an "object" there, we'll can *another*
// "object" instance - and so we cannot use a random object as a key.
// time cross-AppDomain code executes, so if we put an "object" there, we'll get *another*
// "object" instance back - and so we cannot use a random object as a key.
//
// so what we do is: we register a guid in the call context, and we keep a table mapping those
// guids to the actual objects. the guid serializes back and forth without causing any issue,
// and we can retrieve the actual objects from the table.
// only issue: how are we supposed to clear the table? we can't, really. objects should take
// care of de-registering themselves from context.
// everything we use does, except the NoScope scope, which just stays there
//
// during tests, NoScope can to into call context... nothing much we can do about it
// so far, the only objects that go into this table are scopes (using ScopeItemKey) and
// scope contexts (using ContextItemKey).
private static readonly object StaticCallContextObjectsLock = new object();
private static readonly Dictionary<Guid, object> StaticCallContextObjects
= new Dictionary<Guid, object>();
// normal scopes and scope contexts take greate care removing themselves when disposed, so it
// is all safe. OTOH the NoScope *CANNOT* remove itself, this is by design, it *WILL* leak and
// there is little (nothing) we can do about it - NoScope exists for backward compatibility
// reasons and relying on it is greatly discouraged.
//
// however... we can *try* at protecting the app against memory leaks, by collecting NoScope
// instances that are too old. if anything actually *need* to retain a NoScope instance for
// a long time, it will break. but that's probably ok. so: the constants below define how
// long a NoScope instance can stay in the table before being removed, and how often we should
// collect the table - and collecting happens anytime SetCallContextObject is invoked
private static readonly TimeSpan StaticCallContextNoScopeLifeSpan = TimeSpan.FromMinutes(30);
private static readonly TimeSpan StaticCallContextCollectPeriod = TimeSpan.FromMinutes(4);
private static DateTime _staticCallContextLastCollect = DateTime.MinValue;
#if DEBUG_SCOPES
public Dictionary<Guid, object> CallContextObjects
{
@@ -156,6 +174,7 @@ namespace Umbraco.Core.Scoping
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
#endif
StaticCallContextObjects.Remove(objectKey);
CollectStaticCallContextObjectsLocked();
}
}
else
@@ -171,11 +190,37 @@ namespace Umbraco.Core.Scoping
//Logging.LogHelper.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
#endif
StaticCallContextObjects.Add(objectKey, value);
CollectStaticCallContextObjectsLocked();
}
CallContext.LogicalSetData(key, objectKey);
}
}
private static void CollectStaticCallContextObjectsLocked()
{
// is it time to collect?
var now = DateTime.Now;
if (now - _staticCallContextLastCollect <= StaticCallContextCollectPeriod)
return;
// disable warning: this method is invoked from within a lock
// ReSharper disable InconsistentlySynchronizedField
var threshold = now.Add(-StaticCallContextNoScopeLifeSpan);
var guids = StaticCallContextObjects
.Where(x => x.Value is NoScope noScope && noScope.Timestamp < threshold)
.Select(x => x.Key)
.ToList();
if (guids.Count > 0)
{
LogHelper.Warn<ScopeProvider>($"Collected {guids.Count} NoScope instances from StaticCallContextObjects.");
foreach (var guid in guids)
StaticCallContextObjects.Remove(guid);
}
// ReSharper restore InconsistentlySynchronizedField
_staticCallContextLastCollect = now;
}
// this is for tests exclusively until we have a proper accessor in v8
internal static Func<IDictionary> HttpContextItemsGetter { get; set; }
@@ -18,7 +18,7 @@ using Task = System.Threading.Tasks.Task;
namespace Umbraco.Core.Security
{
public class BackOfficeUserStore : DisposableObject,
public class BackOfficeUserStore : DisposableObjectSlim,
IUserStore<BackOfficeIdentityUser, int>,
IUserPasswordStore<BackOfficeIdentityUser, int>,
IUserEmailStore<BackOfficeIdentityUser, int>,
@@ -58,7 +58,7 @@ namespace Umbraco.Core.Security
}
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObjectSlim"/> which handles common required locking logic.
/// </summary>
protected override void DisposeResources()
{
+39 -7
View File
@@ -692,7 +692,7 @@ namespace Umbraco.Core.Services
totalChildren = 0;
return Enumerable.Empty<IContent>();
}
query.Where(x => x.Path.SqlStartsWith(string.Format("{0},", contentPath[0]), TextColumnType.NVarchar));
query.Where(x => x.Path.SqlStartsWith(string.Format("{0},", contentPath[0].Path), TextColumnType.NVarchar));
}
@@ -737,7 +737,7 @@ namespace Umbraco.Core.Services
totalChildren = 0;
return Enumerable.Empty<IContent>();
}
query.Where(x => x.Path.SqlStartsWith(string.Format("{0},", contentPath[0]), TextColumnType.NVarchar));
query.Where(x => x.Path.SqlStartsWith(string.Format("{0},", contentPath[0].Path), TextColumnType.NVarchar));
}
return repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out totalChildren, orderBy, orderDirection, orderBySystemField, filter);
@@ -884,8 +884,8 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateContentRepository(uow);
var query = Query<IContent>.Builder.Where(x => x.Published && x.ExpireDate <= DateTime.Now);
return repository.GetByQuery(query);
var query = Query<IContent>.Builder.Where(x => x.ExpireDate <= DateTime.Now);
return repository.GetByQuery(query).Where(x => x.HasPublishedVersion);
}
}
@@ -912,13 +912,11 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateContentRepository(uow);
var query = Query<IContent>.Builder.Where(x => x.Path.Contains(Constants.System.RecycleBinContent.ToInvariantString()));
var query = Query<IContent>.Builder.Where(x => x.Path.StartsWith(Constants.System.RecycleBinContentPathPrefix));
return repository.GetByQuery(query);
}
}
/// <summary>
/// Checks whether an <see cref="IContent"/> item has any children
/// </summary>
@@ -1344,6 +1342,40 @@ namespace Umbraco.Core.Services
return content;
}
public void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
{
using (new WriteLock(Locker))
using (var uow = UowProvider.GetUnitOfWork())
{
var repository = RepositoryFactory.CreateContentBlueprintRepository(uow);
var contentTypeIdsA = contentTypeIds.ToArray();
var query = new Query<IContent>();
if (contentTypeIdsA.Length > 0)
{
query.Where(x => contentTypeIdsA.Contains(x.ContentTypeId));
}
var blueprints = repository.GetByQuery(query).Select(x =>
{
((Content) x).IsBlueprint = true;
return x;
}).ToArray();
foreach (var blueprint in blueprints)
{
repository.Delete(blueprint);
}
uow.Events.Dispatch(DeletedBlueprint, this, new DeleteEventArgs<IContent>(blueprints), "DeletedBlueprint");
uow.Commit();
}
}
public void DeleteBlueprintsOfType(int contentTypeId, int userId = 0)
{
DeleteBlueprintsOfTypes(new[] {contentTypeId}, userId);
}
/// <summary>
/// Saves a single <see cref="IContent"/> object
/// </summary>
@@ -920,7 +920,9 @@ namespace Umbraco.Core.Services
var deletedContentTypes = new List<IContentType> { contentType };
deletedContentTypes.AddRange(GetDescendants(contentType));
_contentService.DeleteContentOfTypes(deletedContentTypes.Select(x => x.Id), userId);
var ids = deletedContentTypes.Select(x => x.Id).ToArray();
_contentService.DeleteContentOfTypes(ids, userId);
_contentService.DeleteBlueprintsOfTypes(ids);
repository.Delete(contentType);
deleteEventArgs.DeletedEntities = deletedContentTypes.DistinctBy(x => x.Id);
+3 -1
View File
@@ -101,7 +101,9 @@ namespace Umbraco.Core.Services
IContent GetBlueprintById(Guid id);
void SaveBlueprint(IContent content, int userId = 0);
void DeleteBlueprint(IContent content, int userId = 0);
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0);
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0);
void DeleteBlueprintsOfType(int contentTypeId, int userId = 0);
void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = 0);
/// <summary>
/// Gets all XML entries found in the cmsContentXml table based on the given path
+20 -4
View File
@@ -39,8 +39,16 @@ namespace Umbraco.Core.Services
int? val;
using (var uow = _uowProvider.GetUnitOfWork())
{
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
//if it's unknown don't include the nodeObjectType in the query
if (umbracoObjectType == UmbracoObjectTypes.Unknown)
{
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id", new { id = key});
}
else
{
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
}
uow.Commit();
}
@@ -92,8 +100,16 @@ namespace Umbraco.Core.Services
Guid? val;
using (var uow = _uowProvider.GetUnitOfWork())
{
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
//if it's unknown don't include the nodeObjectType in the query
if (umbracoObjectType == UmbracoObjectTypes.Unknown)
{
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id", new { id });
}
else
{
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
}
uow.Commit();
}
+9 -9
View File
@@ -389,7 +389,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMediaRepository(uow);
var query = Query<IMedia>.Builder.Where(x => x.Level == level && x.Path.StartsWith("-21") == false);
var query = Query<IMedia>.Builder.Where(x => x.Level == level && x.Path.StartsWith(Constants.System.RecycleBinMediaPathPrefix) == false);
return repository.GetByQuery(query);
}
}
@@ -440,7 +440,7 @@ namespace Umbraco.Core.Services
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
public IEnumerable<IMedia> GetAncestors(IMedia media)
{
var ids = media.Path.Split(',').Where(x => x != "-1" && x != media.Id.ToString(CultureInfo.InvariantCulture)).Select(int.Parse).ToArray();
var ids = media.Path.Split(',').Where(x => x != Constants.System.RootString && x != media.Id.ToString(CultureInfo.InvariantCulture)).Select(int.Parse).ToArray();
if (ids.Any() == false)
return new List<IMedia>();
@@ -609,7 +609,7 @@ namespace Umbraco.Core.Services
totalChildren = 0;
return Enumerable.Empty<IMedia>();
}
query.Where(x => x.Path.SqlStartsWith(string.Format("{0},", mediaPath[0]), TextColumnType.NVarchar));
query.Where(x => x.Path.SqlStartsWith(string.Format("{0},", mediaPath[0].Path), TextColumnType.NVarchar));
}
IQuery<IMedia> filterQuery = null;
if (filter.IsNullOrWhiteSpace() == false)
@@ -673,7 +673,7 @@ namespace Umbraco.Core.Services
/// <returns>Parent <see cref="IMedia"/> object</returns>
public IMedia GetParent(IMedia media)
{
if (media.ParentId == -1 || media.ParentId == -21)
if (media.ParentId == Constants.System.Root || media.ParentId == Constants.System.RecycleBinMedia)
return null;
return GetById(media.ParentId);
@@ -703,7 +703,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMediaRepository(uow);
var query = Query<IMedia>.Builder.Where(x => x.ParentId == -1);
var query = Query<IMedia>.Builder.Where(x => x.ParentId == Constants.System.Root);
return repository.GetByQuery(query);
}
}
@@ -717,7 +717,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMediaRepository(uow);
var query = Query<IMedia>.Builder.Where(x => x.Path.Contains("-21"));
var query = Query<IMedia>.Builder.Where(x => x.Path.StartsWith(Constants.System.RecycleBinMediaPathPrefix));
return repository.GetByQuery(query);
}
}
@@ -767,7 +767,7 @@ namespace Umbraco.Core.Services
using (new WriteLock(Locker))
{
//This ensures that the correct method is called if this method is used to Move to recycle bin.
if (parentId == -21)
if (parentId == Constants.System.RecycleBinMedia)
{
MoveToRecycleBin(media, userId);
return;
@@ -868,7 +868,7 @@ namespace Umbraco.Core.Services
var repository = RepositoryFactory.CreateMediaRepository(uow);
repository.Delete(media);
deleteEventArgs.CanCancel = false;
deleteEventArgs.CanCancel = false;
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
Audit(uow, AuditType.Delete, "Delete Media performed by user", userId, media.Id);
@@ -1003,7 +1003,7 @@ namespace Umbraco.Core.Services
recycleBinEventArgs.RecycleBinEmptiedSuccessfully = success;
uow.Events.Dispatch(EmptiedRecycleBin, this, recycleBinEventArgs);
Audit(uow, AuditType.Delete, "Empty Media Recycle Bin performed by user", 0, -21);
Audit(uow, AuditType.Delete, "Empty Media Recycle Bin performed by user", 0, Constants.System.RecycleBinMedia);
uow.Commit();
}
}
+1 -1
View File
@@ -695,7 +695,7 @@ namespace Umbraco.Core.Services
IQuery<IMember> filterQuery = null;
if (filter.IsNullOrWhiteSpace() == false)
{
filterQuery = Query<IMember>.Builder.Where(x => x.Name.Contains(filter) || x.Username.Contains(filter));
filterQuery = Query<IMember>.Builder.Where(x => x.Name.Contains(filter) || x.Username.Contains(filter) || x.Email.Contains(filter));
}
var repository = RepositoryFactory.CreateMemberRepository(uow);
@@ -1748,9 +1748,10 @@ namespace Umbraco.Core.Services
internal InstallationSummary InstallPackage(string packageFilePath, int userId = 0, bool raiseEvents = false)
{
var metaData = GetPackageMetaData(packageFilePath);
if (raiseEvents)
{
var metaData = GetPackageMetaData(packageFilePath);
{
if (ImportingPackage.IsRaisedEventCancelled(new ImportPackageEventArgs<string>(packageFilePath, metaData), this))
{
var initEmpty = new InstallationSummary().InitEmpty();
@@ -1762,7 +1763,7 @@ namespace Umbraco.Core.Services
if (raiseEvents)
{
ImportedPackage.RaiseEvent(new ImportPackageEventArgs<InstallationSummary>(installationSummary, false), this);
ImportedPackage.RaiseEvent(new ImportPackageEventArgs<InstallationSummary>(installationSummary, metaData, false), this);
}
return installationSummary;
@@ -70,7 +70,7 @@ namespace Umbraco.Core.Strings
{
foreach (var node in _umbracoSettings.RequestHandler.CharCollection)
{
if(string.IsNullOrEmpty(node.Char) == false)
if (string.IsNullOrEmpty(node.Char) == false)
_urlReplaceCharacters[node.Char] = node.Replacement;
}
}
@@ -109,7 +109,7 @@ namespace Umbraco.Core.Strings
private void EnsureNotFrozen()
{
if (_frozen)
throw new InvalidOperationException("Cannot configure the helper once it is frozen.");
throw new InvalidOperationException("Cannot configure the helper once it is frozen.");
}
/// <summary>
@@ -176,7 +176,7 @@ namespace Umbraco.Core.Strings
}).WithConfig(CleanStringType.Alias, new Config
{
PreFilter = ApplyUrlReplaceCharacters,
IsTerm = (c, leading) => leading
IsTerm = (c, leading) => leading
? char.IsLetter(c) // only letters
: (char.IsLetterOrDigit(c) || c == '_'), // letter, digit or underscore
StringType = CleanStringType.Ascii | CleanStringType.UmbracoCase,
@@ -215,12 +215,12 @@ namespace Umbraco.Core.Strings
return new Config
{
PreFilter = PreFilter,
PostFilter = PostFilter,
PostFilter = PostFilter,
IsTerm = IsTerm,
StringType = StringType,
BreakTermsOnUpper = BreakTermsOnUpper,
CutAcronymOnNonUpper = CutAcronymOnNonUpper,
GreedyAcronyms = GreedyAcronyms,
CutAcronymOnNonUpper = CutAcronymOnNonUpper,
GreedyAcronyms = GreedyAcronyms,
Separator = Separator
};
}
@@ -338,9 +338,9 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// Gets the JavaScript code defining client-side short string services.
/// </summary>
public string GetShortStringServicesJavaScript(string controllerPath)
{
return string.Format(SssjsFormat,
_umbracoSettings.Content.ForceSafeAliases ? "true" : "false", controllerPath);
{
return string.Format(SssjsFormat,
_umbracoSettings.Content.ForceSafeAliases ? "true" : "false", controllerPath);
}
#endregion
@@ -467,7 +467,7 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// Cleans a string.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <returns>The clean string.</returns>
/// <remarks>The string is cleaned in the context of the default culture.</remarks>
@@ -480,7 +480,7 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// Cleans a string, using a specified separator.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <param name="separator">The separator.</param>
/// <returns>The clean string.</returns>
@@ -494,7 +494,7 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// Cleans a string in the context of a specified culture.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <param name="culture">The culture.</param>
/// <returns>The clean string.</returns>
@@ -507,7 +507,7 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// Cleans a string in the context of a specified culture, using a specified separator.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <param name="separator">The separator.</param>
/// <param name="culture">The culture.</param>
@@ -554,7 +554,7 @@ function validateSafeAlias(input, value, immediate, callback) {{
text = Utf8ToAsciiConverter.ToAsciiString(text);
break;
case CleanStringType.TryAscii:
const char ESC = (char) 27;
const char ESC = (char)27;
var ctext = Utf8ToAsciiConverter.ToAsciiString(text, ESC);
if (ctext.Contains(ESC) == false) text = ctext;
break;
@@ -568,8 +568,8 @@ function validateSafeAlias(input, value, immediate, callback) {{
// apply post-filter
if (config.PostFilter != null)
text = config.PostFilter(text);
text = config.PostFilter(text);
return text;
}
@@ -839,7 +839,7 @@ function validateSafeAlias(input, value, immediate, callback) {{
{
term = term.Substring(i);
term.CopyTo(0, output, opos, term.Length);
opos += term.Length;
opos += term.Length;
}
break;
@@ -914,21 +914,22 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// <returns>The filtered string.</returns>
public virtual string ReplaceMany(string text, IDictionary<string, string> replacements)
{
// be safe
if (text == null)
{
throw new ArgumentNullException("text");
}
if (replacements == null)
{
throw new ArgumentNullException("replacements");
}
// Have done various tests, implementing my own "super fast" state machine to handle
// replacement of many items, or via regexes, but on short strings and not too
// many replacements (which prob. is going to be our case) nothing can beat this...
// (at least with safe and checked code -- we don't want unsafe/unchecked here)
foreach (KeyValuePair<string, string> item in replacements)
{
text = text.Replace(item.Key, item.Value);
}
// Note that it will do chained-replacements ie replaced items can be replaced
// in turn by another replacement (ie the order of replacements is important)
return replacements.Aggregate(text, (current, kvp) => current.Replace(kvp.Key, kvp.Value));
return text;
}
/// <summary>
@@ -940,15 +941,22 @@ function validateSafeAlias(input, value, immediate, callback) {{
/// <returns>The filtered string.</returns>
public virtual string ReplaceMany(string text, char[] chars, char replacement)
{
// be safe
if (text == null)
{
throw new ArgumentNullException("text");
}
if (chars == null)
{
throw new ArgumentNullException("chars");
}
// see note above
for (int i = 0; i < chars.Length; i++)
{
text = text.Replace(chars[i], replacement);
}
return chars.Aggregate(text, (current, c) => current.Replace(c, replacement));
return text;
}
#endregion
@@ -55,7 +55,7 @@ namespace Umbraco.Core.Sync
if (newApplicationUrl)
{
appContext._umbracoApplicationDomains.Add(applicationUrl);
LogHelper.Info(typeof(ApplicationUrlHelper), $"New ApplicationUrl detected: {applicationUrl}");
LogHelper.Info(typeof(ApplicationUrlHelper), string.Format("New ApplicationUrl detected: {0}", applicationUrl));
}
}
@@ -169,4 +169,4 @@ namespace Umbraco.Core.Sync
return url.TrimEnd('/');
}
}
}
}
+4 -2
View File
@@ -43,8 +43,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="ClientDependency.Core, Version=1.9.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ClientDependency.1.9.2\lib\net45\ClientDependency.Core.dll</HintPath>
<Reference Include="ClientDependency.Core, Version=1.9.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ClientDependency.1.9.6\lib\net45\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
@@ -349,6 +349,7 @@
<Compile Include="Deploy\Direction.cs" />
<Compile Include="Deploy\IFileType.cs" />
<Compile Include="Deploy\IFileTypeCollection.cs" />
<Compile Include="DisposableObjectSlim.cs" />
<Compile Include="EmailSender.cs" />
<Compile Include="Events\EventDefinitionFilter.cs" />
<Compile Include="Events\IDeletingMediaFilesEventArgs.cs" />
@@ -1546,6 +1547,7 @@
<Compile Include="ReadLock.cs" />
<Compile Include="TypeFinder.cs" />
<Compile Include="TypeHelper.cs" />
<Compile Include="Collections\CompositeTypeTypeKey.cs" />
<Compile Include="Udi.cs" />
<Compile Include="UdiDefinitionAttribute.cs" />
<Compile Include="UdiEntityType.cs" />
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
<package id="ClientDependency" version="1.9.2" targetFramework="net45" />
<package id="ClientDependency" version="1.9.6" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net45" />
<package id="ImageProcessor" version="2.5.6" targetFramework="net45" />
<package id="log4net" version="2.0.8" targetFramework="net45" />
@@ -3,43 +3,24 @@ using System.Collections.Generic;
using System.Data.SqlServerCe;
using System.IO;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnostics.Windows;
using BenchmarkDotNet.Jobs;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Migrations.Initial;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Tests.Benchmarks.Config;
using Umbraco.Tests.TestHelpers;
using ILogger = Umbraco.Core.Logging.ILogger;
namespace Umbraco.Tests.Benchmarks
{
[Config(typeof(Config))]
[QuickRunWithMemoryDiagnoserConfig]
public class BulkInsertBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
Add(new MemoryDiagnoser());
//Add(ExecutionValidator.FailOnError);
//The 'quick and dirty' settings, so it runs a little quicker
// see benchmarkdotnet FAQ
Add(Job.Default
.WithLaunchCount(1) // benchmark process will be launched only once
.WithIterationTime(100) // 100ms per iteration
.WithWarmupCount(3) // 3 warmup iteration
.WithTargetCount(3)); // 3 target iteration
}
}
private static byte[] _initDbBytes = null;
[Setup]
[GlobalSetup]
public void Setup()
{
var logger = new DebugDiagnosticsLogger();
@@ -51,8 +32,8 @@ namespace Umbraco.Tests.Benchmarks
SetupSqlCe(path, logger);
SetupSqlServer(logger);
}
}
private void SetupSqlServer(ILogger logger)
{
@@ -75,7 +56,7 @@ namespace Umbraco.Tests.Benchmarks
[lastNotifiedDate] [datetime] NOT NULL,
[isActive] [bit] NOT NULL,
[isMaster] [bit] NOT NULL,
CONSTRAINT [PK_umbracoServer] PRIMARY KEY CLUSTERED
CONSTRAINT [PK_umbracoServer] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
@@ -87,7 +68,7 @@ namespace Umbraco.Tests.Benchmarks
var dbName = string.Concat("Umb", Guid.NewGuid(), ".sdf");
AppDomain.CurrentDomain.SetData("DataDirectory", path);
var sqlCeConnectionString = $"Datasource=|DataDirectory|\\{dbName};Flush Interval=1;";
_dbFile = Path.Combine(path, dbName);
//only create the db one time
@@ -107,12 +88,12 @@ namespace Umbraco.Tests.Benchmarks
var creation = new DatabaseSchemaCreation(_dbSqlCe, logger, _sqlCeSyntax);
creation.InitializeDatabaseSchema();
}
_initDbBytes = File.ReadAllBytes(_dbFile);
_initDbBytes = File.ReadAllBytes(_dbFile);
}
else
{
File.WriteAllBytes(_dbFile, _initDbBytes);
}
}
//create the db
_dbSqlCe = new UmbracoDatabase(
@@ -138,7 +119,7 @@ namespace Umbraco.Tests.Benchmarks
return data;
}
[Cleanup]
[GlobalCleanup]
public void Cleanup()
{
_dbSqlCe.Dispose();
@@ -0,0 +1,153 @@
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core.Collections;
namespace Umbraco.Tests.Benchmarks
{
[MemoryDiagnoser]
public class ConcurrentDictionaryBenchmarks
{
private static readonly ConcurrentDictionary<CompositeTypeTypeKey, bool> AssignableTypeCache = new ConcurrentDictionary<CompositeTypeTypeKey, bool>();
private static object input = new Bar();
private static Type source = typeof(Bar);
private static Type target = typeof(Foo);
[Benchmark(Baseline = true)]
public bool GetCachedCanAssignFactory()
{
return AssignableTypeCache.GetOrAdd(new CompositeTypeTypeKey(source, target), k =>
{
var ksource = k.Type1;
var ktarget = k.Type2;
return ktarget.IsAssignableFrom(ksource) && typeof(IConvertible).IsAssignableFrom(ksource);
});
}
[Benchmark]
public bool GetCachedCanAssignNoFactory()
{
// This method is 10% faster
var key = new CompositeTypeTypeKey(source, target);
bool canConvert;
if (AssignableTypeCache.TryGetValue(key, out canConvert))
{
return canConvert;
}
// "is" is faster than "IsAssignableFrom"
if (input is IConvertible && target.IsAssignableFrom(source))
{
return AssignableTypeCache[key] = true;
}
return AssignableTypeCache[key] = false;
}
private class Foo : IConvertible
{
public TypeCode GetTypeCode()
{
return TypeCode.Object;
}
public bool ToBoolean(IFormatProvider provider)
{
throw new NotImplementedException();
}
public byte ToByte(IFormatProvider provider)
{
throw new NotImplementedException();
}
public char ToChar(IFormatProvider provider)
{
throw new NotImplementedException();
}
public DateTime ToDateTime(IFormatProvider provider)
{
throw new NotImplementedException();
}
public decimal ToDecimal(IFormatProvider provider)
{
throw new NotImplementedException();
}
public double ToDouble(IFormatProvider provider)
{
throw new NotImplementedException();
}
public short ToInt16(IFormatProvider provider)
{
throw new NotImplementedException();
}
public int ToInt32(IFormatProvider provider)
{
throw new NotImplementedException();
}
public long ToInt64(IFormatProvider provider)
{
throw new NotImplementedException();
}
public sbyte ToSByte(IFormatProvider provider)
{
throw new NotImplementedException();
}
public float ToSingle(IFormatProvider provider)
{
throw new NotImplementedException();
}
public string ToString(IFormatProvider provider)
{
throw new NotImplementedException();
}
public object ToType(Type conversionType, IFormatProvider provider)
{
if (conversionType == typeof(Foo))
{
return new Foo();
}
throw new NotImplementedException();
}
public ushort ToUInt16(IFormatProvider provider)
{
throw new NotImplementedException();
}
public uint ToUInt32(IFormatProvider provider)
{
throw new NotImplementedException();
}
public ulong ToUInt64(IFormatProvider provider)
{
throw new NotImplementedException();
}
}
private class Bar : Foo
{
}
}
}
@@ -0,0 +1,33 @@
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Horology;
using BenchmarkDotNet.Jobs;
using System;
namespace Umbraco.Tests.Benchmarks.Config
{
/// <summary>
/// Configures the benchmark to run with less warmup and a shorter iteration time than the standard benchmark.
/// </summary>
public class QuickRunConfigAttribute : Attribute, IConfigSource
{
/// <summary>
/// Initializes a new instance of the <see cref="QuickRunConfigAttribute"/> class.
/// </summary>
public QuickRunConfigAttribute()
{
Config = (ManualConfig) ManualConfig.CreateEmpty()
.With(Job.Default.WithLaunchCount(1) // benchmark process will be launched only once
.WithIterationTime(new TimeInterval(100, TimeUnit.Millisecond)) // 100ms per iteration
.WithWarmupCount(3) // 3 warmup iteration
.WithTargetCount(3)); // 3 target iteration
}
/// <summary>
/// Gets the manual configuration.
/// </summary>
protected ManualConfig Config { get; }
/// <inheritdoc/>
IConfig IConfigSource.Config => Config;
}
}
@@ -0,0 +1,20 @@
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
namespace Umbraco.Tests.Benchmarks.Config
{
/// <summary>
/// Configures the benchmark to run with less warmup and a shorter iteration time than the standard benchmark,
/// and include memory usage diagnosis.
/// </summary>
public class QuickRunWithMemoryDiagnoserConfigAttribute : QuickRunConfigAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="QuickRunWithMemoryDiagnoserConfigAttribute"/> class.
/// </summary>
public QuickRunWithMemoryDiagnoserConfigAttribute()
{
Config.Add(new MemoryDiagnoser());
}
}
}
@@ -1,25 +1,16 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnostics.Windows;
using BenchmarkDotNet.Diagnosers;
namespace Umbraco.Tests.Benchmarks
{
/// <summary>
/// Want to check what is faster OfType or Cast when a enurable all has the same items
/// </summary>
[Config(typeof(Config))]
[MemoryDiagnoser]
public class LinqCastBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
Add(new MemoryDiagnoser());
}
}
public LinqCastBenchmarks()
{
_array = new List<object>();
@@ -1,47 +1,19 @@
using System;
using System.Collections.Generic;
using System.Data.SqlServerCe;
using System.Diagnostics;
using System.IO;
using System.Linq.Expressions;
using System.Threading;
using System.Xml;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Diagnostics.Windows;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Validators;
using Moq;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.Migrations.Initial;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Tests.TestHelpers;
using ILogger = Umbraco.Core.Logging.ILogger;
namespace Umbraco.Tests.Benchmarks
{
[Config(typeof(Config))]
[MemoryDiagnoser]
public class ModelToSqlExpressionHelperBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
Add(new MemoryDiagnoser());
}
}
public ModelToSqlExpressionHelperBenchmarks()
{
var contentMapper = new ContentMapper(_syntaxProvider);
@@ -51,7 +23,7 @@ namespace Umbraco.Tests.Benchmarks
mappingResolver.Setup(resolver => resolver.ResolveMapperByType(It.IsAny<Type>())).Returns(contentMapper);
_mappingResolver = mappingResolver.Object;
}
private readonly ISqlSyntaxProvider _syntaxProvider = new SqlCeSyntaxProvider();
private readonly CachedExpression _cachedExpression;
private readonly MappingResolver _mappingResolver;
@@ -62,18 +34,15 @@ namespace Umbraco.Tests.Benchmarks
for (int i = 0; i < 100; i++)
{
var a = i;
var b = i*10;
var b = i * 10;
Expression<Func<IContent, bool>> predicate = content =>
content.Path.StartsWith("-1") && content.Published && (content.ContentTypeId == a || content.ContentTypeId == b);
var modelToSqlExpressionHelper = new ModelToSqlExpressionVisitor<IContent>(_syntaxProvider, _mappingResolver);
var result = modelToSqlExpressionHelper.Visit(predicate);
}
}
[Benchmark()]
public void WithCachedExpression()
{
@@ -83,7 +52,7 @@ namespace Umbraco.Tests.Benchmarks
var b = i * 10;
Expression<Func<IContent, bool>> predicate = content =>
content.Path.StartsWith("-1") && content.Published && (content.ContentTypeId == a || content.ContentTypeId == b);
var modelToSqlExpressionHelper = new ModelToSqlExpressionVisitor<IContent>(_syntaxProvider, _mappingResolver);
//wrap it!
@@ -92,6 +61,5 @@ namespace Umbraco.Tests.Benchmarks
var result = modelToSqlExpressionHelper.Visit(_cachedExpression);
}
}
}
}
+1 -11
View File
@@ -6,17 +6,7 @@ namespace Umbraco.Tests.Benchmarks
{
public static void Main(string[] args)
{
var switcher = new BenchmarkSwitcher(new[]
{
typeof(BulkInsertBenchmarks),
typeof(ModelToSqlExpressionHelperBenchmarks),
typeof(XmlBenchmarks),
typeof(LinqCastBenchmarks),
//typeof(DeepCloneBenchmarks),
typeof(XmlPublishedContentInitBenchmarks),
});
switcher.Run(args);
new BenchmarkSwitcher(typeof(Program).Assembly).Run(args);
}
}
}
@@ -0,0 +1,138 @@
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Tests.Benchmarks.Config;
namespace Umbraco.Tests.Benchmarks
{
[QuickRunWithMemoryDiagnoserConfig]
public class StringReplaceManyBenchmarks
{
/*
short text, short replacement:
Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated |
--------------------------------------------- |---------:|----------:|----------:|-------:|---------:|-------:|----------:|
'String.ReplaceMany w/chars - Aggregate' | 236.0 ns | 40.92 ns | 2.312 ns | 1.00 | 0.00 | 0.0461 | 200 B |
'String.ReplaceMany w/chars - For Loop' | 166.7 ns | 70.51 ns | 3.984 ns | 0.71 | 0.01 | 0.0420 | 180 B |
'String.ReplaceMany w/dictionary - Aggregate' | 606.5 ns | 342.94 ns | 19.377 ns | 2.57 | 0.07 | 0.0473 | 212 B |
'String.ReplaceMany w/dictionary - For Each' | 571.8 ns | 232.33 ns | 13.127 ns | 2.42 | 0.05 | 0.0458 | 212 B |
long text, short replacement:
Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated |
--------------------------------------------- |----------:|----------:|----------:|-------:|---------:|-------:|----------:|
'String.ReplaceMany w/chars - Aggregate' | 5.771 us | 9.963 us | 0.5630 us | 1.00 | 0.00 | 1.6798 | 6.94 KB |
'String.ReplaceMany w/chars - For Loop' | 4.962 us | 2.121 us | 0.1199 us | 0.87 | 0.08 | 1.6840 | 6.92 KB |
'String.ReplaceMany w/dictionary - Aggregate' | 14.514 us | 8.189 us | 0.4627 us | 2.53 | 0.22 | 1.6447 | 6.96 KB |
'String.ReplaceMany w/dictionary - For Each' | 15.445 us | 24.745 us | 1.3981 us | 2.69 | 0.30 | 1.5696 | 6.96 KB |
short text, long replacements dictionary:
Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated |
--------------------------------------------- |-----------:|-----------:|----------:|-------:|---------:|-------:|----------:|
'String.ReplaceMany w/chars - Aggregate' | 257.0 ns | 200.0 ns | 11.30 ns | 1.00 | 0.00 | 0.0452 | 200 B |
'String.ReplaceMany w/chars - For Loop' | 182.4 ns | 221.0 ns | 12.49 ns | 0.71 | 0.05 | 0.0425 | 180 B |
'String.ReplaceMany w/dictionary - Aggregate' | 7,273.8 ns | 2,747.1 ns | 155.22 ns | 28.34 | 1.12 | 0.0714 | 464 B |
'String.ReplaceMany w/dictionary - For Each' | 6,981.0 ns | 5,500.7 ns | 310.80 ns | 27.20 | 1.38 | 0.0775 | 464 B |
long text, long replacements dictionary:
Method | Mean | Error | StdDev | Scaled | ScaledSD | Gen 0 | Allocated |
--------------------------------------------- |-----------:|-----------:|-----------:|-------:|---------:|-------:|----------:|
'String.ReplaceMany w/chars - Aggregate' | 4.868 us | 3.420 us | 0.1932 us | 1.00 | 0.00 | 1.6816 | 6.94 KB |
'String.ReplaceMany w/chars - For Loop' | 4.958 us | 2.633 us | 0.1487 us | 1.02 | 0.04 | 1.6791 | 6.92 KB |
'String.ReplaceMany w/dictionary - Aggregate' | 181.309 us | 210.177 us | 11.8754 us | 37.29 | 2.32 | 5.3571 | 24.28 KB |
'String.ReplaceMany w/dictionary - For Each' | 174.567 us | 113.733 us | 6.4262 us | 35.90 | 1.57 | 5.8594 | 24.28 KB |
*/
// don't use constants
// ReSharper disable ConvertToConstant.Local
// input text for ReplaceMany
private static readonly string Text;
// replaced chars for ReplaceMany with chars
private static readonly char[] ReplacedChars = { ',', '.', ':', '&', '#' };
// replacement char for ReplaceMany with chars
private static readonly char ReplacementChar = '*';
// replacements for ReplaceMany with dictionary
private static readonly IDictionary<string, string> Replacements;
// ReSharper restore ConvertToConstant.Local
static StringReplaceManyBenchmarks()
{
// pick what you want to benchmark
// short
Text = "1,2.3:4&5#6";
// long
//Text = "Sed ut perspiciatis unde omnis iste natus &error sit voluptatem accusantium doloremque l:audantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et &quasi architecto beatae vitae ::dicta sunt explicabo. Nemo enim ipsam volupta:tem quia voluptas sit aspernatur aut o&dit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciun&t. Neque porro quisquam est, qui dolorem: ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut e:nim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi co&&nsequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse: quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?";
// short
Replacements = new Dictionary<string, string>
{
{ ",", "*" },
{ ".", "*" },
{ ":", "*" },
{ "&", "*" },
{ "#", "*" },
};
// long
//Replacements = new Dictionary<string, string>();
//for (var i = 2; i < 100; i++)
// Replacements[Convert.ToChar(i).ToString()] = "*";
}
// this is what v7 originally did
[Benchmark(Description = "String.ReplaceMany w/chars - Aggregate", Baseline = true)]
public string ReplaceManyAggregate()
{
var result = Text;
return ReplacedChars.Aggregate(result, (current, c) => current.Replace(c, ReplacementChar));
}
[Benchmark(Description = "String.ReplaceMany w/chars - For Loop")]
public string ReplaceManyForLoop()
{
var result = Text;
// ReSharper disable once LoopCanBeConvertedToQuery
// ReSharper disable once ForCanBeConvertedToForeach
for (var i = 0; i < ReplacedChars.Length; i++)
{
result = result.Replace(ReplacedChars[i], ReplacementChar);
}
return result;
}
// this is what v7 originally did
[Benchmark(Description = "String.ReplaceMany w/dictionary - Aggregate")]
public string ReplaceManyDictionaryAggregate()
{
return Replacements.Aggregate(Text, (current, kvp) => current.Replace(kvp.Key, kvp.Value));
}
[Benchmark(Description = "String.ReplaceMany w/dictionary - For Each")]
public string ReplaceManyDictionaryForEach()
{
var result = Text;
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var item in Replacements)
{
result = result.Replace(item.Key, item.Value);
}
return result;
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using Umbraco.Core;
namespace Umbraco.Tests.Benchmarks
{
[MemoryDiagnoser]
public class TryConvertToBenchmarks
{
private static readonly List<string> List = new List<string>() { "hello", "world", "awesome" };
private static readonly string Date = "Saturday 10, November 2012";
[Benchmark(Description = "List<string> to IEnumerable<string>")]
public IEnumerable<string> TryConvertToEnumerable()
{
return List.TryConvertTo<IEnumerable<string>>().Result;
}
[Benchmark(Description = "Int to Double")]
public double TryConvertToDouble()
{
return 1.TryConvertTo<double>().Result;
}
[Benchmark(Description = "Float to Decimal")]
public decimal TryConvertToDecimal()
{
return 1F.TryConvertTo<decimal>().Result;
}
[Benchmark(Description = "String to Boolean")]
public bool TryConvertToBoolean()
{
return "1".TryConvertTo<bool>().Result;
}
[Benchmark(Description = "String to DateTime")]
public DateTime TryConvertToDateTime()
{
return Date.TryConvertTo<DateTime>().Result;
}
}
}
@@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Umbraco.Tests.Benchmarks</RootNamespace>
<AssemblyName>Umbraco.Tests.Benchmarks</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -38,38 +39,55 @@
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="BenchmarkDotNet, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.0.9.9\lib\net45\BenchmarkDotNet.dll</HintPath>
<Reference Include="BenchmarkDotNet, Version=0.10.12.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.0.10.12\lib\net46\BenchmarkDotNet.dll</HintPath>
</Reference>
<Reference Include="BenchmarkDotNet.Core, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Core.0.9.9\lib\net45\BenchmarkDotNet.Core.dll</HintPath>
<Reference Include="BenchmarkDotNet.Core, Version=0.10.12.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Core.0.10.12\lib\net46\BenchmarkDotNet.Core.dll</HintPath>
</Reference>
<Reference Include="BenchmarkDotNet.Diagnostics.Windows, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Diagnostics.Windows.0.9.9\lib\net45\BenchmarkDotNet.Diagnostics.Windows.dll</HintPath>
</Reference>
<Reference Include="BenchmarkDotNet.Toolchains.Roslyn, Version=0.9.9.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Toolchains.Roslyn.0.9.9\lib\net45\BenchmarkDotNet.Toolchains.Roslyn.dll</HintPath>
<Reference Include="BenchmarkDotNet.Toolchains.Roslyn, Version=0.10.12.0, Culture=neutral, PublicKeyToken=aa0ca2f9092cefc4, processorArchitecture=MSIL">
<HintPath>..\packages\BenchmarkDotNet.Toolchains.Roslyn.0.10.12\lib\net46\BenchmarkDotNet.Toolchains.Roslyn.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.3.2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Reference Include="Microsoft.CodeAnalysis, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.3.2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Diagnostics.Tracing.TraceEvent, Version=1.0.41.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.41\lib\net40\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DotNet.InternalAbstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.DotNet.InternalAbstractions.1.0.0\lib\net451\Microsoft.DotNet.InternalAbstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.DotNet.PlatformAbstractions.1.1.1\lib\net451\Microsoft.DotNet.PlatformAbstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Registry, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Registry.4.3.0\lib\net46\Microsoft.Win32.Registry.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.1.1309.919, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.1.1309.0919\lib\net40\Moq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.dll</HintPath>
@@ -77,13 +95,52 @@
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.FileVersionInfo, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.StackTrace, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Reflection.Metadata, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.3.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Reference Include="System.Reflection.Metadata, Version=1.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.0.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net46\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net46\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.4.3.0\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Thread, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -91,20 +148,38 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
</Reference>
<Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
</Reference>
<Reference Include="System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
</Reference>
<Reference Include="System.Xml.XPath.XDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ConcurrentDictionaryBenchmarks.cs" />
<Compile Include="Config\QuickRunConfigAttribute.cs" />
<Compile Include="Config\QuickRunWithMemoryDiagnoserConfigAttribute.cs" />
<Compile Include="LinqCastBenchmarks.cs" />
<Compile Include="ModelToSqlExpressionHelperBenchmarks.cs" />
<Compile Include="BulkInsertBenchmarks.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StringReplaceManyBenchmarks.cs" />
<Compile Include="TryConvertToBenchmarks.cs" />
<Compile Include="XmlBenchmarks.cs" />
<Compile Include="XmlPublishedContentInitBenchmarks.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="_TraceEventProgrammersGuide.docx" />
<None Include="app.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
@@ -120,10 +195,6 @@
<Name>Umbraco.Web</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="TraceEvent.ReadMe.txt" />
<Content Include="TraceEvent.ReleaseNotes.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
+8 -31
View File
@@ -1,42 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnostics.Windows;
using BenchmarkDotNet.Jobs;
using Umbraco.Tests.Benchmarks.Config;
namespace Umbraco.Tests.Benchmarks
{
[Config(typeof(Config))]
[QuickRunWithMemoryDiagnoserConfig]
public class XmlBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
Add(new MemoryDiagnoser());
//Add(ExecutionValidator.FailOnError);
//The 'quick and dirty' settings, so it runs a little quicker
// see benchmarkdotnet FAQ
Add(Job.Default
.WithLaunchCount(1) // benchmark process will be launched only once
.WithIterationTime(100) // 100ms per iteration
.WithWarmupCount(3) // 3 warmup iteration
.WithTargetCount(3)); // 3 target iteration
}
}
[Setup]
[GlobalSetup]
public void Setup()
{
var templateId = 0;
var xmlText = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!DOCTYPE root[
<!DOCTYPE root[
<!ELEMENT Home ANY>
<!ATTLIST Home id ID #REQUIRED>
<!ELEMENT CustomDocument ANY>
@@ -49,7 +26,7 @@ namespace Umbraco.Tests.Benchmarks
<umbracoNaviHide>1</umbracoNaviHide>
<Home id=""1173"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-20T18:06:45"" updateDate=""2012-07-20T19:07:31"" nodeName=""Sub1"" urlName=""sub1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173"" isDoc="""">
<content><![CDATA[<div>This is some content</div>]]></content>
<umbracoUrlAlias><![CDATA[page2/alias, 2ndpagealias]]></umbracoUrlAlias>
<umbracoUrlAlias><![CDATA[page2/alias, 2ndpagealias]]></umbracoUrlAlias>
<Home id=""1174"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-20T18:07:54"" updateDate=""2012-07-20T19:10:27"" nodeName=""Sub2"" urlName=""sub2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1174"" isDoc="""">
<content><![CDATA[]]></content>
<umbracoUrlAlias><![CDATA[only/one/alias]]></umbracoUrlAlias>
@@ -70,7 +47,7 @@ namespace Umbraco.Tests.Benchmarks
_xml.LoadXml(xmlText);
}
[Cleanup]
[GlobalCleanup]
public void Cleanup()
{
_xml = null;
@@ -90,7 +67,7 @@ namespace Umbraco.Tests.Benchmarks
public void XmlWithNavigation()
{
var elt = _xml.DocumentElement;
var id = NavigateElementRoute(elt, new[] {"home", "sub1", "sub2"});
var id = NavigateElementRoute(elt, new[] { "home", "sub1", "sub2" });
if (id <= 0) Console.WriteLine("ERR");
}
@@ -120,4 +97,4 @@ namespace Umbraco.Tests.Benchmarks
return found ? int.Parse(elt.GetAttribute("id")) : -1;
}
}
}
}
@@ -3,37 +3,17 @@ using System.Collections.Generic;
using System.Linq;
using System.Xml;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnostics.Windows;
using BenchmarkDotNet.Jobs;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Tests.Benchmarks.Config;
using Umbraco.Web.PublishedCache.XmlPublishedCache;
namespace Umbraco.Tests.Benchmarks
{
[Config(typeof(Config))]
[QuickRunWithMemoryDiagnoserConfig]
public class XmlPublishedContentInitBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
Add(new MemoryDiagnoser());
//The 'quick and dirty' settings, so it runs a little quicker
// see benchmarkdotnet FAQ
Add(Job.Default
.WithLaunchCount(1) // benchmark process will be launched only once
.WithIterationTime(100) // 100ms per iteration
.WithWarmupCount(3) // 3 warmup iteration
.WithTargetCount(3)); // 3 target iteration
}
}
public XmlPublishedContentInitBenchmarks()
{
_xml10 = Build(10);
@@ -281,7 +261,7 @@ namespace Umbraco.Tests.Benchmarks
var nodes = xmlNode.SelectNodes(dataXPath);
contentType = GetPublishedContentType(PublishedItemType.Content, docTypeAlias);
var propertyNodes = new Dictionary<string, XmlNode>();
if (nodes != null)
foreach (XmlNode n in nodes)
@@ -307,8 +287,8 @@ namespace Umbraco.Tests.Benchmarks
private static PublishedContentType GetPublishedContentType(PublishedItemType type, string alias)
{
return new PublishedContentType(alias, new string[] {},
new List<PublishedPropertyType>(Enumerable.Range(0, 10).Select(x => new PublishedPropertyType("prop" + x, 0, "test", initConverters:false))));
return new PublishedContentType(alias, new string[] { },
new List<PublishedPropertyType>(Enumerable.Range(0, 10).Select(x => new PublishedPropertyType("prop" + x, 0, "test", initConverters: false))));
}
}
@@ -1,16 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
@@ -27,6 +30,10 @@
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
@@ -36,45 +43,25 @@
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
<assemblyIdentity name="BenchmarkDotNet.Core" publicKeyToken="aa0ca2f9092cefc4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.10.12.0" newVersion="0.10.12.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
+50 -29
View File
@@ -1,40 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BenchmarkDotNet" version="0.9.9" targetFramework="net45" />
<package id="BenchmarkDotNet.Core" version="0.9.9" targetFramework="net45" />
<package id="BenchmarkDotNet" version="0.10.12" targetFramework="net46" />
<package id="BenchmarkDotNet.Core" version="0.10.12" targetFramework="net46" />
<package id="BenchmarkDotNet.Diagnostics.Windows" version="0.9.9" targetFramework="net45" />
<package id="BenchmarkDotNet.Toolchains.Roslyn" version="0.9.9" targetFramework="net45" />
<package id="BenchmarkDotNet.Toolchains.Roslyn" version="0.10.12" targetFramework="net46" />
<package id="Castle.Core" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Common" version="1.3.2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.CSharp" version="1.3.2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Common" version="2.4.0" targetFramework="net46" />
<package id="Microsoft.CodeAnalysis.CSharp" version="2.4.0" targetFramework="net46" />
<package id="Microsoft.Diagnostics.Tracing.TraceEvent" version="1.0.41" targetFramework="net45" />
<package id="Microsoft.DotNet.InternalAbstractions" version="1.0.0" targetFramework="net46" />
<package id="Microsoft.DotNet.PlatformAbstractions" version="1.1.1" targetFramework="net46" />
<package id="Microsoft.SqlServer.Compact" version="4.0.8854.1" targetFramework="net45" />
<package id="Microsoft.Win32.Registry" version="4.3.0" targetFramework="net46" />
<package id="Moq" version="4.1.1309.0919" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
<package id="System.Collections" version="4.0.11" targetFramework="net45" />
<package id="System.Collections.Concurrent" version="4.0.12" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.2.0" targetFramework="net45" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net45" />
<package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="net45" />
<package id="System.Dynamic.Runtime" version="4.0.11" targetFramework="net45" />
<package id="System.Globalization" version="4.0.11" targetFramework="net45" />
<package id="System.Linq" version="4.1.0" targetFramework="net45" />
<package id="System.Linq.Expressions" version="4.1.0" targetFramework="net45" />
<package id="System.Reflection" version="4.1.0" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.3.0" targetFramework="net45" />
<package id="System.AppContext" version="4.3.0" targetFramework="net46" />
<package id="System.Collections" version="4.3.0" targetFramework="net46" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net46" />
<package id="System.Collections.Immutable" version="1.3.1" targetFramework="net46" />
<package id="System.Console" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net46" />
<package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net46" />
<package id="System.Globalization" version="4.3.0" targetFramework="net46" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net46" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net46" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Linq" version="4.3.0" targetFramework="net46" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net46" />
<package id="System.Reflection" version="4.3.0" targetFramework="net46" />
<package id="System.Reflection.Metadata" version="1.4.2" targetFramework="net46" />
<package id="System.Reflection.Primitives" version="4.0.1" targetFramework="net45" />
<package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="net45" />
<package id="System.Runtime" version="4.1.0" targetFramework="net45" />
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net45" />
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="net45" />
<package id="System.Runtime.Numerics" version="4.0.1" targetFramework="net45" />
<package id="System.Text.Encoding" version="4.0.11" targetFramework="net45" />
<package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="net45" />
<package id="System.Threading" version="4.0.11" targetFramework="net45" />
<package id="System.Threading.Tasks" version="4.0.11" targetFramework="net45" />
<package id="System.Threading.Tasks.Extensions" version="4.0.0" targetFramework="net45" />
<package id="System.Threading.Tasks.Parallel" version="4.0.1" targetFramework="net45" />
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net45" />
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="net45" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net46" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net46" />
<package id="System.Text.Encoding.CodePages" version="4.3.0" targetFramework="net46" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net46" />
<package id="System.Threading" version="4.3.0" targetFramework="net46" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net46" />
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net46" />
<package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net46" />
<package id="System.Threading.Thread" version="4.3.0" targetFramework="net46" />
<package id="System.ValueTuple" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.XPath" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net46" />
</packages>
+153 -11
View File
@@ -6,6 +6,10 @@ using System.Threading;
using System.Web.UI.WebControls;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
namespace Umbraco.Tests
{
@@ -155,16 +159,151 @@ namespace Umbraco.Tests
Assert.AreEqual("Hello world", result.Result);
}
[Test]
[Test]
public virtual void CanConvertObjectToSameObject()
{
var obj = new MyTestObject();
var result = obj.TryConvertTo<object>();
Assert.AreEqual(obj, result.Result);
Assert.AreEqual(obj, result.Result);
}
private CultureInfo savedCulture;
[Test]
public void ConvertToIntegerTest()
{
var conv = "100".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100.000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100,000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = "100.001".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100.000m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = 100.001m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
}
[Test]
public void ConvertToDecimalTest()
{
var conv = "100".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100,000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.001".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.000m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.001m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
}
[Test]
public void ConvertToNullableDecimalTest()
{
var conv = "100".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.000".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100,000".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.001".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100m.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.000m.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.001m.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
}
[Test]
public void ConvertToDateTimeTest()
{
var conv = "2016-06-07".TryConvertTo<DateTime?>();
Assert.IsTrue(conv);
Assert.AreEqual(new DateTime(2016, 6, 7), conv.Result);
}
[Test]
public void ConvertToNullableDateTimeTest()
{
var conv = "2016-06-07".TryConvertTo<DateTime>();
Assert.IsTrue(conv);
Assert.AreEqual(new DateTime(2016, 6, 7), conv.Result);
}
[Test]
public void Value_Editor_Can_Convert_Decimal_To_Decimal_Clr_Type()
{
var valueEditor = new PropertyValueEditor
{
ValueType = PropertyEditorValueTypes.Decimal
};
var result = valueEditor.TryConvertValueToCrlType(12.34d);
Assert.IsTrue(result.Success);
Assert.AreEqual(12.34d, result.Result);
}
private CultureInfo _savedCulture;
/// <summary>
/// Run once before each test in derived test fixtures.
@@ -172,10 +311,13 @@ namespace Umbraco.Tests
[SetUp]
public void TestSetup()
{
savedCulture = Thread.CurrentThread.CurrentCulture;
_savedCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); // make sure the dates parse correctly
return;
}
var settings = SettingsForTests.GetDefault();
ShortStringHelperResolver.Current = new ShortStringHelperResolver(new DefaultShortStringHelper(settings).WithDefaultConfig());
Resolution.Freeze();
}
/// <summary>
/// Run once after each test in derived test fixtures.
@@ -183,9 +325,9 @@ namespace Umbraco.Tests
[TearDown]
public void TestTearDown()
{
Thread.CurrentThread.CurrentCulture = savedCulture;
return;
}
Thread.CurrentThread.CurrentCulture = _savedCulture;
ShortStringHelperResolver.Reset();
}
private class MyTestObject
{
@@ -195,4 +337,4 @@ namespace Umbraco.Tests
}
}
}
}
}
@@ -332,6 +332,9 @@ namespace Umbraco.Tests.Persistence.Repositories
var contentType = (IContentType)MockedContentTypes.CreateSimpleContentType2("test", "Test", propertyGroupName: "testGroup");
Assert.AreEqual(4, contentType.PropertyTypes.Count());
// remove all templates - since they are not saved, they would break the (wtf) mapping code
contentType.AllowedTemplates = new ITemplate[0];
// there is NO mapping from display to contentType, but only from save
// to contentType, so if we want to test, let's to it properly!
@@ -24,7 +24,9 @@ namespace Umbraco.Tests.Persistence.Repositories
[TestCase("Alpha (10)", "Alpha (2)", +1)] // this is the real stuff
[TestCase("Kilo", "Golf (2)", +1)]
[TestCase("Kilo (1)", "Golf (2)", +1)]
public void ComparerTest(string name1, string name2, int expected)
[TestCase("", "", 0)]
[TestCase(null, null, 0)]
public void ComparerTest(string name1, string name2, int expected)
{
var comparer = new SimilarNodeName.Comparer();
@@ -76,7 +78,9 @@ namespace Umbraco.Tests.Persistence.Repositories
[TestCase(0, "Alpha", "Alpha (3)")]
[TestCase(0, "Kilo (1)", "Kilo (1) (1)")] // though... we might consider "Kilo (2)"
[TestCase(6, "Kilo (1)", "Kilo (1)")] // because of the id
public void Test(int nodeId, string nodeName, string expected)
[TestCase(0, "", " (1)")]
[TestCase(0, null, " (1)")]
public void Test(int nodeId, string nodeName, string expected)
{
var names = new[]
{
@@ -286,7 +286,7 @@ AnotherContentFinder
{
var trees = _manager.ResolveAttributedTrees();
// commit 6c5e35ec2cbfa31be6790d1228e0c2faf5f55bc8 brings the count down to 14
Assert.AreEqual(8, trees.Count());
Assert.AreEqual(6, trees.Count());
}
[Test]
@@ -29,7 +29,7 @@ namespace Umbraco.Tests.PropertyEditors
[Test]
public void ImageCropData_Properties_As_Dynamic()
{
var sourceObj = cropperJson1.SerializeToCropDataSet();
var sourceObj = cropperJson1.DeserializeToCropDataSet();
dynamic d = sourceObj;
var index = 0;
@@ -62,7 +62,7 @@ namespace Umbraco.Tests.PropertyEditors
[Test]
public void ImageCropFocalPoint_Properties_As_Dynamic()
{
var sourceObj = cropperJson1.SerializeToCropDataSet();
var sourceObj = cropperJson1.DeserializeToCropDataSet();
dynamic d = sourceObj;
Assert.AreEqual(sourceObj.FocalPoint.Left, d.FocalPoint.Left);
@@ -75,7 +75,7 @@ namespace Umbraco.Tests.PropertyEditors
[Test]
public void ImageCropDataSet_Properties_As_Dynamic()
{
var sourceObj = cropperJson1.SerializeToCropDataSet();
var sourceObj = cropperJson1.DeserializeToCropDataSet();
dynamic d = sourceObj;
Assert.AreEqual(sourceObj.Src, d.Src);
@@ -91,7 +91,7 @@ namespace Umbraco.Tests.PropertyEditors
[Test]
public void ImageCropDataSet_Methods_As_Dynamic()
{
var sourceObj = cropperJson1.SerializeToCropDataSet();
var sourceObj = cropperJson1.DeserializeToCropDataSet();
dynamic d = sourceObj;
Assert.AreEqual(sourceObj.HasCrop("thumb"), d.HasCrop("thumb"));
@@ -108,7 +108,7 @@ namespace Umbraco.Tests.PropertyEditors
public void CanConvertImageCropperDataSetSrcToString()
{
//cropperJson3 - has not crops
var sourceObj = cropperJson3.SerializeToCropDataSet();
var sourceObj = cropperJson3.DeserializeToCropDataSet();
var destObj = sourceObj.TryConvertTo<string>();
Assert.IsTrue(destObj.Success);
Assert.AreEqual(destObj.Result, "/media/1005/img_0672.jpg");
@@ -118,7 +118,7 @@ namespace Umbraco.Tests.PropertyEditors
public void CanConvertImageCropperDataSetJObject()
{
//cropperJson3 - has not crops
var sourceObj = cropperJson3.SerializeToCropDataSet();
var sourceObj = cropperJson3.DeserializeToCropDataSet();
var destObj = sourceObj.TryConvertTo<JObject>();
Assert.IsTrue(destObj.Success);
Assert.AreEqual(sourceObj, destObj.Result.ToObject<ImageCropDataSet>());
@@ -127,7 +127,7 @@ namespace Umbraco.Tests.PropertyEditors
[Test]
public void CanConvertImageCropperDataSetJsonToString()
{
var sourceObj = cropperJson1.SerializeToCropDataSet();
var sourceObj = cropperJson1.DeserializeToCropDataSet();
var destObj = sourceObj.TryConvertTo<string>();
Assert.IsTrue(destObj.Success);
Assert.IsTrue(destObj.Result.DetectIsJson());
@@ -150,7 +150,7 @@ namespace Umbraco.Tests.PropertyEditors
var converter = new Umbraco.Web.PropertyEditors.ValueConverters.ImageCropperValueConverter(dataTypeService.Object);
var result = converter.ConvertDataToSource(new PublishedPropertyType("test", 0, "test"), val1, false); // does not use type for conversion
var resultShouldMatch = val2.SerializeToCropDataSet();
var resultShouldMatch = val2.DeserializeToCropDataSet();
if (expected)
{
Assert.AreEqual(resultShouldMatch, result);
@@ -220,7 +220,7 @@ namespace Umbraco.Tests.PropertyEditors
[Test]
public void GetBaseCropUrlFromModelTest()
{
var cropDataSet = cropperJson1.SerializeToCropDataSet();
var cropDataSet = cropperJson1.DeserializeToCropDataSet();
var urlString = cropDataSet.GetCropUrl("thumb");
Assert.AreEqual("?crop=0.58729977382575338,0.055768992440203169,0,0.32457553600198386&cropmode=percentage&width=100&height=100", urlString);
}
@@ -548,7 +548,7 @@ namespace Umbraco.Tests.Scheduling
runner.Shutdown(false, true);
// check that task has been disposed (timer has been killed, etc)
Assert.IsTrue(task.IsDisposed);
Assert.IsTrue(task.Disposed);
}
}
@@ -533,6 +533,16 @@ namespace Umbraco.Tests.Services
Assert.AreEqual(mediaObjectType, UmbracoObjectTypes.MediaType);
}
[Test]
public void EntityService_Can_Get_Key_For_Id_With_Unknown_Type()
{
var service = ServiceContext.EntityService;
var result = service.GetKeyForId(1060, UmbracoObjectTypes.Unknown);
Assert.IsTrue(result.Success);
Assert.AreEqual(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), result.Result);
}
[Test]
public void EntityService_Can_Get_Key_For_Id()
{
@@ -554,6 +564,16 @@ namespace Umbraco.Tests.Services
Assert.IsFalse(result2.Success);
}
[Test]
public void EntityService_Can_Get_Id_For_Key_With_Unknown_Type()
{
var service = ServiceContext.EntityService;
var result = service.GetIdForKey(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), UmbracoObjectTypes.Unknown);
Assert.IsTrue(result.Success);
Assert.AreEqual(1060, result.Result);
}
[Test]
public void EntityService_Can_Get_Id_For_Key()
{
-105
View File
@@ -1,105 +0,0 @@
using System;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
namespace Umbraco.Tests
{
[TestFixture]
public class TryConvertToTests
{
[SetUp]
public void SetUp()
{
var settings = SettingsForTests.GetDefault();
ShortStringHelperResolver.Current = new ShortStringHelperResolver(new DefaultShortStringHelper(settings).WithDefaultConfig());
Resolution.Freeze();
}
[TearDown]
public void TearDown()
{
ShortStringHelperResolver.Reset();
}
[Test]
public void ConvertToIntegerTest()
{
var conv = "100".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100.000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100,000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = "100.001".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100.000m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = 100.001m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
}
[Test]
public void ConvertToDecimalTest()
{
var conv = "100".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100,000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.001".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.000m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.001m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
}
[Test]
public void ConvertToDateTimeTest()
{
var conv = "2016-06-07".TryConvertTo<DateTime>();
Assert.IsTrue(conv);
Assert.AreEqual(new DateTime(2016, 6, 7), conv.Result);
}
}
}
-1
View File
@@ -232,7 +232,6 @@
<Compile Include="Services\CachedDataTypeServiceTests.cs" />
<Compile Include="TestHelpers\Entities\MockedPropertyTypes.cs" />
<Compile Include="TestHelpers\Entities\MockedUserGroup.cs" />
<Compile Include="TryConvertToTests.cs" />
<Compile Include="UdiTests.cs" />
<Compile Include="UmbracoExamine\RandomIdRAMDirectory.cs" />
<Compile Include="UmbracoExamine\UmbracoContentIndexerTests.cs" />
+1 -8
View File
@@ -31,8 +31,7 @@
"moment": "~2.10.3",
"ace-builds": "^1.2.3",
"clipboard": "1.7.1",
"font-awesome": "~4.2",
"angular-moment": "^1.0.1"
"font-awesome": "~4.2"
},
"install": {
"path": "lib-bower",
@@ -60,9 +59,6 @@
"bower_components/angular-local-storage/dist/angular-local-storage.min.js",
"bower_components/angular-local-storage/dist/angular-local-storage.min.js.map"
],
"angular-moment": [
"bower_components/angular-moment/angular-moment.min.js"
],
"tinymce": [
"bower_components/tinymce/tinymce.min.js"
],
@@ -73,8 +69,5 @@
"jquery-migrate": "bower_components/jquery-migrate/jquery-migrate.min.js",
"clipboard": "bower_components/clipboard/dist/clipboard.min.js"
}
},
"resolutions": {
"moment": ">=2.19.3 <3.0.0"
}
}
@@ -84,27 +84,21 @@
};
}
if (!String.prototype.trimStart) {
/** trims the start of the string*/
String.prototype.trimStart = function (str) {
if (this.startsWith(str)) {
return this.substring(str.length);
}
return this;
};
}
if (!String.prototype.trimEnd) {
/** trims the start of the string*/
String.prototype.trimStart = function (str) {
if (this.startsWith(str)) {
return this.substring(str.length);
}
return this;
};
/** trims the end of the string*/
String.prototype.trimEnd = function (str) {
if (this.endsWith(str)) {
return this.substring(0, this.length - str.length);
}
return this;
};
}
/** trims the end of the string*/
String.prototype.trimEnd = function (str) {
if (this.endsWith(str)) {
return this.substring(0, this.length - str.length);
}
return this;
};
if (!String.prototype.utf8Encode) {
@@ -332,4 +326,4 @@
}
})();
})();
+1 -2
View File
@@ -11,8 +11,7 @@ var app = angular.module('umbraco', [
'ngMobile',
'tmh.dynamicLocale',
'ngFileUpload',
'LocalStorageModule',
'angularMoment'
'LocalStorageModule'
]);
var packages = angular.module("umbraco.packages", []);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 KiB

After

Width:  |  Height:  |  Size: 386 KiB

@@ -1,3 +1,188 @@
/**
@ngdoc directive
@name umbraco.directives.directive:umbTour
@restrict E
@scope
@description
<b>Added in Umbraco 7.8</b>. The tour component is a global component and is already added to the umbraco markup.
In the Umbraco UI the tours live in the "Help drawer" which opens when you click the Help-icon in the bottom left corner of Umbraco.
You can easily add you own tours to the Help-drawer or show and start tours from
anywhere in the Umbraco backoffice. To see a real world example of a custom tour implementation, install <a href="https://our.umbraco.org/projects/starter-kits/the-starter-kit/">The Starter Kit</a> in Umbraco 7.8
<h1><b>Extending the help drawer with custom tours</b></h1>
The easiet way to add new tours to Umbraco is through the Help-drawer. All it requires is a my-tour.json file.
Place the file in <i>App_Plugins/{MyPackage}/backoffice/tours/{my-tour}.json</i> and it will automatically be
picked up by Umbraco and shown in the Help-drawer.
<h3><b>The tour object</b></h3>
The tour object consist of two parts - The overall tour configuration and a list of tour steps. We have split up the tour object for a better overview.
<pre>
// The tour config object
{
"name": "My Custom Tour", // (required)
"alias": "myCustomTour", // A unique tour alias (required)
"group": "My Custom Group" // Used to group tours in the help drawer
"groupOrder": 200 // Control the order of tour groups
"allowDisable": // Adds a "Don't" show this tour again"-button to the intro step
"requiredSections":["content", "media", "mySection"] // Sections that the tour will access while running, if the user does not have access to the required tour sections, the tour will not load.
"steps": [] // tour steps - see next example
}
</pre>
<pre>
// A tour step object
{
"title": "Title",
"content": "<p>Step content</p>",
"type": "intro" // makes the step an introduction step,
"element": "[data-element='my-table-row']", // the highlighted element
"event": "click" // forces the user to click the UI to go to next step
"eventElement": "[data-element='my-table-row'] [data-element='my-tour-button']" // specify an element to click inside a highlighted element
"elementPreventClick": false // prevents user interaction in the highlighted element
"backdropOpacity": 0.4 // the backdrop opacity
"view": "" // add a custom view
"customProperties" : {} // add any custom properties needed for the custom view
}
</pre>
<h1><b>Adding tours to other parts of the Umbraco backoffice</b></h1>
It is also possible to add a list of custom tours to other parts of the Umbraco backoffice,
as an example on a Dashboard in a Custom section. You can then use the {@link umbraco.services.tourService tourService} to start and stop tours but you don't have to register them as part of the tour service.
<h1><b>Using the tour service</b></h1>
<h3>Markup example - show custom tour</h3>
<pre>
<div ng-controller="My.TourController as vm">
<div>{{vm.tour.name}}</div>
<button type="button" ng-click="vm.startTour()">Start tour</button>
<!-- This button will be clicked in the tour -->
<button data-element="my-tour-button" type="button">Click me</button>
</div>
</pre>
<h3>Controller example - show custom tour</h3>
<pre>
(function () {
"use strict";
function TourController(tourService) {
var vm = this;
vm.tour = {
"name": "My Custom Tour",
"alias": "myCustomTour",
"steps": [
{
"title": "Welcome to My Custom Tour",
"content": "",
"type": "intro"
},
{
"element": "[data-element='my-tour-button']",
"title": "Click the button",
"content": "Click the button",
"event": "click"
}
]
};
vm.startTour = startTour;
function startTour() {
tourService.startTour(vm.tour);
}
}
angular.module("umbraco").controller("My.TourController", TourController);
})();
</pre>
<h1><b>Custom step views</b></h1>
In some cases you will need a custom view for one of your tour steps.
This could be for validation or for running any other custom logic for that step.
We have added a couple of helper components to make it easier to get the step scaffolding to look like a regular tour step.
In the following example you see how to run some custom logic before a step goes to the next step.
<h3>Markup example - custom step view</h3>
<pre>
<div ng-controller="My.TourStep as vm">
<umb-tour-step on-close="model.endTour()">
<umb-tour-step-header
title="model.currentStep.title">
</umb-tour-step-header>
<umb-tour-step-content
content="model.currentStep.content">
<!-- Add any custom content here -->
</umb-tour-step-content>
<umb-tour-step-footer class="flex justify-between items-center">
<umb-tour-step-counter
current-step="model.currentStepIndex + 1"
total-steps="model.steps.length">
</umb-tour-step-counter>
<div>
<umb-button
size="xs"
button-style="success"
type="button"
action="vm.initNextStep()"
label="Next">
</umb-button>
</div>
</umb-tour-step-footer>
</umb-tour-step>
</div>
</pre>
<h3>Controller example - custom step view</h3>
<pre>
(function () {
"use strict";
function StepController() {
var vm = this;
vm.initNextStep = initNextStep;
function initNextStep() {
// run logic here before going to the next step
$scope.model.nextStep();
}
}
angular.module("umbraco").controller("My.TourStep", StepController);
})();
</pre>
<h3>Related services</h3>
<ul>
<li>{@link umbraco.services.tourService tourService}</li>
</ul>
@param {string} model (<code>binding</code>): Tour object
**/
(function () {
'use strict';
@@ -84,6 +84,7 @@
}
function createButtons(content) {
$scope.page.buttonGroupState = "init";
var buttons = contentEditingHelper.configureContentEditorButtons({
create: $scope.page.isNew,
content: content,
@@ -214,6 +215,8 @@
$scope.page.buttonGroupState = "success";
}, function(err) {
$scope.page.buttonGroupState = 'error';
});
}
@@ -1,7 +1,7 @@
(function () {
'use strict';
function ContentNodeInfoDirective($timeout, $location, logResource, eventsService, userService, localizationService) {
function ContentNodeInfoDirective($timeout, $location, logResource, eventsService, userService, localizationService, dateHelper) {
function link(scope, element, attrs, ctrl) {
@@ -86,7 +86,7 @@
// get current backoffice user and format dates
userService.getCurrentUser().then(function (currentUser) {
angular.forEach(data.items, function(item) {
item.timestampFormatted = getLocalDate(item.timestamp, currentUser.locale, 'LLL');
item.timestampFormatted = dateHelper.getLocalDate(item.timestamp, currentUser.locale, 'LLL');
});
});
@@ -149,8 +149,17 @@
function setPublishDate(date) {
if (!date) {
return;
}
//The date being passed in here is the user's local date/time that they have selected
//we need to convert this date back to the server date on the model.
var serverTime = dateHelper.convertToServerStringTime(moment(date), Umbraco.Sys.ServerVariables.application.serverTimeOffset);
// update publish value
scope.node.releaseDate = date;
scope.node.releaseDate = serverTime;
// make sure dates are formatted to the user's locale
formatDatesToLocal();
@@ -174,8 +183,17 @@
function setUnpublishDate(date) {
if (!date) {
return;
}
//The date being passed in here is the user's local date/time that they have selected
//we need to convert this date back to the server date on the model.
var serverTime = dateHelper.convertToServerStringTime(moment(date), Umbraco.Sys.ServerVariables.application.serverTimeOffset);
// update publish value
scope.node.removeDate = date;
scope.node.removeDate = serverTime;
// make sure dates are formatted to the user's locale
formatDatesToLocal();
@@ -199,31 +217,24 @@
function ucfirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getLocalDate(date, culture, format) {
if (date) {
var dateVal;
var serverOffset = Umbraco.Sys.ServerVariables.application.serverTimeOffset;
var localOffset = new Date().getTimezoneOffset();
var serverTimeNeedsOffsetting = -serverOffset !== localOffset;
if (serverTimeNeedsOffsetting) {
dateVal = dateHelper.convertToLocalMomentTime(date, serverOffset);
} else {
dateVal = moment(date, 'YYYY-MM-DD HH:mm:ss');
}
return dateVal.locale(culture).format(format);
}
}
function formatDatesToLocal() {
// get current backoffice user and format dates
userService.getCurrentUser().then(function (currentUser) {
scope.node.createDateFormatted = getLocalDate(scope.node.createDate, currentUser.locale, 'LLL');
scope.node.releaseDateMonth = scope.node.releaseDate ? ucfirst(getLocalDate(scope.node.releaseDate, currentUser.locale, 'MMMM')) : null;
scope.node.releaseDateDay = scope.node.releaseDate ? ucfirst(getLocalDate(scope.node.releaseDate, currentUser.locale, 'dddd')) : null;
scope.node.removeDateMonth = scope.node.removeDate ? ucfirst(getLocalDate(scope.node.removeDate, currentUser.locale, 'MMMM')) : null;
scope.node.removeDateDay = scope.node.removeDate ? ucfirst(getLocalDate(scope.node.removeDate, currentUser.locale, 'dddd')) : null;
scope.node.createDateFormatted = dateHelper.getLocalDate(scope.node.createDate, currentUser.locale, 'LLL');
scope.node.releaseDateYear = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'YYYY')) : null;
scope.node.releaseDateMonth = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'MMMM')) : null;
scope.node.releaseDateDayNumber = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'DD')) : null;
scope.node.releaseDateDay = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'dddd')) : null;
scope.node.releaseDateTime = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'HH:mm')) : null;
scope.node.removeDateYear = scope.node.removeDate ? ucfirst(dateHelper.getLocalDate(scope.node.removeDate, currentUser.locale, 'YYYY')) : null;
scope.node.removeDateMonth = scope.node.removeDate ? ucfirst(dateHelper.getLocalDate(scope.node.removeDate, currentUser.locale, 'MMMM')) : null;
scope.node.removeDateDayNumber = scope.node.removeDate ? ucfirst(dateHelper.getLocalDate(scope.node.removeDate, currentUser.locale, 'DD')) : null;
scope.node.removeDateDay = scope.node.removeDate ? ucfirst(dateHelper.getLocalDate(scope.node.removeDate, currentUser.locale, 'dddd')) : null;
scope.node.removeDateTime = scope.node.removeDate ? ucfirst(dateHelper.getLocalDate(scope.node.removeDate, currentUser.locale, 'HH:mm')) : null;
});
}
@@ -1,20 +1,28 @@
(function () {
'use strict';
function MediaNodeInfoDirective($timeout, $location) {
function MediaNodeInfoDirective($timeout, $location, eventsService, userService, dateHelper) {
function link(scope, element, attrs, ctrl) {
var evts = [];
function onInit() {
scope.allowOpenMediaType = true;
// get document type details
scope.mediaType = scope.node.contentType;
// get node url
scope.nodeUrl = scope.node.mediaLink;
// make sure dates are formatted to the user's locale
formatDatesToLocal();
}
function formatDatesToLocal() {
// get current backoffice user and format dates
userService.getCurrentUser().then(function (currentUser) {
scope.node.createDateFormatted = dateHelper.getLocalDate(scope.node.createDate, currentUser.locale, 'LLL');
scope.node.updateDateFormatted = dateHelper.getLocalDate(scope.node.updateDate, currentUser.locale, 'LLL');
});
}
scope.openMediaType = function (mediaType) {
@@ -22,6 +30,20 @@
var url = "/settings/mediaTypes/edit/" + mediaType.id;
$location.path(url);
};
// watch for content updates - reload content when node is saved, published etc.
scope.$watch('node.updateDate', function(newValue, oldValue){
if(!newValue) { return; }
if(newValue === oldValue) { return; }
formatDatesToLocal();
});
//ensure to unregister from all events!
scope.$on('$destroy', function () {
for (var e in evts) {
eventsService.unsubscribe(evts[e]);
}
});
onInit();
@@ -9,9 +9,14 @@ function noDirtyCheck() {
restrict: 'A',
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
elm.focus(function () {
ctrl.$pristine = false;
scope.$watch(function() {
ctrl.$pristine = false;
});
});
}
};
}
@@ -17,6 +17,7 @@
* Registers all tours from the server and returns a promise
*/
function registerAllTours() {
tours = [];
return tourResource.getTours().then(function(tourFiles) {
angular.forEach(tourFiles, function (tourFile) {
angular.forEach(tourFile.tours, function(newTour) {
@@ -29,80 +30,6 @@
});
}
/**
* @ngdoc method
* @name umbraco.services.tourService#registerTour
* @methodOf umbraco.services.tourService
*
* @description
* Registers a tour in the service
* @param {Object} tour The tour you want to register in the service
* @param {String} tour.name The tour name
* @param {String} tour.alias The tour alias
* @param {Array} tour.steps Array of tour steps
* @param {String} tour.step.title Step title
* @param {DomElement} tour.step.content Step content (pass in any HTML markup)
* @param {DomElement} tour.step.element Highlight a DOM-element
* @param {Boolean} tour.step.elementPreventClick Adds invisible layer on top of highligted element to prevent all clicks and interaction with it
* @param {Number} tour.step.backdropOpacity Sets the backdrop opacity (default 0.4)
*/
function registerTour(newTour) {
validateTour(newTour);
validateTourRegistration(newTour);
tours.push(newTour);
eventsService.emit("appState.tour.updatedTours", tours);
}
/**
* @ngdoc method
* @name umbraco.services.tourService#registerTours
* @methodOf umbraco.services.tourService
*
* @description
* Registers an array of tours in the service
* @param {Array} tours The tours to register in the service
*/
function registerTours(newTours) {
angular.forEach(newTours, function(newTour){
validateTour(newTour);
validateTourRegistration(newTour);
tours.push(newTour);
});
eventsService.emit("appState.tour.updatedTours", tours);
}
/**
* @ngdoc method
* @name umbraco.services.tourService#unregisterTour
* @methodOf umbraco.services.tourService
*
* @description
* Unregisters a tour in the service
* @param {String} tourAlias The tour alias of the tour you want to unregister
*/
function unregisterTour(tourAlias) {
tours = tours.filter(function( obj ) {
return obj.alias !== tourAlias;
});
eventsService.emit("appState.tour.updatedTours", tours);
}
/**
* @ngdoc method
* @name umbraco.services.tourService#unregisterTourGroup
* @methodOf umbraco.services.tourService
*
* @description
* Unregisters a tour in the service
* @param {String} tourGroupName The name of the tour group you want to unregister
*/
function unregisterTourGroup(tourGroup) {
tours = tours.filter(function( obj ) {
return obj.group !== tourGroup;
});
eventsService.emit("appState.tour.updatedTours", tours);
}
/**
* Method to return all of the tours as a new instance
*/
@@ -117,8 +44,8 @@
*
* @description
* Raises an event to start a tour
* @param {Object} tour The tour which should be started
*/
* @param {Object} tour The tour which should be started
*/
function startTour(tour) {
validateTour(tour);
eventsService.emit("appState.tour.start", tour);
@@ -132,7 +59,7 @@
*
* @description
* Raises an event to end the current tour
*/
*/
function endTour(tour) {
eventsService.emit("appState.tour.end", tour);
currentTour = null;
@@ -163,7 +90,7 @@
* @description
* Completes a tour for the user, raises an event and returns a promise
* @param {Object} tour The tour which should be completed
*/
*/
function completeTour(tour) {
var deferred = $q.defer();
tour.completed = true;
@@ -185,26 +112,12 @@
* @description
* Returns the current tour
* @returns {Object} Returns the current tour
*/
*/
function getCurrentTour() {
//TODO: This should be reset if a new user logs in
return currentTour;
}
/**
* @ngdoc method
* @name umbraco.services.tourService#getAllTours
* @methodOf umbraco.services.tourService
*
* @description
* Returns a promise of all tours with the current user statuses
* @returns {Array} All registered tours
*/
function getAllTours() {
var tours = getTours();
return setTourStatuses(tours);
}
/**
* @ngdoc method
* @name umbraco.services.tourService#getGroupedTours
@@ -213,12 +126,43 @@
* @description
* Returns a promise of grouped tours with the current user statuses
* @returns {Array} All registered tours grouped by tour group
*/
*/
function getGroupedTours() {
var deferred = $q.defer();
var tours = getTours();
setTourStatuses(tours).then(function() {
var groupedTours = _.groupBy(tours, "group");
var groupedTours = [];
tours.forEach(function (item) {
var groupExists = false;
var newGroup = {
"group": "",
"tours": []
};
groupedTours.forEach(function(group){
// extend existing group if it is already added
if(group.group === item.group) {
if(item.groupOrder) {
group.groupOrder = item.groupOrder
}
groupExists = true;
group.tours.push(item)
}
});
// push new group to array if it doesn't exist
if(!groupExists) {
newGroup.group = item.group;
if(item.groupOrder) {
newGroup.groupOrder = item.groupOrder
}
newGroup.tours.push(item);
groupedTours.push(newGroup);
}
});
deferred.resolve(groupedTours);
});
return deferred.promise;
@@ -233,7 +177,7 @@
* Returns a promise of the tour found by alias with the current user statuses
* @param {Object} tourAlias The tour alias of the tour which should be returned
* @returns {Object} Tour object
*/
*/
function getTourByAlias(tourAlias) {
var deferred = $q.defer();
var tours = getTours();
@@ -244,38 +188,6 @@
return deferred.promise;
}
/**
* @ngdoc method
* @name umbraco.services.tourService#getCompletedTours
* @methodOf umbraco.services.tourService
*
* @description
* Returns a promise of completed tours for the user
* @returns {Array} Array of completed tour aliases
*/
function getCompletedTours() {
var deferred = $q.defer();
currentUserResource.getTours().then(function (storedTours) {
var completedTours = _.where(storedTours, { completed: true });
var aliases = _.pluck(completedTours, "alias");
deferred.resolve(aliases);
});
return deferred.promise;
}
/**
* Returns a promise of disabled tours for the user
*/
function getDisabledTours() {
var deferred = $q.defer();
currentUserResource.getTours().then(function (storedTours) {
var disabledTours = _.where(storedTours, { disabled: true });
var aliases = _.pluck(disabledTours, "alias");
deferred.resolve(aliases);
});
return deferred.promise;
}
///////////
/**
@@ -300,6 +212,9 @@
throw "Tour " + tour.alias + " is missing tour steps";
}
if (tour.requiredSections.length === 0) {
throw "Tour " + tour.alias + " is missing the required sections";
}
}
/**
@@ -346,59 +261,15 @@
return deferred.promise;
}
function saveInLocalStorage(tour) {
var storedTours = [];
var tourFound = false;
// check if something exists in local storage
if (localStorageService.get(localStorageKey)) {
storedTours = localStorageService.get(localStorageKey);
}
// update existing tour in localstorage if it's already there
if (storedTours.length > 0) {
angular.forEach(storedTours, function (storedTour) {
if (storedTour.alias === tour.alias) {
storedTour.completed = storedTour.completed ? storedTour.completed : tour.completed;
storedTour.disabled = storedTour.disabled ? storedTour.disabled : tour.disabled;
tourFound = true;
}
});
}
// create new entry in local storage
if (!tourFound) {
var storageObject = {
"alias": tour.alias,
"completed": tour.completed,
"disabled": tour.disabled
};
storedTours.push(storageObject);
}
localStorageService.set(localStorageKey, storedTours);
}
var service = {
registerAllTours: registerAllTours,
registerTour: registerTour,
registerTours: registerTours,
unregisterTour: unregisterTour,
unregisterTourGroup: unregisterTourGroup,
startTour: startTour,
endTour: endTour,
disableTour: disableTour,
completeTour: completeTour,
getCurrentTour: getCurrentTour,
//TODO: Not used
getAllTours: getAllTours,
getGroupedTours: getGroupedTours,
getTourByAlias: getTourByAlias,
//TODO: Not used
getCompletedTours: getCompletedTours,
//TODO: Not used
getDisabledTours: getDisabledTours,
getTourByAlias: getTourByAlias
};
return service;
File diff suppressed because it is too large Load Diff
@@ -14,7 +14,6 @@ function SearchController($scope, searchService, $log, $location, navigationServ
$scope.isSearching = false;
$scope.selectedResult = -1;
$scope.navigateResults = function (ev) {
//38: up 40: down, 13: enter
@@ -34,24 +33,37 @@ function SearchController($scope, searchService, $log, $location, navigationServ
}
};
var group = undefined;
var groupNames = [];
var groupIndex = -1;
var itemIndex = -1;
$scope.selectedItem = undefined;
$scope.clearSearch = function () {
$scope.searchTerm = null;
};
function iterateResults(up) {
//default group
if (!group) {
group = $scope.groups[0];
for (var g in $scope.groups) {
if ($scope.groups.hasOwnProperty(g)) {
groupNames.push(g);
}
}
//Sorting to match the groups order
groupNames.sort();
group = $scope.groups[groupNames[0]];
groupIndex = 0;
}
if (up) {
if (itemIndex === 0) {
if (groupIndex === 0) {
gotoGroup($scope.groups.length - 1, true);
gotoGroup(Object.keys($scope.groups).length - 1, true);
} else {
gotoGroup(groupIndex - 1, true);
}
@@ -62,7 +74,7 @@ function SearchController($scope, searchService, $log, $location, navigationServ
if (itemIndex < group.results.length - 1) {
gotoItem(itemIndex + 1);
} else {
if (groupIndex === $scope.groups.length - 1) {
if (groupIndex === Object.keys($scope.groups).length - 1) {
gotoGroup(0);
} else {
gotoGroup(groupIndex + 1);
@@ -73,7 +85,7 @@ function SearchController($scope, searchService, $log, $location, navigationServ
function gotoGroup(index, up) {
groupIndex = index;
group = $scope.groups[groupIndex];
group = $scope.groups[groupNames[groupIndex]];
if (up) {
gotoItem(group.results.length - 1);
@@ -95,6 +107,13 @@ function SearchController($scope, searchService, $log, $location, navigationServ
$scope.hasResults = false;
if ($scope.searchTerm) {
if (newVal !== null && newVal !== undefined && newVal !== oldVal) {
//Resetting for brand new search
group = undefined;
groupNames = [];
groupIndex = -1;
itemIndex = -1;
$scope.isSearching = true;
navigationService.showSearch();
$scope.selectedItem = undefined;
@@ -114,7 +133,7 @@ function SearchController($scope, searchService, $log, $location, navigationServ
var filtered = {};
_.each(result, function (value, key) {
if (value.results.length > 0) {
filtered[key] = value;
filtered[key] = value;
}
});
$scope.groups = filtered;
+10 -1
View File
@@ -20,8 +20,17 @@ app.run(['userService', '$log', '$rootScope', '$location', 'queryStrings', 'navi
assetsService._loadInitAssets().then(function() {
//Register all of the tours on the server
tourService.registerAllTours().then(function (dashboards) {
tourService.registerAllTours().then(function () {
appReady(data);
// Auto start intro tour
tourService.getTourByAlias("umbIntroIntroduction").then(function (introTour) {
// start intro tour if it hasn't been completed or disabled
if (introTour && introTour.disabled !== true && introTour.completed !== true) {
tourService.startTour(introTour);
}
});
}, function(){
appReady(data);
});
@@ -18,7 +18,7 @@
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls">
<input type="email" id="email" name="email" placeholder="you@example.com" required ng-model="installer.current.model.email" val-email />
<input type="email" id="email" name="email" placeholder="you@example.com" val-email required ng-model="installer.current.model.email" />
<small class="inline-help">Your email will be used as your login</small>
</div>
</div>
@@ -240,6 +240,7 @@
.umb-tree .umb-tree-node-checked i:before {
/*check box*/
content: "\e165" !important;
font-family: inherit;
}
a.umb-options {
@@ -1,7 +1,7 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.IconPickerController">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons">
<div class="form-search">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
style="width: 100%"
@@ -9,50 +9,49 @@
class="umb-search-field search-query input-block-level"
localize="placeholder"
placeholder="@placeholders_filter"
no-dirty-check>
no-dirty-check />
</div>
</div>
</div>
</div>
</div>
<div class="umb-panel-body with-footer">
<div class="umb-panel-body with-footer">
<div class="umb-control-group">
<select ng-model="color" class="input-block-level">
<option value=""><localize key="colors_black">Black</localize></option>
<option value="color-green"><localize key="colors_green">Green</localize></option>
<option value="color-yellow"><localize key="colors_yellow">Yellow</localize></option>
<option value="color-orange"><localize key="colors_orange">Orange</localize></option>
<option value="color-blue"><localize key="colors_blue">Blue</localize></option>
<option value="color-red"><localize key="colors_red">Red</localize></option>
</select>
<select ng-model="color" class="input-block-level">
<option value=""><localize key="colors_black">Black</localize></option>
<option value="color-green"><localize key="colors_green">Green</localize></option>
<option value="color-yellow"><localize key="colors_yellow">Yellow</localize></option>
<option value="color-orange"><localize key="colors_orange">Orange</localize></option>
<option value="color-blue"><localize key="colors_blue">Blue</localize></option>
<option value="color-red"><localize key="colors_red">Red</localize></option>
</select>
</div>
<umb-load-indicator ng-if="loading"></umb-load-indicator>
<div class="umb-control-group" ng-show="!loading">
<ul class="umb-iconpicker" ng-class="color" ng-show="icons">
<li class="umb-iconpicker-item" ng-repeat="icon in filtered = (icons | filter: searchTerm) track by $id(icon)">
<a href="#" title="{{icon}}" ng-click="submitClass(icon)" prevent-default>
<i class="{{icon}} large"></i>
</a>
</li>
</ul>
</div>
<ul class="umb-iconpicker" ng-class="color" ng-show="icons">
<li class="umb-iconpicker-item" ng-repeat="icon in filtered = (icons | filter: searchTerm) track by $id(icon)">
<a href="#" title="{{icon}}" ng-click="submitClass(icon)" prevent-default>
<i class="{{icon}} large"></i>
</a>
</li>
</ul>
</div>
<umb-empty-state
ng-if="filtered.length === 0"
position="center">
<localize key="defaultdialogs_noIconsFound">No icons were found.</localize>
</umb-empty-state>
</div>
<umb-empty-state ng-if="filtered.length === 0"
position="center">
<localize key="defaultdialogs_noIconsFound">No icons were found.</localize>
</umb-empty-state>
</div>
<div class="umb-panel-footer" >
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
</div>
</div>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
</div>
</div>
</div>
</div>
@@ -1,4 +1,4 @@
<form novalidate name="insertMacroForm" ng-submit="submitForm()" ng-controller="Umbraco.Dialogs.InsertMacroController" val-form-manager>
<form novalidate name="insertMacroForm" ng-controller="Umbraco.Dialogs.InsertMacroController" val-form-manager>
<div class="umb-panel">
<div class="umb-panel-footer">
@@ -6,8 +6,8 @@
<a href class="btn btn-link" ng-click="close()">
<localize key="cancel" />
</a>
<button type="submit" class="btn btn-primary">
<localize key="buttons_select"/>
<button type="button" ng-click="submitForm()" class="btn btn-primary">
<localize key="buttons_select" />
</button>
</div>
</div>
@@ -61,22 +61,23 @@
<div class="umb-panel umb-dialogs-mediapicker browser"
on-drag-leave="dragLeave()"
on-drag-end="dragLeave()"
on-drag-enter="dragEnter()"
ng-hide="target">
on-drag-leave="dragLeave()"
on-drag-end="dragLeave()"
on-drag-enter="dragEnter()"
ng-hide="target">
<div class="umb-panel-header">
<div class="umb-el-wrap umb-panel-buttons umb-mediapicker-upload">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
ng-model="searchTerm"
class="umb-search-field search-query"
localize="placeholder"
placeholder="@placeholders_filter">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
ng-model="searchTerm"
class="umb-search-field search-query"
localize="placeholder"
placeholder="@placeholders_filter"
no-dirty-check />
</div>
<div class="upload-button">
@@ -97,7 +98,7 @@
<li ng-repeat="item in path">
<a href ng-click="gotoFolder(item)" prevent-default>{{item.name}}</a> /
</li>
<li>
<a href ng-hide="showFolderInput" ng-click="showFolderInput = true">
<i class="icon icon-add small"></i>
@@ -114,28 +115,26 @@
</ul>
</div>
</div>
<div class="umb-panel-body with-footer">
<umb-file-dropzone
ng-if="acceptedMediatypes.length > 0"
accepted-mediatypes="acceptedMediatypes"
hide-dropzone="{{!activeDrag && images.length > 0}}"
parent-id="{{currentFolder.id}}"
files-uploaded="onUploadComplete"
files-queued="onFilesQueue">
<umb-file-dropzone ng-if="acceptedMediatypes.length > 0"
accepted-mediatypes="acceptedMediatypes"
hide-dropzone="{{!activeDrag && images.length > 0}}"
parent-id="{{currentFolder.id}}"
files-uploaded="onUploadComplete"
files-queued="onFilesQueue">
</umb-file-dropzone>
<umb-photo-folder
min-height="105"
min-width="150"
max-height="250"
ideal-items-per-row="3"
on-click="clickHandler"
ng-model="images"
images-only="{{onlyImages}}"
filter-by="searchTerm" />
<umb-photo-folder min-height="105"
min-width="150"
max-height="250"
ideal-items-per-row="3"
on-click="clickHandler"
ng-model="images"
images-only="{{onlyImages}}"
filter-by="searchTerm" />
</div>
@@ -1,7 +1,7 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.MemberGroupPickerController">
<div class="umb-panel-body with-footer no-header">
<div>
<umb-tree section="member"
treealias="memberGroups"
@@ -14,21 +14,21 @@
</div>
</div>
<div class="umb-panel-footer" >
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<a href ng-click="close()" class="btn btn-link">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary"
ng-click="submit(dialogData.selection)">
<localize key="buttons_select">Select</localize>
({{dialogData.selection.length}})
</button>
<button class="btn btn-primary"
ng-click="submit(dialogData.selection)">
<localize key="buttons_select">Select</localize>
({{dialogData.selection.length}})
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -124,7 +124,7 @@
function showTourButton(index, tourGroup) {
if(index !== 0) {
var prevTour = tourGroup[index - 1];
var prevTour = tourGroup.tours[index - 1];
if(prevTour.completed) {
return true;
}
@@ -147,12 +147,12 @@
// Finding out, how many tours are completed for the progress circle
angular.forEach(vm.tours, function(group){
var completedTours = 0;
angular.forEach(group, function(tour){
angular.forEach(group.tours, function(tour){
if(tour.completed) {
completedTours++;
}
});
group.completedPercentage = Math.round((completedTours/group.length)*100);
group.completedPercentage = Math.round((completedTours/group.tours.length)*100);
});
}
@@ -12,23 +12,23 @@
<h5 style="margin-bottom: 10px; margin-top: 0;">Tours</h5>
<div ng-repeat="(key,value) in vm.tours" style="margin-bottom: 5px;">
<div ng-repeat="tourGroup in vm.tours | orderBy:'groupOrder'" style="margin-bottom: 5px;">
<div class="umb-help-list">
<a href="" class="umb-help-list-item umb-help-list-item__content flex items-center justify-between" style="text-decoration: none;" ng-click="value.open = !value.open">
<h5 class="umb-help-list-item__group-title"><i style="margin-right: 2px;text-decoration: none;" ng-class="{'icon-navigation-right': !value.open, 'icon-navigation-down': value.open}"></i>
<span ng-if="key !== 'undefined'">{{key}}</span>
<span ng-if="key === 'undefined'">Other</span>
<a href="" class="umb-help-list-item umb-help-list-item__content flex items-center justify-between" style="text-decoration: none;" ng-click="tourGroup.open = !tourGroup.open">
<h5 class="umb-help-list-item__group-title"><i style="margin-right: 2px;text-decoration: none;" ng-class="{'icon-navigation-right': !tourGroup.open, 'icon-navigation-down': tourGroup.open}"></i>
<span ng-if="tourGroup.group !== 'undefined'">{{tourGroup.group}}</span>
<span ng-if="tourGroup.group === 'undefined'">Other</span>
</h5>
<umb-progress-circle
percentage="{{value.completedPercentage}}"
percentage="{{tourGroup.completedPercentage}}"
size="40">
</umb-progress-circle>
</a>
<div ng-if="value.open">
<div data-element="tour-{{tour.alias}}" class="umb-help-list-item" ng-repeat="tour in value">
<div ng-if="tourGroup.open">
<div data-element="tour-{{tour.alias}}" class="umb-help-list-item" ng-repeat="tour in tourGroup.tours">
<div class="umb-help-list-item__content justify-between">
<div class="flex items-center">
<div ng-if="!tour.completed" class="umb-number-badge umb-number-badge--xs umb-help-list-item__icon">{{ $index + 1 }}</div>
@@ -36,7 +36,7 @@
<span ng-class="{'strike': tour.completed}" class="umb-help-list-item__title">{{ tour.name }}</span>
</div>
<div>
<umb-button ng-if="!tour.completed && vm.showTourButton($index, value)" button-style="primary" size="xxs" type="button" label="Start" action="vm.startTour(tour)"></umb-button>
<umb-button ng-if="!tour.completed && vm.showTourButton($index, tourGroup)" button-style="primary" size="xxs" type="button" label="Start" action="vm.startTour(tour)"></umb-button>
<umb-button ng-if="tour.completed" size="xxs" type="button" label="Rerun" action="vm.startTour(tour)"></umb-button>
</div>
</div>
@@ -7,9 +7,10 @@
style="width: 100%"
ng-model="searchTerm"
class="umb-search-field search-query input-block-level"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus>
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus
no-dirty-check />
</div>
</div>
@@ -17,20 +18,17 @@
<localize key="contentTypeEditor_compositionsDescription"></localize>
</div>
<umb-empty-state
ng-if="model.availableCompositeContentTypes.length === 0 && model.totalContentTypes <= 1"
position="center">
<localize key="contentTypeEditor_noAvailableCompositions"></localize>
<umb-empty-state ng-if="model.availableCompositeContentTypes.length === 0 && model.totalContentTypes <= 1"
position="center">
<localize key="contentTypeEditor_noAvailableCompositions"></localize>
</umb-empty-state>
<umb-empty-state
ng-if="model.availableCompositeContentTypes.length === 0 && model.totalContentTypes > 1"
position="center">
<localize key="contentTypeEditor_compositionInUse"></localize>
<umb-empty-state ng-if="model.availableCompositeContentTypes.length === 0 && model.totalContentTypes > 1"
position="center">
<localize key="contentTypeEditor_compositionInUse"></localize>
</umb-empty-state>
<ul class="umb-checkbox-list">
<li class="umb-checkbox-list__item"
ng-repeat="compositeContentType in model.availableCompositeContentTypes | filter:searchTerm"
ng-class="{'-disabled': compositeContentType.allowed===false || compositeContentType.inherited, '-selected': vm.isSelected(compositeContentType.contentType.alias)}">
@@ -41,7 +39,7 @@
checklist-model="model.compositeContentTypes"
checklist-value="compositeContentType.contentType.alias"
ng-change="model.selectCompositeContentType(compositeContentType.contentType)"
ng-disabled="compositeContentType.allowed===false || compositeContentType.inherited"/>
ng-disabled="compositeContentType.allowed===false || compositeContentType.inherited" />
</div>
<label for="umb-overlay-comp-{{compositeContentType.contentType.key}}" class="umb-checkbox-list__item-text" ng-class="{'-faded': compositeContentType.allowed===false}">
@@ -1,120 +1,103 @@
<div class="umb-overlay-body" ng-controller="Umbraco.Overlays.EditorPickerOverlay as vm">
<!-- FILTER -->
<div class="umb-control-group -no-border">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
style="width: 100%"
ng-change="vm.filterItems()"
ng-model="vm.searchTerm"
class="umb-search-field search-query search-input input-block-level"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus>
</div>
</div>
<umb-load-indicator ng-if="vm.loading"></umb-load-indicator>
<!-- TABS -->
<div ng-if="vm.showTabs">
<umb-tabs-nav model="vm.tabs"></umb-tabs-nav>
<umb-tabs-content>
<umb-tab id="tab{{tab.id}}" ng-repeat="tab in vm.tabs" rel="{{tab.id}}">
<div ng-if="tab.alias==='Default'">
<div ng-repeat="(key,value) in tab.typesAndEditors">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="systemDataType in value | orderBy:'name'"
<!-- FILTER -->
<div class="umb-control-group -no-border">
<div class="form-search">
<i class="icon-search"></i>
<input type="text"
style="width: 100%"
ng-change="vm.filterItems()"
ng-model="vm.searchTerm"
class="umb-search-field search-query search-input input-block-level"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus
no-dirty-check />
</div>
</div>
<umb-load-indicator ng-if="vm.loading"></umb-load-indicator>
<!-- TABS -->
<div ng-if="vm.showTabs">
<umb-tabs-nav model="vm.tabs"></umb-tabs-nav>
<umb-tabs-content>
<umb-tab id="tab{{tab.id}}" ng-repeat="tab in vm.tabs" rel="{{tab.id}}">
<div ng-if="tab.alias==='Default'">
<div ng-repeat="(key,value) in tab.typesAndEditors">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="systemDataType in value | orderBy:'name'"
data-element="editor-{{systemDataType.name}}"
ng-mouseover="vm.showDetailsOverlay(systemDataType)"
ng-click="vm.pickEditor(systemDataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ systemDataType.name }}">
<i class="{{ systemDataType.icon }}" ng-class="{'icon-autofill': systemDataType.icon == null}"></i>
{{ systemDataType.name }}
</a>
</li>
</ul>
</div>
</div>
<div ng-if="tab.alias==='Reuse'">
<div ng-repeat="(key,value) in tab.userConfigured">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="dataType in value | orderBy:'name'"
ng-mouseover="vm.showDetailsOverlay(systemDataType)"
ng-click="vm.pickEditor(systemDataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ systemDataType.name }}">
<i class="{{ systemDataType.icon }}" ng-class="{'icon-autofill': systemDataType.icon == null}"></i>
{{ systemDataType.name }}
</a>
</li>
</ul>
</div>
</div>
<div ng-if="tab.alias==='Reuse'">
<div ng-repeat="(key,value) in tab.userConfigured">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="dataType in value | orderBy:'name'"
data-element="editor-{{dataType.name}}"
ng-mouseover="vm.showDetailsOverlay(dataType)"
ng-click="vm.pickDataType(dataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ dataType.name }}">
<i class="{{ dataType.icon }}" ng-class="{'icon-autofill': dataType.icon == null}"></i>
{{ dataType.name }}
</a>
</li>
</ul>
</div>
</div>
</umb-tab>
</umb-tabs-content>
</div>
<!-- FILTER RESULTS -->
<div ng-if="vm.showFilterResult">
<h5 class="-border-bottom -black"><localize key="contentTypeEditor_reuse"></localize></h5>
<div ng-repeat="(key,value) in vm.userConfigured">
<div ng-if="(value | filter:vm.searchTerm).length > 0">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="dataType in value | orderBy:'name' | filter: vm.searchTerm"
ng-mouseover="vm.showDetailsOverlay(dataType)"
ng-click="vm.pickDataType(dataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ dataType.name }}">
<i class="{{ dataType.icon }}" ng-class="{'icon-autofill': dataType.icon == null}"></i>
{{ dataType.name }}
</a>
</li>
</ul>
</div>
</div>
<h5 class="-border-bottom -black"><localize key="contentTypeEditor_availableEditors"></localize></h5>
<div ng-repeat="(key,value) in vm.typesAndEditors">
<div ng-if="(value | filter:vm.searchTerm).length > 0">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="systemDataType in value | orderBy:'name' | filter: vm.searchTerm"
ng-mouseover="vm.showDetailsOverlay(systemDataType)"
ng-click="vm.pickEditor(systemDataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ systemDataType.name }}">
<i class="{{ systemDataType.icon }}" ng-class="{'icon-autofill': systemDataType.icon == null}"></i>
{{ systemDataType.name }}
</a>
</li>
</ul>
</div>
</div>
</div>
<umb-overlay
ng-mouseover="vm.showDetailsOverlay(dataType)"
ng-click="vm.pickDataType(dataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ dataType.name }}">
<i class="{{ dataType.icon }}" ng-class="{'icon-autofill': dataType.icon == null}"></i>
{{ dataType.name }}
</a>
</li>
</ul>
</div>
</div>
</umb-tab>
</umb-tabs-content>
</div>
<!-- FILTER RESULTS -->
<div ng-if="vm.showFilterResult">
<h5 class="-border-bottom -black"><localize key="contentTypeEditor_reuse"></localize></h5>
<div ng-repeat="(key,value) in vm.userConfigured">
<div ng-if="(value | filter:vm.searchTerm).length > 0">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="dataType in value | orderBy:'name' | filter: vm.searchTerm"
ng-mouseover="vm.showDetailsOverlay(dataType)"
ng-click="vm.pickDataType(dataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ dataType.name }}">
<i class="{{ dataType.icon }}" ng-class="{'icon-autofill': dataType.icon == null}"></i>
{{ dataType.name }}
</a>
</li>
</ul>
</div>
</div>
<h5 class="-border-bottom -black"><localize key="contentTypeEditor_availableEditors"></localize></h5>
<div ng-repeat="(key,value) in vm.typesAndEditors">
<div ng-if="(value | filter:vm.searchTerm).length > 0">
<h5>{{key}}</h5>
<ul class="umb-card-grid" ng-mouseleave="vm.hideDetailsOverlay()">
<li ng-repeat="systemDataType in value | orderBy:'name' | filter: vm.searchTerm"
ng-mouseover="vm.showDetailsOverlay(systemDataType)"
ng-click="vm.pickEditor(systemDataType)"
class="-four-in-row">
<a class="umb-card-grid-item" href="" title="{{ systemDataType.name }}">
<i class="{{ systemDataType.icon }}" ng-class="{'icon-autofill': systemDataType.icon == null}"></i>
{{ systemDataType.name }}
</a>
</li>
</ul>
</div>
</div>
</div>
<umb-overlay ng-if="vm.editorSettingsOverlay.show"
data-element="overlay-editor-settings"
ng-if="vm.editorSettingsOverlay.show"
model="vm.editorSettingsOverlay"
position="right"
view="vm.editorSettingsOverlay.view">
</umb-overlay>
model="vm.editorSettingsOverlay"
position="right"
view="vm.editorSettingsOverlay.view">
</umb-overlay>
</div>
@@ -10,7 +10,7 @@
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus
no-dirty-check>
no-dirty-check />
</div>
</div>
@@ -1,25 +1,25 @@
<div ng-controller="Umbraco.Overlays.ItemPickerOverlay">
<div class="form-search" ng-hide="model.filter === false" style="margin-bottom: 15px;">
<i class="icon-search"></i>
<input type="text"
ng-model="searchTerm"
class="umb-search-field search-query input-block-level -full-width-input"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus />
<i class="icon-search"></i>
<input type="text"
ng-model="searchTerm"
class="umb-search-field search-query input-block-level -full-width-input"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus
no-dirty-check />
</div>
<ul class="umb-card-grid">
<li
ng-repeat="availableItem in model.availableItems | compareArrays:model.selectedItems:'alias' | orderBy:'name' | filter:searchTerm"
ng-click="selectItem(availableItem)"
class="-three-in-row">
<a class="umb-card-grid-item" href="" title="{{ availableItem.name }}">
<i class="{{ availableItem.icon }}"></i>
{{ availableItem.name }}
</a>
</li>
<li ng-repeat="availableItem in model.availableItems | compareArrays:model.selectedItems:'alias' | orderBy:'name' | filter:searchTerm"
ng-click="selectItem(availableItem)"
class="-three-in-row">
<a class="umb-card-grid-item" href="" title="{{ availableItem.name }}">
<i class="{{ availableItem.icon }}"></i>
{{ availableItem.name }}
</a>
</li>
</ul>
</div>
@@ -13,7 +13,8 @@
class="umb-search-field search-query input-block-level"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus />
umb-auto-focus
no-dirty-check />
</div>
<ul class="umb-card-grid">
@@ -27,9 +28,8 @@
</li>
</ul>
<umb-empty-state
ng-if="nomacros"
position="center">
<umb-empty-state ng-if="nomacros"
position="center">
<localize key="defaultdialogs_noMacros">
There are no macros available to insert
</localize>
@@ -52,9 +52,8 @@
</li>
</ul>
<umb-empty-state
ng-if="noMacroParams"
position="center">
<umb-empty-state ng-if="noMacroParams"
position="center">
<localize key="defaultdialogs_noMacroParams">There are no parameters for this macro</localize>
</umb-empty-state>
@@ -3,159 +3,147 @@
enctype="multipart/form-data"
umb-image-upload="options">
<div
on-drag-leave="dragLeave()"
on-drag-end="dragLeave()"
on-drag-enter="dragEnter()">
<div on-drag-leave="dragLeave()"
on-drag-end="dragLeave()"
on-drag-enter="dragEnter()">
<div class="umb-control-group umb-mediapicker-upload">
<div class="umb-control-group umb-mediapicker-upload">
<umb-load-indicator
ng-if="loading">
</umb-load-indicator>
<umb-load-indicator ng-if="loading">
</umb-load-indicator>
<div class="form-search">
<i class="icon-search"></i>
<input
class="umb-search-field search-query -full-width-input"
ng-model="searchOptions.filter"
localize="placeholder"
placeholder="@placeholders_search"
ng-change="changeSearch()"
type="text">
</div>
<div class="form-search">
<i class="icon-search"></i>
<input class="umb-search-field search-query -full-width-input"
ng-model="searchOptions.filter"
localize="placeholder"
placeholder="@placeholders_search"
ng-change="changeSearch()"
type="text"
no-dirty-check />
</div>
<div class="upload-button">
<umb-button
type="button"
label-key="general_upload"
action="upload()"
disabled="lockedFolder">
</umb-button>
</div>
<div class="upload-button">
<umb-button type="button"
label-key="general_upload"
action="upload()"
disabled="lockedFolder">
</umb-button>
</div>
</div>
</div>
<div class="row umb-control-group" ng-show="!searchOptions.filter">
<ul class="umb-breadcrumbs">
<li ng-hide="startNodeId != -1" class="umb-breadcrumbs__ancestor">
<a href ng-click="gotoFolder()" prevent-default>Media</a>
<span class="umb-breadcrumbs__seperator">&#47;</span>
</li>
<div class="row umb-control-group" ng-show="!searchOptions.filter">
<ul class="umb-breadcrumbs">
<li ng-hide="startNodeId != -1" class="umb-breadcrumbs__ancestor">
<a href ng-click="gotoFolder()" prevent-default>Media</a>
<span class="umb-breadcrumbs__seperator">&#47;</span>
</li>
<li ng-repeat="item in path" class="umb-breadcrumbs__ancestor">
<a href ng-click="gotoFolder(item)" prevent-default>{{item.name}}</a>
<span class="umb-breadcrumbs__seperator">&#47;</span>
</li>
<li ng-repeat="item in path" class="umb-breadcrumbs__ancestor">
<a href ng-click="gotoFolder(item)" prevent-default>{{item.name}}</a>
<span class="umb-breadcrumbs__seperator">&#47;</span>
</li>
<li class="umb-breadcrumbs__ancestor" ng-show="!lockedFolder">
<a href ng-hide="showFolderInput" ng-click="showFolderInput = true">
<i class="icon icon-add small"></i>
</a>
<li class="umb-breadcrumbs__ancestor" ng-show="!lockedFolder">
<a href ng-hide="showFolderInput" ng-click="showFolderInput = true">
<i class="icon icon-add small"></i>
</a>
<input
type="text"
class="umb-breadcrumbs__add-ancestor"
ng-show="showFolderInput"
ng-model="newFolderName"
ng-keydown="enterSubmitFolder($event)"
on-blur="submitFolder()"
focus-when="{{showFolderInput}}" />
</li>
</ul>
<div class="umb-loader" ng-if="creatingFolder"></div>
</div>
<input type="text"
class="umb-breadcrumbs__add-ancestor"
ng-show="showFolderInput"
ng-model="newFolderName"
ng-keydown="enterSubmitFolder($event)"
on-blur="submitFolder()"
focus-when="{{showFolderInput}}" />
</li>
</ul>
<div class="umb-loader" ng-if="creatingFolder"></div>
</div>
<umb-file-dropzone
ng-if="acceptedMediatypes.length > 0 && !loading && !lockedFolder"
accepted-mediatypes="acceptedMediatypes"
parent-id="{{currentFolder.id}}"
files-uploaded="onUploadComplete"
files-queued="onFilesQueue"
accept="{{acceptedFileTypes}}"
max-file-size="{{maxFileSize}}"
hide-dropzone="{{!activeDrag && images.length > 0 || searchOptions.filter }}"
compact="{{ images.length > 0 }}">
</umb-file-dropzone>
<umb-file-dropzone ng-if="acceptedMediatypes.length > 0 && !loading && !lockedFolder"
accepted-mediatypes="acceptedMediatypes"
parent-id="{{currentFolder.id}}"
files-uploaded="onUploadComplete"
files-queued="onFilesQueue"
accept="{{acceptedFileTypes}}"
max-file-size="{{maxFileSize}}"
hide-dropzone="{{!activeDrag && images.length > 0 || searchOptions.filter }}"
compact="{{ images.length > 0 }}">
</umb-file-dropzone>
<umb-media-grid
ng-if="!loading"
items="images"
on-click="clickHandler"
on-click-name="clickItemName"
item-max-width="150"
item-max-height="150"
item-min-width="100"
item-min-height="100"
only-images={{onlyImages}}>
</umb-media-grid>
<umb-media-grid ng-if="!loading"
items="images"
on-click="clickHandler"
on-click-name="clickItemName"
item-max-width="150"
item-max-height="150"
item-min-width="100"
item-min-height="100"
only-images={{onlyImages}}>
</umb-media-grid>
<div class="flex justify-center">
<umb-pagination
ng-if="searchOptions.totalPages > 0 && !loading"
page-number="searchOptions.pageNumber"
total-pages="searchOptions.totalPages"
on-change="changePagination(pageNumber)">
<umb-pagination ng-if="searchOptions.totalPages > 0 && !loading"
page-number="searchOptions.pageNumber"
total-pages="searchOptions.totalPages"
on-change="changePagination(pageNumber)">
</umb-pagination>
</div>
<umb-empty-state
ng-if="searchOptions.filter && images.length === 0 && !loading"
position="center">
<umb-empty-state ng-if="searchOptions.filter && images.length === 0 && !loading"
position="center">
<localize key="general_searchNoResult"></localize>
</umb-empty-state>
</div>
</div>
<umb-overlay
ng-if="mediaPickerDetailsOverlay.show"
model="mediaPickerDetailsOverlay"
position="right">
<umb-overlay ng-if="mediaPickerDetailsOverlay.show"
model="mediaPickerDetailsOverlay"
position="right">
<div class="umb-control-group">
<div class="umb-control-group">
<div ng-if="target.url">
<umb-image-gravity
src="target.url"
center="target.focalPoint">
</umb-image-gravity>
</div>
<div ng-if="target.url">
<umb-image-gravity src="target.url"
center="target.focalPoint">
</umb-image-gravity>
</div>
<div ng-if="cropSize">
<div ng-if="cropSize">
<h5>
<localize key="general_preview">Preview</localize>
</h5>
<h5>
<localize key="general_preview">Preview</localize>
</h5>
<umb-image-thumbnail
center="target.focalPoint"
src="target.url"
height="{{cropSize.height}}"
width="{{cropSize.width}}"
max-size="400">
</umb-image-thumbnail>
<umb-image-thumbnail center="target.focalPoint"
src="target.url"
height="{{cropSize.height}}"
width="{{cropSize.width}}"
max-size="400">
</umb-image-thumbnail>
</div>
</div>
</div>
</div>
<div class="umb-control-group">
<label><localize key="@general_url"></localize></label>
<input
type="text"
localize="placeholder"
placeholder="@general_url"
class="umb-editor umb-textstring"
ng-model="target.url"
ng-disabled="target.id" />
</div>
<div class="umb-control-group">
<label><localize key="@general_url"></localize></label>
<input type="text"
localize="placeholder"
placeholder="@general_url"
class="umb-editor umb-textstring"
ng-model="target.url"
ng-disabled="target.id" />
</div>
<div class="umb-control-group">
<label><localize key="@content_altTextOptional"></localize></label>
<input type="text" class="umb-editor umb-textstring" ng-model="target.altText" />
</div>
<div class="umb-control-group">
<label><localize key="@content_altTextOptional"></localize></label>
<input type="text" class="umb-editor umb-textstring" ng-model="target.altText" />
</div>
</umb-overlay>
</umb-overlay>
</form>
@@ -1,7 +1,6 @@
<div ng-controller="Umbraco.Overlays.UserGroupPickerController as vm">
<umb-load-indicator
ng-if="vm.loading">
<umb-load-indicator ng-if="vm.loading">
</umb-load-indicator>
<div ng-if="!vm.loading">
@@ -9,17 +8,18 @@
<div class="form-search" style="margin-bottom: 15px;">
<i class="icon-search"></i>
<input type="text"
ng-model="searchTerm"
class="umb-search-field search-query input-block-level -full-width-input"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus />
ng-model="searchTerm"
class="umb-search-field search-query input-block-level -full-width-input"
localize="placeholder"
placeholder="@placeholders_filter"
umb-auto-focus
no-dirty-check />
</div>
<div class="umb-user-group-picker-list">
<a href="" class="umb-user-group-picker-list-item" ng-repeat="userGroup in vm.userGroups | filter:searchTerm" ng-click="vm.selectUserGroup(userGroup)">
<div class="umb-user-group-picker-list-item__icon">
<i ng-if="!userGroup.selected" class="{{userGroup.icon}}"></i>
<umb-checkmark ng-if="userGroup.selected" checked="userGroup.selected" size="xs"></umb-checkmark>
@@ -42,7 +42,7 @@
<span ng-if="userGroup.contentStartNode">{{ userGroup.contentStartNode.name }}</span>
</span>
</div>
<div class="umb-user-group-picker-list-item__permission">
<span>
<span class="bold"><localize key="user_mediastartnode">Media start node</localize>:</span>
@@ -55,9 +55,8 @@
</div>
<umb-empty-state
ng-if="vm.userGroups.length === 0"
position="center">
<umb-empty-state ng-if="vm.userGroups.length === 0"
position="center">
No user groups have been added
</umb-empty-state>

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