コード例 #1
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);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>Reads the item aggregation browse or info file and returns a built <see cref="Item_Aggregation_Browse_Info"/> object for
        /// inclusion in the item aggregation </summary>
        /// <param name="fileName"> Filename of the browse or info file</param>
        /// <param name="Browse_Type"> Flag indicates if this is a browse or info file</param>
        /// <param name="tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <returns> Built object containing all of the pertinent details about this info or browse </returns>
        private static Item_Aggregation_Browse_Info Get_Item_Aggregation_Browse_Info(string fileName, Item_Aggregation_Browse_Info.Browse_Info_Type Browse_Type, Custom_Tracer tracer)
        {
            HTML_Based_Content           fileContent  = HTML_Based_Content_Reader.Read_HTML_File(fileName, false, tracer);
            Item_Aggregation_Browse_Info returnObject = new Item_Aggregation_Browse_Info(Browse_Type, Item_Aggregation_Browse_Info.Source_Type.Static_HTML, fileContent.Code, fileName, fileContent.Title);

            return(returnObject);
        }
コード例 #3
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)
 {
 }
コード例 #4
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
 }
コード例 #5
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_Browse_Info 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 DataSet_Browse_Info_AggregationViewer class </summary>
 /// <param name="Browse_Object"> Browse or information object to be displayed </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="Code_Manager"> Code manager object maintains mapping between SobekCM codes and greenstone codes (used by result_dataset_html_subwriter)</param>
 /// <param name="Item_List"> Object for pulling additional information about each item during display </param>
 /// <param name="Current_User"> Currently logged on user, or NULL </param>
 public DataSet_Browse_Info_AggregationViewer(Item_Aggregation_Browse_Info Browse_Object,
     Search_Results_Statistics Results_Statistics,
     List<iSearch_Title_Result> Paged_Results,
     Aggregation_Code_Manager Code_Manager,
     Item_Lookup_Object Item_List,
     User_Object Current_User)
     : base(null, null)
 {
     browseObject = Browse_Object;
     codeManager = Code_Manager;
     itemList = Item_List;
     currentUser = Current_User;
     resultsStatistics = Results_Statistics;
     pagedResults = Paged_Results;
 }
コード例 #7
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;
 }
        /// <summary> Constructor for a new instance of the Metadata_Browse_AggregationViewer class </summary>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_Aggregation"> Current item aggregation object to display </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Metadata_Browse_AggregationViewer(SobekCM_Navigation_Object Current_Mode, Item_Aggregation Current_Aggregation, Custom_Tracer Tracer)
            : base(Current_Aggregation, Current_Mode)
        {
            string defaultBrowseBy = Current_Aggregation.Default_BrowseBy;

            // If there is not info browse mode listed, use the default
            if (Current_Mode.Info_Browse_Mode.Length == 0)
                Current_Mode.Info_Browse_Mode = defaultBrowseBy;
            if ((Current_Mode.Info_Browse_Mode.Length == 0) && (Current_Aggregation.Has_Browse_By_Pages))
                Current_Mode.Info_Browse_Mode = Current_Aggregation.Browse_By_Pages(Current_Mode.Language)[0].Code;

            // Get this browse
            browseObject = Current_Aggregation.Get_Browse_Info_Object(Current_Mode.Info_Browse_Mode);

            // Was this a metadata browseby, or just a static html?
            if (( browseObject == null ) || ( browseObject.Source != Item_Aggregation_Browse_Info.Source_Type.Static_HTML))
            {
                // Determine the correct metadata code
                string metadata_code = Current_Mode.Info_Browse_Mode.Trim().Replace("_", " ");
                Current_Mode.Info_Browse_Mode = metadata_code;

                // Only get values if there was a metadata code
                if (metadata_code.Length > 0)
                {
                    // Check the cache for this value
                    List<string> cacheInstance = Cached_Data_Manager.Retrieve_Aggregation_Metadata_Browse(Current_Mode.Aggregation, Current_Mode.Info_Browse_Mode, Tracer);

                    if (cacheInstance != null)
                    {
                        results = cacheInstance;
                    }
                    else
                    {
                        results = SobekCM_Database.Get_Item_Aggregation_Metadata_Browse(Current_Mode.Aggregation, Current_Mode.Info_Browse_Mode, Tracer);
                        Cached_Data_Manager.Store_Aggregation_Metadata_Browse(Current_Mode.Aggregation, Current_Mode.Info_Browse_Mode, results, Tracer);
                    }
                }
            }
        }
コード例 #9
0
        /// <summary> Gets the browse or info object and any other needed data for display ( resultset or text to display) </summary>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Aggregation_Object"> Item Aggregation object</param>
        /// <param name="Base_Directory"> Base directory location under which the the CMS/info source file will be found</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="Browse_Object"> [OUT] Stores all the information about this browse or info </param>
        /// <param name="Complete_Result_Set_Info"> [OUT] Information about the entire set of results </param>
        /// <param name="Paged_Results"> [OUT] List of search results for the requested page of results </param>
        /// <param name="Browse_Info_Display_Text"> [OUT] Static HTML-based content to be displayed if this is browing a staticly created html source file </param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        /// <remarks> This attempts to pull the objects from the cache.  If unsuccessful, it builds the objects from the
        /// database and hands off to the <see cref="Cached_Data_Manager" /> to store in the cache </remarks>
        public bool Get_Browse_Info(SobekCM_Navigation_Object Current_Mode,
                                    Item_Aggregation Aggregation_Object,
                                    string Base_Directory,
                                    Custom_Tracer Tracer,
                                    out Item_Aggregation_Browse_Info Browse_Object,
                                    out Search_Results_Statistics Complete_Result_Set_Info,
                                    out List<iSearch_Title_Result> Paged_Results,
                                    out HTML_Based_Content Browse_Info_Display_Text )
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("SobekCM_Assistant.Get_Browse_Info", String.Empty);
            }

            // Set output initially to null
            Browse_Object = null;
            Paged_Results = null;
            Complete_Result_Set_Info = null;
            Browse_Info_Display_Text = null;

            // First, make sure the browse submode is valid
            if ((Aggregation_Object.Aggregation_ID == -1) && (Current_Mode.Mode == Display_Mode_Enum.Simple_HTML_CMS))
            {
                string source = Base_Directory + "design\\info";
                string[] matching_file = Directory.GetFiles(source, Current_Mode.Info_Browse_Mode + ".*");
                if (matching_file.Length > 0)
                {
                    Browse_Object = new Item_Aggregation_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Info, Item_Aggregation_Browse_Info.Source_Type.Static_HTML, Current_Mode.Info_Browse_Mode, matching_file[0], Current_Mode.Info_Browse_Mode);
                }
            }
            else
            {
                Browse_Object = Aggregation_Object.Get_Browse_Info_Object(Current_Mode.Info_Browse_Mode);
            }
            if (Browse_Object == null)
            {
                Current_Mode.Error_Message = "Unable to retrieve browse/info item '" + Current_Mode.Info_Browse_Mode + "'";
                return false;
            }

            // Is this a table result, or a string?
            switch (Browse_Object.Data_Type)
            {
                case Item_Aggregation_Browse_Info.Result_Data_Type.Table:

                    // Set the current sort to ZERO, if currently set to ONE and this is an ALL BROWSE.
                    // Those two sorts are the same in this case
                    int sort = Current_Mode.Sort;
                    if ((Current_Mode.Sort == 0) && (Browse_Object.Code == "all"))
                        sort = 1;

                    // Special code if this is a JSON browse
                    string browse_code = Current_Mode.Info_Browse_Mode;
                    if (Current_Mode.Writer_Type == Writer_Type_Enum.JSON)
                    {
                        browse_code = browse_code + "_JSON";
                        sort = 12;
                    }

                    // Determine if this is a special search type which returns more rows and is not cached.
                    // This is used to return the results as XML and DATASET
                    bool special_search_type = false;
                    int results_per_page = 20;
                    if ((Current_Mode.Writer_Type == Writer_Type_Enum.XML) || (Current_Mode.Writer_Type == Writer_Type_Enum.DataSet))
                    {
                        results_per_page = 1000;
                        special_search_type = true;
                        sort = 2; // Sort by BibID always for these
                    }

                    // Set the flags for how much data is needed.  (i.e., do we need to pull ANYTHING?  or
                    // perhaps just the next page of results ( as opposed to pulling facets again).
                    bool need_browse_statistics = true;
                    bool need_paged_results = true;
                    if (!special_search_type)
                    {
                        // Look to see if the browse statistics are available on any cache for this browse
                        Complete_Result_Set_Info = Cached_Data_Manager.Retrieve_Browse_Result_Statistics(Aggregation_Object.Code, browse_code, Tracer);
                        if (Complete_Result_Set_Info != null)
                            need_browse_statistics = false;

                        // Look to see if the paged results are available on any cache..
                        Paged_Results = Cached_Data_Manager.Retrieve_Browse_Results(Aggregation_Object.Code, browse_code, Current_Mode.Page, sort, Tracer);
                        if (Paged_Results != null)
                            need_paged_results = false;
                    }

                    // Was a copy found in the cache?
                    if ((!need_browse_statistics) && ( !need_paged_results ))
                    {
                        if (Tracer != null)
                        {
                            Tracer.Add_Trace("SobekCM_Assistant.Get_Browse_Info", "Browse statistics and paged results retrieved from cache");
                        }
                    }
                    else
                    {
                        if (Tracer != null)
                        {
                            Tracer.Add_Trace("SobekCM_Assistant.Get_Browse_Info", "Building results information");
                        }

                        // Try to pull more than one page, so we can cache the next page or so
                        List<List<iSearch_Title_Result>> pagesOfResults;

                        // Get from the hierarchy object
                        if (Current_Mode.Writer_Type == Writer_Type_Enum.JSON)
                        {
                            Multiple_Paged_Results_Args returnArgs = SobekCM_Database.Get_Item_Aggregation_Browse_Paged(Current_Mode.Aggregation, "1900-01-01", false, 20, Current_Mode.Page, 0, need_browse_statistics, Aggregation_Object.Facets, need_browse_statistics, Tracer);
                            if (need_browse_statistics)
                            {
                                Complete_Result_Set_Info = returnArgs.Statistics;
                            }
                            pagesOfResults = returnArgs.Paged_Results;
                            if ((pagesOfResults != null) && (pagesOfResults.Count > 0))
                                Paged_Results = pagesOfResults[0];
                        }
                        else
                        {
                            Multiple_Paged_Results_Args returnArgs = Aggregation_Object.Get_Browse_Results(Browse_Object, Current_Mode.Page, sort, results_per_page, !special_search_type, need_browse_statistics, Tracer);
                            if (need_browse_statistics)
                            {
                                Complete_Result_Set_Info = returnArgs.Statistics;
                            }
                            pagesOfResults = returnArgs.Paged_Results;
                            if ((pagesOfResults != null) && (pagesOfResults.Count > 0))
                                Paged_Results = pagesOfResults[0];
                        }

                        // Save the overall result set statistics to the cache if something was pulled
                        if (!special_search_type)
                        {
                            if ((need_browse_statistics) && (Complete_Result_Set_Info != null))
                            {
                                Cached_Data_Manager.Store_Browse_Result_Statistics(Aggregation_Object.Code, browse_code, Complete_Result_Set_Info, Tracer);
                            }

                            // Save the overall result set statistics to the cache if something was pulled
                            if ((need_paged_results) && (Paged_Results != null))
                            {
                                Cached_Data_Manager.Store_Browse_Results(Aggregation_Object.Code, browse_code, Current_Mode.Page, sort, pagesOfResults, Tracer);
                            }
                        }
                    }
                    break;

                case Item_Aggregation_Browse_Info.Result_Data_Type.Text:
                    Browse_Info_Display_Text = Browse_Object.Get_Static_Content(Current_Mode.Language, Current_Mode.Base_URL, SobekCM_Library_Settings.Base_Design_Location + Aggregation_Object.objDirectory, Tracer);
                    break;
            }
            return true;
        }
コード例 #10
0
 /// <summary>
 ///   Add a new browse or info object to this hierarchical object
 /// </summary>
 /// <param name = "newBrowse">Completely assembled browse or info object</param>
 internal void Add_Browse_Info(Item_Aggregation_Browse_Info newBrowse)
 {
     // Add this to the Hash table
     browseInfoHash[newBrowse.Code] = newBrowse;
 }
コード例 #11
0
        /// <summary>
        ///   Add a new browse or info object to this hierarchical object
        /// </summary>
        /// <param name = "Browse_Type">Flag indicates if this is a BROWSE or INFO object</param>
        /// <param name = "Browse_Code">SubMode indicator for this object</param>
        /// <param name = "Static_HTML_Source">Any static HTML source to be used for display</param>
        /// <param name = "Text">Text to display for this browse</param>
        /// <returns>The built data object</returns>
        internal Item_Aggregation_Browse_Info Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type Browse_Type, string Browse_Code, string Static_HTML_Source, string Text)
        {
            // Create the new Browse_Info object
            Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info(Browse_Type, Item_Aggregation_Browse_Info.Source_Type.Database, Browse_Code, Static_HTML_Source, Text);

            // Add this to the Hash table
            browseInfoHash[Browse_Code] = newBrowse;

            return newBrowse;
        }
コード例 #12
0
 public void Remove_Browse_Info_Page( Item_Aggregation_Browse_Info Browse_Page )
 {
     if (browseInfoHash.ContainsKey(Browse_Page.Code))
         browseInfoHash.Remove(Browse_Page.Code);
 }
コード例 #13
0
        /// <summary>
        ///   Method returns the table of results for the browse indicated
        /// </summary>
        /// <param name = "BrowseInfoObject">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 = "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>
        /// <returns> Resutls for the browse or info in table form </returns>
        public Results.Multiple_Paged_Results_Args Get_Browse_Results(Item_Aggregation_Browse_Info BrowseInfoObject,
                                                                      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.Get_Browse_Table", String.Empty);
            }

            // Get the list of facets first
            List<short> facetsList = Facets;
            if (!Potentially_Include_Facets)
                facetsList = null;

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

                if (BrowseInfoObject.Code == "new")
                {
                    return Database.SobekCM_Database.Get_Item_Aggregation_Browse_Paged(Code, true, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer);
                }
                return Database.SobekCM_Database.Get_Item_Aggregation_Browse_Paged(Code, false, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer);
            }

            // Default return NULL
            return null;
        }
        private void Browse_Writer_Helper(TextWriter Output, int BrowseCounter, Item_Aggregation_Browse_Info thisBrowse, int Max_Labels, int Max_Sources)
        {
            string directory = (SobekCM_Library_Settings.Base_Design_Location + itemAggregation.objDirectory).ToLower().Replace("/", "\\");

            // Add the code line
            Output.WriteLine("<tr><td width=\"120px\"> &nbsp; &nbsp; <label for=\"admin_aggr_browse_code_" + BrowseCounter + "\">Code:</label></td><td><input class=\"admin_aggr_small_input\" name=\"admin_aggr_browse_code_" + BrowseCounter + "\" id=\"admin_aggr_browse_code_" + BrowseCounter + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(thisBrowse.Code) + "\" onfocus=\"javascript:textbox_enter('admin_aggr_browse_code_" + BrowseCounter + "', 'admin_aggr_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_aggr_browse_code_" + BrowseCounter + "', 'admin_aggr_small_input')\" /></td></tr>");

            // Add the type line
            Output.Write("<tr><td> &nbsp; &nbsp; <label for=\"admin_aggr_link_" + BrowseCounter + "\">Type:</label></td><td><select class=\"admin_aggr_select\" name=\"admin_aggr_browse_type_" + BrowseCounter + "\" id=\"admin_aggr_browse_type_" + BrowseCounter + "\">");
            if (thisBrowse.Browse_Type ==  Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home)
                Output.Write("<option value=\"browse\" selected=\"selected\">Browse</option>");
            else
                Output.Write("<option value=\"browse\">Browse</option>");

            if (thisBrowse.Browse_Type ==  Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By)
                Output.Write("<option value=\"browseby\" selected=\"selected\">Browse By</option>");
            else
                Output.Write("<option value=\"browseby\">Browse By</option>");

            if (thisBrowse.Browse_Type ==  Item_Aggregation_Browse_Info.Browse_Info_Type.Info)
                Output.Write("<option value=\"info\" selected=\"selected\">Info</option>");
            else
                Output.Write("<option value=\"info\">Info</option>");

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

            // Add lines for the label
            if (Max_Labels == 1)
                Output.Write("<tr><td> &nbsp; &nbsp; Label:</td><td>");
            else
                Output.Write("<tr valign=\"top\"><td><br /> &nbsp; &nbsp; Label:</td><td>");
            for (int j = 0; j < Max_Labels; j++)
            {
                Web_Language_Enum language = SobekCM_Library_Settings.Default_UI_Language;
                string text = String.Empty;
                if (j < thisBrowse.Label_Dictionary.Count)
                {
                    language = thisBrowse.Label_Dictionary.Keys.ElementAt(j);
                    text = thisBrowse.Label_Dictionary[language];
                }

                // Start the select box
                string id = "admin_aggr_label_lang_" + BrowseCounter + "_" + (j + 1).ToString();
                string id2 = "admin_aggr_label_" + BrowseCounter + "_" + (j + 1).ToString();
                Output.Write("<select class=\"admin_aggr_select2\" name=\"" + id + "\" id=\"" + id + "\">");

                // Add each language in the combo box
                foreach (string possible_language in Web_Language_Enum_Converter.Language_Name_Array)
                {
                    if (language == Web_Language_Enum_Converter.Code_To_Enum(possible_language))
                    {
                        Output.Write("<option value=\"" + possible_language + "\" selected=\"selected\" >" + HttpUtility.HtmlEncode(possible_language) + "</option>");
                    }
                    else
                    {
                        Output.Write("<option value=\"" + possible_language + "\">" + HttpUtility.HtmlEncode(possible_language) + "</option>");
                    }
                }
                Output.WriteLine("</select> &nbsp; &nbsp; ");

                // Add the text to the text box
                Output.Write("<input class=\"admin_aggr_medium_input\" name=\"" + id2 + "\" id=\"" + id2 + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(text) + "\" onfocus=\"javascript:textbox_enter('" + id2 + "', 'admin_aggr_medium_input_focused')\" onblur=\"javascript:textbox_leave('" + id2 + "', 'admin_aggr_medium_input')\" /><br />");
            }
            Output.WriteLine("</td></tr>");

            // Add sources by language
            if (Max_Sources == 1)
                Output.Write("<tr><td> &nbsp; &nbsp; HTML Source:</td><td>");
            else
                Output.Write("<tr valign=\"top\"><td><br /> &nbsp; &nbsp; HTML Source:</td><td>");
            for (int j = 0; j < Max_Sources; j++)
            {
                Web_Language_Enum language = SobekCM_Library_Settings.Default_UI_Language;
                string text = String.Empty;
                if (j < thisBrowse.Source_Dictionary.Count)
                {
                    language = thisBrowse.Source_Dictionary.Keys.ElementAt(j);
                    text = thisBrowse.Source_Dictionary[language];
                }

                // Start the select box
                string id = "admin_aggr_source_lang_" + BrowseCounter + "_" + (j + 1).ToString();
                string id2 = "admin_aggr_source_" + BrowseCounter + "_" + (j + 1).ToString();
                Output.Write("<hr /><select class=\"admin_aggr_select2\" name=\"" + id + "\" id=\"" + id + "\">");

                // Add each language in the combo box
                foreach (string possible_language in Web_Language_Enum_Converter.Language_Name_Array)
                {
                    if (language == Web_Language_Enum_Converter.Code_To_Enum(possible_language))
                    {
                        Output.Write("<option value=\"" + possible_language + "\" selected=\"selected\" >" + HttpUtility.HtmlEncode(possible_language) + "</option>");
                    }
                    else
                    {
                        Output.Write("<option value=\"" + possible_language + "\">" + HttpUtility.HtmlEncode(possible_language) + "</option>");
                    }
                }
                Output.WriteLine("</select> <br /> ");

                // Add the text to the text box
                if ((text.ToLower().IndexOf("http://") < 0) && (text.IndexOf("<%BASEURL%>") < 0))
                {

                    text = text.ToLower().Replace("/", "\\").Replace(directory, "");
                }
                Output.Write("<input class=\"admin_aggr_large_input\" name=\"" + id2 + "\" id=\"" + id2 + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(text) + "\" onfocus=\"javascript:textbox_enter('" + id2 + "', 'admin_aggr_large_input_focused')\" onblur=\"javascript:textbox_leave('" + id2 + "', 'admin_aggr_large_input')\" /><br />");
            }
            Output.WriteLine("</td></tr>");

            // Add a delete option
            Output.WriteLine("<tr><td colspan=\"2\" align=\"right\"><a href=\"\">DELETE THIS PAGE</a></td></tr>");
        }
コード例 #15
0
        /// <summary> Constructor creates a new instance of the Aggregation_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="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param>
        /// <param name="Paged_Results"> Paged results to display within a browse or search result </param>
        /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </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="Thematic_Headings"> Headings under which all the highlighted collections on the home page are organized </param>
        /// <param name="Current_User"> Currently logged on user </param>
        /// <param name="IP_Restrictions"> IP restrictions, used to determine if a user has access to a particular 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>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public Aggregation_HtmlSubwriter(Item_Aggregation Hierarchy_Object, 
            SobekCM_Navigation_Object Current_Mode, SobekCM_Skin_Object HTML_Skin, 
            Language_Support_Info Translator, 
            Item_Aggregation_Browse_Info Browse_Object,
            Search_Results_Statistics Results_Statistics,
            List<iSearch_Title_Result> Paged_Results,
            Aggregation_Code_Manager Code_Manager, Item_Lookup_Object All_Items_Lookup,
            List<Thematic_Heading> Thematic_Headings, User_Object Current_User,
            IP_Restriction_Ranges IP_Restrictions,
            HTML_Based_Content Static_Web_Content,
            Custom_Tracer Tracer )
        {
            currentUser = Current_User;
            base.Hierarchy_Object = Hierarchy_Object;
            currentMode = Current_Mode;
            Skin = HTML_Skin;
            translator = Translator;
            thisBrowseObject = Browse_Object;
            thisStaticBrowseObject = Static_Web_Content;
            codeManager = Code_Manager;
            itemList = All_Items_Lookup;
            thematicHeadings = Thematic_Headings;
            ipRestrictions = IP_Restrictions;
            resultsStatistics = Results_Statistics;
            pagedResults = Paged_Results;

            NameValueCollection form = HttpContext.Current.Request.Form;
            if (form["item_action"] != null)
            {
                string action = form["item_action"].ToLower().Trim();

                if (action == "add_aggregation")
                {
                    SobekCM_Database.User_Set_Aggregation_Home_Page_Flag(currentUser.UserID, base.Hierarchy_Object.Aggregation_ID, true, Tracer);
                    currentUser.Set_Aggregation_Home_Page_Flag(base.Hierarchy_Object.Code, base.Hierarchy_Object.Name, true);
                    HttpContext.Current.Session.Add("ON_LOAD_MESSAGE", "Added aggregation to your home page");
                }

                if (action == "remove_aggregation")
                {
                    int removeAggregationID = base.Hierarchy_Object.Aggregation_ID;
                    string remove_code = base.Hierarchy_Object.Code;
                    string remove_name = base.Hierarchy_Object.Name;

                    if ((form["aggregation"] != null) && (form["aggregation"].Length > 0))
                    {
                        Item_Aggregation_Related_Aggregations aggrInfo = codeManager[form["aggregation"]];
                        if (aggrInfo != null)
                        {
                            remove_code = aggrInfo.Code;
                            removeAggregationID = aggrInfo.ID;
                        }
                    }

                    SobekCM_Database.User_Set_Aggregation_Home_Page_Flag(currentUser.UserID, removeAggregationID, false, Tracer);
                    currentUser.Set_Aggregation_Home_Page_Flag(remove_code, remove_name, false);

                    if (currentMode.Home_Type != Home_Type_Enum.Personalized)
                    {
                        HttpContext.Current.Session.Add("ON_LOAD_MESSAGE", "Removed aggregation from your home page");
                    }
                }

                if (action == "private_folder")
                {
                    User_Folder thisFolder = currentUser.Get_Folder(form["aggregation"]);
                    if (SobekCM_Database.Edit_User_Folder(thisFolder.Folder_ID, currentUser.UserID, -1, thisFolder.Folder_Name, false, String.Empty, Tracer) >= 0)
                        thisFolder.isPublic = false;
                }

                if (action == "email")
                {
                    string address = form["email_address"].Replace(";", ",").Trim();
                    string comments = form["email_comments"].Trim();
                    string format = form["email_format"].Trim().ToUpper();

                    if (address.Length > 0)
                    {
                        // Determine the email format
                        bool is_html_format = true;
                        if (format == "TEXT")
                            is_html_format = false;

                        // CC: the user, unless they are already on the list
                        string cc_list = currentUser.Email;
                        if (address.ToUpper().IndexOf(currentUser.Email.ToUpper()) >= 0)
                            cc_list = String.Empty;

                        // Send the email
                        string any_error = URL_Email_Helper.Send_Email(address, cc_list, comments, currentUser.Full_Name, currentMode.SobekCM_Instance_Abbreviation, is_html_format, HttpContext.Current.Items["Original_URL"].ToString(), base.Hierarchy_Object.Name, "home");
                        HttpContext.Current.Session.Add("ON_LOAD_MESSAGE", any_error.Length > 0 ? any_error : "Your email has been sent");

                        currentMode.isPostBack = true;

                        // Do this to force a return trip (cirumnavigate cacheing)
                        string original_url = HttpContext.Current.Items["Original_URL"].ToString();
                        if (original_url.IndexOf("?") < 0)
                            HttpContext.Current.Response.Redirect(original_url + "?p=" + DateTime.Now.Millisecond, false);
                        else
                            HttpContext.Current.Response.Redirect(original_url + "&p=" + DateTime.Now.Millisecond, false);
                    }
                }
            }

            // If this is a search, verify it is a valid search type
            if (currentMode.Mode == Display_Mode_Enum.Search)
            {
                // Not every collection has every search type...
                ReadOnlyCollection<Search_Type_Enum> possibleSearches = base.Hierarchy_Object.Search_Types;
                if (!possibleSearches.Contains(currentMode.Search_Type))
                {
                    bool found_valid = false;

                    if ((currentMode.Search_Type == Search_Type_Enum.Full_Text) && (possibleSearches.Contains(Search_Type_Enum.dLOC_Full_Text)))
                    {
                        found_valid = true;
                        currentMode.Search_Type = Search_Type_Enum.dLOC_Full_Text;
                    }

                    if ((!found_valid) && (currentMode.Search_Type == Search_Type_Enum.Basic) && (possibleSearches.Contains(Search_Type_Enum.Newspaper)))
                    {
                        found_valid = true;
                        currentMode.Search_Type = Search_Type_Enum.Newspaper;
                    }

                    if (( !found_valid ) && ( possibleSearches.Count > 0 ))
                    {
                        found_valid = true;
                        currentMode.Search_Type = possibleSearches[0];
                    }

                    if ( !found_valid )
                    {
                        currentMode.Mode = Display_Mode_Enum.Aggregation_Home;
                    }
                }
            }

            if (currentMode.Mode == Display_Mode_Enum.Search)
            {
                collectionViewer = AggregationViewer_Factory.Get_Viewer(currentMode.Search_Type, base.Hierarchy_Object, currentMode, currentUser);
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Home)
            {
                collectionViewer = AggregationViewer_Factory.Get_Viewer(base.Hierarchy_Object.Views_And_Searches[0], base.Hierarchy_Object, currentMode);
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Browse_Info)
            {
                if ( resultsStatistics == null )
                {
                    collectionViewer = new Static_Browse_Info_AggregationViewer(thisBrowseObject, thisStaticBrowseObject);
                }
                else
                {
                    collectionViewer = new DataSet_Browse_Info_AggregationViewer(thisBrowseObject, resultsStatistics, pagedResults, codeManager, itemList, currentUser );
                }
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Browse_By)
            {
                collectionViewer = new Metadata_Browse_AggregationViewer( Current_Mode, Hierarchy_Object, Tracer );
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Browse_Map)
            {
                collectionViewer = new Map_Browse_AggregationViewer(Current_Mode, Hierarchy_Object, Tracer);
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Item_Count)
            {
                collectionViewer = new Item_Count_AggregationViewer(Current_Mode, Hierarchy_Object);
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Usage_Statistics)
            {
                collectionViewer = new Usage_Statistics_AggregationViewer(Current_Mode, Hierarchy_Object);
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Private_Items)
            {
                collectionViewer = new Private_Items_AggregationViewer(Current_Mode, Hierarchy_Object, Tracer);
            }

            if (currentMode.Mode == Display_Mode_Enum.Aggregation_Admin_View)
            {
                collectionViewer = new Admin_AggregationViewer(Hierarchy_Object);
            }

            if (collectionViewer != null)
            {
                collectionViewer.Translator = translator;
                collectionViewer.HTML_Skin = HTML_Skin;
                collectionViewer.CurrentMode = Current_Mode;
                collectionViewer.CurrentObject = Hierarchy_Object;
                collectionViewer.Current_User = Current_User;

                // Pull the standard values
                switch (collectionViewer.Selection_Panel_Display)
                {
                    case Selection_Panel_Display_Enum.Selectable:
                        if (form["show_subaggrs"] != null)
                        {
                            string show_subaggrs = form["show_subaggrs"].ToUpper();
                            if (show_subaggrs == "TRUE")
                                currentMode.Show_Selection_Panel = true;
                        }
                        break;

                    case Selection_Panel_Display_Enum.Always:
                        currentMode.Show_Selection_Panel = true;
                        break;
                }
            }
        }
        private void Add_Page_5(TextWriter Output)
        {
            Output.WriteLine("<table class=\"popup_table\">");

            // Determine the maximum number of languages used in tooltips and text
            int max_labels = 0;
            int max_sources = 0;
            List<Item_Aggregation_Browse_Info> browse_infos = new List<Item_Aggregation_Browse_Info>();
            foreach (Item_Aggregation_Browse_Info thisBrowse in itemAggregation.Browse_Home_Pages(SobekCM_Library_Settings.Default_UI_Language))
            {
                if (thisBrowse.Source == Item_Aggregation_Browse_Info.Source_Type.Static_HTML)
                {
                    max_labels = Math.Max(max_labels, thisBrowse.Label_Dictionary.Count);
                    max_sources = Math.Max(max_sources, thisBrowse.Source_Dictionary.Count);
                    browse_infos.Add(thisBrowse);
                }
            }
            foreach (Item_Aggregation_Browse_Info thisBrowse in itemAggregation.Browse_By_Pages(SobekCM_Library_Settings.Default_UI_Language))
            {
                if (thisBrowse.Source == Item_Aggregation_Browse_Info.Source_Type.Static_HTML)
                {
                    max_labels = Math.Max(max_labels, thisBrowse.Label_Dictionary.Count);
                    max_sources = Math.Max(max_sources, thisBrowse.Source_Dictionary.Count);
                    browse_infos.Add(thisBrowse);
                }
            }
            foreach (Item_Aggregation_Browse_Info thisBrowse in itemAggregation.Info_Pages)
            {
                if (thisBrowse.Source == Item_Aggregation_Browse_Info.Source_Type.Static_HTML)
                {
                    max_labels = Math.Max(max_labels, thisBrowse.Label_Dictionary.Count);
                    max_sources = Math.Max(max_sources, thisBrowse.Source_Dictionary.Count);
                    browse_infos.Add(thisBrowse);
                }
            }
            max_labels += 1;
            max_sources += 1;

            // Add each browse and info page
            for (int i = 0; i < browse_infos.Count + 1; i++)
            {
                if (i > 0)
                {
                    // Add some space and a line
                    Output.WriteLine("<tr><td colspan=\"2\">&nbsp;</td></tr>");
                    Output.WriteLine("<tr style=\"background:#333333\"><td colspan=\"2\"></td></tr>");
                    Output.WriteLine("<tr><td colspan=\"2\">&nbsp;</td></tr>");
                }

                // Get the info/browse object to display, or make an empty one
                Item_Aggregation_Browse_Info emptyBrowseInfo = new Item_Aggregation_Browse_Info();
                emptyBrowseInfo.Source = Item_Aggregation_Browse_Info.Source_Type.Static_HTML;
                emptyBrowseInfo.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home;
                if (i < browse_infos.Count)
                    emptyBrowseInfo = browse_infos[i];

                // Now, add it to the form
                Browse_Writer_Helper(Output, i + 1, emptyBrowseInfo, max_labels, max_sources);
            }

            Output.WriteLine("</table>");
            Output.WriteLine("<br />");
        }
        private void Save_Page_6_Postback(NameValueCollection form)
        {
            // Get the metadata browses
            List<Item_Aggregation_Browse_Info> metadata_browse_bys = new List<Item_Aggregation_Browse_Info>();
            foreach (Item_Aggregation_Browse_Info thisBrowse in itemAggregation.Browse_By_Pages(SobekCM_Library_Settings.Default_UI_Language))
            {
                if (thisBrowse.Browse_Type == Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By)
                {
                    if (thisBrowse.Source == Item_Aggregation_Browse_Info.Source_Type.Database)
                    {
                        metadata_browse_bys.Add(thisBrowse);
                    }
                }
            }

            // Remove all these browse by's
            foreach (Item_Aggregation_Browse_Info browseBy in metadata_browse_bys)
            {
                itemAggregation.Remove_Browse_Info_Page(browseBy);
            }

            // Look for the default browse by
            short default_browseby_id = 0;
            if (form["admin_aggr_default_browseby"] != null)
            {
                string default_browseby = form["admin_aggr_default_browseby"].ToString();
                if (Int16.TryParse(default_browseby, out default_browseby_id))
                {
                    Metadata_Search_Field field = SobekCM_Library_Settings.Metadata_Search_Field_By_ID(default_browseby_id);
                    if (field != null)
                    {
                        Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By, Item_Aggregation_Browse_Info.Source_Type.Database, field.Display_Term, String.Empty, field.Display_Term);
                        itemAggregation.Add_Browse_Info(newBrowse);
                        itemAggregation.Default_BrowseBy = field.Display_Term;
                    }
                }
                else
                {
                    itemAggregation.Default_BrowseBy = default_browseby;
                }
            }

            // Now, get all the new browse bys
            for (int i = 0; i < metadata_browse_bys.Count + 10; i++)
            {
                if (form["admin_aggr_browseby_" + i] != null)
                {
                    short browseby_id = Convert.ToInt16(form["admin_aggr_browseby_" + i]);
                    if ((browseby_id > 0) && (default_browseby_id != browseby_id))
                    {
                        Metadata_Search_Field field = SobekCM_Library_Settings.Metadata_Search_Field_By_ID(browseby_id);
                        if (field != null)
                        {
                            Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By, Item_Aggregation_Browse_Info.Source_Type.Database, field.Display_Term, String.Empty, field.Display_Term);
                            itemAggregation.Add_Browse_Info(newBrowse);
                        }
                    }
                }
            }
        }
コード例 #18
0
 /// <summary>Reads the item aggregation browse or info file and returns a built <see cref="Item_Aggregation_Browse_Info"/> object for
 /// inclusion in the item aggregation </summary>
 /// <param name="fileName"> Filename of the browse or info file</param>
 /// <param name="Browse_Type"> Flag indicates if this is a browse or info file</param>
 /// <param name="tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
 /// <returns> Built object containing all of the pertinent details about this info or browse </returns>
 private static Item_Aggregation_Browse_Info Get_Item_Aggregation_Browse_Info( string fileName, Item_Aggregation_Browse_Info.Browse_Info_Type Browse_Type, Custom_Tracer tracer )
 {
     HTML_Based_Content fileContent = HTML_Based_Content_Reader.Read_HTML_File(fileName, false, tracer);
     Item_Aggregation_Browse_Info returnObject = new Item_Aggregation_Browse_Info(Browse_Type, Item_Aggregation_Browse_Info.Source_Type.Static_HTML, fileContent.Code, fileName, fileContent.Title);
     return returnObject;
 }
 /// <summary> Constructor for a new instance of the Static_Browse_Info_AggregationViewer class </summary>
 /// <param name="Browse_Object"> Browse or information object to be displayed </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 Static_Browse_Info_AggregationViewer(Item_Aggregation_Browse_Info Browse_Object, HTML_Based_Content Static_Web_Content )
     : base(null, null)
 {
     browseObject = Browse_Object;
     staticWebContent = Static_Web_Content;
 }
コード例 #20
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="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);
                    }
                }
            }
        }
コード例 #21
0
        private static void read_browse(bool browse, XmlNodeReader nodeReader, Item_Aggregation hierarchyObject)
        {
            // Create a new browse/info object
            Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info
            {
                Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home,
                Source      = Item_Aggregation_Browse_Info.Source_Type.Static_HTML,
                Data_Type   = Item_Aggregation_Browse_Info.Result_Data_Type.Text
            };

            bool isDefault = false;

            string code = String.Empty;

            // Determine which XML node name to look for and set browse v. info
            string lastName = "HI:BROWSE";

            if (!browse)
            {
                lastName = "HI:INFO";
                newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Info;
            }

            // Check for the attributes
            if (nodeReader.HasAttributes)
            {
                if (nodeReader.MoveToAttribute("location"))
                {
                    if (nodeReader.Value == "BROWSEBY")
                    {
                        newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By;
                    }
                }
                if (nodeReader.MoveToAttribute("default"))
                {
                    if (nodeReader.Value == "DEFAULT")
                    {
                        isDefault = true;
                    }
                }
            }

            // Step through the XML and build this browse/info object
            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:METADATA":
                        nodeReader.Read();
                        newBrowse.Code      = nodeReader.Value.ToLower();
                        newBrowse.Source    = Item_Aggregation_Browse_Info.Source_Type.Database;
                        newBrowse.Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Table;
                        break;

                    case "HI:CODE":
                        nodeReader.Read();
                        newBrowse.Code = nodeReader.Value.ToLower();
                        break;

                    case "HI:TITLE":
                        // Look for a language attached to this title
                        string titleLanguage = String.Empty;
                        if ((nodeReader.HasAttributes) && (nodeReader.MoveToAttribute("lang")))
                        {
                            titleLanguage = nodeReader.GetAttribute("lang");
                        }

                        // read and save the title
                        nodeReader.Read();
                        newBrowse.Add_Label(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(titleLanguage));
                        break;

                    case "HI:BODY":
                        // Look for a language attached to this title
                        string bodyLanguage = String.Empty;
                        if ((nodeReader.HasAttributes) && (nodeReader.MoveToAttribute("lang")))
                        {
                            bodyLanguage = nodeReader.GetAttribute("lang");
                        }

                        // read and save the title
                        nodeReader.Read();
                        string bodySource = nodeReader.Value;
                        newBrowse.Add_Static_HTML_Source(bodySource, Web_Language_Enum_Converter.Code_To_Enum(bodyLanguage));
                        break;
                    }
                }

                if (nodeReader.NodeType == XmlNodeType.EndElement)
                {
                    if (nodeReader.Name.Trim().ToUpper() == lastName)
                    {
                        hierarchyObject.Add_Browse_Info(newBrowse);

                        // If this set the default browse by save that information
                        if ((newBrowse.Browse_Type == Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By) && (isDefault))
                        {
                            hierarchyObject.Default_BrowseBy = newBrowse.Code;
                        }

                        return;
                    }
                }
            }
        }
コード例 #22
0
        private static void read_browse(bool browse, XmlNodeReader nodeReader, Item_Aggregation hierarchyObject )
        {
            // Create a new browse/info object
            Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info
                                {
                                    Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home,
                                    Source = Item_Aggregation_Browse_Info.Source_Type.Static_HTML,
                                    Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Text
                                };

            bool isDefault = false;

            string code = String.Empty;

            // Determine which XML node name to look for and set browse v. info
            string lastName = "HI:BROWSE";
            if (!browse)
            {
                lastName = "HI:INFO";
                newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Info;
            }

            // Check for the attributes
            if (nodeReader.HasAttributes)
            {
                if (nodeReader.MoveToAttribute("location"))
                {
                    if (nodeReader.Value == "BROWSEBY")
                        newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By;
                }
                if (nodeReader.MoveToAttribute("default"))
                {
                    if (nodeReader.Value == "DEFAULT")
                        isDefault = true;
                }
            }

            // Step through the XML and build this browse/info object
            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:METADATA":
                            nodeReader.Read();
                            newBrowse.Code = nodeReader.Value.ToLower();
                            newBrowse.Source = Item_Aggregation_Browse_Info.Source_Type.Database;
                            newBrowse.Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Table;
                            break;

                        case "HI:CODE":
                            nodeReader.Read();
                            newBrowse.Code = nodeReader.Value.ToLower();
                            break;

                        case "HI:TITLE":
                            // Look for a language attached to this title
                            string titleLanguage = String.Empty;
                            if ((nodeReader.HasAttributes) && ( nodeReader.MoveToAttribute("lang")))
                            {
                                titleLanguage = nodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            nodeReader.Read();
                            newBrowse.Add_Label( nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(titleLanguage));
                            break;

                        case "HI:BODY":
                            // Look for a language attached to this title
                            string bodyLanguage = String.Empty;
                            if ((nodeReader.HasAttributes) && (nodeReader.MoveToAttribute("lang")))
                            {
                                bodyLanguage = nodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            nodeReader.Read();
                            string bodySource = nodeReader.Value;
                            newBrowse.Add_Static_HTML_Source(bodySource, Web_Language_Enum_Converter.Code_To_Enum(bodyLanguage));
                            break;
                    }
                }

                if (nodeReader.NodeType == XmlNodeType.EndElement)
                {
                    if (nodeReader.Name.Trim().ToUpper() == lastName )
                    {
                        hierarchyObject.Add_Browse_Info(newBrowse);

                        // If this set the default browse by save that information
                        if ((newBrowse.Browse_Type == Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By) && (isDefault))
                        {
                            hierarchyObject.Default_BrowseBy = newBrowse.Code;
                        }

                        return;
                    }
                }
            }
        }