/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { // Put user code to initialize the page here if (Page.IsPostBack) { return; } try { IList <string> segments = Request.GetFriendlyUrlSegments(); ProjectId = Int32.Parse(segments[0]); } catch { ProjectId = Request.QueryString.Get("pid", 0); } // BGN-1379 if (ProjectId.Equals(0)) { ErrorRedirector.TransferToNotFoundPage(Page); } BindProjectSummary(); // SiteMap.SiteMapResolve += ExpandPaths; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { IList <string> segments = Request.GetFriendlyUrlSegments(); ProjectId = Int32.Parse(segments[0]); } catch { ProjectId = Request.QueryString.Get("pid", 0); } // If don't know project or issue then redirect to something missing page if (ProjectId == 0) { ErrorRedirector.TransferToSomethingMissingPage(Page); } CurrentProject = ProjectManager.GetById(ProjectId); litProject.Text = CurrentProject.Name; litProjectCode.Text = CurrentProject.Code; if (CurrentProject == null) { ErrorRedirector.TransferToNotFoundPage(Page); return; } //security check: add issue if (!UserManager.HasPermission(ProjectId, Common.Permission.AddIssue.ToString())) { ErrorRedirector.TransferToLoginPage(Page); } BindOptions(); BindDefaultValues(); //check users role permission for adding an attachment if (!Page.User.Identity.IsAuthenticated || !UserManager.HasPermission(ProjectId, Common.Permission.AddAttachment.ToString())) { pnlAddAttachment.Visible = false; } else if (HostSettingManager.Get(HostSettingNames.AllowAttachments, false) && CurrentProject.AllowAttachments) { pnlAddAttachment.Visible = true; } } //need to rebind these on every postback because of dynamic controls ctlCustomFields.DataSource = CustomFieldManager.GetByProjectId(ProjectId); ctlCustomFields.DataBind(); // The ExpandIssuePaths method is called to handle // the SiteMapResolve event. SiteMap.SiteMapResolve += ExpandIssuePaths; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } ctlDisplayIssues.PageSize = UserManager.GetProfilePageSize(); ctlDisplayIssues.CurrentPageIndex = 0; ProjectId = Request.Get("pid", -1); // BGN-1379 if (ProjectId.Equals(-1)) { ErrorRedirector.TransferToNotFoundPage(Page); } if (!User.Identity.IsAuthenticated) { dropView.Items.Remove(dropView.Items.FindByValue("Relevant")); dropView.Items.Remove(dropView.Items.FindByValue("Assigned")); dropView.Items.Remove(dropView.Items.FindByValue("Owned")); dropView.Items.Remove(dropView.Items.FindByValue("Created")); dropView.SelectedIndex = 1; } var state = (IssueListState)Session[ISSUELISTSTATE]; if (state != null) { if (Request.QueryString.Count == 1 && state.ViewIssues == string.Empty) { state.ViewIssues = "Open"; } if ((ProjectId > 0) && (ProjectId != state.ProjectId)) { Session.Remove(ISSUELISTSTATE); } else { if (Request.QueryString.Count > 1) { state.ViewIssues = string.Empty; } dropView.SelectedValue = state.ViewIssues; ProjectId = state.ProjectId; ctlDisplayIssues.CurrentPageIndex = state.IssueListPageIndex; ctlDisplayIssues.SortField = state.SortField; ctlDisplayIssues.SortAscending = state.SortAscending; ctlDisplayIssues.PageSize = state.PageSize; } } else { if (Request.QueryString.Count > 1) { dropView.SelectedValue = string.Empty; } } BindIssues(); }
/// <summary> /// Page Load Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var s = GetLocalResourceObject("DeleteIssueQuestion").ToString().Trim().JsEncode(); lnkDelete.Attributes.Add("onclick", string.Format("return confirm('{0}');", s)); IssueId = Request.QueryString.Get("id", 0); // If don't know issue id then redirect to something missing page if (IssueId == 0) { ErrorRedirector.TransferToSomethingMissingPage(Page); } //set up global properties _currentIssue = IssueManager.GetById(IssueId); if (_currentIssue == null || _currentIssue.Disabled) { ErrorRedirector.TransferToNotFoundPage(Page); return; } //private issue check var issueVisible = IssueManager.CanViewIssue(_currentIssue, Security.GetUserName()); //private issue check if (!issueVisible) { ErrorRedirector.TransferToLoginPage(Page); } _currentProject = ProjectManager.GetById(_currentIssue.ProjectId); if (_currentProject == null) { ErrorRedirector.TransferToNotFoundPage(Page); return; } ProjectId = _currentProject.Id; if (_currentProject.AccessType == ProjectAccessType.Private && !User.Identity.IsAuthenticated) { ErrorRedirector.TransferToLoginPage(Page); } else if (User.Identity.IsAuthenticated && _currentProject.AccessType == ProjectAccessType.Private && !ProjectManager.IsUserProjectMember(User.Identity.Name, ProjectId)) { ErrorRedirector.TransferToLoginPage(Page); } BindValues(_currentIssue); // Page.Title = string.Concat(_currentIssue.FullId, ": ", Server.HtmlDecode(_currentIssue.Title)); lblIssueNumber.Text = string.Format("{0}-{1}", _currentProject.Code, IssueId); ctlIssueTabs.Visible = true; SetFieldSecurity(); if (!_currentProject.AllowIssueVoting) { VoteBox.Visible = false; } //set the referrer url if (Request.UrlReferrer != null) { if (Request.UrlReferrer.ToString() != Request.Url.ToString()) { Session["ReferrerUrl"] = Request.UrlReferrer.ToString(); } } else { Session["ReferrerUrl"] = string.Format("~/Issues/IssueList.aspx?pid={0}", ProjectId); } } Page.Title = string.Concat(lblIssueNumber.Text, ": ", Server.HtmlDecode(TitleTextBox.Text)); //need to rebind these on every postback because of dynamic controls ctlCustomFields.DataSource = CustomFieldManager.GetByIssueId(IssueId); ctlCustomFields.DataBind(); // The ExpandIssuePaths method is called to handle // the SiteMapResolve event. SiteMap.SiteMapResolve += ExpandIssuePaths; ctlIssueTabs.IssueId = IssueId; ctlIssueTabs.ProjectId = ProjectId; }