protected void Page_Load(object sender, EventArgs e) { manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName); masterLibraryHasVersions = manager.Libraries.ProtectedMasterLibrary.List.EnableVersioning; if (WorkBox.IsWebAWorkBox(SPContext.Current.Web)) { workBox = new WorkBox(SPContext.Current); team = workBox.OwningTeam; } else { team = WBTeam.GetFromTeamSite(SPContext.Current); } if (!IsPostBack && team != null) { WBQuery query = manager.GetQueryForTeamsPublicRecordsToReview(team); WBLogging.Debug("The query is: " + query.JustCAMLQuery(manager.Libraries.ProtectedMasterLibrary.Site)); SPListItemCollection items = manager.Libraries.ProtectedMasterLibrary.List.WBxGetItems(manager.Libraries.ProtectedMasterLibrary.Site, query); RenderFoundRecords(items); } }
public SPListItemCollection GetRecordsInFolder(String folderPath) { WBColumn sortColumn = WBColumn.GetKnownColumnByInternalName(ViewState["SortColumn"].WBxToString()); WBQuery workBoxQuery = new WBQuery(); workBoxQuery.FilterByFolderPath = folderPath; if (sortColumn != null) { bool ascending = true; if (ViewState["SortDirection"].WBxToString() == "Descending") { ascending = false; } workBoxQuery.OrderBy(sortColumn, ascending); } workBoxQuery.RecursiveAll = true; SPList list = manager.Libraries.ProtectedMasterLibrary.List; return(list.WBxGetItems(manager.Libraries.ProtectedMasterLibrary.Site, workBoxQuery)); }
private string createTableRowForDocument(WBTaxonomy seriesTags, Term docSeriesTerm) { WBQuery query = new WBQuery(); WBTerm docSeriesTag = new WBTerm(seriesTags, docSeriesTerm); query.AddEqualsFilter(WBColumn.SeriesTag, docSeriesTag); query.OrderBy(WBColumn.DeclaredRecord, false); query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.EncodedAbsoluteURL); query.AddViewColumn(WBColumn.DeclaredRecord); WBFarm farm = WBFarm.Local; SPListItem document = null; using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl)) { using (SPWeb web = site.OpenWeb()) { SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); SPListItemCollection items = recordsLibrary.WBxGetItems(site, query); if (items.Count > 0) { document = items[0]; } } } string docURL = "#"; string docName = "Did not find a docuemnt for this series tag"; if (document != null) { docURL = document.WBxGetAsString(WBColumn.EncodedAbsoluteURL); docName = document.WBxGetAsString(WBColumn.Name); } string html = "<tr class=\"seriesTags\"><td><img src=\"/_layouts/images/icdocx.png\"/></td><td class=\"seriesTags\"><a href=\"" + docURL + "\">" + docSeriesTag.Name + "</a></td><td>(" + docName + ")</td></tr>"; return(html); }
internal static SPListItem GetRecord(SPSite site, SPWeb web, SPList library, String zone, String recordID) { WBQuery query = new WBQuery(); WBQueryClause recordIDClause = new WBQueryClause(WBColumn.RecordID, WBQueryClause.Comparators.Equals, recordID); query.AddClause(recordIDClause); WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddClause(isLiveClause); 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.SourceID); SPListItemCollection items = library.WBxGetItems(site, query); if (items.Count < 1) { WBLogging.Debug("Couldn't find the document with Record ID = " + recordID); return(null); } else { if (items.Count > 1) { WBUtils.shouldThrowError("Found " + items.Count + " items that matched the query for Record ID: " + recordID); } return(items[0]); } }
protected void Page_Load(object sender, EventArgs e) { manager = new WBRecordsManager(); workBox = new WorkBox(SPContext.Current); if (!IsPostBack) { WBQuery query = new WBQuery(); query.AddFilter(WBColumn.RecordID, WBQueryClause.Comparators.GreaterThan, 100); query.AddEqualsFilter(WBColumn.OwningTeam, workBox.OwningTeam); query.AddEqualsFilter(WBColumn.LiveOrArchived, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddEqualsFilter(WBColumn.ProtectiveZone, WBRecordsType.PROTECTIVE_ZONE__PUBLIC); //query.AddFilter(WBColumn.ReviewDate, WBQueryClause.Comparators.LessThan, DateTime.Now); query.RecursiveAll = true; WBLogging.Debug("The query is: " + query.JustCAMLQuery(manager.Libraries.ProtectedMasterLibrary.Site)); SPListItemCollection items = manager.Libraries.ProtectedMasterLibrary.List.WBxGetItems(manager.Libraries.ProtectedMasterLibrary.Site, query); RenderFoundRecords(items); } }
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 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 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 void Page_Load(object sender, EventArgs e) { String html = "<table class='wbf-record-series-details'>\n"; html += "<tr>" + "<th class='wbf-record-series-odd'>Version</th>" + "<th class='wbf-record-series-even'>Filename</th>" + "<th class='wbf-record-series-odd'>Published</th>" + "<th class='wbf-record-series-even'>Published By</th>" + "<th class='wbf-record-series-odd'>Modified</th>" + "<th class='wbf-record-series-even'>Status</th>" + "<th class='wbf-record-series-odd'>File Size</th>" + "<th class='wbf-record-series-odd'></th>" + "</tr>\n"; String recordSeriesID = Request.QueryString["RecordSeriesID"]; String recordID = Request.QueryString["RecordID"]; using (WBRecordsManager manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName)) { WBRecordsLibrary masterLibrary = manager.Libraries.ProtectedMasterLibrary; SPList masterLibraryList = masterLibrary.List; WBQuery query = new WBQuery(); if (String.IsNullOrEmpty(recordSeriesID) || recordSeriesID == recordID) { query.AddEqualsFilter(WBColumn.RecordID, recordID); } else { query.AddEqualsFilter(WBColumn.RecordSeriesID, recordSeriesID); query.OrderBy(WBColumn.RecordSeriesIssue, false); } SPListItemCollection items = masterLibraryList.WBxGetItems(SPContext.Current.Site, query); /* * List<WBDocument> versions = new List<WBDocument>(); * foreach (SPListItem item in items) * { * * bool notInserted = true; * for (int i = 0; i < versions.Count && notInserted; i++) * { * * * if (document.RecordSeriesIssue.WBxToInt() > versions[i].RecordSeriesIssue.WBxToInt()) * } * * } * */ Dictionary <String, String> checklistTextMap = manager.GetChecklistTextMap(); if (masterLibrary.List.EnableVersioning) { foreach (SPListItem item in items) { SPListItemVersionCollection versionCollection = item.Versions; int versionCount = item.Versions.Count; WBLogging.Debug("Item versions count | File versions count: " + versionCount + " | " + item.File.Versions.Count); for (int i = 0; i < versionCount; i++) { SPListItemVersion version = versionCollection[i]; WBDocument document = new WBDocument(masterLibrary, version); // We're going to render the minor version numbers counting up - even though lower index values are for more recent versions: html += RenderHTMLForOneDocumentVersion(checklistTextMap, document, document.RecordSeriesIssue, (versionCount - 1 - i).ToString(), i); } } } else { foreach (SPListItem item in items) { WBDocument document = new WBDocument(masterLibrary, item); html += RenderHTMLForOneDocumentVersion(checklistTextMap, document, document.RecordSeriesIssue, null, -1); } } } html += "</table>"; ViewRecordSeriesTable.Text = html; }
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"); } }
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 override void Render(HtmlTextWriter writer) { WorkBox workBox = WorkBox.GetIfWorkBox(SPContext.Current); if (workBox == null) { errorLiteral.Text = "<i>(You can only use this web part in a work box)</i>"; } else { WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); WBTaxonomy seriesTags = WBTaxonomy.GetSeriesTags(recordsTypes); WBTerm thisSeries = workBox.SeriesTag(seriesTags); WBQuery query = new WBQuery(); query.AddEqualsFilter(WBColumn.RecordsType, workBox.RecordsType); if (FilterBySeriesTag) { query.AddEqualsFilter(WBColumn.SeriesTag, workBox.SeriesTag(seriesTags)); } if (FilterByReferenceID) { query.AddEqualsFilter(WBColumn.ReferenceID, workBox.ReferenceID); } // if (FilterByOwningTeam) // query.AddEqualsFilter(WBColumn.OwningTeam, workBox.OwningTeam); if (sortColumn != null) { WBLogging.Debug("Sorting in Render with sortColumn: " + sortColumn.DisplayName); } else { WBLogging.Debug("Sorting Render - sortColumn was null"); } if (sortColumn != null) { query.OrderBy(sortColumn, ascending); } query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.WorkBoxURL); query.AddViewColumn(WBColumn.ReferenceDate); query.AddViewColumn(WBColumn.WorkBoxStatus); WBColumn testIfIsThisWorkBox = new WBColumn("IfIsThisWorkBox", WBColumn.DataTypes.VirtualConditional); testIfIsThisWorkBox.TestColumnInternalName = WBColumn.Title.InternalName; testIfIsThisWorkBox.TestColumnValue = workBox.Title; testIfIsThisWorkBox.ValueIfEqual = "===>"; query.AddViewColumn(testIfIsThisWorkBox); DataTable dataTable = workBox.Collection.Query(query); gridView.DataSource = new DataView(dataTable); BoundField testIfIsThisWorkBoxField = WBUtils.BoundField(testIfIsThisWorkBox, HorizontalAlign.Center, sortColumn, ascending); testIfIsThisWorkBoxField.HeaderText = " "; gridView.Columns.Add(testIfIsThisWorkBoxField); gridView.Columns.Add(WBUtils.FixedIconTemplateField(WorkBox.ICON_16_IMAGE_URL, WBColumn.WorkBoxURL)); gridView.Columns.Add(WBUtils.HyperLinkField(WBColumn.Title, WBColumn.WorkBoxURL, sortColumn, ascending)); gridView.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending)); gridView.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxStatus, HorizontalAlign.Center, sortColumn, ascending)); gridView.DataBind(); if (ShowCreateNewLink) { string createNewText = workBox.RecordsType.CreateNewWorkBoxText; string createNewURL = workBox.Collection.GetUrlForNewDialog(workBox, WorkBox.RELATION_TYPE__DYNAMIC); createNewLink.Text = "<a href=\"#\" onclick=\"javascript: WorkBoxFramework_commandAction('" + createNewURL + "', 600, 500); \">" + createNewText + "</a>"; } workBox.Dispose(); } 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 string createTableRowForChildSubjectTag(WBTaxonomy seriesTags, String additionalPath, Term child) * { * string currentURL = Request.Url.ToString(); * int startIndex = currentURL.IndexOf("?"); * if (startIndex > 0) * { * currentURL = currentURL.Substring(0, startIndex); * } * * string childURL = currentURL + "?AdditionalPath=" + additionalPath + "/" + child.Name; * * if (!webPart.OnlyLiveRecords) * { * childURL += "&LiveOrArchived=" + SelectedLiveOrArchivedStatusFilter; * } * * * string html = "<tr class=\"subjectTags\"><td class=\"subjectTags\"><a href=\"" + childURL + "\">" + child.Name + "</a></td></tr>"; * * return html; * } */ private int CountArchivedDocsOfThisSelection() { WBFarm farm = WBFarm.Local; int foundDocuments = 0; 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); WBQueryClause isArchivedClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__ARCHIVED); query.AddClause(isArchivedClause); 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); } } query.AddViewColumn(WBColumn.Name); query.AddViewColumn(WBColumn.Title); query.AddViewColumn(WBColumn.RecordID); SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName]; SPListItemCollection foundArchivedItems = recordsLibrary.WBxGetItems(site, query); foundDocuments = foundArchivedItems.Count; } } else { WBUtils.logMessage("pageSubjectTag was null"); } } return(foundDocuments); }
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 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"); } } }
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 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 (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"); } }