/// <summary> /// Gets and updates message board subscription. Called when the "Get and update subscription" button is pressed. /// Expects the CreateMessageBoardSubscription method to be run first. /// </summary> private bool GetAndUpdateMessageBoardSubscription() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (board != null) { // Get the message board subscription BoardSubscriptionInfo updateSubscription = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(board.BoardID, MembershipContext.AuthenticatedUser.UserID); if (updateSubscription != null) { // Update the properties updateSubscription.SubscriptionEmail = updateSubscription.SubscriptionEmail.ToLowerCSafe(); // Update the subscription BoardSubscriptionInfoProvider.SetBoardSubscriptionInfo(updateSubscription); return(true); } } } return(false); }
/// <summary> /// Reloads the board messages related to the currently processed message board. /// </summary> private void ReloadBoardMessages() { this.SetContext(); // If user isn't allowed to read comments if (!CMSContext.CurrentUser.IsAuthenticated() && !this.BoardProperties.BoardEnableAnonymousRead) { // Do not display existing messages to anonymous user, but inform on situation this.lblNoMessages.Visible = true; this.lblNoMessages.Text = GetString("board.messagelist.anonymousreadnotallowed"); } else { // If the message board ID was specified if (this.MessageBoardID > 0) { string where = "(MessageBoardID = " + this.MessageBoardID.ToString() + ")"; // If the user should be displayed with all messages not just approved ones if (!BoardInfoProvider.IsUserAuthorizedToManageMessages(bi)) { where += " AND (MessageApproved = 1) AND ((MessageIsSpam IS NULL) OR (MessageIsSpam = 0))"; } // Get board messages this.rptBoardMessages.WhereCondition = where; this.rptBoardMessages.ReloadData(true); } } this.ReleaseContext(); }
/// <summary> /// Creates message board subscription. Called when the "Create subscription" button is pressed. /// Expects the CreateMessageBoard method to be run first. /// </summary> private bool CreateMessageBoardSubscription() { // Create new message board subscription object BoardSubscriptionInfo newSubscription = new BoardSubscriptionInfo(); // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (board != null) { // Set the properties newSubscription.SubscriptionBoardID = board.BoardID; newSubscription.SubscriptionUserID = MembershipContext.AuthenticatedUser.UserID; newSubscription.SubscriptionEmail = "*****@*****.**"; newSubscription.SubscriptionLastModified = DateTime.Now; // Create the message board subscription BoardSubscriptionInfoProvider.SetBoardSubscriptionInfo(newSubscription); return(true); } } return(false); }
/// <summary> /// Gets and updates message. Called when the "Get and update message" button is pressed. /// Expects the CreateMessage method to be run first. /// </summary> private bool GetAndUpdateMessage() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get the root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (board != null) { // Get the data DataSet messages = BoardMessageInfoProvider.GetMessages(board.BoardID); if (!DataHelper.DataSourceIsEmpty(messages)) { // Create object from DataRow BoardMessageInfo updateMessage = new BoardMessageInfo(messages.Tables[0].Rows[0]); // Update the properties updateMessage.MessageText = updateMessage.MessageText.ToLowerCSafe(); // Update the message BoardMessageInfoProvider.SetBoardMessageInfo(updateMessage); return(true); } } } return(false); }
/// <summary> /// Deletes message. Called when the "Delete message" button is pressed. /// Expects the CreateMessage method to be run first. /// </summary> private bool DeleteMessage() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get the root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (board != null) { // Get the data DataSet messages = BoardMessageInfoProvider.GetMessages(board.BoardID); if (!DataHelper.DataSourceIsEmpty(messages)) { // Get the message BoardMessageInfo deleteMessage = new BoardMessageInfo(messages.Tables[0].Rows[0]); // Delete the message BoardMessageInfoProvider.DeleteBoardMessageInfo(deleteMessage); return(deleteMessage != null); } } } return(false); }
/// <summary> /// Gets and bulk updates message boards. Called when the "Get and bulk update boards" button is pressed. /// Expects the CreateMessageBoard method to be run first. /// </summary> private bool GetAndBulkUpdateMessageBoards() { // Prepare the parameters string where = "BoardName LIKE N'MyNewBoard%'"; // Get the data DataSet boards = BoardInfoProvider.GetMessageBoards(where, null); if (!DataHelper.DataSourceIsEmpty(boards)) { // Loop through the individual items foreach (DataRow boardDr in boards.Tables[0].Rows) { // Create object from DataRow BoardInfo modifyBoard = new BoardInfo(boardDr); // Update the property modifyBoard.BoardDisplayName = modifyBoard.BoardDisplayName.ToUpper(); // Update the message board BoardInfoProvider.SetBoardInfo(modifyBoard); } return(true); } return(false); }
/// <summary> /// Gets and updates message board. Called when the "Get and update board" button is pressed. /// Expects the CreateMessageBoard method to be run first. /// </summary> private bool GetAndUpdateMessageBoard() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get the root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo updateBoard = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (updateBoard != null) { // Update the property updateBoard.BoardDisplayName = updateBoard.BoardDisplayName.ToLowerCSafe(); // Update the message board BoardInfoProvider.SetBoardInfo(updateBoard); return(true); } } return(false); }
/// <summary> /// Creates message board. Called when the "Create board" button is pressed. /// </summary> private bool CreateMessageBoard() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get the root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Create new message board object BoardInfo newBoard = new BoardInfo(); // Set the properties newBoard.BoardDisplayName = "My new board"; newBoard.BoardName = "MyNewBoard"; newBoard.BoardDescription = "MyNewBoard"; newBoard.BoardOpened = true; newBoard.BoardEnabled = true; newBoard.BoardAccess = 0; newBoard.BoardModerated = true; newBoard.BoardUseCaptcha = false; newBoard.BoardMessages = 0; newBoard.BoardEnableSubscriptions = true; newBoard.BoardSiteID = SiteContext.CurrentSiteID; newBoard.BoardDocumentID = root.DocumentID; // Create the message board BoardInfoProvider.SetBoardInfo(newBoard); return(true); } return(false); }
/// <summary> /// On action event handling. /// </summary> /// <param name="actionName">Name of the action.</param> /// <param name="actionArgument">Parameter for the action.</param> protected void boardSubscriptions_OnAction(string actionName, object actionArgument) { int boardSubscriptionId = ValidationHelper.GetInteger(actionArgument, 0); switch (actionName.ToLowerCSafe()) { case "delete": if (RaiseOnCheckPermissions(PERMISSION_MANAGE, this)) { if (StopProcessing) { return; } } try { BoardSubscriptionInfoProvider.DeleteBoardSubscriptionInfo(boardSubscriptionId); } catch (Exception ex) { ShowError(ex.Message); } break; case "approve": if (RaiseOnCheckPermissions(PERMISSION_MANAGE, this)) { if (StopProcessing) { return; } } // Approve BoardSubscriptionInfo object BoardSubscriptionInfo bsi = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(boardSubscriptionId); if ((bsi != null) && !bsi.SubscriptionApproved) { bsi.SubscriptionApproved = true; BoardSubscriptionInfoProvider.SetBoardSubscriptionInfo(bsi); // Send confirmation mail BoardInfo bi = BoardInfoProvider.GetBoardInfo(bsi.SubscriptionBoardID); if ((bi != null) && bi.BoardSendOptInConfirmation) { BoardSubscriptionInfoProvider.SendConfirmationEmail(bsi, true); } // Log activity if (MembershipContext.AuthenticatedUser.UserID == UserID) { Service <ICurrentContactMergeService> .Entry().UpdateCurrentContactEmail(bsi.SubscriptionEmail, MembershipContext.AuthenticatedUser); BoardSubscriptionInfoProvider.LogSubscriptionActivity(bsi, bi, PredefinedActivityType.SUBSCRIPTION_MESSAGE_BOARD, false); } } break; } }
/// <summary> /// Deletes message board subscription. Called when the "Delete subscription" button is pressed. /// Expects the CreateMessageBoardSubscription method to be run first. /// </summary> private bool DeleteMessageBoardSubscription() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (board != null) { // Get the message board subscription BoardSubscriptionInfo deleteSubscription = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(board.BoardID, MembershipContext.AuthenticatedUser.UserID); // Delete the message board subscription BoardSubscriptionInfoProvider.DeleteBoardSubscriptionInfo(deleteSubscription); return(deleteSubscription != null); } } return(false); }
/// <summary> /// Initializes the controls on the page. /// </summary> private void SetupControl() { // Get current subscription ID mSubscriptionId = QueryHelper.GetInteger("subscriptionid", 0); mCurrentSubscription = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(mSubscriptionId); // Get current board and group ID boardId = QueryHelper.GetInteger("boardid", 0); groupId = QueryHelper.GetInteger("groupid", 0); BoardInfo boardObj = BoardInfoProvider.GetBoardInfo(boardId); if (boardObj != null) { // Check whether edited board belongs to group if ((boardObj.BoardGroupID == 0) || (groupId != boardObj.BoardGroupID)) { EditedObject = null; } } boardSubscription.IsLiveSite = false; boardSubscription.BoardID = boardId; boardSubscription.GroupID = groupId; boardSubscription.SubscriptionID = mSubscriptionId; boardSubscription.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(boardSubscription_OnCheckPermissions); boardSubscription.OnSaved += new EventHandler(boardSubscription_OnSaved); InitializeBreadcrumbs(); }
/// <summary> /// Returns the count of messages in given message board. /// </summary> /// <param name="documentId">ID of the document.</param> /// <param name="boardWebpartName">Messageboard webpart name.</param> /// <param name="type">Type of messageboard: 'document', 'user' or 'group'.</param> public static int GetBoardMessagesCount(int documentId, string boardWebpartName, string type) { // Get board type BoardOwnerTypeEnum boardType = BoardInfoProvider.GetBoardOwnerTypeEnum(type); Guid identifier = Guid.Empty; // Get correct identifier by type switch (boardType) { case BoardOwnerTypeEnum.User: identifier = CMSContext.CurrentUser.UserGUID; break; case BoardOwnerTypeEnum.Group: identifier = GetCurrentGroupGuid(); break; } // Get board name string boardName = BoardInfoProvider.GetMessageBoardName(boardWebpartName, boardType, identifier.ToString()); // Get board info BoardInfo board = BoardInfoProvider.GetBoardInfo(boardName, documentId); if (board != null) { // Get messages count return(BoardMessageInfoProvider.GetMessagesCount(board.BoardID, true, true)); } return(0); }
protected void gridBoards_OnAction(string actionName, object actionArgument) { switch (actionName) { case "delete": if (!CheckPermissions("cms.messageboards", PERMISSION_MODIFY)) { return; } int boardId = ValidationHelper.GetInteger(actionArgument, 0); // If no Document-Category relationship exist concerning current category if (boardId > 0) { BoardInfoProvider.DeleteBoardInfo(boardId); } if (IsLiveSite) { ReloadData(); } break; } RaiseOnAction(actionName, actionArgument); }
protected void Page_Load(object sender, EventArgs e) { // Get current board ID boardId = QueryHelper.GetInteger("boardid", 0); BoardInfo boardObj = BoardInfoProvider.GetBoardInfo(boardId); if (boardObj != null) { groupId = boardObj.BoardGroupID; // Check whether edited board belongs to group if (groupId == 0) { EditedObject = null; } } boardSubscriptions.BoardID = boardId; boardSubscriptions.GroupID = groupId; boardSubscriptions.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(boardSubscriptions_OnCheckPermissions); boardSubscriptions.OnAction += new CommandEventHandler(boardSubscriptions_OnAction); // Initialize the master page InitializeMasterPage(); }
/// <summary> /// Adds role to message board. Called when the button "Add role to board" is pressed. /// Expects the method CreateMessageBoard to be run first. /// </summary> private bool AddRoleToMessageBoard() { // Get the tree structure TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); // Get the root document TreeNode root = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); // Get the role CMSDeskAdmin RoleInfo role = RoleInfoProvider.GetRoleInfo("CMSDeskAdmin", CMSContext.CurrentSite.SiteID); if ((board != null) && (role != null)) { // Add role to message board BoardRoleInfoProvider.AddRoleToBoard(role.RoleID, board.BoardID); return(true); } } return(false); }
protected void CheckLocalPermissions() { int groupId = 0; int boardId = mBoardId; BoardMessageInfo bmi = BoardMessageInfoProvider.GetBoardMessageInfo(mMessageId); if (bmi != null) { boardId = bmi.MessageBoardID; } BoardInfo bi = BoardInfoProvider.GetBoardInfo(boardId); if (bi != null) { groupId = bi.BoardGroupID; } // Check 'Manage' permission if (MembershipContext.AuthenticatedUser.IsGroupAdministrator(groupId)) { return; } if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.groups", CMSAdminControl.PERMISSION_MANAGE)) { RedirectToAccessDenied("cms.groups", CMSAdminControl.PERMISSION_MANAGE); } }
/// <summary> /// Removes moderator from message board. Called when the button "Remove moderator from board" is pressed. /// Expects the method AddModeratorToMessageBoard to be run first. /// </summary> private bool RemoveModeratorFromMessageBoard() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get the root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); if (board != null) { BoardModeratorInfo boardModerator = BoardModeratorInfoProvider.GetBoardModeratorInfo(MembershipContext.AuthenticatedUser.UserID, board.BoardID); if (boardModerator != null) { // Remove moderator from message board BoardModeratorInfoProvider.DeleteBoardModeratorInfo(boardModerator); return(true); } } } return(false); }
/// <summary> /// Removes role from message board. Called when the button "Remove role from board" is pressed. /// Expects the method AddRoleToMessageBoard to be run first. /// </summary> private bool RemoveRoleFromMessageBoard() { // Get the tree structure TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); // Get the root document TreeNode root = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/", null, true); if (root != null) { // Get the message board BoardInfo board = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); // Get the role RoleInfo role = RoleInfoProvider.GetRoleInfo("CMSDeskAdmin", SiteContext.CurrentSite.SiteID); if ((board != null) && (role != null)) { BoardRoleInfo boardRole = BoardRoleInfoProvider.GetBoardRoleInfo(role.RoleID, board.BoardID); if (boardRole != null) { // Remove role from message board BoardRoleInfoProvider.DeleteBoardRoleInfo(boardRole); return(true); } } } return(false); }
/// <summary> /// Initializes all the nested controls. /// </summary> private void SetupControls() { this.tabElem.TabControlIdPrefix = "boards"; this.tabElem.OnTabClicked += new EventHandler(tabElem_OnTabChanged); this.lnkEditBack.Text = GetString("Group_General.Boards.Boards.BackToList"); this.lnkEditBack.Click += new EventHandler(lnkEditBack_Click); // Register for the security events this.boardList.OnCheckPermissions += new CheckPermissionsEventHandler(boardList_OnCheckPermissions); this.boardEdit.OnCheckPermissions += new CheckPermissionsEventHandler(boardEdit_OnCheckPermissions); this.boardModerators.OnCheckPermissions += new CheckPermissionsEventHandler(boardModerators_OnCheckPermissions); this.boardSecurity.OnCheckPermissions += new CheckPermissionsEventHandler(boardSecurity_OnCheckPermissions); // Setup controls this.boardList.IsLiveSite = this.IsLiveSite; this.boardList.GroupID = this.GroupID; this.boardList.OnAction += new CommandEventHandler(boardList_OnAction); this.boardMessages.IsLiveSite = this.IsLiveSite; this.boardMessages.OnCheckPermissions += new CheckPermissionsEventHandler(boardMessages_OnCheckPermissions); this.boardMessages.BoardID = this.BoardID; this.boardMessages.GroupID = this.GroupID; this.boardMessages.EditPageUrl = (this.GroupID > 0) ? "~/CMSModules/Groups/CMSPages/Message_Edit.aspx" : "~/CMSModules/MessageBoards/CMSPages/Message_Edit.aspx"; this.boardEdit.IsLiveSite = this.IsLiveSite; this.boardEdit.BoardID = this.BoardID; this.boardEdit.DisplayMode = this.DisplayMode; this.boardModerators.IsLiveSite = this.IsLiveSite; this.boardModerators.BoardID = this.BoardID; this.boardSecurity.IsLiveSite = this.IsLiveSite; this.boardSecurity.BoardID = this.BoardID; this.boardSecurity.GroupID = this.GroupID; this.boardSubscriptions.IsLiveSite = this.IsLiveSite; this.boardSubscriptions.BoardID = this.BoardID; this.boardSubscriptions.GroupID = this.GroupID; // Initialize tab control string[,] tabs = new string[5, 4]; tabs[0, 0] = GetString("Group_General.Boards.Boards.Messages"); tabs[1, 0] = GetString("Group_General.Boards.Boards.Edit"); tabs[2, 0] = GetString("Group_General.Boards.Boards.Moderators"); tabs[3, 0] = GetString("Group_General.Boards.Boards.Security"); tabs[4, 0] = GetString("Group_General.Boards.Boards.SubsList"); this.tabElem.Tabs = tabs; // Initialize breadcrubms if (this.BoardID > 0) { board = BoardInfoProvider.GetBoardInfo(this.BoardID); if (board != null) { this.lblEditBack.Text = breadCrumbsSeparator + HTMLHelper.HTMLEncode(board.BoardDisplayName); } } }
/// <summary> /// Checks if the board is currently opened. /// </summary> /// <param name="drv">Data row view holding information on current board data</param> private bool IsBoardOpened(DataRowView drv) { bool opened = ValidationHelper.GetBoolean(drv["BoardOpened"], false); DateTime from = ValidationHelper.GetDateTime(drv["BoardOpened"], DateTimeHelper.ZERO_TIME); DateTime to = ValidationHelper.GetDateTime(drv["BoardOpened"], DateTimeHelper.ZERO_TIME); return(BoardInfoProvider.IsBoardOpened(opened, from, to)); }
/// <summary> /// Handles the UniGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void gridElem_OnAction(string actionName, object actionArgument) { BoardMessageInfo message = BoardMessageInfoProvider.GetBoardMessageInfo(Convert.ToInt32(actionArgument)); BoardInfo bi = BoardInfoProvider.GetBoardInfo(message.MessageBoardID); string[] argument = null; switch (actionName) { case "delete": case "approve": // Check whether user is board moderator first if (!BoardInfoProvider.IsUserAuthorizedToManageMessages(bi)) { // Then check modify to messageboards if (!CheckPermissions("cms.messageboards", CMSAdminControl.PERMISSION_MODIFY)) { return; } } break; } switch (actionName) { case "delete": if (message != null) { BoardMessageInfoProvider.DeleteBoardMessageInfo(message); } break; case "approve": if (message != null) { if (message.MessageApproved) { // Reject message message.MessageApproved = false; message.MessageApprovedByUserID = 0; } else { // Approve message message.MessageApproved = true; message.MessageApprovedByUserID = CMSContext.CurrentUser.UserID; } BoardMessageInfoProvider.SetBoardMessageInfo(message); } break; default: break; } this.RaiseOnAction(actionName, ((argument == null) ? actionArgument : argument)); }
/// <summary> /// Button handler. /// </summary> void btnDelete_Click(object sender, EventArgs e) { // Check 'Modify' permission if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.MessageBoards", "Modify")) { RedirectToAccessDenied("CMS.MessageBoards", "Modify"); } BoardInfoProvider.DeleteBoardInfo(ValidationHelper.GetInteger(hdnBoardId.Value, 0)); ltlScript.Text += ScriptHelper.GetScript("parent.frames['main'].location.href = '" + ResolveUrl("~/CMSPages/blank.htm") + "'"); ltlScript.Text += ScriptHelper.GetScript("window.location.replace(window.location);"); }
private void boardMsgActions_OnMessageAction(string actionName, object argument) { // Get current board message ID int boardMessageId = ValidationHelper.GetInteger(argument, 0); BoardMessageInfo message = BoardMessageInfoProvider.GetBoardMessageInfo(boardMessageId); // Handle not existing message if (message == null) { return; } if ((bi != null) && BoardInfoProvider.IsUserAuthorizedToManageMessages(bi)) { switch (actionName.ToLowerCSafe()) { case "delete": // Delete message BoardMessageInfoProvider.DeleteBoardMessageInfo(message); rptBoardMessages.ClearCache(); ReloadData(); break; case "approve": // Approve board message if (MembershipContext.AuthenticatedUser != null) { message.MessageApprovedByUserID = MembershipContext.AuthenticatedUser.UserID; message.MessageApproved = true; BoardMessageInfoProvider.SetBoardMessageInfo(message); } rptBoardMessages.ClearCache(); ReloadData(); break; case "reject": // Reject board message if (MembershipContext.AuthenticatedUser != null) { message.MessageApprovedByUserID = 0; message.MessageApproved = false; BoardMessageInfoProvider.SetBoardMessageInfo(message); } rptBoardMessages.ClearCache(); ReloadData(); break; } } }
private void boardSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender) { // Check 'Manage' permission int groupId = 0; BoardInfo bi = BoardInfoProvider.GetBoardInfo(boardId); if (bi != null) { groupId = bi.BoardGroupID; } CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE); }
/// <summary> /// Board moderated checkbox change. /// </summary> protected void chkBoardModerated_CheckedChanged(object sender, EventArgs e) { if (!canModify || (Board == null)) { return; } Board.BoardModerated = chkBoardModerated.Checked; BoardInfoProvider.SetBoardInfo(Board); ShowChangesSaved(); ShouldReloadData = true; }
protected void btnOk_Click(object sender, EventArgs e) { // Check permissions if (!CheckPermissions("cms.messageboards", PERMISSION_MODIFY)) { return; } // Check if board exists if (Board != null) { if (radOnlyUsers.Checked) { Board.BoardAccess = SecurityAccessEnum.AuthenticatedUsers; } if (radAllUsers.Checked) { Board.BoardAccess = SecurityAccessEnum.AllUsers; } if (radOnlyRoles.Checked) { Board.BoardAccess = SecurityAccessEnum.AuthorizedRoles; } if (radOnlyGroupAdmin.Visible && radOnlyGroupAdmin.Checked) { Board.BoardAccess = SecurityAccessEnum.GroupAdmin; } if (radGroupMembers.Visible && radGroupMembers.Checked) { Board.BoardAccess = SecurityAccessEnum.GroupMembers; } if (radOnlyOwner.Visible && radOnlyOwner.Checked) { Board.BoardAccess = SecurityAccessEnum.Owner; } Board.BoardUseCaptcha = chkUseCaptcha.Checked; // Save changes BoardInfoProvider.SetBoardInfo(Board); ShowChangesSaved(); } }
protected void Page_Load(object sender, EventArgs e) { int boardId = QueryHelper.GetInteger("boardid", 0); // Get board info and check whether it belongs to current site BoardInfo board = BoardInfoProvider.GetBoardInfo(boardId); if (board != null) { CheckMessageBoardSiteID(board.BoardSiteID); } boardModerators.Board = board; boardModerators.IsLiveSite = false; }
/// <summary> /// Returns board name according board type. /// </summary> /// <param name="webPartName">Name of the web part</param> /// <param name="boardOwner">Owner of the board</param> private string GetBoardName(string webPartName, string boardOwner) { // Get type BoardOwnerTypeEnum type = BoardInfoProvider.GetBoardOwnerTypeEnum(boardOwner); // Get name switch (boardOwner.ToLowerCSafe()) { case "user": return(BoardInfoProvider.GetMessageBoardName(webPartName, type, CurrentUser.UserGUID.ToString())); default: return(BoardInfoProvider.GetMessageBoardName(webPartName, type, "")); } }
private void msgEdit_OnAfterMessageSaved(BoardMessageInfo message) { if ((bi == null) && (message != null) && (message.MessageBoardID > 0)) { MessageBoardID = message.MessageBoardID; // Get updated board information bi = BoardInfoProvider.GetBoardInfo(message.MessageBoardID); userVerified = BoardInfoProvider.IsUserAuthorizedToManageMessages(bi); } rptBoardMessages.ClearCache(); ReloadData(); }
protected void Page_Load(object sender, EventArgs e) { boardObj = BoardInfoProvider.GetBoardInfo(QueryHelper.GetInteger("boardid", 0)); if (boardObj != null) { groupId = boardObj.BoardGroupID; // Check whether edited board belongs to any group if (groupId == 0) { EditedObject = null; } } boardEdit.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(boardEdit_OnCheckPermissions); }