private void CreateTemplateByDirectory(string directorypath) { if (base.CheckCookie()) { ForumPageTemplate.BuildTemplate(directorypath); } }
private void CreateTemplate_Click(object sender, EventArgs e) { if (base.CheckCookie()) { ForumPageTemplate.BuildTemplate(this.Templatepath.SelectedValue); base.RegisterStartupScript("PAGE", "window.location.href='shortcut.aspx';"); } }
public DataSet LoadDataTable() { string @string = Request["path"]; XCache.Remove("/Forum/" + @string + "/TemplateVariable"); DataSet dataSet = new DataSet(); DataTable table = ForumPageTemplate.GetTemplateVarList(BaseConfigs.GetForumPath, @string).Copy(); dataSet.Tables.Add(table); return(dataSet); }
protected void Page_Load(object sender, EventArgs e) { if (Request["type"] == "single") { this.CreateSingleTemplate(Request["filename"], Request["path"]); return; } if (Request["type"] == "template") { ForumPageTemplate.BuildTemplate(Request["templatepath"]); } }
public DataSet LoadDataTable() { #region 加载数据 string path = DNTRequest.GetString("path"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/" + path + "/TemplateVariable"); DataSet ds = new DataSet(); DataTable dt = ForumPageTemplate.GetTemplateVarList(BaseConfigs.GetForumPath, path).Copy(); ds.Tables.Add(dt); return(ds); #endregion }
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(); }
private void CreateSingleTemplate(string filename, string path) { int num = -1; //int templateId = Convert.ToInt32(AdminTemplates.GetAllTemplateList(Utils.GetMapPath("..\\..\\templates\\")).Select("directory='" + path + "'")[0]["templateid"].ToString()); Template tmp = Template.FindByPath(path); Int32 templateId = tmp.ID; if (filename != "") { ForumPageTemplate forumPageTemplate = new ForumPageTemplate(); forumPageTemplate.GetTemplate(BaseConfigs.GetForumPath, path, filename, 1, tmp.Name); num = 1; } base.Response.Write(num); base.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1.0); base.Response.Expires = -1; base.Response.End(); }
public static void BuildTemplate(string directorypath) { var tmp = Template.FindByPath(directorypath); if (tmp == null) return; //var templateId = tmp.ID; var dic = new Dictionary<String, String>(); GetTemplates("default", dic); if (directorypath != "default") GetTemplates(directorypath, dic); var fpt = new ForumPageTemplate(); foreach (var item in dic) { var templateName = item.Key.Split('.')[0]; var ss = item.Value.Split('\\'); fpt.GetTemplate(BaseConfigs.GetForumPath, ss[0], templateName, (ss.Length >= 2) ? ss[ss.Length - 1] : "", 1, tmp.Name); } }
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 }
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); } }
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); } }
protected void CreateTemplate_Click(object sender, EventArgs e) { if (base.CheckCookie()) { string text = this.TreeView1.GetSelectString(","); if (String.IsNullOrEmpty(text)) { base.RegisterStartupScript("", "<script>alert('您未选中任何模板');</script>"); return; } if (String.IsNullOrEmpty(Request["chkall"]) && text.Contains("_")) { text = this.RemadeTemplatePathList(text); } int tid = DNTRequest.GetInt("templateid", 1); var tmp = Template.FindByID(tid); int num = 0; var fpt = new ForumPageTemplate(); string[] array = text.Split(','); for (int i = 0; i < array.Length; i++) { string file = array[i]; string text3 = Path.GetFileName(file).ToLower(); string ext = Path.GetExtension(text3); if ((ext.Equals(".htm") || ext.Equals(".config")) && !text3.Contains("_")) { string subdir = ""; if (file.Split('\\').Length >= 3) { subdir = Path.GetDirectoryName(file).Substring("\\"); } fpt.GetTemplate(BaseConfigs.GetForumPath, this.skinpath, Path.GetFileNameWithoutExtension(text3), subdir, 1, tmp.Name); num++; } } base.RegisterStartupScript("PAGETemplate", "共" + num + " 个模板已更新"); } }
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(); } }
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 }