Exemple #1
0
 private void CreateTemplate(string forumpath, string templatepath, string pagename, int templateid)
 {
     if (!Directory.Exists(Utils.GetMapPath(forumpath + "aspx/" + templateid)))
     {
         Directory.CreateDirectory(Utils.GetMapPath(forumpath + "aspx/" + templateid));
     }
     if (!File.Exists(Utils.GetMapPath(forumpath + "aspx/" + templateid + "/" + pagename)))   //当前模板文件不存在
     {
         ForumPageTemplate forumpagetemplate = new ForumPageTemplate();
         forumpagetemplate.GetTemplate(forumpath, templatepath, pagename.Split('.')[0], 1, templateid);
     }
 }
 private void CreateSingleTemplate(string filename,string path)
 {
     int result = -1;
     int templateid = Convert.ToInt32(AdminTemplates.GetAllTemplateList(Utils.GetMapPath(@"..\..\templates\")).Select("directory='" + path + "'")[0]["templateid"].ToString());
     if (filename != "")
     {
         ForumPageTemplate forumpagetemplate = new ForumPageTemplate();
         forumpagetemplate.GetTemplate(BaseConfigs.GetForumPath, path, filename, 1, templateid);
         result = 1;
     }
     Response.Write(result);
     Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
     Response.Expires = -1;
     Response.End();
 }
        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
        }
Exemple #4
0
        public static void BuildTemplate(string directorypath)
        {
            int templateid = Convert.ToInt32(AdminTemplates.GetAllTemplateList(Utils.GetMapPath(@"..\..\templates\")).Select("directory='" + directorypath + "'")[0]["templateid"].ToString());

            Hashtable ht = new Hashtable();
            GetTemplates("default", ht);

            if (directorypath != "default")
            {
                GetTemplates(directorypath, ht);
            }
            ForumPageTemplate forumpagetemplate = new ForumPageTemplate();

            foreach (string key in ht.Keys)
            {
                string filename = key.Split('.')[0];
                string[] template = ht[key].ToString().Split('\\');
                forumpagetemplate.GetTemplate(BaseConfigs.GetForumPath, template[0], filename, template.Length >= 2 ? template[template.Length -1] : "", 1, templateid);
            }

        }
Exemple #5
0
        public static void BuildTemplate(string directorypath)
        {
            int templateid = Convert.ToInt32(AdminTemplates.GetAllTemplateList(AppDomain.CurrentDomain.BaseDirectory + "templates/").Select("directory='" + directorypath + "'")[0]["templateid"].ToString());

            Hashtable ht = new Hashtable();
            GetTemplates("default", ht);

            if (directorypath != "default")
            {
                GetTemplates(directorypath, ht);
            }

            ForumPageTemplate forumpagetemplate = new ForumPageTemplate();

            foreach (string key in ht.Keys)
            {
                string filename = key.Split('.')[0];
                forumpagetemplate.GetTemplate("/", directorypath, filename, 1, templateid);
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int result = -1;
                string filename = DNTRequest.GetString("filename");
                string path = DNTRequest.GetString("path");

                int templateid = Convert.ToInt32(AdminTemplates.GetAllTemplateList(AppDomain.CurrentDomain.BaseDirectory + "templates/").Select("directory='" + path + "'")[0]["templateid"].ToString());

                if (filename != "")
                {
                    ForumPageTemplate forumpagetemplate = new ForumPageTemplate();
                    forumpagetemplate.GetTemplate("/",path, filename, 1, templateid);
                    result = 1;
                }

                Response.Write(result);
                Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
                Response.Expires = -1;
                Response.End();
            }
        }
Exemple #7
0
 private void CreateTemplate(string forumpath, string templatepath, string pagename, int templateid)
 {
     if (!Directory.Exists(Utils.GetMapPath(forumpath + "aspx/" + templateid)))
     {
         Directory.CreateDirectory(Utils.GetMapPath(forumpath + "aspx/" + templateid));
     }
     if (!File.Exists(Utils.GetMapPath(forumpath + "aspx/" + templateid + "/" + pagename)))   //当前模板文件不存在
     {
         ForumPageTemplate forumpagetemplate = new ForumPageTemplate();
         forumpagetemplate.GetTemplate(forumpath, templatepath, pagename.Split('.')[0], 1, templateid);
     }
 }
        private void CreateTemplate_Click(object sender, EventArgs e)
        {
            #region 建立文件
            if (this.CheckCookie())
            {
                string templatepathlist = TreeView1.GetSelectString(",");

                if (templatepathlist == "")
                {
                    base.RegisterStartupScript( "", "<script>alert('您未选中任何模板');</script>");
                    return;
                }
                if (DNTRequest.GetString("chkall") == "")   //非全部生成
                {
                    templatepathlist = RemadeTemplatePathList(templatepathlist);
                }
                int templateid = DNTRequest.GetInt("templateid", 1);
                string skinname = "";
                string templateName = "";
                string[] tempstr;
                int updatecount = 0;
                ForumPageTemplate forumpagetemplate = new ForumPageTemplate();

                foreach (string templatepath in templatepathlist.Split(','))
                {
                    tempstr = templatepath.Split('\\');
                    skinname = tempstr[0];
                    templateName = tempstr[tempstr.Length - 1];
                    tempstr = templateName.Split('.');
                    if ((tempstr[tempstr.Length - 1].ToLower().Equals("htm") || (tempstr[tempstr.Length - 1].ToLower().Equals("config"))) && (templateName.IndexOf("_") != 0))
                    {
                        templateName = tempstr[0];
                        forumpagetemplate.GetTemplate("/",skinname, templateName, 1, templateid);
                        updatecount++;
                    }
                }
                //用cookies保存最近常生成的模板
                //templatepathlist = templatepathlist.Replace(DNTRequest.GetString("templatename") + "\\", "");
                //System.Web.HttpCookie commontemplate = new System.Web.HttpCookie("commontemplate");
                //if (templatepathlist.Split(',').Length > 5)
                //{
                //    string commontemplatevalue = "";
                //    string[] templatepathlistarray = templatepathlist.Split(',');
                //    for (int i = 0; i < 5; i++)
                //    {
                //        commontemplatevalue += templatepathlistarray[i] + ",";
                //    }
                //    commontemplate.Value = commontemplatevalue.TrimEnd(',');
                //}
                //else
                //{
                //    commontemplate.Value = templatepathlist;
                //}
                //commontemplate.Expires = DateTime.Now.AddYears(1);
                //Response.AppendCookie(commontemplate);


                base.RegisterStartupScript( "PAGETemplate", "共" + updatecount + " 个模板已更新");
                //base.CallBaseRegisterStartupScript("form1", "<script>window.location.href='global_templatetree.aspx?templateid=" + Request.Params["templateid"] + "&path=" + Request.Params["path"].Replace(" ", "%20") + "&templatename=" + Request.Params["templatename"].Replace(" ", "%20") + "';</script>");
            }
            #endregion
        }