예제 #1
0
        protected void DeleteApply_Click(object sender, EventArgs e)
        {
            if (this.CheckCookie())
            {
                string[]    urllist = DNTRequest.GetString("url").Split(',');
                XmlDocument xml     = new XmlDocument();
                try
                {
                    xml.Load(listfilename);
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('缺少对列表文件的访问权限或者列表文件不存在');window.location.href='space_moduledefmanage.aspx';</script>");
                    return;
                }
                foreach (string url in urllist)
                {
                    XmlNodeList xnl = xml.GetElementsByTagName("Gadget");

                    for (int i = 0; i < xnl.Count; i++)
                    {
                        if (url == xnl[i].Attributes["url"].Value)
                        {
                            xnl[i].ParentNode.RemoveChild(xnl[i]);
                            if (url.StartsWith("builtin_"))
                            {
                                Spaces.DeleteModuleDefByUrl(url);
                            }
                        }
                    }
                }
                try
                {
                    xml.Save(listfilename);
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('缺少对列表文件的访问权限或者列表文件不存在');window.location.href='space_moduledefmanage.aspx';</script>");
                    return;
                }

                base.RegisterStartupScript("", "<script>window.location.href='space_moduledefmanage.aspx';</script>");
            }
        }