Exemplo n.º 1
0
        private void addrota_Click(Object sender, EventArgs e)
        {
            #region 插入聚合页图版轮换广告

            if ((rotaimg.Text.Trim() != "") && (url.Text.Trim() != "") && (titlecontent.Text.Trim() != ""))
            {
                if ((!Utils.IsURL(rotaimg.Text.Trim()) || (!Utils.IsURL(url.Text.Trim()))))
                {
                    base.RegisterStartupScript("", "<script>alert('图片路径或点击链接可能是非法URL');</script>");
                    BindData();
                    ResetForm();
                    return;
                }

                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                int lastRotatepicid = 0;
                if (doc.SelectSingleNode(targetNode) != null)
                {
                    if (doc.SelectSingleNode(targetNode).InnerText != "")
                    {
                        lastRotatepicid = int.Parse(doc.SelectSingleNode(targetNode).LastChild["rotatepicid"].InnerText);
                    }
                }
                lastRotatepicid++;

                XmlElement rotatepicNode = doc.CreateElement(nodeName);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", lastRotatepicid.ToString());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1");
                doc.AppendChildElementByNameValue(ref rotatepicNode, "img", rotaimg.Text.Trim());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url.Text.Trim());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent.Text.Trim());

                doc.CreateNode(targetNode).AppendChild(rotatepicNode);
                doc.Save(configPath);
                AggregationFacade.BaseAggregation.ClearAllDataBind();
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加聚合页图版轮换广告", "添加聚合页图版轮换广告,名称为: " + titlecontent.Text.Trim());

                try
                {
                    BindData();
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList");
                    ResetForm();
                    base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';");
                    return;
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                    return;
                }
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('图片或链接地址以及标题不能为空.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                return;
            }

            #endregion
        }
        /// <summary>
        /// 保存主题显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveTopicDisplay_Click(object sender, EventArgs e)
        {
            #region 保存主题显示
            //if (!Utils.IsNumeric(topnumber.Text))
            //{
            //    base.RegisterStartupScript("", "<script>alert('显示主题条数必须为数字!');</script>");
            //    return;
            //}
            //if (Convert.ToInt32(topnumber.Text) <= 0)
            //{
            //    base.RegisterStartupScript("", "<script>alert('显示主题条数至少是1条!');</script>");
            //    return;
            //}
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Bbs");
            //doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");

            if (doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum") == null)
            {
                doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");
            }

            XmlElement BBS = doc.CreateElement("Bbs");
            doc.AppendChildElementByNameValue(ref BBS, "Topnumber", topnumber.Text, false);
            doc.AppendChildElementByNameValue(ref BBS, "Showtype", showtype.SelectedValue, false);
            doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum").AppendChild(BBS);
            doc.Save(configPath);
            AggregationConfig.ResetConfig();
            AggregationFacade.ForumAggregation.ClearAllDataBind();
            #endregion
        }
Exemplo n.º 3
0
        private void DelRec_Click(object sender, EventArgs e)
        {
            #region  除菜单项
            if (this.CheckCookie())
            {
                string menuidlist = DNTRequest.GetString("menuid");
                if (menuidlist != "")
                {
                    int delcount            = 0;
                    XmlDocumentExtender doc = new XmlDocumentExtender();
                    doc.Load(configPath);
                    XmlNodeList __xmlnodelist = doc.SelectSingleNode("/menuset").ChildNodes;
                    foreach (string menuid in menuidlist.Split(','))
                    {
                        doc.SelectSingleNode("/menuset").RemoveChild(__xmlnodelist.Item(int.Parse(menuid) - delcount));
                        delcount++;
                    }
                    doc.Save(configPath);
                    CreateJsFile();
                    Response.Redirect("forum_mymenumanage.aspx");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_mymenumanage.aspx';</script>");
                }
                CreateJsFile();
            }

            #endregion
        }
Exemplo n.º 4
0
        protected void saveinfo_Click(object sender, EventArgs e)
        {
            string configPath       = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
            XmlDocumentExtender doc = new XmlDocumentExtender();

            if (System.IO.File.Exists(configPath))
            {
                if (doc.SelectSingleNode("/UserConfig/ShowInfo") == null)
                {
                    XmlNode userconfig = doc.CreateElement("UserConfig");
                    doc.AppendChild(userconfig);
                    XmlNode showinfo = doc.CreateElement("ShowInfo");
                    showinfo.InnerText = showhelp.SelectedValue.ToString();
                    userconfig.AppendChild(showinfo);
                }
                else
                {
                    XmlNode showinfo = doc.SelectSingleNode("/UserConfig/ShowInfo");
                    showinfo.InnerText = showhelp.SelectedValue.ToString();
                }
            }
            else
            {
                XmlElement userconfig = doc.CreateElement("UserConfig");
                XmlElement showinfo   = doc.CreateElement("ShowInfo");
                showinfo.InnerText = showhelp.SelectedValue.ToString();
                userconfig.AppendChild(showinfo);
                doc.AppendChild(userconfig);
            }
            doc.Save(configPath);
            this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'");
        }
Exemplo n.º 5
0
 private void DelRec_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         string rowid = Request["rowid"];
         if (rowid != "")
         {
             int num = 0;
             XmlDocumentExtender doc = new XmlDocumentExtender();
             doc.Load(this.configPath);
             XmlNodeList childNodes = doc.SelectSingleNode(this.targetNode).ChildNodes;
             string[]    array      = rowid.Split(',');
             for (int i = 0; i < array.Length; i++)
             {
                 string s = array[i];
                 doc.SelectSingleNode(this.targetNode).RemoveChild(childNodes.Item(int.Parse(s) - num));
                 num++;
             }
             doc.Save(this.configPath);
             AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除选定的图版轮换页", "删除选定的图版轮换页,ID为: " + Request["id"].Replace("0 ", ""));
             base.Response.Redirect("aggregation_rotatepic.aspx?pagename=" + Request["pagename"]);
             return;
         }
         base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';</script>");
     }
 }
Exemplo n.º 6
0
 private void DelRec_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         string @string = Request["menuid"];
         if (@string != "")
         {
             int num = 0;
             XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();
             xmlDocumentExtender.Load(this.configPath);
             XmlNodeList childNodes = xmlDocumentExtender.SelectSingleNode("/menuset").ChildNodes;
             string[]    array      = @string.Split(',');
             for (int i = 0; i < array.Length; i++)
             {
                 string s = array[i];
                 xmlDocumentExtender.SelectSingleNode("/menuset").RemoveChild(childNodes.Item(int.Parse(s) - num));
                 num++;
             }
             xmlDocumentExtender.Save(this.configPath);
             this.CreateJsFile();
             base.Response.Redirect("forum_mymenumanage.aspx");
         }
         else
         {
             base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_mymenumanage.aspx';</script>");
         }
         this.CreateJsFile();
     }
 }
Exemplo n.º 7
0
        private void DelRec_Click(object sender, EventArgs e)
        {
            #region  除选定的图版轮换页
            if (this.CheckCookie())
            {
                string rowidlist = DNTRequest.GetString("rowid");
                if (rowidlist != "")
                {
                    int delcount            = 0;
                    XmlDocumentExtender doc = new XmlDocumentExtender();
                    doc.Load(configPath);
                    XmlNodeList __xmlnodelist = doc.SelectSingleNode(targetNode).ChildNodes;
                    foreach (string menuid in rowidlist.Split(','))
                    {
                        doc.SelectSingleNode(targetNode).RemoveChild(__xmlnodelist.Item(int.Parse(menuid) - delcount));
                        delcount++;
                    }
                    doc.Save(configPath);

                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除选定的图版轮换页", "删除选定的图版轮换页,ID为: " + DNTRequest.GetString("id").Replace("0 ", ""));
                    Response.Redirect("aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename"));
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                }
            }

            #endregion
        }
Exemplo n.º 8
0
        protected void SaveMyMenu_Click(object sender, EventArgs e)
        {
            #region 保存“我的”菜单
            int  menuid             = 0;
            bool error              = false;
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList __xmlnodelist = doc.SelectSingleNode("/menuset").ChildNodes;
            if ((__xmlnodelist != null) && (__xmlnodelist.Count > 0))
            {
                doc.InitializeNode("/menuset");
            }
            foreach (object o in DataGrid1.GetKeyIDArray())
            {
                string menuorder = DataGrid1.GetControlValue(menuid, "menuorder");
                string text      = DataGrid1.GetControlValue(menuid, "text");
                string href      = DataGrid1.GetControlValue(menuid, "href");
                string onclick   = DataGrid1.GetControlValue(menuid, "onclick");
                string target    = DataGrid1.GetControlValue(menuid, "target");
                if ((text.Trim() == "") && (href.Trim() == ""))
                {
                    error = true;
                    continue;
                }

                bool       insert       = false;
                XmlElement __newxmlnode = doc.CreateElement("menuitem");
                doc.AppendChildElementByNameValue(ref __newxmlnode, "menuorder", menuorder);
                doc.AppendChildElementByNameValue(ref __newxmlnode, "text", text);
                doc.AppendChildElementByNameValue(ref __newxmlnode, "href", href);
                doc.AppendChildElementByNameValue(ref __newxmlnode, "onclick", onclick, true);
                doc.AppendChildElementByNameValue(ref __newxmlnode, "target", target);
                foreach (XmlNode __node in __xmlnodelist)
                {
                    if (int.Parse(__node["menuorder"].InnerText) > int.Parse(menuorder))
                    {
                        doc.SelectSingleNode("/menuset").InsertBefore(__newxmlnode, __node);
                        insert = true;
                        break;
                    }
                }
                if (!insert)
                {
                    doc.SelectSingleNode("/menuset").AppendChild(__newxmlnode);
                }
                menuid++;
            }
            doc.Save(configPath);
            CreateJsFile();
            if (error)
            {
                base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
            }
            else
            {
                base.RegisterStartupScript("", "<script>window.location.href='forum_mymenumanage.aspx';</script>");
            }
            #endregion
        }
Exemplo n.º 9
0
        protected void SaveMyMenu_Click(object sender, EventArgs e)
        {
            int  num  = 0;
            bool flag = false;
            XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(this.configPath);
            XmlNodeList childNodes = xmlDocumentExtender.SelectSingleNode("/menuset").ChildNodes;

            if (childNodes != null && childNodes.Count > 0)
            {
                xmlDocumentExtender.InitializeNode("/menuset");
            }
            foreach (object arg_5D_0 in this.DataGrid1.GetKeyIDArray())
            {
                string controlValue  = this.DataGrid1.GetControlValue(num, "menuorder");
                string controlValue2 = this.DataGrid1.GetControlValue(num, "text");
                string controlValue3 = this.DataGrid1.GetControlValue(num, "href");
                string controlValue4 = this.DataGrid1.GetControlValue(num, "onclick");
                string controlValue5 = this.DataGrid1.GetControlValue(num, "target");
                if (String.IsNullOrEmpty(controlValue2.Trim()) && String.IsNullOrEmpty(controlValue3.Trim()))
                {
                    flag = true;
                }
                else
                {
                    bool       flag2    = false;
                    XmlElement newChild = xmlDocumentExtender.CreateElement("menuitem");
                    xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "menuorder", controlValue);
                    xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "text", controlValue2);
                    xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "href", controlValue3);
                    xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "onclick", controlValue4, true);
                    xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "target", controlValue5);
                    foreach (XmlNode xmlNode in childNodes)
                    {
                        if (int.Parse(xmlNode["menuorder"].InnerText) > int.Parse(controlValue))
                        {
                            xmlDocumentExtender.SelectSingleNode("/menuset").InsertBefore(newChild, xmlNode);
                            flag2 = true;
                            break;
                        }
                    }
                    if (!flag2)
                    {
                        xmlDocumentExtender.SelectSingleNode("/menuset").AppendChild(newChild);
                    }
                    num++;
                }
            }
            xmlDocumentExtender.Save(this.configPath);
            this.CreateJsFile();
            if (flag)
            {
                base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
                return;
            }
            base.RegisterStartupScript("", "<script>window.location.href='forum_mymenumanage.aspx';</script>");
        }
Exemplo n.º 10
0
        private void SaveRotatepic_Click(object sender, EventArgs e)
        {
            int  num  = 0;
            bool flag = false;
            var  doc  = new XmlDocumentExtender();

            doc.Load(this.configPath);
            var childNodes = doc.SelectSingleNode(this.targetNode).ChildNodes;

            if (childNodes != null && childNodes.Count > 0)
            {
                doc.InitializeNode(this.targetNode);
            }
            foreach (object arg_5F_0 in this.DataGrid1.GetKeyIDArray())
            {
                string controlValue  = this.DataGrid1.GetControlValue(num, "rotatepicid");
                string controlValue2 = this.DataGrid1.GetControlValue(num, "img");
                string controlValue3 = this.DataGrid1.GetControlValue(num, "url");
                string text          = this.DataGrid1.GetControlValue(num, "titlecontent").Trim();
                if (!Utils.IsNumeric(controlValue) || !Utils.IsURL(controlValue2) || !Utils.IsURL(controlValue3) || String.IsNullOrEmpty(text))
                {
                    flag = true;
                    break;
                }
                bool       flag2    = false;
                XmlElement newChild = doc.CreateElement(this.nodeName);
                doc.AppendChildElementByNameValue(ref newChild, "rotatepicid", controlValue);
                doc.AppendChildElementByNameValue(ref newChild, "pagetype", "1");
                doc.AppendChildElementByNameValue(ref newChild, "img", controlValue2);
                doc.AppendChildElementByNameValue(ref newChild, "url", controlValue3);
                doc.AppendChildElementByNameValue(ref newChild, "titlecontent", text);
                foreach (XmlNode xmlNode in childNodes)
                {
                    if (int.Parse(xmlNode["rotatepicid"].InnerText) > int.Parse(controlValue))
                    {
                        doc.SelectSingleNode(this.targetNode).InsertBefore(newChild, xmlNode);
                        flag2 = true;
                        break;
                    }
                }
                if (!flag2)
                {
                    doc.SelectSingleNode(this.targetNode).AppendChild(newChild);
                }
                num++;
            }
            AggregationFacade.BaseAggregation.ClearAllDataBind();
            if (!flag)
            {
                SiteUrls.Current = null;
                AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "聚合页面论坛广告编辑", "");
                doc.Save(this.configPath);
                base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';");
                return;
            }
            base.RegisterStartupScript("", "<script>alert('某行序号、图片路径或点击链接可能是非法URL或说明文字为空,不能进行更新.');window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';</script>");
        }
Exemplo n.º 11
0
        public void BindData()
        {
            this.DataGrid1.AllowCustomPaging = false;
            this.DataGrid1.DataKeyField      = "rotatepicid";
            this.DataGrid1.TableHeaderName   = "聚合轮换图片列表";
            var doc = new XmlDocumentExtender();

            doc.Load(this.configPath);
            var xmlNode = doc.SelectSingleNode(this.targetNode);

            if (xmlNode == null || xmlNode.ChildNodes.Count == 0)
            {
                this.DataGrid1.Visible = (this.SaveRotatepic.Visible = false);
                return;
            }
            var reader = new XmlNodeReader(xmlNode);

            this.dsSrc.ReadXml(reader);
            this.dsSrc.Tables[0].Columns.Add("rowid");
            int num = 0;

            foreach (DataRow dataRow in this.dsSrc.Tables[0].Rows)
            {
                dataRow["rowid"] = num.ToString();
                num++;
            }
            this.DataGrid1.DataSource = this.dsSrc.Tables[0];
            this.DataGrid1.DataBind();
        }
Exemplo n.º 12
0
        //public static bool DownSubMenu(int submenuid, int mainmenuid)
        //{
        //	return true;
        //}
        //public static bool DeleteSubMenu(string mainMenuTitle, string subMenuTitle)
        //{
        //	int num = FindMenuID(mainMenuTitle);
        //	int num2 = FindMenuID(mainMenuTitle, subMenuTitle);
        //	return num != -1 && num2 != -1 && DeleteSubMenu(num2, num);
        //}
        public static bool NewMenuItem(int menuparentid, string title, string link)
        {
            XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(configPath);
            XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/dataset/submain");

            foreach (XmlNode xmlNode in xmlNodeList)
            {
                if (xmlNode["link"].InnerText == link)
                {
                    return(false);
                }
            }
            XmlElement xmlElement  = xmlDocumentExtender.CreateElement("submain");
            XmlElement xmlElement2 = xmlDocumentExtender.CreateElement("menuparentid");

            xmlElement2.InnerText = menuparentid.ToString();
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("menutitle");
            xmlElement2.InnerText = title;
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("link");
            xmlElement2.InnerText = link;
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("frameid");
            xmlElement2.InnerText = "main";
            xmlElement.AppendChild(xmlElement2);
            xmlDocumentExtender.SelectSingleNode("/dataset").AppendChild(xmlElement);
            xmlDocumentExtender.Save(configPath);
            return(true);
        }
Exemplo n.º 13
0
        public void BindData()
        {
            #region 绑定轮换图片列表
            DataGrid1.AllowCustomPaging = false;
            DataGrid1.DataKeyField      = "rotatepicid";
            DataGrid1.TableHeaderName   = "聚合轮换图片列表";

            XmlDocumentExtender xmldocument = new XmlDocumentExtender();
            xmldocument.Load(configPath);
            XmlNode node = xmldocument.SelectSingleNode(targetNode);
            if (node == null || node.ChildNodes.Count == 0)
            {
                DataGrid1.Visible = SaveRotatepic.Visible = false;
                return;
            }
            XmlNodeReader rdr = new XmlNodeReader(node);
            dsSrc.ReadXml(rdr);
            dsSrc.Tables[0].Columns.Add("rowid");
            int i = 0;
            foreach (DataRow dr in dsSrc.Tables[0].Rows)
            {
                dr["rowid"] = i.ToString();
                i++;
            }
            DataGrid1.DataSource = dsSrc.Tables[0];
            DataGrid1.DataBind();
            #endregion
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   isShowUpgradeInfo = false;
            string configPath        = Page.Server.MapPath("../xml/user_" + this.userid + ".config");

            if (File.Exists(configPath))
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                isShowUpgradeInfo = doc.SelectSingleNode("/UserConfig/ShowUpgrade") != null?doc.SelectSingleNode("/UserConfig/ShowUpgrade").InnerText == "1" : false;
            }
            else
            {
                isShowUpgradeInfo = true;
            }
            if (isShowUpgradeInfo)
            {
                LoadUpgradeInfo();
            }

            LoadTemplateInfo();
            GetStatInfo();
            //加载论坛版块信息
            forumid.BuildTree(Forums.GetForumListForDataTable(), "name", "fid");
            LinkDiscuzVersionPage();
        }
Exemplo n.º 15
0
        private void CreateJsFile()
        {
            string path = base.Server.MapPath(BaseConfigs.GetForumPath + "javascript/mymenu.js");
            XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(this.configPath);
            XmlNodeList childNodes = xmlDocumentExtender.SelectSingleNode("/menuset").ChildNodes;

            if (childNodes.Count == 0)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();

            foreach (XmlNode xmlNode in childNodes)
            {
                stringBuilder.Append(string.Format("document.write('<li><a href=\"{0}\" {1} {2}>{3}</a></li>');\r\n", new object[]
                {
                    xmlNode["href"].InnerText,
                    (String.IsNullOrEmpty(xmlNode["onclick"].InnerText)) ? "" : ("onclick=\"" + xmlNode["onclick"].InnerText.Replace("'", "\\'") + "\""),
                    (String.IsNullOrEmpty(xmlNode["target"].InnerText)) ? "" : ("target=\"" + xmlNode["target"].InnerText + "\""),
                    xmlNode["text"].InnerText
                }));
            }
            stringBuilder = stringBuilder.Replace(" onclick=\"\"", "").Replace(" target=\"\"", "");
            using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(stringBuilder.ToString());
                fileStream.Write(bytes, 0, bytes.Length);
                fileStream.Close();
            }
        }
Exemplo n.º 16
0
        public void BindData()
        {
            this.DataGrid1.AllowCustomPaging = false;
            this.DataGrid1.DataKeyField      = "menuid";
            this.DataGrid1.TableHeaderName   = "我的菜单列表";
            DataSet             dataSet             = new DataSet();
            XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(this.configPath);
            XmlNode xmlNode = xmlDocumentExtender.SelectSingleNode("/menuset");

            if (xmlNode == null || xmlNode.ChildNodes.Count == 0)
            {
                return;
            }
            XmlNodeReader reader = new XmlNodeReader(xmlNode);

            dataSet.ReadXml(reader);
            dataSet.Tables[0].Columns.Add("menuid");
            int num = 0;

            foreach (DataRow dataRow in dataSet.Tables[0].Rows)
            {
                dataRow["menuid"] = num.ToString();
                num++;
            }
            this.DataGrid1.DataSource = dataSet.Tables[0];
            this.DataGrid1.DataBind();
        }
Exemplo n.º 17
0
        public void BindData()
        {
            #region 绑定数据
            DataGrid1.AllowCustomPaging = false;
            DataGrid1.DataKeyField      = "menuid";
            DataGrid1.TableHeaderName   = "我的菜单列表";


            DataSet             dsSrc       = new DataSet();
            XmlDocumentExtender xmldocument = new XmlDocumentExtender();
            xmldocument.Load(configPath);
            XmlNode node = xmldocument.SelectSingleNode("/menuset");
            if (node == null || node.ChildNodes.Count == 0)
            {
                return;
            }
            XmlNodeReader rdr = new XmlNodeReader(node);
            dsSrc.ReadXml(rdr);
            dsSrc.Tables[0].Columns.Add("menuid");
            int i = 0;
            foreach (DataRow dr in dsSrc.Tables[0].Rows)
            {
                dr["menuid"] = i.ToString();
                i++;
            }
            DataGrid1.DataSource = dsSrc.Tables[0];
            DataGrid1.DataBind();
            #endregion
        }
Exemplo n.º 18
0
        private void LoadInfo()
        {
            string fids             = "";
            XmlDocumentExtender doc = new XmlDocumentExtender();

            doc.Load(configPath);
            XmlNode fidlist = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist");

            if (fidlist == null)
            {
                return;
            }
            fids = fidlist.InnerText;
            string strJson = "";

            ForumInfo[] lists = Forums.GetForumList();
            foreach (string fid in fids.Split(','))
            {
                foreach (ForumInfo foruminfo in lists)
                {
                    if (foruminfo.Fid.ToString() == fid)
                    {
                        strJson += "{'fid':'" + foruminfo.Fid + "','forumtitle':'" + foruminfo.Name + "'},";
                        break;
                    }
                }
            }
            if (strJson != "")
            {
                strJson = strJson.TrimEnd(',');
            }

            strJson = "<script type='text/javascript'>\r\nvar fidlist = [" + strJson + "];\r\nfor(var i = 0 ; i < fidlist.length ; i++)\r\n{\r\nvar no = new Option();\r\nno.value = fidlist[i]['fid'];\r\nno.text = fidlist[i]['forumtitle'];\r\nForm1.list2.options[Form1.list2.options.length] = no;\r\n}\r\n</script>";
            base.RegisterStartupScript("", strJson);
        }
Exemplo n.º 19
0
 /// <summary>
 /// 建立前台所使用的JS文件
 /// </summary>
 private void CreateJsFile()
 {
     #region 建立JS文件
     string jspath           = AppDomain.CurrentDomain.BaseDirectory + "javascript/mymenu.js";
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList __xmlnodelist = doc.SelectSingleNode("/menuset").ChildNodes;
     if (__xmlnodelist.Count == 0)
     {
         return;
     }
     StringBuilder jscontent = new StringBuilder();
     foreach (XmlNode __xmlnode in __xmlnodelist)
     {
         jscontent.Append(string.Format("document.write('<li><a href=\"{0}\" {1} {2}>{3}</a></li>');\r\n",
                                        __xmlnode["href"].InnerText,
                                        (__xmlnode["onclick"].InnerText == "" ? "" : "onclick=\"" + __xmlnode["onclick"].InnerText.Replace("'", "\\'") + "\""),
                                        (__xmlnode["target"].InnerText == "" ? "" : "target=\"" + __xmlnode["target"].InnerText + "\""),
                                        __xmlnode["text"].InnerText));
     }
     jscontent = jscontent.Replace(" onclick=\"\"", "").Replace(" target=\"\"", "");
     using (FileStream fs = new FileStream(jspath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
     {
         Byte[] info = System.Text.Encoding.UTF8.GetBytes(jscontent.ToString());
         fs.Write(info, 0, info.Length);
         fs.Close();
     }
     #endregion
 }
Exemplo n.º 20
0
        public static int NewMainMenu(string title, string defaulturl)
        {
            var xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(configPath);

            var        xmlNodeList = xmlDocumentExtender.SelectNodes("/dataset/toptabmenu");
            int        result      = xmlNodeList.Count + 1;
            XmlElement xmlElement  = xmlDocumentExtender.CreateElement("toptabmenu");
            XmlElement xmlElement2 = xmlDocumentExtender.CreateElement("id");

            xmlElement2.InnerText = result.ToString();
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("title");
            xmlElement2.InnerText = title;
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("mainmenulist");
            xmlElement2.InnerText = "";
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("mainmenuidlist");
            xmlElement2.InnerText = "";
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("defaulturl");
            xmlElement2.InnerText = defaulturl;
            xmlElement.AppendChild(xmlElement2);
            xmlElement2           = xmlDocumentExtender.CreateElement("system");
            xmlElement2.InnerText = "0";
            xmlElement.AppendChild(xmlElement2);
            xmlDocumentExtender.SelectSingleNode("/dataset").AppendChild(xmlElement);
            xmlDocumentExtender.Save(configPath);
            return(result);
        }
Exemplo n.º 21
0
 private void addrota_Click(object sender, EventArgs e)
 {
     if (this.rotaimg.Text.Trim() != "" && this.url.Text.Trim() != "" && this.titlecontent.Text.Trim() != "")
     {
         if (!Utils.IsURL(this.rotaimg.Text.Trim()) || !Utils.IsURL(this.url.Text.Trim()))
         {
             base.RegisterStartupScript("", "<script>alert('图片路径或点击链接可能是非法URL');</script>");
             this.BindData();
             this.ResetForm();
             return;
         }
         XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();
         xmlDocumentExtender.Load(this.configPath);
         int num = 0;
         if (xmlDocumentExtender.SelectSingleNode(this.targetNode) != null && xmlDocumentExtender.SelectSingleNode(this.targetNode).InnerText != "")
         {
             num = int.Parse(xmlDocumentExtender.SelectSingleNode(this.targetNode).LastChild["rotatepicid"].InnerText);
         }
         num++;
         XmlElement newChild = xmlDocumentExtender.CreateElement(this.nodeName);
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "rotatepicid", num.ToString());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "pagetype", "1");
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "img", this.rotaimg.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "url", this.url.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "titlecontent", this.titlecontent.Text.Trim());
         xmlDocumentExtender.CreateNode(this.targetNode).AppendChild(newChild);
         xmlDocumentExtender.Save(this.configPath);
         AggregationFacade.BaseAggregation.ClearAllDataBind();
         AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加聚合页图版轮换广告", "添加聚合页图版轮换广告,名称为: " + this.titlecontent.Text.Trim());
         try
         {
             this.BindData();
             XCache.Remove(CacheKeys.FORUM_FORUM_LINK_LIST);
             this.ResetForm();
             base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';");
             return;
         }
         catch
         {
             base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';</script>");
             return;
         }
     }
     base.RegisterStartupScript("", "<script>alert('图片或链接地址以及标题不能为空.');window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';</script>");
 }
Exemplo n.º 22
0
        private void addmenu_Click(Object sender, EventArgs e)
        {
            #region 插入菜单

            if ((atext.Text.Trim() != "") && (ahref.Text.Trim() != ""))
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                int lastmenuorder = 0;
                if (doc.SelectSingleNode("/menuset").ChildNodes.Count != 0)
                {
                    lastmenuorder = int.Parse(doc.SelectSingleNode("/menuset").LastChild["menuorder"].InnerText);
                }
                lastmenuorder++;
                XmlElement menunode = doc.CreateElement("menuitem");
                doc.AppendChildElementByNameValue(ref menunode, "menuorder", lastmenuorder.ToString());
                doc.AppendChildElementByNameValue(ref menunode, "text", atext.Text.Trim());
                doc.AppendChildElementByNameValue(ref menunode, "href", ahref.Text.Trim());
                doc.AppendChildElementByNameValue(ref menunode, "onclick", aonclick.Text.Trim(), true);
                doc.AppendChildElementByNameValue(ref menunode, "target", atarget.Text.Trim());

                doc.CreateNode("/menuset").AppendChild(menunode);
                doc.Save(configPath);
                CreateJsFile();
                try
                {
                    BindData();
                    ResetForm();
                    base.RegisterStartupScript("PAGE", "window.location.href='forum_mymenumanage.aspx';");
                    return;
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='forum_mymenumanage.aspx';</script>");
                    return;
                }
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
                return;
            }

            #endregion
        }
Exemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string text = this.Page.Server.MapPath("../xml/user_" + this.userid + ".config");

            if (!base.IsPostBack)
            {
                if (File.Exists(text))
                {
                    XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();
                    xmlDocumentExtender.Load(text);
                    this.showhelp.SelectedValue    = ((xmlDocumentExtender.SelectSingleNode("/UserConfig/ShowInfo") != null) ? xmlDocumentExtender.SelectSingleNode("/UserConfig/ShowInfo").InnerText : "1");
                    this.showupgrade.SelectedValue = ((xmlDocumentExtender.SelectSingleNode("/UserConfig/ShowUpgrade") != null) ? xmlDocumentExtender.SelectSingleNode("/UserConfig/ShowUpgrade").InnerText : "1");
                    return;
                }
                this.showhelp.SelectedValue    = "1";
                this.showupgrade.SelectedValue = "1";
            }
        }
        private void LoadInfo()
        {
            string fids             = "";
            XmlDocumentExtender doc = new XmlDocumentExtender();

            doc.Load(configPath);
            fids = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist").InnerText;
            XmlNodeList forumrecomendtopic = doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomendtopiclist/Website_forumrecomendtopic");

            ForumInfo[] lists     = Forums.GetForumList();
            DataTable   forumdata = new DataTable();

            forumdata.Columns.Add("fid");
            forumdata.Columns.Add("name");
            forumdata.Columns.Add("tid");
            forumdata.Columns.Add("title");
            forumdata.Columns.Add("img");

            foreach (string fid in fids.Split(','))
            {
                foreach (ForumInfo foruminfo in lists)
                {
                    if (foruminfo.Fid.ToString() == fid)    //在板块信息中找到当前选择的板块
                    {
                        DataRow dr = forumdata.NewRow();
                        dr["fid"]   = fid;
                        dr["name"]  = foruminfo.Name;
                        dr["tid"]   = "";
                        dr["title"] = "";
                        dr["img"]   = "";
                        forumdata.Rows.Add(dr);
                        break;
                    }
                }
            }

            foreach (XmlNode topic in forumrecomendtopic)
            {
                foreach (DataRow dr in forumdata.Rows)
                {
                    if (topic["fid"].InnerText == dr["fid"].ToString())
                    {
                        dr["tid"]   = topic["tid"].InnerText;
                        dr["title"] = topic["title"].InnerText;
                        dr["img"]   = topic["img"].InnerText;
                        break;
                    }
                }
            }

            DataGrid1.TableHeaderName = "推荐版块图片选择";
            DataGrid1.DataKeyField    = "fid";
            DataGrid1.DataSource      = forumdata;
            DataGrid1.DataBind();
        }
Exemplo n.º 25
0
        protected void SaveTopicDisplay_Click(object sender, EventArgs e)
        {
            XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(this.configPath);
            xmlDocumentExtender.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Bbs");
            if (xmlDocumentExtender.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum") == null)
            {
                xmlDocumentExtender.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");
            }
            XmlElement newChild = xmlDocumentExtender.CreateElement("Bbs");

            xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "Topnumber", this.topnumber.Text, false);
            xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "Showtype", this.showtype.SelectedValue, false);
            xmlDocumentExtender.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum").AppendChild(newChild);
            xmlDocumentExtender.Save(this.configPath);

            //AggregationConfig.ResetConfig();
            AggregationConfigInfo.Current = null;
            AggregationFacade.ForumAggregation.ClearAllDataBind();
        }
Exemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");

            if (!IsPostBack)
            {
                if (File.Exists(configPath))
                {
                    XmlDocumentExtender doc = new XmlDocumentExtender();
                    doc.Load(configPath);
                    showhelp.SelectedValue = doc.SelectSingleNode("/UserConfig/ShowInfo") != null?doc.SelectSingleNode("/UserConfig/ShowInfo").InnerText : "1";

                    showupgrade.SelectedValue = doc.SelectSingleNode("/UserConfig/ShowUpgrade") != null?doc.SelectSingleNode("/UserConfig/ShowUpgrade").InnerText : "1";
                }
                else
                {
                    showhelp.SelectedValue    = "1";
                    showupgrade.SelectedValue = "1";
                }
            }
        }
Exemplo n.º 27
0
        private void LoadInfo()
        {
            XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();

            xmlDocumentExtender.Load(this.configPath);
            string         innerText   = xmlDocumentExtender.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist").InnerText;
            XmlNodeList    xmlNodeList = xmlDocumentExtender.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomendtopiclist/Website_forumrecomendtopic");
            List <IXForum> forumList   = Forums.GetForumList();
            DataTable      dataTable   = new DataTable();

            dataTable.Columns.Add("fid");
            dataTable.Columns.Add("name");
            dataTable.Columns.Add("tid");
            dataTable.Columns.Add("title");
            dataTable.Columns.Add("img");
            string[] array = innerText.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                string text = array[i];
                foreach (var current in forumList)
                {
                    if (current.Fid.ToString() == text)
                    {
                        DataRow dataRow = dataTable.NewRow();
                        dataRow["fid"]   = text;
                        dataRow["name"]  = current.Name;
                        dataRow["tid"]   = "";
                        dataRow["title"] = "";
                        dataRow["img"]   = "";
                        dataTable.Rows.Add(dataRow);
                        break;
                    }
                }
            }
            foreach (XmlNode xmlNode in xmlNodeList)
            {
                foreach (DataRow dataRow2 in dataTable.Rows)
                {
                    if (xmlNode["fid"].InnerText == dataRow2["fid"].ToString())
                    {
                        dataRow2["tid"]   = xmlNode["tid"].InnerText;
                        dataRow2["title"] = xmlNode["title"].InnerText;
                        dataRow2["img"]   = xmlNode["img"].InnerText;
                        break;
                    }
                }
            }
            this.DataGrid1.TableHeaderName = "推荐版块图片选择";
            this.DataGrid1.DataKeyField    = "fid";
            this.DataGrid1.DataSource      = dataTable;
            this.DataGrid1.DataBind();
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //加入快捷操作菜单
            resultmessage = "<img src='../images/existmenu.gif' style='vertical-align:middle'/> 已经收藏";
            string configPath       = Page.Server.MapPath("xml/navmenu.config");
            string title            = "";
            string menuparentid     = "";
            string url              = DNTRequest.GetString("url").ToLower();
            XmlDocumentExtender doc = new XmlDocumentExtender();

            doc.Load(configPath);
            //读到快捷操作菜单
            XmlNodeList shortcuts = doc.SelectNodes("/dataset/shortcut");

            foreach (XmlNode singleshortcut in shortcuts)
            {
                //如果当前链接在快捷菜单内,则返回
                if (singleshortcut.SelectSingleNode("link").InnerText == url.ToLower().Trim())
                {
                    return;
                }
            }
            XmlNodeList             submains        = doc.SelectNodes("/dataset/submain");
            XmlNodeInnerTextVisitor submainsvisitor = new XmlNodeInnerTextVisitor();

            foreach (XmlNode submain in submains)
            {
                submainsvisitor.SetNode(submain);
                if (submainsvisitor["link"].ToLower() == url)
                {
                    title        = submainsvisitor["menutitle"];
                    menuparentid = submainsvisitor["menuparentid"];
                }
            }
            string[]   parm     = GetParm(doc, menuparentid);
            XmlElement shortcut = doc.CreateElement("shortcut");

            //将当前页面存入快捷操作菜单内
            doc.AppendChildElementByNameValue(ref shortcut, "link", url);
            doc.AppendChildElementByNameValue(ref shortcut, "menutitle", title);
            doc.AppendChildElementByNameValue(ref shortcut, "frameid", "main");
            doc.AppendChildElementByNameValue(ref shortcut, "custommenu", "true");
            doc.AppendChildElementByNameValue(ref shortcut, "showmenuid", parm[0]);
            doc.AppendChildElementByNameValue(ref shortcut, "toptabmenuid", parm[1]);
            doc.AppendChildElementByNameValue(ref shortcut, "mainmenulist", parm[2]);
            doc.SelectSingleNode("/dataset").AppendChild(shortcut);
            doc.Save(configPath);
            //managemainmenu.CreateMenu(Utils.GetMapPath("xml/navmenu.config"), Utils.GetMapPath("framepage") + "/navmenu.js");
            MenuManage.CreateMenuJson();
        }
Exemplo n.º 29
0
 private void addmenu_Click(object sender, EventArgs e)
 {
     if (!this.atext.Text.IsNullOrEmpty() && !this.ahref.Text.IsNullOrEmpty())
     {
         XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();
         xmlDocumentExtender.Load(this.configPath);
         int num = 0;
         if (xmlDocumentExtender.SelectSingleNode("/menuset").ChildNodes.Count != 0)
         {
             num = int.Parse(xmlDocumentExtender.SelectSingleNode("/menuset").LastChild["menuorder"].InnerText);
         }
         num++;
         XmlElement newChild = xmlDocumentExtender.CreateElement("menuitem");
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "menuorder", num.ToString());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "text", this.atext.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "href", this.ahref.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "onclick", this.aonclick.Text.Trim(), true);
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "target", this.atarget.Text.Trim());
         xmlDocumentExtender.CreateNode("/menuset").AppendChild(newChild);
         xmlDocumentExtender.Save(this.configPath);
         this.CreateJsFile();
         try
         {
             this.BindData();
             this.ResetForm();
             base.RegisterStartupScript("PAGE", "window.location.href='forum_mymenumanage.aspx';");
             return;
         }
         catch
         {
             base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='forum_mymenumanage.aspx';</script>");
             return;
         }
     }
     base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
 }
        /// <summary>
        /// 保存主题显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveTopicDisplay_Click(object sender, EventArgs e)
        {
            #region 保存主题显示
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            //doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Bbs");
            doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");

            XmlElement BBS = doc.CreateElement("Bbs");
            doc.AppendChildElementByNameValue(ref BBS, "Topnumber", topnumber.Text, false);
            doc.AppendChildElementByNameValue(ref BBS, "Showtype", showtype.SelectedValue, false);
            doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum").AppendChild(BBS);
            doc.Save(configPath);
            #endregion
        }