/// <summary> Gets a page from an existing digital resource, by page sequence </summary> /// <param name="Current_Item"> Digital resource from which to pull the current page, by sequence </param> /// <param name="Sequence"> Sequence for the page to retrieve from this item </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns> Page tree node object for the requested page </returns> public static Page_TreeNode Get_Current_Page(SobekCM_Item Current_Item, int Sequence, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_Item_Factory.Get_Current_Page", "Requesting the page (by sequence) from the item"); } Page_TreeNode returnValue = null; try { // Set the current page if (Sequence >= 1) { int requested_page = Sequence - 1; if ((requested_page < 0) || (requested_page > Current_Item.Web.Static_PageCount - 1)) { requested_page = 0; } if (requested_page <= Current_Item.Web.Static_PageCount - 1) { returnValue = Current_Item.Web.Pages_By_Sequence[requested_page]; } } } catch (Exception ee) { throw new ApplicationException("Error assigning the current page sequence", ee); } return(returnValue); }
private void print_pages(bool include_brief_citation, int from_page, int to_page, TextWriter Output) { if (include_brief_citation) { print_brief_citation("700", Output); } int page_index = from_page - 1; while (page_index < to_page) { // Get this page Page_TreeNode thisPage = currentItem.Web.Pages_By_Sequence[page_index]; // Find the jpeg image and show the image foreach (SobekCM_File_Info thisFile in thisPage.Files) { if (thisFile.System_Name.IndexOf(".jpg") > 0) { if (page_index > from_page - 1) { Output.WriteLine("<br />"); } Output.WriteLine("<img src=\"" + currentItem.Web.Source_URL + "/" + thisFile.System_Name + "\" />"); break; } } // Go to next page page_index++; } }
/// <summary> Adds to the collection of pages by sequence </summary> /// <param name="Next_Page"> Next page in sequence to add </param> public void Add_Pages_By_Sequence(Page_TreeNode Next_Page) { if (pages_by_seq == null) { pages_by_seq = new List <Page_TreeNode>(); } pages_by_seq.Add(Next_Page); }
/// <summary> Constructor for a new instance of the Xml_MainWriter class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> public Xml_MainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List <iSearch_Title_Result> Paged_Results, Item_Aggregation_Browse_Info Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page) : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, null) { }
/// <summary> Constructor for a new instance of the DataProvider_MainWriter class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> public DataProvider_MainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List <iSearch_Title_Result> Paged_Results, Item_Aggregation_Child_Page Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page) : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, null) { // All work done in base class }
/// <summary> Constructor for a new instance of the Text_MainWriter class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> /// <param name="Static_Web_Content"> HTML content-based browse, info, or imple CMS-style web content objects. These are objects which are read from a static HTML file and much of the head information must be maintained </param> public Text_MainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List <iSearch_Title_Result> Paged_Results, Item_Aggregation_Browse_Info Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page, HTML_Based_Content Static_Web_Content) : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, Static_Web_Content) { // All work done in base class }
/// <summary> Constructor for a new instance of the Json_MainWriter class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Current_Image_Root"> Current root directory to pull images and metadata for digital resources </param> public Json_MainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List <iSearch_Title_Result> Paged_Results, Item_Aggregation_Child_Page Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page, Item_Lookup_Object All_Items_Lookup, string Current_Image_Root) : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, null) { allItems = All_Items_Lookup; currentGreenstoneImageRoot = Current_Image_Root; }
private void print_thumbnails(bool include_brief_citation, TextWriter Output) { if (include_brief_citation) { print_brief_citation("550", Output); } Output.WriteLine("<table cellspacing=\"10px\" class=\"thumbnails\">"); Output.WriteLine(" <tr align=\"center\" valign=\"top\">"); int page_index = 0; int col = 0; while (page_index < currentItem.Web.Static_PageCount) { Page_TreeNode thisPage = currentItem.Web.Pages_By_Sequence[page_index]; // Find the jpeg image foreach (SobekCM_File_Info thisFile in thisPage.Files.Where(thisFile => thisFile.System_Name.IndexOf(".jpg") > 0)) { // Should a new row be started if (col == 3) { col = 0; Output.WriteLine(" </tr>\n"); Output.WriteLine(" <tr align=\"center\" valign=\"top\">"); } Output.WriteLine(" <td><img src=\"" + currentItem.Web.Source_URL + "/" + thisFile.System_Name.Replace(".jpg", "thm.jpg") + "\" border=\"1\" /><br />" + thisPage.Label + "</td>"); col++; break; } // Go to next page page_index++; } if (col == 1) { Output.WriteLine(" <td colspan=\"2\"> </td>"); } if (col == 2) { Output.WriteLine(" <td> </td>"); } Output.WriteLine(" </tr>\n"); Output.WriteLine("</table>\n"); }
private void recurse_through_nodes(SobekCM_Item thisPackage, abstract_TreeNode node, List <Page_TreeNode> pages_encountered) { if (node.Page) { Page_TreeNode pageNode = (Page_TreeNode)node; if (!pages_encountered.Contains(pageNode)) { pageseq++; // Add each of the files view codes to the list bool page_added = false; foreach (SobekCM_File_Info thisFile in pageNode.Files) { string upper_name = thisFile.System_Name.ToUpper(); if ((upper_name.IndexOf("SOUNDFILESONLY") < 0) && (upper_name.IndexOf("FILMONLY") < 0) && (upper_name.IndexOf("MULTIMEDIA") < 0) && (upper_name.IndexOf("THM.JPG") < 0)) { if (!page_added) { // Add this to the simple page collection thisPackage.Web.Add_Pages_By_Sequence(pageNode); pages_encountered.Add(pageNode); page_added = true; } View_Object thisViewer = thisFile.Get_Viewer(); if (thisViewer != null) { string[] codes = thisViewer.Viewer_Codes; if ((codes.Length > 0) && (codes[0].Length > 0)) { thisPackage.Web.Viewer_To_File[pageseq.ToString() + codes[0]] = thisFile; } } } } } } else { divseq++; Division_TreeNode divNode = (Division_TreeNode)node; foreach (abstract_TreeNode childNode in divNode.Nodes) { recurse_through_nodes(thisPackage, childNode, pages_encountered); } } }
/// <summary> Constructor for a new instance of the abstractMainWriter abstract class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> /// <param name="Static_Web_Content"> HTML content-based browse, info, or imple CMS-style web content objects. These are objects which are read from a static HTML file and much of the head information must be maintained </param> protected abstractMainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List <iSearch_Title_Result> Paged_Results, Item_Aggregation_Browse_Info Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page, HTML_Based_Content Static_Web_Content) { currentMode = Current_Mode; hierarchyObject = Hierarchy_Object; results_statistics = Results_Statistics; paged_results = Paged_Results; thisBrowseObject = Browse_Object; currentItem = Current_Item; currentPage = Current_Page; htmlBasedContent = Static_Web_Content; }
private void recurse_through_nodes(abstract_TreeNode Node, List <Page_TreeNode> PagesEncountered) { if (Node.Page) { Page_TreeNode pageNode = (Page_TreeNode)Node; if (!PagesEncountered.Contains(pageNode)) { pageseq++; } } else { Division_TreeNode divNode = (Division_TreeNode)Node; foreach (abstract_TreeNode childNode in divNode.Nodes) { recurse_through_nodes(childNode, PagesEncountered); } } }
private void print_jpeg2000(bool include_brief_citation, int page, TextWriter Output) { if (include_brief_citation) { print_brief_citation("700", Output); } // Get this page Page_TreeNode thisPage = currentItem.Web.Pages_By_Sequence[page - 1]; // Find the jpeg2000 image and show the image foreach (SobekCM_File_Info thisFile in thisPage.Files) { if (thisFile.System_Name.ToUpper().IndexOf(".JP2") > 0) { int zoomlevels = zoom_levels(thisFile.Width, thisFile.Height); int size_pixels = 512 + (currentMode.Viewport_Size * 256); if (currentMode.Viewport_Size == 3) { size_pixels = 1536; } int rotation = (currentMode.Viewport_Rotation % 4) * 90; string jpeg2000_filename = thisFile.System_Name; if ((jpeg2000_filename.Length > 0) && (jpeg2000_filename[0] != '/')) { jpeg2000_filename = "/UFDC/" + currentItem.Web.AssocFilePath + "/" + jpeg2000_filename; } // Build the source URL Output.Write("<img src=\"" + SobekCM_Library_Settings.JP2_Server + "imageserver?res=" + (zoomlevels - currentMode.Viewport_Zoom + 1) + "&viewwidth=" + size_pixels + "&viewheight=" + size_pixels); if (currentMode.Viewport_Zoom != 1) { Output.Write("&x=" + currentMode.Viewport_Point_X + "&y=" + currentMode.Viewport_Point_Y); } Output.WriteLine("&rotation=" + rotation + "&filename=" + jpeg2000_filename + "\" />"); break; } } }
private void recurse_through_nodes(abstract_TreeNode Node, List <string> Extensions) { // Was this node a page? if (Node.Page) { // Cast back to the PAGE node Page_TreeNode pageNode = (Page_TreeNode)Node; // If no files, do not add this back if (pageNode.Files.Count == 0) { return; } // Add a filenode for each file foreach (SobekCM_File_Info thisFile in pageNode.Files) { string extension = thisFile.File_Extension.ToLower(); if (!Extensions.Contains(extension)) { Extensions.Add(extension); } } } else { // This was a division node Division_TreeNode divNode = (Division_TreeNode)Node; // Look for children nodes foreach (abstract_TreeNode childNode in divNode.Nodes) { // Visit each child node recurse_through_nodes(childNode, Extensions); } } }
/// <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); }
/// <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> /// <remarks> This currently does not to anything, as this element is not fully implemented </remarks> public override void Save_To_Bib(SobekCM_Item Bib) { // Collect the list of download_files and download_labels from the form string[] getKeys = HttpContext.Current.Request.Form.AllKeys; string filename = String.Empty; List <string> download_files = new List <string>(); List <string> download_labels = new List <string>(); foreach (string thisKey in getKeys) { if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_select") == 0) { filename = HttpContext.Current.Request.Form[thisKey]; } if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_text") == 0) { if (filename.Length > 0) { string label = HttpContext.Current.Request.Form[thisKey]; download_files.Add(filename.Replace(".*", "")); download_labels.Add(label); } filename = String.Empty; } } // Collect the list of download files and download labels from the package List <string> existing_files = new List <string>(); List <string> existing_labels = new List <string>(); List <abstract_TreeNode> downloadGroups = Bib.Divisions.Download_Tree.Pages_PreOrder; foreach (Page_TreeNode thisDownload in downloadGroups) { if (thisDownload.Files.Count > 0) { string base_file = thisDownload.Files[0].File_Name_Sans_Extension; if (!existing_files.Contains(base_file)) { existing_files.Add(base_file); existing_labels.Add(thisDownload.Label); } } } // Now, compare the current list of downloads to the new list bool different = false; if (download_files.Count != existing_files.Count) { different = true; } else { // Same number of downloads, so step through and compare the files and labels for (int i = 0; i < download_files.Count; i++) { // Get the index of this on the existing list int index = existing_files.IndexOf(download_files[i].ToUpper()); if (index < 0) { different = true; break; } if (existing_labels[index].Trim() != download_labels[i].Trim()) { different = true; break; } } } // If this was different clear the existing downloads and load the new ones if (different) { // Get the directory for this package string directory = SobekCM_Library_Settings.Image_Server_Network + Bib.Web.AssocFilePath; // Clear existing Bib.Divisions.Download_Tree.Clear(); // No nodes exist, so add a MAIN division node Division_TreeNode newDivNode = new Division_TreeNode("Main", String.Empty); Bib.Divisions.Download_Tree.Roots.Add(newDivNode); // Add a page for each for (int i = 0; i < download_files.Count; i++) { // Get the list of matching files string[] files = Directory.GetFiles(directory, download_files[i] + ".*"); if (files.Length > 0) { // Add this as a new page on the new division Page_TreeNode newPage = new Page_TreeNode(download_labels[i]); newDivNode.Add_Child(newPage); // Add all the files next foreach (SobekCM_File_Info newFile in files.Select(thisFile => (new FileInfo(thisFile)).Name).Select(add_filename => new SobekCM_File_Info(add_filename))) { newPage.Files.Add(newFile); } } } } }
public static bool add_local_files(string[] files, Division_Info BibDivInfo, string directory, ref int pages_added, ref int files_added) { bool returnValue = false; files_added = 0; pages_added = 0; // Get the list of all divisions and page nodes (with attached files) List <abstract_TreeNode> allDivs = BibDivInfo.Physical_Tree.Divisions_PreOrder; // Get the full name for the current directory, normalized string package_normalized_dirname = (new DirectoryInfo(directory)).FullName.ToUpper(); // Store the hashtable between directory and relative directory (computed as necessary) Dictionary <string, string> directory_to_relative = new Dictionary <string, string>(); // Get the list of selected files foreach (string thisFile in files) { // Get the basic file information FileInfo thisFileInfo = new FileInfo(thisFile); // Get the normalized directoryname for this string this_normalized_dirname = thisFileInfo.Directory.FullName.ToUpper(); // Is this from the same directory? bool abort = false; string relative_directory = String.Empty; if (!this_normalized_dirname.Equals(package_normalized_dirname)) { // Is this in a subdirectory if (this_normalized_dirname.Contains(package_normalized_dirname)) { // Was the relative directory already computed? if (directory_to_relative.ContainsKey(this_normalized_dirname)) { relative_directory = directory_to_relative[this_normalized_dirname]; } else { // Compute the relative directory here StringBuilder relativeBuilder = new StringBuilder(); DirectoryInfo relativeDirIterator = thisFileInfo.Directory; relativeBuilder.Append(relativeDirIterator.Name); int binding_counter = 0; while ((relativeDirIterator.Parent.FullName.ToUpper() != package_normalized_dirname) && (binding_counter < 10)) { relativeDirIterator = relativeDirIterator.Parent; relativeBuilder.Insert(0, relativeDirIterator.Name + "\\"); binding_counter++; } if (binding_counter >= 10) { abort = true; MessageBox.Show("Error finding relative directory of file directory. "); } // Set the relative directory and save it relative_directory = relativeBuilder.ToString(); directory_to_relative[this_normalized_dirname] = relative_directory; } } else { // Not in a subdirectory, so look at potentially moving this file over if (File.Exists(directory + "\\" + thisFileInfo.Name)) { DialogResult thisResult = MessageBox.Show("New file matches existing file in the resource directory.\n\nWould you like to copy and overwrite the existing file? ", "Overwrite?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (thisResult != DialogResult.Yes) { abort = true; } else { File.Copy(thisFile, directory + "\\" + thisFileInfo.Name, true); thisFileInfo = new FileInfo(directory + "\\" + thisFileInfo.Name); } } else { File.Copy(thisFile, directory + "\\" + thisFileInfo.Name, true); thisFileInfo = new FileInfo(directory + "\\" + thisFileInfo.Name); } } } // Create the file object, so we can use it we need to SobekCM_File_Info newMetsFile = new SobekCM_File_Info(relative_directory.Length == 0 ? thisFileInfo.Name : relative_directory + "\\" + thisFileInfo.Name); if (!abort) { // Get the short filename for inserting into the structure map string filename = newMetsFile.File_Name_Sans_Extension; if (MetaTemplate_UserSettings.Page_Images_In_Seperate_Folders_Can_Be_Same_Page) { if (filename.IndexOf("\\") > 0) { string[] slash_splitter = filename.Split("\\".ToCharArray()); filename = slash_splitter[slash_splitter.Length - 1]; } } string extension = newMetsFile.File_Extension; // Is this an image file? if ((extension == "TIF") || (extension == "TIFF") || (extension == "JPG") || (extension == "JPEG") || (extension == "GIF") || (extension == "JP2") || (extension == "JPX") || (extension == "TXT") || (extension == "PRO") || (extension == "PNG")) { bool file_found = false; bool page_found = false; // Does this match an existing page file? foreach (abstract_TreeNode thisNode in allDivs) { // Is this a page? if (thisNode.Page) { // Step through all the files in this page Page_TreeNode pageNode = (Page_TreeNode)thisNode; foreach (SobekCM_File_Info existingFile in pageNode.Files) { // Get the filename for this string existingFileName = existingFile.System_Name.ToUpper(); if (MetaTemplate_UserSettings.Page_Images_In_Seperate_Folders_Can_Be_Same_Page) { if (existingFileName.IndexOf("\\") > 0) { string[] slash_splitter = existingFileName.Split("\\".ToCharArray()); existingFileName = slash_splitter[slash_splitter.Length - 1]; } } // Does this system name match the filename? if (existingFileName.IndexOf(filename + ".") == 0) { page_found = true; if (existingFileName == filename + "." + extension) { // Since we strip THM.JPG from the filename, let's do one last check for this if (existingFile.System_Name.ToUpper() == newMetsFile.System_Name.ToUpper()) { file_found = true; break; } } } } // Is this a matching page? if (page_found) { // If the file was not found, add this to the page if (!file_found) { pageNode.Files.Add(newMetsFile); files_added++; returnValue = true; } break; } } } // If not found, add this as a new page at the bottom if (!page_found) { // If there is no root division yet, make one if (BibDivInfo.Physical_Tree.Roots.Count == 0) { Division_TreeNode newRoot = new Division_TreeNode("Main", String.Empty); BibDivInfo.Physical_Tree.Roots.Add(newRoot); } // Create a mage node Page_TreeNode newPage = new Page_TreeNode(); newPage.Files.Add(newMetsFile); ((Division_TreeNode)BibDivInfo.Physical_Tree.Roots[0]).Nodes.Add(newPage); files_added++; pages_added++; returnValue = true; // Woah! This call below should be refactored since this is a time-expensive operation to // pull the entire nodes each time they list is altered. allDivs = BibDivInfo.Physical_Tree.Divisions_PreOrder; } } else { BibDivInfo.Download_Tree.Add_File(thisFileInfo.Name); files_added++; returnValue = true; } } } return(returnValue); }
public PrintForm_Fragment_ItemViewer(Page_TreeNode Current_Page, abstractItemViewer PageViewer) { currentPage = Current_Page; pageViewer = PageViewer; }
private void recursively_add_div_page_text(string SourceDirectory, abstract_TreeNode ThisNode, TextWriter Output_Stream, ref int PageCount) { if (ThisNode.Page) { Page_TreeNode pageNode = (Page_TreeNode)ThisNode; if (pageNode.Files.Count > 0) { string pageimage = String.Empty; string textfilename = pageNode.Files[0].File_Name_Sans_Extension + ".txt"; foreach (SobekCM_File_Info thisFile in pageNode.Files) { if (thisFile.File_Extension.ToLower() == "txt") { textfilename = thisFile.System_Name; } if ((thisFile.File_Extension.ToLower() == "jpg") && (thisFile.System_Name.ToLower().IndexOf("thm.jpg") < 0)) { pageimage = thisFile.System_Name; } } // Add the page break first Output_Stream.Write("<pb n=\"" + PageCount + "\""); if (pageimage.Length > 0) { Output_Stream.Write(" facs=\"" + Convert_String_To_XML_Safe(pageimage) + "\""); } Output_Stream.WriteLine(" />"); // Does the text file exist? string text_file = SourceDirectory + "\\" + textfilename; try { if (File.Exists(text_file)) { Output_Stream.WriteLine(Convert_String_To_XML_Safe(File.ReadAllText(text_file))); } } catch { } } PageCount++; } else { Division_TreeNode divNode = (Division_TreeNode)ThisNode; if (ThisNode.Type != "main") { Output_Stream.WriteLine("<div type=\"" + ThisNode.Type + "\">"); if ((ThisNode.Label.Length > 0) && (ThisNode.Label != ThisNode.Type)) { Output_Stream.WriteLine("<head>" + Convert_String_To_XML_Safe(ThisNode.Label) + "</head>"); } } // Now, step through child nodes foreach (abstract_TreeNode childNode in divNode.Nodes) { recursively_add_div_page_text(SourceDirectory, childNode, Output_Stream, ref PageCount); } if (ThisNode.Type != "main") { Output_Stream.WriteLine("</div>"); } } }
/// <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> Stream to which to write the HTML for this subwriter </summary> /// <param name="Output"> Response stream for the item viewer to write directly to </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Related_Images_ItemViewer.Write_Main_Viewer_Section", ""); } int images_per_page = thumbnailsPerPage; int size_of_thumbnails = thumbnailSize; // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; ushort current_view_page = CurrentMode.Page; // Start the citation table Output.WriteLine("\t\t<td>"); Output.WriteLine("\t\t<!-- RELATED IMAGES VIEWER OUTPUT -->"); // Start the main div for the thumbnails ushort page = (ushort)(CurrentMode.Page - 1); if (page > (CurrentItem.Web.Static_PageCount - 1) / images_per_page) { page = (ushort)((CurrentItem.Web.Static_PageCount - 1) / images_per_page); } //Outer div which contains all the thumbnails Output.WriteLine("<div style=\"margin:5px;text-align:center;\">"); // Step through each page in the item for (int page_index = page * images_per_page; (page_index < (page + 1) * images_per_page) && (page_index < CurrentItem.Web.Static_PageCount); page_index++) { // Get this page Page_TreeNode thisPage = CurrentItem.Web.Pages_By_Sequence[page_index]; // Find the jpeg and thumbnail images string jpeg = String.Empty; string thumbnail = String.Empty; foreach (SobekCM_File_Info thisFile in thisPage.Files) { if (thisFile.System_Name.ToLower().IndexOf(".jpg") > 0) { if (thisFile.System_Name.ToLower().IndexOf("thm.jpg") > 0) { thumbnail = thisFile.System_Name; } else { jpeg = thisFile.System_Name; } } } // If the thumbnail is not in the METS, just guess its existence if (thumbnail.Length == 0) { thumbnail = jpeg.ToLower().Replace(".jpg", "thm.jpg"); } // Get the image URL CurrentMode.Page = (ushort)(page_index + 1); CurrentMode.ViewerCode = (page_index + 1).ToString(); string url = CurrentMode.Redirect_URL(); // Determine the width information and the URL for the image string image_url; // = (CurrentItem.Web.Source_URL + "/" + thumbnail).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); int width = -1; switch (size_of_thumbnails) { case 2: image_url = (CurrentItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); width = 315; break; case 3: image_url = (CurrentItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); width = 472; break; case 4: image_url = (CurrentItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); break; default: image_url = (CurrentItem.Web.Source_URL + "/" + thumbnail).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); width = 150; break; } if (width > 0) { Output.WriteLine(" <table class=\"sbkRi_Thumbnail\" id=\"span" + page_index + "\" style=\"width:" + (width + 15) + "px\">"); } else { Output.WriteLine(" <table class=\"sbkRi_Thumbnail\" id=\"span" + page_index + "\">"); } Output.WriteLine(" <tr>"); Output.WriteLine(" <td>"); Output.WriteLine(" <a id=\"" + page_index + "\" href=\"" + url + "\" title=\"" + thisPage.Label + "\">"); if (width > 0) { Output.WriteLine(" <img src=\"" + image_url + "\" style=\"width:" + width + "px;\" alt=\"MISSING THUMBNAIL\" />"); } else { Output.WriteLine(" <img src=\"" + image_url + "\" alt=\"MISSING THUMBNAIL\" />"); } Output.WriteLine(" </a>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"text-align:center\">" + thisPage.Label + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine(); } //Close the outer div Output.WriteLine("</div>"); // Restore the mode CurrentMode.ViewerCode = current_view_code; CurrentMode.Page = current_view_page; Output.WriteLine("<script type=\"text/javascript\"> WindowResizeActions();</script>"); // Finish the citation table Output.WriteLine("\t\t</td>"); Output.WriteLine("\t\t<!-- END RELATED IMAGES VIEWER OUTPUT -->"); }
/// <summary> Adds the main view section to the page turner </summary> /// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("QC_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } int images_per_page = thumbnailsPerPage; int size_of_thumbnails = thumbnailSize; // Build the value StringBuilder builder = new StringBuilder(5000); // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; ushort current_view_page = CurrentMode.Page; builder.AppendLine("<!-- Hidden field is used for postbacks to add new form elements (i.e., new page, etc..) -->"); builder.AppendLine("<input type=\"hidden\" id=\"QC_behaviors_request\" name=\"QC_behaviors_request\" value=\"\" />"); // Start the citation table builder.AppendLine("\t\t<!-- QUALITY CONTROL VIEWER OUTPUT -->"); if (CurrentItem.Web.Static_PageCount < 100) { builder.AppendLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>" + translator.Get_Translation(title, CurrentMode.Language) + "</b></span></td></tr>"); builder.AppendLine("\t<tr>"); } builder.AppendLine("\t\t<td>"); // Start the main div for the thumbnails ushort page = (ushort)(CurrentMode.Page - 1); if (page > (CurrentItem.Web.Static_PageCount - 1) / images_per_page) { page = (ushort)((CurrentItem.Web.Static_PageCount - 1) / images_per_page); } //Outer div which contains all the thumbnails builder.AppendLine("<div id=\"allThumbnailsOuterDiv1\" align=\"center\" style=\"margin:5px;\"><span id=\"allThumbnailsOuterDiv\" align=\"left\" style=\"float:left\" class=\"doNotSort\">"); // Step through each page in the item Division_TreeNode lastParent = null; for (int page_index = page * images_per_page; (page_index < (page + 1) * images_per_page) && (page_index < CurrentItem.Web.Static_PageCount); page_index++) { Page_TreeNode thisPage = CurrentItem.Web.Pages_By_Sequence[page_index]; Division_TreeNode thisParent = childToParent[thisPage]; // Find the jpeg image foreach (SobekCM_File_Info thisFile in thisPage.Files.Where(thisFile => thisFile.System_Name.IndexOf(".jpg") > 0)) { // Get the image URL CurrentMode.Page = (ushort)(page_index + 1); CurrentMode.ViewerCode = (page_index + 1).ToString(); //set the image url to fetch the small thumbnail .thm image string image_url = (CurrentItem.Web.Source_URL + "/" + thisFile.System_Name.Replace(".jpg", "thm.jpg")).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); //If thumbnail size selected is large, get the full-size jpg image if (size_of_thumbnails == 2 || size_of_thumbnails == 3 || size_of_thumbnails == 4) { image_url = (CurrentItem.Web.Source_URL + "/" + thisFile.System_Name).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); } string url = CurrentMode.Redirect_URL().Replace("&", "&").Replace("\"", """); // Start the box for this thumbnail builder.AppendLine("<span id=\"span" + page_index + "\" align=\"left\" style=\"display:inline-block;\" onmouseover=\"this.className='thumbnailHighlight'; showQcPageIcons(this.id); showErrorIcon(this.id);\" onmouseout=\"this.className='thumbnailNormal'; hideQcPageIcons(this.id); hideErrorIcon(this.id);\" >"); builder.AppendLine("<div class=\"qcpage\" align=\"center\" id=\"parent" + image_url + "\" >"); builder.AppendLine("<table>"); // Add the name of the file builder.AppendLine("<tr><td class=\"qcfilename\" align=\"left\">" + thisFile.File_Name_Sans_Extension + "</td>"); //Determine the error icon size based on the current thumbnail size int error_icon_height = 20; int error_icon_width = 20; switch (size_of_thumbnails) { case 2: error_icon_height = 25; error_icon_width = 25; break; case 3: error_icon_height = 30; error_icon_width = 30; break; case 4: error_icon_height = 30; error_icon_width = 30; break; default: error_icon_height = 20; error_icon_height = 20; break; } //Add the error icon builder.AppendLine("<td><span id=\"error" + page_index + "\" class=\"errorIconSpan\"><img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/Cancel.ico\" height=\"" + error_icon_height + "\" width=\"" + error_icon_width + "\" alt=\"Missing Icon Image\"></img></span></td></tr>"); // Add the anchor for jumping to the file? builder.Append("<tr><td colspan=\"2\"><a id=\"" + page_index + "\" href=\"" + url + "\" target=\"_blank\">"); // Write the image and determine some values, based on current thumbnail size string division_text = "Division:"; string pagination_text = "Pagination:"; string division_box = "divisionbox_small"; string pagination_box = "pagebox_small"; int icon_width = 15; int icon_height = 15; int num_spaces = 1; switch (size_of_thumbnails) { case 2: builder.Append("<img id=\"child" + image_url + "\" src=\"" + image_url + "\" width=\"315px\" height=\"50%\" alt=\"MISSING THUMBNAIL\" class=\"qcthumbnails\" />"); division_box = "divisionbox_medium"; pagination_box = "pagebox_medium"; icon_width = 20; icon_height = 20; num_spaces = 3; break; case 3: builder.AppendLine("<img id=\"child" + image_url + "\" src=\"" + image_url + "\" width=\"472.5px\" height=\"75%\" alt=\"MISSING THUMBNAIL\" class=\"qcthumbnails\" />"); division_box = "divisionbox_large"; pagination_box = "pagebox_large"; icon_width = 20; icon_height = 20; num_spaces = 4; break; case 4: builder.AppendLine("<img id=\"child" + image_url + "\" src=\"" + image_url + "\" alt=\"MISSING THUMBNAIL\" class=\"qcthumbnails\" />"); division_box = "divisionbox_full"; pagination_box = "pagebox_full"; icon_width = 25; icon_height = 25; num_spaces = 4; break; default: builder.AppendLine("<img src=\"" + image_url + "\" alt=\"MISSING THUMBNAIL\" class=\"qcthumbnails\" />"); division_box = "divisionbox_small"; pagination_box = "pagebox_small"; division_text = "D:"; pagination_text = "Page:"; break; } builder.AppendLine("</a></td></tr>"); // Add the text box for entering the name of this page builder.AppendLine("<tr><td class=\"paginationtext\" align=\"left\">" + pagination_text + "</td>"); builder.AppendLine("<td><input type=\"text\" id=\"textbox" + page_index + "\" class=\"" + pagination_box + "\" value=\"" + thisPage.Label + "\" onchange=\"PaginationTextChanged(this.id,0," + CurrentItem.Web.Static_PageCount + ");\"></input></td></tr>"); // Was this a new parent? bool newParent = thisParent != lastParent; // Add the Division prompting, and the check box for a new division builder.Append("<tr><td class=\"divisiontext\" align=\"left\">" + division_text); builder.Append("<input type=\"checkbox\" id=\"newDivType" + page_index + "\" name=\"newdiv" + page_index + "\" value=\"new\" onclick=\"UpdateDivDropdown(this.name, " + CurrentItem.Web.Static_PageCount + ");\""); if (newParent) { builder.Append(" checked=\"checked\""); } builder.AppendLine("/></td>"); // Determine the text for the parent string parentLabel = String.Empty; if (thisParent != null) { parentLabel = thisParent.Display_Label; //if (parentLabel.Length == 0) // parentLabel = thisParent.Type; } // Add the division box // builder.AppendLine("<td><input type=\"text\" class=\"" + division_box + "\" value=\"" + parentLabel + "\"></input></td></tr>"); if (newParent) { builder.AppendLine("<td><select id=\"selectDivType" + page_index + "\" class=\"" + division_box + "\" onchange=\"DivisionTypeChanged(this.id," + CurrentItem.Web.Static_PageCount + ");\">"); } else { builder.AppendLine("<td><select id=\"selectDivType" + page_index + "\" class=\"" + division_box + "\" disabled=\"disabled\" onchange=\"DivisionTypeChanged(this.id," + CurrentItem.Web.Static_PageCount + ");\">"); } //Read the Division_Types_Errors.xml file to get the select options string divisionTypesErrorsFile = CurrentMode.Base_URL + "config/Division_Types_Errors.xml"; List <string> divOptions = new List <string>(); DataSet divList = new DataSet(); divList.ReadXml(divisionTypesErrorsFile); foreach (DataRow row in divList.Tables[1].Rows) { divOptions.Add(row[1].ToString()); } foreach (string divoption in divOptions) { if (divoption == parentLabel) { builder.AppendLine("<option value=\"" + divoption + "\" selected=\"selected\">" + divoption + "</option>"); } else { builder.AppendLine("<option value=\"" + divoption + "\">" + divoption + "</option>"); } } builder.AppendLine("</select></td></tr>"); //Add the on-hover options span for the page thumbnail builder.AppendLine("<tr><td colspan=\"100%\">"); builder.AppendLine("<span id=\"qcPageOptions" + page_index + "\" class=\"qcPageOptionsSpan\" style=\"float:right\"><img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/Main_Information.ICO\" height=\"" + icon_height + "\" width=\"" + icon_width + "\" alt=\"Missing Icon Image\"></img>"); //Add spaces between icons based on the current thumbnail size for (int i = 0; i < num_spaces; i++) { builder.AppendLine(" "); } builder.AppendLine("<a href=\"" + url + "\" target=\"_blank\"><img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/View.ico\" height=\"" + icon_height + "\" width=\"" + icon_width + "\" alt=\"Missing Icon Image\"></img></a>"); for (int i = 0; i < num_spaces; i++) { builder.AppendLine(" "); } builder.AppendLine("<img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/TRASH01.ICO\" height=\"" + icon_height + "\" width=\"" + icon_width + "\" alt=\"Missing Icon Image\"></img>"); for (int i = 0; i < num_spaces; i++) { builder.AppendLine(" "); } builder.AppendLine("<img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/POINT02.ICO\" height=\"" + icon_height + "\" width=\"" + icon_width + "\" alt=\"Missing Icon Image\"></img>"); for (int i = 0; i < num_spaces; i++) { builder.AppendLine(" "); } builder.AppendLine("<img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/POINT04.ICO\" height=\"" + icon_height + "\" width=\"" + icon_width + "\" alt=\"Missing Icon Image\"></img>"); builder.AppendLine("</span>"); builder.AppendLine("</tr></td>"); // Finish this one division builder.AppendLine("</table></div></span>"); builder.AppendLine(); break; } // Save the last parent lastParent = thisParent; } //Close the outer div builder.AppendLine("</span></div>"); // Restore the mode CurrentMode.ViewerCode = current_view_code; CurrentMode.Page = current_view_page; // Finish the citation table builder.AppendLine("\t\t</td>"); builder.AppendLine("\t\t<!-- END QUALITY CONTROL VIEWER OUTPUT -->"); //If the current url has an anchor, call the javascript function to animate the corresponding span background color //builder.AppendLine("<script type=\"text/javascript\">window.onload=MakeSpanFlashOnPageLoad();</script>"); builder.AppendLine("<script type=\"text/javascript\">window.onload=MakeSortable1();</script>"); builder.AppendLine("<script type=\"text/javascript\"> WindowResizeActions();</script>"); //Add the Complete and Cancel buttons at the end of the form builder.AppendLine("</tr><tr><td colspan=\"100%\" style=\"float:right\">"); builder.AppendLine("<button type=\"button\" onclick=\"behaviors_save_form();\"><img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/check.ico\" width=\"25\" height=\"25\"/>Complete</button>"); builder.AppendLine("<button type=\"button\" onclick=\"behaviors_cancel_form();\"><img src=\"" + CurrentMode.Base_URL + "default/images/ToolboxImages/Cancel.ico\" width=\"25\" height=\"25\" />Cancel</button>"); builder.AppendLine("</td></tr>"); // Add the build HTML for all the images Literal mainLiteral = new Literal { Text = builder.ToString() }; placeHolder.Controls.Add(mainLiteral); }
private bool recurse_through_nodes(abstract_TreeNode Node, List <BriefItem_FileGrouping> Groupings, List <BriefItem_TocElement> Toc, Stack <BriefItem_TocElement> CurrDivStack, int Level) { // Was this node a page? if (Node.Page) { // Cast back to the PAGE node Page_TreeNode pageNode = (Page_TreeNode)Node; // If no files, do not add this back if (pageNode.Files.Count == 0) { return(false); } // Create the file grouping object for this BriefItem_FileGrouping newNode = new BriefItem_FileGrouping(pageNode.Label); // Add a filenode for each file foreach (SobekCM_File_Info thisFile in pageNode.Files) { BriefItem_File newFile = new BriefItem_File(thisFile.System_Name); if (thisFile.Width > 0) { newFile.Width = thisFile.Width; } if (thisFile.Height > 0) { newFile.Height = thisFile.Height; } newNode.Files.Add(newFile); } // Add this to the list of images Groupings.Add(newNode); // Since this was a page with files, return TRUE return(true); } else { // Get what will be the sequence (if it turned out to have pages under it) int sequence = Groupings.Count + 1; // This was a division node Division_TreeNode divNode = (Division_TreeNode)Node; // Create the brief item TOC element BriefItem_TocElement divToc = new BriefItem_TocElement { Level = Level, Name = divNode.Label }; if (string.IsNullOrEmpty(divToc.Name)) { divToc.Name = divNode.Type; } // Add to the stack CurrDivStack.Push(divToc); // Look for children nodes bool some_files_under = false; foreach (abstract_TreeNode childNode in divNode.Nodes) { // Visit each child node if (recurse_through_nodes(childNode, Groupings, Toc, CurrDivStack, Level + 1)) { some_files_under = true; } } // Were there some files under here? if (some_files_under) { // Now, pop-up all the nodes in the queue and add them if (CurrDivStack.Count > 0) { IEnumerable <BriefItem_TocElement> reversed = CurrDivStack.Reverse(); foreach (BriefItem_TocElement revDiv in reversed) { revDiv.Sequence = sequence; Toc.Add(revDiv); } CurrDivStack.Clear(); } } else { // If this division (with NO pages under it apparently) is on the stack, // just pop it off if ((CurrDivStack.Count > 0) && (CurrDivStack.Peek() == divToc)) { CurrDivStack.Pop(); } } // Return whether there were any files under this return(some_files_under); } }
/// <summary> Build the solr document from the SobekCM Digital Resource object </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> /// <returns> Fully built (v5) solr document </returns> public v5_SolrDocument Build_Solr_Document(SobekCM_Item Digital_Object, string File_Location) { // Start the return object v5_SolrDocument returnValue = new v5_SolrDocument(); returnValue.FileLocation = File_Location; // Set the unique key returnValue.DID = Digital_Object.BibID + ":" + Digital_Object.VID; // Add the administrative fields returnValue.Aggregations = new List <string>(); returnValue.Aggregations.AddRange(Digital_Object.Behaviors.Aggregation_Code_List); returnValue.BibID = Digital_Object.BibID; returnValue.VID = Digital_Object.VID; returnValue.MainThumbnail = Digital_Object.Behaviors.Main_Thumbnail; // Add the made public field if (Digital_Object.Web.MadePublicDate.HasValue) { returnValue.MadePublicDate = Digital_Object.Web.MadePublicDate.Value; } else { // If this is public and non-dark, but no date for made // public exists, make it today if ((!Digital_Object.Behaviors.Dark_Flag) && (Digital_Object.Behaviors.IP_Restriction_Membership >= 0)) { Digital_Object.Web.MadePublicDate = DateTime.Now; } } // Add Serial hierarchy fields returnValue.Level1_Text = String.Empty; returnValue.Level1_Index = -1; returnValue.Level1_Facet = "NONE"; returnValue.Level2_Text = String.Empty; returnValue.Level2_Index = -1; returnValue.Level2_Facet = "NONE"; returnValue.Level3_Text = String.Empty; returnValue.Level3_Index = -1; returnValue.Level3_Facet = "NONE"; returnValue.Level4_Text = String.Empty; returnValue.Level4_Index = -1; returnValue.Level4_Facet = "NONE"; returnValue.Level5_Text = String.Empty; returnValue.Level5_Index = -1; returnValue.Level5_Facet = "NONE"; if (Digital_Object.Behaviors != null) { if (Digital_Object.Behaviors.Serial_Info.Count > 0) { returnValue.Level1_Index = Digital_Object.Behaviors.Serial_Info[0].Order; returnValue.Level1_Text = Digital_Object.Behaviors.Serial_Info[0].Display; returnValue.Level1_Text_Display = Digital_Object.Behaviors.Serial_Info[0].Display; returnValue.Level1_Facet = Digital_Object.Behaviors.Serial_Info[0].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[0].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 1) { returnValue.Level2_Index = Digital_Object.Behaviors.Serial_Info[1].Order; returnValue.Level2_Text = Digital_Object.Behaviors.Serial_Info[1].Display; returnValue.Level2_Text_Display = Digital_Object.Behaviors.Serial_Info[1].Display; returnValue.Level2_Facet = Digital_Object.Behaviors.Serial_Info[1].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[1].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 2) { returnValue.Level3_Index = Digital_Object.Behaviors.Serial_Info[2].Order; returnValue.Level3_Text = Digital_Object.Behaviors.Serial_Info[2].Display; returnValue.Level3_Text_Display = Digital_Object.Behaviors.Serial_Info[2].Display; returnValue.Level3_Facet = Digital_Object.Behaviors.Serial_Info[2].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[2].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 3) { returnValue.Level4_Index = Digital_Object.Behaviors.Serial_Info[3].Order; returnValue.Level4_Text = Digital_Object.Behaviors.Serial_Info[3].Display; returnValue.Level4_Text_Display = Digital_Object.Behaviors.Serial_Info[3].Display; returnValue.Level4_Facet = Digital_Object.Behaviors.Serial_Info[3].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[3].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 4) { returnValue.Level5_Index = Digital_Object.Behaviors.Serial_Info[4].Order; returnValue.Level5_Text = Digital_Object.Behaviors.Serial_Info[4].Display; returnValue.Level5_Text_Display = Digital_Object.Behaviors.Serial_Info[4].Display; returnValue.Level5_Facet = Digital_Object.Behaviors.Serial_Info[4].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[4].Display; } returnValue.Hidden = Digital_Object.Behaviors.Dark_Flag; } // Some defaults returnValue.Discover_Groups = new List <int> { 0 }; returnValue.Discover_Users = new List <int> { 0 }; returnValue.RestrictedMsg = String.Empty; // Set the IP restrictions based on PRIVATE or NOT if (Digital_Object.Behaviors.IP_Restriction_Membership == -1) { returnValue.Discover_IPs = new List <int> { -1 } } ; else { returnValue.Discover_IPs = new List <int> { 0 }; // If some restrictions, set the restriction message if (Digital_Object.Behaviors.IP_Restriction_Membership > 0) { returnValue.RestrictedMsg = "Access Restrictions Apply"; } } // Set the spatial KML GeoSpatial_Information geo = Digital_Object.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geo != null) { if (returnValue.SpatialFootprintKml == null) { returnValue.SpatialFootprintKml = new List <string>(); } returnValue.SpatialFootprintKml.Add(geo.SobekCM_Main_Spatial_String); returnValue.SpatialDistance = (int)geo.SobekCM_Main_Spatial_Distance; } // Get the rest of the metadata, from the item List <KeyValuePair <string, string> > searchTerms = Digital_Object.Search_Terms; // Loop through and add each data field foreach (KeyValuePair <string, string> searchTerm in searchTerms) { // Ensure there is a value here if (String.IsNullOrWhiteSpace(searchTerm.Value)) { continue; } // Assign based on the key term switch (searchTerm.Key.ToLower()) { case "title": returnValue.Title = searchTerm.Value; break; case "sort title": returnValue.SortTitle = searchTerm.Value; break; case "other title": if (returnValue.AltTitle == null) { returnValue.AltTitle = new List <string>(); } returnValue.AltTitle.Add(searchTerm.Value); break; case "translated title": if (returnValue.TranslatedTitle == null) { returnValue.TranslatedTitle = new List <string>(); } returnValue.TranslatedTitle.Add(searchTerm.Value); break; case "series title": returnValue.SeriesTitle = searchTerm.Value; break; case "other citation": if (returnValue.OtherCitation == null) { returnValue.OtherCitation = new List <string>(); } returnValue.OtherCitation.Add(searchTerm.Value); break; case "tickler": if (returnValue.Tickler == null) { returnValue.Tickler = new List <string>(); } returnValue.Tickler.Add(searchTerm.Value); break; case "abstract": if (returnValue.Abstract == null) { returnValue.Abstract = new List <string>(); } returnValue.Abstract.Add(searchTerm.Value); break; case "affililation": if (returnValue.Affiliation == null) { returnValue.Affiliation = new List <string>(); } returnValue.Affiliation.Add(searchTerm.Value); // For now, also put this in the display if (returnValue.AffiliationDisplay == null) { returnValue.AffiliationDisplay = new List <string>(); } returnValue.AffiliationDisplay.Add(searchTerm.Value); break; case "affililation display": if (returnValue.AffiliationDisplay == null) { returnValue.AffiliationDisplay = new List <string>(); } returnValue.AffiliationDisplay.Add(searchTerm.Value); break; case "genre": if (returnValue.Genre == null) { returnValue.Genre = new List <string>(); } returnValue.Genre.Add(searchTerm.Value); break; case "genre display": if (returnValue.GenreDisplay == null) { returnValue.GenreDisplay = new List <string>(); } returnValue.GenreDisplay.Add(searchTerm.Value); break; case "donor": returnValue.Donor = searchTerm.Value; break; case "identifier": if (returnValue.Identifier == null) { returnValue.Identifier = new List <string>(); } returnValue.Identifier.Add(searchTerm.Value); break; case "identifier display": if (returnValue.IdentifierDisplay == null) { returnValue.IdentifierDisplay = new List <string>(); } returnValue.IdentifierDisplay.Add(searchTerm.Value); break; case "accession number": // Set the display value (also used for faceting) to the full term returnValue.AccessionNumberDisplay = searchTerm.Value; // Make sure the list is built if (returnValue.AccessionNumber == null) { returnValue.AccessionNumber = new List <string>(); } // If there are any periods, represeting a hierarchical identifier, split it if (searchTerm.Value.IndexOf(".") > 0) { // Add each segment of the identifier string[] split = searchTerm.Value.Split(".".ToCharArray()); StringBuilder builder = new StringBuilder(split[0]); returnValue.AccessionNumber.Add(builder.ToString()); for (int i = 1; i < split.Length; i++) { builder.Append("." + split[i]); returnValue.AccessionNumber.Add(builder.ToString()); } } else { returnValue.AccessionNumber.Add(searchTerm.Value); } break; case "language": if (returnValue.Language == null) { returnValue.Language = new List <string>(); } returnValue.Language.Add(searchTerm.Value); break; case "creator": if (returnValue.Creator == null) { returnValue.Creator = new List <string>(); } returnValue.Creator.Add(searchTerm.Value); break; case "creator.display": if (returnValue.Creator_Display == null) { returnValue.Creator_Display = new List <string>(); } returnValue.Creator_Display.Add(searchTerm.Value); break; case "publisher": if (returnValue.Publisher == null) { returnValue.Publisher = new List <string>(); } returnValue.Publisher.Add(searchTerm.Value); break; case "publisher.display": if (returnValue.Publisher_Display == null) { returnValue.Publisher_Display = new List <string>(); } returnValue.Publisher_Display.Add(searchTerm.Value); break; case "holding location": returnValue.Holding = searchTerm.Value; break; case "notes": if (returnValue.Notes == null) { returnValue.Notes = new List <string>(); } returnValue.Notes.Add(searchTerm.Value); break; case "frequency": if (returnValue.Frequency == null) { returnValue.Frequency = new List <string>(); } returnValue.Frequency.Add(searchTerm.Value); break; case "edition": returnValue.Edition = searchTerm.Value; break; case "publication place": if (returnValue.PubPlace == null) { returnValue.PubPlace = new List <string>(); } returnValue.PubPlace.Add(searchTerm.Value); break; case "format": returnValue.Format = searchTerm.Value; break; case "source institution": returnValue.Source = searchTerm.Value; break; case "target audience": if (returnValue.Audience == null) { returnValue.Audience = new List <string>(); } returnValue.Audience.Add(searchTerm.Value); break; case "type": returnValue.Type = searchTerm.Value; break; case "name as subject": if (returnValue.NameAsSubject == null) { returnValue.NameAsSubject = new List <string>(); } returnValue.NameAsSubject.Add(searchTerm.Value); break; case "name as subject dispay": if (returnValue.NameAsSubjectDisplay == null) { returnValue.NameAsSubjectDisplay = new List <string>(); } returnValue.NameAsSubjectDisplay.Add(searchTerm.Value); break; case "title as subject": if (returnValue.TitleAsSubject == null) { returnValue.TitleAsSubject = new List <string>(); } returnValue.TitleAsSubject.Add(searchTerm.Value); break; case "title as subject display": if (returnValue.TitleAsSubjectDisplay == null) { returnValue.TitleAsSubjectDisplay = new List <string>(); } returnValue.TitleAsSubjectDisplay.Add(searchTerm.Value); break; case "spatial coverage": if (returnValue.Spatial == null) { returnValue.Spatial = new List <string>(); } returnValue.Spatial.Add(searchTerm.Value); break; case "spatial coverage.display": if (returnValue.SpatialDisplay == null) { returnValue.SpatialDisplay = new List <string>(); } returnValue.SpatialDisplay.Add(searchTerm.Value); break; case "country": if (returnValue.Country == null) { returnValue.Country = new List <string>(); } returnValue.Country.Add(searchTerm.Value); break; case "state": if (returnValue.State == null) { returnValue.State = new List <string>(); } returnValue.State.Add(searchTerm.Value); break; case "county": if (returnValue.County == null) { returnValue.County = new List <string>(); } returnValue.County.Add(searchTerm.Value); break; case "city": if (returnValue.City == null) { returnValue.City = new List <string>(); } returnValue.City.Add(searchTerm.Value); break; case "subject keyword": if (returnValue.Subject == null) { returnValue.Subject = new List <string>(); } returnValue.Subject.Add(searchTerm.Value.Trim()); break; case "subjects.display": if (returnValue.SubjectDisplay == null) { returnValue.SubjectDisplay = new List <string>(); } returnValue.SubjectDisplay.Add(searchTerm.Value.Trim()); break; case "publication date": returnValue.Date = searchTerm.Value; returnValue.DateDisplay = searchTerm.Value; break; case "date year": returnValue.DateYear = searchTerm.Value; break; case "toc": if (returnValue.TableOfContents == null) { returnValue.TableOfContents = new List <string>(); } returnValue.TableOfContents.Add(searchTerm.Value.Trim()); break; case "mime type": if (returnValue.MimeType == null) { returnValue.MimeType = new List <string>(); } returnValue.MimeType.Add(searchTerm.Value.Trim()); break; case "cultural context": if (returnValue.CulturalContext == null) { returnValue.CulturalContext = new List <string>(); } returnValue.CulturalContext.Add(searchTerm.Value.Trim()); break; case "inscription": if (returnValue.Inscription == null) { returnValue.Inscription = new List <string>(); } returnValue.Inscription.Add(searchTerm.Value.Trim()); break; case "materials": case "material": if (returnValue.Material == null) { returnValue.Material = new List <string>(); } returnValue.Material.Add(searchTerm.Value.Trim()); break; case "materials display": case "material display": if (returnValue.MaterialDisplay == null) { returnValue.MaterialDisplay = new List <string>(); } returnValue.MaterialDisplay.Add(searchTerm.Value.Trim()); break; case "measurements": if (returnValue.Measurements == null) { returnValue.Measurements = new List <string>(); } returnValue.Measurements.Add(searchTerm.Value.Trim()); break; case "measurements display": if (returnValue.MeasurementsDisplay == null) { returnValue.MeasurementsDisplay = new List <string>(); } returnValue.MeasurementsDisplay.Add(searchTerm.Value.Trim()); break; case "style period": if (returnValue.StylePeriod == null) { returnValue.StylePeriod = new List <string>(); } returnValue.StylePeriod.Add(searchTerm.Value.Trim()); break; case "technique": if (returnValue.Technique == null) { returnValue.Technique = new List <string>(); } returnValue.Technique.Add(searchTerm.Value.Trim()); break; case "interviewee": if (returnValue.Interviewee == null) { returnValue.Interviewee = new List <string>(); } returnValue.Interviewee.Add(searchTerm.Value.Trim()); break; case "interviewer": if (returnValue.Interviewer == null) { returnValue.Interviewer = new List <string>(); } returnValue.Interviewer.Add(searchTerm.Value.Trim()); break; case "performance": returnValue.Performance = searchTerm.Value.Trim(); // For now, we aren't setting the performance display any differently than performance returnValue.PerformanceDisplay = searchTerm.Value.Trim(); break; case "performance date": returnValue.PerformanceDate = searchTerm.Value.Trim(); break; case "performer": if (returnValue.Performer == null) { returnValue.Performer = new List <string>(); } returnValue.Performer.Add(searchTerm.Value.Trim()); // For now, we aren't setting the performer display any differently than performer if (returnValue.PerformerDisplay == null) { returnValue.PerformerDisplay = new List <string>(); } returnValue.PerformerDisplay.Add(searchTerm.Value.Trim()); break; case "etd committee": if (returnValue.EtdCommittee == null) { returnValue.EtdCommittee = new List <string>(); } returnValue.EtdCommittee.Add(searchTerm.Value.Trim()); break; case "etd degree": returnValue.EtdDegree = searchTerm.Value.Trim(); break; case "etd degree discipline": returnValue.EtdDegreeDiscipline = searchTerm.Value.Trim(); break; case "etd degree division": returnValue.EtdDegreeDivision = searchTerm.Value.Trim(); break; case "etd degree grantor": returnValue.EtdDegreeGrantor = searchTerm.Value.Trim(); break; case "etd degree level": returnValue.EtdDegreeLevel = searchTerm.Value.Trim(); break; case "zt kingdom": if (returnValue.ZoologicalKingdom == null) { returnValue.ZoologicalKingdom = new List <string>(); } returnValue.ZoologicalKingdom.Add(searchTerm.Value.Trim()); break; case "zt phylum": if (returnValue.ZoologicalPhylum == null) { returnValue.ZoologicalPhylum = new List <string>(); } returnValue.ZoologicalPhylum.Add(searchTerm.Value.Trim()); break; case "zt class": if (returnValue.ZoologicalClass == null) { returnValue.ZoologicalClass = new List <string>(); } returnValue.ZoologicalClass.Add(searchTerm.Value.Trim()); break; case "zt order": if (returnValue.ZoologicalOrder == null) { returnValue.ZoologicalOrder = new List <string>(); } returnValue.ZoologicalOrder.Add(searchTerm.Value.Trim()); break; case "zt family": if (returnValue.ZoologicalFamily == null) { returnValue.ZoologicalFamily = new List <string>(); } returnValue.ZoologicalFamily.Add(searchTerm.Value.Trim()); break; case "zt genus": if (returnValue.ZoologicalGenus == null) { returnValue.ZoologicalGenus = new List <string>(); } returnValue.ZoologicalGenus.Add(searchTerm.Value.Trim()); break; case "zt species": if (returnValue.ZoologicalSpecies == null) { returnValue.ZoologicalSpecies = new List <string>(); } returnValue.ZoologicalSpecies.Add(searchTerm.Value.Trim()); break; case "zt common name": if (returnValue.ZoologicalCommonName == null) { returnValue.ZoologicalCommonName = new List <string>(); } returnValue.ZoologicalCommonName.Add(searchTerm.Value.Trim()); break; case "zt scientific name": if (returnValue.ZoologicalScientificName == null) { returnValue.ZoologicalScientificName = new List <string>(); } returnValue.ZoologicalScientificName.Add(searchTerm.Value.Trim()); break; case "zt hierarchical": if (returnValue.ZoologicalHierarchical == null) { returnValue.ZoologicalHierarchical = new List <string>(); } returnValue.ZoologicalHierarchical.Add(searchTerm.Value.Trim()); break; // Solr already rolls up to a zt_all field, so ignore this case "zt all taxonomy": break; case "lom aggregation": returnValue.LomAggregation = searchTerm.Value.Trim(); break; case "lom context": if (returnValue.LomContext == null) { returnValue.LomContext = new List <string>(); } returnValue.LomContext.Add(searchTerm.Value.Trim()); break; case "lom context display": if (returnValue.LomContextDisplay == null) { returnValue.LomContextDisplay = new List <string>(); } returnValue.LomContextDisplay.Add(searchTerm.Value.Trim()); break; case "lom difficulty": returnValue.LomDifficulty = searchTerm.Value.Trim(); break; case "lom intended end user": if (returnValue.LomIntendedEndUser == null) { returnValue.LomIntendedEndUser = new List <string>(); } returnValue.LomIntendedEndUser.Add(searchTerm.Value.Trim()); break; case "lom intended end user display": returnValue.LomIntendedEndUserDisplay = searchTerm.Value.Trim(); break; case "lom interactivity level": returnValue.LomInteractivityLevel = searchTerm.Value.Trim(); break; case "lom interactivity type": returnValue.LomInteractivityType = searchTerm.Value.Trim(); break; case "lom status": returnValue.LomStatus = searchTerm.Value.Trim(); break; case "lom requirement": if (returnValue.LomRequirement == null) { returnValue.LomRequirement = new List <string>(); } returnValue.LomRequirement.Add(searchTerm.Value.Trim()); break; case "lom requirement display": if (returnValue.LomRequirementDisplay == null) { returnValue.LomRequirementDisplay = new List <string>(); } returnValue.LomRequirementDisplay.Add(searchTerm.Value.Trim()); break; case "lom age range": if (returnValue.LomAgeRange == null) { returnValue.LomAgeRange = new List <string>(); } returnValue.LomAgeRange.Add(searchTerm.Value.Trim()); break; case "lom resource type": if (returnValue.LomResourceType == null) { returnValue.LomResourceType = new List <string>(); } returnValue.LomResourceType.Add(searchTerm.Value.Trim()); break; case "lom resource type display": if (returnValue.LomResourceTypeDisplay == null) { returnValue.LomResourceTypeDisplay = new List <string>(); } returnValue.LomResourceTypeDisplay.Add(searchTerm.Value.Trim()); break; case "lom learning time": returnValue.LomLearningTime = searchTerm.Value.Trim(); break; case "temporal subject": returnValue.TemporalSubject = searchTerm.Value.Trim(); break; case "temporal subject display": returnValue.TemporalSubjectDisplay = searchTerm.Value.Trim(); break; // Not handled yet case "temporal year": case "ead name": break; // Ignore these case "bibid": case "vid": break; // Some more to ignore, since these are handled differently in solr case "all subjects": case "aggregation": break; default: StreamWriter writer = new StreamWriter("missing_fields.txt", true); writer.WriteLine(searchTerm.Key); writer.Flush(); writer.Close(); break; } } // Find the Gregorian date issues value string pub_date = Digital_Object.Bib_Info.Origin_Info.Date_Check_All_Fields; returnValue.Date = pub_date; returnValue.DateDisplay = pub_date; DateTime gregDate; if (DateTime.TryParse(pub_date, out gregDate)) { returnValue.Date = returnValue.Date + " (Date Auto-Converted to " + gregDate.ToShortDateString() + ")"; returnValue.GregorianDate = gregDate; returnValue.DateYear = gregDate.Year.ToString(); // For now (since temporal subject isn't the best) just use this date for the timeline returnValue.TimelineDate = gregDate; returnValue.TimelineDateDisplay = pub_date; } else { int year_only; if ((pub_date.Length == 4) && (int.TryParse(pub_date, out year_only))) { gregDate = new DateTime(year_only, 1, 1); returnValue.Date = returnValue.Date = returnValue.Date + " (Date Converted to " + gregDate.ToShortDateString() + ")"; returnValue.GregorianDate = gregDate; returnValue.DateYear = gregDate.Year.ToString(); // For now (since temporal subject isn't the best) just use this date for the timeline returnValue.TimelineDate = gregDate; returnValue.TimelineDateDisplay = pub_date; } else { returnValue.Date = returnValue.Date + " (Date NOT Converted)"; } } //// Subject metadata fields ( and also same spatial information ) //List<string> spatials = new List<string>(); //List<Subject_Info_HierarchicalGeographic> hierarhicals = new List<Subject_Info_HierarchicalGeographic>(); //if ( Digital_Object.Bib_Info.Subjects_Count > 0 ) //{ // List<string> subjects = new List<string>(); // List<string> name_as_subject = new List<string>(); // List<string> title_as_subject = new List<string>(); // // Collect the types of subjects // foreach (Subject_Info thisSubject in Digital_Object.Bib_Info.Subjects) // { // switch (thisSubject.Class_Type) // { // case Subject_Info_Type.Name: // name_as_subject.Add(thisSubject.ToString()); // break; // case Subject_Info_Type.TitleInfo: // title_as_subject.Add(thisSubject.ToString()); // break; // case Subject_Info_Type.Standard: // subjects.Add(thisSubject.ToString()); // Subject_Info_Standard standardSubj = thisSubject as Subject_Info_Standard; // if (standardSubj.Geographics_Count > 0) // { // spatials.AddRange(standardSubj.Geographics); // } // break; // case Subject_Info_Type.Hierarchical_Spatial: // hierarhicals.Add( thisSubject as Subject_Info_HierarchicalGeographic); // break; // } // } // // Now add to this document, if present // if (name_as_subject.Count > 0) // { // NameAsSubject = new List<string>(); // NameAsSubject.AddRange(name_as_subject); // } // if (title_as_subject.Count > 0) // { // TitleAsSubject = new List<string>(); // TitleAsSubject.AddRange(title_as_subject); // } // if (subjects.Count > 0) // { // Subject = new List<string>(); // Subject.AddRange(subjects); // } //} // Add the empty solr pages for now returnValue.Solr_Pages = new List <Legacy_SolrPage>(); // Prepare to step through all the divisions/pages in this item int pageorder = 1; List <abstract_TreeNode> divsAndPages = Digital_Object.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; // 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()]; } Legacy_SolrPage newPage = new Legacy_SolrPage(Digital_Object.BibID, Digital_Object.VID, pageorder, pageNode.Label, pageText, thumbnail); returnValue.Solr_Pages.Add(newPage); } catch { } } } // Increment the page order for the next page irregardless pageorder++; } } // Now, check for any other valid text files returnValue.AdditionalTextFiles = 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)) { returnValue.AdditionalTextFiles.Add(thisTextFile); } } return(returnValue); }
/// <summary> Writes the item information in JSON format directly to the output stream </summary> /// <param name="Output"> Stream to which to write the JSON item information </param> protected internal void display_item_info(TextWriter Output) { SobekCM_Item currentItem = SobekEngineClient.Items.Get_Sobek_Item(RequestSpecificValues.Current_Mode.BibID, RequestSpecificValues.Current_Mode.VID, RequestSpecificValues.Tracer); // What if the page requested is greater than pages in the book? // What is the ID? // What if an item does not have jpeg's for each page? No jpegs at all? Output.Write("["); if (currentItem != null) { if (RequestSpecificValues.Current_Mode.ViewerCode != "text") { int currentPageIndex = RequestSpecificValues.Current_Mode.Page.HasValue ? RequestSpecificValues.Current_Mode.Page.Value : 1; int first_page_to_show = (currentPageIndex - 1) * 20; int last_page_to_show = (currentPageIndex * 20) - 1; if (first_page_to_show < currentItem.Web.Static_PageCount) { int page = first_page_to_show; string jpeg_to_view = String.Empty; while ((page < currentItem.Web.Static_PageCount) && (page <= last_page_to_show)) { Page_TreeNode thisPage = currentItem.Web.Pages_By_Sequence[page]; bool found = false; foreach (SobekCM_File_Info thisFile in thisPage.Files.Where(ThisFile => ThisFile.System_Name.ToUpper().IndexOf(".JPG") > 0)) { jpeg_to_view = currentGreenstoneImageRoot + currentItem.Web.AssocFilePath + "/" + thisFile.System_Name; found = true; break; } if (found) { if (page > first_page_to_show) { Output.Write(","); } jpeg_to_view = jpeg_to_view.Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); Output.Write("{\"item_page\":{\"position\":" + (page + 1) + ",\"image_url\":\"" + jpeg_to_view + "\",\"id\":" + (page + 1) + ",\"collection_item_id\":1}}"); } page++; } } } else { // Get the list of all TEXT files List <string> existing_text_files = new List <string>(); if (Directory.Exists(UI_ApplicationCache_Gateway.Settings.Servers.Image_Server_Network + currentItem.Web.AssocFilePath)) { string[] allFiles = Directory.GetFiles(UI_ApplicationCache_Gateway.Settings.Servers.Image_Server_Network + currentItem.Web.AssocFilePath, "*.txt"); existing_text_files.AddRange(allFiles.Select(ThisFile => (new FileInfo(ThisFile)).Name.ToUpper())); } int page = 0; string jpeg_to_view = String.Empty; while (page < currentItem.Web.Static_PageCount) { string text_to_read = String.Empty; Page_TreeNode thisPage = currentItem.Web.Pages_By_Sequence[page]; bool found = false; foreach (SobekCM_File_Info thisFile in thisPage.Files) { if (thisFile.System_Name.ToUpper().IndexOf(".JPG") > 0) { if (existing_text_files.Contains(thisFile.System_Name.ToUpper().Replace(".JPG", "") + ".TXT")) { text_to_read = currentGreenstoneImageRoot + currentItem.Web.AssocFilePath + "/" + thisFile.System_Name.Replace(".JPG", ".TXT").Replace(".jpg", ".txt"); } jpeg_to_view = currentGreenstoneImageRoot + currentItem.Web.AssocFilePath + "/" + thisFile.System_Name; found = true; break; } } if (found) { if (page > 0) { Output.Write(","); } jpeg_to_view = jpeg_to_view.Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); text_to_read = text_to_read.Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); Output.Write("{\"item_page\":{\"position\":" + (page + 1) + ",\"image_url\":\"" + jpeg_to_view + "\",\"text_url\":\"" + text_to_read + "\"}}"); } page++; } } } Output.Write("]"); }
/// <summary> Adds the main view section to the page turner </summary> /// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Related_Images_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } int images_per_page = thumbnailsPerPage; int size_of_thumbnails = thumbnailSize; // Build the value StringBuilder builder = new StringBuilder(5000); // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; ushort current_view_page = CurrentMode.Page; // Start the citation table builder.AppendLine("\t\t<!-- RELATED IMAGES VIEWER OUTPUT -->"); builder.AppendLine("\t\t<td>"); // Start the main div for the thumbnails ushort page = (ushort)(CurrentMode.Page - 1); if (page > (CurrentItem.Web.Static_PageCount - 1) / images_per_page) { page = (ushort)((CurrentItem.Web.Static_PageCount - 1) / images_per_page); } //Outer div which contains all the thumbnails builder.AppendLine("<div align=\"center\" style=\"margin:5px;\"><span align=\"left\" style=\"float:left\">"); // Step through each page in the item for (int page_index = page * images_per_page; (page_index < (page + 1) * images_per_page) && (page_index < CurrentItem.Web.Static_PageCount); page_index++) { Page_TreeNode thisPage = CurrentItem.Web.Pages_By_Sequence[page_index]; // Find the jpeg image foreach (SobekCM_File_Info thisFile in thisPage.Files.Where(thisFile => thisFile.System_Name.IndexOf(".jpg") > 0)) { // Get the image URL CurrentMode.Page = (ushort)(page_index + 1); CurrentMode.ViewerCode = (page_index + 1).ToString(); //set the image url to fetch the small thumbnail .thm image string image_url = (CurrentItem.Web.Source_URL + "/" + thisFile.System_Name.Replace(".jpg", "thm.jpg")).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); //If thumbnail size selected is large, get the full-size jpg image if (size_of_thumbnails == 2 || size_of_thumbnails == 3 || size_of_thumbnails == 4) { image_url = (CurrentItem.Web.Source_URL + "/" + thisFile.System_Name).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); } string url = CurrentMode.Redirect_URL().Replace("&", "&").Replace("\"", """); //builder.Append("<span id=\"span"+thisPage.Label+"\" align=\"left\" style=\"display:inline-block;\" onmouseover=\"this.className='thumbnailHighlight'\" onmouseout=\"this.className='thumbnailNormal'\" onmousedown=\"window.location.href='" + url + "';\">"); builder.Append("<span id=\"span" + (page_index + 1) + "\" align=\"left\" style=\"display:inline-block;\" onmouseover=\"this.className='thumbnailHighlight'\" onmouseout=\"this.className='thumbnailNormal'\" onmousedown=\"window.location.href='" + url + "';\">"); if (size_of_thumbnails == 2) { builder.AppendLine("<span style=\"display:inline-block;\" align=\"center\" id=\"parent" + image_url + "\"><table style=\"display:inline-block;\"><tr><td><a id=\"" + thisPage.Label + "\" href=\"" + url + "\"><img id=\"child" + image_url + "\" src=\"" + image_url + "\" width=\"315px\" height=\"50%\" alt=\"MISSING THUMBNAIL\" class=\"itemThumbnails\" /></a></td></tr><tr><td><span align=\"center\"><span class=\"SobekThumbnailText\" style=\"display:inline-block;\">" + thisPage.Label + "</span></span></td></tr></table></span></span>"); } else if (size_of_thumbnails == 3) { builder.AppendLine("<span style=\"display:inline-block;\" align=\"center\" id=\"parent" + image_url + "\"><table style=\"display:inline-block;\"><tr><td><a id=\"" + thisPage.Label + "\" href=\"" + url + "\"><img id=\"child" + image_url + "\" src=\"" + image_url + "\" width=\"472.5px\" height=\"75%\" alt=\"MISSING THUMBNAIL\" class=\"itemThumbnails\" /></a></td></tr><tr><td><span align=\"center\"><span class=\"SobekThumbnailText\" style=\"display:inline-block;\">" + thisPage.Label + "</span></span></td></tr></table></span></span>"); } else if (size_of_thumbnails == 4) { builder.AppendLine("<span style=\"display:inline-block;\" align=\"center\" id=\"parent" + image_url + "\"><table style=\"display:inline-block;\"><tr><td><a id=\"" + thisPage.Label + "\" href=\"" + url + "\"><img id=\"child" + image_url + "\" src=\"" + image_url + "\" alt=\"MISSING THUMBNAIL\" class=\"itemThumbnails\" /></a></td></tr><tr><td><span align=\"center\"><span class=\"SobekThumbnailText\" style=\"display:inline-block;\">" + thisPage.Label + "</span></span></td></tr></table></span></span>"); } else { builder.AppendLine("<span align=\"center\" style=\"display:inline-block;\"><table style=\"display:inline-block;\"><tr><td><a id=\"" + thisPage.Label + "\" href=\"" + url + "\"><img src=\"" + image_url + "\" alt=\"MISSING THUMBNAIL\" class=\"itemThumbnails\" /></a></td></tr><tr><td><span align=\"center\" style=\"display:inline-block;\"><span class=\"SobekThumbnailText\" style=\"display:inline-block;\">" + thisPage.Label + "</span></span></td></tr></table></span></span>"); } break; } } //Close the outer div builder.AppendLine("</span></div>"); // Restore the mode CurrentMode.ViewerCode = current_view_code; CurrentMode.Page = current_view_page; // Finish the citation table builder.AppendLine("\t\t</td>"); builder.AppendLine("\t\t<!-- END RELATED IMAGES VIEWER OUTPUT -->"); //If the current url has an anchor, call the javascript function to animate the corresponding span background color builder.AppendLine("<script type=\"text/javascript\">window.onload=MakeSpanFlashOnPageLoad();</script>"); builder.AppendLine("<script type=\"text/javascript\"> WindowResizeActions();</script>"); // Add the HTML for the images Literal mainLiteral = new Literal { Text = builder.ToString() }; placeHolder.Controls.Add(mainLiteral); }