Get_HTML_Skin() public method

Gets the HTML skin indicated in the current navigation mode
public Get_HTML_Skin ( Navigation_Object Current_Mode, SobekCM.Core.Skins.Web_Skin_Collection Skin_Collection, bool Cache_On_Build, Custom_Tracer Tracer ) : Web_Skin_Object
Current_Mode SobekCM.Core.Navigation.Navigation_Object Mode / navigation information for the current request
Skin_Collection SobekCM.Core.Skins.Web_Skin_Collection Collection of the most common skins and source information for all the skins made on the fly
Cache_On_Build bool Flag indicates if this should be added to the ASP.net (or caching server) cache
Tracer Custom_Tracer Trace object keeps a list of each method executed and important milestones in rendering
return SobekCM.Core.Skins.Web_Skin_Object
コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }