Example #1
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;
        }
Example #2
0
        protected void saveinfo_Click(object sender, EventArgs e)
        {
			string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
            XmlDocumentExtender doc = new XmlDocumentExtender();
            if (System.IO.File.Exists(configPath))
            {
                if (doc.SelectSingleNode("/UserConfig/ShowInfo") == null)
                {
                    XmlNode userconfig = doc.CreateElement("UserConfig");
                    doc.AppendChild(userconfig);
                    XmlNode showinfo = doc.CreateElement("ShowInfo");
                    showinfo.InnerText = showhelp.SelectedValue.ToString();
                    userconfig.AppendChild(showinfo);
                }
                else
                {
                    XmlNode showinfo = doc.SelectSingleNode("/UserConfig/ShowInfo");
                    showinfo.InnerText = showhelp.SelectedValue.ToString();
                }
            }
            else
            {
                XmlElement userconfig = doc.CreateElement("UserConfig");
                XmlElement showinfo = doc.CreateElement("ShowInfo");
                showinfo.InnerText = showhelp.SelectedValue.ToString();
                userconfig.AppendChild(showinfo);
                doc.AppendChild(userconfig);
            }
            doc.Save(configPath);
            this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'");
        }
 private void 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
 }
        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();
 }
Example #6
0
 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();
 }
Example #7
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;
 }
        /// <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
        }
Example #9
0
        /// <summary>
        /// 增加子菜单
        /// </summary>
        /// <param name="mainmenuid">主菜单ID</param>
        /// <param name="menutitle">子菜单标题</param>
        /// <returns>新建子菜单ID</returns>
        public static int NewSubMenu(int mainmenuid, string menutitle)
        {
            int newid = 1;
            int newmenuid = 100;
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList submains = doc.SelectNodes("/dataset/mainmenu");
            newid += int.Parse(submains.Item(submains.Count - 1)["id"].InnerText);
            newmenuid += int.Parse(submains.Item(submains.Count - 1)["menuid"].InnerText);
            XmlElement mainmenu = doc.CreateElement("mainmenu");
            XmlElement node = doc.CreateElement("id");
            node.InnerText = newid.ToString();
            mainmenu.AppendChild(node);

            node = doc.CreateElement("menuid");
            node.InnerText = newmenuid.ToString();
            mainmenu.AppendChild(node);

            node = doc.CreateElement("menutitle");
            node.InnerText = menutitle;
            mainmenu.AppendChild(node);

            doc.SelectSingleNode("/dataset").AppendChild(mainmenu);

            XmlNodeList mainMenus = doc.SelectNodes("/dataset/toptabmenu");
            foreach (XmlNode menuItem in mainMenus) //查找主菜单信息
            {
                if (menuItem["id"].InnerText == mainmenuid.ToString())
                {
                    menuItem["mainmenulist"].InnerText += "," + newid;
                    menuItem["mainmenuidlist"].InnerText += "," + newmenuid;
                    menuItem["mainmenulist"].InnerText = menuItem["mainmenulist"].InnerText.TrimStart(',');
                    menuItem["mainmenuidlist"].InnerText = menuItem["mainmenuidlist"].InnerText.TrimStart(',');
                    break;
                }
            }
            doc.Save(configPath);
            return newmenuid;
        }
        private void addrota_Click(Object sender, EventArgs e)
        {
            #region 插入聚合页图版轮换广告

            if ((rotaimg.Text.Trim() != "") && (url.Text.Trim() != "") && (titlecontent.Text.Trim() != ""))
            {
                if((!Utils.IsURL(rotaimg.Text.Trim()) || (!Utils.IsURL(url.Text.Trim()))))
                {
                    base.RegisterStartupScript("", "<script>alert('图片路径或点击链接可能是非法URL');</script>");
                    BindData();
                    ResetForm();
                    return;
                }
               
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                int lastRotatepicid = 0;
				if (doc.SelectSingleNode(targetNode) != null)
				{
					if (doc.SelectSingleNode(targetNode).InnerText != "")
					{
						lastRotatepicid = int.Parse(doc.SelectSingleNode(targetNode).LastChild["rotatepicid"].InnerText);
					}
				}
                lastRotatepicid++;

                XmlElement rotatepicNode = doc.CreateElement(nodeName);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", lastRotatepicid.ToString());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1");
                doc.AppendChildElementByNameValue(ref rotatepicNode, "img", rotaimg.Text.Trim());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url.Text.Trim());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent.Text.Trim());

                doc.CreateNode(targetNode).AppendChild(rotatepicNode);
                doc.Save(configPath);
                AggregationFacade.BaseAggregation.ClearAllDataBind();
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加聚合页图版轮换广告", "添加聚合页图版轮换广告,名称为: " + titlecontent.Text.Trim());

                try
                {
                    BindData();
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList");
                    ResetForm();
					base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';");
                    return;
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                    return;
                }

            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('图片或链接地址以及标题不能为空.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                return;
            }

            #endregion
        }
Example #11
0
 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 Btn_SaveInfo_Click(object sender, EventArgs e)
        {
            #region 保存自动提取数据
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            int rowid = 0;
            XmlNode topiclist = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomendtopiclist");
            foreach (object o in DataGrid1.GetKeyIDArray())
            {
                string fid = o.ToString();
                string tid = DataGrid1.GetControlValue(rowid, "tid");
                string title = DataGrid1.GetControlValue(rowid, "title");
                string img = DataGrid1.GetControlValue(rowid, "img");
                XmlElement topicNode = doc.CreateElement("Website_forumrecomendtopic");
                doc.AppendChildElementByNameValue(ref topicNode, "fid", fid);
                doc.AppendChildElementByNameValue(ref topicNode, "tid", tid);
                doc.AppendChildElementByNameValue(ref topicNode, "img", img);
                doc.AppendChildElementByNameValue(ref topicNode, "title", title);
                topiclist.AppendChild(topicNode);
                rowid++;
            }

            /*
            XmlNode fidlist = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist");
            fidlist.InnerText = DNTRequest.GetString("rst");*/
            doc.Save(configPath);
            Response.Redirect("aggregation_recommendforums.aspx");
            #endregion
        }
Example #13
0
 /// <summary>
 /// 编辑菜单项
 /// </summary>
 /// <param name="id">菜单项的序号</param>
 /// <param name="title">菜单项的标题</param>
 /// <param name="link">菜单项的链接</param>
 /// <returns>操作成功否</returns>
 public static bool EditMenuItem(int id, string title, string link)
 {
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList submains = doc.SelectNodes("/dataset/submain");
     int rowcount = 0;
     foreach (XmlNode sub in submains)
     {
         if (rowcount.ToString() != id.ToString() && sub["link"].InnerText == link)
         {
             return false;
         }
         rowcount++;
     }
     string tmpLink = submains.Item(id)["link"].InnerText;
     submains.Item(id)["menutitle"].InnerText = title;
     submains.Item(id)["link"].InnerText = link;
     XmlNodeList shortcuts = doc.SelectNodes("/dataset/shortcut");
     foreach (XmlNode shortmenuitem in shortcuts)
     {
         if (shortmenuitem["link"].InnerText == tmpLink)
         {
             shortmenuitem["link"].InnerText = link;
             shortmenuitem["menutitle"].InnerText = title;
             break;
         }
     }
     doc.Save(configPath);
     return true;
 }
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveTopic_Click(object sender, EventArgs e)
        {
            #region 保存信息
            string tidlist = DNTRequest.GetString("forumtopicstatus");
            //当未选择主题时,则清除所有选择
            if (tidlist == "")
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist");
                doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist");
                doc.Save(configPath);
                Response.Redirect("aggregation_editforumaggset.aspx");
                return;
            }
            else
            {
                //得到所选择帖子信息
                DataTable dt = DatabaseProvider.GetInstance().GetTopicListByTidlist(tablelist.SelectedValue, tidlist);
            
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                //清除以前选择
                XmlNode topiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist");
                XmlNode websitetopiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist");

                tidlist = DNTRequest.GetString("tid");
                foreach (DataRow dr in dt.Rows)
                {
                    //创建Topic节点
                    XmlElement topic = doc.CreateElement("Topic");
                    doc.AppendChildElementByDataRow(ref topic, dt.Columns, dr, "tid,message");
                    doc.AppendChildElementByNameValue(ref topic, "topicid", dr["tid"].ToString());
                    string tempubbstr = UBB.ClearUBB(dr["message"].ToString());
                    if (tempubbstr.Length > 200)
                        tempubbstr = tempubbstr.Substring(0, 200) + "...";

                    doc.AppendChildElementByNameValue(ref topic, "shortdescription", tempubbstr, true);
                    doc.AppendChildElementByNameValue(ref topic, "fulldescription", UBB.ClearUBB(dr["message"].ToString()), true);
                    topiclistnode.AppendChild(topic);


                    if (("," + tidlist + ",").IndexOf("," + dr["tid"].ToString() + ",") >= 0)
                    {
                        websitetopiclistnode.AppendChild(topic.Clone());
                    }
                }                          
                doc.Save(configPath);
                AggregationFacade.BaseAggregation.ClearAllDataBind();
                Response.Redirect("aggregation_editforumaggset.aspx");
            }
            #endregion
        }
        private void SaveRotatepic_Click(object sender, EventArgs e)
        {
            #region 保存轮换图片修改
            int rowid = 0;
            bool error = false;

            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList __xmlnodelist = doc.SelectSingleNode(targetNode).ChildNodes;

            if ((__xmlnodelist != null) && (__xmlnodelist.Count > 0))
            {
                doc.InitializeNode(targetNode);
            }

            foreach (object o in DataGrid1.GetKeyIDArray())
            {
                #region 轮换图片
                string rotatepicid = DataGrid1.GetControlValue(rowid, "rotatepicid");
                //string name = ((TextBox)E.Item.FindControl("rotatepicid")).Text;
                string img = DataGrid1.GetControlValue(rowid, "img");
                string url = DataGrid1.GetControlValue(rowid, "url");
                string titlecontent = DataGrid1.GetControlValue(rowid, "titlecontent").Trim();
                if (!Utils.IsNumeric(rotatepicid) || !Utils.IsURL(img) || !Utils.IsURL(url) || titlecontent == "")
                {
                    //base.RegisterStartupScript("", "<script>alert('序号、图片路径或点击链接可能是非法URL或说明文字为空');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                    //return;
                    error = true;
                    //continue;
                    break;//如果用continue,则导致正确的设置可以被保存,有错误的设置却被删除,即使被修改之前是正确的。会丢失数据
                }
                bool insert = false;
                XmlElement rotatepicNode = doc.CreateElement(nodeName);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", rotatepicid);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1");
                doc.AppendChildElementByNameValue(ref rotatepicNode, "img", img);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent);

                foreach (XmlNode __node in __xmlnodelist)
                {
                    if (int.Parse(__node["rotatepicid"].InnerText) > int.Parse(rotatepicid))
                    {
                        doc.SelectSingleNode(targetNode).InsertBefore(rotatepicNode, __node);
                        insert = true;
                        break;
                    }
                }
                if (!insert)
                {
                    doc.SelectSingleNode(targetNode).AppendChild(rotatepicNode);
                }
                rowid++;
                #endregion
            }
            AggregationFacade.BaseAggregation.ClearAllDataBind();
            if(!error)
            {
                SiteUrls.SetInstance();
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "聚合页面论坛广告编辑", "");
                doc.Save(configPath);

                base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';");
                return;
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('某行序号、图片路径或点击链接可能是非法URL或说明文字为空,不能进行更新.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                return;
            }
            #endregion
        }
Example #16
0
        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
        }
 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
 }
        private void AddNewRec_Click(object sender, EventArgs e)
        {
            #region 添加附件分类
            if (typename.Text == "")
            {
                base.RegisterStartupScript("", "<script>alert('附件分类名称不能为空!');window.location.href='forum_attchemnttypes.aspx';</script>");
                return;
            }

            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
            if (DNTRequest.GetString("atttypeid") == "")   //增加附件分类
            {
                XmlNode attachtypes = doc.SelectSingleNode("/MyAttachmentsTypeConfigInfo/attachtypes");
                XmlElement attachtype = doc.CreateElement("AttachmentType");
                XmlElement node = doc.CreateElement("TypeId");
                int maxTypeid = GetMaxTypeid();
                node.InnerText = (++maxTypeid).ToString();
                attachtype.AppendChild(node);
                node = doc.CreateElement("TypeName");
                node.InnerText = typename.Text;
                attachtype.AppendChild(node);
                node = doc.CreateElement("ExtName");
                node.InnerText = GetAttTypeList();
                attachtype.AppendChild(node);
                attachtypes.AppendChild(attachtype);
            }
            else
            {
                XmlNodeList xnl = doc.SelectNodes("/MyAttachmentsTypeConfigInfo/attachtypes/AttachmentType");
                foreach (XmlNode xn in xnl)
                {
                    if (xn["TypeId"].InnerText == DNTRequest.GetString("atttypeid"))
                    {
                        xn["TypeName"].InnerText = typename.Text;
                        xn["ExtName"].InnerText = GetAttTypeList();
                    }
                }
            }
            doc.Save(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
            UpdateAttchmentTypes();
            base.RegisterStartupScript("", "<script>window.location.href='forum_attchemnttypes.aspx';</script>");
            #endregion
        }
        private void DelRec_Click(object sender, EventArgs e)
        {
            #region 删除附件分类

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("typeid") != "")
                {
                    string idlist = DNTRequest.GetString("typeid");

                    XmlDocumentExtender doc = new XmlDocumentExtender();
                    doc.Load(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
                    XmlNodeList xnl = doc.SelectNodes("/MyAttachmentsTypeConfigInfo/attachtypes/AttachmentType");
                    foreach (string id in idlist.Split(','))
                    {
                        foreach (XmlNode xn in xnl)
                        {
                            if (id == xn["TypeId"].InnerText)
                            {
                                xn.ParentNode.RemoveChild(xn);
                                break;
                            }
                        }
                    }
                    doc.Save(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
                    UpdateAttchmentTypes();
                    Response.Redirect("forum_attchemnttypes.aspx");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_attchemnttypes.aspx';</script>");
                }
            }

            #endregion
        }
Example #20
0
 /// <summary>
 /// 删除子菜单
 /// </summary>
 /// <param name="submenuid">子菜单ID</param>
 /// <param name="mainmenuid">主菜单ID</param>
 /// <returns>操作成功否</returns>
 public static bool DeleteSubMenu(int submenuid, int mainmenuid)
 {
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList submains = doc.SelectNodes("/dataset/mainmenu");
     bool result = false;
     string menuid = "";
     foreach (XmlNode menuItem in submains)
     {
         if (menuItem["id"].InnerText == submenuid.ToString())
         {
             menuid = menuItem["menuid"].InnerText;
             XmlNodeList items = doc.SelectNodes("/dataset/submain");
             foreach (XmlNode item in items)
             {
                 if (item["menuparentid"].InnerText == menuid)
                     return false;
             }
             menuItem.ParentNode.RemoveChild(menuItem);
             result = true;
             break;
         }
     }
     XmlNodeList mainMenus = doc.SelectNodes("/dataset/toptabmenu");
     foreach (XmlNode menuItem in mainMenus) //查找主菜单信息
     {
         if (menuItem["id"].InnerText == mainmenuid.ToString())
         {
             menuItem["mainmenulist"].InnerText = ("," + menuItem["mainmenulist"].InnerText + ",").Replace("," + submenuid + ",", ",");
             menuItem["mainmenuidlist"].InnerText = ("," + menuItem["mainmenuidlist"].InnerText + ",").Replace("," + menuid + ",", ",");
             menuItem["mainmenulist"].InnerText = menuItem["mainmenulist"].InnerText.TrimStart(',').TrimEnd(',');
             menuItem["mainmenuidlist"].InnerText = menuItem["mainmenuidlist"].InnerText.TrimStart(',').TrimEnd(',');
             break;
         }
     }
     if (result)
     {
         doc.Save(configPath);
     }
     return result;
 }
Example #21
0
        /// <summary>
        /// 新建菜单项
        /// </summary>
        /// <param name="menuparentid">父菜单ID</param>
        /// <param name="title">菜单标题</param>
        /// <param name="link">菜单链接</param>
        /// <returns>操作成功否</returns>
        public static bool NewMenuItem(int menuparentid, string title, string link)
        {
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList submains = doc.SelectNodes("/dataset/submain");
            foreach (XmlNode sub in submains)
            {
                if (sub["link"].InnerText == link)
                {
                    return false;
                }
            }
            XmlElement submain = doc.CreateElement("submain");
            XmlElement node = doc.CreateElement("menuparentid");
            node.InnerText = menuparentid.ToString();
            submain.AppendChild(node);

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

            node = doc.CreateElement("link");
            node.InnerText = link;
            submain.AppendChild(node);

            node = doc.CreateElement("frameid");
            node.InnerText = "main";
            submain.AppendChild(node);

            doc.SelectSingleNode("/dataset").AppendChild(submain);
            doc.Save(configPath);
            return true;
        }
        /// <summary>
        /// 保存主题显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveTopicDisplay_Click(object sender, EventArgs e)
        {
            #region 保存主题显示
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            //doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Bbs");
            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);
            #endregion
        }
Example #23
0
 /// <summary>
 /// 删除菜单项
 /// </summary>
 /// <param name="id">菜单项的序号</param>
 public static void DeleteMenuItem(int id)
 {
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList submains = doc.SelectNodes("/dataset/submain");
     string link = submains.Item(id)["link"].InnerText;
     submains.Item(id).ParentNode.RemoveChild(submains.Item(id));
     XmlNodeList shortcuts = doc.SelectNodes("/dataset/shortcut");
     foreach (XmlNode shortmenuitem in shortcuts)
     {
         if (shortmenuitem["link"].InnerText == link)
         {
             shortmenuitem.ParentNode.RemoveChild(shortmenuitem);
             break;
         }
     }
     doc.Save(configPath);
 }
Example #24
0
 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>
        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
        }
Example #26
0
 /// <summary>
 /// 删除一级菜单,其下子菜单必须为空
 /// </summary>
 /// <param name="menuid">要删除的一级菜单ID</param>
 /// <returns>操作成功否</returns>
 public static bool DeleteMainMenu(int menuid)
 {
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
     XmlNode delMenu = null;
     int newid = menuid;
     bool result = false;
     foreach (XmlNode menuitem in mainmenus)
     {
         if (menuitem["id"].InnerText == menuid.ToString())
         {
             if (menuitem["mainmenulist"].InnerText.Trim() != "")
                 return false;
             delMenu = menuitem;
             result = true;
             break;
         }
         else
         {
             if (delMenu != null)
             {
                 menuitem["id"].InnerText = newid.ToString();
                 newid++;
             }
         }
     }
     if (result)
     {
         delMenu.ParentNode.RemoveChild(delMenu);
         doc.Save(configPath);
     }
     return result;
 }
 /// <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
 }
Example #28
0
 /// <summary>
 /// 编辑子菜单
 /// </summary>
 /// <param name="submenuid">子菜单ID</param>
 /// <param name="menutitle">子菜单标题</param>
 /// <returns>操作成功否</returns>
 public static bool EditSubMenu(int submenuid, string menutitle)
 {
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     XmlNodeList submains = doc.SelectNodes("/dataset/mainmenu");
     bool result = false;
     foreach (XmlNode menuItem in submains)
     {
         if (menuItem["id"].InnerText == submenuid.ToString())
         {
             menuItem["menutitle"].InnerText = menutitle;
             result = true;
             break;
         }
     }
     if (result)
     {
         doc.Save(configPath);
     }
     return result;
 }
Example #29
0
 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 DelRec_Click(object sender, EventArgs e)
		{
			#region 删除选定的图版轮换页
			if (this.CheckCookie())
			{
				string rowidlist = DNTRequest.GetString("rowid");
				if (rowidlist != "")
				{
                    int delcount = 0;
                    XmlDocumentExtender doc = new XmlDocumentExtender();
                    doc.Load(configPath);
                    XmlNodeList __xmlnodelist = doc.SelectSingleNode(targetNode).ChildNodes;
                    foreach (string menuid in rowidlist.Split(','))
                    {
                        doc.SelectSingleNode(targetNode).RemoveChild(__xmlnodelist.Item(int.Parse(menuid) - delcount));
                        delcount++;
                    }
                    doc.Save(configPath);

					AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除选定的图版轮换页", "删除选定的图版轮换页,ID为: " + DNTRequest.GetString("id").Replace("0 ", ""));
					Response.Redirect("aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename"));
				}
				else
				{
					base.RegisterStartupScript( "","<script>alert('您未选中任何选项');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
				}
			}

			#endregion
		}