/// <summary>
        /// Gets the list items.
        /// </summary>
        /// <param name="status">The status.</param>
        /// <returns></returns>
        public List <SelectListItem> GetListItems(MediaStatus status)
        {
            List <SelectListItem> items = PhotoHtmlHelper.PrivacyList();

            items.ForEach(o => o.Selected = o.Value.Equals(status.ToString(), StringComparison.InvariantCultureIgnoreCase));
            return(items);
        }
        /// <summary>
        /// Gets the photo detail links.
        /// </summary>
        /// <param name="media">The media.</param>
        /// <param name="isAuthenticated">if set to <c>true</c> [is authenticated].</param>
        /// <returns></returns>
        private string GetDetailSection(Media media, bool isAuthenticated)
        {
            ITagService tagService = DependencyInjection.Resolve <ITagService>();

            string html = @"<ul>
                        <li>
                        <span>";

            html += (isAuthenticated ? @"<a id=""editlink""  href=""{0}/photos/edit/{1}"">edit</a>" : string.Empty);
            html += @"</span>            
                    </li>";
            html += "{2}";
            html += @"          
                    </li>
                     {3}        
                    <li><span><a href=""{0}/comments/leave/{1}"">comments ({4})</a></span> 
                </ul>";

            string tags = string.Empty;

            if (!string.IsNullOrEmpty(media.Tags))
            {
                const string tagFormat    = @"<li><span>tags:</span> {0}</li>";
                string       renderedTags = tagService.HyperlinkTheTags(media.Tags, media.Owner.Username);
                tags = string.Format(tagFormat, renderedTags);
            }

            string date    = PhotoHtmlHelper.GetDate(media);
            string content = string.Format(html, UrlService.UserRoot(media.Owner.Username), HttpUtility.HtmlEncode(media.MediaId.ToString()), date, tags, media.CommentCount); return(content);
        }
Beispiel #3
0
        /// <summary>
        /// Renders the specified media.
        /// </summary>
        /// <param name="media">The media.</param>
        /// <param name="user">The user.</param>
        /// <param name="set">The set.</param>
        /// <returns></returns>
        public static string Render(IList <Media> media, User user, string set)
        {
            IUserUrlService urlService = UserUrlService.GetInstance(user);
            StringBuilder   builder    = new StringBuilder();

            const string thumbFormat = @"
                                        <div class=""thumbnails"" {3}>
                                            <span >
                                                <a href=""{9}"" rel=""{0}"" name=""{4}"" class=""showimage lightbox"" title=""{2}"" ><img src=""{1}""  alt=""{2}"" /></a>
                                            </span>
                                        
                                            <ul class=""largethumbnailmetadata"" >
                                                <li class=""title"" >{5}</li>
                                                <li>{6}</li>
                                                <li class=""comment hyperlinks"" ><a href=""{8}/comments/leave/{4}"">comments ({7})</a></li>
                                            </ul>
                                        </div>";

            if (media == null)
            {
                throw new System.ArgumentNullException("media", "Parameter 'media' is null, value expected");
            }

            if (media.Count > 0)
            {
                string imagePath = PhotoHtmlHelper.GetImageDetailLinkForFirst(media[0], "homepagefullsize", set, PhotoType.Websize);
                builder.AppendLine(string.Format("<div class=\"firstimage\" >{0} <div > <h3 class=\"firstphototitle\" >{1}</h3> <p>{2}</p></div> <br class=\"clearboth\" /> </div>", imagePath, media[0].Title, media[0].Description));

                if (media.Count > 15)
                {
                    builder.AppendLine("<div class=\"largethumbs\" >");

                    for (int index = 1; index < media.Count && index < 16; index++)
                    {
                        string    showUrl    = urlService.UserUrl("photos/show/" + set + "/#/photo/" + media[index].MediaId);
                        MediaFile webSize    = media[index].GetImageByPhotoType(PhotoType.Websize);
                        string    websizeUrl = urlService.CreateImageUrl(webSize.FilePath);
                        builder.AppendLine(string.Format(thumbFormat,
                                                         websizeUrl,
                                                         websizeUrl,
                                                         media[index].Title,
                                                         (index % 3 == 0 ? "style=\"margin-right:0px;\"" : string.Empty),
                                                         media[index].MediaId,
                                                         TruncateText(media[index].Title, 20),
                                                         TruncateText(media[index].Description, 35),
                                                         media[index].CommentCount,
                                                         urlService.UserRoot(),
                                                         showUrl));
                    }

                    builder.AppendLine("<div class=\"clearboth\" ></div>");
                    builder.AppendLine("</div>");
                }
            }

            return(builder.ToString());
        }
Beispiel #4
0
        /// <summary>
        /// Gets the friend HTML.
        /// </summary>
        /// <param name="friends">The friends.</param>
        /// <param name="builder">The builder.</param>
        /// <param name="username">The username.</param>
        /// <returns></returns>
        private static string GetFriendHtml(IEnumerable <Friend> friends, StringBuilder builder, string username)
        {
            builder.AppendLine(string.Format("<h3><a href=\"/{0}/friends\" >friends</a></h3>", username));
            builder.AppendLine("<ul class=\"thumbs\">");

            foreach (Friend t in friends)
            {
                builder.AppendLine(PhotoHtmlHelper.GetFriendImageThumbnailForUserHomepage(t));
            }

            builder.AppendLine("</ul>");
            builder.AppendLine("<div style=\"clear:both;\" ></div>");

            return(builder.ToString());
        }
 /// <summary>
 /// Gets the image link.
 /// </summary>
 /// <param name="set">The set.</param>
 /// <param name="media">The media.</param>
 /// <returns></returns>
 public string GetImageLink(string set, Media media)
 {
     return(PhotoHtmlHelper.GetImageLink(set, media));
 }
        /// <summary>
        /// Gets the media.
        /// </summary>
        /// <param name="media">The media.</param>
        /// <returns></returns>
        public JsonResult Details(Media media)
        {
            string linkHtml = PhotoHtmlHelper.GetPhotoDetailLinks(media, Authorization.IsOwner);

            return(Json(new { detailHtml = linkHtml, mediaTitle = media.Title, mediaDescription = media.Description }, "application/json", JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Metas the specified id.
        /// </summary>
        /// <param name="media">The media.</param>
        /// <returns></returns>
        public ActionResult Meta(Media media)
        {
            string content = PhotoHtmlHelper.GetPhotoDetailLinks(media, Authorization.IsOwner);

            return(Content(content));
        }
Beispiel #8
0
        /// <summary>
        /// Gets the list items.
        /// </summary>
        /// <returns></returns>
        public List <SelectListItem> GetListItems()
        {
            List <SelectListItem> items = PhotoHtmlHelper.PrivacyList();

            return(items);
        }