Пример #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            uploadfield.DataTypeUploadField uft = new uploadfield.DataTypeUploadField();

            cms.businesslogic.Content c = cms.businesslogic.media.Media.GetContentFromVersion(_data.Version);

            //store children array here because iterating over an Array property object is very inneficient.
            var children = c.Children;

            foreach (BusinessLogic.console.IconI cc in children)
            {
                cms.businesslogic.media.Media m = new cms.businesslogic.media.Media(cc.UniqueId);
                var props = m.getProperties;
                foreach (cms.businesslogic.property.Property p in props)
                {
                    if (p.PropertyType.DataTypeDefinition.DataType.Id == uft.Id && p.Value.ToString() != "")
                    {
                        // Check for thumbnail!
                        string fileNameOrg   = p.Value.ToString();
                        string ext           = fileNameOrg.Substring(fileNameOrg.LastIndexOf(".") + 1, fileNameOrg.Length - fileNameOrg.LastIndexOf(".") - 1);
                        string fileNameThumb = fileNameOrg.Replace("." + ext, "_thumb.jpg");
                        if (File.Exists(IOHelper.MapPath(IOHelper.FindFile(fileNameThumb))))
                        {
                            writer.WriteLine("<a href=\"?id=" + m.Id.ToString() + "\"><img src=\"" + IOHelper.ResolveUrl(fileNameThumb) + "\" alt=\"" + m.Text + "\" style=\"border: none\"/></a> &nbsp; ");
                        }
                    }
                }
            }
            base.Render(writer);
        }
Пример #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            uploadfield.DataTypeUploadField uft = new uploadfield.DataTypeUploadField();

            Cms.BusinessLogic.Content c = Cms.BusinessLogic.media.Media.GetContentFromVersion(_data.Version);
            foreach (BusinessLogic.Console.IIcon cc in c.Children)
            {
                Cms.BusinessLogic.media.Media m = new Cms.BusinessLogic.media.Media(cc.UniqueId);
                foreach (Cms.BusinessLogic.property.Property p in m.getProperties)
                {
                    if (p.PropertyType.DataTypeDefinition.DataType.Id == uft.Id && p.Value.ToString() != "")
                    {
                        // Check for thumbnail!
                        string fileNameOrg   = p.Value.ToString();
                        string ext           = fileNameOrg.Substring(fileNameOrg.LastIndexOf(".") + 1, fileNameOrg.Length - fileNameOrg.LastIndexOf(".") - 1);
                        string fileNameThumb = umbraco.GlobalSettings.Path + "/.." + fileNameOrg.Replace("." + ext, "_thumb.jpg");
                        if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(fileNameThumb)))
                        {
                            writer.WriteLine("<a href=\"?id=" + m.Id.ToString() + "\"><img src=\"" + fileNameThumb + "\" alt=\"" + m.Text + "\" style=\"border: none\"/></a> &nbsp; ");
                        }
                    }
                }
            }
            base.Render(writer);
        }
Пример #3
0
		protected override void Render(HtmlTextWriter writer)
		{
			uploadfield.DataTypeUploadField uft = new uploadfield.DataTypeUploadField();
		
			Cms.BusinessLogic.Content c = Cms.BusinessLogic.media.Media.GetContentFromVersion(_data.Version);
			foreach (BusinessLogic.Console.IIcon cc in c.Children) 
			{
				Cms.BusinessLogic.media.Media m = new Cms.BusinessLogic.media.Media(cc.UniqueId);
				foreach (Cms.BusinessLogic.property.Property p in m.getProperties) 
				{
					if (p.PropertyType.DataTypeDefinition.DataType.Id == uft.Id && p.Value.ToString() != "") 
					{
						// Check for thumbnail!
						string fileNameOrg = p.Value.ToString();
						string ext = fileNameOrg.Substring(fileNameOrg.LastIndexOf(".")+1, fileNameOrg.Length-fileNameOrg.LastIndexOf(".")-1);
						string fileNameThumb = umbraco.GlobalSettings.Path + "/.." + fileNameOrg.Replace("."+ext, "_thumb.jpg");
						if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(fileNameThumb)))  
						{
							writer.WriteLine("<a href=\"?id=" +  m.Id.ToString() + "\"><img src=\"" + fileNameThumb + "\" alt=\"" + m.Text + "\" style=\"border: none\"/></a> &nbsp; ");
						}
					}
				}
			}
			base.Render (writer);
		}