protected void updatePanelWithTeamDetails(WBTeam team) { TeamName.Text = team.Name; TeamGUID.Text = team.Id.ToString(); TeamAcronym.Text = team.Acronym; UseAllFunctionalAreas.Checked = team.UseAllFunctionalAreas; TeamFunctionalAreas.Text = team.FunctionalAreaUIControlValue; if (TeamFunctionalAreas.Text == "") { InheritedFunctionalAreas.Text = team.FunctionalArea(functionalAreas).Names(); } else { InheritedFunctionalAreas.Text = ""; } TeamsSiteURL.Text = team.TeamSiteUrl; TeamsSiteGUID.Text = team.TeamSiteGuidString; WBLogging.Debug("In TeamManagement.updatePanelWithTeamDetails(): OwnersGroupName = " + team.OwnersGroupName); WBLogging.Debug("In TeamManagement.updatePanelWithTeamDetails(): MembersGroupName = " + team.MembersGroupName); InformationAssetOwner.WBxInitialise(team.InformationAssetOwner(SPContext.Current.Web)); TeamManager.WBxInitialise(team.Manager(SPContext.Current.Web)); //TeamOwnersSharePointUserGroup.CommaSeparatedAccounts = ""; //TeamOwnersSharePointUserGroup.ResolvedEntities.Clear(); //TeamOwnersSharePointUserGroup.Entities.Clear(); TeamOwnersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.OwnersGroupName)); //TeamMembersSharePointUserGroup.CommaSeparatedAccounts = ""; //TeamMembersSharePointUserGroup.ResolvedEntities.Clear(); //TeamMembersSharePointUserGroup.Entities.Clear(); TeamMembersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.MembersGroupName)); //TeamPublishersSharePointUserGroup.CommaSeparatedAccounts = ""; TeamPublishersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.PublishersGroupName)); RecordsTypesListUrl.Text = team.RecordsTypesListUrl; CommonActivitiesListUrl.Text = team.CommonActivitiesListUrl; FunctionalActivitiesListUrl.Text = team.FunctionalActivitiesListUrl; }
protected void saveButton_OnClick(object sender, EventArgs e) { WBLogging.Debug("In TeamManagement.saveButton_OnClick(): just started"); WBTeam team = teams.GetSelectedTeam(AllTeamsTreeView.SelectedNode.ValuePath); team.Name = TeamName.Text; team.Acronym = TeamAcronym.Text; WBLogging.Debug("Set name and acronym"); team.UseAllFunctionalAreas = UseAllFunctionalAreas.Checked; team.FunctionalAreaUIControlValue = TeamFunctionalAreas.Text; team.TeamSiteUrl = TeamsSiteURL.Text; WBLogging.Debug("About to set manager"); team.SetInformationAssetOwner(InformationAssetOwner.WBxGetSingleResolvedUser(SPContext.Current.Web)); team.SetManager(SPContext.Current.Site, TeamManager.WBxGetSingleResolvedUser(SPContext.Current.Web)); WBLogging.Debug("Set manager"); team.OwnersGroupName = WBUtils.EntitiesToPropertyString(TeamOwnersSharePointUserGroup.ResolvedEntities, 1); team.MembersGroupName = WBUtils.EntitiesToPropertyString(TeamMembersSharePointUserGroup.ResolvedEntities, 1); team.PublishersGroupName = WBUtils.EntitiesToPropertyString(TeamPublishersSharePointUserGroup.ResolvedEntities, 1); WBLogging.Debug("In TeamManagement.saveButton_OnClick(): OwnersGroupName is now = " + team.OwnersGroupName); WBLogging.Debug("In TeamManagement.saveButton_OnClick(): MembersGroupName is now = " + team.MembersGroupName); WBLogging.Debug("In TeamManagement.saveButton_OnClick(): PublishersGroupName is now = " + team.PublishersGroupName); team.RecordsTypesListUrl = RecordsTypesListUrl.Text; team.CommonActivitiesListUrl = CommonActivitiesListUrl.Text; team.FunctionalActivitiesListUrl = FunctionalActivitiesListUrl.Text; team.Update(); updatePanelWithTeamDetails(team); popupMessageOnUpdate("Changes saved OK."); WBUtils.logMessage("Clicked Save Changes with TeamsSiteURL.Text = " + TeamsSiteURL.Text); WBUtils.logMessage("... and selected path: " + AllTeamsTreeView.SelectedNode.ValuePath); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SPSite site = SPContext.Current.Site; SPWeb web = SPContext.Current.Web; WBTaxonomy teams = WBTaxonomy.GetTeams(site); WBTaxonomy functionalAreas = WBTaxonomy.GetFunctionalAreas(teams); teams.InitialiseTaxonomyControl(TeamTerm, "Select Team Term", false); teams.InitialiseTaxonomyControl(ParentTeamTerm, "Select the Parent Team Term", false); functionalAreas.InitialiseTaxonomyControl(TeamFunctionalAreas, "Select the functional area", true); TeamName.Text = web.Title; WBTeam team = WBTeam.GetFromTeamSite(teams, web); if (team != null) { TeamTerm.Text = team.UIControlValue; TeamAcronym.Text = team.Acronym; TeamFunctionalAreas.Text = team.FunctionalAreaUIControlValue; UseAllFunctionalAreas.Checked = team.UseAllFunctionalAreas; if (TeamFunctionalAreas.Text == "") { InheritedFunctionalAreas.Text = team.FunctionalArea(functionalAreas).Names(); } else { InheritedFunctionalAreas.Text = ""; } InformationAssetOwner.WBxInitialise(team.InformationAssetOwner(web)); TeamManager.WBxInitialise(team.Manager(web)); TeamOwnersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.OwnersGroupName)); TeamMembersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.MembersGroupName)); TeamPublishersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.PublishersGroupName)); TeamTerm.Enabled = false; ParentTeamTerm.Enabled = false; TeamOwnersSharePointUserGroup.Enabled = false; TeamMembersSharePointUserGroup.Enabled = false; RecordsTypesListUrl.Text = team.RecordsTypesListUrl; } else { TeamTerm.Text = ""; SPWeb parentWeb = web.ParentWeb; WBTeam parentTeam = WBTeam.GetFromTeamSite(teams, parentWeb); if (parentTeam != null) { ParentTeamTerm.Text = parentTeam.UIControlValue; InheritedFunctionalAreas.Text = parentTeam.FunctionalArea(functionalAreas).Names(); RecordsTypesListUrl.Text = parentTeam.RecordsTypesListUrl; } TeamOwnersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(web.Title + " - Owners")); TeamMembersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(web.Title + " - Members")); } } }
protected void okButton_OnClick(object sender, EventArgs e) { SPSite site = SPContext.Current.Site; SPWeb web = SPContext.Current.Web; WBTaxonomy teams = WBTaxonomy.GetTeams(site); WBTeam team = null; if (TeamTerm.Enabled) { if (TeamTerm.Text != "" && ParentTeamTerm.Text != "") { TeamTermStatus.Text = "You can only select either a direct term or the parent term, not both!"; return; } if (TeamTerm.Text == "" && ParentTeamTerm.Text == "") { TeamTermStatus.Text = "You must select either a direct term or the parent term."; return; } if (TeamTerm.Text != "") { team = new WBTeam(teams, TeamTerm.Text); } else { if (ParentTeamTerm.Text != "") { WBTerm parent = new WBTerm(teams, ParentTeamTerm.Text); Term newTerm = parent.Term.CreateTerm(web.Title, WorkBox.LOCALE_ID_ENGLISH); team = new WBTeam(teams, newTerm); } } team.OwnersGroupName = WBUtils.EntitiesToPropertyString(TeamOwnersSharePointUserGroup.ResolvedEntities, 1); team.MembersGroupName = WBUtils.EntitiesToPropertyString(TeamMembersSharePointUserGroup.ResolvedEntities, 1); team.TeamSiteUrl = web.Url; } else { team = WBTeam.GetFromTeamSite(teams, web); } if (team == null) { TeamTermStatus.Text = "Had a problem finding or creating the term!"; return; } team.Name = TeamName.Text; web.Title = TeamName.Text; team.Acronym = TeamAcronym.Text; team.SetInformationAssetOwner(InformationAssetOwner.WBxGetSingleResolvedUser(web)); team.SetManager(site, TeamManager.WBxGetSingleResolvedUser(web)); team.PublishersGroupName = WBUtils.EntitiesToPropertyString(TeamPublishersSharePointUserGroup.ResolvedEntities, 1); team.RecordsTypesListUrl = RecordsTypesListUrl.Text; if (!String.IsNullOrEmpty(TeamFunctionalAreas.Text)) { team.FunctionalAreaUIControlValue = TeamFunctionalAreas.Text; } team.UseAllFunctionalAreas = UseAllFunctionalAreas.Checked; // This will actually update the web as well as the term. team.UpdateWithTeamSiteWeb(web); SPUtility.Redirect("settings.aspx", SPRedirectFlags.RelativeToLayoutsPage, Context); }