/// <summary> Constructor for a new instance of the Advanced_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Advanced_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Compute the redirect stem to use
            string            fields            = currentMode.Search_Fields;
            string            searchCollections = currentMode.SubAggregation;
            Display_Mode_Enum lastMode          = currentMode.Mode;

            currentMode.SubAggregation = String.Empty;
            string searchString = currentMode.Search_String;

            currentMode.Search_String    = String.Empty;
            currentMode.Search_Fields    = String.Empty;
            currentMode.Mode             = Display_Mode_Enum.Results;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string redirectStem = currentMode.Redirect_URL();

            currentMode.Search_String  = searchString;
            currentMode.Search_Fields  = fields;
            currentMode.SubAggregation = searchCollections;
            currentMode.Mode           = lastMode;

            // If there are children under this hierarchy that can be selected
            //script_action_name = "Javascript:advanced_select_search_sobekcm('" + redirect_stem + "', '" + sub_code + "')";
            //script_include_name = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";

            scriptActionName  = "Javascript:advanced_search_sobekcm('" + redirectStem + "')";
            scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
        }
Ejemplo n.º 2
0
        /// <summary> Constructor for a new instance of the Advanced_Search_YearRange_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Advanced_Search_YearRange_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode)
            : base(Current_Aggregation, Current_Mode)
        {
            // Compute the redirect stem to use
            string                fields            = currentMode.Search_Fields;
            string                searchCollections = currentMode.SubAggregation;
            Display_Mode_Enum     lastMode          = currentMode.Mode;
            Aggregation_Type_Enum aggrType          = currentMode.Aggregation_Type;

            currentMode.SubAggregation = String.Empty;
            string searchString = currentMode.Search_String;

            currentMode.Search_String    = String.Empty;
            currentMode.Search_Fields    = String.Empty;
            currentMode.Mode             = Display_Mode_Enum.Results;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string redirectStem = currentMode.Redirect_URL();

            currentMode.Search_String    = searchString;
            currentMode.Search_Fields    = fields;
            currentMode.SubAggregation   = searchCollections;
            currentMode.Mode             = lastMode;
            currentMode.Aggregation_Type = aggrType;

            scriptActionName = "Javascript:advanced_search_years_sobekcm('" + redirectStem + "')";
        }
Ejemplo n.º 3
0
        private static string Menu_HTML_Helper(string SkinCode, Search_Type_Enum Search_Type, string Display_Text, SobekCM_Navigation_Object Current_Mode)
        {
            if (Current_Mode.Is_Robot)
            {
                if ((Current_Mode.Mode == Display_Mode_Enum.Search) && (Current_Mode.Search_Type == Search_Type))
                {
                    return("<li class=\"selected-sf-menu-item-link\"><a href=\"\">" + Display_Text + "</a></li>" + Environment.NewLine);
                }
                else
                {
                    return("<li><a href=\"\">" + Display_Text + "</a></li>" + Environment.NewLine);
                }
            }

            if ((Current_Mode.Mode == Display_Mode_Enum.Search) && (Current_Mode.Search_Type == Search_Type))
            {
                return("<li class=\"selected-sf-menu-item-link\"><a href=\"" + Current_Mode.Redirect_URL() + "\">" + Display_Text + "</a></li>" + Environment.NewLine);
            }

            // else...
            Search_Type_Enum  currentSearchType2 = Current_Mode.Search_Type;
            Display_Mode_Enum currentMode2       = Current_Mode.Mode;

            Current_Mode.Search_Type = Search_Type;
            Current_Mode.Mode        = Display_Mode_Enum.Search;
            string toReturn2 = "<li><a href=\"" + Current_Mode.Redirect_URL() + "\">" + Display_Text + "</a></li>" + Environment.NewLine;

            Current_Mode.Search_Type = currentSearchType2;
            Current_Mode.Mode        = currentMode2;
            return(toReturn2);
        }
Ejemplo n.º 4
0
        private static string Tabs_HTML_Helper(string SkinCode, Search_Type_Enum Search_Type, string Display_Text, SobekCM_Navigation_Object Current_Mode, bool Downward_Tabs)
        {
            if (Downward_Tabs)
            {
                if ((Current_Mode.Mode == Display_Mode_Enum.Search) && (Current_Mode.Search_Type == Search_Type))
                {
                    return("<img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cLD_s.gif\" border=\"0\" class=\"tab_image\" alt=\"\" /><span class=\"tab_s\"> " + Display_Text + " </span><img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cRD_s.gif\" border=\"0\" class=\"tab_image\" alt=\"\" />" + Environment.NewLine);
                }
                Search_Type_Enum  currentSearchType = Current_Mode.Search_Type;
                Display_Mode_Enum currentMode       = Current_Mode.Mode;
                Current_Mode.Search_Type = Search_Type;
                Current_Mode.Mode        = Display_Mode_Enum.Search;
                string toReturn = "<a href=\"" + Current_Mode.Redirect_URL() + "\"> " + "<img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cLD.gif\" border=\"0\" class=\"tab_image\" alt=\"\" /><span class=\"tab\"> " + Display_Text + " </span><img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cRD.gif\" border=\"0\" class=\"tab_image\" alt=\"\" /></a>" + Environment.NewLine;
                Current_Mode.Search_Type = currentSearchType;
                Current_Mode.Mode        = currentMode;
                return(toReturn);
            }

            if ((Current_Mode.Mode == Display_Mode_Enum.Search) && (Current_Mode.Search_Type == Search_Type))
            {
                return("<img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cL_s.gif\" border=\"0\" class=\"tab_image\" alt=\"\" /><span class=\"tab_s\"> " + Display_Text + " </span><img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cR_s.gif\" border=\"0\" class=\"tab_image\" alt=\"\" />" + Environment.NewLine);
            }

            // else...
            Search_Type_Enum  currentSearchType2 = Current_Mode.Search_Type;
            Display_Mode_Enum currentMode2       = Current_Mode.Mode;

            Current_Mode.Search_Type = Search_Type;
            Current_Mode.Mode        = Display_Mode_Enum.Search;
            string toReturn2 = "<a href=\"" + Current_Mode.Redirect_URL() + "\"> <img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cL.gif\" border=\"0\" class=\"tab_image\" alt=\"\" /><span class=\"tab\"> " + Display_Text + " </span><img src=\"" + Current_Mode.Base_URL + "design/skins/" + SkinCode + "/tabs/cR.gif\" border=\"0\" class=\"tab_image\" alt=\"\" /> </a>" + Environment.NewLine;

            Current_Mode.Search_Type = currentSearchType2;
            Current_Mode.Mode        = currentMode2;
            return(toReturn2);
        }
        /// <summary> Writes the HTML generated by this simple text / CMS html subwriter 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>
        /// <remarks> This finishes out the page and includes all the static content in this static web content file </remarks>
        public override void Write_Final_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Web_Content_HtmlSubwriter.Write_Final_HTML", "Rendering HTML");

            // If there is a sitemap, move to the second part of the table
            if (siteMap != null)
            {
                Output.WriteLine("</td>");
                Output.WriteLine("<td valign=\"top\">");
            }

            // Save the current mode and browse
            Display_Mode_Enum thisMode = currentMode.Mode;

            if ((thisStaticBrowseObject.Banner.Length > 0) && (thisStaticBrowseObject.Banner.ToUpper().Trim() != "NONE"))
            {
                if (thisStaticBrowseObject.Banner.ToUpper().Trim() == "DEFAULT")
                {
                    if ((htmlSkin != null) && (htmlSkin.Banner_HTML.Length > 0))
                    {
                        Output.WriteLine(htmlSkin.Banner_HTML);
                    }
                    else
                    {
                        if (Current_Aggregation != null)
                        {
                            Output.WriteLine("<img id=\"mainBanner\" src=\"" + currentMode.Base_URL + Current_Aggregation.Banner_Image(currentMode.Language, htmlSkin) + "\" alt=\"MISSING BANNER\" /><br />");
                        }
                    }
                }
                else
                {
                    Output.WriteLine("<img id=\"mainBanner\" src=\"" + thisStaticBrowseObject.Banner.Replace("<%BASEURL%>", currentMode.Base_URL) + "\" alt=\"MISSING BANNER\" /><br />");
                }
            }

            // Add the breadcrumbs
            if (!String.IsNullOrEmpty(breadcrumbs))
            {
                Output.WriteLine("<span class=\"breadcrumbs\">" + breadcrumbs + "</span><br />");
            }

            // Add the secondary HTML ot the home page
            Output.WriteLine("<div class=\"SobekResultsPanel\">");
            Output.WriteLine(thisStaticBrowseObject.Static_Text);
            Output.WriteLine("</div>");
            Output.WriteLine("<br />");
            Output.WriteLine();

            // If there is a sitemap, finish the main table
            if (siteMap != null)
            {
                Output.WriteLine("</td>");
                Output.WriteLine("</tr>");
                Output.WriteLine("</table>");
            }
        }
        /// <summary> Constructor for a new instance of the Rotating_Highlight_MimeType_AggregationViewer class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="ViewBag"> Aggregation-specific request information, such as aggregation object and any browse object requested </param>
        public Rotating_Highlight_MimeType_AggregationViewer(RequestCache RequestSpecificValues, AggregationViewBag ViewBag)
            : base(RequestSpecificValues, ViewBag)
        {
            // Determine the sub text to use
            const string SUB_CODE = "s=";

            Sharing_Buttons_HTML = String.Empty;

            // Save the search term
            if (RequestSpecificValues.Current_Mode.Search_String.Length > 0)
            {
                textBoxValue = RequestSpecificValues.Current_Mode.Search_String;
            }

            // Determine the complete script action name
            Display_Mode_Enum     displayMode = RequestSpecificValues.Current_Mode.Mode;
            Aggregation_Type_Enum aggrType    = RequestSpecificValues.Current_Mode.Aggregation_Type;
            Search_Type_Enum      searchType  = RequestSpecificValues.Current_Mode.Search_Type;

            RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Results;
            RequestSpecificValues.Current_Mode.Search_Type      = Search_Type_Enum.Basic;
            RequestSpecificValues.Current_Mode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string search_string = RequestSpecificValues.Current_Mode.Search_String;

            RequestSpecificValues.Current_Mode.Search_String = String.Empty;
            RequestSpecificValues.Current_Mode.Search_Fields = String.Empty;
            arg2 = String.Empty;
            arg1 = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Aggregation;
            RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
            RequestSpecificValues.Current_Mode.Info_Browse_Mode = "all";
            browse_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            RequestSpecificValues.Current_Mode.Info_Browse_Mode = String.Empty;
            RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Home;
            if ((!RequestSpecificValues.Current_Mode.Show_Selection_Panel.HasValue) || (!RequestSpecificValues.Current_Mode.Show_Selection_Panel.Value) || (ViewBag.Hierarchy_Object.Children_Count == 0))
            {
                Search_Script_Action = "basic_search_sobekcm('" + arg1 + "', '" + browse_url + "')";
            }
            else
            {
                Search_Script_Action = "basic_select_search_sobekcm('" + arg1 + "', '" + SUB_CODE + "')";
                arg2 = SUB_CODE;
            }
            RequestSpecificValues.Current_Mode.Mode             = displayMode;
            RequestSpecificValues.Current_Mode.Aggregation_Type = aggrType;
            RequestSpecificValues.Current_Mode.Search_Type      = searchType;
            RequestSpecificValues.Current_Mode.Search_String    = search_string;

            // Get the front banner
            frontBannerInfo = ViewBag.Hierarchy_Object.FrontBannerObj;
        }
        /// <summary> Constructor for a new instance of the Full_Text_Search_AggregationViewer class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="ViewBag"> Aggregation-specific request information, such as aggregation object and any browse object requested </param>
        public Full_Text_Search_AggregationViewer(RequestCache RequestSpecificValues, AggregationViewBag ViewBag)
            : base(RequestSpecificValues, ViewBag)
        {
            // Determine the sub text to use
            const string SUB_CODE = "s=";

            // Save the search term
            if (RequestSpecificValues.Current_Mode.Search_String.Length > 0)
            {
                textBoxValue = RequestSpecificValues.Current_Mode.Search_String;
            }

            // Determine the complete script action name
            Display_Mode_Enum     displayMode = RequestSpecificValues.Current_Mode.Mode;
            Search_Type_Enum      searchType  = RequestSpecificValues.Current_Mode.Search_Type;
            Aggregation_Type_Enum aggrType    = RequestSpecificValues.Current_Mode.Aggregation_Type;

            RequestSpecificValues.Current_Mode.Mode        = Display_Mode_Enum.Results;
            RequestSpecificValues.Current_Mode.Search_Type = Search_Type_Enum.Full_Text;
            string search_string = RequestSpecificValues.Current_Mode.Search_String;

            RequestSpecificValues.Current_Mode.Search_String    = String.Empty;
            RequestSpecificValues.Current_Mode.Search_Fields    = String.Empty;
            RequestSpecificValues.Current_Mode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            arg2 = String.Empty;
            arg1 = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            // Get the browse all url, if enabled
            browse_url = String.Empty;
            if (ViewBag.Hierarchy_Object.Can_Browse_Items)
            {
                RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Aggregation;
                RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
                RequestSpecificValues.Current_Mode.Info_Browse_Mode = "all";
                browse_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
            }

            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Search;
            if ((!RequestSpecificValues.Current_Mode.Show_Selection_Panel.HasValue) || (!RequestSpecificValues.Current_Mode.Show_Selection_Panel.Value) || (ViewBag.Hierarchy_Object.Children_Count == 0))
            {
                Search_Script_Action = "fulltext_search_sobekcm('" + arg1 + "', '" + browse_url + "');";
            }
            else
            {
                Search_Script_Action = "fulltext_select_search_sobekcm('" + arg1 + "', '" + SUB_CODE + "')";
                arg2 = SUB_CODE;
            }
            RequestSpecificValues.Current_Mode.Mode             = displayMode;
            RequestSpecificValues.Current_Mode.Aggregation_Type = aggrType;
            RequestSpecificValues.Current_Mode.Search_Type      = searchType;
            RequestSpecificValues.Current_Mode.Search_String    = search_string;
            RequestSpecificValues.Current_Mode.Info_Browse_Mode = String.Empty;
        }
        /// <summary> Constructor for a new instance of the Basic_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Rotating_Highlight_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Determine the sub text to use
            const string SUB_CODE = "s=";

            Sharing_Buttons_HTML = String.Empty;

            // Save the search term
            if (currentMode.Search_String.Length > 0)
            {
                textBoxValue = currentMode.Search_String;
            }

            // Determine the complete script action name
            Display_Mode_Enum     displayMode = currentMode.Mode;
            Aggregation_Type_Enum aggrType    = currentMode.Aggregation_Type;
            Search_Type_Enum      searchType  = currentMode.Search_Type;

            currentMode.Mode             = Display_Mode_Enum.Results;
            currentMode.Search_Type      = Search_Type_Enum.Basic;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string search_string = currentMode.Search_String;

            currentMode.Search_String = String.Empty;
            currentMode.Search_Fields = String.Empty;
            arg2 = String.Empty;
            arg1 = currentMode.Redirect_URL();
            currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url = currentMode.Redirect_URL();
            currentMode.Info_Browse_Mode = String.Empty;
            currentMode.Aggregation_Type = Aggregation_Type_Enum.Home;
            if ((!currentMode.Show_Selection_Panel) || (Current_Aggregation.Children_Count == 0))
            {
                scriptActionName = "basic_search_sobekcm('" + arg1 + "', '" + browse_url + "')";
            }
            else
            {
                scriptActionName = "basic_select_search_sobekcm('" + arg1 + "', '" + SUB_CODE + "')";
                arg2             = SUB_CODE;
            }
            currentMode.Mode             = displayMode;
            currentMode.Aggregation_Type = aggrType;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;

            // Get the front banner
            frontBannerInfo = Current_Aggregation.Front_Banner_Image(currentMode.Language);
        }
Ejemplo n.º 9
0
        /// <summary> Constructor for a new instance of the Basic_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Rotating_Highlight_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Determine the sub text to use
            const string subCode = "s=";

            Sharing_Buttons_HTML = String.Empty;

            // Save the search term
            if (currentMode.Search_String.Length > 0)
            {
                textBoxValue = currentMode.Search_String;
            }

            // Determine the complete script action name
            Display_Mode_Enum displayMode = currentMode.Mode;
            Search_Type_Enum  searchType  = currentMode.Search_Type;

            currentMode.Mode             = Display_Mode_Enum.Results;
            currentMode.Search_Type      = Search_Type_Enum.Basic;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string search_string = currentMode.Search_String;

            currentMode.Search_String = String.Empty;
            currentMode.Search_Fields = String.Empty;
            arg2                         = String.Empty;
            arg1                         = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Aggregation_Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url                   = currentMode.Redirect_URL();
            currentMode.Info_Browse_Mode = String.Empty;
            currentMode.Mode             = Display_Mode_Enum.Aggregation_Home;
            if ((!currentMode.Show_Selection_Panel) || (Current_Aggregation.Children_Count == 0))
            {
                scriptActionName  = "basic_search_sobekcm('" + arg1 + "', '" + browse_url + "')";
                scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
            }
            else
            {
                scriptActionName  = "basic_select_search_sobekcm('" + arg1 + "', '" + subCode + "')";
                arg2              = subCode;
                scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
            }
            currentMode.Mode          = displayMode;
            currentMode.Search_Type   = searchType;
            currentMode.Search_String = search_string;
        }
Ejemplo n.º 10
0
        /// <summary> Constructor for a new instance of the Full_Text_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Full_Text_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Determine the sub text to use
            const string SUB_CODE = "s=";

            // Save the search term
            if (currentMode.Search_String.Length > 0)
            {
                textBoxValue = currentMode.Search_String;
            }

            // Determine the complete script action name
            Display_Mode_Enum     displayMode = currentMode.Mode;
            Search_Type_Enum      searchType  = currentMode.Search_Type;
            Aggregation_Type_Enum aggrType    = currentMode.Aggregation_Type;

            currentMode.Mode        = Display_Mode_Enum.Results;
            currentMode.Search_Type = Search_Type_Enum.Full_Text;
            string search_string = currentMode.Search_String;

            currentMode.Search_String    = String.Empty;
            currentMode.Search_Fields    = String.Empty;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            arg2                         = String.Empty;
            arg1                         = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Aggregation;
            currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url                   = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Search;
            if ((!currentMode.Show_Selection_Panel) || (Current_Aggregation.Children_Count == 0))
            {
                scriptActionName = "fulltext_search_sobekcm('" + arg1 + "', '" + browse_url + "');";
            }
            else
            {
                scriptActionName = "fulltext_select_search_sobekcm('" + arg1 + "', '" + SUB_CODE + "')";
                arg2             = SUB_CODE;
            }
            currentMode.Mode             = displayMode;
            currentMode.Aggregation_Type = aggrType;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;
            currentMode.Info_Browse_Mode = String.Empty;
        }
        /// <summary> Constructor for a new instance of the dLOC_Search_AggregationViewer class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="ViewBag"> Aggregation-specific request information, such as aggregation object and any browse object requested </param>
        public dLOC_Search_AggregationViewer(RequestCache RequestSpecificValues, AggregationViewBag ViewBag)
            : base(RequestSpecificValues, ViewBag)
        {
            textBoxValue = String.Empty;
            if (RequestSpecificValues.Current_Mode.Search_String.Length > 0)
            {
                textBoxValue = RequestSpecificValues.Current_Mode.Search_String.Replace(",newspaper", "");
            }

            // Determine the complete script action name
            Display_Mode_Enum     displayMode = RequestSpecificValues.Current_Mode.Mode;
            Aggregation_Type_Enum aggrType    = RequestSpecificValues.Current_Mode.Aggregation_Type;
            Search_Type_Enum      searchType  = RequestSpecificValues.Current_Mode.Search_Type;

            RequestSpecificValues.Current_Mode.Mode        = Display_Mode_Enum.Results;
            RequestSpecificValues.Current_Mode.Search_Type = Search_Type_Enum.Full_Text;
            string search_string = RequestSpecificValues.Current_Mode.Search_String;

            RequestSpecificValues.Current_Mode.Search_String = String.Empty;
            RequestSpecificValues.Current_Mode.Search_Fields = String.Empty;
            arg2 = String.Empty;
            RequestSpecificValues.Current_Mode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            arg1 = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            // Get the browse all url, if enabled
            browse_url = String.Empty;
            if (ViewBag.Hierarchy_Object.Can_Browse_Items)
            {
                RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Aggregation;
                RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
                RequestSpecificValues.Current_Mode.Info_Browse_Mode = "all";
                browse_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
            }



            Search_Script_Action = "dloc_search_sobekcm('" + arg1 + "', '" + browse_url + "');";

            RequestSpecificValues.Current_Mode.Mode             = displayMode;
            RequestSpecificValues.Current_Mode.Aggregation_Type = aggrType;
            RequestSpecificValues.Current_Mode.Search_Type      = searchType;
            RequestSpecificValues.Current_Mode.Search_String    = search_string;
            RequestSpecificValues.Current_Mode.Info_Browse_Mode = String.Empty;
        }
            /// <summary> Constructor for a new instance of the Search object </summary>
            /// <param name="currentMode"> Current navigation object to save the modal information ( interface, etc..)</param>
            /// <param name="SessionIP"> IP address which performed this search</param>
            /// <param name="Search_Type"> Type of search </param>
            /// <param name="Aggregation"> Aggregation against which this search was performed</param>
            /// <param name="Search_Terms"> Terms used in the search </param>
            public Search(SobekCM_Navigation_Object currentMode, string SessionIP, Search_Type_Enum Search_Type, string Aggregation, string Search_Terms)
            {
                Time = DateTime.Now.ToShortDateString().Replace("/", "-") + " " + DateTime.Now.ToShortTimeString().Replace(" ", "");

                // Save some of the values
                this.SessionIP = SessionIP;
                switch (Search_Type)
                {
                case Search_Type_Enum.Advanced:
                    this.Search_Type = "Advanced";
                    break;

                case Search_Type_Enum.Basic:
                    this.Search_Type = "Basic";
                    break;

                case Search_Type_Enum.Newspaper:
                    this.Search_Type = "Newspaper";
                    break;

                case Search_Type_Enum.Map:
                    this.Search_Type = "Map";
                    break;

                default:
                    this.Search_Type = "Unknown";
                    break;
                }

                // Create the key
                Key = SessionIP + "_" + this.Search_Type + "_" + Aggregation + "_" + Search_Terms.Replace(" ", "_");

                // Save the collection as a link
                Display_Mode_Enum lastMode = currentMode.Mode;

                currentMode.Mode             = Display_Mode_Enum.Aggregation;
                currentMode.Aggregation_Type = Aggregation_Type_Enum.Home;
                this.Aggregation             = "<a href=\"" + currentMode.Redirect_URL() + "\">" + Aggregation.Replace("&", "&amp;").Replace("\"", "&quot;") + "</a>";

                // Save the search terms as a link to the search
                currentMode.Mode  = lastMode;
                this.Search_Terms = "<a href=\"" + currentMode.Redirect_URL() + "\">" + Search_Terms.Replace("&", "&amp;").Replace("\"", "&quot;") + "</a>";
            }
Ejemplo n.º 13
0
        /// <summary> Constructor for a new instance of the dLOC_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public dLOC_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            textBoxValue = String.Empty;
            if (currentMode.Search_String.Length > 0)
            {
                textBoxValue = currentMode.Search_String.Replace(",newspaper", "");
            }

            // Determine the complete script action name
            Display_Mode_Enum displayMode = currentMode.Mode;
            Search_Type_Enum  searchType  = currentMode.Search_Type;

            currentMode.Mode        = Display_Mode_Enum.Results;
            currentMode.Search_Type = Search_Type_Enum.Full_Text;
            string search_string = currentMode.Search_String;

            currentMode.Search_String = String.Empty;
            currentMode.Search_Fields = String.Empty;
            arg2 = String.Empty;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            arg1                         = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Aggregation_Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url                   = currentMode.Redirect_URL();


            //if (( !currentMode.Show_Selection_Panel) || ( hierarchyObject.Codes.Length == 0 ))
            //{
            scriptActionName  = "dloc_search_sobekcm('" + arg1 + "', '" + browse_url + "');";
            scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
            //}
            //else
            //{
            //    script_action_name = "Javascript:dloc_select_search_sobekcm('" + currentMode.Redirect_URL() + "', '" + sub_code + "')";
            //    script_include_name = "<script src=\"" + currentMode.Base_URL + "default/scripts/dloc_select_search_sobekcm.js\" type=\"text/javascript\"></script>";
            //}
            currentMode.Mode             = displayMode;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;
            currentMode.Info_Browse_Mode = String.Empty;
        }
        /// <summary> Constructor for a new instance of the Advanced_Search_YearRange_AggregationViewer class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="ViewBag"> Aggregation-specific request information, such as aggregation object and any browse object requested </param>
        public Advanced_Search_YearRange_AggregationViewer(RequestCache RequestSpecificValues, AggregationViewBag ViewBag)
            : base(RequestSpecificValues, ViewBag)
        {
            // Compute the redirect stem to use
            string                fields            = RequestSpecificValues.Current_Mode.Search_Fields;
            string                searchCollections = RequestSpecificValues.Current_Mode.SubAggregation;
            Display_Mode_Enum     lastMode          = RequestSpecificValues.Current_Mode.Mode;
            Aggregation_Type_Enum aggrType          = RequestSpecificValues.Current_Mode.Aggregation_Type;

            RequestSpecificValues.Current_Mode.SubAggregation = String.Empty;

            string searchString = RequestSpecificValues.Current_Mode.Search_String;

            RequestSpecificValues.Current_Mode.Search_String    = String.Empty;
            RequestSpecificValues.Current_Mode.Search_Fields    = String.Empty;
            RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Results;
            RequestSpecificValues.Current_Mode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string redirectStem = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            // Get the browse all url, if enabled
            string browse_url = String.Empty;

            if (ViewBag.Hierarchy_Object.Can_Browse_Items)
            {
                RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Aggregation;
                RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
                RequestSpecificValues.Current_Mode.Info_Browse_Mode = "all";
                browse_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
            }

            RequestSpecificValues.Current_Mode.Search_String    = searchString;
            RequestSpecificValues.Current_Mode.Search_Fields    = fields;
            RequestSpecificValues.Current_Mode.SubAggregation   = searchCollections;
            RequestSpecificValues.Current_Mode.Mode             = lastMode;
            RequestSpecificValues.Current_Mode.Aggregation_Type = aggrType;

            Search_Script_Action = "advanced_search_years_sobekcm('" + redirectStem + "','" + browse_url + "')";
        }
        /// <summary> Constructor for a new instance of the dLOC_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public dLOC_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            textBoxValue = String.Empty;
            if (currentMode.Search_String.Length > 0)
            {
                textBoxValue = currentMode.Search_String.Replace(",newspaper", "");
            }

            // Determine the complete script action name
            Display_Mode_Enum     displayMode = currentMode.Mode;
            Aggregation_Type_Enum aggrType    = currentMode.Aggregation_Type;
            Search_Type_Enum      searchType  = currentMode.Search_Type;

            currentMode.Mode        = Display_Mode_Enum.Results;
            currentMode.Search_Type = Search_Type_Enum.Full_Text;
            string search_string = currentMode.Search_String;

            currentMode.Search_String = String.Empty;
            currentMode.Search_Fields = String.Empty;
            arg2 = String.Empty;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            arg1                         = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Aggregation;
            currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url                   = currentMode.Redirect_URL();



            scriptActionName = "dloc_search_sobekcm('" + arg1 + "', '" + browse_url + "');";

            currentMode.Mode             = displayMode;
            currentMode.Aggregation_Type = aggrType;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;
            currentMode.Info_Browse_Mode = String.Empty;
        }
        /// <summary> Add the header to the output </summary>
        /// <param name="Output"> Stream to which to write the HTML for this header </param>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="Container_CssClass"> Class name for the container around the page </param>
        /// <param name="Web_Page_Title"> Title for this web page, to include behind the banner possibly </param>
        /// <param name="Behaviors"> List of behaviors from the html subwriters </param>
        /// <param name="Current_Aggregation"> Current aggregation object, if there is one </param>
        /// <param name="Current_Item"> Current item object, if there is one </param>
        public static void Add_Header(TextWriter Output, RequestCache RequestSpecificValues, string Container_CssClass, string Web_Page_Title, List <HtmlSubwriter_Behaviors_Enum> Behaviors, Item_Aggregation Current_Aggregation, BriefItemInfo Current_Item)
        {
            // Get the url options
            string url_options          = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);
            string modified_url_options = String.Empty;

            if (url_options.Length > 0)
            {
                modified_url_options = "?" + url_options;
            }

            // Get the current contact URL
            Display_Mode_Enum thisMode = RequestSpecificValues.Current_Mode.Mode;

            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Contact;
            string contact = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            // Restore the old mode
            RequestSpecificValues.Current_Mode.Mode = thisMode;

            // Determine which header and footer to display
            bool useItemHeader = (RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Item_Display) || (RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Item_Print) || ((Behaviors != null) && (Behaviors.Contains(HtmlSubwriter_Behaviors_Enum.MySobek_Subwriter_Mimic_Item_Subwriter)));

            // Create the breadcrumbs text
            string breadcrumbs = "&nbsp; &nbsp; ";

            if (useItemHeader)
            {
                StringBuilder breadcrumb_builder = new StringBuilder("<a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + modified_url_options + "\">" + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Home</a>");

                int codes_added = 0;
                if ((RequestSpecificValues.Current_Mode.Aggregation.Length > 0) && (RequestSpecificValues.Current_Mode.Aggregation != "all"))
                {
                    breadcrumb_builder.Append(" &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + RequestSpecificValues.Current_Mode.Aggregation + modified_url_options + "\">" + UI_ApplicationCache_Gateway.Aggregations.Get_Collection_Short_Name(RequestSpecificValues.Current_Mode.Aggregation) + "</a>");
                    codes_added++;
                }

                if (Current_Item != null)
                {
                    if ((Current_Item.Behaviors.Aggregation_Code_List != null) && (Current_Item.Behaviors.Aggregation_Code_List.Count > 0))
                    {
                        foreach (string aggrCode in Current_Item.Behaviors.Aggregation_Code_List)
                        {
                            if (aggrCode.ToLower() != RequestSpecificValues.Current_Mode.Aggregation)
                            {
                                if ((String.Compare(aggrCode, Current_Item.Behaviors.Source_Institution_Aggregation, StringComparison.OrdinalIgnoreCase) != 0) &&
                                    (String.Compare(aggrCode, "i" + Current_Item.Behaviors.Source_Institution_Aggregation, StringComparison.OrdinalIgnoreCase) != 0) &&
                                    (String.Compare(aggrCode, Current_Item.Behaviors.Holding_Location_Aggregation, StringComparison.OrdinalIgnoreCase) != 0) &&
                                    (String.Compare(aggrCode, "i" + Current_Item.Behaviors.Holding_Location_Aggregation, StringComparison.OrdinalIgnoreCase) != 0))
                                {
                                    Item_Aggregation_Related_Aggregations thisAggr = UI_ApplicationCache_Gateway.Aggregations[aggrCode];
                                    if ((thisAggr != null) && (thisAggr.Active))
                                    {
                                        breadcrumb_builder.Append(" &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL +
                                                                  aggrCode.ToLower() + modified_url_options + "\">" +
                                                                  thisAggr.ShortName +
                                                                  "</a>");
                                        codes_added++;
                                    }
                                }
                            }
                            if (codes_added == 5)
                            {
                                break;
                            }
                        }
                    }

                    if (codes_added < 5)
                    {
                        if (!String.IsNullOrEmpty(Current_Item.Behaviors.Source_Institution_Aggregation))
                        {
                            // Add source code
                            string source_code = Current_Item.Behaviors.Source_Institution_Aggregation;
                            if ((source_code[0] != 'i') && (source_code[0] != 'I'))
                            {
                                source_code = "I" + source_code;
                            }
                            Item_Aggregation_Related_Aggregations thisSourceAggr = UI_ApplicationCache_Gateway.Aggregations[source_code];
                            if ((thisSourceAggr != null) && (!thisSourceAggr.Hidden) && (thisSourceAggr.Active))
                            {
                                string source_name = thisSourceAggr.ShortName;
                                if (source_name.ToUpper() != "ADDED AUTOMATICALLY")
                                {
                                    breadcrumb_builder.Append(" &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL +
                                                              source_code.ToLower() + modified_url_options + "\">" +
                                                              source_name + "</a>");
                                }
                            }

                            // Add the holding code
                            if ((!String.IsNullOrEmpty(Current_Item.Behaviors.Holding_Location_Aggregation)) &&
                                (String.Compare(Current_Item.Behaviors.Source_Institution_Aggregation, Current_Item.Behaviors.Source_Institution_Aggregation, StringComparison.OrdinalIgnoreCase) != 0))
                            {
                                // Add holding code
                                string holding_code = Current_Item.Behaviors.Holding_Location_Aggregation;
                                if ((holding_code[0] != 'i') && (holding_code[0] != 'I'))
                                {
                                    holding_code = "I" + holding_code;
                                }

                                Item_Aggregation_Related_Aggregations thisAggr = UI_ApplicationCache_Gateway.Aggregations[holding_code];
                                if ((thisAggr != null) && (!thisAggr.Hidden) && (thisAggr.Active))
                                {
                                    string holding_name = thisAggr.ShortName;

                                    if (holding_name.ToUpper() != "ADDED AUTOMATICALLY")
                                    {
                                        breadcrumb_builder.Append(" &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL +
                                                                  holding_code.ToLower() + modified_url_options + "\">" +
                                                                  holding_name + "</a>");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(Current_Item.Behaviors.Holding_Location_Aggregation))
                            {
                                // Add holding code
                                string holding_code = Current_Item.Behaviors.Holding_Location_Aggregation;
                                if ((holding_code[0] != 'i') && (holding_code[0] != 'I'))
                                {
                                    holding_code = "I" + holding_code;
                                }
                                string holding_name = UI_ApplicationCache_Gateway.Aggregations.Get_Collection_Short_Name(holding_code);
                                if (holding_name.ToUpper() != "ADDED AUTOMATICALLY")
                                {
                                    breadcrumb_builder.Append(" &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL +
                                                              holding_code.ToLower() + modified_url_options + "\">" +
                                                              holding_name + "</a>");
                                }
                            }
                        }
                    }
                }
                breadcrumbs = breadcrumb_builder.ToString();
            }
            else
            {
                switch (RequestSpecificValues.Current_Mode.Mode)
                {
                case Display_Mode_Enum.Error:
                    breadcrumbs = "<a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + modified_url_options + "\">" + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Home</a>";
                    break;

                case Display_Mode_Enum.Aggregation:
                    if ((RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Home) || (RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Home_Edit))
                    {
                        if ((RequestSpecificValues.Current_Mode.Aggregation.Length > 0) && (RequestSpecificValues.Current_Mode.Aggregation != "all"))
                        {
                            breadcrumbs = "<a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + modified_url_options + "\">" + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Home</a>";
                        }
                    }
                    else
                    {
                        breadcrumbs = "<a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + modified_url_options + "\">" + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Home</a>";
                        if ((RequestSpecificValues.Current_Mode.Aggregation.Length > 0) && (RequestSpecificValues.Current_Mode.Aggregation != "all"))
                        {
                            breadcrumbs = breadcrumbs + " &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + RequestSpecificValues.Current_Mode.Aggregation + modified_url_options + "\">" + UI_ApplicationCache_Gateway.Aggregations.Get_Collection_Short_Name(RequestSpecificValues.Current_Mode.Aggregation) + "</a>";
                        }
                    }
                    break;

                default:
                    breadcrumbs = "<a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + modified_url_options + "\">" + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Home</a>";
                    if ((RequestSpecificValues.Current_Mode.Aggregation.Length > 0) && (RequestSpecificValues.Current_Mode.Aggregation != "all"))
                    {
                        breadcrumbs = breadcrumbs + " &nbsp;|&nbsp; <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + RequestSpecificValues.Current_Mode.Aggregation + modified_url_options + "\">" + UI_ApplicationCache_Gateway.Aggregations.Get_Collection_Short_Name(RequestSpecificValues.Current_Mode.Aggregation) + "</a>";
                    }
                    break;
                }
            }


            // Create the mySobek text
            string mySobekLinks = create_mysobek_link(RequestSpecificValues, url_options, null);

            // Look for some basic mode data
            string collection_code = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Aggregation) ? String.Empty : RequestSpecificValues.Current_Mode.Aggregation;

            if (String.Compare(collection_code, "ALL", StringComparison.OrdinalIgnoreCase) == 0)
            {
                collection_code = String.Empty;
            }
            string bibid = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.BibID) ? String.Empty : RequestSpecificValues.Current_Mode.BibID;
            string vid   = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.BibID) ? String.Empty : RequestSpecificValues.Current_Mode.BibID;
            string mode  = String.Empty;

            switch (RequestSpecificValues.Current_Mode.Mode)
            {
            case Display_Mode_Enum.Item_Display:
                mode = "item";
                break;

            case Display_Mode_Enum.Aggregation:
            case Display_Mode_Enum.Search:
                mode = "aggregation";
                break;

            case Display_Mode_Enum.Results:
                mode = "results";
                break;
            }


            // Get the language selections
            Web_Language_Enum language = RequestSpecificValues.Current_Mode.Language;

            RequestSpecificValues.Current_Mode.Language = Web_Language_Enum.TEMPLATE;
            string template_language = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
            string english           = template_language.Replace("l=XXXXX", "l=en");
            string french            = template_language.Replace("l=XXXXX", "l=fr");
            string spanish           = template_language.Replace("l=XXXXX", "l=es");

            RequestSpecificValues.Current_Mode.Language = language;

            if (RequestSpecificValues.Current_Mode.Is_Robot)
            {
                english = String.Empty;
                french  = String.Empty;
                spanish = String.Empty;
            }

            // Determine which container to use, depending on the current mode
            string container_inner = Container_CssClass;

            // Get the skin url
            string skin_url = RequestSpecificValues.Current_Mode.Base_Design_URL + "skins/" + RequestSpecificValues.Current_Mode.Skin + "/";

            // Determine the URL options for replacement
            string urlOptions1 = String.Empty;
            string urlOptions2 = String.Empty;

            if (url_options.Length > 0)
            {
                urlOptions1 = "?" + url_options;
                urlOptions2 = "&" + url_options;
            }

            // Determine the possible banner to display
            string banner = String.Empty;

            if ((Behaviors != null) && (!Behaviors.Contains(HtmlSubwriter_Behaviors_Enum.Suppress_Banner)))
            {
                if ((RequestSpecificValues.HTML_Skin != null) && (RequestSpecificValues.HTML_Skin.Override_Banner.HasValue) && (RequestSpecificValues.HTML_Skin.Override_Banner.Value))
                {
                    banner = !String.IsNullOrEmpty(RequestSpecificValues.HTML_Skin.Banner_HTML) ? RequestSpecificValues.HTML_Skin.Banner_HTML : String.Empty;
                }
                else
                {
                    if (Current_Aggregation != null)
                    {
                        string banner_image = Current_Aggregation.Get_Banner_Image(RequestSpecificValues.HTML_Skin);
                        if (Current_Aggregation.Code != "all")
                        {
                            if (banner_image.Length > 0)
                            {
                                banner = "<section id=\"sbkHmw_BannerDiv\" role=\"banner\" title=\"" + Current_Aggregation.ShortName + "\"><h1 class=\"hidden-element\">" + Web_Page_Title + "</h1><a alt=\"" + Current_Aggregation.ShortName + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + Current_Aggregation.Code + urlOptions1 + "\"><img id=\"mainBanner\" src=\"" + RequestSpecificValues.Current_Mode.Base_URL + banner_image + "\"  alt=\"" + Current_Aggregation.ShortName + "\" /></a></section>";
                            }
                        }
                        else
                        {
                            if (banner_image.Length > 0)
                            {
                                banner = "<section id=\"sbkHmw_BannerDiv\" role=\"banner\" title=\"" + Current_Aggregation.ShortName + "\"><h1 class=\"hidden-element\">" + Web_Page_Title + "</h1><a alt=\"" + Current_Aggregation.ShortName + "\"  href=\"" + RequestSpecificValues.Current_Mode.Base_URL + urlOptions1 + "\"><img id=\"mainBanner\" src=\"" + RequestSpecificValues.Current_Mode.Base_URL + banner_image + "\"  alt=\"" + Current_Aggregation.ShortName + "\" /></a></section>";
                            }
                            else
                            {
                                banner = "<section id=\"sbkHmw_BannerDiv\" role=\"banner\" title=\"" + Current_Aggregation.ShortName + "\"><h1 class=\"hidden-element\">" + Web_Page_Title + "</h1><a alt=\"" + Current_Aggregation.ShortName + "\"  href=\"" + RequestSpecificValues.Current_Mode.Base_URL + urlOptions1 + "\"><img id=\"mainBanner\" src=\"" + skin_url + "default.jpg\" alt=\"" + Current_Aggregation.ShortName + "\" /></a></section>";
                            }
                        }
                    }
                }
            }

            // Get the session id and user id
            string sessionId = HttpContext.Current.Session.SessionID ?? String.Empty;
            string userid    = ((RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.UserID > 0)) ? RequestSpecificValues.Current_User.UserID.ToString() : String.Empty;

            // Add the appropriate header
            StringBuilder headerBuilder = new StringBuilder();

            try
            {
                if (useItemHeader)
                {
                    headerBuilder.Append(RequestSpecificValues.HTML_Skin.Header_Item_HTML);
                }
                else
                {
                    headerBuilder.Append(RequestSpecificValues.HTML_Skin.Header_HTML);

                    if ((!String.IsNullOrEmpty(container_inner)) && ((!RequestSpecificValues.HTML_Skin.Header_Has_Container_Directive.HasValue) || (!RequestSpecificValues.HTML_Skin.Header_Has_Container_Directive.Value)))
                    {
                        headerBuilder.Insert(0, "<div id=\"" + container_inner + "\">" + Environment.NewLine);
                    }
                }

                // Do all the replacements
                headerBuilder.Replace("<%COLLCODE%>", collection_code);
                headerBuilder.Replace("<%BIBID%>", bibid);
                headerBuilder.Replace("<%VID%>", vid);
                headerBuilder.Replace("<%MODE%>", mode);
                //              headerBuilder.Replace("<%COLLNAME%>", collection_name);
                headerBuilder.Replace("<%CONTACT%>", contact);
                headerBuilder.Replace("<%URLOPTS%>", url_options);
                headerBuilder.Replace("<%?URLOPTS%>", urlOptions1);
                headerBuilder.Replace("<%&URLOPTS%>", urlOptions2);
                headerBuilder.Replace("<%BREADCRUMBS%>", breadcrumbs);
                headerBuilder.Replace("<%MYSOBEK%>", mySobekLinks);
                headerBuilder.Replace("<%ENGLISH%>", english);
                headerBuilder.Replace("<%FRENCH%>", french);
                headerBuilder.Replace("<%SPANISH%>", spanish);
                headerBuilder.Replace("<%BASEURL%>", RequestSpecificValues.Current_Mode.Base_URL);
                headerBuilder.Replace("\"container-inner\"", "\"" + container_inner + "\"");
                headerBuilder.Replace("<%BANNER%>", banner);
                headerBuilder.Replace("<%SKINURL%>", skin_url);
                if ((!useItemHeader) && (!String.IsNullOrEmpty(container_inner)) && (RequestSpecificValues.HTML_Skin.Header_Has_Container_Directive.HasValue) && (RequestSpecificValues.HTML_Skin.Header_Has_Container_Directive.Value))
                {
                    headerBuilder.Replace("<%CONTAINER%>", "<div id=\"" + container_inner + "\">");
                }
                else
                {
                    headerBuilder.Replace("<%CONTAINER%>", String.Empty);
                }
                headerBuilder.Replace("<%INSTANCENAME%>", RequestSpecificValues.Current_Mode.Instance_Name);
                headerBuilder.Replace("<%SESSIONID%>", sessionId);
                headerBuilder.Replace("<%USERID%>", userid);
            }
            catch (Exception ee)
            {
                RequestSpecificValues.Tracer.Add_Trace("HeaderFooter_Helper_HtmlSubWriter.Add_Header", "EXCEPTION CAUGHT while trying to write the header.");
                if (RequestSpecificValues.HTML_Skin == null)
                {
                    RequestSpecificValues.Tracer.Add_Trace("HeaderFooter_Helper_HtmlSubWriter.Add_Header", "HTML Skin was NULL");
                }
                else if (RequestSpecificValues.HTML_Skin.Header_Item_HTML == null)
                {
                    RequestSpecificValues.Tracer.Add_Trace("HeaderFooter_Helper_HtmlSubWriter.Add_Header", "HTML Skin was not NULL, but Header_Item_HTML property was NULL");
                }
            }

            // Write the header
            Output.WriteLine(headerBuilder.ToString());
        }
        /// <summary> Add a single hit against an institutional aggregation </summary>
        /// <param name="Code"> Institutional aggregation code </param>
        /// <param name="mode"> Mode information </param>
        /// <param name="SessionID"> ID for the session from which this hit originated </param>
        public void Add_Institution_Hit(string Code, Display_Mode_Enum mode, int SessionID)
        {
            // Determine if this session is already linked to this institution
            int increment_session = 0;
            if (institution_sessions.ContainsKey(Code))
            {
                // This code has been found before, but was this session among them previous sessions?
                if (!institution_sessions[Code].Contains(SessionID))
                {
                    // New session!
                    increment_session = 1;
                    institution_sessions[Code].Add(SessionID);
                }
            }
            else
            {
                // This institution has not been hit yet at all
                increment_session = 1;
                List<int> new_institution_id_list = new List<int> {SessionID};
                institution_sessions.Add(Code, new_institution_id_list);
            }

            // Create or fetch the data row for this collection
            DataRow newRow;
            if (institution_rows.ContainsKey(Code))
            {
                newRow = institution_rows[Code];
            }
            else
            {
                newRow = institution_stats.NewRow();
                newRow["code"] = Code;
                newRow["sessions"] = 0;
                newRow["home_page_hits"] = 0;
                newRow["browse_hits"] = 0;
                newRow["advanced_search_hits"] = 0;
                newRow["results_hits"] = 0;
                institution_stats.Rows.Add(newRow);
                institution_rows.Add(Code, newRow);
            }

            // If this is a new session, increment that counter
            if (increment_session > 0)
            {
                newRow["sessions"] = Convert.ToInt32(newRow["sessions"]) + 1;
            }

            // If there is no mode, this is home page
            switch (mode)
            {
                case Display_Mode_Enum.Aggregation_Home:
                    newRow["home_page_hits"] = Convert.ToInt32(newRow["home_page_hits"]) + 1;
                    break;

                case Display_Mode_Enum.Aggregation_Browse_By:
                case Display_Mode_Enum.Aggregation_Browse_Info:
                case Display_Mode_Enum.Aggregation_Browse_Map:
                    newRow["browse_hits"] = Convert.ToInt32(newRow["browse_hits"]) + 1;
                    break;

                case Display_Mode_Enum.Search:
                    newRow["advanced_search_hits"] = Convert.ToInt32(newRow["advanced_search_hits"]) + 1;
                    break;

                case Display_Mode_Enum.Results:
                    newRow["results_hits"] = Convert.ToInt32(newRow["results_hits"]) + 1;
                    break;

                default:
                    // Just call this home page then.
                    newRow["home_page_hits"] = Convert.ToInt32(newRow["home_page_hits"]) + 1;
                    break;
            }
        }
        /// <summary> Add the header to the output </summary>
        /// <param name="Output"> Stream to which to write the HTML for this header </param>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="Behaviors"> List of behaviors from the html subwriters </param>
        /// <param name="Current_Aggregation"> Current aggregation object, if there is one </param>
        /// <param name="Current_Item"> Current item object, if there is one </param>
        public static void Add_Footer(TextWriter Output, RequestCache RequestSpecificValues, List <HtmlSubwriter_Behaviors_Enum> Behaviors, Item_Aggregation Current_Aggregation, BriefItemInfo Current_Item)
        {
            // Determine which header and footer to display
            bool useItemFooter = (RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Item_Display) || (RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Item_Print) || ((Behaviors != null) && (Behaviors.Contains(HtmlSubwriter_Behaviors_Enum.MySobek_Subwriter_Mimic_Item_Subwriter)));

            // Get the current contact URL
            Display_Mode_Enum thisMode = RequestSpecificValues.Current_Mode.Mode;

            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Contact;
            string contact = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

            // Restore the old mode
            RequestSpecificValues.Current_Mode.Mode = thisMode;

            // Get the URL options
            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;
            }

            // Create the mySobek text
            string mySobekLinks = create_mysobek_link(RequestSpecificValues, url_options, "staff login");

            // Get the base url
            string base_url = RequestSpecificValues.Current_Mode.Base_URL;

            if (RequestSpecificValues.Current_Mode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)
            {
                base_url = base_url + "l/";
            }

            // Look for the collection code and name
            string collection_code = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Aggregation) ? String.Empty : RequestSpecificValues.Current_Mode.Aggregation;
            string bibid           = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.BibID) ? String.Empty : RequestSpecificValues.Current_Mode.BibID;
            string vid             = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.BibID) ? String.Empty : RequestSpecificValues.Current_Mode.BibID;
            string mode            = String.Empty;

            switch (RequestSpecificValues.Current_Mode.Mode)
            {
            case Display_Mode_Enum.Item_Display:
                mode = "item";
                break;

            case Display_Mode_Enum.Aggregation:
            case Display_Mode_Enum.Search:
                mode = "aggregation";
                break;

            case Display_Mode_Enum.Results:
                mode = "results";
                break;
            }

            // Get the skin url
            string skin_url = RequestSpecificValues.Current_Mode.Base_Design_URL + "skins/" + RequestSpecificValues.HTML_Skin.Skin_Code + "/";

            bool end_div = true;// !((RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Simple_HTML_CMS) && (RequestSpecificValues.Site_Map != null));

            string version = UI_ApplicationCache_Gateway.Settings.Static.Current_Web_Version;

            if (version.IndexOf(" ") > 0)
            {
                version = version.Split(" ".ToCharArray())[0];
            }

            // Get the session id
            string sessionId = HttpContext.Current.Session.SessionID ?? String.Empty;
            string userid    = ((RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.UserID > 0)) ? RequestSpecificValues.Current_User.UserID.ToString() : String.Empty;

            StringBuilder footerBuilder = new StringBuilder();

            if (useItemFooter)
            {
                footerBuilder.Append(RequestSpecificValues.HTML_Skin.Footer_Item_HTML);
            }
            else
            {
                if ((RequestSpecificValues.HTML_Skin.Footer_Has_Container_Directive.HasValue) && (RequestSpecificValues.HTML_Skin.Footer_Has_Container_Directive.Value))
                {
                    footerBuilder.Append(RequestSpecificValues.HTML_Skin.Footer_HTML);
                }
                else
                {
                    footerBuilder.Append(RequestSpecificValues.HTML_Skin.Footer_HTML + Environment.NewLine + "</div>");
                }
            }

            // Make all the replacements
            footerBuilder.Replace("<%COLLCODE%>", collection_code);
            footerBuilder.Replace("<%BIBID%>", bibid);
            footerBuilder.Replace("<%VID%>", vid);
            footerBuilder.Replace("<%MODE%>", mode);
            footerBuilder.Replace("<%MYSOBEK%>", mySobekLinks);
            footerBuilder.Replace("<%CONTACT%>", contact);
            footerBuilder.Replace("<%URLOPTS%>", url_options);
            footerBuilder.Replace("<%?URLOPTS%>", urlOptions1);
            footerBuilder.Replace("<%&URLOPTS%>", urlOptions2);
            footerBuilder.Replace("<%VERSION%>", version);
            footerBuilder.Replace("<%BASEURL%>", base_url);
            footerBuilder.Replace("<%SKINURL%>", skin_url);
            footerBuilder.Replace("<%INSTANCENAME%>", RequestSpecificValues.Current_Mode.Instance_Name);
            footerBuilder.Replace("<%SESSIONID%>", sessionId);
            footerBuilder.Replace("<%USERID%>", userid);
            if ((!useItemFooter) && (RequestSpecificValues.HTML_Skin.Footer_Has_Container_Directive.HasValue) && (RequestSpecificValues.HTML_Skin.Footer_Has_Container_Directive.Value))
            {
                footerBuilder.Replace("<%CONTAINER%>", "</div>");
            }

            // Write this to the stream
            Output.WriteLine(footerBuilder.ToString().Trim());
        }