Compare commits

...

145 Commits

Author SHA1 Message Date
Claus 78735ff349 Merge pull request #5798 from kjac/v8-fix-save-member
V8: Can't save members without resetting their password
2019-07-08 09:29:37 +02:00
Kenn Jacobsen 1af43498d9 Make it possible to save a member without resetting the password 2019-07-07 11:16:02 +02:00
Shannon 015ad64e30 Updates the exception thrown during upgrade to provide some meaningful feedback to the user. 2019-07-05 14:36:33 +10:00
Bjarke Berg 6dbb988903 Refactor to limit to only v7.14.0 - V7.15.* 2019-07-04 11:44:05 +02:00
Bjarke Berg 926acb910e Forces the initial migration state of V7 sites that are allowed to be migrated into v7.14 state. 2019-07-04 11:44:05 +02:00
Sebastiaan Janssen 57e3187e3a For some reason this file was not part of the project any more :-( 2019-07-03 22:10:01 +02:00
Bjarke Berg 988d51c4c8 Merge pull request #5767 from umbraco/v8/bugfix/5671-fix-for-different-version-number-in-modelbuilder-models-in-live-mode
V8: Bugfix for Modelsbuilder models with different versions error
2019-07-03 13:43:00 +02:00
Bjarke Berg 4733256ca1 Merge pull request #5772 from umbraco/v8/bugfix/fix-n1-issue
Fixes N+1 Issues caused by the new bypass start nodes changes
2019-07-03 13:15:55 +02:00
Bjarke Berg 4133a1fe76 Refactored the ModelBindingExceptionFilter to also handle InvalidCastException, and also ensure the models are the same type.
Otherwise a infinite loop was introduced, when requesting a wrong model in the view.
Also refactored the why we do the retry from Html to Http headers
2019-07-03 13:14:35 +02:00
Shannon 37bf6fe938 Automatically refresh the page if we encounter a ModelBindingException 2019-07-03 19:15:54 +10:00
Shannon Deminick 31716e574c Update src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs
good catch!

Co-Authored-By: Bjarke Berg <mail@bergmania.dk>
2019-07-03 18:34:11 +10:00
Shannon 126c4cbd46 ensures media is rebuild and adds more notes 2019-07-03 18:25:19 +10:00
Shannon 7cc91f71c2 Fixes pure live mode when changing doc types 2019-07-03 18:11:00 +10:00
Shannon 7c52b9602c Reduce some allocations and in advertent SQL calls along with inadvertent enumeration of the entire cache, adds some notes 2019-07-03 17:43:30 +10:00
Bjarke Berg c5f1cc15fd Refactored dataTypeId when a guid into dataTypeKey 2019-07-03 08:33:30 +02:00
Shannon d089518681 Fixes SQL generation to populate the nodedto object of the datatypedto 2019-07-03 15:40:18 +10:00
Shannon cd6ef35bf9 comments out the fix during investigation - adds some notes 2019-07-03 15:17:51 +10:00
Shannon 47cdc79fcb Merge branch 'v8/dev' into v8/bugfix/5671-fix-for-different-version-number-in-modelbuilder-models-in-live-mode 2019-07-03 13:50:38 +10:00
Shannon f7382255c2 Fixes N+1 Issues caused by the new bypass start nodes changes 2019-07-03 13:16:40 +10:00
Shannon Deminick 2167eada0c Merge pull request #5764 from umbraco/v8/bugfix/fixes-for-bypass-securtiy-after-merge
V8: Bugfixes regarding the Bypass Security feature after merge from v7
2019-07-03 11:27:55 +10:00
Shannon df11935598 Revert and adjusts "Fixes issue when creating DateTypes of type Umbraco.MultiNodeTreePicker with type member, because -1 can't be casted to Udi" 2019-07-03 11:23:25 +10:00
Shannon d3b4b9fe64 fix merge 2019-07-03 11:10:34 +10:00
Shannon 33aff7ff61 Merge branch 'v8/dev' into v8/bugfix/fixes-for-bypass-securtiy-after-merge
# Conflicts:
#	src/Umbraco.Web/Editors/EntityController.cs
2019-07-03 11:04:34 +10:00
Sebastiaan Janssen 4d2c551b79 Merge branch 'v7/dev' into v8/dev 2019-07-02 22:01:34 +02:00
Sebastiaan Janssen 5b7ae7150f Fix weird merge 2019-07-02 21:55:54 +02:00
Sebastiaan Janssen 5bf29a907a Fixes #5206 2019-07-02 21:47:14 +02:00
Bjarke Berg 96d5bdd7b2 https://github.com/umbraco/Umbraco-CMS/issues/5671 - If modelsbuilder is in live mode, we need to clear cache for all document types when at least one is cleared. This is due to modelsbuilder updating all the models to different versions. 2019-07-02 15:26:54 +02:00
Bjarke Berg 7b4023fd5a Fixes issue when creating DateTypes of type Umbraco.MultiNodeTreePicker with type member, because -1 can't be casted to Udi 2019-07-02 13:17:47 +02:00
Bjarke Berg af72729905 Merge remote-tracking branch 'origin/v8/dev' into v8/dev 2019-07-02 13:03:29 +02:00
Claus d5bc54cf6c refixing #4708 - old merge error. 2019-07-02 13:00:50 +02:00
Claus 5625102e2c making EditorValidatorOfT public instead of internal. 2019-07-02 12:42:18 +02:00
Bjarke Berg 66abd7b50c Merge remote-tracking branch 'origin/v8/dev' into v8/dev 2019-07-02 11:31:14 +02:00
Bjarke Berg 2a9bcf0e98 Merge pull request #5763 from umbraco/v7/bugfix/fix-for-null-ref-exception-when-using-member-pickers
V7: Bugfix for Null ref-exception when using member pickers.
2019-07-02 11:20:53 +02:00
Bjarke Berg e6484687e5 Small fixes after v7 to v8 merge regarding the bypass security feature 2019-07-02 11:17:23 +02:00
Shannon 5da1e64bbc Merge branch 'v8/dev' of https://github.com/umbraco/Umbraco-CMS into v8/dev 2019-07-02 19:15:20 +10:00
Shannon 7b0979f9fd Fixes install.ps1 and updates sln to remove old ps1 file 2019-07-02 19:15:04 +10:00
Dave Woestenborghs 1a437c1c6a #5750 - fix outside click directive so it doesn't close dialogues from create action 2019-07-02 11:11:03 +02:00
Bjarke Berg 3c0565e516 Bugfix: Null ref-exception when using member pickers. 2019-07-02 10:56:44 +02:00
Claus 178b1ccf40 Merge pull request #5743 from umbraco/v8/feature/sourcelink-update
V8: Adds in SourceLink Debugging Feature
2019-07-02 10:49:11 +02:00
Shannon Deminick c03cd81c23 Merge pull request #5748 from umbraco/v8/feature/mb-embed-prepare
Prepare MB future
2019-07-02 18:18:07 +10:00
Stephan 3d3647b476 Fix tests 2019-07-02 10:11:51 +02:00
Stephan a4cac670df Merge branch 'v8/dev' into v8/feature/mb-embed-prepare 2019-07-02 09:12:00 +02:00
Shannon c414dd06cc updates package lock 2019-07-02 15:38:17 +10:00
Shannon 4ed746e4ef Fixes tree refreshing when changing users, fixes memory/event leak 2019-07-02 13:37:40 +10:00
Shannon c270d8ecac Merge remote-tracking branch 'origin/v7/dev' into v8/dev
# Conflicts:
#	build/NuSpecs/tools/Web.config.install.xdt
#	src/Umbraco.Core/Constants-DataTypes.cs
#	src/Umbraco.Core/Models/DataTypeDefinition.cs
#	src/Umbraco.Core/Models/DataTypeExtensions.cs
#	src/Umbraco.Core/Models/IDataTypeDefinition.cs
#	src/Umbraco.Core/Models/UmbracoEntity.cs
#	src/Umbraco.Core/Models/UserExtensions.cs
#	src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs
#	src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs
#	src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs
#	src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs
#	src/Umbraco.Core/Services/ContentService.cs
#	src/Umbraco.Core/Services/DataTypeService.cs
#	src/Umbraco.Core/Services/DateTypeServiceExtensions.cs
#	src/Umbraco.Core/Services/EntityService.cs
#	src/Umbraco.Core/Services/IContentService.cs
#	src/Umbraco.Core/Services/IDataTypeService.cs
#	src/Umbraco.Core/Services/IEntityService.cs
#	src/Umbraco.Core/Services/IRelationService.cs
#	src/Umbraco.Core/Services/Implement/RelationService.cs
#	src/Umbraco.Tests/Models/UmbracoEntityTests.cs
#	src/Umbraco.Tests/Plugins/PluginManagerTests.cs
#	src/Umbraco.Tests/Services/EntityServiceTests.cs
#	src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js
#	src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js
#	src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js
#	src/Umbraco.Web.UI.Client/src/common/services/mediahelper.service.js
#	src/Umbraco.Web.UI.Client/src/common/services/search.service.js
#	src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/contentpicker/contentpicker.html
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.html
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.html
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/rte.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/multiurlpicker/multiurlpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.html
#	src/Umbraco.Web.UI/config/EmbeddedMedia.Release.config
#	src/Umbraco.Web.UI/config/EmbeddedMedia.config
#	src/Umbraco.Web.UI/packages.config
#	src/Umbraco.Web.UI/web.Template.config
#	src/Umbraco.Web/Editors/ContentController.cs
#	src/Umbraco.Web/Editors/EntityController.cs
#	src/Umbraco.Web/Editors/MediaController.cs
#	src/Umbraco.Web/HtmlHelperRenderExtensions.cs
#	src/Umbraco.Web/Models/ContentEditing/ContentPropertyBasic.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyDtoConverter.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyModelMapper.cs
#	src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs
#	src/Umbraco.Web/Mvc/RenderRouteHandler.cs
#	src/Umbraco.Web/PropertyEditors/ContentPicker2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/MediaPicker2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/MultiNodeTreePicker2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/RelatedLinks2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/RichTextPreValueEditor.cs
#	src/Umbraco.Web/Search/UmbracoTreeSearcher.cs
#	src/Umbraco.Web/Security/UmbracoAntiForgeryAdditionalDataProvider.cs
#	src/Umbraco.Web/Trees/ContentTreeController.cs
#	src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
#	src/Umbraco.Web/Trees/MediaTreeController.cs
#	src/Umbraco.Web/Trees/TreeControllerBase.cs
#	src/Umbraco.Web/Trees/TreeQueryStringParameters.cs
#	src/Umbraco.Web/UmbracoHelper.cs
#	src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs
#	src/Umbraco.Web/WebBootManager.cs
#	src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs
#	src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs
#	src/umbraco.cms/businesslogic/web/Access.cs
2019-07-02 12:24:05 +10:00
Shannon Deminick ade9bb7324 Merge pull request #5741 from umbraco/v8/merge/v715
Merging 7.15 - 8.1
2019-07-02 12:10:03 +10:00
Shannon 4134dd16df adds fixme note 2019-07-02 12:04:58 +10:00
Shannon f81588bb13 fixes search for content picker with ignore start nodes 2019-07-02 11:48:09 +10:00
Shannon 09793a1744 Fixes tests 2019-07-02 11:07:59 +10:00
Shannon ba7cd48b8f Merge remote-tracking branch 'origin/v8/dev' into v8/merge/v715
# Conflicts:
#	src/Umbraco.Core/Constants-DataTypes.cs
#	src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs
#	src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/linkpicker/linkpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js
2019-07-02 10:49:20 +10:00
Shannon 640d2cedb9 Gets the link and media pickers working in the grid in the rte with ignore start nodes 2019-07-01 21:48:45 +10:00
Shannon 0a6237af04 Gets the multi url picker working with ignore start nodes 2019-07-01 21:13:11 +10:00
Shannon 503183331f gets media picker with ignore start nodes working in rte 2019-07-01 20:59:41 +10:00
Warren Buckley 3effc66b2c Need to update NuSpec to ensure the PDB are getting coppied into the bin when Nuget pacakeg installed into a project 2019-07-01 11:53:22 +01:00
Warren Buckley b64f303537 Mark the release PDB as portable too - the Powershell build uses Release not Debug 2019-07-01 11:20:07 +01:00
Warren Buckley 760f6a1647 Umbraco.Web.UI revert change as no real CS code to F11 into this project 2019-07-01 10:54:29 +01:00
Warren Buckley 0b64e34f05 Add in SourceLink Nuget to Umbraco.ModelsBuilder csproj 2019-07-01 10:19:09 +01:00
Warren Buckley f01be09075 Update sourcelink & set from full to portable 2019-07-01 10:13:31 +01:00
Shannon 1c5ed58074 gets media picker working with ignore user start nodes 2019-07-01 18:54:39 +10:00
Shannon 42d86f147f gets content picker ignore start nodes working, fixes descriptions 2019-07-01 18:23:36 +10:00
Shannon fa4acb255b fixes missing 'var' 2019-07-01 17:09:11 +10:00
Shannon 1885767ef1 Internalizes the new Anchor logic and removes it from the IContentService interface into extensions. 2019-07-01 16:33:09 +10:00
Shannon 80e6880bb7 more manual merging - getting anchors back in tinymce 2019-07-01 16:22:54 +10:00
Adam Nelson fabacd1689 V8: Fixes case issue on metaData.hasChildren in mini list view as well as .toLowerCase() issue on undefined scope.entityTypeFilter.filter (#5744) 2019-07-01 07:48:57 +02:00
Warren Buckley 23a7654cea Merge branch 'v8/dev' into v8/feature/sourcelink-update 2019-06-28 12:37:20 +01:00
Sebastiaan Janssen b2d019bfe1 Merge pull request #5270 from umbraco/v8/bugfix/5268-audit-repository
Bugfix Audit service
2019-06-28 10:53:42 +02:00
Sebastiaan Janssen 9f817bf032 Merge pull request #5742 from umbraco/v8/fix/typeloader-static-fields
Typeloader change fields set by constructor to non static
2019-06-28 10:51:45 +02:00
Rasmus John Pedersen 01c89bd338 Make fields set by constructor non static 2019-06-28 10:11:20 +02:00
Kenn Jacobsen e5956e4955 V8: Don't cast IContent to Content in DocumentRepository (#4611) 2019-06-28 09:19:11 +02:00
Shannon 958c3b147b more manual merging 2019-06-28 15:42:23 +10:00
Shannon 4a33ca99ba More manual merging 2019-06-28 15:03:52 +10:00
Shannon 568835f7e2 manual merging/fixing, project builds now, but need to manually merge the remaining 2019-06-28 13:24:13 +10:00
Shannon 84aa861a5b Merge remote-tracking branch 'origin/v7/dev' into v8/dev - Iniital commit (broken)
# Conflicts:
#	build/NuSpecs/tools/Web.config.install.xdt
#	src/Umbraco.Core/Constants-DataTypes.cs
#	src/Umbraco.Core/Models/DataTypeDefinition.cs
#	src/Umbraco.Core/Models/DataTypeExtensions.cs
#	src/Umbraco.Core/Models/IDataTypeDefinition.cs
#	src/Umbraco.Core/Models/UmbracoEntity.cs
#	src/Umbraco.Core/Models/UserExtensions.cs
#	src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs
#	src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs
#	src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs
#	src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs
#	src/Umbraco.Core/Services/ContentService.cs
#	src/Umbraco.Core/Services/DataTypeService.cs
#	src/Umbraco.Core/Services/EntityService.cs
#	src/Umbraco.Core/Services/IContentService.cs
#	src/Umbraco.Core/Services/IDataTypeService.cs
#	src/Umbraco.Core/Services/IEntityService.cs
#	src/Umbraco.Core/Services/IRelationService.cs
#	src/Umbraco.Core/Services/Implement/RelationService.cs
#	src/Umbraco.Tests/Models/UmbracoEntityTests.cs
#	src/Umbraco.Tests/Plugins/PluginManagerTests.cs
#	src/Umbraco.Tests/Services/EntityServiceTests.cs
#	src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js
#	src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js
#	src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js
#	src/Umbraco.Web.UI.Client/src/common/services/mediahelper.service.js
#	src/Umbraco.Web.UI.Client/src/common/services/search.service.js
#	src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/contentpicker/contentpicker.html
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/linkpicker/linkpicker.html
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.html
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/rte.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/multiurlpicker/multiurlpicker.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.html
#	src/Umbraco.Web.UI/packages.config
#	src/Umbraco.Web.UI/web.Template.config
#	src/Umbraco.Web/Editors/ContentController.cs
#	src/Umbraco.Web/Editors/EntityController.cs
#	src/Umbraco.Web/Editors/MediaController.cs
#	src/Umbraco.Web/HtmlHelperRenderExtensions.cs
#	src/Umbraco.Web/Models/ContentEditing/ContentPropertyBasic.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyDtoConverter.cs
#	src/Umbraco.Web/Models/Mapping/ContentPropertyModelMapper.cs
#	src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs
#	src/Umbraco.Web/Mvc/RenderRouteHandler.cs
#	src/Umbraco.Web/PropertyEditors/ContentPicker2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/MediaPicker2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/MultiNodeTreePicker2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/RelatedLinks2PropertyEditor.cs
#	src/Umbraco.Web/PropertyEditors/RichTextPreValueEditor.cs
#	src/Umbraco.Web/Search/UmbracoTreeSearcher.cs
#	src/Umbraco.Web/Security/UmbracoAntiForgeryAdditionalDataProvider.cs
#	src/Umbraco.Web/Trees/ContentTreeController.cs
#	src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
#	src/Umbraco.Web/Trees/MediaTreeController.cs
#	src/Umbraco.Web/Trees/TreeControllerBase.cs
#	src/Umbraco.Web/Trees/TreeQueryStringParameters.cs
#	src/Umbraco.Web/UmbracoHelper.cs
#	src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs
#	src/Umbraco.Web/WebBootManager.cs
#	src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs
#	src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs
#	src/umbraco.cms/businesslogic/web/Access.cs
2019-06-28 13:03:36 +10:00
leekelleher ee2ebc7d14 ReadOnlyValueController - enabled filters
Previously the code checks if the `config` is an array,
but with how config options are set, this would typically
be an object (dictionary). So the previous code would
never allow a filter to be set.

Now the check is on the object property.
2019-06-27 22:43:14 +02:00
Kenn Jacobsen 9ce996cbba V8: Don't show multiple open menus (take two) (#5609) 2019-06-27 22:42:05 +02:00
leekelleher 580ba79619 Icon Constants consistency
Updated the `Constants.Icons` and replaced the hard-coded strings with
 the const references.
2019-06-27 22:35:29 +02:00
Lee Kelleher fbe184ef6e Prevent deletion of System DataTypes (#5623) 2019-06-27 22:33:19 +02:00
Kenn Jacobsen 2f7bf413ed V8: Make dialogs prompt to discard changes on outside click and ESC (#5740) 2019-06-27 22:27:42 +02:00
Andy Butland 390613c796 Fixed issue with node deletion not removing related records from the public access tables 2019-06-27 22:20:31 +02:00
BatJan b3e3475bf5 Make sure padding is not overwritten by other selectors 2019-06-27 22:19:27 +02:00
Bjarne Fyrstenborg 5333b23c23 v8: Add keyboard support to slider (#5651) 2019-06-27 22:17:31 +02:00
Patrick de Mooij 734086fcf5 temp-5612: Being able to add your own roles/startnodes etc 2019-06-27 22:05:50 +02:00
Morten Bock 12dff9bca3 Reduce size of LocalizedText output. Refactor localizationService to not expose internal dictionary. Refactor controllers to not access dictionary directly. 2019-06-27 21:59:33 +02:00
Kenn Jacobsen f370e738da V8: Use an overlay style dialog for deleting Nested Content ite… (#5357) 2019-06-27 21:34:19 +02:00
Marc Goodson a018ed9e52 V7: Less-Urgent-But-Still-Quite-Important - Add Giphy EmbeddedMedia support (#5736) 2019-06-27 14:27:33 +02:00
Marc Goodson 17f73b88dc Urgent: Add Giphy embed provider support (#5731) 2019-06-27 14:26:36 +02:00
Mike 405e9a79be V8: Make the content tree keyboard accessible (#5729) 2019-06-27 14:07:37 +02:00
Kenn Jacobsen 4d90322842 Fix broken on-outside-click 2019-06-27 13:58:43 +02:00
Kenn Jacobsen a8b5d69be0 Fix confirmation for permissions dialog 2019-06-27 13:56:50 +02:00
Kenn Jacobsen 5ebd90aba5 Make searched media pickable in linkpicker 2019-06-27 13:52:07 +02:00
Sebastiaan Janssen bec909c284 Merge branch 'v8/dev' of https://github.com/umbraco/Umbraco-CMS into v8/dev 2019-06-27 13:48:43 +02:00
Sebastiaan Janssen 46e0b08d65 Merge remote-tracking branch 'origin/v8/bugfix/fix-atroot' into v8/dev 2019-06-27 13:48:16 +02:00
Stephan 7a178be031 Fix getting content AtRoot 2019-06-27 13:29:35 +02:00
Kenn Jacobsen 9d14c9e0b7 Don't explicitly allow deleting the current editor's own content 2019-06-27 13:28:54 +02:00
Warren Buckley ef19633a90 Merge pull request #5134 from umbraco/v8/bugfix/image-cropper-converter
The ImageCropperPropertyValueEditor doesn't convert values in ConvertDbToString correctly
2019-06-27 12:20:43 +01:00
Sebastiaan Janssen 80ffd026f6 Reverts PR #5693 - we need to update the linkpicker search instead to return the correct results for us 2019-06-27 13:18:45 +02:00
Kenn Jacobsen cb7300688c Don't prompt for changes when cancelling empty properties 2019-06-27 12:53:58 +02:00
Kenn Jacobsen 040ebfe9dd Add auto-focus to the default action in overlay dialogs 2019-06-27 12:49:53 +02:00
Shannon fad33a97b2 don't throw JS exception when no MediaPath, instead warn. 2019-06-27 15:47:25 +10:00
Warren Buckley ac586c5207 Merge pull request #5715 from umbraco/v7/bugfix/AB-1085/antiforgery-per-form
Custom IAntiForgeryAdditionalDataProvider implementation
2019-06-26 09:23:32 +01:00
Bjarke Berg 8033931e31 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1085 - Fixed merge conflict 2019-06-26 09:58:01 +02:00
Bjarke Berg 8e29810598 Merge remote-tracking branch 'origin/v7/dev' into v7/bugfix/AB-1085/antiforgery-per-form 2019-06-26 09:52:44 +02:00
Shannon Deminick be96e2cf08 Merge pull request #5713 from umbraco/v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers
V7: Reintroduce the bypass security option in pickers
2019-06-26 17:02:17 +10:00
Shannon 534ee67ad2 Merge branch 'v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers' of https://github.com/umbraco/Umbraco-CMS into v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers 2019-06-26 16:49:00 +10:00
Shannon 571a3bc257 fixes test 2019-06-26 16:48:39 +10:00
Bjarke Berg e7a30d0a5d https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1085 - Fixes for gulp build 2019-06-26 07:39:34 +02:00
Shannon a55323176f Updates EntityController to support passing in the dataTypeId for the GetChildren methods and updates the mediapicker to pass along that data 2019-06-26 14:35:36 +10:00
Shannon 1b83e0a87d cleanup 2019-06-26 13:49:45 +10:00
Shannon ca15f340b0 Fixes a bunch of N+1, content/media trees should be much more snappy 2019-06-26 13:32:16 +10:00
Shannon 23b8e1cce8 Removes the remaining part of the EntityRepository that was loading in ALL properties for media which we don't want whatsoever which means some other code is cleaned up/removed 2019-06-26 13:31:04 +10:00
Shannon cf53ba363d Internalizes new methods classes + cleanup 2019-06-26 13:29:05 +10:00
Bjarke Berg 2f309a2fd6 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1085 - moved the code that adds the ufprt token to the context items, into the constructor of UmbracoForm. Because it needs to happen before the @Html.AntiForgeryToken() is called. The dispose method is too late. 2019-06-25 15:09:37 +02:00
Bjarke Berg 9f45d41a4a https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479
- Test fixes
2019-06-25 13:18:15 +02:00
Bjarke Berg 1994194656 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479
- Review fixes
2019-06-25 11:51:02 +02:00
Bjarke Berg 36559b8761 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Fix for NullReferenceException 2019-06-25 09:22:56 +02:00
Bjarke Berg 8fe7c5599a Merge remote-tracking branch 'origin/v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers' into v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers
# Conflicts:
#	src/Umbraco.Core/Services/ContentService.cs
2019-06-25 09:22:43 +02:00
Bjarke Berg 4dd325cec9 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Fix for NullReferenceException 2019-06-25 09:22:30 +02:00
Bjarke Berg d558646d75 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Fix for NullReferenceException 2019-06-25 09:21:51 +02:00
Bjarke Berg afac4bb918 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - missing entityResource injection 2019-06-25 09:18:30 +02:00
Bjarke Berg 0869bf27c7 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - clean up 2019-06-25 08:26:01 +02:00
Bjarke Berg 383a8617ce https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Fixed test 2019-06-25 08:19:50 +02:00
Bjarke Berg 3865f4fb50 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - bugfix - wrong constant used 2019-06-25 08:15:06 +02:00
Shannon 3e74bbfb45 Creates a custom IAntiForgeryAdditionalDataProvider that provides and validates custom token data in the request which allows having a custom AF token per form created with BeginUmbracoForm 2019-06-25 14:35:28 +10:00
Bjarke Berg 966b07ba1c https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Changed entity service to only return small model with media path. And updated media picker to use entity service when loading data. 2019-06-24 21:12:38 +02:00
Warren Buckley 60ed6f6b20 Remove snupkg aka newer Symbol nuget packages 2019-06-24 13:18:20 +01:00
Warren Buckley 903c163a57 Merge branch 'v8/bugfix/fix-js-tests-currentuser-auth' into v8/feature/sourcelink-update 2019-06-24 11:31:43 +01:00
Bjarke Berg d4311fe4ab https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Replaced client side method to get Auchors with a server side version, and eliminated the use of contentResource in linkPikers 2019-06-24 10:52:35 +02:00
Bjarke Berg eab597a2a8 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - fix for js linter 2019-06-24 08:58:25 +02:00
Warren Buckley 003ee1a991 Added in Microsoft.SourceLink.GitHub Nuget package 2019-06-23 19:57:43 +01:00
Warren Buckley 601d48277e Update NuSpecs with the XML MetaData for SourceLink 2019-06-23 19:53:57 +01:00
Sebastiaan Janssen 8d12170def Correct NuGet transform for the web.config file in the Views folder 2019-06-21 14:58:58 +02:00
Bjarke Berg d2655a9f2f Merge remote-tracking branch 'origin/v7/dev' into v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers 2019-06-21 13:59:11 +02:00
Bjarke Berg c4c2082fa9 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 - Only allow "ignoreUserStartNodes" for custom data types and not the default build in. 2019-06-21 13:57:17 +02:00
Sebastiaan Janssen 40d4a8fe6a Modelsbuilder is asking for too old a version of CodeAnalysis, Immutable and Metadata dependencies 2019-06-21 13:32:53 +02:00
Bjarke Berg 2898203cb9 https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1479 Bugfixes for the "Bypass security" feature + filter out possible sensitive data 2019-06-21 10:50:23 +02:00
Sebastiaan Janssen 5ebdfc7b1c Previously added a few too many binding redirects to the web.config 2019-06-21 10:22:16 +02:00
Bjarke Berg 31d7e58191 Merge remote-tracking branch 'origin/v7/dev' into v7/feature/AB-1479-Reintroduce-the-bypass-security-option-in-pickers 2019-06-21 10:20:51 +02:00
Sebastiaan Janssen ad4416f663 So apparently Microsoft.CodeAnalysis.CSharp version 1.3.2 contains the dll that has the version 1.3.1.. very confusing 2019-06-21 10:07:45 +02:00
Sebastiaan Janssen b55d2a8a41 Modelsbuilder is asking for too old a version of the CodeAnalysis dependency 2019-06-21 09:56:01 +02:00
Sebastiaan Janssen 17a4799b97 7.15 release needs a few more assembly redirects (#5698)
7.15 release needs a few more assembly redirects
2019-06-21 08:19:35 +02:00
Bjarke Berg 4df838c20c https://umbraco.visualstudio.com/D-Team%20Tracker/_workitems/edit/1358 - Changed the ignoreUserStartNodes in public endpoints to the data type id, and then look up the setting 2019-06-20 16:02:42 +02:00
Sebastiaan Janssen 4e44871671 The NuGet packages needs an extra DotNetCompilerPlatform transform to be sure it gets applied as it sometimes didn't
Added SignalR binding redirect for Umbraco Cloud
Added System.Web.Http.WebHost binding redirect for uCommerce
2019-06-20 15:57:31 +02:00
Bjarke Berg 1dd2c1cb91 Revert "Revert "U4 10147 - Bypass User Security option in pickers (#2441)""
This reverts commit 994c6eed
2019-06-19 14:30:44 +02:00
Stephan 6b23a8221d Bugfix Audit service 2019-04-15 16:34:01 +02:00
Shannon db867c66a3 The ImageCropperPropertyValueEditor doesn't convert values in ConvertDbToString correctly 2019-04-03 13:32:21 +11:00
193 changed files with 3317 additions and 2053 deletions
+3 -2
View File
@@ -14,6 +14,7 @@
<summary>Contains the core assemblies needed to run Umbraco Cms</summary>
<language>en-US</language>
<tags>umbraco</tags>
<repository type="git" url="https://github.com/umbraco/umbraco-cms" />
<dependencies>
<group targetFramework="net472">
@@ -44,7 +45,7 @@
<dependency id="Umbraco.SqlServerCE" version="[4.0.0.1,4.999999)" />
<dependency id="NPoco" version="[3.9.4,3.999999)" />
</group>
</dependencies>
</metadata>
<files>
@@ -55,6 +56,6 @@
<file src="$BuildTmp$\WebApp\bin\Umbraco.Core.xml" target="lib\net472\Umbraco.Core.xml" />
<!-- symbols -->
<file src="$BuildTmp$\bin\Umbraco.Core.pdb" target="lib" />
<file src="$BuildTmp$\bin\Umbraco.Core.pdb" target="lib\net472\Umbraco.Core.pdb" />
</files>
</package>
+4 -3
View File
@@ -14,6 +14,7 @@
<summary>Contains the core assemblies needed to run Umbraco Cms</summary>
<language>en-US</language>
<tags>umbraco</tags>
<repository type="git" url="https://github.com/umbraco/umbraco-cms" />
<dependencies>
<group targetFramework="net472">
@@ -43,7 +44,7 @@
<dependency id="System.Threading.Tasks.Dataflow" version="[4.9.0,4.999999)" />
</group>
</dependencies>
</metadata>
<files>
@@ -58,7 +59,7 @@
<file src="$BuildTmp$\WebApp\bin\Umbraco.Examine.xml" target="lib\net472\Umbraco.Examine.xml" />
<!-- symbols -->
<file src="$BuildTmp$\bin\Umbraco.Web.pdb" target="lib" />
<file src="$BuildTmp$\bin\Umbraco.Examine.pdb" target="lib" />
<file src="$BuildTmp$\bin\Umbraco.Web.pdb" target="lib\net472\Umbraco.Web.pdb" />
<file src="$BuildTmp$\bin\Umbraco.Examine.pdb" target="lib\net472\Umbraco.Examine.pdb" />
</files>
</package>
+1
View File
@@ -14,6 +14,7 @@
<summary>Installs Umbraco Cms in your Visual Studio ASP.NET project</summary>
<language>en-US</language>
<tags>umbraco</tags>
<repository type="git" url="https://github.com/umbraco/umbraco-cms" />
<dependencies>
<group targetFramework="net472">
@@ -8,7 +8,7 @@
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" xdt:Locator="Match(factoryType)" xdt:Transform="SetAttributes(factoryType)" />
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" xdt:Locator="Match(factoryType)" xdt:Transform="SetAttributes(factoryType)" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="Umbraco.Web.PublishedContentModels" xdt:Transform="InsertIfMissing" />
@@ -18,13 +18,13 @@
<system.web>
<pages
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
xdt:Locator="Match(pageParserFilterType,pageBaseType,userControlBaseType)"
xdt:Transform="SetAttributes(pageParserFilterType,pageBaseType,userControlBaseType)">
<controls>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" xdt:Locator="Match(namespace)" xdt:Transform="SetAttributes(assembly)" />
<add assembly="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" xdt:Locator="Match(namespace)" xdt:Transform="SetAttributes(assembly)" />
</controls>
</pages>
</system.web>
+21 -4
View File
@@ -18,9 +18,20 @@ if ($project) {
# Copy umbraco and umbraco_files from package to project folder
$umbracoFolder = Join-Path $projectPath "Umbraco"
New-Item -ItemType Directory -Force -Path $umbracoFolder
New-Item -ItemType Directory -Force -Path $umbracoFolder
$umbracoFolderSource = Join-Path $installPath "UmbracoFiles\Umbraco"
robocopy $umbracoFolderSource $umbracoFolder /is /it /e /xf UI.xml /LOG:$copyLogsPath\UmbracoCopy.log
Write-Host "copying files to $umbracoFolder ..."
# see https://support.microsoft.com/en-us/help/954404/return-codes-that-are-used-by-the-robocopy-utility-in-windows-server-2
robocopy $umbracoFolderSource $umbracoFolder /is /it /e
if (($lastexitcode -eq 1) -or ($lastexitcode -eq 3) -or ($lastexitcode -eq 5) -or ($lastexitcode -eq 7))
{
write-host "Copy succeeded!"
}
else
{
write-host "Copy failed with exit code:" $lastexitcode
}
$copyWebconfig = $true
$destinationWebConfig = Join-Path $projectPath "Web.config"
@@ -40,7 +51,11 @@ if ($project) {
}
}
}
Catch { }
Catch
{
Write-Host "An error occurred:"
Write-Host $_
}
}
if($copyWebconfig -eq $true)
@@ -74,7 +89,9 @@ if ($project) {
}
Catch
{
# Not a big problem if this fails, let it go
# Not a big problem if this fails, let it go
# Write-Host "An error occurred:"
# Write-Host $_
}
}
+10 -10
View File
@@ -15,7 +15,7 @@
[Parameter(Mandatory=$false)]
[Alias("doc")]
[switch] $docfx = $false,
# keep the build directories, don't clear them
[Parameter(Mandatory=$false)]
[Alias("c")]
@@ -392,13 +392,13 @@
&$this.BuildEnv.NuGet Pack "$nuspecs\UmbracoCms.Core.nuspec" `
-Properties BuildTmp="$($this.BuildTemp)" `
-Version "$($this.Version.Semver.ToString())" `
-Symbols -SymbolPackageFormat snupkg -Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cmscore.log"
-Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cmscore.log"
if (-not $?) { throw "Failed to pack NuGet UmbracoCms.Core." }
&$this.BuildEnv.NuGet Pack "$nuspecs\UmbracoCms.Web.nuspec" `
-Properties BuildTmp="$($this.BuildTemp)" `
-Version "$($this.Version.Semver.ToString())" `
-Symbols -SymbolPackageFormat snupkg -Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cmsweb.log"
-Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cmsweb.log"
if (-not $?) { throw "Failed to pack NuGet UmbracoCms.Web." }
&$this.BuildEnv.NuGet Pack "$nuspecs\UmbracoCms.nuspec" `
@@ -429,37 +429,37 @@
Write-Host "Prepare Azure Gallery"
$this.CopyFile("$($this.SolutionRoot)\build\Azure\azuregalleryrelease.ps1", $this.BuildOutput)
})
$ubuild.DefineMethod("PrepareCSharpDocs",
{
Write-Host "Prepare C# Documentation"
$src = "$($this.SolutionRoot)\src"
$tmp = $this.BuildTemp
$out = $this.BuildOutput
$DocFxJson = Join-Path -Path $src "\ApiDocs\docfx.json"
$DocFxSiteOutput = Join-Path -Path $tmp "\_site\*.*"
#restore nuget packages
$this.RestoreNuGet()
# run DocFx
$DocFx = $this.BuildEnv.DocFx
& $DocFx metadata $DocFxJson
& $DocFx build $DocFxJson
# zip it
& $this.BuildEnv.Zip a -tzip -r "$out\csharp-docs.zip" $DocFxSiteOutput
})
$ubuild.DefineMethod("PrepareAngularDocs",
{
Write-Host "Prepare Angular Documentation"
$src = "$($this.SolutionRoot)\src"
$out = $this.BuildOutput
$this.CompileBelle()
"Moving to Umbraco.Web.UI.Client folder"
+2 -2
View File
@@ -42,8 +42,8 @@ namespace Umbraco.Core.Composing
private string _currentAssembliesHash;
private IEnumerable<Assembly> _assemblies;
private bool _reportedChange;
private static string _localTempPath;
private static string _fileBasePath;
private readonly string _localTempPath;
private string _fileBasePath;
/// <summary>
/// Initializes a new instance of the <see cref="TypeLoader"/> class.
+350 -2
View File
@@ -1,27 +1,375 @@
namespace Umbraco.Core
using System;
namespace Umbraco.Core
{
public static partial class Constants
{
public static class DataTypes
{
public const int LabelString = -92;
//NOTE: unfortunately due to backwards compat we can't move/rename these, with the addition of the GUID
//constants, it would make more sense to have these suffixed with "ID" or in a Subclass called "INT", for
//now all we can do is make a subclass called Guids to put the GUID IDs.
public const int LabelString = System.DefaultLabelDataTypeId;
public const int LabelInt = -91;
public const int LabelBigint = -93;
public const int LabelDateTime = -94;
public const int LabelTime = -98;
public const int LabelDecimal = -99;
public const int Textarea = -89;
public const int Textbox = -88;
public const int RichtextEditor = -87;
public const int Boolean = -49;
public const int DateTime = -36;
public const int DropDownSingle = -39;
public const int DropDownMultiple = -42;
public const int Upload = -90;
public const int DefaultContentListView = -95;
public const int DefaultMediaListView = -96;
public const int DefaultMembersListView = -97;
public const int ImageCropper = 1043;
public const int Tags = 1041;
public static class ReservedPreValueKeys
{
public const string IgnoreUserStartNodes = "ignoreUserStartNodes";
}
/// <summary>
/// Defines the identifiers for Umbraco data types as constants for easy centralized access/management.
/// </summary>
public static class Guids
{
/// <summary>
/// Guid for Content Picker as string
/// </summary>
public const string ContentPicker = "FD1E0DA5-5606-4862-B679-5D0CF3A52A59";
/// <summary>
/// Guid for Content Picker
/// </summary>
public static readonly Guid ContentPickerGuid = new Guid(ContentPicker);
/// <summary>
/// Guid for Member Picker as string
/// </summary>
public const string MemberPicker = "1EA2E01F-EBD8-4CE1-8D71-6B1149E63548";
/// <summary>
/// Guid for Member Picker
/// </summary>
public static readonly Guid MemberPickerGuid = new Guid(MemberPicker);
/// <summary>
/// Guid for Media Picker as string
/// </summary>
public const string MediaPicker = "135D60E0-64D9-49ED-AB08-893C9BA44AE5";
/// <summary>
/// Guid for Media Picker
/// </summary>
public static readonly Guid MediaPickerGuid = new Guid(MediaPicker);
/// <summary>
/// Guid for Multiple Media Picker as string
/// </summary>
public const string MultipleMediaPicker = "9DBBCBBB-2327-434A-B355-AF1B84E5010A";
/// <summary>
/// Guid for Multiple Media Picker
/// </summary>
public static readonly Guid MultipleMediaPickerGuid = new Guid(MultipleMediaPicker);
/// <summary>
/// Guid for Related Links as string
/// </summary>
public const string RelatedLinks = "B4E3535A-1753-47E2-8568-602CF8CFEE6F";
/// <summary>
/// Guid for Related Links
/// </summary>
public static readonly Guid RelatedLinksGuid = new Guid(RelatedLinks);
/// <summary>
/// Guid for Member as string
/// </summary>
public const string Member = "d59be02f-1df9-4228-aa1e-01917d806cda";
/// <summary>
/// Guid for Member
/// </summary>
public static readonly Guid MemberGuid = new Guid(Member);
/// <summary>
/// Guid for Image Cropper as string
/// </summary>
public const string ImageCropper = "1df9f033-e6d4-451f-b8d2-e0cbc50a836f";
/// <summary>
/// Guid for Image Cropper
/// </summary>
public static readonly Guid ImageCropperGuid = new Guid(ImageCropper);
/// <summary>
/// Guid for Tags as string
/// </summary>
public const string Tags = "b6b73142-b9c1-4bf8-a16d-e1c23320b549";
/// <summary>
/// Guid for Tags
/// </summary>
public static readonly Guid TagsGuid = new Guid(Tags);
/// <summary>
/// Guid for List View - Content as string
/// </summary>
public const string ListViewContent = "C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4";
/// <summary>
/// Guid for List View - Content
/// </summary>
public static readonly Guid ListViewContentGuid = new Guid(ListViewContent);
/// <summary>
/// Guid for List View - Media as string
/// </summary>
public const string ListViewMedia = "3A0156C4-3B8C-4803-BDC1-6871FAA83FFF";
/// <summary>
/// Guid for List View - Media
/// </summary>
public static readonly Guid ListViewMediaGuid = new Guid(ListViewMedia);
/// <summary>
/// Guid for List View - Members as string
/// </summary>
public const string ListViewMembers = "AA2C52A0-CE87-4E65-A47C-7DF09358585D";
/// <summary>
/// Guid for List View - Members
/// </summary>
public static readonly Guid ListViewMembersGuid = new Guid(ListViewMembers);
/// <summary>
/// Guid for Date Picker with time as string
/// </summary>
public const string DatePickerWithTime = "e4d66c0f-b935-4200-81f0-025f7256b89a";
/// <summary>
/// Guid for Date Picker with time
/// </summary>
public static readonly Guid DatePickerWithTimeGuid = new Guid(DatePickerWithTime);
/// <summary>
/// Guid for Approved Color as string
/// </summary>
public const string ApprovedColor = "0225af17-b302-49cb-9176-b9f35cab9c17";
/// <summary>
/// Guid for Approved Color
/// </summary>
public static readonly Guid ApprovedColorGuid = new Guid(ApprovedColor);
/// <summary>
/// Guid for Dropdown multiple as string
/// </summary>
public const string DropdownMultiple = "f38f0ac7-1d27-439c-9f3f-089cd8825a53";
/// <summary>
/// Guid for Dropdown multiple
/// </summary>
public static readonly Guid DropdownMultipleGuid = new Guid(DropdownMultiple);
/// <summary>
/// Guid for Radiobox as string
/// </summary>
public const string Radiobox = "bb5f57c9-ce2b-4bb9-b697-4caca783a805";
/// <summary>
/// Guid for Radiobox
/// </summary>
public static readonly Guid RadioboxGuid = new Guid(Radiobox);
/// <summary>
/// Guid for Date Picker as string
/// </summary>
public const string DatePicker = "5046194e-4237-453c-a547-15db3a07c4e1";
/// <summary>
/// Guid for Date Picker
/// </summary>
public static readonly Guid DatePickerGuid = new Guid(DatePicker);
/// <summary>
/// Guid for Dropdown as string
/// </summary>
public const string Dropdown = "0b6a45e7-44ba-430d-9da5-4e46060b9e03";
/// <summary>
/// Guid for Dropdown
/// </summary>
public static readonly Guid DropdownGuid = new Guid(Dropdown);
/// <summary>
/// Guid for Checkbox list as string
/// </summary>
public const string CheckboxList = "fbaf13a8-4036-41f2-93a3-974f678c312a";
/// <summary>
/// Guid for Checkbox list
/// </summary>
public static readonly Guid CheckboxListGuid = new Guid(CheckboxList);
/// <summary>
/// Guid for Checkbox as string
/// </summary>
public const string Checkbox = "92897bc6-a5f3-4ffe-ae27-f2e7e33dda49";
/// <summary>
/// Guid for Checkbox
/// </summary>
public static readonly Guid CheckboxGuid = new Guid(Checkbox);
/// <summary>
/// Guid for Numeric as string
/// </summary>
public const string Numeric = "2e6d3631-066e-44b8-aec4-96f09099b2b5";
/// <summary>
/// Guid for Dropdown
/// </summary>
public static readonly Guid NumericGuid = new Guid(Numeric);
/// <summary>
/// Guid for Richtext editor as string
/// </summary>
public const string RichtextEditor = "ca90c950-0aff-4e72-b976-a30b1ac57dad";
/// <summary>
/// Guid for Richtext editor
/// </summary>
public static readonly Guid RichtextEditorGuid = new Guid(RichtextEditor);
/// <summary>
/// Guid for Textstring as string
/// </summary>
public const string Textstring = "0cc0eba1-9960-42c9-bf9b-60e150b429ae";
/// <summary>
/// Guid for Textstring
/// </summary>
public static readonly Guid TextstringGuid = new Guid(Textstring);
/// <summary>
/// Guid for Textarea as string
/// </summary>
public const string Textarea = "c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3";
/// <summary>
/// Guid for Dropdown
/// </summary>
public static readonly Guid TextareaGuid = new Guid(Textarea);
/// <summary>
/// Guid for Upload as string
/// </summary>
public const string Upload = "84c6b441-31df-4ffe-b67e-67d5bc3ae65a";
/// <summary>
/// Guid for Upload
/// </summary>
public static readonly Guid UploadGuid = new Guid(Upload);
/// <summary>
/// Guid for Label as string
/// </summary>
public const string LabelString = "f0bc4bfb-b499-40d6-ba86-058885a5178c";
/// <summary>
/// Guid for Label string
/// </summary>
public static readonly Guid LabelStringGuid = new Guid(LabelString);
/// <summary>
/// Guid for Label as int
/// </summary>
public const string LabelInt = "8e7f995c-bd81-4627-9932-c40e568ec788";
/// <summary>
/// Guid for Label int
/// </summary>
public static readonly Guid LabelIntGuid = new Guid(LabelInt);
/// <summary>
/// Guid for Label as big int
/// </summary>
public const string LabelBigInt = "930861bf-e262-4ead-a704-f99453565708";
/// <summary>
/// Guid for Label big int
/// </summary>
public static readonly Guid LabelBigIntGuid = new Guid(LabelBigInt);
/// <summary>
/// Guid for Label as date time
/// </summary>
public const string LabelDateTime = "0e9794eb-f9b5-4f20-a788-93acd233a7e4";
/// <summary>
/// Guid for Label date time
/// </summary>
public static readonly Guid LabelDateTimeGuid = new Guid(LabelDateTime);
/// <summary>
/// Guid for Label as time
/// </summary>
public const string LabelTime = "a97cec69-9b71-4c30-8b12-ec398860d7e8";
/// <summary>
/// Guid for Label time
/// </summary>
public static readonly Guid LabelTimeGuid = new Guid(LabelTime);
/// <summary>
/// Guid for Label as decimal
/// </summary>
public const string LabelDecimal = "8f1ef1e1-9de4-40d3-a072-6673f631ca64";
/// <summary>
/// Guid for Label decimal
/// </summary>
public static readonly Guid LabelDecimalGuid = new Guid(LabelDecimal);
}
}
}
}
+56 -6
View File
@@ -5,39 +5,89 @@
public static class Icons
{
/// <summary>
/// System contenttype icon
/// System default icon
/// </summary>
public const string ContentType = "icon-arrangement";
public const string DefaultIcon = Content;
/// <summary>
/// System datatype icon
/// System content icon
/// </summary>
public const string Content = "icon-document";
/// <summary>
/// System content type icon
/// </summary>
public const string ContentType = "icon-item-arrangement";
/// <summary>
/// System data type icon
/// </summary>
public const string DataType = "icon-autofill";
/// <summary>
/// System property editor icon
/// System list view icon
/// </summary>
public const string PropertyEditor = "icon-autofill";
public const string ListView = "icon-thumbnail-list";
/// <summary>
/// System macro icon
/// </summary>
public const string Macro = "icon-settings-alt";
/// <summary>
/// System media file icon
/// </summary>
public const string MediaFile = "icon-document";
/// <summary>
/// System media folder icon
/// </summary>
public const string MediaFolder = "icon-folder";
/// <summary>
/// System media image icon
/// </summary>
public const string MediaImage = "icon-picture";
/// <summary>
/// System media type icon
/// </summary>
public const string MediaType = "icon-thumbnails";
/// <summary>
/// System member icon
/// </summary>
public const string Member = "icon-user";
/// <summary>
/// System member icon
/// System member group icon
/// </summary>
public const string MemberGroup = "icon-users-alt";
/// <summary>
/// System member type icon
/// </summary>
public const string MemberType = "icon-users";
/// <summary>
/// System property editor icon
/// </summary>
public const string PropertyEditor = "icon-autofill";
/// <summary>
/// System member icon
/// </summary>
public const string Template = "icon-layout";
/// <summary>
/// System user icon
/// </summary>
public const string User = "icon-user";
/// <summary>
/// System user group icon
/// </summary>
public const string UserGroup = "icon-users";
}
}
}
+2 -1
View File
@@ -10,6 +10,8 @@ namespace Umbraco.Core
///</summary>
public static class EnumerableExtensions
{
internal static bool IsCollectionEmpty<T>(this IReadOnlyCollection<T> list) => list == null || list.Count == 0;
internal static bool HasDuplicates<T>(this IEnumerable<T> items, bool includeNull)
{
var hs = new HashSet<T>();
@@ -112,7 +114,6 @@ namespace Umbraco.Core
}
}
/// <summary>
/// Returns true if all items in the other collection exist in this collection
/// </summary>
@@ -101,33 +101,33 @@ namespace Umbraco.Core.Migrations.Install
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1", SortOrder = 0, UniqueId = new Guid("916724a5-173d-4619-b97e-b9de133dd6f5"), Text = "SYSTEM DATA: umbraco master root", NodeObjectType = Constants.ObjectTypes.SystemRoot, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -20, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,-20", SortOrder = 0, UniqueId = new Guid("0F582A79-1E41-4CF0-BFA0-76340651891A"), Text = "Recycle Bin", NodeObjectType = Constants.ObjectTypes.ContentRecycleBin, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -21, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,-21", SortOrder = 0, UniqueId = new Guid("BF7C7CBC-952F-4518-97A2-69E9C7B33842"), Text = "Recycle Bin", NodeObjectType = Constants.ObjectTypes.MediaRecycleBin, CreateDate = DateTime.Now });
InsertDataTypeNodeDto(Constants.DataTypes.LabelString, 35, "f0bc4bfb-b499-40d6-ba86-058885a5178c", "Label");
InsertDataTypeNodeDto(Constants.DataTypes.LabelInt, 36, "8e7f995c-bd81-4627-9932-c40e568ec788", "Label (integer)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelBigint, 36, "930861bf-e262-4ead-a704-f99453565708", "Label (bigint)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelDateTime, 37, "0e9794eb-f9b5-4f20-a788-93acd233a7e4", "Label (datetime)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelTime, 38, "a97cec69-9b71-4c30-8b12-ec398860d7e8", "Label (time)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelDecimal, 39, "8f1ef1e1-9de4-40d3-a072-6673f631ca64", "Label (decimal)");
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -90, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-90", SortOrder = 34, UniqueId = new Guid("84c6b441-31df-4ffe-b67e-67d5bc3ae65a"), Text = "Upload", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = new Guid("c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3"), Text = "Textarea", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -88, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-88", SortOrder = 32, UniqueId = new Guid("0cc0eba1-9960-42c9-bf9b-60e150b429ae"), Text = "Textstring", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -87, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-87", SortOrder = 4, UniqueId = new Guid("ca90c950-0aff-4e72-b976-a30b1ac57dad"), Text = "Richtext editor", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = new Guid("2e6d3631-066e-44b8-aec4-96f09099b2b5"), Text = "Numeric", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -49, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-49", SortOrder = 2, UniqueId = new Guid("92897bc6-a5f3-4ffe-ae27-f2e7e33dda49"), Text = "True/false", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -43, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = new Guid("fbaf13a8-4036-41f2-93a3-974f678c312a"), Text = "Checkbox list", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DropDownSingle, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DropDownSingle}", SortOrder = 2, UniqueId = new Guid("0b6a45e7-44ba-430d-9da5-4e46060b9e03"), Text = "Dropdown", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -41, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = new Guid("5046194e-4237-453c-a547-15db3a07c4e1"), Text = "Date Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -40, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = new Guid("bb5f57c9-ce2b-4bb9-b697-4caca783a805"), Text = "Radiobox", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DropDownMultiple, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DropDownMultiple}", SortOrder = 2, UniqueId = new Guid("f38f0ac7-1d27-439c-9f3f-089cd8825a53"), Text = "Dropdown multiple", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -37, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = new Guid("0225af17-b302-49cb-9176-b9f35cab9c17"), Text = "Approved Color", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -36, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-36", SortOrder = 2, UniqueId = new Guid("e4d66c0f-b935-4200-81f0-025f7256b89a"), Text = "Date Picker with time", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultContentListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultContentListView}", SortOrder = 2, UniqueId = new Guid("C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMediaListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultMediaListView}", SortOrder = 2, UniqueId = new Guid("3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMembersListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultMembersListView}", SortOrder = 2, UniqueId = new Guid("AA2C52A0-CE87-4E65-A47C-7DF09358585D"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
InsertDataTypeNodeDto(Constants.DataTypes.LabelString, 35, Constants.DataTypes.Guids.LabelString, "Label (string)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelInt, 36, Constants.DataTypes.Guids.LabelInt, "Label (integer)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelBigint, 36, Constants.DataTypes.Guids.LabelBigInt, "Label (bigint)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelDateTime, 37, Constants.DataTypes.Guids.LabelDateTime, "Label (datetime)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelTime, 38, Constants.DataTypes.Guids.LabelTime, "Label (time)");
InsertDataTypeNodeDto(Constants.DataTypes.LabelDecimal, 39, Constants.DataTypes.Guids.LabelDecimal, "Label (decimal)");
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Upload, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Upload}", SortOrder = 34, UniqueId = Constants.DataTypes.Guids.UploadGuid, Text = "Upload", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Textarea, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Textarea}", SortOrder = 33, UniqueId = Constants.DataTypes.Guids.TextareaGuid, Text = "Textarea", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Textbox, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Textbox}", SortOrder = 32, UniqueId = Constants.DataTypes.Guids.TextstringGuid, Text = "Textstring", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.RichtextEditor, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.RichtextEditor}", SortOrder = 4, UniqueId = Constants.DataTypes.Guids.RichtextEditorGuid, Text = "Richtext editor", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.NumericGuid, Text = "Numeric", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Boolean, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Boolean}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.CheckboxGuid, Text = "True/false", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -43, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.CheckboxListGuid, Text = "Checkbox list", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DropDownSingle, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DropDownSingle}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DropdownGuid, Text = "Dropdown", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -41, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DatePickerGuid, Text = "Date Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -40, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.RadioboxGuid, Text = "Radiobox", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DropDownMultiple, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DropDownMultiple}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DropdownMultipleGuid, Text = "Dropdown multiple", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -37, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ApprovedColorGuid, Text = "Approved Color", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DateTime, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DateTime}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DatePickerWithTimeGuid, Text = "Date Picker with time", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultContentListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultContentListView}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ListViewContentGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMediaListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultMediaListView}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ListViewMediaGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMembersListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultMembersListView}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ListViewMembersGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1031, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1031", SortOrder = 2, UniqueId = new Guid("f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d"), Text = Constants.Conventions.MediaTypes.Folder, NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1032, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1032", SortOrder = 2, UniqueId = new Guid("cc07b313-0843-4aa8-bbda-871c8da728c8"), Text = Constants.Conventions.MediaTypes.Image, NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1033, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1033", SortOrder = 2, UniqueId = new Guid("4c52d8ab-54e6-40cd-999c-7a5f24903e4d"), Text = Constants.Conventions.MediaTypes.File, NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1041, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1041", SortOrder = 2, UniqueId = new Guid("b6b73142-b9c1-4bf8-a16d-e1c23320b549"), Text = "Tags", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1043, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1043", SortOrder = 2, UniqueId = new Guid("1df9f033-e6d4-451f-b8d2-e0cbc50a836f"), Text = "Image Cropper", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Tags, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Tags}", SortOrder = 2, UniqueId = new Guid("b6b73142-b9c1-4bf8-a16d-e1c23320b549"), Text = "Tags", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.ImageCropper, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.ImageCropper}", SortOrder = 2, UniqueId = new Guid("1df9f033-e6d4-451f-b8d2-e0cbc50a836f"), Text = "Image Cropper", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now });
_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1044, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1044", SortOrder = 0, UniqueId = new Guid("d59be02f-1df9-4228-aa1e-01917d806cda"), Text = Constants.Conventions.MemberTypes.DefaultAlias, NodeObjectType = Constants.ObjectTypes.MemberType, CreateDate = DateTime.Now });
//New UDI pickers with newer Ids
@@ -155,10 +155,10 @@ namespace Umbraco.Core.Migrations.Install
private void CreateContentTypeData()
{
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = Constants.Conventions.MediaTypes.Folder, Icon = "icon-folder", Thumbnail = "icon-folder", IsContainer = false, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = Constants.Conventions.MediaTypes.Image, Icon = "icon-picture", Thumbnail = "icon-picture", AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = Constants.Conventions.MediaTypes.File, Icon = "icon-document", Thumbnail = "icon-document", AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 531, NodeId = 1044, Alias = Constants.Conventions.MemberTypes.DefaultAlias, Icon = "icon-user", Thumbnail = "icon-user", Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = Constants.Conventions.MediaTypes.Folder, Icon = Constants.Icons.MediaFolder, Thumbnail = Constants.Icons.MediaFolder, IsContainer = false, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = Constants.Conventions.MediaTypes.Image, Icon = Constants.Icons.MediaImage, Thumbnail = Constants.Icons.MediaImage, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = Constants.Conventions.MediaTypes.File, Icon = Constants.Icons.MediaFile, Thumbnail = Constants.Icons.MediaFile, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 531, NodeId = 1044, Alias = Constants.Conventions.MemberTypes.DefaultAlias, Icon = Constants.Icons.Member, Thumbnail = Constants.Icons.Member, Variations = (byte) ContentVariation.Nothing });
}
private void CreateUserData()
@@ -210,19 +210,19 @@ namespace Umbraco.Core.Migrations.Install
private void CreatePropertyTypeData()
{
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 6, UniqueId = 6.ToGuid(), DataTypeId = 1043, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.File, Name = "Upload image", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 6, UniqueId = 6.ToGuid(), DataTypeId = Constants.DataTypes.ImageCropper, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.File, Name = "Upload image", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 7, UniqueId = 7.ToGuid(), DataTypeId = Constants.DataTypes.LabelInt, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Width, Name = "Width", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in pixels", Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 8, UniqueId = 8.ToGuid(), DataTypeId = Constants.DataTypes.LabelInt, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Height, Name = "Height", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in pixels", Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 9, UniqueId = 9.ToGuid(), DataTypeId = Constants.DataTypes.LabelBigint, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in bytes", Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 10, UniqueId = 10.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 24, UniqueId = 24.ToGuid(), DataTypeId = -90, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.File, Name = "Upload file", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 24, UniqueId = 24.ToGuid(), DataTypeId = Constants.DataTypes.Upload, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.File, Name = "Upload file", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 25, UniqueId = 25.ToGuid(), DataTypeId = -92, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 26, UniqueId = 26.ToGuid(), DataTypeId = Constants.DataTypes.LabelBigint, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in bytes", Variations = (byte) ContentVariation.Nothing });
//membership property types
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 28, UniqueId = 28.ToGuid(), DataTypeId = -89, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.Comments, Name = Constants.Conventions.Member.CommentsLabel, SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 28, UniqueId = 28.ToGuid(), DataTypeId = Constants.DataTypes.Textarea, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.Comments, Name = Constants.Conventions.Member.CommentsLabel, SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 29, UniqueId = 29.ToGuid(), DataTypeId = Constants.DataTypes.LabelInt, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.FailedPasswordAttempts, Name = Constants.Conventions.Member.FailedPasswordAttemptsLabel, SortOrder = 1, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 30, UniqueId = 30.ToGuid(), DataTypeId = -49, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsApproved, Name = Constants.Conventions.Member.IsApprovedLabel, SortOrder = 2, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 31, UniqueId = 31.ToGuid(), DataTypeId = -49, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsLockedOut, Name = Constants.Conventions.Member.IsLockedOutLabel, SortOrder = 3, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 30, UniqueId = 30.ToGuid(), DataTypeId = Constants.DataTypes.Boolean, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsApproved, Name = Constants.Conventions.Member.IsApprovedLabel, SortOrder = 2, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 31, UniqueId = 31.ToGuid(), DataTypeId = Constants.DataTypes.Boolean, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsLockedOut, Name = Constants.Conventions.Member.IsLockedOutLabel, SortOrder = 3, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 32, UniqueId = 32.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLockoutDate, Name = Constants.Conventions.Member.LastLockoutDateLabel, SortOrder = 4, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 33, UniqueId = 33.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLoginDate, Name = Constants.Conventions.Member.LastLoginDateLabel, SortOrder = 5, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
_database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 34, UniqueId = 34.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastPasswordChangeDate, Name = Constants.Conventions.Member.LastPasswordChangeDateLabel, SortOrder = 6, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing });
@@ -266,30 +266,30 @@ namespace Umbraco.Core.Migrations.Install
const string layouts = "[" + cardLayout + "," + listLayout + "]";
// TODO: Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors.
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -49, EditorAlias = Constants.PropertyEditors.Aliases.Boolean, DbType = "Integer" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Boolean, EditorAlias = Constants.PropertyEditors.Aliases.Boolean, DbType = "Integer" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -51, EditorAlias = Constants.PropertyEditors.Aliases.Integer, DbType = "Integer" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -87, EditorAlias = Constants.PropertyEditors.Aliases.TinyMce, DbType = "Ntext",
Configuration = "{\"value\":\",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|\"}" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -88, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -89, EditorAlias = Constants.PropertyEditors.Aliases.TextArea, DbType = "Ntext" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -90, EditorAlias = Constants.PropertyEditors.Aliases.UploadField, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Textbox, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Textarea, EditorAlias = Constants.PropertyEditors.Aliases.TextArea, DbType = "Ntext" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Upload, EditorAlias = Constants.PropertyEditors.Aliases.UploadField, DbType = "Nvarchar" });
InsertDataTypeDto(Constants.DataTypes.LabelString, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}");
InsertDataTypeDto(Constants.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.Label, "Integer", "{\"umbracoDataValueType\":\"INT\"}");
InsertDataTypeDto(Constants.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}");
InsertDataTypeDto(Constants.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}");
InsertDataTypeDto(Constants.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.Label, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}");
InsertDataTypeDto(Constants.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"TIME\"}");
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -36, EditorAlias = Constants.PropertyEditors.Aliases.DateTime, DbType = "Date" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DateTime, EditorAlias = Constants.PropertyEditors.Aliases.DateTime, DbType = "Date" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -37, EditorAlias = Constants.PropertyEditors.Aliases.ColorPicker, DbType = "Nvarchar" });
InsertDataTypeDto(Constants.DataTypes.DropDownSingle, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":false}");
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -40, EditorAlias = Constants.PropertyEditors.Aliases.RadioButtonList, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -41, EditorAlias = "Umbraco.DateTime", DbType = "Date", Configuration = "{\"format\":\"YYYY-MM-DD\"}" });
InsertDataTypeDto(Constants.DataTypes.DropDownMultiple, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":true}");
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -43, EditorAlias = Constants.PropertyEditors.Aliases.CheckBoxList, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1041, EditorAlias = Constants.PropertyEditors.Aliases.Tags, DbType = "Ntext",
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Tags, EditorAlias = Constants.PropertyEditors.Aliases.Tags, DbType = "Ntext",
Configuration = "{\"group\":\"default\", \"storageType\":\"Json\"}"
});
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1043, EditorAlias = Constants.PropertyEditors.Aliases.ImageCropper, DbType = "Ntext" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.ImageCropper, EditorAlias = Constants.PropertyEditors.Aliases.ImageCropper, DbType = "Ntext" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DefaultContentListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar",
Configuration = "{\"pageSize\":100, \"orderBy\":\"updateDate\", \"orderDirection\":\"desc\", \"layouts\":" + layouts + ", \"includeProperties\":[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]}" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DefaultMediaListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar",
@@ -74,6 +74,11 @@ namespace Umbraco.Core.Migrations.Upgrade
throw new InvalidOperationException($"Version {currentVersion} cannot be migrated to {UmbracoVersion.SemanticVersion}."
+ $" Please upgrade first to at least {minVersion}.");
// Force versions between 7.14.*-7.15.* into into 7.14 initial state. Because there is no db-changes,
// and we don't want users to workaround my putting in version 7.14.0 them self.
if (minVersion <= currentVersion && currentVersion < new SemVersion(7, 16))
return GetInitState(minVersion);
// initial state is eg "{init-7.14.0}"
return GetInitState(currentVersion);
}
@@ -2,24 +2,24 @@
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes
{
[RuntimeLevel(MinLevel = RuntimeLevel.Upgrade, MaxLevel = RuntimeLevel.Upgrade)] // only on upgrades
public class PreValueMigratorComposer : ICoreComposer
[RuntimeLevel(MinLevel = RuntimeLevel.Upgrade, MaxLevel = RuntimeLevel.Upgrade)] // only on upgrades
public class PreValueMigratorComposer : ICoreComposer
{
public void Compose(Composition composition)
{
public void Compose(Composition composition)
{
// do NOT add DefaultPreValueMigrator to this list!
// it will be automatically used if nothing matches
// do NOT add DefaultPreValueMigrator to this list!
// it will be automatically used if nothing matches
composition.WithCollectionBuilder<PreValueMigratorCollectionBuilder>()
.Append<RenamingPreValueMigrator>()
.Append<RichTextPreValueMigrator>()
.Append<UmbracoSliderPreValueMigrator>()
.Append<MediaPickerPreValueMigrator>()
.Append<ContentPickerPreValueMigrator>()
.Append<NestedContentPreValueMigrator>()
.Append<DecimalPreValueMigrator>()
.Append<ListViewPreValueMigrator>()
.Append<ValueListPreValueMigrator>();
}
composition.WithCollectionBuilder<PreValueMigratorCollectionBuilder>()
.Append<RenamingPreValueMigrator>()
.Append<RichTextPreValueMigrator>()
.Append<UmbracoSliderPreValueMigrator>()
.Append<MediaPickerPreValueMigrator>()
.Append<ContentPickerPreValueMigrator>()
.Append<NestedContentPreValueMigrator>()
.Append<DecimalPreValueMigrator>()
.Append<ListViewPreValueMigrator>()
.Append<ValueListPreValueMigrator>();
}
}
}
@@ -30,7 +30,20 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
.Where<DataTypeDto>(x => x.EditorAlias == toAlias));
if (oldCount > 0)
throw new InvalidOperationException($"Cannot rename datatype alias \"{fromAlias}\" to \"{toAlias}\" because the target alias is already used.");
{
// If we throw it means that the upgrade will exit and cannot continue.
// This will occur if a v7 site has the old "Obsolete" property editors that are already named with the `toAlias` name.
// TODO: We should have an additional upgrade step when going from 7 -> 8 like we did with 6 -> 7 that shows a compatibility report,
// this would include this check and then we can provide users with information on what they should do (i.e. before upgrading to v8 they will
// need to migrate these old obsolete editors to non-obsolete editors)
throw new InvalidOperationException(
$"Cannot rename datatype alias \"{fromAlias}\" to \"{toAlias}\" because the target alias is already used." +
$"This is generally because when upgrading from a v7 to v8 site, the v7 site contains Data Types that reference old and already Obsolete " +
$"Property Editors. Before upgrading to v8, any Data Types using property editors that are named with the prefix '(Obsolete)' must be migrated " +
$"to the non-obsolete v7 property editors of the same type.");
}
}
Database.Execute(Sql()
@@ -35,5 +35,58 @@ namespace Umbraco.Core.Models
throw new InvalidCastException($"Cannot cast dataType configuration, of type {configuration.GetType().Name}, to {typeof(T).Name}.");
}
private static readonly ISet<Guid> IdsOfBuildInDataTypes = new HashSet<Guid>()
{
Constants.DataTypes.Guids.ContentPickerGuid,
Constants.DataTypes.Guids.MemberPickerGuid,
Constants.DataTypes.Guids.MediaPickerGuid,
Constants.DataTypes.Guids.MultipleMediaPickerGuid,
Constants.DataTypes.Guids.RelatedLinksGuid,
Constants.DataTypes.Guids.MemberGuid,
Constants.DataTypes.Guids.ImageCropperGuid,
Constants.DataTypes.Guids.TagsGuid,
Constants.DataTypes.Guids.ListViewContentGuid,
Constants.DataTypes.Guids.ListViewMediaGuid,
Constants.DataTypes.Guids.ListViewMembersGuid,
Constants.DataTypes.Guids.DatePickerWithTimeGuid,
Constants.DataTypes.Guids.ApprovedColorGuid,
Constants.DataTypes.Guids.DropdownMultipleGuid,
Constants.DataTypes.Guids.RadioboxGuid,
Constants.DataTypes.Guids.DatePickerGuid,
Constants.DataTypes.Guids.DropdownGuid,
Constants.DataTypes.Guids.CheckboxListGuid,
Constants.DataTypes.Guids.CheckboxGuid,
Constants.DataTypes.Guids.NumericGuid,
Constants.DataTypes.Guids.RichtextEditorGuid,
Constants.DataTypes.Guids.TextstringGuid,
Constants.DataTypes.Guids.TextareaGuid,
Constants.DataTypes.Guids.UploadGuid,
Constants.DataTypes.Guids.LabelStringGuid,
Constants.DataTypes.Guids.LabelDecimalGuid,
Constants.DataTypes.Guids.LabelDateTimeGuid,
Constants.DataTypes.Guids.LabelBigIntGuid,
Constants.DataTypes.Guids.LabelTimeGuid,
Constants.DataTypes.Guids.LabelDateTimeGuid,
};
/// <summary>
/// Returns true if this date type is build-in/default.
/// </summary>
/// <param name="dataType">The data type definition.</param>
/// <returns></returns>
internal static bool IsBuildInDataType(this IDataType dataType)
{
return IsBuildInDataType(dataType.Key);
}
/// <summary>
/// Returns true if this date type is build-in/default.
/// </summary>
internal static bool IsBuildInDataType(Guid key)
{
return IdsOfBuildInDataTypes.Contains(key);
}
}
}
+1 -31
View File
@@ -81,37 +81,7 @@ namespace Umbraco.Core.Models.Entities
_key = Guid.Empty;
_hasIdentity = false;
}
/// <summary>
/// Updates the entity when it is being saved for the first time.
/// </summary>
internal virtual void AddingEntity()
{
var now = DateTime.Now;
// set the create and update dates, if not already set
if (IsPropertyDirty("CreateDate") == false || _createDate == default)
CreateDate = now;
if (IsPropertyDirty("UpdateDate") == false || _updateDate == default)
UpdateDate = now;
}
/// <summary>
/// Updates the entity when it is being saved.
/// </summary>
internal virtual void UpdatingEntity()
{
var now = DateTime.Now;
// just in case
if (_createDate == default)
CreateDate = now;
// set the update date if not already set
if (IsPropertyDirty("UpdateDate") == false || _updateDate == default)
UpdateDate = now;
}
public virtual bool Equals(EntityBase other)
{
return other != null && (ReferenceEquals(this, other) || SameIdentityAs(other));
@@ -0,0 +1,46 @@
using System;
namespace Umbraco.Core.Models.Entities
{
internal static class EntityExtensions
{
/// <summary>
/// Updates the entity when it is being saved.
/// </summary>
internal static void UpdatingEntity(this IEntity entity)
{
var now = DateTime.Now;
// just in case
if (entity.CreateDate == default)
{
entity.CreateDate = now;
}
// set the update date if not already set
if (entity.UpdateDate == default || (entity is ICanBeDirty canBeDirty && canBeDirty.IsPropertyDirty("UpdateDate") == false))
{
entity.UpdateDate = now;
}
}
/// <summary>
/// Updates the entity when it is being saved for the first time.
/// </summary>
internal static void AddingEntity(this IEntity entity)
{
var now = DateTime.Now;
var canBeDirty = entity as ICanBeDirty;
// set the create and update dates, if not already set
if (entity.CreateDate == default || canBeDirty?.IsPropertyDirty("CreateDate") == false)
{
entity.CreateDate = now;
}
if (entity.UpdateDate == default || canBeDirty?.IsPropertyDirty("UpdateDate") == false)
{
entity.UpdateDate = now;
}
}
}
}
-13
View File
@@ -478,19 +478,6 @@ namespace Umbraco.Core.Models
set => SetPropertyValueAndDetectChanges(value, ref _providerUserKey, nameof(ProviderUserKey));
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
/// <remarks>Created date is set and a Unique key is assigned</remarks>
internal override void AddingEntity()
{
base.AddingEntity();
if (ProviderUserKey == null)
ProviderUserKey = Key;
}
/* Internal experiment - only used for mapping queries.
* Adding these to have first level properties instead of the Properties collection.
*/
+8
View File
@@ -21,6 +21,7 @@ namespace Umbraco.Core.Models
private string _alias;
private string _description;
private int _dataTypeId;
private Guid _dataTypeKey;
private Lazy<int> _propertyGroupId;
private string _propertyEditorAlias;
private ValueStorageType _valueStorageType;
@@ -139,6 +140,13 @@ namespace Umbraco.Core.Models
set => SetPropertyValueAndDetectChanges(value, ref _dataTypeId, nameof(DataTypeId));
}
[DataMember]
public Guid DataTypeKey
{
get => _dataTypeKey;
set => SetPropertyValueAndDetectChanges(value, ref _dataTypeKey, nameof(DataTypeKey));
}
/// <summary>
/// Gets or sets the alias of the property editor for this property type.
/// </summary>
@@ -13,6 +13,10 @@
/// <summary>
/// Refreshes the factory.
/// </summary>
/// <remarks>
/// <para>This will typically re-compiled models/classes into a new DLL that are used to populate the cache.</para>
/// <para>This is called prior to refreshing the cache.</para>
/// </remarks>
void Refresh();
}
}
-13
View File
@@ -193,19 +193,6 @@ namespace Umbraco.Core.Models
return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia);
}
internal static bool IsInBranchOfStartNode(this IUser user, IUmbracoEntity entity, IEntityService entityService, int recycleBinId, out bool hasPathAccess)
{
switch (recycleBinId)
{
case Constants.System.RecycleBinMedia:
return ContentPermissionsHelper.IsInBranchOfStartNode(entity.Path, user.CalculateMediaStartNodeIds(entityService), user.GetMediaStartNodePaths(entityService), out hasPathAccess);
case Constants.System.RecycleBinContent:
return ContentPermissionsHelper.IsInBranchOfStartNode(entity.Path, user.CalculateContentStartNodeIds(entityService), user.GetContentStartNodePaths(entityService), out hasPathAccess);
default:
throw new NotSupportedException("Path access is only determined on content or media");
}
}
/// <summary>
/// Determines whether this user has access to view sensitive data
/// </summary>
@@ -54,6 +54,7 @@ namespace Umbraco.Core.Persistence.Factories
propertyType.Alias = typeDto.Alias;
propertyType.DataTypeId = typeDto.DataTypeId;
propertyType.DataTypeKey = typeDto.DataTypeDto.NodeDto.UniqueId;
propertyType.Description = typeDto.Description;
propertyType.Id = typeDto.Id;
propertyType.Key = typeDto.UniqueId;
@@ -18,7 +18,8 @@ namespace Umbraco.Core.Persistence.Mappers
DefineMap<AuditItem, LogDto>(nameof(AuditItem.Id), nameof(LogDto.NodeId));
DefineMap<AuditItem, LogDto>(nameof(AuditItem.CreateDate), nameof(LogDto.Datestamp));
DefineMap<AuditItem, LogDto>(nameof(AuditItem.UserId), nameof(LogDto.UserId));
DefineMap<AuditItem, LogDto>(nameof(AuditItem.AuditType), nameof(LogDto.Header));
// we cannot map that one - because AuditType is an enum but Header is a string
//DefineMap<AuditItem, LogDto>(nameof(AuditItem.AuditType), nameof(LogDto.Header));
DefineMap<AuditItem, LogDto>(nameof(AuditItem.Comment), nameof(LogDto.Comment));
}
}
@@ -85,6 +85,17 @@ namespace Umbraco.Core.Persistence.Querying
// I'm just unsure right now due to time constraints how to make it correct. It won't matter right now and has been working already with this bug but I've
// only just discovered what it is actually doing.
// TODO
// in most cases we want to convert the value to a plain object,
// but for in some rare cases, we may want to do it differently,
// for instance a Models.AuditType (an enum) may in some cases
// need to be converted to its string value.
// but - we cannot have specific code here, really - and how would
// we configure this? is it even possible?
/*
var toString = typeof(object).GetMethod("ToString");
var member = Expression.Call(m, toString);
*/
var member = Expression.Convert(m, typeof(object));
var lambda = Expression.Lambda<Func<object>>(member);
var getter = lambda.Compile();
@@ -33,5 +33,7 @@ namespace Umbraco.Core.Persistence.Repositories
Direction orderDirection,
AuditType[] auditTypeFilter,
IQuery<IAuditItem> customFilter);
IEnumerable<IAuditItem> Get(AuditType type, IQuery<IAuditItem> query);
}
}
@@ -100,7 +100,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
/// <inheritdoc />
protected override void PersistNewItem(IAuditEntry entity)
{
((EntityBase) entity).AddingEntity();
entity.AddingEntity();
var dto = AuditEntryFactory.BuildDto(entity);
Database.Insert(dto);
@@ -74,6 +74,18 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
return dtos.Select(x => new AuditItem(x.NodeId, Enum<AuditType>.Parse(x.Header), x.UserId ?? Constants.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList();
}
public IEnumerable<IAuditItem> Get(AuditType type, IQuery<IAuditItem> query)
{
var sqlClause = GetBaseQuery(false)
.Where<LogDto>(x => x.Header == type.ToString());
var translator = new SqlTranslator<IAuditItem>(sqlClause, query);
var sql = translator.Translate();
var dtos = Database.Fetch<LogDto>(sql);
return dtos.Select(x => new AuditItem(x.NodeId, Enum<AuditType>.Parse(x.Header), x.UserId ?? Constants.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList();
}
protected override Sql<ISqlContext> GetBaseQuery(bool isCount)
{
var sql = SqlContext.Sql();
@@ -69,7 +69,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
/// <inheritdoc />
protected override void PersistNewItem(IConsent entity)
{
((EntityBase) entity).AddingEntity();
entity.AddingEntity();
var dto = ConsentFactory.BuildDto(entity);
Database.Insert(dto);
@@ -80,7 +80,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
/// <inheritdoc />
protected override void PersistUpdatedItem(IConsent entity)
{
((EntityBase) entity).UpdatingEntity();
entity.UpdatingEntity();
var dto = ConsentFactory.BuildDto(entity);
Database.Update(dto);
@@ -7,6 +7,7 @@ using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Scoping;
using static Umbraco.Core.Persistence.NPocoSqlExtensions.Statics;
namespace Umbraco.Core.Persistence.Repositories.Implement
{
@@ -188,10 +189,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
var groupDtos = Database.Fetch<PropertyTypeGroupDto>(sql1);
var sql2 = Sql()
.Select<PropertyTypeDto>(r => r.Select(x => x.DataTypeDto))
.Select<PropertyTypeDto>(r => r.Select(x => x.DataTypeDto, r1 => r1.Select(x => x.NodeDto)))
.AndSelect<MemberPropertyTypeDto>()
.From<PropertyTypeDto>()
.InnerJoin<DataTypeDto>().On<PropertyTypeDto, DataTypeDto>((pt, dt) => pt.DataTypeId == dt.NodeId)
.InnerJoin<NodeDto>().On<DataTypeDto, NodeDto>((dt, n) => dt.NodeId == n.NodeId)
.InnerJoin<ContentTypeDto>().On<PropertyTypeDto, ContentTypeDto>((pt, ct) => pt.ContentTypeId == ct.NodeId)
.LeftJoin<PropertyTypeGroupDto>().On<PropertyTypeDto, PropertyTypeGroupDto>((pt, ptg) => pt.PropertyTypeGroupId == ptg.Id)
.LeftJoin<MemberPropertyTypeDto>().On<PropertyTypeDto, MemberPropertyTypeDto>((pt, mpt) => pt.Id == mpt.PropertyTypeId)
@@ -290,6 +292,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
Description = dto.Description,
DataTypeId = dto.DataTypeId,
DataTypeKey = dto.DataTypeDto.NodeDto.UniqueId,
Id = dto.Id,
Key = dto.UniqueId,
Mandatory = dto.Mandatory,
@@ -5,6 +5,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -230,7 +231,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
throw ex;
}
((ContentType)entity).AddingEntity();
entity.AddingEntity();
PersistNewBaseContentType(entity);
PersistTemplates(entity, false);
@@ -270,7 +271,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
ValidateAlias(entity);
//Updates Modified date
((ContentType)entity).UpdatingEntity();
entity.UpdatingEntity();
//Look up parent to get and set the correct Path if ParentId has changed
if (entity.IsPropertyDirty("ParentId"))
@@ -1013,8 +1013,9 @@ AND umbracoNode.id <> @id",
if (propertyType.PropertyEditorAlias.IsNullOrWhiteSpace() == false)
{
var sql = Sql()
.SelectAll()
.Select<DataTypeDto>(dt => dt.Select(x => x.NodeDto))
.From<DataTypeDto>()
.InnerJoin<NodeDto>().On<DataTypeDto, NodeDto>((dt, n) => dt.NodeId == n.NodeId)
.Where("propertyEditorAlias = @propertyEditorAlias", new { propertyEditorAlias = propertyType.PropertyEditorAlias })
.OrderBy<DataTypeDto>(typeDto => typeDto.NodeId);
var datatype = Database.FirstOrDefault<DataTypeDto>(sql);
@@ -1022,6 +1023,7 @@ AND umbracoNode.id <> @id",
if (datatype != null)
{
propertyType.DataTypeId = datatype.NodeId;
propertyType.DataTypeKey = datatype.NodeDto.UniqueId;
}
else
{
@@ -9,6 +9,7 @@ using Umbraco.Core.Events;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -106,7 +107,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IDataType entity)
{
((DataType)entity).AddingEntity();
entity.AddingEntity();
//ensure a datatype has a unique name before creating it
entity.Name = EnsureUniqueNodeName(entity.Name);
@@ -174,7 +175,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
//Updates Modified date
((DataType)entity).UpdatingEntity();
entity.UpdatingEntity();
//Look up parent to get and set the correct Path if ParentId has changed
if (entity.IsPropertyDirty("ParentId"))
@@ -148,7 +148,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IDictionaryItem entity)
{
((EntityBase)entity).UpdatingEntity();
entity.UpdatingEntity();
foreach (var translation in entity.Translations)
translation.Value = translation.Value.ToValidXmlString();
@@ -6,6 +6,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
@@ -205,7 +206,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
"DELETE FROM " + Constants.DatabaseSchema.Tables.ContentVersionCultureVariation + " WHERE versionId IN (SELECT id FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id)",
"DELETE FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Content + " WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.AccessRule + " WHERE accessId IN (SELECT id FROM " + Constants.DatabaseSchema.Tables.Access + " WHERE nodeId = @id OR loginNodeId = @id OR noAccessNodeId = @id)",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Access + " WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Access + " WHERE loginNodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Access + " WHERE noAccessNodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Node + " WHERE id = @id"
};
return list;
@@ -260,21 +264,16 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IContent entity)
{
// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4234 - sort out IContent vs Content
// however, it's not just so we have access to AddingEntity
// there are tons of things at the end of the methods, that can only work with a true Content
// and basically, the repository requires a Content, not an IContent
var content = (Content)entity;
entity.AddingEntity();
content.AddingEntity();
var publishing = content.PublishedState == PublishedState.Publishing;
var publishing = entity.PublishedState == PublishedState.Publishing;
// ensure that the default template is assigned
if (entity.TemplateId.HasValue == false)
entity.TemplateId = entity.ContentType.DefaultTemplate?.Id;
// sanitize names
SanitizeNames(content, publishing);
SanitizeNames(entity, publishing);
// ensure that strings don't contain characters that are invalid in xml
// TODO: do we really want to keep doing this here?
@@ -324,11 +323,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
contentVersionDto.NodeId = nodeDto.NodeId;
contentVersionDto.Current = !publishing;
Database.Insert(contentVersionDto);
content.VersionId = contentVersionDto.Id;
entity.VersionId = contentVersionDto.Id;
// persist the document version dto
var documentVersionDto = dto.DocumentVersionDto;
documentVersionDto.Id = content.VersionId;
documentVersionDto.Id = entity.VersionId;
if (publishing)
documentVersionDto.Published = true;
Database.Insert(documentVersionDto);
@@ -336,62 +335,62 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// and again in case we're publishing immediately
if (publishing)
{
content.PublishedVersionId = content.VersionId;
entity.PublishedVersionId = entity.VersionId;
contentVersionDto.Id = 0;
contentVersionDto.Current = true;
contentVersionDto.Text = content.Name;
contentVersionDto.Text = entity.Name;
Database.Insert(contentVersionDto);
content.VersionId = contentVersionDto.Id;
entity.VersionId = contentVersionDto.Id;
documentVersionDto.Id = content.VersionId;
documentVersionDto.Id = entity.VersionId;
documentVersionDto.Published = false;
Database.Insert(documentVersionDto);
}
// persist the property data
var propertyDataDtos = PropertyFactory.BuildDtos(content.ContentType.Variations, content.VersionId, content.PublishedVersionId, entity.Properties, LanguageRepository, out var edited, out var editedCultures);
var propertyDataDtos = PropertyFactory.BuildDtos(entity.ContentType.Variations, entity.VersionId, entity.PublishedVersionId, entity.Properties, LanguageRepository, out var edited, out var editedCultures);
foreach (var propertyDataDto in propertyDataDtos)
Database.Insert(propertyDataDto);
// if !publishing, we may have a new name != current publish name,
// also impacts 'edited'
if (!publishing && content.PublishName != content.Name)
if (!publishing && entity.PublishName != entity.Name)
edited = true;
// persist the document dto
// at that point, when publishing, the entity still has its old Published value
// so we need to explicitly update the dto to persist the correct value
if (content.PublishedState == PublishedState.Publishing)
if (entity.PublishedState == PublishedState.Publishing)
dto.Published = true;
dto.NodeId = nodeDto.NodeId;
content.Edited = dto.Edited = !dto.Published || edited; // if not published, always edited
entity.Edited = dto.Edited = !dto.Published || edited; // if not published, always edited
Database.Insert(dto);
//insert the schedule
PersistContentSchedule(content, false);
PersistContentSchedule(entity, false);
// persist the variations
if (content.ContentType.VariesByCulture())
if (entity.ContentType.VariesByCulture())
{
// bump dates to align cultures to version
if (publishing)
content.AdjustDates(contentVersionDto.VersionDate);
entity.AdjustDates(contentVersionDto.VersionDate);
// names also impact 'edited'
// ReSharper disable once UseDeconstruction
foreach (var cultureInfo in content.CultureInfos)
if (cultureInfo.Name != content.GetPublishName(cultureInfo.Culture))
foreach (var cultureInfo in entity.CultureInfos)
if (cultureInfo.Name != entity.GetPublishName(cultureInfo.Culture))
(editedCultures ?? (editedCultures = new HashSet<string>(StringComparer.OrdinalIgnoreCase))).Add(cultureInfo.Culture);
// insert content variations
Database.BulkInsertRecords(GetContentVariationDtos(content, publishing));
Database.BulkInsertRecords(GetContentVariationDtos(entity, publishing));
// insert document variations
Database.BulkInsertRecords(GetDocumentVariationDtos(content, publishing, editedCultures));
Database.BulkInsertRecords(GetDocumentVariationDtos(entity, publishing, editedCultures));
}
// refresh content
content.SetCultureEdited(editedCultures);
entity.SetCultureEdited(editedCultures);
// trigger here, before we reset Published etc
OnUowRefreshedEntity(new ScopedEntityEventArgs(AmbientScope, entity));
@@ -399,23 +398,23 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// flip the entity's published property
// this also flips its published state
// note: what depends on variations (eg PublishNames) is managed directly by the content
if (content.PublishedState == PublishedState.Publishing)
if (entity.PublishedState == PublishedState.Publishing)
{
content.Published = true;
content.PublishTemplateId = content.TemplateId;
content.PublisherId = content.WriterId;
content.PublishName = content.Name;
content.PublishDate = content.UpdateDate;
entity.Published = true;
entity.PublishTemplateId = entity.TemplateId;
entity.PublisherId = entity.WriterId;
entity.PublishName = entity.Name;
entity.PublishDate = entity.UpdateDate;
SetEntityTags(entity, _tagRepository);
}
else if (content.PublishedState == PublishedState.Unpublishing)
else if (entity.PublishedState == PublishedState.Unpublishing)
{
content.Published = false;
content.PublishTemplateId = null;
content.PublisherId = null;
content.PublishName = null;
content.PublishDate = null;
entity.Published = false;
entity.PublishTemplateId = null;
entity.PublisherId = null;
entity.PublishName = null;
entity.PublishDate = null;
ClearEntityTags(entity, _tagRepository);
}
@@ -437,34 +436,33 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IContent entity)
{
// however, it's not just so we have access to AddingEntity
// there are tons of things at the end of the methods, that can only work with a true Content
// and basically, the repository requires a Content, not an IContent
var content = (Content)entity;
var entityBase = entity as EntityBase;
var isEntityDirty = entityBase != null && entityBase.IsDirty();
// check if we need to make any database changes at all
if ((content.PublishedState == PublishedState.Published || content.PublishedState == PublishedState.Unpublished)
&& !content.IsEntityDirty() && !content.IsAnyUserPropertyDirty())
if ((entity.PublishedState == PublishedState.Published || entity.PublishedState == PublishedState.Unpublished)
&& !isEntityDirty && !entity.IsAnyUserPropertyDirty())
return; // no change to save, do nothing, don't even update dates
// whatever we do, we must check that we are saving the current version
var version = Database.Fetch<ContentVersionDto>(SqlContext.Sql().Select<ContentVersionDto>().From<ContentVersionDto>().Where<ContentVersionDto>(x => x.Id == content.VersionId)).FirstOrDefault();
var version = Database.Fetch<ContentVersionDto>(SqlContext.Sql().Select<ContentVersionDto>().From<ContentVersionDto>().Where<ContentVersionDto>(x => x.Id == entity.VersionId)).FirstOrDefault();
if (version == null || !version.Current)
throw new InvalidOperationException("Cannot save a non-current version.");
// update
content.UpdatingEntity();
var publishing = content.PublishedState == PublishedState.Publishing;
entity.UpdatingEntity();
var publishing = entity.PublishedState == PublishedState.Publishing;
// check if we need to create a new version
if (publishing && content.PublishedVersionId > 0)
if (publishing && entity.PublishedVersionId > 0)
{
// published version is not published anymore
Database.Execute(Sql().Update<DocumentVersionDto>(u => u.Set(x => x.Published, false)).Where<DocumentVersionDto>(x => x.Id == content.PublishedVersionId));
Database.Execute(Sql().Update<DocumentVersionDto>(u => u.Set(x => x.Published, false)).Where<DocumentVersionDto>(x => x.Id == entity.PublishedVersionId));
}
// sanitize names
SanitizeNames(content, publishing);
SanitizeNames(entity, publishing);
// ensure that strings don't contain characters that are invalid in xml
// TODO: do we really want to keep doing this here?
@@ -504,13 +502,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// and, if publishing, insert new content & document version dtos
if (publishing)
{
content.PublishedVersionId = content.VersionId;
entity.PublishedVersionId = entity.VersionId;
contentVersionDto.Id = 0; // want a new id
contentVersionDto.Current = true; // current version
contentVersionDto.Text = content.Name;
contentVersionDto.Text = entity.Name;
Database.Insert(contentVersionDto);
content.VersionId = documentVersionDto.Id = contentVersionDto.Id; // get the new id
entity.VersionId = documentVersionDto.Id = contentVersionDto.Id; // get the new id
documentVersionDto.Published = false; // non-published version
Database.Insert(documentVersionDto);
@@ -518,31 +516,31 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// replace the property data (rather than updating)
// only need to delete for the version that existed, the new version (if any) has no property data yet
var versionToDelete = publishing ? content.PublishedVersionId : content.VersionId;
var versionToDelete = publishing ? entity.PublishedVersionId : entity.VersionId;
var deletePropertyDataSql = Sql().Delete<PropertyDataDto>().Where<PropertyDataDto>(x => x.VersionId == versionToDelete);
Database.Execute(deletePropertyDataSql);
// insert property data
var propertyDataDtos = PropertyFactory.BuildDtos(content.ContentType.Variations, content.VersionId, publishing ? content.PublishedVersionId : 0,
var propertyDataDtos = PropertyFactory.BuildDtos(entity.ContentType.Variations, entity.VersionId, publishing ? entity.PublishedVersionId : 0,
entity.Properties, LanguageRepository, out var edited, out var editedCultures);
foreach (var propertyDataDto in propertyDataDtos)
Database.Insert(propertyDataDto);
// if !publishing, we may have a new name != current publish name,
// also impacts 'edited'
if (!publishing && content.PublishName != content.Name)
if (!publishing && entity.PublishName != entity.Name)
edited = true;
if (content.ContentType.VariesByCulture())
if (entity.ContentType.VariesByCulture())
{
// bump dates to align cultures to version
if (publishing)
content.AdjustDates(contentVersionDto.VersionDate);
entity.AdjustDates(contentVersionDto.VersionDate);
// names also impact 'edited'
// ReSharper disable once UseDeconstruction
foreach (var cultureInfo in content.CultureInfos)
if (cultureInfo.Name != content.GetPublishName(cultureInfo.Culture))
foreach (var cultureInfo in entity.CultureInfos)
if (cultureInfo.Name != entity.GetPublishName(cultureInfo.Culture))
{
edited = true;
(editedCultures ?? (editedCultures = new HashSet<string>(StringComparer.OrdinalIgnoreCase))).Add(cultureInfo.Culture);
@@ -560,7 +558,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
Database.Execute(deleteContentVariations);
// replace the document version variations (rather than updating)
var deleteDocumentVariations = Sql().Delete<DocumentCultureVariationDto>().Where<DocumentCultureVariationDto>(x => x.NodeId == content.Id);
var deleteDocumentVariations = Sql().Delete<DocumentCultureVariationDto>().Where<DocumentCultureVariationDto>(x => x.NodeId == entity.Id);
Database.Execute(deleteDocumentVariations);
// TODO: NPoco InsertBulk issue?
@@ -570,32 +568,32 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// (same in PersistNewItem above)
// insert content variations
Database.BulkInsertRecords(GetContentVariationDtos(content, publishing));
Database.BulkInsertRecords(GetContentVariationDtos(entity, publishing));
// insert document variations
Database.BulkInsertRecords(GetDocumentVariationDtos(content, publishing, editedCultures));
Database.BulkInsertRecords(GetDocumentVariationDtos(entity, publishing, editedCultures));
}
// refresh content
content.SetCultureEdited(editedCultures);
entity.SetCultureEdited(editedCultures);
// update the document dto
// at that point, when un/publishing, the entity still has its old Published value
// so we need to explicitly update the dto to persist the correct value
if (content.PublishedState == PublishedState.Publishing)
if (entity.PublishedState == PublishedState.Publishing)
dto.Published = true;
else if (content.PublishedState == PublishedState.Unpublishing)
else if (entity.PublishedState == PublishedState.Unpublishing)
dto.Published = false;
content.Edited = dto.Edited = !dto.Published || edited; // if not published, always edited
entity.Edited = dto.Edited = !dto.Published || edited; // if not published, always edited
Database.Update(dto);
//update the schedule
if (content.IsPropertyDirty("ContentSchedule"))
PersistContentSchedule(content, true);
if (entity.IsPropertyDirty("ContentSchedule"))
PersistContentSchedule(entity, true);
// if entity is publishing, update tags, else leave tags there
// means that implicitly unpublished, or trashed, entities *still* have tags in db
if (content.PublishedState == PublishedState.Publishing)
if (entity.PublishedState == PublishedState.Publishing)
SetEntityTags(entity, _tagRepository);
// trigger here, before we reset Published etc
@@ -603,23 +601,23 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// flip the entity's published property
// this also flips its published state
if (content.PublishedState == PublishedState.Publishing)
if (entity.PublishedState == PublishedState.Publishing)
{
content.Published = true;
content.PublishTemplateId = content.TemplateId;
content.PublisherId = content.WriterId;
content.PublishName = content.Name;
content.PublishDate = content.UpdateDate;
entity.Published = true;
entity.PublishTemplateId = entity.TemplateId;
entity.PublisherId = entity.WriterId;
entity.PublishName = entity.Name;
entity.PublishDate = entity.UpdateDate;
SetEntityTags(entity, _tagRepository);
}
else if (content.PublishedState == PublishedState.Unpublishing)
else if (entity.PublishedState == PublishedState.Unpublishing)
{
content.Published = false;
content.PublishTemplateId = null;
content.PublisherId = null;
content.PublishName = null;
content.PublishDate = null;
entity.Published = false;
entity.PublishTemplateId = null;
entity.PublisherId = null;
entity.PublishName = null;
entity.PublishDate = null;
ClearEntityTags(entity, _tagRepository);
}
@@ -1335,7 +1333,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
#region Utilities
private void SanitizeNames(Content content, bool publishing)
private void SanitizeNames(IContent content, bool publishing)
{
// a content item *must* have an invariant name, and invariant published name
// else we just cannot write the invariant rows (node, content version...) to the database
@@ -1400,7 +1398,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
x.NodeId != SqlTemplate.Arg<int>("id"))
.OrderBy<ContentVersionCultureVariationDto>(x => x.LanguageId));
private void EnsureVariantNamesAreUnique(Content content, bool publishing)
private void EnsureVariantNamesAreUnique(IContent content, bool publishing)
{
if (!EnsureUniqueNaming || !content.ContentType.VariesByCulture() || content.CultureInfos.Count == 0) return;
@@ -6,6 +6,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Scoping;
@@ -101,7 +102,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (languageExists == 0) throw new NullReferenceException("No language exists with id " + entity.LanguageId.Value);
}
((UmbracoDomain)entity).AddingEntity();
entity.AddingEntity();
var factory = new DomainModelFactory();
var dto = factory.BuildDto(entity);
@@ -120,7 +121,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IDomain entity)
{
((UmbracoDomain)entity).UpdatingEntity();
entity.UpdatingEntity();
var exists = Database.ExecuteScalar<int>("SELECT COUNT(*) FROM umbracoDomain WHERE domainName = @domainName AND umbracoDomain.id <> @id",
new { domainName = entity.DomainName, id = entity.Id });
@@ -139,7 +139,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IIdentityUserLogin entity)
{
((EntityBase)entity).AddingEntity();
entity.AddingEntity();
var dto = ExternalLoginFactory.BuildDto(entity);
@@ -151,7 +151,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IIdentityUserLogin entity)
{
((EntityBase)entity).UpdatingEntity();
entity.UpdatingEntity();
var dto = ExternalLoginFactory.BuildDto(entity);
@@ -129,7 +129,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (entity.IsoCode.IsNullOrWhiteSpace() || entity.CultureName.IsNullOrWhiteSpace())
throw new InvalidOperationException("Cannot save a language without an ISO code and a culture name.");
((EntityBase) entity).AddingEntity();
entity.AddingEntity();
// deal with entity becoming the new default entity
if (entity.IsDefault)
@@ -156,7 +156,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (entity.IsoCode.IsNullOrWhiteSpace() || entity.CultureName.IsNullOrWhiteSpace())
throw new InvalidOperationException("Cannot save a language without an ISO code and a culture name.");
((EntityBase) entity).UpdatingEntity();
entity.UpdatingEntity();
if (entity.IsDefault)
{
@@ -132,7 +132,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IMacro entity)
{
((EntityBase)entity).AddingEntity();
entity.AddingEntity();
var dto = MacroFactory.BuildDto(entity);
@@ -152,7 +152,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IMacro entity)
{
((EntityBase)entity).UpdatingEntity();
entity.UpdatingEntity();
;
var dto = MacroFactory.BuildDto(entity);
@@ -8,6 +8,7 @@ using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -217,7 +218,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IMedia entity)
{
var media = (Models.Media) entity;
media.AddingEntity();
entity.AddingEntity();
// ensure unique name on the same level
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name);
@@ -5,6 +5,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Scoping;
@@ -102,7 +103,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IMediaType entity)
{
((MediaType)entity).AddingEntity();
entity.AddingEntity();
PersistNewBaseContentType(entity);
@@ -114,7 +115,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
ValidateAlias(entity);
//Updates Modified date
((MediaType)entity).UpdatingEntity();
entity.UpdatingEntity();
//Look up parent to get and set the correct Path if ParentId has changed
if (entity.IsPropertyDirty("ParentId"))
@@ -6,6 +6,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -91,8 +92,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IMemberGroup entity)
{
//Save to db
entity.AddingEntity();
var group = (MemberGroup)entity;
group.AddingEntity();
var dto = MemberGroupFactory.BuildDto(group);
var o = Database.IsNew(dto) ? Convert.ToInt32(Database.Insert(dto)) : Database.Update(dto);
group.Id = dto.NodeId; //Set Id on entity to ensure an Id is set
@@ -6,6 +6,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -232,8 +233,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IMember entity)
{
if (entity.ProviderUserKey == null)
{
entity.ProviderUserKey = entity.Key;
}
entity.AddingEntity();
var member = (Member) entity;
member.AddingEntity();
// ensure that strings don't contain characters that are invalid in xml
// TODO: do we really want to keep doing this here?
@@ -5,6 +5,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -131,12 +132,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
ValidateAlias(entity);
((MemberType)entity).AddingEntity();
entity.AddingEntity();
//set a default icon if one is not specified
if (entity.Icon.IsNullOrWhiteSpace())
{
entity.Icon = "icon-user";
entity.Icon = Constants.Icons.Member;
}
//By Convention we add 9 standard PropertyTypes to an Umbraco MemberType
@@ -165,7 +166,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
ValidateAlias(entity);
//Updates Modified date
((MemberType)entity).UpdatingEntity();
entity.UpdatingEntity();
//Look up parent to get and set the correct Path if ParentId has changed
if (entity.IsPropertyDirty("ParentId"))
@@ -224,6 +225,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
//this reset's its current data type reference which will be re-assigned based on the property editor assigned on the next line
propertyType.DataTypeId = 0;
propertyType.DataTypeKey = default;
}
}
}
@@ -5,6 +5,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -134,7 +134,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IRelation entity)
{
((EntityBase)entity).AddingEntity();
entity.AddingEntity();
var factory = new RelationFactory(entity.RelationType);
var dto = factory.BuildDto(entity);
@@ -147,7 +147,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IRelation entity)
{
((EntityBase)entity).UpdatingEntity();
entity.UpdatingEntity();
var factory = new RelationFactory(entity.RelationType);
var dto = factory.BuildDto(entity);
@@ -133,7 +133,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IRelationType entity)
{
((EntityBase)entity).AddingEntity();
entity.AddingEntity();
var dto = RelationTypeFactory.BuildDto(entity);
@@ -145,7 +145,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IRelationType entity)
{
((EntityBase)entity).UpdatingEntity();
entity.UpdatingEntity();
var dto = RelationTypeFactory.BuildDto(entity);
Database.Update(dto);
@@ -5,6 +5,7 @@ using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
@@ -96,7 +97,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IServerRegistration entity)
{
((ServerRegistration)entity).AddingEntity();
entity.AddingEntity();
var dto = ServerRegistrationFactory.BuildDto(entity);
@@ -108,7 +109,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IServerRegistration entity)
{
((ServerRegistration)entity).UpdatingEntity();
entity.UpdatingEntity();
var dto = ServerRegistrationFactory.BuildDto(entity);
@@ -85,7 +85,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
/// <inheritdoc />
protected override void PersistNewItem(ITag entity)
{
((EntityBase)entity).AddingEntity();
entity.AddingEntity();
var dto = TagFactory.BuildDto(entity);
var id = Convert.ToInt32(Database.Insert(dto));
@@ -97,7 +97,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
/// <inheritdoc />
protected override void PersistUpdatedItem(ITag entity)
{
((EntityBase)entity).UpdatingEntity();
entity.UpdatingEntity();
var dto = TagFactory.BuildDto(entity);
Database.Update(dto);
@@ -290,7 +290,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistNewItem(IUserGroup entity)
{
((UserGroup) entity).AddingEntity();
entity.AddingEntity();
var userGroupDto = UserGroupFactory.BuildDto(entity);
@@ -304,7 +304,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
protected override void PersistUpdatedItem(IUserGroup entity)
{
((UserGroup) entity).UpdatingEntity();
entity.UpdatingEntity();
var userGroupDto = UserGroupFactory.BuildDto(entity);
@@ -445,7 +445,7 @@ ORDER BY colName";
return;
}
((User) entity).AddingEntity();
entity.AddingEntity();
// ensure security stamp if missing
if (entity.SecurityStamp.IsNullOrWhiteSpace())
@@ -495,7 +495,7 @@ ORDER BY colName";
protected override void PersistUpdatedItem(IUser entity)
{
// updates Modified date
((User) entity).UpdatingEntity();
entity.UpdatingEntity();
// ensure security stamp if missing
if (entity.SecurityStamp.IsNullOrWhiteSpace())
@@ -0,0 +1,10 @@
namespace Umbraco.Core.PropertyEditors
{
/// <summary>
/// Marker interface for any editor configuration that supports Ignoring user start nodes
/// </summary>
internal interface IIgnoreUserStartNodesConfig
{
bool IgnoreUserStartNodes { get; set; }
}
}
@@ -9,7 +9,14 @@ namespace Umbraco.Core
public static class PublishedModelFactoryExtensions
{
/// <summary>
/// Executes an action with a safe live factory/
/// Returns true if the current <see cref="IPublishedModelFactory"/> is an implementation of <see cref="ILivePublishedModelFactory"/>
/// </summary>
/// <param name="factory"></param>
/// <returns></returns>
public static bool IsLiveFactory(this IPublishedModelFactory factory) => factory is ILivePublishedModelFactory;
/// <summary>
/// Executes an action with a safe live factory
/// </summary>
/// <remarks>
/// <para>If the factory is a live factory, ensures it is refreshed and locked while executing the action.</para>
@@ -20,6 +27,7 @@ namespace Umbraco.Core
{
lock (liveFactory.SyncRoot)
{
//Call refresh on the live factory to re-compile the models
liveFactory.Refresh();
action();
}
@@ -6,9 +6,25 @@ namespace Umbraco.Core.Services.Changes
public enum ContentTypeChangeTypes : byte
{
None = 0,
Create = 1, // item type has been created, no impact
RefreshMain = 2, // changed, impacts content (adding property or composition does NOT)
RefreshOther = 4, // changed, other changes
Remove = 8 // item type has been removed
/// <summary>
/// Item type has been created, no impact
/// </summary>
Create = 1,
/// <summary>
/// Content type changes impact only the Content type being saved
/// </summary>
RefreshMain = 2,
/// <summary>
/// Content type changes impacts the content type being saved and others used that are composed of it
/// </summary>
RefreshOther = 4, // changed, other change
/// <summary>
/// Content type was removed
/// </summary>
Remove = 8
}
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
@@ -11,6 +12,42 @@ namespace Umbraco.Core.Services
/// </summary>
public static class ContentServiceExtensions
{
#region RTE Anchor values
private static readonly Regex AnchorRegex = new Regex("<a id=\"(.*?)\">", RegexOptions.Compiled);
internal static IEnumerable<string> GetAnchorValuesFromRTEs(this IContentService contentService, int id, string culture = "*")
{
var result = new List<string>();
var content = contentService.GetById(id);
foreach (var contentProperty in content.Properties)
{
if (contentProperty.PropertyType.PropertyEditorAlias.InvariantEquals(Constants.PropertyEditors.Aliases.TinyMce))
{
var value = contentProperty.GetValue(culture)?.ToString();
if (!string.IsNullOrEmpty(value))
{
result.AddRange(contentService.GetAnchorValuesFromRTEContent(value));
}
}
}
return result;
}
internal static IEnumerable<string> GetAnchorValuesFromRTEContent(this IContentService contentService, string rteContent)
{
var result = new List<string>();
var matches = AnchorRegex.Matches(rteContent);
foreach (Match match in matches)
{
result.Add(match.Value.Split('\"')[1]);
}
return result;
}
#endregion
public static IEnumerable<IContent> GetByIds(this IContentService contentService, IEnumerable<Udi> ids)
{
var guids = new List<GuidUdi>();
@@ -0,0 +1,21 @@
using System;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Services
{
internal static class DateTypeServiceExtensions
{
public static bool IsDataTypeIgnoringUserStartNodes(this IDataTypeService dataTypeService, Guid key)
{
if (DataTypeExtensions.IsBuildInDataType(key)) return false; //built in ones can never be ignoring start nodes
var dataType = dataTypeService.GetDataType(key);
if (dataType != null && dataType.Configuration is IIgnoreUserStartNodesConfig ignoreStartNodesConfig)
return ignoreStartNodesConfig.IgnoreUserStartNodes;
return false;
}
}
}
@@ -526,5 +526,6 @@ namespace Umbraco.Core.Services
OperationResult Rollback(int id, int versionId, string culture = "*", int userId = Constants.Security.SuperUserId);
#endregion
}
}
@@ -4,6 +4,7 @@ using Umbraco.Core.Models;
namespace Umbraco.Core.Services
{
/// <summary>
/// Defines the DataType Service, which is an easy access to operations involving <see cref="IDataType"/>
/// </summary>
@@ -51,8 +51,8 @@ namespace Umbraco.Core.Services.Implement
using (var scope = ScopeProvider.CreateScope())
{
var result = sinceDate.HasValue == false
? _auditRepository.Get(Query<IAuditItem>().Where(x => x.UserId == userId && x.AuditType == type))
: _auditRepository.Get(Query<IAuditItem>().Where(x => x.UserId == userId && x.AuditType == type && x.CreateDate >= sinceDate.Value));
? _auditRepository.Get(type, Query<IAuditItem>().Where(x => x.UserId == userId))
: _auditRepository.Get(type, Query<IAuditItem>().Where(x => x.UserId == userId && x.CreateDate >= sinceDate.Value));
scope.Complete();
return result;
}
@@ -63,8 +63,8 @@ namespace Umbraco.Core.Services.Implement
using (var scope = ScopeProvider.CreateScope())
{
var result = sinceDate.HasValue == false
? _auditRepository.Get(Query<IAuditItem>().Where(x => x.AuditType == type))
: _auditRepository.Get(Query<IAuditItem>().Where(x => x.AuditType == type && x.CreateDate >= sinceDate.Value));
? _auditRepository.Get(type, Query<IAuditItem>())
: _auditRepository.Get(type, Query<IAuditItem>().Where(x => x.CreateDate >= sinceDate.Value));
scope.Complete();
return result;
}
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using Umbraco.Core.Events;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
@@ -31,6 +32,7 @@ namespace Umbraco.Core.Services.Implement
private IQuery<IContent> _queryNotTrashed;
//TODO: The non-lazy object should be injected
private readonly Lazy<PropertyValidationService> _propertyValidationService = new Lazy<PropertyValidationService>(() => new PropertyValidationService());
#region Constructors
@@ -3024,5 +3026,8 @@ namespace Umbraco.Core.Services.Implement
}
#endregion
}
}
+10 -2
View File
@@ -13,7 +13,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
@@ -23,7 +23,7 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@@ -55,6 +55,11 @@
</ItemGroup>
<ItemGroup>
<!-- note: NuGet deals with transitive references now -->
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>1.0.0-beta2-19324-01</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Serilog.Sinks.Async">
<Version>1.3.0</Version>
</PackageReference>
@@ -237,6 +242,7 @@
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RenamingPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RichTextPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\MergeDateAndDateTimePropertyEditor.cs" />
<Compile Include="Models\Entities\EntityExtensions.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorBase.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueDto.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\PropertyEditorsMigrationBase.cs" />
@@ -258,6 +264,7 @@
<Compile Include="Models\PublishedContent\ILivePublishedModelFactory.cs" />
<Compile Include="Models\PublishedContent\IPublishedContentType.cs" />
<Compile Include="Models\PublishedContent\IPublishedPropertyType.cs" />
<Compile Include="PropertyEditors\IIgnoreUserStartNodesConfig.cs" />
<Compile Include="PublishedContentExtensions.cs" />
<Compile Include="Models\PublishedContent\UrlMode.cs" />
<Compile Include="Persistence\Dtos\PropertyTypeCommonDto.cs" />
@@ -267,6 +274,7 @@
<Compile Include="PropertyEditors\DateTimeConfiguration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RenameLabelAndRichTextPropertyEditorAliases.cs" />
<Compile Include="PublishedModelFactoryExtensions.cs" />
<Compile Include="Services\DateTypeServiceExtensions.cs" />
<Compile Include="Services\PropertyValidationService.cs" />
<Compile Include="Composing\TypeCollectionBuilderBase.cs" />
<Compile Include="TypeLoaderExtensions.cs" />
+7 -2
View File
@@ -13,7 +13,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
@@ -23,7 +23,7 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@@ -49,6 +49,11 @@
<ItemGroup>
<!-- note: NuGet deals with transitive references now -->
<PackageReference Include="Examine" Version="1.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>1.0.0-beta2-19324-01</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="NPoco" Version="3.9.4" />
</ItemGroup>
@@ -14,7 +14,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
@@ -22,7 +22,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@@ -103,6 +103,11 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>2.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>1.0.0-beta2-19324-01</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
@@ -327,7 +327,7 @@ AnotherContentFinder
public void Resolves_RestExtensions()
{
var types = _manager.ResolveRestExtensions();
Assert.AreEqual(3, types.Count());
Assert.AreEqual(2, types.Count());
}
[Test]
@@ -264,6 +264,74 @@ namespace Umbraco.Tests.PublishedContent
yield return CreateKit(12, 4, 2);
}
private IEnumerable<ContentNodeKit> GetVariantWithDraftKits()
{
var paths = new Dictionary<int, string> { { -1, "-1" } };
Dictionary<string, CultureVariation> GetCultureInfos(int id, DateTime now)
{
var en = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
var fr = new[] { 1, 3, 4, 6, 7, 9, 10, 12 };
var infos = new Dictionary<string, CultureVariation>();
if (en.Contains(id))
infos["en-US"] = new CultureVariation { Name = "N" + id + "-" + "en-US", Date = now, IsDraft = false };
if (fr.Contains(id))
infos["fr-FR"] = new CultureVariation { Name = "N" + id + "-" + "fr-FR", Date = now, IsDraft = false };
return infos;
}
ContentNodeKit CreateKit(int id, int parentId, int sortOrder)
{
if (!paths.TryGetValue(parentId, out var parentPath))
throw new Exception("Unknown parent.");
var path = paths[id] = parentPath + "," + id;
var level = path.Count(x => x == ',');
var now = DateTime.Now;
ContentData CreateContentData(bool published) => new ContentData
{
Name = "N" + id,
Published = published,
TemplateId = 0,
VersionId = 1,
VersionDate = now,
WriterId = 0,
Properties = new Dictionary<string, PropertyData[]>(),
CultureInfos = GetCultureInfos(id, now)
};
var withDraft = id%2==0;
var withPublished = !withDraft;
return new ContentNodeKit
{
ContentTypeId = _contentTypeVariant.Id,
Node = new ContentNode(id, Guid.NewGuid(), level, path, sortOrder, parentId, DateTime.Now, 0),
DraftData = withDraft ? CreateContentData(false) : null,
PublishedData = withPublished ? CreateContentData(true) : null
};
}
yield return CreateKit(1, -1, 1);
yield return CreateKit(2, -1, 2);
yield return CreateKit(3, -1, 3);
yield return CreateKit(4, 1, 1);
yield return CreateKit(5, 1, 2);
yield return CreateKit(6, 1, 3);
yield return CreateKit(7, 2, 3);
yield return CreateKit(8, 2, 2);
yield return CreateKit(9, 2, 1);
yield return CreateKit(10, 3, 1);
yield return CreateKit(11, 4, 1);
yield return CreateKit(12, 4, 2);
}
[Test]
public void EmptyTest()
{
@@ -747,6 +815,25 @@ namespace Umbraco.Tests.PublishedContent
AssertDocuments(documents, "N9", "N8", "N7");
}
[Test]
public void AtRootTest()
{
Init(GetVariantWithDraftKits());
var snapshot = _snapshotService.CreatePublishedSnapshot(previewToken: null);
_snapshotAccessor.PublishedSnapshot = snapshot;
_variationAccesor.VariationContext = new VariationContext("en-US");
// N2 is draft only
var documents = snapshot.Content.GetAtRoot().ToArray();
AssertDocuments(documents, "N1-en-US", /*"N2-en-US",*/ "N3-en-US");
documents = snapshot.Content.GetAtRoot(true).ToArray();
AssertDocuments(documents, "N1-en-US", "N2-en-US", "N3-en-US");
}
private void AssertDocuments(IPublishedContent[] documents, params string[] names)
{
Assert.AreEqual(names.Length, documents.Length);
@@ -4,6 +4,7 @@ using NUnit.Framework;
using Umbraco.Core.Services.Implement;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.Testing;
using Umbraco.Core.Models;
namespace Umbraco.Tests.Services
{
@@ -48,5 +49,19 @@ namespace Umbraco.Tests.Services
Assert.AreEqual(123 + 5, entries[0].PerformingUserId);
Assert.AreEqual(123 + 4, entries[1].PerformingUserId);
}
[Test]
public void CanReadEntries()
{
var yesterday = DateTime.UtcNow.AddDays(-1);
for (var i = 0; i < 10; i++)
{
yesterday = yesterday.AddMinutes(1);
ServiceContext.AuditService.Add(AuditType.Unpublish, -1, 33, "", "blah");
}
var logs = ServiceContext.AuditService.GetUserLogs(-1, AuditType.Unpublish);
}
}
}
@@ -248,6 +248,11 @@ namespace Umbraco.Tests.Testing
// register empty content apps collection
Composition.WithCollectionBuilder<ContentAppFactoryCollectionBuilder>();
// manifest
Composition.ManifestValueValidators();
Composition.ManifestFilters();
}
protected virtual void ComposeMapper(bool configure)
@@ -77,6 +77,19 @@ namespace Umbraco.Tests.Web.Controllers
var entityService = new Mock<IEntityService>();
entityService.Setup(x => x.GetAllPaths(UmbracoObjectTypes.Document, It.IsAny<int[]>()))
.Returns((UmbracoObjectTypes objType, int[] ids) => ids.Select(x => new TreeEntityPath { Path = $"-1,{x}", Id = x }).ToList());
entityService.Setup(x => x.GetKey(It.IsAny<int>(), UmbracoObjectTypes.DataType))
.Returns((int id, UmbracoObjectTypes objType) =>
{
switch (id)
{
case Constants.DataTypes.Textbox:
return Attempt.Succeed(Constants.DataTypes.Guids.TextstringGuid);
case Constants.DataTypes.RichtextEditor:
return Attempt.Succeed(Constants.DataTypes.Guids.RichtextEditorGuid);
}
return Attempt.Fail<Guid>();
});
var dataTypeService = new Mock<IDataTypeService>();
dataTypeService.Setup(service => service.GetDataType(It.IsAny<int>()))
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -35,7 +35,7 @@
"lazyload-js": "1.0.0",
"moment": "2.22.2",
"ng-file-upload": "12.2.13",
"nouislider": "12.1.0",
"nouislider": "14.0.1",
"npm": "^6.4.1",
"signalr": "2.4.0",
"spectrum-colorpicker": "1.8.0",
@@ -95,7 +95,8 @@ Use this directive to render an umbraco button. The directive can be used to gen
size: "@?",
alias: "@?",
addEllipsis: "@?",
showCaret: "@?"
showCaret: "@?",
autoFocus: "@?"
}
});
@@ -101,14 +101,14 @@ angular.module('umbraco.directives')
var eventBindings = [];
function oneTimeClick(event) {
var el = event.target.nodeName;
//ignore link and button clicks
var els = ["INPUT", "A", "BUTTON"];
if (els.indexOf(el) >= 0) { return; }
// ignore clicks on button groups toggles (i.e. the save and publish button)
var parents = $(event.target).closest("[data-element='button-group-toggle']");
if (parents.length > 0) {
return;
}
// ignore clicks on new overlay
var parents = $(event.target).parents("a,button,.umb-overlay,.umb-tour");
parents = $(event.target).parents(".umb-overlay,.umb-tour");
if (parents.length > 0) {
return;
}
@@ -131,12 +131,19 @@ angular.module('umbraco.directives')
return;
}
// ignore clicks on dialog actions
var actions = $(event.target).parents(".umb-action");
if (actions.length === 1) {
return;
}
//ignore clicks inside this element
if ($(element).has($(event.target)).length > 0) {
return;
}
angularHelper.safeApply(scope, attrs.onOutsideClick);
// please to not use angularHelper.safeApply here, it won't work
scope.$apply(attrs.onOutsideClick);
}
@@ -9,8 +9,10 @@ angular.module("umbraco.directives")
}
};
$timeout(function() {
update();
});
if (attr.umbAutoFocus !== "false") {
$timeout(function() {
update();
});
}
};
});
@@ -4,7 +4,9 @@ angular.module("umbraco.directives")
scope: {
uniqueId: '=',
value: '=',
configuration: "="
configuration: "=", //this is the RTE configuration
datatypeKey: '@',
ignoreUserStartNodes: '@'
},
templateUrl: 'views/components/grid/grid-rte.html',
replace: true,
@@ -35,6 +37,14 @@ angular.module("umbraco.directives")
editorConfig.maxImageSize = tinyMceService.defaultPrevalues().maxImageSize;
}
//ensure the grid's global config is being passed up to the RTE, these 2 properties need to be in this format
//since below we are just passing up `scope` as the actual model and for 2 way binding to work with `value` that
//is the way it needs to be unless we start adding watchers. We'll just go with this for now but it's super ugly.
scope.config = {
ignoreUserStartNodes: scope.ignoreUserStartNodes === "true"
}
scope.dataTypeKey = scope.datatypeKey; //Yes - this casing is rediculous, but it's because the var starts with `data` so it can't be `data-type-id` :/
//stores a reference to the editor
var tinyMceEditor = null;
@@ -311,9 +311,8 @@ Opens an overlay to show a custom YSOD. </br>
var submitOnEnter = document.activeElement.hasAttribute("overlay-submit-on-enter");
var submitOnEnterValue = submitOnEnter ? document.activeElement.getAttribute("overlay-submit-on-enter") : "";
if(clickableElements.indexOf(activeElementType) === 0) {
document.activeElement.trigger("click");
event.preventDefault();
if(clickableElements.indexOf(activeElementType) >= 0) {
// don't do anything, let the browser Enter key handle this
} else if(activeElementType === "TEXTAREA" && !submitOnEnter) {
@@ -1,16 +1,20 @@
(function() {
'use strict';
function UmbContextDialog(navigationService, keyboardService) {
function UmbContextDialog(navigationService, keyboardService, localizationService, overlayService) {
function link($scope) {
$scope.outSideClick = function() {
navigationService.hideDialog();
}
keyboardService.bind("esc", function() {
navigationService.hideDialog();
$scope.dialog = {
confirmDiscardChanges: false
};
$scope.outSideClick = function() {
hide();
};
keyboardService.bind("esc", function () {
hide();
});
//ensure to unregister from all events!
@@ -18,6 +22,35 @@
keyboardService.unbind("esc");
});
function hide() {
if ($scope.dialog.confirmDiscardChanges) {
localizationService.localizeMany(["prompt_unsavedChanges", "prompt_unsavedChangesWarning", "prompt_discardChanges", "prompt_stay"]).then(
function (values) {
var overlay = {
"view": "default",
"title": values[0],
"content": values[1],
"disableBackdropClick": true,
"disableEscKey": true,
"submitButtonLabel": values[2],
"closeButtonLabel": values[3],
submit: function () {
overlayService.close();
navigationService.hideDialog();
},
close: function () {
overlayService.close();
}
};
overlayService.open(overlay);
}
);
}
else {
navigationService.hideDialog();
}
}
}
var directive = {
@@ -92,10 +92,6 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
}
}
// TODO: This isn't used!?
function clearCache(section) {
treeService.clearCache({ section: section });
}
/**
* Re-loads the tree with the updated parameters
@@ -12,6 +12,7 @@ function treeSearchBox(localizationService, searchService, $q) {
searchFromName: "@",
showSearch: "@",
section: "@",
datatypeKey: "@",
hideSearchCallback: "=",
searchCallback: "="
},
@@ -34,6 +35,7 @@ function treeSearchBox(localizationService, searchService, $q) {
scope.showSearch = "false";
}
//used to cancel any request in progress if another one needs to take it's place
var canceler = null;
@@ -60,6 +62,11 @@ function treeSearchBox(localizationService, searchService, $q) {
searchArgs["searchFrom"] = scope.searchFromId;
}
//append dataTypeId value if there is one
if (scope.datatypeKey) {
searchArgs["dataTypeKey"] = scope.datatypeKey;
}
searcher(searchArgs).then(function (data) {
scope.searchCallback(data);
//set back to null so it can be re-created
@@ -474,6 +474,11 @@
if (!property.inherited) {
var oldPropertyModel = angular.copy(property);
if (oldPropertyModel.allowCultureVariant === undefined) {
// this is necessary for comparison when detecting changes to the property
oldPropertyModel.allowCultureVariant = scope.model.allowCultureVariant;
oldPropertyModel.alias = "";
}
var propertyModel = angular.copy(property);
var propertySettings = {
@@ -71,7 +71,7 @@
}
// set published state for content
if (c.metaData) {
c.hasChildren = c.metaData.HasChildren;
c.hasChildren = c.metaData.hasChildren;
if(scope.entityType === "Document") {
c.published = c.metaData.IsPublished;
}
@@ -79,7 +79,7 @@
// filter items if there is a filter and it's not advanced
// ** ignores advanced filter at the moment
if (scope.entityTypeFilter && !scope.entityTypeFilter.filterAdvanced) {
if (scope.entityTypeFilter && scope.entityTypeFilter.filter && !scope.entityTypeFilter.filterAdvanced) {
var a = scope.entityTypeFilter.filter.toLowerCase().replace(/\s/g, '').split(',');
var found = a.indexOf(c.metaData.ContentTypeAlias.toLowerCase()) >= 0;
@@ -1,27 +1,27 @@
/**
* @ngdoc service
* @name umbraco.resources.contentResource
* @description Handles all transactions of content data
* from the angular application to the Umbraco database, using the Content WebApi controller
*
* all methods returns a resource promise async, so all operations won't complete untill .then() is completed.
*
* @requires $q
* @requires $http
* @requires umbDataFormatter
* @requires umbRequestHelper
*
* ##usage
* To use, simply inject the contentResource into any controller or service that needs it, and make
* sure the umbraco.resources module is accesible - which it should be by default.
*
* <pre>
* contentResource.getById(1234)
* .then(function(data) {
* $scope.content = data;
* @ngdoc service
* @name umbraco.resources.contentResource
* @description Handles all transactions of content data
* from the angular application to the Umbraco database, using the Content WebApi controller
*
* all methods returns a resource promise async, so all operations won't complete untill .then() is completed.
*
* @requires $q
* @requires $http
* @requires umbDataFormatter
* @requires umbRequestHelper
*
* ##usage
* To use, simply inject the contentResource into any controller or service that needs it, and make
* sure the umbraco.resources module is accesible - which it should be by default.
*
* <pre>
* contentResource.getById(1234)
* .then(function(data) {
* $scope.content = data;
* });
* </pre>
**/
**/
function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
@@ -79,27 +79,27 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#sort
* @methodOf umbraco.resources.contentResource
*
* @description
* Sorts all children below a given parent node id, based on a collection of node-ids
*
* ##usage
* <pre>
* var ids = [123,34533,2334,23434];
* contentResource.sort({ parentId: 1244, sortedIds: ids })
* .then(function() {
* $scope.complete = true;
* });
* @ngdoc method
* @name umbraco.resources.contentResource#sort
* @methodOf umbraco.resources.contentResource
*
* @description
* Sorts all children below a given parent node id, based on a collection of node-ids
*
* ##usage
* <pre>
* var ids = [123,34533,2334,23434];
* contentResource.sort({ parentId: 1244, sortedIds: ids })
* .then(function() {
* $scope.complete = true;
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.parentId the ID of the parent node
* @param {Array} options.sortedIds array of node IDs as they should be sorted
* @returns {Promise} resourcePromise object.
*
*/
* @param {Object} args arguments object
* @param {Int} args.parentId the ID of the parent node
* @param {Array} options.sortedIds array of node IDs as they should be sorted
* @returns {Promise} resourcePromise object.
*
*/
sort: function (args) {
if (!args) {
throw "args cannot be null";
@@ -121,28 +121,28 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#move
* @methodOf umbraco.resources.contentResource
*
* @description
* Moves a node underneath a new parentId
*
* ##usage
* <pre>
* contentResource.move({ parentId: 1244, id: 123 })
* .then(function() {
* alert("node was moved");
* }, function(err){
* @ngdoc method
* @name umbraco.resources.contentResource#move
* @methodOf umbraco.resources.contentResource
*
* @description
* Moves a node underneath a new parentId
*
* ##usage
* <pre>
* contentResource.move({ parentId: 1244, id: 123 })
* .then(function() {
* alert("node was moved");
* }, function(err){
* alert("node didnt move:" + err.data.Message);
* });
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.idd the ID of the node to move
* @param {Int} args.parentId the ID of the parent node to move to
* @returns {Promise} resourcePromise object.
*
*/
* @param {Object} args arguments object
* @param {Int} args.idd the ID of the node to move
* @param {Int} args.parentId the ID of the parent node to move to
* @returns {Promise} resourcePromise object.
*
*/
move: function (args) {
if (!args) {
throw "args cannot be null";
@@ -164,29 +164,29 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#copy
* @methodOf umbraco.resources.contentResource
*
* @description
* Copies a node underneath a new parentId
*
* ##usage
* <pre>
* contentResource.copy({ parentId: 1244, id: 123 })
* .then(function() {
* alert("node was copied");
* }, function(err){
* @ngdoc method
* @name umbraco.resources.contentResource#copy
* @methodOf umbraco.resources.contentResource
*
* @description
* Copies a node underneath a new parentId
*
* ##usage
* <pre>
* contentResource.copy({ parentId: 1244, id: 123 })
* .then(function() {
* alert("node was copied");
* }, function(err){
* alert("node wasnt copy:" + err.data.Message);
* });
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.id the ID of the node to copy
* @param {Int} args.parentId the ID of the parent node to copy to
* @param {Boolean} args.relateToOriginal if true, relates the copy to the original through the relation api
* @returns {Promise} resourcePromise object.
*
*/
* @param {Object} args arguments object
* @param {Int} args.id the ID of the node to copy
* @param {Int} args.parentId the ID of the parent node to copy to
* @param {Boolean} args.relateToOriginal if true, relates the copy to the original through the relation api
* @returns {Promise} resourcePromise object.
*
*/
copy: function (args) {
if (!args) {
throw "args cannot be null";
@@ -205,26 +205,26 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @ngdoc method
* @name umbraco.resources.contentResource#unpublish
* @methodOf umbraco.resources.contentResource
*
* @description
* Unpublishes a content item with a given Id
*
* ##usage
* <pre>
* @methodOf umbraco.resources.contentResource
*
* @description
* Unpublishes a content item with a given Id
*
* ##usage
* <pre>
* contentResource.unpublish(1234)
* .then(function() {
* alert("node was unpulished");
* }, function(err){
* .then(function() {
* alert("node was unpulished");
* }, function(err){
* alert("node wasnt unpublished:" + err.data.Message);
* });
* });
* </pre>
* @param {Int} id the ID of the node to unpublish
* @returns {Promise} resourcePromise object.
*
*/
* @param {Int} id the ID of the node to unpublish
* @returns {Promise} resourcePromise object.
*
*/
unpublish: function (id, cultures) {
if (!id) {
throw "id cannot be null";
@@ -242,7 +242,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
'Failed to publish content with id ' + id);
},
/**
* @ngdoc method
* @ngdoc method
* @name umbraco.resources.contentResource#getCultureAndDomains
* @methodOf umbraco.resources.contentResource
*
@@ -281,23 +281,23 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#emptyRecycleBin
* @methodOf umbraco.resources.contentResource
*
* @description
* Empties the content recycle bin
*
* ##usage
* <pre>
* contentResource.emptyRecycleBin()
* .then(function() {
* alert('its empty!');
* });
* @name umbraco.resources.contentResource#emptyRecycleBin
* @methodOf umbraco.resources.contentResource
*
* @description
* Empties the content recycle bin
*
* ##usage
* <pre>
* contentResource.emptyRecycleBin()
* .then(function() {
* alert('its empty!');
* });
* </pre>
*
* @returns {Promise} resourcePromise object.
*
*/
* @returns {Promise} resourcePromise object.
*
*/
emptyRecycleBin: function () {
return umbRequestHelper.resourcePromise(
$http.post(
@@ -308,25 +308,25 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#deleteById
* @methodOf umbraco.resources.contentResource
*
* @description
* Deletes a content item with a given id
*
* ##usage
* <pre>
* contentResource.deleteById(1234)
* .then(function() {
* alert('its gone!');
* });
* @ngdoc method
* @name umbraco.resources.contentResource#deleteById
* @methodOf umbraco.resources.contentResource
*
* @description
* Deletes a content item with a given id
*
* ##usage
* <pre>
* contentResource.deleteById(1234)
* .then(function() {
* alert('its gone!');
* });
* </pre>
*
* @param {Int} id id of content item to delete
* @returns {Promise} resourcePromise object.
*
*/
* @returns {Promise} resourcePromise object.
*
*/
deleteById: function (id) {
return umbRequestHelper.resourcePromise(
$http.post(
@@ -348,27 +348,27 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getById
* @methodOf umbraco.resources.contentResource
*
* @description
* Gets a content item with a given id
*
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* @ngdoc method
* @name umbraco.resources.contentResource#getById
* @methodOf umbraco.resources.contentResource
*
* @description
* Gets a content item with a given id
*
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* var myDoc = content;
* alert('its here!');
* });
* alert('its here!');
* });
* </pre>
*
* @param {Int} id id of content item to return
* @param {Int} culture optional culture to retrieve the item in
* @returns {Promise} resourcePromise object containing the content item.
*
*/
* @returns {Promise} resourcePromise object containing the content item.
*
*/
getById: function (id) {
return umbRequestHelper.resourcePromise(
$http.get(
@@ -419,26 +419,26 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getByIds
* @methodOf umbraco.resources.contentResource
*
* @description
* Gets an array of content items, given a collection of ids
*
* ##usage
* <pre>
* contentResource.getByIds( [1234,2526,28262])
* .then(function(contentArray) {
* @ngdoc method
* @name umbraco.resources.contentResource#getByIds
* @methodOf umbraco.resources.contentResource
*
* @description
* Gets an array of content items, given a collection of ids
*
* ##usage
* <pre>
* contentResource.getByIds( [1234,2526,28262])
* .then(function(contentArray) {
* var myDoc = contentArray;
* alert('they are here!');
* });
* alert('they are here!');
* });
* </pre>
*
* @param {Array} ids ids of content items to return as an array
* @returns {Promise} resourcePromise object containing the content items array.
*
*/
* @returns {Promise} resourcePromise object containing the content items array.
*
*/
getByIds: function (ids) {
var idQuery = "";
@@ -464,37 +464,37 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getScaffold
* @methodOf umbraco.resources.contentResource
* @ngdoc method
* @name umbraco.resources.contentResource#getScaffold
* @methodOf umbraco.resources.contentResource
*
* @description
* Returns a scaffold of an empty content item, given the id of the content item to place it underneath and the content type alias.
*
* @description
* Returns a scaffold of an empty content item, given the id of the content item to place it underneath and the content type alias.
*
* - Parent Id must be provided so umbraco knows where to store the content
* - Parent Id must be provided so umbraco knows where to store the content
* - Content Type alias must be provided so umbraco knows which properties to put on the content scaffold
*
* The scaffold is used to build editors for content that has not yet been populated with data.
* The scaffold is used to build editors for content that has not yet been populated with data.
*
* ##usage
* <pre>
* contentResource.getScaffold(1234, 'homepage')
* .then(function(scaffold) {
* var myDoc = scaffold;
* ##usage
* <pre>
* contentResource.getScaffold(1234, 'homepage')
* .then(function(scaffold) {
* var myDoc = scaffold;
* myDoc.name = "My new document";
*
* contentResource.publish(myDoc, true)
* .then(function(content){
* alert("Retrieved, updated and published again");
* });
* });
*
* contentResource.publish(myDoc, true)
* .then(function(content){
* alert("Retrieved, updated and published again");
* });
* });
* </pre>
*
* @param {Int} parentId id of content item to return
* @param {Int} parentId id of content item to return
* @param {String} alias contenttype alias to base the scaffold on
* @returns {Promise} resourcePromise object containing the content scaffold.
*
*/
* @returns {Promise} resourcePromise object containing the content scaffold.
*
*/
getScaffold: function (parentId, alias) {
return umbRequestHelper.resourcePromise(
@@ -524,25 +524,25 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getNiceUrl
* @methodOf umbraco.resources.contentResource
*
* @description
* Returns a url, given a node ID
*
* ##usage
* <pre>
* contentResource.getNiceUrl(id)
* .then(function(url) {
* alert('its here!');
* });
* @ngdoc method
* @name umbraco.resources.contentResource#getNiceUrl
* @methodOf umbraco.resources.contentResource
*
* @description
* Returns a url, given a node ID
*
* ##usage
* <pre>
* contentResource.getNiceUrl(id)
* .then(function(url) {
* alert('its here!');
* });
* </pre>
*
* @param {Int} id Id of node to return the public url to
* @returns {Promise} resourcePromise object containing the url.
*
*/
* @param {Int} id Id of node to return the public url to
* @returns {Promise} resourcePromise object containing the url.
*
*/
getNiceUrl: function (id) {
return umbRequestHelper.resourcePromise(
$http.get(
@@ -554,33 +554,33 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getChildren
* @methodOf umbraco.resources.contentResource
*
* @description
* Gets children of a content item with a given id
*
* ##usage
* <pre>
* contentResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
* @ngdoc method
* @name umbraco.resources.contentResource#getChildren
* @methodOf umbraco.resources.contentResource
*
* @description
* Gets children of a content item with a given id
*
* ##usage
* <pre>
* contentResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
* var children = contentArray;
* alert('they are here!');
* });
* alert('they are here!');
* });
* </pre>
*
* @param {Int} parentid id of content item to return children of
* @param {Object} options optional options object
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
* @param {Int} options.pageNumber if paging data, current page index, default = 0
* @param {String} options.filter if provided, query will only return those with names matching the filter
* @param {String} options.orderDirection can be `Ascending` or `Descending` - Default: `Ascending`
* @param {String} options.orderBy property to order items by, default: `SortOrder`
* @param {Int} parentid id of content item to return children of
* @param {Object} options optional options object
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
* @param {Int} options.pageNumber if paging data, current page index, default = 0
* @param {String} options.filter if provided, query will only return those with names matching the filter
* @param {String} options.orderDirection can be `Ascending` or `Descending` - Default: `Ascending`
* @param {String} options.orderBy property to order items by, default: `SortOrder`
* @param {String} options.cultureName if provided, the results will be for this specific culture/variant
* @returns {Promise} resourcePromise object containing an array of content items.
*
*/
* @returns {Promise} resourcePromise object containing an array of content items.
*
*/
getChildren: function (parentId, options) {
var defaults = {
@@ -651,34 +651,34 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#save
* @methodOf umbraco.resources.contentResource
*
* @description
* Saves changes made to a content item to its current version, if the content item is new, the isNew paramater must be passed to force creation
* @ngdoc method
* @name umbraco.resources.contentResource#save
* @methodOf umbraco.resources.contentResource
*
* @description
* Saves changes made to a content item to its current version, if the content item is new, the isNew paramater must be passed to force creation
* if the content item needs to have files attached, they must be provided as the files param and passed separately
*
*
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* content.name = "I want a new name!";
* contentResource.save(content, false)
* .then(function(content){
* alert("Retrieved, updated and saved again");
* });
* });
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* content.name = "I want a new name!";
* contentResource.save(content, false)
* .then(function(content){
* alert("Retrieved, updated and saved again");
* });
* });
* </pre>
*
* @param {Object} content The content item object with changes applied
* @param {Object} content The content item object with changes applied
* @param {Bool} isNew set to true to create a new item or to update an existing
* @param {Array} files collection of files for the document
* @param {Bool} showNotifications an option to disable/show notifications (default is true)
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
save: function (content, isNew, files, showNotifications) {
var endpoint = umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
@@ -694,34 +694,34 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#publish
* @methodOf umbraco.resources.contentResource
*
* @description
* Saves and publishes changes made to a content item to a new version, if the content item is new, the isNew paramater must be passed to force creation
* @ngdoc method
* @name umbraco.resources.contentResource#publish
* @methodOf umbraco.resources.contentResource
*
* @description
* Saves and publishes changes made to a content item to a new version, if the content item is new, the isNew paramater must be passed to force creation
* if the content item needs to have files attached, they must be provided as the files param and passed separately
*
*
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* content.name = "I want a new name, and be published!";
* contentResource.publish(content, false)
* .then(function(content){
* alert("Retrieved, updated and published again");
* });
* });
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* content.name = "I want a new name, and be published!";
* contentResource.publish(content, false)
* .then(function(content){
* alert("Retrieved, updated and published again");
* });
* });
* </pre>
*
* @param {Object} content The content item object with changes applied
* @param {Object} content The content item object with changes applied
* @param {Bool} isNew set to true to create a new item or to update an existing
* @param {Array} files collection of files for the document
* @param {Bool} showNotifications an option to disable/show notifications (default is true)
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
publish: function (content, isNew, files, showNotifications) {
var endpoint = umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
@@ -743,31 +743,31 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#sendToPublish
* @methodOf umbraco.resources.contentResource
* @ngdoc method
* @name umbraco.resources.contentResource#sendToPublish
* @methodOf umbraco.resources.contentResource
*
* @description
* Saves changes made to a content item, and notifies any subscribers about a pending publication
*
* @description
* Saves changes made to a content item, and notifies any subscribers about a pending publication
*
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* content.name = "I want a new name, and be published!";
* contentResource.sendToPublish(content, false)
* .then(function(content){
* alert("Retrieved, updated and notication send off");
* });
* });
* ##usage
* <pre>
* contentResource.getById(1234)
* .then(function(content) {
* content.name = "I want a new name, and be published!";
* contentResource.sendToPublish(content, false)
* .then(function(content){
* alert("Retrieved, updated and notication send off");
* });
* });
* </pre>
*
* @param {Object} content The content item object with changes applied
* @param {Object} content The content item object with changes applied
* @param {Bool} isNew set to true to create a new item or to update an existing
* @param {Array} files collection of files for the document
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
sendToPublish: function (content, isNew, files, showNotifications) {
var endpoint = umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
@@ -797,25 +797,25 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#publishByid
* @methodOf umbraco.resources.contentResource
* @ngdoc method
* @name umbraco.resources.contentResource#publishByid
* @methodOf umbraco.resources.contentResource
*
* @description
* Publishes a content item with a given ID
*
* @description
* Publishes a content item with a given ID
*
* ##usage
* <pre>
* contentResource.publishById(1234)
* .then(function(content) {
* alert("published");
* });
* ##usage
* <pre>
* contentResource.publishById(1234)
* .then(function(content) {
* alert("published");
* });
* </pre>
*
* @param {Int} id The ID of the conten to publish
* @returns {Promise} resourcePromise object containing the published content item.
*
*/
* @param {Int} id The ID of the conten to publish
* @returns {Promise} resourcePromise object containing the published content item.
*
*/
publishById: function (id) {
if (!id) {
@@ -2,10 +2,10 @@
* @ngdoc service
* @name umbraco.resources.entityResource
* @description Loads in basic data for all entities
*
*
* ##What is an entity?
* An entity is a basic **read-only** representation of an Umbraco node. It contains only the most
* basic properties used to display the item in trees, lists and navigation.
* basic properties used to display the item in trees, lists and navigation.
*
* ##What is the difference between entity and content/media/etc...?
* the entity only contains the basic node data, name, id and guid, whereas content
@@ -15,7 +15,7 @@
*
* ##Entity object types?
* You need to specify the type of object you want returned.
*
*
* The core object types are:
*
* - Document
@@ -35,7 +35,7 @@ function entityResource($q, $http, umbRequestHelper) {
//the factory object returned
return {
getSafeAlias: function (value, camelCase) {
if (!value) {
@@ -64,10 +64,10 @@ function entityResource($q, $http, umbRequestHelper) {
* .then(function(pathArray) {
* alert('its here!');
* });
* </pre>
*
* </pre>
*
* @param {Int} id Id of node to return the public url to
* @param {string} type Object type name
* @param {string} type Object type name
* @returns {Promise} resourcePromise object containing the url.
*
*/
@@ -100,8 +100,8 @@ function entityResource($q, $http, umbRequestHelper) {
* .then(function(url) {
* alert('its here!');
* });
* </pre>
*
* </pre>
*
* @param {Int} id Id of node to return the public url to
* @param {string} type Object type name
* @returns {Promise} resourcePromise object containing the url.
@@ -135,17 +135,17 @@ function entityResource($q, $http, umbRequestHelper) {
* //get media by id
* entityResource.getEntityById(0, "Media")
* .then(function(ent) {
* var myDoc = ent;
* var myDoc = ent;
* alert('its here!');
* });
* </pre>
*
* </pre>
*
* @param {Int} id id of entity to return
* @param {string} type Object type name
* @param {string} type Object type name
* @returns {Promise} resourcePromise object containing the entity.
*
*/
getById: function (id, type) {
getById: function (id, type) {
if (id === -1 || id === "-1") {
return null;
@@ -160,6 +160,39 @@ function entityResource($q, $http, umbRequestHelper) {
'Failed to retrieve entity data for id ' + id);
},
getUrlAndAnchors: function (id) {
if (id === -1 || id === "-1") {
return null;
}
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetUrlAndAnchors",
{ id: id })),
'Failed to retrieve url and anchors data for id ' + id);
},
getAnchors: function (rteContent) {
if (!rteContent || rteContent.length === 0) {
return [];
}
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
'GetAnchors'),
{
rteContent: rteContent
}),
'Failed to anchors data for rte content ' + rteContent);
},
/**
* @ngdoc method
* @name umbraco.resources.entityResource#getByIds
@@ -173,18 +206,18 @@ function entityResource($q, $http, umbRequestHelper) {
* //Get templates for ids
* entityResource.getEntitiesByIds( [1234,2526,28262], "Template")
* .then(function(templateArray) {
* var myDoc = contentArray;
* var myDoc = contentArray;
* alert('they are here!');
* });
* </pre>
*
* </pre>
*
* @param {Array} ids ids of entities to return as an array
* @param {string} type type name
* @param {string} type type name
* @returns {Promise} resourcePromise object containing the entity array.
*
*/
getByIds: function (ids, type) {
var query = "type=" + type;
return umbRequestHelper.resourcePromise(
@@ -212,14 +245,14 @@ function entityResource($q, $http, umbRequestHelper) {
* //get content by xpath
* entityResource.getByQuery("$current", -1, "Document")
* .then(function(ent) {
* var myDoc = ent;
* var myDoc = ent;
* alert('its here!');
* });
* </pre>
*
* </pre>
*
* @param {string} query xpath to use in query
* @param {Int} nodeContextId id id to start from
* @param {string} type Object type name
* @param {string} type Object type name
* @returns {Promise} resourcePromise object containing the entity.
*
*/
@@ -247,12 +280,12 @@ function entityResource($q, $http, umbRequestHelper) {
* //Only return media
* entityResource.getAll("Media")
* .then(function(ent) {
* var myDoc = ent;
* var myDoc = ent;
* alert('its here!');
* });
* </pre>
*
* @param {string} type Object type name
* </pre>
*
* @param {string} type Object type name
* @param {string} postFilter optional filter expression which will execute a dynamic where clause on the server
* @returns {Promise} resourcePromise object containing the entity.
*
@@ -277,24 +310,36 @@ function entityResource($q, $http, umbRequestHelper) {
*
* @description
* Gets ancestor entities for a given item
*
*
*
*
* @param {string} type Object type name
* @param {string} culture Culture
* @returns {Promise} resourcePromise object containing the entity.
*
*/
getAncestors: function (id, type, culture) {
if (culture === undefined) culture = "";
getAncestors: function (id, type, culture, options) {
if (!culture) {
culture = "";
}
var args = [
{ id: id },
{ type: type },
{ culture: culture}
];
if (options && options.dataTypeKey) {
args.push({ dataTypeKey: options.dataTypeKey });
}
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetAncestors",
[{ id: id }, { type: type }, { culture: culture }])),
'Failed to retrieve ancestor data for id ' + id);
args)),
'Failed to retrieve ancestor data for id ' + id);
},
/**
* @ngdoc method
* @name umbraco.resources.entityResource#getChildren
@@ -302,20 +347,25 @@ function entityResource($q, $http, umbRequestHelper) {
*
* @description
* Gets children entities for a given item
*
*
* @param {Int} parentid id of content item to return children of
* @param {string} type Object type name
* @param {string} type Object type name
* @returns {Promise} resourcePromise object containing the entity.
*
*/
getChildren: function (id, type) {
getChildren: function (id, type, options) {
var args = [{ id: id }, { type: type }];
if (options && options.dataTypeKey) {
args.push({ dataTypeKey: options.dataTypeKey });
}
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetChildren",
[{ id: id }, { type: type }])),
args)),
'Failed to retrieve child data for id ' + id);
},
@@ -331,11 +381,11 @@ function entityResource($q, $http, umbRequestHelper) {
* <pre>
* entityResource.getPagedChildren(1234, "Content", {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
* var children = contentArray;
* var children = contentArray;
* alert('they are here!');
* });
* </pre>
*
* </pre>
*
* @param {Int} parentid id of content item to return children of
* @param {string} type Object type name
* @param {Object} options optional options object
@@ -383,7 +433,8 @@ function entityResource($q, $http, umbRequestHelper) {
pageSize: options.pageSize,
orderBy: options.orderBy,
orderDirection: options.orderDirection,
filter: encodeURIComponent(options.filter)
filter: encodeURIComponent(options.filter),
dataTypeKey: options.dataTypeKey
}
)),
'Failed to retrieve child data for id ' + parentId);
@@ -401,11 +452,11 @@ function entityResource($q, $http, umbRequestHelper) {
* <pre>
* entityResource.getPagedDescendants(1234, "Document", {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
* var children = contentArray;
* var children = contentArray;
* alert('they are here!');
* });
* </pre>
*
* </pre>
*
* @param {Int} parentid id of content item to return descendants of
* @param {string} type Object type name
* @param {Object} options optional options object
@@ -424,7 +475,8 @@ function entityResource($q, $http, umbRequestHelper) {
pageNumber: 1,
filter: '',
orderDirection: "Ascending",
orderBy: "SortOrder"
orderBy: "SortOrder",
dataTypeKey: null
};
if (options === undefined) {
options = {};
@@ -453,12 +505,14 @@ function entityResource($q, $http, umbRequestHelper) {
pageSize: options.pageSize,
orderBy: options.orderBy,
orderDirection: options.orderDirection,
filter: encodeURIComponent(options.filter)
filter: encodeURIComponent(options.filter),
dataTypeKey: options.dataTypeKey
}
)),
'Failed to retrieve child data for id ' + parentId);
},
/**
* @ngdoc method
* @name umbraco.resources.entityResource#search
@@ -471,23 +525,27 @@ function entityResource($q, $http, umbRequestHelper) {
* <pre>
* entityResource.search("news", "Media")
* .then(function(mediaArray) {
* var myDoc = mediaArray;
* var myDoc = mediaArray;
* alert('they are here!');
* });
* </pre>
*
* @param {String} Query search query
* @param {String} Type type of conten to search
* </pre>
*
* @param {String} Query search query
* @param {String} Type type of conten to search
* @returns {Promise} resourcePromise object containing the entity array.
*
*/
search: function (query, type, searchFrom, canceler) {
search: function (query, type, searchFrom, canceler, dataTypeKey) {
var args = [{ query: query }, { type: type }];
if (searchFrom) {
args.push({ searchFrom: searchFrom });
}
if (dataTypeKey) {
args.push({ dataTypeKey: dataTypeKey });
}
var httpConfig = {};
if (canceler) {
httpConfig["timeout"] = canceler;
@@ -502,7 +560,7 @@ function entityResource($q, $http, umbRequestHelper) {
httpConfig),
'Failed to retrieve entity data for query ' + query);
},
/**
* @ngdoc method
@@ -516,12 +574,12 @@ function entityResource($q, $http, umbRequestHelper) {
* <pre>
* entityResource.searchAll("bob")
* .then(function(array) {
* var myDoc = array;
* var myDoc = array;
* alert('they are here!');
* });
* </pre>
*
* @param {String} Query search query
* </pre>
*
* @param {String} Query search query
* @returns {Promise} resourcePromise object containing the entity array.
*
*/
@@ -541,7 +599,9 @@ function entityResource($q, $http, umbRequestHelper) {
httpConfig),
'Failed to retrieve entity data for query ' + query);
}
};
}
@@ -1,16 +1,16 @@
/**
* @ngdoc service
* @name umbraco.resources.mediaResource
* @description Loads in data for media
**/
* @ngdoc service
* @name umbraco.resources.mediaResource
* @description Loads in data for media
**/
function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
/** internal method process the saving of data and post processing the result */
function saveMediaItem(content, action, files) {
return umbRequestHelper.postSaveContent({
restApiUrl: umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"PostSave"),
"mediaApiBaseUrl",
"PostSave"),
content: content,
action: action,
files: files,
@@ -24,35 +24,35 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
getRecycleBin: function () {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetRecycleBin")),
'Failed to retrieve data for media recycle bin');
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetRecycleBin")),
'Failed to retrieve data for media recycle bin');
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#sort
* @methodOf umbraco.resources.mediaResource
*
* @description
* Sorts all children below a given parent node id, based on a collection of node-ids
*
* ##usage
* <pre>
* var ids = [123,34533,2334,23434];
* mediaResource.sort({ sortedIds: ids })
* .then(function() {
* $scope.complete = true;
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.parentId the ID of the parent node
* @param {Array} options.sortedIds array of node IDs as they should be sorted
* @returns {Promise} resourcePromise object.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#sort
* @methodOf umbraco.resources.mediaResource
*
* @description
* Sorts all children below a given parent node id, based on a collection of node-ids
*
* ##usage
* <pre>
* var ids = [123,34533,2334,23434];
* mediaResource.sort({ sortedIds: ids })
* .then(function() {
* $scope.complete = true;
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.parentId the ID of the parent node
* @param {Array} options.sortedIds array of node IDs as they should be sorted
* @returns {Promise} resourcePromise object.
*
*/
sort: function (args) {
if (!args) {
throw "args cannot be null";
@@ -65,37 +65,37 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
}
return umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostSort"),
{
parentId: args.parentId,
idSortOrder: args.sortedIds
}),
'Failed to sort media');
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostSort"),
{
parentId: args.parentId,
idSortOrder: args.sortedIds
}),
'Failed to sort media');
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#move
* @methodOf umbraco.resources.mediaResource
*
* @description
* Moves a node underneath a new parentId
*
* ##usage
* <pre>
* mediaResource.move({ parentId: 1244, id: 123 })
* .then(function() {
* alert("node was moved");
* }, function(err){
* alert("node didnt move:" + err.data.Message);
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.idd the ID of the node to move
* @param {Int} args.parentId the ID of the parent node to move to
* @returns {Promise} resourcePromise object.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#move
* @methodOf umbraco.resources.mediaResource
*
* @description
* Moves a node underneath a new parentId
*
* ##usage
* <pre>
* mediaResource.move({ parentId: 1244, id: 123 })
* .then(function() {
* alert("node was moved");
* }, function(err){
* alert("node didnt move:" + err.data.Message);
* });
* </pre>
* @param {Object} args arguments object
* @param {Int} args.idd the ID of the node to move
* @param {Int} args.parentId the ID of the parent node to move to
* @returns {Promise} resourcePromise object.
*
*/
move: function (args) {
if (!args) {
throw "args cannot be null";
@@ -108,121 +108,121 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
}
return umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostMove"),
{
parentId: args.parentId,
id: args.id
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostMove"),
{
parentId: args.parentId,
id: args.id
}, {responseType: 'text'}),
{
error: function(data){
var errorMsg = 'Failed to move media';
if (data.id !== undefined && data.parentId !== undefined) {
if (data.id === data.parentId) {
errorMsg = 'Media can\'t be moved into itself';
}
}
else if (data.notifications !== undefined) {
if (data.notifications.length > 0) {
if (data.notifications[0].header.length > 0) {
errorMsg = data.notifications[0].header;
}
if (data.notifications[0].message.length > 0) {
errorMsg = errorMsg + ": " + data.notifications[0].message;
}
{
error: function(data){
var errorMsg = 'Failed to move media';
if (data.id !== undefined && data.parentId !== undefined) {
if (data.id === data.parentId) {
errorMsg = 'Media can\'t be moved into itself';
}
}
else if (data.notifications !== undefined) {
if (data.notifications.length > 0) {
if (data.notifications[0].header.length > 0) {
errorMsg = data.notifications[0].header;
}
if (data.notifications[0].message.length > 0) {
errorMsg = errorMsg + ": " + data.notifications[0].message;
}
}
}
return {
errorMsg: errorMsg
};
}
});
return {
errorMsg: errorMsg
};
}
});
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#getById
* @methodOf umbraco.resources.mediaResource
*
* @description
* Gets a media item with a given id
*
* ##usage
* <pre>
* mediaResource.getById(1234)
* .then(function(media) {
* var myMedia = media;
* alert('its here!');
* });
* </pre>
*
* @param {Int} id id of media item to return
* @returns {Promise} resourcePromise object containing the media item.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#getById
* @methodOf umbraco.resources.mediaResource
*
* @description
* Gets a media item with a given id
*
* ##usage
* <pre>
* mediaResource.getById(1234)
* .then(function(media) {
* var myMedia = media;
* alert('its here!');
* });
* </pre>
*
* @param {Int} id id of media item to return
* @returns {Promise} resourcePromise object containing the media item.
*
*/
getById: function (id) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetById",
[{ id: id }])),
'Failed to retrieve data for media id ' + id);
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetById",
[{ id: id }])),
'Failed to retrieve data for media id ' + id);
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#deleteById
* @methodOf umbraco.resources.mediaResource
*
* @description
* Deletes a media item with a given id
*
* ##usage
* <pre>
* mediaResource.deleteById(1234)
* .then(function() {
* alert('its gone!');
* });
* </pre>
*
* @param {Int} id id of media item to delete
* @returns {Promise} resourcePromise object.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#deleteById
* @methodOf umbraco.resources.mediaResource
*
* @description
* Deletes a media item with a given id
*
* ##usage
* <pre>
* mediaResource.deleteById(1234)
* .then(function() {
* alert('its gone!');
* });
* </pre>
*
* @param {Int} id id of media item to delete
* @returns {Promise} resourcePromise object.
*
*/
deleteById: function (id) {
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"DeleteById",
[{ id: id }])),
'Failed to delete item ' + id);
$http.post(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"DeleteById",
[{ id: id }])),
'Failed to delete item ' + id);
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#getByIds
* @methodOf umbraco.resources.mediaResource
*
* @description
* Gets an array of media items, given a collection of ids
*
* ##usage
* <pre>
* mediaResource.getByIds( [1234,2526,28262])
* .then(function(mediaArray) {
* var myDoc = contentArray;
* alert('they are here!');
* });
* </pre>
*
* @param {Array} ids ids of media items to return as an array
* @returns {Promise} resourcePromise object containing the media items array.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#getByIds
* @methodOf umbraco.resources.mediaResource
*
* @description
* Gets an array of media items, given a collection of ids
*
* ##usage
* <pre>
* mediaResource.getByIds( [1234,2526,28262])
* .then(function(mediaArray) {
* var myDoc = contentArray;
* alert('they are here!');
* });
* </pre>
*
* @param {Array} ids ids of media items to return as an array
* @returns {Promise} resourcePromise object containing the media items array.
*
*/
getByIds: function (ids) {
var idQuery = "";
@@ -231,96 +231,96 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
});
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetByIds",
idQuery)),
'Failed to retrieve data for media ids ' + ids);
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetByIds",
idQuery)),
'Failed to retrieve data for media ids ' + ids);
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#getScaffold
* @methodOf umbraco.resources.mediaResource
*
* @description
* Returns a scaffold of an empty media item, given the id of the media item to place it underneath and the media type alias.
*
* - Parent Id must be provided so umbraco knows where to store the media
* - Media Type alias must be provided so umbraco knows which properties to put on the media scaffold
*
* The scaffold is used to build editors for media that has not yet been populated with data.
*
* ##usage
* <pre>
* mediaResource.getScaffold(1234, 'folder')
* .then(function(scaffold) {
* var myDoc = scaffold;
* myDoc.name = "My new media item";
*
* mediaResource.save(myDoc, true)
* .then(function(media){
* alert("Retrieved, updated and saved again");
* });
* });
* </pre>
*
* @param {Int} parentId id of media item to return
* @param {String} alias mediatype alias to base the scaffold on
* @returns {Promise} resourcePromise object containing the media scaffold.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#getScaffold
* @methodOf umbraco.resources.mediaResource
*
* @description
* Returns a scaffold of an empty media item, given the id of the media item to place it underneath and the media type alias.
*
* - Parent Id must be provided so umbraco knows where to store the media
* - Media Type alias must be provided so umbraco knows which properties to put on the media scaffold
*
* The scaffold is used to build editors for media that has not yet been populated with data.
*
* ##usage
* <pre>
* mediaResource.getScaffold(1234, 'folder')
* .then(function(scaffold) {
* var myDoc = scaffold;
* myDoc.name = "My new media item";
*
* mediaResource.save(myDoc, true)
* .then(function(media){
* alert("Retrieved, updated and saved again");
* });
* });
* </pre>
*
* @param {Int} parentId id of media item to return
* @param {String} alias mediatype alias to base the scaffold on
* @returns {Promise} resourcePromise object containing the media scaffold.
*
*/
getScaffold: function (parentId, alias) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetEmpty",
[{ contentTypeAlias: alias }, { parentId: parentId }])),
'Failed to retrieve data for empty media item type ' + alias);
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetEmpty",
[{ contentTypeAlias: alias }, { parentId: parentId }])),
'Failed to retrieve data for empty media item type ' + alias);
},
rootMedia: function () {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetRootMedia")),
'Failed to retrieve data for root media');
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetRootMedia")),
'Failed to retrieve data for root media');
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#getChildren
* @methodOf umbraco.resources.mediaResource
*
* @description
* Gets children of a media item with a given id
*
* ##usage
* <pre>
* mediaResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
* var children = contentArray;
* alert('they are here!');
* });
* </pre>
*
* @param {Int} parentid id of content item to return children of
* @param {Object} options optional options object
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
* @param {Int} options.pageNumber if paging data, current page index, default = 0
* @param {String} options.filter if provided, query will only return those with names matching the filter
* @param {String} options.orderDirection can be `Ascending` or `Descending` - Default: `Ascending`
* @param {String} options.orderBy property to order items by, default: `SortOrder`
* @returns {Promise} resourcePromise object containing an array of content items.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#getChildren
* @methodOf umbraco.resources.mediaResource
*
* @description
* Gets children of a media item with a given id
*
* ##usage
* <pre>
* mediaResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
* .then(function(contentArray) {
* var children = contentArray;
* alert('they are here!');
* });
* </pre>
*
* @param {Int} parentid id of content item to return children of
* @param {Object} options optional options object
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
* @param {Int} options.pageNumber if paging data, current page index, default = 0
* @param {String} options.filter if provided, query will only return those with names matching the filter
* @param {String} options.orderDirection can be `Ascending` or `Descending` - Default: `Ascending`
* @param {String} options.orderBy property to order items by, default: `SortOrder`
* @returns {Promise} resourcePromise object containing an array of content items.
*
*/
getChildren: function (parentId, options) {
var defaults = {
@@ -361,111 +361,111 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
}
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetChildren",
[
{ id: parentId },
{ pageNumber: options.pageNumber },
{ pageSize: options.pageSize },
{ orderBy: options.orderBy },
{ orderDirection: options.orderDirection },
{ orderBySystemField: toBool(options.orderBySystemField) },
{ filter: options.filter }
])),
'Failed to retrieve children for media item ' + parentId);
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetChildren",
[
{ id: parentId },
{ pageNumber: options.pageNumber },
{ pageSize: options.pageSize },
{ orderBy: options.orderBy },
{ orderDirection: options.orderDirection },
{ orderBySystemField: toBool(options.orderBySystemField) },
{ filter: options.filter }
])),
'Failed to retrieve children for media item ' + parentId);
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#save
* @methodOf umbraco.resources.mediaResource
*
* @description
* Saves changes made to a media item, if the media item is new, the isNew paramater must be passed to force creation
* if the media item needs to have files attached, they must be provided as the files param and passed separately
*
*
* ##usage
* <pre>
* mediaResource.getById(1234)
* .then(function(media) {
* media.name = "I want a new name!";
* mediaResource.save(media, false)
* .then(function(media){
* alert("Retrieved, updated and saved again");
* });
* });
* </pre>
*
* @param {Object} media The media item object with changes applied
* @param {Bool} isNew set to true to create a new item or to update an existing
* @param {Array} files collection of files for the media item
* @returns {Promise} resourcePromise object containing the saved media item.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#save
* @methodOf umbraco.resources.mediaResource
*
* @description
* Saves changes made to a media item, if the media item is new, the isNew paramater must be passed to force creation
* if the media item needs to have files attached, they must be provided as the files param and passed separately
*
*
* ##usage
* <pre>
* mediaResource.getById(1234)
* .then(function(media) {
* media.name = "I want a new name!";
* mediaResource.save(media, false)
* .then(function(media){
* alert("Retrieved, updated and saved again");
* });
* });
* </pre>
*
* @param {Object} media The media item object with changes applied
* @param {Bool} isNew set to true to create a new item or to update an existing
* @param {Array} files collection of files for the media item
* @returns {Promise} resourcePromise object containing the saved media item.
*
*/
save: function (media, isNew, files) {
return saveMediaItem(media, "save" + (isNew ? "New" : ""), files);
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#addFolder
* @methodOf umbraco.resources.mediaResource
*
* @description
* Shorthand for adding a media item of the type "Folder" under a given parent ID
*
* ##usage
* <pre>
* mediaResource.addFolder("My gallery", 1234)
* .then(function(folder) {
* alert('New folder');
* });
* </pre>
*
* @param {string} name Name of the folder to create
* @param {int} parentId Id of the media item to create the folder underneath
* @returns {Promise} resourcePromise object.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#addFolder
* @methodOf umbraco.resources.mediaResource
*
* @description
* Shorthand for adding a media item of the type "Folder" under a given parent ID
*
* ##usage
* <pre>
* mediaResource.addFolder("My gallery", 1234)
* .then(function(folder) {
* alert('New folder');
* });
* </pre>
*
* @param {string} name Name of the folder to create
* @param {int} parentId Id of the media item to create the folder underneath
* @returns {Promise} resourcePromise object.
*
*/
addFolder: function (name, parentId) {
return umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper
.getApiUrl("mediaApiBaseUrl", "PostAddFolder"),
{
name: name,
parentId: parentId
}),
'Failed to add folder');
$http.post(umbRequestHelper
.getApiUrl("mediaApiBaseUrl", "PostAddFolder"),
{
name: name,
parentId: parentId
}),
'Failed to add folder');
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#getChildFolders
* @methodOf umbraco.resources.mediaResource
*
* @description
* Retrieves all media children with types used as folders.
* Uses the convention of looking for media items with mediaTypes ending in
* *Folder so will match "Folder", "bannerFolder", "secureFolder" etc,
*
* @ngdoc method
* @name umbraco.resources.mediaResource#getChildFolders
* @methodOf umbraco.resources.mediaResource
*
* @description
* Retrieves all media children with types used as folders.
* Uses the convention of looking for media items with mediaTypes ending in
* *Folder so will match "Folder", "bannerFolder", "secureFolder" etc,
*
* NOTE: This will return a page of max 500 folders, if more is required it needs to be paged
* and then folders are in the .items property of the returned promise data
*
* ##usage
* <pre>
* mediaResource.getChildFolders(1234)
*
* ##usage
* <pre>
* mediaResource.getChildFolders(1234)
* .then(function(page) {
* alert('folders');
* });
* </pre>
*
* @param {int} parentId Id of the media item to query for child folders
* @returns {Promise} resourcePromise object.
*
*/
* alert('folders');
* });
* </pre>
*
* @param {int} parentId Id of the media item to query for child folders
* @returns {Promise} resourcePromise object.
*
*/
getChildFolders: function (parentId) {
if (!parentId) {
parentId = -1;
@@ -473,69 +473,69 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
//NOTE: This will return a max of 500 folders, if more is required it needs to be paged
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetChildFolders",
{
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetChildFolders",
{
id: parentId,
pageNumber: 1,
pageSize: 500
})),
})),
'Failed to retrieve child folders for media item ' + parentId);
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#emptyRecycleBin
* @methodOf umbraco.resources.mediaResource
*
* @description
* Empties the media recycle bin
*
* ##usage
* <pre>
* mediaResource.emptyRecycleBin()
* .then(function() {
* alert('its empty!');
* });
* </pre>
*
* @returns {Promise} resourcePromise object.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#emptyRecycleBin
* @methodOf umbraco.resources.mediaResource
*
* @description
* Empties the media recycle bin
*
* ##usage
* <pre>
* mediaResource.emptyRecycleBin()
* .then(function() {
* alert('its empty!');
* });
* </pre>
*
* @returns {Promise} resourcePromise object.
*
*/
emptyRecycleBin: function () {
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"EmptyRecycleBin")),
'Failed to empty the recycle bin');
$http.post(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"EmptyRecycleBin")),
'Failed to empty the recycle bin');
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#search
* @methodOf umbraco.resources.mediaResource
*
* @description
* Paginated search for media items starting on the supplied nodeId
*
* ##usage
* <pre>
* mediaResource.search("my search", 1, 100, -1)
* .then(function(searchResult) {
* alert('it's here!');
* });
* </pre>
*
* @param {string} query The search query
* @param {int} pageNumber The page number
* @param {int} pageSize The number of media items on a page
* @param {int} searchFrom NodeId to search from (-1 for root)
* @returns {Promise} resourcePromise object.
*
*/
* @ngdoc method
* @name umbraco.resources.mediaResource#search
* @methodOf umbraco.resources.mediaResource
*
* @description
* Paginated search for media items starting on the supplied nodeId
*
* ##usage
* <pre>
* mediaResource.search("my search", 1, 100, -1)
* .then(function(searchResult) {
* alert('it's here!');
* });
* </pre>
*
* @param {string} query The search query
* @param {int} pageNumber The page number
* @param {int} pageSize The number of media items on a page
* @param {int} searchFrom NodeId to search from (-1 for root)
* @returns {Promise} resourcePromise object.
*
*/
search: function (query, pageNumber, pageSize, searchFrom) {
var args = [
@@ -546,12 +546,12 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
];
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"Search",
args)),
'Failed to retrieve media items for search: ' + query);
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"Search",
args)),
'Failed to retrieve media items for search: ' + query);
}
};
@@ -29,35 +29,48 @@ angular.module('umbraco.services')
var resourceFileLoadStatus = "none";
var resourceLoadingPromise = [];
function _lookup(value, tokens, dictionary) {
// array to hold the localized resource string entries
var innerDictionary = [];
function _lookup(alias, tokens, dictionary, fallbackValue) {
//strip the key identifier if its there
if (value && value[0] === "@") {
value = value.substring(1);
if (alias && alias[0] === "@") {
alias = alias.substring(1);
}
var underscoreIndex = alias.indexOf("_");
//if no area specified, add general_
if (value && value.indexOf("_") < 0) {
value = "general_" + value;
if (alias && underscoreIndex < 0) {
alias = "general_" + alias;
underscoreIndex = alias.indexOf("_");
}
var entry = dictionary[value];
if (entry) {
return service.tokenReplace(entry, tokens);
var areaAlias = alias.substring(0, underscoreIndex);
var valueAlias = alias.substring(underscoreIndex + 1);
var areaEntry = dictionary[areaAlias];
if (areaEntry) {
var valueEntry = areaEntry[valueAlias];
if (valueEntry) {
return service.tokenReplace(valueEntry, tokens);
}
}
return "[" + value + "]";
if (fallbackValue) return fallbackValue;
return "[" + alias + "]";
}
var service = {
// array to hold the localized resource string entries
dictionary: [],
// loads the language resource file from the server
initLocalizedResources: function () {
var deferred = $q.defer();
if (resourceFileLoadStatus === "loaded") {
deferred.resolve(service.dictionary);
deferred.resolve(innerDictionary);
return deferred.promise;
}
@@ -77,7 +90,7 @@ angular.module('umbraco.services')
$http({ method: "GET", url: url, cache: false })
.then(function (response) {
resourceFileLoadStatus = "loaded";
service.dictionary = response.data;
innerDictionary = response.data;
eventsService.emit("localizationService.updated", response.data);
@@ -159,11 +172,14 @@ angular.module('umbraco.services')
* @param {Array} tokens if specified this array will be sent as parameter values
* This replaces %0% and %1% etc in the dictionary key value with the passed in strings
*
* @param {String} fallbackValue if specified this string will be returned if no matching
* entry was found in the dictionary
*
* @returns {String} localized resource string
*/
localize: function (value, tokens) {
localize: function (value, tokens, fallbackValue) {
return service.initLocalizedResources().then(function (dic) {
return _lookup(value, tokens, dic);
return _lookup(value, tokens, dic, fallbackValue);
});
},
@@ -244,8 +260,8 @@ angular.module('umbraco.services')
//Build a concat string by looping over the array of resolved promises/translations
var returnValue = "";
for(var i = 0; i < localizedValues.length; i++){
returnValue += localizedValues[i];
for(var j = 0; j < localizedValues.length; j++){
returnValue += localizedValues[j];
}
return returnValue;
@@ -292,11 +308,11 @@ angular.module('umbraco.services')
return $q.all(promises).then(function(localizedValues){
//Replace {0} and {1} etc in message with the localized values
for(var i = 0; i < localizedValues.length; i++){
var token = "%" + i + "%";
for(var j = 0; j < localizedValues.length; j++){
var token = "%" + j + "%";
var regex = new RegExp(token, "g");
message = message.replace(regex, localizedValues[i]);
message = message.replace(regex, localizedValues[j]);
}
return message;
@@ -3,7 +3,7 @@
* @name umbraco.services.mediaHelper
* @description A helper object used for dealing with media items
**/
function mediaHelper(umbRequestHelper) {
function mediaHelper(umbRequestHelper, $log) {
//container of fileresolvers
var _mediaFileResolvers = {};
@@ -13,11 +13,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#getImagePropertyValue
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Returns the file path associated with the media property if there is one
*
*
* @param {object} options Options object
* @param {object} options.mediaModel The media object to retrieve the image path from
* @param {object} options.imageOnly Optional, if true then will only return a path if the media item is an image
@@ -80,11 +80,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#getImagePropertyValue
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Returns the actual image path associated with the image property if there is one
*
*
* @param {object} options Options object
* @param {object} options.imageModel The media object to retrieve the image path from
*/
@@ -104,11 +104,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#getThumbnail
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* formats the display model used to display the content to the model used to save the content
*
*
* @param {object} options Options object
* @param {object} options.imageModel The media object to retrieve the image path from
*/
@@ -133,18 +133,20 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#resolveFileFromEntity
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Gets the media file url for a media entity returned with the entityResource
*
*
* @param {object} mediaEntity A media Entity returned from the entityResource
* @param {boolean} thumbnail Whether to return the thumbnail url or normal url
*/
resolveFileFromEntity: function (mediaEntity, thumbnail) {
if (!angular.isObject(mediaEntity.metaData) || !mediaEntity.metaData.MediaPath) {
throw "Cannot resolve the file url from the mediaEntity, it does not contain the required metaData";
//don't throw since this image legitimately might not contain a media path, but output a warning
$log.warn("Cannot resolve the file url from the mediaEntity, it does not contain the required metaData");
return null;
}
if (thumbnail) {
@@ -164,11 +166,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#resolveFile
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Gets the media file url for a media object returned with the mediaResource
*
*
* @param {object} mediaEntity A media Entity returned from the entityResource
* @param {boolean} thumbnail Whether to return the thumbnail url or normal url
*/
@@ -240,11 +242,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#scaleToMaxSize
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Finds the corrct max width and max height, given maximum dimensions and keeping aspect ratios
*
*
* @param {number} maxSize Maximum width & height
* @param {number} width Current width
* @param {number} height Current height
@@ -283,11 +285,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#getThumbnailFromPath
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Returns the path to the thumbnail version of a given media library image path
*
*
* @param {string} imagePath Image path, ex: /media/1234/my-image.jpg
*/
getThumbnailFromPath: function (imagePath) {
@@ -310,11 +312,11 @@ function mediaHelper(umbRequestHelper) {
* @ngdoc function
* @name umbraco.services.mediaHelper#detectIfImageByExtension
* @methodOf umbraco.services.mediaHelper
* @function
* @function
*
* @description
* Returns true/false, indicating if the given path has an allowed image extension
*
*
* @param {string} imagePath Image path, ex: /media/1234/my-image.jpg
*/
detectIfImageByExtension: function (imagePath) {
@@ -349,7 +349,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
reloadSection: function(sectionAlias) {
return navReadyPromise.promise.then(function () {
mainTreeApi.clearCache({ section: sectionAlias });
treeService.clearCache({ section: sectionAlias });
return mainTreeApi.load(sectionAlias);
});
},
@@ -2,7 +2,7 @@
* @ngdoc service
* @name umbraco.services.searchService
*
*
*
* @description
* Service for handling the main application search, can currently search content, media and members
*
@@ -15,10 +15,10 @@
* angular.forEach(results, function(result){
* //returns:
* {name: "name", id: 1234, menuUrl: "url", editorPath: "url", metaData: {}, subtitle: "/path/etc" }
* })
* var result =
* })
* </pre>
* })
* var result =
* })
* </pre>
*/
angular.module('umbraco.services')
.factory('searchService', function ($q, $log, entityResource, contentResource, umbRequestHelper, $injector, searchResultFormatter) {
@@ -67,7 +67,7 @@ angular.module('umbraco.services')
throw "args.term is required";
}
return entityResource.search(args.term, "Document", args.searchFrom, args.canceler).then(function (data) {
return entityResource.search(args.term, "Document", args.searchFrom, args.canceler, args.dataTypeKey).then(function (data) {
_.each(data, function (item) {
searchResultFormatter.configureContentResult(item);
});
@@ -92,7 +92,7 @@ angular.module('umbraco.services')
throw "args.term is required";
}
return entityResource.search(args.term, "Media", args.searchFrom).then(function (data) {
return entityResource.search(args.term, "Media", args.searchFrom, args.canceler, args.dataTypeKey).then(function (data) {
_.each(data, function (item) {
searchResultFormatter.configureMediaResult(item);
});
@@ -122,7 +122,7 @@ angular.module('umbraco.services')
_.each(data, function (resultByType) {
//we need to format the search result data to include things like the subtitle, urls, etc...
// this is done with registered angular services as part of the SearchableTreeAttribute, if that
// this is done with registered angular services as part of the SearchableTreeAttribute, if that
// is not found, than we format with the default formatter
var formatterMethod = searchResultFormatter.configureDefaultResult;
//check if a custom formatter is specified...
@@ -143,7 +143,7 @@ angular.module('umbraco.services')
_.each(resultByType.results, function (item) {
formatterMethod.apply(this, [item, resultByType.treeAlias, resultByType.appAlias]);
});
});
return data;
@@ -157,4 +157,4 @@ angular.module('umbraco.services')
var currentSection = sectionAlias;
}
};
});
});
@@ -6,7 +6,7 @@
* @description
* A service containing all logic for all of the Umbraco TinyMCE plugins
*/
function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, stylesheetResource, macroResource, macroService, $routeParams, umbRequestHelper, angularHelper, userService, editorService, editorState) {
function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, stylesheetResource, macroResource, macroService, $routeParams, umbRequestHelper, angularHelper, userService, editorService, entityResource) {
//These are absolutely required in order for the macros to render inline
//we put these as extended elements because they get merged on top of the normal allowed elements by tiny mce
@@ -895,38 +895,6 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
},
/**
* @ngdoc method
* @name umbraco.services.tinyMceService#getAnchorNames
* @methodOf umbraco.services.tinyMceService
*
* @description
* From the given string, generates a string array where each item is the id attribute value from a named anchor
* 'some string <a id="anchor"></a>with a named anchor' returns ['anchor']
*
* @param {string} input the string to parse
*/
getAnchorNames: function (input) {
var anchors = [];
if (!input) {
return anchors;
}
var anchorPattern = /<a id=\\"(.*?)\\">/gi;
var matches = input.match(anchorPattern);
if (matches) {
anchors = matches.map(function (v) {
return v.substring(v.indexOf('"') + 1, v.lastIndexOf('\\'));
});
}
return anchors.filter(function(val, i, self) {
return self.indexOf(val) === i;
});
},
insertLinkInEditor: function (editor, target, anchorElm) {
var href = target.url;
@@ -1148,29 +1116,50 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
//create link picker
self.createLinkPicker(args.editor, function (currentTarget, anchorElement) {
var linkPicker = {
currentTarget: currentTarget,
anchors: editorState.current ? self.getAnchorNames(JSON.stringify(editorState.current.properties)) : [],
submit: function (model) {
self.insertLinkInEditor(args.editor, model.target, anchorElement);
editorService.close();
},
close: function () {
editorService.close();
}
};
editorService.linkPicker(linkPicker);
entityResource.getAnchors(args.model.value).then(function (anchorValues) {
var linkPicker = {
currentTarget: currentTarget,
dataTypeKey: args.model.dataTypeKey,
ignoreUserStartNodes: args.model.config.ignoreUserStartNodes,
anchors: anchorValues,
submit: function (model) {
self.insertLinkInEditor(args.editor, model.target, anchorElement);
editorService.close();
},
close: function () {
editorService.close();
}
};
editorService.linkPicker(linkPicker);
});
});
//Create the insert media plugin
self.createMediaPicker(args.editor, function (currentTarget, userData) {
var startNodeId, startNodeIsVirtual;
if (!args.model.config.startNodeId) {
if (args.model.config.ignoreUserStartNodes === true) {
startNodeId = -1;
startNodeIsVirtual = true;
}
else {
startNodeId = userData.startMediaIds.length !== 1 ? -1 : userData.startMediaIds[0];
startNodeIsVirtual = userData.startMediaIds.length !== 1;
}
}
var mediaPicker = {
currentTarget: currentTarget,
onlyImages: true,
showDetails: true,
disableFolderSelect: true,
startNodeId: userData.startMediaIds.length !== 1 ? -1 : userData.startMediaIds[0],
startNodeIsVirtual: userData.startMediaIds.length !== 1,
startNodeId: startNodeId,
startNodeIsVirtual: startNodeIsVirtual,
dataTypeKey: args.model.dataTypeKey,
submit: function (model) {
self.insertMediaInEditor(args.editor, model.selection[0]);
editorService.close();
@@ -9,8 +9,8 @@
*
*/
function MainController($scope, $location, appState, treeService, notificationsService,
userService, historyService, updateChecker, assetsService, eventsService,
tmhDynamicLocale, localStorageService, editorService, overlayService, focusService) {
userService, historyService, updateChecker, navigationService, eventsService,
tmhDynamicLocale, localStorageService, editorService, overlayService) {
//the null is important because we do an explicit bool check on this in the view
$scope.authenticated = null;
@@ -105,6 +105,13 @@ function MainController($scope, $location, appState, treeService, notificationsS
//if the user has changed we need to redirect to the root so they don't try to continue editing the
//last item in the URL (NOTE: the user id can equal zero, so we cannot just do !data.lastUserId since that will resolve to true)
if (data.lastUserId !== undefined && data.lastUserId !== null && data.lastUserId !== data.user.id) {
var section = appState.getSectionState("currentSection");
if (section) {
//if there's a section already assigned, reload it so the tree is cleared
navigationService.reloadSection(section);
}
$location.path("/").search("");
historyService.removeAll();
treeService.clearCache();
@@ -140,8 +140,9 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
//// TODO: remove this it's not a thing
//$scope.selectedId = navigationService.currentId;
var isInit = false;
var evts = [];
//Listen for global state changes
evts.push(eventsService.on("appState.globalState.changed", function (e, args) {
if (args.key === "showNavigation") {
@@ -236,8 +237,10 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
}));
//when the application is ready and the user is authorized, setup the data
//this will occur anytime a new user logs in!
evts.push(eventsService.on("app.ready", function (evt, data) {
init();
$scope.authenticated = true;
ensureInit();
}));
// event for infinite editors
@@ -305,9 +308,14 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
/**
* Called when the app is ready and sets up the navigation (should only be called once)
*/
function init() {
function ensureInit() {
$scope.authenticated = true;
//only run once ever!
if (isInit) {
return;
}
isInit = true;
var navInit = false;
@@ -0,0 +1,24 @@
// sr-only - based on the boot strap naming conventions used to remove an element from the view, whilst retaining accessibily for screen readers. More info available at https://getbootstrap.com/docs/4.0/utilities/screenreaders/
// --------------------------------------------------
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
&--focusable:active,
&--focusable:focus,
&--hoverable:hover {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
}
@@ -80,8 +80,10 @@
@import "forms/umb-validation-label.less";
// Umbraco Accessibility
@import "accessibility/sr-only.less";
// Umbraco Components
@import "components/application/umb-app-a11y.less";
@import "components/application/umb-app-header.less";
@import "components/application/umb-app-content.less";
@import "components/application/umb-tour.less";
@@ -1,10 +0,0 @@
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
@@ -27,6 +27,7 @@
}
.umb-action-link {
position: relative;
white-space: nowrap;
font-size: 15px;
color: @black;
@@ -34,6 +35,7 @@
text-decoration: none;
cursor: pointer;
display: flex;
width: 100%;
align-items: center;
body.touch & {
@@ -8,12 +8,28 @@
user-select: none;
}
&:hover ins {
&:hover .umb-tree-item__arrow {
visibility: visible;
cursor: pointer
}
}
.umb-tree-item__arrow {
position: relative;
margin-left: -16px;
width: 16px;
height: 16px;
visibility: hidden;
text-decoration: none;
font-size: 12px;
line-height: 12px;
transition: color 120ms;
&:hover {
color: @ui-option-type-hover;
}
}
.umb-tree-item > .umb-tree-item__inner {
&:hover .umb-tree-item__label {
@@ -95,7 +111,7 @@
a,
.umb-tree-icon,
ins {
.umb-tree-item__arrow {
color: @ui-active-type !important;
}
}
@@ -15,20 +15,6 @@
text-decoration: none;
}
ins {
margin: -4px 0 0 -16px;
width: 16px;
height: 16px;
visibility: hidden;
text-decoration: none;
font-size: 12px;
transition: color 120ms;
&:hover {
color: @ui-option-type-hover;
}
}
i.noSpr {
display: inline-block;
margin-top: 1px;
@@ -62,7 +48,7 @@
}
body.touch .umb-tree {
ins {
.umb-tree-item__arrow {
font-size: 14px;
visibility: visible;
padding: 7px;
@@ -104,7 +90,13 @@ body.touch .umb-tree {
}
> .umb-options {
visibility: visible;
position: relative;
width: auto;
height: auto;
margin: 0 10px 0 auto;
padding: 9px 5px;
overflow: visible;
clip: auto;
}
.umb-tree-icon {
@@ -178,7 +170,7 @@ body.touch .umb-tree {
}
.umb-options {
visibility: hidden;
position: relative;
display: flex;
flex: 0 0 auto;
justify-content: flex-end;
@@ -192,6 +184,20 @@ body.touch .umb-tree {
background: @btnBackgroundHighlight;
}
// NOTE - We're having to repeat ourselves here due to an .sr-only class appearing in umbraco/lib/font-awesome/css/font-awesome.min.css
&.sr-only--hoverable:hover,
&.sr-only--focusable:focus {
position: relative;
display: flex;
flex: 0 0 auto;
justify-content: flex-end;
padding: 9px 5px;
text-align: center;
margin: 0 10px 0 auto;
cursor: pointer;
border-radius: 3px;
}
i {
height: 5px !important;
width: 5px !important;
@@ -6,7 +6,7 @@
flex-wrap: wrap;
align-items: center;
position: relative;
padding: 0;
padding: 0 !important;
margin: 0;
min-height: 22px;
line-height: 22px;
@@ -113,6 +113,10 @@
bottom: 0px;
padding: 20px;
margin: 0;
.btn.umb-outline {
position: relative
}
}
/*we will always make sure to wrap iframe dialogs in proper padding*/
@@ -113,7 +113,10 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
$scope.exitPreview = function () {
var culture = $location.search().culture || getParameterByName("culture");
var relativeUrl = "/" + $scope.pageId +'?culture='+ culture;
var relativeUrl = "/" + $scope.pageId;
if (culture) {
relativeUrl += '?culture=' + culture;
}
window.top.location.href = "../preview/end?redir=" + encodeURIComponent(relativeUrl);
};
@@ -1,6 +1,6 @@
//used for the media picker dialog
angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
function ($scope, eventsService, entityResource, contentResource, mediaResource, mediaHelper, udiParser, userService, localizationService, tinyMceService, editorService, contentEditingHelper) {
function ($scope, eventsService, entityResource, mediaResource, mediaHelper, udiParser, userService, localizationService, editorService) {
var vm = this;
var dialogOptions = $scope.model;
@@ -20,13 +20,14 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
$scope.model.title = value;
});
}
$scope.customTreeParams = dialogOptions.dataTypeKey ? "dataTypeKey=" + dialogOptions.dataTypeKey : "";
$scope.dialogTreeApi = {};
$scope.model.target = {};
$scope.searchInfo = {
searchFromId: null,
searchFromName: null,
showSearch: false,
dataTypeKey: dialogOptions.dataTypeKey,
results: [],
selectedSearchResults: []
};
@@ -86,10 +87,11 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
oneTimeTreeSync.sync();
});
// get the content properties to build the anchor name list
contentResource.getById(id).then(function (resp) {
handleContentTarget(resp);
entityResource.getUrlAndAnchors(id).then(function (resp) {
$scope.anchorValues = resp.anchorValues;
$scope.model.target.url = resp.url;
});
}
} else if ($scope.model.target.url.length) {
// a url but no id/udi indicates an external link - trim the url to remove the anchor/qs
@@ -136,10 +138,11 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
if (args.node.id < 0) {
$scope.model.target.url = "/";
} else {
contentResource.getById(args.node.id).then(function (resp) {
handleContentTarget(resp);
}
else {
entityResource.getUrlAndAnchors(args.node.id).then(function (resp) {
$scope.anchorValues = resp.anchorValues;
$scope.model.target.url = resp.url;
});
}
@@ -148,10 +151,6 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
}
}
function handleContentTarget(content) {
$scope.anchorValues = tinyMceService.getAnchorNames(JSON.stringify(contentEditingHelper.getAllProps(content.variants[0])));
$scope.model.target.url = content.urls.filter(item => item.culture === $scope.currentNode.metaData.culture)[0].text;
}
function nodeExpandedHandler(args) {
// open mini list view for list views
@@ -162,9 +161,21 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
$scope.switchToMediaPicker = function () {
userService.getCurrentUser().then(function (userData) {
var startNodeId, startNodeIsVirtual;
if (dialogOptions.ignoreUserStartNodes === true) {
startNodeId = -1;
startNodeIsVirtual = true;
}
else {
startNodeId = userData.startMediaIds.length !== 1 ? -1 : userData.startMediaIds[0];
startNodeIsVirtual = userData.startMediaIds.length !== 1;
}
var mediaPicker = {
startNodeId: userData.startMediaIds.length !== 1 ? -1 : userData.startMediaIds[0],
startNodeIsVirtual: userData.startMediaIds.length !== 1,
startNodeId: startNodeId,
startNodeIsVirtual: startNodeIsVirtual,
dataTypeKey: dialogOptions.dataTypeKey,
submit: function (model) {
var media = model.selection[0];
@@ -172,7 +183,7 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
$scope.model.target.udi = media.udi;
$scope.model.target.isMedia = true;
$scope.model.target.name = media.name;
$scope.model.target.url = mediaHelper.resolveFile(media);
$scope.model.target.url = media.image;
editorService.close();
@@ -25,7 +25,7 @@
ng-model="model.target.url"
ng-disabled="model.target.id || model.target.udi" />
</umb-control-group>
<umb-control-group label="@defaultdialogs_anchorLinkPicker">
<input type="text"
list="anchors"
@@ -33,13 +33,13 @@
placeholder="@placeholders_anchor"
class="umb-property-editor umb-textstring"
ng-model="model.target.anchor" />
<datalist id="anchors">
<option value="{{a}}" ng-repeat="a in anchorValues"></option>
</datalist>
</umb-control-group>
</div>
<umb-control-group label="@defaultdialogs_nodeNameLinkPicker">
<input type="text"
localize="placeholder"
@@ -47,7 +47,7 @@
class="umb-property-editor umb-textstring"
ng-model="model.target.name" />
</umb-control-group>
<umb-control-group ng-if="showTarget" label="@content_target">
<umb-checkbox
model="vm.openInNewWindow"
@@ -58,27 +58,28 @@
<div class="umb-control-group">
<h5><localize key="defaultdialogs_linkToPage">Link to page</localize></h5>
<div ng-hide="miniListView">
<umb-tree-search-box
<umb-tree-search-box
hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
datatype-key="{{searchInfo.dataTypeKey}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<br />
<umb-tree-search-results
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch">
<umb-tree
<umb-tree
section="content"
hideheader="true"
hideoptions="true"
@@ -86,21 +87,22 @@
on-init="onTreeInit()"
enablelistviewexpand="true"
isdialog="true"
enablecheckboxes="true">
enablecheckboxes="true"
customtreeparams="{{customTreeParams}}">
</umb-tree>
</div>
</div>
<umb-mini-list-view
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="Document"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
</div>
<div class="umb-control-group">
<h5><localize key="defaultdialogs_linkToMedia">Link to media</localize></h5>
<a href ng-click="switchToMediaPicker()" class="btn">

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