Exemplo n.º 1
0
        protected string RenderPictureTag(string urlPhoto, string additionalUrlPhoto, string urlPath, string photoDesc, string productName, int photoId, int productId)
        {
            string strFormat = string.Empty;

            string alt = photoDesc.IsNotEmpty() ? photoDesc : productName + " - " + Resource.ClientPage_AltText + " " + photoId;

            switch (ViewMode)
            {
            case SettingsCatalog.ProductViewMode.Tiles:
                strFormat = string.Format("<a class=\"pv-lnk-photo\" href=\"{0}\"><img src=\"{1}\" alt=\"{2}\" class=\"scp-img p-photo {4}\" {3} /></a>", urlPath,
                                          FoldersHelper.GetImageProductPath(ProductImageType.Small, additionalUrlPhoto.IsNotEmpty() ? additionalUrlPhoto : urlPhoto, false),
                                          HttpUtility.HtmlEncode(alt),
                                          InplaceEditor.Image.AttributesProduct(photoId == 0 ? productId : photoId, productId, ProductImageType.Small, true, !urlPhoto.IsNullOrEmpty(), !urlPhoto.IsNullOrEmpty()),
                                          InplaceEditor.CanUseInplace(RoleActionKey.DisplayCatalog) ? "js-inplace-image-visible-permanent" : "");
                break;

            case SettingsCatalog.ProductViewMode.List:
                strFormat = string.Format("<a class=\"pv-lnk-photo\" href=\"{0}\"><img src=\"{1}\" alt=\"{2}\" class=\"scp-img p-photo {4}\" {3}/></a>", urlPath,
                                          FoldersHelper.GetImageProductPath(ProductImageType.Small, additionalUrlPhoto.IsNotEmpty() ? additionalUrlPhoto : urlPhoto, false),
                                          HttpUtility.HtmlEncode(alt),
                                          InplaceEditor.Image.AttributesProduct(photoId == 0 ? productId : photoId, productId, ProductImageType.Small, true, !urlPhoto.IsNullOrEmpty(), !urlPhoto.IsNullOrEmpty()),
                                          InplaceEditor.CanUseInplace(RoleActionKey.DisplayCatalog) ? "js-inplace-image-visible-permanent" : "");
                break;

            case SettingsCatalog.ProductViewMode.Table:
                if (urlPhoto.IsNotEmpty())
                {
                    strFormat = string.Format("abbr=\"{0}\"",
                                              FoldersHelper.GetImageProductPath(ProductImageType.Small, additionalUrlPhoto.IsNotEmpty() ? additionalUrlPhoto : urlPhoto, false));
                }
                break;
            }
            return(strFormat);
        }
Exemplo n.º 2
0
        protected string RenderPictureTag(int productId, string strPhoto, string urlpath, string photoDesc, string productName, int photoId)
        {
            string alt = photoDesc.IsNotEmpty() ? photoDesc : productName + " - " + Resource.ClientPage_AltText + " " + photoId;

            return
                (string.Format(
                     "<a href=\"{0}\" class=\"mp-pv-lnk\"><img src=\"{1}\" alt=\"{2}\" class=\"pv-photo p-photo scp-img {5}\" {3} {4}></a>",
                     UrlService.GetLink(ParamType.Product, urlpath, productId), strPhoto.IsNotEmpty()
                                                                                   ? FoldersHelper.GetImageProductPath(ProductImageType.Small, strPhoto, false)
                                                                                   : "images/nophoto_small.jpg",
                     HttpUtility.HtmlEncode(alt), Mode == SettingsDesign.eMainPageMode.Default ? "style=\"max-width:100%;\"" : "",
                     InplaceEditor.Image.AttributesProduct(photoId == 0 ? productId : photoId, productId, ProductImageType.Small, true, !strPhoto.IsNullOrEmpty(), !strPhoto.IsNullOrEmpty()),
                     InplaceEditor.CanUseInplace(RoleActionKey.DisplayCatalog) ? "js-inplace-image-visible-permanent" : ""));
        }
Exemplo n.º 3
0
        public string RenderHtml()
        {
            string       resStrHtml = string.Empty;
            const string aTag       = "<a href=\"{0}\" {1} {2}>{3}</a>";
            const string imgTag     = "<img id=\"logo\" src=\"{0}\" {1} {2} {3}/>";


            //Source

            if (SettingsMain.LogoImageName.IsNullOrEmpty() && InplaceEditor.CanUseInplace(RoleActionKey.DisplayCommonSettings))
            {
                ImgSource = "images/nophoto-logo.png";
            }
            else if (SettingsMain.LogoImageName.IsNullOrEmpty())
            {
                return(string.Empty);
            }

            //Alt
            string alt = !string.IsNullOrEmpty(ImgAlt) ? string.Format("alt=\"{0}\"", ImgAlt) : string.Empty;
            //CssClass
            string cssClass = string.Format("class=\"{0}{1}\"",
                                            (!string.IsNullOrEmpty(CssClassImage) ? CssClassImage : string.Empty),
                                            InplaceEditor.CanUseInplace(RoleActionKey.DisplayCommonSettings)? " js-inplace-image-visible-permanent" : string.Empty);

            //Result
            resStrHtml = string.Format(imgTag, ImgSource, alt, cssClass, AdvantShop.CMS.InplaceEditor.Image.AttributesLogo());
            //---------------------------------------------------------------------------

            //Creating href tag----------------------------------------------------------
            if (EnableHref && !string.IsNullOrEmpty(ImgHref))
            {
                //Href
                string href = UrlService.GetAbsoluteLink(ImgHref);
                //Title
                string title = !string.IsNullOrEmpty(Title) ? string.Format("title=\"{0}\"", Title) : string.Empty;
                //CssClass
                cssClass = !string.IsNullOrEmpty(CssClassHref) ? string.Format("class=\"{0}\"", CssClassHref) : string.Empty;
                //Href
                string image = resStrHtml;
                //Result
                resStrHtml = string.Format(aTag, href, title, cssClass, image);
            }
            //----------------------------------------------------------------------------

            return(resStrHtml);
        }
Exemplo n.º 4
0
        protected string RenderCategoryImage(string imageUrl, int categoryId, string urlPath, string categoryName)
        {
            var result = string.Empty;


            if (imageUrl.IsNullOrEmpty() && !CustomerContext.CurrentCustomer.IsAdmin)
            {
                return(result);
            }


            result = string.Format("<a class=\"cat-lnk\" href=\"{0}\"><img src=\"{1}\" class=\"cat-image {4}\" alt=\"{2}\" title=\"{2}\" {3}/></a>",
                                   UrlService.GetLink(ParamType.Category, urlPath, SQLDataHelper.GetInt(categoryId)),
                                   imageUrl.IsNullOrEmpty() ? "images/nophoto_small.jpg" : FoldersHelper.GetImageCategoryPath(CategoryImageType.Small, imageUrl, false),
                                   HttpUtility.HtmlEncode(categoryName),
                                   InplaceEditor.Image.AttributesCategory(categoryId, InplaceEditor.Image.Field.CategorySmall),
                                   InplaceEditor.CanUseInplace(RoleActionKey.DisplayCatalog) ? "js-inplace-image-visible-permanent" : "");


            return(result);
        }