/// <summary> Constructor for a new instance of the MySobek_HtmlSubwriter class </summary>
        /// <param name="Results_Statistics"> Information about the entire set of results for a browse of a user's bookshelf folder </param>
        /// <param name="Paged_Results"> Single page of results for a browse of a user's bookshelf folder, within the entire set </param>
        /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param>
        /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param>
        /// <param name="Hierarchy_Object"> Current item aggregation object to display </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_Item">Current item to edit, if the user is requesting to edit an item</param>
        /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations </param>
        /// <param name="Web_Skin_Collection"> Collection of all the web skins </param>
        /// <param name="Current_User"> Currently logged on user </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="IP_Restrictions"> List of all IP Restriction ranges in use by this digital library </param>
        /// <param name="URL_Portals"> List of all web portals into this system </param>
        /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param>
        /// <param name="Thematic_Headings"> Headings under which all the highlighted collections on the home page are organized </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public MySobek_HtmlSubwriter(Search_Results_Statistics Results_Statistics,
                                     List <iSearch_Title_Result> Paged_Results,
                                     Aggregation_Code_Manager Code_Manager,
                                     Item_Lookup_Object All_Items_Lookup,
                                     Item_Aggregation Hierarchy_Object,
                                     SobekCM_Skin_Object HTML_Skin,
                                     Language_Support_Info Translator,
                                     SobekCM_Navigation_Object Current_Mode,
                                     SobekCM_Item Current_Item,
                                     Dictionary <string, string> Aggregation_Aliases,
                                     SobekCM_Skin_Collection Web_Skin_Collection,
                                     User_Object Current_User,
                                     IP_Restriction_Ranges IP_Restrictions,
                                     Dictionary <string, Wordmark_Icon> Icon_Table,
                                     Portal_List URL_Portals,
                                     Statistics_Dates Stats_Date_Range,
                                     List <Thematic_Heading> Thematic_Headings,
                                     Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Saving values and geting user object back from the session");

            resultsStatistics = Results_Statistics;
            pagedResults      = Paged_Results;
            codeManager       = Code_Manager;
            itemList          = All_Items_Lookup;
            htmlSkin          = HTML_Skin;
            translator        = Translator;
            currentCollection = Hierarchy_Object;
            currentItem       = Current_Item;
            user           = Current_User;
            ipRestrictions = IP_Restrictions;
            iconTable      = Icon_Table;
            statsDates     = Stats_Date_Range;


            if (Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Log_Out)
            {
                Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Performing logout");

                HttpContext.Current.Session["user"] = null;
                HttpContext.Current.Response.Redirect("?");
            }

            if ((Current_Mode.My_Sobek_Type != My_Sobek_Type_Enum.Logon) && (user != null) && (user.Is_Temporary_Password))
            {
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.New_Password;
            }

            if (Current_Mode.Logon_Required)
            {
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Logon;
            }

            Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Building the my sobek viewer object");
            switch (Current_Mode.My_Sobek_Type)
            {
            case My_Sobek_Type_Enum.Home:
                mySobekViewer = new Home_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.New_Item:
                mySobekViewer = new New_Group_And_Item_MySobekViewer(user, Current_Mode, itemList, codeManager, iconTable, htmlSkin, translator, Tracer);
                break;

            case My_Sobek_Type_Enum.Folder_Management:
                mySobekViewer = new Folder_Mgmt_MySobekViewer(user, resultsStatistics, pagedResults, codeManager, itemList, currentCollection, htmlSkin, translator, Current_Mode, Tracer);
                break;

            case My_Sobek_Type_Enum.Saved_Searches:
                mySobekViewer = new Saved_Searches_MySobekViewer(user, translator, Current_Mode, Tracer);
                break;

            case My_Sobek_Type_Enum.Preferences:
                mySobekViewer = new Preferences_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.Logon:
                mySobekViewer = new Logon_MySobekViewer(Current_Mode, Tracer);
                break;

            case My_Sobek_Type_Enum.New_Password:
                mySobekViewer = new NewPassword_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.Delete_Item:
                mySobekViewer = new Delete_Item_MySobekViewer(user, Current_Mode, All_Items_Lookup, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Item_Behaviors:
                mySobekViewer = new Edit_Item_Behaviors_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Item_Metadata:
                mySobekViewer = new Edit_Item_Metadata_MySobekViewer(user, Current_Mode, itemList, currentItem, codeManager, iconTable, htmlSkin, Tracer);
                break;

            case My_Sobek_Type_Enum.File_Management:
                mySobekViewer = new File_Management_MySobekViewer(user, Current_Mode, Current_Item, itemList, codeManager, iconTable, htmlSkin, translator, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Group_Behaviors:
                mySobekViewer = new Edit_Group_Behaviors_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Group_Serial_Hierarchy:
                mySobekViewer = new Edit_Serial_Hierarchy_MySobekViewer(user);
                break;

            case My_Sobek_Type_Enum.Group_Add_Volume:
                // Pull the list of items tied to this group
                SobekCM_Items_In_Title itemsInTitle = Cached_Data_Manager.Retrieve_Items_In_Title(currentItem.BibID, Tracer);
                if (itemsInTitle == null)
                {
                    // Get list of information about this item group and save the item list
                    DataSet itemDetails = SobekCM_Database.Get_Item_Group_Details(currentItem.BibID, Tracer);
                    itemsInTitle = new SobekCM_Items_In_Title(itemDetails.Tables[1]);

                    // Store in cache if retrieved
                    Cached_Data_Manager.Store_Items_In_Title(currentItem.BibID, itemsInTitle, Tracer);
                }
                mySobekViewer = new Group_Add_Volume_MySobekViewer(user, Current_Mode, itemList, currentItem, codeManager, iconTable, htmlSkin, itemsInTitle, translator, Tracer);
                break;

            case My_Sobek_Type_Enum.Group_AutoFill_Volumes:
                mySobekViewer = new Group_AutoFill_Volume_MySobekViewer(user);
                break;

            case My_Sobek_Type_Enum.Group_Mass_Update_Items:
                mySobekViewer = new Mass_Update_Items_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer);
                break;

            case My_Sobek_Type_Enum.User_Tags:
                mySobekViewer = new User_Tags_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.User_Usage_Stats:
                mySobekViewer = new User_Usage_Stats_MySobekViewer(user, Current_Mode, statsDates, Tracer);
                break;
            }

            // Pass in the navigation and translator information
            mySobekViewer.CurrentMode = Current_Mode;
            mySobekViewer.Translator  = translator;
        }