/// <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", ""); } // Get the metadata module for EADs EAD_Info eadInfo = (EAD_Info)CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY); // Build the value Output.WriteLine(" <td>"); Output.WriteLine(" <div id=\"sbkEad_MainArea\">"); if (CurrentMode.Text_Search.Length > 0) { // 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> 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("Feature_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } // Build the value StringBuilder builder = new StringBuilder(5000); // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; // Start the citation table builder.AppendLine("\t\t<!-- FEATURE VIEWER OUTPUT -->" ); builder.AppendLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Features</b></span></td></tr>" ); builder.AppendLine("\t\t<tr><td class=\"SobekDocumentDisplay\">"); builder.AppendLine("\t\t\t<div class=\"SobekCitation\">"); // Get the list of streets from the database Map_Features_DataSet features = SobekCM_Database.Get_All_Features_By_Item( CurrentItem.Web.ItemID, Tracer ); Create_Feature_Index( builder, features ); // Finish the citation table builder.AppendLine( "\t\t\t</div>" ); builder.AppendLine("\t\t</td>" ); builder.AppendLine("\t\t<!-- END FEATURE VIEWER OUTPUT -->" ); // Restore the mode CurrentMode.ViewerCode = current_view_code; // Add the HTML for the image Literal mainLiteral = new Literal {Text = builder.ToString()}; placeHolder.Controls.Add( mainLiteral ); }
/// <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("YouTube_Embedded_Video_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } //Determine the name of the FLASH file string youtube_url = CurrentItem.Bib_Info.Location.Other_URL; if ( youtube_url.IndexOf("watch") > 0 ) youtube_url = youtube_url.Replace("watch?v=","v/") + "?fs=1&hl=en_US"; const int width = 600; const int height = 480; // Add the HTML for the image StringBuilder result = new StringBuilder(500); result.AppendLine(" <!-- YOU TUBE VIEWER OUTPUT -->"); result.AppendLine(" <td align=\"left\"><span class=\"SobekViewerTitle\"><b>Streaming Video</b></span></td>"); result.AppendLine(" </tr>"); result.AppendLine(" <tr>"); result.AppendLine(" <td class=\"SobekCitationDisplay\">"); result.AppendLine(" <object width=\"" + width + "\" height=\"" + height + "\">"); result.AppendLine(" <param name=\"allowscriptaccess\" value=\"always\" />"); result.AppendLine(" <param name=\"movie\" value=\"" + youtube_url + "\" />"); result.AppendLine(" <param name=\"allowFullScreen\" value=\"true\"></param>"); result.AppendLine(" <embed src=\"" + youtube_url + "\" type=\"application/x-shockwave-flash\" AllowScriptAccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\"></embed>"); result.AppendLine(" </object>"); result.AppendLine(" </td>" ); result.AppendLine(" <!-- END YOU TUBE VIEWER OUTPUT -->" ); Literal mainLiteral = new Literal {Text = result.ToString()}; placeHolder.Controls.Add(mainLiteral); }
/// <summary> Constructor for a new instance of the Static_Pages_Builder class </summary> /// <param name="Primary_Web_Server_URL"> URL for the primary web server </param> /// <param name="Static_Data_Location"> Network location for the data directory </param> /// <param name="Default_Skin"> Default skin code </param> public Static_Pages_Builder(string Primary_Web_Server_URL, string Static_Data_Location, string Default_Skin) { primaryWebServerUrl = Primary_Web_Server_URL; staticSobekcmDataLocation = Static_Data_Location; staticSobekcmLocation = UI_ApplicationCache_Gateway.Settings.Servers.Application_Server_Network; tracer = new Custom_Tracer(); assistant = new SobekCM_Assistant(); // Save all the objects needed by the SobekCM Library defaultSkin = Default_Skin; // Create the mode object currentMode = new Navigation_Object { ViewerCode = "citation", Skin = String.Empty, Mode = Display_Mode_Enum.Item_Display, Language = Web_Language_Enum.English, Base_URL = primaryWebServerUrl }; // Set some constant settings // SobekCM.Library.UI_ApplicationCache_Gateway.Settings.Watermarks_URL = primary_web_server_url + "/design/wordmarks/"; UI_ApplicationCache_Gateway.Settings.Base_SobekCM_Location_Relative = primaryWebServerUrl; // Ensure all the folders exist if (!Directory.Exists(staticSobekcmDataLocation)) Directory.CreateDirectory(staticSobekcmDataLocation); if (!Directory.Exists(staticSobekcmDataLocation + "\\rss")) Directory.CreateDirectory(staticSobekcmDataLocation + "\\rss"); }
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer) { if ((CurrentItem.Behaviors.Can_Be_Described) && (CurrentUser != null)) { // Determine the number of columns for text areas, depending on browser int actual_cols = 50; if (CurrentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0) actual_cols = 45; StringBuilder responseBuilder = new StringBuilder(); responseBuilder.AppendLine("<!-- Add descriptive tage form -->"); responseBuilder.AppendLine("<div class=\"describe_popup_div\" id=\"describe_item_form\" style=\"display:none;\">"); responseBuilder.AppendLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">A<span class=\"smaller\">DD </span> I<span class=\"smaller\">TEM </span> D<span class=\"smaller\">ESCRIPTION</span></td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"describe_item_form_close()\">X</a> </td></tr></table></div>"); responseBuilder.AppendLine(" <br />"); responseBuilder.AppendLine(" <fieldset><legend>Enter a description or notes to add to this item </legend>"); responseBuilder.AppendLine(" <br />"); responseBuilder.AppendLine(" <table class=\"popup_table\">"); // Add comments area responseBuilder.Append(" <tr align=\"left\" valign=\"top\"><td><br /><label for=\"add_notes\">Notes:</label></td>"); responseBuilder.AppendLine("<td><textarea rows=\"10\" cols=\"" + actual_cols + "\" name=\"add_tag\" id=\"add_tag\" class=\"add_notes_textarea\" onfocus=\"javascript:textbox_enter('add_tag','add_notes_textarea_focused')\" onblur=\"javascript:textbox_leave('add_tag','add_notes_textarea')\"></textarea></td></tr>"); responseBuilder.AppendLine(" </table>"); responseBuilder.AppendLine(" <br />"); responseBuilder.AppendLine(" </fieldset><br />"); responseBuilder.AppendLine(" <center><a href=\"\" onclick=\"return describe_item_form_close();\"><img border=\"0\" src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/buttons/cancel_button_g.gif\" alt=\"CLOSE\" /></a> <input type=\"image\" src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/buttons/save_button_g.gif\" value=\"Submit\" alt=\"Submit\" ></center><br />"); responseBuilder.AppendLine("</div>"); responseBuilder.AppendLine(); placeHolder.Controls.Add(new Literal() { Text = responseBuilder.ToString() }); } }
/// <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("EmbeddedVideo_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } //Determine the name of the FLASH file string youtube_url = CurrentItem.Bib_Info.Location.Other_URL; if (youtube_url.IndexOf("watch") > 0) youtube_url = youtube_url.Replace("watch?v=", "v/") + "?fs=1&hl=en_US"; const int width = 600; const int height = 480; // Add the HTML for the image StringBuilder result = new StringBuilder(500); result.AppendLine(" <!-- EMBEDDED VIDEO VIEWER OUTPUT -->"); result.AppendLine(" <td align=\"left\"><span class=\"SobekViewerTitle\"><b>Streaming Video</b></span></td>"); result.AppendLine(" </tr>"); result.AppendLine(" <tr>"); result.AppendLine(" <td class=\"SobekCitationDisplay\">"); result.AppendLine(CurrentItem.Behaviors.Embedded_Video); result.AppendLine(" </td>"); result.AppendLine(" <!-- END EMBEDDED VIDEO VIEWER OUTPUT -->"); Literal mainLiteral = new Literal { Text = result.ToString() }; placeHolder.Controls.Add(mainLiteral); }
/// <summary> Add the HTML to be displayed in the search box </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This adds the title of the into the box </remarks> public override void Add_Search_Box_HTML(TextWriter Output, Custom_Tracer Tracer) { // Normalize the submode string submode = currentMode.Info_Browse_Mode.ToLower(); if ((submode != "views") && (submode != "itemviews") && (submode != "titles") && (submode != "items") && (submode != "definitions")) { submode = "views"; } // Show the next data, depending on type switch (submode) { case "views": Output.WriteLine("<h1>History of Collection-Level Usage</h1>"); break; case "itemviews": Output.WriteLine("<h1>History of Item Usage</h1>"); break; case "titles": Output.WriteLine("<h1>Most Accessed Titles</h1>"); break; case "items": Output.WriteLine("<h1>Most Accessed Items</h1>"); break; case "definitions": Output.WriteLine("<h1>Definitions of Terms Used</h1>"); break; } }
public override void Add_Main_Viewer_Section(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer) { StringBuilder responseBuilder = new StringBuilder(); // Calculate the title and url string title = HttpUtility.HtmlEncode(CurrentItem.Bib_Info.Main_Title.Title); string share_url = CurrentMode.Base_URL + "/" + CurrentItem.BibID + "/" + CurrentItem.VID; if (HttpContext.Current != null) share_url = HttpContext.Current.Items["Original_URL"].ToString().Replace("&", "%26").Replace("?", "%3F").Replace("http://", "").Replace("=", "%3D").Replace("\"", """); responseBuilder.AppendLine("<!-- Share form -->"); responseBuilder.AppendLine("<div id=\"shareform_content\">"); responseBuilder.AppendLine("<a href=\"http://www.facebook.com/share.php?u=" + share_url + "&t=" + title + "\" target=\"FACEBOOK_WINDOW\" onmouseover=\"facebook_share.src='" + CurrentMode.Base_URL + "default/images/facebook_share_h.gif'\" onmouseout=\"facebook_share.src='" + CurrentMode.Base_URL + "default/images/facebook_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"facebook_share\" name=\"facebook_share\" src=\"" + CurrentMode.Base_URL + "default/images/facebook_share.gif\" alt=\"FACEBOOK\" /></a>"); responseBuilder.AppendLine("<a href=\"http://buzz.yahoo.com/buzz?targetUrl=" + share_url + "&headline=" + title + "\" target=\"YAHOOBUZZ_WINDOW\" onmouseover=\"yahoobuzz_share.src='" + CurrentMode.Base_URL + "default/images/yahoobuzz_share_h.gif'\" onmouseout=\"yahoobuzz_share.src='" + CurrentMode.Base_URL + "default/images/yahoobuzz_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"yahoobuzz_share\" name=\"yahoobuzz_share\" src=\"" + CurrentMode.Base_URL + "default/images/yahoobuzz_share.gif\" alt=\"YAHOO BUZZ\" /></a>"); responseBuilder.AppendLine("<br />"); responseBuilder.AppendLine("<a href=\"http://twitter.com/home?status=Currently reading " + share_url + "\" target=\"TWITTER_WINDOW\" onmouseover=\"twitter_share.src='" + CurrentMode.Base_URL + "default/images/twitter_share_h.gif'\" onmouseout=\"twitter_share.src='" + CurrentMode.Base_URL + "default/images/twitter_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"twitter_share\" name=\"twitter_share\" src=\"" + CurrentMode.Base_URL + "default/images/twitter_share.gif\" alt=\"TWITTER\" /></a>"); responseBuilder.AppendLine("<a href=\"http://www.google.com/bookmarks/mark?op=add&bkmk=" + share_url + "&title=" + title + "\" target=\"GOOGLE_WINDOW\" onmouseover=\"google_share.src='" + CurrentMode.Base_URL + "default/images/google_share_h.gif'\" onmouseout=\"google_share.src='" + CurrentMode.Base_URL + "default/images/google_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"google_share\" name=\"google_share\" src=\"" + CurrentMode.Base_URL + "default/images/google_share.gif\" alt=\"GOOGLE SHARE\" /></a>"); responseBuilder.AppendLine("<br />"); responseBuilder.AppendLine("<a href=\"http://www.stumbleupon.com/submit?url=" + share_url + "&title=" + title + "\" target=\"STUMBLEUPON_WINDOW\" onmouseover=\"stumbleupon_share.src='" + CurrentMode.Base_URL + "default/images/stumbleupon_share_h.gif'\" onmouseout=\"stumbleupon_share.src='" + CurrentMode.Base_URL + "default/images/stumbleupon_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"stumbleupon_share\" name=\"stumbleupon_share\" src=\"" + CurrentMode.Base_URL + "default/images/stumbleupon_share.gif\" alt=\"STUMBLEUPON\" /></a>"); responseBuilder.AppendLine("<a href=\"http://myweb.yahoo.com/myresults/bookmarklet?t=" + title + "&u=" + share_url + "\" target=\"YAHOO_WINDOW\" onmouseover=\"yahoo_share.src='" + CurrentMode.Base_URL + "default/images/yahoo_share_h.gif'\" onmouseout=\"yahoo_share.src='" + CurrentMode.Base_URL + "default/images/yahoo_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"yahoo_share\" name=\"yahoo_share\" src=\"" + CurrentMode.Base_URL + "default/images/yahoo_share.gif\" alt=\"YAHOO SHARE\" /></a>"); responseBuilder.AppendLine("<br />"); responseBuilder.AppendLine("<a href=\"http://digg.com/submit?phase=2&url=" + share_url + "&title=" + title + "\" target=\"DIGG_WINDOW\" onmouseover=\"digg_share.src='" + CurrentMode.Base_URL + "default/images/digg_share_h.gif'\" onmouseout=\"digg_share.src='" + CurrentMode.Base_URL + "default/images/digg_share.gif'\" onclick=\"\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"digg_share\" name=\"digg_share\" src=\"" + CurrentMode.Base_URL + "default/images/digg_share.gif\" alt=\"DIGG\" /></a>"); responseBuilder.AppendLine("<a onmouseover=\"favorites_share.src='" + CurrentMode.Base_URL + "default/images/favorites_share_h.gif'\" onmouseout=\"favorites_share.src='" + CurrentMode.Base_URL + "default/images/favorites_share.gif'\" onclick=\"javascript:add_to_favorites();\"><img class=\"ResultSavePrintButtons\" border=\"0px\" id=\"favorites_share\" name=\"favorites_share\" src=\"" + CurrentMode.Base_URL + "default/images/favorites_share.gif\" alt=\"MY FAVORITES\" /></a>"); responseBuilder.AppendLine("<br />"); responseBuilder.AppendLine("</div>"); responseBuilder.AppendLine(); MainPlaceHolder.Controls.Add(new Literal() { Text = responseBuilder.ToString() }); }
/// <summary> Perform all the work of adding text directly to the response stream back to the web user </summary> /// <param name="Output"> Stream to which to write the text for this main writer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Add_Text_To_Page(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Html_Echo_MainWriter.Add_Text_To_Page", "Reading the text from the file and echoing back to the output stream"); try { FileStream fileStream = new FileStream(fileToEcho, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(fileStream); string line = reader.ReadLine(); while ( line != null ) { Output.WriteLine(line); line = reader.ReadLine(); } reader.Close(); } catch { Output.WriteLine("ERROR READING THE SOURCE FILE"); } Tracer.Add_Trace("Html_Echo_MainWriter.Add_Text_To_Page", "Finished reading and writing the file"); Output.WriteLine("<br /><br /><b>TRACE ROUTE</b>"); Output.WriteLine("<br /><br />Total Execution Time: " + Tracer.Milliseconds + " Milliseconds<br /><br />"); Output.WriteLine(Tracer.Complete_Trace + "<br />"); }
/// <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("Feature_ItemViewer.Write_Main_Viewer_Section", ""); } // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; // Start the citation table Output.WriteLine("\t\t<!-- FEATURE VIEWER OUTPUT -->" ); Output.WriteLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Features</b></span></td></tr>" ); Output.WriteLine("\t\t<tr><td class=\"SobekDocumentDisplay\">"); Output.WriteLine("\t\t\t<div class=\"SobekCitation\">"); // Get the list of streets from the database Map_Features_DataSet features = SobekCM_Database.Get_All_Features_By_Item( CurrentItem.Web.ItemID, Tracer ); Create_Feature_Index( Output, features ); // Finish the citation table Output.WriteLine( "\t\t\t</div>" ); Output.WriteLine("\t\t</td>" ); Output.WriteLine("\t\t<!-- END FEATURE VIEWER OUTPUT -->" ); // Restore the mode CurrentMode.ViewerCode = current_view_code; }
/// <summary> Gets a page from an existing digital resource, by page sequence </summary> /// <param name="Current_Item"> Digital resource from which to pull the current page, by sequence </param> /// <param name="Sequence"> Sequence for the page to retrieve from this item </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns> Page tree node object for the requested page </returns> public static Page_TreeNode Get_Current_Page(SobekCM_Item Current_Item, int Sequence, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_Item_Factory.Get_Current_Page", "Requesting the page (by sequence) from the item"); } Page_TreeNode returnValue = null; try { // Set the current page if (Sequence >= 1) { int requested_page = Sequence - 1; if ((requested_page < 0) || (requested_page > Current_Item.Web.Static_PageCount - 1)) requested_page = 0; if (requested_page <= Current_Item.Web.Static_PageCount - 1) { returnValue = Current_Item.Web.Pages_By_Sequence[requested_page]; } } } catch (Exception ee) { throw new ApplicationException("Error assigning the current page sequence", ee); } return returnValue; }
/// <summary> Read the source browse and info static html files and create the /// appropriate <see cref="HTML_Based_Content"/> object with all the bibliographic information /// (author, keywords, description, title, code) loaded from the header in the HTML file</summary> /// <param name="Source_URL"> URL to the source HTML document, retrievable via the web</param> /// <param name="Retain_Entire_Display_Text"> Flag indicates whether the entire display text should be retained (as it is about to be displayed) or just the basic information from the HEAD of the file </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> Fully built browse info object with all the bibliographic information</returns> public static HTML_Based_Content Read_Web_Document(string Source_URL, bool Retain_Entire_Display_Text, Custom_Tracer Tracer) { try { if (Tracer != null) { Tracer.Add_Trace("HTML_Based_Content_Reader.Read_Web_Document", "Reading source file via web response"); } // the html retrieved from the page string displayText; WebRequest objRequest = WebRequest.Create(Source_URL); WebResponse objResponse = objRequest.GetResponse(); // the using keyword will automatically dispose the object once complete using (StreamReader sr = new StreamReader(objResponse.GetResponseStream())) { displayText = sr.ReadToEnd(); // Close and clean up the StreamReader sr.Close(); } // Convert this to the object return Text_To_HTML_Based_Content(displayText, Retain_Entire_Display_Text, String.Empty); } catch { return null; } }
/// <summary> Constructor for a new instance of the Saved_Searches_MySobekViewer class </summary> /// <param name="User"> Authenticated user information </param> /// <param name="Translator"> Translation / language support object for writing the user interface is multiple languages</param> /// <param name="currentMode"> Mode / navigation information for the current request</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public Saved_Searches_MySobekViewer(User_Object User, Language_Support_Info Translator, SobekCM_Navigation_Object currentMode, Custom_Tracer Tracer) : base(User) { Tracer.Add_Trace("Saved_Searches_MySobekViewer.Constructor", String.Empty); user = User; base.Translator = Translator; if (currentMode.isPostBack) { // Pull the standard values NameValueCollection form = HttpContext.Current.Request.Form; string item_action = form["item_action"].ToUpper().Trim(); string folder_id = form["folder_id"].Trim(); if (item_action == "REMOVE") { int folder_id_int; if (Int32.TryParse(folder_id, out folder_id_int)) SobekCM_Database.Delete_User_Search(folder_id_int, Tracer); } HttpContext.Current.Response.Redirect(HttpContext.Current.Items["Original_URL"].ToString()); } }
/// <summary> Builds a brief version of a digital resource, used when displaying the 'FULL VIEW' in /// a search result or browse list </summary> /// <param name="METS_Location"> Location (URL) of the METS file to read via HTTP </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns> Briefly built version of a digital resource </returns> public SobekCM_Item Build_Brief_Item(string METS_Location, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", "Create the requested item"); } try { // Get the response object for this METS file string mets_file = METS_Location.Replace("\\", "/") + "/citation_mets.xml"; SobekCM_Item thisPackage = Build_Item_From_METS(mets_file, "citation_mets.xml", Tracer); if (thisPackage == null) { if (Tracer != null) Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", "Unable to find/read either METS file", Custom_Trace_Type_Enum.Error); } if (Tracer != null) { Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", "Finished building this item"); } return thisPackage; } catch (Exception ee) { if (Tracer != null) Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Brief_Item", ee.ToString().Replace("\n", "<br />"), Custom_Trace_Type_Enum.Error); return null; } }
/// <summary> Writes the HTML generated by this error html subwriter directly to the response stream </summary> /// <param name="Output"> Stream to which to write the HTML for this subwriter </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns> public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Error_HtmlSubwriter.Write_HTML", "Rendering HTML"); // Start the page container Output.WriteLine("<div id=\"pagecontainer\">"); Output.WriteLine("<br />"); Output.WriteLine("<center>"); Output.WriteLine(" <br /><br />"); Output.WriteLine("<span style=\"font-size:large; color:red\">"); Output.WriteLine(" <b>Deprecated URL detected</b>"); Output.WriteLine("</span>"); Output.WriteLine("<span style=\"font-size:1.2em\">"); Output.WriteLine(" <br /><br />"); Output.WriteLine("The URL you entered is a legacy URL. Support for this URL will end shortly.<br /><br />Please update your records to the new URL below:<br /><br />"); Output.WriteLine("<a href=\"" + currentMode.Error_Message + "\">" + currentMode.Error_Message + "</a>"); Output.WriteLine(" <br /><br /><br /><br />"); Output.WriteLine("</span>"); Output.WriteLine("</center>"); Output.WriteLine(); Output.WriteLine("<!-- Close the pagecontainer div -->"); Output.WriteLine("</div>"); Output.WriteLine(); return true; }
/// <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> This methods pulls the text to display and determines the width </remarks> public override void Perform_PreDisplay_Work(Custom_Tracer Tracer) { // Set some defaults text_from_file = String.Empty; file_does_not_exist = false; error_occurred = false; width = -1; if (FileName.Length > 0) { string filesource = CurrentItem.Web.Source_URL + "/" + FileName; text_from_file = Get_Html_Page(filesource, Tracer); // Did this work? if (text_from_file.Length > 0) { string[] splitter = text_from_file.Split("\n".ToCharArray()); foreach (string thisString in splitter) { width = Math.Max(width, thisString.Length*9); } // width = Math.Min(width, 800); } } else { file_does_not_exist = true; } }
/// <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("Download_Only_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html"); } // Build the value StringBuilder builder = new StringBuilder(1500); // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; // Start the citation table builder.AppendLine("\t\t<!-- DOWNLOAD ONLY VIEWER OUTPUT -->" ); builder.AppendLine("\t\t<td class=\"SobekDocumentDisplay\">" ); builder.AppendLine("\t\t\t<div class=\"SobekCitation\">" ); builder.AppendLine("\t\t\t</div>" ); // Finish the table builder.AppendLine( "\t\t</td>" ); builder.AppendLine("\t\t<!-- END DOWNLOAD ONLY VIEWER OUTPUT -->" ); // Restore the mode CurrentMode.ViewerCode = current_view_code; // Add the HTML for the image Literal mainLiteral = new Literal {Text = builder.ToString()}; placeHolder.Controls.Add( mainLiteral ); }
/// <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("YouTube_Embedded_Video_ItemViewer.Write_Main_Viewer_Section", ""); } //Determine the name of the FLASH file string youtube_url = CurrentItem.Bib_Info.Location.Other_URL; if ( youtube_url.IndexOf("watch") > 0 ) youtube_url = youtube_url.Replace("watch?v=","v/") + "?fs=1&hl=en_US"; const int width = 600; const int height = 480; // Add the HTML for the image StringBuilder result = new StringBuilder(500); Output.WriteLine(" <td><div id=\"sbkEmv_ViewerTitle\">Streaming Video</div></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td id=\"sbkEmv_MainArea\">"); Output.WriteLine(" <object style=\"width:" + width + ";height:" + height + "\">"); Output.WriteLine(" <param name=\"allowscriptaccess\" value=\"always\" />"); Output.WriteLine(" <param name=\"movie\" value=\"" + youtube_url + "\" />"); Output.WriteLine(" <param name=\"allowFullScreen\" value=\"true\"></param>"); Output.WriteLine(" <embed src=\"" + youtube_url + "\" type=\"application/x-shockwave-flash\" AllowScriptAccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\"></embed>"); Output.WriteLine(" </object>"); Output.WriteLine(" </td>" ); }
/// <summary> Writes the style references and other data to the HEAD portion of the web page </summary> /// <param name="Output"> Stream to which to write the text for this main writer </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public void Write_Within_HTML_Head(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Html_Echo_MainWriter.Write_Within_HTML_Head", "Adding style references to HTML"); Output.WriteLine(" <meta name=\"robots\" content=\"index, follow\">"); // Write the style sheet to use #if DEBUG Output.WriteLine(" <link href=\"" + currentMode.Base_URL + "default/SobekCM.css\" rel=\"stylesheet\" type=\"text/css\" />"); #else Output.WriteLine(" <link href=\"" + currentMode.Base_URL + "default/SobekCM.min.css\" rel=\"stylesheet\" type=\"text/css\" />"); #endif // Write the main SobekCM item style sheet to use #if DEBUG Output.WriteLine(" <link href=\"" + currentMode.Base_URL + "default/SobekCM_Item.css\" rel=\"stylesheet\" type=\"text/css\" />"); #else Output.WriteLine(" <link href=\"" + currentMode.Base_URL + "default/SobekCM_Item.min.css\" rel=\"stylesheet\" type=\"text/css\" title=\"standard\" />"); #endif // Always add jQuery library (changed as of 7/8/2013) if ((currentMode.Mode != Display_Mode_Enum.Item_Display) || (currentMode.ViewerCode != "pageturner")) { #if DEBUG Output.WriteLine(" <script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-1.10.2.js\"></script>"); Output.WriteLine(" <script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_full.js\"></script>"); #else Output.WriteLine(" <script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-1.10.2.min.js\"></script>"); Output.WriteLine(" <script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_full.min.js\"></script>"); #endif } // Include the interface's style sheet if it has one Output.WriteLine(" <link href=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/" + currentMode.Base_Skin + ".css\" rel=\"stylesheet\" type=\"text/css\" />"); }
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer) { // Set caching on this HttpContext.Current.Response.Cache.SetCacheability( HttpCacheability.NoCache ); if ((CurrentItem.Web.ItemID > 0) && (CurrentUser != null) && (!CurrentUser.Is_In_Bookshelf(CurrentItem.BibID, CurrentItem.VID))) { StringBuilder responseBuilder = new StringBuilder(); // Determine the number of columns for text areas, depending on browser int actual_cols = 50; if (CurrentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0) actual_cols = 45; responseBuilder.AppendLine("<!-- Add to bookshelf form -->"); responseBuilder.AppendLine("<div id=\"addform_content\">"); responseBuilder.AppendLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">A<span class=\"smaller\">DD THIS</span> I<span class=\"smaller\">TEM TO YOUR</span> B<span class=\"smaller\">OOKSHELF</span></td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"add_item_form_close()\">X</a> </td></tr></table></div>"); responseBuilder.AppendLine(" <br />"); responseBuilder.AppendLine(" <fieldset><legend>Enter notes for this item in your bookshelf </legend>"); responseBuilder.AppendLine(" <br />"); responseBuilder.AppendLine(" <table class=\"popup_table\">"); // Add bookshelf choices responseBuilder.Append(" <tr align=\"left\"><td width=\"80px\"><label for=\"add_bookshelf\">Bookshelf:</label></td>"); responseBuilder.Append("<td><select class=\"email_bookshelf_input\" name=\"add_bookshelf\" id=\"add_bookshelf\">"); foreach (User_Folder folder in CurrentUser.All_Folders) { if (folder.Folder_Name.Length > 80) { responseBuilder.Append("<option value=\"" + HttpUtility.HtmlEncode(folder.Folder_Name) + "\">" + HttpUtility.HtmlEncode(folder.Folder_Name.Substring(0, 75)) + "...</option>"); } else { if (folder.Folder_Name != "Submitted Items") { if (folder.Folder_Name == "My Bookshelf") responseBuilder.Append("<option value=\"" + HttpUtility.HtmlEncode(folder.Folder_Name) + "\" selected=\"selected\" >" + HttpUtility.HtmlEncode(folder.Folder_Name) + "</option>"); else responseBuilder.Append("<option value=\"" + HttpUtility.HtmlEncode(folder.Folder_Name) + "\">" + HttpUtility.HtmlEncode(folder.Folder_Name) + "</option>"); } } } responseBuilder.AppendLine("</select></td></tr>"); // Add comments area responseBuilder.Append(" <tr align=\"left\" valign=\"top\"><td><br /><label for=\"add_notes\">Notes:</label></td>"); responseBuilder.AppendLine("<td><textarea rows=\"6\" cols=\"" + actual_cols + "\" name=\"add_notes\" id=\"add_notes\" class=\"add_notes_textarea\" onfocus=\"javascript:textbox_enter('add_notes','add_notes_textarea_focused')\" onblur=\"javascript:textbox_leave('add_notes','add_notes_textarea')\"></textarea></td></tr>"); responseBuilder.AppendLine(" <tr align=\"left\" valign=\"top\"><td> </td><td><input type=\"checkbox\" id=\"open_bookshelf\" name=\"open_bookshelf\" value=\"open\" /> <label for=\"open_bookshelf\">Open bookshelf in new window</label></td></tr>"); responseBuilder.AppendLine(" </table>"); responseBuilder.AppendLine(" <br />"); responseBuilder.AppendLine(" </fieldset><br />"); responseBuilder.AppendLine(" <center><a href=\"\" onclick=\"return add_item_form_close();\"><img border=\"0\" src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/buttons/cancel_button_g.gif\" alt=\"CLOSE\" /></a> <input type=\"image\" src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/buttons/save_button_g.gif\" value=\"Submit\" alt=\"Submit\" ></center><br />"); responseBuilder.AppendLine("</div>"); responseBuilder.AppendLine(); placeHolder.Controls.Add(new Literal() { Text = responseBuilder.ToString() }); } }
/// <summary> Add the HTML to be displayed in the main SobekCM viewer area (outside of the forms)</summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This class does nothing, since the interface list is added as controls, not HTML </remarks> public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Edit_Serial_Hierarchy_MySobekViewer.Write_HTML", "Do nothing"); Output.WriteLine("<br /><br />"); Output.WriteLine("<strong>EDIT SERIAL HIERARCHY</strong><br /><br />"); Output.WriteLine("Implementation for this feature is currently pending.<br /><br /><br />"); }
/// <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) { // Replace item URL in the restricted message CurrentMode.ViewerCode = string.Empty; string msg = restrictedMessage.Replace("<%ITEMURL%>", CurrentMode.Redirect_URL()); Output.WriteLine("<td style=\"text-align:left;\" id=\"sbkRes_MainArea\">" + msg + "</td>"); }
/// <summary> Constructor for a new instance of the User_Tags_MySobekViewer class </summary> /// <param name="User"> Authenticated user information </param> /// <param name="Current_Mode"> Mode / navigation information for the current request</param> /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public User_Usage_Stats_MySobekViewer(User_Object User, SobekCM_Navigation_Object Current_Mode, Statistics_Dates Stats_Date_Range, Custom_Tracer Tracer) : base(User) { Tracer.Add_Trace("User_Usage_Stats_MySobekViewer.Constructor", String.Empty); currentMode = Current_Mode; statsDates = Stats_Date_Range; }
/// <summary> Perform all the work of adding to the response stream back to the web user </summary> /// <param name="Navigation_Place_Holder"> Place holder is used to add more complex server-side objects during execution</param> /// <param name="TOC_Place_Holder"> Place holder is used to add more complex server-side objects during execution</param> /// <param name="Main_Place_Holder"> Place holder is used to add more complex server-side objects during execution</param> /// <param name="myUfdcUploadPlaceHolder"> Place holder is used to add more complex server-side objects during execution </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> Since this class writes all the output directly to the response stream, this method simply returns, without doing anything</remarks> public override void Add_Controls(PlaceHolder Navigation_Place_Holder, PlaceHolder TOC_Place_Holder, PlaceHolder Main_Place_Holder, PlaceHolder myUfdcUploadPlaceHolder, Custom_Tracer Tracer) { return; }
/// <summary> Add the HTML to be displayed in the main SobekCM viewer area (outside of the forms)</summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This class does nothing, since the interface list is added as controls, not HTML </remarks> public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Group_AutoFill_Volume_MySobekViewer.Write_HTML", "Do nothing"); Output.WriteLine("<br /><br />"); Output.WriteLine("<strong>AUTO-FILL NEW VOLUMES</strong><br /><br />"); Output.WriteLine("Implementation for this feature is currently pending.<br /><br /><br />"); }
/// <summary> Constructor for a new instance of the Preferences_MySobekViewer class </summary> /// <param name="User"> Authenticated user information </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public Preferences_MySobekViewer(User_Object User, Custom_Tracer Tracer) : base(User) { Tracer.Add_Trace("Preferences_MySobekViewer.Constructor", String.Empty); // Do nothing validationErrors = new List<string>(); }
/// <summary> Add the HTML to be displayed in the search box </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This adds the title of the static browse or info into the box </remarks> public override void Add_Search_Box_HTML(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Static_Browse_Info_AggregationViewer.Add_Search_Box_HTML", "Adding HTML"); } Output.WriteLine(" <h1>" + browseObject.Get_Label(currentMode.Language) + "</h1>"); }
/// <summary> Add the HTML to be displayed in the search box </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public override void Add_Search_Box_HTML(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("No_Search_AggregationViewer.Add_Search_Box_HTML", "Adding html for search box"); } Output.WriteLine("<h1>" + currentCollection.Name + " Home</h1>"); }
/// <summary> Writes the HTML generated by this error html subwriter directly to the response stream </summary> /// <param name="Output"> Stream to which to write the HTML for this subwriter </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> TRUE -- Value indicating if html writer should finish the page immediately after this, or if there are other controls or routines which need to be called first </returns> public override bool Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Error_HtmlSubwriter.Write_HTML", "Rendering HTML"); // Start the page container Output.WriteLine("<div id=\"pagecontainer\">"); Output.WriteLine("<br />"); string url_options = currentMode.URL_Options(); if (url_options.Length > 0) url_options = "?" + url_options; if (invalidItem) { Output.WriteLine("<span class=\"UfdcGeneralError\">"); Output.WriteLine(" <br /><br />"); Output.WriteLine(" The item indicated was not valid."); Output.WriteLine(" <br /><br />"); Output.WriteLine(" Click <a href=\"" + currentMode.Base_URL + "contact\">here</a> to report an error."); Output.WriteLine(" <br /><br /><br /><br />"); Output.WriteLine("</span>"); Output.WriteLine(); } else { Output.WriteLine("<br />"); Output.WriteLine("<div class=\"SobekHomeText\">"); Output.WriteLine("<table width=\"700\" border=\"0\" align=\"center\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td align=\"center\" >"); string error_message = "Unknown error occurred"; if ((currentMode != null) && (currentMode.Error_Message.Length > 0)) { error_message = currentMode.Error_Message; } Output.WriteLine(" <b><h4>" + error_message + "</h4></b>"); Output.WriteLine(" <h5>We apologize for the inconvenience.</h5>"); Output.WriteLine(" <h5>Click <a href=\"" + currentMode.Base_URL + url_options + "\">here</a> to return to the library.</h5>"); string returnurl = currentMode.Base_URL + "contact?em=" + error_message.Replace(" ", "%20") + currentMode.URL_Options(); Output.WriteLine(" <h5>Click <a href=\"" + returnurl + "\">here</a> to report the problem.</h5>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine("</table>"); Output.WriteLine("<br /><br />"); Output.WriteLine("</div>"); } Output.WriteLine("<!-- Close the pagecontainer div -->"); Output.WriteLine("</div>"); Output.WriteLine(); return true; }
/// <summary> Adds the main view section to the page turner </summary> /// <param name="MainPlaceHolder"> 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 MainPlaceHolder, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("TOC_ItemViewer.Add_Main_Viewer_Section", ""); } // Build the value StringBuilder builder = new StringBuilder(); // Save the current viewer code string current_view_code = CurrentMode.ViewerCode; // Start the citation table builder.AppendLine("\t\t<!-- TABLE OF CONTENTS VIEWER OUTPUT -->" ); builder.AppendLine("\t\t<td align=\"left\"><span class=\"SobekViewerTitle\"><b>Table of Contents</b></span></td></tr>" ); builder.AppendLine("\t\t<tr><td class=\"SobekDocumentDisplay\">"); builder.AppendLine("\t\t\t<div class=\"SobekTOC\">"); builder.AppendLine("\t\t\t\t<table cellpadding=\"5px\">"); builder.AppendLine("\t\t\t\t\t<tr height=\"5\"> <td> </td> </tr>" ); builder.AppendLine("\t\t\t\t\t<tr>" ); builder.AppendLine("\t\t\t\t\t\t<td width=\"15\"> </td>" ); builder.AppendLine("\t\t\t\t\t\t<td valign=\"top\">"); builder.AppendLine("\t\t\t\t\t\t\t<b>" + CurrentItem.Bib_Info.Main_Title.Title + "</b><br />" ); // Create the tree structure // ArrayList nodes = Create_Tree_From_DataTable(currentItem.Divisions); // Recursively build the result builder.AppendLine("\t\t\t\t\t\t\t<table>" + Environment.NewLine); //foreach ( TOC_TreeNode thisNode in nodes ) //{ // Add_TOC_TreeNode_HTML( thisNode, builder, " " ); //} builder.AppendLine("\t\t\t\t\t\t\t</table>" + Environment.NewLine); // Finish the citation table builder.AppendLine("\t\t\t\t\t\t</td>" ); builder.AppendLine("\t\t\t\t\t\t<td width=\"15\"> </td>" ); builder.AppendLine("\t\t\t\t\t</tr>"); builder.AppendLine("\t\t\t\t\t<tr height=\"5\"> <td> </td> </tr>"); builder.AppendLine("\t\t\t\t</table>"); builder.AppendLine("\t\t\t</div>"); builder.AppendLine("\t\t</td>"); builder.AppendLine( "\t\t<!-- END TABLE OF CONTENTS VIEWER OUTPUT -->" ); // Restore the mode CurrentMode.ViewerCode = current_view_code; // Add the HTML for the image Literal mainLiteral = new Literal {Text = builder.ToString()}; MainPlaceHolder.Controls.Add( mainLiteral ); }
/// <summary> Constructor for a new instance of the JPEG2000_ItemViewer class, used to display JPEG2000s linked to /// pages in a digital resource </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> public JPEG2000_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer, string ViewerCode, string[] FileExtensions) { // Add the trace if (Tracer != null) { Tracer.Add_Trace("JPEG2000_ItemViewer.Constructor"); } // Save the arguments for use later this.BriefItem = BriefItem; this.CurrentUser = CurrentUser; this.CurrentRequest = CurrentRequest; // Determine if the navigator ( in the left nav bar ) should be suppressed suppressNavigator = false; if (UI_ApplicationCache_Gateway.Settings.Contains_Additional_Setting("JPEG2000 ItemViewer.Suppress Navigator")) { if (UI_ApplicationCache_Gateway.Settings.Get_Additional_Setting("JPEG2000 ItemViewer.Suppress Navigator").ToLower().Trim() != "false") { suppressNavigator = true; } } // Determine the page page = 1; if (!String.IsNullOrEmpty(CurrentRequest.ViewerCode)) { int tempPageParse; if (Int32.TryParse(CurrentRequest.ViewerCode.Replace(ViewerCode.Replace("#", ""), ""), out tempPageParse)) { page = tempPageParse; } } // Just a quick range check if (page > BriefItem.Images.Count) { page = 1; } // Try to set the file information here if ((!set_file_information(FileExtensions)) && (page != 1)) { // If there was an error, just set to the first page page = 1; set_file_information(FileExtensions); } // Since this is a paging viewer, set the viewer code if (String.IsNullOrEmpty(CurrentRequest.ViewerCode)) { CurrentRequest.ViewerCode = ViewerCode.Replace("#", page.ToString()); } }
/// <summary> This is an opportunity to write HTML directly into the main form, without /// using the pop-up html form architecture </summary> /// <param name="Output"> Textwriter to write the pop-up form HTML for this viewer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This text will appear within the ItemNavForm form tags </remarks> public override void Add_HTML_In_Main_Form(TextWriter Output, Custom_Tracer Tracer) { if ((details != null) && (details.Tables[0].Rows.Count > 0)) { Tracer.Add_Trace("IP_Restrictions_AdminViewer.Add_HTML_In_Main_Form", "Display details regarding one IP restrictive range"); // Assign some of the values from the details to the range thisRange.Title = details.Tables[0].Rows[0]["Title"].ToString(); thisRange.Notes = details.Tables[0].Rows[0]["Notes"].ToString(); // Add the stylesheet(s)and javascript needed Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_form.js\" ></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" ></script>"); // Add the hidden field Output.WriteLine("<!-- Hidden field is used for postbacks to indicate what to save and reset -->"); Output.WriteLine("<input type=\"hidden\" id=\"rangeid\" name=\"rangeid\" value=\"" + thisRange.RangeID + "\" />"); Output.WriteLine("<input type=\"hidden\" id=\"action\" name=\"action\" value=\"\" />"); Output.WriteLine(); // Start the HTML rendering Output.WriteLine("<div class=\"SobekHomeText\">"); // Add the save and cancel button and link to help currentMode.My_Sobek_SubMode = String.Empty; Output.WriteLine(" <br />"); Output.WriteLine(" <table width=\"750px\"><tr><td align=\"left\"> For clarification of any terms on this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/restrictions\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</td><td align=\"right\"><a href=\"" + currentMode.Redirect_URL() + "\"><img border=\"0\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/cancel_button_22.gif\" alt=\"CLOSE\" /></a> <input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\"></td></tr></table>"); // Add all the basic information Output.WriteLine(" <span class=\"SobekAdminTitle\">Basic Information</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <div class=\"admin_aggr_new_div\">"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for range title Output.WriteLine(" <tr>"); Output.WriteLine(" <td width=\"120px\"><label for=\"admin_title\">Title:</label></td>"); Output.WriteLine(" <td><input class=\"admin_ip_large_input\" name=\"admin_title\" id=\"admin_title\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(thisRange.Title) + "\" onfocus=\"javascript:textbox_enter('admin_title', 'admin_ip_large_input_focused')\" onblur=\"javascript:textbox_leave('admin_title', 'admin_ip_large_input')\" /></td>"); Output.WriteLine(" </tr>"); // Compute the size of the text boxes int actual_cols = 75; if (currentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0) { actual_cols = 70; } // Add the notes text area box Output.WriteLine(" <tr valign=\"top\"><td valign=\"top\"><label for=\"admin_notes\">Notes:</label></td><td colspan=\"2\"><textarea rows=\"5\" cols=\"" + actual_cols + "\" name=\"admin_notes\" id=\"admin_notes\" class=\"admin_ip_input\" onfocus=\"javascript:textbox_enter('admin_notes','admin_ip_focused')\" onblur=\"javascript:textbox_leave('admin_notes','admin_ip_input')\">" + HttpUtility.HtmlEncode(thisRange.Notes) + "</textarea></td></tr>"); // Add the message text area box Output.WriteLine(" <tr valign=\"top\"><td valign=\"top\"><label for=\"admin_message\">Message:</label></td><td colspan=\"2\"><textarea rows=\"10\" cols=\"" + actual_cols + "\" name=\"admin_message\" id=\"admin_message\" class=\"admin_ip_input\" onfocus=\"javascript:textbox_enter('admin_message','admin_ip_focused')\" onblur=\"javascript:textbox_leave('admin_message','admin_ip_input')\">" + HttpUtility.HtmlEncode(thisRange.Item_Restricted_Statement) + "</textarea></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekAdminTitle\">IP Addresses</span>"); Output.WriteLine(" <br /><br />"); Output.WriteLine(" <blockquote>"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"90px\" align=\"left\"><span style=\"color: White\"> ACTIONS</span></th>"); Output.WriteLine(" <th width=\"135px\" align=\"left\"><span style=\"color: White\">START IP</span></th>"); Output.WriteLine(" <th width=\"135px\" align=\"left\"><span style=\"color: White\">END IP</span></th>"); Output.WriteLine(" <th width=\"250px\" align=\"left\"><span style=\"color: White\">LABEL</span></th>"); Output.WriteLine(" </tr>"); foreach (DataRow thisRow in details.Tables[1].Rows) { // Get the primary key for this IP address string ip_primary = thisRow["IP_SingleID"].ToString(); // Build the action links Output.WriteLine(" <tr align=\"left\" >"); Output.Write(" <td class=\"SobekAdminActionLink\" >( "); Output.WriteLine("<a title=\"Click to clear this ip address\" id=\"CLEAR_" + ip_primary + "\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return clear_ip_address('" + ip_primary + "');\">clear</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td><input class=\"admin_ip_small_input\" name=\"admin_ipstart_" + ip_primary + "\" id=\"admin_ipstart_" + ip_primary + "\" type=\"text\" value=\"" + thisRow["StartIP"].ToString().Trim() + "\" onfocus=\"javascript:textbox_enter('admin_ipstart_" + ip_primary + "', 'admin_ip_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_ipstart_" + ip_primary + "', 'admin_ip_small_input')\" /></td>"); Output.WriteLine(" <td><input class=\"admin_ip_small_input\" name=\"admin_ipend_" + ip_primary + "\" id=\"admin_ipend_" + ip_primary + "\" type=\"text\" value=\"" + thisRow["EndIP"].ToString().Trim() + "\" onfocus=\"javascript:textbox_enter('admin_ipend_" + ip_primary + "', 'admin_ip_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_ipend_" + ip_primary + "', 'admin_ip_small_input')\" /></td>"); Output.WriteLine(" <td><input class=\"admin_ip_medium_input\" name=\"admin_iplabel_" + ip_primary + "\" id=\"admin_iplabel_" + ip_primary + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(thisRow["Notes"].ToString().Trim()) + "\" onfocus=\"javascript:textbox_enter('admin_iplabel_" + ip_primary + "', 'admin_ip_medium_input_focused')\" onblur=\"javascript:textbox_leave('admin_iplabel_" + ip_primary + "', 'admin_ip_medium_input')\" /></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>"); } // Now, always add ten empty IP rows here for (int i = 1; i < 10; i++) { Output.WriteLine(" <tr align=\"left\" >"); Output.Write(" <td class=\"SobekAdminActionLink\" >( "); Output.WriteLine("<a title=\"Click to clear this ip address\" id=\"CLEAR_new" + i + "\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return clear_ip_address('new" + i + "');\">clear</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td><input class=\"admin_ip_small_input\" name=\"admin_ipstart_new" + i + "\" id=\"admin_ipstart_new" + i + "\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_ipstart_new" + i + "', 'admin_ip_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_ipstart_new" + i + "', 'admin_ip_small_input')\" /></td>"); Output.WriteLine(" <td><input class=\"admin_ip_small_input\" name=\"admin_ipend_new" + i + "\" id=\"admin_ipend_new" + i + "\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_ipend_new" + i + "', 'admin_ip_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_ipend_new" + i + "', 'admin_ip_small_input')\" /></td>"); Output.WriteLine(" <td><input class=\"admin_ip_medium_input\" name=\"admin_iplabel_new" + i + "\" id=\"admin_iplabel_new" + i + "\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_iplabel_new" + i + "', 'admin_ip_medium_input_focused')\" onblur=\"javascript:textbox_leave('admin_iplabel_new" + i + "', 'admin_ip_medium_input')\" /></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>"); } Output.WriteLine("</table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine("</div>"); return; } Tracer.Add_Trace("IP_Restrictions_AdminViewer.Add_HTML_In_Main_Form", "Display main IP restrictive range admin form"); Output.WriteLine("<div class=\"SobekHomeText\">"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" Restrictive ranges of IP addresses may be used to restrict access to digital resources. This form allows system administrators to edit the individual IP addresses and contiguous IP addresses associated with an existing restrictive range.<br /><br />"); Output.WriteLine(" For more information about IP restriction ranges and this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/restrictions\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>."); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Existing Ranges</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" Select an IP restrictive range below to view or edit:<br />"); Output.WriteLine(" <blockquote>"); for (int i = 0; i < ipRestrictionInfo.Count; i++) { currentMode.My_Sobek_SubMode = ipRestrictionInfo[i].RangeID.ToString(); Output.WriteLine("<a href=\"" + currentMode.Redirect_URL() + "\">" + ipRestrictionInfo[i].Title + "</a><br /><br />"); } Output.WriteLine(" </blockquote>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); }
/// <summary> This is an opportunity to write HTML directly into the main form, without /// using the pop-up html form architecture </summary> /// <param name="Output"> Textwriter to write the pop-up form HTML for this viewer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This text will appear within the ItemNavForm form tags </remarks> public override void Write_ItemNavForm_Closing(TextWriter Output, Custom_Tracer Tracer) { Output.WriteLine("<!-- IP_Restrictions_AdminViewer.Write_ItemNavForm_Closing -->"); // Add the stylesheet(s)and javascript needed Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" ></script>"); Output.WriteLine(); // Add the hidden field Output.WriteLine("<!-- Hidden field is used for postbacks to indicate what to save and reset -->"); if (thisRange != null) { Output.WriteLine("<input type=\"hidden\" id=\"rangeid\" name=\"rangeid\" value=\"" + thisRange.RangeID + "\" />"); } Output.WriteLine("<input type=\"hidden\" id=\"action\" name=\"action\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<div class=\"sbkAdm_HomeText\">"); if (!String.IsNullOrEmpty(actionMessage)) { Output.WriteLine(" <br />"); Output.WriteLine(" <div id=\"sbkAdm_ActionMessage\">" + actionMessage + "</div>"); } if ((details != null) && (thisRange != null) && (details.Tables[0].Rows.Count > 0)) { Tracer.Add_Trace("IP_Restrictions_AdminViewer.Write_ItemNavForm_Closing", "Display details regarding one IP restrictive range"); // Assign some of the values from the details to the range thisRange.Title = details.Tables[0].Rows[0]["Title"].ToString(); thisRange.Notes = details.Tables[0].Rows[0]["Notes"].ToString(); // Add the save and cancel button and link to help currentMode.My_Sobek_SubMode = String.Empty; Output.WriteLine(" <br />"); Output.WriteLine(" <table style=\"width:750px;\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td> For clarification of any terms on this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "adminhelp/restrictions\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</td>"); Output.WriteLine(" <td style=\"text-align:right\">"); if (user.Is_System_Admin) { Output.WriteLine(" <button title=\"Do not apply changes\" class=\"sbkAdm_RoundButton\" onclick=\"parent.location='" + currentMode.Redirect_URL() + "';return false;\"><img src=\"" + currentMode.Base_URL + "default/images/button_previous_arrow.png\" class=\"sbkAdm_RoundButton_LeftImg\" alt=\"\" /> CANCEL</button> "); Output.WriteLine(" <button title=\"Save changes to this IP restriction range\" class=\"sbkAdm_RoundButton\" type=\"submit\">SAVE <img src=\"" + currentMode.Base_URL + "default/images/button_next_arrow.png\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button>"); } else { Output.WriteLine(" <button title=\"Do not apply changes\" class=\"sbkAdm_RoundButton\" onclick=\"parent.location='" + currentMode.Redirect_URL() + "';return false;\"><img src=\"" + currentMode.Base_URL + "default/images/button_previous_arrow.png\" class=\"sbkAdm_RoundButton_LeftImg\" alt=\"\" /> BACK</button> "); } Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine(); // Add portal admin message string readonly_tag = String.Empty; int columns = 4; if (!user.Is_System_Admin) { Output.WriteLine("<p>Portal Admins have rights to see these settings. System Admins can change these settings.</p>"); readonly_tag = " readonly=\"readonly\""; columns = 3; } // Add all the basic information Output.WriteLine(" <h2>Basic Information</h2>"); Output.WriteLine(" <div class=\"sbkIpav_NewDiv\">"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for range title Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:120px;\"><label for=\"admin_title\">Title:</label></td>"); Output.WriteLine(" <td><input class=\"sbkIpav_large_input sbkAdmin_Focusable\" name=\"admin_title\" id=\"admin_title\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(thisRange.Title) + "\" " + readonly_tag + " /></td>"); Output.WriteLine(" </tr>"); // Add the notes text area box Output.WriteLine(" <tr style=\"vertical-align:top\"><td><label for=\"admin_notes\">Notes:</label></td><td colspan=\"2\"><textarea rows=\"5\" name=\"admin_notes\" id=\"admin_notes\" class=\"sbkIpav_input sbkAdmin_Focusable\"" + readonly_tag + ">" + HttpUtility.HtmlEncode(thisRange.Notes) + "</textarea></td></tr>"); // Add the message text area box Output.WriteLine(" <tr style=\"vertical-align:top\"><td><label for=\"admin_message\">Message:</label></td><td colspan=\"2\"><textarea rows=\"10\" name=\"admin_message\" id=\"admin_message\" class=\"sbkIpav_input sbkAdmin_Focusable\"" + readonly_tag + " >" + HttpUtility.HtmlEncode(thisRange.Item_Restricted_Statement) + "</textarea></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(); Output.WriteLine(" <h2>IP Addresses</h2>"); Output.WriteLine(" <table class=\"sbkIpav_Table sbkAdm_Table\">"); Output.WriteLine(" <tr>"); if (user.Is_System_Admin) { Output.WriteLine(" <th class=\"sbkIpav_TableHeader1\">ACTIONS</th>"); } Output.WriteLine(" <th class=\"sbkIpav_TableHeader2\">START IP</th>"); Output.WriteLine(" <th class=\"sbkIpav_TableHeader3\">END IP</th>"); Output.WriteLine(" <th class=\"sbkIpav_TableHeader4\">LABEL</th>"); Output.WriteLine(" </tr>"); foreach (DataRow thisRow in details.Tables[1].Rows) { // Get the primary key for this IP address string ip_primary = thisRow["IP_SingleID"].ToString(); // Build the action links Output.WriteLine(" <tr>"); if (user.Is_System_Admin) { Output.WriteLine(" <td class=\"sbkAdm_ActionLink\" >( <a title=\"Click to clear this ip address\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return clear_ip_address('" + ip_primary + "');\">clear</a> )</td>"); } // Add the rest of the row with data Output.WriteLine(" <td><input class=\"sbkIpav_small_input sbkAdmin_Focusable\" name=\"admin_ipstart_" + ip_primary + "\" id=\"admin_ipstart_" + ip_primary + "\" type=\"text\" value=\"" + thisRow["StartIP"].ToString().Trim() + "\" /></td>"); Output.WriteLine(" <td><input class=\"sbkIpav_small_input sbkAdmin_Focusable\" name=\"admin_ipend_" + ip_primary + "\" id=\"admin_ipend_" + ip_primary + "\" type=\"text\" value=\"" + thisRow["EndIP"].ToString().Trim() + "\" /></td>"); Output.WriteLine(" <td><input class=\"sbkIpav_medium_input sbkAdmin_Focusable\" name=\"admin_iplabel_" + ip_primary + "\" id=\"admin_iplabel_" + ip_primary + "\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(thisRow["Notes"].ToString().Trim()) + "\" /></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"" + columns + "\"></td></tr>"); } // Now, always add ten empty IP rows here, for system administrators if (user.Is_System_Admin) { for (int i = 1; i < 10; i++) { Output.WriteLine(" <tr>"); Output.WriteLine(" <td class=\"sbkAdm_ActionLink\" >( <a title=\"Click to clear this ip address\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return clear_ip_address('new" + i + "');\">clear</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td><input class=\"sbkIpav_small_input sbkAdmin_Focusable\" name=\"admin_ipstart_new" + i + "\" id=\"admin_ipstart_new" + i + "\" type=\"text\" value=\"\" /></td>"); Output.WriteLine(" <td><input class=\"sbkIpav_small_input sbkAdmin_Focusable\" name=\"admin_ipend_new" + i + "\" id=\"admin_ipend_new" + i + "\" type=\"text\" value=\"\" /></td>"); Output.WriteLine(" <td><input class=\"sbkIpav_medium_input sbkAdmin_Focusable\" name=\"admin_iplabel_new" + i + "\" id=\"admin_iplabel_new" + i + "\" type=\"text\" value=\"\" /></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"4\"></td></tr>"); } } Output.WriteLine(" </table>"); Output.WriteLine("</div>"); return; } Tracer.Add_Trace("IP_Restrictions_AdminViewer.Write_ItemNavForm_Closing", "Display main IP restrictive range admin form"); Output.WriteLine(" <p>Restrictive ranges of IP addresses may be used to restrict access to digital resources. This form allows system administrators to edit the individual IP addresses and contiguous IP addresses associated with an existing restrictive range.</p>"); Output.WriteLine(" <p>For more information about IP restriction ranges and this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "adminhelp/restrictions\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</p>"); Output.WriteLine(); if (user.Is_System_Admin) { // Add all the basic information Output.WriteLine(" <h2>New IP Restrictive Range</h2>"); Output.WriteLine(" <div class=\"sbkIpav_NewDiv\">"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for range title Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:120px;\"><label for=\"admin_title\">Title:</label></td>"); Output.WriteLine(" <td><input class=\"sbkIpav_large_input sbkAdmin_Focusable\" name=\"new_admin_title\" id=\"new_admin_title\" type=\"text\" value=\"\" /></td>"); Output.WriteLine(" </tr>"); // Add the notes text area box Output.WriteLine(" <tr style=\"vertical-align:top\"><td><label for=\"admin_notes\">Notes:</label></td><td colspan=\"2\"><textarea rows=\"5\" name=\"new_admin_notes\" id=\"new_admin_notes\" class=\"sbkIpav_input sbkAdmin_Focusable\" ></textarea></td></tr>"); // Add the message text area box Output.WriteLine(" <tr style=\"vertical-align:top\"><td><label for=\"admin_message\">Message:</label></td><td colspan=\"2\"><textarea rows=\"10\" name=\"new_admin_message\" id=\"new_admin_message\" class=\"sbkIpav_input sbkAdmin_Focusable\" ></textarea></td></tr>"); // Add the SAVE button Output.WriteLine(" <tr style=\"height:30px; text-align: center;\"><td></td><td><button title=\"Save new IP restrictive range\" class=\"sbkAdm_RoundButton\" onclick=\"return save_new_ip_range();\">SAVE <img src=\"" + currentMode.Base_URL + "default/images/button_next_arrow.png\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(); } else { // Add portal admin message Output.WriteLine("<p>Portal Admins have rights to see these settings. System Admins can change these settings.</p>"); } Output.WriteLine(" <h2>Existing Ranges</h2>"); if (ipRestrictionInfo.Count == 0) { Output.WriteLine(" <p>No existing IP restrictive ranges exist.</p>"); if (user.Is_System_Admin) { Output.WriteLine("<p>To add one, enter the information above and press SAVE.</p>"); } } else { Output.WriteLine(" <p>Select an IP restrictive range below to view or edit:</p>"); Output.WriteLine(" <ul id=\"sbkIpav_RangeList\">"); for (int i = 0; i < ipRestrictionInfo.Count; i++) { currentMode.My_Sobek_SubMode = ipRestrictionInfo[i].RangeID.ToString(); Output.WriteLine("<li><a href=\"" + currentMode.Redirect_URL() + "\">" + ipRestrictionInfo[i].Title + "</a></li>"); } Output.WriteLine(" </ul>"); } Output.WriteLine("</div>"); }
/// <summary>Reads the item aggregation browse or info file and returns a built <see cref="Item_Aggregation_Child_Page"/> 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_Child_Page Get_Item_Aggregation_Browse_Info(string FileName, Item_Aggregation_Child_Page.Visibility_Type Browse_Type, Custom_Tracer Tracer) { HTML_Based_Content fileContent = HTML_Based_Content_Reader.Read_HTML_File(FileName, false, Tracer); Item_Aggregation_Child_Page returnObject = new Item_Aggregation_Child_Page(Browse_Type, Item_Aggregation_Child_Page.Source_Type.Static_HTML, fileContent.Code, FileName, fileContent.Title); return(returnObject); }
/// <summary> Add the HTML to be displayed in the main SobekCM viewer area </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This class does nothing, since the alias list is added as controls, not HTML </remarks> public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("IP_Restrictions_AdminViewer.Write_HTML", "Do nothing"); }
/// <summary> Add the HTML to be displayed in the main SobekCM viewer area </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This class does nothing, since the themes list is added as controls, not HTML </remarks> public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Thematic_Headings_AdminViewer.Write_HTML", "Do nothing"); }
/// <summary> Add the HTML to be displayed in the main SobekCM viewer area </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This class does nothing, since the interface list is added as controls, not HTML </remarks> public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Default_Metadata_AdminViewer.Write_HTML", "Do nothing"); }
/// <summary> Allows controls to be added directory to a place holder, rather than just writing to the output HTML stream </summary> /// <param name="MainPlaceHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which 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> /// <remarks> This method does nothing, since nothing is added to the place holder as a control for this item viewer </remarks> public void Add_Main_Viewer_Section(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer) { // Do nothing }
/// <summary> Write the item viewer main section as HTML directly to the HTTP output stream </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 void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Related_Images_ItemViewer.Write_Main_Viewer_Section", ""); } int images_per_page = thumbnailsPerPage; int size_of_thumbnails = thumbnailSize; // Save the current viewer code string current_view_code = currentRequest.ViewerCode; ushort current_view_page = currentRequest.Page.HasValue ? currentRequest.Page.Value : ((ushort)1); // Start the citation table Output.WriteLine("\t\t<td>"); Output.WriteLine("\t\t<!-- RELATED IMAGES VIEWER OUTPUT -->"); // Start the main div for the thumbnails ushort page = (ushort)(currentRequest.Page - 1); if (page > (pageCount - 1) / images_per_page) { page = (ushort)((pageCount - 1) / images_per_page); } //Outer div which contains all the thumbnails Output.WriteLine("<div style=\"margin:5px;text-align:center;\">"); // Get any search terms for highlighting purposes List <string> terms = new List <string>(); if (!String.IsNullOrWhiteSpace(currentRequest.Text_Search)) { string[] splitter = currentRequest.Text_Search.Replace("\"", "").Split(" ".ToCharArray()); terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim()); } // Step through each page in the item for (int page_index = page * images_per_page; (page_index < (page + 1) * images_per_page) && (page_index < pageCount); page_index++) { // Get this page BriefItem_FileGrouping thisPage = briefItem.Images[page_index]; // Find the jpeg and thumbnail images string jpeg = String.Empty; string thumbnail = String.Empty; foreach (BriefItem_File thisFile in thisPage.Files) { if (String.Compare(thisFile.File_Extension, ".jpg", StringComparison.OrdinalIgnoreCase) == 0) { if (thisFile.Name.ToLower().IndexOf("thm.jpg") > 0) { thumbnail = thisFile.Name; } else { jpeg = thisFile.Name; } } } // If the thumbnail is not in the METS, just guess its existence if (thumbnail.Length == 0) { thumbnail = jpeg.ToLower().Replace(".jpg", "thm.jpg"); } // Get the image URL currentRequest.Page = (ushort)(page_index + 1); currentRequest.ViewerCode = (page_index + 1).ToString(); string url = UrlWriterHelper.Redirect_URL(currentRequest); // Determine the width information and the URL for the image string image_url; // = (briefItem.Web.Source_URL + "/" + thumbnail).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"); int width = -1; switch (size_of_thumbnails) { case 2: image_url = (briefItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://"); width = 315; break; case 3: image_url = (briefItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://"); width = 472; break; case 4: image_url = (briefItem.Web.Source_URL + "/" + jpeg).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://"); break; default: image_url = (briefItem.Web.Source_URL + "/" + thumbnail).Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://").Replace("https:/", "https://"); width = 150; break; } if (width > 0) { Output.WriteLine(" <table class=\"sbkRi_Thumbnail\" id=\"span" + page_index + "\" style=\"width:" + (width + 15) + "px\">"); } else { Output.WriteLine(" <table class=\"sbkRi_Thumbnail\" id=\"span" + page_index + "\">"); } Output.WriteLine(" <tr>"); Output.WriteLine(" <td>"); Output.WriteLine(" <a id=\"" + page_index + "\" href=\"" + url + "\" title=\"" + thisPage.Label + "\">"); if (width > 0) { Output.WriteLine(" <img src=\"" + image_url + "\" style=\"width:" + width + "px;\" alt=\"MISSING THUMBNAIL\" />"); } else { Output.WriteLine(" <img src=\"" + image_url + "\" alt=\"MISSING THUMBNAIL\" />"); } Output.WriteLine(" </a>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"text-align:center\">" + Text_Search_Term_Highlighter.Hightlight_Term_In_HTML(thisPage.Label, terms, "<span class=\"sbkRi_TextHighlight\">", "</span>") + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine(); } //Close the outer div Output.WriteLine("</div>"); // Restore the mode currentRequest.ViewerCode = current_view_code; currentRequest.Page = current_view_page; Output.WriteLine("<script type=\"text/javascript\"> WindowResizeActions();</script>"); // Finish the citation table Output.WriteLine("\t\t</td>"); Output.WriteLine("\t\t<!-- END RELATED IMAGES VIEWER OUTPUT -->"); }
/// <summary> Adds any viewer_specific information to the item viewer above the standard pagination buttons </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 void Write_Top_Additional_Navigation_Row(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Related_Images_ItemViewer.Write_Top_Additional_Navigation_Row", ""); } string numOfThumbnails = "thumbnails per page"; string goToThumbnail = "Go to thumbnail"; const string SMALL_THUMBNAILS = "Switch to small thumbnails"; const string MEDIUM_THUMBNAILS = "Switch to medium thumbnails"; const string LARGE_THUMBNAILS = "Switch to large thumbnails"; if (currentRequest.Language == Web_Language_Enum.French) { numOfThumbnails = "vignettes par page"; //Size_Of_Thumbnail = "la taille des vignettes"; goToThumbnail = "Aller à l'Vignette"; } if (currentRequest.Language == Web_Language_Enum.Spanish) { numOfThumbnails = "miniaturas por página"; //Size_Of_Thumbnail = "Miniatura de tamaño"; goToThumbnail = "Ir a la miniatura"; } //Start building the top nav bar Output.WriteLine("<tr>"); Output.WriteLine("<td>"); Output.WriteLine("\t\t<!-- RELATED IMAGES VIEWER TOP NAV ROW -->"); //Include the js files Output.WriteLine("<script type=\"text/javascript\" src=\"" + Static_Resources_Gateway.Jquery_Ui_1_10_3_Custom_Js + "\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + Static_Resources_Gateway.Jquery_Color_2_1_1_Js + "\"></script>"); Output.WriteLine("<table style=\"width: 100%\">"); Output.WriteLine("\t<tr>"); //Add the dropdown for the number of thumbnails per page, only if there are >25 thumbnails if (pageCount > 25) { //Redirect to the first page of results when the number of thumbnails option is changed by the user string current_viewercode = currentRequest.ViewerCode; UrlWriterHelper.Redirect_URL(currentRequest, "thumbs"); // currentRequest.Thumbnails_Per_Page = -1; // string current_Page_url = UrlWriterHelper.Redirect_URL(currentRequest, "1thumbs"); // Collect the list of options to display List <int> thumbsOptions = new List <int> { 25 }; if (pageCount > 50) { thumbsOptions.Add(50); } if (pageCount > 100) { thumbsOptions.Add(100); } if (pageCount > 250) { thumbsOptions.Add(250); } if (pageCount > 500) { thumbsOptions.Add(500); } // Start the drop down select list Output.WriteLine("\t\t<td style=\"valign:top;text-align:left;padding-left: 20px;\">"); Output.WriteLine("\t\t\t<select id=\"selectNumOfThumbnails\" onchange=\"location=this.options[this.selectedIndex].value;\">"); // Step through all the options foreach (int thumbOption in thumbsOptions) { currentRequest.Thumbnails_Per_Page = (short)thumbOption; if (thumbnailsPerPage == thumbOption) { Output.WriteLine("\t\t\t\t<option value=\"" + UrlWriterHelper.Redirect_URL(currentRequest) + "\" selected=\"selected\">" + thumbOption + " " + numOfThumbnails + "</option>"); } else { Output.WriteLine("\t\t\t\t<option value=\"" + UrlWriterHelper.Redirect_URL(currentRequest) + "\">" + thumbOption + " " + numOfThumbnails + "</option>"); } } currentRequest.Thumbnails_Per_Page = -1; if (thumbnailsPerPage == int.MaxValue) { Output.WriteLine("\t\t\t\t<option value=\"" + UrlWriterHelper.Redirect_URL(currentRequest) + "\" selected=\"selected\">All thumbnails</option>"); } else { Output.WriteLine("\t\t\t\t<option value=\"" + UrlWriterHelper.Redirect_URL(currentRequest) + "\">All thumbnails</option>"); } //Reset the Current Mode Thumbnails_Per_Page currentRequest.ViewerCode = current_viewercode; Output.WriteLine("\t\t\t</select>"); Output.WriteLine("\t\t</td>"); } currentRequest.Thumbnails_Per_Page = -100; //Add the control for the thumbnail size //Get the icons for the thumbnail sizes Output.WriteLine("\t\t<td id=\"sbkRi_Thumbnailsizeselect\">"); if (thumbnailSize == 1) { Output.Write("\t\t\t<img src=\"" + Static_Resources_Gateway.Thumbs3_Selected_Gif + "\" alt=\"Small\" />"); } else { currentRequest.Size_Of_Thumbnails = 1; Output.Write("\t\t\t<a href=\"" + UrlWriterHelper.Redirect_URL(currentRequest, "thumbs") + "\" title=\"" + SMALL_THUMBNAILS + "\"><img src=\"" + Static_Resources_Gateway.Thumbs3_Gif + "\" alt=\"Small\" /></a>"); } if (thumbnailSize == 2) { Output.Write("<img src=\"" + Static_Resources_Gateway.Thumbs2_Selected_Gif + "\" alt=\"Medium\" />"); } else { currentRequest.Size_Of_Thumbnails = 2; Output.Write("<a href=\"" + UrlWriterHelper.Redirect_URL(currentRequest, "thumbs") + "\" title=\"" + MEDIUM_THUMBNAILS + "\"><img src=\"" + Static_Resources_Gateway.Thumbs2_Gif + "\" alt=\"Medium\" /></a>"); } if (thumbnailSize == 3) { Output.Write("<img src=\"" + Static_Resources_Gateway.Thumbs2_Selected_Gif + "\" alt=\"Large\" />"); } else { currentRequest.Size_Of_Thumbnails = 3; Output.Write("<a href=\"" + UrlWriterHelper.Redirect_URL(currentRequest, "thumbs") + "\" title=\"" + LARGE_THUMBNAILS + "\"><img src=\"" + Static_Resources_Gateway.Thumbs1_Gif + "\" alt=\"Large\" /></a>"); } //Reset the current mode currentRequest.Size_Of_Thumbnails = -1; Output.WriteLine("\t\t</td>"); //Add the dropdown for the thumbnail anchor within the page to directly navigate to Output.WriteLine("\t\t<td style=\"valign:top;text-align:right;font-weight:bold;padding-right: 20px;\">"); Output.WriteLine(goToThumbnail + ":"); Output.WriteLine("\t\t\t<select onchange=\"location=this.options[this.selectedIndex].value; AddAnchorDivEffect(this.options[this.selectedIndex].value);\" >"); //iterate through the page items and add each label? if (pageCount > 0) { int thumbnail_count = 0; foreach (BriefItem_FileGrouping thisFile in briefItem.Images) { string currentPageURL1 = UrlWriterHelper.Redirect_URL(currentRequest, (thumbnail_count / thumbnailsPerPage + (thumbnail_count % thumbnailsPerPage == 0 ? 0 : 1)).ToString() + "thumbs"); // Output.WriteLine("<option value=\"" + current_Page_url1 + "#" + thisFile.Label + "\">" + thisFile.Label + "</option>"); if (String.IsNullOrEmpty(thisFile.Label)) { Output.WriteLine("\t\t\t\t<option value=\"" + currentPageURL1 + "#" + thumbnail_count + "\">" + "(page " + thumbnail_count + ")" + "</option>"); } else { if (thisFile.Label.Length > 50) { Output.WriteLine("\t\t\t\t<option value=\"" + currentPageURL1 + "#" + thumbnail_count + "\">" + thisFile.Label.Substring(0, 50) + "...</option>"); } else { Output.WriteLine("\t\t\t\t<option value=\"" + currentPageURL1 + "#" + thumbnail_count + "\">" + thisFile.Label + "</option>"); } } thumbnail_count++; } } Output.WriteLine("\t\t\t</select>"); Output.WriteLine("\t\t</td>"); Output.WriteLine("\t</tr>"); Output.WriteLine("</table>"); // Finish the nav row controls Output.WriteLine("\t\t<!-- END RELATED IMAGES VIEWER NAV ROW -->"); Output.WriteLine("\t\t</td>"); Output.WriteLine("\t</tr>"); }
/// <summary> Adds any viewer_specific information to the left Navigation Bar Menu Section </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 void Write_Left_Nav_Menu_Section(TextWriter Output, Custom_Tracer Tracer) { // Do nothing }
/// <summary> Write any additional values within the HTML Head of the final served page </summary> /// <param name="Output"> Output stream currently within the HTML head tags </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public void Write_Within_HTML_Head(TextWriter Output, Custom_Tracer Tracer) { // Do nothing }
/// <summary> Constructor for a new instance of the Related_Images_ItemViewer class, used to display /// the thumbnail images (i.e., related images) associated with a digital resource </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> /// <param name="ViewerCode"> Viewer code for the related images viewer </param> public Related_Images_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer, string ViewerCode) { // Save the arguments for use later briefItem = BriefItem; currentRequest = CurrentRequest; // Get the proper number of thumbnails per page if (CurrentUser != null) { // First, pull the thumbnails per page from the user options thumbnailsPerPage = CurrentUser.Get_Setting("Related_Images_ItemViewer:ThumbnailsPerPage", 50); // Or was there a new value in the URL? if ((currentRequest.Thumbnails_Per_Page.HasValue) && (currentRequest.Thumbnails_Per_Page.Value >= -1)) { CurrentUser.Add_Setting("Related_Images_ItemViewer:ThumbnailsPerPage", currentRequest.Thumbnails_Per_Page); thumbnailsPerPage = currentRequest.Thumbnails_Per_Page.Value; } } else { int tempValue = 50; object sessionValue = HttpContext.Current.Session["Related_Images_ItemViewer:ThumbnailsPerPage"]; if (sessionValue != null) { int.TryParse(sessionValue.ToString(), out tempValue); } thumbnailsPerPage = tempValue; // Or was there a new value in the URL? if ((currentRequest.Thumbnails_Per_Page.HasValue) && (currentRequest.Thumbnails_Per_Page.Value >= -1)) { HttpContext.Current.Session["Related_Images_ItemViewer:ThumbnailsPerPage"] = currentRequest.Thumbnails_Per_Page; thumbnailsPerPage = currentRequest.Thumbnails_Per_Page.Value; } } // -1 means to display all thumbnails if (thumbnailsPerPage == -1) { thumbnailsPerPage = int.MaxValue; } // Now, reset the value in the navigation object, since we won't need to set it again currentRequest.Thumbnails_Per_Page = -100; // Get the proper size of thumbnails per page if (CurrentUser != null) { // First, pull the thumbnails per page from the user options thumbnailSize = CurrentUser.Get_Setting("Related_Images_ItemViewer:ThumbnailSize", 1); // Or was there a new value in the URL? if ((currentRequest.Size_Of_Thumbnails.HasValue) && (currentRequest.Size_Of_Thumbnails.Value > -1)) { CurrentUser.Add_Setting("Related_Images_ItemViewer:ThumbnailSize", currentRequest.Size_Of_Thumbnails); thumbnailSize = currentRequest.Size_Of_Thumbnails.Value; } } else { int tempValue = 1; object sessionValue = HttpContext.Current.Session["Related_Images_ItemViewer:ThumbnailSize"]; if (sessionValue != null) { int.TryParse(sessionValue.ToString(), out tempValue); } thumbnailSize = tempValue; // Or was there a new value in the URL? if ((currentRequest.Size_Of_Thumbnails.HasValue) && (currentRequest.Size_Of_Thumbnails.Value > -1)) { HttpContext.Current.Session["Related_Images_ItemViewer:ThumbnailSize"] = currentRequest.Size_Of_Thumbnails; thumbnailSize = currentRequest.Size_Of_Thumbnails.Value; } } // Now, reset the value in the navigation object, since we won't need to set it again currentRequest.Size_Of_Thumbnails = -1; // Get the number of thumbnails for this item pageCount = briefItem.Images != null ? briefItem.Images.Count : 0; // Determine the page page = 1; if (!String.IsNullOrEmpty(CurrentRequest.ViewerCode)) { int tempPageParse; if (Int32.TryParse(CurrentRequest.ViewerCode.Replace(ViewerCode.Replace("#", ""), ""), out tempPageParse)) { page = tempPageParse; } } // Just a quick range check if (page > pageCount) { page = 1; } }
/// <summary> Creates and returns the an instance of the <see cref="JPEG2000_ItemViewer"/> class for showing a zoomable /// JPEG2000 image from a page within a digital resource during execution of a single HTTP request. </summary> /// <param name="CurrentItem"> 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> /// <returns> Fully built and initialized <see cref="JPEG2000_ItemViewer"/> object </returns> /// <remarks> This method is called whenever a request requires the actual viewer to be created to render the HTML for /// the digital resource requested. The created viewer is then destroyed at the end of the request </remarks> public iItemViewer Create_Viewer(BriefItemInfo CurrentItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer) { return(new JPEG2000_ItemViewer(CurrentItem, CurrentUser, CurrentRequest, Tracer, ViewerCode, FileExtensions)); }
/// <summary> This is an opportunity to write HTML directly into the main form, without /// using the pop-up html form architecture </summary> /// <param name="Output"> Textwriter to write the pop-up form HTML for this viewer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This text will appear within the ItemNavForm form tags </remarks> public override void Write_ItemNavForm_Closing(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Default_Metadata_AdminViewer.Write_ItemNavForm_Closing", "Add any popup divisions for form elements"); Output.WriteLine("<!-- Default_Metadata_AdminViewer.Write_ItemNavForm_Closing -->"); // Add the scripts needed Output.WriteLine("<script type=\"text/javascript\" src=\"" + Static_Resources_Gateway.Jquery_Ui_1_10_3_Custom_Js + "\"></script>"); // Add the hidden field Output.WriteLine("<!-- Hidden field is used for postbacks to indicate what to save -->"); Output.WriteLine("<input type=\"hidden\" id=\"admin_project_tosave\" name=\"admin_project_tosave\" value=\"\" />"); Output.WriteLine("<input type=\"hidden\" id=\"admin_project_delete\" name=\"admin_project_delete\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- Default_Metadata Rename Form -->"); Output.WriteLine("<div class=\"sbkPav_PopupDiv\" id=\"form_project\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"sbkAdm_PopupTitle\"><table style=\"width:100%\"><tr><td style=\"text-align:left;\">RENAME DEFAULT METADATA</td><td style=\"text-align:right;\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"project_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for code Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:120px;\"><label for=\"form_project_code\">Code:</label></td>"); Output.WriteLine(" <td><span class=\"form_linkline admin_existing_code_line\" id=\"form_project_code\"></span></td>"); Output.WriteLine(" </tr>"); // Add line for name Output.WriteLine(" <tr>"); Output.WriteLine(" <td><label for=\"form_project_name\">Name:</label></td>"); Output.WriteLine(" <td><input class=\"sbkPav_large_input sbkAdmin_Focusable\" name=\"form_project_name\" id=\"form_project_name\" type=\"text\" value=\"\" /></td>"); Output.WriteLine(" </tr>"); // Add line for description Output.WriteLine(" <tr class=\"sbkPav_descriptionRow\">"); Output.WriteLine(" <td><label for=\"form_project_desc\">Description:</label></td>"); Output.WriteLine(" <td><textarea class=\"sbkPav_textarea sbkAdmin_Focusable\" name=\"form_project_desc\" id=\"form_project_desc\" type=\"text\" ></textarea></td>"); Output.WriteLine(" </tr>"); // Add the buttons and close the table Output.WriteLine(" <tr style=\"height:35px; text-align: center; vertical-align: bottom;\">"); Output.WriteLine(" <td colspan=\"2\"> "); Output.WriteLine(" <button title=\"Do not apply changes\" class=\"sbkAdm_RoundButton\" onclick=\"return project_form_close();\"><img src=\"" + Static_Resources_Gateway.Button_Previous_Arrow_Png + "\" class=\"sbkAdm_RoundButton_LeftImg\" alt=\"\" /> CANCEL</button> "); Output.WriteLine(" <button title=\"Save changes to this default metadata\" class=\"sbkAdm_RoundButton\" type=\"submit\">SAVE <img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine("</div>"); Output.WriteLine(); Tracer.Add_Trace("Default_Metadata_AdminViewer.Write_ItemNavForm_Closing", "Write the rest of the form html"); Output.WriteLine("<script src=\"" + Static_Resources_Gateway.Sobekcm_Admin_Js + "\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"sbkAdm_HomeText\">"); if (actionMessage.Length > 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <div id=\"sbkAdm_ActionMessage\">" + actionMessage + "</div>"); } Output.WriteLine(" <p>For clarification of any terms on this form, <a href=\"" + UI_ApplicationCache_Gateway.Settings.System.Help_URL(RequestSpecificValues.Current_Mode.Base_URL) + "adminhelp/projects\" target=\"PROJECTS_INTERFACE_HELP\" >click here to view the help page</a>.</p>"); Output.WriteLine(" <h2>New Default Metadata</h2>"); Output.WriteLine(" <div class=\"sbkPav_NewDiv\">"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for code Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:120px;\"><label for=\"admin_project_code\">Metadata Code:</label></td>"); Output.WriteLine(" <td><input class=\"sbkPav_small_input sbkAdmin_Focusable\" name=\"admin_project_code\" id=\"admin_project_code\" type=\"text\" value=\"" + entered_code + "\" /></td>"); Output.WriteLine(" </tr>"); // Add line for basecode Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:120px;\"><label for=\"admin_project_code\">Base Metadata:</label></td>"); Output.WriteLine(" <td><select class=\"sbkPav_select\" name=\"admin_project_base\" id=\"admin_project_base\">"); Output.WriteLine(" <option value=\"\" selected=\"selected\">(none)</option>"); foreach (Default_Metadata thisSet in UI_ApplicationCache_Gateway.Global_Default_Metadata) { if (String.Compare(thisSet.Code, "NONE", true) != 0) { if (entered_base == thisSet.Code) { Output.Write(" <option value=\"" + thisSet.Code + "\" selected=\"selected\" >" + thisSet.Code + " - " + thisSet.Name + "</option>"); } else { Output.Write(" <option value=\"" + thisSet.Code + "\" >" + thisSet.Code + " - " + thisSet.Name + "</option>"); } } } Output.WriteLine(" </select>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); // Add line for name Output.WriteLine(" <tr>"); Output.WriteLine(" <td><label for=\"admin_project_name\">Name:</label></td>"); Output.WriteLine(" <td><input class=\"sbkPav_large_input sbkAdmin_Focusable\" name=\"admin_project_name\" id=\"admin_project_name\" type=\"text\" value=\"" + entered_name + "\" /></td>"); Output.WriteLine(" <tr>"); // Add line for description Output.WriteLine(" <tr class=\"sbkPav_descriptionRow\">"); Output.WriteLine(" <td><label for=\"admin_project_desc\">Description:</label></td>"); Output.WriteLine(" <td><textarea class=\"sbkPav_textarea sbkAdmin_Focusable\" name=\"admin_project_desc\" id=\"admin_project_desc\"/>" + entered_desc + "</textarea></td>"); Output.WriteLine(" <tr>"); // Add the SAVE button Output.WriteLine(" <tr style=\"height:30px; text-align: center;\"><td colspan=\"2\"><button title=\"Save new default metadata\" class=\"sbkAdm_RoundButton\" onclick=\"return save_new_project();\">SAVE <img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(" <br />"); Output.WriteLine(); if (UI_ApplicationCache_Gateway.Global_Default_Metadata.Count > 0) { // Add all the existing proejcts Output.WriteLine(" <h2>Existing Global Default Metadata Sets</h2>"); Output.WriteLine(" <p>The following global default metadata sets can be edited, renamed, or deleted below:</p>"); Output.WriteLine(" <table class=\"sbkPav_Table sbkAdm_Table\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <th class=\"sbkPav_TableHeader1\">ACTIONS</th>"); Output.WriteLine(" <th class=\"sbkPav_TableHeader2\">CODE</th>"); Output.WriteLine(" <th class=\"sbkPav_TableHeader3\">NAME</th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); RequestSpecificValues.Current_Mode.My_Sobek_SubMode = "XXXXXXX"; string redirect = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode); // Write the data for each interface foreach (Default_Metadata thisSet in UI_ApplicationCache_Gateway.Global_Default_Metadata) { // Build the action links Output.WriteLine(" <tr>"); Output.Write(" <td class=\"sbkAdm_ActionLink\" >( "); Output.Write("<a title=\"Click to edit this default metadata\" href=\"" + redirect.Replace("XXXXXXX", "1" + thisSet.Code) + "\" >edit</a> | "); Output.Write("<a title=\"Click to change the name of this default metadata\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return project_form_popup('" + thisSet.Code + "','" + thisSet.Name.Replace("'", """) + "', '" + thisSet.Description.Replace("'", """) + "');\">rename</a> "); if (String.Compare(thisSet.Code, "none", StringComparison.OrdinalIgnoreCase) != 0) { if (RequestSpecificValues.Current_User.Is_System_Admin) { Output.WriteLine("| <a title=\"Click to delete this default metadata\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_project('" + thisSet.Code + "');\">delete</a> )</td>"); } else { Output.WriteLine("| <a title=\"Only SYSTEM administrators can delete default metadata\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"alert('Only SYSTEM administrators can delete default metadata'); return false;\">delete</a> )</td>"); } } else { Output.WriteLine(")</td>"); } // Add the rest of the row with data Output.WriteLine(" <td>" + thisSet.Code + "</td>"); Output.WriteLine(" <td>" + thisSet.Name + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td></td><td colspan=\"2\" class=\"sbkPav_DescriptionCell\">" + HttpUtility.HtmlEncode(thisSet.Description) + "</td></tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); } Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); } Output.WriteLine("</div>"); Output.WriteLine(); }
private void add_usage_definitions(TextWriter Output, Custom_Tracer Tracer) { // See if the FAQ is present for this collection string directory = SobekCM_Library_Settings.Base_Design_Location + "\\extra\\stats"; string usageDefinitions = String.Empty; if (Directory.Exists(directory)) { if (File.Exists(directory + "\\stats_usage_definitions.txt")) { if (Tracer != null) { Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_usage_definitions", "Loading usage definitions"); } try { StreamReader faqReader = new StreamReader(directory + "\\stats_usage_definitions.txt"); usageDefinitions = faqReader.ReadToEnd(); faqReader.Close(); } catch (Exception) { // If there is an error here, no problem.. just uses the default } } } if (usageDefinitions.Length > 0) { string urloptions = currentMode.URL_Options(); if (urloptions.Length > 0) { urloptions = "?" + urloptions; } if (Tracer != null) { Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_usage_definitions", "Rendering HTML read from source file"); } Output.WriteLine("<div class=\"SobekText\">"); Output.WriteLine(usageDefinitions.Replace("<%BASEURL%>", currentMode.Base_URL).Replace("<%?URLOPTS%>", urloptions)); Output.WriteLine("</div>"); } else { if (Tracer != null) { Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_usage_definitions", "Rendering Default HTML"); } Output.WriteLine("<div class=\"SobekText\">"); Output.WriteLine("<p>The following terms are defined below:</p>"); Output.WriteLine("<table width=\"600px\" border=\"0\" align=\"center\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td><a href=\"#Collection_Hierarchy\">Collection Hierarchy</a></td>"); Output.WriteLine(" <td><a href=\"#Collection_Groups\">Collection Groups</a></td>"); Output.WriteLine(" <td><a href=\"#Collections\">Collections</a></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td><a href=\"#SubCollections\">SubCollections</a></td>"); Output.WriteLine(" <td><a href=\"#Views\">Views</a></td>"); Output.WriteLine(" <td><a href=\"#Visits\">Visits</a></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td><a href=\"#Main_Pages\">Main Pages</a></td>"); Output.WriteLine(" <td><a href=\"#Browses\">Browses</a></td>"); Output.WriteLine(" <td><a href=\"#Titles_Items\">Titles and Items</a></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td><a href=\"#Title_Views\">Title Views</a></td>"); Output.WriteLine(" <td><a href=\"#Item_Views\">Item Views</a></td>"); Output.WriteLine(" <td><a href=\"#Citation_Views\">Citation Views</a></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td><a href=\"#Text_Searches\">Text Searches</a></td>"); Output.WriteLine(" <td><a href=\"#Static_Views\">Static Views</a></td>"); Output.WriteLine(" <td> </td>"); Output.WriteLine(" </tr>"); Output.WriteLine("</table>"); Output.WriteLine("<h2>Defined Terms</h2>"); Output.WriteLine(); Output.WriteLine("<a name=\"Collection_Hierarchy\" ></a>"); Output.WriteLine("<h3>COLLECTION HIERARCHY</h3>"); Output.WriteLine("<p>Collections are organized by Collection Groups, which contain Collections and Collections contain Subcollections. This hierarchical organization allows for general searches and browses at the Collection Group level and for granular searches at the Collection level for optimum usability for multiple user needs. <br /><br />"); Output.WriteLine("In reading the statistics by Collection, views and searches done from the main page and the Collection Group pages are not within collections and so are not included in the Collection statistics.</p>"); Output.WriteLine("<a name=\"Collection_Groups\" ></a>"); Output.WriteLine("<h3>COLLECTION GROUPS</h3>"); Output.WriteLine("<p>Collection groups are aggregations of collections in this library. The Collection Groups simplify searching across multiple Collections simultaneously. Collection Groups also connect less tightly related materials to increase the likelihood for serendipity, where users may be searching for one topic and may easily stumble across something related and critically useful that they had not considered. Thus, Collection Groups are usually constructed topically. <br /><br />"); Output.WriteLine("As an aggregate, views at the Collection Group level do not count toward any particular Collection and are not included in the Collection based statistics.</p>"); Output.WriteLine("<a name=\"Collections\" ></a>"); Output.WriteLine("<h3>COLLECTIONS</h3>"); Output.WriteLine("<p>Collections are the main method for defining and collecting related materials and are the most familiar hierarchical structures for subject specialists, partners, and other internal users. A single Collection can exist in several Collection Groups, and a single Collection can have many subcollections. <br /><br />"); Output.WriteLine("A single item may be in several Collections, but one Collection is always selected as primary so all item views will be within a single Collection. </p>"); Output.WriteLine("<a name=\"SubCollections\" ></a>"); Output.WriteLine("<h3>SUBCOLLECTIONS</h3>"); Output.WriteLine("<p>The smallest collected unit is the Subcollection. A single item can belong to several Subcollections under the same collection, or to multiple Collections and to Subcollections within each Collection. <br /><br />"); Output.WriteLine("Because all Subcollection items will have a primary Collection, the usage statistics for Subcollections are also included in the Collection usage statistics. </p>"); Output.WriteLine("<a name=\"Views\" ></a>"); Output.WriteLine("<h3>VIEWS</h3>"); Output.WriteLine("<p>Views are the actual page hits. Each time a person goes to " + currentMode.SobekCM_Instance_Abbreviation + " it counts as a view. The " + currentMode.SobekCM_Instance_Abbreviation + " statistics are cleaned so that views from robots, which search engines use to index websites, are removed. If they were not removed, the views on all collections and items would be much higher. Web usage statistics are always somewhat fallible, and this is one of the means for ensuring better quality usage statistics. <br /><br />"); Output.WriteLine("Some web statistics count "page item downloads" as views, which is highly inaccurate because each page has multiple items on it. For instance, the digital library main page, " + currentMode.SobekCM_Instance_Abbreviation + ", includes the page HTML and all of the images. If the statistics counted each “page item download” as a hit, each single view to the main page would be counted as over 30 “page item downloads.” To make matters more confusing, some digital repositories only offer PDF downloads for users to view items. Those digital repositories track "item downloads" and those are most equivalent to our statistics for usage by "item." </p>"); Output.WriteLine("<a name=\"Visits\" ></a>"); Output.WriteLine("<h3>VISITS</h3>"); Output.WriteLine("<p>Each time a person goes to this digital library it counts as a view, but that means a single user going to the site repeatedly can log a large number of views. Visits provide a better statistic for how many different “unique” users are using the site. Visits include all views from a particular IP address (the user’s computer web address when connected) as recorded in the web log file within an hour. <br /><br />"); Output.WriteLine("This is also a fallible statistic since users’ IP addresses are frequently reused on networks. Connecting to free wireless means that network gives your computer an IP address, and then when you disconnect that IP address will be given to the next user who needs it. For a campus based resource with so many on campus users connecting through the VPN or from on campus, the margin for error increases for visit-based statistics. </p>"); Output.WriteLine("<a name=\"Main_Pages\" ></a>"); Output.WriteLine("<h3>MAIN PAGES</h3>"); Output.WriteLine("<p>For each of the elements in the Collection Hierarchy, the main pages are the home or landing pages, the search pages, the contact pages, and any other supplemental pages. <br /><br />"); Output.WriteLine("When users conduct a search through the Collection pages and view the results, those search result pages are also included in the main pages. Once a user clicks on one of the items in the search results, that item is not one of the main pages. The views for search results by thumbnail, table, and brief modes are all included in the main pages for the Collection.</p>"); Output.WriteLine("<a name=\"Browses\" ></a>"); Output.WriteLine("<h3>BROWSES</h3>"); Output.WriteLine("<p>Browses include views against standard browses, such as <i>All Items</i> and <i>New Items</i> (when available). It also includes all views of non-standard browses.</p>"); Output.WriteLine("<a name=\"Search_Results\" ></a>"); Output.WriteLine("<h3>SEARCH RESULTS</h3>"); Output.WriteLine("<p>Search result views includes every view of a section of search results, and includes searches which returned zero results.</p>"); Output.WriteLine("<a name=\"Titles_Items\" ></a>"); Output.WriteLine("<h3>TITLES & ITEMS</h3>"); Output.WriteLine("<p>Titles are for single bibliographic units, like a book or a newspaper. Items are the volumes within titles. Thus, one book may have one title and one item where one newspaper may have one title and thousands of items. <br /><br />"); Output.WriteLine("Titles with only one item (or volume) appear functionally equivalent to users. However for items like newspapers, a single title may correspond to thousands of items. <br /><br />"); Output.WriteLine("Readers of the technical documentation and internal users know titles by their bibliographic identifier (BIBID) and items within each title by the BIBID plus the volume identifier (VID).</p>"); Output.WriteLine("<a name=\"Title_Views\" ></a>"); Output.WriteLine("<h3>TITLE VIEWS</h3>"); Output.WriteLine("<p>Title views include all views at the title level.</p>"); Output.WriteLine("<a name=\"Item_Views\" ></a>"); Output.WriteLine("<h3>ITEM VIEWS</h3>"); Output.WriteLine("<p>Item views include views at the item level only.</p>"); Output.WriteLine("<a name=\"Citation_Views\" ></a>"); Output.WriteLine("<h3>CITATION VIEWS</h3>"); Output.WriteLine("<p>For each item, the default view is set to the page item (zoomable or static based on user selection and the availability of each of the views for that item). All items also include a “Citation View” that is not selected by default. The “Citation Views” counts the number of times a user chooses the “Citation View” for an item.</p>"); Output.WriteLine("<a name=\"Text_Searches\" ></a>"); Output.WriteLine("<h3>TEXT SEARCHES</h3>"); Output.WriteLine("<p>Text searches are item-level searches within the text of a single document. This returns the pages upon which the term or terms appear.</p>"); Output.WriteLine("<a name=\"Static_Views\" ></a>"); Output.WriteLine("<h3>STATIC VIEWS</h3>"); Output.WriteLine("<p>For each item in this library, a static page is generated for search engines to index. When an item appears in the search results in a standard search engine, the link forwards the user to the static page. Any additional navigation moves the user into the dynamically generated pages within this library. Attempts have been made to remove all the search engine indexing views from these numbers. These numbers represent the number of users that entered this library from a search engine.</p>"); Output.WriteLine("</div>"); } }
/// <summary> This is an opportunity to write HTML directly into the main form, without /// using the pop-up html form architecture </summary> /// <param name="Output"> Textwriter to write the pop-up form HTML for this viewer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This text will appear within the ItemNavForm form tags </remarks> public override void Write_ItemNavForm_Closing(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Thematic_Headings_AdminViewer.Write_ItemNavForm_Closing", "Add any popup divisions for form elements"); Output.WriteLine("<!-- Thematic_Headings_AdminViewer.Write_ItemNavForm_Closing -->"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + Static_Resources_Gateway.Jquery_Ui_1_10_3_Custom_Js + "\"></script>"); // Add the hidden field Output.WriteLine("<!-- Hidden field is used for postbacks to indicate what to save and reset -->"); Output.WriteLine("<input type=\"hidden\" id=\"admin_heading_action\" name=\"admin_heading_action\" value=\"\" />"); Output.WriteLine("<input type=\"hidden\" id=\"admin_heading_tosave\" name=\"admin_heading_tosave\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- Thematic Heading Edit Form -->"); Output.WriteLine("<div class=\"sbkThav_PopupDiv\" id=\"form_heading\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"sbkAdm_PopupTitle\"><table style=\"width:100%;\"><tr><td style=\"text-align: left;\">EDIT THEMATIC HEADING</td><td style=\"text-align:right;\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"heading_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for heading Output.WriteLine(" <tr><td style=\"width: 80px;\"><label for=\"form_heading_name\">Heading:</label></td><td colspan=\"2\"><input class=\"sbkThav_input sbkAdmin_Focusable\" name=\"form_heading_name\" id=\"form_heading_name\" type=\"text\" value=\"\" /></td></tr>"); // Add the buttons Output.WriteLine(" <tr style=\"height:35px; text-align: center; vertical-align: bottom;\">"); Output.WriteLine(" <td colspan=\"2\">"); Output.WriteLine(" <button title=\"Do not apply changes\" class=\"sbkAdm_RoundButton\" onclick=\"return heading_form_close();\"><img src=\"" + Static_Resources_Gateway.Button_Previous_Arrow_Png + "\" class=\"sbkAdm_RoundButton_LeftImg\" alt=\"\" /> CANCEL</button> "); Output.WriteLine(" <button title=\"Save changes to this existing thematic heading\" class=\"sbkAdm_RoundButton\" type=\"submit\">SAVE <img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button> "); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine("</div>"); Output.WriteLine(); Tracer.Add_Trace("Thematic_Headings_AdminViewer.Write_ItemNavForm_Closing", "Write the rest of the form "); Output.WriteLine("<script src=\"" + Static_Resources_Gateway.Sobekcm_Admin_Js + "\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"sbkAdm_HomeText\">"); if (actionMessage.Length > 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <div id=\"sbkAdm_ActionMessage\">" + actionMessage + "</div>"); } Output.WriteLine(" <p>Thematic headings are the headings on the main library home page, under which all the item aggregation icons appear.</p>"); Output.WriteLine(" <p>For more information about thematic headings, <a href=\"" + UI_ApplicationCache_Gateway.Settings.System.Help_URL(RequestSpecificValues.Current_Mode.Base_URL) + "adminhelp/headings\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</p>"); Output.WriteLine(); Output.WriteLine(" <h2>New Thematic Heading</h2>"); Output.WriteLine(" <div class=\"sbkThav_NewDiv\">"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td><label for=\"admin_heading_name\">Heading:</label></td>"); Output.WriteLine(" <td><input class=\"sbkThav_input sbkAdmin_Focusable\" name=\"admin_heading_name\" id=\"admin_heading_name\" type=\"text\" value=\"\" /></td>"); Output.WriteLine(" <td><button title=\"Save new thematic heading\" class=\"sbkAdm_RoundButton\" onclick=\"return save_new_heading();\">SAVE <img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <h2>Existing Thematic Headings</h2>"); Output.WriteLine(" <table class=\"sbkThav_Table sbkAdm_Table\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <th class=\"sbkThav_TableHeader1\">ACTIONS</th>"); Output.WriteLine(" <th class=\"sbkThav_TableHeader2\">REORDER</th>"); Output.WriteLine(" <th class=\"sbkThav_TableHeader3\">THEMATIC HEADING</th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); // Write the data for each interface int current_order = 1; foreach (Thematic_Heading thisTheme in UI_ApplicationCache_Gateway.Thematic_Headings) { // Build the action links Output.WriteLine(" <tr style=\"text-align:left;\" >"); Output.Write(" <td class=\"sbkAdm_ActionLink\" >( "); Output.Write("<a title=\"Click to edit\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return heading_form_popup('" + thisTheme.Text + "','" + thisTheme.ID + "');\">edit</a> | "); Output.WriteLine("<a title=\"Delete this thematic heading\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_heading('" + thisTheme.ID + "', '" + thisTheme.Text.Replace("\'", "") + "');\">delete</a> )</td>"); Output.Write(" <td class=\"sbkAdm_ActionLink\">( "); Output.Write("<a title=\"Move this heading up in the order\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return move_heading_up('" + thisTheme.ID + "', '" + current_order + "');\">up</a> | "); Output.WriteLine("<a title=\"Move this heading down in the order\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return move_heading_down('" + thisTheme.ID + "', '" + current_order + "');\">down</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td>" + thisTheme.Text + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); current_order++; } Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
/// <summary> Verifies that each global object is built and builds them upon request </summary> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <param name="Reload_All"> Flag indicates if everything should be reloaded/repopulated</param> /// <param name="Skins"> [REF] Collection of all the web skins </param> /// <param name="Translator"> [REF] Language support object which handles simple translational duties </param> /// <param name="Code_Manager"> [REF] List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param> /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library </param> /// <param name="Icon_Dictionary"> [REF] Dictionary of information about every wordmark/icon in this digital library </param> /// <param name="Stats_Date_Range"> [REF] Object contains the start and end dates for the statistical data in the database </param> /// <param name="Thematic_Headings"> [REF] Headings under which all the highlighted collections on the main home page are organized </param> /// <param name="Aggregation_Aliases"> [REF] List of all existing aliases for existing aggregations </param> /// <param name="IP_Restrictions"> [REF] List of all IP Restriction ranges in use by this digital library </param> /// <param name="URL_Portals"> [REF] List of all web portals into this system </param> /// <param name="Mime_Types">[REF] Dictionary of MIME types by extension</param> public static void Build_Application_State(Custom_Tracer Tracer, bool Reload_All, ref SobekCM_Skin_Collection Skins, ref Language_Support_Info Translator, ref Aggregation_Code_Manager Code_Manager, ref Item_Lookup_Object All_Items_Lookup, ref Dictionary <string, Wordmark_Icon> Icon_Dictionary, ref Statistics_Dates Stats_Date_Range, ref List <Thematic_Heading> Thematic_Headings, ref Dictionary <string, string> Aggregation_Aliases, ref IP_Restriction_Ranges IP_Restrictions, ref Portal_List URL_Portals, ref Dictionary <string, Mime_Type_Info> Mime_Types, ref List <string> Item_Viewer_Priority) { // Should we reload the data from the exteral configuraiton file? if (Reload_All) { SobekCM_Library_Settings.Read_Configuration_File(); if (SobekCM_Library_Settings.Database_Connections.Count > 0) { SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; } SobekCM_Library_Settings.Refresh(SobekCM_Database.Get_Settings_Complete(null)); } // If there is no database connection string, there is a problem if ((SobekCM_Library_Settings.Database_Connections.Count == 0) || (String.IsNullOrEmpty(SobekCM_Library_Settings.Database_Connections[0].Connection_String))) { throw new ApplicationException("Missing database connection string!"); } // Set the database connection strings Resource_Object.Database.SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; // Set the workflow and disposition types if ((SobekCM_Library_Settings.Need_Workflow_And_Disposition_Types) || (Reload_All)) { SobekCM_Library_Settings.Set_Workflow_And_Disposition_Types(SobekCM_Database.All_WorkFlow_Types, SobekCM_Database.All_Possible_Disposition_Types); } // Set the metadata types if ((SobekCM_Library_Settings.Need_Metadata_Types) || (Reload_All)) { SobekCM_Library_Settings.Set_Metadata_Types(SobekCM_Database.Get_Metadata_Fields(null)); } // Set the search stop words if ((SobekCM_Library_Settings.Need_Search_Stop_Words) || (Reload_All)) { SobekCM_Library_Settings.Search_Stop_Words = SobekCM_Database.Search_Stop_Words(Tracer); } // Check the list of thematic headings if ((Thematic_Headings == null) || (Reload_All)) { if (Thematic_Headings != null) { lock (Thematic_Headings) { if (!SobekCM_Database.Populate_Thematic_Headings(Thematic_Headings, Tracer)) { Thematic_Headings = null; throw SobekCM_Database.Last_Exception; } } } else { Thematic_Headings = new List <Thematic_Heading>(); if (!SobekCM_Database.Populate_Thematic_Headings(Thematic_Headings, Tracer)) { Thematic_Headings = null; throw SobekCM_Database.Last_Exception; } } } // Check the list of forwardings if ((Aggregation_Aliases == null) || (Reload_All)) { if (Aggregation_Aliases != null) { lock (Aggregation_Aliases) { SobekCM_Database.Populate_Aggregation_Aliases(Aggregation_Aliases, Tracer); } } else { Aggregation_Aliases = new Dictionary <string, string>(); SobekCM_Database.Populate_Aggregation_Aliases(Aggregation_Aliases, Tracer); } } // Check the list of constant skins if ((Skins == null) || (Skins.Count == 0) || (Reload_All)) { if (Skins != null) { lock (Skins) { SobekCM_Skin_Collection_Builder.Populate_Default_Skins(Skins, Tracer); } } else { Skins = new SobekCM_Skin_Collection(); SobekCM_Skin_Collection_Builder.Populate_Default_Skins(Skins, Tracer); } } // Check the list of all web portals if ((URL_Portals == null) || (URL_Portals.Count == 0) || (Reload_All)) { if (URL_Portals != null) { lock (URL_Portals) { SobekCM_Database.Populate_URL_Portals(URL_Portals, Tracer); } } else { URL_Portals = new Portal_List(); SobekCM_Database.Populate_URL_Portals(URL_Portals, Tracer); } } // Check the translation table has been loaded if ((Translator == null) || (Reload_All)) { // Get the translation hashes into memory if (Translator != null) { lock (Translator) { SobekCM_Database.Populate_Translations(Translator, Tracer); } } else { Translator = new Language_Support_Info(); SobekCM_Database.Populate_Translations(Translator, Tracer); } } // Check that the conversion from SobekCM Codes to Greenstone Codes has been loaded if ((Code_Manager == null) || (Reload_All)) { if (Code_Manager != null) { lock (Code_Manager) { SobekCM_Database.Populate_Code_Manager(Code_Manager, Tracer); } } else { Code_Manager = new Aggregation_Code_Manager(); SobekCM_Database.Populate_Code_Manager(Code_Manager, Tracer); } } // Check the statistics date range information if ((Stats_Date_Range == null) || (Reload_All)) { if (Stats_Date_Range != null) { // Get the translation hashes into memory lock (Stats_Date_Range) { SobekCM_Database.Populate_Statistics_Dates(Stats_Date_Range, Tracer); } } else { Stats_Date_Range = new Statistics_Dates(); SobekCM_Database.Populate_Statistics_Dates(Stats_Date_Range, Tracer); } } // Get the Icon list if ((Icon_Dictionary == null) || (Reload_All)) { if (Icon_Dictionary != null) { // Get the translation hashes into memory lock (Icon_Dictionary) { SobekCM_Database.Populate_Icon_List(Icon_Dictionary, Tracer); } } else { Icon_Dictionary = new Dictionary <string, Wordmark_Icon>(); SobekCM_Database.Populate_Icon_List(Icon_Dictionary, Tracer); } } // Check the list of ip range restrictions if ((IP_Restrictions == null) || (Reload_All)) { if (IP_Restrictions != null) { lock (IP_Restrictions) { DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } } } else { DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions = new IP_Restriction_Ranges(); IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } } } // Get the MIME type list if ((Mime_Types == null) || (Reload_All)) { if (Mime_Types != null) { // Get the translation hashes into memory lock (Mime_Types) { SobekCM_Database.Populate_MIME_List(Mime_Types, Tracer); } } else { Mime_Types = new Dictionary <string, Mime_Type_Info>(); SobekCM_Database.Populate_MIME_List(Mime_Types, Tracer); } } // Check the list of forwardings if ((Item_Viewer_Priority == null) || (Reload_All)) { if (Item_Viewer_Priority != null) { lock (Item_Viewer_Priority) { Item_Viewer_Priority = SobekCM_Database.Get_Viewer_Priority(Tracer); } } else { Item_Viewer_Priority = SobekCM_Database.Get_Viewer_Priority(Tracer); } } // Check the IE hack CSS is loaded if ((HttpContext.Current.Application["NonIE_Hack_CSS"] == null) || (Reload_All)) { string css_file = HttpContext.Current.Server.MapPath("default/SobekCM_NonIE.css"); if (File.Exists(css_file)) { try { StreamReader reader = new StreamReader(css_file); HttpContext.Current.Application["NonIE_Hack_CSS"] = reader.ReadToEnd().Trim(); reader.Close(); } catch (Exception) { HttpContext.Current.Application["NonIE_Hack_CSS"] = "/* ERROR READING FILE: default/SobekCM_NonIE.css */"; throw; } } else { HttpContext.Current.Application["NonIE_Hack_CSS"] = String.Empty; } } }
/// <summary> This is an opportunity to write HTML directly into the main form, without /// using the pop-up html form architecture </summary> /// <param name="Output"> Textwriter to write the pop-up form HTML for this viewer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This text will appear within the ItemNavForm form tags </remarks> public override void Write_ItemNavForm_Closing(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Aggregations_Mgmt_AdminViewer.Write_ItemNavForm_Closing", ""); Output.WriteLine("<script type=\"text/javascript\" src=\"" + Static_Resources_Gateway.Jquery_Ui_1_10_3_Custom_Js + "\"></script>"); // Add the hidden field Output.WriteLine("<!-- Hidden field is used for postbacks to indicate what to save and reset -->"); Output.WriteLine("<input type=\"hidden\" id=\"admin_aggr_tosave\" name=\"admin_aggr_tosave\" value=\"\" />"); Output.WriteLine("<input type=\"hidden\" id=\"admin_aggr_reset\" name=\"admin_aggr_reset\" value=\"\" />"); Output.WriteLine("<input type=\"hidden\" id=\"admin_aggr_delete\" name=\"admin_aggr_delete\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- Aggregations_Mgmt_AdminViewer.Write_ItemNavForm_Closing -->"); Output.WriteLine("<script src=\"" + Static_Resources_Gateway.Sobekcm_Admin_Js + "\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"sbkAdm_HomeText\">"); // Add the action message, if there is one if (!String.IsNullOrEmpty(actionMessage)) { // If this is an error, show it differently if (actionMessage.IndexOf("Error", StringComparison.InvariantCultureIgnoreCase) >= 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <div id=\"sbkAdm_ActionMessageError\">" + actionMessage + "</div>"); } else { Output.WriteLine(" <br />"); Output.WriteLine(" <div id=\"sbkAdm_ActionMessageSuccess\">" + actionMessage + "</div>"); } } Output.WriteLine(" <p>For clarification of any terms on this form, <a href=\"" + UI_ApplicationCache_Gateway.Settings.System.Help_URL(RequestSpecificValues.Current_Mode.Base_URL) + "adminhelp/aggregations\" target=\"ADMIN_INTERFACE_HELP\" >click here to view the help page</a>.</p>"); Output.WriteLine(" <h2>New Item Aggregation</h2>"); RequestSpecificValues.Current_Mode.Admin_Type = Admin_Type_Enum.Add_Collection_Wizard; string wizard_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode); RequestSpecificValues.Current_Mode.Admin_Type = Admin_Type_Enum.Aggregations_Mgmt; Output.WriteLine(" <table>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td>"); Output.WriteLine(" <p>Use the new <a href=\"" + wizard_url + "\">Add New Collection Wizard</a> to add a single new collection.</p>"); if (!addedNewCollection) { Output.WriteLine(" <span id=\"oldnewdivprompt\" style=\"display:block;\"><p>Alternatively, you can use the reduced interface below by <a href=\"\" onclick=\"$('#oldnewdiv').css('display', 'block');$('#oldnewdivprompt').css('display', 'none');return false;\">clicking here</a>.</p></span>"); } Output.WriteLine(" </td>"); Output.WriteLine(" <td style=\"padding-left: 30px;\">"); Output.WriteLine(" <button title=\"Use the wizard to add a new collection\" class=\"sbkAdm_RoundButton\" onclick=\"window.location.href='" + wizard_url + "';return false;\"> NEW COLLECTION <br />WIZARD</button>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); if (addedNewCollection) { Output.WriteLine(" <div class=\"sbkAsav_NewDiv\" id=\"oldnewdiv\" style=\"display:block;\">"); } else { Output.WriteLine(" <div class=\"sbkAsav_NewDiv\" id=\"oldnewdiv\" style=\"display:none;\">"); } Output.WriteLine(" <br /><br />"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for aggregation code and aggregation type Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:120px;\"><label for=\"admin_aggr_code\">Code:</label></td>"); Output.WriteLine(" <td><input class=\"sbkAsav_small_input sbkAdmin_Focusable\" name=\"admin_aggr_code\" id=\"admin_aggr_code\" type=\"text\" value=\"" + enteredCode + "\" /></td>"); Output.WriteLine(" <td style=\"width:300px;text-align:right;\">"); Output.WriteLine(" <label for=\"admin_aggr_type\">Type:</label> "); Output.WriteLine(" <select class=\"sbkAsav_select \" name=\"admin_aggr_type\" id=\"admin_aggr_type\" onchange=\"return aggr_display_external_link(this);\">"); if (enteredType == String.Empty) { Output.WriteLine(" <option value=\"\" selected=\"selected\" ></option>"); } Output.WriteLine(enteredType == "coll" ? " <option value=\"coll\" selected=\"selected\" >Collection</option>" : " <option value=\"coll\">Collection</option>"); Output.WriteLine(enteredType == "group" ? " <option value=\"group\" selected=\"selected\" >Collection Group</option>" : " <option value=\"group\">Collection Group</option>"); Output.WriteLine(enteredType == "exhibit" ? " <option value=\"exhibit\" selected=\"selected\" >Exhibit</option>" : " <option value=\"exhibit\">Exhibit</option>"); Output.WriteLine(enteredType == "inst" ? " <option value=\"inst\" selected=\"selected\" >Institution</option>" : " <option value=\"inst\">Institution</option>"); Output.WriteLine(enteredType == "subinst" ? " <option value=\"subinst\" selected=\"selected\" >Institutional Division</option>" : " <option value=\"subinst\">Institutional Division</option>"); Output.WriteLine(enteredType == "subcoll" ? " <option value=\"subcoll\" selected=\"selected\" >SubCollection</option>" : " <option value=\"subcoll\">SubCollection</option>"); Output.WriteLine(" </select>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); // Add the parent line Output.WriteLine(" <tr>"); Output.WriteLine(" <td>"); Output.WriteLine(" <label for=\"admin_aggr_parent\">Parent:</label></td><td colspan=\"2\">"); Output.WriteLine(" <select class=\"sbkAsav_select_large\" name=\"admin_aggr_parent\" id=\"admin_aggr_parent\">"); if (enteredParent == String.Empty) { Output.WriteLine(" <option value=\"\" selected=\"selected\" ></option>"); } foreach (Item_Aggregation_Related_Aggregations thisAggr in UI_ApplicationCache_Gateway.Aggregations.All_Aggregations) { // For aggregations, this retains the initial i as lower case (easier to recognize) string aggrCode = thisAggr.Code; if ((aggrCode[0] == 'I') && (thisAggr.Type.IndexOf("Institution", StringComparison.InvariantCultureIgnoreCase) >= 0)) { aggrCode = "i" + aggrCode.Substring(1); } if (enteredParent == thisAggr.Code) { Output.WriteLine(" <option value=\"" + thisAggr.Code + "\" selected=\"selected\" >" + aggrCode + " - " + thisAggr.Name + "</option>"); } else { Output.WriteLine(" <option value=\"" + thisAggr.Code + "\" >" + aggrCode + " - " + thisAggr.Name + "</option>"); } } Output.WriteLine(" </select>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); // Add the full name line Output.WriteLine(" <tr><td><label for=\"admin_aggr_name\">Name (full):</label></td><td colspan=\"2\"><input class=\"sbkAsav_large_input sbkAdmin_Focusable\" name=\"admin_aggr_name\" id=\"admin_aggr_name\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(enteredName) + "\" onchange=\"if ( $('#admin_aggr_shortname').val().length == 0 ) { $('#admin_aggr_shortname').val(this.value); }\" /></td></tr>"); // Add the short name line Output.WriteLine(" <tr><td><label for=\"admin_aggr_shortname\">Name (short):</label></td><td colspan=\"2\"><input class=\"sbkAsav_large_input sbkAdmin_Focusable\" name=\"admin_aggr_shortname\" id=\"admin_aggr_shortname\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(enteredShortname) + "\" onchange=\"if ( $('#admin_aggr_name').val().length == 0 ) { $('#admin_aggr_name').val(this.value); }\" /></td></tr>"); // Add the link line Output.WriteLine(" <tr id=\"external_link_row\" style=\"display:none;\"><td><label for=\"admin_aggr_link\">External Link:</label></td><td colspan=\"2\"><input class=\"sbkAsav_large_input sbkAdmin_Focusable\" name=\"admin_aggr_link\" id=\"admin_aggr_link\" type=\"text\" value=\"" + HttpUtility.HtmlEncode(enteredLink) + "\" /></td></tr>"); // Add the thematic heading line Output.WriteLine(" <tr>"); Output.WriteLine(" <td><label for=\"admin_aggr_heading\">Thematic Heading:</label></td>"); Output.WriteLine(" <td colspan=\"2\">"); Output.WriteLine(" <select class=\"sbkAsav_select_large\" name=\"admin_aggr_heading\" id=\"admin_aggr_heading\">"); Output.WriteLine(" <option value=\"-1\" selected=\"selected\" ></option>"); foreach (Thematic_Heading thisHeading in UI_ApplicationCache_Gateway.Thematic_Headings) { if (thisHeading.Text == enteredThematicHeading) { Output.Write(" <option value=\"" + thisHeading.ID + "\" selected=\"selected\">" + HttpUtility.HtmlEncode(thisHeading.Text) + "</option>"); } else { Output.Write(" <option value=\"" + thisHeading.ID + "\">" + HttpUtility.HtmlEncode(thisHeading.Text) + "</option>"); } } Output.WriteLine(" </select>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); // Add the description box Output.WriteLine(" <tr style=\"vertical-align:top\"><td><label for=\"admin_aggr_desc\">Description:</label></td><td colspan=\"2\"><textarea rows=\"6\" name=\"admin_aggr_desc\" id=\"admin_aggr_desc\" class=\"sbkAsav_input sbkAdmin_Focusable\">" + HttpUtility.HtmlEncode(enteredDescription) + "</textarea></td></tr>"); // Add checkboxes for is active and is hidden Output.Write(enteredIsActive ? " <tr style=\"height:30px\"><td>Behavior:</td><td colspan=\"2\"><input class=\"sbkAsav_checkbox\" type=\"checkbox\" name=\"admin_aggr_isactive\" id=\"admin_aggr_isactive\" checked=\"checked\" /> <label for=\"admin_aggr_isactive\">Active?</label></td></tr> " : " <tr style=\"height:30px\"><td>Behavior:</td><td colspan=\"2\"><input class=\"sbkAsav_checkbox\" type=\"checkbox\" name=\"admin_aggr_isactive\" id=\"admin_aggr_isactive\" /> <label for=\"admin_aggr_isactive\">Active?</label></td></tr> "); Output.Write(!enteredIsHidden ? " <tr><td></td><td colspan=\"2\"><input class=\"sbkAsav_checkbox\" type=\"checkbox\" name=\"admin_aggr_ishidden\" id=\"admin_aggr_ishidden\" checked=\"checked\" /> <label for=\"admin_aggr_ishidden\">Show in parent collection home page?</label></td></tr> " : " <tr><td></td><td colspan=\"2\"><input class=\"sbkAsav_checkbox\" type=\"checkbox\" name=\"admin_aggr_ishidden\" id=\"admin_aggr_ishidden\" /> <label for=\"admin_aggr_ishidden\">Show in parent collection home page?</label></td></tr> "); // Add the SAVE button Output.WriteLine(" <tr style=\"height:30px; text-align: center;\"><td colspan=\"3\"><button title=\"Save new item aggregation\" class=\"sbkAdm_RoundButton\" onclick=\"return save_new_aggr();\">SAVE <img src=\"" + Static_Resources_Gateway.Button_Next_Arrow_Png + "\" class=\"sbkAdm_RoundButton_RightImg\" alt=\"\" /></button></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(); Output.WriteLine(" <h2>Existing Aggregations</h2>"); Output.WriteLine(" <table class=\"sbkAsav_Table display\" id=\"adminMgmtTable\">"); Output.WriteLine(" <thead>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader1\">ACTIONS</th>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader2\">CODE</th>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader3\">TYPE</th>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader4\">NAME</th>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader5\">ACTIVE</th>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader6\">ON HOME</th>"); Output.WriteLine(" <th class=\"sbkAsav_TableHeader7\">PARENT</th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </thead>"); Output.WriteLine(" <tfoot>"); Output.WriteLine(" <tr>"); Output.WriteLine(" <th></th>"); Output.WriteLine(" <th><input id=\"adminMgmtCodeSearch\" type=\"text\" placeholder=\"Search Code\" /></th>"); Output.WriteLine(" <th>TYPE</th>"); Output.WriteLine(" <th><input id=\"adminMgmtNameSearch\" type=\"text\" placeholder=\"Search Name\" /></th>"); Output.WriteLine(" <th>ACTIVE</th>"); Output.WriteLine(" <th>ON HOME</th>"); Output.WriteLine(" <th>PARENT</th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </tfoot>"); Output.WriteLine(" <tbody>"); // Show all the aggregations string last_code = String.Empty; foreach (Item_Aggregation_Related_Aggregations thisAggr in UI_ApplicationCache_Gateway.Aggregations.All_Aggregations) { if (thisAggr.Code != last_code) { last_code = thisAggr.Code; // Build the action links Output.WriteLine(" <tr>"); Output.Write(" <td class=\"sbkAsav_ActionLink\" >( "); Output.Write("<a title=\"Click to edit this item aggregation\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/admin/editaggr/" + thisAggr.Code + "\">edit</a> | "); if (thisAggr.Active) { Output.Write("<a title=\"Click to view this item aggregation\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/" + thisAggr.Code + "\">view</a> | "); } else { Output.Write("view | "); } if (String.Compare(thisAggr.Code, "ALL", StringComparison.InvariantCultureIgnoreCase) != 0) { Output.Write("<a title=\"Click to delete this item aggregation\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_aggr('" + thisAggr.Code + "');\">delete</a> | "); } Output.WriteLine("<a title=\"Click to reset the instance in the application cache\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return reset_aggr('" + thisAggr.Code + "');\">reset</a> )</td>"); // Special code to start istitutions with a small letter 'i' string code = thisAggr.Code; if ((thisAggr.Type.IndexOf("Institution", StringComparison.InvariantCultureIgnoreCase) >= 0) && (code[0] == 'I') && (code.Length > 1)) { code = "i" + code.Substring(1); } // Add the rest of the row with data Output.WriteLine(" <td>" + code + "</td>"); Output.WriteLine(" <td>" + thisAggr.Type + "</td>"); Output.WriteLine(" <td>" + thisAggr.Name + "</td>"); if (thisAggr.Active) { Output.WriteLine(" <td>Y</td>"); } else { Output.WriteLine(" <td>N</td>"); } if (thisAggr.Thematic_Heading != null) { Output.WriteLine(" <td>Y</td>"); } else { Output.WriteLine(" <td>N</td>"); } if (thisAggr.Parent_Count > 0) { Output.WriteLine(" <td>" + thisAggr.Parents[0].Code + "</td>"); } else { Output.WriteLine(" <td></td>"); } Output.WriteLine(" </tr>"); } } Output.WriteLine(" </tbody>"); Output.WriteLine(" </table>"); Output.WriteLine("<script type=\"text/javascript\">"); Output.WriteLine(" $(document).ready(function() { "); Output.WriteLine(" var table = $('#adminMgmtTable').DataTable({ "); // If 100 or less aggregations, suppress paging if (UI_ApplicationCache_Gateway.Aggregations.All_Aggregations.Count <= 100) { Output.WriteLine(" \"paging\": false, "); Output.WriteLine(" \"info\": false, "); } else { Output.WriteLine(" \"lengthMenu\": [ [50, 100, -1], [50, 100, \"All\"] ], "); Output.WriteLine(" \"pageLength\": 50, "); } Output.WriteLine(" initComplete: function () {"); Output.WriteLine(" var api = this.api();"); Output.WriteLine(" api.columns().indexes().flatten().each( function ( i ) {"); Output.WriteLine(" if (( i == 2 || i == 4 || i == 5 || i == 6 )) {"); Output.WriteLine(" var column = api.column( i );"); Output.WriteLine(" var select = $('<select><option value=\"\"></option></select>')"); Output.WriteLine(" .appendTo( $(column.footer()).empty() )"); Output.WriteLine(" .on( 'change', function () {"); Output.WriteLine(" var val = $.fn.dataTable.util.escapeRegex($(this).val());"); Output.WriteLine(" column.search( val ? '^'+val+'$' : '', true, false ).draw();"); Output.WriteLine(" } );"); Output.WriteLine(" column.data().unique().sort().each( function ( d, j ) {"); Output.WriteLine(" select.append( '<option value=\"'+d+'\">'+d+'</option>' )"); Output.WriteLine(" } );"); Output.WriteLine(" }"); Output.WriteLine(" } );"); Output.WriteLine(" }"); Output.WriteLine(" });"); Output.WriteLine(" $('#adminMgmtCodeSearch').on( 'keyup change', function () { table.column( 1 ).search( this.value ).draw(); } );"); Output.WriteLine(" $('#adminMgmtNameSearch').on( 'keyup change', function () { table.column( 3 ).search( this.value ).draw(); } );"); Output.WriteLine(" } );"); Output.WriteLine("</script>"); Output.WriteLine(); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
/// <summary> Constructor for a new instance of the Aliases_AdminViewer class </summary> /// <param name="User"> Authenticated user information </param> /// <param name="currentMode"> Mode / navigation information for the current request</param> /// <param name="IP_Restrictions"> List of all IP restrictions ranges used in this digital library to restrict access to certain digital resources </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> Postback from handling an edit or new item aggregation alias is handled here in the constructor </remarks> public IP_Restrictions_AdminViewer(User_Object User, SobekCM_Navigation_Object currentMode, IP_Restriction_Ranges IP_Restrictions, Custom_Tracer Tracer) : base(User) { Tracer.Add_Trace("IP_Restrictions_AdminViewer.Constructor", String.Empty); ipRestrictionInfo = IP_Restrictions; this.currentMode = currentMode; // Ensure the user is the system admin if ((User == null) || (!User.Is_System_Admin)) { currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home; HttpContext.Current.Response.Redirect(currentMode.Redirect_URL(), false); } // Determine if there is an specific IP address range for editing index = -1; if (currentMode.My_Sobek_SubMode.Length > 0) { if (!Int32.TryParse(currentMode.My_Sobek_SubMode, out index)) { index = -1; } } // If there was an index included, try to pull the information about it thisRange = null; details = null; if ((index >= 1) && (index <= ipRestrictionInfo.Count)) { thisRange = ipRestrictionInfo[index - 1]; if (thisRange != null) { details = SobekCM_Database.Get_IP_Restriction_Range_Details(thisRange.RangeID, Tracer); } } if ((currentMode.isPostBack) && (details != null) && (thisRange != null)) { try { // Get a reference to this form NameValueCollection form = HttpContext.Current.Request.Form; // Pull the main values string title = form["admin_title"].Trim(); string notes = form["admin_notes"].Trim(); string message = form["admin_message"].Trim(); if (title.Length == 0) { title = thisRange.Title; } // Edit the main values in the database SobekCM_Database.Edit_IP_Range(thisRange.RangeID, title, notes, message, Tracer); thisRange.Title = title; thisRange.Notes = notes; thisRange.Item_Restricted_Statement = message; // Now check each individual IP address range string[] getKeys = form.AllKeys; int single_ip_index = 0; foreach (string thisKey in getKeys) { // Is this for a new ip address? if (thisKey.IndexOf("admin_ipstart_") == 0) { // Get the basic information for this single ip address string ip_index = thisKey.Replace("admin_ipstart_", ""); string thisIpStart = form["admin_ipstart_" + ip_index].Trim(); string thisIpEnd = form["admin_ipend_" + ip_index].Trim(); string thisIpNote = form["admin_iplabel_" + ip_index].Trim(); // Does this match an existing IP range? if ((ip_index.IndexOf("new") < 0) && (single_ip_index < details.Tables[1].Rows.Count)) { // Get the pre-existing IP row DataRow ipRow = details.Tables[1].Rows[single_ip_index]; int singleIpId = Convert.ToInt32(ipRow[0]); if (thisIpStart.Length == 0) { SobekCM_Database.Delete_Single_IP(singleIpId, Tracer); } else { // Is this the same? if ((thisIpStart != ipRow[1].ToString().Trim()) || (thisIpEnd != ipRow[2].ToString().Trim()) || (thisIpNote != ipRow[3].ToString().Trim())) { int edit_point_count = thisIpStart.Count(thisChar => thisChar == '.'); if (edit_point_count == 3) { SobekCM_Database.Edit_Single_IP(singleIpId, thisRange.RangeID, thisIpStart, thisIpEnd, thisIpNote, Tracer); } } } // Be ready to look at the next pre-existing IP range single_ip_index++; } else { // Just add this as a new single ip address if (thisIpStart.Length > 0) { int add_point_count = thisIpStart.Count(thisChar => thisChar == '.'); if (add_point_count == 3) { SobekCM_Database.Edit_Single_IP(-1, thisRange.RangeID, thisIpStart, thisIpEnd, thisIpNote, Tracer); } } } } } } catch (Exception) { // Some error caught while handling postback } // Repopulate the restriction table DataTable ipRestrictionTbl = SobekCM_Database.Get_IP_Restriction_Ranges(Tracer); if (ipRestrictionTbl != null) { IP_Restrictions.Populate_IP_Ranges(ipRestrictionTbl); } // Forward back to the main form currentMode.My_Sobek_SubMode = String.Empty; HttpContext.Current.Response.Redirect(currentMode.Redirect_URL()); } }
/// <summary> Add the HTML to be displayed in the main SobekCM viewer area (outside of the forms)</summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This class does nothing, since the interface list is added as controls, not HTML </remarks> public override void Write_HTML(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Aggregations_Mgmt_AdminViewer.Write_HTML", "Do nothing"); }
/// <summary> Adds any viewer_specific information to the Navigation Bar Menu Section </summary> /// <param name="placeHolder"> Additional place holder ( "navigationPlaceHolder" ) in the itemNavForm form allows item-viewer-specific controls to be added to the left navigation bar</param> /// <param name="Internet_Explorer"> Flag indicates if the current browser is internet explorer </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> Returns FALSE since nothing was added to the left navigational bar </returns> /// <remarks> For this item viewer, this method does nothing except return FALSE </remarks> public override bool Add_Nav_Bar_Menu_Section(PlaceHolder placeHolder, bool Internet_Explorer, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("EmbeddedVideo_ItemViewer.Add_Nav_Bar_Menu_Section", "Nothing added to placeholder"); } return(false); }
private void add_item_usage_history(TextWriter Output, DataTable StatsCount, Custom_Tracer Tracer) { Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_collection_history", "Rendering HTML"); Output.WriteLine("<div class=\"SobekText\">"); Output.WriteLine("<p>Usage history for the items within this collection are displayed below.</p>"); currentMode.Info_Browse_Mode = "definitions"; Output.WriteLine("<p>The <a href=\"" + currentMode.Redirect_URL() + "\">Definitions page</a> provides more details about the statistics and words used below.</p>"); Output.WriteLine("</div>"); Output.WriteLine("<center>"); int jpegViews = 0; int zoomViews = 0; int thumbViews = 0; int flashViews = 0; int googleMapViews = 0; int downloadViews = 0; int citationViews = 0; int textSearchViews = 0; int staticViews = 0; Output.WriteLine(" <table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"right\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"120px\" align=\"left\"><span style=\"color: White\">DATE</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">JPEG<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">ZOOMABLE<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">CITATION<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">THUMBNAIL<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">TEXT<br />SEARCHES</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">FLASH<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">MAP<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">DOWNLOAD<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">STATIC<br />VIEWS</span></th>"); Output.WriteLine(" </tr>"); const int COLUMNS = 10; string lastYear = String.Empty; if (StatsCount != null) { foreach (DataRow thisRow in StatsCount.Rows) { if (thisRow[0].ToString() != lastYear) { Output.WriteLine(" <tr><td bgcolor=\"#7d90d5\" colspan=\"" + COLUMNS + "\"><span style=\"color: White\"><b> " + thisRow[0] + " STATISTICS</b></span></td></tr>"); lastYear = thisRow[0].ToString(); } else { Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"" + COLUMNS + "\"></td></tr>"); } Output.WriteLine(" <tr align=\"right\" >"); Output.WriteLine(" <td align=\"left\">" + Month_From_Int(Convert.ToInt32(thisRow[1])) + " " + thisRow[0] + "</td>"); if (thisRow[10] != DBNull.Value) { jpegViews += Convert.ToInt32(thisRow[10]); Output.WriteLine(" <td>" + thisRow[10] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[11] != DBNull.Value) { zoomViews += Convert.ToInt32(thisRow[11]); Output.WriteLine(" <td>" + thisRow[11] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[12] != DBNull.Value) { citationViews += Convert.ToInt32(thisRow[12]); Output.WriteLine(" <td>" + thisRow[12] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[13] != DBNull.Value) { thumbViews += Convert.ToInt32(thisRow[13]); Output.WriteLine(" <td>" + thisRow[13] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[14] != DBNull.Value) { textSearchViews += Convert.ToInt32(thisRow[14]); Output.WriteLine(" <td>" + thisRow[14] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[15] != DBNull.Value) { flashViews += Convert.ToInt32(thisRow[15]); Output.WriteLine(" <td>" + thisRow[15] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[16] != DBNull.Value) { googleMapViews += Convert.ToInt32(thisRow[16]); Output.WriteLine(" <td>" + thisRow[16] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[17] != DBNull.Value) { downloadViews += Convert.ToInt32(thisRow[17]); Output.WriteLine(" <td>" + thisRow[17] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[18] != DBNull.Value) { staticViews += Convert.ToInt32(thisRow[18]); Output.WriteLine(" <td>" + thisRow[18] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } Output.WriteLine(" </tr>"); } Output.WriteLine(" <tr><td bgcolor=\"Black\" colspan=\"" + COLUMNS + "\"></td></tr>"); Output.WriteLine(" <tr align=\"right\" >"); Output.WriteLine(" <td align=\"left\"><b>TOTAL</b></td>"); Output.WriteLine(" <td><b>" + jpegViews + "</td>"); Output.WriteLine(" <td><b>" + zoomViews + "</td>"); Output.WriteLine(" <td><b>" + citationViews + "</td>"); Output.WriteLine(" <td><b>" + thumbViews + "</td>"); Output.WriteLine(" <td><b>" + textSearchViews + "</td>"); Output.WriteLine(" <td><b>" + flashViews + "</td>"); Output.WriteLine(" <td><b>" + googleMapViews + "</td>"); Output.WriteLine(" <td><b>" + downloadViews + "</td>"); Output.WriteLine(" <td><b>" + staticViews + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); } Output.WriteLine(" <br /> <br />"); Output.WriteLine("</center>"); }
/// <summary> Abstract method writes the item viewer main section as HTML directly to the HTTP output stream </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> /// <remarks> This MUST be implemented by all classes that implement this abstract class </remarks> public abstract void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer);
private void add_collection_usage_history(TextWriter Output, DataTable StatsCount, Custom_Tracer Tracer) { Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_collection_history", "Rendering HTML"); Output.WriteLine("<div class=\"SobekText\">"); Output.WriteLine("<p>Usage history for this collection is displayed below. This history includes just the top-level views of the collection.</p>"); currentMode.Info_Browse_Mode = "definitions"; Output.WriteLine("<p>The <a href=\"" + currentMode.Redirect_URL() + "\">Definitions page</a> provides more details about the statistics and words used below.</p>"); Output.WriteLine("</div>"); Output.WriteLine("<center>"); Output.WriteLine(" <table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"right\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"120px\" align=\"left\"><span style=\"color: White\">DATE</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">TOTAL<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">VISITS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">MAIN <br />PAGES</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">BROWSES</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">SEARCH<br />RESULTS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">TITLE<br />VIEWS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"right\"><span style=\"color: White\">ITEM<br />VIEWS</span></th>"); Output.WriteLine(" </tr>"); const int COLUMNS = 8; string lastYear = String.Empty; int hits = 0; int sessions = 0; int mainPages = 0; int browses = 0; int searchResults = 0; int titleHits = 0; int itemHits = 0; // Add the collection level information if (StatsCount != null) { foreach (DataRow thisRow in StatsCount.Rows) { if (thisRow[0].ToString() != lastYear) { Output.WriteLine(" <tr><td bgcolor=\"#7d90d5\" colspan=\"" + COLUMNS + "\"><span style=\"color: White\"><b> " + thisRow[0] + " STATISTICS</b></span></td></tr>"); lastYear = thisRow[0].ToString(); } else { Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"" + COLUMNS + "\"></td></tr>"); } Output.WriteLine(" <tr align=\"right\" >"); Output.WriteLine(" <td align=\"left\">" + Month_From_Int(Convert.ToInt32(thisRow[1])) + " " + thisRow[0] + "</td>"); hits += Convert.ToInt32(thisRow[2]); Output.WriteLine(" <td>" + thisRow[2] + "</td>"); sessions += Convert.ToInt32(thisRow[3]); Output.WriteLine(" <td>" + thisRow[3] + "</td>"); int thisRowMainPage = Convert.ToInt32(thisRow[4]) + Convert.ToInt32(thisRow[6]); mainPages += thisRowMainPage; Output.WriteLine(" <td>" + thisRowMainPage + "</td>"); browses += Convert.ToInt32(thisRow[5]); Output.WriteLine(" <td>" + thisRow[5] + "</td>"); searchResults += Convert.ToInt32(thisRow[7]); Output.WriteLine(" <td>" + thisRow[7] + "</td>"); if (thisRow[8] != DBNull.Value) { titleHits += Convert.ToInt32(thisRow[8]); Output.WriteLine(" <td>" + thisRow[8] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[9] != DBNull.Value) { itemHits += Convert.ToInt32(thisRow[9]); Output.WriteLine(" <td>" + thisRow[9] + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } Output.WriteLine(" </tr>"); } Output.WriteLine(" <tr><td bgcolor=\"Black\" colspan=\"" + COLUMNS + "\"></td></tr>"); Output.WriteLine(" <tr align=\"right\" >"); Output.WriteLine(" <td align=\"left\"><b>TOTAL</b></td>"); Output.WriteLine(" <td><b>" + hits + "</td>"); Output.WriteLine(" <td><b>" + sessions + "</td>"); Output.WriteLine(" <td><b>" + mainPages + "</td>"); Output.WriteLine(" <td><b>" + browses + "</td>"); Output.WriteLine(" <td><b>" + searchResults + "</td>"); Output.WriteLine(" <td><b>" + titleHits + "</td>"); Output.WriteLine(" <td><b>" + itemHits + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); } Output.WriteLine(" <br /> <br />"); Output.WriteLine("</center>"); }
/// <summary> Constructor for a new instance of the Home_MySobekViewer class </summary> /// <param name="currentMode"> Mode / navigation information for the current request (including interface code) </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> public Logon_MySobekViewer(SobekCM_Navigation_Object currentMode, Custom_Tracer Tracer) : base(null) { Tracer.Add_Trace("Logon_MySobekViewer.Constructor", String.Empty); CurrentMode = currentMode; errorMessage = String.Empty; // If this is a postback, check to see if the user is valid if (currentMode.isPostBack) { string possible_username = String.Empty; string possible_password = String.Empty; bool remember_me = false; string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { switch (thisKey) { case "logon_username": possible_username = HttpContext.Current.Request.Form[thisKey].Trim(); break; case "logon_password": possible_password = HttpContext.Current.Request.Form[thisKey].Trim(); break; case "rememberme": if (HttpContext.Current.Request.Form[thisKey].Trim() == "rememberme") { remember_me = true; } break; } } if ((!String.IsNullOrEmpty(possible_password)) && (!String.IsNullOrEmpty(possible_username))) { user = SobekCM_Database.Get_User(possible_username, possible_password, Tracer); if (user != null) { // The user was valid here, so save this user information HttpContext.Current.Session["user"] = user; // Should we remember this user via cookies? if (remember_me) { HttpCookie userCookie = new HttpCookie("SobekUser"); userCookie.Values["userid"] = user.UserID.ToString(); userCookie.Values["security_hash"] = user.Security_Hash(HttpContext.Current.Request.UserHostAddress); userCookie.Expires = DateTime.Now.AddDays(14); HttpContext.Current.Response.Cookies.Add(userCookie); } // Forward back to their original URL (unless the original URL was this logon page) string raw_url = HttpContext.Current.Items["Original_URL"].ToString(); if (raw_url.ToLower().IndexOf("my/logon") > 0) { currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home; HttpContext.Current.Response.Redirect(currentMode.Redirect_URL()); } else { HttpContext.Current.Response.Redirect(raw_url); } } } } }
/// <summary> Add controls directly to the form, either to the main control area or to the file upload placeholder </summary> /// <param name="placeHolder"> Main place holder to which all main controls are added </param> /// <param name="uploadFilesPlaceHolder"> Place holder is used for uploading file </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> No controls are added here, although some children class override this virtual method to add controls </remarks> public override void Add_Controls(PlaceHolder placeHolder, PlaceHolder uploadFilesPlaceHolder, Custom_Tracer Tracer) { Tracer.Add_Trace("Logon_MySobekViewer.Add_Controls", String.Empty); StringBuilder literalBuilder = new StringBuilder(); // Get ready to draw the tabs string sobek_home = currentMode.SobekCM_Instance_Abbreviation.ToUpper() + " HOME"; string my_sobek = "my" + currentMode.SobekCM_Instance_Abbreviation; literalBuilder.AppendLine("<div class=\"ViewsBrowsesRow\">"); literalBuilder.AppendLine(""); // Write the Sobek home tab currentMode.Mode = Display_Mode_Enum.Aggregation_Home; literalBuilder.AppendLine(" <a href=\"" + currentMode.Redirect_URL() + "\">" + Unselected_Tab_Start + sobek_home + Unselected_Tab_End + "</a>"); currentMode.Mode = Display_Mode_Enum.My_Sobek; literalBuilder.AppendLine(""); literalBuilder.AppendLine("</div>"); literalBuilder.AppendLine(); literalBuilder.AppendLine("<div class=\"SobekSearchPanel\">"); literalBuilder.AppendLine(" <h1>Logon to " + my_sobek + "</h1>"); literalBuilder.AppendLine("</div>"); literalBuilder.AppendLine(); literalBuilder.AppendLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_metadata.js\" type=\"text/javascript\"></script>"); literalBuilder.AppendLine("<div class=\"SobekHomeText\" >"); literalBuilder.AppendLine("<br />"); literalBuilder.AppendLine("<blockquote>"); literalBuilder.AppendLine("The feature you are trying to access requires a valid logon.<br /><br />Please choose the appropriate logon directly below. <br /><br />"); literalBuilder.AppendLine("<ul>"); if (currentMode.SobekCM_Instance_Abbreviation == "dLOC") { literalBuilder.AppendLine("<li><b>If you have a valid myDLOC logon</b>, <a id=\"form_logon_term\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return popup_focus('form_logon', 'form_logon_term', 'logon_username', 280, 400 );\">Sign on with myDLOC authentication</a>.<br /><br /></li>"); if ((SobekCM_Library_Settings.Shibboleth_System_URL.Length > 0) && (SobekCM_Library_Settings.Shibboleth_System_Name.Length > 0)) { literalBuilder.AppendLine("<li><b>If you have a valid " + SobekCM_Library_Settings.Shibboleth_System_Name + " ID</b>, <a href=\"" + SobekCM_Library_Settings.Shibboleth_System_URL + "\">Sign on with your " + SobekCM_Library_Settings.Shibboleth_System_Name + " here</a>.<br /><br /></li>"); } } else { if ((SobekCM_Library_Settings.Shibboleth_System_URL.Length > 0) && (SobekCM_Library_Settings.Shibboleth_System_Name.Length > 0)) { literalBuilder.AppendLine("<li><b>If you have a valid " + SobekCM_Library_Settings.Shibboleth_System_Name + " ID</b>, <a href=\"" + SobekCM_Library_Settings.Shibboleth_System_URL + "\">Sign on with your " + SobekCM_Library_Settings.Shibboleth_System_Name + " here</a>.<br /><br /></li>"); } literalBuilder.AppendLine("<li><b>If you have a valid my" + currentMode.SobekCM_Instance_Abbreviation + " logon</b>, <a id=\"form_logon_term\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return popup_focus('form_logon', 'form_logon_term', 'logon_username', 280, 400 );\">Sign on with my" + currentMode.SobekCM_Instance_Abbreviation + " authentication here</a>.<br /><br /></li>"); } currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Preferences; literalBuilder.Append("<li><b>Not registered yet?</b> <a href=\"" + currentMode.Redirect_URL() + "\">Register now</a> or "); currentMode.Mode = Display_Mode_Enum.Contact; literalBuilder.AppendLine(" <a href=\"" + currentMode.Redirect_URL() + "\">Contact Us</a></li>"); currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Logon; currentMode.Mode = Display_Mode_Enum.My_Sobek; literalBuilder.AppendLine("</ul>"); literalBuilder.AppendLine("</blockquote>"); literalBuilder.AppendLine("<br />"); literalBuilder.AppendLine("</div>"); literalBuilder.AppendLine("<br />"); literalBuilder.AppendLine("<br />"); LiteralControl literal2 = new LiteralControl(literalBuilder.ToString()); placeHolder.Controls.Add(literal2); }
/// <summary> Write any additional values within the HTML Head of the final served page </summary> /// <param name="Output"> Output stream currently within the HTML head tags </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public override void Write_Within_HTML_Head(TextWriter Output, Custom_Tracer Tracer) { Output.WriteLine("<script src=\"" + Static_Resources_Gateway.OpenSeaDragon_Js + "\"></script>"); }
/// <summary> Creates and returns the an instance of the <see cref="Related_Images_ItemViewer"/> class for showing the /// thumbnail images (i.e., related images) associated with a digital resource during execution of a single HTTP request. </summary> /// <param name="CurrentItem"> 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> /// <returns> Fully built and initialized <see cref="Related_Images_ItemViewer"/> object </returns> /// <remarks> This method is called whenever a request requires the actual viewer to be created to render the HTML for /// the digital resource requested. The created viewer is then destroyed at the end of the request </remarks> public virtual iItemViewer Create_Viewer(BriefItemInfo CurrentItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer) { return(new Related_Images_ItemViewer(CurrentItem, CurrentUser, CurrentRequest, Tracer, ViewerCode)); }
/// <summary> Gets a fully built item aggregation object for a particular aggregation code and language code. </summary> /// <param name="AggregationCode">Code for this aggregation object</param> /// <param name="Language_Code">Code for the language for this aggregation object</param> /// <param name="CacheInstance">Instance of this item aggregation pulled from cache (or NULL)</param> /// <param name="IsRobot">Flag tells if this request is from a robot (which will vary cacheing time)</param> /// <param name="StoreInCache"> Flag indicates if this should be stored in the cache once built </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns>Fully built item aggregation object for the particular aggregation code and language code</returns> /// <remarks>Item aggregation object is also placed in the cache.<br /><br /> /// Building of an item aggregation always starts by pulling the item from the database ( either <see cref="SobekCM_Database.Get_Item_Aggregation"/> or <see cref="SobekCM_Database.Get_Main_Aggregation"/> ).<br /><br /> /// Then, either the Item Aggregation XML file is read (if present) or the entire folder hierarchy is analyzed to find the browses, infos, banners, etc..</remarks> public static Item_Aggregation Get_Item_Aggregation(string AggregationCode, string Language_Code, Item_Aggregation CacheInstance, bool IsRobot, bool StoreInCache, Custom_Tracer Tracer) { // Does this exist in the cache? if (CacheInstance == null) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Creating '" + AggregationCode + "' item aggregation"); } // Get the information about this collection and this entry point Item_Aggregation hierarchyObject; if ((AggregationCode.Length > 0) && (AggregationCode != "all")) { hierarchyObject = SobekCM_Database.Get_Item_Aggregation(AggregationCode, false, IsRobot, Tracer); } else { hierarchyObject = SobekCM_Database.Get_Main_Aggregation(Tracer); } // If no value was returned, don't do anything else here if (hierarchyObject != null) { // Add all the values to this object string xmlDataFile = SobekCM_Library_Settings.Base_Design_Location + hierarchyObject.ObjDirectory + "\\" + hierarchyObject.Code + ".xml"; if (File.Exists(xmlDataFile)) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Reading XML Configuration File"); } // Add the ALL and NEW browses Add_All_New_Browses(hierarchyObject); // Add all the other data from the XML file Item_Aggregation_XML_Reader reader = new Item_Aggregation_XML_Reader(); reader.Add_Info_From_XML_File(hierarchyObject, xmlDataFile); } else { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Adding banner, home, and all/new browse information"); } Add_HTML(hierarchyObject); Add_All_New_Browses(hierarchyObject); if (!IsRobot) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Scanning Design Directory for browse and info files"); } Add_Browse_Files(hierarchyObject, Tracer); } // Since there was no configuration file, save one hierarchyObject.Write_Configuration_File(SobekCM_Library_Settings.Base_Design_Location + hierarchyObject.ObjDirectory); } // Now, save this to the cache if ((!IsRobot) && (StoreInCache)) { Cached_Data_Manager.Store_Item_Aggregation(AggregationCode, Language_Code, hierarchyObject, Tracer); } else { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Skipping storing item aggregation on cache due to robot flag"); } } // Return this built hierarchy object return(hierarchyObject); } if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "NULL value returned from database"); } return(null); } if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Found '" + AggregationCode + "' item aggregation in cache"); } // Get the HTML element and search fields and return all this return(CacheInstance); }