예제 #1
0
    private string GetEmbedCode(string path, string filename)
    {
        SiteFile file = SiteFiles.GetFile(path, filename);

        if (file != null)
        {
            if (!GlobalSettings.IsImage(filename))
            {
                return(string.Format("<a href=\"{0}\">{1}</a>", FileStorageProvider.GetGenericDownloadUrl(file.File), filename));
            }
            else
            {
                int width  = 200;
                int height = 200;
                try
                {
                    width = int.Parse(this.txtWidth.Text);
                }
                catch { }
                try
                {
                    height = int.Parse(this.txtHeight.Text);
                }
                catch { }

                return(GlobalSettings.ResizeImageHtml(SiteUrlManager.GetResizedImageUrl(file.File, width, height), width, height, false));
            }
        }
        else
        {
            return(string.Empty);
        }
    }
 protected void egvIndustries_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         ProductIndustry industry     = e.Row.DataItem as ProductIndustry;
         Image           industryLogo = e.Row.FindControl("IndustryLogo") as Image;
         if (industryLogo != null)
         {
             if (industry.File != null)
             {
                 industryLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)industryLogo.Width.Value, (int)industryLogo.Height.Value);
             }
             else
             {
                 industryLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)industryLogo.Width.Value, (int)industryLogo.Height.Value);
             }
         }
         HyperLink hyName = e.Row.FindControl("hlIndustryName") as HyperLink;
         if (hyName != null)
         {
             hyName.Text        = industry.IndustryName;
             hyName.NavigateUrl = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?product-product&ii=" + industry.IndustryID;
         }
     }
 }
    void BindData()
    {
        if (brandID != 0)
        {
            btnPost.Text = "更新";
        }
        ProductBrand brand = ProductBrands.GetProductBrand(brandID);

        if (brand == null)
        {
            brand = new ProductBrand();
        }

        this.txtBrandAbstract.Text = brand.BrandAbstract;
        this.txtBrandContent.Text  = brand.BrandContent;
        if (!string.IsNullOrEmpty(brand.BrandGroup))
        {
            ddlBrandGroup.SelectedItem.Selected = false;
            ddlBrandGroup.Items.FindByText(brand.BrandGroup).Selected = true;
        }
        this.txtBrandName.Text    = brand.BrandName;
        this.txtBrandTitle.Text   = brand.BrandTitle;
        this.txtDisplayOrder.Text = brand.DisplayOrder.ToString();
        csBrand.SelectedValue     = brand.BrandStatus;
        if (brand.File != null)
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(brand.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
        else
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
    }
예제 #4
0
 /// <summary>
 /// 获取默认图像
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <returns></returns>
 public string GetDefaultImageUrl(int width, int height)
 {
     if (width == 0 || height == 0)
     {
         if (File != null)
         {
             return(FileStorageProvider.GetGenericDownloadUrl(File));
         }
         else
         {
             return(SiteUrlManager.GetNoPictureUrl());
         }
     }
     else
     {
         if (File == null)
         {
             return(SiteUrlManager.GetNoPictureUrl(width, height));
         }
         else
         {
             return(SiteUrlManager.GetResizedImageUrl(File, width, height));
         }
     }
 }
예제 #5
0
    void BindData()
    {
        ShowPicture showPicture = null;

        if (action == OperateType.Edit)
        {
            showPicture = ShowPictures.Get(showPictureID);
        }
        else
        {
            showPicture = new ShowPicture();
        }
        this.txtDescription.Text  = showPicture.Description;
        this.txtLink.Text         = showPicture.Link;
        this.txtTitle.Text        = showPicture.Title;
        this.txtDisplayOrder.Text = showPicture.DisplayOrder.ToString();
        if (showPicture.File != null)
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(showPicture.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
        else
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
    }
예제 #6
0
 protected void egvBrands_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         ProductBrand brand     = e.Row.DataItem as ProductBrand;
         Image        brandLogo = e.Row.FindControl("BrandLogo") as Image;
         if (brandLogo != null)
         {
             if (brand.File != null)
             {
                 brandLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(brand.File, (int)brandLogo.Width.Value, (int)brandLogo.Height.Value);
             }
             else
             {
                 brandLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)brandLogo.Width.Value, (int)brandLogo.Height.Value);
             }
         }
         HyperLink hyName = e.Row.FindControl("hlBrandName") as HyperLink;
         if (hyName != null)
         {
             hyName.Text        = brand.BrandName;
             hyName.NavigateUrl = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?product-product&bi=" + brand.BrandID;
         }
     }
 }
예제 #7
0
    protected void Button33_Click(object sender, EventArgs e)
    {
        ProductBrand brand = ProductBrands.GetProductBrand(10);

        Image1.ImageUrl        = SiteUrlManager.GetResizedImageUrl(brand.File, 80, 80);
        HyperLink2.NavigateUrl = brand.Url;
        HyperLink2.Text        = brand.BrandLogo;
    }
    void BindData()
    {
        SiteSettings settings = SiteSettingsManager.GetSiteSettings();

        this.txtCopyright.Text             = settings.Copyright;
        this.txtSearchMetaDescription.Text = settings.SearchMetaDescription;
        this.txtSearchMetaKeywords.Text    = settings.SearchMetaKeywords;
        this.txtSiteDesc.Text   = settings.SiteDescription;
        this.txtSiteName.Text   = settings.SiteName;
        this.txtIdea.Text       = settings.CompanyIdea;
        this.txtService.Text    = settings.CompanyService;
        this.txtServiceTel.Text = settings.ServiceTel;
        this.txtICP.Text        = settings.CompanyICP;
        this.imgShow.ImageUrl   = SiteUrlManager.GetShowPicture((int)this.imgShow.Width.Value, (int)this.imgShow.Height.Value);
    }
예제 #9
0
 protected void egvShowPictures_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         ShowPicture picture          = e.Row.DataItem as ShowPicture;
         Image       showPictureThumb = e.Row.FindControl("ShowPictureThumb") as Image;
         if (showPictureThumb != null)
         {
             if (picture.File != null)
             {
                 showPictureThumb.ImageUrl = SiteUrlManager.GetResizedImageUrl(picture.File, (int)showPictureThumb.Width.Value, (int)showPictureThumb.Height.Value);
             }
             else
             {
                 showPictureThumb.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)showPictureThumb.Width.Value, (int)showPictureThumb.Height.Value);
             }
         }
     }
 }
예제 #10
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            base.Render(writer);


            if (!this.Page.ClientScript.IsStartupScriptRegistered(base.GetType(), "HHOnlineOptions"))
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "HHOnlineOptions", "");
                writer.Write("\r\n<script language=\"javascript\" type=\"text/javascript\">\r\n// <![CDATA[\r\n");
                writer.Write("tinyMCE_HHOnlineOptions = new Object();\r\n");
                writer.Write(@"tinyMCE_HHOnlineOptions.InsertMediaOpenFunction = function()
                {
                      $.fn.jmodal({
                        title: '插入媒体',
                        initWidth: 500,
                        closable:false,
                        content: function(sender, args) {
                            window.$mceHideJModal = args.cancel;
                                sender.height(260);
                                sender.attr('src', '" + SiteUrlManager.GetInsertMediaUrl() + @"?t='+Math.random());
                            }
                         });
                };");
                writer.Write("\r\n// ]]>\r\n</script>");
            }
            if (!this.Page.ClientScript.IsStartupScriptRegistered(base.GetType(), this.ClientID))
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), this.ClientID, "");
                writer.Write("\r\n<script language=\"javascript\" type=\"text/javascript\">\r\n// <![CDATA[\r\n");
                writer.Write(@"function InsertContentToHtmlEditor(content)
                {{
                    var bm = tinyMCE.activeEditor.selection.getBookmark();
                    tinyMCE.get('{0}').execCommand('mceInsertContent',false,content);
                    tinyMCE.activeEditor.selection.moveToBookmark(bm);
                }}", this.ClientID);

                writer.Write("tinyMCE.init({mode:'exact',relative_urls:false,");
                //writer.Write("setup:new Function('ed', 'tinyMCE_HHOnlineOptions.Setup(ed);'),");
                writer.Write("elements:'{0}',language:'zh'{1}}});", this.ClientID.ToString(), this.GetFormattedOptions());

                writer.Write("\r\n// ]]>\r\n</script>");
            }
        }
    void BindData()
    {
        ProductIndustry industry = null;

        if (action == OperateType.Add)
        {
            industry          = new ProductIndustry();
            industry.ParentID = parentID;
        }
        else
        {
            industry     = ProductIndustries.GetProductIndustry(industryID);
            btnPost.Text = "更新";
        }

        if (industry.ParentID == 0)
        {
            parentRow.Visible = false;
        }
        else
        {
            parentRow.Visible  = true;
            lblParentName.Text = ProductIndustries.GetProductIndustry(industry.ParentID).IndustryName;
        }

        this.txtIndustryAbstract.Text = industry.IndustryAbstract;
        this.txtIndustryContent.Text  = industry.IndustryContent;
        this.txtIndustryName.Text     = industry.IndustryName;
        this.txtIndustryTitle.Text    = industry.IndustryTitle;
        this.txtDisplayOrder.Text     = industry.DisplayOrder.ToString();
        this.csIndustry.SelectedValue = industry.IndustryStatus;
        if (industry.File != null)
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
        else
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
    }
예제 #12
0
 /// <summary>
 /// 获取默认图像
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <returns></returns>
 public string GetDefaultImageUrl(int width, int height)
 {
     //if (width == 0 || height == 0)
     //{
     //    if (DefaultImageFile != null)
     //        return FileStorageProvider.GetGenericDownloadUrl(DefaultImageFile);
     //    else
     //        return SiteUrlManager.GetNoPictureUrl();
     //}
     //else
     //{
     //    if (DefaultImageFile == null)
     //    {
     //        return SiteUrlManager.GetNoPictureUrl(width, height);
     //    }
     //    else
     //    {
     //        return SiteUrlManager.GetResizedImageUrl(DefaultImageFile, width, height);
     //    }
     //}
     return(SiteUrlManager.GetNoPictureUrl());
 }