コード例 #1
0
        private void CreateDataLabel(M_ModelInfo info)
        {
            //创建数据源标签
            M_Label lab = new M_Label();

            lab.LableName   = info.ModelName + "数据源标签";
            lab.LabelCate   = "数据源标签";
            lab.LableType   = 3;
            lab.LabelTable  = "ZL_CommonModel left join " + info.TableName + " on ZL_CommonModel.ItemID=" + info.TableName + ".ID";
            lab.LabelField  = "ZL_CommonModel.*," + info.TableName + ".*";
            lab.LabelWhere  = "ZL_CommonModel.GeneralID=@InfoID";
            lab.Param       = "InfoID,0,2,内容ID";
            lab.LabelOrder  = "";
            lab.LabelCount  = "";
            lab.Content     = "";
            lab.Desc        = info.ModelName + "数据源标签";
            lab.LabelNodeID = 0;
            B_Label blab = new B_Label();

            //blab.AddLabel(lab);
            blab.AddLabelXML(lab);
            //创建空白内容页模板并绑定到模型
            string fname = "默认" + info.ModelName + "内容页.html";

            info.ContentModule = "内容页/" + fname;
            string vpath      = SiteConfig.SiteOption.TemplateDir + "/内容页/" + fname;
            string strcontent = @"{ZL.Source id=""[ZL_Modelname/]"" /}
<!DOCTYPEHTML>
<html>
<head>
<meta http-equiv=""Content-Type"" content=""text/html;charset=utf-8""/>
<title>{SField sid=""[ZL_Modelname/]"" FD=""Title"" page=""0""/}</title>
{ZL:Boot()/}
<meta name=""Keywords"" content=""{SField sid=""[ZL_Modelname/]"" FD=""Tagkey"" page=""0"" /}"">
<style>
.container-fulid{
height:50vh;padding-top:10%;background:#ccc;text-align:center;}
span{font-size:10em;}
</style>
</head>
<body>
<div class=""container-fulid"">
<div class=""row"">
<span class=""fa fa-info-circle""></span><h1>模板内容放这里!</h1><a href=""/hlep.html"" target=""_blank"">快速帮助></a>
</div>
</div>
</body>
</html>";

            strcontent = strcontent.Replace("[ZL_Modelname/]", info.ModelName + "数据源标签");
            SafeSC.WriteFile(vpath, strcontent);
        }
コード例 #2
0
 protected void EBtnSubmit_Click(object sender, EventArgs e)//保存
 {
     if (this.Page.IsValid)
     {
         M_ModelInfo info = new M_ModelInfo();
         info.ModelID   = DataConverter.CLng(this.HdnModelId.Value);
         info.ModelName = this.TxtModelName.Text;
         if (info.ModelID > 0)
         {
             info.TableName = this.TxtTableName.Text;
         }
         else
         {
             info.TableName = this.LblTablePrefix.Text + this.TxtTableName.Text;
         }
         info.ItemName    = this.TxtItemName.Text;
         info.ItemUnit    = this.TxtItemUnit.Text;
         info.ItemIcon    = this.TxtItemIcon.Text;
         info.Description = this.TxtDescription.Text;
         info.ModelType   = 4;
         if (info.ModelID == 0)
         {
             //创建数据源标签
             M_Label lab = new M_Label();
             lab.LableName   = info.ModelName + "数据源标签";
             lab.LabelCate   = "数据源标签";
             lab.LableType   = 3;
             lab.LabelTable  = "ZL_CommonModel left join " + info.TableName + " on ZL_CommonModel.ItemID=" + info.TableName + ".ID";
             lab.LabelField  = "ZL_CommonModel.*," + info.TableName + ".*";
             lab.LabelWhere  = "ZL_CommonModel.GeneralID=@InfoID";
             lab.Param       = "InfoID,0,2,内容ID";
             lab.LabelOrder  = "";
             lab.LabelCount  = "";
             lab.Content     = "";
             lab.Desc        = info.ModelName + "数据源标签";
             lab.LabelNodeID = 0;
             B_Label blab = new B_Label();
             blab.AddLabelXML(lab);
             //创建空白内容页模板并绑定到模型
             string strPath = "默认" + info.ModelName + "内容页.html";
             SafeSC.WriteFile(SiteConfig.SiteOption.TemplateDir + "/内容页/" + strPath, info.ModelName + "内容页");
             this.bll.AddModel(info);
             Response.Redirect("../Content/ModelManage.aspx?ModelType=4");
         }
         else
         {
             this.bll.UpdateModel(info);
             Response.Redirect("../Content/ModelManage.aspx?ModelType=4");
         }
     }
 }
コード例 #3
0
 protected void repFileReName_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         string LabelName = e.CommandArgument.ToString();
         bll.DelLabelXML(LabelName);
         Response.Redirect("LabelManage.aspx");
     }
     if (e.CommandName == "Copy")
     {
         string  LabelName = e.CommandArgument.ToString();
         M_Label newlbl    = bll.GetLabelXML(LabelName);
         newlbl.LableName = newlbl.LableName + DataSecurity.RandomNum(4);
         newlbl.LabelID   = 0;
         bll.AddLabelXML(newlbl);
         Response.Redirect("LabelManage.aspx");
     }
     if (e.CommandName == "Download")
     {
         string  LabelName = e.CommandArgument.ToString();
         M_Label newlbl    = bll.GetLabelXML(LabelName);
         SafeSC.DownFile(B_Label.GetLabelVPath(newlbl), newlbl.LableName + ".lable");
     }
 }
コード例 #4
0
ファイル: FrontController.cs プロジェクト: baixue001/IPS
        private string Content_TemplateToHtml(string TemplateDir)
        {
            string Templatestrstr = FileSystemObject.ReadFile(function.VToP(SiteConfig.SiteOption.TemplateDir + "/" + TemplateDir));
            string ContentHtml    = bll.CreateHtml(Templatestrstr, CPage, ItemID, "0");//Templatestrstr:模板页面字符串,页码,该文章ID

            /* --------------------判断是否分页 并做处理------------------------------------------------*/
            if (!string.IsNullOrEmpty(ContentHtml))
            {
                string infoContent = ""; //进行处理的内容字段
                string pagelabel   = "";
                string infotmp     = "";
                #region 分页符分页
                string pattern = @"{\#PageCode}([\s\S])*?{\/\#PageCode}";  //查找要分页的内容
                if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                {
                    infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                    infotmp     = infoContent;
                    infoContent = infoContent.Replace("{#PageCode}", "").Replace("{/#PageCode}", "");
                    //查找分页标签
                    bool   isPage   = false;
                    string pattern1 = @"{ZL\.Page([\s\S])*?\/}";

                    if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                    {
                        pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                        isPage    = true;
                    }
                    if (isPage)
                    {
                        if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段内容
                        {
                            ContentHtml = ContentHtml.Replace(pagelabel, "");
                        }
                        else   //进行内容分页处理
                        {
                            //文件名
                            string file1 = "Content?ID=" + ItemID.ToString();
                            //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                            string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                            string         lblContent = "";
                            IList <string> ContentArr = new List <string>();

                            if (string.IsNullOrEmpty(ilbl))
                            {
                                lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                ContentArr = bll.GetContentPage(infoContent);
                            }
                            else
                            {
                                string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (paArr.Length == 0)
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = bll.GetContentPage(infoContent);
                                }
                                else
                                {
                                    string  lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                    B_Label blbl    = new B_Label();
                                    lblContent = blbl.GetLabelXML(lblname).Content;
                                    if (string.IsNullOrEmpty(lblContent))
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    }
                                    ContentArr = bll.GetContentPage(infoContent);
                                }
                            }
                            if (ContentArr.Count > 0) //存在分页数据
                            {
                                string curCPage = GetParam("cpage");
                                bool   isAll    = !(string.IsNullOrEmpty(curCPage)) && curCPage.Equals("0");
                                if (isAll)//必须明确传值,才显示全部
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace("[PageCode/]", "");
                                }
                                else
                                {
                                    int _cpage = PageHelper.GetCPage(CPage, 1, ContentArr.Count) - 1;
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[_cpage]);
                                    ContentHtml = ContentHtml.Replace("{#Content}", "").Replace("{/#Content}", "");
                                }
                                ContentHtml = ContentHtml.Replace(pagelabel, bll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, ContentArr.Count));//输出分页
                            }
                            else
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                        }
                    }
                    else  //没有分页标签
                    {
                        //如果设定了分页内容字段 将该字段内容的分页标志清除
                        if (!string.IsNullOrEmpty(infoContent))
                        {
                            ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                        }
                    }
                }
                #endregion
                #region  查找要分页的内容
                pattern = @"{\#Content}([\s\S])*?{\/\#Content}";
                if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                {
                    infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                    infotmp     = infoContent;
                    infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");
                    //查找分页标签
                    bool   isPage   = false;
                    string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                    if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                    {
                        pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                        isPage    = true;
                    }
                    if (isPage)                                //包含分页
                    {
                        if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段内容
                        {
                            ContentHtml = ContentHtml.Replace(pagelabel, "");
                        }
                        else   //进行内容分页处理
                        {
                            //文件名
                            string file1 = "Content?ID=" + ItemID.ToString();
                            //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                            string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                            string         lblContent = "";
                            int            NumPerPage = 500;
                            IList <string> ContentArr = new List <string>();

                            if (string.IsNullOrEmpty(ilbl))
                            {
                                lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                ContentArr = bll.GetContentPage(infoContent, NumPerPage);
                            }
                            else
                            {
                                string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (paArr.Length == 0)
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = bll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                    if (paArr.Length > 1)
                                    {
                                        NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                    }
                                    B_Label blbl = new B_Label();
                                    lblContent = blbl.GetLabelXML(lblname).Content;
                                    if (string.IsNullOrEmpty(lblContent))
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    }
                                    ContentArr = bll.GetContentPage(infoContent, NumPerPage);
                                }
                            }
                            if (ContentArr.Count > 0) //存在分页数据
                            {
                                int _cpage = PageHelper.GetCPage(CPage, 0, ContentArr.Count - 1);
                                ContentHtml = ContentHtml.Replace(infotmp, ContentArr[_cpage]);
                                ContentHtml = ContentHtml.Replace(pagelabel, bll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, NumPerPage));
                            }
                            else
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                        }
                    }
                    else//没有分页标签
                    {
                        //如果设定了分页内容字段 将该字段内容的分页标志清除
                        if (!string.IsNullOrEmpty(infoContent))
                        {
                            ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                        }
                    }
                }
                #endregion
            }
            //替换默认分页标签
            string patterns   = @"{ZL\.Page([\s\S])*?\/}";
            string pagelabels = Regex.Match(ContentHtml, patterns, RegexOptions.IgnoreCase).Value;
            if (!string.IsNullOrEmpty(pagelabels))
            {
                ContentHtml = ContentHtml.Replace(pagelabels, "");
            }
            //if (nodeMod.SafeGuard == 1 && File.Exists(Server.MapPath("/js/Guard.js"))) { ContentHtml = ContentHtml + SafeSC.ReadFileStr("/js/Guard.js"); }
            //if (SiteConfig.SiteOption.IsSensitivity == 1) { ContentHtml = B_Sensitivity.Process(ContentHtml); }
            return(ContentHtml);
        }
コード例 #5
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                if (!String.IsNullOrEmpty(this.TxtTableName.Text))
                {
                    string str = this.TxtTableName.Text;
                    bool   b   = this.bll.isExistTableName("ZL_P_" + str);
                    if (b)
                    {
                        function.WriteErrMsg("数据库表名已存在,请重新输入!");
                        return;
                    }
                }
                M_ModelInfo info = new M_ModelInfo();
                info.ModelID   = DataConverter.CLng(this.HdnModelId.Value);
                info.ModelName = this.TxtModelName.Text;
                if (info.ModelID > 0)
                {
                    info.TableName = this.TxtTableName.Text;
                }
                else
                {
                    info.TableName = this.LblTablePrefix.Text + this.TxtTableName.Text;
                }
                info.ItemName    = this.TxtItemName.Text;
                info.ItemUnit    = this.TxtItemUnit.Text;
                info.ItemIcon    = this.TxtItemIcon.Text;
                info.Description = this.TxtDescription.Text;
                info.ModelType   = 2;
                info.MultiFlag   = true;

                if (info.ModelID == 0)
                {
                    //创建数据源标签
                    M_Label lab = new M_Label();
                    lab.LableName   = info.ModelName + "数据源标签";
                    lab.LabelCate   = "数据源标签";
                    lab.LableType   = 3;
                    lab.LabelTable  = "ZL_Commodities left join " + info.TableName + " on ZL_Commodities.ItemID=" + info.TableName + ".ID";
                    lab.LabelField  = "ZL_Commodities.*," + info.TableName + ".*";
                    lab.LabelWhere  = "ZL_Commodities.ID=@InfoID";
                    lab.Param       = "InfoID,0,2,商品ID";
                    lab.LabelOrder  = "";
                    lab.LabelCount  = "";
                    lab.Content     = "";
                    lab.Desc        = info.ModelName + "数据源标签";
                    lab.LabelNodeID = 0;
                    B_Label blab = new B_Label();
                    //blab.AddLabel(lab);
                    blab.AddLabelXML(lab);
                    //创建空白内容页模板并绑定到模型
                    string strPath = "默认" + info.ModelName + "内容页.html";
                    info.ContentModule = "/内容页/" + strPath;
                    SafeSC.WriteFile(SiteConfig.SiteOption.TemplateDir + "/内容页/" + strPath, info.ModelName + "内容页");
                    bool iscrate = this.bll.AddModel(info);
                    if (iscrate)
                    {
                        Response.Redirect("ModelManage.aspx");
                    }
                }
                else
                {
                    if (this.bll.UpdateModel(info))
                    {
                        Response.Redirect("ModelManage.aspx");
                    }
                }
            }
            Response.Redirect("ModelManage.aspx");
        }
コード例 #6
0
        public void Default()
        {
            if (pageID < 1)
            {
                RepToClient("[产生错误的可能原因:没有找到黄页信息!访问规则:/Page/Default?Pageid=黄页ID]"); return;
            }
            pageMod = pageBll.SelReturnModel(pageID);
            if (pageMod.ID < 0)
            {
                RepToClient("[产生错误的可能原因:您访问的黄页信息不存在!]"); return;
            }
            if (pageMod.Status != 99)
            {
                RepToClient("[产生错误的可能原因:您访问的黄页信息未经过审核!]"); return;
            }
            if (pageMod.TableName.IndexOf("ZL_Reg_") == -1)
            {
                RepToClient("[产生错误的可能原因:您访问的黄页信息不存在!]"); return;
            }
            string pageuser = pageMod.UserName;
            int    Itemid   = DataConverter.CLng(pageMod.InfoID);

            DataTable dt = fieldBll.SelectTableName(pageMod.TableName, "UserName = '******'");

            //pagesmallinfo-黄页详细注册信息
            if (dt.Rows.Count < 1)
            {
                RepToClient("[产生错误的可能原因:您访问的黄页信息不存在!]"); return;
            }
            if (string.IsNullOrEmpty(pageMod.Template))
            {
                RepToClient("[产生错误的可能原因:该黄页未指定模板!]"); return;
            }
            else
            {
                string templateurl = "";
                if (string.IsNullOrEmpty(pageMod.Template))
                {
                }
                else
                {
                    templateurl = pageMod.Template;
                }
                string TemplateDir = "";
                TemplateDir = SiteConfig.SiteOption.TemplateDir + "/" + templateurl;
                int Cpage = 1;
                if (string.IsNullOrEmpty(base.Request.QueryString["p"]))
                {
                    Cpage = 1;
                }
                else
                {
                    Cpage = DataConverter.CLng(base.Request.QueryString["p"]);
                }
                TemplateDir = base.Request.PhysicalApplicationPath + TemplateDir;
                TemplateDir = TemplateDir.Replace("/", @"\").Replace("\\\\", "\\");
                //获取模板html
                string indexstr = FileSystemObject.ReadFile(TemplateDir);
                indexstr = this.createBll.CreateHtml(indexstr, Cpage, pageID, "0"); //黄页最后一个为int类型
                string ContentHtml = indexstr;

                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    /* --------------------判断是否分页 并做处理------------------------------------------------*/
                    string infoContent = ""; //进行处理的内容字段
                    string pagelabel   = "";
                    string infotmp     = "";
                    string pattern     = @"{\#Content}([\s\S])*?{\/\#Content}"; //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");
                    }
                    //查找分页标签
                    bool   isPage   = false;
                    string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                    if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                    {
                        pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                        isPage    = true;
                    }
                    if (isPage)
                    {
                        if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段内容
                        {
                            ContentHtml = ContentHtml.Replace(pagelabel, "");
                        }
                        else   //进行内容分页处理
                        {
                            //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                            string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                            string         lblContent = "";
                            int            NumPerPage = 500;
                            IList <string> ContentArr = new List <string>();
                            if (string.IsNullOrEmpty(ilbl))
                            {
                                lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                            }
                            else
                            {
                                string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (paArr.Length == 0)
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                    if (paArr.Length > 1)
                                    {
                                        NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                    }
                                    B_Label blbl = new B_Label();
                                    lblContent = blbl.GetLabelXML(lblname).Content;
                                    if (string.IsNullOrEmpty(lblContent))
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    }
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                            }
                            if (ContentArr.Count > 0) //存在分页数据
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, pageID, Cpage, ContentArr.Count, NumPerPage));
                            }
                            else
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                        }
                    }
                    else  //没有分页标签
                    {
                        //如果设定了分页内容字段 将该字段内容的分页标志清除
                        if (!string.IsNullOrEmpty(infoContent))
                        {
                            ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                        }
                    }
                }
                /*--------------------- 分页内容处理结束-------------------------------------------------------------------------*/
                Response.Write(ContentHtml);
            }
        }
コード例 #7
0
        public void PageContent()
        {
            if (ItemID < 1)
            {
                RepToClient("[产生错误的可能原因:您访问的内容信息不存在!访问规则:PageContent?ItemID=信息ID]"); return;
            }
            B_Model      bmode    = new B_Model();
            B_Node       bnode    = new B_Node();
            M_CommonData ItemInfo = conBll.GetCommonData(ItemID);

            if (ItemInfo.IsNull)
            {
                RepToClient("[产生错误的可能原因:内容信息不存在或未开放!]"); return;
            }
            M_ModelInfo modelinfo = bmode.GetModelById(ItemInfo.ModelID);

            M_Templata Nodeinfo    = tll.Getbyid(ItemInfo.NodeID);
            string     TemplateDir = GetTempPath(ItemInfo, Nodeinfo, pageID);

            if (string.IsNullOrEmpty(TemplateDir))
            {
                RepToClient("[产生错误的可能原因:该内容所属模型未指定模板!]"); return;
            }
            else
            {
                int Cpage = 1;
                if (string.IsNullOrEmpty(base.Request.QueryString["p"]))
                {
                    Cpage = 1;
                }
                else
                {
                    Cpage = DataConverter.CLng(base.Request.QueryString["p"]);
                }
                string ContentHtml = "";
                try
                {
                    ContentHtml = FileSystemObject.ReadFile(TemplateDir);
                }
                catch
                {
                    RepToClient("[产生错误的可能原因:该内容所属模型未指定模板!]"); return;
                }

                ContentHtml = this.createBll.CreateHtml(ContentHtml, Cpage, ItemID, 0);

                /* --------------------判断是否分页 并做处理------------------------------------------------*/
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    string infoContent = "";     //进行处理的内容字段
                    string pagelabel   = "";
                    string infotmp     = "";
                    #region 分页符分页
                    string pattern = @"{\#PageCode}([\s\S])*?{\/\#PageCode}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#PageCode}", "").Replace("{/#PageCode}", "");
                        //查找分页标签
                        //bool flag = false;
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                IList <string> ContentArr = new List <string>();
                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.createBll.GetContentPage(infoContent);
                                    }
                                    else
                                    {
                                        string  lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        B_Label blbl    = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.createBll.GetContentPage(infoContent);
                                    }
                                }

                                if (ContentArr.Count > 0)     //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[CPage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, ContentArr.Count));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else      //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                    #endregion

                    pattern = @"{\#Content}([\s\S])*?{\/\#Content}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");

                        //查找分页标签
                        //bool flag = false;
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                int            NumPerPage = 500;
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                    }
                                    else
                                    {
                                        string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        if (paArr.Length > 1)
                                        {
                                            NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                        }
                                        B_Label blbl = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                    }
                                }
                                if (ContentArr.Count > 0)     //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, NumPerPage));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else      //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                }
                string patterns   = @"{ZL\.Page([\s\S])*?\/}";
                string pagelabels = Regex.Match(ContentHtml, patterns, RegexOptions.IgnoreCase).Value;
                if (pagelabels != "")
                {
                    ContentHtml = ContentHtml.Replace(pagelabels, "");
                }
                /*--------------------- 分页内容处理结束-------------------------------------------------------------------------*/
                Response.Write(ContentHtml);
            }
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ItemID < 1)
            {
                function.WriteErrMsg("[产生错误的可能原因:内容信息不存在或未开放!调用方法:Content.aspx?ID=内容ID]");
            }
            M_CommonData ItemInfo = bcontent.GetCommonData(ItemID);
            M_Node       nodeinfo = bnode.GetNode(ItemInfo.NodeID);

            if (ItemInfo.IsNull)
            {
                function.WriteErrMsg("[产生错误的可能原因:内容信息不存在或未开放!]");
            }
            else if (ItemInfo.Status == -2)
            {
                function.WriteErrMsg("[对不起,当前信息已删除,您无法浏览!]");
            }
            else if (ItemInfo.Status == 0)
            {
                function.WriteErrMsg("[对不起,当前信息待审核状态,您无法浏览!]");
            }
            else if (ItemInfo.Status != 99)
            {
                function.WriteErrMsg("[对不起,当前信息未通过审核,您无法浏览!]");
            }
            if (nodeinfo.PurviewType)
            {
                if (!buser.CheckLogin())
                {
                    function.WriteErrMsg("该信息所属栏目需登录验证,请先<a href='/User/login.aspx' target='_top'>登录</a>再进行此操作!", "/User/login.aspx");
                }
                else
                {
                    //此处以后可以加上用户组权限检测
                }
            }
            if (nodeinfo.ConsumePoint > 0)
            {
                M_UserInfo userinfo = buser.GetUserByUserID(buser.GetLogin().UserID);
                int        groupID  = 0; //会员级别id
                int        groupNum = 0; //浏览文章的次数

                if (nodeinfo.Viewinglimit != "" || nodeinfo.Viewinglimit != null)
                {
                    #region 查找当前登录会员浏览该文章规定的次数
                    string   Viewinglimits     = nodeinfo.Viewinglimit;
                    string[] ViewinglimitArray = Viewinglimits.Split(new char[] { '|' });
                    if (ViewinglimitArray.Length > 1)
                    {
                        for (int i = 0; i < ViewinglimitArray.Length; i++)
                        {
                            if (userinfo.GroupID == int.Parse(ViewinglimitArray[i].Substring(0, ViewinglimitArray[i].IndexOf("="))))
                            {
                                groupID  = int.Parse(ViewinglimitArray[i].Substring(0, ViewinglimitArray[i].IndexOf("=")));
                                groupNum = int.Parse(ViewinglimitArray[i].Substring(ViewinglimitArray[i].IndexOf("=") + 1, ViewinglimitArray[i].Length - ViewinglimitArray[i].Substring(0, ViewinglimitArray[i].IndexOf("=") + 1).Length));
                                break;
                            }
                        }
                    }
                    #endregion
                }
                if (buser.CheckLogin() && (userinfo.UserPoint - nodeinfo.ConsumePoint) > 0)
                {
                    B_CompleteHistory bcomhistory = new B_CompleteHistory();
                    switch (nodeinfo.ConsumeType)
                    {
                    case 0:        //0-不重复收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 1:        //1-距离上次收费时间多少小时后重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 2:        //2-重复阅读内容多少次重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 3:        //3-上述两者都满足时重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 4:        //4- 1、2两者任一个满足时就重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 5:         //5-每阅读一次就重复收费一次
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    default:
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);        //不重复收费
                        break;
                    }
                }
                else
                {
                    function.WriteErrMsg("您的点券不足,请充值!");
                }
            }
            M_ModelInfo modelinfo   = bmode.GetModelById(ItemInfo.ModelID);
            string      TempNode    = bnode.GetModelTemplate(ItemInfo.NodeID, ItemInfo.ModelID);
            string      TempContent = ItemInfo.Template;
            string      TemplateDir = modelinfo.ContentModule;
            if (!string.IsNullOrEmpty(TempContent))
            {
                TemplateDir = TempContent;
            }
            else
            {
                if (!string.IsNullOrEmpty(TempNode))
                {
                    TemplateDir = TempNode;
                }
            }
            if (string.IsNullOrEmpty(TemplateDir))
            {
                function.WriteErrMsg("该内容所属模型未指定模板");
            }
            else
            {
                GetNodePreate(nodeinfo.NodeID);
                if (!(TemplateDir.ToLower().IndexOf("site") > 0 && TemplateDir.ToLower().IndexOf("site") <= 2))
                {
                    TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + TemplateDir;
                }
                else
                {
                    TemplateDir = base.Request.PhysicalApplicationPath + "/" + TemplateDir;
                }
                int    pid = bnode.GetContrarily(DataConverter.CLng(ItemInfo.NodeID), 5); //子站判断
                M_Node mn  = bnode.GetNodeXML(DataConverter.CLng(pid));
                mn = bnode.dal_GetNode(DataConverter.CLng(pid));
                if (mn.NodeBySite == 5)
                {
                    string NodeDir = mn.NodeDir;
                    mn          = bnode.GetNodeXML(DataConverter.CLng(ItemInfo.NodeID));
                    TemplateDir = modelinfo.ContentModule;
                    if (!string.IsNullOrEmpty(TempNode))
                    {
                        TemplateDir = TempNode;
                    }
                    if (TemplateDir.IndexOf("SiteTemplate") < 0)
                    {
                        TemplateDir = "\\Site\\" + NodeDir + "\\Template" + TemplateDir;
                    }
                    TemplateDir = base.Request.PhysicalApplicationPath + TemplateDir;    // "\\Site\\" + NodeDir + "\\Template" +
                }
                TemplateDir = TemplateDir.Replace("/", @"\").Replace(@"\\", @"\");
                string Templatestrstr = FileSystemObject.ReadFile(TemplateDir);
                string ContentHtml    = this.bll.CreateHtml(Templatestrstr, Cpage, ItemID, "0"); //Templatestrstr:模板页面字符串,页码,该文章ID
                /* --------------------判断是否分页 并做处理------------------------------------------------*/
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    string infoContent = "";     //进行处理的内容字段
                    string pagelabel   = "";
                    string infotmp     = "";

                    #region 分页符分页

                    string pattern = @"{\#PageCode}([\s\S])*?{\/\#PageCode}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#PageCode}", "").Replace("{/#PageCode}", "");
                        //查找分页标签
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";

                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //文件名
                                string file1 = "Content.aspx?ID=" + ItemID.ToString();
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.bll.GetContentPage(infoContent);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.bll.GetContentPage(infoContent);
                                    }
                                    else
                                    {
                                        string  lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        B_Label blbl    = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.bll.GetContentPage(infoContent);
                                    }
                                }

                                if (ContentArr.Count > 0) //存在分页数据
                                {
                                    if (Cpage == 0)       //显示全部
                                    {
                                        ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                        ContentHtml = ContentHtml.Replace("[PageCode/]", "");
                                    }
                                    else
                                    {
                                        ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                    }
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.bll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, ContentArr.Count));    //输出分页
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else      //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                    #endregion

                    pattern = @"{\#Content}([\s\S])*?{\/\#Content}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");
                        //查找分页标签
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //文件名
                                string file1 = "Content.aspx?ID=" + ItemID.ToString();
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                int            NumPerPage = 500;
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                    }
                                    else
                                    {
                                        string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        if (paArr.Length > 1)
                                        {
                                            NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                        }
                                        B_Label blbl = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                    }
                                }
                                if (ContentArr.Count > 0)     //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.bll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, NumPerPage));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else    //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                }

                string patterns   = @"{ZL\.Page([\s\S])*?\/}";
                string pagelabels = Regex.Match(ContentHtml, patterns, RegexOptions.IgnoreCase).Value;
                if (pagelabels != "")
                {
                    ContentHtml = ContentHtml.Replace(pagelabels, "");
                }
                if (nodeinfo.SafeGuard == 1 && File.Exists(Server.MapPath("/JS/Guard.js")))
                {
                    ContentHtml = ContentHtml + SafeSC.ReadFileStr("/JS/Guard.js");
                }
                if (SiteConfig.SiteOption.IsSensitivity == 1)
                {
                    ContentHtml = sell.ProcessSen(ContentHtml);
                }
                Response.Write(ContentHtml);
            }
        }
コード例 #9
0
        //提交
        protected void Submit_B_Click(object sender, EventArgs e)
        {
            M_Pub pubMod  = new M_Pub();
            bool  addtrue = true;

            #region 验证模块
            if (Mid < 1)
            {
                DataTable tempinfo = pubBll.SelByName(PubName.Text);
                if (tempinfo.Rows.Count > 0)
                {
                    addtrue = false;
                    function.WriteErrMsg("已存在此互动模块!请更换模块名称再试!!");
                }
                DataTable PubInputLoadStrtable = pubBll.SelBy("", "PubInputLoadStr.Text", Mid.ToString());
                if (PubInputLoadStrtable.Rows.Count > 0)
                {
                    addtrue = false;
                    function.WriteErrMsg("已经存在此提交标签!");
                }
                DataTable PubLoadstrtable = pubBll.SelBy(PubLoadstr.Text, "", Mid.ToString());
                if (PubLoadstrtable.Rows.Count > 0)
                {
                    addtrue = false;
                    function.WriteErrMsg("已经存在此互动标签!");
                }
            }
            #endregion
            if (addtrue)
            {
                if (Mid > 0)
                {
                    pubMod = pubBll.SelReturnModel(Mid);
                    if (Menu.Equals("copy"))
                    {
                        pubMod.Pubid = 0;
                    }
                }
                pubMod.PubAddnum     = 0;
                pubMod.PubCreateTime = DateTime.Now;
                pubMod.PubBindPub    = 0;
                pubMod.PubClass      = DataConverter.CLng(this.PubClass.SelectedValue);
                pubMod.PubCode       = PubCode.Checked ? 1 : 0;
                //界面处理显示结束时间,如果是最大则不显示
                if (!string.IsNullOrEmpty(this.PubEndTime.Text))
                {
                    pubMod.PubEndTime = DataConverter.CDate(this.PubEndTime.Text.Replace("/", "-"));
                }
                else
                {
                    pubMod.PubEndTime = DateTime.MaxValue;
                }
                pubMod.PubInputLoadStr = PubInputLoadStr.Text;
                pubMod.PubType         = DataConverter.CLng(this.PubType.SelectedValue);
                pubMod.PubNodeID       = "";
                pubMod.PubTemplateID   = "";
                pubMod.PubIsDel        = 0;
                pubMod.PubIsTrue       = PubIsTrue.Checked ? 1 : 0;
                pubMod.PubLoadstr      = PubLoadstr.Text;
                pubMod.PubLogin        = PubLogin.Checked ? 1 : 0;
                pubMod.PubLoginUrl     = PubLoginUrl.Text;
                pubMod.PubTableName    = "ZL_Pub_" + PubTableName.Text;
                pubMod.PubName         = PubName.Text;
                pubMod.PubOpenComment  = PubOpenComment.Checked ? 1 : 0;
                pubMod.PubShowType     = DataConverter.CLng(this.PubShowType.SelectedValue);
                //pubMod.PubTimeSlot = CookieNum_Rad.SelectedValue.Equals("0") ? 0 : DataConverter.CLng(CookieNum_T.Text);
                pubMod.Pubkeep     = DataConverter.CLng(this.Pubkeep.Text);
                pubMod.PubInputTM  = "";
                pubMod.PubTemplate = "";
                pubMod.Puberrmsg   = Puberrmsg.Text;
                pubMod.PubFlag     = pubflag.Checked ? 1 : 0;
                string perm = "";
                if (CheckBox1.Checked)
                {
                    perm += "Look";
                }
                if (CheckBox2.Checked)
                {
                    perm += ",Edit";
                }
                if (CheckBox3.Checked)
                {
                    perm += ",Del";
                }
                if (CheckBox4.Checked)
                {
                    perm += ",Sen";
                }
                pubMod.PubPermissions = perm;
                pubMod.PubGourl       = PubGourl.Text;
                pubMod.Public         = RaPublic.Checked ? 1 : 0;
                //设置限制用户提交数量
                if (this.PubOneOrMore.SelectedValue == "2")
                {
                    pubMod.PubOneOrMore = DataConverter.CLng(this.PubOneOrMorenum.Text);
                }
                else
                {
                    pubMod.PubOneOrMore = DataConverter.CLng(this.PubOneOrMore.SelectedValue);
                }
                //设置限制IP提交数量
                if (this.PubIPOneOrMore.SelectedValue == "2")
                {
                    pubMod.PubIPOneOrMore = DataConverter.CLng(this.PubIPOneOrMorenum.Text);
                }
                else
                {
                    pubMod.PubIPOneOrMore = DataConverter.CLng(this.PubIPOneOrMore.SelectedValue);
                }
                pubMod.Interval = DataConverter.CLng(Interval_T.Text);
                string strPath       = "";
                string strPathname   = "";
                string PubInputTMurl = "";
                string Tempinputstr  = @"";
                //模型ID
                if (pubMod.Pubid == 0)
                {
                    pubMod.PubModelID = pubBll.CreateModelInfo(pubMod);//建立数据表与模型Field,Model
                    int Pubinsertid = pubBll.GetInsert(pubMod);

                    #region 创建互动模板
                    string  PubTemplateurl = "";
                    string  Tmpstr         = "";
                    M_Label lab            = new M_Label();
                    B_Label blab           = new B_Label();
                    lab.LabelAddUser = badmin.GetAdminLogin().AdminId;
                    string getstr = "";
                    switch (pubMod.PubClass)
                    {
                    //0-内容 1-商城 2-黄页 3-店铺 4-会员
                    case 0:
                        getstr = "ID";
                        break;

                    case 1:
                        getstr = "ID";
                        break;

                    case 2:
                        getstr = "Pageid";
                        break;

                    case 3:
                        getstr = "id";
                        break;

                    case 4:
                        getstr = "Userid";
                        break;

                    case 5:
                        getstr = "Nodeid";
                        break;

                    case 6:
                        getstr = "";
                        break;

                    default:
                        getstr = "ID";
                        break;
                    }
                    string pubcontdid = "-1";
                    if (pubMod.PubClass != 6)
                    {
                        pubcontdid = "{$GetRequest(" + getstr + ")$}";
                    }
                    //创建标签
                    switch (pubMod.PubType)
                    {
                    case 0:    //评论
                               //创建源标签
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n评论说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n评论时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认评论" + pubMod.PubName + "模板.html";
                        strPathname = "默认评论" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        strPath     = strPath.Replace("/", @"\");
                        FileSystemObject.WriteFile(strPath, Tmpstr);
                        break;

                    case 1:    //投票
                               //创建标签
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n投票说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n投票时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认投票" + pubMod.PubName + "模板.html";
                        strPathname = "默认投票" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 2:    //活动
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "<a href=PubAction.aspx?menu=hd&act=add&Pubid=" + Pubinsertid.ToString() + ">发起活动</a>\n{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n活动内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认活动" + pubMod.PubName + "模板.html";
                        strPathname = "默认活动" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 3:    //留言
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n留言内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认留言" + pubMod.PubName + "模板.html";
                        strPathname = "默认留言" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 4:    //问券
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n问券内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}<br />";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认问券" + pubMod.PubName + "模板.html";
                        strPathname = "默认问券" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 5:    //统计
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 2;
                        lab.LabelTable  = pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " and Parentid=0  And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "点击数:{Field=\"Pubnum\"/}";
                        lab.Desc        = pubMod.PubTableName + "动态标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认统计" + pubMod.PubName + "模板.html";
                        strPathname = "默认统计" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 6:    //竞标
                               //创建标签
                        lab.LableName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LableType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.Param       = "";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n竞标说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n竞标时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "默认竞标" + pubMod.PubName + "模板.html";
                        strPathname = "默认竞标" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 7:
                        lab.LableName  = pubMod.PubName + "调用标签";
                        lab.LabelCate  = "互动标签";
                        lab.LableType  = 1;
                        lab.LabelTable = "";
                        lab.LabelField = "";
                        lab.LabelWhere = "";
                        lab.Param      = "";
                        lab.LabelOrder = "";
                        lab.LabelCount = "10";
                        if (string.IsNullOrEmpty(starOPT.Text.Trim()))
                        {
                            function.WriteErrMsg("选项不能为空!!");
                        }
                        string[] starOP = starOPT.Text.Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        lab.Content     = GetContent(starOP, Pubinsertid);
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr      = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + PubInputLoadStr.Text + "/}";
                        strPath     = "评星" + pubMod.PubName + "模板.html";
                        strPathname = "评星" + pubMod.PubName + "模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 8:
                        break;

                    default:
                        function.WriteErrMsg("类型错误,该类型不存在!!!");
                        break;
                    }
                    strPath = strPath.Replace("/", @"\");
                    if (!string.IsNullOrEmpty(strPath))
                    {
                        FileSystemObject.WriteFile(strPath, Tmpstr);
                    }
                    PubTemplateurl = "/互动模板/" + strPathname;
                    #endregion
                    #region 创建互动提交模板
                    switch (pubMod.PubType)
                    {
                    case 0:    //评论
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">评论标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">评论内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        strPath      = "默认评论" + pubMod.PubName + "提交模板.html";
                        strPathname  = "默认评论" + pubMod.PubName + "提交模板.html";
                        strPath      = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 1:    //投票
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">投票标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">投票内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        strPath      = "默认投票" + pubMod.PubName + "提交模板.html";
                        strPathname  = "默认投票" + pubMod.PubName + "提交模板.html";
                        strPath      = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 2:    //活动
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">活动标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">活动内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        strPath      = "默认活动" + pubMod.PubName + "提交模板.html";
                        strPathname  = "默认活动" + pubMod.PubName + "提交模板.html";
                        strPath      = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 3:    //留言
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">留言标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">留言内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        strPath      = "默认留言" + pubMod.PubName + "提交模板.html";
                        strPathname  = "默认留言" + pubMod.PubName + "提交模板.html";
                        strPath      = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 4:    //问券
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">问券标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">问券内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        strPath      = "默认问券" + pubMod.PubName + "提交模板.html";
                        strPathname  = "默认问券" + pubMod.PubName + "提交模板.html";
                        strPath      = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 5:    //统计
                        Tempinputstr = @"<a href=/PubAction.aspx?pubid=" + Pubinsertid + "&PubContentid={PubContentid/}>通过链接提交</a>";
                        strPath      = "默认统计" + pubMod.PubName + "提交模板.html";
                        strPathname  = "默认统计" + pubMod.PubName + "提交模板.html";
                        strPath      = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 6:    //竞标
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction.aspx"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">竞标标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">竞标内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());

                        strPath     = "默认竞标" + pubMod.PubName + "提交模板.html";
                        strPathname = "默认竞标" + pubMod.PubName + "提交模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    case 7:    //评星
                        if (string.IsNullOrEmpty(starOPT.Text.Trim()))
                        {
                            function.WriteErrMsg("选项不能为空!!");
                        }
                        string[] starOP = starOPT.Text.Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        Tempinputstr = GetContent(starOP, Pubinsertid);
                        //存值方式Content中
                        //name:value,name:value然后用先获取contentID下的记录,然后再统计用lamda统计得分
                        strPath     = "评星" + pubMod.PubName + "提交模板.html";
                        strPathname = "评星" + pubMod.PubName + "提交模板.html";
                        strPath     = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/互动模板/" + strPath;
                        break;

                    default:
                        break;
                    }
                    if (pubflag.Checked)//开启cookie验证
                    {
                        Tempinputstr += @"    if (!localStorage[""cookflag""]) { localStorage[""cookflag""] = GetRanPass(12); } if (!getCookie(""cookflag"")) { setCookie(""cookflag"", localStorage[""cookflag""]); }";
                    }
                    strPath = strPath.Replace("/", @"\");
                    FileSystemObject.WriteFile(strPath, Tempinputstr);
                    PubInputTMurl = "/互动模板/" + strPathname;
                    #endregion
                    pubMod             = pubBll.GetSelect(Pubinsertid);
                    pubMod.PubInputTM  = PubInputTMurl;//提交窗口模板
                    pubMod.PubTemplate = PubTemplateurl;
                    pubMod.Public      = RaPublic.Checked ? 1 : 0;
                    pubBll.GetUpdate(pubMod);
                    function.WriteSuccessMsg("添加成功", pubMod.PubType == 8 ? "FormMangae.aspx" : "pubmanage.aspx");
                }
                else
                {
                    pubMod.PubTableName = ModelList_DP.SelectedValue;
                    pubMod.PubInputTM   = PubInputTM_hid.Value;
                    pubMod.PubTemplate  = PubTemplate_hid.Value;
                    pubMod.Pubinfo      = Pubinfo.Text;
                    pubBll.GetUpdate(pubMod);
                    function.WriteSuccessMsg("更新成功", pubMod.PubType == 8 ? "FormMangae.aspx" : "pubmanage.aspx");
                }
            }
        }
コード例 #10
0
        private void MyBind()
        {
            LabelCate_DP.DataSource = bll.GetLabelCateListXML();
            LabelCate_DP.DataBind();
            //----绑定第二步数据表
            DataTable dsList = dsBll.Sel();

            DBList_DP.Items.Add(new ListItem("系统主数据库", "main"));
            DBList2_DP.Items.Add(new ListItem("系统主数据库", "main"));
            foreach (DataRow dr in dsList.Rows)
            {
                ListItem item = new ListItem("[外]" + dr["DSName"].ToString(), dr["ID"].ToString());
                DBList_DP.Items.Add(item);
                DBList2_DP.Items.Add(item);
            }
            DBList_DP.Items.Add(new ListItem("+添加新数据库", "new"));
            DataTable tableDT = DS_GetByDP(D1).Table_List();

            BindTableListToDP(tableDT, TableList_DP);
            BindTableListToDP(tableDT, TableList2_DP);
            //---最终步
            CustomLabel_DP.DataSource = bll.GetLabelCateListXML();
            CustomLabel_DP.DataBind();
            CustomLabel_DP.Items.Insert(0, new ListItem("选择标签类型", ""));
            lblSys.Text = funBll.GetSysLabel(); //系统标签
            lblFun.Text = funBll.GetFunLabel(); //扩展函数
                                                //-----------------绑定已有数据
            if (!string.IsNullOrEmpty(LabelName))
            {
                M_Label labelMod = bll.GetLabelXML(LabelName);
                labelMod.LabelWhere = ClearTableHolder(labelMod.LabelWhere);
                labelMod.LabelField = ClearTableHolder(labelMod.LabelField);
                labelMod.LabelTable = ClearTableHolder(labelMod.LabelTable);
                labelMod.LabelOrder = ClearTableHolder(labelMod.LabelOrder);
                //第一步
                LabelName_T.Text            = labelMod.LableName;
                LabelCate_T.Text            = labelMod.LabelCate;
                LabelType_Rad.SelectedValue = labelMod.LableType.ToString();
                Desc_T.Text = labelMod.Desc;
                //schema_Text.Text = labelMod.ConnectString;
                //第二步
                string t1 = "", t2 = "";
                if (!string.IsNullOrEmpty(labelMod.DataSourceType) && labelMod.DataSourceType.StartsWith("{"))
                {
                    JObject jobj = JsonConvert.DeserializeObject <JObject>(labelMod.DataSourceType);
                    DBList_DP.SelectedValue  = jobj["ds_m"].ToString();
                    DBList2_DP.SelectedValue = jobj["ds_m"].ToString();
                    t1      = jobj["tb_m"].ToString();
                    t2      = jobj["tb_s"].ToString();
                    tableDT = DS_GetByDP(D1).Table_List();
                    BindTableListToDP(tableDT, TableList_DP);
                    BindTableListToDP(tableDT, TableList2_DP);
                }
                else
                {
                    B_Label.GetT1AndT2(labelMod.LabelTable, ref t1, ref t2);
                }
                TableList_DP.SelectedValue  = t1;
                TableList2_DP.SelectedValue = t2;
                TableList_DP_SelectedIndexChanged(null, null);
                TableList2_DP_SelectedIndexChanged(null, null);
                //是否启用了联接查询
                string joinType = B_Label.GetJoinType(labelMod.LabelTable);
                if (!string.IsNullOrEmpty(joinType))
                {
                    SqlJoin_DP.SelectedValue = joinType;
                    string on1 = "", on2 = "";
                    B_Label.GetOnField(labelMod.LabelTable, ref on1, ref on2);
                    OnField_DP.SelectedValue  = on1;
                    OnField2_DP.SelectedValue = on2;
                }
                SqlTable_T.Text = labelMod.LabelTable;
                SqlField_T.Text = labelMod.LabelField;
                //第三步
                RptParam_Bind(labelMod.Param);
                Param_Hid.Value = labelMod.Param;
                Where_T.Text    = labelMod.LabelWhere;
                Order_T.Text    = labelMod.LabelOrder;
                PSize_T.Text    = labelMod.LabelCount;
                //第四步
                textContent.Text              = labelMod.Content;
                Modeltypeinfo.Text            = labelMod.Modeltypeinfo;
                Modelvalue.Text               = labelMod.Modelvalue;
                setroot.SelectedValue         = labelMod.setroot;
                Valueroot.Text                = labelMod.Valueroot;
                BoolMode_Chk.Checked          = labelMod.IsOpen == 1;
                falsecontent.Text             = labelMod.FalseContent;
                bool_addroot_dp.SelectedValue = labelMod.addroot;
                Bread_L.Text = "当前标签:<a href='" + Request.RawUrl + "'>" + labelMod.LableName + "</a>";
            }
            if (string.IsNullOrEmpty(LabelName))
            {
                Bread_L.Text = "添加新标签";
                if (LabelCate_DP.Items.Count > 0)
                {
                    LabelCate_T.Text = LabelCate_DP.SelectedValue;
                }
            }
        }
コード例 #11
0
ファイル: LabelSql.aspx.cs プロジェクト: zoomlacms/web003
    private void MyBind()
    {
        LabelCate_DP.DataSource = bll.GetLabelCateListXML();
        LabelCate_DP.DataBind();
        //----绑定第二步数据表
        DBList_DP.Items.Add(new ListItem("系统主数据库", "main"));
        DBList_DP.Items.Add(new ListItem("从数据库", "second"));
        DBList_DP.Items.Add(new ListItem("+添加新数据库", "new"));
        DBList2_DP.Items.Add(new ListItem("系统主数据库", "main"));
        DBList2_DP.Items.Add(new ListItem("从数据库", "second"));
        DataTable tableDT = DBCenter.DB.Table_List();

        BindTableListToDP(tableDT, TableList_DP);
        BindTableListToDP(tableDT, TableList2_DP);
        //---最终步
        CustomLabel_DP.DataSource = bll.GetLabelCateListXML();
        CustomLabel_DP.DataBind();
        CustomLabel_DP.Items.Insert(0, new ListItem("选择标签类型", ""));
        lblSys.Text = funBll.GetSysLabel(); //系统标签
        lblFun.Text = funBll.GetFunLabel(); //扩展函数
        //-----------------绑定已有数据
        if (!string.IsNullOrEmpty(LabelName))
        {
            M_Label labelMod = bll.GetLabelXML(LabelName);
            //第一步
            LabelName_T.Text            = labelMod.LableName;
            LabelCate_T.Text            = labelMod.LabelCate;
            LabelType_Rad.SelectedValue = labelMod.LableType.ToString();
            Desc_T.Text = labelMod.Desc;
            //schema_Text.Text = labelMod.ConnectString;
            //第二步
            string t1 = "", t2 = "";
            B_Label.GetT1AndT2(labelMod.LabelTable, ref t1, ref t2);
            TableList_DP.SelectedValue  = t1;
            TableList2_DP.SelectedValue = t2;
            TableList_DP_SelectedIndexChanged(null, null);
            TableList2_DP_SelectedIndexChanged(null, null);
            //是否启用了联接查询
            string joinType = B_Label.GetJoinType(labelMod.LabelTable);
            if (!string.IsNullOrEmpty(joinType))
            {
                SqlJoin_DP.SelectedValue = joinType;
                string on1 = "", on2 = "";
                B_Label.GetOnField(labelMod.LabelTable, ref on1, ref on2);
                OnField_DP.SelectedValue  = on1;
                OnField2_DP.SelectedValue = on2;
            }
            SqlTable_T.Text = labelMod.LabelTable;
            SqlField_T.Text = labelMod.LabelField;
            //第三步
            RptParam_Bind(labelMod.Param);
            Param_Hid.Value = labelMod.Param;
            Where_T.Text    = labelMod.LabelWhere;
            Order_T.Text    = labelMod.LabelOrder;
            PSize_T.Text    = labelMod.LabelCount;
            //第四步
            textContent.Text              = labelMod.Content;
            Modeltypeinfo.Text            = labelMod.Modeltypeinfo;
            Modelvalue.Text               = labelMod.Modelvalue;
            setroot.SelectedValue         = labelMod.setroot;
            Valueroot.Text                = labelMod.Valueroot;
            BoolMode_Chk.Checked          = labelMod.IsOpen == 1;
            falsecontent.Text             = labelMod.FalseContent;
            bool_addroot_dp.SelectedValue = labelMod.addroot;
            Bread_L.Text = "当前标签:<a href='" + Request.RawUrl + "'>" + labelMod.LableName + "</a>";
        }
        if (string.IsNullOrEmpty(LabelName))
        {
            Bread_L.Text = "添加新标签";
        }
    }
コード例 #12
0
        public void StoreContent()
        {
            if (ItemID < 1)
            {
                ErrToClient("[产生错误的可能原因:您访问的商品信息不存在!");
            }
            M_Product ItemInfo = proBll.GetproductByid(ItemID);

            if (ItemInfo == null)
            {
                ErrToClient("[产生错误的可能原因:您访问的商品信息不存在!]"); return;
            }
            M_Node nodeinfo = nodeBll.GetNodeXML(ItemInfo.Nodeid);

            if (nodeinfo.PurviewType)
            {
                if (!buser.CheckLogin())
                {
                    function.WriteErrMsg("该信息所属栏目需登录验证,请先登录再进行此操作!", "/User/login"); return;
                }
                else
                {
                    //此处以后可以加上用户组权限检测
                }
            }
            string TemplateDir = "";

            //ItemID 商品ID
            if (proBll.SelectProByCmdID(ItemID).Rows.Count < 1)
            {
                function.WriteErrMsg("该商品不存在!"); return;
            }
            int       UserID    = DataConverter.CLng(proBll.SelectProByCmdID(ItemID).Rows[0]["UserID"]);
            string    username  = buser.GetUserByUserID(UserID).UserName;
            DataTable mosinfo   = mfbll.SelectTableName("ZL_CommonModel", "TableName like 'ZL_Store_%' and Inputer='" + username + "'");
            int       GeneralID = DataConverter.CLng(mosinfo.Rows[0]["GeneralID"]);

            DataTable         infos        = conBll.GetContent(GeneralID);
            int               StoreStyleID = DataConverter.CLng(infos.Rows[0]["StoreStyleID"]);
            M_StoreStyleTable stinfo       = sstbll.GetStyleByID(DataConverter.CLng(StoreStyleID));
            string            ContentStyle = stinfo.ContentStyle;
            M_ModelInfo       modelinfo    = modBll.GetModelById(ItemInfo.ModelID);
            string            TempNode     = nodeBll.GetModelTemplate(ItemInfo.Nodeid, ItemInfo.ModelID);

            if (!string.IsNullOrEmpty(TempNode))
            {
                TemplateDir = TempNode;
            }

            if (!string.IsNullOrEmpty(ContentStyle))
            {
                TemplateDir = ContentStyle;
            }

            if (string.IsNullOrEmpty(TemplateDir))
            {
                Response.Write("[产生错误的可能原因:该商品所属模型未指定模板!]");
            }
            else
            {
                TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + TemplateDir;
                TemplateDir = TemplateDir.Replace("/", @"\");
                string ContentHtml = FileSystemObject.ReadFile(TemplateDir);
                ContentHtml = this.createBll.CreateHtml(ContentHtml, 0, ItemID, "0");
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    /* --------------------判断是否分页 并做处理------------------------------------------------*/
                    string infoContent = ""; //进行处理的商品字段
                    string pagelabel   = "";
                    string infotmp     = "";
                    string pattern     = @"{\#Content}([\s\S])*?{\/\#Content}"; //查找要分页的商品
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");
                    }
                    //查找分页标签
                    bool   isPage   = false;
                    string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                    if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                    {
                        pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                        isPage    = true;
                    }
                    if (isPage)
                    {
                        if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段商品
                        {
                            ContentHtml = ContentHtml.Replace(pagelabel, "");
                        }
                        else   //进行商品分页处理
                        {
                            //文件名
                            string file1 = "StoreContent.aspx?ItemID=" + ItemID.ToString();
                            //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                            string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                            string         lblContent = "";
                            int            NumPerPage = 500;
                            IList <string> ContentArr = new List <string>();
                            if (string.IsNullOrEmpty(ilbl))
                            {
                                lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                            }
                            else
                            {
                                string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (paArr.Length == 0)
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                    if (paArr.Length > 1)
                                    {
                                        NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                    }
                                    B_Label blbl = new B_Label();
                                    lblContent = blbl.GetLabelXML(lblname).Content;
                                    if (string.IsNullOrEmpty(lblContent))
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    }
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                            }
                            //Response.Write(NumPerPage.ToString());
                            //Response.End();
                            if (ContentArr.Count > 0) //存在分页数据
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, NumPerPage));
                            }
                            else
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                        }
                    }
                    else  //没有分页标签
                    {
                        //如果设定了分页商品字段 将该字段商品的分页标志清除
                        if (!string.IsNullOrEmpty(infoContent))
                        {
                            ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                        }
                    }
                }
                /*--------------------- 分页商品处理结束-------------------------------------------------------------------------*/
                Response.Write(ContentHtml);
            }
        }
コード例 #13
0
ファイル: PubController.cs プロジェクト: baixue001/IPS
        public IActionResult PubAdd_Submit()
        {
            M_Pub pubMod = new M_Pub();

            if (Mid > 0)
            {
                pubMod = pubBll.SelReturnModel(Mid);
            }
            pubMod.PubName = GetParam("PubName");
            bool addtrue = true;

            #region 验证模块
            if (Mid < 1)
            {
                pubMod.PubLoadstr      = GetParam("PubLoadstr");
                pubMod.PubInputLoadStr = GetParam("PubInputLoadStr");
                pubMod.PubTableName    = B_Pub.PREFIX + GetParam("PubTableName");
                DataTable tempinfo = pubBll.SelByName(pubMod.PubName);
                if (tempinfo.Rows.Count > 0)
                {
                    addtrue = false;
                    return(WriteErr("已存在此互动模块!请更换模块名称再试!!", "javascript:history.back(-2);"));
                }
                DataTable PubInputLoadStrtable = pubBll.SelBy("", "PubInputLoadStr.Text", Mid.ToString());
                if (PubInputLoadStrtable.Rows.Count > 0)
                {
                    addtrue = false;
                    return(WriteErr("已经存在此提交标签!"));
                }
                DataTable PubLoadstrtable = pubBll.SelBy(pubMod.PubLoadstr, "", Mid.ToString());
                if (PubLoadstrtable.Rows.Count > 0)
                {
                    addtrue = false;
                    return(WriteErr("已经存在此互动标签!"));
                }
            }
            #endregion
            if (addtrue)
            {
                pubMod.PubClass = DataConverter.CLng(GetParam("PubClass"));
                pubMod.PubCode  = DataConvert.CLng(GetParam("PubCode"));
                //界面处理显示结束时间,如果是最大则不显示
                if (!string.IsNullOrEmpty(GetParam("PubEndTime")))
                {
                    pubMod.PubEndTime = DataConverter.CDate(GetParam("PubEndTime").Replace("/", "-"));
                }
                else
                {
                    pubMod.PubEndTime = DateTime.MaxValue;
                }
                pubMod.PubType   = DataConverter.CLng(GetParam("PubType"));
                pubMod.PubIsTrue = DataConvert.CLng(GetParam("PubIsTrue"));
                pubMod.PubLogin  = DataConvert.CLng(GetParam("PubLogin"));
                //pubMod.PubLoginUrl = PubLoginUrl.Text;
                pubMod.PubOpenComment = DataConvert.CLng(GetParam("PubOpenComment"));
                pubMod.PubShowType    = DataConverter.CLng(GetParam("PubShowType"));
                pubMod.Pubkeep        = DataConverter.CLng(GetParam("Pubkeep"));
                pubMod.Puberrmsg      = Request.Form["Puberrmsg"];
                pubMod.PubPermissions = GetParam("PubPermissions");
                pubMod.PubGourl       = GetParam("PubGourl");
                pubMod.Public         = DataConvert.CLng(GetParam("RaPublic"));
                pubMod.VerifyMode     = Request.Form["verify_chk"];
                pubMod.PubIPOneOrMore = DataConverter.CLng(GetParam("PubIPOneOrMore"));
                pubMod.Interval       = DataConverter.CLng(GetParam("Interval_T"));
                pubMod.Pubinfo        = GetParam("Pubinfo");
                string PubInputTMurl = "";
                string Tempinputstr  = @"";
                //模型ID
                if (pubMod.Pubid == 0)
                {
                    string saveDir  = function.VToP(SiteConfig.SiteOption.TemplateDir + "/互动模板/");
                    string saveName = "";

                    pubMod.PubModelID = pubBll.CreateModelInfo(pubMod);//建立数据表与模型Field,Model
                    int Pubinsertid = pubBll.GetInsert(pubMod);

                    #region 创建互动引用模板
                    string  PubTemplateurl = ""; //模板路径
                    string  Tmpstr         = ""; //引用标签
                    M_Label lab            = new M_Label();
                    B_Label blab           = new B_Label();
                    lab.LabelAddUser = adminMod.AdminId;

                    string pubcontdid = "@ID";
                    lab.Param = "ID,0,2,";

                    //创建标签
                    switch (pubMod.PubType)
                    {
                    case 0:    //评论
                               //创建源标签
                        lab.LabelName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LabelType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n评论说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n评论时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr   = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}";
                        saveName = "默认评论" + pubMod.PubName + "模板.html";
                        break;

                    case 1:    //投票
                               //创建标签
                        lab.LabelName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LabelType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n投票说明:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n投票时间:{Field=\"PubAddTime\"/}<br />{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr   = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}";
                        saveName = "默认投票" + pubMod.PubName + "模板.html";
                        break;

                    case 2:    //活动
                        lab.LabelName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LabelType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "<a href=PubAction?menu=hd&act=add&Pubid=" + Pubinsertid.ToString() + ">发起活动</a>\n{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n活动内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr   = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}";
                        saveName = "默认活动" + pubMod.PubName + "模板.html";
                        break;

                    case 3:    //留言
                        lab.LabelName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LabelType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n留言内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr   = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}";
                        saveName = "默认留言" + pubMod.PubName + "模板.html";
                        break;

                    case 4:    //问券
                        lab.LabelName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LabelType   = 4;
                        lab.LabelTable  = "" + pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = "" + pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = "" + pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.LabelOrder  = "" + pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "{Repeate}\n用户名:{Field=\"PubUserName\"/}<br />\n问券内容:{Field=\"PubContent\"/}<br />\n用户IP:{Field=\"PubIP\"/}<br />\n提交时间:{Field=\"PubAddTime\"/}\n{/Repeate}<br />\n{ZL.Page/}<br />";
                        lab.Desc        = pubMod.PubTableName + "分页标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr   = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}";
                        saveName = "默认问券" + pubMod.PubName + "模板.html";
                        break;

                    case 5:    //统计
                        lab.LabelName   = pubMod.PubName + "调用标签";
                        lab.LabelCate   = "互动标签";
                        lab.LabelType   = 2;
                        lab.LabelTable  = pubMod.PubTableName + " left join ZL_Pub on " + pubMod.PubTableName + ".Pubupid=ZL_Pub.Pubid";
                        lab.LabelField  = pubMod.PubTableName + ".*,ZL_Pub.*";
                        lab.LabelWhere  = pubMod.PubTableName + ".Pubupid=" + Pubinsertid.ToString() + " And " + pubMod.PubTableName + ".PubContentid=" + pubcontdid + " and Parentid=0  And " + pubMod.PubTableName + ".Pubstart=1";
                        lab.LabelOrder  = pubMod.PubTableName + ".ID DESC";
                        lab.LabelCount  = "10";
                        lab.Content     = "点击数:{Field=\"Pubnum\"/}";
                        lab.Desc        = pubMod.PubTableName + "动态标签";
                        lab.LabelNodeID = 0;
                        blab.AddLabelXML(lab);
                        Tmpstr   = "{ZL.Label id=\"" + pubMod.PubName + "调用标签\"/}\n{Pub." + pubMod.PubInputLoadStr + "/}";
                        saveName = "默认统计" + pubMod.PubName + "模板.html";
                        break;

                    case 6:    //竞标
                    case 7:
                    case 8:
                        break;

                    default:
                        return(WriteErr("类型错误,该类型不存在!!!"));

                        break;
                    }
                    if (!string.IsNullOrEmpty(saveName))
                    {
                        FileSystemObject.WriteFile(saveDir + saveName, Tmpstr);
                    }
                    PubTemplateurl = "/互动模板/" + saveName;
                    #endregion
                    #region 创建互动提交模板
                    switch (pubMod.PubType)
                    {
                    case 0:    //评论
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">评论标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">评论内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        saveName     = "默认评论" + pubMod.PubName + "提交模板.html";
                        break;

                    case 1:    //投票
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">投票标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">投票内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        saveName     = "默认投票" + pubMod.PubName + "提交模板.html";
                        break;

                    case 2:    //活动
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">活动标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">活动内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        saveName     = "默认活动" + pubMod.PubName + "提交模板.html";
                        break;

                    case 3:    //留言
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">留言标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">留言内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        saveName     = "默认留言" + pubMod.PubName + "提交模板.html";
                        break;

                    case 4:    //问券
                        Tempinputstr = @"<form name=""form{PubID/}"" method=""post"" action=""/PubAction"">
<input type=""hidden"" name=""PubID"" id=""PubID"" value=""{PubID/}"" />
<input type=""hidden"" name=""PubContentid"" id=""PubContentid"" value=""{PubContentid/}"" />
<input type=""hidden"" name=""PubInputer"" id=""PubInputer"" value=""{PubInputer/}"" />
<div class=""form-group"">
<label for=""PubTitle"">问券标题:</label>
<input type=""text"" class=""form-control"" id=""PubTitle"" name=""PubTitle"" />
{PubCode/}
</div>
<div class=""form-group"">
<label for=""PubContent"">问券内容:</label>
<textarea class=""form-control"" name=""PubContent"" cols=""50"" rows=""10"" id=""PubContent""></textarea>
</div>
<div class=""form-group text-center"">
<button type=""submit"" class=""btn btn-default"">提交</button>
<button type=""reset"" class=""btn btn-default"">重置</button>
</div>
</form>";
                        Tempinputstr = Tempinputstr.Replace(@"{PubID/}", Pubinsertid.ToString());
                        saveName     = "默认问券" + pubMod.PubName + "提交模板.html";
                        break;

                    case 5:    //统计
                    case 6:    //竞标
                    default:
                        break;
                    }
                    if (!string.IsNullOrEmpty(saveName))
                    {
                        FileSystemObject.WriteFile(saveDir + saveName, Tempinputstr);
                    }
                    PubInputTMurl = "/互动模板/" + saveName;
                    #endregion
                    pubMod             = pubBll.GetSelect(Pubinsertid);
                    pubMod.PubInputTM  = PubInputTMurl;//提交窗口模板
                    pubMod.PubTemplate = PubTemplateurl;
                    pubBll.GetUpdate(pubMod);
                }
                else
                {
                    pubMod.PubInputTM  = GetParam("PubInputTM_hid");
                    pubMod.PubTemplate = GetParam("PubTemplate_hid");
                    pubBll.GetUpdate(pubMod);
                }
            }
            return(WriteOK("操作成功", pubMod.PubType == 8 ? "FormManage" : "PubManage"));
        }