コード例 #1
0
        private string CreatAdvertisementJS()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("var objAD = new ObjectAD();\n");
            builder.Append("objAD.ADID= " + this.advertisementInfo.ADId + ";");
            builder.Append("objAD.ADType= " + this.advertisementInfo.ADType + ";");
            builder.Append("objAD.ADName= \"" + this.advertisementInfo.ADName + "\";");
            string imgUrl = this.advertisementInfo.ImgUrl;

            builder.Append("objAD.ImgUrl= \"" + Utility.ConvertAbsolutePath(SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.AdvertisementDir), imgUrl) + "\";");
            builder.Append("objAD.ImgWidth       = " + this.advertisementInfo.ImgWidth + ";");
            builder.Append("objAD.ImgHeight      = " + this.advertisementInfo.ImgHeight + ";");
            builder.Append("objAD.FlashWmode     = " + this.advertisementInfo.FlashWmode + ";");
            builder.Append("objAD.ADIntro =\"" + DataSecurity.ConvertToJavaScript(this.advertisementInfo.ADIntro) + "\";");
            builder.Append("objAD.LinkUrl        = \"" + this.advertisementInfo.LinkUrl + "\";");
            builder.Append("objAD.LinkTarget     = " + this.advertisementInfo.LinkTarget + ";");
            builder.Append("objAD.LinkAlt        = \"" + this.advertisementInfo.LinkAlt + "\";");
            builder.Append("objAD.Priority       = " + this.advertisementInfo.Priority + ";");
            builder.Append("objAD.CountView      = " + this.advertisementInfo.CountView.ToString().ToLower(CultureInfo.CurrentCulture) + ";");
            builder.Append("objAD.CountClick     = " + this.advertisementInfo.CountClick.ToString().ToLower(CultureInfo.CurrentCulture) + ";");
            builder.Append("objAD.OverdueDate    = \"" + this.advertisementInfo.OverdueDate.ToString("yyyy", CultureInfo.CurrentCulture) + "/" + this.advertisementInfo.OverdueDate.ToString("MM", CultureInfo.CurrentCulture) + "/" + this.advertisementInfo.OverdueDate.ToString("dd", CultureInfo.CurrentCulture) + "\";");
            builder.Append("objAD.InstallDir     = \"" + VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Request.ApplicationPath) + "\";");
            builder.Append("objAD.ADDIR= \"" + SiteConfig.SiteOption.AdvertisementDir + "\";");
            builder.Append("ZoneAD_" + this.advertisementInfo.ZoneId + ".AddAD(objAD);");
            return(builder.ToString());
        }
コード例 #2
0
        private static bool CreateIncludeFile(IncludeFileInfo includeFileInfo)
        {
            if (includeFileInfo.IsNull)
            {
                return(false);
            }
            string includeFilePath = SiteConfig.SiteOption.IncludeFilePath;

            includeFilePath = "~/" + includeFilePath + "/" + includeFileInfo.FileName;
            includeFilePath = HttpContext.Current.Request.MapPath(includeFilePath);
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList       = new NameValueCollection();
            templateInfo.PageName        = "";
            templateInfo.TemplateContent = includeFileInfo.Template;
            templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            templateInfo.CurrentPage     = 1;
            string templateContent = TemplateTransform.GetHtml(templateInfo).TemplateContent;

            if (includeFileInfo.IncludeType == IncludeType.JSWriteHtml)
            {
                templateContent = "document.write(\"" + DataSecurity.ConvertToJavaScript(templateContent) + "\")";
            }
            FileSystemObject.WriteFile(includeFilePath, templateContent);
            return(true);
        }
コード例 #3
0
 protected void RepKeyWords_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
     {
         KeywordInfo dataItem = (KeywordInfo)e.Item.DataItem;
         this.allKeyword = this.allKeyword + " " + dataItem.KeywordText;
         ExtendedLiteral literal = e.Item.FindControl("LitKeyword") as ExtendedLiteral;
         string          format  = "<a href=\"#\" onclick=\"add('{0}')\" title='{1}'>{2}</a>";
         literal.HtmlEncode = false;
         literal.Text       = string.Format(format, DataSecurity.HtmlEncode(DataSecurity.ConvertToJavaScript(dataItem.KeywordText)), DataSecurity.HtmlEncode(dataItem.KeywordText), (dataItem.KeywordText.Length < 6) ? DataSecurity.HtmlEncode(dataItem.KeywordText) : (DataSecurity.HtmlEncode(dataItem.KeywordText.Substring(0, 6)) + "..."));
     }
 }
コード例 #4
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
            writer.Write("<span style=\"color: blue\"><=");
            if (!string.IsNullOrEmpty(this.KeyWords))
            {
                string[] strArray = this.KeyWords.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                string   str      = string.Empty;
                foreach (string str2 in strArray)
                {
                    str = DataSecurity.HtmlEncode(str2);
                    writer.Write("【<span onclick=\"add('");
                    writer.Write(DataSecurity.HtmlEncode(DataSecurity.ConvertToJavaScript(str2)));
                    writer.Write("','");
                    writer.Write(this.ClientID);
                    writer.Write("')\" style=\"cursor:pointer;color: red;\">");
                    writer.Write(str);
                    writer.Write("</span>】");
                }
            }
            string str3 = "";

            str3 = this.Page.Request.ApplicationPath.Equals("/") ? string.Empty : this.Page.Request.ApplicationPath;
            str3 = this.Page.Request.Url.Scheme + "://" + this.Page.Request.Url.Authority + str3;
            if (this.IsAdminManage)
            {
                str3 = str3 + "/" + SiteConfig.SiteOption.ManageDir;
            }
            else
            {
                str3 = str3 + "/User";
            }
            if (this.IsAdminManage || PEContext.Current.User.Identity.IsAuthenticated)
            {
                writer.Write("【<span style=\"cursor:pointer;color: red;\" onclick=\"window.open('" + str3 + "/Accessories/KeyWordList.aspx?OpenerText=" + this.ClientID + "','KeyWordList' ,'width=600,height=450,resizable=0,scrollbars=yes');\">更多</span>】");
                writer.Write("</span>");
            }
        }