protected void Page_Load(object sender, EventArgs e) { // Get AnswerID and PollID from querystring pollId = QueryHelper.GetInteger("pollId", 0); answerId = QueryHelper.GetInteger("answerId", 0); groupId = QueryHelper.GetInteger("groupId", 0); string currentPollAnswer = GetString("Polls_Answer_Edit.NewItemCaption"); // Initialize AnswerEdit control if (QueryHelper.GetInteger("saved", 0) == 1) { AnswerEdit.Saved = true; } AnswerEdit.ItemID = answerId; AnswerEdit.PollId = pollId; AnswerEdit.OnSaved += new EventHandler(AnswerEdit_OnSaved); AnswerEdit.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(AnswerEdit_OnCheckPermissions); if (answerId > 0) { this.CurrentMaster.Title.HelpTopicName = "answer_edit"; PollAnswerInfo pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(answerId); EditedObject = pollAnswerObj; if (pollAnswerObj != null) { // Check that poll belongs to the specified group if ((pollAnswerObj.AnswerPollID > 0) && (groupId > 0)) { PollInfo poll = PollInfoProvider.GetPollInfo(pollAnswerObj.AnswerPollID); // Answer not found or doesn't belong to specified group if ((poll == null) || (poll.PollGroupID != groupId)) { RedirectToAccessDenied(GetString("community.group.pollnotassigned")); } } // Set control currentPollAnswer = GetString("Polls_Answer_Edit.AnswerLabel") + " " + pollAnswerObj.AnswerOrder.ToString(); pollId = pollAnswerObj.AnswerPollID; } } else { this.CurrentMaster.Title.HelpTopicName = "new_answer"; } // Validate EditedObject = PollInfoProvider.GetPollInfo(pollId); if (!RequestHelper.IsPostBack()) { AnswerEdit.ReloadData(); } // Initializes page title control string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("Polls_Answer_Edit.ItemListLink"); breadcrumbs[0, 1] = "~/CMSModules/Groups/Tools/Polls/Polls_Edit_Answer_List.aspx?pollId=" + pollId + "&groupId=" + groupId; breadcrumbs[0, 2] = ""; breadcrumbs[1, 0] = currentPollAnswer; breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; this.CurrentMaster.Title.Breadcrumbs = breadcrumbs; // New item link string[,] actions = new string[1, 6]; actions[0, 0] = HeaderActions.TYPE_HYPERLINK; actions[0, 1] = GetString("Polls_Answer_List.NewItemCaption"); actions[0, 2] = null; actions[0, 3] = ResolveUrl("Polls_Edit_Answer_Edit.aspx?pollId=" + pollId.ToString() + "&groupId=" + groupId); actions[0, 4] = null; actions[0, 5] = GetImageUrl("Objects/Polls_PollAnswer/add.png"); this.CurrentMaster.HeaderActions.Actions = actions; }
/// <summary> /// Displays appropriate controls regarding set properties. /// </summary> private void DisplayControls(string selectedPage, bool forceReload) { PollProperties.Visible = false; AnswerList.Visible = false; PollSecurity.Visible = false; PollView.Visible = false; PollView.StopProcessing = true; headerLinks.Visible = false; pnlPollsBreadcrumbs.Visible = false; pnlPollsLinks.Visible = false; AnswerEdit.Visible = false; btnResetAnswers.Visible = true; imgResetAnswers.Visible = true; if (forceReload) { selectedPage = "0"; tabMenu.SelectedTab = 0; } // Display appropriate tab switch (selectedPage) { // Answer list case "1": AnswerList.Visible = true; AnswerList.PollId = ItemID; AnswerList.ReloadData(true); headerLinks.Visible = true; pnlPollsLinks.Visible = true; break; // Answer edit case "answersedit": headerLinks.Visible = true; pnlPollsBreadcrumbs.Visible = true; pnlPollsLinks.Visible = true; AnswerEdit.Visible = true; AnswerEdit.PollId = ItemID; AnswerEdit.ReloadData(); btnResetAnswers.Visible = false; imgResetAnswers.Visible = false; AnswerEditSelected = true; // Initialize breadcrumbs InitializeBreadcrumbs(); break; // Poll security case "2": PollSecurity.Visible = true; PollSecurity.ItemID = ItemID; PollSecurity.ReloadData(); break; // Poll view case "3": PollView.Visible = true; InitPollView(ItemID); PollView.StopProcessing = false; PollView.ReloadData(false); break; // Poll properties default: PollProperties.Visible = true; PollProperties.ItemID = ItemID; PollProperties.ReloadData(); break; } }
/// <summary> /// Displays appropriate controls regarding set properties. /// </summary> private void DisplayControls(string selectedPage, bool forceReload) { PollProperties.Visible = false; AnswerList.Visible = false; PollSecurity.Visible = false; PollView.Visible = false; PollView.StopProcessing = true; headerLinks.Visible = false; pnlPollsBreadcrumbs.Visible = false; pnlPollsLinks.Visible = false; AnswerEdit.Visible = false; btnResetAnswers.Visible = true; imgResetAnswers.Visible = true; if (forceReload) { selectedPage = "0"; tabMenu.SelectedTab = 0; } // Display appropriate tab switch (selectedPage) { // Poll properties case "0": default: PollProperties.Visible = true; PollProperties.ItemID = ItemID; PollProperties.ReloadData(); break; // Answer list case "1": AnswerList.Visible = true; AnswerList.PollId = ItemID; AnswerList.ReloadData(true); headerLinks.Visible = true; pnlPollsLinks.Visible = true; break; // Answer edit case "answersedit": headerLinks.Visible = true; pnlPollsBreadcrumbs.Visible = true; pnlPollsLinks.Visible = true; AnswerEdit.Visible = true; AnswerEdit.PollId = ItemID; AnswerEdit.ReloadData(); btnResetAnswers.Visible = false; imgResetAnswers.Visible = false; AnswerEditSelected = true; // Initialize breadcrumbs string currentPollAnswer = GetString("Polls_Answer_Edit.NewItemCaption"); if (AnswerEdit.ItemID > 0) { PollAnswerInfo pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(AnswerEdit.ItemID); if (pollAnswerObj != null) { currentPollAnswer = GetString("Polls_Answer_Edit.AnswerLabel") + " " + pollAnswerObj.AnswerOrder.ToString(); } } lblAnswer.Text = currentPollAnswer; break; // Poll security case "2": PollSecurity.Visible = true; PollSecurity.ItemID = ItemID; PollSecurity.ReloadData(); break; // Poll view case "3": PollView.Visible = true; InitPollView(ItemID); PollView.StopProcessing = false; PollView.ReloadData(false); break; } }