/// <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("Tracking_ItemViewer.Write_Main_Viewer_Section", ""); } // If this is an internal user or can edit this item, ensure the extra information // has been pulled for this item if ((userCanEditItem) || (CurrentMode.Internal_User) || (CurrentMode.ViewerCode == "tracking") || (CurrentMode.ViewerCode == "media") || (CurrentMode.ViewerCode == "archive")) { if (!CurrentItem.Tracking.Tracking_Info_Pulled) { DataSet data = SobekCM_Database.Tracking_Get_History_Archives(CurrentItem.Web.ItemID, Tracer); CurrentItem.Tracking.Set_Tracking_Info(data); } } // Determine the citation type Tracking_Type citationType = Tracking_Type.Milestones; switch (CurrentMode.ViewerCode) { case "tracking": citationType = Tracking_Type.History; break; case "media": citationType = Tracking_Type.Media; break; case "archive": citationType = Tracking_Type.Archives; break; case "directory": citationType = Tracking_Type.Directory_List; break; } // Add the HTML for the image Output.WriteLine("<!-- TRACKING ITEM VIEWER OUTPUT -->"); // Start the citation table Output.WriteLine(" <td align=\"left\"><span class=\"sbkTrk_ViewerTitle\">Tracking Information</span></td>"); Output.WriteLine("</tr>"); Output.WriteLine("<tr>"); Output.WriteLine(" <td class=\"sbkTrk_MainArea\">"); // Set the text const string MILESTONES_VIEW = "MILESTONES"; const string TRACKING_VIEW = "HISTORY"; const string MEDIA_VIEW = "MEDIA"; const string ARCHIVE_VIEW = "ARCHIVES"; const string DIRECTORY_VIEW = "DIRECTORY"; // Add the tabs for the different citation information string viewer_code = CurrentMode.ViewerCode; Output.WriteLine(" <div id=\"sbkTrk_ViewSelectRow\">"); Output.WriteLine(" <ul class=\"sbk_FauxDownwardTabsList\">"); if (CurrentItem.METS_Header.RecordStatus_Enum != METS_Record_Status.BIB_LEVEL) { if (citationType == Tracking_Type.Milestones) { Output.WriteLine(" <li class=\"current\">" + MILESTONES_VIEW + "</li>"); } else { Output.WriteLine(" <li><a href=\"" + CurrentMode.Redirect_URL("milestones") + "\">" + MILESTONES_VIEW + "</a></li>"); } if ((citationType == Tracking_Type.History) || ((CurrentItem.Tracking.hasHistoryInformation))) { if (citationType == Tracking_Type.History) { Output.WriteLine(" <li class=\"current\">" + TRACKING_VIEW + "</li>"); } else { Output.WriteLine(" <li><a href=\"" + CurrentMode.Redirect_URL("tracking") + "\">" + TRACKING_VIEW + "</a></li>"); } } if ((citationType == Tracking_Type.Media) || ((CurrentItem.Tracking.hasMediaInformation))) { if (citationType == Tracking_Type.Media) { Output.WriteLine(" <li class=\"current\">" + MEDIA_VIEW + "</li>"); } else { Output.WriteLine(" <li><a href=\"" + CurrentMode.Redirect_URL("media") + "\">" + MEDIA_VIEW + "</a></li>"); } } if ((citationType == Tracking_Type.Archives) || ((CurrentItem.Tracking.hasArchiveInformation) && ((CurrentMode.Internal_User) || (userCanEditItem)))) { if (citationType == Tracking_Type.Archives) { Output.WriteLine(" <li class=\"current\">" + ARCHIVE_VIEW + "</li>"); } else { Output.WriteLine(" <li><a href=\"" + CurrentMode.Redirect_URL("archive") + "\">" + ARCHIVE_VIEW + "</a></li>"); } } if ((citationType == Tracking_Type.Directory_List) || (CurrentMode.Internal_User) || (userCanEditItem)) { if (citationType == Tracking_Type.Directory_List) { Output.WriteLine(" <li class=\"current\">" + DIRECTORY_VIEW + "</li>"); } else { Output.WriteLine(" <li><a href=\"" + CurrentMode.Redirect_URL("directory") + "\">" + DIRECTORY_VIEW + "</a></li>"); } } } Output.WriteLine(" </div>"); // Now, add the text switch (citationType) { case Tracking_Type.Milestones: Output.WriteLine(Milestones_String(Tracer) + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->"); break; case Tracking_Type.History: Output.WriteLine(History_String(Tracer) + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->"); break; case Tracking_Type.Media: Output.WriteLine(Media_String(Tracer) + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->"); break; case Tracking_Type.Archives: Output.WriteLine(Archives_String(Tracer) + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->"); break; case Tracking_Type.Directory_List: Output.WriteLine(Directory_String(Tracer) + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->"); break; } CurrentMode.ViewerCode = viewer_code; }
/// <summary> Adds the main view section to the page turner </summary> /// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) 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("Tracking_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } // If this is an internal user or can edit this item, ensure the extra information // has been pulled for this item if ((userCanEditItem) || (CurrentMode.Internal_User) || (CurrentMode.ViewerCode == "tracking") || (CurrentMode.ViewerCode == "media") || (CurrentMode.ViewerCode == "archive")) { if (!CurrentItem.Tracking.Tracking_Info_Pulled) { DataSet data = SobekCM_Database.Tracking_Get_History_Archives(CurrentItem.Web.ItemID, Tracer); CurrentItem.Tracking.Set_Tracking_Info(data); } } // Determine the citation type Tracking_Type citationType = Tracking_Type.Milestones; switch (CurrentMode.ViewerCode) { case "tracking": citationType = Tracking_Type.History; break; case "media": citationType = Tracking_Type.Media; break; case "archive": citationType = Tracking_Type.Archives; break; case "directory": citationType = Tracking_Type.Directory_List; break; } // Add the HTML for the image StringBuilder result = new StringBuilder(3000); result.AppendLine(" <!-- TRACKING ITEM VIEWER OUTPUT -->"); // Start the citation table result.AppendLine(" <td align=\"left\"><span class=\"SobekViewerTitle\"><b>Tracking Information</b></span></td>"); result.AppendLine(" </tr>"); result.AppendLine(" <tr>"); result.AppendLine(" <td class=\"SobekCitationDisplay\">"); // Set the text const string MILESTONES_VIEW = "MILESTONES"; const string TRACKING_VIEW = "HISTORY"; const string MEDIA_VIEW = "MEDIA"; const string ARCHIVE_VIEW = "ARCHIVES"; const string DIRECTORY_VIEW = "DIRECTORY"; // Add the tabs for the different citation information string viewer_code = CurrentMode.ViewerCode; result.AppendLine(" <div class=\"SobekCitation\">"); result.AppendLine(" <div class=\"CitationViewSelectRow\">"); if (CurrentItem.METS_Header.RecordStatus_Enum != METS_Record_Status.BIB_LEVEL) { if (citationType == Tracking_Type.Milestones) { result.AppendLine(" <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + MILESTONES_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />"); } else { result.AppendLine(" <a href=\"" + CurrentMode.Redirect_URL("milestones") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + MILESTONES_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>"); } if ((citationType == Tracking_Type.History) || ((CurrentItem.Tracking.hasHistoryInformation))) { if (citationType == Tracking_Type.History) { result.AppendLine(" <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + TRACKING_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />"); } else { result.AppendLine(" <a href=\"" + CurrentMode.Redirect_URL("tracking") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + TRACKING_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>"); } } if ((citationType == Tracking_Type.Media) || ((CurrentItem.Tracking.hasMediaInformation))) { if (citationType == Tracking_Type.Media) { result.AppendLine(" <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + MEDIA_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />"); } else { result.AppendLine(" <a href=\"" + CurrentMode.Redirect_URL("media") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + MEDIA_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>"); } } if ((citationType == Tracking_Type.Archives) || ((CurrentItem.Tracking.hasArchiveInformation) && ((CurrentMode.Internal_User) || (userCanEditItem)))) { if (citationType == Tracking_Type.Archives) { result.AppendLine(" <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + ARCHIVE_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />"); } else { result.AppendLine(" <a href=\"" + CurrentMode.Redirect_URL("archive") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + ARCHIVE_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>"); } } if ((citationType == Tracking_Type.Directory_List) || (CurrentMode.Internal_User) || (userCanEditItem)) { if (citationType == Tracking_Type.Directory_List) { result.AppendLine(" <img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD_s.gif\" border=\"0\" alt=\"\" /><span class=\"tab_s\">" + DIRECTORY_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD_s.gif\" border=\"0\" alt=\"\" />"); } else { result.AppendLine(" <a href=\"" + CurrentMode.Redirect_URL("directory") + "\"><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cLD.gif\" border=\"0\" alt=\"\" /><span class=\"tab\">" + DIRECTORY_VIEW + "</span><img src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/tabs/cRD.gif\" border=\"0\" alt=\"\" /></a>"); } } } result.AppendLine(" </div>"); // Now, add the text Literal mainLiteral = new Literal(); switch (citationType) { case Tracking_Type.Milestones: mainLiteral.Text = result + Environment.NewLine + Milestones_String(Tracer) + "</div>" + Environment.NewLine + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->" + Environment.NewLine; break; case Tracking_Type.History: mainLiteral.Text = result + Environment.NewLine + History_String(Tracer) + "</div>" + Environment.NewLine + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->" + Environment.NewLine; break; case Tracking_Type.Media: mainLiteral.Text = result + Environment.NewLine + Media_String(Tracer) + "</div>" + Environment.NewLine + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->" + Environment.NewLine; break; case Tracking_Type.Archives: mainLiteral.Text = result + Environment.NewLine + Archives_String(Tracer) + "</div>" + Environment.NewLine + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->" + Environment.NewLine; break; case Tracking_Type.Directory_List: mainLiteral.Text = result + Environment.NewLine + Directory_String(Tracer) + "</div>" + Environment.NewLine + " </td>" + Environment.NewLine + " <!-- END TRACKING VIEWER OUTPUT -->" + Environment.NewLine; break; } CurrentMode.ViewerCode = viewer_code; placeHolder.Controls.Add(mainLiteral); }