/// <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("Metadata_Links_ItemViewer.Write_Main_Viewer_Section", "Write the citation information directly to the output stream");
            }

            // Determine if user can edit
            bool userCanEditItem = false;

            if (CurrentUser != null)
            {
                userCanEditItem = CurrentUser.Can_Edit_This_Item(BriefItem.BibID, BriefItem.Type, BriefItem.Behaviors.Source_Institution_Aggregation, BriefItem.Behaviors.Holding_Location_Aggregation, BriefItem.Behaviors.Aggregation_Code_List);
            }

            // Add the HTML for the citation
            Output.WriteLine("        <!-- METADATA LINKS 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) && (!userCanEditItem) && (!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, "METADATA");
            }

            // Now, add the text
            Output.WriteLine();
            Output.WriteLine(Metadata_String(Tracer) + "  </td>" + Environment.NewLine + "  <!-- END CITATION VIEWER OUTPUT -->");


            CurrentRequest.ViewerCode = viewer_code;
        }
        /// <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;
        }
        private void print_full_citation(TextWriter Output)
        {
            Output.WriteLine("</center>");
            if (RequestSpecificValues.Current_Mode.Base_Skin_Or_Skin == "ufdc")
            {
                Output.WriteLine("<img src=\"ufdc_banner_700.jpg\" />");
                Output.WriteLine("<br />");
            }

            if (RequestSpecificValues.Current_Mode.Base_Skin_Or_Skin == "dloc")
            {
                Output.WriteLine("<img src=\"dloc_banner_700.jpg\" />");
                Output.WriteLine("<br />");
            }

            // For this, also need the brief item (OBVIOUSLY NEEDS TO CHANGE!)

            Output.WriteLine("<div class=\"SobekCitation\">");
            Output.WriteLine(Citation_Standard_ItemViewer.Standard_Citation_String(currentItem, RequestSpecificValues.Current_Mode, RequestSpecificValues.Current_User, 850, false, null));
            Output.WriteLine("</div>");
        }
        /// <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("SearchEngineIndexing_ItemViewer.Write_Main_Viewer_Section", "Write the citation information directly to the output stream");
            }

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

            // 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) || (BriefItem.Behaviors.IP_Restriction_Membership != 0))
            {
                Output.WriteLine("          <td><div id=\"darkItemSuppressCitationMsg\">This item is DARK and cannot be viewed at this time</div>" + Environment.NewLine + "</td>" + Environment.NewLine + "  <!-- END SEARCH ENGINE VIEWER OUTPUT -->");
                return;
            }

            string viewer_code = CurrentRequest.ViewerCode;

            // Add the CITATION
            Output.WriteLine("        <td align=\"left\"><span class=\"SobekViewerTitle\">Citation</span></td>");
            Output.WriteLine("      </tr>");
            Output.WriteLine("      <tr>");
            Output.WriteLine("        <td>");
            // Add the main wrapper division
            // Determine the material type
            string microdata_type = "CreativeWork";

            switch (BriefItem.Type)
            {
            case "BOOK":
            case "SERIAL":
            case "NEWSPAPER":
                microdata_type = "Book";
                break;

            case "MAP":
                microdata_type = "Map";
                break;

            case "PHOTOGRAPH":
            case "AERIAL":
                microdata_type = "Photograph";
                break;
            }

            // Set the width
            int width = 180;

            if ((CurrentRequest.Language == Web_Language_Enum.French) || (CurrentRequest.Language == Web_Language_Enum.Spanish))
            {
                width = 230;
            }

            // Add the main wrapper division, with microdata information
            Output.WriteLine("          <div id=\"sbkCiv_Citation\" itemprop=\"about\" itemscope itemtype=\"http://schema.org/" + microdata_type + "\">");
            Output.WriteLine();
            Output.WriteLine(Citation_Standard_ItemViewer.Standard_Citation_String(BriefItem, CurrentRequest, null, width, false, Tracer));
            CurrentRequest.ViewerCode = viewer_code;

            Output.WriteLine("        </td>");
            Output.WriteLine("      </tr>");
            Output.WriteLine("      <tr>");

            // Add the downloads
            if ((BriefItem.Downloads != null) && (BriefItem.Downloads.Count > 0))
            {
                Output.WriteLine("        <td align=\"left\"><span class=\"SobekViewerTitle\">Downloads</span></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("      <tr>");
                Output.WriteLine("        <td id=\"sbkDiv_MainArea\">");
                Downloads_ItemViewer.Add_Download_Links(Output, BriefItem, CurrentRequest, null, Tracer);
                Output.WriteLine("        </td>");
            }
            Output.WriteLine("      </tr>");

            string textLocation = SobekFileSystem.Resource_Network_Uri(BriefItem);

            Add_Full_Text(Output, textLocation);
        }