private void RefreshBoundData() { if (SelectedNodePath != "") { SPGroup rmManagersGroup = SPContext.Current.Web.WBxGetGroupOrNull(WBFarm.Local.RecordsManagersGroupName); if (rmManagersGroup != null) { if (rmManagersGroup.ContainsCurrentUser) { currentUserIsRecordsManager = true; WBLogging.Debug("Set the current user as being a records manager."); } else { WBLogging.Debug("The current user is not a part of the RM Managers group called: " + WBFarm.Local.RecordsManagersGroupName); } } else { WBLogging.Debug("Could not find the RM Managers group called: " + WBFarm.Local.RecordsManagersGroupName); } SelectedRecordsType.Text = SelectedNodePath.Replace("Records Types/", "").Replace("/", " / "); WBRecordsType recordsType = null; WBTerm functionalArea = null; WBTerm subjectTag = null; switch (SelectedView) { case VIEW_BY_RECORDS_TYPE: { recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(SelectedNodePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } case VIEW_BY_FUNCTION_THEN_TYPE: { string[] parts = SelectedNodePath.Split('/'); if (parts.Length < 3) { break; } string functionPath = parts[0]; List <String> partsList = new List <String>(parts); partsList.RemoveAt(0); string recordsTypePath = String.Join("/", partsList.ToArray()); Term functionalAreaTerm = functionalAreaTaxonomy.GetSelectedTermByPath(functionPath); if (functionalAreaTerm != null) { functionalArea = new WBTerm(functionalAreaTaxonomy, functionalAreaTerm); } recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } case VIEW_BY_SUBJECT: { Term subjectTagsTerm = subjectTagsTaxonomy.GetSelectedTermByPath(SelectedNodePath); if (subjectTagsTerm != null) { subjectTag = new WBTerm(subjectTagsTaxonomy, subjectTagsTerm); SelectedRecordsTypeDescription.Text = subjectTag.Description; } if (subjectTag == null) { WBLogging.Generic.Verbose("Did not find subject with path: " + SelectedNodePath); return; } break; } case VIEW_BY_FOLDER_PATH: { string[] parts = SelectedNodePath.Split('/'); if (parts.Length < 3) { break; } string functionPath = parts[0]; List <String> recordsTypePartsList = new List <String>(); recordsTypePartsList.Add(parts[1]); recordsTypePartsList.Add(parts[2]); string recordsTypePath = String.Join("/", recordsTypePartsList.ToArray()); Term functionalAreaTerm = functionalAreaTaxonomy.GetSelectedTermByPath(functionPath); if (functionalAreaTerm != null) { functionalArea = new WBTerm(functionalAreaTaxonomy, functionalAreaTerm); } recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } default: return; } WBTeam team = WBTeam.GetFromTeamSite(teamsTaxonomy, SPContext.Current.Web); WBFarm farm = WBFarm.Local; using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); if (recordsType == null && functionalArea == null) { query.LogicallyCannotHaveResults = true; } else { if (SelectedView == VIEW_BY_FUNCTION_THEN_TYPE || SelectedView == VIEW_BY_FOLDER_PATH) { WBLogging.Generic.Unexpected("Setting FilterByFolderPath = " + SelectedNodePath); query.FilterByFolderPath = SelectedNodePath; } else { if (recordsType != null) { WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = true; query.AddClause(recordsTypeClause); } if (functionalArea != null) { WBQueryClause functionalAreaClause = new WBQueryClause(WBColumn.FunctionalArea, WBQueryClause.Comparators.Equals, functionalArea); functionalAreaClause.UseDescendants = true; query.AddClause(functionalAreaClause); } } query.AddClause(new WBQueryClause(WBColumn.ContentType, WBQueryClause.Comparators.Equals, farm.WorkBoxRecordContentTypeName)); if (subjectTag != null) { WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, subjectTag); subjectTagClause.UseDescendants = false; query.AddClause(subjectTagClause); } if (team != null) { query.AddEqualsFilter(WBColumn.InvolvedTeams, team); } if (!String.IsNullOrEmpty(webPart.FilterByProtectiveZone)) { query.AddEqualsFilter(WBColumn.ProtectiveZone, webPart.FilterByProtectiveZone); } } showFilters = true; string statusFilter = SelectedLiveOrArchivedStatusFilter; if (statusFilter == null || statusFilter == "") { statusFilter = "All"; // 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"; } 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.FunctionalArea); query.AddViewColumn(WBColumn.OwningTeam); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.ReferenceID); query.AddViewColumn(WBColumn.SeriesTag); query.AddViewColumn(WBColumn.ProtectiveZone); query.AddViewColumn(WBColumn.RecordID); query.AddViewColumn(WBColumn.LiveOrArchived); if (SelectedView != VIEW_BY_SUBJECT) { query.AddViewColumn(WBColumn.SubjectTags); } else { query.AddViewColumn(WBColumn.RecordsType); } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query); ShowResults.DataSource = dataTable; ShowResults.Columns.Clear(); ShowResults.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); ShowResults.Columns.Add(WBUtils.HyperLinkField(WBColumn.TitleOrName, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FileType, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.DisplayFileSize, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, 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.OwningTeam, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ProtectiveZone, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.LiveOrArchived, sortColumn, ascending)); if (SelectedView != VIEW_BY_SUBJECT) { ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.SubjectTags, sortColumn, ascending)); } else { ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, sortColumn, ascending)); } if (this.currentUserIsRecordsManager) { 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>"; ShowResults.Columns.Add(WBUtils.FormatStringTemplateField(formatString, valueColumns)); WBLogging.Debug("Added the (edit metadata) show column."); } else { WBLogging.Debug("Did not add the (edit metadata) show column."); } ShowResults.DataBind(); } } } else { WBUtils.logMessage("SelectedNodePath was empty"); } }
protected override void Render(HtmlTextWriter writer) { //WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); WBTaxonomy seriesTags = WBTaxonomy.GetSeriesTags(SPContext.Current.Site); WBTerm seriesTag = null; if (SeriesTag != null && SeriesTag != "") { Term seriesTagTerm = seriesTags.GetSelectedTermByPath(SeriesTag); if (seriesTagTerm != null) { seriesTag = new WBTerm(seriesTags, seriesTagTerm); } } WBQuery query = new WBQuery(); //query.AddEqualsFilter(WBColumn.RecordsType, workBox.RecordsType); if (seriesTag != null) { query.AddEqualsFilter(WBColumn.SeriesTag, seriesTag); } if (ReferenceID != null && ReferenceID != "") { query.AddEqualsFilter(WBColumn.ReferenceID, ReferenceID); } // if (FilterByOwningTeam) // query.AddEqualsFilter(WBColumn.OwningTeam, workBox.OwningTeam); if (sortColumn != null) { WBLogging.Debug("Sorting in Render with sortColumn: " + sortColumn.DisplayName); } else { WBLogging.Debug("SortColumn was null - so sorting by declared record date."); sortColumn = WBColumn.DeclaredRecord; ascending = false; } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.FileTypeIcon); query.AddViewColumn(WBColumn.EncodedAbsoluteURL); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.ProtectiveZone); query.AddViewColumn(WBColumn.DeclaredRecord); WBFarm farm = WBFarm.Local; using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { using (SPWeb web = site.OpenWeb()) { SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query, MaxNumDocuments); gridView.DataSource = dataTable; gridView.Columns.Clear(); gridView.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); gridView.Columns.Add(WBUtils.HyperLinkField(WBColumn.Name, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); gridView.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending)); gridView.Columns.Add(WBUtils.BoundField(WBColumn.ProtectiveZone, sortColumn, ascending)); gridView.Columns.Add(WBUtils.BoundField(WBColumn.DeclaredRecord, sortColumn, ascending)); gridView.DataBind(); } } base.Render(writer); }
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 (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { 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 protectiveZoneFilter = Request.QueryString["ProtectiveZone"]; if (protectiveZoneFilter != null && protectiveZoneFilter != "") { query.AddEqualsFilter(WBColumn.ProtectiveZone, protectiveZoneFilter); } query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.FileTypeIcon); query.AddViewColumn(WBColumn.EncodedAbsoluteURL); query.AddViewColumn(WBColumn.FunctionalArea); query.AddViewColumn(WBColumn.OwningTeam); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.ReferenceID); query.AddViewColumn(WBColumn.SeriesTag); query.AddViewColumn(WBColumn.ProtectiveZone); if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query); ShowResults.DataSource = dataTable; ShowResults.Columns.Clear(); ShowResults.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); ShowResults.Columns.Add(WBUtils.HyperLinkField(WBColumn.Name, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, 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.ProtectiveZone, sortColumn, ascending)); ShowResults.DataBind(); } } } else { WBUtils.logMessage("SelectedNodePath was empty"); } }
/* * protected void ViewSelector_OnSelectedIndexChanged(object sender, EventArgs e) * { * SelectedViewTitle.Text = "Browse " + webPart.RecordsLibraryView; // ViewSelector.SelectedValue; * // SelectedView = ViewSelector.SelectedValue; * * SelectedNodePath = ""; * * RefreshBrowsableTreeView(); * RefreshBoundData(); * * } * * protected void FilterByProtectiveZone_OnSelectedIndexChanged(object sender, EventArgs e) * { * ProtectiveZoneFilter = FilterByProtectiveZone.SelectedValue; * * RefreshBoundData(); * } */ private void RefreshBoundData() { if (SelectedNodePath != "") { SelectedRecordsType.Text = SelectedNodePath.Replace("Records Types/", "").Replace("/", " / "); WBRecordsType recordsType = null; WBTerm functionalArea = null; WBTerm subjectTag = null; switch (SelectedView) { case VIEW_BY_RECORDS_TYPE: { recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(SelectedNodePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } case VIEW_BY_FUNCTION_THEN_TYPE: { string[] parts = SelectedNodePath.Split('/'); if (parts.Length < 3) { break; } string functionPath = parts[0]; List <String> partsList = new List <String>(parts); partsList.RemoveAt(0); string recordsTypePath = String.Join("/", partsList.ToArray()); Term functionalAreaTerm = functionalAreaTaxonomy.GetSelectedTermByPath(functionPath); if (functionalAreaTerm != null) { functionalArea = new WBTerm(functionalAreaTaxonomy, functionalAreaTerm); } recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } case VIEW_BY_SUBJECT: { Term subjectTagsTerm = subjectTagsTaxonomy.GetSelectedTermByPath(SelectedNodePath); if (subjectTagsTerm != null) { subjectTag = new WBTerm(subjectTagsTaxonomy, subjectTagsTerm); SelectedRecordsTypeDescription.Text = subjectTag.Description; } if (subjectTag == null) { WBLogging.Generic.Verbose("Did not find subject with path: " + SelectedNodePath); return; } break; } default: return; } String recordsLibraryURL = WBFWebPartsUtils.GetRecordsLibraryURL(SPContext.Current.Site); using (SPSite site = new SPSite(recordsLibraryURL)) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); if (recordsType == null && functionalArea == null) { query.LogicallyCannotHaveResults = true; } else { if (SelectedView == VIEW_BY_FUNCTION_THEN_TYPE) { query.FilterByFolderPath = WBUtils.PrepareFilenameForPublicWeb(SelectedNodePath); } else { if (recordsType != null) { WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = true; query.AddClause(recordsTypeClause); } if (functionalArea != null) { WBQueryClause functionalAreaClause = new WBQueryClause(WBColumn.FunctionalArea, WBQueryClause.Comparators.Equals, functionalArea); functionalAreaClause.UseDescendants = true; query.AddClause(functionalAreaClause); } } //query.AddClause(new WBQueryClause(WBColumn.ContentType, WBQueryClause.Comparators.Equals, WorkBox.WORK_BOX_RECORD_CONTENT_TYPE)); if (subjectTag != null) { WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, subjectTag); subjectTagClause.UseDescendants = false; query.AddClause(subjectTagClause); } 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.FileSize); query.AddViewColumn(WBColumn.FileTypeIcon); query.AddViewColumn(WBColumn.FileType); query.AddViewColumn(WBColumn.TitleOrName); query.AddViewColumn(WBColumn.DisplayFileSize); query.AddViewColumn(WBColumn.EncodedAbsoluteURL); //query.AddViewColumn(WBColumn.FunctionalArea); //query.AddViewColumn(WBColumn.OwningTeam); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.DeclaredRecord); //query.AddViewColumn(WBColumn.ReferenceID); //query.AddViewColumn(WBColumn.SeriesTag); //query.AddViewColumn(WBColumn.ProtectiveZone); if (SelectedView != VIEW_BY_SUBJECT) { query.AddViewColumn(WBColumn.SubjectTags); } else { query.AddViewColumn(WBColumn.RecordsType); } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(recordsLibraryURL); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query); ShowResults.DataSource = dataTable; ShowResults.Columns.Clear(); ShowResults.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); ShowResults.Columns.Add(WBUtils.HyperLinkField(WBColumn.TitleOrName, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.HyperLinkField(WBColumn.Name, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); //ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); //ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FileType, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.DisplayFileSize, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending)); //ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.DeclaredRecord, 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.ProtectiveZone, sortColumn, ascending)); /* * if (SelectedView != VIEW_BY_SUBJECT) * { * ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.SubjectTags, sortColumn, ascending)); * } * else * { * ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, sortColumn, ascending)); * } */ ShowResults.DataBind(); } } } else { WBUtils.logMessage("SelectedNodePath was empty"); } }
private void RefreshBoundData() { //if (SelectedNodePath != "") // { // SelectedRecordsType.Text = SelectedNodePath.Replace("Records Types/", "").Replace("/", " / "); WBRecordsType recordsType = null; WBTerm functionalArea = null; WBTerm subjectTag = null; /* * switch (SelectedView) * { * case VIEW_BY_RECORDS_TYPE: * { * recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(SelectedNodePath); * // SelectedRecordsTypeDescription.Text = recordsType.Description; * break; * } * * case VIEW_BY_FUNCTION_THEN_TYPE: * { * string[] parts = SelectedNodePath.Split('/'); * if (parts.Length < 3) return; * * string functionPath = parts[0]; * List<String> partsList = new List<String>(parts); * partsList.RemoveAt(0); * string recordsTypePath = String.Join("/", partsList.ToArray()); * * Term functionalAreaTerm = functionalAreaTaxonomy.GetSelectedTermByPath(functionPath); * if (functionalAreaTerm != null) * { * functionalArea = new WBTerm(functionalAreaTaxonomy, functionalAreaTerm); * } * * recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypePath); * // SelectedRecordsTypeDescription.Text = recordsType.Description; * break; * } * * case VIEW_BY_SUBJECT: * { * Term subjectTagsTerm = subjectTagsTaxonomy.GetSelectedTermByPath(SelectedNodePath); * if (subjectTagsTerm != null) * { * subjectTag = new WBTerm(subjectTagsTaxonomy, subjectTagsTerm); * SelectedRecordsTypeDescription.Text = subjectTag.Description; * } * * if (subjectTag == null) * { * WBLogging.Debug("Did not find subject with path: " + SelectedNodePath); * return; * } * break; * } * * * default: return; * * } */ WBTeam team = null; if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam)) { team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam); } if (team == null) { team = WBTeam.GetFromTeamSite(teamsTaxonomy, SPContext.Current.Web); } if (team == null) { WBUtils.shouldThrowError("There was no team configured - so we'll jus stop"); return; } WBFarm farm = WBFarm.Local; using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); if (recordsType != null) { WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = true; query.AddClause(recordsTypeClause); } if (functionalArea != null) { WBQueryClause functionalAreaClause = new WBQueryClause(WBColumn.FunctionalArea, WBQueryClause.Comparators.Equals, functionalArea); functionalAreaClause.UseDescendants = true; query.AddClause(functionalAreaClause); } if (subjectTag != null) { WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, subjectTag); subjectTagClause.UseDescendants = false; query.AddClause(subjectTagClause); } if (team != null) { query.AddEqualsFilter(WBColumn.OwningTeam, team); } //if (!String.IsNullOrEmpty(webPart.FilterByProtectiveZone)) // { // query.AddEqualsFilter(WBColumn.ProtectiveZone, webPart.FilterByProtectiveZone); //} 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.FunctionalArea); // query.AddViewColumn(WBColumn.OwningTeam); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.DeclaredRecord); query.AddViewColumn(WBColumn.SeriesTag); // query.AddViewColumn(WBColumn.ProtectiveZone); if (SelectedView != VIEW_BY_SUBJECT) { query.AddViewColumn(WBColumn.SubjectTags); } else { query.AddViewColumn(WBColumn.RecordsType); } if (sortColumn == null) { sortColumn = WBColumn.DeclaredRecord; ascending = false; } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query); ShowResults.DataSource = dataTable; ShowResults.Columns.Clear(); ShowResults.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); ShowResults.Columns.Add(WBUtils.HyperLinkField(WBColumn.TitleOrName, WBColumn.EncodedAbsoluteURL, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FileType, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.DisplayFileSize, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, 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.OwningTeam, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ProtectiveZone, sortColumn, ascending)); /* * if (SelectedView != VIEW_BY_SUBJECT) * { * ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.SubjectTags, sortColumn, ascending)); * } * else * { * ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, sortColumn, ascending)); * } */ ShowResults.DataBind(); } } /* * } * else * { * WBUtils.logMessage("SelectedNodePath was empty"); * } */ }
private void RefreshBoundData() { if (SelectedNodePath != "") { SelectedRecordsType.Text = SelectedNodePath.Replace("Records Types/", "").Replace("/", " / "); WBRecordsType recordsType = null; WBTerm functionalArea = null; WBTerm subjectTag = null; switch (SelectedView) { case VIEW_BY_RECORDS_TYPE: { recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(SelectedNodePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } case VIEW_BY_FUNCTION_THEN_TYPE: { string[] parts = SelectedNodePath.Split('/'); if (parts.Length < 3) { return; } string functionPath = parts[0]; List <String> partsList = new List <String>(parts); partsList.RemoveAt(0); string recordsTypePath = String.Join("/", partsList.ToArray()); Term functionalAreaTerm = functionalAreaTaxonomy.GetSelectedTermByPath(functionPath); if (functionalAreaTerm != null) { functionalArea = new WBTerm(functionalAreaTaxonomy, functionalAreaTerm); } recordsType = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypePath); SelectedRecordsTypeDescription.Text = recordsType.Description; break; } case VIEW_BY_SUBJECT: { Term subjectTagsTerm = subjectTagsTaxonomy.GetSelectedTermByPath(SelectedNodePath); if (subjectTagsTerm != null) { subjectTag = new WBTerm(subjectTagsTaxonomy, subjectTagsTerm); SelectedRecordsTypeDescription.Text = subjectTag.Description; } if (subjectTag == null) { WBLogging.Debug("Did not find subject with path: " + SelectedNodePath); return; } break; } default: return; } WBTeam team = WBTeam.GetFromTeamSite(teamsTaxonomy, SPContext.Current.Web); String recordsLibraryURL = WBFWebPartsUtils.GetRecordsLibraryURL(SPContext.Current.Site); if (Request.QueryString["Library"] == "Extranet") { recordsLibraryURL = WBFWebPartsUtils.GetExtranetLibraryURL(SPContext.Current.Site); } using (SPSite site = new SPSite(recordsLibraryURL)) { using (SPWeb web = site.OpenWeb()) { WBQuery query = new WBQuery(); if (recordsType != null) { WBQueryClause recordsTypeClause = new WBQueryClause(WBColumn.RecordsType, WBQueryClause.Comparators.Equals, recordsType); recordsTypeClause.UseDescendants = true; query.AddClause(recordsTypeClause); } if (functionalArea != null) { WBQueryClause functionalAreaClause = new WBQueryClause(WBColumn.FunctionalArea, WBQueryClause.Comparators.Equals, functionalArea); functionalAreaClause.UseDescendants = true; query.AddClause(functionalAreaClause); } if (subjectTag != null) { WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, subjectTag); subjectTagClause.UseDescendants = false; query.AddClause(subjectTagClause); } if (team != null) { query.AddEqualsFilter(WBColumn.InvolvedTeams, team); } // 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.FileSize); query.AddViewColumn(WBColumn.FileTypeIcon); query.AddViewColumn(WBColumn.FileType); query.AddViewColumn(WBColumn.TitleOrName); query.AddViewColumn(WBColumn.DisplayFileSize); query.AddViewColumn(WBColumn.RecordID); query.AddViewColumn(WBColumn.EncodedAbsoluteURL); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.ReferenceID); query.AddViewColumn(WBColumn.ProtectiveZone); query.AddViewColumn(WBColumn.DeclaredRecord); if (SelectedView != VIEW_BY_SUBJECT) { query.AddViewColumn(WBColumn.SubjectTags); } else { query.AddViewColumn(WBColumn.RecordsType); } if (sortColumn == null) { sortColumn = WBColumn.DeclaredRecord; ascending = false; } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } SPList recordsLibrary = web.GetList(recordsLibraryURL); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query); ShowResults.DataSource = dataTable; ShowResults.Columns.Clear(); ButtonField buttonField = new ButtonField(); buttonField.Text = "Select"; buttonField.CommandName = "Select Document"; ShowResults.Columns.Add(buttonField); ShowResults.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.Title, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.Name, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.DeclaredRecord, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ProtectiveZone, sortColumn, ascending)); ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.RecordID, sortColumn, ascending)); // BoundField test = WBUtils.BoundField(WBColumn.ServerURL, sortColumn, ascending); // test.Hid // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.FunctionalArea, sortColumn, ascending)); //ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.OwningTeam, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending)); // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceID, sortColumn, ascending)); //ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.SeriesTag, sortColumn, ascending)); //if (SelectedView != VIEW_BY_SUBJECT) // { // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.SubjectTags, sortColumn, ascending)); // } //else // { // ShowResults.Columns.Add(WBUtils.BoundField(WBColumn.RecordsType, sortColumn, ascending)); // } ShowResults.DataBind(); } } } else { WBUtils.logMessage("SelectedNodePath was empty"); } }