Accepts a result set of titles and items and renders the correct page of results in the result view the user has requested
This class extends the abstractHtmlSubwriter abstract class.
Inheritance: abstractHtmlSubwriter
        /// <summary> Adds controls to the main navigational page </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form, widely used throughout the application</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="populate_node_event"> Event is used to populate the a tree node without doing a full refresh of the page </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles </returns>
        /// <remarks> This uses a <see cref="PagedResults_HtmlSubwriter"/> instance to render the browse  </remarks>
        public void Add_Controls(PlaceHolder placeHolder, Custom_Tracer Tracer, TreeNodeEventHandler populate_node_event)
        {
            if ((RequestSpecificValues.Paged_Results != null) && (RequestSpecificValues.Results_Statistics != null))
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Add_Controls", "Building Result DataSet Writer");

                    writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues, RequestSpecificValues.Results_Statistics, RequestSpecificValues.Paged_Results)
                                      {
                                          Browse_Title = RequestSpecificValues.Public_Folder.FolderName,
                                          Folder_Owner_Name = RequestSpecificValues.Public_Folder.Name,
                                          Folder_Owner_Email = RequestSpecificValues.Public_Folder.Email
                                      };
                }

                Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Add_Controls", "Add controls");
                writeResult.Add_Controls(placeHolder, Tracer);
            }
        }
        /// <summary> Adds controls to the main navigational page </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form, widely used throughout the application</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="populate_node_event"> Event is used to populate the a tree node without doing a full refresh of the page </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles </returns>
        /// <remarks> This uses a <see cref="PagedResults_HtmlSubwriter"/> instance to render the browse  </remarks>
        public void Add_Controls(PlaceHolder placeHolder, Custom_Tracer Tracer, TreeNodeEventHandler populate_node_event)
        {
            if ((pagedResults != null) && (resultsStatistics != null))
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Add_Controls", "Building Result DataSet Writer");

                    writeResult = new PagedResults_HtmlSubwriter(resultsStatistics, pagedResults, codeManager, translations, allItemsTable, currentUser, currentMode, Tracer)
                                      {
                                          Hierarchy_Object = Hierarchy_Object,
                                          Skin = htmlSkin,
                                          Mode = currentMode,
                                          Browse_Title = publicFolder.FolderName,
                                          Folder_Owner_Name = publicFolder.Name,
                                          Folder_Owner_Email = publicFolder.Email
                                      };
                }

                Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Add_Controls", "Add controls");
                writeResult.Add_Controls(placeHolder, Tracer);
            }
        }
        /// <summary> Add controls to the placeholder below the search box </summary>
        /// <param name="placeHolder"> Placeholder into which to place controls to be rendered</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This adds the results from the dataset into the space below the search box.<br /><br />
        /// This creates and uses a <see cref="PagedResults_HtmlSubwriter"/> to write the results. </remarks>
        public override void Add_Secondary_Controls(PlaceHolder placeHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("DataSet_Browse_Info_AggregationViewer.Add_Secondary_Controls", "Adding HTML");
            }

            writeResult = new PagedResults_HtmlSubwriter(resultsStatistics, pagedResults, codeManager, translator, itemList, currentUser, currentMode, Tracer)
                              {
                                  Skin = htmlSkin,
                                  Mode = currentMode,
                                  Hierarchy_Object = currentCollection,
                                  Browse_Title = browseObject.Get_Label(currentMode.Language)
                              };
            writeResult.Add_Controls(placeHolder, Tracer);

            if ( resultsStatistics.Total_Items > 0)
            {
                Literal literal = new Literal
                                      {
                                          Text ="<div class=\"SobekResultsNavBar\">" + Environment.NewLine + "  " + writeResult.Buttons +"" + Environment.NewLine + "  " + writeResult.Showing_Text  + Environment.NewLine + "</div>" + Environment.NewLine + "<br />" + Environment.NewLine
                                      };
                placeHolder.Controls.Add(literal);
            }
        }
        /// <summary> Add controls to the placeholder below the search box </summary>
        /// <param name="MainPlaceHolder"> Placeholder into which to place controls to be rendered</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This adds the results from the dataset into the space below the search box.<br /><br />
        /// This creates and uses a <see cref="PagedResults_HtmlSubwriter"/> to write the results. </remarks>
        public override void Add_Secondary_Controls(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("DataSet_Browse_Info_AggregationViewer.Add_Secondary_Controls", "Adding HTML");
            }

            writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues) { Browse_Title = RequestSpecificValues.Browse_Object.Label };
            writeResult.Add_Controls(MainPlaceHolder, Tracer);

            //if ( resultsStatistics.Total_Items > 0)
            //{
            //	Literal literal = new Literal
            //						  {
            //							  Text = "<div class=\"sbkPrsw_ResultsNavBar\">" + Environment.NewLine + "  " + writeResult.Buttons + "" + Environment.NewLine + "  " + writeResult.Showing_Text + Environment.NewLine + "</div>" + Environment.NewLine + "<br />" + Environment.NewLine
            //						  };
            //	MainPlaceHolder.Controls.Add(literal);
            //}
        }
        /// <summary> Add controls directly to the form in the main control area placeholder </summary>
        /// <param name="MainPlaceHolder"> Main place holder to which all main controls are added </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> The <see cref="PagedResults_HtmlSubwriter"/> class is instantiated and adds controls to the placeholder here </remarks>
        public override void Add_Controls(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Folder_Mgmt_MySobekViewer.Add_Controls", String.Empty);

            // If this is submitted items, don't show the folders
            string redirect_url = String.Empty;
            if ( properFolderName != "Submitted Items")
            {
                // Determine the redirect
                RequestSpecificValues.Current_Mode.My_Sobek_SubMode = "XXXXXXXXXXXXXXXXXX";
                Result_Display_Type_Enum currentDisplayType = RequestSpecificValues.Current_Mode.Result_Display_Type;
                RequestSpecificValues.Current_Mode.Result_Display_Type = Result_Display_Type_Enum.Bookshelf;
                redirect_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                RequestSpecificValues.Current_Mode.My_Sobek_SubMode = String.Empty;
                RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Saved_Searches;
                string saved_search_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Aggregation;
                RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Home;
                RequestSpecificValues.Current_Mode.Home_Type = Home_Type_Enum.Personalized;
                RequestSpecificValues.Current_Mode.Aggregation = String.Empty;
                string personalized_home = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.My_Sobek;
                RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Folder_Management;
                RequestSpecificValues.Current_Mode.My_Sobek_SubMode = properFolderName;
                RequestSpecificValues.Current_Mode.Result_Display_Type = currentDisplayType;

                // Build the tree view object and tree view nodes now
                TreeView treeView1 = new TreeView
                                         {
                                             CssClass = "tree",
                                             EnableClientScript = true,
                                             PopulateNodesFromClient = false,
                                             ShowLines = false
                                         };
                treeView1.NodeStyle.NodeSpacing = new Unit(2);
                treeView1.NodeStyle.CssClass = "TreeNode";

                // Add the root my bookshelves node
                TreeNode rootNode = new TreeNode
                                        {
                                            Text = "&nbsp; <a title=\"Manage my library\" href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", String.Empty) + "\">My Library  (Manage my bookshelves)</a>",
                                            ImageUrl = Static_Resources_Gateway.Bookshelf_Img,
                                            SelectAction = TreeNodeSelectAction.None
                                        };
                treeView1.Nodes.Add(rootNode);

                // Add the personalized home page
                TreeNode homeNode = new TreeNode
                                        {
                                            Text = "&nbsp; <a title=\"View my collections home page\" href=\"" + personalized_home + "\">My Collections Home</a>",
                                            SelectAction = TreeNodeSelectAction.None,
                                            ImageUrl = Static_Resources_Gateway.Home_Folder_Gif
                                        };
                rootNode.ChildNodes.Add(homeNode);

                // Add the saved searches node
                TreeNode savedSearchesNode = new TreeNode
                                                 {
                                                     Text ="&nbsp; <a title=\"View my saved searches\" href=\"" + saved_search_url + "\">My Saved Searches</a>",
                                                     SelectAction = TreeNodeSelectAction.None,
                                                     ImageUrl = Static_Resources_Gateway.Saved_Searches_Img
                                                 };
                rootNode.ChildNodes.Add(savedSearchesNode);

               // StringBuilder literalBuilder = new StringBuilder();
                List<TreeNode> selectedNodes = new List<TreeNode>();
                foreach (User_Folder thisFolder in RequestSpecificValues.Current_User.Folders)
                {
                    if (thisFolder.Folder_Name != "Submitted Items")
                    {
                        TreeNode folderNode = new TreeNode
                                                  { Text ="&nbsp; <a href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">" + thisFolder.Folder_Name + "</a>" };
                        if (thisFolder.Folder_Name == properFolderName)
                        {
                            selectedNodes.Add(folderNode);
                            if (thisFolder.IsPublic)
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Open_Folder_Public_Jpg;
                                folderNode.ImageToolTip = "Public folder";
                            }
                            else
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Open_Folder_Jpg;
                            }
                            folderNode.Text = "&nbsp; <span class=\"Selected_TreeNode_Text\">" + thisFolder.Folder_Name + "</span>";
                            folderNode.SelectAction = TreeNodeSelectAction.None;
                        }
                        else
                        {
                            if (thisFolder.IsPublic)
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Closed_Folder_Public_Jpg;
                                folderNode.ImageToolTip = "Public folder";
                            }
                            else
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Closed_Folder_Jpg;
                            }
                            folderNode.Text = "&nbsp; <a href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">" + thisFolder.Folder_Name + "</a>";
                        }
                        rootNode.ChildNodes.Add(folderNode);

                        // Add all the children nodes as well
                        add_children_nodes(folderNode, thisFolder, properFolderName, redirect_url, selectedNodes);
                    }
                }

                // Collapse the treeview
                treeView1.CollapseAll();
                if (selectedNodes.Count > 0)
                {
                    TreeNode selectedNodeExpander = selectedNodes[0];
                    while (selectedNodeExpander.Parent != null)
                    {
                        (selectedNodeExpander.Parent).Expand();
                        selectedNodeExpander = selectedNodeExpander.Parent;
                    }
                }
                else
                {
                    rootNode.Expand();
                }

                MainPlaceHolder.Controls.Add(treeView1);
            }

            if (RequestSpecificValues.Current_Mode.My_Sobek_SubMode.Length > 0)
            {
                if ( RequestSpecificValues.Results_Statistics.Total_Titles == 0)
                {
                    Literal literal = new Literal();

                    string folder_name = RequestSpecificValues.Current_User.Folder_Name(RequestSpecificValues.Current_Mode.My_Sobek_SubMode);
                    RequestSpecificValues.Current_Mode.My_Sobek_SubMode = String.Empty;
                    if (folder_name.Length == 0)
                    {
                        UrlWriterHelper.Redirect(RequestSpecificValues.Current_Mode);
                        return;
                    }

                    if (properFolderName != "Submitted Items")
                        literal.Text = "<br /><br /><h1>" + folder_name + "</h1><br /><br /><div class=\"SobekHomeText\" ><center><b>This bookshelf is currently empty</b></center><br /><br /><br /></div></div>";
                    else
                        literal.Text = "<h1>" + folder_name + "</h1><br /><br /><div class=\"SobekHomeText\" ><center><b>This bookshelf is currently empty</b></center><br /><br /><br /></div></div>";
                    MainPlaceHolder.Controls.Add(literal);

                }
                else
                {

                    writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues, RequestSpecificValues.Results_Statistics, RequestSpecificValues.Paged_Results)
                                      {
                                          Browse_Title = properFolderName,
                                          Outer_Form_Name = "itemNavForm"
                                      };
                    if (properFolderName != "Submitted Items")
                        writeResult.Include_Bookshelf_View = true;

                    // Add some space and then the view type selection box
                    StringBuilder view_type_selection_builder = new StringBuilder( 2000);
                    if (properFolderName != "Submitted Items")
                        view_type_selection_builder.AppendLine("<br /><br />");

                    StringWriter writer = new StringWriter(view_type_selection_builder);
                    writeResult.Write_HTML(writer, Tracer);

                    Literal view_type_selection_literal = new Literal {Text = view_type_selection_builder.ToString()};
                    MainPlaceHolder.Controls.Add(view_type_selection_literal);

                    // Now, add the results controls as well
                    writeResult.Add_Controls(MainPlaceHolder, Tracer);

                    // Close the div
                    Literal final_literal = new Literal {Text = "<br />\n"};
                    MainPlaceHolder.Controls.Add(final_literal);
                }

                //if (( pagedResults != null ) && ( pagedResults.Count > 0))
                //{
                //	Literal literal = new Literal();
                //	literal.Text = "<div class=\"sbkPrsw_ResultsNavBar\">" + Environment.NewLine + "  " + writeResult.Buttons + Environment.NewLine + "  " + writeResult.Showing_Text + Environment.NewLine + "</div>" + Environment.NewLine + "<br />" + Environment.NewLine;
                //	MainPlaceHolder.Controls.Add(literal);
                //}
            }
            else
            {
                // Add the folder management piece here
                StringBuilder bookshelfManageBuilder = new StringBuilder();
                bookshelfManageBuilder.AppendLine("<br /><br />\n<h1>Manage My Bookshelves</h1>\n<div class=\"SobekHomeText\" >");
                bookshelfManageBuilder.AppendLine("  <blockquote>");
                bookshelfManageBuilder.AppendLine("  <table width=\"630px\">");
                bookshelfManageBuilder.AppendLine("    <tr valign=\"middle\">");
                bookshelfManageBuilder.AppendLine("      <td align=\"left\" width=\"30px\"><a href=\"?\" id=\"new_bookshelf_link\" name=\"new_bookshelf_link\" onclick=\"return open_new_bookshelf_folder();\" title=\"Click to add a new bookshelf\" ><img title=\"Click to add a new bookshelf\" src=\"" + Static_Resources_Gateway.New_Folder_Jpg + "\" /></a><td>");
                bookshelfManageBuilder.AppendLine("      <td align=\"left\"><a href=\"?\" id=\"new_bookshelf_link\" name=\"new_bookshelf_link\" onclick=\"return open_new_bookshelf_folder();\" title=\"Click to add a new bookshelf\" >Add New Bookshelf</a><td>");
                bookshelfManageBuilder.AppendLine("      <td align=\"right\" width=\"40px\"><a href=\"?\" id=\"refresh_bookshelf_link\" name=\"refresh_bookshelf_link\" onclick=\"return refresh_bookshelves();\" title=\"Refresh bookshelf list\" ><img title=\"Refresh bookshelf list\" src=\"" + Static_Resources_Gateway.Refresh_Folder_Jpg + "\" /></a><td>");
                bookshelfManageBuilder.AppendLine("      <td align=\"left\" width=\"150px\"><a href=\"?\" id=\"refresh_bookshelf_link\" name=\"refresh_bookshelf_link\" onclick=\"return refresh_bookshelves();\" title=\"Refresh bookshelf list\" >Refresh Bookshelves</a><td>");
                bookshelfManageBuilder.AppendLine("    </tr>");
                bookshelfManageBuilder.AppendLine("  </table>");
                bookshelfManageBuilder.AppendLine("  <br /><br />");
                bookshelfManageBuilder.AppendLine("  <table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">");
                bookshelfManageBuilder.AppendLine("    <tr align=\"left\" bgcolor=\"#0022a7\" >");
                bookshelfManageBuilder.AppendLine("      <th width=\"210px\" align=\"left\"><span style=\"color: White\"> &nbsp; ACTIONS</span></th>");
                bookshelfManageBuilder.AppendLine("      <th width=\"40px\" align=\"left\">&nbsp;</th>");
                bookshelfManageBuilder.AppendLine("      <th width=\"380px\" align=\"left\"><span style=\"color: White\">BOOKSHELF NAME</span></th>");
                bookshelfManageBuilder.AppendLine("     </tr>");
                bookshelfManageBuilder.AppendLine("    <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>");

                // Write the data for each interface
                int folder_number = 1;
                foreach ( User_Folder thisFolder in RequestSpecificValues.Current_User.All_Folders )
                {
                    if (thisFolder.Folder_Name != "Submitted Items")
                    {
                        // Build the action links
                        bookshelfManageBuilder.AppendLine("    <tr align=\"left\" valign=\"center\" >");
                        bookshelfManageBuilder.Append("      <td class=\"SobekFolderActionLink\" >( ");
                        if (thisFolder.Child_Count == 0)
                        {
                            if (RequestSpecificValues.Current_User.All_Folders.Count == 1)
                            {
                                bookshelfManageBuilder.Append("<a title=\"Click to delete this bookshelf\" id=\"DELETE_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"alert('You cannot delete your last bookshelf');return false;\">delete</a> | ");
                            }
                            else
                            {
                                bookshelfManageBuilder.Append("<a title=\"Click to delete this bookshelf\" id=\"DELETE_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_folder('" + thisFolder.Folder_ID + "');\">delete</a> | ");
                            }
                        }
                        else
                        {
                            bookshelfManageBuilder.Append("<a title=\"Click to delete this bookshelf\" id=\"DELETE_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"alert('You cannot delete bookshelves which contain other bookshelves');return false;\">delete</a> | ");
                        }
                        if (thisFolder.IsPublic)
                        {
                            bookshelfManageBuilder.Append("<a title=\"Make this bookshelf private\" id=\"PUBLIC_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return change_folder_visibility('" + thisFolder.Folder_Name_Encoded + "', 'private');\">make private</a> | ");
                        }
                        else
                        {
                            bookshelfManageBuilder.Append("<a title=\"Make this bookshelf public\" id=\"PUBLIC_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return change_folder_visibility('" + thisFolder.Folder_Name_Encoded + "', 'public');\">make public</a> | ");
                        }
                        bookshelfManageBuilder.AppendLine("<a title=\"Click to manage this bookshelf\" href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">manage</a> )</td>");
                        if (thisFolder.IsPublic)
                        {
                            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Public_Folder;
                            RequestSpecificValues.Current_Mode.FolderID = thisFolder.Folder_ID;
                            bookshelfManageBuilder.AppendLine("      <td><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\"><img title=\"Public folder\" src=\"" + Static_Resources_Gateway.Closed_Folder_Public_Jpg + "\" /><a/></td>");
                            bookshelfManageBuilder.AppendLine("      <td><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">" + thisFolder.Folder_Name + "</a></td>");
                            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.My_Sobek;
                        }
                        else
                        {
                            bookshelfManageBuilder.AppendLine("      <td><img title=\"Private folder\" src=\"" + Static_Resources_Gateway.Closed_Folder_Jpg + "\" /></td>");
                            bookshelfManageBuilder.AppendLine("      <td>" + thisFolder.Folder_Name + "</td>");
                        }
                        bookshelfManageBuilder.AppendLine("     </tr>");
                        bookshelfManageBuilder.AppendLine("    <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>");

                        // Increment the folder number
                        folder_number++;
                    }
                }

                bookshelfManageBuilder.AppendLine("  </table>");
                bookshelfManageBuilder.AppendLine("  </blockquote>");
                bookshelfManageBuilder.AppendLine("</div>");

                // Add this as a literal
                Literal mgmtLiteral = new Literal {Text = bookshelfManageBuilder.ToString()};
                MainPlaceHolder.Controls.Add(mgmtLiteral);
            }
        }
        /// <summary> Writes the HTML generated to browse a public folder  directly to the response stream </summary>
        /// <param name="Output"> Stream to which to write the HTML for this subwriter </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns>
        public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Write_HTML", "Rendering HTML");

            const string publicFolderText = "PUBLIC BOOKSHELF";

            if (RequestSpecificValues.Current_Mode.Language == Web_Language_Enum.French)
            {
            }

            if (RequestSpecificValues.Current_Mode.Language == Web_Language_Enum.Spanish)
            {
            }

            // Add the item views
            Output.WriteLine("<!-- Add the menu -->");
            Output.WriteLine("<div id=\"sbkPfm_MenuBar\" class=\"sbkMenu_Bar\">");
            Output.WriteLine("<ul class=\"sf-menu\">");

            // Get ready to draw the tabs
            string sobek_home_text = RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Home";

            // Add the 'SOBEK HOME' first menu option and suboptions
            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Aggregation;
            RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Home;
            RequestSpecificValues.Current_Mode.Home_Type = Home_Type_Enum.List;
            Output.WriteLine("\t\t<li class=\"sbkMenu_Home\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\" class=\"sbkMenu_NoPadding\"><img src=\"" + Static_Resources_Gateway.Home_Png + "\" /> <div class=\"sbkMenu_HomeText\">" + sobek_home_text + "</div></a></li>");

            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Public_Folder;
            Output.WriteLine("\t\t<li class=\"selected-sf-menu-item-link\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">" + publicFolderText + "</a></li>");
            Output.WriteLine("\t</ul></div>");

            Output.WriteLine("<!-- Initialize the main user menu -->");
            Output.WriteLine("<script>");
            Output.WriteLine("  jQuery(document).ready(function () {");
            Output.WriteLine("     jQuery('ul.sf-menu').superfish();");
            Output.WriteLine("  });");
            Output.WriteLine("</script>");
            Output.WriteLine();

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

            if (( RequestSpecificValues.Paged_Results != null ) && ( RequestSpecificValues.Results_Statistics != null ))
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Write_HTML", "Building Result DataSet Writer");
                    writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues, RequestSpecificValues.Results_Statistics, RequestSpecificValues.Paged_Results)
                                      {
                                          Browse_Title = RequestSpecificValues.Public_Folder.FolderName,
                                          Folder_Owner_Name = RequestSpecificValues.Public_Folder.Name,
                                          Folder_Owner_Email = RequestSpecificValues.Public_Folder.Email
                                      };
                }
                writeResult.Write_HTML(Output, Tracer);
            }

            return true;
        }
        /// <summary> Writes the HTML generated to browse a public folder  directly to the response stream </summary>
        /// <param name="Output"> Stream to which to write the HTML for this subwriter </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns>
        public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Write_HTML", "Rendering HTML");

            const string publicFolderText = "PUBLIC BOOKSHELF";
            string homeText = "HOME";

            if (currentMode.Language == Web_Language_Enum.French)
            {
                homeText = "PAGE D'ACCUEIL";
            }

            if (currentMode.Language == Web_Language_Enum.Spanish)
            {
                homeText = "INICIO";
            }

            Output.WriteLine("<div class=\"ViewsBrowsesRow\">");

            currentMode.Mode = Display_Mode_Enum.Aggregation_Home;
            Output.WriteLine("  <a href=\"" + currentMode.Redirect_URL() + "\">" + Unselected_Tab_Start + homeText + Unselected_Tab_End + "</a>");
            currentMode.Mode = Display_Mode_Enum.Public_Folder;

            Output.WriteLine("  " + Selected_Tab_Start + publicFolderText + Selected_Tab_End);
            Output.WriteLine("</div>");
            Output.WriteLine();

            if (( pagedResults != null ) && ( resultsStatistics != null ))
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Write_HTML", "Building Result DataSet Writer");
                    writeResult = new PagedResults_HtmlSubwriter(null, null, codeManager, translations, allItemsTable, currentUser, currentMode, Tracer)
                                      {
                                          Hierarchy_Object = Hierarchy_Object,
                                          Skin = htmlSkin,
                                          Mode = currentMode,
                                          Browse_Title = publicFolder.FolderName,
                                          Folder_Owner_Name = publicFolder.Name,
                                          Folder_Owner_Email = publicFolder.Email
                                      };
                }
                writeResult.Write_HTML(Output, Tracer);
            }

            return true;
        }
        /// <summary> Writes the HTML generated to browse a public folder  directly to the response stream </summary>
        /// <param name="Output"> Stream to which to write the HTML for this subwriter </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns>
        public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Write_HTML", "Rendering HTML");

            const string publicFolderText = "PUBLIC BOOKSHELF";
            string homeText = "HOME";

            if (currentMode.Language == Web_Language_Enum.French)
            {
                homeText = "PAGE D'ACCUEIL";
            }

            if (currentMode.Language == Web_Language_Enum.Spanish)
            {
                homeText = "INICIO";
            }

            // Add the item views
            Output.WriteLine("<!-- Add the menu -->");
            Output.WriteLine("<div id=\"sbkPfm_MenuBar\" class=\"sbkMenu_Bar\">");
            Output.WriteLine("<ul class=\"sf-menu\">");

            // Get ready to draw the tabs
            string sobek_home_text = Mode.SobekCM_Instance_Abbreviation + " Home";

            // Add the 'SOBEK HOME' first menu option and suboptions
            Mode.Mode = Display_Mode_Enum.Aggregation;
            Mode.Aggregation_Type = Aggregation_Type_Enum.Home;
            Mode.Home_Type = Home_Type_Enum.List;
            Output.WriteLine("\t\t<li class=\"sbkMenu_Home\"><a href=\"" + Mode.Redirect_URL() + "\" class=\"sbkMenu_NoPadding\"><img src=\"" + Mode.Default_Images_URL + "home.png\" /> <div class=\"sbkMenu_HomeText\">" + sobek_home_text + "</div></a></li>");

            Mode.Mode = Display_Mode_Enum.Public_Folder;
            Output.WriteLine("\t\t<li class=\"selected-sf-menu-item-link\"><a href=\"" + Mode.Redirect_URL() + "\">" + publicFolderText + "</a></li>");
            Output.WriteLine("\t</ul></div>");

            Output.WriteLine("<!-- Initialize the main user menu -->");
            Output.WriteLine("<script>");
            Output.WriteLine("  jQuery(document).ready(function () {");
            Output.WriteLine("     jQuery('ul.sf-menu').superfish();");
            Output.WriteLine("  });");
            Output.WriteLine("</script>");
            Output.WriteLine();

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

            if (( pagedResults != null ) && ( resultsStatistics != null ))
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Public_Folder_HtmlSubwriter.Write_HTML", "Building Result DataSet Writer");
                    writeResult = new PagedResults_HtmlSubwriter(null, null, codeManager, translations, allItemsTable, currentUser, currentMode, Tracer)
                                      {
                                          Current_Aggregation = Current_Aggregation,
                                          Skin = htmlSkin,
                                          Mode = currentMode,
                                          Browse_Title = publicFolder.FolderName,
                                          Folder_Owner_Name = publicFolder.Name,
                                          Folder_Owner_Email = publicFolder.Email
                                      };
                }
                writeResult.Write_HTML(Output, Tracer);
            }

            return true;
        }
        /// <summary> Writes the HTML generated to browse the results of a search directly to the response stream </summary>
        /// <param name="Output"> Stream to which to write the HTML for this subwriter </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns>
        public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Search_Results_HtmlSubwriter.Write_HTML", "Rendering HTML");

            // If this skin has top-level navigation suppressed, skip the top tabs
            if (htmlSkin.Suppress_Top_Navigation)
            {
                Output.WriteLine("<br />");
            }
            else
            {
                // Add the main aggrgeation menu here
                MainMenus_Helper_HtmlSubWriter.Add_Aggregation_Search_Results_Menu(Output, currentMode, currentUser, Current_Aggregation, translations, codeManager, false);

            }

            if ( resultsStatistics != null )
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Search_Results_HtmlSubwriter.Write_HTML", "Building Result DataSet Writer");
                    writeResult = new PagedResults_HtmlSubwriter(resultsStatistics, pagedResults, codeManager, translations, allItemsTable, currentUser, currentMode, Tracer)
                                      {Current_Aggregation = Current_Aggregation, Skin = htmlSkin, Mode = currentMode};
                }
                writeResult.Write_HTML(Output, Tracer);
            }

            return true;
        }
        /// <summary> Adds controls to the main navigational page </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form, widely used throughout the application</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="populate_node_event"> Event is used to populate the a tree node without doing a full refresh of the page </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles </returns>
        /// <remarks> This uses a <see cref="PagedResults_HtmlSubwriter"/> instance to render the items  </remarks>
        public void Add_Controls(PlaceHolder placeHolder, Custom_Tracer Tracer, TreeNodeEventHandler populate_node_event )
        {
            if (resultsStatistics == null) return;

            if (writeResult == null)
            {
                Tracer.Add_Trace("Search_Results_HtmlSubwriter.Add_Controls", "Building Result DataSet Writer");

                writeResult = new PagedResults_HtmlSubwriter(resultsStatistics, pagedResults, codeManager, translations, allItemsTable, currentUser, currentMode, Tracer)
                                  {Current_Aggregation = Current_Aggregation, Skin = htmlSkin, Mode = currentMode};
            }

            Tracer.Add_Trace("Search_Results_HtmlSubwriter.Add_Controls", "Add controls");
            writeResult.Add_Controls(placeHolder, Tracer);
        }
        /// <summary> Writes the HTML generated to browse the results of a search directly to the response stream </summary>
        /// <param name="Output"> Stream to which to write the HTML for this subwriter </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns>
        public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Search_Results_HtmlSubwriter.Write_HTML", "Rendering HTML");

            // If this skin has top-level navigation suppressed, skip the top tabs
            if ((RequestSpecificValues.HTML_Skin.Suppress_Top_Navigation.HasValue) && (RequestSpecificValues.HTML_Skin.Suppress_Top_Navigation.Value))
            {
                Output.WriteLine("<br />");
            }
            else
            {
                // Add the main aggrgeation menu here
                MainMenus_Helper_HtmlSubWriter.Add_Aggregation_Search_Results_Menu(Output, RequestSpecificValues, hierarchyObject, false);
            }

            if ( RequestSpecificValues.Results_Statistics != null )
            {
                if (writeResult == null)
                {
                    Tracer.Add_Trace("Search_Results_HtmlSubwriter.Write_HTML", "Building Result DataSet Writer");
                    writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues, RequestSpecificValues.Results_Statistics, RequestSpecificValues.Paged_Results);
                }
                writeResult.Write_HTML(Output, Tracer);
            }

            return true;
        }
        /// <summary> Adds controls to the main navigational page </summary>
        /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form, widely used throughout the application</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="PopulateNodeEvent"> Event is used to populate the a tree node without doing a full refresh of the page </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles </returns>
        /// <remarks> This uses a <see cref="PagedResults_HtmlSubwriter"/> instance to render the items  </remarks>
        public void Add_Controls(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer, TreeNodeEventHandler PopulateNodeEvent )
        {
            if (RequestSpecificValues.Results_Statistics == null) return;

            if (writeResult == null)
            {
                Tracer.Add_Trace("Search_Results_HtmlSubwriter.Add_Controls", "Building Result DataSet Writer");

                writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues, RequestSpecificValues.Results_Statistics, RequestSpecificValues.Paged_Results);
            }

            Tracer.Add_Trace("Search_Results_HtmlSubwriter.Add_Controls", "Add controls");
            writeResult.Add_Controls(MainPlaceHolder, Tracer);
        }