SobekCM.Library.HTML.Item_HtmlSubwriter.Write_Additional_HTML C# (CSharp) 메소드

Write_Additional_HTML() 공개 메소드

Writes the HTML generated by this item html subwriter directly to the response stream
This continues writing this item from finishing the left navigation bar to the popup forms to the page navigation controls at the top of the item viewer's main area
public Write_Additional_HTML ( TextWriter Output, Custom_Tracer Tracer ) : void
Output System.IO.TextWriter Stream to which to write the HTML for this subwriter
Tracer SobekCM.Tools.Custom_Tracer Trace object keeps a list of each method executed and important milestones in rendering
리턴 void
        public override void Write_Additional_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            // If this is for a fragment, do nothing
            if (!String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Fragment))
                return;

            Tracer.Add_Trace("Item_HtmlSubwriter.Write_Additional_HTML", "Rendering HTML ( finish left navigation bar, begin main viewer section )");

            if (ShouldLeftNavigationBarBeShown)
            {
                // If this is an EAD-type item, show the table of contents here since it is all done
                // in HTML, and does not use the tree control

                //if (isEadTypeItem)
                //{
                //    EAD_Info eadInfo = (EAD_Info) currentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);
                //    if ((eadInfo != null) && (eadInfo.TOC_Included_Sections.Count > 0))
                //    {
                //        // Determine the URL to use for most of these
                //        string description_link = String.Empty;
                //        if (RequestSpecificValues.Current_Mode.ViewerCode != "description")
                //            description_link = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode, "description");

                //        // Add the TOC as a floating DIV
                //        Output.WriteLine("      <div id=\"sbkEad_FloatingTOC\">");
                //        Output.WriteLine("      <ul class=\"sbkEad_TocMenu\">");
                //        Output.WriteLine("        <li class=\"sbkEad_TocHeader\">TABLE OF CONTENTS &nbsp; <span style=\"color:#eeeeee\"><a href=\"#\" title=\"Return to the top of this document\"><img src=\"" + RequestSpecificValues.Current_Mode.Base_URL + "design/skins/" + RequestSpecificValues.Current_Mode.Base_Skin_Or_Skin + "/buttons/up_arrow.gif\" /></a></span></li>");

                //        foreach (EAD_TOC_Included_Section thisMatch in eadInfo.TOC_Included_Sections)
                //        {
                //            Output.WriteLine("        <li><a href=\"" + description_link + "#" + thisMatch.Internal_Link_Name + "\">" + thisMatch.Section_Title + "</a></li>");
                //        }

                //        // Add the container list if there is one
                //        if (eadInfo.Container_Hierarchy.Containers.Count > 0)
                //        {
                //            Output.WriteLine("        <li><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode, "container") + "\">Container List</a></li>");
                //        }

                //        Output.WriteLine("      </ul>");
                //        Output.WriteLine("      </div>");
                //    }
                //}

                // Add any wordmarks
                if ((currentItem.Behaviors.Wordmarks != null) && (currentItem.Behaviors.Wordmarks.Count > 0))
                {
                    Output.WriteLine("\t<div id=\"sbkIsw_Wordmarks\">");

                    // Compute the URL options which may be needed
                    string url_options = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);
                    string urlOptions1 = String.Empty;
                    string urlOptions2 = String.Empty;
                    if (url_options.Length > 0)
                    {
                        urlOptions1 = "?" + url_options;
                        urlOptions2 = "&" + url_options;
                    }

                    // Step through each wordmark mentioned in the brief item
                    foreach (string thisIcon in currentItem.Behaviors.Wordmarks)
                    {
                        // Look for a match in the dictionary
                        if (UI_ApplicationCache_Gateway.Icon_List.ContainsKey(thisIcon))
                        {
                            Wordmark_Icon wordmarkInfo = UI_ApplicationCache_Gateway.Icon_List[thisIcon];

                            Output.WriteLine("\t\t" + wordmarkInfo.HTML.Replace("<%BASEURL%>", RequestSpecificValues.Current_Mode.Base_URL).Replace("<%URLOPTS%>", url_options).Replace("<%?URLOPTS%>", urlOptions1).Replace("<%&URLOPTS%>", urlOptions2));
                        }
                    }

                    Output.WriteLine("\t</div>");
                }
                else
                {
                    Output.WriteLine("\t<div id=\"sbkIsw_NoWordmarks\">&nbsp;</div>");
                }

                Output.WriteLine("</nav>");
                Output.WriteLine();

                Output.WriteLine("<!-- Presentation table first cell ends and next will begin-->");
                Output.WriteLine("</td><td>");
            }

            // Begin the document display portion
            Output.WriteLine("<!-- Begin the main item viewing area -->");
            Output.WriteLine("<section id=\"main-content\" role=\"main\" class=\"sbkIsw_MainContentSection\">");
            if (behaviors.Contains(HtmlSubwriter_Behaviors_Enum.Item_Subwriter_NonWindowed_Mode))
            {
                //if (pageViewer != null && pageViewer.Viewer_Height > 0)
                //    Output.WriteLine("<table id=\"sbkIsw_DocumentNonWindowed\" style=\"height:" + pageViewer.Viewer_Height + "px;\" >");
                //else
                    Output.WriteLine("<table id=\"sbkIsw_DocumentNonWindowed\" >");
            }
            else
            {
                // Start the table
                Output.Write("<table class=\"sbkIsw_DocumentDisplay2\" ");

                // Was an ID included for this viewer?
                if ((pageViewer != null) && (!String.IsNullOrEmpty(pageViewer.ViewerBox_CssId)))
                    Output.Write("id=\"" + pageViewer.ViewerBox_CssId + "\" ");

                // Were there inline styles as well?
                if ((pageViewer != null) && (!String.IsNullOrEmpty(pageViewer.ViewerBox_InlineStyle)))
                    Output.Write("style=\"" + pageViewer.ViewerBox_InlineStyle + "\" ");

                Output.WriteLine(">");

                // In this format, add the DARK and RESTRICTED information
                if (currentItem.Behaviors.Dark_Flag)
                {
                    Output.WriteLine("\t<tr id=\"sbkIsw_RestrictedRow\">");
                    Output.WriteLine("\t\t<td>");
                    Output.WriteLine("\t\t\t<span style=\"font-size:larger; font-weight: bold;\">DARK ITEM</span>");
                    Output.WriteLine("\t\t</td>");
                    Output.WriteLine("\t</tr>");
                }
                else if (currentItem.Behaviors.IP_Restriction_Membership < 0)
                {
                    Output.WriteLine("\t<tr id=\"sbkIsw_RestrictedRow\">");
                    Output.WriteLine("\t\t<td>");
                    Output.WriteLine("\t\t\t<span style=\"font-size:larger; font-weight: bold;\">PRIVATE ITEM</span>");
                    Output.WriteLine("\t\t\tDigitization of this item is currently in progress.");
                    Output.WriteLine("\t\t</td>");
                    Output.WriteLine("\t</tr>");
                }
            }

            #region Add navigation rows here (buttons for first, previous, next, last, etc.)

            // Add navigation row here (buttons and viewer specific)
            if (pageViewer != null)
            {
                // Allow the pageviewer to add any special elements to the main
                // item viewer above the pagination
                pageViewer.Write_Top_Additional_Navigation_Row(Output, Tracer);

                // Should buttons be included here?
                if (pageViewer.PageCount != 1)
                {
                    Output.WriteLine("\t<tr>");
                    Output.WriteLine("\t\t<td>");

                    // ADD NAVIGATION BUTTONS
                    if (pageViewer.PageCount != 1)
                    {
                        string go_to = "Go To:";
                        string first_page = "First Page";
                        string previous_page = "Previous Page";
                        string next_page = "Next Page";
                        string last_page = "Last Page";
                        string first_page_text = "First";
                        string previous_page_text = "Previous";
                        string next_page_text = "Next";
                        string last_page_text = "Last";

                        if (RequestSpecificValues.Current_Mode.Language == Web_Language_Enum.Spanish)
                        {
                            go_to = "Ir a:";
                            first_page = "Primera Página";
                            previous_page = "Página Anterior";
                            next_page = "Página Siguiente";
                            last_page = "Última Página";
                            first_page_text = "Primero";
                            previous_page_text = "Anterior";
                            next_page_text = "Proximo";
                            last_page_text = "Último";
                        }

                        if (RequestSpecificValues.Current_Mode.Language == Web_Language_Enum.French)
                        {
                            go_to = "Aller à:";
                            first_page = "Première Page";
                            previous_page = "Page Précédente";
                            next_page = "Page Suivante";
                            last_page = "Dernière Page";
                            first_page_text = "Première";
                            previous_page_text = "Précédente";
                            next_page_text = "Suivante";
                            last_page_text = "Derniere";
                        }

                        Output.WriteLine("\t\t\t<div class=\"sbkIsw_PageNavBar\">");
                        StringBuilder buttonsHtmlBuilder = new StringBuilder(1000);

                        // Get the URL for the first and previous buttons
                        string firstButtonURL = pageViewer.First_Page_URL;
                        string prevButtonURL = pageViewer.Previous_Page_URL;

                        // Only continue if there is an item and mode, and there is previous pages to go to
                        if ((pageViewer.Current_Page > 1) && ((firstButtonURL.Length > 0) || (prevButtonURL.Length > 0)))
                        {
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t<span class=\"sbkIsw_LeftPaginationButtons\">");
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t\t<button title=\"" + first_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + firstButtonURL + "'; return false;\"><img src=\"" + Static_Resources_Gateway.Button_First_Arrow_Png + "\" class=\"roundbutton_img_left\" alt=\"\" />" + first_page_text + "</button>&nbsp;");
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t\t<button title=\"" + previous_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + prevButtonURL + "'; return false;\"><img src=\"" + Static_Resources_Gateway.Button_Previous_Arrow_Png + "\" class=\"roundbutton_img_left\" alt=\"\" />" + previous_page_text + "</button>");
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t</span>");
                        }

                        // Get the URL for the first and previous buttons
                        string lastButtonURL = pageViewer.Last_Page_URL;
                        string nextButtonURL = pageViewer.Next_Page_URL;

                        // Only continue if there is an item and mode, and there is previous pages to go to
                        if ((pageViewer.Current_Page < pageViewer.PageCount) && ((lastButtonURL.Length > 0) || (nextButtonURL.Length > 0)))
                        {
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t<span class=\"sbkIsw_RightPaginationButtons\">");
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t\t<button title=\"" + next_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + nextButtonURL + "'; return false;\">" + next_page_text + "<img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"roundbutton_img_right\" alt=\"\" /></button>&nbsp;");
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t\t<button title=\"" + last_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + lastButtonURL + "'; return false;\">" + last_page_text + "<img src=\"" + Static_Resources_Gateway.Button_Last_Arrow_Png + "\" class=\"roundbutton_img_right\" alt=\"\" /></button>");
                            buttonsHtmlBuilder.AppendLine("\t\t\t\t</span>");
                        }

                        // Write the buttons and save the HTML for the bottom of the page
                        buttonsHtml = buttonsHtmlBuilder.ToString();
                        Output.WriteLine(buttonsHtml);

                        // Show a pageselector, if one was selected
                        switch (pageViewer.Page_Selector)
                        {
                            case ItemViewer_PageSelector_Type_Enum.DropDownList:
                                string[] pageNames = pageViewer.Go_To_Names;
                                if (pageNames.Length > 0)
                                {
                                    // Determine if these page names are very long at all
                                    if (pageNames.Any(ThisName => ThisName.Length > 25))
                                    {
                                        // Long page names, so move the Go To: to the next line (new div)
                                        Output.WriteLine("\t\t\t</div>");
                                        Output.WriteLine("\t\t\t<div class=\"sbkIsw_PageNavBar2\">");
                                    }

                                    Output.WriteLine("\t\t\t\t<span id=\"sbkIsw_GoToSpan\"><label for=\"page_select\">" + go_to + "</label></span>");
                                    string orig_viewercode = RequestSpecificValues.Current_Mode.ViewerCode;
                                    string viewercode_only = RequestSpecificValues.Current_Mode.ViewerCode.Replace(RequestSpecificValues.Current_Mode.Page.ToString(), "");
                                    RequestSpecificValues.Current_Mode.ViewerCode = "XX1234567890XX";
                                    string url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                                    RequestSpecificValues.Current_Mode.ViewerCode = orig_viewercode;

                                    Output.WriteLine("\t\t\t\t<select id=\"page_select\" name=\"page_select\" onchange=\"javascript:item_jump_sobekcm('" + url + "')\">");

                                    // Add all the page selection items to the combo box
                                    int page_index = 1;
                                    foreach (string thisName in pageNames)
                                    {
                                        if (thisName.Length > 75)
                                        {
                                            if (RequestSpecificValues.Current_Mode.Page == page_index)
                                            {
                                                Output.WriteLine("\t\t\t\t\t<option value=\"" + page_index + viewercode_only + "\" selected=\"selected\" >" + thisName.Substring(0, 75) + "..</option>");
                                            }
                                            else
                                            {
                                                Output.WriteLine("\t\t\t\t\t<option value=\"" + page_index + viewercode_only + "\">" + thisName.Substring(0, 75) + "..</option>");
                                            }
                                        }
                                        else
                                        {
                                            if (RequestSpecificValues.Current_Mode.Page == page_index)
                                            {
                                                Output.WriteLine("\t\t\t\t\t<option value=\"" + page_index + viewercode_only + "\" selected=\"selected\" >" + thisName + "</option>");
                                            }
                                            else
                                            {
                                                Output.WriteLine("\t\t\t\t\t<option value=\"" + page_index + viewercode_only + "\">" + thisName + "</option>");
                                            }
                                        }
                                        page_index++;
                                    }

                                    Output.WriteLine("\t\t\t\t</select>");
                                }
                                break;

                            case ItemViewer_PageSelector_Type_Enum.PageLinks:
                                // Create the page selection if that is the type to display.  This is where it is actually
                                // built as well, althouogh it is subsequently used further up the page
                                if (pageViewer.Page_Selector == ItemViewer_PageSelector_Type_Enum.PageLinks)
                                {
                                    StringBuilder pageLinkBuilder = new StringBuilder();

                                    //Get the total page count
                                    int num_of_pages = pageViewer.PageCount;
                                    string[] page_urls = pageViewer.Go_To_Names;

                                    pageLinkBuilder.AppendLine("\t\t\t\t<div class=\"sbkIsw_PageLinks\">");

                                    //Display the first, last, current page numbers, and 2 pages before and after the current page
                                    if (num_of_pages <= 7 && num_of_pages > 1)
                                    {
                                        for (int i = 1; i <= num_of_pages; i++)
                                        {
                                            if (i == pageViewer.Current_Page)
                                                pageLinkBuilder.AppendLine("\t\t\t\t\t" + i + "&nbsp;");
                                            else
                                                pageLinkBuilder.AppendLine("\t\t\t\t\t<a href=\"" + page_urls[i - 1] + "\">" + i + "</a>&nbsp;");
                                        }
                                    }
                                    else if (num_of_pages > 7)
                                    {
                                        if (pageViewer.Current_Page > 4 && pageViewer.Current_Page < num_of_pages - 3)
                                        {
                                            pageLinkBuilder.AppendLine("\t\t\t\t\t<a href=\"" + page_urls[0] + "\">" + 1 + "</a>" + "..");
                                            for (int i = pageViewer.Current_Page - 2; i <= pageViewer.Current_Page + 2; i++)
                                            {
                                                if (i == pageViewer.Current_Page)
                                                    pageLinkBuilder.AppendLine("\t\t\t\t\t" + i + "&nbsp;");
                                                else
                                                    pageLinkBuilder.AppendLine("\t\t\t\t\t<a href=\"" + page_urls[i - 1] + "\">" + i + "</a>&nbsp;");
                                            }
                                            pageLinkBuilder.AppendLine("\t\t\t\t\t.." + "<a href=\"" + page_urls[page_urls.Length - 1] + "\">" + num_of_pages + "</a>");
                                        }

                                        else if (pageViewer.Current_Page <= 4 && pageViewer.Current_Page < num_of_pages - 3)
                                        {
                                            for (int i = 1; i <= (pageViewer.Current_Page + 2); i++)
                                            {
                                                if (i == pageViewer.Current_Page)
                                                    pageLinkBuilder.AppendLine("\t\t\t\t\t" + i + "&nbsp;");
                                                else
                                                    pageLinkBuilder.AppendLine("\t\t\t\t\t<a href=\"" + page_urls[i - 1] + "\">" + i + "</a>&nbsp;");
                                            }
                                            pageLinkBuilder.AppendLine("\t\t\t\t\t.." + "<a href=\"" + page_urls[page_urls.Length - 1] + "\">" + num_of_pages + "</a>");
                                        }

                                        else if (pageViewer.Current_Page > 4 && pageViewer.Current_Page >= num_of_pages - 3)
                                        {
                                            pageLinkBuilder.AppendLine("\t\t\t\t\t<a href=\"" + page_urls[0] + "\">" + 1 + "</a>" + "..");
                                            for (int i = pageViewer.Current_Page - 2; i <= num_of_pages; i++)
                                            {
                                                if (i == pageViewer.Current_Page)
                                                    pageLinkBuilder.AppendLine("\t\t\t\t\t" + i + "&nbsp;");
                                                else
                                                    pageLinkBuilder.AppendLine("\t\t\t\t\t<a href=\"" + page_urls[i - 1] + "\">" + i + "</a>&nbsp;");
                                            }

                                        }
                                    }

                                    pageLinkBuilder.AppendLine("\t\t\t\t</div>");

                                    pageLinksHtml = pageLinkBuilder.ToString();
                                    Output.WriteLine(pageLinksHtml);
                                }
                                break;
                        }

                        Output.WriteLine("\t\t\t</div>");
                    }

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

            #endregion

            Output.WriteLine("\t<tr>");

            // Add the HTML from the pageviewer, the main viewer section
            Tracer.Add_Trace("Item_MainWriter.Write_Additional_HTML", "Allowing page viewer to write directly to the output to add main viewer section");
            pageViewer.Write_Main_Viewer_Section(Output, Tracer);
        }

Usage Example

        private void Finish_writing_html(SobekCM_Item CurrentItem, Page_TreeNode CurrentPage, string Filename, string TextFileLocation )
        {
            bool textSearchable = CurrentItem.Behaviors.Text_Searchable;
            CurrentItem.Behaviors.Text_Searchable = false;
            if (staticSobekcmLocation.Length > 0)
                SobekCM_Library_Settings.Base_Directory = staticSobekcmLocation;

            // Get the skin
            if ((CurrentItem.Behaviors.Web_Skin_Count > 0) && ( !CurrentItem.Behaviors.Web_Skins.Contains( defaultSkin.ToUpper())))
                currentMode.Skin = CurrentItem.Behaviors.Web_Skins[0];

            // Get the skin object
            SobekCM_Skin_Object skinObject = skinsCollection[currentMode.Skin];
            if (skinObject == null)
            {
                skinObject = assistant.Get_HTML_Skin(currentMode, skinsCollection, false, null);
                skinsCollection.Add(skinObject);
            }

            // Create the HTML writer
            Item_HtmlSubwriter itemWriter = new Item_HtmlSubwriter(CurrentItem, CurrentPage, null, codeManager, translations, true, true, currentMode, null, String.Empty, null, tracer) { Mode = currentMode, Skin = skinObject };
            SobekCM_Library_Settings.Base_SobekCM_Location_Relative = currentMode.Base_URL;
            if ((SobekCM_Library_Settings.Base_SobekCM_Location_Relative.Length == 0) || (SobekCM_Library_Settings.Base_SobekCM_Location_Relative.Contains("localhost")))
            {
                SobekCM_Library_Settings.Base_SobekCM_Location_Relative = primaryWebServerUrl;
                currentMode.Base_URL = SobekCM_Library_Settings.Base_SobekCM_Location_Relative;
            }

            // Now that the item viewer is built, set the robot flag to suppress some checks
            currentMode.Is_Robot = true;

            // Create the TextWriter
            StreamWriter writer = new StreamWriter(Filename, false, Encoding.UTF8);

            writer.WriteLine("<!DOCTYPE html>");
            writer.WriteLine("<html>");
            writer.WriteLine("<head>");
            writer.WriteLine("  <title>" + CurrentItem.Bib_Info.Main_Title + "</title>");
            writer.WriteLine();
            writer.WriteLine("  <!-- " + SobekCM_Library_Settings.System_Name + " : SobekCM Digital Repository -->");
            writer.WriteLine();
            writer.WriteLine("  <link href=\"" + SobekCM_Library_Settings.System_Base_URL + "default/SobekCM.min.css\" rel=\"stylesheet\" type=\"text/css\" />");
            writer.WriteLine("  <script type=\"text/javascript\" src=\"" + SobekCM_Library_Settings.System_Base_URL + "default/scripts/jquery/jquery-1.10.2.min.js\"></script>");
            writer.WriteLine("  <script type=\"text/javascript\" src=\"" + SobekCM_Library_Settings.System_Base_URL + "default/scripts/sobekcm_full.min.js\"></script>");
            writer.WriteLine("  <link href=\"" + SobekCM_Library_Settings.System_Base_URL + "default/SobekCM_Item.min.css\" rel=\"stylesheet\" type=\"text/css\" />");

            writer.WriteLine("  <meta name=\"robots\" content=\"index, follow\" />");
            if (skinObject.CSS_Style.Length > 0)
            {
                writer.WriteLine("  <link href=\"" + SobekCM_Library_Settings.System_Base_URL + skinObject.CSS_Style + "\" rel=\"stylesheet\" type=\"text/css\" />");
            }

            string image_src = currentMode.Base_URL + "/" + CurrentItem.Web.AssocFilePath + "/" + CurrentItem.Behaviors.Main_Thumbnail;
            writer.WriteLine("  <link rel=\"image_src\" href=\"" + image_src.Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://") + "\" />");

            writer.WriteLine("</head>");
            writer.WriteLine("<body>");

            // Is this item DARK or PRIVATE
            if ((CurrentItem.Behaviors.Dark_Flag) || ( CurrentItem.Behaviors.IP_Restriction_Membership < 0 ))
            {
                writer.WriteLine("THIS ITEM IS CURRENTLY DARK OR PRIVATE");
                writer.WriteLine("</body>");
                writer.WriteLine("</html>");
                writer.Flush();
                writer.Close();
                return;
            }

            // Add the header
            Display_Header(writer, itemWriter.Skin, CurrentItem);

            // Begin to write the item view
            itemWriter.Write_HTML(writer, tracer);

            if ((CurrentItem.Behaviors.Wordmark_Count > 0) || ((CurrentItem.Web.Static_PageCount > 1) && (CurrentItem.Web.Static_Division_Count > 1)))
            {
                writer.WriteLine("<nav id=\"sbkIsw_Leftnavbar\" style=\"padding-top:3px\">");

                // Write the table of contents as static HTML, rather than the TreeView web control
                if ((CurrentItem.Web.Static_PageCount > 1) && (CurrentItem.Web.Static_Division_Count > 1))
                {
                    writer.WriteLine("  <div class=\"sbkIsw_ShowTocRow\">");
                    writer.WriteLine("    <div class=\"sbkIsw_UpToc\">HIDE TABLE OF CONTENTS</div>");
                    writer.WriteLine("  </div>");

                    writer.WriteLine("<div class=\"sbkIsw_TocTreeView\">");

                    // load the table of contents in the tree
                    TreeView treeView1 = new TreeView();
                    itemWriter.Create_TreeView_From_Divisions(treeView1);

                    // Step through all the parent nodes
                    writer.WriteLine("  <table cellspacing=\"4px\">");
                    foreach (TreeNode thisNode in treeView1.Nodes)
                    {
                        writer.WriteLine("    <tr><td width=\"9px\">&nbsp;</td><td>" + thisNode.Text.Replace("sbkIsw_SelectedTocTreeViewItem", "sbkIsw_TocTreeViewItem") + "</td></tr>");
                    }
                    writer.WriteLine("  </table>");
                    writer.WriteLine("</div>");
                }

            }

            itemWriter.Write_Additional_HTML(writer, tracer);

            //Literal citationLiteral = (Literal)placeHolder.Controls[0];
            //writer.WriteLine(citationLiteral.Text);
            //placeHolder.Controls.Clear();

            writer.WriteLine("<!-- COMMENT HERE -->");

            // Close out this tables and form
            writer.WriteLine("       </tr>");

            // If this is IP restricted, show nothing else
            if (CurrentItem.Behaviors.IP_Restriction_Membership == 0)
            {
                // Add the download list if there are some
                if (CurrentItem.Divisions.Download_Tree.Has_Files)
                {
                    writer.WriteLine("       <tr>");
                    // Create the downloads viewer to ouput the html
                    Download_ItemViewer downloadViewer = new Download_ItemViewer {CurrentItem = CurrentItem, CurrentMode = currentMode};

                    // Add the HTML for this now
                    downloadViewer.Write_Main_Viewer_Section(writer, tracer);
                    writer.WriteLine("       </tr>");
                }

                // If there is a table of contents write it again, this time it will be complete
                // and also show a hierarchy if there is one
                if ((CurrentItem.Web.Static_PageCount > 1) && (CurrentItem.Web.Static_Division_Count > 1))
                {
                    writer.WriteLine("       <tr>");
                    writer.WriteLine("         <td align=\"left\"><span class=\"SobekViewerTitle\">Table of Contents</span></td>");
                    writer.WriteLine("       </tr>");

                    writer.WriteLine("       <tr>");
                    writer.WriteLine("          <td>");
                    writer.WriteLine("            <div class=\"sbkCiv_Citation\">");

                    foreach (abstract_TreeNode treeNode in CurrentItem.Divisions.Physical_Tree.Roots)
                    {
                        recursively_write_toc(writer, treeNode, "&nbsp; &nbsp; ");
                    }

                    writer.WriteLine("            </div>");
                    writer.WriteLine("          </td>");
                    writer.WriteLine("       </tr>");
                }

                // Is the text file location included, in which case any full text should be appended to the end?
                if ((TextFileLocation.Length > 0) && (Directory.Exists(TextFileLocation)))
                {
                    // Get the list of all TXT files in this division
                    string[] text_files = Directory.GetFiles(TextFileLocation, "*.txt");
                    Dictionary<string, string> text_files_existing = new Dictionary<string, string>();
                    foreach (string thisTextFile in text_files)
                    {
                        string text_filename = (new FileInfo(thisTextFile)).Name.ToUpper();
                        text_files_existing[text_filename] = text_filename;
                    }

                    // Are there ANY text files?
                    if (text_files.Length > 0)
                    {
                        // If this has page images, check for related text files
                        List<string> text_files_included = new List<string>();
                        bool started = false;
                        if (CurrentItem.Divisions.Physical_Tree.Has_Files)
                        {
                            // Go through the first 100 text pages
                            List<abstract_TreeNode> pages = CurrentItem.Divisions.Physical_Tree.Pages_PreOrder;
                            int page_count = 0;
                            foreach (Page_TreeNode thisPage in pages)
                            {
                                // Keep track of the page count
                                page_count++;

                                // Look for files in this page
                                if (thisPage.Files.Count > 0)
                                {
                                    bool found_non_thumb_file = false;
                                    foreach (SobekCM_File_Info thisFile in thisPage.Files)
                                    {
                                        // Make sure this is not a thumb
                                        if (thisFile.System_Name.ToLower().IndexOf("thm.jpg") < 0)
                                        {
                                            found_non_thumb_file = true;
                                            string root = thisFile.File_Name_Sans_Extension;
                                            if (text_files_existing.ContainsKey(root.ToUpper() + ".TXT"))
                                            {
                                                string text_file = TextFileLocation + "\\" + thisFile.File_Name_Sans_Extension + ".txt";

                                                // SInce this is marked to be included, save this name
                                                text_files_included.Add(root.ToUpper() + ".TXT");

                                                // For size reasons, we only include the text from the first 100 pages
                                                if (page_count <= 100)
                                                {
                                                    if (!started)
                                                    {
                                                        writer.WriteLine("       <tr>");
                                                        writer.WriteLine("         <td align=\"left\"><span class=\"SobekViewerTitle\">Full Text</span></td>");
                                                        writer.WriteLine("       </tr>");
                                                        writer.WriteLine("       <tr>");
                                                        writer.WriteLine("          <td>");
                                                        writer.WriteLine("            <div class=\"sbkCiv_Citation\">");

                                                        started = true;
                                                    }

                                                    try
                                                    {
                                                        StreamReader reader = new StreamReader(text_file);
                                                        string text_line = reader.ReadLine();
                                                        while (text_line != null)
                                                        {
                                                            writer.WriteLine(text_line + "<br />");
                                                            text_line = reader.ReadLine();
                                                        }
                                                        reader.Close();
                                                    }
                                                    catch
                                                    {
                                                        writer.WriteLine("Unable to read file: " + text_file);
                                                    }

                                                    writer.WriteLine("<br /><br />");
                                                }
                                            }

                                        }

                                        // If a suitable file was found, break here
                                        if (found_non_thumb_file)
                                            break;
                                    }
                                }
                            }

                            // End this if it was ever started
                            if (started)
                            {
                                writer.WriteLine("            </div>");
                                writer.WriteLine("          </td>");
                                writer.WriteLine("       </tr>");
                            }
                        }

                        // Now, check for any other valid text files
                        List<string> additional_text_files = text_files_existing.Keys.Where(ThisTextFile => (!text_files_included.Contains(ThisTextFile.ToUpper())) && (ThisTextFile.ToUpper() != "AGREEMENT.TXT") && (ThisTextFile.ToUpper().IndexOf("REQUEST") != 0)).ToList();

                        // Now, include any additional text files, which would not be page text files, possiblye
                        // full text for included PDFs, Powerpoint, Word Doc, etc..
                        started = false;
                        foreach (string thisTextFile in additional_text_files)
                        {
                            if (!started)
                            {
                                writer.WriteLine("       <tr>");
                                writer.WriteLine("         <td align=\"left\"><span class=\"SobekViewerTitle\">Full Text</span></td>");
                                writer.WriteLine("       </tr>");
                                writer.WriteLine("       <tr>");
                                writer.WriteLine("          <td>");
                                writer.WriteLine("            <div class=\"sbkCiv_Citation\">");

                                started = true;
                            }

                            string text_file = TextFileLocation + "\\" + thisTextFile;

                            try
                            {

                                StreamReader reader = new StreamReader(text_file);
                                string text_line = reader.ReadLine();
                                while (text_line != null)
                                {
                                    writer.WriteLine(text_line + "<br />");
                                    text_line = reader.ReadLine();
                                }
                                reader.Close();
                            }
                            catch
                            {
                                writer.WriteLine("Unable to read file: " + text_file);
                            }

                            writer.WriteLine("<br /><br />");
                        }

                        // End this if it was ever started
                        if (started)
                        {
                            writer.WriteLine("            </div>");
                            writer.WriteLine("          </td>");
                            writer.WriteLine("       </tr>");
                        }
                    }
                }
            }

            writer.WriteLine("      </table>");
            writer.WriteLine("      </div>");

            // Write the footer
            Display_Footer(writer, itemWriter.Skin);

            writer.WriteLine("</body>");
            writer.WriteLine("</html>");

            writer.Flush();
            writer.Close();

            // Restore the text searchable flag and robot flag
            currentMode.Is_Robot = false;
            CurrentItem.Behaviors.Text_Searchable = textSearchable;
        }
All Usage Examples Of SobekCM.Library.HTML.Item_HtmlSubwriter::Write_Additional_HTML