protected void Page_Load(object sender, EventArgs e) { // First we're going to check membership of the records management group: String rmGroupName = WBFarm.Local.RecordsManagersGroupName; SPGroup rmGroup = null; if (!String.IsNullOrEmpty(rmGroupName)) { try { rmGroup = SPContext.Current.Web.SiteGroups[rmGroupName]; } catch (Exception exception) { // Probably the group hasn't been created or setup here yet } } if (rmGroup == null || !rmGroup.ContainsCurrentUser) { AccessDeniedPanel.Visible = true; UpdateRecordsMetadataPanel.Visible = false; return; } currentUserLoginName = SPContext.Current.Web.CurrentUser.LoginName; String listIDString = ""; String itemIDString = ""; String recordIDString = ""; recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy); librarySite = new SPSite(WBFarm.Local.ProtectedRecordsLibraryUrl); libraryWeb = librarySite.OpenWeb(); libraryList = libraryWeb.GetList(WBFarm.Local.ProtectedRecordsLibraryUrl); if (!IsPostBack) { recordIDString = Request.QueryString["RecordID"]; if (String.IsNullOrEmpty(recordIDString)) { listIDString = Request.QueryString["ListID"]; itemIDString = Request.QueryString["ItemID"]; } else { listIDString = libraryList.ID.ToString(); } ListID.Value = listIDString; ItemID.Value = itemIDString; } else { recordIDString = RecordID.Text; listIDString = ListID.Value; itemIDString = ItemID.Value; } if (!String.IsNullOrEmpty(itemIDString)) { int itemID = Convert.ToInt32(itemIDString); recordItem = libraryList.GetItemById(itemID); } else { recordItem = WBUtils.FindItemByColumn(SPContext.Current.Site, libraryList, WBColumn.RecordID, recordIDString); if (recordItem != null) { itemIDString = recordItem.ID.ToString(); ItemID.Value = itemIDString; } } if (recordItem != null) { record = new WBDocument(recordItem); FunctionalArea.Text = record.FunctionalArea.Names(); WBRecordsType recordsType = record.RecordsType; recordsType.Taxonomy = recordsTypesTaxonomy; RecordsType.Text = recordsType.FullPath.Replace("/", " / "); if (!IsPostBack) { Filename.Text = recordItem.Name; Title.Text = recordItem.Title; RecordID.Text = record[WBColumn.RecordID].WBxToString(); LiveOrArchived.DataSource = new String[] { "Live", "Archived" }; LiveOrArchived.DataBind(); LiveOrArchived.SelectedValue = record[WBColumn.LiveOrArchived].WBxToString(); ProtectiveZone.DataSource = WBRecordsType.getProtectiveZones(); ProtectiveZone.DataBind(); ProtectiveZone.SelectedValue = record.ProtectiveZone; subjectTagsTaxonomy.InitialiseTaxonomyControl(SubjectTags, WBColumn.SubjectTags.DisplayName, true); SubjectTags.Text = record.SubjectTags.UIControlValue; } } if (!IsPostBack) { libraryWeb.Dispose(); librarySite.Dispose(); LiveOrArchived.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { webPart = this.Parent as ViewRecordsLibraryWebPart; recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); teamsTaxonomy = WBTaxonomy.GetTeams(recordsTypesTaxonomy); functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy); subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy); if (!IsPostBack) { // ViewSelector.DataSource = LibraryViews; // ViewSelector.DataBind(); ProtectiveZoneFilterOptions = WBRecordsType.getProtectiveZones(); ProtectiveZoneFilterOptions.Insert(0, ""); FilterByProtectiveZone.DataSource = ProtectiveZoneFilterOptions; FilterByProtectiveZone.DataBind(); string selectedView = webPart.RecordsLibraryView; if (!String.IsNullOrEmpty(Request.QueryString["FolderPath"])) { selectedView = VIEW_BY_FOLDER_PATH; SelectedNodePath = Request.QueryString["FolderPath"]; } if (String.IsNullOrEmpty(selectedView)) { selectedView = VIEW_BY_RECORDS_TYPE; } SelectedViewTitle.Text = selectedView; SelectedView = selectedView; } RefreshBrowsableTreeView(); ShowResults.AllowSorting = true; ShowResults.Sorting += new GridViewSortEventHandler(ShowResults_Sorting); ShowResults.AllowPaging = true; ShowResults.PageIndexChanging += new GridViewPageEventHandler(ShowResults_PageIndexChanging); ShowResults.PagerSettings.Mode = PagerButtons.Numeric; ShowResults.PagerSettings.Position = PagerPosition.Bottom; ShowResults.PagerSettings.PageButtonCount = 50; ShowResults.PagerSettings.Visible = true; ShowResults.PageSize = 50; // this odd statement is required in order to get the pagination to work with an SPGridView! ShowResults.PagerTemplate = null; if (SelectedView == VIEW_BY_FOLDER_PATH) { RefreshBoundData(); } }
protected void updatePanelWithRecordsTypeDetails(WBRecordsType recordsType) { RecordsTypeName.Text = recordsType.Name; LastModfiedDate.Text = String.Format("{0:d/M/yyyy HH:mm:ss}", recordsType.Term.LastModifiedDate); RecordsTypeDescription.Text = recordsType.Description; DefaultFunctionalArea.Text = recordsType.DefaultFunctionalAreaUIControlValue; AllowOtherFunctionalAreas.Checked = recordsType.AllowOtherFunctionalAreas; // First the work box details: AllowWorkBoxRecords.Checked = recordsType.AllowWorkBoxRecords; WhoCanCreateNewWorkBoxes.DataSource = WBRecordsType.getWhoCanCreateOptions(); WhoCanCreateNewWorkBoxes.DataBind(); WhoCanCreateNewWorkBoxes.WBxSafeSetSelectedValue(recordsType.WhoCanCreateNewWorkBoxes); CreateNewWorkBoxText.Text = recordsType.CreateNewWorkBoxText; WorkBoxUniqueIDPrefix.Text = recordsType.WorkBoxUniqueIDPrefix; WorkBoxLocalIDSource.DataSource = WBRecordsType.getWorkBoxLocalIDSources(); WorkBoxLocalIDSource.DataBind(); WorkBoxLocalIDSource.WBxSafeSetSelectedValue(recordsType.WorkBoxLocalIDSource); WorkBoxGeneratedLocalIDOffset.Text = recordsType.WorkBoxGeneratedLocalIDOffset.ToString(); WorkBoxShortTitleRequirement.DataSource = WBRecordsType.getRequirementOptions(); WorkBoxShortTitleRequirement.DataBind(); WorkBoxShortTitleRequirement.WBxSafeSetSelectedValue(recordsType.WorkBoxShortTitleRequirement); WorkBoxShortTitleDescription.Text = recordsType.WorkBoxShortTitleDescription; WorkBoxReferenceIDRequirement.DataSource = WBRecordsType.getRequirementOptions(); WorkBoxReferenceIDRequirement.DataBind(); WorkBoxReferenceIDRequirement.WBxSafeSetSelectedValue(recordsType.WorkBoxReferenceIDRequirement); WorkBoxReferenceIDDescription.Text = recordsType.WorkBoxReferenceIDDescription; WorkBoxReferenceDateRequirement.DataSource = WBRecordsType.getRequirementOptions(); WorkBoxReferenceDateRequirement.DataBind(); WorkBoxReferenceDateRequirement.WBxSafeSetSelectedValue(recordsType.WorkBoxReferenceDateRequirement); WorkBoxReferenceDateDescription.Text = recordsType.WorkBoxReferenceDateDescription; WorkBoxSeriesTagRequirement.DataSource = WBRecordsType.getRequirementOptions(); WorkBoxSeriesTagRequirement.DataBind(); WorkBoxSeriesTagRequirement.WBxSafeSetSelectedValue(recordsType.WorkBoxSeriesTagRequirement); WorkBoxSeriesTagParentTerm.Text = recordsType.WorkBoxSeriesTagParentTermUIControlValue; WorkBoxSeriesTagAllowNewTerms.Checked = recordsType.WorkBoxSeriesTagAllowNewTerms; WorkBoxSeriesTagDescription.Text = recordsType.WorkBoxSeriesTagDescription; WorkBoxNamingConventions.DataSource = WBRecordsType.getWorkBoxNamingConventions(); WorkBoxNamingConventions.DataBind(); WorkBoxNamingConventions.WBxSafeSetSelectedValue(recordsType.WorkBoxNamingConvention); AutoCloseTriggerDate.DataSource = WBRecordsType.getAutoCloseTriggerDates(); AutoCloseTriggerDate.DataBind(); AutoCloseTriggerDate.WBxSafeSetSelectedValue(recordsType.AutoCloseTriggerDate); AutoCloseTimeUnits.DataSource = WBRecordsType.getAutoCloseUnits(); AutoCloseTimeUnits.DataBind(); AutoCloseTimeUnits.WBxSafeSetSelectedValue(recordsType.AutoCloseTimeUnit); AutoCloseTimeScalar.Text = recordsType.AutoCloseTimeScalarAsString; RetentionTriggerDate.DataSource = WBRecordsType.getRetentionTriggerDates(); RetentionTriggerDate.DataBind(); RetentionTriggerDate.WBxSafeSetSelectedValue(recordsType.RetentionTriggerDate); RetentionUnits.DataSource = WBRecordsType.getRetentionUnits(); RetentionUnits.DataBind(); RetentionUnits.WBxSafeSetSelectedValue(recordsType.RetentionTimeUnit); RetentionScalar.Text = recordsType.RetentionTimeScalarAsString; AllowPublishingOut.Checked = recordsType.AllowPublishingOut; MinimumPublishingOutProtectiveZone.DataSource = WBRecordsType.getProtectiveZones(); MinimumPublishingOutProtectiveZone.DataBind(); MinimumPublishingOutProtectiveZone.WBxSafeSetSelectedValue(recordsType.MinimumPublishingOutProtectiveZone); GenerateFilenames.Checked = recordsType.GeneratePublishOutFilenames; UseDefaults.Checked = recordsType.UseDefaultsWhenPublishingOut; DefaultRecordsType.Text = recordsType.DefaultPublishingOutRecordsTypeUIControlValue; WorkBoxCollectionURLProperty.Text = recordsType.WorkBoxCollectionUrlProperty; WorkBoxCollectionURL.Text = recordsType.WorkBoxCollectionUrl; CacheDetailsForOpenWorkBoxes.Checked = recordsType.CacheDetailsForOpenWorkBoxes; // Now the document details: AllowDocumentRecords.Checked = recordsType.AllowDocumentRecords; ProtectiveZones.DataSource = WBRecordsType.getProtectiveZones(); ProtectiveZones.DataBind(); ProtectiveZones.WBxSafeSetSelectedValue(recordsType.DocumentMinimumProtectiveZone); DocumentReferenceIDRequirement.DataSource = WBRecordsType.getRequirementOptions(); DocumentReferenceIDRequirement.DataBind(); DocumentReferenceIDRequirement.WBxSafeSetSelectedValue(recordsType.DocumentReferenceIDRequirement); DocumentReferenceIDDescription.Text = recordsType.DocumentReferenceIDDescription; DocumentReferenceDateRequirement.DataSource = WBRecordsType.getRequirementOptions(); DocumentReferenceDateRequirement.DataBind(); DocumentReferenceDateRequirement.WBxSafeSetSelectedValue(recordsType.DocumentReferenceDateRequirement); DocumentReferenceDateSource.DataSource = WBRecordsType.getReferenceDateSources(); DocumentReferenceDateSource.DataBind(); DocumentReferenceDateSource.WBxSafeSetSelectedValue(recordsType.DocumentReferenceDateSource); DocumentReferenceDateDescription.Text = recordsType.DocumentReferenceDateDescription; DocumentSeriesTagRequirement.DataSource = WBRecordsType.getRequirementOptions(); DocumentSeriesTagRequirement.DataBind(); DocumentSeriesTagRequirement.WBxSafeSetSelectedValue(recordsType.DocumentSeriesTagRequirement); DocumentSeriesTagParentTerm.Text = recordsType.DocumentSeriesTagParentTermUIControlValue; DocumentSeriesTagAllowNewTerms.Checked = recordsType.DocumentSeriesTagAllowNewTerms; DocumentSeriesTagDescription.Text = recordsType.DocumentSeriesTagDescription; DocumentScanDateRequirement.DataSource = WBRecordsType.getRequirementOptions(); DocumentScanDateRequirement.DataBind(); DocumentScanDateRequirement.WBxSafeSetSelectedValue(recordsType.DocumentScanDateRequirement); DocumentScanDateDescription.Text = recordsType.DocumentScanDateDescription; DocumentNamingConvention.DataSource = WBRecordsType.getDocumentNamingConventions(); DocumentNamingConvention.DataBind(); DocumentNamingConvention.WBxSafeSetSelectedValue(recordsType.DocumentNamingConvention); EnforceDocumentNamingConvention.Checked = recordsType.EnforceDocumentNamingConvention; FilingRuleLevel1.DataSource = WBRecordsType.getFilingRules(); FilingRuleLevel1.DataBind(); FilingRuleLevel1.WBxSafeSetSelectedValue(recordsType.FilingRuleLevel1); FilingRuleLevel2.DataSource = WBRecordsType.getFilingRules(); FilingRuleLevel2.DataBind(); FilingRuleLevel2.WBxSafeSetSelectedValue(recordsType.FilingRuleLevel2); FilingRuleLevel3.DataSource = WBRecordsType.getFilingRules(); FilingRuleLevel3.DataBind(); FilingRuleLevel3.WBxSafeSetSelectedValue(recordsType.FilingRuleLevel3); FilingRuleLevel4.DataSource = WBRecordsType.getFilingRules(); FilingRuleLevel4.DataBind(); FilingRuleLevel4.WBxSafeSetSelectedValue(recordsType.FilingRuleLevel4); WBFarm farm = WBFarm.Local; if (!String.IsNullOrEmpty(farm.ProtectedRecordsLibraryUrl)) { using (SPSite recordsSite = new SPSite(farm.ProtectedRecordsLibraryUrl)) using (SPWeb recordsWeb = recordsSite.OpenWeb()) { string link = farm.ProtectedRecordsLibraryUrl + "/_layouts/expirationconfig.aspx?RootFolder="; SPList library = recordsWeb.GetList(farm.ProtectedRecordsLibraryUrl); string rootFolder = library.RootFolder.ServerRelativeUrl + recordsType.FullPath; link += Uri.EscapeDataString(rootFolder); link += "&List=" + library.ID.WBxToString(); LinkToRecordsCenterConfig.Text = "<a href=\"" + link + "\">Configure document retention</a>"; } } }