protected void Page_Load(object sender, EventArgs e) { recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); teamsTaxonomy = WBTaxonomy.GetTeams(recordsTypesTaxonomy); functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy); subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy); SelectedView = VIEW_BY_FUNCTION_THEN_TYPE; if (!IsPostBack) { } RefreshBrowsableTreeView(); ShowResults.AllowSorting = true; ShowResults.Sorting += new GridViewSortEventHandler(ShowResults_Sorting); ShowResults.AllowPaging = true; ShowResults.PageIndexChanging += new GridViewPageEventHandler(ShowResults_PageIndexChanging); ShowResults.PagerSettings.Mode = PagerButtons.Numeric; ShowResults.PagerSettings.Position = PagerPosition.Bottom; ShowResults.PagerSettings.PageButtonCount = 50; ShowResults.PagerSettings.Visible = true; ShowResults.PageSize = 50; // this odd statement is required in order to get the pagination to work with an SPGridView! ShowResults.PagerTemplate = null; }
protected void Page_Load(object sender, EventArgs e) { if (!WorkBox.CurrentUserIsOwner() && !WorkBox.CurrentUserIsBusinessAdmin() && !WorkBox.CurrentUserIsSystemAdmin()) { ErrorText.Text = "Only owners or admin can invite teams to have access to a work box."; return; } teamsTaxonomy = WBTaxonomy.GetTeams(SPContext.Current.Site); if (!IsPostBack) { WorkBoxTitle.Text = WorkBox.Title; InviteType.SelectedValue = "Involved"; CurrentlySelectedValue.Value = "Involved"; SendInviteEmail.Checked = true; SendAsOne.Checked = true; CCToYou.Checked = true; EmailSubject.Text = WorkBox.Template.InviteInvolvedUserEmailSubject; EmailBody.Text = WorkBox.Template.InviteInvolvedUserEmailBody; OtherEmailSubject.Value = WorkBox.Template.InviteVisitingUserEmailSubject; OtherEmailBody.Value = WorkBox.Template.InviteVisitingUserEmailBody; teamsTaxonomy.InitialiseTaxonomyControl(TeamsToInviteControl, "Teams to invite", true); TeamsToInviteControl.Focus(); DisposeWorkBox(); } }
void PopulateControls() { if (!IsPostBack) { WBCollection collection = new WBCollection(SPContext.Current); WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); teams.InitialiseTaxonomyControl(SystemAdminTeams, "Select the System Admin Teams", true); SystemAdminTeams.Text = collection.SystemAdminTeams.UIControlValue; teams.InitialiseTaxonomyControl(BusinessAdminTeams, "Select the Business Admin Teams", true); BusinessAdminTeams.Text = collection.BusinessAdminTeams.UIControlValue; NameOfAllWorkBoxesList.Text = collection.ListName; if (collection.EventReceiversAdded) { EventReceiverStatus.Text = "<i>(Event receiver <b>has</b> been added)</i>"; } GenerateUniqueIds.Checked = collection.GenerateUniqueIDs; WorkBoxCollectionUniqueIdPrefix.Text = collection.UniqueIDPrefix; NumberOfDigitsInIds.Text = collection.NumberOfDigitsInIDs.ToString(); InitialIdOffset.Text = collection.InitialIDOffset.ToString(); CanAnyoneCreate.Checked = collection.CanAnyoneCreate; SysadminOpen.Text = collection.OpenPermissionLevelForSystemAdmin; AdminOpen.Text = collection.OpenPermissionLevelForBusinessAdmin; OwnerOpen.Text = collection.OpenPermissionLevelForOwner; InvolvedOpen.Text = collection.OpenPermissionLevelForInvolved; VisitorsOpen.Text = collection.OpenPermissionLevelForVisitors; EveryoneOpen.Text = collection.OpenPermissionLevelForEveryone; SysadminClosed.Text = collection.ClosedPermissionLevelForSystemAdmin; AdminClosed.Text = collection.ClosedPermissionLevelForBusinessAdmin; OwnerClosed.Text = collection.ClosedPermissionLevelForOwner; InvolvedClosed.Text = collection.ClosedPermissionLevelForInvolved; VisitorsClosed.Text = collection.ClosedPermissionLevelForVisitors; EveryoneClosed.Text = collection.ClosedPermissionLevelForEveryone; UseFolderAccessGroupsPattern.Checked = collection.UseFolderAccessGroupsPattern; FolderAccessGroupsPrefix.Text = collection.FolderAccessGroupsPrefix; FolderAccessGroupsFolderNames.Text = collection.FolderAccessGroupsFolderNames; FolderAccessGroupPermissionLevel.Text = collection.FolderAccessGroupPermissionLevel; AllFoldersAccessGroupPermissionLevel.Text = collection.AllFoldersAccessGroupPermissionLevel; NewWorkBoxDialogUrl.Text = collection.UrlForNewWorkBoxDialog; CreateNewWorkBoxText.Text = collection.CreateNewWorkBoxText; teams.InitialiseTaxonomyControl(DefaultOwningTeam, "Select the Default Owning Team", false); DefaultOwningTeam.Text = collection.DefaultOwningTeamUIControlValue; UsesLinkedCalendars.Checked = collection.UsesLinkedCalendars; ReturnUrl.Value = Request.QueryString["ReturnUrl"]; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WBFarm farm = WBFarm.Local; FarmInstance.DataSource = WBFarm.GetFarmInstances(); FarmInstance.DataBind(); FarmInstance.WBxSafeSetSelectedValue(farm.FarmInstance); ProtectedRecordsLibraryURL.Text = farm.ProtectedRecordsLibraryUrl; PublicRecordsLibraryURL.Text = farm.PublicRecordsLibraryUrl; PublicExtranetRecordsLibraryURL.Text = farm.PublicExtranetRecordsLibraryUrl; TeamSitesSiteCollectionURL.Text = farm.TeamSitesSiteCollectionUrl; WBLogging.Debug("Got here"); WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); if (teams == null) { WBLogging.Debug("teams was null"); } WBTeam systemAdminTeam = farm.SystemAdminTeam(teams); if (systemAdminTeam != null) { SystemAdminTeam.Text = systemAdminTeam.FullPath; } else { WBLogging.Debug("systemAdminTeam was null"); SystemAdminTeam.Text = ""; } // SystemAdminTeam.Text = farm.SystemAdminTeamGUIDString; OpenWorkBoxesCachedDetailsListURL.Text = farm.OpenWorkBoxesCachedDetailsListUrl; RecordsManagersGroupName.Text = farm.RecordsManagersGroupName; RecordsSystemAdminGroupName.Text = farm.RecordsSystemAdminGroupName; TimerJobsManagementSiteURL.Text = farm.TimerJobsManagementSiteUrl; TimerJobsServerName.Text = farm.TimerJobsServerName; AllWorkBoxCollections.Text = farm.AllWorkBoxCollectionsPropertyValue; TermStoreName.Text = farm.TermStoreName; TermStoreGroupName.Text = farm.TermStoreGroupName; DocumentContentTypeName.Text = farm.WorkBoxDocumentContentTypeName; RecordContentTypeName.Text = farm.WorkBoxRecordContentTypeName; SendErrorReportsTo.Text = farm.SendErrorReportEmailsTo; } }
protected void okButton_OnClick(object sender, EventArgs e) { WBFarm farm = WBFarm.Local; farm.FarmInstance = FarmInstance.SelectedValue; farm.ProtectedRecordsLibraryUrl = ProtectedRecordsLibraryURL.Text; farm.PublicRecordsLibraryUrl = PublicRecordsLibraryURL.Text; farm.PublicExtranetRecordsLibraryUrl = PublicExtranetRecordsLibraryURL.Text; farm.TeamSitesSiteCollectionUrl = TeamSitesSiteCollectionURL.Text; //farm.SystemAdminTeamGUIDString = SystemAdminTeam.Text; if (!String.IsNullOrEmpty(SystemAdminTeam.Text)) { WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); WBTeam systemAdminTeam = teams.GetSelectedTeam(SystemAdminTeam.Text); if (systemAdminTeam != null) { farm.SystemAdminTeamGUIDString = systemAdminTeam.Id.ToString(); } else { farm.SystemAdminTeamGUIDString = ""; } } else { farm.SystemAdminTeamGUIDString = ""; } farm.OpenWorkBoxesCachedDetailsListUrl = OpenWorkBoxesCachedDetailsListURL.Text; farm.RecordsManagersGroupName = RecordsManagersGroupName.Text; farm.RecordsSystemAdminGroupName = RecordsSystemAdminGroupName.Text; farm.TimerJobsManagementSiteUrl = TimerJobsManagementSiteURL.Text; farm.TimerJobsServerName = TimerJobsServerName.Text; farm.AllWorkBoxCollectionsPropertyValue = AllWorkBoxCollections.Text; farm.TermStoreName = TermStoreName.Text; farm.TermStoreGroupName = TermStoreGroupName.Text; farm.WorkBoxDocumentContentTypeName = DocumentContentTypeName.Text; farm.WorkBoxRecordContentTypeName = RecordContentTypeName.Text; farm.SendErrorReportEmailsTo = SendErrorReportsTo.Text; farm.Update(); SPUtility.Redirect("/applications.aspx", SPRedirectFlags.Static, Context); }
protected override void CreateChildControls() { WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); String selectedUserLoginName = Page.Request.QueryString["LoginName"]; if (!String.IsNullOrEmpty(selectedUserLoginName)) { selectedUser = SPContext.Current.Web.WBxEnsureUserOrNull(selectedUserLoginName); } TermCollection terms = teams.TermSet.Terms; if (ParentTeamsTerm != null && ParentTeamsTerm != "") { Term parentTerm = teams.GetSelectedTermByPath(ParentTeamsTerm); terms = parentTerm.Terms; } SPTreeView treeView = new SPTreeView(); TreeNodeStyle nodeStyle = new TreeNodeStyle(); treeView.NodeStyle.HorizontalPadding = new Unit(3); treeView.NodeStyle.CssClass = "wbf-team-tree-node"; this.Controls.Clear(); this.Controls.Add(treeView); if (UseTreeView) { treeView.ShowLines = true; treeView.Nodes.Clear(); PopulateTreeView(treeView.Nodes, teams, terms); } else { PopulateListView(teams, terms); } if (!displayingAnyTeams) { Literal noTeamsLiteral = new Literal(); noTeamsLiteral.Text = "<i>(You are not a member of such a team site yet. Contact the SharePoint champion in your area for more information)</i>"; this.Controls.Add(noTeamsLiteral); } }
protected void Page_Load(object sender, EventArgs e) { //SPSite site = SPContext.Current.Site; _subjectTags = WBTaxonomy.GetSubjectTags(SPContext.Current.Site); if (!IsPostBack) { TreeViewTermCollection collection = new TreeViewTermCollection(_subjectTags.TermSet); // Bind the data source to your collection tvAllSubjectTags.DataSource = collection; tvAllSubjectTags.DataBind(); var teamsTax = WBTaxonomy.GetTeams(SPContext.Current.Site); teamsTax.InitialiseTaxonomyControl(taxTeams, "Select team with permissions to edit this term and create children", true, false, this); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WBFarm farm = WBFarm.Local; if (!String.IsNullOrEmpty(farm.TermStoreName)) { try { WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); if (teams == null) { WBLogging.Debug("teams was null"); } WBTeam systemAdminTeam = farm.SystemAdminTeam(teams); if (systemAdminTeam != null) { AdminTeamSiteURL.Text = systemAdminTeam.TeamSiteUrl; } } catch (Exception exception) { WBLogging.Generic.HighLevel("Couldn't find the current admin team site URL: " + exception.Message); } } TimerJobsServerName.Text = farm.TimerJobsServerName; TermStoreName.Text = farm.TermStoreName; TermStoreGroupName.Text = farm.TermStoreGroupName; DocumentContentTypeName.Text = farm.WorkBoxDocumentContentTypeName; RecordContentTypeName.Text = farm.WorkBoxRecordContentTypeName; if (!String.IsNullOrEmpty(farm.TimerJobsManagementSiteUrl)) { DoInitialConfigStep.Text = "Check Configuration"; } } }
protected void Page_Load(object sender, EventArgs e) { webPart = this.Parent as ViewTeamsPublishedDocuments; recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); teamsTaxonomy = WBTaxonomy.GetTeams(recordsTypesTaxonomy); functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy); subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy); //RefreshBrowsableTreeView(); ShowResults.AllowSorting = true; ShowResults.Sorting += new GridViewSortEventHandler(ShowResults_Sorting); ShowResults.AllowPaging = true; ShowResults.PageIndexChanging += new GridViewPageEventHandler(ShowResults_PageIndexChanging); ShowResults.PagerSettings.Mode = PagerButtons.Numeric; ShowResults.PagerSettings.Position = PagerPosition.Bottom; ShowResults.PagerSettings.PageButtonCount = 50; ShowResults.PagerSettings.Visible = true; ShowResults.PageSize = 50; // this odd statement is required in order to get the pagination to work with an SPGridView! ShowResults.PagerTemplate = null; if (!IsPostBack) { // ViewSelector.DataSource = LibraryViews; // ViewSelector.DataBind(); //ProtectiveZoneFilterOptions = WBRecordsType.getProtectiveZones(); // ProtectiveZoneFilterOptions.Insert(0, ""); // FilterByProtectiveZone.DataSource = ProtectiveZoneFilterOptions; // FilterByProtectiveZone.DataBind(); SelectedView = VIEW_BY_FUNCTION_THEN_TYPE; RefreshBoundData(); } }
protected void Page_Load(object sender, EventArgs e) { SPSite site = SPContext.Current.Site; teams = WBTaxonomy.GetTeams(site); functionalAreas = WBTaxonomy.GetFunctionalAreas(teams); functionalAreas.InitialiseTaxonomyControl(TeamFunctionalAreas, "Select Functional Area(s)", true, false, this); if (!IsPostBack) { TreeViewTermCollection collection = new TreeViewTermCollection(); collection.Add(new TreeViewTerm(teams.TermSet)); // Bind the data source to your collection AllTeamsTreeView.DataSource = collection; AllTeamsTreeView.DataBind(); } }
/* Added by Steve Clements to support Add / Edit tag functionality */ /// <summary> /// Setup the properties for the add / edit buttons /// </summary> void SetupAddEditButtons(WBSubjectTag tag) { canEditOrCreate = false; if (tag == null) { return; } WBTaxonomy teamsTax = WBTaxonomy.GetTeams(SPContext.Current.Site); if (tag.TeamsWithPermissionToEdit(teamsTax).WBxContainsCurrentUserAsTeamMember()) { canEditOrCreate = true; // properties on the button var mmspath = String.Concat(webPart.RootSubjectTag, Request.QueryString["AdditionalPath"] ?? String.Empty); btnNewSubjectTag.Attributes.Add("data-mmspath", mmspath); btnEditSubjectTag.Attributes.Add("data-mmspath", mmspath); } }
protected override void CreateChildControls() { WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); team = WBTeam.GetFromTeamSite(teams, SPContext.Current); Literal literal = new Literal(); string html = ""; //html += tempStyling(); WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); TermCollection recordsClassesTerms = recordsTypes.TermSet.Terms; html += addWorkBoxesForRecordsClasses(recordsTypes, recordsClassesTerms); literal.Text = html; this.Controls.Add(literal); }
protected void Page_Load(object sender, EventArgs e) { teams = WBTaxonomy.GetTeams(SPContext.Current.Site); team = WBTeam.GetFromTeamSite(teams, SPContext.Current); if (team == null) { ErrorText.Text = "You do not appear to be viewing this form while on a team site."; return; } if (!team.IsCurrentUserTeamOwnerOrSystemAdmin()) { ErrorText.Text = "Only team owners or system admin can invite individuals to a team."; return; } if (!IsPostBack) { TeamName.Text = team.Name; InviteAsMember.Checked = true; InviteAsOwner.Checked = false; SendInviteEmail.Checked = true; SendAsOne.Checked = true; CCToYou.Checked = true; EmailSubject.Text = WBFarm.Local.InviteToTeamDefaultEmailSubject; EmailBody.Text = WBFarm.Local.InviteToTeamDefaultEmailBody; IndividualsToInviteControl.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { WBLogging.Generic.Verbose("In Page_Load for the public doc metadata dialog"); // Creating the taxonomy objects for later use: recordsTypeTaxonomy = WBTaxonomy.GetRecordsTypes(WorkBox.Site); teamsTaxonomy = WBTaxonomy.GetTeams(recordsTypeTaxonomy); seriesTagsTaxonomy = WBTaxonomy.GetSeriesTags(recordsTypeTaxonomy); subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(recordsTypeTaxonomy); functionalAreasTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypeTaxonomy); // If this is the initial call to the page then we need to load the basic details of the document we're publishing out: if (!IsPostBack) { ListGUID.Value = Request.QueryString["ListGUID"]; ItemID.Value = Request.QueryString["ItemID"]; // The following variable has its name due to a strange compliation error with the name 'DestinationType' TheDestinationType.Value = Request.QueryString["DestinationType"]; DestinationURL.Value = Request.QueryString["DestinationURL"]; DestinationTitle.Text = Request.QueryString["DestinationTitle"] + " (" + Request.QueryString["DestinationType"] + ")"; WBLogging.Generic.Verbose("DestinationType = " + TheDestinationType.Value); WBLogging.Generic.Verbose("DestinationURL = " + DestinationURL.Value); } // Now do a check that we do at this stage have the basic details of the document: if (ListGUID.Value == null || ListGUID.Value == "") { errorMessage += "ListGUID hasn't been set. "; } if (ItemID.Value == null || ItemID.Value == "") { errorMessage += "ItemID hasn't been set. "; } if (TheDestinationType.Value == null || TheDestinationType.Value == "") { errorMessage += "DestinationType hasn't been set. "; } if (errorMessage.Length > 0) { ErrorMessageLabel.Text = errorMessage; return; } // Let's clear out all of the error messages text fields: ErrorMessageLabel.Text = ""; RecordsTypeFieldMessage.Text = ""; FunctionalAreaFieldMessage.Text = ""; ProtectiveZoneMessage.Text = ""; ReferenceIDMessage.Text = ""; ReferenceDateMessage.Text = ""; SeriesTagFieldMessage.Text = ""; ScanDateMessage.Text = ""; OwningTeamFieldMessage.Text = ""; InvolvedTeamsFieldMessage.Text = ""; //OK so we have the basic identity information for the document being published out so let's get the document item: Guid sourceListGuid = new Guid(ListGUID.Value); SPDocumentLibrary sourceDocLib = (SPDocumentLibrary)WorkBox.Web.Lists[sourceListGuid]; sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value)); sourceFile = sourceDocAsItem.File; generatingFilename = WorkBox.RecordsType.GeneratePublishOutFilenames; // Now, if this is the first time we might need to load up the default metadata values for the document: if (!IsPostBack) { WorkBox.Web.AllowUnsafeUpdates = true; WorkBox.ApplyPublishOutDefaults(sourceDocAsItem); WorkBox.Web.AllowUnsafeUpdates = false; // Let's now re-load the item as it's name may have changed: sourceDocAsItem = null; sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value)); sourceFile = sourceDocAsItem.File; pageRenderingRequired = true; } else { WBLogging.Debug("Setting the subject tags: " + SubjectTagsField.Text); sourceDocAsItem.WBxSetMultiTermColumn(WorkBox.COLUMN_NAME__SUBJECT_TAGS, SubjectTagsField.Text); // If this is a post back - then let's check if the records type has been modified: if (NewRecordsTypeUIControlValue.Value != "") { WBLogging.Generic.Unexpected("The returned value was: " + NewRecordsTypeUIControlValue.Value); WBRecordsType oldRecordsType = sourceDocAsItem.WBxGetSingleTermColumn <WBRecordsType>(recordsTypeTaxonomy, WorkBox.COLUMN_NAME__RECORDS_TYPE); WBRecordsType newRecordsType = new WBRecordsType(recordsTypeTaxonomy, NewRecordsTypeUIControlValue.Value); RecordsTypeUIControlValue.Value = NewRecordsTypeUIControlValue.Value; RecordsType.Text = newRecordsType.Name; pageRenderingRequired = true; // These are now being done in CaptureAsDocument() // sourceDocAsItem.WBxSetSingleTermColumn(WorkBox.COLUMN_NAME__RECORDS_TYPE, NewRecordsTypeUIControlValue.Value); // sourceDocAsItem.WBxSet(WBColumn.Title, this.TitleField.Text); // This is now being done in CaptureAsDocument() // WorkBox.GenerateFilename(newRecordsType, sourceDocAsItem); // If either the old or new records type have an uneditable functional area, then we'll update it to the new default area. if (!oldRecordsType.IsFunctionalAreaEditable || !newRecordsType.IsFunctionalAreaEditable) { WBLogging.Debug("Setting the functional area as it's not editable: " + newRecordsType.DefaultFunctionalAreaUIControlValue); this.FunctionalAreaField.Text = newRecordsType.DefaultFunctionalAreaUIControlValue; sourceDocAsItem.WBxSetMultiTermColumn(WorkBox.COLUMN_NAME__FUNCTIONAL_AREA, newRecordsType.DefaultFunctionalAreaUIControlValue); } /* This is now being done in CaptureAsDocument() * else * { * WBLogging.Debug("Saving the current functional area selection: " + this.FunctionalAreaField.Text); * sourceDocAsItem.WBxSetMultiTermColumn(WorkBox.COLUMN_NAME__FUNCTIONAL_AREA, this.FunctionalAreaField.Text); * } */ WBDocument document = CaptureAsDocument(sourceDocAsItem, newRecordsType); document.Update(); // Let's now re-load the item as it's name may have changed: sourceDocAsItem = null; sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value)); sourceFile = sourceDocAsItem.File; } else { // Otherwise we are in a normal post back call. pageRenderingRequired = false; } } // Now load up some of the basic details: documentRecordsType = sourceDocAsItem.WBxGetSingleTermColumn <WBRecordsType>(recordsTypeTaxonomy, WorkBox.COLUMN_NAME__RECORDS_TYPE); destinationType = TheDestinationType.Value; // Which of the metadata fields are being used in the form (or will need to be processed in any postback) : showReferenceID = documentRecordsType.DocumentReferenceIDRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN; showReferenceDate = documentRecordsType.DocumentReferenceDateRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN; showSubjectTags = true; // documentRecordsType.DocumentSubjectTagsRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN; showSeriesTag = documentRecordsType.DocumentSeriesTagRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN; showScanDate = documentRecordsType.DocumentScanDateRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN; if (pageRenderingRequired) { renderPage(); } }
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); }
protected void okButton_OnClick(object sender, EventArgs e) { String errorMessage = "No error occurred"; try { WBCollection collection = new WBCollection(SPContext.Current); WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); collection.SystemAdminTeams = new WBTermCollection <WBTeam>(teams, SystemAdminTeams.Text); collection.BusinessAdminTeams = new WBTermCollection <WBTeam>(teams, BusinessAdminTeams.Text); // OK so first make sure that the event receiver is attached to the correct list collection.ListName = NameOfAllWorkBoxesList.Text; // OK so now to save the various other settings values: collection.UniqueIDPrefix = WorkBoxCollectionUniqueIdPrefix.Text; collection.GenerateUniqueIDs = GenerateUniqueIds.Checked; collection.NumberOfDigitsInIDs = Convert.ToInt32(NumberOfDigitsInIds.Text); collection.InitialIDOffset = Convert.ToInt32(InitialIdOffset.Text); collection.CanAnyoneCreate = CanAnyoneCreate.Checked; collection.OpenPermissionLevelForSystemAdmin = SysadminOpen.Text; collection.OpenPermissionLevelForBusinessAdmin = AdminOpen.Text; collection.OpenPermissionLevelForOwner = OwnerOpen.Text; collection.OpenPermissionLevelForInvolved = InvolvedOpen.Text; collection.OpenPermissionLevelForVisitors = VisitorsOpen.Text; collection.OpenPermissionLevelForEveryone = EveryoneOpen.Text; collection.ClosedPermissionLevelForSystemAdmin = SysadminClosed.Text; collection.ClosedPermissionLevelForBusinessAdmin = AdminClosed.Text; collection.ClosedPermissionLevelForOwner = OwnerClosed.Text; collection.ClosedPermissionLevelForInvolved = InvolvedClosed.Text; collection.ClosedPermissionLevelForVisitors = VisitorsClosed.Text; collection.ClosedPermissionLevelForEveryone = EveryoneClosed.Text; collection.UseFolderAccessGroupsPattern = UseFolderAccessGroupsPattern.Checked; collection.FolderAccessGroupsPrefix = FolderAccessGroupsPrefix.Text; collection.FolderAccessGroupsFolderNames = FolderAccessGroupsFolderNames.Text; collection.FolderAccessGroupPermissionLevel = FolderAccessGroupPermissionLevel.Text; collection.AllFoldersAccessGroupPermissionLevel = AllFoldersAccessGroupPermissionLevel.Text; collection.UrlForNewWorkBoxDialog = NewWorkBoxDialogUrl.Text; collection.CreateNewWorkBoxText = CreateNewWorkBoxText.Text; collection.DefaultOwningTeamUIControlValue = DefaultOwningTeam.Text; collection.UsesLinkedCalendars = UsesLinkedCalendars.Checked; collection.Update(); } catch (Exception exception) { WBLogging.WorkBoxCollections.Unexpected(exception.StackTrace); SPUtility.TransferToErrorPage("An exception occurred : " + exception.StackTrace, "Return to site settings page", "/_layouts/settings.aspx"); } if (String.IsNullOrEmpty(ReturnUrl.Value)) { SPUtility.Redirect("settings.aspx", SPRedirectFlags.RelativeToLayoutsPage, Context); } else { SPUtility.Redirect(ReturnUrl.Value, SPRedirectFlags.Static, Context); } }
protected void Page_Load(object sender, EventArgs e) { webPart = this.Parent as ViewRecordsLibraryWebPart; recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); teamsTaxonomy = WBTaxonomy.GetTeams(recordsTypesTaxonomy); functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy); subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy); if (!IsPostBack) { // ViewSelector.DataSource = LibraryViews; // ViewSelector.DataBind(); ProtectiveZoneFilterOptions = WBRecordsType.getProtectiveZones(); ProtectiveZoneFilterOptions.Insert(0, ""); FilterByProtectiveZone.DataSource = ProtectiveZoneFilterOptions; FilterByProtectiveZone.DataBind(); string selectedView = webPart.RecordsLibraryView; if (!String.IsNullOrEmpty(Request.QueryString["FolderPath"])) { selectedView = VIEW_BY_FOLDER_PATH; SelectedNodePath = Request.QueryString["FolderPath"]; } if (String.IsNullOrEmpty(selectedView)) { selectedView = VIEW_BY_RECORDS_TYPE; } SelectedViewTitle.Text = selectedView; SelectedView = selectedView; } RefreshBrowsableTreeView(); ShowResults.AllowSorting = true; ShowResults.Sorting += new GridViewSortEventHandler(ShowResults_Sorting); ShowResults.AllowPaging = true; ShowResults.PageIndexChanging += new GridViewPageEventHandler(ShowResults_PageIndexChanging); ShowResults.PagerSettings.Mode = PagerButtons.Numeric; ShowResults.PagerSettings.Position = PagerPosition.Bottom; ShowResults.PagerSettings.PageButtonCount = 50; ShowResults.PagerSettings.Visible = true; ShowResults.PageSize = 50; // this odd statement is required in order to get the pagination to work with an SPGridView! ShowResults.PagerTemplate = null; if (SelectedView == VIEW_BY_FOLDER_PATH) { RefreshBoundData(); } }
private void RefreshBoundDocumentsList() { WBFarm farm = WBFarm.Local; // SC if (String.IsNullOrEmpty(farm.ProtectedRecordsLibraryUrl)) { return; } bool foundDocuments = false; using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { WBTaxonomy subjectTags = WBTaxonomy.GetSubjectTags(site); WBTaxonomy teamsTaxonomy = WBTaxonomy.GetTeams(subjectTags); WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(teamsTaxonomy); Term pageSeriesTagTerm = subjectTags.GetSelectedTermByPath(FullSubjectTagPath); WBTerm localPageSubjectTag = null; if (pageSeriesTagTerm != null) { localPageSubjectTag = new WBTerm(subjectTags, pageSeriesTagTerm); } if (localPageSubjectTag != null) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag); subjectTagClause.UseDescendants = false; query.AddClause(subjectTagClause); if (webPart.OnlyLiveRecords) { WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddClause(isLiveClause); } else { string statusFilter = SelectedLiveOrArchivedStatusFilter; if (statusFilter == null || statusFilter == "") { statusFilter = WBColumn.LIVE_OR_ARCHIVED__LIVE; } if (statusFilter != "All") { query.AddEqualsFilter(WBColumn.LiveOrArchived, statusFilter); } FilterLiveStatus.CssClass = "wbf-unselected-filter"; FilterArchivedStatus.CssClass = "wbf-unselected-filter"; FilterAllStatus.CssClass = "wbf-unselected-filter"; if (statusFilter == WBColumn.LIVE_OR_ARCHIVED__LIVE) { FilterLiveStatus.CssClass = "wbf-selected-filter"; } if (statusFilter == WBColumn.LIVE_OR_ARCHIVED__ARCHIVED) { FilterArchivedStatus.CssClass = "wbf-selected-filter"; } if (statusFilter == "All") { FilterAllStatus.CssClass = "wbf-selected-filter"; } } WBTeam team = null; if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam)) { team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam); if (team != null) { query.AddEqualsFilter(WBColumn.OwningTeam, team); } } if (webPart.ShowRecordTypes && !String.IsNullOrEmpty(recordsTypeFullPath) && recordsTypeFullPath != NO_RECORDS_TYPE_SELECTED) { WBRecordsType recordsTypeToFilterBy = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypeFullPath); if (recordsTypeToFilterBy != null) { query.AddEqualsFilter(WBColumn.RecordsType, recordsTypeToFilterBy); } } /* * string protectiveZoneFilter = "Public"; // Request.QueryString["ProtectiveZone"]; * if (protectiveZoneFilter != null && protectiveZoneFilter != "") * { * query.AddEqualsFilter(WBColumn.ProtectiveZone, protectiveZoneFilter); * } * */ query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.TitleOrName); query.AddViewColumn(WBColumn.FileSize); query.AddViewColumn(WBColumn.FileTypeIcon); query.AddViewColumn(WBColumn.FileType); query.AddViewColumn(WBColumn.DisplayFileSize); query.AddViewColumn(WBColumn.EncodedAbsoluteURL); query.AddViewColumn(WBColumn.LiveOrArchived); query.AddViewColumn(WBColumn.RecordID); // query.AddViewColumn(WBColumn.OwningTeam); query.AddViewColumn(WBColumn.ReferenceDate); // query.AddViewColumn(WBColumn.ReferenceID); // query.AddViewColumn(WBColumn.SeriesTag); // query.AddViewColumn(WBColumn.ProtectiveZone); //query.AddViewColumn(WBColumn.DeclaredRecord); // query.AddViewColumn(WBColumn.SubjectTags); if (sortColumn == null) { sortColumn = WBColumn.ReferenceDate; ascending = false; } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query); if (dataTable.Rows.Count > 0) { foundDocuments = true; } DocumentsForSubject.DataSource = dataTable; DocumentsForSubject.Columns.Clear(); DocumentsForSubject.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); DocumentsForSubject.Columns.Add(WBUtils.HyperLinkField(WBColumn.TitleOrName, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.FileType, sortColumn, ascending)); DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.DisplayFileSize, sortColumn, ascending)); if (!webPart.OnlyLiveRecords) { DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.LiveOrArchived, sortColumn, ascending)); } DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending)); SPGroup rmManagersGroup = SPContext.Current.Web.WBxGetGroupOrNull(WBFarm.Local.RecordsManagersGroupName); if (rmManagersGroup != null) { if (rmManagersGroup.ContainsCurrentUser) { List <WBColumn> valueColumns = new List <WBColumn>(); valueColumns.Add(WBColumn.RecordID); String formatString = SPContext.Current.Web.Url + "/_layouts/WorkBoxFramework/UpdateRecordsMetadata.aspx?RecordID={0}"; formatString = "<a href=\"javascript: WorkBoxFramework_commandAction('" + formatString + "', 800, 600); \">(edit metadata)</a>"; DocumentsForSubject.Columns.Add(WBUtils.FormatStringTemplateField(formatString, valueColumns)); } } DocumentsForSubject.DataBind(); } } else { WBUtils.logMessage("pageSubjectTag was null"); } } if (foundDocuments && !webPart.OnlyLiveRecords) { showFilters = true; } if (!foundDocuments && !foundChildSubjectTags && !(onRootOfAtoZ)) { int archivedDocs = 0; if (!webPart.OnlyLiveRecords) { if (SelectedLiveOrArchivedStatusFilter == WBColumn.LIVE_OR_ARCHIVED__LIVE) { archivedDocs = this.CountArchivedDocsOfThisSelection(); } showFilters = true; } if (archivedDocs > 0) { DynamicNoDocumentsMessage.Text = "(No live documents have been found. There are " + archivedDocs + " archived documents of this type.)"; } else { DynamicNoDocumentsMessage.Text = "(No documents have been found)"; } } else { DynamicNoDocumentsMessage.Text = ""; } // Show Related docs header if docs or message being displayed if (DocumentsForSubject.Rows.Count > 0 || !String.IsNullOrEmpty(DynamicNoDocumentsMessage.Text)) { h3RelatedDocs.Style.Add(HtmlTextWriterStyle.Display, "block"); } }
private void RefreshBoundData() { if (SelectedNodePath != "") { SelectedRecordsType.Text = SelectedNodePath.Replace("Records Types/", "").Replace("/", " / "); WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); WBTaxonomy teams = WBTaxonomy.GetTeams(recordsTypes); WBRecordsType recordsType = recordsTypes.GetSelectedRecordsType(SelectedNodePath); SelectedRecordsTypeDescription.Text = recordsType.Description; WBTeam team = WBTeam.GetFromTeamSite(teams, SPContext.Current.Web); WBFarm farm = WBFarm.Local; using (WBCollection collection = new WBCollection(recordsType.WorkBoxCollectionUrl)) { // using (SPWeb web = site.OpenWeb()) // { WBQuery query = new WBQuery(); WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = true; query.AddClause(recordsTypeClause); if (team != null) { query.AddEqualsFilter(WBColumn.InvolvedTeams, team); } string statusFilter = Request.QueryString["Status"]; if (statusFilter != null && statusFilter != "") { query.AddEqualsFilter(WBColumn.WorkBoxStatus, statusFilter); } query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.WorkBoxURL); query.AddViewColumn(WBColumn.OwningTeam); // query.AddViewColumn(WBColumn.FunctionalArea); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.ReferenceID); query.AddViewColumn(WBColumn.SeriesTag); // query.AddViewColumn(WBColumn.InvolvedTeams); query.AddViewColumn(WBColumn.WorkBoxStatus); if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } DataTable dataTable = collection.Query(query); ShowResults.DataSource = dataTable; ShowResults.Columns.Clear(); ShowResults.Columns.Add(WBUtils.FixedIconTemplateField(WorkBox.ICON_16_IMAGE_URL, WBColumn.WorkBoxURL)); ShowResults.Columns.Add(WBUtils.HyperLinkField(WBColumn.Title, WBColumn.WorkBoxURL, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, HorizontalAlign.Center, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceID, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.SeriesTag, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.InvolvedTeams, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxStatus, sortColumn, ascending)); ShowResults.DataBind(); // } } } else { WBUtils.logMessage("SelectedNodePath was empty"); } }
private void RefreshBoundData() { if (IsPostBack) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "TriggerUpdateFunction", "aspPanelHasUpdated();", true); } WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); WBTaxonomy teams = WBTaxonomy.GetTeams(recordsTypes); WBQuery query = new WBQuery(); query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.WorkBoxURL); // query.AddViewColumn(WBColumn.FunctionalArea); //query.AddViewColumn(WBColumn.ReferenceDate); //query.AddViewColumn(WBColumn.ReferenceID); //query.AddViewColumn(WBColumn.SeriesTag); // query.AddViewColumn(WBColumn.InvolvedTeams); //List<String> orderByColumnOptions = new List<String>(); //orderByColumnOptions.Add("Title"); checkSortState(); if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SelectedWorkBoxes.Columns.Clear(); SelectedWorkBoxes.Columns.Add(WBUtils.StatusIconTemplateField("24")); SelectedWorkBoxes.Columns.Add(WBUtils.HyperLinkField(WBColumn.Title, WBColumn.WorkBoxURL, sortColumn, ascending, "")); OrderBy.Items.Clear(); addColumnAsOption(OrderBy, WBColumn.Title); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, HorizontalAlign.Center, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceID, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.SeriesTag, sortColumn, ascending)); query.AddViewColumn(WBColumn.WorkBoxStatus); if (StatusCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxStatus, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.WorkBoxStatus); } string statusFilter = SelectedWorkBoxStatusFilter; if (statusFilter != "Any") { query.AddEqualsFilter(WBColumn.WorkBoxStatus, statusFilter); } query.AddViewColumn(WBColumn.RecordsType); if (RecordsTypeCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.RecordsType); } if (LastModifiedCheckBox.Checked) { query.AddViewColumn(WBColumn.WorkBoxDateLastModified); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxDateLastModified, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.WorkBoxDateLastModified); } if (LastVisitedCheckBox.Checked) { query.AddViewColumn(WBColumn.WorkBoxDateLastVisited); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxDateLastVisited, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.WorkBoxDateLastVisited); } if (DateCreatedCheckBox.Checked) { query.AddViewColumn(WBColumn.WorkBoxDateCreated); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxDateCreated, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.WorkBoxDateCreated); } if (ReferenceDateCheckBox.Checked) { query.AddViewColumn(WBColumn.ReferenceDate); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.ReferenceDate); } if (ReferenceIDCheckBox.Checked) { query.AddViewColumn(WBColumn.ReferenceID); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceID, HorizontalAlign.Center, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.ReferenceID); } query.AddViewColumn(WBColumn.OwningTeam); if (OwningTeamCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.OwningTeam); } query.AddViewColumn(WBColumn.InvolvedTeams); if (InvolvedTeamsCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.InvolvedTeams, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.InvolvedTeams); } query.AddViewColumn(WBColumn.VisitingTeams); if (VisitingTeamsCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.VisitingTeams, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.VisitingTeams); } query.AddViewColumn(WBColumn.InvolvedIndividuals); if (InvolvedIndividualsCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.InvolvedIndividuals, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.InvolvedIndividuals); } query.AddViewColumn(WBColumn.VisitingIndividuals); if (VisitingIndividualsCheckBox.Checked) { SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.VisitingIndividuals, sortColumn, ascending)); addColumnAsOption(OrderBy, WBColumn.VisitingIndividuals); } //OrderBy.DataSource = orderByColumnOptions; //OrderBy.DataBind(); OrderBy.WBxSafeSetSelectedValue(ViewState["SortExpression"].WBxToString()); WBRecordsType recordsType = null; WBTeam team = WBTeam.GetFromTeamSite(teams, SPContext.Current.Web); WBLogging.Generic.Unexpected("SelectedInvolvementFilter = " + SelectedInvolvementFilter); if (team != null) { switch (SelectedInvolvementFilter) { case FILTER_INVOLVEMENT__OWNS: { WBLogging.Debug("Adding a filter for OwningTeam"); query.AddEqualsFilter(WBColumn.OwningTeam, team); break; } case FILTER_INVOLVEMENT__INVOLVED: { WBLogging.Debug("Adding a filter for InvolvedTeams"); query.AddEqualsFilter(WBColumn.InvolvedTeams, team); break; } case FILTER_INVOLVEMENT__VISITING: { WBLogging.Debug("Adding a filter for VisitingTeams"); query.AddEqualsFilter(WBColumn.VisitingTeams, team); break; } } } if (SelectedRecordsTypeGUID != "") { recordsType = recordsTypes.GetRecordsType(new Guid(SelectedRecordsTypeGUID)); } if (recordsType != null) { String recordsTypePath = recordsType.FullPath; //recordsTypePath = recordsTypePath.Substring(1, recordsTypePath.Length - 1); recordsTypePath = recordsTypePath.Replace("/", " / "); RecordsTypeSelected.Text = recordsTypePath; RecordsTypeDescription.Text = recordsType.Description; WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = false; query.AddClause(recordsTypeClause); } else { RecordsTypeSelected.Text = "No records type selected"; RecordsTypeDescription.Text = ""; } String cachedDetailsListUrl = WBFarm.Local.OpenWorkBoxesCachedDetailsListUrl; // OK so this is a general 'recent' query using (SPWeb cacheWeb = SPContext.Current.Site.OpenWeb(cachedDetailsListUrl)) { SPList cacheList = cacheWeb.GetList(cachedDetailsListUrl); SPListItemCollection items = cacheList.WBxGetItems(SPContext.Current.Site, query); if (items.Count > 0) { StringBuilder html = new StringBuilder(); foreach (SPListItem item in items) { String status = item.WBxGetAsString(WBColumn.WorkBoxStatus); html.Append("<div class='wbf-icons-view-icon-panel'><div class='wbf-icons-view-icon'><a href='"); html.Append(item.WBxGetAsString(WBColumn.WorkBoxURL)).Append("'>").Append("<img src='").Append(WBUtils.StatusIconImageURL(status, "64")).Append("' alt='Work box icon for: ").Append(item.WBxGetAsString(WBColumn.Title).Replace('\'', ' ')).Append("' />").Append("</a></div><div class='wbf-icons-view-label'><a href='"); html.Append(item.WBxGetAsString(WBColumn.WorkBoxURL)).Append("'>").Append(item.WBxGetAsString(WBColumn.Title)).Append("</a></div></div>\n\n"); } IconViewLiteral.Text = html.ToString(); } else { IconViewLiteral.Text = "<p>" + NoWorkBoxesText + "</p>"; } DataTable dataTable = cacheList.WBxGetDataTable(SPContext.Current.Site, query); SelectedWorkBoxes.DataSource = dataTable; SelectedWorkBoxes.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { DialogTitle.Text = "An Error Occurred"; if (!WorkBox.CurrentUserIsOwner() && !WorkBox.CurrentUserIsBusinessAdmin() && !WorkBox.CurrentUserIsSystemAdmin()) { AreYouSureText.Text = "Only owners or admin can remove teams or individuals from having access to a work box."; RemoveButton.Enabled = false; return; } if (!IsPostBack) { TeamOrIndividual.Value = Request.QueryString["TeamOrIndividual"]; InvolvedOrVisiting.Value = Request.QueryString["InvolvedOrVisiting"]; if (TeamOrIndividual.Value == "Team") { GUIDOfTeamToRemove.Value = Request.QueryString["GUIDOfTeamToRemove"]; } if (TeamOrIndividual.Value == "Individual") { LoginNameOfUserToRemove.Value = Request.QueryString["LoginNameOfUserToRemove"]; } CancelButton.Focus(); } if (String.IsNullOrEmpty(TeamOrIndividual.Value)) { AreYouSureText.Text = "Error in the parameters sent to this dialog."; return; } AreYouSureText.Text = "Odd error in the parameters sent to this dialog."; if (TeamOrIndividual.Value == "Team" && !String.IsNullOrEmpty(GUIDOfTeamToRemove.Value)) { teams = WBTaxonomy.GetTeams(SPContext.Current.Site); team = teams.GetTeam(new Guid(GUIDOfTeamToRemove.Value)); if (!IsPostBack) { if (InvolvedOrVisiting.Value == "Involved") { DialogTitle.Text = "Remove Involved Team"; AreYouSureText.Text = "Are you sure you want to remove the following team from being involved with this work box?"; NameOfTeamOrIndividual.Text = "Removing involved team: <b>" + team.Name + "</b>"; } else { DialogTitle.Text = "Remove Visiting Team"; AreYouSureText.Text = "Are you sure you want to remove the following team from being able to visit this work box?"; NameOfTeamOrIndividual.Text = "Removing visiting team: <b>" + team.Name + "</b>"; } } } if (TeamOrIndividual.Value == "Individual" && !String.IsNullOrEmpty(LoginNameOfUserToRemove.Value)) { user = WorkBox.Web.WBxEnsureUserOrNull(LoginNameOfUserToRemove.Value); if (!IsPostBack) { if (InvolvedOrVisiting.Value == "Involved") { DialogTitle.Text = "Remove Involved Individual"; AreYouSureText.Text = "Are you sure you want to remove the following individual from being involved with this work box?"; NameOfTeamOrIndividual.Text = "Removing involved individual: <b>" + user.Name + "</b>"; } else { DialogTitle.Text = "Remove Visiting Individual"; AreYouSureText.Text = "Are you sure you want to remove the following individual from being able to visit this work box?"; NameOfTeamOrIndividual.Text = "Removing visiting individual: <b>" + user.Name + "</b>"; } } } if (!IsPostBack) { DisposeWorkBox(); } }
private Dictionary <String, String> FindRecordsTypesToList() { WBFarm farm = WBFarm.Local; Dictionary <String, String> typesToList = new Dictionary <String, String>(); using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { WBTaxonomy subjectTags = WBTaxonomy.GetSubjectTags(site); WBTaxonomy teamsTaxonomy = WBTaxonomy.GetTeams(subjectTags); WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(teamsTaxonomy); Term pageSeriesTagTerm = subjectTags.GetSelectedTermByPath(FullSubjectTagPath); WBTerm localPageSubjectTag = null; if (pageSeriesTagTerm != null) { localPageSubjectTag = new WBTerm(subjectTags, pageSeriesTagTerm); } if (localPageSubjectTag != null) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag); subjectTagClause.UseDescendants = false; query.AddClause(subjectTagClause); if (webPart.OnlyLiveRecords) { WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddClause(isLiveClause); } /* * else * { * string statusFilter = SelectedLiveOrArchivedStatusFilter; * if (statusFilter == null || statusFilter == "") statusFilter = WBColumn.LIVE_OR_ARCHIVED__LIVE; * if (statusFilter != "All") * { * query.AddEqualsFilter(WBColumn.LiveOrArchived, statusFilter); * } * } */ WBTeam team = null; if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam)) { team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam); if (team != null) { query.AddEqualsFilter(WBColumn.OwningTeam, team); } } query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.RecordsType); if (sortColumn == null) { sortColumn = WBColumn.ReferenceDate; ascending = false; } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; SPListItemCollection listOfFoundDocuments = recordsLibrary.WBxGetItems(site, query); foreach (SPListItem item in listOfFoundDocuments) { WBRecordsType recordsType = item.WBxGetSingleTermColumn <WBRecordsType>(recordsTypesTaxonomy, WBColumn.RecordsType); String justRecordsType = GetJustRecordsTypeName(recordsType.Name); if (!typesToList.ContainsKey(justRecordsType)) { typesToList.Add(justRecordsType, recordsType.FullPath); } } } } else { WBLogging.Debug("pageSubjectTag was null"); } } return(typesToList); }
protected void Page_Load(object sender, EventArgs e) { // Get the selected parameters: string recordsTypeGUID = Request.Params["recordsTypeGUID"]; string selectedWorkBoxCollectionURL = Request.Params["workBoxCollectionURL"]; string includeDocumentsFlag = Request.Params["includeDocuments"]; WBTaxonomy teams = WBTaxonomy.GetTeams(SPContext.Current.Site); WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(teams); WBTeam team = WBTeam.GetFromTeamSite(teams, SPContext.Current); if (recordsTypeGUID == null || recordsTypeGUID == "" || selectedWorkBoxCollectionURL == null || selectedWorkBoxCollectionURL == "" || team == null ) { InformationText.Text = "<span>Make a selection from the left to see work boxes of that type.</span>"; } else { Guid teamsTermGuid = team.Id; string teamsGUID = team.Id.ToString(); // Process the parameters: bool includeDocumentRecords = false; if (includeDocumentsFlag != null && includeDocumentsFlag != "") { includeDocumentRecords = includeDocumentsFlag.Equals(true.ToString()); } WBRecordsType recordsType = null; Guid selectedRecordsTypeTermGUID = new Guid(recordsTypeGUID); recordsType = recordsTypes.GetRecordsType(selectedRecordsTypeTermGUID); string infoText = "<div class='wbf-view-selected-records-type'>You have selected to view: <span 'wbf-records-type-name'>" + recordsType.Name + "</span></div>\n"; if (recordsType.Description != "") { infoText += "<div class='wbf-records-type-description'>" + recordsType.Description + "</div>"; } InformationText.Text = infoText; WBUtils.logMessage("Found the records type info: " + recordsType.Name); DataTable combinedData = createCombinedDataTable(); if (includeDocumentRecords) { WBUtils.logMessage("Records Library IS being included in search"); WBFarm farm = WBFarm.Local; // SPListItemCollection docResults = getResultsForList(farm.RecordsCenterUrl, farm.RecordsCenterRecordsLibraryName, team, recordsType); // addDocResultsToCombinedData(farm.RecordsCenterUrl, docResults, combinedData); } else { WBUtils.logMessage("Records Library is not being included in search"); } if (selectedWorkBoxCollectionURL != "") { using (WBCollection collection = new WBCollection(selectedWorkBoxCollectionURL)) { WBUtils.logMessage("A work box colleciton IS being included in search: " + selectedWorkBoxCollectionURL); SPListItemCollection workBoxResults = collection.QueryFilteredBy(team, recordsType, true); WBUtils.logMessage("Got back from query this num of results: " + workBoxResults.Count); addWorkBoxResultsToCombinedData(collection, workBoxResults, combinedData); if (recordsType.CanCurrentUserCreateWorkBoxForTeam(collection, team)) { string createNewURL = collection.GetUrlForNewDialog(recordsType, team); string createNewText = recordsType.CreateNewWorkBoxText; CreateNewWorkBoxLink.Text = "<a href=\"#\" onclick=\"javascript: WorkBoxFramework_commandAction('" + createNewURL + "', 730, 800);\">" + createNewText + "</a>"; } } } else { WBUtils.logMessage("No work box colleciton is being included in search"); } ShowCombinedResults.DataSource = combinedData; ShowCombinedResults.DataBind(); } }
private void RefreshBoundData() { if (SelectedWorkBoxView == VIEW__SELECTED_RECORDS_TYPE) { FilterOpenStatus.Enabled = true; FilterClosedStatus.Enabled = true; FilterAllStatus.Enabled = true; } else { FilterOpenStatus.Enabled = false; FilterClosedStatus.Enabled = false; FilterAllStatus.Enabled = false; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ClearHighlightedRecordsTypes", "$('a.ms-navitem').css('font-weight', 'normal');", true); } WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); WBTaxonomy teams = WBTaxonomy.GetTeams(recordsTypes); WBQuery query = new WBQuery(); query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.WorkBoxURL); //query.AddViewColumn(WBColumn.OwningTeam); // query.AddViewColumn(WBColumn.FunctionalArea); //query.AddViewColumn(WBColumn.ReferenceDate); //query.AddViewColumn(WBColumn.ReferenceID); //query.AddViewColumn(WBColumn.SeriesTag); // query.AddViewColumn(WBColumn.InvolvedTeams); query.AddViewColumn(WBColumn.WorkBoxStatus); checkSortState(); if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SelectedWorkBoxes.Columns.Clear(); SelectedWorkBoxes.Columns.Add(WBUtils.FixedIconTemplateField(WorkBox.ICON_16_IMAGE_URL, WBColumn.WorkBoxURL)); SelectedWorkBoxes.Columns.Add(WBUtils.HyperLinkField(WBColumn.Title, WBColumn.WorkBoxURL, sortColumn, ascending, "")); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, HorizontalAlign.Center, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceID, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.SeriesTag, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.InvolvedTeams, sortColumn, ascending)); switch (SelectedWorkBoxView) { case VIEW__RECENTLY_CREATED: { query.AddViewColumn(WBColumn.WorkBoxDateCreated); //query.AddViewColumn(WBColumn.RecordsType); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxDateCreated, HorizontalAlign.Center, sortColumn, ascending)); //SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, HorizontalAlign.Center, sortColumn, ascending)); break; } case VIEW__RECENTLY_MODIFIED: { query.AddViewColumn(WBColumn.WorkBoxDateLastModified); //query.AddViewColumn(WBColumn.RecordsType); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxDateLastModified, HorizontalAlign.Center, sortColumn, ascending)); //SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, HorizontalAlign.Center, sortColumn, ascending)); break; } case VIEW__RECENTLY_VISITED: { query.AddViewColumn(WBColumn.WorkBoxDateLastVisited); //query.AddViewColumn(WBColumn.RecordsType); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxDateLastVisited, HorizontalAlign.Center, sortColumn, ascending)); //SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, HorizontalAlign.Center, sortColumn, ascending)); break; } case VIEW__SELECTED_RECORDS_TYPE: { query.AddViewColumn(WBColumn.ReferenceDate); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, HorizontalAlign.Center, sortColumn, ascending)); break; } } SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxStatus, HorizontalAlign.Center, sortColumn, ascending)); WBRecordsType recordsType = null; WBTeam team = WBTeam.GetFromTeamSite(teams, SPContext.Current.Web); if (team != null) { switch (SelectedInvolvementFilter) { case FILTER_INVOLVEMENT__OWNS: { WBLogging.Debug("Adding a filter for OwningTeam"); query.AddEqualsFilter(WBColumn.OwningTeam, team); break; } case FILTER_INVOLVEMENT__INVOLVED: { WBLogging.Debug("Adding a filter for InvolvedTeams"); query.AddEqualsFilter(WBColumn.InvolvedTeams, team); break; } case FILTER_INVOLVEMENT__VISITING: { WBLogging.Debug("Adding a filter for VisitingTeams"); query.AddEqualsFilter(WBColumn.VisitingTeams, team); break; } } } if (SelectedWorkBoxView == VIEW__SELECTED_RECORDS_TYPE) { if (SelectedRecordsTypeGUID != "") { recordsType = recordsTypes.GetRecordsType(new Guid(SelectedRecordsTypeGUID)); } else if (!IsPostBack && !String.IsNullOrEmpty(webPart.InitialRecordsType)) { string initialRecordsTypePath = webPart.InitialRecordsType.Replace(" / ", "/").Trim(); recordsType = recordsTypes.GetSelectedRecordsType(initialRecordsTypePath); } if (recordsType != null) { String recordsTypePath = recordsType.FullPath; //recordsTypePath = recordsTypePath.Substring(1, recordsTypePath.Length - 1); recordsTypePath = recordsTypePath.Replace("/", " / "); SelectionTitle.Text = recordsTypePath; SelectionDescription.Text = recordsType.Description; WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = false; query.AddClause(recordsTypeClause); string statusFilter = SelectedWorkBoxStatusFilter; if (statusFilter != "All") { query.AddEqualsFilter(WBColumn.WorkBoxStatus, statusFilter); } try { using (WBCollection collection = new WBCollection(recordsType.WorkBoxCollectionUrl)) { DataTable dataTable = collection.Query(query); SelectedWorkBoxes.DataSource = dataTable; SelectedWorkBoxes.DataBind(); if (recordsType.CanCurrentUserCreateWorkBoxForTeam(collection, team)) { string createNewURL = collection.GetUrlForNewDialog(recordsType, team); string createNewText = recordsType.CreateNewWorkBoxText; CreateNewWorkBoxLink.Text = "<a href=\"#\" onclick=\"javascript: WorkBoxFramework_commandAction('" + createNewURL + "', 730, 800);\">" + createNewText + "</a>"; } else { CreateNewWorkBoxLink.Text = ""; } } } catch (Exception exception) { SelectedWorkBoxes.DataSource = null; SelectedWorkBoxes.DataBind(); SelectionDescription.Text = SelectionDescription.Text + "<p><em>(An exception occured when trying to query the work boxes for this records type!)</em></p>"; CreateNewWorkBoxLink.Text = ""; WBLogging.RecordsTypes.Unexpected("Exception occurred on a team site when trying to query the work boxes of records type: " + recordsTypePath, exception); } } else { WBUtils.logMessage("SelectedRecordsTypeGUID was empty"); } } else { String cachedDetailsListUrl = WBFarm.Local.OpenWorkBoxesCachedDetailsListUrl; // OK so this is a general 'recent' query using (SPWeb cacheWeb = SPContext.Current.Site.OpenWeb(cachedDetailsListUrl)) { SPList cacheList = cacheWeb.GetList(cachedDetailsListUrl); DataTable dataTable = cacheList.WBxGetDataTable(SPContext.Current.Site, query); SelectedWorkBoxes.DataSource = dataTable; SelectedWorkBoxes.DataBind(); CreateNewWorkBoxLink.Text = ""; SelectionTitle.Text = SelectedWorkBoxView + " Work Boxes"; SelectionDescription.Text = "Select a category from left hand tree navigation to list work boxes of that type."; } } // OK so now to check that the right filters are highlighted: ViewRecentlyCreated.CssClass = ""; ViewRecentlyModified.CssClass = ""; ViewRecentlyVisited.CssClass = ""; if (SelectedWorkBoxView == VIEW__RECENTLY_CREATED) { ViewRecentlyCreated.CssClass = "wbf-filter-selected"; } if (SelectedWorkBoxView == VIEW__RECENTLY_MODIFIED) { ViewRecentlyModified.CssClass = "wbf-filter-selected"; } if (SelectedWorkBoxView == VIEW__RECENTLY_VISITED) { ViewRecentlyVisited.CssClass = "wbf-filter-selected"; } FilterByOwns.CssClass = ""; FilterByInvolved.CssClass = ""; FilterByVisiting.CssClass = ""; if (SelectedInvolvementFilter == FILTER_INVOLVEMENT__OWNS) { FilterByOwns.CssClass = "wbf-filter-selected"; } if (SelectedInvolvementFilter == FILTER_INVOLVEMENT__INVOLVED) { FilterByInvolved.CssClass = "wbf-filter-selected"; } if (SelectedInvolvementFilter == FILTER_INVOLVEMENT__VISITING) { FilterByVisiting.CssClass = "wbf-filter-selected"; } FilterOpenStatus.CssClass = ""; FilterClosedStatus.CssClass = ""; FilterAllStatus.CssClass = ""; if (SelectedWorkBoxStatusFilter == "Open") { FilterOpenStatus.CssClass = "wbf-filter-selected"; } if (SelectedWorkBoxStatusFilter == "Closed") { FilterClosedStatus.CssClass = "wbf-filter-selected"; } if (SelectedWorkBoxStatusFilter == "All") { FilterAllStatus.CssClass = "wbf-filter-selected"; } }
private void BuildListOfAllowedTerms() { WBFarm farm = WBFarm.Local; using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { WBTaxonomy subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(site); WBTaxonomy teamsTaxonomy = WBTaxonomy.GetTeams(subjectTagsTaxonomy); Term pageSeriesTagTerm = subjectTagsTaxonomy.GetSelectedTermByPath(FullSubjectTagPath); WBTerm localPageSubjectTag = null; if (pageSeriesTagTerm != null) { localPageSubjectTag = new WBTerm(subjectTagsTaxonomy, pageSeriesTagTerm); } if (localPageSubjectTag != null) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); //WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag); //subjectTagClause.UseDescendants = true; //query.AddClause(subjectTagClause); if (webPart.OnlyLiveRecords) { WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddClause(isLiveClause); } WBTeam team = null; if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam)) { team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam); if (team != null) { query.AddEqualsFilter(WBColumn.OwningTeam, team); } } /* * string protectiveZoneFilter = "Public"; // Request.QueryString["ProtectiveZone"]; * if (protectiveZoneFilter != null && protectiveZoneFilter != "") * { * query.AddEqualsFilter(WBColumn.ProtectiveZone, protectiveZoneFilter); * } * */ query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.SubjectTags); SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; SPListItemCollection documents = recordsLibrary.WBxGetItems(site, query); WBLogging.Debug("Got documents back"); WBLogging.Debug("Documents contains " + documents.Count + " items"); foreach (SPListItem document in documents) { WBTermCollection <WBTerm> subjectTags = document.WBxGetMultiTermColumn <WBTerm>(subjectTagsTaxonomy, WBColumn.SubjectTags.DisplayName); foreach (WBTerm subjectTag in subjectTags) { string fullPath = subjectTag.FullPath; if (allUsedTerms.Contains(fullPath)) { WBLogging.Debug("Already has term: " + fullPath + " so not adding"); } else { WBLogging.Debug("Adding to list of allowed terms: " + fullPath); this.allUsedTerms.Add(fullPath); while (fullPath.Contains("/")) { int lastIndex = fullPath.LastIndexOf('/'); fullPath = fullPath.Substring(0, lastIndex); if (allUsedTerms.Contains(fullPath)) { WBLogging.Debug("Already has term: " + fullPath + " so not adding"); fullPath = ""; } else { allUsedTerms.Add(fullPath); } } } } } } } else { WBUtils.logMessage("pageSubjectTag was null"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { StringBuilder html = new StringBuilder(); WBFarm farm = WBFarm.Local; teams = WBTaxonomy.GetTeams(SPContext.Current.Site); team = WBTeam.GetFromTeamSite(teams, SPContext.Current); if (team == null) { ErrorText.Text = "You do not appear to be viewing this form while on a team site."; return; } if (!WBFarm.Local.IsCurrentUserSystemAdmin()) { ErrorText.Text = "Only team owners or system admin can invite individuals to a team."; return; } List <List <String> > tableColumnThenRow = new List <List <String> >(); // First we're going to add the list of group members on the team sites site collection: // Note that we're actually assuming here that the web part is being used on the teams sites site collection! SPGroup fromGroup = team.MembersGroup(SPContext.Current.Site); List <String> column = new List <String>(); foreach (SPUser user in fromGroup.Users) { column.Add(user.Name); } column.Sort(); column.Insert(0, farm.TeamSitesSiteCollectionUrl); tableColumnThenRow.Add(column); String groupName = team.MembersGroupName; html.Append("<p>Checking synchronisation of team : <b>").Append(team.Name).Append("</b></p>"); html.Append("<p>The underlying SharePoint group is : <b>").Append(groupName).Append("</b></p>"); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(farm.TimerJobsManagementSiteUrl)) using (SPWeb web = site.OpenWeb()) { SPList dailyJobs = web.Lists[WBTimerTasksJob.DAILY_TIMER_TASKS__LIST_NAME]; SPView inOrderToExecute = dailyJobs.Views[WBTimerTasksJob.DAILY_TIMER_TASKS__ORDERED_VIEW_NAME]; foreach (SPListItem task in dailyJobs.GetItems(inOrderToExecute)) { string command = task.WBxGetColumnAsString(WBTimerTask.COLUMN_NAME__COMMAND); string targetUrl = task.WBxGetColumnAsString(WBTimerTask.COLUMN_NAME__TARGET_URL); string argument1 = task.WBxGetColumnAsString(WBTimerTask.COLUMN_NAME__ARGUMENT_1); if (command == WBTimerTask.COMMAND__SYNCHRONISE_ALL_TEAMS) { // Create a new column object: column = new List <String>(); try { using (SPSite toSite = new SPSite(targetUrl)) { toSite.AllowUnsafeUpdates = true; toSite.RootWeb.AllowUnsafeUpdates = true; SPGroup toGroup = WBUtils.SyncSPGroup(SPContext.Current.Site, toSite, groupName); foreach (SPUser user in toGroup.Users) { column.Add(user.Name); } column.Sort(); } } catch (Exception exception) { WBLogging.Teams.Unexpected("Something went wrong when trying to add a set of users to " + groupName + " on site collection " + targetUrl, exception); column.Add("Exception: " + exception.Message); } // First row in all columns is the URL of the site collection: column.Insert(0, targetUrl); tableColumnThenRow.Add(column); } } } }); html.Append("\n<table width='100%' cellpadding='2px' cellspacing='5px'>\n"); int columns = tableColumnThenRow.Count; bool foundValues = true; html.Append("<tr>\n"); for (int columnIndex = 0; columnIndex < columns; columnIndex++) { html.Append("<th>").Append(tableColumnThenRow[columnIndex][0]).Append("</th>"); } html.Append("</tr>\n"); int rowIndex = 1; while (foundValues) { foundValues = false; html.Append("<tr>\n"); for (int columnIndex = 0; columnIndex < columns; columnIndex++) { if (tableColumnThenRow[columnIndex].Count > rowIndex) { html.Append("<td>").Append(tableColumnThenRow[columnIndex][rowIndex]).Append("</td>"); foundValues = true; } else { html.Append("<td></td>"); } } html.Append("</tr>\n"); rowIndex++; } html.Append("</table>\n"); TeamSyncInformation.Text = html.ToString(); } }
private void RefreshBoundData() { if (!String.IsNullOrEmpty(SelectedRecordsTypeGUID)) { WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); WBTaxonomy teams = WBTaxonomy.GetTeams(recordsTypes); WBRecordsType recordsType = recordsTypes.GetRecordsType(new Guid(SelectedRecordsTypeGUID)); String recordsTypePath = recordsType.FullPath; //recordsTypePath = recordsTypePath.Substring(1, recordsTypePath.Length - 1); recordsTypePath = recordsTypePath.Replace("/", " / "); SelectionTitle.Text = recordsTypePath; SelectionDescription.Text = recordsType.Description; WBTeam team = WBTeam.GetFromTeamSite(teams, SPContext.Current.Web); WBFarm farm = WBFarm.Local; using (WBCollection collection = new WBCollection(recordsType.WorkBoxCollectionUrl)) { // using (SPWeb web = site.OpenWeb()) // { WBQuery query = new WBQuery(); WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = false; query.AddClause(recordsTypeClause); if (team != null) { query.AddEqualsFilter(WBColumn.InvolvedTeams, team); } string statusFilter = SelectedWorkBoxStatusFilter; if (statusFilter == null || statusFilter == "") statusFilter = "Open"; if (statusFilter != "All") { query.AddEqualsFilter(WBColumn.WorkBoxStatus, statusFilter); } FilterOpenStatus.CssClass = "wbf-unselected-filter"; FilterClosedStatus.CssClass = "wbf-unselected-filter"; FilterAllStatus.CssClass = "wbf-unselected-filter"; if (statusFilter == "Open") FilterOpenStatus.CssClass = "wbf-selected-filter"; if (statusFilter == "Closed") FilterClosedStatus.CssClass = "wbf-selected-filter"; if (statusFilter == "All") FilterAllStatus.CssClass = "wbf-selected-filter"; query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.WorkBoxURL); //query.AddViewColumn(WBColumn.OwningTeam); // query.AddViewColumn(WBColumn.FunctionalArea); query.AddViewColumn(WBColumn.ReferenceDate); //query.AddViewColumn(WBColumn.ReferenceID); //query.AddViewColumn(WBColumn.SeriesTag); // query.AddViewColumn(WBColumn.InvolvedTeams); query.AddViewColumn(WBColumn.WorkBoxStatus); if (sortColumn != null) query.OrderBy(sortColumn, ascending); DataTable dataTable = collection.Query(query); SelectedWorkBoxes.DataSource = dataTable; SelectedWorkBoxes.Columns.Clear(); SelectedWorkBoxes.Columns.Add(WBUtils.FixedIconTemplateField(WorkBox.ICON_16_IMAGE_URL, WBColumn.WorkBoxURL)); SelectedWorkBoxes.Columns.Add(WBUtils.HyperLinkField(WBColumn.Title, WBColumn.WorkBoxURL, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, HorizontalAlign.Center, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceID, sortColumn, ascending)); // SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.SeriesTag, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.InvolvedTeams, sortColumn, ascending)); SelectedWorkBoxes.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxStatus, sortColumn, ascending)); SelectedWorkBoxes.DataBind(); if (recordsType.CanCurrentUserCreateWorkBoxForTeam(collection, team)) { string createNewURL = collection.GetUrlForNewDialog(recordsType, team); string createNewText = recordsType.CreateNewWorkBoxText; CreateNewWorkBoxLink.Text = "<a href=\"#\" onclick=\"javascript: WorkBoxFramework_commandAction('" + createNewURL + "', 730, 800);\">" + createNewText + "</a>"; } else { CreateNewWorkBoxLink.Text = ""; } // } } } else { WBUtils.logMessage("SelectedRecordsTypeGUID was empty"); } }
/// <summary> /// Initialise the form /// </summary> void BindForm() { if (String.IsNullOrEmpty(_path)) { return; } SPSecurity.RunWithElevatedPrivileges(() => { using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.ID)) { WBTaxonomy subjectTags = WBTaxonomy.GetSubjectTags(elevatedSite); Term rootSubjectTagTerm = subjectTags.GetSelectedTermByPath(_path); WBSubjectTag subjectTag = null; if (rootSubjectTagTerm != null) { subjectTag = new WBSubjectTag(subjectTags, rootSubjectTagTerm); if (subjectTag == null) { return; } } // DOes the current user have permission? WBTaxonomy teamsTax = WBTaxonomy.GetTeams(elevatedSite); if (!subjectTag.TeamsWithPermissionToEdit(teamsTax).WBxContainsCurrentUserAsTeamMember()) { Response.Redirect("AccessDenied.html"); } if (!CreateNew) // Edit Mode { txtTagName.Text = subjectTag.Name; txtTagName.ReadOnly = true; // To support existing terms where content is stored in the description, first attempt to read from the the multi-property array Page Content, // then fall back to the description. Changes will be saved to the multi-property array. if (String.IsNullOrEmpty(subjectTag.PageContent)) { htmlDescription.Field.Html = subjectTag.Description; } else { htmlDescription.Field.Html = subjectTag.PageContent; } ppInternalContact.WBxInitialise(subjectTag.InternalContact(SPContext.Current.Web)); // It's an option to use the RootWeb of the elevated site here, I have used SPContext for consistency htmlExternalContact.Field.Html = subjectTag.ExternalContact; // Added this due to issue with the Html editor in IE in a modal dialog! If the value is null, you cannot click in to start editing. if (String.IsNullOrEmpty(htmlExternalContact.Field.Html)) { htmlExternalContact.Field.Html = " "; } if (String.IsNullOrEmpty(htmlDescription.Field.Html)) { htmlDescription.Field.Html = " "; } } else { // Nothing to do if creating a new child term } } }); }
protected void Page_Load(object sender, EventArgs e) { string relatedWorkBoxUrl = ""; string recordsTypeGUIDString = ""; // Set the reference date control to match the locally set locale: ReferenceDate.LocaleId = SPContext.Current.Web.Locale.LCID; recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); teams = WBTaxonomy.GetTeams(recordsTypes); seriesTags = WBTaxonomy.GetSeriesTags(recordsTypes); functionalAreas = WBTaxonomy.GetFunctionalAreas(recordsTypes); if (!IsPostBack) { WorkBoxCollectionUrl.Value = Request.QueryString["workBoxCollectionUrl"]; pageRenderingRequired = true; recordsTypeGUIDString = Request.QueryString["recordsTypeGUID"]; RecordsTypeGUID.Value = recordsTypeGUIDString; if (recordsTypeGUIDString != "") { workBoxRecordsType = recordsTypes.GetRecordsType(new Guid(recordsTypeGUIDString)); } else { WBLogging.Generic.Unexpected("The records type GUID appears to be blank in initial call to page!"); } // Now to setup some default intiail values: ReferenceDate.SelectedDate = DateTime.Now; functionalAreaFieldIsEditable = workBoxRecordsType.IsFunctionalAreaEditable; string owningTeamGuidString = Request.QueryString["owningTeamGUID"]; WBTeam owningTeam = null; if (owningTeamGuidString != null && !owningTeamGuidString.Equals("")) { owningTeam = teams.GetTeam(new Guid(owningTeamGuidString)); OwningTeamField.Text = owningTeam.Name; // UIControlValue; OwningTeamUIControlValue.Value = owningTeam.UIControlValue; InvolvedTeamsField.Text = owningTeam.UIControlValue; } relatedWorkBoxUrl = Request.QueryString["relatedWorkBoxURL"]; RelatedWorkBoxUrl.Value = relatedWorkBoxUrl; RelationType.Value = Request.QueryString["relationType"]; if (relatedWorkBoxUrl != null && relatedWorkBoxUrl != "") { relatedWorkBox = new WorkBox(relatedWorkBoxUrl); ReferenceID.Text = relatedWorkBox.ReferenceID; WBTerm seriesTag = relatedWorkBox.SeriesTag(seriesTags); if (seriesTag != null) { seriesTagInitialValue = seriesTag.UIControlValue; } owningTeam = relatedWorkBox.OwningTeam; OwningTeamField.Text = owningTeam.Name; // UIControlValue; OwningTeamUIControlValue.Value = owningTeam.UIControlValue; InvolvedTeamsField.Text = relatedWorkBox.InvolvedTeams.UIControlValue; } // Now let's setup the initial value for the functional area: if (functionalAreaFieldIsEditable) { functionalAreaInitialValue = workBoxRecordsType.DefaultFunctionalAreaUIControlValue; if (functionalAreaInitialValue == null || functionalAreaInitialValue == "") { if (owningTeam != null) { functionalAreaInitialValue = owningTeam.FunctionalArea(functionalAreas).UIControlValue; } } } else { functionalAreaInitialValue = workBoxRecordsType.DefaultFunctionalAreaUIControlValue; } } else { WBUtils.logMessage("In the postback with workBoxCollectionUrl = " + WorkBoxCollectionUrl.Value); pageRenderingRequired = false; relatedWorkBoxUrl = RelatedWorkBoxUrl.Value; recordsTypeGUIDString = RecordsTypeGUID.Value; if (recordsTypeGUIDString != "") { workBoxRecordsType = recordsTypes.GetRecordsType(new Guid(recordsTypeGUIDString)); } else { WBLogging.Generic.Unexpected("The records type GUID appears to be blank in postback!"); } } if (pageRenderingRequired) { renderPage(); } }