Beispiel #1
0
        /// <summary>
        /// Gets the photo src.
        /// </summary>
        /// <param name="item">The source item.</param>
        /// <param name="maxWidth">Width of the max.</param>
        /// <returns>The photo src.</returns>
        private static string GetPhotoSrc(Item item, int maxWidth)
        {
            XmlField field   = item.Fields["image"];
            var      srcLink = field.GetAttribute("src") + "?mw=" + maxWidth + "&mh=" + maxWidth + "&bc=white";

            return(srcLink);
        }
Beispiel #2
0
        public static string LinkFieldOptions(this Item item, ID fieldID, LinkFieldOption option)
        {
            XmlField field = item.Fields[fieldID];

            switch (option)
            {
            case LinkFieldOption.Text:
                return(field?.GetAttribute("text"));

            case LinkFieldOption.LinkType:
                return(field?.GetAttribute("linktype"));

            case LinkFieldOption.Class:
                return(field?.GetAttribute("class"));

            case LinkFieldOption.Alt:
                return(field?.GetAttribute("title"));

            case LinkFieldOption.Target:
                return(field?.GetAttribute("target"));

            case LinkFieldOption.QueryString:
                return(field?.GetAttribute("querystring"));

            case LinkFieldOption.Anchor:
                return(field?.GetAttribute("anchor"));

            default:
                throw new ArgumentOutOfRangeException(nameof(option), option, null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Builds the images HTML.
        /// </summary>
        /// <param name="itm">The source itm.</param>
        /// <returns>The images HTML.</returns>
        private string BuildImagesHtml(Item itm)
        {
            StringBuilder htmlList = new StringBuilder();

            htmlList.Append("<div class=\"title\">");
            htmlList.Append(itm.Fields["Title"].Value);
            htmlList.Append("</div>");
            XmlField xmlField = itm.Fields["image"];

            if (xmlField != null)
            {
                var strUrl = string.Concat("/~/", xmlField.GetAttribute("src"), "?w=1024&h=768&as=1&force=1");
                this.downLoadAsWallpaper.Attributes.Add("href", strUrl);
            }
            return(htmlList.ToString());
        }
Beispiel #4
0
        public static string LinkFieldTarget(this Item item, ID fieldID)
        {
            XmlField field = item.Fields[fieldID];

            return(field?.GetAttribute("target"));
        }
        public static string LinkFieldDescription(this Item item, string fieldName)
        {
            XmlField field = item?.Fields?[fieldName];

            return(field?.GetAttribute("description"));
        }
        public static string LinkFieldClass(this Item item, string fieldName)
        {
            XmlField field = item?.Fields?[fieldName];

            return(field?.GetAttribute("class"));
        }
        public static string LinkFieldTarget(this Item item, string fieldId)
        {
            XmlField field = item?.Fields?[fieldId];

            return(field?.GetAttribute("target"));
        }