Exemplo n.º 1
0
        public string GetContent(HtmlHelper htmlHelper, ViewModels.FrontEndCmsPage model, string id)
        {
            StringBuilder result = new StringBuilder();

            MediaGallery mediaGallery = new MediaGalleries().GetMediaGallery(id, model.LanguageCode);

            if (mediaGallery.IsNotNull())
            {
                result.AppendLine("<div class=\"panel panel-default\">");
                result.AppendLine("<div class=\"panel-heading\">");
                result.AppendLine("<h3 class=\"panel-title\">" + mediaGallery.MediaGalleryTitle + "</h3>");
                result.AppendLine("</div>");
                result.AppendLine("<div class=\"panel-body\">");
                MediaItems       mediaItems    = new MediaItems();
                List <MediaItem> mediaItemList = mediaItems.GetMediaItems(mediaGallery.MediaGalleryCode, true);
                result.AppendLine("<div class=\"galleria\">");
                if (mediaItemList.IsNotNull())
                {
                    string thumbImg;
                    foreach (MediaItem mediaItem in mediaItemList)
                    {
                        thumbImg = "";
                        switch (mediaItem.MediaTypeId)
                        {
                        case 1:     //Photo
                            thumbImg = HtmlHelpers.HtmlHelpers.GetThumbFromBigPhoto(mediaItem.MediaItemPath);
                            break;

                        case 2:     //YouTube Video
                            thumbImg = HtmlHelpers.HtmlHelpers.GetThumbFromYouTubeVideo(mediaItem.MediaItemPath);

                            break;
                        }
                        if (thumbImg.IsNotEmptyOrWhiteSpace())
                        {
                            result.AppendLine("<a href=\"" + mediaItem.MediaItemPath + "\"><img src=\"" + thumbImg + "\" data-title=\"" + GetMediaTitleFromLanguageCode(mediaItem.MediaItemLanguagesTitles, model.LanguageCode) + "\" data-description=\"\" /></a>");
                        }
                    }
                }
                result.AppendLine("</div>");
                result.AppendLine("</div>");
                result.AppendLine("</div>");
            }

            return(result.ToString());
        }
Exemplo n.º 2
0
        public ActionResult MediaItems(BackEndMediaItemsList backEndMediaItemsList, string id)
        {
            backEndMediaItemsList.MediaGalleryCode = id;

            MediaGallery mediaGallery = new MediaGalleries().GetMediaGallery(id);

            if (mediaGallery.IsNotNull())
            {
                MediaItems mediaItems = new MediaItems();
                backEndMediaItemsList.MediaItemsList = mediaItems.GetMediaItems(id, backEndMediaItemsList.IsActive, backEndMediaItemsList.MediaTypeId);
                if (backEndMediaItemsList.MediaItemsList.IsNull() || backEndMediaItemsList.MediaItemsList.Count == 0)
                {
                    ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.NoDataFound);
                }
            }
            else
            {
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist);
                ViewData.IsFormVisible(false);
            }

            return(View(backEndMediaItemsList));
        }