public override void Submit_OnClick(object sender, EventArgs e) { try { PhExport.Visible = false; const string fileName = "users.csv"; var filePath = PathUtils.GetTemporaryFilesPath(fileName); ExcelObject.CreateExcelFileForUsers(filePath, ETriStateUtils.GetEnumType(RblCheckedState.SelectedValue)); var link = new HyperLink { NavigateUrl = ActionsDownload.GetUrl(PageUtils.GetApiUrl(), filePath), Text = "下载" }; var successMessage = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ContentID"); _nodeId = Body.GetQueryInt("NodeID"); _contentId = Body.GetQueryInt("ContentID"); _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("returnUrl")); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "评论管理", string.Empty); StlCommentInput.ApiUrl = PageUtils.GetApiUrl(); StlCommentInput.IsAnonymous = true; StlCommentInput.PageNum = 20; StlCommentInput.ApiActionsAddUrl = CMS.Controllers.Comments.ActionsAdd.GetUrl(StlCommentInput.ApiUrl, PublishmentSystemId, _nodeId, _contentId); StlCommentInput.ApiActionsDeleteUrl = CMS.Controllers.Comments.ActionsDelete.GetUrl(StlCommentInput.ApiUrl, PublishmentSystemId, _nodeId, _contentId); StlCommentInput.ApiActionsGoodUrl = CMS.Controllers.Comments.ActionsGood.GetUrl(StlCommentInput.ApiUrl, PublishmentSystemId, _nodeId, _contentId); StlCommentInput.ApiGetUrl = CMS.Controllers.Comments.Get.GetUrl(StlCommentInput.ApiUrl, PublishmentSystemId, _nodeId, _contentId); StlCommentInput.ApiActionsLogoutUrl = CMS.Controllers.Users.ActionsLogout.GetUrl(StlCommentInput.ApiUrl); StlCommentInput.HomeUrl = PageUtils.GetHomeUrl(); StlCommentInput.IsDelete = true; BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToComment(PublishmentSystemId, _nodeId, _contentId)); } }
protected override void Render(HtmlTextWriter writer) { var controllerUrl = CMS.Controllers.Files.UEditor.GetUrl(PageUtils.GetApiUrl(), 0); var editorUrl = SiteFilesAssets.GetUrl(PageUtils.GetApiUrl(), "ueditor"); if (string.IsNullOrEmpty(Height) || Height == "0") { Height = "280"; } if (string.IsNullOrEmpty(Width) || Width == "0") { Width = "100%"; } var builder = new StringBuilder(); builder.Append( $@"<script type=""text/javascript"">window.UEDITOR_HOME_URL = ""{editorUrl}/"";window.UEDITOR_CONTROLLER_URL = ""{controllerUrl}"";</script><script type=""text/javascript"" src=""{editorUrl}/editor_config.js""></script><script type=""text/javascript"" src=""{editorUrl}/ueditor_all_min.js""></script>"); builder.Append($@" <textarea id=""{ClientID}"" name=""{ClientID}"" style=""display:none"">{HttpUtility.HtmlEncode(Text)}</textarea> <script type=""text/javascript""> $(function(){{ UE.getEditor('{ClientID}', {{allowDivTransToP: false}}); $('#{ClientID}').show(); }}); </script>"); writer.Write(builder); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _exportType = Body.GetQueryString("ExportType"); if (!IsPostBack) { var fileName = string.Empty; try { if (_exportType == ExportTypeSingleTableStyle) { var tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); var tableName = Body.GetQueryString("TableName"); fileName = ExportSingleTableStyle(tableStyle, tableName); } var link = new HyperLink(); var filePath = PathUtils.GetTemporaryFilesPath(fileName); link.NavigateUrl = ActionsDownload.GetUrl(PageUtils.GetApiUrl(), filePath); link.Text = "下载"; var successMessage = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } } }
public Comment(CommentInfo commentInfo, UserInfo userInfo) { if (commentInfo == null) { return; } Id = commentInfo.Id; AddDate = DateUtils.GetDateAndTimeString(commentInfo.AddDate, EDateFormatType.Chinese, ETimeFormatType.ShortTime); GoodCount = commentInfo.GoodCount; Content = commentInfo.Content; IsChecked = commentInfo.IsChecked; DisplayName = userInfo?.DisplayName; AvatarUrl = PageUtility.GetUserAvatarUrl(PageUtils.GetApiUrl(), userInfo); }
public static string GetApiUrl(PublishmentSystemInfo publishmentSystemInfo = null) { if (publishmentSystemInfo == null) { return(PageUtils.GetApiUrl()); } var apiUrl = publishmentSystemInfo.Additional.ApiUrl; if (publishmentSystemInfo.Additional.IsMultiDeployment) { apiUrl = publishmentSystemInfo.Additional.InnerApiUrl; } return(apiUrl); }
public User(UserInfo userInfo) { AvatarUrl = PageUtility.GetUserAvatarUrl(PageUtils.GetApiUrl(), userInfo); if (userInfo == null) { return; } Id = userInfo.UserId; UserName = userInfo.UserName; GroupId = userInfo.GroupId; CreateDate = userInfo.CreateDate; LastResetPasswordDate = userInfo.LastResetPasswordDate; LastActivityDate = userInfo.LastActivityDate; CountOfLogin = userInfo.CountOfLogin; CountOfFailedLogin = userInfo.CountOfFailedLogin; CountOfWriting = userInfo.CountOfWriting; IsChecked = userInfo.IsChecked; IsLockedOut = userInfo.IsLockedOut; DisplayName = userInfo.DisplayName; Email = userInfo.Email; Mobile = userInfo.Mobile; AvatarUrl = userInfo.AvatarUrl; Organization = userInfo.Organization; Department = userInfo.Department; Position = userInfo.Position; Gender = userInfo.Gender; Birthday = userInfo.Birthday; Education = userInfo.Education; Graduation = userInfo.Graduation; Address = userInfo.Address; WeiXin = userInfo.WeiXin; Qq = userInfo.Qq; WeiBo = userInfo.WeiBo; Interests = userInfo.Interests; Signature = userInfo.Signature; IsAnonymous = string.IsNullOrEmpty(userInfo.UserName); Additional = userInfo.Additional; }