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

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

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

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

            scriptActionName = "Javascript:advanced_search_years_sobekcm('" + redirectStem + "')";
        }
コード例 #2
0
        /// <summary> Checks the appropriate design folders to add any existing browse or info pages to the item aggregation </summary>
        /// <param name="ThisObject"> Item aggregation object to add the browse and info pages to</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks>This method is only called if the item aggregation does not have an existing XML configuration file.</remarks>
        protected static void Add_Browse_Files(Item_Aggregation ThisObject, Custom_Tracer Tracer)
        {
            // Collect the list of items in the browse folder
            if (Directory.Exists(SobekCM_Library_Settings.Base_Design_Location + ThisObject.ObjDirectory + "html/browse"))
            {
                string[] files = Directory.GetFiles(SobekCM_Library_Settings.Base_Design_Location + ThisObject.ObjDirectory + "html/browse", "*.htm*");
                foreach (string thisFile in files)
                {
                    // Get the new browse info object
                    Item_Aggregation_Child_Page newBrowse = Get_Item_Aggregation_Browse_Info(thisFile, Item_Aggregation_Child_Page.Visibility_Type.MAIN_MENU, Tracer);
                    if (newBrowse != null)
                    {
                        ThisObject.Add_Child_Page(newBrowse);
                    }
                }
            }

            // Collect the list of items in the info folder
            if (Directory.Exists(SobekCM_Library_Settings.Base_Design_Location + ThisObject.ObjDirectory + "html/info"))
            {
                string[] files = Directory.GetFiles(SobekCM_Library_Settings.Base_Design_Location + ThisObject.ObjDirectory + "html/info", "*.htm*");
                foreach (string thisFile in files)
                {
                    // Get the title for this file
                    // Get the new browse info object
                    Item_Aggregation_Child_Page newInfo = Get_Item_Aggregation_Browse_Info(thisFile, Item_Aggregation_Child_Page.Visibility_Type.NONE, Tracer);
                    if (newInfo != null)
                    {
                        ThisObject.Add_Child_Page(newInfo);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary> Adds the ALL ITEMS and NEW ITEMS browses to the item aggregation, if the display options and last added
        /// item date call for it </summary>
        /// <param name="thisObject"> Item aggregation to which to add the ALL ITEMS and NEW ITEMS browse</param>
        /// <remarks>This method is always called while building an item aggregation, irregardless of whether there is an
        /// item aggregation configuration XML file or not.</remarks>
        protected static void Add_All_New_Browses(Item_Aggregation thisObject)
        {
            // If this is the main home page for this site, do not show ALL since we cannot browse ALL items
            if (!thisObject.Can_Browse_Items)
            {
                return;
            }

            // If this is in the display options, and the item browses
            if ((thisObject.Display_Options.Length == 0) || (thisObject.Display_Options.IndexOf("I") >= 0))
            {
                // Add the ALL browse, if there should be one
                thisObject.Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home, "all", String.Empty, "All Items");

                // Add the NEW search, if the ALL search exists
                if ((thisObject.Get_Browse_Info_Object("all") != null) && (thisObject.Show_New_Item_Browse))
                {
                    thisObject.Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home, "new", String.Empty, "Recently Added Items");
                }
            }
            else
            {
                // Add the ALL browse as an info
                thisObject.Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Info, "all", String.Empty, "All Items");
            }
        }
        /// <summary> Constructor for a new instance of the Advanced_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Advanced_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Compute the redirect stem to use
            string            fields            = currentMode.Search_Fields;
            string            searchCollections = currentMode.SubAggregation;
            Display_Mode_Enum lastMode          = currentMode.Mode;

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

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

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

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

            scriptActionName  = "Javascript:advanced_search_sobekcm('" + redirectStem + "')";
            scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
        }
コード例 #5
0
        /// <summary> Checks the appropriate design folders to add any existing browse or info pages to the item aggregation </summary>
        /// <param name="thisObject"> Item aggregation object to add the browse and info pages to</param>
        /// <param name="tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks>This method is only called if the item aggregation does not have an existing XML configuration file.</remarks>
        protected static void Add_Browse_Files(Item_Aggregation thisObject, Custom_Tracer tracer)
        {
            // Collect the list of items in the browse folder
            if (Directory.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/browse"))
            {
                string[] files = Directory.GetFiles(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/browse", "*.htm*");
                foreach (string thisFile in files)
                {
                    // Get the new browse info object
                    Item_Aggregation_Browse_Info newBrowse = Get_Item_Aggregation_Browse_Info(thisFile, Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home, tracer);
                    if (newBrowse != null)
                    {
                        thisObject.Add_Browse_Info(newBrowse);
                    }
                }
            }

            // Collect the list of items in the info folder
            if (Directory.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/info"))
            {
                string[] files = Directory.GetFiles(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/info", "*.htm*");
                foreach (string thisFile in files)
                {
                    // Get the title for this file
                    // Get the new browse info object
                    Item_Aggregation_Browse_Info newInfo = Get_Item_Aggregation_Browse_Info(thisFile, Item_Aggregation_Browse_Info.Browse_Info_Type.Info, tracer);
                    if (newInfo != null)
                    {
                        thisObject.Add_Browse_Info(newInfo);
                    }
                }
            }
        }
コード例 #6
0
        /// <summary> Reads the item aggregation configuration file and populates the new data into the
        /// item aggregation object </summary>
        /// <param name="HierarchyObject"> Item aggregation object to populate</param>
        /// <param name="FileLocation"> Full name of the item aggregation configuration XML file </param>
        public void Add_Info_From_XML_File(Item_Aggregation HierarchyObject, string FileLocation)
        {
            // Get the directory from the file location
            string directory = (new FileInfo(FileLocation)).DirectoryName;

            // Load this XML file
            XmlDocument hierarchyXml = new XmlDocument();

            hierarchyXml.Load(FileLocation);

            // create the node reader
            XmlNodeReader nodeReader = new XmlNodeReader(hierarchyXml);

            // Read all the nodes
            while (nodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (nodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = nodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                    case "HI:SETTINGS":
                        read_settings(nodeReader, HierarchyObject);
                        break;

                    case "HI:HOME":
                        read_home(nodeReader, HierarchyObject);
                        break;

                    case "HI:BANNER":
                        read_banners(nodeReader, HierarchyObject);
                        break;

                    case "HI:DIRECTIVES":
                        read_directives(nodeReader, HierarchyObject, directory);
                        break;

                    case "HI:HIGHLIGHTS":
                        read_highlights(nodeReader, HierarchyObject);
                        break;

                    case "HI:BROWSE":
                        read_browse(true, nodeReader, HierarchyObject);
                        break;

                    case "HI:INFO":
                        read_browse(false, nodeReader, HierarchyObject);
                        break;

                    case "HI:RESULTS":
                        read_results_specs(nodeReader, HierarchyObject);
                        break;
                    }
                }
            }
        }
コード例 #7
0
        /// <summary> Constructor for a new instance of the Web_Content_HtmlSubwriter class </summary>
        /// <param name="Hierarchy_Object"> Current item aggregation object to display </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Static_Web_Content"> Object contains all the basic information about this info display </param>
        /// <param name="Site_Map"> Optional site map object used to render a navigational tree-view on left side of page</param>
        public Web_Content_HtmlSubwriter(Item_Aggregation Hierarchy_Object,
                                         SobekCM_Navigation_Object Current_Mode, SobekCM_Skin_Object HTML_Skin, HTML_Based_Content Static_Web_Content,
                                         SobekCM_SiteMap Site_Map)
        {
            base.Hierarchy_Object = Hierarchy_Object;
            currentMode           = Current_Mode;
            Skin = HTML_Skin;

            thisStaticBrowseObject = Static_Web_Content;
            siteMap = Site_Map;

            // If there is a sitemap, check if this is a robot request and then if the URL
            // for the sitemap pages is URL restricted
            if ((siteMap != null) && (siteMap.Is_URL_Restricted_For_Robots) && (currentMode.Is_Robot))
            {
                if (currentMode.Base_URL != siteMap.Restricted_Robot_URL)
                {
                    currentMode.Base_URL = siteMap.Restricted_Robot_URL;
                    string redirect_url = currentMode.Redirect_URL();

                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.Status = "301 Moved Permanently";
                    HttpContext.Current.Response.AddHeader("Location", redirect_url);
                    HttpContext.Current.Response.End();
                }
            }
        }
コード例 #8
0
        private static void read_settings(XmlNodeReader NodeReader, Item_Aggregation HierarchyObject)
        {
            while (NodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (NodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = NodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                    case "HI:WEBSKINS":
                        NodeReader.Read();
                        string   webskins = NodeReader.Value;
                        string[] splitter = webskins.Split(",".ToCharArray());
                        foreach (string thisSplitter in splitter)
                        {
                            if (thisSplitter.Length > 0)
                            {
                                HierarchyObject.Add_Web_Skin(thisSplitter.ToLower());
                            }
                        }
                        break;

                    case "HI:CSS":
                        NodeReader.Read();
                        HierarchyObject.CSS_File = NodeReader.Value.Trim();
                        break;

                    case "HI:CUSTOMHOME":
                        NodeReader.Read();
                        HierarchyObject.Custom_Home_Page_Source_File = NodeReader.Value.Trim();
                        break;

                    case "HI:FACETS":
                        NodeReader.Read();
                        string   facets    = NodeReader.Value;
                        string[] splitter2 = facets.Split(",".ToCharArray());
                        HierarchyObject.Clear_Facets();
                        foreach (string thisSplitter2 in splitter2)
                        {
                            HierarchyObject.Add_Facet(Convert.ToInt16(thisSplitter2));
                        }
                        break;
                    }
                }

                if (NodeReader.NodeType == XmlNodeType.EndElement)
                {
                    if (NodeReader.Name.Trim().ToUpper() == "HI:SETTINGS")
                    {
                        return;
                    }
                }
            }
        }
コード例 #9
0
 /// <summary> Constructor for a new instance of the Xml_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>
 public Xml_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)
     : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, null)
 {
 }
コード例 #10
0
        /// <summary> [HELPER] Gets the all information, including the HTML, for an item aggregation child page </summary>
        /// <param name="AggregationCode"> Code for the aggregation </param>
        /// <param name="RequestedLanguage"> Requested language to retrieve </param>
        /// <param name="DefaultLanguage"> Default interface language, in case the requested language does not exist </param>
        /// <param name="ChildPageCode"> Code the requested child page </param>
        /// <param name="Tracer"></param>
        /// <returns> Fully built object, based on the aggregation configuration and reading the source HTML file </returns>
        /// <remarks> This may be public now, but this will be converted into a private helped class with
        /// the release of SobekCM 5.0 </remarks>
        public static HTML_Based_Content get_item_aggregation_html_child_page(string AggregationCode, Web_Language_Enum RequestedLanguage, Web_Language_Enum DefaultLanguage, string ChildPageCode, Custom_Tracer Tracer)
        {
            // Try to pull from the cache
            HTML_Based_Content cacheInst = CachedDataManager.Aggregations.Retrieve_Aggregation_HTML_Based_Content(AggregationCode, RequestedLanguage, ChildPageCode, Tracer);

            if (cacheInst != null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Found built child page in the cache");
                return(cacheInst);
            }

            // Get the language-specific item aggregation object
            Item_Aggregation itemAggr = get_item_aggregation(AggregationCode, RequestedLanguage, DefaultLanguage, Tracer);

            if (itemAggr == null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Item aggregation object was NULL.. May not be a valid aggregation code");
                return(null);
            }

            // Get the child page object
            Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Get child page object from the language-specific item aggregation");
            Item_Aggregation_Child_Page childPage = itemAggr.Child_Page_By_Code(ChildPageCode);

            if (childPage == null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Child page does not exist in language-specific item agggregation");
                return(null);
            }

            if (childPage.Source_Data_Type != Item_Aggregation_Child_Source_Data_Enum.Static_HTML)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Child page exists in language-specific item aggregation, but it is not of type static html");
                return(null);
            }

            string path = Path.Combine("/design/", itemAggr.ObjDirectory, childPage.Source);
            string file = HttpContext.Current.Server.MapPath(path);

            Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Attempting to read source file for child page");
            HTML_Based_Content results = HTML_Based_Content_Reader.Read_HTML_File(file, true, Tracer);

            if (results != null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Storing build child page in the cache");

                CachedDataManager.Aggregations.Store_Aggregation_HTML_Based_Content(AggregationCode, RequestedLanguage, ChildPageCode, results, Tracer);
            }
            else
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation_html_child_page", "Child page object returned from HTML_Based_Content_Reader was null.. returning NULL");
            }

            return(results);
        }
コード例 #11
0
        private static void read_banners(XmlNodeReader nodeReader, Item_Aggregation hierarchyObject)
        {
            while (nodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (nodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = nodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                    case "HI:SOURCE":
                        // Check for any attributes to this banner node
                        string lang    = String.Empty;
                        bool   special = false;

                        if (nodeReader.HasAttributes)
                        {
                            if (nodeReader.MoveToAttribute("lang"))
                            {
                                lang = nodeReader.Value.Trim().ToUpper();
                            }
                            if (nodeReader.MoveToAttribute("type"))
                            {
                                if (nodeReader.Value.Trim().ToUpper() == "HIGHLIGHT")
                                {
                                    special = true;
                                }
                            }
                        }

                        // Now read the banner information and add to the aggregation object
                        nodeReader.Read();
                        if (special)
                        {
                            hierarchyObject.Add_Front_Banner_Image(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                        }
                        else
                        {
                            hierarchyObject.Add_Banner_Image(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                        }


                        break;
                    }
                }

                if ((nodeReader.NodeType == XmlNodeType.EndElement) && (nodeReader.Name.Trim().ToUpper() == "HI:BANNER"))
                {
                    return;
                }
            }
        }
コード例 #12
0
 /// <summary> Constructor for a new instance of the DataProvider_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>
 public DataProvider_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)
     : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, null)
 {
     // All work done in base class
 }
コード例 #13
0
        /// <summary> Write the dublin core metadata about the aggregation into the HTML head </summary>
        /// <param name="Output"> Stream to which to write within the HTML head tag </param>
        /// <param name="CurrentAggregation"> Current aggregation being displayed </param>
        /// <param name="RequestSpecificValues"> Other, request specific values, such as the current mode, user, etc.. </param>
        public void Write_Within_HTML_Head(TextWriter Output, Item_Aggregation CurrentAggregation, RequestCache RequestSpecificValues)
        {
            // If the item is NULL, do nothing
            if (CurrentAggregation == null)
            {
                return;
            }

            Output.WriteLine("  <link title=\"Dublin Core Metadata Schema\" rel=\"schema.DC\" href=\"http://purl.org/DC/elements/1.1/\" />");
            Output.WriteLine("  <meta name=\"DC.title\" content=\"" + CurrentAggregation.Name.Replace("\"", "'") + "\" />");
        }
コード例 #14
0
 /// <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="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 Text_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,
                        HTML_Based_Content Static_Web_Content)
     : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, Static_Web_Content)
 {
     // All work done in base class
 }
コード例 #15
0
 /// <summary> Constructor for a new instance of the AggregationViewBag class </summary>
 /// <param name="Hierarchy_Object"> Current item aggregation object to display </param>
 /// <param name="Results_Statistics"> Information about the entire set of results for a browse </param>
 /// <param name="Paged_Results"> Single page of results for a 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="Static_Web_Content"> HTML content-based aggregation browse or info.  These are objects which are read from a static HTML file and much of the head information must be maintained </param>
 public AggregationViewBag(Item_Aggregation Hierarchy_Object,
                           Search_Results_Statistics Results_Statistics,
                           List <iSearch_Title_Result> Paged_Results,
                           Item_Aggregation_Child_Page Browse_Object,
                           HTML_Based_Content Static_Web_Content)
 {
     this.Hierarchy_Object   = Hierarchy_Object;
     this.Results_Statistics = Results_Statistics;
     this.Paged_Results      = Paged_Results;
     this.Browse_Object      = Browse_Object;
     this.Static_Web_Content = Static_Web_Content;
 }
コード例 #16
0
 /// <summary> Constructor for a new instance of the Json_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="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param>
 /// <param name="Current_Image_Root"> Current root directory to pull images and metadata for digital resources </param>
 public Json_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,
                        Item_Lookup_Object All_Items_Lookup,
                        string Current_Image_Root)
     : base(Current_Mode, Hierarchy_Object, Results_Statistics, Paged_Results, Browse_Object, Current_Item, Current_Page, null)
 {
     allItems = All_Items_Lookup;
     currentGreenstoneImageRoot = Current_Image_Root;
 }
        /// <summary> Constructor for a new instance of the Basic_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Rotating_Highlight_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Determine the sub text to use
            const string SUB_CODE = "s=";

            Sharing_Buttons_HTML = String.Empty;

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

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

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

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

            // Get the front banner
            frontBannerInfo = Current_Aggregation.Front_Banner_Image(currentMode.Language);
        }
コード例 #18
0
        /// <summary> Write the simple JSON metadata about the aggregation into the HTML head </summary>
        /// <param name="Output"> Stream to which to write within the HTML head tag </param>
        /// <param name="CurrentAggregation"> Current aggregation being displayed </param>
        /// <param name="RequestSpecificValues"> Other, request specific values, such as the current mode, user, etc.. </param>
        public void Write_Within_HTML_Head(TextWriter Output, Item_Aggregation CurrentAggregation, RequestCache RequestSpecificValues)
        {
            // If the item is NULL, do nothing
            if (CurrentAggregation == null)
            {
                return;
            }

            // Create the simple aggregation object, and get the JSON
            Simple_Aggregation simpleAggr        = new Simple_Aggregation(CurrentAggregation);
            string             simpleAggr_asJson = simpleAggr.ToJSON();

            // Write the JSON to the header
            Output.WriteLine("  <script id=\"aggregation_json\" type=\"application/json\">" + simpleAggr_asJson + "</script>");

            // To use in javascript, use: var data = JSON.parse($("#aggregation_json").html());
        }
コード例 #19
0
        /// <summary> Finds the home page source file and banner images or html for this item aggregation </summary>
        /// <param name="thisObject"> Item aggregation to add the home page link and banner html </param>
        /// <remarks>This method is only called if the item aggregation does not have an existing XML configuration file. </remarks>
        protected static void Add_HTML(Item_Aggregation thisObject)
        {
            // Just use the standard home text
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/home/text.html"))
            {
                thisObject.Add_Home_Page_File("html/home/text.html", SobekCM_Library_Settings.Default_UI_Language);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/home/text_en.html"))
            {
                thisObject.Add_Home_Page_File("html/home/text_en.html", Web_Language_Enum.English);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/home/text_fr.html"))
            {
                thisObject.Add_Home_Page_File("html/home/text_fr.html", Web_Language_Enum.French);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/home/text_es.html"))
            {
                thisObject.Add_Home_Page_File("html/home/text_es.html", Web_Language_Enum.Spanish);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/home/text_sp.html"))
            {
                thisObject.Add_Home_Page_File("html/home/text_sp.html", Web_Language_Enum.Spanish);
            }

            // Just use the standard banner image
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "images/banners/coll.jpg"))
            {
                thisObject.Add_Banner_Image("images/banners/coll.jpg", SobekCM_Library_Settings.Default_UI_Language);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "images/banners/coll_en.jpg"))
            {
                thisObject.Add_Banner_Image("images/banners/coll_en.jpg", Web_Language_Enum.English);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "images/banners/coll_fr.jpg"))
            {
                thisObject.Add_Banner_Image("images/banners/coll_fr.jpg", Web_Language_Enum.French);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "images/banners/coll_es.jpg"))
            {
                thisObject.Add_Banner_Image("images/banners/coll_es.jpg", Web_Language_Enum.Spanish);
            }
            if (File.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "images/banners/coll_sp.jpg"))
            {
                thisObject.Add_Banner_Image("images/banners/coll_sp.jpg", Web_Language_Enum.Spanish);
            }
        }
コード例 #20
0
        /// <summary> Constructor for a new instance of the Basic_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Rotating_Highlight_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Determine the sub text to use
            const string subCode = "s=";

            Sharing_Buttons_HTML = String.Empty;

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

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

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

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

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

            // Compute the redirect stem to use
            string fields        = currentMode.Search_Fields;
            string search_string = currentMode.Search_String;

            currentMode.Search_String    = String.Empty;
            currentMode.Search_Fields    = String.Empty;
            currentMode.Home_Type        = Home_Type_Enum.List;
            currentMode.Mode             = Display_Mode_Enum.Results;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            string redirect_stem = currentMode.Redirect_URL().Replace("&m=hhh", "").Replace("m=hht", "").Replace("&m=lhh", "").Replace("m=lht", "");

            currentMode.Mode             = Display_Mode_Enum.Aggregation_Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url = currentMode.Redirect_URL();
            currentMode.Search_String    = search_string;
            currentMode.Search_Fields    = fields;
            currentMode.Mode             = Display_Mode_Enum.Aggregation_Home;
            currentMode.Info_Browse_Mode = String.Empty;

            // Write the advanced search box
            arg2 = String.Empty;
            arg1 = redirect_stem;

            if ((Current_Aggregation.Children_Count > 0) && (currentMode.Show_Selection_Panel))
            {
                scriptActionName  = "newspaper_select_search_sobekcm('" + arg1 + "', '" + subCode + "', '" + browse_url + "');";
                arg2              = subCode;
                scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
            }
            else
            {
                scriptActionName  = "newspaper_search_sobekcm('" + arg1 + "');";
                scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
            }
        }
コード例 #22
0
        /// <summary> Constructor for a new instance of the Full_Text_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Full_Text_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            // Determine the sub text to use
            const string SUB_CODE = "s=";

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

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

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

            currentMode.Search_String    = String.Empty;
            currentMode.Search_Fields    = String.Empty;
            currentMode.Search_Precision = Search_Precision_Type_Enum.Inflectional_Form;
            arg2                         = String.Empty;
            arg1                         = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Aggregation;
            currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
            currentMode.Info_Browse_Mode = "all";
            browse_url                   = currentMode.Redirect_URL();
            currentMode.Mode             = Display_Mode_Enum.Search;
            if ((!currentMode.Show_Selection_Panel) || (Current_Aggregation.Children_Count == 0))
            {
                scriptActionName = "fulltext_search_sobekcm('" + arg1 + "', '" + browse_url + "');";
            }
            else
            {
                scriptActionName = "fulltext_select_search_sobekcm('" + arg1 + "', '" + SUB_CODE + "')";
                arg2             = SUB_CODE;
            }
            currentMode.Mode             = displayMode;
            currentMode.Aggregation_Type = aggrType;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;
            currentMode.Info_Browse_Mode = String.Empty;
        }
コード例 #23
0
 /// <summary> Constructor for a new instance of the abstractMainWriter abstract 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="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>
 protected abstractMainWriter(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,
                              HTML_Based_Content Static_Web_Content)
 {
     currentMode        = Current_Mode;
     hierarchyObject    = Hierarchy_Object;
     results_statistics = Results_Statistics;
     paged_results      = Paged_Results;
     thisBrowseObject   = Browse_Object;
     currentItem        = Current_Item;
     currentPage        = Current_Page;
     htmlBasedContent   = Static_Web_Content;
 }
コード例 #24
0
        /// <summary> Constructor for a new instance of the RequestCache class </summary>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</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="Current_User"> Currently logged on user </param>
        /// <param name="Public_Folder"> Object contains the information about the public folder to display </param>
        /// <param name="Top_Collection"> Item aggregation for the top-level collection, which is used in a number of places, for example
        /// showing the correct banner, even when it is not the "current" aggregation </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public RequestCache(Navigation_Object Current_Mode,
                            Search_Results_Statistics Results_Statistics,
                            List <iSearch_Title_Result> Paged_Results,
                            User_Object Current_User,
                            Public_User_Folder Public_Folder,
                            Item_Aggregation Top_Collection,
                            Custom_Tracer Tracer)
        {
            this.Current_Mode       = Current_Mode;
            this.Results_Statistics = Results_Statistics;
            this.Paged_Results      = Paged_Results;
            this.Current_User       = Current_User;
            this.Public_Folder      = Public_Folder;
            this.Top_Collection     = Top_Collection;
            this.Tracer             = Tracer;

            Flags = new RequestCache_RequestFlags();
        }
コード例 #25
0
        /// <summary> Apply the individual user settings to this static text, replacing all directives with the actual data from this HTTP request </summary>
        /// <param name="Display_Text"> Display text to apply the individual request's settings to </param>
        /// <param name="Aggregation"> Current item aggregation, used for any custom directives which may exist </param>
        /// <param name="Web_Skin_Code"> Code for the current web skin</param>
        /// <param name="Base_Skin_Code"> Code for the base web skin from which the current web skin inherits</param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <param name="URL_Options"> Current URL Options </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Static text for this info/browse with substitutions made to support the current request </returns>
        /// <remarks> This actually reads the HTML file each time this is requested </remarks>
        public string Apply_Settings_To_Static_Text(string Display_Text, Item_Aggregation Aggregation, string Web_Skin_Code, string Base_Skin_Code, string Base_URL, string URL_Options, Custom_Tracer Tracer)
        {
            //// Replace any item aggregation specific custom directives
            //if ((Aggregation != null) && ( Aggregation.Custom_Directives != null ))
            //{
            //    foreach (string thisKey in Aggregation.Custom_Directives.Keys)
            //    {
            //        if (Display_Text.IndexOf(thisKey) > 0)
            //        {
            //            Display_Text = Display_Text.Replace(thisKey, Aggregation.Custom_Directives[thisKey].Replacement_HTML);
            //        }
            //    }
            //}

            string urlOptions1 = String.Empty;
            string urlOptions2 = String.Empty;

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

            // Replace the standard directives next
            Display_Text = Display_Text.Replace("<%URLOPTS%>", URL_Options).Replace("<%?URLOPTS%>", urlOptions1).Replace("<%&URLOPTS%>", urlOptions2).Replace("<%INTERFACE%>", Web_Skin_Code).Replace("<%WEBSKIN%>", Web_Skin_Code).Replace("<%BASEURL%>", Base_URL);
            Display_Text = Display_Text.Replace("[%URLOPTS%]", URL_Options).Replace("[%?URLOPTS%]", urlOptions1).Replace("[%&URLOPTS%]", urlOptions2).Replace("[%INTERFACE%]", Web_Skin_Code).Replace("[%WEBSKIN%]", Web_Skin_Code).Replace("[%BASEURL%]", Base_URL);

            // Replace some additional (more complex) values
            string tabstart        = "<img src=\"" + Base_URL + "design/skins/" + Base_Skin_Code + "/tabs/cLD.gif\" border=\"0\" class=\"tab_image\" /><span class=\"tab\">";
            string tabend          = "</span><img src=\"" + Base_URL + "design/skins/" + Base_Skin_Code + "/tabs/cRD.gif\" border=\"0\" class=\"tab_image\" />";
            string select_tabstart = "<img src=\"" + Base_URL + "design/skins/" + Base_Skin_Code + "/tabs/cLD_s.gif\" border=\"0\" class=\"tab_image\" /><span class=\"tab_s\">";
            string select_tabend   = "</span><img src=\"" + Base_URL + "design/skins/" + Base_Skin_Code + "/tabs/cRD_s.gif\" border=\"0\" class=\"tab_image\" />";

            Display_Text = Display_Text.Replace("<%TABSTART%>", tabstart).Replace("<%TABEND%>", tabend).Replace("<%SELECTED_TABSTART%>", select_tabstart).Replace("<%SELECTED_TABEND%>", select_tabend);

            if (Display_Text.IndexOf("<body>") >= 0)
            {
                Display_Text = Display_Text.Substring(Display_Text.IndexOf("<body>") + 6);
                Display_Text = Display_Text.Substring(0, Display_Text.IndexOf("</body>"));
            }
            return(Display_Text);
        }
コード例 #26
0
        /// <summary> Constructor for a new instance of the dLOC_Search_AggregationViewer class </summary>
        /// <param name="Current_Aggregation"> Current item aggregation object </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public dLOC_Search_AggregationViewer(Item_Aggregation Current_Aggregation, SobekCM_Navigation_Object Current_Mode) : base(Current_Aggregation, Current_Mode)
        {
            textBoxValue = String.Empty;
            if (currentMode.Search_String.Length > 0)
            {
                textBoxValue = currentMode.Search_String.Replace(",newspaper", "");
            }

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

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

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


            //if (( !currentMode.Show_Selection_Panel) || ( hierarchyObject.Codes.Length == 0 ))
            //{
            scriptActionName  = "dloc_search_sobekcm('" + arg1 + "', '" + browse_url + "');";
            scriptIncludeName = "<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_search.js\" type=\"text/javascript\"></script>";
            //}
            //else
            //{
            //    script_action_name = "Javascript:dloc_select_search_sobekcm('" + currentMode.Redirect_URL() + "', '" + sub_code + "')";
            //    script_include_name = "<script src=\"" + currentMode.Base_URL + "default/scripts/dloc_select_search_sobekcm.js\" type=\"text/javascript\"></script>";
            //}
            currentMode.Mode             = displayMode;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;
            currentMode.Info_Browse_Mode = String.Empty;
        }
コード例 #27
0
        /// <summary> [HELPER] Gets the language-specific item aggregation, by aggregation code and language code </summary>
        /// <param name="AggregationCode"> Code for the aggregation </param>
        /// <param name="RequestedLanguage"> Requested language to retrieve </param>
        /// <param name="DefaultLanguage"> Default interface language, in case the requested language does not exist </param>
        /// <param name="Tracer"></param>
        /// <returns> Built language-specific item aggregation object </returns>
        /// <remarks> This may be public now, but this will be converted into a private helped class with
        /// the release of SobekCM 5.0 </remarks>
        public static Item_Aggregation get_item_aggregation(string AggregationCode, Web_Language_Enum RequestedLanguage, Web_Language_Enum DefaultLanguage, Custom_Tracer Tracer)
        {
            // Try to pull from the cache
            Item_Aggregation cacheInst = CachedDataManager.Aggregations.Retrieve_Item_Aggregation(AggregationCode, RequestedLanguage, Tracer);

            if (cacheInst != null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation", "Found language-specific item aggregation in the cache");
                return(cacheInst);
            }

            Tracer.Add_Trace("AggregationServices.get_item_aggregation", "Language-specific item aggregation NOT found in the cache.. will build");

            // Get the complete aggregation
            Complete_Item_Aggregation compAggr = get_complete_aggregation(AggregationCode, true, Tracer);

            // If the complete aggregation was null, just return null now
            if (compAggr == null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation", "Complete item aggregation not built correctly.. returning NULL");
                return(null);
            }

            // Get the language-specific version
            Item_Aggregation returnValue = Item_Aggregation_Utilities.Get_Item_Aggregation(compAggr, RequestedLanguage, Tracer);

            // Store in cache again, if not NULL
            if (returnValue != null)
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation", "Storing built Language-specific item aggregation in cache");

                CachedDataManager.Aggregations.Store_Item_Aggregation(AggregationCode, RequestedLanguage, returnValue, Tracer);
            }
            else
            {
                Tracer.Add_Trace("AggregationServices.get_item_aggregation", "Language-specific item aggregation not built correctly by Item_Aggregation_Utilities.Get_Item_Aggregation.. returning NULL");
            }

            return(returnValue);
        }
コード例 #28
0
        /// <summary> Method returns the table of results for the browse indicated </summary>
        /// <param name="ItemAggr"> Item Aggregation from which to return the browse </param>
        /// <param name = "ChildPageObject">Object with all the information about the browse</param>
        /// <param name = "Page"> Page of results requested for the indicated browse </param>
        /// <param name = "Sort"> Sort applied to the results before being returned </param>
        /// <param name="Potentially_Include_Facets"> Flag indicates if facets could be included in this browse results </param>
        /// <param name = "Need_Browse_Statistics"> Flag indicates if the browse statistics (facets and total counts) are required for this browse as well </param>
        /// <param name = "Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <param name="Results_Per_Page"> Number of results to retrieve per page</param>
        /// <returns> Resutls for the browse or info in table form </returns>
        public static Multiple_Paged_Results_Args Get_Browse_Results(Item_Aggregation ItemAggr, Item_Aggregation_Child_Page ChildPageObject,
                                                                     int Page, int Sort, int Results_Per_Page, bool Potentially_Include_Facets, bool Need_Browse_Statistics,
                                                                     Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Browse_Results", String.Empty);
            }

            // Get the list of facets first
            List <short> facetsList = ItemAggr.Facets;

            if (!Potentially_Include_Facets)
            {
                facetsList = null;
            }

            // Pull data from the database if necessary
            if ((ChildPageObject.Code == "all") || (ChildPageObject.Code == "new"))
            {
                // Get this browse from the database
                if ((ItemAggr.ID < 0) || (ItemAggr.Code.ToUpper() == "ALL"))
                {
                    if (ChildPageObject.Code == "new")
                    {
                        return(Engine_Database.Get_All_Browse_Paged(true, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer));
                    }
                    return(Engine_Database.Get_All_Browse_Paged(false, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer));
                }

                if (ChildPageObject.Code == "new")
                {
                    return(Engine_Database.Get_Item_Aggregation_Browse_Paged(ItemAggr.Code, true, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer));
                }
                return(Engine_Database.Get_Item_Aggregation_Browse_Paged(ItemAggr.Code, false, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer));
            }

            // Default return NULL
            return(null);
        }
        /// <summary> Retrieves the item aggregation obejct from the cache  </summary>
        /// <param name="AggregationCode"> Code for the item aggregation to retrieve </param>
        /// <param name="Language"> Current language code (item aggregation instances are currently language-specific)</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <returns> Either NULL or the item aggregation object </returns>
        public Item_Aggregation Retrieve_Item_Aggregation(string AggregationCode, Web_Language_Enum Language, Custom_Tracer Tracer)
        {
            // If the cache is disabled, just return before even tracing
            if ((settings.Disabled) || (HttpContext.Current == null))
            {
                return(null);
            }

            if (Tracer != null)
            {
                Tracer.Add_Trace("CachedDataManager.Retrieve_Item_Aggregation", "");
            }

            // Determine the key
            string languageCode = Web_Language_Enum_Converter.Enum_To_Code(Language);
            string key          = "AGGR|" + AggregationCode.ToUpper() + "|" + languageCode;

            // See if this is in the local cache first
            Item_Aggregation returnValue = HttpContext.Current.Cache.Get(key) as Item_Aggregation;

            if (returnValue != null)
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("CachedDataManager.Retrieve_Item_Aggregation", "Found " + AggregationCode + " item aggregation on local cache for " + languageCode);
                }

                return(returnValue);
            }

            if (Tracer != null)
            {
                Tracer.Add_Trace("CachedDataManager.Retrieve_Item_Aggregation", "Aggregation ( " + AggregationCode + " ) not found in the local cache for " + languageCode);
            }

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

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

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

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



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

            currentMode.Mode             = displayMode;
            currentMode.Aggregation_Type = aggrType;
            currentMode.Search_Type      = searchType;
            currentMode.Search_String    = search_string;
            currentMode.Info_Browse_Mode = String.Empty;
        }