public void Set_Main_Writer() { // If this is for HTML or HTML logged in, try to get the web skin object string current_skin_code = currentMode.Skin.ToUpper(); if ((currentMode.Writer_Type == Writer_Type_Enum.HTML) || (currentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)) { // Check if a different skin should be used if this is an item display if ((currentMode.Mode == Display_Mode_Enum.Item_Display) || (currentMode.Mode == Display_Mode_Enum.Item_Print)) { if ((currentItem != null) && (currentItem.Behaviors.Web_Skin_Count > 0)) { if (!currentItem.Behaviors.Web_Skins.Contains(current_skin_code)) { string new_skin_code = currentItem.Behaviors.Web_Skins[0]; current_skin_code = new_skin_code; } } } // Check if a differente skin should be used if this is a collection display if ((hierarchyObject != null) && ( hierarchyObject.Web_Skins != null ) && (hierarchyObject.Web_Skins.Count > 0)) { // Do NOT do this replacement if the web skin is in the URL and this is admin mode if ((!currentMode.Skin_In_URL) || (currentMode.Mode != Display_Mode_Enum.Administrative)) { if (!hierarchyObject.Web_Skins.Contains(current_skin_code.ToLower())) { current_skin_code = hierarchyObject.Web_Skins[0]; } } } SobekCM_Assistant assistant = new SobekCM_Assistant(); // Try to get the web skin from the cache or skin collection, otherwise build it htmlSkin = assistant.Get_HTML_Skin(current_skin_code, currentMode, UI_ApplicationCache_Gateway.Web_Skin_Collection, true, tracer); // If the skin was somehow overriden, default back to the default skin if (( htmlSkin == null ) && ( !String.IsNullOrEmpty(defaultSkin))) { if (String.Compare(current_skin_code, defaultSkin, StringComparison.InvariantCultureIgnoreCase) != 0) { currentMode.Skin = defaultSkin; htmlSkin = assistant.Get_HTML_Skin(defaultSkin, currentMode, UI_ApplicationCache_Gateway.Web_Skin_Collection, true, tracer); } } // If there was no web skin returned, forward user to URL with no web skin. // This happens if the web skin code is invalid. If a robot, just return a bad request // value though. if (htmlSkin == null) { HttpContext.Current.Response.StatusCode = 404; HttpContext.Current.Response.Output.WriteLine("404 - INVALID URL"); HttpContext.Current.Response.Output.WriteLine("Web skin indicated is invalid, default web skin invalid - line 1029"); HttpContext.Current.Response.Output.WriteLine(tracer.Text_Trace); HttpContext.Current.ApplicationInstance.CompleteRequest(); currentMode.Request_Completed = true; return; } } // Build the RequestCache object RequestCache RequestSpecificValues = new RequestCache(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage, htmlSkin, currentUser, publicFolder, siteMap, itemsInTitle, staticWebContent, tracer); if ((currentMode.Writer_Type == Writer_Type_Enum.HTML) || (currentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)) { mainWriter = new Html_MainWriter(RequestSpecificValues); } // Load the OAI writer if (currentMode.Writer_Type == Writer_Type_Enum.OAI) { mainWriter = new Oai_MainWriter(HttpContext.Current.Request.QueryString, RequestSpecificValues); } // Load the DataSet writer if (currentMode.Writer_Type == Writer_Type_Enum.DataSet) { mainWriter = new Dataset_MainWriter(RequestSpecificValues); } // Load the DataProvider writer if (currentMode.Writer_Type == Writer_Type_Enum.Data_Provider) { mainWriter = new DataProvider_MainWriter(RequestSpecificValues); } // Load the XML writer if (currentMode.Writer_Type == Writer_Type_Enum.XML) { mainWriter = new Xml_MainWriter(RequestSpecificValues); } // Load the JSON writer if (currentMode.Writer_Type == Writer_Type_Enum.JSON) { mainWriter = new Json_MainWriter(RequestSpecificValues, UI_ApplicationCache_Gateway.Settings.Servers.Image_URL); } // Load the HTML ECHO writer if (currentMode.Writer_Type == Writer_Type_Enum.HTML_Echo) { mainWriter = new Html_Echo_MainWriter(RequestSpecificValues, browse_info_display_text); } // Default to HTML if (mainWriter == null) { mainWriter = new Html_MainWriter(RequestSpecificValues); } }
public void Set_Main_Writer() { // Load the html writer string current_skin_code = currentMode.Skin.ToUpper(); if ((currentMode.Writer_Type == Writer_Type_Enum.HTML) || (currentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)) { // Check if a different skin should be used if this is an item display if ((currentMode.Mode == Display_Mode_Enum.Item_Display) || (currentMode.Mode == Display_Mode_Enum.Item_Print)) { if ((currentItem != null) && (currentItem.Behaviors.Web_Skin_Count > 0)) { if (!currentItem.Behaviors.Web_Skins.Contains(current_skin_code)) { string new_skin_code = currentItem.Behaviors.Web_Skins[0]; current_skin_code = new_skin_code; } } } // Check if a differente skin should be used if this is a collection display if ((hierarchyObject != null) && (hierarchyObject.Web_Skins.Count > 0)) { if (!hierarchyObject.Web_Skins.Contains(current_skin_code.ToLower())) { current_skin_code = hierarchyObject.Web_Skins[0]; } } SobekCM_Assistant assistant = new SobekCM_Assistant(); // Try to get the web skin from the cache or skin collection, otherwise build it htmlSkin = assistant.Get_HTML_Skin(current_skin_code, currentMode, Global.Skins, true, tracer); // If there was no web skin returned, forward user to URL with no web skin. // This happens if the web skin code is invalid. If a robot, just return a bad request // value though. if (htmlSkin == null) { if ((currentMode == null) || (currentMode.Is_Robot)) { HttpContext.Current.Response.StatusCode = 404; HttpContext.Current.Response.Output.WriteLine("404 - INVALID URL"); HttpContext.Current.ApplicationInstance.CompleteRequest(); currentMode.Request_Completed = true; } else { currentMode.Skin = String.Empty; currentMode.Redirect(); return; } return; } mainWriter = new Html_MainWriter(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage, htmlSkin, currentUser, Global.Translation, Global.Codes, Global.Item_List, Global.Stats_Date_Range, Global.Search_History, Global.Icon_List, Global.Thematic_Headings, publicFolder, Global.Collection_Aliases, Global.Skins, Global.Checked_List, Global.IP_Restrictions, Global.URL_Portals, siteMap, itemsInTitle, staticWebContent, tracer); } // Load the OAI writer if (currentMode.Writer_Type == Writer_Type_Enum.OAI) { mainWriter = new Oai_MainWriter(HttpContext.Current.Request.QueryString, Global.Item_List); } // Load the DataSet writer if (currentMode.Writer_Type == Writer_Type_Enum.DataSet) { mainWriter = new Dataset_MainWriter(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage); } // Load the DataProvider writer if (currentMode.Writer_Type == Writer_Type_Enum.Data_Provider) { mainWriter = new DataProvider_MainWriter(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage); } // Load the XML writer if (currentMode.Writer_Type == Writer_Type_Enum.XML) { mainWriter = new Xml_MainWriter(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage); } // Load the JSON writer if (currentMode.Writer_Type == Writer_Type_Enum.JSON) { mainWriter = new Json_MainWriter(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage, Global.Item_List, SobekCM_Library_Settings.Image_URL); } // Load the HTML ECHO writer if (currentMode.Writer_Type == Writer_Type_Enum.HTML_Echo) { mainWriter = new Html_Echo_MainWriter(currentMode, browse_info_display_text); } // Default to HTML if (mainWriter == null) { SobekCM_Assistant assistant = new SobekCM_Assistant(); htmlSkin = assistant.Get_HTML_Skin(currentMode, Global.Skins, true, tracer); mainWriter = new Html_MainWriter(currentMode, hierarchyObject, searchResultStatistics, pagedSearchResults, thisBrowseObject, currentItem, currentPage, htmlSkin, currentUser, Global.Translation, Global.Codes, Global.Item_List, Global.Stats_Date_Range, Global.Search_History, Global.Icon_List, Global.Thematic_Headings, publicFolder, Global.Collection_Aliases, Global.Skins, Global.Checked_List, Global.IP_Restrictions, Global.URL_Portals, siteMap, itemsInTitle, staticWebContent, tracer); } }
public void Set_Main_Writer() { // If this is for HTML or HTML logged in, try to get the web skin object string current_skin_code = currentMode.Skin.ToUpper(); if ((currentMode.Writer_Type == Writer_Type_Enum.HTML) || (currentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)) { // Check if a different skin should be used if this is an item display if ((currentMode.Mode == Display_Mode_Enum.Item_Display) || (currentMode.Mode == Display_Mode_Enum.Item_Print)) { if ((currentItem != null) && (currentItem.Behaviors.Web_Skin_Count > 0)) { if (!currentItem.Behaviors.Web_Skins.Contains(current_skin_code)) { string new_skin_code = currentItem.Behaviors.Web_Skins[0]; current_skin_code = new_skin_code; } } } } // Build the RequestCache object RequestCache RequestSpecificValues = new RequestCache(currentMode, searchResultStatistics, pagedSearchResults, currentUser, publicFolder, topLevelCollection, tracer); if ((currentMode.Writer_Type == Writer_Type_Enum.HTML) || (currentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)) { mainWriter = new Html_MainWriter(RequestSpecificValues); } // Load the OAI writer if (currentMode.Writer_Type == Writer_Type_Enum.OAI) { mainWriter = new Oai_MainWriter(HttpContext.Current.Request.QueryString, RequestSpecificValues); } // Load the DataSet writer if (currentMode.Writer_Type == Writer_Type_Enum.DataSet) { mainWriter = new Dataset_MainWriter(RequestSpecificValues); } // Load the DataProvider writer if (currentMode.Writer_Type == Writer_Type_Enum.Data_Provider) { mainWriter = new DataProvider_MainWriter(RequestSpecificValues); } // Load the XML writer if (currentMode.Writer_Type == Writer_Type_Enum.XML) { mainWriter = new Xml_MainWriter(RequestSpecificValues); } // Load the JSON writer if (currentMode.Writer_Type == Writer_Type_Enum.JSON) { mainWriter = new Json_MainWriter(RequestSpecificValues, UI_ApplicationCache_Gateway.Settings.Servers.Image_URL); } // Load the HTML ECHO writer if (currentMode.Writer_Type == Writer_Type_Enum.HTML_Echo) { mainWriter = new Html_Echo_MainWriter(RequestSpecificValues, browse_info_display_text); } // Default to HTML if (mainWriter == null) { mainWriter = new Html_MainWriter(RequestSpecificValues); } }