Merge branch 'wip-u4-1949' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-wip-u4-1949

This commit is contained in:
Sebastiaan Janssen
2013-07-19 15:22:05 +02:00
parent 7e24af9daf
commit 90cfd004cb
4 changed files with 60 additions and 4 deletions

View File

@@ -1305,6 +1305,25 @@ namespace Umbraco.Core.Configuration
}
}
/// <summary>
/// Gets the default document type property used when adding new properties through the back-office
/// </summary>
/// <value>Configured text for the default document type property</value>
/// <remarks>If undefined, 'Textstring' is the default</remarks>
public static string DefaultDocumentTypeProperty
{
get
{
var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty");
if (string.IsNullOrEmpty(defaultDocumentTypeProperty))
{
defaultDocumentTypeProperty = "Textstring";
}
return defaultDocumentTypeProperty;
}
}
/// <summary>
/// Configuration regarding webservices
/// </summary>

View File

@@ -105,6 +105,9 @@
<!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
<disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd</disallowedUploadFiles>
<!-- Defines the default document type property used when adding properties in the back-office (if missing or empty, defaults to Textstring -->
<defaultDocumentTypeProperty>Textstring</defaultDocumentTypeProperty>
</content>
<security>

View File

@@ -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)
{

View File

@@ -581,6 +581,16 @@ namespace umbraco
get { return Umbraco.Core.Configuration.UmbracoSettings.IconPickerBehaviour; }
}
/// <summary>
/// Gets the default document type property used when adding new properties through the back-office
/// </summary>
/// <value>Configured text for the default document type property</value>
/// <remarks>If undefined, 'Textstring' is the default</remarks>
public static string DefaultDocumentTypeProperty
{
get { return Umbraco.Core.Configuration.UmbracoSettings.DefaultDocumentTypeProperty; }
}
/// <summary>
/// Configuration regarding webservices
/// </summary>