protected void DeleteTemplateFile_Click(object sender, EventArgs e)
        {
            #region  除模板文件
            if (CheckCookie())
            {
                string templatepathlist = TreeView1.GetSelectString(",");

                if (templatepathlist == "")
                {
                    RegisterStartupScript("", "<script>alert('您未选中任何模板');</script>");
                    return;
                }
                try
                {
                    foreach (string templatepath in templatepathlist.Split(','))
                    {
                        DeleteFile(templatepath);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    RegisterStartupScript("", "<script>alert('您的目录设置了权限导致无法在此删除此文件');</script>");
                    return;
                }
                RegisterStartupScript("PAGE", "window.location.href='global_templatetree.aspx?templateid=" + Request.Params["templateid"] + "&path=" + Request.Params["path"] + "&templatename=" + Request.Params["templatename"] + "';");
            }
            #endregion
        }
        protected void CreateTemplate_Click(object sender, EventArgs e)
        {
            #region 建立文件
            if (CheckCookie())
            {
                string templatePathList = TreeView1.GetSelectString(",");   //取得勾选文件列表

                if (templatePathList == "")
                {
                    RegisterStartupScript("", "<script>alert('您未选中任何模板');</script>");
                    return;
                }
                if (DNTRequest.GetString("chkall") == "" && templatePathList.Contains("_"))   //非全部生成
                {
                    templatePathList = RemadeTemplatePathList(templatePathList);
                }
                int               templateId        = DNTRequest.GetInt("templateid", 1);
                int               updateCount       = 0;
                string            forumPath         = BaseConfigs.GetForumPath;
                ForumPageTemplate forumPageTemplate = new ForumPageTemplate();

                foreach (string templatePath in templatePathList.Split(','))
                {
                    string templateFileName = Path.GetFileName(templatePath).ToLower(); //tempstr[tempstr.Length - 1];
                    string tempplaeExtName  = Path.GetExtension(templateFileName);      //tempstr = templateName.Split('.');
                    if ((tempplaeExtName.Equals(".htm") || (tempplaeExtName.Equals(".config"))) && !templateFileName.Contains("_"))
                    {
                        string subTemplateDirectory = "";
                        if (templatePath.Split('\\').Length >= 3)
                        {
                            subTemplateDirectory = Path.GetDirectoryName(templatePath).Substring(Path.GetDirectoryName(templatePath).LastIndexOf("\\") + 1);
                        }
                        forumPageTemplate.GetTemplate(forumPath, skinpath, Path.GetFileNameWithoutExtension(templateFileName),
                                                      subTemplateDirectory, 1, templateId);
                        updateCount++;
                    }
                }
                RegisterStartupScript("PAGETemplate", "共" + updateCount + " 个模板已更新");
            }
            #endregion
        }