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 }
private void SaveTopic_Click(object sender, EventArgs e) { #region 装载修改信息 string pid = DNTRequest.GetString("pid"); string pidlist = Utils.ClearLastChar(poststatus.Value); if (pidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacearticlelist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacearticlelist"); doc.Save(configPath); Response.Redirect("aggregation_postaggset.aspx"); return; } else { DataTable dt = DbProvider.GetInstance().GetSpacepostLitByTidlist(pidlist); XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode data_spacearticlelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacearticlelist"); XmlNode pagearticlelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacearticlelist"); foreach (DataRow dr in dt.Rows) { XmlElement article = doc.CreateElement("Article"); doc.AppendChildElementByDataRow(ref article, dt.Columns, dr); data_spacearticlelistnode.AppendChild(article); if (("," + pid + ",").IndexOf("," + dr["postid"].ToString() + ",") >= 0) { pagearticlelistnode.AppendChild(article.Clone()); } } doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_postaggset.aspx?pagename=" + pagename); } #endregion }
private void savetopic_Click(object sender, EventArgs e) { #region 绑定自动推荐相册修改 //验证值是否正确 if (!ValidateValue(focusphotodays.Text)) return; if (!ValidateValue(focusphotocount.Text)) return; if (!ValidateValue(focusalbumdays.Text)) return; if (!ValidateValue(focusalbumcount.Text)) return; if (!ValidateValue(weekhot.Text)) return; string strfocusphotoshowtype = focusphotoshowtype.SelectedIndex.ToString(); string strfocusphotodays = focusphotodays.Text; string strfocusphotocount = focusphotocount.Text; string strfocusalbumshowtype = recommendalbumtype.SelectedIndex.ToString(); string strfocusalbumdays = focusalbumdays.Text; string strfocusalbumcount = focusalbumcount.Text; string strweekhot = weekhot.Text; //保存信息 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig"); XmlNode albumconfig = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig"); XmlElement node = doc.CreateElement("Focusphotoshowtype"); node.InnerText = strfocusphotoshowtype; albumconfig.AppendChild(node); node = doc.CreateElement("Focusphotodays"); node.InnerText = strfocusphotodays; albumconfig.AppendChild(node); node = doc.CreateElement("Focusphotocount"); node.InnerText = strfocusphotocount; albumconfig.AppendChild(node); node = doc.CreateElement("Focusalbumshowtype"); node.InnerText = strfocusalbumshowtype; albumconfig.AppendChild(node); node = doc.CreateElement("Focusalbumdays"); node.InnerText = strfocusalbumdays; albumconfig.AppendChild(node); node = doc.CreateElement("Focusalbumcount"); node.InnerText = strfocusalbumcount; albumconfig.AppendChild(node); node = doc.CreateElement("Weekhot"); node.InnerText = strweekhot; albumconfig.AppendChild(node); doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_autoalbums.aspx"); #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 == "") { 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 }
private void SaveTopic_Click(object sender, EventArgs e) { #region 保存相册修改 string pid = DNTRequest.GetString("pid"); string pidlist = Utils.ClearLastChar(recommendphoto.Value); string dataNode = ""; string indexNode = ""; if (pagename == "Website") { dataNode = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Website_photolist"; indexNode = "/Aggregationinfo/Aggregationpage/Website/Website_photolist"; } else { dataNode = "/Aggregationinfo/Aggregationdata/Albumaggregationdata/Albumindex_photolist"; indexNode = "/Aggregationinfo/Aggregationpage/Albumindex/Albumindex_photolist"; } if (pidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode(dataNode); doc.RemoveNodeAndChildNode(indexNode); doc.Save(configPath); Response.Redirect("aggregation_photoaggset.aspx?pagename=" + DNTRequest.GetString("pagename")); return; } else { IDataReader dr = DbProvider.GetInstance().GetRecommendPhotoList(pidlist); XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode data_photolistnode = doc.InitializeNode(dataNode); XmlNode index_photolistnode = doc.InitializeNode(indexNode); string[] colName = { "photoid", "filename", "attachment", "filesize", "title", "description", "postdate", "albumid", "userid", "username", "views", "commentstatus", "tagstatus", "comments", "isattachment" }; while(dr.Read()) { XmlElement photo = doc.CreateElement("Photo"); foreach (string col in colName) { XmlElement node = doc.CreateElement(col); if(col == "filename") node.InnerText = dr[col].ToString().Trim().Replace(".","_thumbnail."); else node.InnerText = dr[col].ToString().Trim() ; photo.AppendChild(node); } data_photolistnode.AppendChild(photo); if (("," + pid + ",").IndexOf("," + dr["photoid"].ToString() + ",") >= 0) index_photolistnode.AppendChild(photo.Clone()); } dr.Close(); doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_photoaggset.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 }
/// <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 }
/// <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 SaveTopic_Click(object sender, EventArgs e) { #region 保存个人空间信息 string sidlist = DNTRequest.GetString("spacestatus"); if (sidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacelist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacelist"); doc.Save(configPath); Response.Redirect("aggregation_spaceaggset.aspx"); return; } else { DataTable dt = DbProvider.GetInstance().GetSpaceLitByTidlist(sidlist); XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode data_spacelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacelist"); XmlNode pagelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacelist"); sidlist = DNTRequest.GetString("sid"); foreach (DataRow dr in dt.Rows) { XmlElement space = doc.CreateElement("Space"); doc.AppendChildElementByDataRow(ref space, dt.Columns, dr, "title,avatar,description"); doc.AppendChildElementByNameValue(ref space, "title", dr["spacetitle"].ToString().Trim()); doc.AppendChildElementByNameValue(ref space, "pic", dr["avatar"].ToString().Trim()); doc.AppendChildElementByNameValue(ref space, "description", Utils.RemoveHtml(dr["description"].ToString().Trim()), true); string[] postinfo = DbProvider.GetInstance().GetSpaceLastPostInfo(int.Parse(dr["userid"].ToString())); doc.AppendChildElementByNameValue(ref space, "postid", postinfo[0]); doc.AppendChildElementByNameValue(ref space, "posttitle", postinfo[1]); data_spacelistnode.AppendChild(space); if (("," + sidlist + ",").IndexOf("," + dr["spaceid"].ToString() + ",") >= 0) { pagelistnode.AppendChild(space.Clone()); } } doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_spaceaggset.aspx?pagename=" + 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 == "") { 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> 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); //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) //{ // PostInfo newpost = null; // foreach (PostInfo post in posts) // { // if (post.Tid.ToString() == dr["tid"].ToString()) // { // newpost = post; // } // } // //创建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) + "..."; // if (newpost != null) // { // tempubbstr = newpost.Message; // } // 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 }