/// <summary> Constructor for a new instance of the SobekCM_Navigation_Object which stores /// all of the information about an individual request. </summary> /// <param name="QueryString">Query string information for analysis</param> /// <param name="Base_URL"> Requested base URL (without query string, etc..)</param> /// <param name="User_Languages"> Languages preferred by user, per their browser settings </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library</param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> public SobekCM_Navigation_Object(NameValueCollection QueryString, string Base_URL, string[] User_Languages, Aggregation_Code_Manager Code_Manager, Dictionary<string, string> Aggregation_Aliases, ref Item_Lookup_Object All_Items_Lookup, Portal_List URL_Portals, Custom_Tracer Tracer ) { // Do general item construction Constructor_Helper(); // If there is a mode value or an aggregation value, use the legacy query string analyzer if ((QueryString["m"] != null) || (QueryString["a"] != null) || (QueryString["c"] != null) || (QueryString["s"] != null) || (QueryString["g"] != null) || (QueryString["h"] != null) || (QueryString["i"] != null)) { // Use the legacy query string analyzer SobekCM_QueryString_Analyzer_Legacy analyzerLegacy = new SobekCM_QueryString_Analyzer_Legacy(); analyzerLegacy.Parse_Query(QueryString, this, Base_URL, User_Languages, Code_Manager, Aggregation_Aliases, ref All_Items_Lookup, URL_Portals, Tracer); } else { // Analyze the query string with the default analyzer SobekCM_QueryString_Analyzer analyzer = new SobekCM_QueryString_Analyzer(); analyzer.Parse_Query(QueryString, this, Base_URL, User_Languages, Code_Manager, Aggregation_Aliases, ref All_Items_Lookup, URL_Portals, Tracer); } }
/// <summary> Constructor for a new instance of the Text_MainWriter class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param> /// <param name="Current_User"> Currently logged on user </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="Item_List"> Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param> /// <param name="Search_History"> List of recent searches performed against this digital library </param> /// <param name="Icon_Dictionary"> Dictionary of information about every wordmark/icon in this digital library, used to build the wordmarks subpage </param> /// <param name="Thematic_Headings"> Headings under which all the highlighted collections on the main home page are organized </param> /// <param name="Public_Folder"> Object contains the information about the public folder to display </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations </param> /// <param name="Web_Skin_Collection"> Collection of all the web skins </param> /// <param name="Checked_Items"> List of all items which are currently checked out for single fair use and the IP address currently viewing the item</param> /// <param name="IP_Restrictions"> Any possible restriction on item access by IP ranges </param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Site_Map"> Optional site map object used to render a navigational tree-view on left side of static web content pages </param> /// <param name="Items_In_Title"> List of items within the current title ( used for the Item Group display )</param> /// <param name="Static_Web_Content"> HTML content-based browse, info, or imple CMS-style web content objects. These are objects which are read from a static HTML file and much of the head information must be maintained </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public Html_MainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List<iSearch_Title_Result> Paged_Results, Item_Aggregation_Child_Page Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page, SobekCM_Skin_Object HTML_Skin, User_Object Current_User, Language_Support_Info Translator, Aggregation_Code_Manager Code_Manager, Item_Lookup_Object Item_List, Statistics_Dates Stats_Date_Range, Recent_Searches Search_History, Dictionary<string, Wordmark_Icon> Icon_Dictionary, List<Thematic_Heading> Thematic_Headings, Public_User_Folder Public_Folder, Dictionary<string, string> Aggregation_Aliases, SobekCM_Skin_Collection Web_Skin_Collection, Checked_Out_Items_List Checked_Items, IP_Restriction_Ranges IP_Restrictions, Portal_List URL_Portals, SobekCM_SiteMap Site_Map, SobekCM_Items_In_Title Items_In_Title, HTML_Based_Content Static_Web_Content, Custom_Tracer Tracer ) : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, Static_Web_Content) { // Save parameters htmlSkin = HTML_Skin; translator = Translator; codeManager = Code_Manager; itemList = Item_List; statsDateRange = Stats_Date_Range; searchHistory = Search_History; currentUser = Current_User; iconList = Icon_Dictionary; thematicHeadings = Thematic_Headings; publicFolder = Public_Folder; aggregationAliases = Aggregation_Aliases; webSkins = Web_Skin_Collection; checkedItems = Checked_Items; ipRestrictionInfo = IP_Restrictions; urlPortals = URL_Portals; siteMap = Site_Map; itemsInTitle = Items_In_Title; // Set some defaults // Handle basic events which may be fired by the internal header if (HttpContext.Current.Request.Form["internal_header_action"] != null) { // Pull the action value string internalHeaderAction = HttpContext.Current.Request.Form["internal_header_action"].Trim(); // Was this to hide or show the header? if ((internalHeaderAction == "hide") || (internalHeaderAction == "show")) { // Pull the current visibility from the session bool shown = !((HttpContext.Current.Session["internal_header"] != null) && (HttpContext.Current.Session["internal_header"].ToString() == "hidden")); if ((internalHeaderAction == "hide") && (shown)) { HttpContext.Current.Session["internal_header"] = "hidden"; currentMode.Redirect(); return; } if ((internalHeaderAction == "show") && (!shown)) { HttpContext.Current.Session["internal_header"] = "shown"; currentMode.Redirect(); return; } } } try { // Create the html sub writer now switch (Current_Mode.Mode) { case Display_Mode_Enum.Internal: subwriter = new Internal_HtmlSubwriter(iconList, currentUser, codeManager); break; case Display_Mode_Enum.Statistics: subwriter = new Statistics_HtmlSubwriter(searchHistory, codeManager, statsDateRange); break; case Display_Mode_Enum.Preferences: subwriter = new Preferences_HtmlSubwriter(currentMode); break; case Display_Mode_Enum.Error: subwriter = new Error_HtmlSubwriter(false); // Send the email now if (currentMode.Caught_Exception != null) { if (currentMode.Error_Message.Length == 0) currentMode.Error_Message = "Unknown exception caught"; Email_Information(currentMode.Error_Message, currentMode.Caught_Exception, Tracer, false); } break; case Display_Mode_Enum.Legacy_URL: subwriter = new LegacyUrl_HtmlSubwriter(); break; case Display_Mode_Enum.Item_Print: subwriter = new Print_Item_HtmlSubwriter(currentItem, codeManager, translator, currentMode); break; case Display_Mode_Enum.Contact: StringBuilder builder = new StringBuilder(); builder.Append("\n\nSUBMISSION INFORMATION\n"); builder.Append("\tDate:\t\t\t\t" + DateTime.Now.ToString() + "\n"); string lastMode = String.Empty; try { if (HttpContext.Current.Session["Last_Mode"] != null) lastMode = HttpContext.Current.Session["Last_Mode"].ToString(); builder.Append("\tIP Address:\t\t\t" + HttpContext.Current.Request.UserHostAddress + "\n"); builder.Append("\tHost Name:\t\t\t" + HttpContext.Current.Request.UserHostName + "\n"); builder.Append("\tBrowser:\t\t\t" + HttpContext.Current.Request.Browser.Browser + "\n"); builder.Append("\tBrowser Platform:\t\t" + HttpContext.Current.Request.Browser.Platform + "\n"); builder.Append("\tBrowser Version:\t\t" + HttpContext.Current.Request.Browser.Version + "\n"); builder.Append("\tBrowser Language:\t\t"); bool first = true; string[] languages = HttpContext.Current.Request.UserLanguages; if (languages != null) foreach (string thisLanguage in languages) { if (first) { builder.Append(thisLanguage); first = false; } else { builder.Append(", " + thisLanguage); } } builder.Append("\n\nHISTORY\n"); if (HttpContext.Current.Session["LastSearch"] != null) builder.Append("\tLast Search:\t\t" + HttpContext.Current.Session["LastSearch"] + "\n"); if (HttpContext.Current.Session["LastResults"] != null) builder.Append("\tLast Results:\t\t" + HttpContext.Current.Session["LastResults"] + "\n"); if (HttpContext.Current.Session["Last_Mode"] != null) builder.Append("\tLast Mode:\t\t\t" + HttpContext.Current.Session["Last_Mode"] + "\n"); builder.Append("\tURL:\t\t\t\t" + HttpContext.Current.Items["Original_URL"]); } catch { } subwriter = new Contact_HtmlSubwriter(lastMode, builder.ToString(), currentMode, hierarchyObject); break; case Display_Mode_Enum.Contact_Sent: subwriter = new Contact_HtmlSubwriter(String.Empty, String.Empty, currentMode, hierarchyObject); break; case Display_Mode_Enum.Simple_HTML_CMS: subwriter = new Web_Content_HtmlSubwriter(hierarchyObject, currentMode, htmlSkin, htmlBasedContent, siteMap); break; case Display_Mode_Enum.My_Sobek: subwriter = new MySobek_HtmlSubwriter(results_statistics, paged_results, codeManager, itemList, hierarchyObject, htmlSkin, translator, currentMode, currentItem, currentUser, iconList, statsDateRange, webSkins, Tracer); break; case Display_Mode_Enum.Administrative: subwriter = new Admin_HtmlSubwriter(codeManager, itemList, hierarchyObject, htmlSkin, translator, currentMode, aggregationAliases, webSkins, currentUser, ipRestrictionInfo, iconList, urlPortals, thematicHeadings, Tracer); break; case Display_Mode_Enum.Results: subwriter = new Search_Results_HtmlSubwriter(results_statistics, paged_results, codeManager, translator, itemList, currentUser); break; case Display_Mode_Enum.Public_Folder: subwriter = new Public_Folder_HtmlSubwriter(results_statistics, paged_results, codeManager, translator, itemList, currentUser, publicFolder); break; case Display_Mode_Enum.Search: case Display_Mode_Enum.Aggregation: subwriter = new Aggregation_HtmlSubwriter(hierarchyObject, currentMode, htmlSkin, translator, thisBrowseObject, results_statistics, paged_results, codeManager, itemList, thematicHeadings, currentUser, htmlBasedContent, Tracer); break; case Display_Mode_Enum.Item_Display: if ((!currentMode.Invalid_Item) && (currentItem != null)) { bool show_toc = false; if (HttpContext.Current.Session["Show TOC"] != null) { Boolean.TryParse(HttpContext.Current.Session["Show TOC"].ToString(), out show_toc); } // Check that this item is not checked out by another user bool itemCheckedOutByOtherUser = false; if (currentItem.Behaviors.CheckOut_Required) { if (!checkedItems.Check_Out(currentItem.Web.ItemID, HttpContext.Current.Request.UserHostAddress)) { itemCheckedOutByOtherUser = true; } } // Check to see if this is IP restricted string restriction_message = String.Empty; if (currentItem.Behaviors.IP_Restriction_Membership > 0) { if (HttpContext.Current != null) { int user_mask = (int)HttpContext.Current.Session["IP_Range_Membership"]; int comparison = currentItem.Behaviors.IP_Restriction_Membership & user_mask; if (comparison == 0) { int restriction = currentItem.Behaviors.IP_Restriction_Membership; int restriction_counter = 0; while (restriction % 2 != 1) { restriction = restriction >> 1; restriction_counter++; } restriction_message = ipRestrictionInfo[restriction_counter].Item_Restricted_Statement; } } } // Create the item viewer writer subwriter = new Item_HtmlSubwriter(currentItem, currentPage, currentUser, codeManager, translator, show_toc, (SobekCM_Library_Settings.JP2ServerUrl.Length > 0), currentMode, hierarchyObject, restriction_message, itemsInTitle, Tracer); ((Item_HtmlSubwriter)subwriter).Item_Checked_Out_By_Other_User = itemCheckedOutByOtherUser; } else { // Create the invalid item html subwrite and write the HTML subwriter = new Error_HtmlSubwriter(true); } break; } } catch (Exception ee) { // Send to the dashboard if ((HttpContext.Current.Request.UserHostAddress == "127.0.0.1") || (HttpContext.Current.Request.UserHostAddress == HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]) || (HttpContext.Current.Request.Url.ToString().IndexOf("localhost") >= 0)) { Tracer.Add_Trace("Html_MainWriter.Constructor", "Exception caught!", Custom_Trace_Type_Enum.Error); Tracer.Add_Trace("Html_MainWriter.Constructor", ee.Message, Custom_Trace_Type_Enum.Error); Tracer.Add_Trace("Html_MainWriter.Constructor", ee.StackTrace, Custom_Trace_Type_Enum.Error); // Wrap this into the SobekCM Exception SobekCM_Traced_Exception newException = new SobekCM_Traced_Exception("Exception caught while building the mode-specific HTML Subwriter", ee, Tracer); // Save this to the session state, and then forward to the dashboard HttpContext.Current.Session["Last_Exception"] = newException; HttpContext.Current.Response.Redirect("dashboard.aspx", false); Current_Mode.Request_Completed = true; return; } else { subwriter = new Error_HtmlSubwriter(false); } } if (subwriter != null) { subwriter.Mode = currentMode; subwriter.Skin = htmlSkin; subwriter.Current_Aggregation = hierarchyObject; } }
/// <summary> Verifies that each global object is built and builds them upon request </summary> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <param name="Reload_All"> Flag indicates if everything should be reloaded/repopulated</param> /// <param name="Skins"> [REF] Collection of all the web skins </param> /// <param name="Translator"> [REF] Language support object which handles simple translational duties </param> /// <param name="Code_Manager"> [REF] List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Icon_Dictionary"> [REF] Dictionary of information about every wordmark/icon in this digital library </param> /// <param name="Stats_Date_Range"> [REF] Object contains the start and end dates for the statistical data in the database </param> /// <param name="Thematic_Headings"> [REF] Headings under which all the highlighted collections on the main home page are organized </param> /// <param name="Aggregation_Aliases"> [REF] List of all existing aliases for existing aggregations </param> /// <param name="IP_Restrictions"> [REF] List of all IP Restriction ranges in use by this digital library </param> /// <param name="URL_Portals"> [REF] List of all web portals into this system </param> /// <param name="Mime_Types">[REF] Dictionary of MIME types by extension</param> public static void Build_Application_State(Custom_Tracer Tracer, bool Reload_All, ref SobekCM_Skin_Collection Skins, ref Language_Support_Info Translator, ref Aggregation_Code_Manager Code_Manager, ref Item_Lookup_Object All_Items_Lookup, ref Dictionary<string, Wordmark_Icon> Icon_Dictionary, ref Statistics_Dates Stats_Date_Range, ref List<Thematic_Heading> Thematic_Headings, ref Dictionary<string, string> Aggregation_Aliases, ref IP_Restriction_Ranges IP_Restrictions, ref Portal_List URL_Portals, ref Dictionary<string, Mime_Type_Info> Mime_Types, ref List<string> Item_Viewer_Priority ) { // Should we reload the data from the exteral configuraiton file? if (Reload_All) { SobekCM_Library_Settings.Read_Configuration_File(); if ( SobekCM_Library_Settings.Database_Connections.Count > 0 ) SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; SobekCM_Library_Settings.Refresh(SobekCM_Database.Get_Settings_Complete(null)); } // If there is no database connection string, there is a problem if ((SobekCM_Library_Settings.Database_Connections.Count == 0) || (String.IsNullOrEmpty(SobekCM_Library_Settings.Database_Connections[0].Connection_String))) { throw new ApplicationException("Missing database connection string!"); } // Set the database connection strings Resource_Object.Database.SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; // Set the workflow and disposition types if ((SobekCM_Library_Settings.Need_Workflow_And_Disposition_Types) || ( Reload_All )) { SobekCM_Library_Settings.Set_Workflow_And_Disposition_Types(SobekCM_Database.All_WorkFlow_Types, SobekCM_Database.All_Possible_Disposition_Types); } // Set the metadata types if ((SobekCM_Library_Settings.Need_Metadata_Types) || ( Reload_All )) { SobekCM_Library_Settings.Set_Metadata_Types(SobekCM_Database.Get_Metadata_Fields(null) ); } // Set the search stop words if ((SobekCM_Library_Settings.Need_Search_Stop_Words) || (Reload_All)) { SobekCM_Library_Settings.Search_Stop_Words = SobekCM_Database.Search_Stop_Words(Tracer); } // Check the list of thematic headings if ((Thematic_Headings == null) || (Reload_All)) { if (Thematic_Headings != null) { lock (Thematic_Headings) { if (!SobekCM_Database.Populate_Thematic_Headings(Thematic_Headings, Tracer)) { Thematic_Headings = null; throw SobekCM_Database.Last_Exception; } } } else { Thematic_Headings = new List<Thematic_Heading>(); if (!SobekCM_Database.Populate_Thematic_Headings(Thematic_Headings, Tracer)) { Thematic_Headings = null; throw SobekCM_Database.Last_Exception; } } } // Check the list of forwardings if ((Aggregation_Aliases == null) || (Reload_All)) { if (Aggregation_Aliases != null) { lock (Aggregation_Aliases) { SobekCM_Database.Populate_Aggregation_Aliases(Aggregation_Aliases, Tracer); } } else { Aggregation_Aliases = new Dictionary<string, string>(); SobekCM_Database.Populate_Aggregation_Aliases(Aggregation_Aliases, Tracer); } } // Check the list of constant skins if ((Skins == null) || (Skins.Count == 0) || (Reload_All)) { if (Skins != null) { lock (Skins) { SobekCM_Skin_Collection_Builder.Populate_Default_Skins(Skins, Tracer); } } else { Skins = new SobekCM_Skin_Collection(); SobekCM_Skin_Collection_Builder.Populate_Default_Skins(Skins, Tracer); } } // Check the list of all web portals if ((URL_Portals == null) || (URL_Portals.Count == 0) || (Reload_All)) { if (URL_Portals != null) { lock (URL_Portals) { SobekCM_Database.Populate_URL_Portals(URL_Portals, Tracer); } } else { URL_Portals = new Portal_List(); SobekCM_Database.Populate_URL_Portals(URL_Portals, Tracer); } } // Check the translation table has been loaded if (( Translator == null) || (Reload_All)) { // Get the translation hashes into memory if (Translator != null) { lock (Translator) { SobekCM_Database.Populate_Translations(Translator, Tracer); } } else { Translator = new Language_Support_Info(); SobekCM_Database.Populate_Translations(Translator, Tracer); } } // Check that the conversion from SobekCM Codes to Greenstone Codes has been loaded if ((Code_Manager == null) || (Reload_All)) { if (Code_Manager != null) { lock (Code_Manager) { SobekCM_Database.Populate_Code_Manager(Code_Manager, Tracer); } } else { Code_Manager = new Aggregation_Code_Manager(); SobekCM_Database.Populate_Code_Manager(Code_Manager, Tracer); } } // Check the statistics date range information if ((Stats_Date_Range == null) || (Reload_All)) { if (Stats_Date_Range != null) { // Get the translation hashes into memory lock (Stats_Date_Range) { SobekCM_Database.Populate_Statistics_Dates(Stats_Date_Range, Tracer); } } else { Stats_Date_Range = new Statistics_Dates(); SobekCM_Database.Populate_Statistics_Dates(Stats_Date_Range, Tracer); } } // Get the Icon list if ((Icon_Dictionary == null) || ( Reload_All )) { if (Icon_Dictionary != null) { // Get the translation hashes into memory lock (Icon_Dictionary) { SobekCM_Database.Populate_Icon_List(Icon_Dictionary, Tracer); } } else { Icon_Dictionary = new Dictionary<string, Wordmark_Icon>(); SobekCM_Database.Populate_Icon_List(Icon_Dictionary, Tracer); } } // Check the list of ip range restrictions if ((IP_Restrictions == null) || (Reload_All)) { if (IP_Restrictions != null) { lock (IP_Restrictions) { DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } } } else { DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions = new IP_Restriction_Ranges(); IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } } } // Get the MIME type list if ((Mime_Types == null) || (Reload_All)) { if (Mime_Types != null) { // Get the translation hashes into memory lock (Mime_Types) { SobekCM_Database.Populate_MIME_List(Mime_Types, Tracer); } } else { Mime_Types = new Dictionary<string, Mime_Type_Info>(); SobekCM_Database.Populate_MIME_List(Mime_Types, Tracer); } } // Check the list of forwardings if ((Item_Viewer_Priority == null) || (Reload_All)) { if (Item_Viewer_Priority != null) { lock (Item_Viewer_Priority) { Item_Viewer_Priority = SobekCM_Database.Get_Viewer_Priority(Tracer); } } else { Item_Viewer_Priority = SobekCM_Database.Get_Viewer_Priority(Tracer); } } // Check the IE hack CSS is loaded if ((HttpContext.Current.Application["NonIE_Hack_CSS"] == null) || (Reload_All)) { string css_file = HttpContext.Current.Server.MapPath("default/SobekCM_NonIE.css"); if (File.Exists(css_file)) { try { StreamReader reader = new StreamReader(css_file); HttpContext.Current.Application["NonIE_Hack_CSS"] = reader.ReadToEnd().Trim(); reader.Close(); } catch (Exception) { HttpContext.Current.Application["NonIE_Hack_CSS"] = "/* ERROR READING FILE: default/SobekCM_NonIE.css */"; throw; } } else { HttpContext.Current.Application["NonIE_Hack_CSS"] = String.Empty; } } }
/// <summary> Parse the query and set the internal variables </summary> /// <param name="QueryString"> QueryString collection passed from the main page </param> /// <param name="Navigator"> Navigation object to hold the mode information </param> /// <param name="Base_URL">Requested base URL (without query string, etc..)</param> /// <param name="User_Languages"> Languages preferred by user, per their browser settings </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library</param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> public void Parse_Query(NameValueCollection QueryString, SobekCM_Navigation_Object Navigator, string Base_URL, string[] User_Languages, Aggregation_Code_Manager Code_Manager, Dictionary<string, string> Aggregation_Aliases, ref Item_Lookup_Object All_Items_Lookup, Portal_List URL_Portals, Custom_Tracer Tracer ) { // This is the legacy URL reader, so this is not optimized as well as the new one. // Just make sure the item list is loaded here SobekCM_Database.Verify_Item_Lookup_Object(true, ref All_Items_Lookup, Tracer); // Set default mode to error Navigator.Mode = Display_Mode_Enum.Error; // If this has 'verb' then this is an OAI-PMH request if ( QueryString["verb"] != null ) { Navigator.Writer_Type = Writer_Type_Enum.OAI; return; } // Is there a TOC state set? if (QueryString["toc"] != null) { if (QueryString["toc"] == "y") { Navigator.TOC_Display = TOC_Display_Type_Enum.Show; } else if ( QueryString["toc"] == "n" ) { Navigator.TOC_Display = TOC_Display_Type_Enum.Hide; } } // Is there a language defined? If so, load right into the navigator if ( QueryString["l"] != null ) { if (( QueryString["l"].ToUpper() == "ES" ) || ( QueryString["l"].ToUpper() == "SP" )) { Navigator.Language = Web_Language_Enum.Spanish; } if ( QueryString["l"].ToUpper() == "FR" ) { Navigator.Language = Web_Language_Enum.French; } } // If there is flag indicating to show the trace route, save it if (QueryString["trace"] != null) { Navigator.Trace_Flag = QueryString["trace"].ToUpper() == "NO" ? Trace_Flag_Type_Enum.No : Trace_Flag_Type_Enum.Explicit; } else { Navigator.Trace_Flag = Trace_Flag_Type_Enum.Unspecified; } // Collect all the values into the strings Collect_Strings( QueryString ); // Get the valid URL Portal Navigator.Default_Aggregation = "all"; Portal urlPortal = URL_Portals.Get_Valid_Portal(Base_URL); Navigator.SobekCM_Instance_Abbreviation = urlPortal.Abbreviation; if (urlPortal.Default_Aggregation.Length > 0) { Navigator.Default_Aggregation = urlPortal.Default_Aggregation; Navigator.Aggregation = urlPortal.Default_Aggregation; } if (urlPortal.Default_Web_Skin.Length > 0) { Navigator.Default_Skin = urlPortal.Default_Web_Skin; Navigator.Skin = urlPortal.Default_Web_Skin; Navigator.Skin_In_URL = false; } // Save the interface if (currSkin.Length > 0) { Navigator.Skin = currSkin.ToLower(); Navigator.Skin_In_URL = true; } // Get the return url if there was one if (return_url.Length > 0) { Navigator.Return_URL = HttpUtility.UrlDecode(return_url); } // If there are no values in the query string, the // current mode should be the default if (( QueryString.Keys.Count == 0 ) && ( aggregation.Length == 0 )) { Navigator.Mode = Display_Mode_Enum.Aggregation; Navigator.Aggregation_Type = Aggregation_Type_Enum.Home; Navigator.Home_Type = Home_Type_Enum.List; return; } char default_html = 'h'; if (HttpContext.Current != null) { if ((HttpContext.Current.Session["user"] != null) || (HttpContext.Current.Request.Cookies["UfdcUser"] != null)) default_html = 'l'; } // If there is no mode listed, just set it to 'h' for home if (string.IsNullOrEmpty(mode)) { if ( search.Length > 0 ) { mode = default_html + "sb"; } else { if (( item.Length > 0 ) || ( bibid.Length > 0 )) { mode = default_html + "d"; } else { mode = default_html + "hl"; } } } // If the length is insufficient, try adding 'h' in front if ( mode.Length == 1 ) mode = default_html + mode; // Check for writer mode switch( mode[0] ) { case 'x': Navigator.Writer_Type = Writer_Type_Enum.XML; break; case 'd': Navigator.Writer_Type = Writer_Type_Enum.DataSet; break; case 't': Navigator.Writer_Type = Writer_Type_Enum.Text; break; case 'j': Navigator.Writer_Type = Writer_Type_Enum.JSON; break; case 'l': Navigator.Writer_Type = Writer_Type_Enum.HTML_LoggedIn; break; default: Navigator.Writer_Type = Writer_Type_Enum.HTML; break; } // Save the aggregation information Navigator.Aggregation = aggregation; Navigator.SubAggregation = subaggregation; // Perform switch, based on the mode switch ( mode[1] ) { case 'a': Admin_Block(Navigator); return; case 'b': Navigator.Mode = Display_Mode_Enum.Aggregation; Navigator.Aggregation_Type = Aggregation_Type_Enum.Browse_Info; Browse_Info_Block( Navigator ); return; case 'c': if ((mode == "hcs") || ( mode == "lcs" )) { Navigator.Mode = Display_Mode_Enum.Contact_Sent; } else { Navigator.Mode = Display_Mode_Enum.Contact; Navigator.Error_Message = error_message; } Navigator.Aggregation = aggregation; return; case 'd': Item_Display_Block(Navigator); return; case 'e': Text_Display(Navigator); return; case 'f': Item_Print_Block(Navigator); return; case 'g': Public_Folder_Block(Navigator); break; case 'h': Home_Block( Navigator ); return; case 'i': Navigator.Mode = Display_Mode_Enum.Aggregation; Navigator.Aggregation_Type = Aggregation_Type_Enum.Browse_Info; Browse_Info_Block(Navigator); return; case 'm': My_Sobek_Block(Navigator); return; case 'p': Navigator.Mode = Display_Mode_Enum.Preferences; return; case 'r': Results_Block(Navigator); return; case 's': // Performing a basic search Search_Block( Navigator ); return; case 't': Statistics_Block(Navigator); return; case 'z': Navigator.Mode = Display_Mode_Enum.Reset; return; default: Navigator.Mode = Display_Mode_Enum.Error; Navigator.Error_Message = "Unknown mode '" + mode + "'"; return; } }
/// <summary> Constructor for a new instance of the Portals_AdminViewer class </summary> /// <param name="User"> Authenticated user information </param> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public Portals_AdminViewer(User_Object User, SobekCM_Navigation_Object Current_Mode, Portal_List URL_Portals, Custom_Tracer Tracer) : base(User) { Tracer.Add_Trace("Portals_AdminViewer.Constructor", String.Empty); portals = URL_Portals; // Save the mode currentMode = Current_Mode; // Set action message to nothing to start actionMessage = String.Empty; // If the user cannot edit this, go back if (!user.Is_System_Admin) { Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Home; HttpContext.Current.Response.Redirect(Current_Mode.Redirect_URL()); } // Handle any post backs if (Current_Mode.isPostBack) { try { // Pull the standard values from the form NameValueCollection form = HttpContext.Current.Request.Form; string save_value = form["admin_portal_tosave"]; string action_value = form["admin_portal_action"]; // Switch, depending on the request if (action_value != null) { switch (action_value.Trim().ToLower()) { case "edit": // Get the values from the form for this new portal string edit_name = form["form_portal_name"].Trim(); string edit_abbr = form["form_portal_abbr"].Trim(); string edit_skin = form["form_portal_skin"].Trim(); string edit_aggr = form["form_portal_aggregation"].Trim(); string edit_url = form["form_portal_url"].Trim(); string edit_purl = form["form_portal_purl"].Trim(); int portalid = Convert.ToInt32(save_value); // Look for this to see if this was the pre-existing default bool isDefault = false; if ( portals.Default_Portal.ID == portalid ) { isDefault = true; } // Don't edit if the URL segment is empty and this is NOT default if ((!isDefault) && (edit_url.Trim().Length == 0)) { actionMessage = "ERROR: Non default portals MUST have a url segment associated."; } else { // Now, save this portal information int edit_id = SobekCM_Database.Edit_URL_Portal(portalid, edit_url, true, isDefault, edit_abbr, edit_name, edit_aggr, edit_skin, edit_purl, Tracer); if (edit_id > 0) actionMessage = "Edited existing URL portal '" + edit_name + "'"; else actionMessage = "Error editing URL portal."; } break; case "delete": actionMessage = SobekCM_Database.Delete_URL_Portal(Convert.ToInt32(save_value), Tracer) ? "URL portal deleted" : "Error deleting the URL portal"; break; case "new": // Get the values from the form for this new portal string new_name = form["admin_portal_name"]; string new_abbr = form["admin_portal_abbr"]; string new_skin = form["admin_portal_skin"]; string new_aggr = form["admin_portal_aggregation"]; string new_url = form["admin_portal_url"]; string new_purl = form["admin_portal_purl"]; // Save this to the database int new_id = SobekCM_Database.Edit_URL_Portal(-1, new_url, true, false, new_abbr, new_name, new_aggr, new_skin, new_purl, Tracer); if (new_id > 0) actionMessage = "Saved new URL portal '" + new_name + "'"; else actionMessage = "Error saving URL portal."; break; } } } catch (Exception) { actionMessage = "Exception caught while handling request"; } // Reload all the URL portals SobekCM_Database.Populate_URL_Portals(portals, Tracer); } }
/// <summary> Constructor for a new instance of the SobekCM_Navigation_Object which stores /// all of the information about an individual request. </summary> /// <param name="QueryString">Query string information for analysis</param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library</param> /// <param name="URL_Portals"> List of all web portals into this system </param> public SobekCM_Navigation_Object(NameValueCollection QueryString, Aggregation_Code_Manager Code_Manager, Dictionary<string, string> Aggregation_Aliases, ref Item_Lookup_Object All_Items_Lookup, Portal_List URL_Portals) { // Do general item construction Constructor_Helper(); // Analyze the query string with the default analyzer SobekCM_QueryString_Analyzer analyzer = new SobekCM_QueryString_Analyzer(); analyzer.Parse_Query(QueryString, this, String.Empty, null, Code_Manager, Aggregation_Aliases, ref All_Items_Lookup, URL_Portals, null); }
/// <summary> Constructor for a new instance of the SobekCM_Navigation_Object which stores /// all of the information about an individual request. </summary> /// <param name="QueryString">Query string information for analysis</param> /// <param name="Base_URL"> Requested base URL (without query string, etc..)</param> /// <param name="User_Languages"> Languages preferred by user, per their browser settings </param> /// <param name="Analyzer">Object to user for the URL analysis</param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library</param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> public SobekCM_Navigation_Object(NameValueCollection QueryString, string Base_URL, string[] User_Languages, iSobekCM_QueryString_Analyzer Analyzer, Aggregation_Code_Manager Code_Manager, Dictionary<string, string> Aggregation_Aliases, ref Item_Lookup_Object All_Items_Lookup, Portal_List URL_Portals, Custom_Tracer Tracer ) { // Do general item construction Constructor_Helper(); // Analyze the query string with the provided analyzer Analyzer.Parse_Query(QueryString, this, Base_URL, User_Languages, Code_Manager, Aggregation_Aliases, ref All_Items_Lookup, URL_Portals, Tracer); }
/// <summary> Verifies that each global object is built and builds them upon request </summary> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <param name="Reload_All"> Flag indicates if everything should be reloaded/repopulated</param> /// <param name="Skins"> [REF] Collection of all the web skins </param> /// <param name="Translator"> [REF] Language support object which handles simple translational duties </param> /// <param name="Code_Manager"> [REF] List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Icon_Dictionary"> [REF] Dictionary of information about every wordmark/icon in this digital library </param> /// <param name="Stats_Date_Range"> [REF] Object contains the start and end dates for the statistical data in the database </param> /// <param name="Thematic_Headings"> [REF] Headings under which all the highlighted collections on the main home page are organized </param> /// <param name="Aggregation_Aliases"> [REF] List of all existing aliases for existing aggregations </param> /// <param name="IP_Restrictions"> [REF] List of all IP Restriction ranges in use by this digital library </param> /// <param name="URL_Portals"> [REF] List of all web portals into this system </param> /// <param name="Mime_Types">[REF] Dictionary of MIME types by extension</param> public static void Build_Application_State(Custom_Tracer Tracer, bool Reload_All, ref SobekCM_Skin_Collection Skins, ref Language_Support_Info Translator, ref Aggregation_Code_Manager Code_Manager, ref Item_Lookup_Object All_Items_Lookup, ref Dictionary <string, Wordmark_Icon> Icon_Dictionary, ref Statistics_Dates Stats_Date_Range, ref List <Thematic_Heading> Thematic_Headings, ref Dictionary <string, string> Aggregation_Aliases, ref IP_Restriction_Ranges IP_Restrictions, ref Portal_List URL_Portals, ref Dictionary <string, Mime_Type_Info> Mime_Types) { // Should we reload the data from the exteral configuraiton file? if (Reload_All) { SobekCM_Library_Settings.Read_Configuration_File(); SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connection_String; SobekCM_Library_Settings.Refresh(SobekCM_Database.Get_Settings_Complete(null)); } // If there is no database connection string, there is a problem if (String.IsNullOrEmpty(SobekCM_Library_Settings.Database_Connection_String)) { throw new ApplicationException("Missing database connection string!"); } // Set the database connection strings Resource_Object.Database.SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connection_String; SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connection_String; // Set the workflow and disposition types if ((SobekCM_Library_Settings.Need_Workflow_And_Disposition_Types) || (Reload_All)) { SobekCM_Library_Settings.Set_Workflow_And_Disposition_Types(SobekCM_Database.All_WorkFlow_Types, SobekCM_Database.All_Possible_Disposition_Types); } // Set the metadata types if ((SobekCM_Library_Settings.Need_Metadata_Types) || (Reload_All)) { SobekCM_Library_Settings.Set_Metadata_Types(SobekCM_Database.Get_Metadata_Fields(null)); } // Set the search stop words if ((SobekCM_Library_Settings.Need_Search_Stop_Words) || (Reload_All)) { SobekCM_Library_Settings.Search_Stop_Words = SobekCM_Database.Search_Stop_Words(Tracer); } // Check the list of thematic headings if ((Thematic_Headings == null) || (Reload_All)) { if (Thematic_Headings != null) { lock (Thematic_Headings) { if (!SobekCM_Database.Populate_Thematic_Headings(Thematic_Headings, Tracer)) { Thematic_Headings = null; throw SobekCM_Database.Last_Exception; } } } else { Thematic_Headings = new List <Thematic_Heading>(); if (!SobekCM_Database.Populate_Thematic_Headings(Thematic_Headings, Tracer)) { Thematic_Headings = null; throw SobekCM_Database.Last_Exception; } } } // Check the list of forwardings if ((Aggregation_Aliases == null) || (Reload_All)) { if (Aggregation_Aliases != null) { lock (Aggregation_Aliases) { SobekCM_Database.Populate_Aggregation_Aliases(Aggregation_Aliases, Tracer); } } else { Aggregation_Aliases = new Dictionary <string, string>(); SobekCM_Database.Populate_Aggregation_Aliases(Aggregation_Aliases, Tracer); } } // Check the list of constant skins if ((Skins == null) || (Skins.Count == 0) || (Reload_All)) { if (Skins != null) { lock (Skins) { SobekCM_Skin_Collection_Builder.Populate_Default_Skins(Skins, Tracer); } } else { Skins = new SobekCM_Skin_Collection(); SobekCM_Skin_Collection_Builder.Populate_Default_Skins(Skins, Tracer); } } // Check the list of all web portals if ((URL_Portals == null) || (URL_Portals.Count == 0) || (Reload_All)) { if (URL_Portals != null) { lock (URL_Portals) { SobekCM_Database.Populate_URL_Portals(URL_Portals, Tracer); } } else { URL_Portals = new Portal_List(); SobekCM_Database.Populate_URL_Portals(URL_Portals, Tracer); } } // Check the translation table has been loaded if ((Translator == null) || (Reload_All)) { // Get the translation hashes into memory if (Translator != null) { lock (Translator) { SobekCM_Database.Populate_Translations(Translator, Tracer); } } else { Translator = new Language_Support_Info(); SobekCM_Database.Populate_Translations(Translator, Tracer); } } // Check that the conversion from SobekCM Codes to Greenstone Codes has been loaded if ((Code_Manager == null) || (Reload_All)) { if (Code_Manager != null) { lock (Code_Manager) { SobekCM_Database.Populate_Code_Manager(Code_Manager, Tracer); } } else { Code_Manager = new Aggregation_Code_Manager(); SobekCM_Database.Populate_Code_Manager(Code_Manager, Tracer); } } // Check the statistics date range information if ((Stats_Date_Range == null) || (Reload_All)) { if (Stats_Date_Range != null) { // Get the translation hashes into memory lock (Stats_Date_Range) { SobekCM_Database.Populate_Statistics_Dates(Stats_Date_Range, Tracer); } } else { Stats_Date_Range = new Statistics_Dates(); SobekCM_Database.Populate_Statistics_Dates(Stats_Date_Range, Tracer); } } // Get the Icon list if ((Icon_Dictionary == null) || (Reload_All)) { if (Icon_Dictionary != null) { // Get the translation hashes into memory lock (Icon_Dictionary) { SobekCM_Database.Populate_Icon_List(Icon_Dictionary, Tracer); } } else { Icon_Dictionary = new Dictionary <string, Wordmark_Icon>(); SobekCM_Database.Populate_Icon_List(Icon_Dictionary, Tracer); } } // Check the list of ip range restrictions if ((IP_Restrictions == null) || (Reload_All)) { if (IP_Restrictions != null) { lock (IP_Restrictions) { DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } } } else { DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions = new IP_Restriction_Ranges(); IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } } } // Get the MIME type list if ((Mime_Types == null) || (Reload_All)) { if (Mime_Types != null) { // Get the translation hashes into memory lock (Mime_Types) { SobekCM_Database.Populate_MIME_List(Mime_Types, Tracer); } } else { Mime_Types = new Dictionary <string, Mime_Type_Info>(); SobekCM_Database.Populate_MIME_List(Mime_Types, Tracer); } } }
/// <summary> Constructor for a new instance of the Admin_HtmlSubwriter class </summary> /// <param name="Results_Statistics"> Information about the entire set of results for a browse of a user's bookshelf folder </param> /// <param name="Paged_Results"> Single page of results for a browse of a user's bookshelf folder, within the entire set </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Current_Item">Current item to edit, if the user is requesting to edit an item</param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations </param> /// <param name="Web_Skin_Collection"> Collection of all the web skins </param> /// <param name="Current_User"> Currently logged on user </param> /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param> /// <param name="IP_Restrictions"> List of all IP Restriction ranges in use by this digital library </param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param> /// <param name="Thematic_Headings"> Headings under which all the highlighted collections on the home page are organized </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public Admin_HtmlSubwriter(Search_Results_Statistics Results_Statistics, List<iSearch_Title_Result> Paged_Results, Aggregation_Code_Manager Code_Manager, Item_Lookup_Object All_Items_Lookup, Item_Aggregation Hierarchy_Object, SobekCM_Skin_Object HTML_Skin, Language_Support_Info Translator, SobekCM_Navigation_Object Current_Mode, SobekCM_Item Current_Item, Dictionary<string,string> Aggregation_Aliases, SobekCM_Skin_Collection Web_Skin_Collection, User_Object Current_User, IP_Restriction_Ranges IP_Restrictions, Dictionary<string, Wordmark_Icon> Icon_Table, Portal_List URL_Portals, Statistics_Dates Stats_Date_Range, List<Thematic_Heading> Thematic_Headings, Custom_Tracer Tracer ) { Tracer.Add_Trace("Admin_HtmlSubwriter.Constructor", "Saving values and geting user object back from the session"); resultsStatistics = Results_Statistics; pagedResults = Paged_Results; codeManager = Code_Manager; itemList = All_Items_Lookup; htmlSkin = HTML_Skin; translator = Translator; currentCollection = Hierarchy_Object; currentItem = Current_Item; user = Current_User; ipRestrictions = IP_Restrictions; iconTable = Icon_Table; statsDates = Stats_Date_Range; if (Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Log_Out) { Tracer.Add_Trace("Admin_HtmlSubwriter.Constructor", "Performing logout"); HttpContext.Current.Session["user"] = null; HttpContext.Current.Response.Redirect("?"); } if ((Current_Mode.My_Sobek_Type != My_Sobek_Type_Enum.Logon) && (user != null) && (user.Is_Temporary_Password)) { Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.New_Password; } if (Current_Mode.Logon_Required) Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Logon; // If the user is not an admin, and admin was selected, reroute this if ((!Current_User.Is_System_Admin) && (!Current_User.Is_Portal_Admin)) { Current_Mode.Mode = Display_Mode_Enum.My_Sobek; Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Home; Current_Mode.My_Sobek_SubMode = String.Empty; HttpContext.Current.Response.Redirect(Current_Mode.Redirect_URL()); } Tracer.Add_Trace("Admin_HtmlSubwriter.Constructor", "Building the my sobek viewer object"); switch (Current_Mode.Admin_Type) { case Admin_Type_Enum.Aggregation_Single: adminViewer = new Aggregation_Single_AdminViewer(user, Current_Mode, codeManager, Thematic_Headings, Web_Skin_Collection, Tracer); break; case Admin_Type_Enum.Home: adminViewer = new Home_AdminViewer(user, Current_Mode, Tracer); break; case Admin_Type_Enum.Builder_Status: adminViewer = new Builder_AdminViewer(user, Current_Mode); break; case Admin_Type_Enum.Interfaces: adminViewer = new Skins_AdminViewer(user, Current_Mode, Web_Skin_Collection, Tracer); break; case Admin_Type_Enum.Forwarding: adminViewer = new Aliases_AdminViewer(user, Current_Mode, Aggregation_Aliases, Tracer); break; case Admin_Type_Enum.Wordmarks: adminViewer = new Wordmarks_AdminViewer(user, Current_Mode, Tracer); break; case Admin_Type_Enum.URL_Portals: adminViewer = new Portals_AdminViewer(user, Current_Mode, URL_Portals, Tracer); break; case Admin_Type_Enum.Users: adminViewer = new Users_AdminViewer(user, Current_Mode, codeManager, Tracer); break; case Admin_Type_Enum.User_Groups: adminViewer = new User_Group_AdminViewer(user, Current_Mode, codeManager, Tracer); break; case Admin_Type_Enum.Aggregations_Mgmt: adminViewer = new Aggregations_Mgmt_AdminViewer(user, Current_Mode, codeManager, Tracer); break; case Admin_Type_Enum.IP_Restrictions: adminViewer = new IP_Restrictions_AdminViewer(user, Current_Mode, ipRestrictions, Tracer); break; case Admin_Type_Enum.Thematic_Headings: adminViewer = new Thematic_Headings_AdminViewer(user, Current_Mode, Thematic_Headings, Tracer); break; case Admin_Type_Enum.Settings: adminViewer = new Settings_AdminViewer(user, Current_Mode, Tracer); break; case Admin_Type_Enum.Projects: if (Current_Mode.My_Sobek_SubMode.Length > 1) { string project_code = Current_Mode.My_Sobek_SubMode.Substring(1); Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Checking cache for valid project file"); if (user != null) { SobekCM_Item projectObject = Cached_Data_Manager.Retrieve_Project(user.UserID, project_code, Tracer); if (projectObject != null) { Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Valid project file found in cache"); adminViewer = new Edit_Item_Metadata_MySobekViewer(user, Current_Mode, itemList, projectObject, codeManager, iconTable, htmlSkin, Tracer); } else { if (SobekCM_Database.Get_All_Projects_Templates(Tracer).Tables[0].Select("ProjectCode='" + project_code + "'").Length > 0) { Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Building project file from (possible) PMETS"); string pmets_file = SobekCM_Library_Settings.Base_MySobek_Directory + "projects\\" + Current_Mode.My_Sobek_SubMode.Substring(1) + ".pmets"; SobekCM_Item pmets_item = File.Exists(pmets_file) ? SobekCM_Item.Read_METS(pmets_file) : new SobekCM_Item(); pmets_item.Bib_Info.Main_Title.Title = "Project level metadata for '" + project_code + "'"; pmets_item.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Project; pmets_item.BibID = project_code.ToUpper(); pmets_item.VID = "00001"; pmets_item.Source_Directory = SobekCM_Library_Settings.Base_MySobek_Directory + "projects\\"; Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Adding project file to cache"); Cached_Data_Manager.Store_Project(user.UserID, project_code, pmets_item, Tracer); adminViewer = new Edit_Item_Metadata_MySobekViewer(user, Current_Mode, itemList, pmets_item, codeManager, iconTable, htmlSkin, Tracer); } } } } if (adminViewer == null) adminViewer = new Projects_AdminViewer(user, Current_Mode, Tracer); break; } // Pass in the navigation and translator information adminViewer.CurrentMode = Current_Mode; adminViewer.Translator = translator; }
/// <summary> Populates the collection of possible portals from the database </summary> /// <param name="Portals"> List of possible URL portals into this library/cms </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns> TRUE if successul, otherwise FALSE </returns> /// <remarks> This calls the 'SobekCM_Get_All_Portals' stored procedure </remarks> public static bool Populate_URL_Portals(Portal_List Portals, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_Database.Populate_URL_Portals", "Pull URL portal information from the database"); } try { // Build the parameter list SqlParameter[] paramList = new SqlParameter[1]; paramList[0] = new SqlParameter("@activeonly", true); // Define a temporary dataset DataSet tempSet = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, "SobekCM_Get_All_Portals", paramList); lock (Portals) { // Clear the current list Portals.Clear(); // If there was no data for this collection and entry point, return null (an ERROR occurred) if (tempSet.Tables.Count > 0) { // Add each provided portal foreach (DataRow thisRow in tempSet.Tables[0].Rows) { // Pull the basic data for this portal int portalId = Convert.ToInt16(thisRow[0]); string baseUrl = thisRow[1].ToString().Trim(); bool isDefault = Convert.ToBoolean(thisRow[3]); string abbreviation = thisRow[4].ToString().Trim(); string name = thisRow[5].ToString().Trim(); string basePurl = thisRow[6].ToString().Trim(); if (isDefault) { if ((baseUrl == "*") || (baseUrl == "default")) baseUrl = String.Empty; } // Get matching skins and aggregations DataRow[] aggrs = tempSet.Tables[1].Select("PortalID=" + portalId); DataRow[] skins = tempSet.Tables[2].Select("PortalID=" + portalId); // Find the default aggregation string defaultAggr = String.Empty; if (aggrs.Length > 0) defaultAggr = aggrs[0][1].ToString().ToLower(); // Find the default skin string defaultSkin = String.Empty; if (skins.Length > 0) defaultSkin = skins[0][1].ToString().ToLower(); // Add this portal Portal newPortal = Portals.Add_Portal(portalId, name, abbreviation, defaultAggr, defaultSkin, baseUrl, basePurl); // If this is default, set it if (isDefault) Portals.Default_Portal = newPortal; } } } if (Portals.Count == 0) { // Add the default url portal then Portals.Default_Portal = Portals.Add_Portal(-1, "Default SobekCM Library", "Sobek", "all", "sobek", "", ""); } // Return the built collection as readonly return true; } catch (Exception ee) { // Add the default url portal then Portals.Default_Portal = Portals.Add_Portal(-1, "Default SobekCM Library", "Sobek", "all", "sobek", "", ""); if (Tracer != null) { Tracer.Add_Trace("SobekCM_Database.Populate_URL_Portals", "Exception caught during database work", Custom_Trace_Type_Enum.Error); Tracer.Add_Trace("SobekCM_Database.Populate_URL_Portals", ee.Message, Custom_Trace_Type_Enum.Error); Tracer.Add_Trace("SobekCM_Database.Populate_URL_Portals", ee.StackTrace, Custom_Trace_Type_Enum.Error); } return false; } }
/// <summary> Constructor for a new instance of the Text_MainWriter class </summary> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param> /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param> /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param> /// <param name="Current_Item"> Current item to display </param> /// <param name="Current_Page"> Current page within the item</param> /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param> /// <param name="Current_User"> Currently logged on user </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="Item_List"> Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param> /// <param name="Search_History"> List of recent searches performed against this digital library </param> /// <param name="Icon_Dictionary"> Dictionary of information about every wordmark/icon in this digital library, used to build the wordmarks subpage </param> /// <param name="Thematic_Headings"> Headings under which all the highlighted collections on the main home page are organized </param> /// <param name="Public_Folder"> Object contains the information about the public folder to display </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations </param> /// <param name="Web_Skin_Collection"> Collection of all the web skins </param> /// <param name="Checked_Items"> List of all items which are currently checked out for single fair use and the IP address currently viewing the item</param> /// <param name="IP_Restrictions"> Any possible restriction on item access by IP ranges </param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Site_Map"> Optional site map object used to render a navigational tree-view on left side of static web content pages </param> /// <param name="Items_In_Title"> List of items within the current title ( used for the Item Group display )</param> /// <param name="Static_Web_Content"> HTML content-based browse, info, or imple CMS-style web content objects. These are objects which are read from a static HTML file and much of the head information must be maintained </param> public Html_MainWriter(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Hierarchy_Object, Search_Results_Statistics Results_Statistics, List<iSearch_Title_Result> Paged_Results, Item_Aggregation_Browse_Info Browse_Object, SobekCM_Item Current_Item, Page_TreeNode Current_Page, SobekCM_Skin_Object HTML_Skin, User_Object Current_User, Language_Support_Info Translator, Aggregation_Code_Manager Code_Manager, Item_Lookup_Object Item_List, Statistics_Dates Stats_Date_Range, Recent_Searches Search_History, Dictionary<string, Wordmark_Icon> Icon_Dictionary, List<Thematic_Heading> Thematic_Headings, Public_User_Folder Public_Folder, Dictionary<string, string> Aggregation_Aliases, SobekCM_Skin_Collection Web_Skin_Collection, Checked_Out_Items_List Checked_Items, IP_Restriction_Ranges IP_Restrictions, Portal_List URL_Portals, SobekCM_SiteMap Site_Map, SobekCM_Items_In_Title Items_In_Title, HTML_Based_Content Static_Web_Content ) : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, Static_Web_Content) { // Save parameters htmlSkin = HTML_Skin; translator = Translator; codeManager = Code_Manager; itemList = Item_List; statsDateRange = Stats_Date_Range; searchHistory = Search_History; currentUser = Current_User; iconList = Icon_Dictionary; thematicHeadings = Thematic_Headings; publicFolder = Public_Folder; aggregationAliases = Aggregation_Aliases; webSkins = Web_Skin_Collection; checkedItems = Checked_Items; ipRestrictionInfo = IP_Restrictions; urlPortals = URL_Portals; siteMap = Site_Map; itemsInTitle = Items_In_Title; // Set some defaults finishPageInAddFinalHtmlMethod = false; // Handle basic events which may be fired by the internal header if (HttpContext.Current.Request.Form["internal_header_action"] != null) { // Pull the action value string internalHeaderAction = HttpContext.Current.Request.Form["internal_header_action"].Trim(); // Was this to hide or show the header? if ((internalHeaderAction == "hide") || (internalHeaderAction == "show")) { // Pull the current visibility from the session bool shown = true; if ((HttpContext.Current.Session["internal_header"] != null) && (HttpContext.Current.Session["internal_header"].ToString() == "hidden")) { shown = false; } if ((internalHeaderAction == "hide") && (shown)) { HttpContext.Current.Session["internal_header"] = "hidden"; HttpContext.Current.Response.Redirect(currentMode.Redirect_URL(), true); } if ((internalHeaderAction == "show") && (!shown)) { HttpContext.Current.Session["internal_header"] = "shown"; HttpContext.Current.Response.Redirect(currentMode.Redirect_URL(), true); } } } }
/// <summary> Constructor for a new instance of the Static_Pages_Builder class </summary> /// <param name="Primary_Web_Server_URL"> URL for the primary web server </param> /// <param name="Static_Data_Location"> Network location for the data directory </param> /// <param name="Base_Network_Location"> Location where the web application files site for this </param> /// <remarks> This constructor pulls all the needed information from the database</remarks> public Static_Pages_Builder(string Primary_Web_Server_URL, string Static_Data_Location, string Base_Network_Location ) { primaryWebServerUrl = Primary_Web_Server_URL; staticSobekcmDataLocation = Static_Data_Location; staticSobekcmLocation = Base_Network_Location; tracer = new Custom_Tracer(); assistant = new SobekCM_Assistant(); // Build all the objects needed by the SobekCM Library iconList = new Dictionary<string, Wordmark_Icon>(); SobekCM_Database.Populate_Icon_List(iconList, tracer); translations = new Language_Support_Info(); SobekCM_Database.Populate_Translations(translations, tracer); codeManager = new Aggregation_Code_Manager(); SobekCM_Database.Populate_Code_Manager(codeManager, tracer); Portal_List urlPortals = new Portal_List(); SobekCM_Database.Populate_URL_Portals(urlPortals, tracer); defaultSkin = urlPortals.Default_Portal.Default_Web_Skin; skinsCollection = new SobekCM_Skin_Collection(); SobekCM_Skin_Collection_Builder.Populate_Default_Skins(skinsCollection, null); // Set some constant settings // SobekCM.Library.SobekCM_Library_Settings.Watermarks_URL = primary_web_server_url + "/design/wordmarks/"; SobekCM_Library_Settings.Base_SobekCM_Location_Relative = primaryWebServerUrl; // Create the mode object currentMode = new SobekCM_Navigation_Object { ViewerCode = "FC", Skin = defaultSkin, Mode = Display_Mode_Enum.Item_Display, Language = Web_Language_Enum.English, Base_URL = primaryWebServerUrl }; // Ensure all the folders exist if (!Directory.Exists(staticSobekcmDataLocation)) Directory.CreateDirectory(staticSobekcmDataLocation); if (!Directory.Exists(staticSobekcmDataLocation + "\\rss")) Directory.CreateDirectory(staticSobekcmDataLocation + "\\rss"); // Disable the cached data manager Cached_Data_Manager.Disabled = true; }
/// <summary> Constructor for a new instance of the MySobek_HtmlSubwriter class </summary> /// <param name="Results_Statistics"> Information about the entire set of results for a browse of a user's bookshelf folder </param> /// <param name="Paged_Results"> Single page of results for a browse of a user's bookshelf folder, within the entire set </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Hierarchy_Object"> Current item aggregation object to display </param> /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Current_Item">Current item to edit, if the user is requesting to edit an item</param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations </param> /// <param name="Web_Skin_Collection"> Collection of all the web skins </param> /// <param name="Current_User"> Currently logged on user </param> /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param> /// <param name="IP_Restrictions"> List of all IP Restriction ranges in use by this digital library </param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param> /// <param name="Thematic_Headings"> Headings under which all the highlighted collections on the home page are organized </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public MySobek_HtmlSubwriter(Search_Results_Statistics Results_Statistics, List<iSearch_Title_Result> Paged_Results, Aggregation_Code_Manager Code_Manager, Item_Lookup_Object All_Items_Lookup, Item_Aggregation Hierarchy_Object, SobekCM_Skin_Object HTML_Skin, Language_Support_Info Translator, SobekCM_Navigation_Object Current_Mode, SobekCM_Item Current_Item, Dictionary<string,string> Aggregation_Aliases, SobekCM_Skin_Collection Web_Skin_Collection, User_Object Current_User, IP_Restriction_Ranges IP_Restrictions, Dictionary<string, Wordmark_Icon> Icon_Table, Portal_List URL_Portals, Statistics_Dates Stats_Date_Range, List<Thematic_Heading> Thematic_Headings, Custom_Tracer Tracer ) { Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Saving values and geting user object back from the session"); resultsStatistics = Results_Statistics; pagedResults = Paged_Results; codeManager = Code_Manager; itemList = All_Items_Lookup; htmlSkin = HTML_Skin; translator = Translator; currentCollection = Hierarchy_Object; currentItem = Current_Item; user = Current_User; ipRestrictions = IP_Restrictions; iconTable = Icon_Table; statsDates = Stats_Date_Range; if (Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Log_Out) { Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Performing logout"); HttpContext.Current.Session["user"] = null; HttpContext.Current.Response.Redirect("?"); } if ((Current_Mode.My_Sobek_Type != My_Sobek_Type_Enum.Logon) && (user != null) && (user.Is_Temporary_Password)) { Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.New_Password; } if (Current_Mode.Logon_Required) Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Logon; Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Building the my sobek viewer object"); switch (Current_Mode.My_Sobek_Type) { case My_Sobek_Type_Enum.Home: mySobekViewer = new Home_MySobekViewer(user, Tracer); break; case My_Sobek_Type_Enum.New_Item: mySobekViewer = new New_Group_And_Item_MySobekViewer(user, Current_Mode, itemList, codeManager, iconTable, htmlSkin, translator, Tracer); break; case My_Sobek_Type_Enum.Folder_Management: mySobekViewer = new Folder_Mgmt_MySobekViewer(user, resultsStatistics, pagedResults, codeManager, itemList, currentCollection, htmlSkin, translator, Current_Mode, Tracer); break; case My_Sobek_Type_Enum.Saved_Searches: mySobekViewer = new Saved_Searches_MySobekViewer(user, translator, Current_Mode, Tracer); break; case My_Sobek_Type_Enum.Preferences: mySobekViewer = new Preferences_MySobekViewer(user, Tracer); break; case My_Sobek_Type_Enum.Logon: mySobekViewer = new Logon_MySobekViewer(Current_Mode, Tracer); break; case My_Sobek_Type_Enum.New_Password: mySobekViewer = new NewPassword_MySobekViewer(user, Tracer); break; case My_Sobek_Type_Enum.Delete_Item: mySobekViewer = new Delete_Item_MySobekViewer(user, Current_Mode, All_Items_Lookup, Tracer); break; case My_Sobek_Type_Enum.Edit_Item_Behaviors: mySobekViewer = new Edit_Item_Behaviors_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer); break; case My_Sobek_Type_Enum.Edit_Item_Metadata: mySobekViewer = new Edit_Item_Metadata_MySobekViewer(user, Current_Mode, itemList, currentItem, codeManager, iconTable, htmlSkin, Tracer); break; case My_Sobek_Type_Enum.File_Management: mySobekViewer = new File_Management_MySobekViewer(user, Current_Mode, Current_Item, itemList, codeManager, iconTable, htmlSkin, translator, Tracer); break; case My_Sobek_Type_Enum.Edit_Group_Behaviors: mySobekViewer = new Edit_Group_Behaviors_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer); break; case My_Sobek_Type_Enum.Edit_Group_Serial_Hierarchy: mySobekViewer = new Edit_Serial_Hierarchy_MySobekViewer(user); break; case My_Sobek_Type_Enum.Group_Add_Volume: // Pull the list of items tied to this group SobekCM_Items_In_Title itemsInTitle = Cached_Data_Manager.Retrieve_Items_In_Title(currentItem.BibID, Tracer); if (itemsInTitle == null) { // Get list of information about this item group and save the item list DataSet itemDetails = SobekCM_Database.Get_Item_Group_Details(currentItem.BibID, Tracer); itemsInTitle = new SobekCM_Items_In_Title(itemDetails.Tables[1]); // Store in cache if retrieved Cached_Data_Manager.Store_Items_In_Title(currentItem.BibID, itemsInTitle, Tracer); } mySobekViewer = new Group_Add_Volume_MySobekViewer(user, Current_Mode, itemList, currentItem, codeManager, iconTable, htmlSkin, itemsInTitle, translator, Tracer); break; case My_Sobek_Type_Enum.Group_AutoFill_Volumes: mySobekViewer = new Group_AutoFill_Volume_MySobekViewer(user); break; case My_Sobek_Type_Enum.Group_Mass_Update_Items: mySobekViewer = new Mass_Update_Items_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer); break; case My_Sobek_Type_Enum.User_Tags: mySobekViewer = new User_Tags_MySobekViewer(user, Tracer); break; case My_Sobek_Type_Enum.User_Usage_Stats: mySobekViewer = new User_Usage_Stats_MySobekViewer(user, Current_Mode, statsDates, Tracer); break; } // Pass in the navigation and translator information mySobekViewer.CurrentMode = Current_Mode; mySobekViewer.Translator = translator; }
/// <summary> Parse the query and set the internal variables </summary> /// <param name="QueryString"> QueryString collection passed from the main page </param> /// <param name="navigator"> Navigation object to hold the mode information </param> /// <param name="Base_URL">Requested base URL (without query string, etc..)</param> /// <param name="User_Languages"> Languages preferred by user, per their browser settings </param> /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections </param> /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library</param> /// <param name="URL_Portals"> List of all web portals into this system </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> public void Parse_Query(NameValueCollection QueryString, SobekCM_Navigation_Object navigator, string Base_URL, string[] User_Languages, Aggregation_Code_Manager Code_Manager, Dictionary<string, string> Aggregation_Aliases, ref Item_Lookup_Object All_Items_Lookup, Portal_List URL_Portals, Custom_Tracer Tracer ) { // Set default mode to error navigator.Mode = Display_Mode_Enum.Error; // If this has 'verb' then this is an OAI-PMH request if ( QueryString["verb"] != null ) { navigator.Writer_Type = Writer_Type_Enum.OAI; return; } // Is there a TOC state set? if (QueryString["toc"] != null) { if (QueryString["toc"] == "y") { navigator.TOC_Display = TOC_Display_Type_Enum.Show; } else if ( QueryString["toc"] == "n" ) { navigator.TOC_Display = TOC_Display_Type_Enum.Hide; } } // Determine the default language, per the browser settings if (User_Languages != null) { foreach (string thisLanguage in User_Languages) { if (thisLanguage.IndexOf("en") == 0) { navigator.Default_Language = Web_Language_Enum.English; break; } if (thisLanguage.IndexOf("fr") == 0) { navigator.Default_Language = Web_Language_Enum.French; break; } if (thisLanguage.IndexOf("es") == 0) { navigator.Default_Language = Web_Language_Enum.Spanish; break; } } } // Is there a language defined? If so, load right into the navigator navigator.Language = navigator.Default_Language; if ( QueryString["l"] != null ) { if (( QueryString["l"] == "es" ) || ( QueryString["l"] == "sp" )) { navigator.Language = Web_Language_Enum.Spanish; } if ( QueryString["l"] == "fr" ) { navigator.Language = Web_Language_Enum.French; } if (QueryString["l"] == "en") { navigator.Language = Web_Language_Enum.English; } } // If there is flag indicating to show the trace route, save it if (QueryString["trace"] != null) { navigator.Trace_Flag = QueryString["trace"].ToUpper() == "NO" ? Trace_Flag_Type_Enum.No : Trace_Flag_Type_Enum.Explicit; } else { navigator.Trace_Flag = Trace_Flag_Type_Enum.Unspecified; } // Did the user request to have it render like it would for a search robot? if (QueryString["robot"] != null) { navigator.Is_Robot = true; } // Was a fragment specified in the query string? if (QueryString["fragment"] != null) { navigator.Fragment = QueryString["fragment"]; } // Parse URL request different now, depending on if this is a legacy URL type or the new URL type navigator.Mode = Display_Mode_Enum.None; // CHECK FOR LEGACY VALUES // Check for legacy bibid / vid information, since this will be supported indefinitely if (( QueryString["b"] != null ) || ( QueryString["bib"] != null )) { navigator.BibID = QueryString["b"] ?? QueryString["bib"]; if ( navigator.BibID.Length > 0 ) { navigator.Mode = Display_Mode_Enum.Item_Display; if ( QueryString["v"] != null ) navigator.VID = QueryString["v"]; else if ( QueryString["vid"] != null ) navigator.VID = QueryString["vid"]; } // No other item information is collected here anymore.. just return return; } // Get the valid URL Portal navigator.Default_Aggregation = "all"; Portal urlPortal = URL_Portals.Get_Valid_Portal(Base_URL); navigator.SobekCM_Instance_Abbreviation = urlPortal.Abbreviation; navigator.SobekCM_Instance_Name = urlPortal.Name; navigator.Portal_PURL = urlPortal.Base_PURL; if (urlPortal.Default_Aggregation.Length > 0) { navigator.Default_Aggregation = urlPortal.Default_Aggregation; navigator.Aggregation = urlPortal.Default_Aggregation; } if (urlPortal.Default_Web_Skin.Length > 0) { navigator.Default_Skin = urlPortal.Default_Web_Skin; navigator.Skin = urlPortal.Default_Web_Skin; navigator.Skin_in_URL = false; } // Collect the interface string if (QueryString["n"] != null) { string currSkin = HttpUtility.HtmlEncode(QueryString["n"].ToLower().Replace("'", "")); // Save the interface if (currSkin.Length > 0) { if (currSkin.IndexOf(",") > 0) currSkin = currSkin.Substring(0, currSkin.IndexOf(",")); navigator.Skin = currSkin.ToLower(); navigator.Skin_in_URL = true; } } // Set the default mode navigator.Mode = Display_Mode_Enum.Aggregation_Home; navigator.Home_Type = Home_Type_Enum.List; // Get any url rewrite which occurred if (QueryString["urlrelative"] != null) { string urlrewrite = QueryString["urlrelative"].ToLower(); if (urlrewrite.Length > 0) { // Split the url relative list string[] url_relative_info = urlrewrite.Split("/".ToCharArray()); List<string> url_relative_list = (from thisPart in url_relative_info where thisPart.Length > 0 select thisPart.ToLower()).ToList(); // Determine the main writer (html, json, xml, oai-pmh, etc..) navigator.Writer_Type = Writer_Type_Enum.HTML; if ( url_relative_list.Count > 0 ) { switch (url_relative_list[0]) { case "l": navigator.Writer_Type = Writer_Type_Enum.HTML_LoggedIn; url_relative_list.RemoveAt(0); break; case "my": navigator.Writer_Type = Writer_Type_Enum.HTML_LoggedIn; break; case "json": navigator.Writer_Type = Writer_Type_Enum.JSON; url_relative_list.RemoveAt(0); break; case "dataset": navigator.Writer_Type = Writer_Type_Enum.DataSet; url_relative_list.RemoveAt(0); break; case "xml": navigator.Writer_Type = Writer_Type_Enum.XML; url_relative_list.RemoveAt(0); break; case "textonly": navigator.Writer_Type = Writer_Type_Enum.Text; url_relative_list.RemoveAt(0); break; } } // Is the first part of the list one of these constants? if (( url_relative_list.Count > 0 ) && ( url_relative_list[0].Length > 0 )) { switch ( url_relative_list[0] ) { case "gatorlink": case "shibboleth": navigator.Mode = Display_Mode_Enum.My_Sobek; navigator.My_Sobek_Type = My_Sobek_Type_Enum.Shibboleth_Landing; break; case "internal": navigator.Mode = Display_Mode_Enum.Internal; navigator.Internal_Type = Internal_Type_Enum.Aggregations_List; if ( url_relative_list.Count > 1 ) { switch( url_relative_list[1] ) { case "aggregations": navigator.Internal_Type = Internal_Type_Enum.Aggregations_List; if (url_relative_list.Count > 2) { if (url_relative_list[2] == "list") { if (url_relative_list.Count > 3) navigator.Info_Browse_Mode = url_relative_list[3]; } else { navigator.Internal_Type = Internal_Type_Enum.Aggregations; navigator.Info_Browse_Mode = url_relative_list[2].Replace("_"," "); } } break; case "cache": navigator.Internal_Type = Internal_Type_Enum.Cache; break; case "new": navigator.Internal_Type = Internal_Type_Enum.New_Items; if (url_relative_list.Count > 2) { navigator.Info_Browse_Mode = url_relative_list[2]; } break; case "failures": navigator.Internal_Type = Internal_Type_Enum.Build_Failures; if (url_relative_list.Count > 2) navigator.Info_Browse_Mode = url_relative_list[2]; break; case "wordmarks": navigator.Internal_Type = Internal_Type_Enum.Wordmarks; break; } } break; case "contact": navigator.Mode = Display_Mode_Enum.Contact; if ( url_relative_list.Count > 1 ) { if (url_relative_list[1] == "sent") { navigator.Mode = Display_Mode_Enum.Contact_Sent; } else { navigator.Aggregation = url_relative_list[1]; } } if (QueryString["em"] != null) navigator.Error_Message = QueryString["em"]; break; case "folder": navigator.Mode = Display_Mode_Enum.Public_Folder; if (url_relative_list.Count >= 2) { try { navigator.FolderID = Convert.ToInt32(url_relative_list[1]); } catch { navigator.FolderID = -1; } // Look for result display type if (url_relative_list.Count >=3 ) { switch (url_relative_list[2]) { case "brief": navigator.Result_Display_Type = Result_Display_Type_Enum.Brief; break; case "export": navigator.Result_Display_Type = Result_Display_Type_Enum.Export; break; case "citation": navigator.Result_Display_Type = Result_Display_Type_Enum.Full_Citation; break; case "image": navigator.Result_Display_Type = Result_Display_Type_Enum.Full_Image; break; case "map": navigator.Result_Display_Type = Result_Display_Type_Enum.Map; break; case "table": navigator.Result_Display_Type = Result_Display_Type_Enum.Table; break; case "thumbs": navigator.Result_Display_Type = Result_Display_Type_Enum.Thumbnails; break; default: navigator.Result_Display_Type = Result_Display_Type_Enum.Brief; break; } } // Look for a page number if (url_relative_list.Count >= 4 ) { string possible_page = url_relative_list[3]; if ((possible_page.Length > 0) && (is_String_Number(possible_page))) { ushort page_result; UInt16.TryParse(possible_page, out page_result); navigator.Page = page_result; } } } break; case "my": navigator.Mode = Display_Mode_Enum.My_Sobek; if (QueryString["return"] != null) navigator.Return_URL = QueryString["return"]; if ( url_relative_list.Count > 1 ) { switch( url_relative_list[1] ) { case "logon": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Logon; if (QueryString["return"] != null) navigator.Return_URL = QueryString["return"]; break; case "home": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Home; if (QueryString["return"] != null) navigator.Return_URL = QueryString["return"]; break; case "delete": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Delete_Item; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.VID = url_relative_list[3]; break; case "submit": navigator.My_Sobek_Type = My_Sobek_Type_Enum.New_Item; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "behaviors": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Edit_Item_Behaviors; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.VID = url_relative_list[3]; if (url_relative_list.Count > 4) navigator.My_Sobek_SubMode = url_relative_list[4]; break; case "edit": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Edit_Item_Metadata; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.VID = url_relative_list[3]; if (url_relative_list.Count > 4) navigator.My_Sobek_SubMode = url_relative_list[4]; break; case "files": navigator.My_Sobek_Type = My_Sobek_Type_Enum.File_Management; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.VID = url_relative_list[3]; if (url_relative_list.Count > 4) navigator.My_Sobek_SubMode = url_relative_list[4]; break; case "addvolume": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Group_Add_Volume; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "autofill": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Group_AutoFill_Volumes; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "massupdate": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Group_Mass_Update_Items; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "groupbehaviors": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Edit_Group_Behaviors; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "serialhierarchy": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Edit_Group_Serial_Hierarchy; if (url_relative_list.Count > 2) navigator.BibID = url_relative_list[2].ToUpper(); if (url_relative_list.Count > 3) navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "bookshelf": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Folder_Management; navigator.Result_Display_Type = Result_Display_Type_Enum.Bookshelf; if (url_relative_list.Count > 2) { navigator.My_Sobek_SubMode = url_relative_list[2]; if (url_relative_list.Count > 3) { switch (navigator.My_Sobek_SubMode) { case "brief": navigator.Result_Display_Type = Result_Display_Type_Enum.Brief; navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "export": navigator.Result_Display_Type = Result_Display_Type_Enum.Export; navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "thumbs": navigator.Result_Display_Type = Result_Display_Type_Enum.Thumbnails; navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "table": navigator.Result_Display_Type = Result_Display_Type_Enum.Table; navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "citation": navigator.Result_Display_Type = Result_Display_Type_Enum.Full_Citation; navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "image": navigator.Result_Display_Type = Result_Display_Type_Enum.Full_Image; navigator.My_Sobek_SubMode = url_relative_list[3]; break; default: if (is_String_Number(url_relative_list[3])) { ushort page_result; UInt16.TryParse(url_relative_list[3], out page_result); navigator.Page = page_result; } break; } } if ((url_relative_list.Count > 4) && ( is_String_Number( url_relative_list[4] ))) { ushort page_result; UInt16.TryParse(url_relative_list[4], out page_result); navigator.Page = page_result; } } break; case "preferences": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Preferences; break; case "logout": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Log_Out; if (QueryString["return"] != null) navigator.Return_URL = QueryString["return"]; break; case "gatorlink": case "shibboleth": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Shibboleth_Landing; if (QueryString["return"] != null) navigator.Return_URL = QueryString["return"]; break; case "searches": navigator.My_Sobek_Type = My_Sobek_Type_Enum.Saved_Searches; break; case "tags": navigator.My_Sobek_Type = My_Sobek_Type_Enum.User_Tags; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "stats": navigator.My_Sobek_Type = My_Sobek_Type_Enum.User_Usage_Stats; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; } } break; case "admin": navigator.Mode = Display_Mode_Enum.Administrative; navigator.Admin_Type = Admin_Type_Enum.Home; if (QueryString["return"] != null) navigator.Return_URL = QueryString["return"]; if (url_relative_list.Count > 1) { switch (url_relative_list[1]) { case "builder": navigator.Admin_Type = Admin_Type_Enum.Builder_Status; break; case "aggregations": navigator.Admin_Type = Admin_Type_Enum.Aggregations_Mgmt; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "editaggr": navigator.Admin_Type = Admin_Type_Enum.Aggregation_Single; if (url_relative_list.Count > 2) navigator.Aggregation = url_relative_list[2]; if (url_relative_list.Count > 3) navigator.My_Sobek_SubMode = url_relative_list[3]; break; case "aliases": navigator.Admin_Type = Admin_Type_Enum.Forwarding; break; case "webskins": navigator.Admin_Type = Admin_Type_Enum.Interfaces; break; case "projects": navigator.Admin_Type = Admin_Type_Enum.Projects; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "restrictions": navigator.Admin_Type = Admin_Type_Enum.IP_Restrictions; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "portals": navigator.Admin_Type = Admin_Type_Enum.URL_Portals; break; case "users": navigator.Admin_Type = Admin_Type_Enum.Users; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "groups": navigator.Admin_Type = Admin_Type_Enum.User_Groups; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "wordmarks": navigator.Admin_Type = Admin_Type_Enum.Wordmarks; break; case "reset": navigator.Admin_Type = Admin_Type_Enum.Reset; break; case "headings": navigator.Admin_Type = Admin_Type_Enum.Thematic_Headings; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; case "settings": navigator.Admin_Type = Admin_Type_Enum.Settings; if (url_relative_list.Count > 2) navigator.My_Sobek_SubMode = url_relative_list[2]; break; } } break; case "preferences": navigator.Mode = Display_Mode_Enum.Preferences; break; case "stats": case "statistics": navigator.Mode = Display_Mode_Enum.Statistics; if ( url_relative_list.Count > 1 ) { switch( url_relative_list[1] ) { case "itemcount": navigator.Statistics_Type = Statistics_Type_Enum.Item_Count_Standard_View; if ( url_relative_list.Count > 2 ) { switch( url_relative_list[2]) { case "arbitrary": navigator.Statistics_Type = Statistics_Type_Enum.Item_Count_Arbitrary_View; if (url_relative_list.Count > 3) { navigator.Info_Browse_Mode = url_relative_list[3]; } break; case "growth": navigator.Statistics_Type = Statistics_Type_Enum.Item_Count_Growth_View; break; case "text": navigator.Statistics_Type = Statistics_Type_Enum.Item_Count_Text; break; case "standard": navigator.Statistics_Type = Statistics_Type_Enum.Item_Count_Standard_View; break; } } break; case "searches": navigator.Statistics_Type = Statistics_Type_Enum.Recent_Searches; break; case "usage": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Overall; if ( url_relative_list.Count > 2 ) { switch( url_relative_list[2]) { case "all": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Overall; break; case "history": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Collection_History; if ( url_relative_list.Count > 3 ) { switch( url_relative_list[3] ) { case "text": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Collection_History_Text; break; default: navigator.Info_Browse_Mode = url_relative_list[3]; break; } if ((String.IsNullOrEmpty(navigator.Info_Browse_Mode)) && (url_relative_list.Count > 4)) navigator.Info_Browse_Mode = url_relative_list[4]; } break; case "collections": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Collections_By_Date; if (url_relative_list.Count > 3) navigator.Info_Browse_Mode = url_relative_list[3]; break; case "definitions": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Definitions; break; case "titles": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Titles_By_Collection; if (( String.IsNullOrEmpty( navigator.Info_Browse_Mode )) && ( url_relative_list.Count > 4 )) navigator.Info_Browse_Mode = url_relative_list[4]; break; case "items": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Item_Views_By_Date; if ( url_relative_list.Count > 3 ) { switch( url_relative_list[3] ) { case "date": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Item_Views_By_Date; break; case "top": navigator.Statistics_Type = Statistics_Type_Enum.Usage_Items_By_Collection; break; case "text": navigator.Statistics_Type = Statistics_Type_Enum.Usage_By_Date_Text; break; default: navigator.Info_Browse_Mode = url_relative_list[3]; break; } if (( String.IsNullOrEmpty( navigator.Info_Browse_Mode )) && ( url_relative_list.Count > 4 )) navigator.Info_Browse_Mode = url_relative_list[4]; } break; } } break; } } break; case "partners": if (navigator.Default_Aggregation == "all") { navigator.Mode = Display_Mode_Enum.Aggregation_Home; navigator.Aggregation = String.Empty; navigator.Home_Type = Home_Type_Enum.Partners_List; if ((url_relative_list.Count > 1) && (url_relative_list[1] == "thumbs")) { navigator.Home_Type = Home_Type_Enum.Partners_Thumbnails; } } else { aggregation_querystring_analyze(navigator, QueryString, navigator.Default_Aggregation, url_relative_list); } break; case "tree": navigator.Mode = Display_Mode_Enum.Aggregation_Home; navigator.Aggregation = String.Empty; navigator.Home_Type = Home_Type_Enum.Tree_Collapsed; if ((url_relative_list.Count > 1) && (url_relative_list[1] == "expanded")) { navigator.Home_Type = Home_Type_Enum.Tree_Expanded; } break; case "brief": navigator.Mode = Display_Mode_Enum.Aggregation_Home; navigator.Aggregation = String.Empty; navigator.Home_Type = Home_Type_Enum.Descriptions; break; case "personalized": navigator.Mode = Display_Mode_Enum.Aggregation_Home; navigator.Aggregation = String.Empty; navigator.Home_Type = Home_Type_Enum.Personalized; break; case "all": //if ( navigator.Default_Aggregation == "all" ) // aggregation_querystring_analyze(navigator, QueryString, "all", url_relative_list.GetRange(1, url_relative_list.Count - 1)); //else aggregation_querystring_analyze(navigator, QueryString, navigator.Default_Aggregation, url_relative_list); break; case "new": //if (navigator.Default_Aggregation != "all") aggregation_querystring_analyze(navigator, QueryString, navigator.Default_Aggregation, url_relative_list); break; case "map": case "advanced": case "text": case "results": case "contains": case "exact": case "resultslike": case "browseby": case "info": aggregation_querystring_analyze(navigator, QueryString, navigator.Default_Aggregation, url_relative_list); break; // This was none of the main constant mode settings, default: // First check to see if the first term was an item aggregation alias, which // allows for the alias to overwrite an existing aggregation code (limited usability // but can be used to hide an existing aggregation easily) if (Aggregation_Aliases.ContainsKey(url_relative_list[0])) { // Perform all aggregation_style checks next string aggregation_code = Aggregation_Aliases[url_relative_list[0]]; navigator.Aggregation_Alias = url_relative_list[0]; aggregation_querystring_analyze( navigator, QueryString, aggregation_code, url_relative_list.GetRange(1, url_relative_list.Count - 1)); } else if ( Code_Manager.isValidCode( url_relative_list[0] )) { // This is an item aggregation call // Perform all aggregation_style checks next aggregation_querystring_analyze( navigator, QueryString, url_relative_list[0], url_relative_list.GetRange(1, url_relative_list.Count - 1 )); } else if ((SobekCM_Database.Verify_Item_Lookup_Object(true, ref All_Items_Lookup, Tracer)) && (All_Items_Lookup.Contains_BibID(url_relative_list[0].ToUpper()))) { // This is a BibID for an existing title with at least one public item navigator.BibID = url_relative_list[0].ToUpper(); navigator.Mode = Display_Mode_Enum.Item_Display; // Is the next part a VID? int current_list_index = 1; if (url_relative_list.Count > 1) { string possible_vid = url_relative_list[1].Trim().PadLeft(5, '0'); if ((All_Items_Lookup.Contains_BibID_VID(navigator.BibID, possible_vid)) || ( possible_vid == "00000" )) { navigator.VID = possible_vid; current_list_index++; } } // Look for the item print mode now if ((url_relative_list.Count > current_list_index) && (url_relative_list[current_list_index] == "print")) { // This is an item print request navigator.Mode = Display_Mode_Enum.Item_Print; // Since we need special characters for ranges, etc.. the viewer code // is in the options query string variable in this case if (QueryString["options"] != null) { navigator.ViewerCode = QueryString["options"]; } } else { // Look for the viewercode next if (url_relative_list.Count > current_list_index) { string possible_viewercode = url_relative_list[current_list_index].Trim(); // Get the view code if (possible_viewercode.Length > 0) { // Get the viewer code navigator.ViewerCode = possible_viewercode; // Now, get the page if ((navigator.ViewerCode.Length > 0) && (Char.IsNumber(navigator.ViewerCode[0]))) { // Look for the first number int numberEnd = navigator.ViewerCode.Length; int count = 0; foreach (char thisChar in navigator.ViewerCode) { if (!Char.IsNumber(thisChar)) { numberEnd = count; break; } count++; } // Get the page navigator.Page = Convert.ToUInt16(navigator.ViewerCode.Substring(0, numberEnd)); } } else { // Sequence is set to 1 navigator.Page = 1; } // Used or discarded the possible viewer code (used unless length of zero ) current_list_index++; // Look for a subpage now, if there since there was a (possible) viewer code if (url_relative_list.Count > current_list_index) { string possible_subpage = url_relative_list[current_list_index].Trim(); if (is_String_Number(possible_subpage)) { navigator.SubPage = Convert.ToUInt16(possible_subpage); } } } } // Check for any view port option information in the query string if (QueryString["vo"] != null) { string viewport_options = QueryString["vo"]; if (viewport_options.Length > 0) { navigator.Viewport_Size = Convert.ToUInt16("0" + viewport_options[0]); if (viewport_options.Length > 1) { navigator.Viewport_Zoom = (ushort)(Convert.ToUInt16("0" + viewport_options[1]) + 1); if (navigator.Viewport_Zoom > 5) navigator.Viewport_Zoom = 5; if (navigator.Viewport_Zoom < 1) navigator.Viewport_Zoom = 1; if (viewport_options.Length > 2) { navigator.Viewport_Rotation = Convert.ToUInt16("0" + viewport_options[2]); } } } } // Check for view port point in the query string if (QueryString["vp"] != null) { string viewport_point = QueryString["vp"]; // Get the viewport point if ((viewport_point.Length > 0) && (viewport_point.IndexOf(",") > 0)) { string[] split = viewport_point.Split(",".ToCharArray()); navigator.Viewport_Point_X = Convert.ToInt32(split[0]); navigator.Viewport_Point_Y = Convert.ToInt32(split[1]); } } // Collect number of thumbnails per page if (QueryString["nt"] != null) { short nt_temp; if (short.TryParse(QueryString["nt"], out nt_temp)) navigator.Thumbnails_Per_Page = nt_temp; } // Collect size of thumbnails per page if (QueryString["ts"] != null) { short ts_temp; if (short.TryParse(QueryString["ts"], out ts_temp)) navigator.Size_Of_Thumbnails = ts_temp; } // Collect the text search string if (QueryString["search"] != null) navigator.Text_Search = QueryString["search"].Replace("+"," "); // If coordinates were here, save them if (QueryString["coord"] != null) navigator.Coordinates = QueryString["coord"]; // If a page is requested by filename (rather than sequenc), collect that if (QueryString["file"] != null) navigator.Page_By_FileName = QueryString["file"]; } else { // Maybe this is a web content / info page navigator.Mode = Display_Mode_Enum.Simple_HTML_CMS; StringBuilder possibleInfoModeBuilder = new StringBuilder(); if (url_relative_list.Count > 0) { possibleInfoModeBuilder.Append(url_relative_list[0]); } for (int i = 1; i < url_relative_list.Count; i++) { possibleInfoModeBuilder.Append("/" + url_relative_list[i]); } string possible_info_mode = possibleInfoModeBuilder.ToString().Replace("'", "").Replace("\"", ""); string filename = possible_info_mode; string base_source = SobekCM_Library_Settings.Base_Directory + "design\\webcontent"; string source = base_source; if ((possible_info_mode.IndexOf("\\") > 0) || (possible_info_mode.IndexOf("/") > 0)) { source = source + "\\" + possible_info_mode.Replace("/", "\\"); string[] split = source.Split("\\".ToCharArray()); filename = split[split.Length - 1]; source = source.Substring(0, source.Length - filename.Length); } if (Directory.Exists(source)) { string[] matching_file = Directory.GetFiles(source, filename + ".htm*"); if (matching_file.Length > 0) { navigator.Info_Browse_Mode = possible_info_mode; navigator.Page_By_FileName = matching_file[0]; } } if ( navigator.Page_By_FileName.Length == 0 ) { // This may point to the default html in the parent directory if ((Directory.Exists(source + "\\" + filename)) && (File.Exists(source + "\\" + filename + "\\default.html"))) { navigator.Info_Browse_Mode = possible_info_mode; navigator.Page_By_FileName = source + "\\" + filename + "\\default.html"; } else { if (navigator.Default_Aggregation == "all") { navigator.Info_Browse_Mode = "default"; navigator.Page_By_FileName = base_source + "\\default.html"; } } } // Last choice would be if this is a default aggregation if ((navigator.Page_By_FileName.Length == 0) && (navigator.Default_Aggregation != "all")) { aggregation_querystring_analyze(navigator, QueryString, navigator.Default_Aggregation, url_relative_list); } } break; } } } } }