public void Page_Load(object sender, EventArgs e) { var request = SiteServer.Plugin.Context.GetCurrentRequest(); SiteId = request.GetQueryInt("siteId"); _redirectUrl = request.GetQueryString("redirectUrl"); if (!request.AdminPermissions.HasSitePermissions(SiteId, Main.PluginId)) { HttpContext.Current.Response.Write("<h1>未授权访问</h1>"); HttpContext.Current.Response.End(); } if (IsPostBack) { return; } var channelInfoList = InteractManager.GetInteractChannelInfoList(SiteId); if (channelInfoList.Count > 0) { Utils.Redirect(_redirectUrl); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); AuthRequest = SiteServer.Plugin.Context.GetCurrentRequest(); SiteId = AuthRequest.GetQueryInt("siteId"); if (!AuthRequest.AdminPermissions.HasSitePermissions(SiteId, Main.PluginId)) { HttpContext.Current.Response.Write("<h1>未授权访问</h1>"); HttpContext.Current.Response.End(); } ChannelInfoList = InteractManager.GetInteractChannelInfoList(SiteId); if (ChannelInfoList.Count == 0) { Utils.Redirect(PageInit.GetRedirectUrl(SiteId, Request.RawUrl)); } }
public void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } TbStartDate.Text = string.Empty; TbEndDate.Now = true; var nodeInfoList = InteractManager.GetInteractChannelInfoList(SiteId); var listItem = new ListItem("<<全部>>", "0"); DdlChannelId.Items.Add(listItem); foreach (var nodeInfo in nodeInfoList) { listItem = new ListItem(nodeInfo.ChannelName, nodeInfo.Id.ToString()); DdlChannelId.Items.Add(listItem); } BindGrid(); }
protected override void OnInit(EventArgs e) { base.OnInit(e); var channelId = AuthRequest.GetQueryInt("channelId"); var contentId = AuthRequest.GetQueryInt("contentId"); _returnUrl = AuthRequest.GetQueryString("returnUrl"); _contentInfo = Main.ContentApi.GetContentInfo(SiteId, channelId, contentId); _adminInfo = Main.AdminApi.GetAdminInfoByUserId(AuthRequest.AdminId); var state = EStateUtils.GetEnumType(_contentInfo.GetString(ContentAttribute.State)); if (IsPostBack) { return; } if (PhBtnAccept != null) { PhBtnAccept.Visible = InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Accept); } if (PhBtnSwitchToTranslate != null) { PhBtnSwitchToTranslate.Visible = InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.SwitchToTranslate); } if (PhBtnReply != null) { PhBtnReply.Visible = InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Reply); } if (PhBtnCheck != null) { PhBtnCheck.Visible = state != EState.Checked && InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Check); } if (PhBtnComment != null) { PhBtnComment.Visible = state != EState.Checked && InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Comment); } if (PhBtnReturn != null) { PhBtnReturn.Visible = !ConfigInfo.ApplyIsOpenWindow; } var tableColumns = Main.ContentApi.GetTableColumns(SiteId, _contentInfo.ChannelId); var isSingle = true; var builder = new StringBuilder(); foreach (var tableColumn in tableColumns) { if (tableColumn.InputStyle == null || Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.Title)) || Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsHot)) || Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsColor)) || Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsRecommend)) || Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsTop)) || Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.DepartmentId) || Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.Content)) { continue; } var value = _contentInfo.GetString(tableColumn.AttributeName); if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.TypeId)) { value = InteractManager.GetTypeName(Utils.ToInt(value)); } else if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.IsPublic)) { value = Utils.ToBool(value) ? "公开" : "不公开"; } else if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.FileUrl)) { if (!string.IsNullOrEmpty(value)) { value = $@"<a href=""{value}"" target=""_blank"">{value}</a>"; } } else if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.State)) { value = EStateUtils.GetText(state); } if (isSingle) { builder.Append("<tr>"); } builder.Append( $@"<th>{tableColumn.InputStyle.DisplayName}</th><td>{value}</td>"); if (!isSingle) { builder.Append("</tr>"); } isSingle = !isSingle; } if (!isSingle) { builder.Append("</tr>"); } LtlTitle.Text = _contentInfo.Title; LtlApplyAttributes.Text = builder.ToString(); LtlContent.Text = _contentInfo.GetString(ContentAttribute.Content); if (PhReply != null) { if (state == EState.Denied || state == EState.Replied || state == EState.Redo || state == EState.Checked) { var replyInfo = ReplyDao.GetReplyInfoByContentId(SiteId, _contentInfo.Id); if (replyInfo != null) { PhReply.Visible = true; LtlDepartmentAndUserName.Text = $"{DepartmentManager.GetDepartmentName(replyInfo.DepartmentId)}({replyInfo.UserName})"; LtlReplyAddDate.Text = Utils.GetDateAndTimeString(replyInfo.AddDate); LtlReply.Text = replyInfo.Reply; if (!string.IsNullOrEmpty(replyInfo.FileUrl)) { LtlReplyFileUrl.Text = $@"<a href=""{replyInfo.FileUrl}"" target=""_blank"">{replyInfo.FileUrl}</a>"; } } } } if (BtnSwitchTo != null) { var departmentId = _contentInfo.GetInt(ContentAttribute.DepartmentId); BtnSwitchTo.Attributes.Add("onclick", ModalDepartmentSelectSingle.GetOpenWindowString(SiteId, _contentInfo.ChannelId)); var scriptBuilder = new StringBuilder(); if (departmentId > 0) { var departmentName = DepartmentManager.GetDepartmentName(departmentId); scriptBuilder.Append( $@"<script>departmentSelect('{departmentName}', {departmentId});</script>"); } LtlScript.Text = scriptBuilder.ToString(); } if (DdlTranslateChannelId != null) { var nodeInfoList = InteractManager.GetInteractChannelInfoList(SiteId); foreach (var nodeInfo in nodeInfoList) { if (nodeInfo.Id != _contentInfo.ChannelId) { var listItem = new ListItem(nodeInfo.ChannelName, nodeInfo.Id.ToString()); DdlTranslateChannelId.Items.Add(listItem); } } } RptRemarks.DataSource = RemarkDao.GetDataSourceByContentId(SiteId, _contentInfo.Id); RptRemarks.ItemDataBound += RptRemarks_ItemDataBound; RptRemarks.DataBind(); if (RptLogs != null) { RptLogs.DataSource = LogDao.GetDataSourceByContentId(SiteId, _contentInfo.Id); RptLogs.ItemDataBound += RptLogs_ItemDataBound; RptLogs.DataBind(); } }