private DataTable GetWebsiteConfig() { DataTable dataTable = new DataTable(); dataTable.Columns.Add("tid"); dataTable.Columns.Add("title"); dataTable.Columns.Add("poster"); dataTable.Columns.Add("postdatetime"); dataTable.Columns.Add("showtype"); XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); if (!File.Exists(this.configPath)) { return(new DataTable()); } xmlDocumentExtender.Load(this.configPath); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/Aggregationinfo/Forum/Hottopiclist/Topic"); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); DataRow dataRow = dataTable.NewRow(); dataRow["tid"] = xmlNodeInnerTextVisitor["tid"]; dataRow["title"] = xmlNodeInnerTextVisitor["title"]; dataRow["poster"] = xmlNodeInnerTextVisitor["poster"]; dataRow["postdatetime"] = xmlNodeInnerTextVisitor["postdatetime"]; dataTable.Rows.Add(dataRow); } return(dataTable); }
private void LoadWebSiteConfig() { XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(this.configPath); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist/Topic"); XmlNodeList xmlNodeList2 = xmlDocumentExtender.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor2 = new XmlNodeInnerTextVisitor(); this.forumlist.Text = ""; int num = 0; foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); bool flag = false; foreach (XmlNode node2 in xmlNodeList2) { xmlNodeInnerTextVisitor2.SetNode(node2); if (xmlNodeInnerTextVisitor["topicid"].ToString() == xmlNodeInnerTextVisitor2["topicid"].ToString()) { flag = true; break; } } Literal expr_E4 = this.forumlist; object text = expr_E4.Text; expr_E4.Text = text + "<div class='mo' id='m" + num + "' flag='f" + num + "'><h1><input type='checkbox' name='tid' " + (flag ? "checked" : "") + " value='" + xmlNodeInnerTextVisitor["topicid"] + "'>" + xmlNodeInnerTextVisitor["title"] + "</h1></div>\n"; num++; } this.topnumber.Text = xmlDocumentExtender.GetSingleNodeValue(xmlDocumentExtender.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum")[0], "Bbs/Topnumber"); this.showtype.SelectedValue = xmlDocumentExtender.GetSingleNodeValue(xmlDocumentExtender.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum")[0], "Bbs/Showtype"); }
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"); }
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 }
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 }
/// <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 LoadWebSiteConfig() { #region 装载个人空间信息 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList data_spacelistNode = doc.SelectNodes("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacelist/Space"); XmlNodeList index_spacelistnode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacelist/Space"); XmlNodeInnerTextVisitor dataspacevisitor = new XmlNodeInnerTextVisitor(); XmlNodeInnerTextVisitor indexspacevisitor = new XmlNodeInnerTextVisitor(); int i = 0; spacelist.Text = ""; foreach (XmlNode data in data_spacelistNode) { dataspacevisitor.SetNode(data); bool isCheck = false; foreach (XmlNode index in index_spacelistnode) { indexspacevisitor.SetNode(index); if (dataspacevisitor["spaceid"].ToString() == indexspacevisitor["spaceid"].ToString()) { isCheck = true; break; } } spacelist.Text += "<div class='mo' id='m" + i + "' flag='f" + i + "'><h1><input type='checkbox' name='sid' " + (isCheck ? "checked" : "") + " value='" + dataspacevisitor["spaceid"] + "'>" + dataspacevisitor["title"] + "</h1></div>\n"; i++; } #endregion }
public string[] GetParm(XmlDocumentExtender doc, string menuparentid) { string[] array = new string[3]; XmlNodeList xmlNodeList = doc.SelectNodes("/dataset/mainmenu"); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); if (xmlNodeInnerTextVisitor["menuid"] == menuparentid) { array[0] = xmlNodeInnerTextVisitor["id"]; break; } } XmlNodeList xmlNodeList2 = doc.SelectNodes("/dataset/toptabmenu"); foreach (XmlNode node2 in xmlNodeList2) { xmlNodeInnerTextVisitor.SetNode(node2); if (("," + xmlNodeInnerTextVisitor["mainmenulist"] + ",").IndexOf("," + array[0] + ",") != -1) { array[1] = xmlNodeInnerTextVisitor["id"]; array[2] = xmlNodeInnerTextVisitor["mainmenulist"]; break; } } return(array); }
/// <summary> /// 装载WebSite信息 /// </summary> private void LoadWebSiteConfig() { #region 装载主题信息 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist/Topic"); XmlNodeList website_spacelistnode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/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["topicid"].ToString() == pagetopicvisitor["topicid"].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["topicid"] + "'>" + topicvisitor["title"] + "</h1></div>\n"; i++; } topnumber.Text = doc.GetSingleNodeValue(doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum")[0], "Bbs/Topnumber"); showtype.SelectedValue = doc.GetSingleNodeValue(doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum")[0], "Bbs/Showtype"); #endregion }
private void BindEditData(string tid) { this.panel1.Visible = true; XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); if (!File.Exists(this.configPath)) { return; } xmlDocumentExtender.Load(this.configPath); string xpath = "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"; if (this.fid != "") { xpath = "/Aggregationinfo/Forum/Topiclist/Topic"; } XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes(xpath); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); if (xmlNodeInnerTextVisitor["topicid"] == tid) { this.topicid.Value = xmlNodeInnerTextVisitor["topicid"]; this.title.Text = xmlNodeInnerTextVisitor["title"]; this.poster.Text = xmlNodeInnerTextVisitor["poster"]; this.postdatetime.Text = xmlNodeInnerTextVisitor["postdatetime"]; this.shortdescription.Text = xmlNodeInnerTextVisitor["shortdescription"]; this.fulldescription.Value = xmlNodeInnerTextVisitor["fulldescription"]; } } }
/// <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); }
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 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 }
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 BindDataGrid() { this.DataGrid1.TableHeaderName = "快捷菜单管理"; XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(this.configPath); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/dataset/mainmenu"); XmlNodeList xmlNodeList2 = xmlDocumentExtender.SelectNodes("/dataset/toptabmenu"); string[] array = new string[xmlNodeList.Count]; for (int i = 0; i < array.Length; i++) { foreach (XmlNode xmlNode in xmlNodeList2) { if (("," + xmlNode["mainmenulist"].InnerText + ",").IndexOf("," + xmlNodeList[i].SelectSingleNode("id").InnerText + ",") != -1) { array[i] = xmlNode["title"].InnerText + "->" + xmlNodeList[i].SelectSingleNode("menutitle").InnerText; break; } } } DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("id")); dataTable.Columns.Add(new DataColumn("local")); XmlNodeList xmlNodeList3 = xmlDocumentExtender.SelectNodes("/dataset/shortcut"); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList3) { xmlNodeInnerTextVisitor.SetNode(node); DataRow dataRow = dataTable.NewRow(); dataRow["id"] = xmlNodeInnerTextVisitor["link"]; dataRow["local"] = array[int.Parse(xmlNodeInnerTextVisitor["showmenuid"]) - 1] + "->" + xmlNodeInnerTextVisitor["menutitle"]; dataTable.Rows.Add(dataRow); } if (dataTable.Rows.Count == 0) { DataRow dataRow2 = dataTable.NewRow(); dataRow2["id"] = ""; dataRow2["local"] = "(暂无收藏)"; dataTable.Rows.Add(dataRow2); } this.DataGrid1.DataSource = dataTable; this.DataGrid1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { this.resultmessage = "<img src='../images/existmenu.gif' style='vertical-align:middle'/> 已经收藏"; string mapPath = Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "admin/xml/navmenu.config"); string childElementValue = ""; string menuparentid = ""; string text = Request["url"].ToLower(); XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); xmlDocumentExtender.Load(mapPath); XmlNodeList xmlNodeList = xmlDocumentExtender.SelectNodes("/dataset/shortcut"); foreach (XmlNode xmlNode in xmlNodeList) { if (xmlNode.SelectSingleNode("link").InnerText == text.ToLower().Trim()) { return; } } XmlNodeList xmlNodeList2 = xmlDocumentExtender.SelectNodes("/dataset/submain"); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList2) { xmlNodeInnerTextVisitor.SetNode(node); if (xmlNodeInnerTextVisitor["link"].ToLower() == text) { childElementValue = xmlNodeInnerTextVisitor["menutitle"]; menuparentid = xmlNodeInnerTextVisitor["menuparentid"]; } } string[] parm = this.GetParm(xmlDocumentExtender, menuparentid); XmlElement newChild = xmlDocumentExtender.CreateElement("shortcut"); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "link", text); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "menutitle", childElementValue); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "frameid", "main"); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "custommenu", "true"); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "showmenuid", parm[0]); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "toptabmenuid", parm[1]); xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "mainmenulist", parm[2]); xmlDocumentExtender.SelectSingleNode("/dataset").AppendChild(newChild); xmlDocumentExtender.Save(mapPath); MenuManage.CreateMenuJson(); }
/// <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 }
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 }
private void BindEditData(string tid) { this.panel1.Visible = true; 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"] == tid) { this.topicid.Value = xmlNodeInnerTextVisitor["tid"]; this.title.Text = xmlNodeInnerTextVisitor["title"]; this.poster.Text = xmlNodeInnerTextVisitor["poster"]; this.postdatetime.Text = xmlNodeInnerTextVisitor["postdatetime"]; } } }
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; } } }
private void ModifyNode(XmlDocumentExtender doc, string topicPath) { XmlNodeList xmlNodeList = doc.SelectNodes(topicPath); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); if (xmlNodeInnerTextVisitor["topicid"] == this.topicid.Value) { xmlNodeInnerTextVisitor["topicid"] = this.topicid.Value; xmlNodeInnerTextVisitor["title"] = this.title.Text; xmlNodeInnerTextVisitor["poster"] = this.poster.Text; xmlNodeInnerTextVisitor["postdatetime"] = this.postdatetime.Text; XmlCDataSection xmlCDataSection = doc.CreateCDataSection("shortdescription"); xmlCDataSection.InnerText = this.shortdescription.Text; xmlNodeInnerTextVisitor.GetNode("shortdescription").RemoveAll(); xmlNodeInnerTextVisitor.GetNode("shortdescription").AppendChild(xmlCDataSection); break; } } }
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(); } }
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"); }