private string RedirectURL() { return(ModalFileView.GetRedirectUrl(PublishmentSystemId, Body.GetQueryString("rootPath"), Body.GetQueryString("FileName"), FileName.Text, Body.GetQueryString("HiddenClientID"))); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "RelatedPath", "FileName", "IsCreate"); _relatedPath = AuthRequest.GetQueryString("RelatedPath").Trim('/'); if (!_relatedPath.StartsWith("@")) { _relatedPath = "@/" + _relatedPath; } _theFileName = AuthRequest.GetQueryString("FileName"); _isCreate = AuthRequest.GetQueryBool("IsCreate"); _fileCharset = ECharset.utf_8; if (SiteInfo != null) { _fileCharset = ECharsetUtils.GetEnumType(SiteInfo.Additional.Charset); } if (_isCreate == false) { var filePath = SiteInfo != null ? PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, _theFileName)) : PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName)); if (!FileUtils.IsFileExists(filePath)) { PageUtils.RedirectToErrorPage("此文件不存在!"); return; } } if (IsPostBack) { return; } DdlCharset.Items.Add(new ListItem("默认", string.Empty)); ECharsetUtils.AddListItems(DdlCharset); if (_isCreate == false) { var filePath = SiteInfo != null?PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, _theFileName)) : PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName)); TbFileName.Text = _theFileName; TbFileName.Enabled = false; TbFileContent.Text = FileUtils.ReadText(filePath, _fileCharset); } if (_isCreate) { return; } if (SiteInfo != null) { LtlOpen.Text = $@"<a class=""btn btn-default m-l-10"" href=""{PageUtility.ParseNavigationUrl(SiteInfo, PageUtils.Combine(_relatedPath, _theFileName), true)}"" target=""_blank"">浏 览</a>"; } else { LtlOpen.Text = $@"<a class=""btn btn-default m-l-10"" href=""{PageUtils.ParseConfigRootUrl(PageUtils.Combine(_relatedPath, _theFileName))}"" target=""_blank"">浏 览</a>"; } LtlView.Text = $@"<a class=""btn btn-default m-l-10"" href=""{ModalFileView.GetRedirectUrl(SiteId, _relatedPath, _theFileName)}"">查 看</a>"; }
private string RedirectUrl() { return(ModalFileView.GetRedirectUrl(SiteId, Body.GetQueryString("rootPath"), Body.GetQueryString("FileName"), TbFileName.Text, Body.GetQueryString("HiddenClientID"))); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "RelatedPath", "FileName", "IsCreate"); _relatedPath = Body.GetQueryString("RelatedPath").Trim('/'); if (!_relatedPath.StartsWith("@")) { _relatedPath = "@/" + _relatedPath; } _theFileName = Body.GetQueryString("FileName"); _isCreate = Body.GetQueryBool("IsCreate"); _fileCharset = ECharset.utf_8; if (PublishmentSystemInfo != null) { _fileCharset = ECharsetUtils.GetEnumType(PublishmentSystemInfo.Additional.Charset); } if (_isCreate == false) { string filePath; if (PublishmentSystemInfo != null) { filePath = PathUtility.MapPath(PublishmentSystemInfo, PathUtils.Combine(_relatedPath, _theFileName)); } else { filePath = PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName)); } if (!FileUtils.IsFileExists(filePath)) { PageUtils.RedirectToErrorPage("此文件不存在!"); return; } } if (!IsPostBack) { Charset.Items.Add(new ListItem("默认", string.Empty)); ECharsetUtils.AddListItems(Charset); if (_isCreate == false) { var filePath = string.Empty; if (PublishmentSystemInfo != null) { filePath = PathUtility.MapPath(PublishmentSystemInfo, PathUtils.Combine(_relatedPath, _theFileName)); } else { filePath = PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName)); } FileName.Text = _theFileName; FileName.Enabled = false; FileContentTextBox.Text = FileUtils.ReadText(filePath, _fileCharset); } if (!_isCreate) { if (PublishmentSystemInfo != null) { ltlOpen.Text = $@"<a href=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, PageUtils.Combine(_relatedPath, _theFileName))}"" target=""_blank"">浏 览</a> "; } else { ltlOpen.Text = $@"<a href=""{PageUtils.ParseConfigRootUrl(PageUtils.Combine(_relatedPath, _theFileName))}"" target=""_blank"">浏 览</a> "; } ltlView.Text = $@"<a href=""{ModalFileView.GetRedirectUrl(PublishmentSystemId, _relatedPath, _theFileName)}"">属 性</a>"; } } }