Ejemplo n.º 1
0
        /// <summary> This provides an opportunity for the viewer to perform any pre-display work
        /// which is necessary before entering any of the rendering portions </summary>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <remarks> A good amount of work is done here.  Since the TREE view is done through controls and the other views are written
        /// directly to the stream, work is done here to prevent having to duplicate the code.  </remarks>
        public override void Perform_PreDisplay_Work(Custom_Tracer Tracer)
        {
            // Determine the citation type
            viewType = View_Type.Tree;
            switch (CurrentMode.ViewerCode)
            {
            case "allvolumes2":
                viewType = View_Type.Thumbnail;
                break;

            case "allvolumes3":
                viewType = View_Type.List;
                break;
            }

            string       volumes_text = "All Volumes";
            string       issues_text  = "All Issues";
            string       map_text     = "Related Map Sets";
            const string AERIAL_TEXT  = "Related Flights";

            if (CurrentMode.Language == Web_Language_Enum.French)
            {
                volumes_text = "Tous les Volumes";
                issues_text  = "Tous les Éditions";
                map_text     = "Définit la Carte Connexes";
            }

            if (CurrentMode.Language == Web_Language_Enum.Spanish)
            {
                volumes_text = "Todos los Volumenes";
                issues_text  = "Todas las Ediciones";
                map_text     = "Relacionado Mapa Conjuntos";
            }

            issues_type = volumes_text;
            if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("NEWSPAPER") >= 0)
            {
                issues_type = issues_text;
            }
            else if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("MAP") >= 0)
            {
                issues_type = map_text;
            }
            else if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("AERIAL") >= 0)
            {
                issues_type = AERIAL_TEXT;
            }

            // If the view type is the thumbnails (where we only show PUBLIC and RESTRICTED items)
            // need a count of the number of public items
            thumbnail_count = 1;
            if (viewType == View_Type.Thumbnail)
            {
                thumbnail_count = Item_List.Item_Table.Select("(IP_Restriction_Mask >= 0 ) and ( Dark = 'false')").Length;
            }
        }
        /// <summary> Constructor for a new instance of the MultiVolumes_ItemViewer class, used to display
        ///  the volumes (VIDs) that are associated with a single BibID </summary>
        /// <param name="BriefItem"> Digital resource object </param>
        /// <param name="CurrentUser"> Current user, who may or may not be logged on </param>
        /// <param name="CurrentRequest"> Information about the current request </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public MultiVolumes_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("MultiVolumes_ItemViewer.Constructor");

            // Save the arguments for use later
            briefItem = BriefItem;
            currentUser = CurrentUser;
            currentRequest = CurrentRequest;

            // Determine the citation type
            viewType = View_Type.Tree;
            if (( currentRequest.Remaining_Url_Segments != null ) && ( currentRequest.Remaining_Url_Segments.Length > 0 ))
                switch (currentRequest.Remaining_Url_Segments[0])
            {
                case "2":
                    viewType = View_Type.Thumbnail;
                    break;

                case "3":
                    viewType = View_Type.List;
                    break;
            }

            string volumes_text = "All Volumes";
            string issues_text = "All Issues";
            string map_text = "Related Map Sets";
            const string AERIAL_TEXT = "Related Flights";

            if (currentRequest.Language == Web_Language_Enum.French)
            {
                volumes_text = "Tous les Volumes";
                issues_text = "Tous les Éditions";
                map_text = "Définit la Carte Connexes";
            }

            if (currentRequest.Language == Web_Language_Enum.Spanish)
            {
                volumes_text = "Todos los Volumenes";
                issues_text = "Todas las Ediciones";
                map_text = "Relacionado Mapa Conjuntos";
            }

            issues_type = volumes_text;
            if (BriefItem.Behaviors.GroupType.ToUpper().IndexOf("NEWSPAPER") >= 0)
            {
                issues_type = issues_text;
            }
            else if (BriefItem.Behaviors.GroupType.ToUpper().IndexOf("MAP") >= 0)
            {
                issues_type = map_text;
            }
            else if (BriefItem.Behaviors.GroupType.ToUpper().IndexOf("AERIAL") >= 0)
            {
                issues_type = AERIAL_TEXT;
            }

            // Get the list of other volumes
            Tracer.Add_Trace("MultiVolumes_ItemViewer.Constructor", "Get the list of items under " + BriefItem.BibID);
            try
            {
                allVolumes = SobekEngineClient.Items.Get_Multiple_Volumes(BriefItem.BibID, Tracer);
            }
            catch (Exception ee)
            {
                Tracer.Add_Trace("Tracking_ItemViewer.Constructor", "Unable to pull volumes under " + BriefItem.BibID);
                CurrentRequest.Mode = Display_Mode_Enum.Error;
                CurrentRequest.Error_Message = "Internal Error : Unable to pull volumes under " + BriefItem.BibID;
                return;
            }

            // If the view type is the thumbnails (where we only show PUBLIC and RESTRICTED items)
            // need a count of the number of public items
            thumbnail_count = 0;
            if (viewType == View_Type.Thumbnail)
            {
                thumbnail_count = allVolumes.Count(OtherVolume => (OtherVolume.IP_Restriction_Mask >= 0) && (!OtherVolume.Dark));
            }
        }
        /// <summary> This provides an opportunity for the viewer to perform any pre-display work
        /// which is necessary before entering any of the rendering portions </summary>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <remarks> A good amount of work is done here.  Since the TREE view is done through controls and the other views are written 
        /// directly to the stream, work is done here to prevent having to duplicate the code.  </remarks>
        public override void Perform_PreDisplay_Work(Custom_Tracer Tracer)
        {
            // Determine the citation type
            viewType = View_Type.Tree;
            switch (CurrentMode.ViewerCode)
            {
                case "allvolumes2":
                    viewType = View_Type.Thumbnail;
                    break;

                case "allvolumes3":
                    viewType = View_Type.List;
                    break;
            }

            string volumes_text = "All Volumes";
            string issues_text = "All Issues";
            string map_text = "Related Map Sets";
            const string AERIAL_TEXT = "Related Flights";

            if (CurrentMode.Language == Web_Language_Enum.French)
            {
                volumes_text = "Tous les Volumes";
                issues_text = "Tous les Éditions";
                map_text = "Définit la Carte Connexes";
            }

            if (CurrentMode.Language == Web_Language_Enum.Spanish)
            {
                volumes_text = "Todos los Volumenes";
                issues_text = "Todas las Ediciones";
                map_text = "Relacionado Mapa Conjuntos";
            }

            issues_type = volumes_text;
            if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("NEWSPAPER") >= 0)
            {
                issues_type = issues_text;
            }
            else if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("MAP") >= 0)
            {
                issues_type = map_text;
            }
            else if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("AERIAL") >= 0)
            {
                issues_type = AERIAL_TEXT;
            }

            // If the view type is the thumbnails (where we only show PUBLIC and RESTRICTED items)
            // need a count of the number of public items
            thumbnail_count = 1;
            if (viewType == View_Type.Thumbnail)
            {
                thumbnail_count = Item_List.Item_Table.Select("(IP_Restriction_Mask >= 0 ) and ( Dark = 'false')").Length;
            }
        }
        /// <summary> Adds the main view section to the page turner </summary>
        /// <param name="placeHolder"> 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 placeHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("MultiVolumes_ItemViewer.Add_Main_Viewer_Section", "Adds tree view control and pulls volumes from database");
            }

            // Determine the citation type
            View_Type viewType = View_Type.Tree;

            switch (CurrentMode.ViewerCode)
            {
            case "allvolumes2":
                viewType = View_Type.Thumbnail;
                break;

            case "allvolumes3":
                viewType = View_Type.List;
                break;
            }

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

            string       volumes_text = "All Volumes";
            string       issues_text  = "All Issues";
            string       map_text     = "Related Map Sets";
            const string AERIAL_TEXT  = "Related Flights";

            if (CurrentMode.Language == Web_Language_Enum.French)
            {
                volumes_text = "Tous les Volumes";
                issues_text  = "Tous les Éditions";
                map_text     = "Définit la Carte Connexes";
            }

            if (CurrentMode.Language == Web_Language_Enum.Spanish)
            {
                volumes_text = "Todos los Volumenes";
                issues_text  = "Todas las Ediciones";
                map_text     = "Relacionado Mapa Conjuntos";
            }

            string issues_type = volumes_text;

            if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("NEWSPAPER") >= 0)
            {
                issues_type = issues_text;
            }
            else if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("MAP") >= 0)
            {
                issues_type = map_text;
            }
            else if (CurrentItem.Behaviors.GroupType.ToUpper().IndexOf("AERIAL") >= 0)
            {
                issues_type = AERIAL_TEXT;
            }

            const string TREE_VIEW      = "VOLUME TREE";
            const string THUMBNAIL_VIEW = "VOLUME THUMBNAILS";
            const string LIST_VIEW      = "VOLUME LIST";

            builder.AppendLine("          <td align=\"left\"><span class=\"SobekViewerTitle\">" + issues_type + "</span></td>");
            builder.AppendLine("        </tr>");
            builder.AppendLine("        <tr>");
            builder.AppendLine("          <td>");
            builder.AppendLine("            <div class=\"SobekCitation\">");
            builder.AppendLine("              <div class=\"CitationViewSelectRow\">");
            if (viewType == View_Type.Tree)
            {
                builder.AppendLine("                <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + TREE_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />");
            }
            else
            {
                builder.AppendLine("                <a href=\"" + CurrentMode.Redirect_URL("allvolumes1") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + TREE_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>");
            }

            if (viewType == View_Type.Thumbnail)
            {
                builder.AppendLine("                <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + THUMBNAIL_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />");
            }
            else
            {
                builder.AppendLine("                <a href=\"" + CurrentMode.Redirect_URL("allvolumes2") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + THUMBNAIL_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>");
            }

            if ((viewType == View_Type.List) || (CurrentMode.Internal_User))
            {
                if (viewType == View_Type.List)
                {
                    builder.AppendLine("                <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + LIST_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />");
                }
                else
                {
                    builder.AppendLine("                <a href=\"" + CurrentMode.Redirect_URL("allvolumes3") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + LIST_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>");
                }
            }
            builder.AppendLine("              </div>");

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

            placeHolder.Controls.Add(mainLiteral);

            switch (viewType)
            {
            case View_Type.Tree:
                // Add the tree view
                TreeView treeView1 = new TreeView {
                    EnableViewState = false, CssClass = "SobekGroupViewTree"
                };
                Build_Tree(treeView1, Item_List.Item_Table);
                placeHolder.Controls.Add(treeView1);
                break;

            case View_Type.Thumbnail:
                placeHolder.Controls.Add(Add_Thumbnails(Item_List.Item_Table));
                CurrentMode.ViewerCode = "allvolumes2";
                break;

            case View_Type.List:
                placeHolder.Controls.Add(Add_List(Item_List.Item_Table));
                CurrentMode.ViewerCode = "allvolumes3";
                break;
            }

            // Add the final HTML
            Literal secondLiteral = new Literal();

            if (CurrentItem.Web.Related_Titles_Count > 0)
            {
                StringBuilder relatedBuilder = new StringBuilder(1000);
                relatedBuilder.AppendLine("<table width=\"650px\" cellpadding=\"5px\" class=\"SobekCitationSection1\">");
                relatedBuilder.AppendLine("  <tr>");
                relatedBuilder.AppendLine("    <td colspan=\"3\" class=\"SobekCitationSectionTitle1\"><b>&nbsp;Related Titles</b></td>");
                relatedBuilder.AppendLine("  </tr>");
                string url_opts = CurrentMode.URL_Options();
                foreach (Related_Titles thisTitle in CurrentItem.Web.All_Related_Titles)
                {
                    relatedBuilder.AppendLine("  <tr>");
                    relatedBuilder.AppendLine("    <td width=\"15px\">&nbsp;</td>");
                    relatedBuilder.AppendLine("    <td width=\"150px\" valign=\"top\"><b>" + thisTitle.Relationship + ": </b></td>");
                    relatedBuilder.AppendLine("    <td>" + thisTitle.Title_And_Link.Replace("<%URL_OPTS%>", url_opts) + "</td>");
                    relatedBuilder.AppendLine("  <tr>");
                }
                relatedBuilder.AppendLine("</table>");
                secondLiteral.Text = "" + Environment.NewLine + relatedBuilder + "</div><!-- FINISHING -->" + Environment.NewLine + "</td>" + Environment.NewLine;
            }
            else
            {
                secondLiteral.Text = "" + Environment.NewLine + "            </div><!-- FINISHING -->" + Environment.NewLine + "</td>" + Environment.NewLine;
            }
            placeHolder.Controls.Add(secondLiteral);
        }