diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 414c45bf13..b5c363ce59 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -88,6 +88,7 @@ This item is not published Last published Media Type + Link to media item(s) Member Group Role Member Type diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs index 014342b6f8..cf5e924ec3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs @@ -2,11 +2,15 @@ using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; +using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Umbraco.Core.IO; using umbraco.BasePages; using umbraco.cms.businesslogic; +using umbraco.cms.businesslogic.datatype.controls; +using umbraco.cms.businesslogic.media; using umbraco.cms.businesslogic.property; using umbraco.cms.businesslogic.propertytype; using umbraco.cms.businesslogic.web; @@ -14,7 +18,7 @@ using umbraco.interfaces; using umbraco.uicontrols; using Content = umbraco.cms.businesslogic.Content; using System.Linq; -using umbraco.IO; +using SystemDirectories = umbraco.IO.SystemDirectories; namespace umbraco.controls { @@ -212,9 +216,46 @@ namespace umbraco.controls ltt.Text = _content.Id.ToString(); PropertiesPane.addProperty("Id", ltt); - tpProp.Controls.AddAt(0, PropertiesPane); - tpProp.Style.Add("text-align", "center"); - //tpProp.Style.Add("padding", "10px"); + if (_content is Media) + { + PropertiesPane.addProperty(ui.Text("content", "mediatype"), new LiteralControl(_content.ContentType.Alias)); + + var uploadField = new Factory().GetNewObject(new Guid("5032a6e6-69e3-491d-bb28-cd31cd11086c")); + + try + { + var uploadProperties = _content.GenericProperties + .Where(p => p.PropertyType.DataTypeDefinition.DataType.Id == uploadField.Id + && p.Value.ToString() != "" + && File.Exists(IOHelper.MapPath(p.Value.ToString()))); + + var properties = uploadProperties as List ?? uploadProperties.ToList(); + + if (properties.Any()) + { + var linkProperties = new Pane(); + var literal = new LiteralControl { Text = String.Empty }; + + literal.Text += ""; + + foreach (var property in properties) + literal.Text += string.Format("", property.PropertyType.Name, property.Value); + + literal.Text += "
{0} {1}
"; + + linkProperties.addProperty(ui.Text("content", "mediaLinks"), literal); + tpProp.Controls.AddAt(1, linkProperties); + } + } + catch + { + //the data type definition may not exist anymore at this point because another thread may + //have deleted it. + } + + tpProp.Controls.AddAt(0, PropertiesPane); + tpProp.Style.Add("text-align", "center"); + } } } @@ -245,7 +286,7 @@ namespace umbraco.controls df.Save(); } - if(!string.IsNullOrEmpty(NameTxt.Text)) + if (!string.IsNullOrEmpty(NameTxt.Text)) _content.Text = NameTxt.Text; Save(this, new EventArgs());