protected void btnEnter_Click(object sender, EventArgs e) { WeiSha.Common.Templates.TemplateBank tmp = WeiSha.Common.Template.GetTemplate(type, tag); tmp.Name = tbName.Text.Trim(); tmp.Author = tbAuthor.Text.Trim(); tmp.Phone = tbPhone.Text.Trim(); tmp.QQ = tbQQ.Text.Trim(); tmp.CrtTime = Convert.ToDateTime(tbCrtTime.Text); tmp.Intro = tbIntro.Text.Trim(); //图片 if (fuLoad.PostedFile.FileName != "") { try { fuLoad.NewName = "logo.jpg"; fuLoad.IsConvertJpg = true; fuLoad.SaveAs(this.Server.MapPath(tmp.Logo)); WeiSha.Common.Images.FileTo.Zoom(this.Server.MapPath(tmp.Logo), 200, 200, false); imgShow.Src = tmp.Logo + "?s=" + DateTime.Now.Ticks; } catch (Exception ex) { this.Alert(ex.Message); } } tmp.Save(); WeiSha.Common.Template.RefreshTemplate(); Master.AlertCloseAndRefresh("操作成功!"); }
public override void LoadCurrentTemplate() { //是否是手机端网页 string filePath = this.Request.Url.AbsolutePath; bool isMobi = isMobilePage(out filePath); //if (isMobi) filePath = filePath.Substring(prefix.Length); //取模板对象 WeiSha.Common.Templates.TemplateBank curr = isMobi ? WeiSha.Common.Template.ForMobile.SetCurrent(this.Organ.Org_TemplateMobi) : WeiSha.Common.Template.ForWeb.SetCurrent(this.Organ.Org_Template); if (curr == null) { throw new Exception("没有任何模板可用!"); } //当前模板的所在路径 string tmFile = curr.Path.Physics + filePath + ".htm"; //装载模板 this.Document = null; if (!System.IO.File.Exists(tmFile)) { tmFile = WeiSha.Common.Template.ForWeb.Default.Path.Physics + filePath + ".htm"; if (!System.IO.File.Exists(tmFile)) { tmFile = curr.Path.Physics + "Notfound.htm"; } this.Document = new TemplateDocument(tmFile, Encoding.UTF8, this.DocumentConfig); } else { this.Document = TemplateDocument.FromFileCache(tmFile, Encoding.UTF8, this.DocumentConfig); } }
private void fill() { WeiSha.Common.Templates.TemplateBank tmp = WeiSha.Common.Template.GetTemplate(type, tag); tbName.Text = tmp.Name; tbAuthor.Text = tmp.Author; tbPhone.Text = tmp.Phone; tbQQ.Text = tmp.QQ; tbCrtTime.Text = tmp.CrtTime.ToString("yyyy-MM-dd"); tbIntro.Text = tmp.Intro; imgShow.Src = tmp.Logo + "?s=" + DateTime.Now.Ticks; lbFileName.Text = tmp.Path.Virtual; }
private void fill() { WeiSha.Common.Templates.TemplateBank tmp = WeiSha.Common.Template.GetTemplate(type, tag); ltName.Text = tmp.Name; ltAuthor.Text = tmp.Author; ltPhone.Text = tmp.Phone; ltQQ.Text = tmp.QQ; ltCrtTime.Text = tmp.CrtTime.ToString(); ltIntro.Text = tmp.Intro; imgShow.Src = tmp.Logo + "?s=" + DateTime.Now.Ticks; lbFileName.Text = tmp.Path.Virtual; }
/// <summary> /// 装载当前页面的模板文档 /// </summary> public virtual void LoadCurrentTemplate() { //是否是手机端网页 string filePath = this.Request.Url.AbsolutePath; bool isMobi = isMobilePage(out filePath); //处理后filePath为文件名(不含扩展名) if (isMobi && LoginState.Accounts.IsLogin) { LoginState.Accounts.Refresh(LoginState.Accounts.CurrentUser); } //取模板对象 WeiSha.Common.Templates.TemplateBank curr = isMobi ? WeiSha.Common.Template.ForMobile.SetCurrent(this.Organ.Org_TemplateMobi) : WeiSha.Common.Template.ForWeb.SetCurrent(this.Organ.Org_Template); if (curr == null) { throw new Exception("没有任何模板库可用!"); } //是否是公共页面 if (curr.Config.Public == null) { throw new Exception("未找到公共模板库!"); } bool isPublic = curr.Config.Public.PageExists(filePath); if (isPublic) { curr = curr.Config.Public; } //当前模板的所在路径 string tmFile = curr.Path.Physics + filePath + ".htm"; //装载模板 this.Document = null; if (!System.IO.File.Exists(tmFile)) { tmFile = curr.Config.Default.Path.Physics + filePath + ".htm"; if (!System.IO.File.Exists(tmFile)) { tmFile = curr.Config.Public.Path.Physics + "Notfound.htm"; } } this.Document = TemplateDocument.FromFileCache(tmFile, Encoding.UTF8, this.DocumentConfig); //this.Document = new TemplateDocument(tmFile, Encoding.UTF8, this.DocumentConfig); //不采用缓存 }
/// <summary> /// 更改模板信息 /// </summary> /// <param name="tmp"></param> /// <returns></returns> public WeiSha.Common.Templates.TemplateBank Save(WeiSha.Common.Templates.TemplateBank tmp) { tmp.Save(); return(tmp); }