Esempio n. 1
0
        /// <summary> Writes the HTML generated by this error 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>
        /// <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("Error_HtmlSubwriter.Write_HTML", "Rendering HTML");

            // Start the page container
            Output.WriteLine("<div id=\"pagecontainer\">");
            Output.WriteLine("<br />");

            string url_options = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);

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

            if (invalidItem)
            {
                Output.WriteLine("<span class=\"UfdcGeneralError\">");
                Output.WriteLine("  <br /><br />");
                Output.WriteLine("  The item indicated was not valid.");
                Output.WriteLine("  <br /><br />");

                Output.WriteLine("  Click <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "contact\">here</a> to report an error.");
                Output.WriteLine("  <br /><br /><br /><br />");
                Output.WriteLine("</span>");
                Output.WriteLine();
            }
            else
            {
                Output.WriteLine("<br />");
                Output.WriteLine("<div class=\"SobekHomeText\">");
                Output.WriteLine("<table width=\"700\" border=\"0\" align=\"center\">");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td align=\"center\" >");
                string error_message = "Unknown error occurred";
                if ((RequestSpecificValues.Current_Mode != null) && (!String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Error_Message)))
                {
                    error_message = RequestSpecificValues.Current_Mode.Error_Message;
                }

                Output.WriteLine("      <b><h4>" + error_message + "</h4></b>");
                Output.WriteLine("      <h5>We apologize for the inconvenience.</h5>");
                Output.WriteLine("      <h5>Click <a href=\"" + RequestSpecificValues.Current_Mode.Base_URL + url_options + "\">here</a> to return to the library.</h5>");
                string returnurl = RequestSpecificValues.Current_Mode.Base_URL + "contact?em=" + error_message.Replace(" ", "%20") + UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);
                Output.WriteLine("      <h5>Click <a href=\"" + returnurl + "\">here</a> to report the problem.</h5>");
                Output.WriteLine("    </td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("</table>");
                Output.WriteLine("<br /><br />");
                Output.WriteLine("</div>");
            }

            Output.WriteLine("<!-- Close the pagecontainer div -->");
            Output.WriteLine("</div>");
            Output.WriteLine();

            return(true);
        }
Esempio n. 2
0
        private string compute_text_redirect_stem()
        {
            // Split the parts
            List <string> terms  = new List <string>();
            List <string> fields = new List <string>();

            // Split the terms correctly
            SobekCM_Assistant.Split_Clean_Search_Terms_Fields(RequestSpecificValues.Current_Mode.Search_String, RequestSpecificValues.Current_Mode.Search_Fields, RequestSpecificValues.Current_Mode.Search_Type, terms, fields, UI_ApplicationCache_Gateway.Search_Stop_Words, RequestSpecificValues.Current_Mode.Search_Precision, ',');

            // See about a text search string
            StringBuilder textSearcher = new StringBuilder();

            // Step through each term and field
            bool text_included_in_search = false;

            for (int i = 0; (i < terms.Count) && (i < fields.Count); i++)
            {
                if ((fields[i].Length > 1) && (terms[i].Length > 1))
                {
                    // If this is either for ANYWHERE or for TEXT, include it
                    if (((fields[i].IndexOf("TX") >= 0) || (fields[i].IndexOf("ZZ") >= 0)) && (fields[i][0] != '-'))
                    {
                        if (textSearcher.Length > 0)
                        {
                            textSearcher.Append("+=" + terms[i].Replace("\"", "%22"));
                        }
                        else
                        {
                            textSearcher.Append(terms[i].Replace("\"", "%22"));
                        }
                    }

                    // See if this was explicitly a search against full text
                    if (fields[i].IndexOf("TX") >= 0)
                    {
                        text_included_in_search = true;
                    }
                }
            }

            string url_options = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);

            if (!String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Coordinates))
            {
                return((url_options.Length > 0) ? "?coord=" + RequestSpecificValues.Current_Mode.Coordinates + "&" + url_options : "?coord=" + RequestSpecificValues.Current_Mode.Coordinates);
            }

            if (textSearcher.Length > 0)
            {
                if ((RequestSpecificValues.Current_Mode.Search_Type == Search_Type_Enum.Full_Text) || (text_included_in_search))
                {
                    return((url_options.Length > 0) ? "/search?search=" + textSearcher + "&" + url_options :  "/search?search=" + textSearcher);
                }

                return((url_options.Length > 0) ? "?search=" + textSearcher + "&" + url_options : "?search=" + textSearcher);
            }
            return((url_options.Length > 0) ?  "?" + url_options :  String.Empty);
        }
Esempio n. 3
0
        private string compute_image_redirect_stem()
        {
            string url_options = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);

            if (!String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Coordinates))
            {
                return((url_options.Length > 0) ? "?coord=" + RequestSpecificValues.Current_Mode.Coordinates + "&" + url_options : "?coord=" + RequestSpecificValues.Current_Mode.Coordinates);
            }

            return((url_options.Length > 0) ? "?" + url_options : String.Empty);
        }
        /// <summary> Adds the banner to the response stream from either the html web skin
        /// or from the current item aggreagtion object, depending on flags in the web skin object </summary>
        /// <param name="Output"> Stream to which to write the HTML for the banner </param>
        /// <param name="Banner_Division_Name"> Name for the wrapper division around the banner </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="Web_Page_Title"> Web page title to add behind the banner image </param>
        /// <param name="CurrentMode"> Mode / navigation information for the current request</param>
        /// <remarks> This is called by several html subwriters that otherwise tell this class to suppress writing the banner </remarks>
        public static void Add_Banner(TextWriter Output, string Banner_Division_Name, string Web_Page_Title, Navigation_Object CurrentMode, Web_Skin_Object HTML_Skin, Item_Aggregation Hierarchy_Object)
        {
            Output.WriteLine("<!-- abstractHtmlSubwriter.Add_Banner - Write the main collection, interface, or institution banner -->");

            if ((HTML_Skin != null) && (HTML_Skin.Override_Banner.HasValue) && (HTML_Skin.Override_Banner.Value))
            {
                if (!String.IsNullOrEmpty(HTML_Skin.Banner_HTML))
                {
                    Output.WriteLine(HTML_Skin.Banner_HTML);
                }
            }
            else
            {
                string url_options = UrlWriterHelper.URL_Options(CurrentMode);
                if (url_options.Length > 0)
                {
                    url_options = "?" + url_options;
                }

                if ((Hierarchy_Object != null) && (Hierarchy_Object.Code != "all"))
                {
                    Output.WriteLine("<section id=\"sbkAhs_BannerDiv\" role=\"banner\" title=\"" + Hierarchy_Object.ShortName + "\">");
                    Output.WriteLine("  <h1 class=\"hidden-element\">" + Web_Page_Title + "</h1>");
                    Output.WriteLine("  <a alt=\"" + Hierarchy_Object.ShortName + "\" href=\"" + CurrentMode.Base_URL + Hierarchy_Object.Code + url_options + "\"><img id=\"mainBanner\" src=\"" + CurrentMode.Base_URL + Hierarchy_Object.Get_Banner_Image(HTML_Skin) + "\"  alt=\"" + Hierarchy_Object.ShortName + "\" /></a>");
                    Output.WriteLine("</section>");
                }
                else
                {
                    if ((Hierarchy_Object != null) && (Hierarchy_Object.Get_Banner_Image(HTML_Skin).Length > 0))
                    {
                        Output.WriteLine("<section id=\"sbkAhs_BannerDiv\" role=\"banner\" title=\"" + Hierarchy_Object.ShortName + "\">");
                        Output.WriteLine("  <h1 class=\"hidden-element\">" + Web_Page_Title + "</h1>");
                        Output.WriteLine("  <a alt=\"" + Hierarchy_Object.ShortName + "\" href=\"" + CurrentMode.Base_URL + url_options + "\"><img id=\"mainBanner\" src=\"" + CurrentMode.Base_URL + Hierarchy_Object.Get_Banner_Image(HTML_Skin) + "\"  alt=\"" + Hierarchy_Object.ShortName + "\" /></a>");
                        Output.WriteLine("</section>");
                    }
                    else
                    {
                        string skin_url = CurrentMode.Base_Design_URL + "skins/" + CurrentMode.Skin + "/";
                        Output.WriteLine("<section id=\"sbkAhs_BannerDiv\" role=\"banner\"><h1 class=\"hidden-element\">" + Web_Page_Title + "</h1><a href=\"" + CurrentMode.Base_URL + url_options + "\"><img id=\"mainBanner\" src=\"" + skin_url + "default.jpg\" alt=\"\" /></a></section>");
                    }
                }
            }

            Output.WriteLine();
        }
Esempio n. 5
0
        /// <summary> Write the item wordmarks to the item display html</summary>
        /// <param name="Output"> Stream to which to write </param>
        /// <param name="Prototyper"> Current item viewer prototyper </param>
        /// <param name="CurrentViewer"> Current item viewer which will be used to fill the primary part of the page </param>
        /// <param name="CurrentItem"> Current item which is being displayed </param>
        /// <param name="RequestSpecificValues"> Other, request specific values, such as the current mode, user, etc.. </param>
        /// <param name="Behaviors"> Behaviors for the current view and situation </param>
        public void Write_HTML(TextWriter Output, iItemViewerPrototyper Prototyper, iItemViewer CurrentViewer, BriefItemInfo CurrentItem, RequestCache RequestSpecificValues, List <HtmlSubwriter_Behaviors_Enum> Behaviors)
        {
            // Add any wordmarks
            if ((CurrentItem.Behaviors.Wordmarks != null) && (CurrentItem.Behaviors.Wordmarks.Count > 0))
            {
                Output.WriteLine("\t<div id=\"sbkIsw_Wordmarks\">");

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

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

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

                Output.WriteLine("\t</div>");
            }
            //else
            //{
            //    Output.WriteLine("\t<div id=\"sbkIsw_NoWordmarks\">&nbsp;</div>");
            //}
        }
        /// <summary> Add the HTML to be displayed below the search box </summary>
        /// <param name="Output"> Textwriter to write the HTML for this viewer</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This writes the HTML from the static browse or info page here  </remarks>
        public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Metadata_Browse_AggregationViewer.Add_Secondary_HTML", "Adding HTML");
            }

            // Get collection of (public) browse bys linked to this aggregation
            ReadOnlyCollection <Item_Aggregation_Child_Page> public_browses = ViewBag.Hierarchy_Object.Browse_By_Pages;

            // Determine if this is an internal user and create list of internal user browses
            List <string> internal_browses = new List <string>();

            if ((RequestSpecificValues.Current_User != null) && ((RequestSpecificValues.Current_User.Is_Internal_User) || (RequestSpecificValues.Current_User.Is_Aggregation_Curator(RequestSpecificValues.Current_Mode.Aggregation))))
            {
                // Just add every metadata field here
                foreach (Item_Aggregation_Metadata_Type field in ViewBag.Hierarchy_Object.Browseable_Fields)
                {
                    internal_browses.Add(field.DisplayTerm);
                }
            }

            // Retain the original short code (or the first public code)
            string original_browse_mode = RequestSpecificValues.Current_Mode.Info_Browse_Mode.ToLower();

            // Get any paging URL and retain original page
            int current_page = RequestSpecificValues.Current_Mode.Page.HasValue ? RequestSpecificValues.Current_Mode.Page.Value : 1;

            RequestSpecificValues.Current_Mode.Page = 1;
            string page_url    = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode, false);
            string url_options = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);

            if (url_options.Length > 0)
            {
                url_options = "?" + url_options.Replace("&", "&amp");
            }

            if ((public_browses.Count > 1) || (internal_browses.Count > 0))
            {
                Output.WriteLine("<table>");
                Output.WriteLine("<tr style=\"vertical-align:top;\">");
                Output.WriteLine("<td id=\"sbkMebv_FacetOuterColumn\">");
                Output.WriteLine("<div class=\"sbkMebv_FacetColumn\">");
                Output.WriteLine("<div class=\"sbkMebv_FacetColumnTitle\">BROWSE BY:</div>");
                Output.WriteLine("<br />");

                if (public_browses.Count > 0)
                {
                    // Sort these by title
                    SortedList <string, Item_Aggregation_Child_Page> sortedBrowses = new SortedList <string, Item_Aggregation_Child_Page>();
                    foreach (Item_Aggregation_Child_Page thisBrowse in public_browses)
                    {
                        if (thisBrowse.Source_Data_Type == Item_Aggregation_Child_Source_Data_Enum.Static_HTML)
                        {
                            sortedBrowses[thisBrowse.Code.ToLower()] = thisBrowse;
                        }
                        else
                        {
                            Metadata_Search_Field facetField = UI_ApplicationCache_Gateway.Settings.Metadata_Search_Field_By_Name(thisBrowse.Code);
                            if (facetField != null)
                            {
                                string facetName = facetField.Display_Term;

                                if (internal_browses.Contains(facetName))
                                {
                                    internal_browses.Remove(facetName);
                                }

                                sortedBrowses[facetName.ToLower()] = thisBrowse;
                            }
                        }
                    }

                    Output.WriteLine(internal_browses.Count > 0 ? "<b> &nbsp;Public Browses</b><br />" : "<b> &nbsp;Browses</b><br />");

                    Output.WriteLine("<div class=\"sbkMebv_FacetBox\">");
                    foreach (Item_Aggregation_Child_Page thisBrowse in sortedBrowses.Values)
                    {
                        // Static HTML or metadata browse by?
                        if (thisBrowse.Source_Data_Type == Item_Aggregation_Child_Source_Data_Enum.Static_HTML)
                        {
                            if (original_browse_mode != thisBrowse.Code)
                            {
                                RequestSpecificValues.Current_Mode.Info_Browse_Mode = thisBrowse.Code;
                                Output.WriteLine("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode).Replace("&", "&amp") + "\">" + thisBrowse.Label + "</a><br />");
                            }
                            else
                            {
                                Output.WriteLine(thisBrowse.Label + "<br />");
                            }
                        }
                        else
                        {
                            Metadata_Search_Field facetField = UI_ApplicationCache_Gateway.Settings.Metadata_Search_Field_By_Display_Name(thisBrowse.Code);
                            if (thisBrowse.Code.ToLower().Replace("_", " ") != original_browse_mode.Replace("_", " "))
                            {
                                RequestSpecificValues.Current_Mode.Info_Browse_Mode = thisBrowse.Code.ToLower().Replace(" ", "_");
                                Output.WriteLine("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode).Replace("&", "&amp") + "\">" + facetField.Display_Term + "</a><br />");
                            }
                            else
                            {
                                Output.WriteLine(facetField.Display_Term + "<br />");
                            }
                        }
                    }

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

                if (internal_browses.Count > 0)
                {
                    Output.WriteLine("<b> &nbsp;Internal Browses</b><br />");
                    Output.WriteLine("<div class=\"sbkMebv_FacetBox\">");

                    foreach (string thisShort in internal_browses)
                    {
                        Metadata_Search_Field facetField = UI_ApplicationCache_Gateway.Settings.Metadata_Search_Field_By_Facet_Name(thisShort);
                        if (facetField != null)
                        {
                            if (thisShort.ToLower() != original_browse_mode)
                            {
                                RequestSpecificValues.Current_Mode.Info_Browse_Mode = thisShort.ToLower().Replace(" ", "_");
                                Output.WriteLine("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode).Replace("&", "&amp") + "\">" + facetField.Display_Term + "</a><br />");
                            }
                            else
                            {
                                Output.WriteLine(facetField.Display_Term + "<br />");
                            }
                        }
                    }

                    Output.WriteLine("</div>");
                    Output.WriteLine("<br />");
                }
                Output.WriteLine("<br />");
                Output.WriteLine("<br />");
                Output.WriteLine("<br />");
                Output.WriteLine("<br />");
                Output.WriteLine("<br />");
                Output.WriteLine("</div>");
                Output.WriteLine("</td>");
                Output.WriteLine("<td>");
            }
            Output.WriteLine("<div class=\"sbkMebv_ResultsPanel\" id=\"main-content\" role=\"main\">");

            RequestSpecificValues.Current_Mode.Info_Browse_Mode = original_browse_mode;

            // Was this static or metadata browse by?
            if ((browseObject != null) && (browseObject.Source_Data_Type == Item_Aggregation_Child_Source_Data_Enum.Static_HTML))
            {
                // Read the content file for this browse
                string             source_file         = UI_ApplicationCache_Gateway.Settings.Servers.Base_Design_Location + ViewBag.Hierarchy_Object.ObjDirectory.Replace("/", "\\") + browseObject.Source;
                HTML_Based_Content staticBrowseContent = HTML_Based_Content_Reader.Read_HTML_File(source_file, true, Tracer);
                if (staticBrowseContent == null)
                {
                    staticBrowseContent = new HTML_Based_Content("Unable to find source file!\n\n" + ViewBag.Hierarchy_Object.ObjDirectory.Replace("/", "\\") + browseObject.Source, browseObject.Code);
                }

                // Apply current user settings for this
                string browseInfoDisplayText = staticBrowseContent.Apply_Settings_To_Static_Text(staticBrowseContent.Content, ViewBag.Hierarchy_Object, RequestSpecificValues.HTML_Skin.Skin_Code, RequestSpecificValues.HTML_Skin.Base_Skin_Code, RequestSpecificValues.Current_Mode.Base_URL, UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode), Tracer);

                // Is this an admin?
                bool isAdmin = (RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.Is_Aggregation_Admin(ViewBag.Hierarchy_Object.Code));
                Aggregation_Type_Enum aggrType = RequestSpecificValues.Current_Mode.Aggregation_Type;

                // Output the adjusted home html
                if (isAdmin)
                {
                    Output.WriteLine("<div id=\"sbkSbia_MainTextEditable\">");
                    Output.WriteLine(browseInfoDisplayText);
                    RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Child_Page_Edit;
                    Output.WriteLine("  <div id=\"sbkSbia_EditableTextLink\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\" title=\"Edit this page's text\"><img src=\"" + Static_Resources_Gateway.Edit_Gif + "\" alt=\"\" />edit content</a></div>");
                    RequestSpecificValues.Current_Mode.Aggregation_Type = aggrType;
                    Output.WriteLine("</div>");
                    Output.WriteLine();

                    Output.WriteLine("<script>");
                    Output.WriteLine("  $(\"#sbkSbia_MainTextEditable\").mouseover(function() { $(\"#sbkSbia_EditableTextLink\").css(\"display\",\"inline-block\"); });");
                    Output.WriteLine("  $(\"#sbkSbia_MainTextEditable\").mouseout(function() { $(\"#sbkSbia_EditableTextLink\").css(\"display\",\"none\"); });");
                    Output.WriteLine("</script>");
                    Output.WriteLine();
                }
                else
                {
                    Output.WriteLine("<div id=\"sbkSbia_MainText\">");
                    Output.WriteLine(browseInfoDisplayText);
                    Output.WriteLine("</div>");
                }
            }
            else
            {
                //Output the results
                if ((results != null) && (results.Count > 0))
                {
                    // Determine which letters appear
                    List <char> letters_appearing = new List <char>();
                    char        last_char         = '\n';
                    if (results.Count > 100)
                    {
                        foreach (string thisValue in results)
                        {
                            if (thisValue.Length > 0)
                            {
                                char this_first_char = Char.ToLower(thisValue[0]);
                                int  ascii           = this_first_char;

                                if (ascii < 97)
                                {
                                    this_first_char = 'a';
                                }
                                if (ascii > 122)
                                {
                                    this_first_char = 'z';
                                }

                                if (this_first_char != last_char)
                                {
                                    if (!letters_appearing.Contains(this_first_char))
                                    {
                                        letters_appearing.Add(this_first_char);
                                    }
                                    last_char = this_first_char;
                                }
                            }
                        }
                    }

                    // Get the search URL
                    RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Results;
                    RequestSpecificValues.Current_Mode.Search_Precision = Search_Precision_Type_Enum.Exact_Match;
                    RequestSpecificValues.Current_Mode.Search_Type      = Search_Type_Enum.Advanced;
                    Metadata_Search_Field facetField = UI_ApplicationCache_Gateway.Settings.Metadata_Search_Field_By_Display_Name(original_browse_mode);
                    RequestSpecificValues.Current_Mode.Search_Fields = facetField.Web_Code;
                    RequestSpecificValues.Current_Mode.Search_String = "\"<%TERM%>\"";
                    string search_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);

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

                    if (results.Count < 100)
                    {
                        foreach (string thisResult in results)
                        {
                            Output.WriteLine("<a href=\"" + search_url.Replace("%3c%25TERM%25%3e", thisResult.Trim().Replace(",", "%2C").Replace("&", "%26").Replace("\"", "%22").Replace("&", "&amp")) + "\">" + thisResult.Replace("\"", "&quot;").Replace("&", "&amp;") + "</a><br />");
                        }
                    }
                    else if (results.Count < 500)
                    {
                        // Determine the actual page first
                        int first_valid_page = -1;
                        if ((letters_appearing.Contains('a')) || (letters_appearing.Contains('b')))
                        {
                            first_valid_page = 1;
                        }

                        if ((letters_appearing.Contains('c')) || (letters_appearing.Contains('d')) || (letters_appearing.Contains('e')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 2;
                            }
                        }

                        if ((letters_appearing.Contains('f')) || (letters_appearing.Contains('g')) || (letters_appearing.Contains('h')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 3;
                            }
                        }

                        if ((letters_appearing.Contains('i')) || (letters_appearing.Contains('j')) || (letters_appearing.Contains('k')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 4;
                            }
                        }

                        if ((letters_appearing.Contains('l')) || (letters_appearing.Contains('m')) || (letters_appearing.Contains('n')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 5;
                            }
                        }

                        if ((letters_appearing.Contains('o')) || (letters_appearing.Contains('p')) || (letters_appearing.Contains('q')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 6;
                            }
                        }

                        if ((letters_appearing.Contains('r')) || (letters_appearing.Contains('s')) || (letters_appearing.Contains('t')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 7;
                            }
                        }

                        if ((letters_appearing.Contains('u')) || (letters_appearing.Contains('v')) || (letters_appearing.Contains('w')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 8;
                            }
                        }

                        if ((letters_appearing.Contains('x')) || (letters_appearing.Contains('y')) || (letters_appearing.Contains('z')))
                        {
                            if (first_valid_page < 0)
                            {
                                first_valid_page = 9;
                            }
                        }

                        // Define the limits of the page value
                        if ((current_page < first_valid_page) || (current_page > 9))
                        {
                            current_page = first_valid_page;
                        }


                        // Add the links for paging through results
                        Output.WriteLine("<div class=\"sbkMebv_NavRow\">");
                        if ((letters_appearing.Contains('a')) || (letters_appearing.Contains('b')))
                        {
                            if (current_page == 1)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">AB</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/1" + url_options + "\" class=\"mbb1\">AB</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">AB</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('c')) || (letters_appearing.Contains('d')) || (letters_appearing.Contains('e')))
                        {
                            if (current_page == 2)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">CDE</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/2" + url_options + "\">CDE</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">CDE</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('f')) || (letters_appearing.Contains('g')) || (letters_appearing.Contains('h')))
                        {
                            if (current_page == 3)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">FGH</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/3" + url_options + "\">FGH</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">FGH</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('i')) || (letters_appearing.Contains('j')) || (letters_appearing.Contains('k')))
                        {
                            if (current_page == 4)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">IJK</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/4" + url_options + "\">IJK</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">IJK</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('l')) || (letters_appearing.Contains('m')) || (letters_appearing.Contains('n')))
                        {
                            if (current_page == 5)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">LMN</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/5" + url_options + "\">LMN</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">LMN</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('o')) || (letters_appearing.Contains('p')) || (letters_appearing.Contains('q')))
                        {
                            if (current_page == 6)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">OPQ</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/6" + url_options + "\">OPQ</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">OPQ</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('r')) || (letters_appearing.Contains('s')) || (letters_appearing.Contains('t')))
                        {
                            if (current_page == 7)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">RST</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/7" + url_options + "\">RST</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">RST</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('u')) || (letters_appearing.Contains('v')) || (letters_appearing.Contains('w')))
                        {
                            if (current_page == 8)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">UVW</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/8" + url_options + "\">UVW</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">UVW</span> &nbsp; ");
                        }

                        if ((letters_appearing.Contains('x')) || (letters_appearing.Contains('y')) || (letters_appearing.Contains('z')))
                        {
                            if (current_page == 9)
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">XYZ</span> &nbsp; ");
                            }
                            else
                            {
                                Output.WriteLine("<a href=\"" + page_url + "/9" + url_options + "\">XYZ</a> &nbsp; ");
                            }
                        }
                        else
                        {
                            Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\" >XYZ</span> &nbsp; ");
                        }

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

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



                        // Find the start character and last character, per the page
                        char first_char = ' ';
                        char stop_char  = 'c';
                        switch (current_page)
                        {
                        case 2:
                            first_char = 'c';
                            stop_char  = 'f';
                            break;

                        case 3:
                            first_char = 'f';
                            stop_char  = 'i';
                            break;

                        case 4:
                            first_char = 'i';
                            stop_char  = 'l';
                            break;

                        case 5:
                            first_char = 'l';
                            stop_char  = 'o';
                            break;

                        case 6:
                            first_char = 'o';
                            stop_char  = 'r';
                            break;

                        case 7:
                            first_char = 'r';
                            stop_char  = 'u';
                            break;

                        case 8:
                            first_char = 'u';
                            stop_char  = 'x';
                            break;

                        case 9:
                            first_char = 'x';
                            stop_char  = '}';
                            break;
                        }

                        // Add the pertinent rows
                        foreach (string thisValue in results)
                        {
                            if (thisValue.Length > 0)
                            {
                                char this_first_char = Char.ToLower(thisValue[0]);
                                if ((this_first_char >= first_char) && (this_first_char < stop_char))
                                {
                                    Output.WriteLine("<a href=\"" + search_url.Replace("%3c%25TERM%25%3e", thisValue.Trim().Replace(",", "%2C").Replace("&", "%26").Replace("\"", "%22")).Replace("&", "&amp;") + "\">" + thisValue.Replace("\"", "&quot;").Replace("&", "&amp;") + "</a><br />");
                                }
                            }
                        }
                    }
                    else
                    {
                        // Determine the first valid page
                        char label_char       = 'a';
                        int  first_valid_page = -1;
                        int  counter          = 1;
                        while (label_char <= 'z')
                        {
                            if (letters_appearing.Contains(label_char))
                            {
                                if (first_valid_page < 0)
                                {
                                    first_valid_page = counter;
                                }
                            }

                            counter++;
                            label_char = (char)((label_char) + 1);
                        }

                        // Define the limits of the page value
                        if ((current_page < first_valid_page) || (current_page > 26))
                        {
                            current_page = first_valid_page;
                        }


                        // Add the links for paging through results
                        label_char = 'a';
                        counter    = 1;
                        Output.WriteLine("<div class=\"sbkMebv_NavRow\">");
                        while (label_char <= 'z')
                        {
                            if (letters_appearing.Contains(label_char))
                            {
                                if (current_page == counter)
                                {
                                    Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">" + Char.ToUpper(label_char) + "</span>&nbsp;");
                                }
                                else
                                {
                                    Output.WriteLine("<a href=\"" + page_url + "/" + counter + url_options + "\" >" + Char.ToUpper(label_char) + "</a>&nbsp;");
                                }
                            }
                            else
                            {
                                Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\" >" + Char.ToUpper(label_char) + "</span>&nbsp;");
                            }

                            counter++;
                            label_char = (char)((label_char) + 1);
                        }
                        Output.WriteLine("</div>");

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

                        // Find the start character and last character, per the page
                        char first_char = ' ';
                        char stop_char  = 'b';
                        if (current_page > 1)
                        {
                            first_char = (char)(96 + current_page);
                            stop_char  = (char)(97 + current_page);
                        }


                        // Add the pertinent rows
                        foreach (string thisValue in results)
                        {
                            if (thisValue.Length > 0)
                            {
                                char this_first_char = Char.ToLower(thisValue[0]);
                                if ((this_first_char >= first_char) && (this_first_char < stop_char))
                                {
                                    Output.WriteLine("<a href=\"" + search_url.Replace("%3c%25TERM%25%3e", thisValue.Trim().Replace(",", "%2C").Replace("&", "%26").Replace("\"", "%22")).Replace("&", "&amp;") + "\">" + thisValue.Replace("\"", "&quot;").Replace("&", "&amp;") + "</a><br />");
                                }
                            }
                        }
                    }
                }
                else
                {
                    Output.WriteLine("<br /><br /><br /><br />");
                    Output.WriteLine(RequestSpecificValues.Current_Mode.Info_Browse_Mode.Length == 0 ? "<center>Select a metadata field to browse by from the list on the left</center>" : "<center>NO MATCHING VALUES</center>");
                    Output.WriteLine("<br /><br />");
                }
            }

            // Set the current mode back
            RequestSpecificValues.Current_Mode.Mode             = Display_Mode_Enum.Aggregation;
            RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_By;

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

            if ((public_browses.Count > 1) || (internal_browses.Count > 0))
            {
                Output.WriteLine("</td>");
                Output.WriteLine("</tr>");
                Output.WriteLine("</table>");
            }
            Output.WriteLine();
        }
        /// <summary> Add the HTML to be displayed below the search box </summary>
        /// <param name="Output"> Textwriter to write the HTML for this viewer</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This adds the search tips by calling the base method <see cref="abstractAggregationViewer.Add_Simple_Search_Tips"/> </remarks>
        public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Custom_Home_Page_AggregationViewer.Add_Secondary_HTML", "Add the entire custom page, doing suitable replacements");
            }

            // Do all the replacements
            string        text          = ViewBag.Hierarchy_Object.HomePageHtml.Content; //.Content;
            StringBuilder textToDisplay = new StringBuilder(text);

            // Determine if certain (more costly) replacements are even needed
            bool header_replacement_needed = text.IndexOf("%HEADER%") > 0;
            bool footer_replacement_needed = text.IndexOf("%FOOTER%") > 0;
            bool menu_replacement_needed   = text.IndexOf("%MAINMENU%") > 0;

            // If necessary, replace the header
            if (header_replacement_needed)
            {
                StringBuilder headerBuilder = new StringBuilder();
                StringWriter  headerWriter  = new StringWriter(headerBuilder);
                HeaderFooter_Helper_HtmlSubWriter.Add_Header(headerWriter, RequestSpecificValues, "container-inner-custom", ViewBag.Hierarchy_Object.ShortName, null, ViewBag.Hierarchy_Object, null);
                string header = headerBuilder.ToString();
                textToDisplay = textToDisplay.Replace("<%HEADER%>", header).Replace("[%HEADER%]", header);
            }

            // If necessary, replace the footer
            if (footer_replacement_needed)
            {
                StringBuilder footerBuilder = new StringBuilder();
                StringWriter  footerWriter  = new StringWriter(footerBuilder);
                HeaderFooter_Helper_HtmlSubWriter.Add_Footer(footerWriter, RequestSpecificValues, null, ViewBag.Hierarchy_Object, null);
                string footer = footerBuilder.ToString();
                textToDisplay = textToDisplay.Replace("<%FOOTER%>", footer).Replace("[%FOOTER%]", footer);
            }

            // If necessary, insert the main menu
            if (menu_replacement_needed)
            {
                StringBuilder menuBuilder = new StringBuilder();
                StringWriter  menuWriter  = new StringWriter(menuBuilder);
                MainMenus_Helper_HtmlSubWriter.Add_Aggregation_Main_Menu(menuWriter, RequestSpecificValues, ViewBag.Hierarchy_Object);
                string menu = menuBuilder.ToString();
                textToDisplay = textToDisplay.Replace("<%MAINMENU%>", menu).Replace("[%MAINMENU%]", menu);
            }

            // Determine the different counts as strings
            string page_count  = "0";
            string item_count  = "0";
            string title_count = "0";

            if (ViewBag.Hierarchy_Object.Statistics != null)
            {
                page_count  = Int_To_Comma_String(ViewBag.Hierarchy_Object.Statistics.Page_Count);
                item_count  = Int_To_Comma_String(ViewBag.Hierarchy_Object.Statistics.Item_Count);
                title_count = Int_To_Comma_String(ViewBag.Hierarchy_Object.Statistics.Title_Count);
            }

            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;
            }

            string home_text = textToDisplay.ToString().Replace("<%BASEURL%>", RequestSpecificValues.Current_Mode.Base_URL).Replace("<%URLOPTS%>", url_options).Replace("<%?URLOPTS%>", urlOptions1).Replace("<%&URLOPTS%>", urlOptions2).Replace("<%INTERFACE%>", RequestSpecificValues.Current_Mode.Base_Skin_Or_Skin).Replace("<%WEBSKIN%>", RequestSpecificValues.Current_Mode.Base_Skin_Or_Skin).Replace("<%PAGES%>", page_count).Replace("<%ITEMS%>", item_count).Replace("<%TITLES%>", title_count);


            Output.Write(home_text);
        }
Esempio n. 8
0
        /// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("HTML_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Save the current viewer code
            string current_view_code = CurrentRequest.ViewerCode;

            // Start the citation table
            Output.WriteLine("\t\t<!-- HTML VIEWER OUTPUT -->");
            Output.WriteLine("\t\t<td style=\"align:left;\">");

            // Determine some replacement strings here
            string itemURL  = SobekFileSystem.Resource_Web_Uri(BriefItem);
            string itemLink = CurrentRequest.Base_URL + "/" + BriefItem.BibID + "/" + BriefItem.VID;

            // Determine the source string
            string sourceString = SobekFileSystem.Resource_Web_Uri(BriefItem) + htmlFile;

            if ((htmlFile.IndexOf("http://") == 0) || (htmlFile.IndexOf("https://") == 0) || (htmlFile.IndexOf("[%BASEURL%]") == 0) || (htmlFile.IndexOf("<%BASEURL%>") == 0))
            {
                sourceString = htmlFile.Replace("[%BASEURL%]", CurrentRequest.Base_URL).Replace("<%BASEURL%>", CurrentRequest.Base_URL);
            }

            // Try to get the HTML for this
            if (Tracer != null)
            {
                Tracer.Add_Trace("HTML_ItemViewer.Write_Main_Viewer_Section", "Reading html for this view from static page");
            }
            string map;

            try
            {
                map = SobekFileSystem.ReadToEnd(BriefItem, sourceString);
            }
            catch
            {
                StringBuilder builder = new StringBuilder();
                builder.AppendLine("<div style=\"background-color: White; color: black;text-align:center; width:630px;\">");
                builder.AppendLine("  <br /><br />");
                builder.AppendLine("  <span style=\"font-weight:bold;font-size:1.4em\">Unable to pull html view for item ( <a href=\"" + sourceString + "\">source</a> )</span><br /><br />");
                builder.AppendLine("  <span style=\"font-size:1.2em\">We apologize for the inconvenience.</span><br /><br />");

                string returnurl = CurrentRequest.Base_URL + "/contact";
                builder.AppendLine("  <span style=\"font-size:1.2em\">Click <a href=\"" + returnurl + "\">here</a> to report the problem.</span>");
                builder.AppendLine("  <br /><br />");
                builder.AppendLine("</div>");
                map = builder.ToString();
            }

            // Write the HTML
            string url_options = UrlWriterHelper.URL_Options(CurrentRequest);
            string urlOptions1 = String.Empty;
            string urlOptions2 = String.Empty;

            if (url_options.Length > 0)
            {
                urlOptions1 = "?" + url_options;
                urlOptions2 = "&" + url_options;
            }
            Output.WriteLine(map.Replace("<%URLOPTS%>", url_options).Replace("<%?URLOPTS%>", urlOptions1).Replace("<%&URLOPTS%>", urlOptions2).Replace("<%ITEMURL%>", itemURL).Replace("<%ITEM_LINK%>", itemLink));

            // Finish the table
            Output.WriteLine("\t\t</td>");
            Output.WriteLine("\t\t<!-- END HTML VIEWER OUTPUT -->");

            // Restore the mode
            CurrentRequest.ViewerCode = current_view_code;
        }
Esempio n. 9
0
        /// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Text_Search_ItemViewer.Write_Main_Viewer_Section", "");
            }

            string search_this_document = "Search this document";

            if (CurrentRequest.Language == Web_Language_Enum.French)
            {
                search_this_document = "Rechercher sur ce Document";
            }

            if (CurrentRequest.Language == Web_Language_Enum.Spanish)
            {
                search_this_document = "Buscar en este Objeto";
            }

            // Save the original search string
            string originalSearchString = CurrentRequest.Text_Search;

            Output.WriteLine("       <!-- TEXT SEARCH ITEM VIEWER OUTPUT -->");

            // Determine the value without any search
            string currentSearch = CurrentRequest.Text_Search;

            CurrentRequest.Text_Search = String.Empty;
            string redirect_url = UrlWriterHelper.Redirect_URL(CurrentRequest);

            CurrentRequest.Text_Search = currentSearch;
            string button_text = String.Empty;

            // Makee sure the search is not null
            if (String.IsNullOrWhiteSpace(currentSearch))
            {
                currentSearch = String.Empty;
            }

            // Add the search this document portion
            Output.WriteLine("    <td style=\"text-align:center;\">");
            Output.WriteLine("      <div style=\"padding:10px 0 10px 0;\" >");
            Output.WriteLine("        <label for=\"searchTextBox\">" + search_this_document + ":</label> &nbsp;");
            Output.WriteLine("        <input class=\"sbkTsv_SearchBox sbkIsw_Focusable\" id=\"searchTextBox\" name=\"searchTextBox\" type=\"text\" value=\"" + currentSearch.Replace(" =", " or ") + "\" onkeydown=\"item_search_keytrap(event, '" + redirect_url + "');\" /> &nbsp; ");
            Output.WriteLine("        <button title=\"" + search_this_document + "\" class=\"sbkIsw_RoundButton\" onclick=\"item_search_sobekcm('" + redirect_url + "'); return false;\">GO<img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"roundbutton_img_right\" alt=\"\" /></button>");
            Output.WriteLine("      </div>");
            if (results != null)
            {
                // Display the explanation string, and possibly paging options if there are more results
                Output.WriteLine("      <hr id=\"sbkTsv_HorizontalLine\">");
                Output.WriteLine("    </td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td style=\"text-align:center;\">");
                Output.WriteLine("      <div id=\"sbkTsv_CurrentSearch\">");
                Output.WriteLine(Compute_Search_Explanation());
                Output.WriteLine("</div>");

                if (results.TotalResults > 20)
                {
                    int current_page = CurrentRequest.SubPage.HasValue ? Math.Max(CurrentRequest.SubPage.Value, ((ushort)1)) : 1;

                    string first_page         = "First Page";
                    string previous_page      = "Previous Page";
                    string next_page          = "Next Page";
                    string last_page          = "Last Page";
                    string first_page_text    = "First";
                    string previous_page_text = "Previous";
                    string next_page_text     = "Next";
                    string last_page_text     = "Last";

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

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

                    // Use a stringbuilder here
                    StringBuilder buttonWriter = new StringBuilder(2000);

                    buttonWriter.AppendLine("            <div class=\"sbkIsw_PageNavBar\">");

                    // Should the first and previous buttons be shown?
                    if (current_page > 1)
                    {
                        // Get the URL for the first and previous buttons
                        CurrentRequest.SubPage = 1;
                        string firstButtonURL = UrlWriterHelper.Redirect_URL(CurrentRequest);
                        CurrentRequest.SubPage = (ushort)(current_page - 1);
                        string prevButtonURL = UrlWriterHelper.Redirect_URL(CurrentRequest);

                        buttonWriter.AppendLine("              <span class=\"sbkIsw_LeftPaginationButtons\">");
                        buttonWriter.AppendLine("                <button title=\"" + first_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + firstButtonURL + "'; return false;\"><img src=\"" + Static_Resources_Gateway.Button_First_Arrow_Png + "\" class=\"roundbutton_img_left\" alt=\"\" />" + first_page_text + "</button>&nbsp;");
                        buttonWriter.AppendLine("                <button title=\"" + previous_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + prevButtonURL + "'; return false;\"><img src=\"" + Static_Resources_Gateway.Button_Previous_Arrow_Png + "\" class=\"roundbutton_img_left\" alt=\"\" />" + previous_page_text + "</button>");
                        buttonWriter.AppendLine("              </span>");
                    }



                    // Only continue if there is an item and mode, and there is previous pages to go to
                    int total_pages = (int)Math.Ceiling((((decimal)results.TotalResults) / 20));
                    if (current_page < total_pages)
                    {
                        // Get the URL for the first and previous buttons
                        CurrentRequest.SubPage = (ushort)total_pages;
                        string lastButtonURL = UrlWriterHelper.Redirect_URL(CurrentRequest);
                        CurrentRequest.SubPage = (ushort)(current_page + 1);
                        string nextButtonURL = UrlWriterHelper.Redirect_URL(CurrentRequest);

                        buttonWriter.AppendLine("              <span class=\"sbkIsw_RightPaginationButtons\">");
                        buttonWriter.AppendLine("                <button title=\"" + next_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + nextButtonURL + "'; return false;\">" + next_page_text + "<img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"roundbutton_img_right\" alt=\"\" /></button>&nbsp;");
                        buttonWriter.AppendLine("                <button title=\"" + last_page + "\" class=\"sbkIsw_RoundButton\" onclick=\"window.location='" + lastButtonURL + "'; return false;\">" + last_page_text + "<img src=\"" + Static_Resources_Gateway.Button_Last_Arrow_Png + "\" class=\"roundbutton_img_right\" alt=\"\" /></button>");
                        buttonWriter.AppendLine("              </span>");
                    }

                    buttonWriter.AppendLine("            </div>");

                    button_text = buttonWriter.ToString();
                    Output.WriteLine(button_text);
                    CurrentRequest.SubPage = (ushort)current_page;
                }
            }
            Output.WriteLine("    </td>");
            Output.WriteLine("  </tr>");

            if ((results != null) && (results.TotalResults > 0))
            {
                // Look that some of these have thumbnails
                char columns   = '2';
                bool hasThumbs = false;
                if (results.Results.Any(Result => Result.Thumbnail.Length > 0))
                {
                    columns   = '3';
                    hasThumbs = true;
                }

                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td id=\"sbkTsv_ResultsArea\">");
                Output.WriteLine("        <table id=\"sbkTsv_ResultsTable\">");

                string thumbnail_root = BriefItem.Web.Source_URL;
                string url_options    = UrlWriterHelper.URL_Options(CurrentRequest);
                if (url_options.Length > 0)
                {
                    url_options = url_options + "&search=" + HttpUtility.UrlEncode(originalSearchString);
                }
                else
                {
                    url_options = "?search=" + HttpUtility.UrlEncode(originalSearchString);
                }
                int  current_displayed_result = ((results.Page_Number - 1) * 20) + 1;
                bool first = true;
                foreach (Legacy_Solr_Page_Result result in results.Results)
                {
                    // If this is not the first results drawn, add a seperating line
                    if (!first)
                    {
                        Output.WriteLine("          <tr><td colspan=\"" + columns + "\"></td></tr>");
                    }
                    else
                    {
                        first = false;
                    }

                    Output.WriteLine("          <tr style=\"vertical-align:middle;\">");
                    Output.WriteLine("            <td class=\"sbkTsv_ResultNumber\">" + current_displayed_result + "</td>");

                    // Only include the thumbnail column if some exist
                    if (hasThumbs)
                    {
                        if (result.Thumbnail.Length > 0)
                        {
                            Output.WriteLine("            <td style=\"text-align:left; width: 150px;\"><a href=\"" + CurrentRequest.Base_URL + BriefItem.BibID + "/" + BriefItem.VID + "/" + result.PageOrder + url_options + "\"><img src=\"" + thumbnail_root + "/" + result.Thumbnail + "\" class=\"sbkTsv_Thumbnail\" /></a></td>");
                        }
                        else
                        {
                            Output.WriteLine("            <td style=\"text-align:left; width: 150px;\"><a href=\"" + CurrentRequest.Base_URL + BriefItem.BibID + "/" + BriefItem.VID + "/" + result.PageOrder + url_options + "\"><img src=\"" + Static_Resources_Gateway.Nothumb_Jpg + "\" class=\"sbkTsv_Thumbnail\" /></a></td>");
                        }
                    }

                    Output.WriteLine("            <td style=\"text-align:left;\">");
                    Output.WriteLine("              <a class=\"sbkTsv_ResultsLink\" href=\"" + CurrentRequest.Base_URL + BriefItem.BibID + "/" + BriefItem.VID + "/" + result.PageOrder + url_options + "\">" + result.PageName + "</a>");
                    if (result.Snippet.Length > 0)
                    {
                        Output.WriteLine("              <br /><br />");
                        Output.WriteLine("              &ldquo;..." + result.Snippet.Replace("<em>", "<span class=\"sbkTsv_HighlightText\">").Replace("</em>", "</span>") + "...&rdquo;");
                    }
                    Output.WriteLine("            </td>");
                    Output.WriteLine("          </tr>");

                    current_displayed_result++;
                }

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

                Output.WriteLine(button_text);
                Output.WriteLine("    </td>");
            }
            else
            {
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td class=\"sbkTsv_ResultsArea\">");
                Output.WriteLine("        <br />");
                Output.WriteLine("        <h2>Quick Tips</h2>");
                Output.WriteLine("        <div id=\"sbkTsv_QuickTips\">");
                Output.WriteLine("          <ul>");
                Output.WriteLine("            <li><h3>Document Searching</h3>");
                Output.WriteLine("              <p> This option searches the full-text of the document and returns any pages which match<br />");
                Output.WriteLine("              the conditions of your search.</p>");
                Output.WriteLine("            </li>");
                Output.WriteLine("            <li><h3>Boolean Searches</h3>");
                Output.WriteLine("              <p> Use <span class=\"sbkTsv_Bold\">+</span> or <span class=\"sbkTsv_BoldItalic\">and</span> between terms to find records with <span class=\"sbkTsv_Bold\">all</span> the terms.<br />");
                Output.WriteLine("              Use <span class=\"sbkTsv_Bold\">-</span> or <span class=\"sbkTsv_BoldItalic\">or</span> between terms to find records with <span class=\"sbkTsv_Bold\">any</span> of the terms.<br />");
                Output.WriteLine("              Use <span class=\"sbkTsv_Bold\">!</span> or <span class=\"sbkTsv_BoldItalic\">and not</span> between terms to exclude records with terms.<br />");
                Output.WriteLine("              If nothing is indicated, <span class=\"sbkTsv_BoldItalic\">and</span> is the default.<br />");
                Output.WriteLine("              EXAMPLE: natural and not history");
                Output.WriteLine("              </p>");
                Output.WriteLine("            </li>");
                Output.WriteLine("            <li><h3>Phrase Searching</h3>");
                Output.WriteLine("              <p> Placing quotes around a phrase will search for the exact phrase.<br />");
                Output.WriteLine("              EXAMPLE: &quot;natural history&quot;</p>");
                Output.WriteLine("            </li>");
                Output.WriteLine("            <li><h3>Capitalization</h3>");
                Output.WriteLine("              <p> Searches are not capitalization sensitive.<br />");
                Output.WriteLine("              EXAMPLE: Searching for <span class=\"sbkTsv_Italic\">NATURAL</span> will return the same results as searching for <span class=\"sbkTsv_Italic\">natural</span></p>");
                Output.WriteLine("            </li>");
                Output.WriteLine("            <li><h3>Diacritics</h3>");
                Output.WriteLine("              <p> To search for words with diacritics, the character must be entered into the search box.<br />");
                Output.WriteLine("              EXAMPLE: Searching <span class=\"sbkTsv_Italic\">Précédent</span> is a different search than <span class=\"sbkTsv_Italic\">Precedent</span></p>");
                Output.WriteLine("            </li>");
                Output.WriteLine("          </ul>");
                Output.WriteLine("        </div>");
                Output.WriteLine("        <br />");
                Output.WriteLine("    </td>");
            }
        }
Esempio n. 10
0
        /// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (CurrentRequest.ViewerCode == "mapsearch")
            {
                googleItemSearch = true;
            }

            if (Tracer != null)
            {
                Tracer.Add_Trace("Google_Map_ItemViewer.Write_Main_Viewer_Section", "");
            }

            Output.WriteLine("        <!-- GOOGLE MAP VIEWER OUTPUT -->" + Environment.NewLine);

            if ((allPolygons.Count > 0) || (allPoints.Count > 0) || (allLines.Count > 0))
            {
                // If there is a coordinate search here
                if ((allPolygons.Count > 1) &&
                    ((!String.IsNullOrEmpty(CurrentRequest.Coordinates)) && (matchingTilesList != null) || (googleItemSearch)))
                {
                    if (googleItemSearch)
                    {
                        // Compute the redirect stem to use
                        string redirect_stem = CurrentRequest.BibID + "/" + CurrentRequest.VID + "/map";
                        if (CurrentRequest.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)
                        {
                            redirect_stem = "l/" + redirect_stem;
                        }

                        // Set some constants
                        const string SEARCH_BUTTON_TEXT = "Search";
                        const string FIND_BUTTON_TEXT   = "Find Address";
                        string       script_action_name = "map_item_search_sobekcm('" + redirect_stem + "');";

                        Output.WriteLine("    <td style=\"text-align:left\">");
                        Output.WriteLine("      <ol>");
                        Output.WriteLine(
                            "        <li>Use the <i>Select Area</i> button below to draw a search box on the map or enter an address and press <i>Find Address</i>.</li>");
                        Output.WriteLine("        <li>Press the <i>Search</i> button to see results</li>");
                        Output.WriteLine("      </ol>");
                        Output.WriteLine("        <div class=\"map_address_div\">");
                        Output.WriteLine("          <label for=\"AddressTextBox\">Address:</label> &nbsp; ");
                        Output.WriteLine(
                            "          <input name=\"AddressTextBox\" type=\"text\" id=\"AddressTextBox\" class=\"MapAddressBox_initial\" value=\"Enter address ( i.e., 12 Main Street, Gainesville Florida )\" onfocus=\"enter_address_box(this);\" onblur=\"leave_address_box(this);\" onkeypress=\"address_box_changed(this);\" onchange=\"address_box_changed(this);\" /> &nbsp; ");
                        Output.WriteLine("          <input type=\"button\" name=\"findButton\" value=\"" + FIND_BUTTON_TEXT +
                                         "\" id=\"findButton\" class=\"SobekSearchButton\" onclick=\"map_address_geocode();\" /> &nbsp; ");
                        Output.WriteLine("          <input type=\"button\" name=\"searchButton\" value=\"" +
                                         SEARCH_BUTTON_TEXT +
                                         "\" id=\"searchButton\" class=\"SobekSearchButton\" onclick=\"" +
                                         script_action_name + "\" />");
                        Output.WriteLine("        </div>");
                        Output.WriteLine("         <input name=\"Textbox1\" type=\"hidden\" id=\"Textbox1\" value=\"" +
                                         providedMaxLat.ToString() + "\" />");
                        Output.WriteLine("         <input name=\"Textbox2\" type=\"hidden\" id=\"Textbox2\" value=\"" +
                                         providedMaxLong.ToString() + "\" />");
                        Output.WriteLine("         <input name=\"Textbox3\" type=\"hidden\" id=\"Textbox3\" value=\"" +
                                         providedMinLat.ToString() + "\" />");
                        Output.WriteLine("         <input name=\"Textbox4\" type=\"hidden\" id=\"Textbox4\" value=\"" +
                                         providedMaxLong.ToString() + "\" />");
                        Output.WriteLine("    </td>");
                    }
                    else
                    {
                        if (matchingTilesList == null || matchingTilesList.Count == 0)
                        {
                            Output.WriteLine("          <td align=\"center\">");
                            Output.WriteLine(
                                "            There were no matches within this item for your geographic search. &nbsp; ");
                            string currentModeViewerCode = CurrentRequest.ViewerCode;
                            CurrentRequest.ViewerCode = "mapsearch";
                            Output.WriteLine("            ( <a href=\"" + UrlWriterHelper.Redirect_URL(CurrentRequest) +
                                             "\">Modify item search</a> )");
                            CurrentRequest.ViewerCode = currentModeViewerCode;

                            // If there was an aggregation included, we can assume that was the origin of the coordinate search,
                            // or at least that map searching is allowed for that collection
                            if (CurrentRequest.Aggregation.Length > 0)
                            {
                                Output.WriteLine("            <br /><br />");
                                CurrentRequest.Mode                = Display_Mode_Enum.Results;
                                CurrentRequest.Search_Type         = Search_Type_Enum.Map;
                                CurrentRequest.Result_Display_Type = "map";
                                if ((providedMinLat > 0) && (providedMinLong > 0) && (providedMaxLat != providedMinLat) &&
                                    (providedMaxLong != providedMinLong))
                                {
                                    CurrentRequest.Search_String = providedMaxLat.ToString() + "," + providedMaxLong + "," +
                                                                   providedMinLat + "," + providedMinLong;
                                }
                                else
                                {
                                    CurrentRequest.Search_String = providedMaxLat.ToString() + "," + providedMaxLong;
                                }
                                Output.WriteLine("            <a href=\"" + UrlWriterHelper.Redirect_URL(CurrentRequest) +
                                                 "\">Click here to search other items in the current collection</a><br />");
                                CurrentRequest.Mode = Display_Mode_Enum.Item_Display;
                            }
                            Output.WriteLine("          </td>" + Environment.NewLine + "        </tr>");
                        }
                        else
                        {
                            string       modify_item_search = "Modify item search";
                            const string ZOOM_EXTENT        = "Zoom to extent";
                            const string ZOOM_MATCHES       = "Zoom to matches";
                            if (BriefItem.Type.IndexOf("aerial", StringComparison.OrdinalIgnoreCase) >= 0)
                            {
                                modify_item_search = "Modify search within flight";
                            }

                            Output.WriteLine("          <td style=\"vertical-align: left\">");
                            Output.WriteLine("            <table id=\"sbkGmiv_ResultsTable\">");

                            Output.WriteLine("              <tr>");
                            Output.WriteLine("                <td style=\"width:50px\">&nbsp;</td>");
                            Output.WriteLine(
                                "                <td colspan=\"4\">The following results match your geographic search:</td>"); //  and also appear on the navigation bar to the left
                            Output.WriteLine("              </tr>");

                            int    column      = 0;
                            bool   first_row   = true;
                            string url_options = UrlWriterHelper.URL_Options(CurrentRequest);
                            string urlOptions1 = String.Empty;
                            string urlOptions2 = String.Empty;
                            if (url_options.Length > 0)
                            {
                                urlOptions1 = "?" + url_options;
                                urlOptions2 = "&" + url_options;
                            }
                            foreach (string thisResult in matchingTilesList)
                            {
                                // Start this row, as it is needed
                                if (column == 0)
                                {
                                    Output.WriteLine("              <tr>");
                                    if (first_row)
                                    {
                                        Output.WriteLine("                <td style=\"width:50px\">&nbsp;</td>");
                                        Output.WriteLine("                <td style=\"width:50px\">&nbsp;</td>");
                                        first_row = false;
                                    }
                                    else
                                    {
                                        Output.WriteLine("                <td colspan=\"2\">&nbsp;</td>");
                                    }
                                }

                                // Add the information for this tile
                                Output.WriteLine("                <td style=\"width:80px\">" +
                                                 thisResult.Replace("<%URLOPTS%>", url_options).Replace("<%?URLOPTS%>",
                                                                                                        urlOptions1).
                                                 Replace("<%&URLOPTS%>", urlOptions2) + "</td>");
                                column++;

                                // If this was the last column, end it
                                if (column >= 3)
                                {
                                    Output.WriteLine("              </tr>");
                                    column = 0;
                                }
                            }

                            // If a row was started, finish it
                            if (column > 0)
                            {
                                while (column < 3)
                                {
                                    Output.WriteLine("                <td style=\"width:80px\">&nbsp;</td>");
                                    column++;
                                }
                                Output.WriteLine("              </tr>");
                            }

                            // Add a horizontal line here
                            Output.WriteLine("              <tr><td></td><td style=\"background-color:#cccccc\" colspan=\"4\"></td></tr>");

                            // Also, add the navigation links
                            Output.WriteLine("              <tr>");
                            Output.WriteLine("                <td>&nbsp;</td>");
                            Output.WriteLine("                <td colspan=\"4\">");
                            Output.WriteLine("                  <a href=\"\" onclick=\"return zoom_to_bounds();\">" +
                                             ZOOM_EXTENT + "</a> &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; ");
                            if (matchingTilesList.Count > 0)
                            {
                                Output.WriteLine("                  <a href=\"\" onclick=\"return zoom_to_selected();\">" +
                                                 ZOOM_MATCHES + "</a> &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; ");
                            }



                            // Add link to modify this item search
                            string currentModeViewerCode = CurrentRequest.ViewerCode;
                            CurrentRequest.ViewerCode = "mapsearch";
                            Output.WriteLine("                  <a href=\"" + UrlWriterHelper.Redirect_URL(CurrentRequest) + "\">" +
                                             modify_item_search + "</a> &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; ");
                            CurrentRequest.ViewerCode = currentModeViewerCode;

                            // Add link to search entire collection
                            if (CurrentRequest.Aggregation.Length > 0)
                            {
                                CurrentRequest.Mode                = Display_Mode_Enum.Results;
                                CurrentRequest.Search_Type         = Search_Type_Enum.Map;
                                CurrentRequest.Result_Display_Type = "map";
                                if ((providedMinLat > 0) && (providedMinLong > 0) && (providedMaxLat != providedMinLat) && (providedMaxLong != providedMinLong))
                                {
                                    CurrentRequest.Search_String = providedMaxLat.ToString() + "," + providedMaxLong + "," + providedMinLat + "," + providedMinLong;
                                }
                                else
                                {
                                    CurrentRequest.Search_String = providedMaxLat.ToString() + "," + providedMaxLong;
                                }

                                if (CurrentRequest.Aggregation == "aerials")
                                {
                                    Output.WriteLine("                  <a href=\"" + UrlWriterHelper.Redirect_URL(CurrentRequest) + "\">Search all flights</a><br />");
                                }
                                else
                                {
                                    Output.WriteLine("                  <a href=\"" + UrlWriterHelper.Redirect_URL(CurrentRequest) + "\">Search entire collection</a><br />");
                                }

                                CurrentRequest.Mode = Display_Mode_Enum.Item_Display;
                            }

                            Output.WriteLine("                </td>");
                            Output.WriteLine("              </tr>");
                            Output.WriteLine("            </table>");
                            Output.WriteLine("          </td>");
                            Output.WriteLine("        </tr>");
                        }
                    }
                }
                else
                {
                    // Start the citation table
                    string title = "Map It!";
                    if (allPolygons.Count == 1)
                    {
                        title = allPolygons[0].Label;
                    }
                }
            }

            Output.WriteLine("        <tr>");
            Output.WriteLine("          <td class=\"SobekCitationDisplay\">");

            if (!String.IsNullOrWhiteSpace(UI_ApplicationCache_Gateway.Settings.System.Google_Map_API_Key))
            {
                Output.WriteLine("            <div id=\"sbkGmiv_MapDiv\"></div>");
                Output.WriteLine();
            }
            else
            {
                Output.WriteLine("            <div style=\"padding: 50px\">");
                Output.WriteLine("              <p style=\"font-weight:bold; text-size:1.1em\">ERROR: Google Maps are not enabled on this instance of SobekCM!</p>");
                Output.WriteLine("              <p>To enable them, please create a Google Map API key and enter it in the system-wide settings.</p>");
                Output.WriteLine("              <p>Information on this process can be found here: <a href=\"http://sobekrepository.org/software/config/googlemaps\" style=\"color:white;\">http://sobekrepository.org/software/config/googlemaps</a>.</p>");
                Output.WriteLine("            </div>");
            }


            Tracer.Add_Trace("goole_map_itemviewer.Write_HTML", "Adding google map instructions as script");
            Output.WriteLine(mapBuilder.ToString());
            Output.WriteLine();

            Output.WriteLine("          </td>");
            Output.WriteLine("        <!-- END GOOGLE MAP VIEWER OUTPUT -->");
        }
        private void add_usage_definitions(TextWriter Output, Custom_Tracer Tracer)
        {
            // See if the FAQ is present for this collection
            string directory        = UI_ApplicationCache_Gateway.Settings.Servers.Base_Design_Location + "\\extra\\stats";
            string usageDefinitions = String.Empty;

            if (Directory.Exists(directory))
            {
                if (File.Exists(directory + "\\stats_usage_definitions.txt"))
                {
                    if (Tracer != null)
                    {
                        Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_usage_definitions", "Loading usage definitions");
                    }

                    try
                    {
                        StreamReader faqReader = new StreamReader(directory + "\\stats_usage_definitions.txt");
                        usageDefinitions = faqReader.ReadToEnd();
                        faqReader.Close();
                    }
                    catch (Exception)
                    {
                        // If there is an error here, no problem.. just uses the default
                    }
                }
            }

            if (usageDefinitions.Length > 0)
            {
                string urloptions = UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode);
                if (urloptions.Length > 0)
                {
                    urloptions = "?" + urloptions;
                }

                if (Tracer != null)
                {
                    Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_usage_definitions", "Rendering HTML read from source file");
                }
                Output.WriteLine("<div class=\"SobekText\">");
                Output.WriteLine(usageDefinitions.Replace("<%BASEURL%>", RequestSpecificValues.Current_Mode.Base_URL).Replace("<%?URLOPTS%>", urloptions));
                Output.WriteLine("</div>");
            }
            else
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_usage_definitions", "Rendering Default HTML");
                }
                Output.WriteLine("<div class=\"SobekText\">");
                Output.WriteLine("<p>The following terms are defined below:</p>");

                Output.WriteLine("<table width=\"600px\" border=\"0\" align=\"center\">");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td><a href=\"#Collection_Hierarchy\">Collection Hierarchy</a></td>");
                Output.WriteLine("    <td><a href=\"#Collection_Groups\">Collection Groups</a></td>");
                Output.WriteLine("    <td><a href=\"#Collections\">Collections</a></td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td><a href=\"#SubCollections\">SubCollections</a></td>");
                Output.WriteLine("    <td><a href=\"#Views\">Views</a></td>");
                Output.WriteLine("    <td><a href=\"#Visits\">Visits</a></td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td><a href=\"#Main_Pages\">Main Pages</a></td>");
                Output.WriteLine("    <td><a href=\"#Browses\">Browses</a></td>");
                Output.WriteLine("    <td><a href=\"#Titles_Items\">Titles and Items</a></td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td><a href=\"#Title_Views\">Title Views</a></td>");
                Output.WriteLine("    <td><a href=\"#Item_Views\">Item Views</a></td>");
                Output.WriteLine("    <td><a href=\"#Citation_Views\">Citation Views</a></td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td><a href=\"#Text_Searches\">Text Searches</a></td>");
                Output.WriteLine("    <td><a href=\"#Static_Views\">Static Views</a></td>");
                Output.WriteLine("    <td>&nbsp;</td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("</table>");

                Output.WriteLine("<h2>Defined Terms</h2>");
                Output.WriteLine();

                Output.WriteLine("<a name=\"Collection_Hierarchy\" ></a>");
                Output.WriteLine("<h3>COLLECTION HIERARCHY</h3>");
                Output.WriteLine("<p>Collections are organized by Collection Groups, which contain Collections and Collections contain Subcollections. This hierarchical organization allows for general searches and browses at the Collection Group level and for granular searches at the Collection level for optimum usability for multiple user needs. <br /><br />");
                Output.WriteLine("In reading the statistics by Collection, views and searches done from the main page and the Collection Group pages are not within collections and so are not included in the Collection statistics.</p>");

                Output.WriteLine("<a name=\"Collection_Groups\" ></a>");
                Output.WriteLine("<h3>COLLECTION GROUPS</h3>");
                Output.WriteLine("<p>Collection groups are aggregations of collections in this library. The Collection Groups simplify searching across multiple Collections simultaneously. Collection Groups also connect less tightly related materials to increase the likelihood for serendipity, where users may be searching for one topic and may easily stumble across something related and critically useful that they had not considered. Thus, Collection Groups are usually constructed topically. <br /><br />");
                Output.WriteLine("As an aggregate, views at the Collection Group level do not count toward any particular Collection and are not included in the Collection based statistics.</p>");

                Output.WriteLine("<a name=\"Collections\" ></a>");
                Output.WriteLine("<h3>COLLECTIONS</h3>");
                Output.WriteLine("<p>Collections are the main method for defining and collecting related materials and are the most familiar hierarchical structures for subject specialists, partners, and other internal users. A single Collection can exist in several Collection Groups, and a single Collection can have many subcollections.  <br /><br />");
                Output.WriteLine("A single item may be in several Collections, but one Collection is always selected as primary so all item views will be within a single Collection. </p>");

                Output.WriteLine("<a name=\"SubCollections\" ></a>");
                Output.WriteLine("<h3>SUBCOLLECTIONS</h3>");
                Output.WriteLine("<p>The smallest collected unit is the Subcollection. A single item can belong to several Subcollections under the same collection, or to multiple Collections and to Subcollections within each Collection. <br /><br />");
                Output.WriteLine("Because all Subcollection items will have a primary Collection, the usage statistics for Subcollections are also included in the Collection usage statistics. </p>");

                Output.WriteLine("<a name=\"Views\" ></a>");
                Output.WriteLine("<h3>VIEWS</h3>");
                Output.WriteLine("<p>Views are the actual page hits. Each time a person goes to " + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " it counts as a view. The " + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " statistics are cleaned so that views from robots, which search engines use to index websites, are removed. If they were not removed, the views on all collections and items would be much higher. Web usage statistics are always somewhat fallible, and this is one of the means for ensuring better quality usage statistics. <br /><br />");
                Output.WriteLine("Some web statistics count &quot;page item downloads&quot; as views, which is highly inaccurate because each page has multiple items on it. For instance, the digital library main page, " + RequestSpecificValues.Current_Mode.Instance_Abbreviation + ", includes the page HTML and all of the images. If the statistics counted each “page item download” as a hit, each single view to the main page would be counted as over 30 “page item downloads.” To make matters more confusing, some digital repositories only offer PDF downloads for users to view items. Those digital repositories track &quot;item downloads&quot; and those are most equivalent to our statistics for usage by &quot;item.&quot; </p>");

                Output.WriteLine("<a name=\"Visits\" ></a>");
                Output.WriteLine("<h3>VISITS</h3>");
                Output.WriteLine("<p>Each time a person goes to this digital library it counts as a view, but that means a single user going to the site repeatedly can log a large number of views. Visits provide a better statistic for how many different “unique” users are using the site. Visits include all views from a particular IP address (the user’s computer web address when connected) as recorded in the web log file within an hour.  <br /><br />");
                Output.WriteLine("This is also a fallible statistic since users’ IP addresses are frequently reused on networks.  Connecting to free wireless means that network gives your computer an IP address, and then when you disconnect that IP address will be given to the next user who needs it. For a campus based resource with so many on campus users connecting through the VPN or from on campus, the margin for error increases for visit-based statistics. </p>");

                Output.WriteLine("<a name=\"Main_Pages\" ></a>");
                Output.WriteLine("<h3>MAIN PAGES</h3>");
                Output.WriteLine("<p>For each of the elements in the Collection Hierarchy, the main pages are the home or landing pages, the search pages, the contact pages, and any other supplemental pages.  <br /><br />");
                Output.WriteLine("When users conduct a search through the Collection pages and view the results, those search result pages are also included in the main pages. Once a user clicks on one of the items in the search results, that item is not one of the main pages. The views for search results by thumbnail, table, and brief modes are all included in the main pages for the Collection.</p>");

                Output.WriteLine("<a name=\"Browses\" ></a>");
                Output.WriteLine("<h3>BROWSES</h3>");
                Output.WriteLine("<p>Browses include views against standard browses, such as <i>All Items</i> and <i>New Items</i> (when available).  It also includes all views of non-standard browses.</p>");

                Output.WriteLine("<a name=\"Search_Results\" ></a>");
                Output.WriteLine("<h3>SEARCH RESULTS</h3>");
                Output.WriteLine("<p>Search result views includes every view of a section of search results, and includes searches which returned zero results.</p>");

                Output.WriteLine("<a name=\"Titles_Items\" ></a>");
                Output.WriteLine("<h3>TITLES & ITEMS</h3>");
                Output.WriteLine("<p>Titles are for single bibliographic units, like a book or a newspaper. Items are the volumes within titles. Thus, one book may have one title and one item where one newspaper may have one title and thousands of items.  <br /><br />");
                Output.WriteLine("Titles with only one item (or volume) appear functionally equivalent to users. However for items like newspapers, a single title may correspond to thousands of items. <br /><br />");
                Output.WriteLine("Readers of the technical documentation and internal users know titles by their bibliographic identifier (BIBID) and items within each title by the BIBID plus the volume identifier (VID).</p>");

                Output.WriteLine("<a name=\"Title_Views\" ></a>");
                Output.WriteLine("<h3>TITLE VIEWS</h3>");
                Output.WriteLine("<p>Title views include all views at the title level.</p>");

                Output.WriteLine("<a name=\"Item_Views\" ></a>");
                Output.WriteLine("<h3>ITEM VIEWS</h3>");
                Output.WriteLine("<p>Item views include views at the item level only.</p>");

                Output.WriteLine("<a name=\"Citation_Views\" ></a>");
                Output.WriteLine("<h3>CITATION VIEWS</h3>");
                Output.WriteLine("<p>For each item, the default view is set to the page item (zoomable or static based on user selection and the availability of each of the views for that item). All items also include a “Citation View” that is not selected by default. The “Citation Views” counts the number of times a user chooses the “Citation View” for an item.</p>");

                Output.WriteLine("<a name=\"Text_Searches\" ></a>");
                Output.WriteLine("<h3>TEXT SEARCHES</h3>");
                Output.WriteLine("<p>Text searches are item-level searches within the text of a single document.  This returns the pages upon which the term or terms appear.</p>");

                Output.WriteLine("<a name=\"Static_Views\" ></a>");
                Output.WriteLine("<h3>STATIC VIEWS</h3>");
                Output.WriteLine("<p>For each item in this library, a static page is generated for search engines to index.  When an item appears in the search results in a standard search engine, the link forwards the user to the static page.  Any additional navigation moves the user into the dynamically generated pages within this library.  Attempts have been made to remove all the search engine indexing views from these numbers.  These numbers represent the number of users that entered this library from a search engine.</p>");
                Output.WriteLine("</div>");
            }
        }
        /// <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());
        }
        /// <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());
        }
Esempio n. 14
0
        /// <summary> Add the HTML to be displayed below the search box </summary>
        /// <param name="Output"> Textwriter to write the HTML for this viewer</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This writes the HTML from the static browse or info page here  </remarks>
        public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Static_Browse_Info_AggregationViewer.Add_Secondary_HTML", "Adding HTML");
            }

            // Get the adjusted text for this user's session
            if (ViewBag.Static_Web_Content == null)
            {
                return;
            }

            string static_browse_info_text = ViewBag.Static_Web_Content.Apply_Settings_To_Static_Text(ViewBag.Static_Web_Content.Content, ViewBag.Hierarchy_Object, RequestSpecificValues.HTML_Skin.Skin_Code, RequestSpecificValues.HTML_Skin.Base_Skin_Code, RequestSpecificValues.Current_Mode.Base_URL, UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode), Tracer);
            bool   isAdmin = (RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.Is_Aggregation_Admin(ViewBag.Hierarchy_Object.Code));


            if ((RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Child_Page_Edit) && (isAdmin))
            {
                const string TITLE_HELP       = "Help for the title place holder";
                const string AUTHOR_HELP      = "Help for the author place holder";
                const string DATE_HELP        = "Help for the date place holder";
                const string DESCRIPTION_HELP = "Help for the description place holder";
                const string KEYWORDS_HELP    = "Help for the keywords place holder";
                const string EXTRA_HEAD_HELP  = "Help for the extra head place holder";


                string post_url = HttpUtility.HtmlEncode(HttpContext.Current.Items["Original_URL"].ToString());
                Output.WriteLine("<form name=\"home_edit_form\" method=\"post\" action=\"" + post_url + "\" id=\"addedForm\" >");

                Output.WriteLine("  <a href=\"\" onclick=\"return show_header_info()\" id=\"sbkSbia_HeaderInfoDivShowLink\">show header data (advanced)</a><br />");
                Output.WriteLine("  <div id=\"sbkSbia_HeaderInfoDiv\" style=\"display:none;\">");
                Output.WriteLine("    <div style=\"font-style:italic; padding:0 5px 5px 5px; text-align:left;\">The data below describes the content of this static child page and is used by some search engine indexing algorithms.  By default, it will not show in text of the page, but will be included in the head tag of the page.</div>");

                Output.WriteLine("    <table id=\"sbkSbia_HeaderTable\">");
                Output.WriteLine("      <tr>");
                Output.WriteLine("        <td style=\"width:50px\">&nbsp;</td>");
                Output.WriteLine("        <td class=\"sbkSbia_HeaderTableLabel\"><label for=\"admin_childpage_title\">Title:</label></td>");
                Output.WriteLine("        <td><input class=\"sbkSbia_HeaderInput sbk_Focusable\" name=\"admin_childpage_title\" id=\"admin_childpage_title\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(ViewBag.Static_Web_Content.Title) + "\" /></td>");
                Output.WriteLine("        <td><img class=\"sbkSbia_HelpButton\" src=\"" + Static_Resources_Gateway.Help_Button_Jpg + "\" onclick=\"alert('" + TITLE_HELP + "');\"  title=\"" + TITLE_HELP + "\" /></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("      <tr>");
                Output.WriteLine("        <td>&nbsp;</td>");
                Output.WriteLine("        <td class=\"sbkSbia_HeaderTableLabel\"><label for=\"admin_childpage_author\">Author:</label></td>");
                Output.WriteLine("        <td><input class=\"sbkSbia_HeaderInput sbk_Focusable\" name=\"admin_childpage_author\" id=\"admin_childpage_author\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(ViewBag.Static_Web_Content.Author) + "\" /></td>");
                Output.WriteLine("        <td><img class=\"sbkSbia_HelpButton\" src=\"" + Static_Resources_Gateway.Help_Button_Jpg + "\" onclick=\"alert('" + AUTHOR_HELP + "');\"  title=\"" + AUTHOR_HELP + "\" /></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("      <tr>");
                Output.WriteLine("        <td>&nbsp;</td>");
                Output.WriteLine("        <td class=\"sbkSbia_HeaderTableLabel\"><label for=\"admin_childpage_date\">Date:</label></td>");
                Output.WriteLine("        <td><input class=\"sbkSbia_HeaderInput sbk_Focusable\" name=\"admin_childpage_date\" id=\"admin_childpage_date\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(ViewBag.Static_Web_Content.Date) + "\" /></td>");
                Output.WriteLine("        <td><img class=\"sbkSbia_HelpButton\" src=\"" + Static_Resources_Gateway.Help_Button_Jpg + "\" onclick=\"alert('" + DATE_HELP + "');\"  title=\"" + DATE_HELP + "\" /></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("      <tr>");
                Output.WriteLine("        <td>&nbsp;</td>");
                Output.WriteLine("        <td class=\"sbkSbia_HeaderTableLabel\"><label for=\"admin_childpage_description\">Description:</label></td>");
                Output.WriteLine("        <td><input class=\"sbkSbia_HeaderInput sbk_Focusable\" name=\"admin_childpage_description\" id=\"admin_childpage_description\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(ViewBag.Static_Web_Content.Description) + "\" /></td>");
                Output.WriteLine("        <td><img class=\"sbkSbia_HelpButton\" src=\"" + Static_Resources_Gateway.Help_Button_Jpg + "\" onclick=\"alert('" + DESCRIPTION_HELP + "');\"  title=\"" + DESCRIPTION_HELP + "\" /></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("      <tr>");
                Output.WriteLine("        <td>&nbsp;</td>");
                Output.WriteLine("        <td class=\"sbkSbia_HeaderTableLabel\"><label for=\"admin_childpage_keywords\">Keywords:</label></td>");
                Output.WriteLine("        <td><input class=\"sbkSbia_HeaderInput sbk_Focusable\" name=\"admin_childpage_keywords\" id=\"admin_childpage_keywords\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(ViewBag.Static_Web_Content.Keywords) + "\" /></td>");
                Output.WriteLine("        <td><img class=\"sbkSbia_HelpButton\" src=\"" + Static_Resources_Gateway.Help_Button_Jpg + "\" onclick=\"alert('" + KEYWORDS_HELP + "');\"  title=\"" + KEYWORDS_HELP + "\" /></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("      <tr style=\"vertical-align:top;\">");
                Output.WriteLine("        <td>&nbsp;</td>");
                Output.WriteLine("        <td class=\"sbkSbia_HeaderTableLabel\" style=\"padding-top:5px\"><label for=\"admin_childpage_extrahead\">HTML Head Info:</label></td>");
                string extra_head_info = ViewBag.Static_Web_Content.Extra_Head_Info ?? String.Empty;
                Output.WriteLine("        <td><textarea rows=\"3\" class=\"sbkSbia_HeaderTextArea sbk_Focusable\" name=\"admin_childpage_extrahead\" id=\"admin_childpage_extrahead\" type=\"text\">" + HttpUtility.HtmlEncode(extra_head_info) + "</textarea></td>");
                Output.WriteLine("        <td><img class=\"sbkSbia_HelpButton\" src=\"" + Static_Resources_Gateway.Help_Button_Jpg + "\" onclick=\"alert('" + EXTRA_HEAD_HELP + "');\"  title=\"" + EXTRA_HEAD_HELP + "\" /></td>");
                Output.WriteLine("      </tr>");
                Output.WriteLine("    </table>");
                Output.WriteLine("    <br />");
                Output.WriteLine("  </div>");


                Output.WriteLine("  <div id=\"sbkSbia_MainText\">");
                Output.WriteLine("  <textarea id=\"sbkSbia_ChildTextEdit\" name=\"sbkSbia_ChildTextEdit\" >");
                Output.WriteLine(static_browse_info_text.Replace("<%", "[%").Replace("%>", "%]"));
                Output.WriteLine("  </textarea>");
                Output.WriteLine("  </div>");
                Output.WriteLine();

                Output.WriteLine("  <div id=\"sbkSbia_TextEditButtons\">");
                RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
                if (ViewBag.Browse_Object.Browse_Type == Item_Aggregation_Child_Visibility_Enum.Metadata_Browse_By)
                {
                    RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Browse_By;
                }
                Output.WriteLine("    <button title=\"Do not apply changes\" class=\"roundbutton\" onclick=\"window.location.href='" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "';return false;\"><img src=\"" + Static_Resources_Gateway.Button_Previous_Arrow_Png + "\" class=\"roundbutton_img_left\" alt=\"\" /> CANCEL</button> &nbsp; &nbsp; ");
                Output.WriteLine("    <button title=\"Save changes to this child page text\" class=\"roundbutton\" type=\"submit\" onclick=\"CKEDITOR.instances.sbkSbia_ChildTextEdit.updateElement();\">SAVE <img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"roundbutton_img_right\" alt=\"\" /></button>");
                Output.WriteLine("  </div>");
                Output.WriteLine("</form>");
                Output.WriteLine("<br /><br />");
                Output.WriteLine();
            }
            else
            {
                Aggregation_Type_Enum aggrType = RequestSpecificValues.Current_Mode.Aggregation_Type;
                Output.WriteLine("<section id=\"main-content\" role=\"main\">");

                // Output the adjusted home html
                if (isAdmin)
                {
                    Output.WriteLine("<div id=\"sbkSbia_MainTextEditable\">");
                    Output.WriteLine(static_browse_info_text);
                    RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Child_Page_Edit;
                    Output.WriteLine("  <div id=\"sbkSbia_EditableTextLink\"><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\" title=\"Edit this page's text\"><img src=\"" + Static_Resources_Gateway.Edit_Gif + "\" alt=\"\" />edit content</a></div>");
                    RequestSpecificValues.Current_Mode.Aggregation_Type = aggrType;
                    Output.WriteLine("</div>");
                    Output.WriteLine();

                    Output.WriteLine("<script>");
                    Output.WriteLine("  $(\"#sbkSbia_MainTextEditable\").mouseover(function() { $(\"#sbkSbia_EditableTextLink\").css(\"display\",\"inline-block\"); });");
                    Output.WriteLine("  $(\"#sbkSbia_MainTextEditable\").mouseout(function() { $(\"#sbkSbia_EditableTextLink\").css(\"display\",\"none\"); });");
                    Output.WriteLine("</script>");
                    Output.WriteLine();
                }
                else
                {
                    Output.WriteLine("<div id=\"sbkSbia_MainText\">");
                    Output.WriteLine(static_browse_info_text);
                    Output.WriteLine("</div>");
                }

                Output.WriteLine("</section>");
            }


            Output.WriteLine("<br />");
            Output.WriteLine();
        }
        /// <summary> Add the HTML to be displayed in the main SobekCM viewer area </summary>
        /// <param name="Output"> Textwriter to write the HTML for this viewer</param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("User_Tags_MySobekViewer.Write_HTML", String.Empty);

            Output.WriteLine("<h1>" + Web_Title + "</h1>");
            Output.WriteLine();

            Output.WriteLine("<div class=\"SobekHomeText\">");
            string submode = String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.My_Sobek_SubMode) ? String.Empty : RequestSpecificValues.Current_Mode.My_Sobek_SubMode;

            // Is this either a sys admin or a collection admin/manager
            if ((RequestSpecificValues.Current_User.Is_System_Admin) || (RequestSpecificValues.Current_User.Is_A_Collection_Manager_Or_Admin))
            {
                Output.WriteLine("<blockquote>As a digital collection manager or administrator, you can use this screen to view descriptive tags added to collections of interest, as well as view the descriptive tags you have added to items.</blockquote>");

                Output.WriteLine("<table width=\"750px\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\">");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td bgcolor=\"#cccccc\">");
                Output.WriteLine("      <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">");
                Output.WriteLine("        <tr>");
                Output.WriteLine("          <td bgcolor=\"#f4f4f4\"> &nbsp; <span class=\"groupname\"><span class=\"groupnamecaps\">&nbsp;T</span>AGS BY <span class=\"groupnamecaps\">A</span>GGREGATION </span></td>");
                Output.WriteLine("        </tr>");
                Output.WriteLine("      </table>");
                Output.WriteLine("    </td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("</table>");


                Output.WriteLine("<table width=\"700px\" border=\"0\" align=\"center\"><tr><td>");
                Output.WriteLine("<br />Choose an aggregation below to view all tags for that aggregation:");
                Output.WriteLine("<blockquote>");

                if (RequestSpecificValues.Current_User.PermissionedAggregations != null)
                {
                    foreach (User_Permissioned_Aggregation aggregation in RequestSpecificValues.Current_User.PermissionedAggregations)
                    {
                        if (aggregation.IsCurator)
                        {
                            RequestSpecificValues.Current_Mode.My_Sobek_SubMode = aggregation.Code;
                            Output.WriteLine("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">" + aggregation.Name + "</a><br /><br />");
                        }
                    }
                }

                if (RequestSpecificValues.Current_User.Is_System_Admin)
                {
                    RequestSpecificValues.Current_Mode.My_Sobek_SubMode = "all";
                    Output.WriteLine("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">All Aggregations</a><br /><br />");
                }

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

            // If there is no submode, just pull this users descriptive tags
            if (submode.Length == 0)
            {
                Output.WriteLine("<table width=\"750px\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\">");
                Output.WriteLine("  <tr>");
                Output.WriteLine("    <td bgcolor=\"#cccccc\">");
                Output.WriteLine("      <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">");
                Output.WriteLine("        <tr>");
                Output.WriteLine("          <td bgcolor=\"#f4f4f4\"> &nbsp; <span class=\"groupname\"><span class=\"groupnamecaps\">&nbsp;Y</span>OUR <span class=\"groupnamecaps\">D</span>ESCRIPTIVE <span class=\"groupnamecaps\">T</span>AGS </span></td>");
                Output.WriteLine("        </tr>");
                Output.WriteLine("      </table>");
                Output.WriteLine("    </td>");
                Output.WriteLine("  </tr>");
                Output.WriteLine("</table>");


                // Get the tags by this RequestSpecificValues.Current_User
                DataTable allTags = SobekCM_Database.View_Tags_By_User(RequestSpecificValues.Current_User.UserID, Tracer);
                if ((allTags == null) || (allTags.Rows.Count == 0))
                {
                    Output.WriteLine("<br /><br /><center><b>You have not added any descriptive tags to any items</b></center><br /><br />");
                }
                else
                {
                    Output.WriteLine("<table width=\"700px\" border=\"0\" align=\"center\"><tr><td>");
                    Output.WriteLine("<br />You have added the following " + allTags.Rows.Count + " descriptive tags:");
                    Output.WriteLine("<blockquote>");

                    foreach (DataRow thisTagRow in allTags.Rows)
                    {
                        string   description = thisTagRow["Description_Tag"].ToString();
                        string   bibid       = thisTagRow["BibID"].ToString();
                        string   vid         = thisTagRow["VID"].ToString();
                        DateTime date        = Convert.ToDateTime(thisTagRow["Date_Modified"]);

                        Output.WriteLine(description + "<br /><i>Added by you on " + date.ToShortDateString() + "</i> &nbsp; &nbsp; &nbsp; ( <a href=\"?m=ldFC&b=" + bibid + "&v=" + vid + UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode) + "\" target=\"" + bibid + vid + "\">view</a> )<br /><br />");
                    }

                    Output.WriteLine("</blockquote>");
                    Output.WriteLine("</td></tr></table>");
                }
            }
            else
            {
                bool char_found = submode.Any(ThisChar => !Char.IsNumber(ThisChar));
                if (char_found)
                {
                    Output.WriteLine("<table width=\"750px\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\">");
                    Output.WriteLine("  <tr>");
                    Output.WriteLine("    <td bgcolor=\"#cccccc\">");
                    Output.WriteLine("      <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">");
                    Output.WriteLine("        <tr>");
                    Output.WriteLine("          <td bgcolor=\"#f4f4f4\"> &nbsp; <span class=\"groupname\"><span class=\"groupnamecaps\">&nbsp;T</span>AGS BY <span class=\"groupnamecaps\">A</span>GGREGATION</span></td>");
                    Output.WriteLine("        </tr>");
                    Output.WriteLine("      </table>");
                    Output.WriteLine("    </td>");
                    Output.WriteLine("  </tr>");
                    Output.WriteLine("</table>");

                    string aggregation_code = submode.ToUpper();
                    if (aggregation_code == "ALL")
                    {
                        aggregation_code = String.Empty;
                    }

                    DataTable allTags = SobekCM_Database.View_Tags_By_Aggregation(aggregation_code, Tracer);

                    if ((allTags != null) && (allTags.Rows.Count > 0))
                    {
                        Output.WriteLine("<table width=\"700px\" border=\"0\" align=\"center\"><tr><td>");
                        Output.WriteLine("<br />This aggregation includes the following " + allTags.Rows.Count + " descriptive tags:");
                        Output.WriteLine("<blockquote>");

                        foreach (DataRow thisTagRow in allTags.Rows)
                        {
                            string   description = thisTagRow["Description_Tag"].ToString();
                            string   bibid       = thisTagRow["BibID"].ToString();
                            string   vid         = thisTagRow["VID"].ToString();
                            DateTime date        = Convert.ToDateTime(thisTagRow["Date_Modified"]);


                            string first_name = thisTagRow["FirstName"].ToString();
                            string nick_name  = thisTagRow["NickName"].ToString();
                            string last_name  = thisTagRow["LastName"].ToString();
                            string full_name  = first_name + " " + last_name;
                            if (nick_name.Length > 0)
                            {
                                full_name = nick_name + " " + last_name;
                            }

                            Output.Write(description + "<br /><i>Added by " + full_name + " on " + date.ToShortDateString() + "</i> &nbsp; &nbsp; &nbsp; ( <a href=\"?m=ldFC&b=" + bibid + "&v=" + vid + UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode) + "\" target=\"" + bibid + vid + "\">view</a> | ");
                            RequestSpecificValues.Current_Mode.My_Sobek_SubMode = thisTagRow["UserID"].ToString();

                            Output.WriteLine("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">view all by this RequestSpecificValues.Current_User</a> )<br /><br />");
                        }

                        Output.WriteLine("</blockquote>");
                        Output.WriteLine("</td></tr></table>");
                    }
                    else
                    {
                        Output.WriteLine("<br /><br /><center><b>This aggregation had no added tags or it is not a valid agggregation code.</b></center><br /><br />");
                    }
                }
                else
                {
                    Output.WriteLine("<table width=\"750px\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\">");
                    Output.WriteLine("  <tr>");
                    Output.WriteLine("    <td bgcolor=\"#cccccc\">");
                    Output.WriteLine("      <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">");
                    Output.WriteLine("        <tr>");
                    Output.WriteLine("          <td bgcolor=\"#f4f4f4\"> &nbsp; <span class=\"groupname\"><span class=\"groupnamecaps\">&nbsp;T</span>AGS BY <span class=\"groupnamecaps\">U</span>SER</span></td>");
                    Output.WriteLine("        </tr>");
                    Output.WriteLine("      </table>");
                    Output.WriteLine("    </td>");
                    Output.WriteLine("  </tr>");
                    Output.WriteLine("</table>");


                    int       userid  = Convert.ToInt32(submode);
                    DataTable allTags = SobekCM_Database.View_Tags_By_User(userid, Tracer);

                    if ((allTags != null) && (allTags.Rows.Count > 0))
                    {
                        Output.WriteLine("<table width=\"700px\" border=\"0\" align=\"center\"><tr><td>");
                        Output.WriteLine("<br />This RequestSpecificValues.Current_User added the following " + allTags.Rows.Count + " descriptive tags:");
                        Output.WriteLine("<blockquote>");

                        foreach (DataRow thisTagRow in allTags.Rows)
                        {
                            string   description = thisTagRow["Description_Tag"].ToString();
                            string   bibid       = thisTagRow["BibID"].ToString();
                            string   vid         = thisTagRow["VID"].ToString();
                            DateTime date        = Convert.ToDateTime(thisTagRow["Date_Modified"]);


                            string first_name = thisTagRow["FirstName"].ToString();
                            string nick_name  = thisTagRow["NickName"].ToString();
                            string last_name  = thisTagRow["LastName"].ToString();
                            string full_name  = first_name + " " + last_name;
                            if (nick_name.Length > 0)
                            {
                                full_name = nick_name + " " + last_name;
                            }

                            Output.WriteLine(description + "<br /><i>Added by " + full_name + " on " + date.ToShortDateString() + "</i> &nbsp; &nbsp; &nbsp; ( <a href=\"?m=ldFC&b=" + bibid + "&v=" + vid + UrlWriterHelper.URL_Options(RequestSpecificValues.Current_Mode) + "\" target=\"" + bibid + vid + "\">view</a> )<br /><br />");
                        }

                        Output.WriteLine("</blockquote>");
                        Output.WriteLine("</td></tr></table>");
                    }
                    else
                    {
                        Output.WriteLine("<br /><br /><center><b>This RequestSpecificValues.Current_User has not added any descriptive tags to any items or it is not a valid userid.</b></center><br /><br />");
                    }
                }
            }

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