private void BindDataGrid()
 {
     DataGrid1.TableHeaderName = pagename + " 子菜单项管理";
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     string submenuid = DNTRequest.GetString("submenuid");
     XmlNodeList submenusitem = doc.SelectNodes("/dataset/submain");
     DataTable dt = new DataTable();
     dt.Columns.Add(new DataColumn("id"));
     dt.Columns.Add(new DataColumn("menutitle"));
     dt.Columns.Add(new DataColumn("link"));
     int i = 0;
     foreach (XmlNode menuitem in submenusitem)
     {
         if(menuitem["menuparentid"].InnerText == submenuid)
         {
             DataRow dr = dt.NewRow();
             dr["id"] = i.ToString();
             dr["menutitle"] = menuitem["menutitle"].InnerText;
             dr["link"] = menuitem["link"].InnerText;
             dt.Rows.Add(dr);
         }
         i++;
     }
     DataGrid1.DataSource = dt;
     DataGrid1.DataBind();
 }
 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
 }
  /// <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
  }
Exemple #4
0
        /// <summary>
        /// 增加主菜单
        /// </summary>
        /// <param name="title">主菜单标题</param>
        /// <param name="defaulturl">主菜单默认展开的页面</param>
        /// <returns>新主菜单项ID</returns>
        public static int NewMainMenu(string title, string defaulturl)
        {
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
            int newMenuId = mainmenus.Count + 1;
            XmlElement newMainMenuItem = doc.CreateElement("toptabmenu");
            XmlElement node = doc.CreateElement("id");
            node.InnerText = newMenuId.ToString();
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("title");
            node.InnerText = title;
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("mainmenulist");
            node.InnerText = "";
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("mainmenuidlist");
            node.InnerText = "";
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("defaulturl");
            node.InnerText = defaulturl;
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("system");
            node.InnerText = "0";
            newMainMenuItem.AppendChild(node);

            doc.SelectSingleNode("/dataset").AppendChild(newMainMenuItem);
            doc.Save(configPath);
            return newMenuId;
        }
 /// <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;
 }
Exemple #6
0
        /*private void SaveManagerBody()
        {
            string url = Context.Request.Url.ToString().ToLower().Substring(0, Context.Request.Url.ToString().ToLower().IndexOf("rapidset")) + "framepage/managerbody.aspx";
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));
            req.Method = "GET";
            WebResponse wr = req.GetResponse();
            StreamReader sr = new StreamReader(wr.GetResponseStream(), System.Text.Encoding.GetEncoding("gb2312"));
            string html = sr.ReadToEnd();
            FileStream fs = new FileStream(Utils.GetMapPath("../framepage/managerbody.htm"), FileMode.Create);
            byte[] bt = System.Text.Encoding.UTF8.GetBytes(html);
            fs.Write(bt, 0, bt.Length);
            fs.Close();
        }*/

        private void BindDataGrid()
        {
            DataGrid1.TableHeaderName = "菜单管理";
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("id"));
            dt.Columns.Add(new DataColumn("title"));
            dt.Columns.Add(new DataColumn("defaulturl"));
            dt.Columns.Add(new DataColumn("system"));
            dt.Columns.Add(new DataColumn("delitem"));
            foreach (XmlNode menuitem in mainmenus)
            {
                DataRow dr = dt.NewRow();
                dr["id"] = menuitem["id"].InnerText;
                dr["title"] = menuitem["title"].InnerText;
                dr["defaulturl"] = menuitem["defaulturl"].InnerText;
                dr["system"] = menuitem["system"].InnerText != "0" ? "是" : "否";
                if (menuitem["mainmenulist"].InnerText != "")
                    dr["delitem"] = "删除";
                else
                    dr["delitem"] = "<a href='managemainmenu.aspx?mode=del&menuid=" + menuitem["id"].InnerText + "' onclick='return confirm(\"您确认要删除此菜单项吗?\")'>删除</a>";
                dt.Rows.Add(dr);
            }
            DataGrid1.DataSource = dt;
            DataGrid1.DataBind();
        }
		public void BindData()
        {
            #region 绑定轮换图片列表
            DataGrid1.AllowCustomPaging = false;
			DataGrid1.DataKeyField = "rotatepicid";
            DataGrid1.TableHeaderName = "聚合轮换图片列表";

			XmlDocumentExtender xmldocument = new XmlDocumentExtender();
			xmldocument.Load(configPath);
			XmlNode node = xmldocument.SelectSingleNode(targetNode);
            if (node == null || node.ChildNodes.Count == 0)
            {
                DataGrid1.Visible = SaveRotatepic.Visible = false;
                return;
            }
			XmlNodeReader rdr = new XmlNodeReader(node);
			dsSrc.ReadXml(rdr);
            dsSrc.Tables[0].Columns.Add("rowid");
            int i = 0;
            foreach (DataRow dr in dsSrc.Tables[0].Rows)
            {
                dr["rowid"] = i.ToString();
                i++;
            }
			DataGrid1.DataSource = dsSrc.Tables[0];
			DataGrid1.DataBind();
            #endregion
        }
 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 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
 }
        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();
			}
		}
        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'");
        }
 /// <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 void BindData()
        {
            #region 绑定数据
            DataGrid1.AllowCustomPaging = false;
            DataGrid1.DataKeyField = "menuid";
			DataGrid1.TableHeaderName = "我的菜单列表";

            
		    DataSet dsSrc = new DataSet();
			XmlDocumentExtender xmldocument = new XmlDocumentExtender();
			xmldocument.Load(configPath);
			XmlNode node = xmldocument.SelectSingleNode("/menuset");
            if (node == null ||node.ChildNodes.Count == 0)
                return;
			XmlNodeReader rdr = new XmlNodeReader(node);
			dsSrc.ReadXml(rdr);
            dsSrc.Tables[0].Columns.Add("menuid");
            int i = 0;
            foreach (DataRow dr in dsSrc.Tables[0].Rows)
            {
                dr["menuid"] = i.ToString();
                i++;
            }
			DataGrid1.DataSource = dsSrc.Tables[0];
			DataGrid1.DataBind();
            #endregion
        }
        private void LoadInfo()
        {
            string fids = "";
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNode fidlist = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist");
            if (fidlist == null)
            {
                return;
            }
            fids = fidlist.InnerText;
            string strJson = "";
            Discuz.Common.Generic.List<ForumInfo> lists = Discuz.Forum.Forums.GetForumList();
            foreach (string fid in fids.Split(','))
            {
                foreach (ForumInfo foruminfo in lists)
                {
                    if (foruminfo.Fid.ToString() == fid)
                    {
                        strJson += "{'fid':'" + foruminfo.Fid + "','forumtitle':'" + foruminfo.Name + "'},";
                        break;
                    }
                }
            }
            if (strJson != "")
            {
                strJson = strJson.TrimEnd(',');
            }

            strJson = "<script type='text/javascript'>\r\nvar fidlist = [" + strJson + "];\r\nfor(var i = 0 ; i < fidlist.length ; i++)\r\n{\r\nvar no = new Option();\r\nno.value = fidlist[i]['fid'];\r\nno.text = fidlist[i]['forumtitle'];\r\nForm1.list2.options[Form1.list2.options.length] = no;\r\n}\r\n</script>";
            base.RegisterStartupScript("", strJson);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            att.Columns.Add("typeid");
            att.Columns.Add("typename");
            att.Columns.Add("extname");
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
            XmlNodeList attachtype = doc.SelectNodes("/MyAttachmentsTypeConfigInfo/attachtypes/AttachmentType");
            foreach (XmlNode node in attachtype)
            {
                DataRow dr = att.NewRow();
                dr["typeid"] = node["TypeId"].InnerText;
                dr["typename"] = node["TypeName"].InnerText;
                dr["extname"] = node["ExtName"].InnerText != "" ? node["ExtName"].InnerText : "无绑定类型";
                att.Rows.Add(dr);
            }
            dt = DatabaseProvider.GetInstance().GetAttachTypes();
            string typeid = DNTRequest.GetString("typeid");

            if (!Page.IsPostBack)
            {
                BindData();

                string attlist = "";    //得到已绑定的附件列表
                if (att != null)
                {
                    foreach (DataRow dr in att.Rows)
                    {
                        attlist += dr["extname"].ToString() + ",";
                    }
                    attlist = attlist.TrimEnd(',');
                }
                attachextensions.AddTableData(dt);
                foreach (string atttype in attlist.Split(','))
                {
                    for (int i = 0; i < attachextensions.Items.Count; i++)
                    {
                        if (atttype == attachextensions.Items[i].Text)
                        {
                            attachextensions.Items[i].Enabled = false;
                            break;
                        }
                    }
                }
                string script = "var atttype = \r\n{";
                if (att != null)
                {
                    foreach (DataRow dr in att.Rows)
                    {
                        script += "\r\n\ttype" + dr["typeid"].ToString() + ":{typename:'" + dr["typename"].ToString() + "',extname:'" + dr["extname"].ToString() + "'},";
                    }
                    script = script.TrimEnd(',');
                }
                script += "\r\n};";
                base.RegisterStartupScript("", "<script type='text/javascript'>\r\n" + script + "\r\n</script>");
            }
        }
 public void BindData()
 {
     string menuId = DNTRequest.GetString("menuid");
     string menuTitle = "";
     string menuSubMenuList = "";
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList mainMenus = doc.SelectNodes("/dataset/toptabmenu");
     foreach (XmlNode menuItem in mainMenus) //查找主菜单信息
     {
         if (menuItem["id"].InnerText == menuId)
         {
             menuTitle = menuItem["title"].InnerText;
             menuSubMenuList = menuItem["mainmenulist"].InnerText;
             break;
         }
     }
     DataGrid1.TableHeaderName = menuTitle + "  菜单项管理";
     XmlNodeList subMenus = doc.SelectNodes("/dataset/mainmenu");
     DataTable dt = new DataTable();
     if (menuSubMenuList == "")  //该菜单没有子菜单
     {
         DataGrid1.DataSource = dt;
         DataGrid1.DataBind();
         return;
     }
     dt.Columns.Add("id");
     dt.Columns.Add("menuid");
     dt.Columns.Add("submenuid");
     dt.Columns.Add("menutitle");
     dt.Columns.Add("delitem");
     foreach (XmlNode subMenuItem in subMenus)
     {
         if (("," + menuSubMenuList + ",").IndexOf("," + subMenuItem["id"].InnerText + ",") != -1)
         {
             DataRow dr = dt.NewRow();
             dr["id"] = subMenuItem["id"].InnerText;
             dr["menuid"] = menuId;
             dr["submenuid"] = subMenuItem["menuid"].InnerText;
             dr["menutitle"] = subMenuItem["menutitle"].InnerText;
             if (FindSubMenuItem(subMenuItem["menuid"].InnerText,doc))
             {
                 dr["delitem"] = "删除";
             }
             else
             {
                 dr["delitem"] = "<a href='managesubmenu.aspx?mode=del&menuid=" + menuId + "&submenuid=" + subMenuItem["id"].InnerText + "' onclick='return confirm(\"您确认要删除此菜单项吗?\");'>删除</a>";
             }
             dt.Rows.Add(dr);
         }
     }
     DataGrid1.DataSource = dt;
     DataGrid1.DataBind();
 }
 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);
     AggregationFacade.BaseAggregation.ClearAllDataBind();
     Response.Redirect("aggregation_recommendtopic.aspx");
     #endregion
 }
        private void LoadInfo()
        {
            string fids = "";
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            fids = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist").InnerText;
            XmlNodeList forumrecomendtopic = doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomendtopiclist/Website_forumrecomendtopic");
            List<ForumInfo> lists = Discuz.Forum.Forums.GetForumList();
            DataTable forumdata = new DataTable();
            forumdata.Columns.Add("fid");
            forumdata.Columns.Add("name");
            forumdata.Columns.Add("tid");
            forumdata.Columns.Add("title");
            forumdata.Columns.Add("img");

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

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

            DataGrid1.TableHeaderName = "推荐版块图片选择";
            DataGrid1.DataKeyField = "fid";
            DataGrid1.DataSource = forumdata;
            DataGrid1.DataBind();
        }
Exemple #19
0
 private void LoadWebSiteConfig()
 {
     #region 绑定自动推荐相册
     //装载配置文件
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNode albumconfig = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig");
     focusphotoshowtype.SelectedIndex =  Convert.ToInt32(doc.GetSingleNodeValue(albumconfig, "Focusphotoshowtype"));
     focusphotodays.Text = doc.GetSingleNodeValue(albumconfig, "Focusphotodays");
     focusphotocount.Text = doc.GetSingleNodeValue(albumconfig, "Focusphotocount");
     recommendalbumtype.SelectedIndex = Convert.ToInt32(doc.GetSingleNodeValue(albumconfig, "Focusalbumshowtype"));
     focusalbumdays.Text = doc.GetSingleNodeValue(albumconfig, "Focusalbumdays");
     focusalbumcount.Text = doc.GetSingleNodeValue(albumconfig, "Focusalbumcount");
     weekhot.Text = doc.GetSingleNodeValue(albumconfig, "Weekhot");
     #endregion
 }
        private void addmenu_Click(Object sender, EventArgs e)
        {
            #region 插入菜单

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

                doc.CreateNode("/menuset").AppendChild(menunode);
                doc.Save(configPath);
                CreateJsFile();
                try
                {
                    BindData();
                    ResetForm();
                    base.RegisterStartupScript("PAGE", "window.location.href='forum_mymenumanage.aspx';");
                    return;
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='forum_mymenumanage.aspx';</script>");
                    return;
                }

            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
                return;
            }

            #endregion
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
     if (!IsPostBack)
     {
         if (System.IO.File.Exists(configPath))
         {
             XmlDocumentExtender doc = new XmlDocumentExtender();
             doc.Load(configPath);
             showhelp.SelectedValue = doc.SelectSingleNode("/UserConfig/ShowInfo").InnerText;
         }
         else
         {
             showhelp.SelectedValue = "1";
         }
     }
 }
        protected void saveinfo_Click(object sender, EventArgs e)
        {
			string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
            if (File.Exists(configPath))
                File.Delete(configPath);
            XmlDocumentExtender doc = new XmlDocumentExtender();
            XmlElement userconfig = doc.CreateElement("UserConfig");
            XmlElement showinfo = doc.CreateElement("ShowInfo");
            showinfo.InnerText = showhelp.SelectedValue.ToString();
            userconfig.AppendChild(showinfo);
            doc.AppendChild(userconfig);
            XmlElement showupgradenode = doc.CreateElement("ShowUpgrade");
            showupgradenode.InnerText = showupgrade.SelectedValue.ToString();
            userconfig.AppendChild(showupgradenode);
            doc.Save(configPath);
            this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'");
        }
 protected void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     int row = e.Item.ItemIndex;
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList shortcutmenus = doc.SelectNodes("/dataset/shortcut");
     int i = 0;
     foreach (XmlNode xn in shortcutmenus)
     {
         if(i == row)
             xn.ParentNode.RemoveChild(xn);
         i++;
     }
     doc.Save(configPath);
     MenuManage.CreateMenuJson();
     base.RegisterStartupScript("delete", "<script type='text/javascript'>window.parent.LoadShortcutMenu();</script>");
     BindDataGrid();
 }
 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();
 }
Exemple #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isShowUpgradeInfo = false;
            string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
            if (File.Exists(configPath))
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                isShowUpgradeInfo = doc.SelectSingleNode("/UserConfig/ShowUpgrade") != null ? doc.SelectSingleNode("/UserConfig/ShowUpgrade").InnerText == "1": false;
            }
            else
                isShowUpgradeInfo = true;
            if(isShowUpgradeInfo)
                LoadUpgradeInfo();

            LoadTemplateInfo();
            GetStatInfo();
            //加载论坛版块信息
            forumid.BuildTree(Forums.GetForumListForDataTable(), "name", "fid");
            LinkDiscuzVersionPage();
        }
 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
 }
Exemple #28
0
 /// <summary>
 /// 编辑一级主菜单
 /// </summary>
 /// <param name="menuid">一级主菜单的ID</param>
 /// <param name="title">一级主菜单标题</param>
 /// <param name="defaulturl">一级主菜单默认展开的页面</param>
 /// <returns>操作成功否</returns>
 public static bool EditMainMenu(int menuid, string title, string defaulturl)
 {
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
     bool result = false;
     foreach (XmlNode menuitem in mainmenus)
     {
         if (menuitem["id"].InnerText == menuid.ToString())
         {
             menuitem["title"].InnerText = title;
             menuitem["defaulturl"].InnerText = defaulturl;
             result = true;
             break;
         }
     }
     if (result)
     {
         doc.Save(configPath);
     }
     return result;
 }
 private bool FindSubMenuItem(string menuid,XmlDocumentExtender doc)
 {
     XmlNodeList submenuitem = doc.SelectNodes("/dataset/submain");
     foreach (XmlNode item in submenuitem)
     {
         if (item["menuparentid"].InnerText == menuid)
             return true;
     }
     return false;
 }
Exemple #30
0
 /// <summary>
 /// 读取聚合页面数据信息
 /// </summary>
 public static void ReadAggregationConfig()
 {
     __xmlDoc = new XmlDocumentExtender();
     __xmlDoc.Load(filepath);
 }