public void FileManager_GET() { base.RenderTemplate(ResourceMap.GetPageContent(ManagementPage.File_Manager), null); }
/// <summary> /// 更新链接 /// </summary> public void Edit_GET() { object data; int linkId = int.Parse(base.Request.QueryString["linkId"]); int bindId = 0; int categoryId = 0; string plinks = ""; SiteLinkDto link = ServiceCall.Instance.SiteService.GetLinkById(this.SiteId, linkId); string bindTitle = String.Empty; string[] binds = (link.Bind ?? "").Split(':'); if (binds.Length != 2 || binds[1] == String.Empty) { binds = null; } else { bindId = int.Parse(binds[1]); if (binds[0] == "category") { CategoryDto cate = ServiceCall.Instance.SiteService.GetCategory(this.SiteId, bindId); bindTitle = cate.Id > 0 ? String.Format("栏目:{0}", cate.Name) : null; categoryId = cate.Id; } else if (binds[0] == "archive") { ArchiveDto archive = ServiceCall.Instance.ArchiveService .GetArchiveById(this.SiteId, bindId); if (archive.Id <= 0) { binds = null; } else { bindTitle = String.Format("文档:{0}", archive.Title); } } } string linkTypeName, resouce; switch ((SiteLinkType)link.Type) { case SiteLinkType.FriendLink: linkTypeName = "友情链接"; resouce = ResourceMap.GetPageContent(ManagementPage.Link_SiteLinkEdit); break; default: case SiteLinkType.CustomLink: linkTypeName = "自定义链接"; resouce = ResourceMap.GetPageContent(ManagementPage.Link_SiteLinkEdit); break; case SiteLinkType.Navigation: linkTypeName = "网站导航"; resouce = ResourceMap.GetPageContent(ManagementPage.Link_SiteLinkEdit_Navigator); break; } //plinks StringBuilder sb = new StringBuilder(); IEnumerable <SiteLinkDto> parentLinks = ServiceCall.Instance.SiteService .GetLinksByType(this.SiteId, link.Type, true); foreach (SiteLinkDto _link in parentLinks) { if (_link.Pid == 0) { sb.Append("<option value=\"").Append(_link.Id.ToString()) .Append("\">").Append(_link.Text).Append("</option>"); } } plinks = sb.ToString(); string json = JsonSerializer.Serialize( new { Id = link.Id, Text = link.Text, Uri = link.Uri, OrderIndex = link.OrderIndex, Btn = "保存", BindId = bindId, BindType = binds == null ? "" : binds[0], BindTitle = bindTitle == String.Empty ? "未绑定" : bindTitle, Target = link.Target, Type = (int)link.Type, ImgUrl = link.ImgUrl, Visible = link.Visible.ToString(), Pid = link.Pid, CategoryId = categoryId }); base.RenderTemplate(resouce, new { entity = json, LinkType = (int)link.Type, linkTypeName = linkTypeName, categoryNodes = this.GetCategorySelector(this.SiteId, -1), plinks = plinks }); }
/// <summary> /// 编辑文件 /// </summary> public void EditFile_GET() { string path = Request["path"]; string content, bakinfo; if (path.ToLower().IndexOf("config/cms.config") != -1) { throw new ArgumentException(); } string mode = "html"; string dependJs = String.Empty; FileInfo file, bakfile; file = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + path); bakfile = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + path + ".bak"); switch (file.Extension.ToLower()) { case ".css": dependJs = "/framework/assets/coder/mode/css.js"; mode = "css"; break; case ".conf": case ".config": case ".xml": dependJs = "/framework/assets/coder/mode/xml.js"; mode = "xml"; break; } if (!file.Exists) { Response.Write("文件不存在!"); return; } else { if (bakfile.Exists) { bakinfo = String.Format(@"上次修改时间日期:{0:yyyy-MM-dd HH:mm:ss} <a style=""margin-right:20px"" href=""javascript:;"" onclick=""process('restore')"">还原</a>", bakfile.LastWriteTime, path); } else { bakinfo = ""; } } StreamReader sr = new StreamReader(file.FullName); content = sr.ReadToEnd(); sr.Dispose(); //base.RenderTemplate(ManagerResouces.tpl_editfile, new //{ // file=path, // content=content, // bakinfo=bakinfo //}); // Response.Write(ManagerResouces.tpl_editfile.Replace("${file}", path) // .Replace("${content}", content).Replace("${bakinfo}", bakinfo)); content = Regex.Replace(content, "<", "<"); content = Regex.Replace(content, ">", ">"); base.RenderTemplate(ResourceMap.GetPageContent(ManagementPage.File_Edit), new { file = path, mode = mode, dependJs = dependJs, content = content, bakinfo = bakinfo, path = path }); }
/// <summary> /// 创建链接 /// </summary> public void Create_GET() { object data; string plinks = ""; SiteLinkType type = (SiteLinkType)Enum.Parse(typeof(SiteLinkType), base.Request["type"], true); string linkTypeName, resouce; switch (type) { case SiteLinkType.FriendLink: linkTypeName = "友情链接"; resouce = ResourceMap.GetPageContent(ManagementPage.Link_SiteLinkEdit); break; default: case SiteLinkType.CustomLink: linkTypeName = "自定义链接"; resouce = ResourceMap.GetPageContent(ManagementPage.Link_SiteLinkEdit); break; case SiteLinkType.Navigation: linkTypeName = "网站导航"; resouce = ResourceMap.GetPageContent(ManagementPage.Link_SiteLinkEdit_Navigator); break; } //plinks StringBuilder sb = new StringBuilder(); int siteID = base.CurrentSite.SiteId; IEnumerable <SiteLinkDto> parentLinks = ServiceCall.Instance.SiteService .GetLinksByType(this.SiteId, type, true); foreach (SiteLinkDto _link in parentLinks) { if (_link.Pid == 0) { sb.Append("<option value=\"").Append(_link.Id.ToString()) .Append("\">").Append(_link.Text).Append("</option>"); } } plinks = sb.ToString(); string json = JsonSerializer.Serialize( new { Id = 0, Text = String.Empty, Uri = String.Empty, OrderIndex = "0", Btn = "添加", BindId = String.Empty, BindType = String.Empty, BindTitle = "未绑定", Target = String.Empty, Type = Request["type"], ImgUrl = String.Empty, pid = '0', Visible = "True" }); base.RenderTemplate(resouce, new { entity = json, LinkType = Request["type"], linkTypeName = linkTypeName, categoryNodes = this.GetCategorySelector(siteID, -1), plinks = plinks }); }