Пример #1
0
        /// <summary> Stream to which to write the HTML for this subwriter  </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("EAD_Description_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Try to get the ead information
            EAD_Transfer_Object eadInfo = SobekEngineClient.Items.Get_Item_EAD(BriefItem.BibID, BriefItem.VID, true, Tracer);

            // Build the value
            Output.WriteLine("          <td>");
            Output.WriteLine("            <div id=\"sbkEad_MainArea\">");

            if (!String.IsNullOrWhiteSpace(CurrentMode.Text_Search))
            {
                // Get any search terms
                List <string> terms = new List <string>();
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }

                Output.Write(Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(eadInfo.Full_Description, terms));
            }
            else
            {
                Output.Write(eadInfo.Full_Description);
            }

            Output.WriteLine("            </div>");
            Output.WriteLine("          </td>");
        }
        /// <summary> Gets the special EAD information related to a digital resource object, by BibID_VID </summary>
        /// <param name="BibID"> Bibliographic identifier (BibID) for the digital resource to retrieve </param>
        /// <param name="VID"> Volume identifier (VID) for the digital resource to retrieve </param>
        /// <param name="UseCache"> Flag indicates if the cache should be used to check for a built copy or store the final product </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Fully built EAD information, or NULL </returns>
        public EAD_Transfer_Object Get_Item_EAD(string BibID, string VID, bool UseCache, Custom_Tracer Tracer)
        {
            // Add a beginning trace
            Tracer.Add_Trace("SobekEngineClient_ItemEndpoints.Get_Item_EAD", "Get EAD information by bibid/vid");

            // Look in the cache
            if ((Config.UseCache) && (UseCache))
            {
                EAD_Transfer_Object fromCache = CachedDataManager.Items.Retrieve_EAD_Info(BibID, VID, Tracer);
                if (fromCache != null)
                {
                    Tracer.Add_Trace("SobekEngineClient_ItemEndpoints.Get_Item_EAD", "Found EAD informationin the local cache");
                    return(fromCache);
                }
            }
            // Get the endpoint
            MicroservicesClient_Endpoint endpoint = GetEndpointConfig("Items.GetItemEAD", Tracer);

            // Format the URL
            string url = String.Format(endpoint.URL, BibID, VID);

            // Call out to the endpoint and deserialize the object
            EAD_Transfer_Object returnValue = Deserialize <EAD_Transfer_Object>(url, endpoint.Protocol, Tracer);

            // Add to the local cache
            if ((Config.UseCache) && (UseCache) && (returnValue != null))
            {
                Tracer.Add_Trace("SobekEngineClient_ItemEndpoints.Get_Item_EAD", "Store EAD information in the local cache");
                CachedDataManager.Items.Store_EAD_Info(BibID, VID, returnValue, Tracer);
            }

            // Return the object
            return(returnValue);
        }
Пример #3
0
        /// <summary> Store the EAD information related to a digital resource on the cache   </summary>
        /// <param name="BibID"> Bibliographic Identifier for the digital resource to store </param>
        /// <param name="VID"> Volume Identifier for the digital resource to store </param>
        /// <param name="StoreObject"> EAD information for a digital Resource object to store for later retrieval </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        public void Store_EAD_Info(string BibID, string VID, EAD_Transfer_Object StoreObject, Custom_Tracer Tracer)
        {
            // If the cache is disabled, just return before even tracing
            if (settings.Disabled)
            {
                return;
            }

            // Determine the key
            string    key            = "ITEM_" + BibID + "_" + VID + "_EadInfo";
            const int LENGTH_OF_TIME = 3;

            if (Tracer != null)
            {
                Tracer.Add_Trace("CachedDataManager_ItemServices.Store_EAD_Info", "Adding object '" + key + "' to the local cache with expiration of " + LENGTH_OF_TIME + " minute");
            }

            HttpContext.Current.Cache.Insert(key, StoreObject, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(LENGTH_OF_TIME));
        }
Пример #4
0
        /// <summary> Adds the main view section to the page turner </summary>
        /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Add_Main_Viewer_Section(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("EAD_Container_List_ItemViewer.Add_Main_Viewer_Section", "");
            }

            // Try to get the ead information
            EAD_Transfer_Object eadInfo = SobekEngineClient.Items.Get_Item_EAD(BriefItem.BibID, BriefItem.VID, true, Tracer);

            // Build any search terms
            List <string> terms = new List <string>();

            if (!String.IsNullOrWhiteSpace(CurrentMode.Text_Search))
            {
                // Get any search terms
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }
            }

            // Build the value
            StringBuilder builder = new StringBuilder(15000);

            builder.AppendLine("          <td><div id=\"sbkEad_ViewerTitle\">Container List</div></td>");
            builder.AppendLine("        </tr>");
            builder.AppendLine("        <tr>");
            builder.AppendLine("          <td id=\"sbkEad_MainArea\">");


            // Step through the top level first
            foreach (EAD_Transfer_Container_Info container in eadInfo.Container_Hierarchy.Containers)
            {
                // Add this container title and date information first
                builder.Append("<h2>" + container.Unit_Title);
                if (container.Unit_Date.Length > 0)
                {
                    builder.Append(", " + container.Unit_Date);
                }
                builder.AppendLine("</h2>");

                // Add physical extent, if it exists
                if (container.Extent.Length > 0)
                {
                    builder.AppendLine("<strong>" + container.Extent + "</strong><br />");
                }

                // Add the scope content next
                if (container.Scope_And_Content.Length > 0)
                {
                    builder.AppendLine(container.Scope_And_Content);
                }

                // Add any bioghist next
                if (container.Biographical_History.Length > 0)
                {
                    builder.AppendLine(container.Biographical_History);
                }

                // Are there children to this top container
                if (container.Children.Count > 0)
                {
                    // Dump the current builder into a literal
                    Literal newLiteral = new Literal
                    {
                        Text = Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(builder.ToString(), terms)
                    };
                    MainPlaceHolder.Controls.Add(newLiteral);

                    // Clear the contents of the builder
                    builder.Remove(0, builder.Length);

                    // Now, add this as a tree
                    TreeView treeView1 = new TreeView
                    {
                        Width = new Unit(700), NodeWrap = true, EnableClientScript = true, PopulateNodesFromClient = false
                    };

                    // Set some tree view properties
                    treeView1.TreeNodePopulate += treeView1_TreeNodePopulate;

                    // Add each child tree node
                    foreach (EAD_Transfer_Container_Info child in container.Children)
                    {
                        // Add this node
                        TreeNode childNode = new TreeNode(child.Unit_Title)
                        {
                            SelectAction = TreeNodeSelectAction.None
                        };
                        if (child.DAO_Link.Length > 0)
                        {
                            if (child.DAO_Title.Length > 0)
                            {
                                childNode.Text = child.Unit_Title + " &nbsp; <a href=\"" + child.DAO_Link + "\">" + child.DAO_Title + "</a>";
                            }
                            else
                            {
                                childNode.Text = "<a href=\"" + child.DAO_Link + "\">" + child.Unit_Title + "</a>";
                            }
                        }

                        treeView1.Nodes.Add(childNode);

                        // Add the description, if there is one
                        if (child.Scope_And_Content.Length > 0)
                        {
                            TreeNode scopeContentNode = new TreeNode(child.Scope_And_Content)
                            {
                                SelectAction = TreeNodeSelectAction.None
                            };
                            childNode.ChildNodes.Add(scopeContentNode);
                        }

                        // Add the grand children
                        if (child.Children_Count > 0)
                        {
                            foreach (EAD_Transfer_Container_Info grandChild in child.Children)
                            {
                                // Add this node
                                TreeNode grandChildNode = new TreeNode(grandChild.Unit_Title)
                                {
                                    SelectAction = TreeNodeSelectAction.None
                                };
                                if (grandChild.DAO_Link.Length > 0)
                                {
                                    if (grandChild.DAO_Title.Length > 0)
                                    {
                                        grandChildNode.Text = grandChild.Unit_Title + " &nbsp; <a href=\"" + grandChild.DAO_Link + "\">" + grandChild.DAO_Title + "</a>";
                                    }
                                    else
                                    {
                                        grandChildNode.Text = "<a href=\"" + grandChild.DAO_Link + "\">" + grandChild.Unit_Title + "</a>";
                                    }
                                }
                                childNode.ChildNodes.Add(grandChildNode);
                            }
                        }
                    }

                    // Configure the tree view collapsed nodes
                    treeView1.CollapseAll();

                    // Add this tree view to the place holder
                    MainPlaceHolder.Controls.Add(treeView1);
                }

                // Put some spaces for now
                builder.AppendLine("<br /><br />");
            }
            builder.AppendLine("            </div>");
            builder.AppendLine("          </td>");

            // Add the HTML for the image
            Literal mainLiteral = new Literal {
                Text = builder.ToString()
            };

            MainPlaceHolder.Controls.Add(mainLiteral);
        }