protected void Page_Load(object sender, EventArgs e) { team = WBTeam.GetFromTeamSite(SPContext.Current); if (team == null) { ErrorText.Text = "You should only be using this form when on a team site."; ChangeButton.Enabled = false; return; } if (!team.IsCurrentUserTeamManagerOrSystemAdmin()) { ErrorText.Text = "Only team the team manager can change the team manager."; ChangeButton.Enabled = false; return; } if (!IsPostBack) { TeamName.Text = team.Name; } }
protected void Page_Load(object sender, EventArgs e) { webPart = this.Parent as TeamDetails; if (!IsPostBack) { WBTeam team = WBTeam.GetFromTeamSite(SPContext.Current); if (team == null) { // then the SPContext is NOT on a team site ListOfTeamOwners.Text = "<i>(This web part is only for use in team sites)</i>"; ListOfTeamMembers.Text = "<i>(This web part is only for use in team sites)</i>"; } else { if (team.IsCurrentUserTeamOwnerOrSystemAdmin()) { userIsTeamOwnerOrSystemAdmin = true; } List <String> ownerEmails = new List <String>(); List <String> membersEmails = new List <String>(); ListOfTeamOwners.Text = generateTable(team, team.OwnersGroupName, "Owner", "Team Owners", ownerEmails); ListOfTeamMembers.Text = generateTable(team, team.MembersGroupName, "Member", "Team Members", membersEmails); String teamActionsHTML = ""; if (userIsTeamOwnerOrSystemAdmin || webPart.ShowMailToLinks) { teamActionsHTML += "<h3>Team Actions:</h3>\n<ul>"; if (webPart.ShowMailToLinks) { teamActionsHTML += "<li>" + WBUtils.GenerateLinkToEmailGroup("Email team owners", ownerEmails) + "</li>"; teamActionsHTML += "<li>" + WBUtils.GenerateLinkToEmailGroup("Email team members", membersEmails) + "</li>"; } if (userIsTeamOwnerOrSystemAdmin) { teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('InviteToTeamWithEmail.aspx', 0, 0); \">Invite user to team</a></li>"; if (team.IsCurrentUserTeamManagerOrSystemAdmin()) { teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('ChangeTeamManager.aspx', 0, 0); \">Change team manager</a></li>"; } if (webPart.ShowAddManagerReportsLinks) { if (String.IsNullOrEmpty(team.ManagerLogin)) { teamActionsHTML += "<li><i>Add manager's direct reports</i></li>"; teamActionsHTML += "<li><i>Add all manager's reports</i></li>"; } else { teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('AddManagersDirectReports.aspx', 0, 0); \">Add manager's direct reports</a></li>"; teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('AddAllManagersReports.aspx', 0, 0); \">Add all manager's reports</a></li>"; } } if (WBFarm.Local.IsCurrentUserSystemAdmin()) { teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('CheckTeamSync.aspx', 0, 0); \">Check team synchronisation</a></li>"; } } teamActionsHTML += "\n</ul>"; } TeamActions.Text = teamActionsHTML; } } }