Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(LabelName))
     {
         M_Label labelinfo = labelBll.GetLabelXML(LabelName);
         param = labelinfo.Param;
     }
     if (!IsPostBack)
     {
         CustomLabel_DP.DataSource     = labelBll.GetLabelCateListXML();
         CustomLabel_DP.DataTextField  = "name";
         CustomLabel_DP.DataValueField = "name";
         CustomLabel_DP.DataBind();
         CustomLabel_DP.Items.Insert(0, new ListItem("选择标签类型", ""));
         Field_DP.DataSource     = labelBll.GetSourceLabelXML();//LabelType
         Field_DP.DataTextField  = "LabelName";
         Field_DP.DataValueField = "LabelID";
         Field_DP.DataBind();
         Field_DP.Items.Insert(0, new ListItem("选择数据源标签", ""));
         lblSys.Text = bfun.GetSysLabel();
         lblFun.Text = bfun.GetFunLabel();
         DealInvoke();
         Call.SetBreadCrumb(Master, "<li><a href='" + customPath2 + "Config/SiteInfo.aspx'>系统设置</a></li><li><a href='LabelManage.aspx'>标签管理</a></li><li class='active'>标签调用</li>");
     }
 }
Esempio n. 2
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);
                XmlDocument doc       = new XmlDocument();
                XmlNode     nodelist  = doc.SelectSingleNode("//NewDataSet/Table[LabelID='" + newlbl.LabelID.ToString() + "']");
                string      fileName  = newlbl.LableName + ".lable";//客户端保存的文件名
                string      path      = newlbl.LabelCate + "/" + newlbl.LableName + ".label";
                SafeSC.DownFile(bll.dir + path, HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
            }
        }
Esempio n. 3
0
        private void LabelInvoke()
        {
            //1,获取主表与次表的表名,然后替换为 A. B.
            //{table1}.dbo.ZL_CommonModel left join {table1}.dbo.ZL_C_Article on {table1}.dbo.ZL_CommonModel.ArticleID={table1}.dbo.ZL_C_Article.aabbb
            M_Label labelMod = labelBll.GetLabelXML(LabelID);

            if (string.IsNullOrEmpty(labelMod.ProceParam))
            {
                return;
            }
            M_SubLabel subMod = JsonConvert.DeserializeObject <M_SubLabel>(labelMod.ProceParam);

            Alias_T.Text        = labelMod.LableName;
            T1_T.Text           = subMod.PureT1;
            T2_T.Text           = subMod.PureT2;
            labelMod.LabelField = PureStr(labelMod.LabelField, subMod);
            labelMod.LabelWhere = PureStr(labelMod.LabelWhere, subMod);
            labelMod.LabelOrder = PureStr(labelMod.LabelOrder, subMod);
            if (!string.IsNullOrEmpty(subMod.OnField2))
            {
                //标签添加时,左边必定是主表,右边必定是次表
                ONStr_T.Text = "A." + subMod.OnField1 + "=B." + subMod.OnField2;
            }
            Fields_T.Text   = labelMod.LabelField;
            WhereStr_T.Text = labelMod.LabelWhere;
            OrderStr_T.Text = labelMod.LabelOrder;
            ReMark_T.Text   = "调用标签" + labelMod.LableName;
            MyPK_T.Text     = "A." + SqlHelper.ExecuteTable("SELECT TOP 1 * FROM " + subMod.PureT1 + " WHERE 1=2").Columns[0].ColumnName;
            //---------------
            if (labelMod.ParamList.Count > 0)
            {
                Params_Hid.Value = JsonConvert.SerializeObject(labelMod.ParamList);
            }
        }
Esempio n. 4
0
        public IActionResult LabelSql()
        {
            VM_Label model = new VM_Label();

            if (!string.IsNullOrEmpty(LabelName))
            {
                model.labelMod = labelBll.GetLabelXML(LabelName);
                if (string.IsNullOrEmpty(model.labelMod.DataSourceType) || model.labelMod.DataSourceType.Equals("{}"))
                {
                    model.labelMod.DataSourceType = "{\"ds_m\":\"main\",\"ds_s\":\"main\",\"tb_m\":\"\",\"tb_s\":\"\"}";
                }
                model.labelMod.LabelWhere = ClearTableHolder(model.labelMod.LabelWhere);
                model.labelMod.LabelField = ClearTableHolder(model.labelMod.LabelField);
                model.labelMod.LabelTable = ClearTableHolder(model.labelMod.LabelTable);
                model.labelMod.LabelOrder = ClearTableHolder(model.labelMod.LabelOrder);
            }
            return(View(model));
        }
 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");
     }
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (function.isAjax())
            {
                #region ajax
                string result = "";
                switch (Action)
                {
                case "custom":
                {
                    string    cate = Request.Form["cate"];
                    DataTable dt   = labelBll.SelAllLabel(cate);
                    result = JsonConvert.SerializeObject(dt);
                }
                break;

                case "field":
                {
                    int labelid = DataConverter.CLng(Request.Form["labelid"]);
                    if (labelid < 1)
                    {
                        break;
                    }
                    M_Label labelMod = labelBll.GetLabelXML(labelid);
                    string  html = "", connStr = SqlHelper.ConnectionString;
                    html   = labelBll.SetLabelColumn(labelMod.LabelField, labelMod.LabelTable, labelMod.LableName, connStr);
                    result = StringHelper.Base64StringEncode(html);
                }
                break;
                }
                Response.Write(result); Response.Flush(); Response.End();
                #endregion
            }
            B_Permission.CheckAuthEx("design");
            if (!IsPostBack)
            {
                Design_Btn.Visible            = string.IsNullOrEmpty(Mid);
                Save_Btn.Visible              = !string.IsNullOrEmpty(Mid);
                CustomLabel_DP.DataSource     = labelBll.GetLabelCateListXML();
                CustomLabel_DP.DataTextField  = "name";
                CustomLabel_DP.DataValueField = "name";
                CustomLabel_DP.DataBind();
                CustomLabel_DP.Items.Insert(0, new ListItem("选择标签类型", ""));
                Field_DP.DataSource     = labelBll.GetSourceLabelXML();//LabelType
                Field_DP.DataTextField  = "LabelName";
                Field_DP.DataValueField = "LabelID";
                Field_DP.DataBind();
                Field_DP.Items.Insert(0, new ListItem("选择数据源标签", ""));
                lblSys.Text = bfun.GetSysLabel();
                lblFun.Text = bfun.GetFunLabel();
                DealInvoke();
                Alias_T.Text = LabelName;
                if (!string.IsNullOrEmpty(LName))
                {
                    if (badmin.CheckLogin())
                    {
                        Response.Redirect(CustomerPageAction.customPath2 + "Template/LabelSQL.aspx?LabelName=" + HttpUtility.UrlEncode(LabelName));
                    }
                    else
                    {
                        function.WriteErrMsg("修改动态标签,必须以管理员身份登录");
                    }
                }
            }
        }
        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);
            }
        }
        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);
            }
        }
Esempio n. 10
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);
            }
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!B_ARoleAuth.Check(ZoomLa.Model.ZLEnum.Auth.label, "LabelEdit"))
                {
                    function.WriteErrMsg("没有权限进行此项操作");
                }
                this.DDLCate.DataSource     = this.bll.GetLabelCateListXML();
                this.DDLCate.DataTextField  = "name";
                this.DDLCate.DataValueField = "name";
                this.DDLCate.DataBind();
                this.DDLCate.Items.Insert(0, new ListItem("选择标签分类", ""));

                this.DropLabelType.DataSource     = this.bll.GetLabelCateListXML();
                this.DropLabelType.DataTextField  = "name";
                this.DropLabelType.DataValueField = "name";
                this.DropLabelType.DataBind();
                this.DropLabelType.Items.Insert(0, new ListItem("选择标签分类", ""));
                LabelName_L.Text = "添加新标签";
                if (!string.IsNullOrEmpty(LabelName))
                {
                    M_Label labelMod = bll.GetLabelXML(LabelName);
                    if (labelMod.LableType >= 2)
                    {
                        Response.Redirect("LabelSql.aspx?LabelName=" + Server.UrlEncode(LabelName.ToString()));
                    }
                    this.TxtLabelName.Text           = labelMod.LableName;
                    LabelName_L.Text                 = "当前标签:[" + labelMod.LableName + "]";
                    this.TxtLabelType.Text           = labelMod.LabelCate;
                    this.DropLabelType.SelectedValue = labelMod.LabelCate;
                    this.TxtLabelIntro.Text          = labelMod.Desc;
                    this.textContent.Text            = labelMod.Content;
                    this.boolmodel.Checked           = (labelMod.IsOpen == 1);
                    this.addroot.SelectedValue       = labelMod.addroot;
                    this.falsecontent.Text           = labelMod.FalseContent;
                    this.Modeltypeinfo.Text          = labelMod.Modeltypeinfo;
                    this.Modelvalue.Text             = labelMod.Modelvalue;
                    this.setroot.SelectedValue       = labelMod.setroot;
                    this.Valueroot.Text              = labelMod.Valueroot;
                }
                this.LblSysLabel.Text = this.bfun.GetSysLabel();
                this.LblFunLabel.Text = this.bfun.GetFunLabel();
            }
            //判断模式
            if (boolmodel.Checked == true)
            {
                this.isbool.Visible = true;
                this.s1.Visible     = true;
                this.s2.Visible     = true;
                switch (Modeltypeinfo.SelectedValue)
                {
                case "计数判断":

                    this.addroot.Visible    = true;
                    this.Valueroot.Visible  = false;
                    this.setroot.Visible    = true;
                    this.Modelvalue.Visible = true;
                    this.Label3.Visible     = true;
                    if (this.addroot.SelectedValue == "循环计算")
                    {
                        this.Label3.Text = "计数器将自动清零,仅限包含<font color=blue>循环标签</font>有效";
                    }
                    else if (this.addroot.SelectedValue == "一直累加,仅限包含<font color=blue>循环标签</font>有效")
                    {
                        this.Label3.Text = "计数器一直累加";
                    }
                    break;

                case "用户登录判断":
                    this.addroot.Visible    = false;
                    this.Valueroot.Visible  = false;
                    this.setroot.Visible    = false;
                    this.Modelvalue.Visible = false;
                    this.Label3.Text        = "判断用户是否登录";
                    break;

                case "参数判断":
                    this.addroot.Visible    = false;
                    this.Valueroot.Visible  = true;
                    this.setroot.Visible    = true;
                    this.Modelvalue.Visible = true;
                    this.Label3.Text        = "判断参数是否满足条件";
                    break;
                }
            }
            else
            {
                this.s1.Visible     = false;
                this.s2.Visible     = false;
                this.isbool.Visible = false;
            }
        }
Esempio n. 12
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;
                }
            }
        }
Esempio n. 13
0
    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 = "添加新标签";
        }
    }
        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);
            }
        }