Beispiel #1
0
        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
        }
        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
        }
Beispiel #3
0
 private void addrota_Click(object sender, EventArgs e)
 {
     if (this.rotaimg.Text.Trim() != "" && this.url.Text.Trim() != "" && this.titlecontent.Text.Trim() != "")
     {
         if (!Utils.IsURL(this.rotaimg.Text.Trim()) || !Utils.IsURL(this.url.Text.Trim()))
         {
             base.RegisterStartupScript("", "<script>alert('图片路径或点击链接可能是非法URL');</script>");
             this.BindData();
             this.ResetForm();
             return;
         }
         XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();
         xmlDocumentExtender.Load(this.configPath);
         int num = 0;
         if (xmlDocumentExtender.SelectSingleNode(this.targetNode) != null && xmlDocumentExtender.SelectSingleNode(this.targetNode).InnerText != "")
         {
             num = int.Parse(xmlDocumentExtender.SelectSingleNode(this.targetNode).LastChild["rotatepicid"].InnerText);
         }
         num++;
         XmlElement newChild = xmlDocumentExtender.CreateElement(this.nodeName);
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "rotatepicid", num.ToString());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "pagetype", "1");
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "img", this.rotaimg.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "url", this.url.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "titlecontent", this.titlecontent.Text.Trim());
         xmlDocumentExtender.CreateNode(this.targetNode).AppendChild(newChild);
         xmlDocumentExtender.Save(this.configPath);
         AggregationFacade.BaseAggregation.ClearAllDataBind();
         AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加聚合页图版轮换广告", "添加聚合页图版轮换广告,名称为: " + this.titlecontent.Text.Trim());
         try
         {
             this.BindData();
             XCache.Remove(CacheKeys.FORUM_FORUM_LINK_LIST);
             this.ResetForm();
             base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';");
             return;
         }
         catch
         {
             base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';</script>");
             return;
         }
     }
     base.RegisterStartupScript("", "<script>alert('图片或链接地址以及标题不能为空.');window.location.href='aggregation_rotatepic.aspx?pagename=" + Request["pagename"] + "';</script>");
 }
Beispiel #4
0
 private void addmenu_Click(object sender, EventArgs e)
 {
     if (!this.atext.Text.IsNullOrEmpty() && !this.ahref.Text.IsNullOrEmpty())
     {
         XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender();
         xmlDocumentExtender.Load(this.configPath);
         int num = 0;
         if (xmlDocumentExtender.SelectSingleNode("/menuset").ChildNodes.Count != 0)
         {
             num = int.Parse(xmlDocumentExtender.SelectSingleNode("/menuset").LastChild["menuorder"].InnerText);
         }
         num++;
         XmlElement newChild = xmlDocumentExtender.CreateElement("menuitem");
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "menuorder", num.ToString());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "text", this.atext.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "href", this.ahref.Text.Trim());
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "onclick", this.aonclick.Text.Trim(), true);
         xmlDocumentExtender.AppendChildElementByNameValue(ref newChild, "target", this.atarget.Text.Trim());
         xmlDocumentExtender.CreateNode("/menuset").AppendChild(newChild);
         xmlDocumentExtender.Save(this.configPath);
         this.CreateJsFile();
         try
         {
             this.BindData();
             this.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;
         }
     }
     base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
 }