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); }
/// <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);"); }
/// <summary> /// Actions handler. /// </summary> protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e) { switch (e.CommandName.ToLowerCSafe()) { case "delete": // Check 'Modify' permission if (!CMSContext.CurrentUser.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);"); break; } }
/// <summary> /// Deletes message board. Called when the "Delete board" button is pressed. /// Expects the CreateMessageBoard method to be run first. /// </summary> private bool DeleteMessageBoard() { // 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 deleteBoard = BoardInfoProvider.GetBoardInfo("MyNewBoard", root.DocumentID); // Delete the message board BoardInfoProvider.DeleteBoardInfo(deleteBoard); return(deleteBoard != null); } return(false); }