diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/UmbracoSettings.cs index 9eadbb2f34..4ed5027539 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings.cs @@ -1305,6 +1305,25 @@ namespace Umbraco.Core.Configuration } } + /// + /// Gets the default document type property used when adding new properties through the back-office + /// + /// Configured text for the default document type property + /// If undefined, 'Textstring' is the default + public static string DefaultDocumentTypeProperty + { + get + { + var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty"); + if (string.IsNullOrEmpty(defaultDocumentTypeProperty)) + { + defaultDocumentTypeProperty = "Textstring"; + } + + return defaultDocumentTypeProperty; + } + } + /// /// Configuration regarding webservices /// diff --git a/src/Umbraco.Web.UI/config/umbracoSettings.config b/src/Umbraco.Web.UI/config/umbracoSettings.config index e5e88a781a..4510e6ae2f 100644 --- a/src/Umbraco.Web.UI/config/umbracoSettings.config +++ b/src/Umbraco.Web.UI/config/umbracoSettings.config @@ -105,6 +105,9 @@ ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd + + + Textstring diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs index 4106275165..7390d4fbd5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs @@ -130,7 +130,7 @@ namespace umbraco.controls.GenericProperties tbValidation.Text = ""; tbDescription.Text = ""; ddlTab.SelectedIndex = 0; - ddlTypes.SelectedIndex = 0; + SetDefaultDocumentTypeProperty(); checkMandatory.Checked = false; } @@ -195,13 +195,24 @@ namespace umbraco.controls.GenericProperties if (_dataTypeDefinitions != null) { ddlTypes.Items.Clear(); + var itemSelected = false; foreach(cms.businesslogic.datatype.DataTypeDefinition dt in _dataTypeDefinitions) { - ListItem li = new ListItem(dt.Text, dt.Id.ToString()); - if (_pt != null && _pt.DataTypeDefinition.Id == dt.Id) - li.Selected = true; + var li = new ListItem(dt.Text, dt.Id.ToString()); + if ((_pt != null && _pt.DataTypeDefinition.Id == dt.Id)) + { + li.Selected = true; + itemSelected = true; + } + ddlTypes.Items.Add(li); } + + // If item not selected from previous edit or load, set to default according to settings + if (!itemSelected) + { + SetDefaultDocumentTypeProperty(); + } } // tabs @@ -234,6 +245,19 @@ namespace umbraco.controls.GenericProperties tbDescription.Text = _pt.GetRawDescription(); } + private void SetDefaultDocumentTypeProperty() + { + var itemToSelect = ddlTypes.Items.FindByText(UmbracoSettings.DefaultDocumentTypeProperty); + if (itemToSelect != null) + { + itemToSelect.Selected = true; + } + else + { + ddlTypes.SelectedIndex = -1; + } + } + protected void defaultDeleteHandler(object sender, System.EventArgs e) { diff --git a/src/umbraco.businesslogic/UmbracoSettings.cs b/src/umbraco.businesslogic/UmbracoSettings.cs index 1b82199d38..647ce1dd0a 100644 --- a/src/umbraco.businesslogic/UmbracoSettings.cs +++ b/src/umbraco.businesslogic/UmbracoSettings.cs @@ -581,6 +581,16 @@ namespace umbraco get { return Umbraco.Core.Configuration.UmbracoSettings.IconPickerBehaviour; } } + /// + /// Gets the default document type property used when adding new properties through the back-office + /// + /// Configured text for the default document type property + /// If undefined, 'Textstring' is the default + public static string DefaultDocumentTypeProperty + { + get { return Umbraco.Core.Configuration.UmbracoSettings.DefaultDocumentTypeProperty; } + } + /// /// Configuration regarding webservices ///