protected void Page_Load(object sender, EventArgs e) { // 在此处放置用户代码以初始化页面 allowUserGroup.Attributes.Add("onclick", "ChanageUserGroupStatus(this.checked)"); if (!IsPostBack) { EnableSpace.SelectedValue = config.Enablespace.ToString(); EnableSpace.Items[0].Attributes.Add("onclick", "ShowHiddenOption(true);"); EnableSpace.Items[1].Attributes.Add("onclick", "ShowHiddenOption(false);"); ShowSpaceOption.Attributes.Add("style", config.Enablespace == 1 ? "display:block" : "display:none"); ShowUserGroup.Attributes.Add("style", config.Enablespace == 1 ? "display:block" : "display:none"); LoadUserGroup(); XmlDocumentExtender xmlDoc = new XmlDocumentExtender(); xmlDoc.Load(Server.MapPath("../../config/space.config")); XmlNode root = xmlDoc.SelectSingleNode("SpaceActiveConfigInfo"); XmlNodeInnerTextVisitor rootvisitor = new XmlNodeInnerTextVisitor(); rootvisitor.SetNode(root); allowPostcount.Checked = rootvisitor["AllowPostcount"] == "1" ? true : false; Postcount.Text = rootvisitor["Postcount"]; allowDigestcount.Checked = rootvisitor["AllowDigestcount"] == "1" ? true : false; Digestcount.Text = rootvisitor["Digestcount"]; allowScore.Checked = rootvisitor["AllowScore"] == "1" ? true : false; Score.Text = rootvisitor["Score"]; allowUserGroup.Checked = rootvisitor["AllowUsergroups"] == "1" ? true : false; string groupList = rootvisitor["Usergroups"]; if (!allowUserGroup.Checked || groupList == "") return; else BindUserGroup(groupList); ActiveType.SelectedValue = rootvisitor["ActiveType"]; BindUserGorupMaxspaceattachsize(); } }
private void LoadWebSiteConfig() { #region 装载日志信息 XmlDocument doc = new XmlDocument(); doc.Load(configPath); XmlNodeList postlistNode = doc.SelectNodes("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacearticlelist/Article"); XmlNodeList index_spacelistnode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacearticlelist/Article"); XmlNodeInnerTextVisitor data_postvisitor = new XmlNodeInnerTextVisitor(); XmlNodeInnerTextVisitor index_postvisitor = new XmlNodeInnerTextVisitor(); postlist.Text = ""; int i = 0; foreach (XmlNode post in postlistNode) { data_postvisitor.SetNode(post); bool isCheck = false; foreach (XmlNode index in index_spacelistnode) { index_postvisitor.SetNode(index); if (data_postvisitor["postid"].ToString() == index_postvisitor["postid"].ToString()) { isCheck = true; break; } } postlist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='pid' " + (isCheck ? "checked" : "") + " value='" + data_postvisitor["postid"] + "'>" + data_postvisitor["title"] + "</h1></div>\n"; i++; } #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 }
/// <summary> /// 获取当前页面的参数 /// </summary> /// <param name="doc"></param> /// <param name="menuparentid"></param> /// <returns></returns> public string[] GetParm(XmlDocumentExtender doc, string menuparentid) { string[] parm = new string[3]; XmlNodeList mainmenus = doc.SelectNodes("/dataset/mainmenu"); XmlNodeInnerTextVisitor menuvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode mainmenu in mainmenus) { menuvisitor.SetNode(mainmenu); if (menuvisitor["menuid"] == menuparentid) { parm[0] = menuvisitor["id"]; break; } } XmlNodeList toptabmenus = doc.SelectNodes("/dataset/toptabmenu"); foreach (XmlNode toptabmenu in toptabmenus) { menuvisitor.SetNode(toptabmenu); if (("," + menuvisitor["mainmenulist"] + ",").IndexOf("," + parm[0] + ",") != -1) { parm[1] = menuvisitor["id"]; parm[2] = menuvisitor["mainmenulist"]; break; } } return parm; }
private DataTable GetWebsiteConfig() { #region 装载主题 DataTable dt = new DataTable(); dt.Columns.Add("tid"); dt.Columns.Add("title"); dt.Columns.Add("poster"); dt.Columns.Add("postdatetime"); dt.Columns.Add("showtype"); 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); DataRow dr = dt.NewRow(); dr["tid"] = topicvisitor["topicid"]; dr["title"] = topicvisitor["title"]; dr["poster"] = topicvisitor["poster"]; dr["postdatetime"] = topicvisitor["postdatetime"]; dt.Rows.Add(dr); } return dt; #endregion }
private void BindEditData(string tid) { #region 装载主题编辑 panel1.Visible = true; XmlDocumentExtender doc = new XmlDocumentExtender(); if (!File.Exists(configPath)) return; doc.Load(configPath); string topicPath = "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"; if (fid != "") topicPath = "/Aggregationinfo/Forum/Topiclist/Topic"; XmlNodeList topiclistNode = doc.SelectNodes(topicPath); XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["topicid"] == tid) { topicid.Value = topicvisitor["topicid"]; title.Text = topicvisitor["title"]; poster.Text = topicvisitor["poster"]; postdatetime.Text = topicvisitor["postdatetime"]; shortdescription.Text = topicvisitor["shortdescription"]; fulldescription.Value = topicvisitor["fulldescription"]; } } #endregion }
private void LoadWebSiteConfig() { #region 装载相册 XmlDocument doc = new XmlDocument(); doc.Load(configPath); string dataNode = ""; string indexNode = ""; string pagename = DNTRequest.GetString("pagename").ToLower(); if(pagename == "albumindex") { dataNode = "/Aggregationinfo/Aggregationdata/Albumindexaggregationdata/Albumindex_albumlist/Album"; indexNode = "/Aggregationinfo/Aggregationpage/Albumindex/Albumindex_albumlist/Album"; } else if (pagename == "website") { dataNode = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Website_albumlist/Album"; indexNode = "/Aggregationinfo/Aggregationpage/Website/Website_albumlist/Album"; } else { dataNode = "/Aggregationinfo/Aggregationdata/Spaceindexaggregationdata/Spaceindex_albumlist/Album"; indexNode = "/Aggregationinfo/Aggregationpage/Spaceindex/Spaceindex_albumlist/Album"; } XmlNodeList data_albumlistNode = doc.SelectNodes(dataNode); XmlNodeList index_albumlistNode = doc.SelectNodes(indexNode); XmlNodeInnerTextVisitor data_albumvisitor = new XmlNodeInnerTextVisitor(); XmlNodeInnerTextVisitor index_albumvisitor = new XmlNodeInnerTextVisitor(); albumlist.Text = ""; int i = 0; foreach (XmlNode album in data_albumlistNode) { data_albumvisitor.SetNode(album); bool isCheck = false; foreach (XmlNode index in index_albumlistNode) { index_albumvisitor.SetNode(index); if (data_albumvisitor["albumid"].ToString() == index_albumvisitor["albumid"].ToString()) { isCheck = true; break; } } albumlist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='aid' " + (isCheck ? "checked" : "") + " value='" + data_albumvisitor["albumid"] + "'>" + data_albumvisitor["title"] + "</h1></div>\n"; i++; } #endregion }
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(); }
private void BindDataGrid() { DataGrid1.TableHeaderName = "快捷菜单管理"; XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList mainmenus = doc.SelectNodes("/dataset/mainmenu"); XmlNodeList toptabmenus = doc.SelectNodes("/dataset/toptabmenu"); string[] menuText = new string[mainmenus.Count]; for (int i = 0; i < menuText.Length; i++) { foreach (XmlNode topmenuitem in toptabmenus) { if (("," + topmenuitem["mainmenulist"].InnerText + ",").IndexOf("," + mainmenus[i].SelectSingleNode("id").InnerText + ",") != -1) { menuText[i] = topmenuitem["title"].InnerText + "->" + mainmenus[i].SelectSingleNode("menutitle").InnerText; break; } } } DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("id")); dt.Columns.Add(new DataColumn("local")); XmlNodeList shortcutmenus = doc.SelectNodes("/dataset/shortcut"); XmlNodeInnerTextVisitor shortcutmenuvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode shortcutmenu in shortcutmenus) { shortcutmenuvisitor.SetNode(shortcutmenu); DataRow dr = dt.NewRow(); dr["id"] = shortcutmenuvisitor["link"]; dr["local"] = menuText[int.Parse(shortcutmenuvisitor["showmenuid"]) - 1] + "->" + shortcutmenuvisitor["menutitle"]; dt.Rows.Add(dr); } if (dt.Rows.Count == 0) { DataRow dr = dt.NewRow(); dr["id"] = ""; dr["local"] = "(暂无收藏)"; dt.Rows.Add(dr); } DataGrid1.DataSource = dt; DataGrid1.DataBind(); }
private void BindEditData(string tid) { #region 装载主题编辑 panel1.Visible = true; 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"] == tid) { topicid.Value = topicvisitor["tid"]; title.Text = topicvisitor["title"]; poster.Text = topicvisitor["poster"]; postdatetime.Text = topicvisitor["postdatetime"]; } } #endregion }
/// <summary> /// 装载WebSite信息 /// </summary> private void LoadWebSiteConfig() { #region 相册信息 XmlDocument doc = new XmlDocument(); doc.Load(configPath); string dataNode = ""; string indexNode = ""; if(pagename == "Website") { dataNode = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Website_photolist/Photo"; indexNode = "/Aggregationinfo/Aggregationpage/Website/Website_hotolist/Photo"; } else { dataNode = "/Aggregationinfo/Aggregationdata/Albumaggregationdata/Albumindex_photolist/Photo"; indexNode = "/Aggregationinfo/Aggregationpage/Albumindex/Albumindex_photolist/Photo"; } XmlNodeList data_photolistNode = doc.SelectNodes(dataNode); XmlNodeList index_photolistNode = doc.SelectNodes(indexNode); XmlNodeInnerTextVisitor data_photovisitor = new XmlNodeInnerTextVisitor(); XmlNodeInnerTextVisitor index_photovisitor = new XmlNodeInnerTextVisitor(); photolist.Text = ""; int i = 0; foreach (XmlNode photo in data_photolistNode) { data_photovisitor.SetNode(photo); bool isCheck = false; foreach (XmlNode index in index_photolistNode) { index_photovisitor.SetNode(index); if (data_photovisitor["photoid"].ToString() == index_photovisitor["photoid"].ToString()) { isCheck = true; break; } } photolist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='pid' " + (isCheck ? "checked" : "") + " value='" + data_photovisitor["photoid"].ToString() + "'>" + data_photovisitor["title"].ToString() + "</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/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 }
public void Submit_Click(object sender, EventArgs e) { config.Enablespace = int.Parse(EnableSpace.SelectedValue); GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config")); if (!Utils.IsInt(Postcount.Text)) { base.RegisterStartupScript("", "<script>alert('论坛发帖数超过输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } if (!Utils.IsInt(Digestcount.Text)) { base.RegisterStartupScript("", "<script>alert('论坛精华帖数输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } if (!Utils.IsInt(Score.Text)) { base.RegisterStartupScript("", "<script>alert('论坛用户积分输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } if (config.Enablespace == 1) { XmlDocument xmlDoc = new XmlDocument(); string filePath = Server.MapPath("../../config/space.config"); xmlDoc.Load(filePath); XmlNode root = xmlDoc.SelectSingleNode("SpaceActiveConfigInfo"); XmlNodeInnerTextVisitor rootvisitor = new XmlNodeInnerTextVisitor(); rootvisitor.SetNode(root); rootvisitor["AllowPostcount"] = allowPostcount.Checked ? "1" : "0"; rootvisitor["Postcount"] = Postcount.Text; rootvisitor["AllowDigestcount"] = allowDigestcount.Checked ? "1" : "0"; rootvisitor["Digestcount"] = Digestcount.Text; rootvisitor["AllowScore"] = allowScore.Checked ? "1" : "0"; rootvisitor["Score"] = Score.Text; rootvisitor["AllowUsergroups"] = allowUserGroup.Checked ? "1" : "0"; string groupList = ""; for (int i = 0; i < UserGroup.Items.Count; i++) { if (UserGroup.Items[i].Selected) { groupList += UserGroup.Items[i].Value + ","; } } if (groupList == "") rootvisitor["Usergroups"] = ""; else rootvisitor["Usergroups"] = groupList.Substring(0, groupList.Length - 1); rootvisitor["ActiveType"] = ActiveType.SelectedValue; xmlDoc.Save(filePath); //保存个人空间最大附件空间 DataTable dt = DatabaseProvider.GetInstance().GetUserGroupMaxspaceattachsize(); foreach (DataRow dr in dt.Rows) { if (!Utils.IsInt(DNTRequest.GetString("maxspaceattachsize" + dr["groupid"].ToString()).ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误,空间附件最大空间只能是0或者正整数');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } int attachsize = DNTRequest.GetInt("maxspaceattachsize" + dr["groupid"].ToString(), 0); Discuz.Entity.UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(dr["groupid"].ToString())); __usergroupinfo.Maxspaceattachsize = attachsize; AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); } Response.Redirect("space_spaceapplysetting.aspx"); }
/// <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 ModifyNode(XmlDocumentExtender doc,string topicPath) { XmlNodeList topiclistNode = doc.SelectNodes(topicPath); XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["topicid"] == topicid.Value) { topicvisitor["topicid"] = topicid.Value; topicvisitor["title"] = title.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; } } }