/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { string subject_text = String.Empty; string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_text") == 0) { subject_text = HttpContext.Current.Request.Form[thisKey]; } if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_select") == 0) { string subject_type = HttpContext.Current.Request.Form[thisKey]; Subject_Info_Standard standardSubject = new Subject_Info_Standard { Authority = "fast" }; if (subject_text.Trim().Length > 0) { switch (subject_type) { case "genre": standardSubject.Add_Genre(subject_type); break; case "geographic": standardSubject.Add_Geographic(subject_type); break; case "occupational": standardSubject.Add_Occupation(subject_type); break; case "temporal": standardSubject.Add_Temporal(subject_type); break; case "topic": standardSubject.Add_Topic(subject_type); break; } if ((standardSubject.Topics_Count > 0) || (standardSubject.Genres_Count > 0) || (standardSubject.Geographics_Count > 0) || (standardSubject.Occupations_Count > 0) || (standardSubject.Temporals_Count > 0)) { Bib.Bib_Info.Add_Subject(standardSubject); } } subject_text = String.Empty; } } }
private void split_add_subjects(SobekCM_Item Package, string Data) { if (Data.IndexOf("--") < 0) { Package.Bib_Info.Add_Subject(new Subject_Info_Standard(Data, null)); } else { Subject_Info_Standard subject = new Subject_Info_Standard(); string[] splitter = Data.Split("-".ToCharArray()); foreach (string thisSplit in splitter) { if (thisSplit.Length == 0) { continue; } string tsl = thisSplit.ToLower().Trim(); // Was this geographic? if ((tsl.IndexOf("county") >= 0) || (tsl.IndexOf("(nev.)") > 0) || (tsl.IndexOf("henderson") >= 0) || (tsl.IndexOf("nevada") >= 0) || (tsl.IndexOf("las vegas") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("california") >= 0) || (tsl.IndexOf("los angeles") >= 0) || (tsl.IndexOf("(calif.)") >= 0) || (tsl.IndexOf("russia") >= 0) || (tsl.IndexOf("lake mead") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("united states") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("el paso") >= 0) || (tsl.IndexOf("texas") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("boulder city") >= 0) || (tsl.IndexOf("pittman") >= 0) || (tsl.IndexOf("gabbs") >= 0) || (tsl.IndexOf("california") >= 0) || (tsl.IndexOf("colorado") >= 0) || (tsl.IndexOf("reno") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl == "japan")) { subject.Add_Geographic(thisSplit.Trim().Replace("\"", "")); } // Was this temporal? else if ((tsl.IndexOf("20th century") >= 0) || (tsl.IndexOf("war, 19") >= 0)) { subject.Add_Temporal(thisSplit.Trim()); } else if (tsl.IndexOf("maps, topographic") >= 0) { subject.Add_Genre(thisSplit.Trim()); } else { subject.Add_Topic(thisSplit.Trim()); } } Package.Bib_Info.Add_Subject(subject); } }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object into which to save this element's data </param> public override void Save_To_Bib(SobekCM_Item Bib) { if (base.thisBox.Text.Trim().Length > 0) { if (dublinCore) { Subject_Info_Standard newStandard = new Subject_Info_Standard(); newStandard.Add_Geographic(base.thisBox.Text.Trim()); Bib.Bib_Info.Add_Subject(newStandard); } else { Subject_Info_HierarchicalGeographic newSpatial = new Subject_Info_HierarchicalGeographic(); newSpatial.Area = base.thisBox.Text.Trim(); Bib.Bib_Info.Add_Subject(newSpatial); } } }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { int subject_index = -1; for (int i = 0; i < Bib.Bib_Info.Subjects.Count; i++) { if (Bib.Bib_Info.Subjects[i].Class_Type == Subject_Info_Type.Standard) { subject_index++; if (subject_index == base.index) { Subject_Info_Standard standSubject = (Subject_Info_Standard)Bib.Bib_Info.Subjects[i]; base.thisKeywordBox.Text = standSubject.ToString(); base.thisSchemeBox.Text = standSubject.Authority.ToLower(); break; } } } }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { int subject_index = -1; if (!seperateSpatialExists) { for (int i = 0; i < Bib.Bib_Info.Subjects.Count; i++) { if (Bib.Bib_Info.Subjects[i].Class_Type == Subject_Info_Type.Standard) { subject_index++; if (subject_index == base.index) { Subject_Info_Standard standSubject = (Subject_Info_Standard)Bib.Bib_Info.Subjects[i]; base.thisBox.Text = standSubject.ToString(); break; } } } } else { for (int i = 0; i < Bib.Bib_Info.Subjects.Count; i++) { if (Bib.Bib_Info.Subjects[i].Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = (Subject_Info_Standard)Bib.Bib_Info.Subjects[i]; if ((standSubject.Topics_Count > 0) || (standSubject.Occupations_Count > 0) || (standSubject.Genres_Count > 0)) { subject_index++; if (subject_index == base.index) { base.thisBox.Text = standSubject.ToString(); break; } } } } } }
/// <summary> Constructor for a new instance of the SolrDocument class </summary> /// <param name="Digital_Object"> Digital object to create an easily indexable view object for </param> /// <param name="File_Location"> Location for all of the text files associated with this item </param> /// <remarks> Some work is done in the constructor; in particular, work that eliminates the number of times /// iterations must be made through objects which may be indexed in a number of places. /// This includes subject keywords, spatial information, genres, and information from the table of contents </remarks> public SolrDocument(SobekCM_Item Digital_Object, string File_Location) { digitalObject = Digital_Object; fileLocation = File_Location; // Add the subjects if (digitalObject.Bib_Info.Subjects_Count > 0) { foreach (Subject_Info thisSubject in digitalObject.Bib_Info.Subjects) { // Add every subject to the complete list of subjects allsubjects.Add(thisSubject.ToString(false)); // Add name subjects if (thisSubject.Class_Type == Subject_Info_Type.Name) { namesubject.Add(thisSubject.ToString(false)); } // Add title subjects if (thisSubject.Class_Type == Subject_Info_Type.TitleInfo) { titlesubject.Add(thisSubject.ToString(false)); } // Add the subject keywords if ((thisSubject.Class_Type == Subject_Info_Type.Standard) && (thisSubject.ID.IndexOf("690") < 0) && (thisSubject.ID.IndexOf("691") < 0)) { // Cast to the hierarchical subject type Subject_Info_Standard standSubj = (Subject_Info_Standard)thisSubject; if (standSubj.Genres_Count > 0) { foreach (string genreTerm in standSubj.Genres) { genre.Add(genreTerm.ToLower()); } } if (standSubj.Geographics_Count > 0) { foreach (string geoTerm in standSubj.Geographics) { spatialcoverage.Add(geoTerm); } } if (standSubj.Topics_Count > 0) { foreach (string topicTerm in standSubj.Topics) { subjectkeyword.Add(topicTerm); } } } // Add hierarchical spatial info if (thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial) { // Cast to the hierarchical subject type Subject_Info_HierarchicalGeographic hiero = (Subject_Info_HierarchicalGeographic)thisSubject; // Check for existing subfacets and add if not there if ((hiero.Continent.Length > 0) && (!spatialcoverage.Contains(hiero.Continent))) { spatialcoverage.Add(hiero.Continent); } if ((hiero.Country.Length > 0) && (!country.Contains(hiero.Country))) { country.Add(hiero.Country); } if ((hiero.State.Length > 0) && (!state.Contains(hiero.State))) { state.Add(hiero.State); } if ((hiero.County.Length > 0) && (!county.Contains(hiero.County))) { county.Add(hiero.County); } if ((hiero.City.Length > 0) && (!city.Contains(hiero.City))) { city.Add(hiero.City); } if ((hiero.Island.Length > 0) && (!spatialcoverage.Contains(hiero.Island))) { spatialcoverage.Add(hiero.Island); } } } } // Add the individual genre information (just to be done with genre) if (digitalObject.Bib_Info.Genres_Count > 0) { foreach (Genre_Info thisGenre in digitalObject.Bib_Info.Genres) { genre.Add(thisGenre.Genre_Term.ToLower()); } } // Add all the temporal subjects if (digitalObject.Bib_Info.TemporalSubjects_Count > 0) { foreach (Temporal_Info thisTemporal in digitalObject.Bib_Info.TemporalSubjects) { if (thisTemporal.TimePeriod.Length > 0) { allsubjects.Add(thisTemporal.TimePeriod); temporalsubject.Add(thisTemporal.TimePeriod); } } } // Prepare to step through all the divisions/pages in this item int pageorder = 1; tocterms = new List <string>(); solrpages = new List <SolrPage>(); List <abstract_TreeNode> divsAndPages = digitalObject.Divisions.Physical_Tree.Divisions_PreOrder; // Get the list of all TXT files in this division string[] text_files = Directory.GetFiles(File_Location, "*.txt"); Dictionary <string, string> text_files_existing = new Dictionary <string, string>(); foreach (string thisTextFile in text_files) { string filename = (new FileInfo(thisTextFile)).Name.ToUpper(); text_files_existing[filename] = filename; } // Get the list of all THM.JPG files in this division string[] thumbnail_files = Directory.GetFiles(File_Location, "*thm.jpg"); Dictionary <string, string> thumbnail_files_existing = new Dictionary <string, string>(); foreach (string thisTextFile in thumbnail_files) { string filename = (new FileInfo(thisTextFile)).Name; thumbnail_files_existing[filename.ToUpper().Replace("THM.JPG", "")] = filename; } // Step through all division nodes from the physical tree here List <string> text_files_included = new List <string>(); foreach (abstract_TreeNode thisNode in divsAndPages) { if (thisNode.Page) { // Cast to a page to continnue Page_TreeNode pageNode = (Page_TreeNode)thisNode; // If this is a unique page label, add it if (pageNode.Label.Length > 0) { if (pageNode.Label.ToUpper().IndexOf("PAGE ") < 0) { tocterms.Add(pageNode.Label); } } // Look for the root filename and then look for a matching TEXT file if (pageNode.Files.Count > 0) { string root = pageNode.Files[0].File_Name_Sans_Extension; if (text_files_existing.ContainsKey(root.ToUpper() + ".TXT")) { try { // SInce this is marked to be included, save this name text_files_included.Add(root.ToUpper() + ".TXT"); // Read the page text StreamReader reader = new StreamReader(File_Location + "\\" + root + ".txt"); string pageText = reader.ReadToEnd().Trim(); reader.Close(); // Look for a matching thumbnail string thumbnail = String.Empty; if (thumbnail_files_existing.ContainsKey(root.ToUpper())) { thumbnail = thumbnail_files_existing[root.ToUpper()]; } SolrPage newPage = new SolrPage(digitalObject.BibID, digitalObject.VID, pageorder, pageNode.Label, pageText, thumbnail); solrpages.Add(newPage); } catch { } } } // Increment the page order for the next page irregardless pageorder++; } else { // Add the label or type for this division if (thisNode.Label.Length > 0) { tocterms.Add(thisNode.Label); } else if (thisNode.Type.Length > 0) { tocterms.Add(thisNode.Type); } } } // Now, check for any other valid text files additional_text_files = new List <string>(); foreach (string thisTextFile in text_files_existing.Keys) { if ((!text_files_included.Contains(thisTextFile.ToUpper())) && (thisTextFile.ToUpper() != "AGREEMENT.TXT") && (thisTextFile.ToUpper().IndexOf("REQUEST") != 0)) { additional_text_files.Add(thisTextFile); } } }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { if (!dublinCore) { int hierarchical_index = -1; for (int i = 0; i < Bib.Bib_Info.Subjects.Count; i++) { if (Bib.Bib_Info.Subjects[i].Class_Type == Subject_Info_Type.Hierarchical_Spatial) { hierarchical_index++; if (hierarchical_index == base.index) { Subject_Info_HierarchicalGeographic hierSubject = (Subject_Info_HierarchicalGeographic)Bib.Bib_Info.Subjects[i]; base.thisBox.Text = hierSubject.Area; break; } } } } else { int spatial_index = -1; for (int i = 0; i < Bib.Bib_Info.Subjects.Count; i++) { if (Bib.Bib_Info.Subjects[i].Class_Type == Subject_Info_Type.Hierarchical_Spatial) { spatial_index++; if (spatial_index == base.index) { Subject_Info_HierarchicalGeographic hierSubject = (Subject_Info_HierarchicalGeographic)Bib.Bib_Info.Subjects[i]; base.thisBox.Text = hierSubject.Area; break; } } else if (Bib.Bib_Info.Subjects[i].Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = (Subject_Info_Standard)Bib.Bib_Info.Subjects[i]; if ((standSubject.Genres_Count == 0) && (standSubject.Occupations_Count == 0) && (standSubject.Topics_Count == 0)) { spatial_index++; if (spatial_index == base.index) { // Compute the result StringBuilder builder = new StringBuilder(); if (standSubject.Geographics_Count > 0) { foreach (string thisGeographic in standSubject.Geographics) { if (builder.Length > 0) { builder.Append(" -- "); } builder.Append(thisGeographic.Trim()); } } if (standSubject.Temporals_Count > 0) { foreach (string thisTemporal in standSubject.Temporals ) { if (builder.Length > 0) { builder.Append(" -- "); } builder.Append(thisTemporal.Trim()); } } base.thisBox.Text = builder.ToString(); break; } } } } } }
/// <summary> Class writes simple dublin core to an output stream </summary> /// <param name="Output"> Output stream to write to </param> /// <param name="BibInfo"> Bibliographic information to write </param> public static void Write_Simple_Dublin_Core(TextWriter Output, Bibliographic_Info BibInfo) { // Add all the titles Output.WriteLine("<dc:title>" + BibInfo.Main_Title + "</dc:title>"); List <string> titles = new List <string> { BibInfo.Main_Title.ToString().Trim() }; if (BibInfo.Other_Titles_Count > 0) { foreach (Title_Info thisTitle in BibInfo.Other_Titles) { if (!titles.Contains(thisTitle.ToString().Trim())) { Output.WriteLine("<dc:title>" + Convert_String_To_XML_Safe_Static(thisTitle.ToString()) + "</dc:title>"); titles.Add(thisTitle.ToString().Trim()); } } } // Series title maps to dc:relation if ((BibInfo.hasSeriesTitle) && (BibInfo.SeriesTitle.Title.Length > 0)) { if (!titles.Contains(BibInfo.SeriesTitle.ToString().Trim())) { Output.WriteLine("<dc:relation>" + Convert_String_To_XML_Safe_Static(BibInfo.SeriesTitle.ToString()) + "</dc:relation>"); } } // Add all the creators List <string> contributors = new List <string>(); if ((BibInfo.hasMainEntityName) && (BibInfo.Main_Entity_Name.Full_Name.Length > 0)) { if ((BibInfo.Main_Entity_Name.Roles.Count == 0) || (BibInfo.Main_Entity_Name.Roles[0].Role.ToUpper() != "CONTRIBUTOR")) { Output.WriteLine("<dc:creator>" + Convert_String_To_XML_Safe_Static(BibInfo.Main_Entity_Name.ToString().Replace("<i>", "").Replace("</i>", "")) + "</dc:creator>"); } else { contributors.Add(BibInfo.Main_Entity_Name.ToString(false).Replace("<i>", "").Replace("</i>", "")); } } if (BibInfo.Names_Count > 0) { foreach (Name_Info thisName in BibInfo.Names) { if ((thisName.Roles.Count == 0) || (thisName.Roles[0].Role.ToUpper() != "CONTRIBUTOR")) { Output.WriteLine("<dc:creator>" + Convert_String_To_XML_Safe_Static(thisName.ToString().Replace("<i>", "").Replace("</i>", "")) + "</dc:creator>"); } else { contributors.Add(thisName.ToString(false).Replace("<i>", "").Replace("</i>", "")); } } } // Add any collected contributors if (contributors.Count > 0) { foreach (string thisContributor in contributors) { Output.WriteLine("<dc:contributor>" + Convert_String_To_XML_Safe_Static(thisContributor) + "</dc:contributor>"); } } // Add the coverages (hierarchical geographic) if (BibInfo.Subjects_Count > 0) { foreach (Subject_Info thisSubject in BibInfo.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial) { string subject_string = thisSubject.ToString(); if (subject_string.Length > 0) { Output.WriteLine("<dc:coverage>" + Convert_String_To_XML_Safe_Static(subject_string) + "</dc:coverage>"); } } } } // Add the coverages (temporal) if (BibInfo.TemporalSubjects_Count > 0) { foreach (Temporal_Info thisTemporal in BibInfo.TemporalSubjects) { if (thisTemporal.TimePeriod.Length > 0) { Output.WriteLine("<dc:coverage>" + Convert_String_To_XML_Safe_Static(thisTemporal.TimePeriod) + "</dc:coverage>"); } } } // Add the date issued if (BibInfo.Origin_Info.Date_Issued.Length > 0) { Output.WriteLine("<dc:date>" + Convert_String_To_XML_Safe_Static(BibInfo.Origin_Info.Date_Issued) + "</dc:date>"); } // Add all descriptions/notes if ((BibInfo.Original_Description != null) && (BibInfo.Original_Description.Notes_Count > 0)) { foreach (string physicalDescNote in BibInfo.Original_Description.Notes) { Output.WriteLine("<dc:description>" + Convert_String_To_XML_Safe_Static(physicalDescNote) + "</dc:description>"); } } if (BibInfo.Notes_Count > 0) { foreach (Note_Info thisNote in BibInfo.Notes) { if (thisNote.Note_Type != Note_Type_Enum.source) { Output.WriteLine("<dc:description>" + Convert_String_To_XML_Safe_Static(thisNote.ToString().Replace("<b>", "(").Replace("</b>", ") ")) + "</dc:description>"); } } } // Add the format if (BibInfo.Original_Description.Extent.Length > 0) { Output.WriteLine("<dc:format>" + Convert_String_To_XML_Safe_Static(BibInfo.Original_Description.Extent) + "</dc:format>"); } // Add all the other identifiers if (BibInfo.Identifiers_Count > 0) { foreach (Identifier_Info thisIdentifier in BibInfo.Identifiers) { Output.WriteLine("<dc:identifier>" + Convert_String_To_XML_Safe_Static(thisIdentifier.Identifier) + "</dc:identifier>"); } } // Add the language information if (BibInfo.Languages_Count > 0) { foreach (Language_Info thisLanguage in BibInfo.Languages) { if (thisLanguage.Language_Text.Length > 0) { Output.WriteLine("<dc:language>" + Convert_String_To_XML_Safe_Static(thisLanguage.Language_Text) + "</dc:language>"); } } } // Add the subjects if (BibInfo.Subjects_Count > 0) { foreach (Subject_Info thisSubject in BibInfo.Subjects) { if (thisSubject.Class_Type != Subject_Info_Type.Hierarchical_Spatial) { if (thisSubject.Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubj = (Subject_Info_Standard)thisSubject; if (standSubj.Geographics_Count > 0) { string[] geographics = new string[standSubj.Geographics_Count]; standSubj.Geographics.CopyTo(geographics, 0); standSubj.Clear_Geographics(); string subject_string = thisSubject.ToString(); if (subject_string.Length > 0) { Output.WriteLine("<dc:subject>" + Convert_String_To_XML_Safe_Static(subject_string.Replace("<i>", "").Replace("</i>", "")) + "</dc:subject>"); } foreach (string thisGeographic in geographics) { Output.WriteLine("<dc:coverage>" + Convert_String_To_XML_Safe_Static(thisGeographic) + "</dc:coverage>"); standSubj.Add_Geographic(thisGeographic); } } else { string subject_string = thisSubject.ToString(); if (subject_string.Length > 0) { Output.WriteLine("<dc:subject>" + Convert_String_To_XML_Safe_Static(subject_string.Replace("<i>", "").Replace("</i>", "")) + "</dc:subject>"); } } } else { string subject_string = thisSubject.ToString(); if (subject_string.Length > 0) { Output.WriteLine("<dc:subject>" + Convert_String_To_XML_Safe_Static(subject_string.Replace("<i>", "").Replace("</i>", "")) + "</dc:subject>"); } } } } } // Add all the publishers from the origin info section if (BibInfo.Origin_Info.Publishers_Count > 0) { foreach (string publisher in BibInfo.Origin_Info.Publishers) { Output.WriteLine("<dc:publisher>" + Convert_String_To_XML_Safe_Static(publisher) + "</dc:publisher>"); } } // Add all publishers held in the more complete custom section if (BibInfo.Publishers.Count > 0) { foreach (Publisher_Info thisPublisher in BibInfo.Publishers) { Output.WriteLine("<dc:publisher>" + Convert_String_To_XML_Safe_Static(thisPublisher.ToString()) + "</dc:publisher>"); } } // Add the type string mods_type = BibInfo.Type.MODS_Type_String; if (mods_type.Length > 0) { Output.WriteLine("<dc:type>" + Convert_String_To_XML_Safe_Static(mods_type) + "</dc:type>"); } if (BibInfo.Type.Uncontrolled_Types_Count > 0) { foreach (string thisType in BibInfo.Type.Uncontrolled_Types) { Output.WriteLine("<dc:type>" + Convert_String_To_XML_Safe_Static(thisType) + "</dc:type>"); } } // Add the relations if (BibInfo.RelatedItems_Count > 0) { foreach (Related_Item_Info thisRelatedItem in BibInfo.RelatedItems) { if (thisRelatedItem.Main_Title.Title.Trim().Length > 0) { Output.WriteLine("<dc:relation>" + Convert_String_To_XML_Safe_Static(thisRelatedItem.Main_Title.Title) + "</dc:relation>"); } } } // Add the rights if (BibInfo.Access_Condition.Text.Length > 0) { Output.WriteLine("<dc:rights>" + Convert_String_To_XML_Safe_Static(BibInfo.Access_Condition.Text) + "</dc:rights>"); } // Add the source note if (BibInfo.Notes_Count > 0) { foreach (Note_Info thisNote in BibInfo.Notes) { if (thisNote.Note_Type == Note_Type_Enum.source) { Output.WriteLine("<dc:source>" + Convert_String_To_XML_Safe_Static(thisNote.Note) + "</dc:source>"); } } } //// Add the source information //if (BibInfo.Source.Statement.Length > 0) //{ // Output.WriteLine("<dc:source>" + BibInfo.Source.XML_Safe_Statement + "</dc:source>"); //} }
/// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary> /// <param name="R"> XmlTextReader from which to read the dublin core data </param> /// <param name="BibInfo"> Digital resource object to save the data to </param> /// <param name="Return_Package"> The return package, if this is reading a top-level section of dublin core </param> public static void Read_Simple_Dublin_Core_Info(XmlReader R, Bibliographic_Info BibInfo, SobekCM_Item Return_Package) { while (R.Read()) { if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "METS:mdWrap") || (R.Name == "mdWrap"))) { return; } if (R.NodeType == XmlNodeType.Element) { switch (R.Name) { case "dc:contributor": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Add_Named_Entity(R.Value.Trim(), "Contributor"); } break; case "dc:coverage": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { Subject_Info_Standard thisSubject = new Subject_Info_Standard(); thisSubject.Add_Geographic(R.Value.Trim()); BibInfo.Add_Subject(thisSubject); } break; case "dc:creator": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { if (BibInfo.Main_Entity_Name.hasData) { BibInfo.Add_Named_Entity(R.Value.Trim()); } else { BibInfo.Main_Entity_Name.Full_Name = R.Value.Trim(); } } break; case "dc:date": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Origin_Info.Date_Issued = R.Value.Trim(); } break; case "dc:description": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Add_Note(R.Value.Trim()); } break; case "dc:format": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Original_Description.Extent = R.Value.Trim(); } break; case "dc:identifier": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Add_Identifier(R.Value.Trim()); } break; case "dc:language": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Add_Language(R.Value.Trim()); } break; case "dc:publisher": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Add_Publisher(R.Value.Trim()); } break; case "dc:relation": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { Related_Item_Info newRelatedItem = new Related_Item_Info(); newRelatedItem.Main_Title.Title = R.Value.Trim(); BibInfo.Add_Related_Item(newRelatedItem); } break; case "dc:rights": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Access_Condition.Text = R.Value.Trim(); } break; case "dc:source": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Add_Note(R.Value, Note_Type_Enum.source); } break; case "dc:subject": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { if (R.Value.IndexOf(";") > 0) { string[] splitter = R.Value.Split(";".ToCharArray()); foreach (string thisSplit in splitter) { BibInfo.Add_Subject(thisSplit.Trim(), String.Empty); } } else { BibInfo.Add_Subject(R.Value.Trim(), String.Empty); } } break; case "dc:title": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { if (BibInfo.Main_Title.Title.Length == 0) { BibInfo.Main_Title.Title = R.Value.Trim(); } else { BibInfo.Add_Other_Title(R.Value.Trim(), Title_Type_Enum.alternative); } } break; case "dc:type": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0)) { BibInfo.Type.Add_Uncontrolled_Type(R.Value.Trim()); } break; case "thesis.degree.name": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null)) { // Ensure the thesis object exists and is added Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; if (thesisInfo == null) { thesisInfo = new Thesis_Dissertation_Info(); Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo); } thesisInfo.Degree = R.Value.Trim(); } break; case "thesis.degree.level": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null)) { // Ensure the thesis object exists and is added Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; if (thesisInfo == null) { thesisInfo = new Thesis_Dissertation_Info(); Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo); } string temp = R.Value.Trim().ToLower(); if ((temp == "doctorate") || (temp == "doctoral")) { thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate; } if ((temp == "masters") || (temp == "master's")) { thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters; } if ((temp == "bachelors") || (temp == "bachelor's")) { thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors; } if ((temp == "post-doctorate") || (temp == "post-doctoral")) { thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors; } } break; case "thesis.degree.discipline": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null)) { // Ensure the thesis object exists and is added Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; if (thesisInfo == null) { thesisInfo = new Thesis_Dissertation_Info(); Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo); } thesisInfo.Add_Degree_Discipline(R.Value.Trim()); } break; case "thesis.degree.grantor": R.Read(); if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null)) { // Ensure the thesis object exists and is added Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; if (thesisInfo == null) { thesisInfo = new Thesis_Dissertation_Info(); Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo); } thesisInfo.Degree_Grantor = R.Value.Trim(); } break; } } } }
/// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary> /// <param name="r"> XmlTextReader from which to read the dublin core data </param> /// <param name="thisBibInfo"> Digital resource object to save the data to </param> public static void Read_Simple_Dublin_Core_Info(XmlReader r, Bibliographic_Info thisBibInfo) { while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "METS:mdWrap") || (r.Name == "mdWrap"))) { return; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "dc:contributor": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Add_Named_Entity(r.Value.Trim(), "Contributor"); } break; case "dc:coverage": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { Subject_Info_Standard thisSubject = new Subject_Info_Standard(); thisSubject.Add_Geographic(r.Value.Trim()); thisBibInfo.Add_Subject(thisSubject); } break; case "dc:creator": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { if (thisBibInfo.Main_Entity_Name.hasData) { thisBibInfo.Add_Named_Entity(r.Value.Trim()); } else { thisBibInfo.Main_Entity_Name.Full_Name = r.Value.Trim(); } } break; case "dc:date": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Origin_Info.Date_Issued = r.Value.Trim(); } break; case "dc:description": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Add_Note(r.Value.Trim()); } break; case "dc:format": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Original_Description.Extent = r.Value.Trim(); } break; case "dc:identifier": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Add_Identifier(r.Value.Trim()); } break; case "dc:language": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Add_Language(r.Value.Trim()); } break; case "dc:publisher": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Add_Publisher(r.Value.Trim()); } break; case "dc:relation": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { Related_Item_Info newRelatedItem = new Related_Item_Info(); newRelatedItem.Main_Title.Title = r.Value.Trim(); thisBibInfo.Add_Related_Item(newRelatedItem); } break; case "dc:rights": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Access_Condition.Text = r.Value.Trim(); } break; case "dc:source": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Add_Note(r.Value, Note_Type_Enum.source); } break; case "dc:subject": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { if (r.Value.IndexOf(";") > 0) { string[] splitter = r.Value.Split(";".ToCharArray()); foreach (string thisSplit in splitter) { thisBibInfo.Add_Subject(thisSplit.Trim(), String.Empty); } } else { thisBibInfo.Add_Subject(r.Value.Trim(), String.Empty); } } break; case "dc:title": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { if (thisBibInfo.Main_Title.Title.Length == 0) { thisBibInfo.Main_Title.Title = r.Value.Trim(); } else { thisBibInfo.Add_Other_Title(r.Value.Trim(), Title_Type_Enum.alternative); } } break; case "dc:type": r.Read(); if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0)) { thisBibInfo.Type.Add_Uncontrolled_Type(r.Value.Trim()); } break; } } } }
/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { if (thisKey.IndexOf("formsubjecttype_") == 0) { string diff = thisKey.Replace("formsubjecttype_", ""); string topic1 = HttpContext.Current.Request.Form["formsubjecttopic1_" + diff].Trim(); string topic2 = HttpContext.Current.Request.Form["formsubjecttopic2_" + diff].Trim(); string topic3 = HttpContext.Current.Request.Form["formsubjecttopic3_" + diff].Trim(); string topic4 = HttpContext.Current.Request.Form["formsubjecttopic4_" + diff].Trim(); string temporal1 = HttpContext.Current.Request.Form["formsubjecttemporal1_" + diff].Trim(); string temporal2 = HttpContext.Current.Request.Form["formsubjecttemporal2_" + diff].Trim(); string geographic1 = HttpContext.Current.Request.Form["formsubjectgeo1_" + diff].Trim(); string geographic2 = HttpContext.Current.Request.Form["formsubjectgeo2_" + diff].Trim(); string genre1 = HttpContext.Current.Request.Form["formsubjectgenre1_" + diff].Trim(); string genre2 = HttpContext.Current.Request.Form["formsubjectgenre2_" + diff].Trim(); string occcupation = HttpContext.Current.Request.Form["formsubjectoccup1_" + diff].Trim(); string authority = HttpContext.Current.Request.Form["formsubjectauthority_" + diff].Trim(); string language = HttpContext.Current.Request.Form["formsubjectlanguage_" + diff].Trim(); string marc = HttpContext.Current.Request.Form["formsubjectmap_" + diff].Trim(); if ((topic1.Length > 0) || (topic2.Length > 0) || (topic3.Length > 0) || (topic4.Length > 0) || (temporal1.Length > 0) || (temporal2.Length > 0) || (geographic1.Length > 0) || (geographic2.Length > 0) || (genre1.Length > 0) || (genre2.Length > 0) || (occcupation.Length > 0)) { Subject_Info_Standard newSubject = new Subject_Info_Standard(); if (topic1.Length > 0) { newSubject.Add_Topic(topic1); } if (topic2.Length > 0) { newSubject.Add_Topic(topic2); } if (topic3.Length > 0) { newSubject.Add_Topic(topic3); } if (topic4.Length > 0) { newSubject.Add_Topic(topic4); } if (temporal1.Length > 0) { newSubject.Add_Temporal(temporal1); } if (temporal2.Length > 0) { newSubject.Add_Temporal(temporal2); } if (geographic1.Length > 0) { newSubject.Add_Geographic(geographic1); } if (geographic2.Length > 0) { newSubject.Add_Geographic(geographic2); } if (genre1.Length > 0) { newSubject.Add_Genre(genre1); } if (genre2.Length > 0) { newSubject.Add_Genre(genre2); } if (occcupation.Length > 0) { newSubject.Add_Occupation(occcupation); } newSubject.Authority = authority; newSubject.Language = language; if ((marc.Length > 0) && (marc != "none")) { newSubject.ID = "SUBJ" + marc + "_" + diff; } Bib.Bib_Info.Add_Subject(newSubject); } } } }
private void saveButton_Button_Pressed(object sender, EventArgs e) { if (!read_only) { saved = true; switch (typeComboBox.SelectedIndex) { case 0: Subject_Info_Name nameSubject = (Subject_Info_Name)thisSubject; nameSubject.Clear_Topics(); nameSubject.Clear_Temporals(); nameSubject.Clear_Genres(); nameSubject.Clear_Geographics(); if (topical1TextBox.Text.Trim().Length > 0) { nameSubject.Add_Topic(topical1TextBox.Text.Trim()); } if (topical2TextBox.Text.Trim().Length > 0) { nameSubject.Add_Topic(topical2TextBox.Text.Trim()); } if (topical3TextBox.Text.Trim().Length > 0) { nameSubject.Add_Topic(topical3TextBox.Text.Trim()); } if (topical4TextBox.Text.Trim().Length > 0) { nameSubject.Add_Topic(topical4TextBox.Text.Trim()); } if (temporal1TextBox.Text.Trim().Length > 0) { nameSubject.Add_Temporal(temporal1TextBox.Text.Trim()); } if (temporal2TextBox.Text.Trim().Length > 0) { nameSubject.Add_Temporal(temporal2TextBox.Text.Trim()); } if (geographic1TextBox.Text.Trim().Length > 0) { nameSubject.Add_Geographic(geographic1TextBox.Text.Trim()); } if (geographic2TextBox.Text.Trim().Length > 0) { nameSubject.Add_Geographic(geographic2TextBox.Text.Trim()); } if (genre1TextBox.Text.Trim().Length > 0) { nameSubject.Add_Genre(genre1TextBox.Text.Trim()); } if (genre2TextBox.Text.Trim().Length > 0) { nameSubject.Add_Genre(genre2TextBox.Text.Trim()); } nameSubject.Authority = authorityComboBox.Text; nameSubject.Language = languageComboBox.Text; thisSubject = nameSubject; break; case 1: Subject_Info_Standard standardSubject = (Subject_Info_Standard)thisSubject; standardSubject.Clear_Topics(); standardSubject.Clear_Temporals(); standardSubject.Clear_Genres(); standardSubject.Clear_Geographics(); standardSubject.Clear_Occupations(); if (topical1TextBox.Text.Trim().Length > 0) { standardSubject.Add_Topic(topical1TextBox.Text.Trim()); } if (topical2TextBox.Text.Trim().Length > 0) { standardSubject.Add_Topic(topical2TextBox.Text.Trim()); } if (topical3TextBox.Text.Trim().Length > 0) { standardSubject.Add_Topic(topical3TextBox.Text.Trim()); } if (topical4TextBox.Text.Trim().Length > 0) { standardSubject.Add_Topic(topical4TextBox.Text.Trim()); } if (temporal1TextBox.Text.Trim().Length > 0) { standardSubject.Add_Temporal(temporal1TextBox.Text.Trim()); } if (temporal2TextBox.Text.Trim().Length > 0) { standardSubject.Add_Temporal(temporal2TextBox.Text.Trim()); } if (geographic1TextBox.Text.Trim().Length > 0) { standardSubject.Add_Geographic(geographic1TextBox.Text.Trim()); } if (geographic2TextBox.Text.Trim().Length > 0) { standardSubject.Add_Geographic(geographic2TextBox.Text.Trim()); } if (genre1TextBox.Text.Trim().Length > 0) { standardSubject.Add_Genre(genre1TextBox.Text.Trim()); } if (genre2TextBox.Text.Trim().Length > 0) { standardSubject.Add_Genre(genre2TextBox.Text.Trim()); } if (optionalTextBox.Text.Trim().Length > 0) { standardSubject.Add_Occupation(optionalTextBox.Text.Trim()); } standardSubject.Authority = authorityComboBox.Text; standardSubject.Language = languageComboBox.Text; thisSubject = standardSubject; if (marcComboBox.Text.Length > 0) { switch (marcComboBox.SelectedIndex) { case 1: if (standardSubject.ID.IndexOf("SUBJ648") < 0) { standardSubject.ID = "SUBJ648"; } break; case 2: if (standardSubject.ID.IndexOf("SUBJ650") < 0) { standardSubject.ID = "SUBJ650"; } break; case 3: if (standardSubject.ID.IndexOf("SUBJ651") < 0) { standardSubject.ID = "SUBJ651"; } break; case 4: if (standardSubject.ID.IndexOf("SUBJ653") < 0) { standardSubject.ID = "SUBJ653"; } break; case 5: if (standardSubject.ID.IndexOf("SUBJ654") < 0) { standardSubject.ID = "SUBJ654"; } break; case 6: if (standardSubject.ID.IndexOf("SUBJ655") < 0) { standardSubject.ID = "SUBJ655"; } break; case 7: if (standardSubject.ID.IndexOf("SUBJ656") < 0) { standardSubject.ID = "SUBJ656"; } break; case 8: if (standardSubject.ID.IndexOf("SUBJ657") < 0) { standardSubject.ID = "SUBJ657"; } break; case 9: if (standardSubject.ID.IndexOf("SUBJ690") < 0) { standardSubject.ID = "SUBJ690"; } break; case 10: if (standardSubject.ID.IndexOf("SUBJ691") < 0) { standardSubject.ID = "SUBJ691"; } break; } } else { if (thisSubject.ID.IndexOf("SUBJ") >= 0) { thisSubject.ID = String.Empty; } } break; case 2: Subject_Info_TitleInfo titleSubject = (Subject_Info_TitleInfo)thisSubject; titleSubject.Clear_Topics(); titleSubject.Clear_Temporals(); titleSubject.Clear_Genres(); titleSubject.Clear_Geographics(); if (topical1TextBox.Text.Trim().Length > 0) { titleSubject.Add_Topic(topical1TextBox.Text.Trim()); } if (topical2TextBox.Text.Trim().Length > 0) { titleSubject.Add_Topic(topical2TextBox.Text.Trim()); } if (topical3TextBox.Text.Trim().Length > 0) { titleSubject.Add_Topic(topical3TextBox.Text.Trim()); } if (topical4TextBox.Text.Trim().Length > 0) { titleSubject.Add_Topic(topical4TextBox.Text.Trim()); } if (temporal1TextBox.Text.Trim().Length > 0) { titleSubject.Add_Temporal(temporal1TextBox.Text.Trim()); } if (temporal2TextBox.Text.Trim().Length > 0) { titleSubject.Add_Temporal(temporal2TextBox.Text.Trim()); } if (geographic1TextBox.Text.Trim().Length > 0) { titleSubject.Add_Geographic(geographic1TextBox.Text.Trim()); } if (geographic2TextBox.Text.Trim().Length > 0) { titleSubject.Add_Geographic(geographic2TextBox.Text.Trim()); } if (genre1TextBox.Text.Trim().Length > 0) { titleSubject.Add_Genre(genre1TextBox.Text.Trim()); } if (genre2TextBox.Text.Trim().Length > 0) { titleSubject.Add_Genre(genre2TextBox.Text.Trim()); } titleSubject.Authority = authorityComboBox.Text; titleSubject.Language = languageComboBox.Text; thisSubject = titleSubject; break; } } Close(); }
public void SetSubject(Subject_Info Subject) { fromPackage = true; typeComboBox.SelectedIndexChanged -= typeComboBox_SelectedIndexChanged; // Save the subject thisSubject = Subject; // Display the values at the base class level languageComboBox.Text = thisSubject.Language; authorityComboBox.Text = thisSubject.Authority; // Display data according to subject type switch (thisSubject.Class_Type) { case Subject_Info_Type.Name: marcComboBox.Hide(); marcLabel.Hide(); optionalLabel.Text = "Name:"; typeComboBox.SelectedIndex = 0; Subject_Info_Name nameSubject = (Subject_Info_Name)thisSubject; optionalTextBox.Text = nameSubject.Name_Object.ToString().Replace("<i>", "").Replace("</i>", "").Replace("&", "&").Replace(""", "\""); optionalTextBox.ReadOnly = true; if (nameSubject.Topics.Count > 0) { topical1TextBox.Text = nameSubject.Topics[0]; } if (nameSubject.Topics.Count > 1) { topical2TextBox.Text = nameSubject.Topics[1]; } if (nameSubject.Topics.Count > 2) { topical3TextBox.Text = nameSubject.Topics[2]; } if (nameSubject.Topics.Count > 3) { topical4TextBox.Text = nameSubject.Topics[3]; } if (nameSubject.Temporals.Count > 0) { temporal1TextBox.Text = nameSubject.Temporals[0]; } if (nameSubject.Temporals.Count > 1) { temporal2TextBox.Text = nameSubject.Temporals[1]; } if (nameSubject.Geographics.Count > 0) { geographic1TextBox.Text = nameSubject.Geographics[0]; } if (nameSubject.Geographics.Count > 1) { geographic2TextBox.Text = nameSubject.Geographics[1]; } if (nameSubject.Genres.Count > 0) { genre1TextBox.Text = nameSubject.Genres[0]; } if (nameSubject.Genres.Count > 1) { genre2TextBox.Text = nameSubject.Genres[1]; } break; case Subject_Info_Type.TitleInfo: marcComboBox.Hide(); marcLabel.Hide(); optionalLabel.Text = "Title:"; typeComboBox.SelectedIndex = 2; Subject_Info_TitleInfo titleSubject = (Subject_Info_TitleInfo)thisSubject; optionalTextBox.Text = titleSubject.Title_Object.ToString(); optionalTextBox.ReadOnly = true; if (titleSubject.Topics.Count > 0) { topical1TextBox.Text = titleSubject.Topics[0]; } if (titleSubject.Topics.Count > 1) { topical2TextBox.Text = titleSubject.Topics[1]; } if (titleSubject.Topics.Count > 2) { topical3TextBox.Text = titleSubject.Topics[2]; } if (titleSubject.Topics.Count > 3) { topical4TextBox.Text = titleSubject.Topics[3]; } if (titleSubject.Temporals.Count > 0) { temporal1TextBox.Text = titleSubject.Temporals[0]; } if (titleSubject.Temporals.Count > 1) { temporal2TextBox.Text = titleSubject.Temporals[1]; } if (titleSubject.Geographics.Count > 0) { geographic1TextBox.Text = titleSubject.Geographics[0]; } if (titleSubject.Geographics.Count > 1) { geographic2TextBox.Text = titleSubject.Geographics[1]; } if (titleSubject.Genres.Count > 0) { genre1TextBox.Text = titleSubject.Genres[0]; } if (titleSubject.Genres.Count > 1) { genre2TextBox.Text = titleSubject.Genres[1]; } break; case Subject_Info_Type.Standard: marcComboBox.Show(); marcLabel.Show(); optionalLabel.Text = "Occupation:"; optionalTextBox.ReadOnly = false; optionalTextBox.Clear(); typeComboBox.SelectedIndex = 1; Subject_Info_Standard standardSubject = (Subject_Info_Standard)thisSubject; if (standardSubject.Topics.Count > 0) { topical1TextBox.Text = standardSubject.Topics[0]; } if (standardSubject.Topics.Count > 1) { topical2TextBox.Text = standardSubject.Topics[1]; } if (standardSubject.Topics.Count > 2) { topical3TextBox.Text = standardSubject.Topics[2]; } if (standardSubject.Topics.Count > 3) { topical4TextBox.Text = standardSubject.Topics[3]; } if (standardSubject.Temporals.Count > 0) { temporal1TextBox.Text = standardSubject.Temporals[0]; } if (standardSubject.Temporals.Count > 1) { temporal2TextBox.Text = standardSubject.Temporals[1]; } if (standardSubject.Geographics.Count > 0) { geographic1TextBox.Text = standardSubject.Geographics[0]; } if (standardSubject.Geographics.Count > 1) { geographic2TextBox.Text = standardSubject.Geographics[1]; } if (standardSubject.Genres.Count > 0) { genre1TextBox.Text = standardSubject.Genres[0]; } if (standardSubject.Genres.Count > 1) { genre2TextBox.Text = standardSubject.Genres[1]; } if (standardSubject.Occupations.Count > 0) { optionalTextBox.Text = standardSubject.Occupations[0]; } if (standardSubject.ID.IndexOf("SUBJ648") >= 0) { marcComboBox.SelectedIndex = 1; } if (standardSubject.ID.IndexOf("SUBJ650") >= 0) { marcComboBox.SelectedIndex = 2; } if (standardSubject.ID.IndexOf("SUBJ651") >= 0) { marcComboBox.SelectedIndex = 3; } if (standardSubject.ID.IndexOf("SUBJ653") >= 0) { marcComboBox.SelectedIndex = 4; } if (standardSubject.ID.IndexOf("SUBJ654") >= 0) { marcComboBox.SelectedIndex = 5; } if (standardSubject.ID.IndexOf("SUBJ655") >= 0) { marcComboBox.SelectedIndex = 6; } if (standardSubject.ID.IndexOf("SUBJ656") >= 0) { marcComboBox.SelectedIndex = 7; } if (standardSubject.ID.IndexOf("SUBJ657") >= 0) { marcComboBox.SelectedIndex = 8; } if (standardSubject.ID.IndexOf("SUBJ690") >= 0) { marcComboBox.SelectedIndex = 9; } if (standardSubject.ID.IndexOf("SUBJ691") >= 0) { marcComboBox.SelectedIndex = 10; } break; } typeComboBox.SelectedIndexChanged += typeComboBox_SelectedIndexChanged; typeComboBox.TextChanged += textChanged; authorityComboBox.TextChanged += textChanged; languageComboBox.TextChanged += textChanged; marcComboBox.TextChanged += textChanged; optionalTextBox.TextChanged += textChanged; geographic1TextBox.TextChanged += textChanged; temporal1TextBox.TextChanged += textChanged; topical1TextBox.TextChanged += textChanged; topical4TextBox.TextChanged += textChanged; topical2TextBox.TextChanged += textChanged; topical3TextBox.TextChanged += textChanged; temporal2TextBox.TextChanged += textChanged; geographic2TextBox.TextChanged += textChanged; genre2TextBox.TextChanged += textChanged; genre1TextBox.TextChanged += textChanged; }
/// <summary> </summary> /// <param name="thisElement"></param> /// <param name="Bib"></param> /// <returns></returns> private int Get_Bib_Element_Count(abstract_Element thisElement, SobekCM_Item Bib) { switch (thisElement.Type) { case Element_Type.Abstract: return(Bib.Bib_Info.Abstracts_Count); case Element_Type.Affiliation: return(Bib.Bib_Info.Affiliations_Count); case Element_Type.Aggregations: return(Bib.Behaviors.Aggregation_Count > 0 ? 1 : 0); case Element_Type.Attribution: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type == Note_Type_Enum.funding)); case Element_Type.BibID: return(1); case Element_Type.Classification: return(Bib.Bib_Info.Classifications_Count); case Element_Type.Contributor: int contributor_count = 0; if ((Bib.Bib_Info.Main_Entity_Name.hasData) && (Bib.Bib_Info.Main_Entity_Name.Roles.Count > 0) && ((Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() == "CONTRIBUTOR") || (Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() == "CTB"))) { contributor_count++; } contributor_count += Bib.Bib_Info.Names.Count(thisName => (thisName.Roles.Count > 0) && ((thisName.Roles[0].Role.ToUpper() == "CONTRIBUTOR") || (thisName.Roles[0].Role.ToUpper() == "CTB"))); return(contributor_count); case Element_Type.Coordinates: GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { return(0); } return((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0) ? 1 : 0); case Element_Type.Creator: if ((thisElement.Display_SubType != "simple") || (((Creator_Simple_Element)thisElement).Contributor_Exists == false)) { return(Bib.Bib_Info.Main_Entity_Name.hasData ? Bib.Bib_Info.Names.Count + 1 : Bib.Bib_Info.Names.Count); } int non_contributor_count = 0; if ((Bib.Bib_Info.Main_Entity_Name.hasData) && ((Bib.Bib_Info.Main_Entity_Name.Roles.Count == 0) || ((Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() != "CONTRIBUTOR") && (Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() != "CTB")))) { non_contributor_count++; } non_contributor_count += Bib.Bib_Info.Names.Count(thisName => (thisName.Roles.Count == 0) || ((thisName.Roles[0].Role.ToUpper() != "CONTRIBUTOR") && (thisName.Roles[0].Role.ToUpper() != "CTB"))); return(non_contributor_count); case Element_Type.CreatorNotes: return(Bib.METS_Header.Creator_Individual_Notes_Count > 0 ? 1 : 0); case Element_Type.Date: return(Bib.Bib_Info.Origin_Info.Date_Issued.Length == 0 ? 0 : 1); case Element_Type.DateCopyrighted: return(Bib.Bib_Info.Origin_Info.Date_Copyrighted.Length > 0 ? 1 : 0); case Element_Type.DescriptionStandard: return(Bib.Bib_Info.Record.Description_Standard.Length > 0 ? 1 : 0); case Element_Type.Donor: return(Bib.Bib_Info.Donor.Full_Name.Length > 0 ? 1 : 0); case Element_Type.Edition: return(Bib.Bib_Info.Origin_Info.Edition.Length > 0 ? 1 : 0); case Element_Type.EncodingLevel: return(Bib.Bib_Info.EncodingLevel.Length > 0 ? 1 : 0); case Element_Type.EAD: return((Bib.Bib_Info.Location.EAD_URL.Length > 0) || (Bib.Bib_Info.Location.EAD_Name.Length > 0) ? 1 : 0); case Element_Type.Error: return(0); case Element_Type.ETD_CommitteeChair: Thesis_Dissertation_Info thesisInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo != null) && (thesisInfo.Committee_Chair.Length > 0) ? 1 : 0); case Element_Type.ETD_CommitteeCoChair: Thesis_Dissertation_Info thesisInfo2 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo2 != null) && (thesisInfo2.Committee_Co_Chair.Length > 0) ? 1 : 0); case Element_Type.ETD_CommitteeMember: Thesis_Dissertation_Info thesisInfo3 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo3 != null) ? thesisInfo3.Committee_Members_Count : 0); case Element_Type.ETD_Degree: Thesis_Dissertation_Info thesisInfo4 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo4 != null) && (thesisInfo4.Degree.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeDiscipline: Thesis_Dissertation_Info thesisInfo5 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo5 != null) && (thesisInfo5.Degree_Discipline.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeGrantor: Thesis_Dissertation_Info thesisInfo6 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo6 != null) && (thesisInfo6.Degree_Grantor.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeLevel: Thesis_Dissertation_Info thesisInfo7 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo7 != null) && (thesisInfo7.Degree_Level != Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Unknown) ? 1 : 0); case Element_Type.ETD_GraduationDate: Thesis_Dissertation_Info thesisInfo8 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo8 != null) && (thesisInfo8.Graduation_Date.HasValue) ? 1 : 0); case Element_Type.FCLA_Flags: return(1); case Element_Type.FDA_Account: DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo != null && daitssInfo.Account.Trim().Length > 0 ? 1 : 0); case Element_Type.FDA_SubAccount: DAITSS_Info daitssInfo2 = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo2 != null && daitssInfo2.SubAccount.Trim().Length > 0 ? 1 : 0); case Element_Type.FDA_Project: DAITSS_Info daitssInfo3 = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo3 != null && daitssInfo3.Project.Trim().Length > 0 ? 1 : 0); case Element_Type.Format: return(Bib.Bib_Info.Original_Description.Extent.Length > 0 ? 1 : 0); case Element_Type.Frequency: return(Bib.Bib_Info.Origin_Info.Frequencies_Count); case Element_Type.Genre: return(Bib.Bib_Info.Genres_Count); case Element_Type.Holding: return(1); case Element_Type.Wordmark: return(Bib.Behaviors.Wordmark_Count > 0 ? 1 : 0); case Element_Type.Identifier: return(Bib.Bib_Info.Identifiers_Count); case Element_Type.Language: return(Bib.Bib_Info.Languages.Count(thisLanguage => thisLanguage.Language_Text.Length > 0)); case Element_Type.MainThumbnail: return(Bib.Behaviors.Main_Thumbnail.Length > 0 ? 1 : 0); case Element_Type.Manufacturer: return(Bib.Bib_Info.Manufacturers_Count); case Element_Type.Note: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type != Note_Type_Enum.statement_of_responsibility)); case Element_Type.OtherURL: return((Bib.Bib_Info.Location.Other_URL.Length > 0) || (Bib.Bib_Info.Location.Other_URL_Note.Length > 0) ? 1 : 0); case Element_Type.PALMM_Code: return(1); case Element_Type.Publisher: return(Bib.Bib_Info.Publishers_Count); case Element_Type.Publication_Place: if (Bib.Bib_Info.Publishers_Count > 0) { if (Bib.Bib_Info.Publishers.SelectMany(thisName => thisName.Places).Any(thisPlace => thisPlace.Place_Text.Length > 0)) { return(1); } } return(0); case Element_Type.RecordOrigin: return(Bib.Bib_Info.Record.Record_Origin.Length > 0 ? 1 : 0); case Element_Type.RecordStatus: return(1); case Element_Type.RelatedItem: return(Bib.Bib_Info.RelatedItems_Count); case Element_Type.Rights: return(Bib.Bib_Info.Access_Condition.Text.Length > 0 ? 1 : 0); case Element_Type.Scale: if (Bib.Bib_Info.Subjects.Where(thisSubject => thisSubject.Class_Type == Subject_Info_Type.Cartographics).Any(thisSubject => ((Subject_Info_Cartographics)thisSubject).Scale.Length > 0)) { return(1); } return(0); case Element_Type.SerialHierarchy: return(Bib.Behaviors.Serial_Info.Count > 0 ? 1 : 0); case Element_Type.Source_Institution: return(1); case Element_Type.Source_Note: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type == Note_Type_Enum.source)); case Element_Type.Spatial: int hierSubjectCount = 0; if (thisElement.Display_SubType == "dublincore") { foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial) { hierSubjectCount++; } else if (thisSubject.Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = (Subject_Info_Standard)thisSubject; if ((standSubject.Genres_Count == 0) && (standSubject.Occupations_Count == 0) && (standSubject.Topics_Count == 0)) { hierSubjectCount++; } } } } else { hierSubjectCount += Bib.Bib_Info.Subjects.Count(thisSubject => thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial); } return(hierSubjectCount); case Element_Type.Structure_Map: return(1); case Element_Type.Subject: bool standard = true; if ((thisElement.Display_SubType == "simple") || (thisElement.Display_SubType == "dublincore")) { if (((Subject_Simple_Element)thisElement).Seperate_Dublin_Core_Spatial_Exists) { standard = false; } } int subjectCount = 0; if (standard) { subjectCount += Bib.Bib_Info.Subjects.Count(thisSubject => (thisSubject.Class_Type == Subject_Info_Type.Standard) || (thisSubject.Class_Type == Subject_Info_Type.TitleInfo) || (thisSubject.Class_Type == Subject_Info_Type.Name)); } else { foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { switch (thisSubject.Class_Type) { case Subject_Info_Type.TitleInfo: subjectCount++; break; case Subject_Info_Type.Name: subjectCount++; break; case Subject_Info_Type.Standard: Subject_Info_Standard standSubject = (Subject_Info_Standard)thisSubject; if ((standSubject.Topics_Count > 0) || (standSubject.Occupations_Count > 0) || (standSubject.Genres_Count > 0)) { subjectCount++; } break; } } } return(subjectCount); case Element_Type.TargetAudience: return(Bib.Bib_Info.Target_Audiences.Any(thisTarget => thisTarget.Authority != "marctarget") ? 1 : 0); case Element_Type.Temporal: return(Bib.Bib_Info.TemporalSubjects_Count); case Element_Type.Title: return(1); case Element_Type.Title_Other: int title_count = 0; if (Bib.Bib_Info.Main_Title.Subtitle.Length > 0) { title_count++; } if ((Bib.Bib_Info.hasSeriesTitle) && (Bib.Bib_Info.SeriesTitle.Title.Length > 0)) { title_count++; } if (Bib.Bib_Info.Other_Titles_Count > 0) { title_count += Bib.Bib_Info.Other_Titles.Count(thisTitle => thisTitle.Title.Length > 0); } return(title_count); case Element_Type.Type: return(1); case Element_Type.VID: return(1); case Element_Type.Viewer: return(Bib.Behaviors.Views_Count); case Element_Type.VRA_CulturalContext: VRACore_Info vraInfo = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo != null ? vraInfo.Cultural_Context_Count : 0); case Element_Type.VRA_Inscription: VRACore_Info vraInfo2 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo2 != null ? vraInfo2.Inscription_Count : 0); case Element_Type.VRA_Material: VRACore_Info vraInfo3 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo3 != null ? vraInfo3.Material_Count : 0); case Element_Type.VRA_Measurement: VRACore_Info vraInfo4 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo4 != null ? vraInfo4.Measurement_Count : 0); case Element_Type.VRA_StateEdition: VRACore_Info vraInfo5 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo5 != null ? vraInfo5.State_Edition_Count : 0); case Element_Type.VRA_StylePeriod: VRACore_Info vraInfo6 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo6 != null ? vraInfo6.Style_Period_Count : 0); case Element_Type.VRA_Technique: VRACore_Info vraInfo7 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo7 != null ? vraInfo7.Technique_Count : 0); case Element_Type.Web_Skin: return(Bib.Behaviors.Web_Skin_Count > 0 ? 1 : 0); case Element_Type.ZT_Class: Zoological_Taxonomy_Info darwinCoreInfo = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo != null && darwinCoreInfo.Class.Length > 0 ? 1 : 0); case Element_Type.ZT_CommonName: Zoological_Taxonomy_Info darwinCoreInfo2 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo2 != null && darwinCoreInfo2.Common_Name.Length > 0 ? 1 : 0); case Element_Type.ZT_Family: Zoological_Taxonomy_Info darwinCoreInfo3 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo3 != null && darwinCoreInfo3.Family.Length > 0 ? 1 : 0); case Element_Type.ZT_Genus: Zoological_Taxonomy_Info darwinCoreInfo4 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo4 != null && darwinCoreInfo4.Genus.Length > 0 ? 1 : 0); case Element_Type.ZT_HigherClassification: Zoological_Taxonomy_Info darwinCoreInfo5 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo5 != null && darwinCoreInfo5.Higher_Classification.Length > 0 ? 1 : 0); case Element_Type.ZT_Kingdom: Zoological_Taxonomy_Info darwinCoreInfo6 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo6 != null && darwinCoreInfo6.Kingdom.Length > 0 ? 1 : 0); case Element_Type.ZT_Order: Zoological_Taxonomy_Info darwinCoreInfo7 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo7 != null && darwinCoreInfo7.Order.Length > 0 ? 1 : 0); case Element_Type.ZT_Phylum: Zoological_Taxonomy_Info darwinCoreInfo8 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo8 != null && darwinCoreInfo8.Phylum.Length > 0 ? 1 : 0); case Element_Type.ZT_ScientificName: Zoological_Taxonomy_Info darwinCoreInfo9 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo9 != null && darwinCoreInfo9.Scientific_Name.Length > 0 ? 1 : 0); case Element_Type.ZT_SpecificEpithet: Zoological_Taxonomy_Info darwinCoreInfo10 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo10 != null && darwinCoreInfo10.Specific_Epithet.Length > 0 ? 1 : 0); case Element_Type.ZT_TaxonRank: Zoological_Taxonomy_Info darwinCoreInfo11 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo11 != null && darwinCoreInfo11.Taxonomic_Rank.Length > 0 ? 1 : 0); default: return(0); } }
/// <summary> Renders the HTML for this element </summary> /// <param name="Output"> Textwriter to write the HTML for this element </param> /// <param name="Bib"> Object to populate this element from </param> /// <param name="Skin_Code"> Code for the current skin </param> /// <param name="IsMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param> /// <param name="PopupFormBuilder"> Builder for any related popup forms for this element </param> /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param> /// <param name="CurrentLanguage"> Current user-interface language </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Base_URL"> Base URL for the current request </param> /// <remarks> This element appends a popup form to the popup_form_builder</remarks> public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL) { // Check that an acronym exists if (Acronym.Length == 0) { const string DEFAULT_ACRONYM = "Enter any subject keyword to describe your material here, along with the vocabulary from which this subject term was pulled."; switch (CurrentLanguage) { case Web_Language_Enum.English: Acronym = DEFAULT_ACRONYM; break; case Web_Language_Enum.Spanish: Acronym = DEFAULT_ACRONYM; break; case Web_Language_Enum.French: Acronym = DEFAULT_ACRONYM; break; default: Acronym = DEFAULT_ACRONYM; break; } } Output.WriteLine(" <!-- " + Title + " Form Element -->"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:" + LEFT_MARGIN + "px\"> </td>"); if (Acronym.Length > 0) { Output.WriteLine(" <td class=\"metadata_label\"><a href=\"" + Help_URL(Skin_Code, Base_URL) + "\" target=\"_" + html_element_name.ToUpper() + "\"><acronym title=\"" + Acronym + "\">" + Translator.Get_Translation(Title, CurrentLanguage) + ":</acronym></a></td>"); } else { Output.WriteLine(" <td class=\"metadata_label\"><a href=\"" + Help_URL(Skin_Code, Base_URL) + "\" target=\"_" + html_element_name.ToUpper() + "\">" + Translator.Get_Translation(Title, CurrentLanguage) + ":</a></td>"); } // Ensure there is at least one standard subject bool found_standard = false; if (Bib.Bib_Info.Subjects_Count > 0) { if (Bib.Bib_Info.Subjects.Any(ThisSubject => ThisSubject.Class_Type == Subject_Info_Type.Standard)) { found_standard = true; } } if (!found_standard) { Bib.Bib_Info.Add_Subject(); } Output.WriteLine(" <td>"); Output.WriteLine(" <table>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td>"); Output.Write(" <div id=\"" + html_element_name + "_div\">"); int subject_index = 1; foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = ( Subject_Info_Standard )thisSubject; // Add this subject linke if (standSubject.hasData) { Output.Write("\n <a title=\"Click to edit this subject information\" href=\"" + Base_URL + "l/technical/javascriptrequired\" onfocus=\"link_focused2('form_subject_term_" + subject_index + "')\" onblur=\"link_blurred2('form_subject_term_" + subject_index + "')\" onkeypress=\"return popup_keypress_focus('form_subject_" + subject_index + "', 'formsubjecttopic1_" + subject_index + "', '" + IsMozilla.ToString() + "' );\" onclick=\"return popup_focus('form_subject_" + subject_index + "', 'formsubjecttopic1_" + subject_index + "' );\"><div class=\"form_linkline form_subject_line\" id=\"form_subject_term_" + subject_index + "\">" + standSubject + "</div></a>"); } else { Output.Write("\n <a title=\"Click to edit this subject information\" href=\"" + Base_URL + "l/technical/javascriptrequired\" onfocus=\"link_focused2('form_subject_term_" + subject_index + "')\" onblur=\"link_blurred2('form_subject_term_" + subject_index + "')\" onkeypress=\"return popup_keypress_focus('form_subject_" + subject_index + "', 'formsubjecttopic1_" + subject_index + "', '" + IsMozilla.ToString() + "' );\" onclick=\"return popup_focus('form_subject_" + subject_index + "', 'formsubjecttopic1_" + subject_index + "' );\"><div class=\"form_linkline_empty form_subject_line\" id=\"form_subject_term_" + subject_index + "\"><i>Empty Subject Keyword</i></div></a>"); } // Add the popup form PopupFormBuilder.AppendLine("<!-- Subject Keyword Form " + subject_index + " -->"); PopupFormBuilder.AppendLine("<div class=\"subject_popup_div sbkMetadata_PopupDiv\" id=\"form_subject_" + subject_index + "\" style=\"display:none;\">"); PopupFormBuilder.AppendLine(" <div class=\"sbkMetadata_PopupTitle\"><table style=\"width:100%\"><tr><td style=\"text-align:left\">Edit Subject</td><td style=\"text-align:right\"><a href=\"" + Help_URL(Skin_Code, Base_URL) + "\" alt=\"HELP\" target=\"_" + html_element_name.ToUpper() + "\" >?</a> <a href=\"#template\" alt=\"CLOSE\" onclick=\"close_subject_form('form_subject_" + subject_index + "')\">X</a> </td></tr></table></div>"); PopupFormBuilder.AppendLine(" <br />"); PopupFormBuilder.AppendLine(" <table class=\"sbkMetadata_PopupTable\">"); // Add the options for this subject ( standard, name, or title) PopupFormBuilder.Append(" <tr><td>Subject Type:</td><td><select class=\"formsubject_type\" name=\"formsubjecttype_" + subject_index + "\" id=\"formsubjecttype_" + subject_index + "\" >"); PopupFormBuilder.Append("<option value=\"standard\" selected=\"selected\">Standard</option>"); PopupFormBuilder.AppendLine("</select></td>"); PopupFormBuilder.Append(" <td>MARC: <select class=\"formsubject_map\" name=\"formsubjectmap_" + subject_index + "\" id=\"formsubjectmap_" + subject_index + "\" >"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ") < 0 ? "<option value=\"none\" selected=\"selected\" > </option>" : "<option value=\"none\" > </option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ648") == 0 ? "<option value=\"648\" selected=\"selected\" >648 - Chronological Term</option>" : "<option value=\"648\" >648 - Chronological Term</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ650") == 0 ? "<option value=\"650\" selected=\"selected\" >650 - Topical Term</option>" : "<option value=\"650\" >650 - Topical Term</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ651") == 0 ? "<option value=\"651\" selected=\"selected\" >651 - Geographic Name</option>" : "<option value=\"651\" >651 - Geographic Name</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ653") == 0 ? "<option value=\"653\" selected=\"selected\" >653 - Uncontrolled Index</option>" : "<option value=\"653\" >653 - Uncontrolled Index</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ654") == 0 ? "<option value=\"654\" selected=\"selected\" >654 - Faceted Topical</option>" : "<option value=\"654\" >654 - Faceted Topical</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ655") == 0 ? "<option value=\"655\" selected=\"selected\" >655 - Genre / Form</option>" : "<option value=\"655\" >655 - Genre / Form</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ656") == 0 ? "<option value=\"656\" selected=\"selected\" >656 - Occupation</option>" : "<option value=\"656\" >656 - Occupation</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ657") == 0 ? "<option value=\"657\" selected=\"selected\" >657 - Function</option>" : "<option value=\"657\" >657 - Function</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ690") == 0 ? "<option value=\"690\" selected=\"selected\" >690 - Local Topical</option>" : "<option value=\"690\" >690 - Local Topical</option>"); PopupFormBuilder.Append(standSubject.ID.IndexOf("SUBJ691") == 0 ? "<option value=\"691\" selected=\"selected\" >691 - Local Geographic</option>" : "<option value=\"691\" >691 - Local Geographic</option>"); PopupFormBuilder.AppendLine("</select></td></tr>"); // Add the first row of topical term boxes PopupFormBuilder.Append(" <tr><td>Topical Term(s):</td><td colspan=\"2\">"); if (standSubject.Topics_Count >= 1) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic1_" + subject_index + "\" id=\"formsubjecttopic1_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Topics[0]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic1_" + subject_index + "\" id=\"formsubjecttopic1_" + subject_index + "\" type=\"text\" value=\"\" />"); } if (standSubject.Topics_Count >= 2) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic2_" + subject_index + "\" id=\"formsubjecttopic2_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Topics[1]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic2_" + subject_index + "\" id=\"formsubjecttopic2_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine("</td></tr>"); // Add the second row of topical term boxes PopupFormBuilder.Append(" <tr><td> </td><td colspan=\"2\">"); if (standSubject.Topics_Count >= 3) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic3_" + subject_index + "\" id=\"formsubjecttopic3_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Topics[2]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic3_" + subject_index + "\" id=\"formsubjecttopic3_" + subject_index + "\" type=\"text\" value=\"\" />"); } if (standSubject.Topics_Count >= 4) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic4_" + subject_index + "\" id=\"formsubjecttopic4_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Topics[3]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttopic4_" + subject_index + "\" id=\"formsubjecttopic4_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine("</td></tr>"); // Add the two chronological term boxes PopupFormBuilder.Append(" <tr><td>Chronological Term(s):</td><td colspan=\"2\">"); if (standSubject.Temporals_Count >= 1) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttemporal1_" + subject_index + "\" id=\"formsubjecttemporal1_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Temporals[0]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttemporal1_" + subject_index + "\" id=\"formsubjecttemporal1_" + subject_index + "\" type=\"text\" value=\"\" />"); } if (standSubject.Temporals_Count >= 2) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttemporal2_" + subject_index + "\" id=\"formsubjecttemporal2_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Temporals[1]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjecttemporal2_" + subject_index + "\" id=\"formsubjecttemporal2_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine("</td></tr>"); // Add the two geographic term boxes PopupFormBuilder.Append(" <tr><td>Geographic Term(s):</td><td colspan=\"2\">"); if (standSubject.Geographics_Count >= 1) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgeo1_" + subject_index + "\" id=\"formsubjectgeo1_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Geographics[0]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgeo1_" + subject_index + "\" id=\"formsubjectgeo1_" + subject_index + "\" type=\"text\" value=\"\" />"); } if (standSubject.Geographics_Count >= 2) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgeo2_" + subject_index + "\" id=\"formsubjectgeo2_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Geographics[1]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgeo2_" + subject_index + "\" id=\"formsubjectgeo2_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine("</td></tr>"); // Add the two genre term boxes PopupFormBuilder.Append(" <tr><td>Form / Genre Term(s):</td><td colspan=\"2\">"); if (standSubject.Genres_Count >= 1) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgenre1_" + subject_index + "\" id=\"formsubjectgenre1_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Genres[0]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgenre1_" + subject_index + "\" id=\"formsubjectgenre1_" + subject_index + "\" type=\"text\" value=\"\" />"); } if (standSubject.Genres_Count >= 2) { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgenre2_" + subject_index + "\" id=\"formsubjectgenre2_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Genres[1]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_medium_input sbk_Focusable\" name=\"formsubjectgenre2_" + subject_index + "\" id=\"formsubjectgenre2_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine("</td></tr>"); // Add the occupational term box PopupFormBuilder.Append(" <tr><td>Occupation:</td><td colspan=\"2\">"); if (standSubject.Occupations_Count >= 1) { PopupFormBuilder.Append("<input class=\"formsubject_large_input sbk_Focusable\" name=\"formsubjectoccup1_" + subject_index + "\" id=\"formsubjectoccup1_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Occupations[0]) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_large_input sbk_Focusable\" name=\"formsubjectoccup1_" + subject_index + "\" id=\"formsubjectoccup1_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine("</td></tr>"); // Add the authority and language text boxes PopupFormBuilder.Append(" <tr><td>Authority:</td><td>"); if (standSubject.Authority.Length > 0) { PopupFormBuilder.Append("<input class=\"formsubject_small_input sbk_Focusable\" name=\"formsubjectauthority_" + subject_index + "\" id=\"formsubjectauthority_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Authority) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_small_input sbk_Focusable\" name=\"formsubjectauthority_" + subject_index + "\" id=\"formsubjectauthority_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.Append("</td><td width=\"255px\" > Language: "); if (standSubject.Language.Length > 0) { PopupFormBuilder.Append("<input class=\"formsubject_small_input sbk_Focusable\" name=\"formsubjectlanguage_" + subject_index + "\" id=\"formsubjectlanguage_" + subject_index + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(standSubject.Language) + "\" />"); } else { PopupFormBuilder.Append("<input class=\"formsubject_small_input sbk_Focusable\" name=\"formsubjectlanguage_" + subject_index + "\" id=\"formsubjectlanguage_" + subject_index + "\" type=\"text\" value=\"\" />"); } PopupFormBuilder.AppendLine(" </td></tr>"); // Finish the popup form and add the CLOSE button PopupFormBuilder.AppendLine(" <tr style=\"height:35px; text-align: center; vertical-align: bottom;\">"); PopupFormBuilder.AppendLine(" <td colspan=\"3\"><button title=\"Close\" class=\"sbkMetadata_RoundButton\" onclick=\"return close_subject_form('form_subject_" + subject_index + "');\">CLOSE</button></td>"); PopupFormBuilder.AppendLine(" </tr>"); PopupFormBuilder.AppendLine(" </table>"); PopupFormBuilder.AppendLine("</div>"); PopupFormBuilder.AppendLine(); subject_index++; } } // Add the link to add a new other subject and close the main element Output.WriteLine("\n </div>"); Output.WriteLine(" </td>"); Output.WriteLine(" <td style=\"vertical-align:bottom\" >"); if (Repeatable) { Output.WriteLine(" <img title=\"" + Translator.Get_Translation("Click to add a new named subject", CurrentLanguage) + ".\" alt=\"+\" class=\"repeat_button\" src=\"" + REPEAT_BUTTON_URL + "\" onmousedown=\"new_subject_link_clicked('" + Template_Page + "');\" />"); } Output.WriteLine(" <a target=\"_" + html_element_name.ToUpper() + "\" title=\"" + Translator.Get_Translation("Get help.", CurrentLanguage) + "\" href=\"" + Help_URL(Skin_Code, Base_URL) + "\" ><img class=\"help_button\" src=\"" + HELP_BUTTON_URL + "\" /></a>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(); }
/// <summary> Reads metadata from an open stream and saves to the provided item/package </summary> /// <param name="Input_Stream"> Open stream to read metadata from </param> /// <param name="Return_Package"> Package into which to read the metadata </param> /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param> /// <param name="Error_Message">[OUTPUT] Explanation of the error, if an error occurs during reading </param> /// <returns>TRUE if successful, otherwise FALSE </returns> /// <remarks>This reader accepts two option values. 'EAD_File_ReaderWriter:XSL_Location' gives the location of a XSL /// file, which can be used to transform the description XML read from this EAD into HTML (or another format of XML). /// 'EAD_File_ReaderWriter:Analyze_Description' indicates whether to analyze the description section of the EAD and /// read it into the item. (Default is TRUE).</remarks> public bool Read_Metadata(Stream Input_Stream, SobekCM_Item Return_Package, Dictionary <string, object> Options, out string Error_Message) { // Ensure this metadata module extension exists EAD_Info eadInfo = Return_Package.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY) as EAD_Info; if (eadInfo == null) { eadInfo = new EAD_Info(); Return_Package.Add_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY, eadInfo); } // Set a couple defaults first Return_Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.EAD; Return_Package.Bib_Info.Type.Collection = true; Error_Message = String.Empty; // Check for some options string XSL_Location = String.Empty; bool Analyze_Description = true; if (Options != null) { if (Options.ContainsKey("EAD_File_ReaderWriter:XSL_Location")) { XSL_Location = Options["EAD_File_ReaderWriter:XSL_Location"].ToString(); } if (Options.ContainsKey("EAD_File_ReaderWriter:Analyze_Description")) { bool.TryParse(Options["EAD_File_ReaderWriter:Analyze_Description"].ToString(), out Analyze_Description); } } // Use a string builder to seperate the description and container sections StringBuilder description_builder = new StringBuilder(20000); StringBuilder container_builder = new StringBuilder(20000); // Read through with a simple stream reader first StreamReader reader = new StreamReader(Input_Stream); string line = reader.ReadLine(); bool in_container_list = false; // Step through each line while (line != null) { if (!in_container_list) { // Do not import the XML stylesheet portion if ((line.IndexOf("xml-stylesheet") < 0) && (line.IndexOf("<!DOCTYPE ") < 0)) { // Does the start a DSC section? if ((line.IndexOf("<dsc ") >= 0) || (line.IndexOf("<dsc>") > 0)) { in_container_list = true; container_builder.AppendLine(line); } else { description_builder.AppendLine(line); } } } else { // Add this to the container builder container_builder.AppendLine(line); // Does this end the container list section? if (line.IndexOf("</dsc>") >= 0) { in_container_list = false; } } // Get the next line line = reader.ReadLine(); } // Close the reader reader.Close(); // Just assign all the description section first eadInfo.Full_Description = description_builder.ToString(); // Should the decrpition additionally be analyzed? if (Analyze_Description) { // Try to read the XML try { StringReader strReader = new StringReader(description_builder.ToString()); XmlTextReader reader2 = new XmlTextReader(strReader); // Initial doctype declaration sometimes throws an error for a missing EAD.dtd. bool ead_start_found = false; int error = 0; while ((!ead_start_found) && (error < 5)) { try { reader2.Read(); if ((reader2.NodeType == XmlNodeType.Element) && (reader2.Name.ToLower() == "ead")) { ead_start_found = true; } } catch { error++; } } // Now read the body of the EAD while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Element) { string nodeName = reader2.Name.ToLower(); switch (nodeName) { case "descrules": string descrules_text = reader2.ReadInnerXml().ToUpper(); if (descrules_text.IndexOf("FINDING AID PREPARED USING ") == 0) { Return_Package.Bib_Info.Record.Description_Standard = descrules_text.Replace("FINDING AID PREPARED USING ", ""); } else { string[] likely_description_standards = { "DACS", "APPM", "AACR2", "RDA", "ISADG", "ISAD", "MAD", "RAD" }; foreach (string likely_standard in likely_description_standards) { if (descrules_text.IndexOf(likely_standard) >= 0) { Return_Package.Bib_Info.Record.Description_Standard = likely_standard; break; } } } break; case "unittitle": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Return_Package.Bib_Info.Main_Title.Title = reader2.Value; break; } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("unittitle")) { break; } } while (!(reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("unittitle"))) { reader2.Read(); } break; case "unitid": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Return_Package.Bib_Info.Add_Identifier(reader2.Value, "Main Identifier"); } if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } break; case "origination": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Element && reader2.Name.Equals("persname")) { while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Return_Package.Bib_Info.Main_Entity_Name.Full_Name = Trim_Final_Punctuation(reader2.Value); Return_Package.Bib_Info.Main_Entity_Name.Name_Type = Name_Info_Type_Enum.personal; } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } } if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } break; case "physdesc": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Element && reader2.Name.Equals("extent")) { while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Return_Package.Bib_Info.Original_Description.Extent = reader2.Value; } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("extent")) { break; } } } if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("physdesc")) { break; } } break; case "abstract": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Return_Package.Bib_Info.Add_Abstract(reader2.Value); } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } break; case "repository": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Element && reader2.Name.Equals("corpname")) { while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Return_Package.Bib_Info.Location.Holding_Name = reader2.Value; } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } } if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } break; case "accessrestrict": Return_Package.Bib_Info.Add_Note(Clean_Text_Block(reader2.ReadInnerXml()), Note_Type_Enum.restriction); break; case "userestrict": Return_Package.Bib_Info.Access_Condition.Text = Clean_Text_Block(reader2.ReadInnerXml()); break; case "acqinfo": Return_Package.Bib_Info.Add_Note(Clean_Text_Block(reader2.ReadInnerXml()), Note_Type_Enum.acquisition); break; case "bioghist": Return_Package.Bib_Info.Add_Note(Clean_Text_Block(reader2.ReadInnerXml()), Note_Type_Enum.biographical); break; case "scopecontent": Return_Package.Bib_Info.Add_Abstract(Clean_Text_Block(reader2.ReadInnerXml()), "", "summary", "Summary"); break; case "controlaccess": while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Element && (reader2.Name.Equals("corpname") || reader2.Name.Equals("persname"))) { string tagnamei = reader2.Name; string source = ""; if (reader2.MoveToAttribute("source")) { source = reader2.Value; } while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { Subject_Info_Name newName = new Subject_Info_Name(); //ToSee: where to add name? and ehat types //ToDo: Type newName.Full_Name = Trim_Final_Punctuation(reader2.Value); newName.Authority = source; Return_Package.Bib_Info.Add_Subject(newName); if (tagnamei.StartsWith("corp")) { newName.Name_Type = Name_Info_Type_Enum.corporate; } else if (tagnamei.StartsWith("pers")) { newName.Name_Type = Name_Info_Type_Enum.personal; } else { newName.Name_Type = Name_Info_Type_Enum.UNKNOWN; } } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals(tagnamei)) { break; } } } else if (reader2.NodeType == XmlNodeType.Element && (reader2.Name.Equals("subject"))) { string tagnamei = reader2.Name; string source = ""; if (reader2.MoveToAttribute("source")) { source = reader2.Value; } while (reader2.Read()) { if (reader2.NodeType == XmlNodeType.Text) { string subjectTerm = Trim_Final_Punctuation(reader2.Value.Trim()); if (subjectTerm.Length > 1) { Subject_Info_Standard subject = Return_Package.Bib_Info.Add_Subject(); subject.Authority = source; if (subjectTerm.IndexOf("--") == 0) { subject.Add_Topic(subjectTerm); } else { while (subjectTerm.IndexOf("--") > 0) { string fragment = subjectTerm.Substring(0, subjectTerm.IndexOf("--")).Trim(); if (fragment.ToLower() == "florida") { subject.Add_Geographic(fragment); } else { subject.Add_Topic(fragment); } if (subjectTerm.Length > subjectTerm.IndexOf("--") + 3) { subjectTerm = subjectTerm.Substring(subjectTerm.IndexOf("--") + 2); } else { subjectTerm = String.Empty; } } if (subjectTerm.Trim().Length > 0) { string fragment = subjectTerm.Trim(); if (fragment.ToLower() == "florida") { subject.Add_Geographic(fragment); } else { subject.Add_Topic(fragment); } } } } } else if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals(tagnamei)) { break; } } } if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.ToLower().Equals(nodeName)) { break; } } break; case "dsc": eadInfo.Container_Hierarchy.Read(reader2); break; } } if (reader2.NodeType == XmlNodeType.EndElement && reader2.Name.Equals("ead")) { break; } } reader2.Close(); } catch (Exception ee) { Error_Message = "Error caught in EAD_reader2_Writer: " + ee.Message; return(false); } } // If there is a XSL, apply it to the description stored in the EAD sub-section of the item id if (XSL_Location.Length > 0) { try { // Create the transform and load the XSL indicated XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(XSL_Location); // Apply the transform to convert the XML into HTML StringWriter results = new StringWriter(); XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; using (XmlReader transformreader = XmlReader.Create(new StringReader(eadInfo.Full_Description), settings)) { transform.Transform(transformreader, null, results); } eadInfo.Full_Description = results.ToString(); // Get rid of the <?xml header if (eadInfo.Full_Description.IndexOf("<?xml") >= 0) { int xml_end_index = eadInfo.Full_Description.IndexOf("?>"); eadInfo.Full_Description = eadInfo.Full_Description.Substring(xml_end_index + 2); } // Since this was successful, try to build the TOC list of included sections SortedList <int, string> toc_sorter = new SortedList <int, string>(); string description = eadInfo.Full_Description; int did = description.IndexOf("<a name=\"did\""); int bioghist = description.IndexOf("<a name=\"bioghist\""); int scopecontent = description.IndexOf("<a name=\"scopecontent\""); int organization = description.IndexOf("<a name=\"organization\""); int arrangement = description.IndexOf("<a name=\"arrangement\""); int relatedmaterial = description.IndexOf("<a name=\"relatedmaterial\""); int otherfindaid = description.IndexOf("<a name=\"otherfindaid\""); int index = description.IndexOf("<a name=\"index\">"); int bibliography = description.IndexOf("<a name=\"bibliography\""); int odd = description.IndexOf("<a name=\"odd\""); int controlaccess = description.IndexOf("<a name=\"controlaccess\""); int accruals = description.IndexOf("<a name=\"accruals\""); int appraisal = description.IndexOf("<a name=\"appraisal\""); int processinfo = description.IndexOf("<a name=\"processinfo\""); int acqinfo = description.IndexOf("<a name=\"acqinfo\""); int prefercite = description.IndexOf("<a name=\"prefercite\""); int altformavail = description.IndexOf("<a name=\"altformavail\""); int custodhist = description.IndexOf("<a name=\"custodhist\""); int accessrestrict = description.IndexOf("<a name=\"accessrestrict\""); int admininfo = description.IndexOf("<a name=\"admininfo\""); if (did >= 0) { toc_sorter[did] = "did"; } if (bioghist >= 0) { toc_sorter[bioghist] = "bioghist"; } if (scopecontent >= 0) { toc_sorter[scopecontent] = "scopecontent"; } if (organization >= 0) { toc_sorter[organization] = "organization"; } if (arrangement >= 0) { toc_sorter[arrangement] = "arrangement"; } if (relatedmaterial >= 0) { toc_sorter[relatedmaterial] = "relatedmaterial"; } if (otherfindaid >= 0) { toc_sorter[otherfindaid] = "otherfindaid"; } if (index >= 0) { toc_sorter[index] = "index"; } if (bibliography >= 0) { toc_sorter[bibliography] = "bibliography"; } if (odd >= 0) { toc_sorter[odd] = "odd"; } if (controlaccess >= 0) { toc_sorter[controlaccess] = "controlaccess"; } if (accruals >= 0) { toc_sorter[accruals] = "accruals"; } if (appraisal >= 0) { toc_sorter[appraisal] = "appraisal"; } if (processinfo >= 0) { toc_sorter[processinfo] = "processinfo"; } if (acqinfo >= 0) { toc_sorter[acqinfo] = "acqinfo"; } if (prefercite >= 0) { toc_sorter[prefercite] = "prefercite"; } if (altformavail >= 0) { toc_sorter[altformavail] = "altformavail"; } if (custodhist >= 0) { toc_sorter[custodhist] = "custodhist"; } if (accessrestrict >= 0) { toc_sorter[accessrestrict] = "accessrestrict"; } if (admininfo >= 0) { toc_sorter[admininfo] = "admininfo"; } // Now, add each section back to the TOC list foreach (string thisEadSection in toc_sorter.Values) { // Index needs to have its head looked up, everything else adds simply if (thisEadSection != "index") { switch (thisEadSection) { case "did": eadInfo.Add_TOC_Included_Section("did", "Descriptive Summary"); break; case "bioghist": eadInfo.Add_TOC_Included_Section("bioghist", "Biographical / Historical Note"); break; case "scopecontent": eadInfo.Add_TOC_Included_Section("scopecontent", "Scope and Content"); break; case "accessrestrict": eadInfo.Add_TOC_Included_Section("accessrestrict", "Access or Use Restrictions"); break; case "relatedmaterial": eadInfo.Add_TOC_Included_Section("relatedmaterial", "Related or Separated Material"); break; case "admininfo": eadInfo.Add_TOC_Included_Section("admininfo", "Administrative Information"); break; case "altformavail": eadInfo.Add_TOC_Included_Section("altformavail", " Alternate Format Available"); break; case "prefercite": eadInfo.Add_TOC_Included_Section("prefercite", " Preferred Citation"); break; case "acqinfo": eadInfo.Add_TOC_Included_Section("acqinfo", " Acquisition Information"); break; case "processinfo": eadInfo.Add_TOC_Included_Section("processinfo", " Processing Information"); break; case "custodhist": eadInfo.Add_TOC_Included_Section("custodhist", " Custodial Work_History"); break; case "controlaccess": eadInfo.Add_TOC_Included_Section("controlaccess", "Selected Subjects"); break; case "otherfindaid": eadInfo.Add_TOC_Included_Section("otherfindaid", "Alternate Form of Finding Aid"); break; } } else { int end_link = eadInfo.Full_Description.IndexOf("</a>", index); string index_title = eadInfo.Full_Description.Substring(index + 16, end_link - index - 16); if (index_title.Length > 38) { index_title = index_title.Substring(0, 32) + "..."; } eadInfo.Add_TOC_Included_Section("index", index_title); } } } catch (Exception ee) { bool error = false; } } // Now, parse the container section as XML if (container_builder.Length > 0) { StringReader containerReader = new StringReader(container_builder.ToString()); XmlTextReader xml_reader = new XmlTextReader(containerReader); xml_reader.Read(); eadInfo.Container_Hierarchy.Read(xml_reader); } return(true); }
/// <summary> Create a test digital resource item </summary> /// <param name="directory">Directory for the package source directory</param> /// <returns>Fully built test bib package</returns> public static SobekCM_Item Create(string directory) { SobekCM_Item testPackage = new SobekCM_Item(); // Add all the METS header information testPackage.METS_Header.Create_Date = new DateTime(2007, 1, 1); testPackage.METS_Header.Modify_Date = DateTime.Now; testPackage.METS_Header.Creator_Individual = "Mark Sullivan"; testPackage.METS_Header.Add_Creator_Individual_Notes("Programmer of new SobekCM.Resource_Object"); testPackage.METS_Header.Add_Creator_Individual_Notes("Adding coordinates"); testPackage.METS_Header.Creator_Organization = "University of Florida"; testPackage.METS_Header.Creator_Software = "SobekCM Bib Package Test"; testPackage.METS_Header.RecordStatus_Enum = METS_Record_Status.COMPLETE; testPackage.METS_Header.Add_Creator_Org_Notes("This test package was done to test DLCs new METS package"); // Add all the MODS elements Abstract_Info testAbstract = testPackage.Bib_Info.Add_Abstract("This is a sample abstract", "en"); testPackage.Bib_Info.Add_Abstract("Tämä on esimerkki abstrakteja", "fin"); testAbstract.Display_Label = "Summary Abstract"; testAbstract.Type = "summary"; testPackage.Bib_Info.Access_Condition.Text = "All rights are reserved by source institution."; testPackage.Bib_Info.Access_Condition.Language = "en"; testPackage.Bib_Info.Access_Condition.Type = "restrictions on use"; testPackage.Bib_Info.Access_Condition.Display_Label = "Rights"; testPackage.Bib_Info.Add_Identifier("000123234", "OCLC", "Electronic OCLC"); testPackage.Bib_Info.Add_Identifier("182-asdsd-28k", "DOI"); testPackage.Bib_Info.Add_Language("English", String.Empty, "en"); testPackage.Bib_Info.Add_Language("Finnish"); testPackage.Bib_Info.Add_Language(String.Empty, "ita", String.Empty); testPackage.Bib_Info.Location.Holding_Code = "MVS"; testPackage.Bib_Info.Location.Holding_Name = "From the Private Library of Mark Sullivan"; testPackage.Bib_Info.Location.PURL = "http://www.uflib.ufl.edu/ufdc/?b=CA00000000"; testPackage.Bib_Info.Location.Other_URL = "http://www.fnhm.edu"; testPackage.Bib_Info.Location.Other_URL_Display_Label = "Specimen Information"; testPackage.Bib_Info.Location.Other_URL_Note = "Specimen FLAS 125342 Database"; testPackage.Bib_Info.Location.EAD_URL = "http://digital.uflib.ufl.edu/"; testPackage.Bib_Info.Location.EAD_Name = "Digital Library Center Finding Guide"; testPackage.Bib_Info.Main_Entity_Name.Name_Type = Name_Info_Type_Enum.personal; testPackage.Bib_Info.Main_Entity_Name.Full_Name = "Brown, B.F."; testPackage.Bib_Info.Main_Entity_Name.Terms_Of_Address = "Dr."; testPackage.Bib_Info.Main_Entity_Name.Display_Form = "B.F. Brown"; testPackage.Bib_Info.Main_Entity_Name.Affiliation = "Chemistry Dept., American University"; testPackage.Bib_Info.Main_Entity_Name.Description = "Chemistry Professor Emeritus"; testPackage.Bib_Info.Main_Entity_Name.Add_Role("Author"); Zoological_Taxonomy_Info taxonInfo = new Zoological_Taxonomy_Info(); testPackage.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, taxonInfo); taxonInfo.Scientific_Name = "Ctenomys sociabilis"; taxonInfo.Higher_Classification = "Animalia; Chordata; Vertebrata; Mammalia; Theria; Eutheria; Rodentia; Hystricognatha; Hystricognathi; Ctenomyidae; Ctenomyini; Ctenomys"; taxonInfo.Kingdom = "Animalia"; taxonInfo.Phylum = "Chordata"; taxonInfo.Class = "Mammalia"; taxonInfo.Order = "Rodentia"; taxonInfo.Family = "Ctenomyidae"; taxonInfo.Genus = "Ctenomys"; taxonInfo.Specific_Epithet = "sociabilis"; taxonInfo.Taxonomic_Rank = "species"; taxonInfo.Common_Name = "Social Tuco-Tuco"; Name_Info name1 = new Name_Info(); name1.Name_Type = Name_Info_Type_Enum.personal; name1.Given_Name = "John Paul"; name1.Terms_Of_Address = "Pope; II"; name1.Dates = "1920-2002"; name1.User_Submitted = true; testPackage.Bib_Info.Add_Named_Entity(name1); Name_Info name2 = new Name_Info(); name2.Name_Type = Name_Info_Type_Enum.conference; name2.Full_Name = "Paris Peace Conference (1919-1920)"; name2.Dates = "1919-1920"; testPackage.Bib_Info.Add_Named_Entity(name2); Name_Info name3 = new Name_Info(); name3.Name_Type = Name_Info_Type_Enum.corporate; name3.Full_Name = "United States -- Court of Appeals (2nd Court)"; testPackage.Bib_Info.Add_Named_Entity(name3); Name_Info name4 = new Name_Info(); name4.Name_Type = Name_Info_Type_Enum.personal; name4.Full_Name = "Wilson, Mary"; name4.Display_Form = "Mary 'Weels' Wilson"; name4.Given_Name = "Mary"; name4.Family_Name = "Wilson"; name4.ID = "NAM4"; name4.Terms_Of_Address = "2nd"; name4.Add_Role("illustrator"); name4.Add_Role("cartographer"); testPackage.Bib_Info.Add_Named_Entity(name4); Name_Info donor = new Name_Info(); donor.Name_Type = Name_Info_Type_Enum.personal; donor.Full_Name = "Livingston, Arthur"; donor.Description = "Gift in honor of Arthur Livingston"; donor.Terms_Of_Address = "3rd"; donor.Add_Role("honoree", String.Empty); testPackage.Bib_Info.Donor = donor; testPackage.Bib_Info.Main_Title.NonSort = "The "; testPackage.Bib_Info.Main_Title.Title = "Man Who Would Be King"; testPackage.Bib_Info.Main_Title.Subtitle = "The story of succession in England"; Title_Info title1 = new Title_Info("homme qui voulut être roi", Title_Type_Enum.translated); title1.NonSort = "L'"; title1.Language = "fr"; testPackage.Bib_Info.Add_Other_Title(title1); Title_Info title2 = new Title_Info(); title2.Title = "Man Who Be King"; title2.Display_Label = "also known as"; title2.NonSort = "The"; title2.Title_Type = Title_Type_Enum.alternative; testPackage.Bib_Info.Add_Other_Title(title2); Title_Info title3 = new Title_Info(); title3.Title = "Great works of England"; title3.Authority = "naf"; title3.Add_Part_Name("Second Portion"); title3.Add_Part_Number("2nd"); title3.Title_Type = Title_Type_Enum.uniform; title3.User_Submitted = true; testPackage.Bib_Info.Add_Other_Title(title3); testPackage.Bib_Info.Add_Note("Funded by the NEH", Note_Type_Enum.funding); testPackage.Bib_Info.Add_Note("Based on a play which originally appeared in France as \"Un peu plus tard, un peu plus tôt\"").User_Submitted = true; testPackage.Bib_Info.Add_Note("Anne Baxter (Louise), Maria Perschy (Angela), Gustavo Rojo (Bill), Reginald Gilliam (Mr. Johnson), [Catherine Elliot?] (Aunt Sallie), Ben Tatar (waiter)", Note_Type_Enum.performers, "Performed By"); testPackage.Bib_Info.Origin_Info.Add_Place("New York", "nyu", "usa"); testPackage.Bib_Info.Origin_Info.Date_Issued = "1992"; testPackage.Bib_Info.Origin_Info.MARC_DateIssued_Start = "1992"; testPackage.Bib_Info.Origin_Info.MARC_DateIssued_End = "1993"; testPackage.Bib_Info.Origin_Info.Date_Copyrighted = "1999"; testPackage.Bib_Info.Origin_Info.Edition = "2nd"; Publisher_Info newPub = testPackage.Bib_Info.Add_Publisher("Published for the American Vacuum Society by the American Institute of Physics"); newPub.Add_Place("New York, New York"); newPub.User_Submitted = true; testPackage.Bib_Info.Add_Publisher("University of Florida Press House").Add_Place("Gainesville, FL"); testPackage.Bib_Info.Add_Manufacturer("Addison Randly Publishing House"); testPackage.Bib_Info.Original_Description.Extent = "1 sound disc (56 min.) : digital ; 3/4 in."; testPackage.Bib_Info.Original_Description.Add_Note("The sleeve of this sound disc was damaged in a fire"); testPackage.Bib_Info.Original_Description.Add_Note("The disc has a moderate amount of scratches, but still plays"); testPackage.Bib_Info.Series_Part_Info.Day = "18"; testPackage.Bib_Info.Series_Part_Info.Day_Index = 18; testPackage.Bib_Info.Series_Part_Info.Month = "Syyskuu"; testPackage.Bib_Info.Series_Part_Info.Month_Index = 9; testPackage.Bib_Info.Series_Part_Info.Year = "1992"; testPackage.Bib_Info.Series_Part_Info.Year_Index = 1992; testPackage.Bib_Info.Series_Part_Info.Enum1 = "Volume 12"; testPackage.Bib_Info.Series_Part_Info.Enum1_Index = 12; testPackage.Bib_Info.Series_Part_Info.Enum2 = "Issue 3"; testPackage.Bib_Info.Series_Part_Info.Enum2_Index = 3; testPackage.Bib_Info.Series_Part_Info.Enum3 = "Part 1"; testPackage.Bib_Info.Series_Part_Info.Enum3_Index = 1; testPackage.Behaviors.Serial_Info.Add_Hierarchy(1, 1992, "1992"); testPackage.Behaviors.Serial_Info.Add_Hierarchy(2, 9, "Syyskuu"); testPackage.Behaviors.Serial_Info.Add_Hierarchy(3, 18, "18"); testPackage.Bib_Info.SeriesTitle.Title = "Shakespeare's most famous musicals"; testPackage.Bib_Info.Add_Target_Audience("young adults"); testPackage.Bib_Info.Add_Target_Audience("adolescent", "marctarget"); testPackage.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper; // Add cartographic subject Subject_Info_Cartographics newCartographics = testPackage.Bib_Info.Add_Cartographics_Subject(); newCartographics.Scale = "1:2000"; newCartographics.Projection = "Conical Projection"; newCartographics.Coordinates = "E 72°--E 148°/N 13°--N 18°"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical.Continent = "North America"; hierarchical.Country = "United States of America"; hierarchical.State = "Kansas"; hierarchical.County = "Butler"; hierarchical.City = "Augusta"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical2 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical2.Region = "Arctic Ocean"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical3 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical3.Island = "Puerto Rico"; hierarchical3.Language = "English"; hierarchical3.Province = "Provincial"; hierarchical3.Territory = "Puerto Rico"; hierarchical3.Area = "Intercontinental areas (Western Hemisphere)"; // Add a name subject Subject_Info_Name subjname1 = testPackage.Bib_Info.Add_Name_Subject(); subjname1.Authority = "lcsh"; subjname1.Full_Name = "Garcia Lorca, Federico"; subjname1.Dates = "1898-1936"; subjname1.Add_Geographic("Russia"); subjname1.Add_Geographic("Moscow"); subjname1.Add_Genre("maps"); subjname1.User_Submitted = true; // Add a title information subject Subject_Info_TitleInfo subjtitle1 = testPackage.Bib_Info.Add_Title_Subject(); subjtitle1.Title_Type = Title_Type_Enum.uniform; subjtitle1.Authority = "naf"; subjtitle1.Title = "Missale Carnotense"; // Add a standard subject Subject_Info_Standard subject1 = testPackage.Bib_Info.Add_Subject(); subject1.Authority = "lcsh"; subject1.Add_Topic("Real property"); subject1.Add_Geographic("Mississippi"); subject1.Add_Geographic("Tippah County"); subject1.Add_Genre("Maps"); // Add a standard subject Subject_Info_Standard subject2 = testPackage.Bib_Info.Add_Subject(); subject2.Add_Occupation("Migrant laborers"); subject2.Add_Genre("School district case files"); // Add a standard subject Subject_Info_Standard subject3 = testPackage.Bib_Info.Add_Subject(); subject3.Authority = "lctgm"; subject3.Add_Topic("Educational buildings"); subject3.Add_Geographic("Washington (D.C.)"); subject3.Add_Temporal("1890-1910"); // Add a standard subject Subject_Info_Standard subject4 = testPackage.Bib_Info.Add_Subject(); subject4.Authority = "rvm"; subject4.Language = "french"; subject4.Add_Topic("Église catholique"); subject4.Add_Topic("Histoire"); subject4.Add_Temporal("20e siècle"); // Add record information testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("English", "eng", "en")); testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("French", "fre", "fr")); testPackage.Bib_Info.Record.MARC_Creation_Date = "080303"; testPackage.Bib_Info.Record.Add_MARC_Record_Content_Sources("FUG"); testPackage.Bib_Info.Record.Record_Origin = "Imported from (OCLC)001213124"; // Test the items which are in the non-MODS portion of the Bib_Info object testPackage.BibID = "MVS0000001"; testPackage.VID = "00001"; testPackage.Bib_Info.SortDate = 1234; testPackage.Bib_Info.SortTitle = "MAN WHO WOULD BE KING"; testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Recent history"); testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Lähihistoria"); testPackage.Bib_Info.Source.Code = "UF"; testPackage.Bib_Info.Source.Statement = "University of Florida"; // Add an affiliation Affiliation_Info affiliation1 = new Affiliation_Info(); affiliation1.University = "University of Florida"; affiliation1.Campus = "Gainesville Campus"; affiliation1.College = "College of Engineering"; affiliation1.Department = "Computer Engineering Department"; affiliation1.Unit = "Robotics"; affiliation1.Name_Reference = "NAM4"; testPackage.Bib_Info.Add_Affiliation(affiliation1); // Add a related item Related_Item_Info relatedItem1 = new Related_Item_Info(); relatedItem1.SobekCM_ID = "UF00001234"; relatedItem1.Relationship = Related_Item_Type_Enum.preceding; relatedItem1.Publisher = "Gainesville Sun Publishing House"; relatedItem1.Add_Note(new Note_Info("Digitized with funding from NEH", Note_Type_Enum.funding)); relatedItem1.Add_Note(new Note_Info("Gainesville Bee was the precursor to this item")); relatedItem1.Main_Title.NonSort = "The"; relatedItem1.Main_Title.Title = "Gainesville Bee"; relatedItem1.Add_Identifier("01234353", "oclc"); relatedItem1.Add_Identifier("002232311", "aleph"); Name_Info ri_name = new Name_Info(); ri_name.Full_Name = "Hills, Bryan"; ri_name.Terms_Of_Address = "Mr."; ri_name.Name_Type = Name_Info_Type_Enum.personal; ri_name.Add_Role("author"); relatedItem1.Add_Name(ri_name); relatedItem1.URL = @"http://www.uflib.ufl.edu/ufdc/?b=UF00001234"; relatedItem1.URL_Display_Label = "Full Text"; testPackage.Bib_Info.Add_Related_Item(relatedItem1); // Add another related item Related_Item_Info relatedItem2 = new Related_Item_Info(); relatedItem2.Relationship = Related_Item_Type_Enum.succeeding; relatedItem2.SobekCM_ID = "UF00009999"; relatedItem2.Main_Title.NonSort = "The"; relatedItem2.Main_Title.Title = "Daily Sun"; relatedItem2.Add_Identifier("0125437", "oclc"); relatedItem2.Add_Note("Name change occured in Fall 1933"); relatedItem2.Start_Date = "Fall 1933"; relatedItem2.End_Date = "December 31, 1945"; testPackage.Bib_Info.Add_Related_Item(relatedItem2); // Add some processing parameters testPackage.Behaviors.Add_Aggregation("JUV"); testPackage.Behaviors.Add_Aggregation("DLOC"); testPackage.Behaviors.Add_Aggregation("DLOSA1"); testPackage.Behaviors.Add_Aggregation("ALICE"); testPackage.Behaviors.Add_Aggregation("ARTE"); testPackage.Web.GUID = "GUID!"; testPackage.Behaviors.Add_Wordmark("DLOC"); testPackage.Behaviors.Add_Wordmark("UFSPEC"); testPackage.Behaviors.Main_Thumbnail = "00001thm.jpg"; // Add some downloads testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.PDF"); testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.MP2"); testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.MP2"); testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.PDF"); // Add some coordinate information GeoSpatial_Information geoSpatial = new GeoSpatial_Information(); testPackage.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoSpatial); geoSpatial.Add_Point(29.530151, -82.301459, "Lake Wauberg"); geoSpatial.Add_Point(29.634352, -82.350640, "Veterinary School"); Coordinate_Polygon polygon = new Coordinate_Polygon(); polygon.Label = "University of Florida Campus"; polygon.Add_Edge_Point(new Coordinate_Point(29.651435, -82.339869, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.641216, -82.340298, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.629503, -82.371969, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.649645, -82.371712, String.Empty)); polygon.Add_Inner_Point(29.649794, -82.351971, "Stadium"); polygon.Add_Inner_Point(29.650988, -82.341156, "Library"); geoSpatial.Add_Polygon(polygon); Coordinate_Line line = new Coordinate_Line(); line.Label = "Waldo Road"; line.Add_Point(29.652852, -82.310944, "Gainesville"); line.Add_Point(29.716681, -82.268372, String.Empty); line.Add_Point(29.791494, -82.167778, "Waldo"); geoSpatial.Add_Line(line); // Add some performing arts information Performing_Arts_Info partInfo = new Performing_Arts_Info(); testPackage.Add_Metadata_Module("PerformingArts", partInfo); partInfo.Performance = "Hamlet"; partInfo.Performance_Date = "August 12, 1923"; Performer performer1 = partInfo.Add_Performer("Sullivan, Mark"); performer1.Sex = "M"; performer1.LifeSpan = "1873-"; performer1.Occupation = "actor"; performer1.Title = "Mr."; Performer performer2 = partInfo.Add_Performer("Waldbart, Julia"); performer2.Sex = "F"; performer2.LifeSpan = "1876-"; performer2.Occupation = "actress"; performer2.Title = "Mrs."; // Add some oral history information Oral_Interview_Info oralInfo = new Oral_Interview_Info(); testPackage.Add_Metadata_Module("OralInterview", oralInfo); oralInfo.Interviewee = "Edwards, Herm"; oralInfo.Interviewer = "Proctor, Samual"; // Add some learning object resource information LearningObjectMetadata lomInfo = new LearningObjectMetadata(); testPackage.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo); lomInfo.AggregationLevel = AggregationLevelEnum.level3; lomInfo.Status = StatusEnum.draft; LOM_System_Requirements lomReq1 = new LOM_System_Requirements(); lomReq1.RequirementType = RequirementTypeEnum.operating_system; lomReq1.Name.Value = "Windows"; lomReq1.MinimumVersion = "Windows XP"; lomReq1.MaximumVersion = "Windows 7"; lomInfo.Add_SystemRequirements(lomReq1); LOM_System_Requirements lomReq2 = new LOM_System_Requirements(); lomReq2.RequirementType = RequirementTypeEnum.software; lomReq2.Name.Value = "Java SDK"; lomReq2.MinimumVersion = "1.7.1"; lomReq2.MaximumVersion = "2.09"; lomInfo.Add_SystemRequirements(lomReq2); lomInfo.InteractivityType = InteractivityTypeEnum.mixed; lomInfo.Add_LearningResourceType("exercise"); lomInfo.Add_LearningResourceType("Tutorials", "encdlwebpedagogicaltype"); lomInfo.InteractivityLevel = InteractivityLevelEnum.high; lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.learner); lomInfo.Add_Context("Undergraduate lower division", "enclearningcontext"); lomInfo.Add_Context("15", "grade"); lomInfo.Add_Context("16", "grade"); lomInfo.Add_Context("5", "group"); lomInfo.Add_TypicalAgeRange("suitable for children over 7", "en"); lomInfo.Add_TypicalAgeRange("2-8"); lomInfo.DifficultyLevel = DifficultyLevelEnum.medium; lomInfo.TypicalLearningTime = "PT45M"; LOM_Classification lomClassification1 = new LOM_Classification(); lomInfo.Add_Classification(lomClassification1); lomClassification1.Purpose.Value = "Discipline"; LOM_TaxonPath lomTaxonPath1 = new LOM_TaxonPath(); lomClassification1.Add_TaxonPath(lomTaxonPath1); lomTaxonPath1.Add_SourceName("ARIADNE"); LOM_Taxon lomTaxon1 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon1); lomTaxon1.ID = "BF120"; lomTaxon1.Add_Entry("Work_History", "en"); lomTaxon1.Add_Entry("Historie", "nl"); LOM_Taxon lomTaxon2 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon2); lomTaxon2.ID = "BF120.1"; lomTaxon2.Add_Entry("American Work_History", "en"); LOM_Taxon lomTaxon3 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon3); lomTaxon3.ID = "BF120.1.4"; lomTaxon3.Add_Entry("American Civil War", "en"); LOM_Classification lomClassification2 = new LOM_Classification(); lomInfo.Add_Classification(lomClassification2); lomClassification2.Purpose.Value = "Educational Objective"; LOM_TaxonPath lomTaxonPath2 = new LOM_TaxonPath(); lomClassification2.Add_TaxonPath(lomTaxonPath2); lomTaxonPath2.Add_SourceName("Common Core Standards", "en"); LOM_Taxon lomTaxon4 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon4); lomTaxon4.ID = "CCS.Math.Content"; LOM_Taxon lomTaxon5 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon5); lomTaxon5.ID = "3"; lomTaxon5.Add_Entry("Grade 3", "en"); LOM_Taxon lomTaxon6 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon6); lomTaxon6.ID = "OA"; lomTaxon6.Add_Entry("Operations and Algebraic Thinking", "en"); LOM_Taxon lomTaxon7 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon7); lomTaxon7.ID = "A"; lomTaxon7.Add_Entry("Represent and solve problems involving multiplication and division.", "en"); LOM_Taxon lomTaxon8 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon8); lomTaxon8.ID = "3"; lomTaxon8.Add_Entry("Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.", "en"); LOM_TaxonPath lomTaxonPath3 = new LOM_TaxonPath(); lomClassification2.Add_TaxonPath(lomTaxonPath3); lomTaxonPath3.Add_SourceName("Common Core Standards", "en"); LOM_Taxon lomTaxon14 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon14); lomTaxon14.ID = "CCS.Math.Content"; LOM_Taxon lomTaxon15 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon15); lomTaxon15.ID = "3"; lomTaxon15.Add_Entry("Grade 3", "en"); LOM_Taxon lomTaxon16 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon16); lomTaxon16.ID = "OA"; lomTaxon16.Add_Entry("Operations and Algebraic Thinking", "en"); LOM_Taxon lomTaxon17 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon17); lomTaxon17.ID = "A"; lomTaxon17.Add_Entry("Represent and solve problems involving multiplication and division.", "en"); LOM_Taxon lomTaxon18 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon18); lomTaxon18.ID = "4"; lomTaxon18.Add_Entry("Determine the unknown whole number in a multiplication or division equation relating three whole numbers. For example, determine the unknown number that makes the equation true in each of the equations 8 × ? = 48, 5 = _ ÷ 3, 6 × 6 = ?", "en"); // Add some views and interfaces testPackage.Behaviors.Clear_Web_Skins(); testPackage.Behaviors.Add_Web_Skin("dLOC"); testPackage.Behaviors.Add_Web_Skin("UFDC"); testPackage.Behaviors.Add_View(View_Enum.JPEG2000); testPackage.Behaviors.Add_View(View_Enum.JPEG); testPackage.Behaviors.Add_View(View_Enum.RELATED_IMAGES); testPackage.Behaviors.Add_View(View_Enum.HTML, "Full Document", "MVS001214.html"); // Create the chapters and pages and link them Division_TreeNode chapter1 = new Division_TreeNode("Chapter", "First Chapter"); Page_TreeNode page1 = new Page_TreeNode("First Page"); Page_TreeNode page2 = new Page_TreeNode("Page 2"); chapter1.Nodes.Add(page1); chapter1.Nodes.Add(page2); Division_TreeNode chapter2 = new Division_TreeNode("Chapter", "Last Chapter"); Page_TreeNode page3 = new Page_TreeNode("Page 3"); Page_TreeNode page4 = new Page_TreeNode("Last Page"); chapter2.Nodes.Add(page3); chapter2.Nodes.Add(page4); testPackage.Divisions.Physical_Tree.Roots.Add(chapter1); testPackage.Divisions.Physical_Tree.Roots.Add(chapter2); // Create the files SobekCM_File_Info file1_1 = new SobekCM_File_Info("2000626_0001.jp2", 2120, 1100); SobekCM_File_Info file1_2 = new SobekCM_File_Info("2000626_0001.jpg", 630, 330); SobekCM_File_Info file1_3 = new SobekCM_File_Info("2000626_0001.tif"); SobekCM_File_Info file2_1 = new SobekCM_File_Info("2000626_0002.jp2", 1754, 2453); SobekCM_File_Info file2_2 = new SobekCM_File_Info("2000626_0002.jpg", 630, 832); SobekCM_File_Info file2_3 = new SobekCM_File_Info("2000626_0002.tif"); SobekCM_File_Info file3_1 = new SobekCM_File_Info("2000626_0003.jp2", 2321, 1232); SobekCM_File_Info file3_2 = new SobekCM_File_Info("2000626_0003.jpg", 630, 342); SobekCM_File_Info file3_3 = new SobekCM_File_Info("2000626_0003.tif"); SobekCM_File_Info file4_1 = new SobekCM_File_Info("2000626_0004.jp2", 2145, 1024); SobekCM_File_Info file4_2 = new SobekCM_File_Info("2000626_0004.jpg", 630, 326); SobekCM_File_Info file4_3 = new SobekCM_File_Info("2000626_0004.tif"); // Link the files to the pages page1.Files.Add(file1_1); page1.Files.Add(file1_2); page1.Files.Add(file1_3); page2.Files.Add(file2_1); page2.Files.Add(file2_2); page2.Files.Add(file2_3); page3.Files.Add(file3_1); page3.Files.Add(file3_2); page3.Files.Add(file3_3); page4.Files.Add(file4_1); page4.Files.Add(file4_2); page4.Files.Add(file4_3); // Add the DAITSS information DAITSS_Info daitssInfo = new DAITSS_Info(); daitssInfo.Account = "FTU"; daitssInfo.SubAccount = "CLAS"; daitssInfo.Project = "UFDC"; daitssInfo.toArchive = true; testPackage.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); PALMM_Info palmmInfo = new PALMM_Info(); testPackage.Add_Metadata_Module("PALMM", palmmInfo); palmmInfo.toPALMM = false; // Save this package testPackage.Source_Directory = directory; return(testPackage); }