예제 #1
0
        private string renderFullSize(UserImageGalleryPlaceholderData placeholderData, CmsLocalImageOnDisk imgToShow, CmsPage page, CmsLanguage lang)
        {
            string caption = imgToShow.getImageCaption();

            StringBuilder html = new StringBuilder();

            html.Append("<div class=\"image\">");

            if (caption.Trim() != "" && (
                    placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.Top ||
                    placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.TopAndBottom))
            {
                html.Append("<div class=\"caption top\">");
                html.Append(caption);
                html.Append("</div>"); // caption
            }


            string imgTag = imgToShow.getImageHtmlTag(placeholderData.FullSizeDisplayBoxWidth, placeholderData.FullSizeDisplayBoxHeight, "");

            html.Append(imgTag);

            if (page.currentUserCanWrite)
            {
                html.Append("<div class=\"caption bottom\">");
                string formId = "userImageGallery";
                html.Append(page.getFormStartHtml(formId));
                html.Append(PageUtils.getHiddenInputHtml(UserImageGallery.UrlParamName, imgToShow.ResourceId.ToString()));
                html.Append(PageUtils.getHiddenInputHtml("action_" + imgToShow.ResourceId.ToString(), "updateCaption"));
                html.Append(PageUtils.getInputTextHtml("caption_" + imgToShow.ResourceId.ToString(), "caption_" + imgToShow.ResourceId.ToString(), caption, 40, 200));
                html.Append(" <input type=\"submit\" value=\"" + getSetCaptionText(lang) + "\">");
                html.Append(page.getFormCloseHtml(formId));
                html.Append("</div>"); // caption


                html.Append(page.getFormStartHtml(formId));
                html.Append(PageUtils.getHiddenInputHtml(UserImageGallery.UrlParamName, imgToShow.ResourceId.ToString()));
                html.Append(PageUtils.getHiddenInputHtml("action_" + imgToShow.ResourceId.ToString(), "deleteImage"));
                html.Append("<p align=\"right\">");
                html.Append(" <input type=\"submit\" value=\"" + getRemoveImageText(lang) + "\">");
                html.Append("</p>");
                html.Append(page.getFormCloseHtml(formId));
            }
            else if (caption.Trim() != "" && (
                         placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.Bottom ||
                         placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.TopAndBottom))
            {
                html.Append("<div class=\"caption bottom\">");
                html.Append(caption);
                html.Append("</div>"); // caption
            }

            html.Append("</div>");

            return(html.ToString());
        }
예제 #2
0
        private string renderThumbnail(UserImageGalleryPlaceholderData placeholderData, CmsLocalImageOnDisk img, CmsPage page)
        {
            string caption = img.getImageCaption();

            StringBuilder html = new StringBuilder();

            html.Append("<div class=\"image\">");

            if (caption.Trim() != "" && (
                    placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.Top ||
                    placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.TopAndBottom))
            {
                html.Append("<div class=\"caption top\">");
                html.Append(caption);
                html.Append("</div>"); // caption
            }


            string imgTag = img.getImageHtmlTag(placeholderData.ThumbnailDisplayBoxWidth, placeholderData.ThumbnailDisplayBoxHeight, "");

            Dictionary <string, string> pageParams = new Dictionary <string, string>();

            pageParams.Add(UrlParamName, img.ResourceId.ToString());
            html.Append("<a href=\"" + page.getUrl(pageParams) + "\">");
            html.Append(imgTag);
            html.Append("</a>");


            if (caption.Trim() != "" && (
                    placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.Bottom ||
                    placeholderData.CaptionLocation == UserImageGalleryPlaceholderData.CaptionDisplayLocation.TopAndBottom))
            {
                html.Append("<div class=\"caption bottom\">");
                html.Append(caption);
                html.Append("</div>"); // caption
            }

            html.Append("</div>");

            return(html.ToString());
        }