protected void Page_Load(object sender, EventArgs e) { Server.ScriptTimeout = 8;//脚本过期时间 int CurrentPage = Int_ThisPage(); string ClassId = (this.lblClassId.Text == "{$CategoryId}") ? Str2Str(q("id")) : Str2Str(this.lblClassId.Text); string ModuleType = this.lblModuleType.Text; doh.Reset(); doh.SqlCmd = "SELECT ID FROM [" + base.CategoryTable + "] WHERE [Id]=" + ClassId; DataTable dtSearch = doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { FinalMessage("栏目不存在或已被删除!", site.Dir, 0, 8); Response.End(); } dtSearch.Clear(); dtSearch.Dispose(); JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); int pageCount = new JumboECMS.DAL.Normal_CategoryDAL().GetContetPageCount(ClassId, true); CurrentPage = JumboECMS.Utils.Int.Min(CurrentPage, pageCount); teDAL.IsHtml = true; string HtmlUrl = Go2Category(ClassId, CurrentPage); if (!System.IO.File.Exists(Server.MapPath(HtmlUrl)))//保存静态 { string TxtStr = teDAL.GetSiteCategoryPage(ClassId, CurrentPage); SaveCacheFile(TxtStr, Server.MapPath(HtmlUrl)); } Response.Redirect(HtmlUrl); }
private void ajaxCreateIndexPage() { Admin_Load("", "json"); JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); teDAL.CreateDefaultFile(); this._response = JsonResult(1, "网站首页更新完成"); }
/// <summary> /// 生成包含文件 /// </summary> private void CreateIncludeFiles() { string _source = q("source"); doh.Reset(); if (_source == "") { doh.SqlCmd = "SELECT * FROM [jcms_normal_templateinclude] ORDER BY [Sort]"; } else { doh.SqlCmd = "SELECT * FROM [jcms_normal_templateinclude] where [Source]='" + _source + "'"; } DataTable dt = doh.GetDataTable(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string PageStr = JumboECMS.Utils.DirFile.ReadFile(site.Dir + "templates/" + tpPath + "/include/" + dt.Rows[i]["Source"].ToString()); if (dt.Rows[i]["NeedBuild"].ToString() == "1") { JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); teDAL.IsHtml = true; teDAL.ReplacePublicTag(ref PageStr); teDAL.ReplaceCategoryLoopTag(ref PageStr); teDAL.ReplaceContentLoopTag(ref PageStr); } JumboECMS.Utils.DirFile.SaveFile(PageStr, "~/_data/shtm/" + dt.Rows[i]["Source"].ToString(), true); //shtm引用 JumboECMS.Utils.DirFile.SaveFile(PageStr, "~/_data/html/" + dt.Rows[i]["Source"].ToString(), false); //aspx引用 } } dt.Clear(); dt.Dispose(); }
/// <summary> /// 解析一般模板标签 /// </summary> /// <param name="PageStr"></param> /// <returns></returns> protected string ExecuteCommonTags(string PageStr) { JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); teDAL.IsHtml = site.IsHtml; teDAL.ReplacePublicTag(ref PageStr); teDAL.ReplaceCategoryLoopTag(ref PageStr); teDAL.ReplaceContentLoopTag(ref PageStr); return(PageStr); }
protected void Page_Load(object sender, EventArgs e) { Server.ScriptTimeout = 8;//脚本过期时间 string TxtStr = string.Empty; JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); TxtStr = teDAL.GetSiteDefaultPage(); teDAL.ReplaceShtmlTag(ref TxtStr); Response.Write(TxtStr);//直接输出 }
protected void Page_Load(object sender, EventArgs e) { Server.ScriptTimeout = 8;//脚本过期时间 int CurrentPage = Int_ThisPage(); string ContentId = this.lblContentId.Text == "{$ContentId}" ? Str2Str(q("id")) : this.lblContentId.Text; if (ContentId == "0") { FinalMessage("参数错误!", site.Dir, 0, 8); Response.End(); } string ModuleType = this.lblModuleType.Text; JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); doh.Reset(); doh.SqlCmd = "SELECT [CategoryId] FROM [jcms_module_" + ModuleType + "] WHERE [IsPass]=1 and [Id]=" + ContentId; DataTable dtSearch = doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { dtSearch.Clear(); dtSearch.Dispose(); FinalMessage("内容不存在或未审核!", site.Dir, 0, 8); Response.End(); } string ClassId = dtSearch.Rows[0]["CategoryId"].ToString(); dtSearch.Clear(); dtSearch.Dispose(); if (!teDAL.CanReadContent(ModuleType, ContentId, ClassId)) { FinalMessage("阅读权限不足!", site.Dir, 0, 8); Response.End(); } doh.Reset(); doh.SqlCmd = "SELECT Id FROM [" + base.CategoryTable + "] WHERE [Id]=" + ClassId; if (doh.GetDataTable().Rows.Count == 0) { FinalMessage("内容所属栏目有误!", site.Dir, 0, 8); Response.End(); } teDAL.IsHtml = true; string HtmlUrl = Go2View(ModuleType, ContentId, CurrentPage); if (!System.IO.File.Exists(Server.MapPath(HtmlUrl)))//静态 { string TxtStr = GetContentFile(ModuleType, ContentId, CurrentPage); SaveCacheFile(TxtStr, Server.MapPath(HtmlUrl)); } Response.Redirect(HtmlUrl); }
private void ajaxCreateHTML() { TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); string categoryid = Str2Str(q("categoryid")); doh.Reset(); doh.SqlCmd = "SELECT Id,[Title],[ModuleType],[TypeId],LanguageCode FROM [" + base.CategoryTable + "] WHERE [TypeId]<4"; if (categoryid != "0") { doh.SqlCmd += " AND ([Code] LIKE (Select code FROM [" + base.CategoryTable + "] WHERE id=" + categoryid + ")+'%') ORDER BY code"; } DataTable dtCategory = doh.GetDataTable(); int _no = 1; for (int i = 0; i < dtCategory.Rows.Count; i++) { string _CategoryId = dtCategory.Rows[i]["Id"].ToString(); string _CategoryModuleType = dtCategory.Rows[i]["ModuleType"].ToString(); string _CategoryTypeId = dtCategory.Rows[i]["TypeId"].ToString(); string _CategoryLanguageCode = dtCategory.Rows[i]["LanguageCode"].ToString(); if (_CategoryTypeId == "2")//终极栏目 { JumboECMS.Entity.Normal_Module ThisModule = new JumboECMS.DAL.Normal_ModuleDAL().GetEntity(_CategoryModuleType); doh.Reset(); doh.SqlCmd = "SELECT id FROM [jcms_module_" + _CategoryModuleType + "] WHERE [IsPass]=1 and [CategoryID]=" + _CategoryId; DataTable dtContent = doh.GetDataTable(); for (int j = 0; j < dtContent.Rows.Count; j++) { string _ContentId = dtContent.Rows[j]["Id"].ToString(); CreateContentFile(ThisModule, _ContentId, -1); _no++; } dtContent.Clear(); dtContent.Dispose(); } CreateCategoryFile(_CategoryId, false); _no++; } dtCategory.Clear(); dtCategory.Dispose(); JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); teDAL.CreateDefaultFile(); TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks); TimeSpan ts = ts2.Subtract(ts1).Duration(); this._response = JsonResult(1, "耗时" + ts.Seconds.ToString() + " 秒,生成" + _no + "个文件"); }
protected void Page_Load(object sender, EventArgs e) { string _code = q("code"); if (_code.Length != 64) { Response.Write("参数有误"); } string strXmlFile = HttpContext.Current.Server.MapPath("~/_data/config/javascript.config"); JumboECMS.DBUtility.XmlControl XmlTool = new JumboECMS.DBUtility.XmlControl(strXmlFile); string _TemplateContent = XmlTool.GetText("Lis/Li[Code=\"" + _code + "\"]/TemplateContent"); XmlTool.Dispose(); JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); string fileStr = ExecuteCommonTags(_TemplateContent); Response.Write(JumboECMS.Utils.Strings.Html2Js(fileStr)); }
/// <summary> /// 获得指定栏目内容页数 /// </summary> /// <param name="_categoryid">栏目ID</param> /// <param name="_includechild">是否包含子类内容</param> /// <returns></returns> public int GetContetPageCount(string _categoryid, bool _includechild) { JumboECMS.Entity.Normal_Category _category = new JumboECMS.DAL.Normal_CategoryDAL().GetEntity(_categoryid, ""); if (_category.TypeId == "3" || _category.TypeId == "4") { return(1); } using (DbOperHandler _doh = new Common().Doh()) { JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); string _pagestr = teDAL.GetSiteCategoryTemplate(_categoryid); string RegexString = "<jcms:categorycontent (?<tagcontent>.*?)>(?<tempstr>.*?)</jcms:categorycontent>"; string[] _tagcontent = JumboECMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tagcontent", false); string[] _tempstr = JumboECMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tempstr", false); if (_tagcontent.Length > 0)//标签存在 { int _pagesize = Str2Int(JumboECMS.Utils.Strings.AttributeValue(_tagcontent[0], "pagesize")); if (_pagesize == 0) { _pagesize = 20; } string _wherestr = string.Empty; if (!_includechild) { _wherestr = " [CategoryID]=" + _categoryid + " AND [IsPass]=1"; } else { _wherestr = " [CategoryID] in (Select id FROM [" + base.CategoryTable + "] WHERE [Code] LIKE '" + _category.Code + "%') AND [IsPass]=1"; } _doh.Reset(); _doh.ConditionExpress = _wherestr; int _totalcount = _doh.Count("jcms_module_" + _category.ModuleType); return(JumboECMS.Utils.Int.PageCount(_totalcount, _pagesize)); } else { return(1); } } }
/// <summary> /// 生成栏目文件 /// </summary> /// <param name="_categoryId"></param> /// <param name="CreateParent"></param> protected void CreateCategoryFile(string _categoryId, bool CreateParent) { JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); int pageCount = new JumboECMS.DAL.Normal_CategoryDAL().GetContetPageCount(_categoryId, true); string PageStr = string.Empty; for (int i = 1; i < (pageCount + 1); i++) { PageStr = teDAL.GetSiteCategoryPage(_categoryId, i); JumboECMS.Utils.DirFile.SaveFile(PageStr, Go2Category(_categoryId, i)); } doh.Reset(); doh.SqlCmd = "SELECT Id, ParentId FROM [" + CategoryTable + "] WHERE [Id]=" + _categoryId; DataTable dtCategory = doh.GetDataTable(); if (dtCategory.Rows.Count > 0 && dtCategory.Rows[0]["ParentId"].ToString() != "0" && CreateParent == true) { CreateCategoryFile(dtCategory.Rows[0]["ParentId"].ToString(), true); } dtCategory.Clear(); dtCategory.Dispose(); }
/// <summary> /// 解析主站的基本信息 /// </summary> /// <param name="PageStr"></param> protected void ReplaceSiteTags(ref string PageStr) { JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL(); teDAL.IsHtml = site.IsHtml; teDAL.ReplaceSiteTags(ref PageStr); }