コード例 #1
0
        private void collect_nodes(Division_Tree Tree, List <BriefItem_FileGrouping> Groupings, List <BriefItem_TocElement> Toc)
        {
            // If not roots, do nothing!
            if ((Tree == null) || (Tree.Roots == null) || (Tree.Roots.Count == 0))
            {
                return;
            }

            // Create the stack used for determining the TOC
            Stack <BriefItem_TocElement> currDivStack = new Stack <BriefItem_TocElement>();

            // Start at the very top?
            List <abstract_TreeNode> rootNodes = Tree.Roots;

            if ((rootNodes.Count == 1) && (!rootNodes[0].Page))
            {
                // This was a division node
                Division_TreeNode divNode = (Division_TreeNode)Tree.Roots[0];

                if ((divNode.Nodes != null) && (divNode.Nodes.Count > 0))
                {
                    rootNodes = divNode.Nodes;
                }
            }

            // Now, step through all the nodes
            foreach (abstract_TreeNode thisNode in rootNodes)
            {
                recurse_through_nodes(thisNode, Groupings, Toc, currDivStack, 1);
            }
        }
コード例 #2
0
 private void recurse_through_and_find_child_parent_relationship(Division_TreeNode parentNode)
 {
     foreach (abstract_TreeNode childNode in parentNode.Nodes)
     {
         if (childNode.Page)
         {
             childToParent[(Page_TreeNode)childNode] = parentNode;
         }
         else
         {
             recurse_through_and_find_child_parent_relationship((Division_TreeNode)childNode);
         }
     }
 }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
        /// <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);
                        }
                    }
                }
            }
        }
コード例 #7
0
        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>");
                }
            }
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
        /// <summary> Adds the main view section to the page turner </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) 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("&", "&amp;").Replace("\"", "&quot;");

                    // 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("&nbsp;");
                    }
                    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("&nbsp;");
                    }
                    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("&nbsp;");
                    }
                    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("&nbsp;");
                    }
                    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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        /// <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);
        }