private void DelRec_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (Request["typeid"] != "") { string @string = Request["typeid"]; XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(base.Server.MapPath(BaseConfigs.GetForumPath + "config/myattachment.config")); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/MyAttachmentsTypeConfigInfo/attachtypes/AttachmentType"); string[] array = @string.Split(','); for (int i = 0; i < array.Length; i++) { string a = array[i]; foreach (XmlNode xmlNode in xmlNodeList) { if (a == xmlNode["TypeId"].InnerText) { xmlNode.ParentNode.RemoveChild(xmlNode); break; } } } xmlDocumentExtender.Save(base.Server.MapPath(BaseConfigs.GetForumPath + "config/myattachment.config")); this.UpdateAttchmentTypes(); base.Response.Redirect("forum_attchemnttypes.aspx"); return; } base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_attchemnttypes.aspx';</script>"); } }
/// <summary> /// 保存信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveTopic_Click(object sender, EventArgs e) { #region 保存信息 string tidlist = DNTRequest.GetString("forumtopicstatus"); //当未选择主题时,则清除所有选择 if (tidlist == "") { if (File.Exists(configPath)) { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Data/Hottopiclist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Forum/Hottopiclist"); doc.Save(configPath); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/Hottopiclist"); } Response.Redirect("aggregation_forumhottopic.aspx"); return; } else { //得到所选择帖子信息 Posts.WriteAggregationHotTopicsData(tidlist, configPath, "/Aggregationinfo/Data/Hottopiclist", "/Aggregationinfo/Forum/Hottopiclist"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/Hottopiclist"); Response.Redirect("aggregation_edithottopic.aspx"); } #endregion }
//public static bool NewMenuItem(string mainMenuTitle, string subMenutitle, string newMenuItemTitle, string link) //{ // int num = FindMenuMenuid(mainMenuTitle, subMenutitle); // return num != -1 && NewMenuItem(num, newMenuItemTitle, link); //} public static bool EditMenuItem(int id, string title, string link) { XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(configPath); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/dataset/submain"); int num = 0; foreach (XmlNode xmlNode in xmlNodeList) { if (num.ToString() != id.ToString() && xmlNode["link"].InnerText == link) { return(false); } num++; } string innerText = xmlNodeList.Item(id)["link"].InnerText; xmlNodeList.Item(id)["menutitle"].InnerText = title; xmlNodeList.Item(id)["link"].InnerText = link; XmlNodeList xmlNodeList2 = xmlDocumentExtender.SelectNodes("/dataset/shortcut"); foreach (XmlNode xmlNode2 in xmlNodeList2) { if (xmlNode2["link"].InnerText == innerText) { xmlNode2["link"].InnerText = link; xmlNode2["menutitle"].InnerText = title; break; } } xmlDocumentExtender.Save(configPath); return(true); }
public static bool EditMainMenu(int menuid, string title, string defaulturl) { var xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(configPath); var xmlNodeList = xmlDocumentExtender.SelectNodes("/dataset/toptabmenu"); bool flag = false; foreach (XmlNode xmlNode in xmlNodeList) { if (xmlNode["id"].InnerText == menuid.ToString()) { xmlNode["title"].InnerText = title; xmlNode["defaulturl"].InnerText = defaulturl; flag = true; break; } } if (flag) { xmlDocumentExtender.Save(configPath); } return(flag); }
//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); }
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); }
protected void savetopic_Click(object sender, EventArgs e) { XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(this.configPath); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/Aggregationinfo/Forum/Hottopiclist/Topic"); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); if (xmlNodeInnerTextVisitor["tid"] == this.topicid.Value) { xmlNodeInnerTextVisitor["tid"] = this.topicid.Value; xmlNodeInnerTextVisitor["title"] = this.title.Text; break; } } xmlNodeList = xmlDocumentExtender.SelectNodes("/Aggregationinfo/Data/Hottopiclist/Topic"); foreach (XmlNode node2 in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node2); if (xmlNodeInnerTextVisitor["tid"] == this.topicid.Value) { xmlNodeInnerTextVisitor["tid"] = this.topicid.Value; xmlNodeInnerTextVisitor["title"] = this.title.Text; break; } } xmlDocumentExtender.Save(this.configPath); XCache.Remove("/Aggregation/Hottopiclist"); base.Response.Redirect("aggregation_edithottopic.aspx"); }
/// <summary> /// 保存信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveTopic_Click(object sender, EventArgs e) { #region 保存信息 string tidlist = DNTRequest.GetString("forumtopicstatus"); //当未选择主题时,则清除所有选择 if (tidlist == "") { if (File.Exists(configPath)) { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Data/Topiclist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Forum/Topiclist"); doc.Save(configPath); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/TopicByForumId_" + fid); } Response.Redirect("aggregation_editforumaggset.aspx?fid=" + fid); return; } else { PostInfo[] posts = new ForumAggregationData().GetPostListFromFile("Website"); //得到所选择帖子信息 Posts.WriteAggregationPostData(posts, tablelist.SelectedValue, tidlist, configPath, "/Aggregationinfo/Data/Topiclist", "/Aggregationinfo/Forum/Topiclist"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/TopicByForumId_" + fid); Response.Redirect("aggregation_editforumaggset.aspx?fid=" + fid); } #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 }
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(); } }
/// <summary> /// 编辑菜单项 /// </summary> /// <param name="id">菜单项的序号</param> /// <param name="title">菜单项的标题</param> /// <param name="link">菜单项的链接</param> /// <returns>操作成功否</returns> public static bool EditMenuItem(int id, string title, string link) { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList submains = doc.SelectNodes("/dataset/submain"); int rowcount = 0; foreach (XmlNode sub in submains) { if (rowcount.ToString() != id.ToString() && sub["link"].InnerText == link) { return(false); } rowcount++; } string tmpLink = submains.Item(id)["link"].InnerText; submains.Item(id)["menutitle"].InnerText = title; submains.Item(id)["link"].InnerText = link; XmlNodeList shortcuts = doc.SelectNodes("/dataset/shortcut"); foreach (XmlNode shortmenuitem in shortcuts) { if (shortmenuitem["link"].InnerText == tmpLink) { shortmenuitem["link"].InnerText = link; shortmenuitem["menutitle"].InnerText = title; break; } } doc.Save(configPath); return(true); }
private void Btn_SaveInfo_Click(object sender, EventArgs e) { #region 保存自动提取数据 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); int rowid = 0; XmlNode topiclist = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomendtopiclist"); foreach (object o in DataGrid1.GetKeyIDArray()) { string fid = o.ToString(); string tid = DataGrid1.GetControlValue(rowid, "tid"); string title = DataGrid1.GetControlValue(rowid, "title"); string img = DataGrid1.GetControlValue(rowid, "img"); XmlElement topicNode = doc.CreateElement("Website_forumrecomendtopic"); doc.AppendChildElementByNameValue(ref topicNode, "fid", fid); doc.AppendChildElementByNameValue(ref topicNode, "tid", tid); doc.AppendChildElementByNameValue(ref topicNode, "img", img); doc.AppendChildElementByNameValue(ref topicNode, "title", title); topiclist.AppendChild(topicNode); rowid++; } /* * XmlNode fidlist = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist"); * fidlist.InnerText = DNTRequest.GetString("rst");*/ doc.Save(configPath); Response.Redirect("aggregation_recommendtopic.aspx"); #endregion }
/// <summary> /// 装载WebSite信息 /// </summary> //private void LoadWebSiteConfig() //{ // #region 装载主题信息 // XmlDocumentExtender doc = new XmlDocumentExtender(); // doc.Load(configPath); // XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Data/Hottopiclist/Topic"); // XmlNodeList website_spacelistnode = doc.SelectNodes("/Aggregationinfo/Forum/Hottopiclist/Topic"); // XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); // XmlNodeInnerTextVisitor pagetopicvisitor = new XmlNodeInnerTextVisitor(); // forumlist.Text = ""; // int i = 0; // foreach (XmlNode topic in topiclistNode) // { // topicvisitor.SetNode(topic); // bool isCheck = false; // foreach (XmlNode index in website_spacelistnode) // { // pagetopicvisitor.SetNode(index); // if (topicvisitor["tid"].ToString() == pagetopicvisitor["tid"].ToString()) // { // isCheck = true; // break; // } // } // //forumlist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='tid' " + (isCheck ? "checked" : "") + " value='" + topicvisitor["tid"] + "'>" + topicvisitor["title"] + "</h1></div>\n"; // i++; // } // #endregion //} protected void savetopic_Click(object sender, EventArgs e) { #region 保存主题修改 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Forum/Hottopiclist/Topic"); XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["tid"] == topicid.Value) { topicvisitor["tid"] = topicid.Value; topicvisitor["title"] = title.Text; break; } } topiclistNode = doc.SelectNodes("/Aggregationinfo/Data/Hottopiclist/Topic"); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["tid"] == topicid.Value) { topicvisitor["tid"] = topicid.Value; topicvisitor["title"] = title.Text; break; } } doc.Save(configPath); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/Hottopiclist"); Response.Redirect("aggregation_edithottopic.aspx"); #endregion }
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 }
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>"); } }
protected void savetopic_Click(object sender, EventArgs e) { #region 保存主题修改 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"); XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["topicid"] == topicid.Value) { topicvisitor["topicid"] = topicid.Value; topicvisitor["title"] = tbtitle.Text; topicvisitor["poster"] = poster.Text; topicvisitor["postdatetime"] = postdatetime.Text; XmlCDataSection shortDes = doc.CreateCDataSection("shortdescription"); shortDes.InnerText = shortdescription.Text; topicvisitor.GetNode("shortdescription").RemoveAll(); topicvisitor.GetNode("shortdescription").AppendChild(shortDes); break; } } doc.Save(configPath); Response.Redirect("aggregation_editforumaggset.aspx"); #endregion }
protected void savetopic_Click(object sender, EventArgs e) { #region 保存主题修改 XmlDocumentExtender doc = new XmlDocumentExtender(); if (!File.Exists(configPath)) { return; } doc.Load(configPath); string topicPath = "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"; string dataTopicPath = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist/Topic"; if (fid != "") { topicPath = "/Aggregationinfo/Forum/Topiclist/Topic"; dataTopicPath = "/Aggregationinfo/Data/Topiclist/Topic"; } ModifyNode(doc, topicPath); ModifyNode(doc, dataTopicPath); doc.Save(configPath); if (fid == "") { AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_editforumaggset.aspx"); } else { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/TopicByForumId_" + fid); Response.Redirect("aggregation_editforumaggset.aspx?fid=" + fid); } #endregion }
private void Btn_SaveInfo_Click(object sender, EventArgs e) { XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(this.configPath); int num = 0; XmlNode xmlNode = xmlDocumentExtender.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomendtopiclist"); foreach (object current in this.DataGrid1.GetKeyIDArray()) { string childElementValue = current.ToString(); string controlValue = this.DataGrid1.GetControlValue(num, "tid"); string controlValue2 = this.DataGrid1.GetControlValue(num, "title"); string controlValue3 = this.DataGrid1.GetControlValue(num, "img"); XmlElement newChild = xmlDocumentExtender.CreateElement("Website_forumrecomendtopic"); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "fid", childElementValue); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "tid", controlValue); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "img", controlValue3); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "title", controlValue2); xmlNode.AppendChild(newChild); num++; } xmlDocumentExtender.Save(this.configPath); base.Response.Redirect("aggregation_recommendtopic.aspx"); }
/// <summary> /// 保存信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveTopic_Click(object sender, EventArgs e) { #region 保存信息 string tidlist = DNTRequest.GetString("forumtopicstatus"); //当未选择主题时,则清除所有选择 if (tidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); doc.Save(configPath); Response.Redirect("aggregation_editforumaggset.aspx"); return; } else { PostInfo[] posts = new ForumAggregationData().GetPostListFromFile("Website"); //得到所选择帖子信息 Posts.WriteAggregationPostData(posts, tablelist.SelectedValue, tidlist, configPath, "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist", "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_editforumaggset.aspx"); } #endregion }
protected void savetopic_Click(object sender, EventArgs e) { XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); if (!File.Exists(this.configPath)) { return; } xmlDocumentExtender.Load(this.configPath); string topicPath = "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"; string topicPath2 = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist/Topic"; if (this.fid != "") { topicPath = "/Aggregationinfo/Forum/Topiclist/Topic"; topicPath2 = "/Aggregationinfo/Data/Topiclist/Topic"; } this.ModifyNode(xmlDocumentExtender, topicPath); this.ModifyNode(xmlDocumentExtender, topicPath2); xmlDocumentExtender.Save(this.configPath); if (String.IsNullOrEmpty(this.fid)) { AggregationFacade.BaseAggregation.ClearAllDataBind(); base.Response.Redirect("aggregation_editforumaggset.aspx"); return; } XCache.Remove("/Aggregation/TopicByForumId_" + this.fid); base.Response.Redirect("aggregation_editforumaggset.aspx?fid=" + this.fid); }
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'"); }
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 }
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 }
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 }
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>"); }
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>"); }
private void savetopic_Click(object sender, EventArgs e) { #region 保存相册 string aid = DNTRequest.GetString("aid"); string aidlist = Utils.ClearLastChar(recommendalbum.Value); string dataNode = ""; string indexNode = ""; string pagename = DNTRequest.GetString("pagename").ToLower(); if (pagename == "albumindex") { dataNode = "/Aggregationinfo/Aggregationdata/Albumindexaggregationdata/Albumindex_albumlist"; indexNode = "/Aggregationinfo/Aggregationpage/Albumindex/Albumindex_albumlist"; } else if (pagename == "website") { dataNode = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Website_albumlist"; indexNode = "/Aggregationinfo/Aggregationpage/Website/Website_albumlist"; } else { dataNode = "/Aggregationinfo/Aggregationdata/Spaceindexaggregationdata/Spaceindex_albumlist"; indexNode = "/Aggregationinfo/Aggregationpage/Spaceindex/Spaceindex_albumlist"; } if (aidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode(dataNode); doc.RemoveNodeAndChildNode(indexNode); doc.Save(configPath); Response.Redirect("aggregation_commendalbums.aspx?pagename=" + DNTRequest.GetString("pagename")); return; } else { DataTable dt = DbProvider.GetInstance().GetAlbumLitByAlbumidList(aidlist); XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode data_albumslistnode = doc.InitializeNode(dataNode); XmlNode index_albumslistnode = doc.InitializeNode(indexNode); foreach (DataRow dr in dt.Rows) { XmlElement album = doc.CreateElement("Album"); doc.AppendChildElementByDataRow(ref album, dt.Columns, dr, "description"); data_albumslistnode.AppendChild(album); if (("," + aid + ",").IndexOf("," + dr["albumid"].ToString() + ",") >= 0) { index_albumslistnode.AppendChild(album.Clone()); } } doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_commendalbums.aspx?pagename=" + DNTRequest.GetString("pagename")); } #endregion }
/// <summary> /// 保存信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveTopic_Click(object sender, EventArgs e) { #region 保存信息 string tidlist = DNTRequest.GetString("forumtopicstatus"); //当未选择主题时,则清除所有选择 if (tidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); doc.Save(configPath); Response.Redirect("aggregation_editforumaggset.aspx"); return; } else { //得到所选择帖子信息 DataTable dt = DatabaseProvider.GetInstance().GetTopicListByTidlist(tablelist.SelectedValue, tidlist); XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); //清除以前选择 XmlNode topiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist"); XmlNode websitetopiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); tidlist = DNTRequest.GetString("tid"); foreach (DataRow dr in dt.Rows) { //创建Topic节点 XmlElement topic = doc.CreateElement("Topic"); doc.AppendChildElementByDataRow(ref topic, dt.Columns, dr, "tid,message"); doc.AppendChildElementByNameValue(ref topic, "topicid", dr["tid"].ToString()); string tempubbstr = UBB.ClearUBB(dr["message"].ToString()); if (tempubbstr.Length > 200) { tempubbstr = tempubbstr.Substring(0, 200) + "..."; } doc.AppendChildElementByNameValue(ref topic, "shortdescription", tempubbstr, true); doc.AppendChildElementByNameValue(ref topic, "fulldescription", UBB.ClearUBB(dr["message"].ToString()), true); topiclistnode.AppendChild(topic); if (("," + tidlist + ",").IndexOf("," + dr["tid"].ToString() + ",") >= 0) { websitetopiclistnode.AppendChild(topic.Clone()); } } doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_editforumaggset.aspx"); } #endregion }
private void Btn_SaveInfo_Click(object sender, EventArgs e) { #region 保存自动提取数据 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode fidlist = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist"); fidlist.InnerText = DNTRequest.GetString("rst"); doc.Save(configPath); Response.Redirect("aggregation_recommendtopic.aspx"); #endregion }
private void Btn_SaveInfo_Click(object sender, EventArgs e) { XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(this.configPath); XmlNode xmlNode = xmlDocumentExtender.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist"); xmlNode.InnerText = Request["rst"]; xmlDocumentExtender.Save(this.configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); base.Response.Redirect("aggregation_recommendtopic.aspx"); }