diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js index 947603794a..a56af3b4ae 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js @@ -17,11 +17,21 @@ function contentPickerController($scope, entityResource, editorState, iconHelper $scope.$watch(function () { //return the joined Ids as a string to watch return _.map($scope.renderModel, function (i) { - return i.id; + if ($scope.model.config.idType === "udi") { + return i.udi; + } + else { + return i.id; + } }).join(); }, function (newVal) { var currIds = _.map($scope.renderModel, function (i) { - return i.id; + if ($scope.model.config.idType === "udi") { + return i.udi; + } + else { + return i.id; + } }); $scope.model.value = trim(currIds.join(), ","); @@ -200,7 +210,12 @@ function contentPickerController($scope, entityResource, editorState, iconHelper $scope.add = function (item) { var currIds = _.map($scope.renderModel, function (i) { - return i.id; + if ($scope.model.config.idType === "udi") { + return i.udi; + } + else { + return i.id; + } }); if (currIds.indexOf(item.id) < 0) { @@ -227,7 +242,12 @@ function contentPickerController($scope, entityResource, editorState, iconHelper var unsubscribe = $scope.$on("formSubmitting", function (ev, args) { var currIds = _.map($scope.renderModel, function (i) { - return i.id; + if ($scope.model.config.idType === "udi") { + return i.udi; + } + else { + return i.id; + } }); $scope.model.value = trim(currIds.join(), ","); }); @@ -244,7 +264,12 @@ function contentPickerController($scope, entityResource, editorState, iconHelper _.each(modelIds, function (id, i) { var entity = _.find(data, function (d) { - return d.id == id; + if ($scope.model.config.idType === "udi") { + return d.udi == id; + } + else { + return d.id == id; + } }); if (entity) { @@ -304,6 +329,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper $scope.renderModel.push({ "name": item.name, "id": item.id, + "udi": item.udi, "icon": item.icon, "path": item.path, "url": item.url, diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs index 7ccd5e2495..d1508d2012 100644 --- a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs @@ -13,7 +13,10 @@ namespace Umbraco.Web.PropertyEditors [PropertyEditor(Constants.PropertyEditors.ContentPickerAlias, "(Obsolete) Content Picker", PropertyEditorValueTypes.Integer, "contentpicker", IsParameterEditor = true, Group = "Pickers", IsDeprecated = true)] public class ContentPickerPropertyEditor : ContentPickerPropertyEditor2 { - + public ContentPickerPropertyEditor() + { + InternalPreValues["idType"] = "int"; + } } /// @@ -25,20 +28,21 @@ namespace Umbraco.Web.PropertyEditors public ContentPickerPropertyEditor2() { - _internalPreValues = new Dictionary + InternalPreValues = new Dictionary { {"startNodeId", "-1"}, {"showOpenButton", "0"}, {"showEditButton", "0"}, - {"showPathOnHover", "0"} + {"showPathOnHover", "0"}, + {"idType", "udi"} }; } - private IDictionary _internalPreValues; + protected IDictionary InternalPreValues; public override IDictionary DefaultPreValues { - get { return _internalPreValues; } - set { _internalPreValues = value; } + get { return InternalPreValues; } + set { InternalPreValues = value; } } protected override PreValueEditor CreatePreValueEditor() diff --git a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs index 169d0d4639..d835209362 100644 --- a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web.PropertyEditors { {"multiPicker", "0"}, {"onlyImages", "0"}, - {"idType", "id"} + {"idType", "int"} }; }