public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); if (Body.IsQueryExists("FileName")) { _fileName = Body.GetQueryString("FileName"); _fileName = PathUtils.RemoveParentPath(_fileName); } _directoryPath = PathUtility.MapPath(SiteInfo, "@/js"); if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.Permissions.WebSite.Template); LtlPageTitle.Text = string.IsNullOrEmpty(_fileName) ? "添加脚本文件" : "编辑脚本文件"; var isCodeMirror = SiteInfo.Additional.ConfigTemplateIsCodeMirror; BtnEditorType.Text = isCodeMirror ? "采用纯文本编辑模式" : "采用代码编辑模式"; PhCodeMirror.Visible = isCodeMirror; ECharsetUtils.AddListItems(DdlCharset); if (_fileName != null) { if (!EFileSystemTypeUtils.IsJs(PathUtils.GetExtension(_fileName))) { PageUtils.RedirectToErrorPage("对不起,此文件无法编辑!"); } else { TbRelatedFileName.Text = PathUtils.RemoveExtension(_fileName); var fileCharset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, _fileName)); ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, ECharsetUtils.GetValue(fileCharset)); TbContent.Text = FileUtils.ReadText(PathUtils.Combine(_directoryPath, _fileName), fileCharset); } } else { ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, SiteInfo.Additional.Charset); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("FileName")) { fileName = Body.GetQueryString("FileName"); fileName = PathUtils.RemoveParentPath(fileName); } directoryPath = PathUtility.MapPath(PublishmentSystemInfo, "@/js"); if (!IsPostBack) { var pageTitle = string.IsNullOrEmpty(fileName) ? "添加脚本文件" : "编辑脚本文件"; BreadCrumb(AppManager.Cms.LeftMenu.IdTemplate, pageTitle, AppManager.Cms.Permission.WebSite.Template); ltlPageTitle.Text = pageTitle; ECharsetUtils.AddListItems(Charset); if (fileName != null) { if (!EFileSystemTypeUtils.IsJs(PathUtils.GetExtension(fileName))) { PageUtils.RedirectToErrorPage("对不起,此文件无法编辑!"); } else { RelatedFileName.Text = PathUtils.RemoveExtension(fileName); ltlCreatedFileExtName.Text = PathUtils.GetExtension(fileName); var fileCharset = FileUtils.GetFileCharset(PathUtils.Combine(directoryPath, fileName)); ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(fileCharset)); Content.Text = FileUtils.ReadText(PathUtils.Combine(directoryPath, fileName), fileCharset); } } else { ltlCreatedFileExtName.Text = ".js"; ControlUtils.SelectListItemsIgnoreCase(Charset, PublishmentSystemInfo.Additional.Charset); } } }