Example #1
0
        /// <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("EAD_Description_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Try to get the ead information
            EAD_Transfer_Object eadInfo = SobekEngineClient.Items.Get_Item_EAD(BriefItem.BibID, BriefItem.VID, true, Tracer);

            // Build the value
            Output.WriteLine("          <td>");
            Output.WriteLine("            <div id=\"sbkEad_MainArea\">");

            if (!String.IsNullOrWhiteSpace(CurrentMode.Text_Search))
            {
                // Get any search terms
                List <string> terms = new List <string>();
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }

                Output.Write(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(eadInfo.Full_Description, terms));
            }
            else
            {
                Output.Write(eadInfo.Full_Description);
            }

            Output.WriteLine("            </div>");
            Output.WriteLine("          </td>");
        }
        /// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </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("TEI_ItemViewer.Add_Main_Viewer_Section", "");
            }



            // Build the value
            Output.WriteLine("          <td>");
            Output.WriteLine("            <div id=\"sbkEad_MainArea\">");

            if (!String.IsNullOrWhiteSpace(CurrentRequest.Text_Search))
            {
                // Get any search terms
                List <string> terms = new List <string>();
                if (CurrentRequest.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentRequest.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }

                Output.Write(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(tei_string_to_display, terms));
            }
            else
            {
                Output.Write(tei_string_to_display);
            }

            Output.WriteLine("            </div>");
            Output.WriteLine("          </td>");
        }
Example #3
0
        /// <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("EAD_Description_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Get the metadata module for EADs
            EAD_Info eadInfo = (EAD_Info)CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);

            // Build the value
            Output.WriteLine("          <td>");
            Output.WriteLine("            <div id=\"sbkEad_MainArea\">");

            if (CurrentMode.Text_Search.Length > 0)
            {
                // Get any search terms
                List <string> terms = new List <string>();
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }

                Output.Write(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(eadInfo.Full_Description, terms));
            }
            else
            {
                Output.Write(eadInfo.Full_Description);
            }

            Output.WriteLine("            </div>");
            Output.WriteLine("          </td>");
        }
        /// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </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("Citation_Standard_ItemViewer.Write_Main_Viewer_Section", "Write the citation information directly to the output stream");
            }


            // Add the HTML for the citation
            Output.WriteLine("        <!-- CITATION ITEM VIEWER OUTPUT -->");
            Output.WriteLine("        <td>");

            // If this is DARK and the user cannot edit and the flag is not set to show citation, show nothing here
            if ((BriefItem.Behaviors.Dark_Flag) && (!userCanEdit) && (!UI_ApplicationCache_Gateway.Settings.Resources.Show_Citation_For_Dark_Items))
            {
                Output.WriteLine("          <div id=\"darkItemSuppressCitationMsg\">This item is DARK and cannot be viewed at this time</div>" + Environment.NewLine + "</td>" + Environment.NewLine + "  <!-- END CITATION VIEWER OUTPUT -->");
                return;
            }

            string viewer_code = CurrentRequest.ViewerCode;

            // Get any search terms
            List <string> terms = new List <string>();

            if (!String.IsNullOrWhiteSpace(CurrentRequest.Text_Search))
            {
                string[] splitter = CurrentRequest.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
            }

            // Add the main wrapper division
            Output.WriteLine("<div id=\"sbkCiv_Citation\">");

            if (!CurrentRequest.Is_Robot)
            {
                Citation_Standard_ItemViewer.Add_Citation_View_Tabs(Output, BriefItem, CurrentRequest, "MARC");
            }

            // Now, add the text
            Output.WriteLine();
            if (terms.Count > 0)
            {
                Output.WriteLine(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(MARC_String(Tracer), terms, "<span class=\"sbkCiv_TextHighlight\">", "</span>") + Environment.NewLine + "  </td>" + Environment.NewLine + "  <!-- END CITATION VIEWER OUTPUT -->");
            }
            else
            {
                Output.WriteLine(MARC_String(Tracer) + Environment.NewLine + "  </td>" + Environment.NewLine + "  <!-- END CITATION VIEWER OUTPUT -->");
            }

            CurrentRequest.ViewerCode = viewer_code;
        }
        /// <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("EAD_Description_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
            }

            // Get the metadata module for EADs
            EAD_Info eadInfo = (EAD_Info)CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);

            // Build the value
            StringBuilder builder = new StringBuilder(15000);

            builder.AppendLine("          <td align=\"left\"><span class=\"SobekViewerTitle\">Archival Description</span></td>");
            builder.AppendLine("        </tr>");
            builder.AppendLine("        <tr>");
            builder.AppendLine("          <td>");
            builder.AppendLine("            <div class=\"SobekCitation\">");
            builder.AppendLine("              <br />");
            builder.AppendLine("              <blockquote>");

            if (CurrentMode.Text_Search.Length > 0)
            {
                // Get any search terms
                List <string> terms = new List <string>();
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }

                builder.Append(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(eadInfo.Full_Description, terms));
            }
            else
            {
                builder.Append(eadInfo.Full_Description);
            }

            builder.AppendLine("              </blockquote>");
            builder.AppendLine("              <br />");
            builder.AppendLine("            </div>");

            // Add the HTML for the image
            Literal mainLiteral = new Literal {
                Text = builder.ToString()
            };

            placeHolder.Controls.Add(mainLiteral);
        }
        /// <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("Text_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Build the value


            if ((error_occurred) || (file_does_not_exist) || (text_from_file.Trim().Length == 0))
            {
                Output.WriteLine("\t\t<td id=\"sbkTiv_ErrorArea\">");
                if (error_occurred)
                {
                    Output.WriteLine("Unknown error while retrieving text");
                }
                else if (file_does_not_exist)
                {
                    Output.WriteLine("No text file exists for this page");
                }
                else
                {
                    Output.WriteLine("No text is recorded for this page");
                }
            }
            else
            {
                Output.WriteLine("\t\t<td id=\"sbkTiv_MainArea\">");
                // If there was a term search here, highlight it
                if (CurrentMode.Text_Search.Length > 0)
                {
                    // Get any search terms
                    List <string> terms    = new List <string>();
                    string[]      splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());

                    Output.WriteLine(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(text_from_file, terms, "<span class=\"sbkTiv_TextHighlight\">", "</span>"));
                }
                else
                {
                    Output.Write(text_from_file);
                }
            }
            Output.WriteLine("\t\t</td>");
        }
Example #7
0
        /// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </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 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 = currentRequest.ViewerCode;
            ushort current_view_page = currentRequest.Page.HasValue ? currentRequest.Page.Value : ((ushort)1);

            // 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)(currentRequest.Page - 1);

            if (page > (pageCount - 1) / images_per_page)
            {
                page = (ushort)((pageCount - 1) / images_per_page);
            }

            //Outer div which contains all the thumbnails
            Output.WriteLine("<div style=\"margin:5px;text-align:center;\">");

            // Get any search terms for highlighting purposes
            List <string> terms = new List <string>();

            if (!String.IsNullOrWhiteSpace(currentRequest.Text_Search))
            {
                string[] splitter = currentRequest.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
            }


            // Step through each page in the item
            for (int page_index = page * images_per_page; (page_index < (page + 1) * images_per_page) && (page_index < pageCount); page_index++)
            {
                // Get this page
                BriefItem_FileGrouping thisPage = briefItem.Images[page_index];

                // Find the jpeg and thumbnail images
                string jpeg      = String.Empty;
                string thumbnail = String.Empty;

                foreach (BriefItem_File thisFile in thisPage.Files)
                {
                    if (String.Compare(thisFile.File_Extension, ".jpg", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        if (thisFile.Name.ToLower().IndexOf("thm.jpg") > 0)
                        {
                            thumbnail = thisFile.Name;
                        }
                        else
                        {
                            jpeg = thisFile.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
                currentRequest.Page       = (ushort)(page_index + 1);
                currentRequest.ViewerCode = (page_index + 1).ToString();
                string url = UrlWriterHelper.Redirect_URL(currentRequest);

                // Determine the width information and the URL for the image
                string image_url; // = (briefItem.Web.Source_URL + "/" + thumbnail).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://");
                int    width = -1;
                switch (size_of_thumbnails)
                {
                case 2:
                    image_url = (briefItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://");
                    width     = 315;
                    break;

                case 3:
                    image_url = (briefItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://");
                    width     = 472;
                    break;

                case 4:
                    image_url = (briefItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://");
                    break;

                default:
                    image_url = (briefItem.Web.Source_URL + "/" + thumbnail).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://");
                    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\">" + Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(thisPage.Label, terms, "<span class=\"sbkRi_TextHighlight\">", "</span>") + "</td>");
                Output.WriteLine("    </tr>");
                Output.WriteLine("  </table>");
                Output.WriteLine();
            }

            //Close the outer div
            Output.WriteLine("</div>");

            // Restore the mode
            currentRequest.ViewerCode = current_view_code;
            currentRequest.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 ( &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("EAD_Container_List_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
            }

            // Get the metadata module for EADs
            EAD_Info eadInfo = (EAD_Info)CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);

            // Build any search terms
            List <string> terms = new List <string>();

            if (CurrentMode.Text_Search.Length > 0)
            {
                // Get any search terms
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }
            }

            // Build the value
            StringBuilder builder = new StringBuilder(15000);

            builder.AppendLine("          <td align=\"left\"><span class=\"SobekViewerTitle\">Container List</span></td>");
            builder.AppendLine("        </tr>");
            builder.AppendLine("        <tr>");
            builder.AppendLine("          <td>");
            builder.AppendLine("            <div class=\"SobekCitation\">");
            builder.AppendLine("              <br />");
            builder.AppendLine("              <blockquote>");


            // Step through the top level first
            foreach (Container_Info container in eadInfo.Container_Hierarchy.Containers)
            {
                // Add this container title and date information first
                builder.Append("<h2>" + container.Unit_Title);
                if (container.Unit_Date.Length > 0)
                {
                    builder.Append(", " + container.Unit_Date);
                }
                builder.AppendLine("</h2>");

                // Add physical extent, if it exists
                if (container.Extent.Length > 0)
                {
                    builder.AppendLine("<strong>" + container.Extent + "</strong><br />");
                }

                // Add the scope content next
                if (container.Scope_And_Content.Length > 0)
                {
                    builder.AppendLine(container.Scope_And_Content);
                }

                // Add any bioghist next
                if (container.Biographical_History.Length > 0)
                {
                    builder.AppendLine(container.Biographical_History);
                }

                // Are there children to this top container
                if (container.Children.Count > 0)
                {
                    // Dump the current builder into a literal
                    Literal newLiteral = new Literal
                    {
                        Text = Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(builder.ToString(), terms)
                    };
                    placeHolder.Controls.Add(newLiteral);

                    // Clear the contents of the builder
                    builder.Remove(0, builder.Length);

                    // Now, add this as a tree
                    TreeView treeView1 = new TreeView
                    {
                        Width = new Unit(700), NodeWrap = true, EnableClientScript = true, PopulateNodesFromClient = false
                    };

                    // Set some tree view properties
                    treeView1.TreeNodePopulate += treeView1_TreeNodePopulate;

                    // Add each child tree node
                    foreach (Container_Info child in container.Children)
                    {
                        // Add this node
                        TreeNode childNode = new TreeNode(child.Unit_Title)
                        {
                            SelectAction = TreeNodeSelectAction.None
                        };
                        if (child.DAO_Link.Length > 0)
                        {
                            if (child.DAO_Title.Length > 0)
                            {
                                childNode.Text = child.Unit_Title + " &nbsp; <a href=\"" + child.DAO_Link + "\">" + child.DAO_Title + "</a>";
                            }
                            else
                            {
                                childNode.Text = "<a href=\"" + child.DAO_Link + "\">" + child.Unit_Title + "</a>";
                            }
                        }

                        treeView1.Nodes.Add(childNode);

                        // Add the description, if there is one
                        if (child.Scope_And_Content.Length > 0)
                        {
                            TreeNode scopeContentNode = new TreeNode(child.Scope_And_Content)
                            {
                                SelectAction = TreeNodeSelectAction.None
                            };
                            childNode.ChildNodes.Add(scopeContentNode);
                        }

                        // Add the grand children
                        if (child.Children_Count > 0)
                        {
                            foreach (Container_Info grandChild in child.Children)
                            {
                                // Add this node
                                TreeNode grandChildNode = new TreeNode(grandChild.Unit_Title)
                                {
                                    SelectAction = TreeNodeSelectAction.None
                                };
                                if (grandChild.DAO_Link.Length > 0)
                                {
                                    if (grandChild.DAO_Title.Length > 0)
                                    {
                                        grandChildNode.Text = grandChild.Unit_Title + " &nbsp; <a href=\"" + grandChild.DAO_Link + "\">" + grandChild.DAO_Title + "</a>";
                                    }
                                    else
                                    {
                                        grandChildNode.Text = "<a href=\"" + grandChild.DAO_Link + "\">" + grandChild.Unit_Title + "</a>";
                                    }
                                }
                                childNode.ChildNodes.Add(grandChildNode);
                            }
                        }
                    }

                    // Configure the tree view collapsed nodes
                    treeView1.CollapseAll();

                    // Add this tree view to the place holder
                    placeHolder.Controls.Add(treeView1);
                }

                // Put some spaces for now
                builder.AppendLine("<br /><br />");
            }

            builder.AppendLine("              </blockquote>");
            builder.AppendLine("              <br />");
            builder.AppendLine("            </div>");

            // Add the HTML for the image
            Literal mainLiteral = new Literal {
                Text = builder.ToString()
            };

            placeHolder.Controls.Add(mainLiteral);
        }