Ejemplo n.º 1
0
        private void ShowImage()
        {
            if (moduleId == -1) { return; }

            Gallery gallery = new Gallery(moduleId);
            DataTable dt = gallery.GetWebImageByPage(pageNumber);

            if (dt.Rows.Count > 0)
            {
                itemId = Convert.ToInt32(dt.Rows[0]["ItemID"]);
                totalPages = Convert.ToInt32(dt.Rows[0]["TotalPages"]);
            }

            showTechnicalData = WebUtils.ParseBoolFromHashtable(
                moduleSettings, "GalleryShowTechnicalDataSetting", false);

            if (itemId == -1) { return; }

            Literal topPageLinks = new Literal();
            string pageUrl = SiteRoot
                + "/ImageGallery/GalleryBrowse.aspx?"
                + "pageid=" + pageId.ToInvariantString()
                + "&mid=" + moduleId.ToInvariantString()
                + "&pagenumber=";

            topPageLinks.Text = UIHelper.GetPagerLinksWithPrevNext(
                pageUrl,1,
                this.totalPages,
                this.pageNumber,
                "modulepager",
                "SelectedPage");

            this.spnTopPager.Controls.Add(topPageLinks);

            GalleryImage galleryImage = new GalleryImage(moduleId, itemId);

            imageLink.Text = "<a onclick=\"window.open(this.href,'_blank');return false;\"  href='" + ImageSiteRoot
                + fullSizeBaseUrl + galleryImage.ImageFile + "' ><img  src='"
                + ImageSiteRoot + webSizeBaseUrl
                + galleryImage.WebImageFile + "' alt='"
                + Resources.GalleryResources.GalleryWebImageAltText + "' /></a>";

            this.pnlGallery.Controls.Add(imageLink);
            this.lblCaption.Text = Server.HtmlEncode(galleryImage.Caption);
            this.lblDescription.Text = galleryImage.Description;

            if(showTechnicalData)
            {
                if(galleryImage.MetaDataXml.Length > 0)
                {
                    xmlMeta.DocumentContent = galleryImage.MetaDataXml;
                    string xslPath = System.Web.HttpContext.Current.Server.MapPath(SiteRoot + "/ImageGallery/GalleryMetaData.xsl");
                    xmlMeta.TransformSource = xslPath;
                }
            }
        }