/// <summary> Constructor for a new instance of the Worker_Controller class </summary> /// <param name="Verbose"> Flag indicates if this should be verbose in the log file and console </param> public Worker_Controller(bool Verbose) { verbose = Verbose; controllerStarted = DateTime.Now; aborted = false; // Assign the database connection strings SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; Library.Database.SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; // Pull the values from the database and assign other setting values SobekCM_Library_Settings.Local_Log_Directory = Application.StartupPath + "\\Logs\\"; DataSet settings = Library.Database.SobekCM_Database.Get_Builder_Settings_Complete(null); if (settings == null) { Console.WriteLine("FATAL ERROR pulling latest settings from the database: " + Library.Database.SobekCM_Database.Last_Exception.Message); return; } if (!SobekCM_Library_Settings.Refresh(settings)) { Console.WriteLine("Error using database settings to refresh SobekCM_Library_Settings in Worker_Controller constructor"); } // If this starts in an ABORTED mode, set to standard Builder_Operation_Flag_Enum operationFlag = Abort_Database_Mechanism.Builder_Operation_Flag; if ((operationFlag == Builder_Operation_Flag_Enum.ABORTING) || (operationFlag == Builder_Operation_Flag_Enum.ABORT_REQUESTED) || (operationFlag == Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED)) { Abort_Database_Mechanism.Builder_Operation_Flag = Builder_Operation_Flag_Enum.STANDARD_OPERATION; } }
/// <summary> Renders the HTML for this element </summary> /// <param name="Output"> Textwriter to write the HTML for this element </param> /// <param name="Bib"> Object to populate this element from </param> /// <param name="Skin_Code"> Code for the current skin </param> /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param> /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param> /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param> /// <param name="CurrentLanguage"> Current user-interface language </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Base_URL"> Base URL for the current request </param> /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks> public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL) { // Check that an acronym exists if (Acronym.Length == 0) { const string defaultAcronym = "Provide instruction on how the physical material should be treated after digization is complete."; switch (CurrentLanguage) { case Web_Language_Enum.English: Acronym = defaultAcronym; break; case Web_Language_Enum.Spanish: Acronym = defaultAcronym; break; case Web_Language_Enum.French: Acronym = defaultAcronym; break; default: Acronym = defaultAcronym; break; } } string term = String.Empty; if (Bib.Tracking.Disposition_Advice > 0) { term = SobekCM_Library_Settings.Disposition_Term_Future(Bib.Tracking.Disposition_Advice); } render_helper(Output, term, Bib.Tracking.Disposition_Advice_Notes, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL, false); }
private void adviceLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Edit_Disposition_Advice_Form trackingForm = new Edit_Disposition_Advice_Form(trackingInfoObj.Disposition_Advice, trackingInfoObj.Disposition_Advice_Notes); if (trackingForm.ShowDialog() == DialogResult.OK) { int type = trackingForm.Disposition_Type_ID; string notes = trackingForm.Disposition_Notes; if ((type != trackingInfoObj.Disposition_Advice) || (notes.Trim() != trackingInfoObj.Disposition_Advice_Notes.Trim())) { if (Resource_Object.Database.SobekCM_Database.Edit_Disposition_Advice(itemid, type, notes)) { trackingInfoObj.Disposition_Advice = (short)type; trackingInfoObj.Disposition_Advice_Notes = notes; string disposition = SobekCM_Library_Settings.Disposition_Term_Future(trackingInfoObj.Disposition_Advice).ToUpper(); if (trackingInfoObj.Disposition_Advice_Notes.Trim().Length > 0) { adviceLinkLabel.Text = disposition + " - " + trackingInfoObj.Disposition_Advice_Notes; adviceLabel.Text = disposition + " - " + trackingInfoObj.Disposition_Advice_Notes; } else { adviceLinkLabel.Text = disposition; adviceLabel.Text = disposition; } } else { MessageBox.Show("Error encountered while saving disposition advice! ", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { // Pull the standard values NameValueCollection form = HttpContext.Current.Request.Form; string advice = String.Empty; string notes = String.Empty; foreach (string thisKey in form.AllKeys) { if (thisKey.IndexOf("dispositionadvice_select") == 0) { advice = form[thisKey]; } if (thisKey.IndexOf("dispositionadvice_text") == 0) { notes = form[thisKey]; } } if (advice.Length > 0) { Bib.Tracking.Disposition_Advice = (short)SobekCM_Library_Settings.Disposition_ID_Future(advice); Bib.Tracking.Disposition_Advice_Notes = notes; } }
/// <summary> Constructor for a new instance of the Edit_Disposition_Advice_Form class </summary> /// <param name="Initial_Disposition_Type"> Initialy disposition type to display </param> /// <param name="Initial_Notes"> Initial disposition advice notes to display </param> public Edit_Disposition_Advice_Form(int Initial_Disposition_Type, string Initial_Notes) { InitializeComponent(); DialogResult = DialogResult.Cancel; notes = String.Empty; typeId = -1; if (!Windows_Appearance_Checker.is_XP_Theme) { textBox1.BorderStyle = BorderStyle.FixedSingle; comboBox1.FlatStyle = FlatStyle.Flat; } // Add each possible disposition type List <string> dispositionTypes = SobekCM_Library_Settings.Disposition_Types_Future; foreach (string thisType in dispositionTypes) { comboBox1.Items.Add(thisType); } comboBox1.Text = SobekCM_Library_Settings.Disposition_Term_Future(Initial_Disposition_Type); textBox1.Text = Initial_Notes; BackColor = Color.FromArgb(240, 240, 240); }
private void okButton_Button_Pressed(object sender, EventArgs e) { notes = textBox1.Text; typeId = SobekCM_Library_Settings.Disposition_ID_Future(comboBox1.Text); DialogResult = DialogResult.OK; Close(); }
private void okButton_Button_Pressed(object sender, EventArgs e) { notes = textBox1.Text; date = dateTimePicker1.Value; typeId = SobekCM_Library_Settings.Disposition_ID_Past(comboBox1.Text); DialogResult = DialogResult.OK; Close(); }
/// <summary> Returns the URL for the element help for a given html interface </summary> /// <param name="Skin_Code"> Code for the current html skin </param> /// <param name="Current_Base_URL"> Base URL for the current request </param> /// <returns> HTML for the URL for the element help </returns> protected string Help_URL(string Skin_Code, string Current_Base_URL) { if (String.IsNullOrEmpty(help_page)) { return(SobekCM_Library_Settings.Metadata_Help_URL(Current_Base_URL) + "help/" + html_element_name.Replace("_", "")); } return(SobekCM_Library_Settings.Metadata_Help_URL(Current_Base_URL) + "help/" + help_page); }
private void updateItemDispositionMenuItem_Click(object sender, EventArgs e) { if ((gridPanel == null) || (gridPanel.Selected_Row == null) || (gridPanel.Selected_Row.Length == 0)) { return; } Update_Disposition_Form trackingBox = new Update_Disposition_Form(); if (trackingBox.ShowDialog() == DialogResult.OK) { Cursor = Cursors.WaitCursor; int updated = 0; int typeid = trackingBox.Disposition_Type_ID; DateTime date = trackingBox.Disposition_Date; string notes = trackingBox.Disposition_Notes; string typeString = SobekCM_Library_Settings.Disposition_Term_Past(typeid); if (notes.Trim().Length == 0) { notes = SobekCM_Library_Settings.Disposition_Term_Past(typeid); } foreach (DataRow thisRow in gridPanel.Selected_Row) { int itemid = Convert.ToInt32(thisRow["ItemID"]); if (itemid > 0) { if (SobekCM_Database.Update_Disposition(itemid, typeid, notes, date, username)) { thisRow["Disposition_Type"] = typeString; thisRow["Disposition_Date"] = date; } updated++; } } Cursor = Cursors.Default; gridPanel.Refresh(); MessageBox.Show(updated + " records updated."); } }
private void editDispositionAdviceMenuItem_Click(object sender, EventArgs e) { if ((gridPanel == null) || (gridPanel.Selected_Row == null) || (gridPanel.Selected_Row.Length == 0)) { return; } Edit_Disposition_Advice_Form trackingBox = new Edit_Disposition_Advice_Form(); if (trackingBox.ShowDialog() == DialogResult.OK) { Cursor = Cursors.WaitCursor; int updated = 0; int typeid = trackingBox.Disposition_Type_ID; string notes = trackingBox.Disposition_Notes; string typeString = SobekCM_Library_Settings.Disposition_Term_Future(typeid); foreach (DataRow thisRow in gridPanel.Selected_Row) { int itemid = Convert.ToInt32(thisRow["ItemID"]); if (itemid > 0) { if (thisRow["Disposition_Date"] == DBNull.Value) { if (SobekCM_Database.Edit_Disposition_Advice(itemid, typeid, notes)) { thisRow["Disposition_Advice"] = typeString; //thisRow["Disposition_Advice_Notes"] = notes; } updated++; } } } Cursor = Cursors.Default; gridPanel.Refresh(); MessageBox.Show(updated + " records updated."); } }
/// <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 individual metadata elements are added as controls, not HTML </remarks> public override void Write_ItemNavForm_Closing(TextWriter Output, Custom_Tracer Tracer) { const string BEHAVIORS = "BEHAVIORS"; Tracer.Add_Trace("Edit_Group_Behaviors_MySobekViewer.Write_ItemNavForm_Closing", ""); Output.WriteLine("<!-- Hidden field is used for postbacks to add new form elements (i.e., new name, new other titles, etc..) -->"); Output.WriteLine("<input type=\"hidden\" id=\"behaviors_request\" name=\"behaviors_request\" value=\"\" />"); Output.WriteLine("<div id=\"sbkIsw_Titlebar\">"); string grouptitle = item.Behaviors.GroupTitle; if (grouptitle.Length > 125) { Output.WriteLine("\t<h1 itemprop=\"name\"><abbr title=\"" + grouptitle + "\">" + grouptitle.Substring(0, 120) + "...</abbr></h1>"); } else { Output.WriteLine("\t<h1 itemprop=\"name\">" + grouptitle + "</h1>"); } Output.WriteLine("</div>"); Output.WriteLine("<div class=\"sbkMenu_Bar\" id=\"sbkIsw_MenuBar\" style=\"height:20px\"> </div>"); Output.WriteLine("<div id=\"container-inner1000\">"); Output.WriteLine("<div id=\"pagecontainer\">"); Output.WriteLine("<!-- Edit_Group_Behaviors_MySobekViewer.Write_ItemNavForm_Closing -->"); Output.WriteLine("<div class=\"sbkMySobek_HomeText\">"); Output.WriteLine(" <br />"); Output.WriteLine(" <h2>Edit the behaviors associated with this item group within this library</h2>"); Output.WriteLine(" <ul>"); Output.WriteLine(" <li>Enter the data for this item group below and press the SAVE button when all your edits are complete.</li>"); Output.WriteLine(" <li>Clicking on the green plus button ( <img class=\"repeat_button\" src=\"" + currentMode.Base_URL + "default/images/new_element_demo.jpg\" /> ) will add another instance of the element, if the element is repeatable.</li>"); Output.WriteLine(" <li>Click <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "help/groupbehaviors\" target=\"_EDIT_INSTRUCTIONS\">here for detailed instructions</a> on editing behaviors online.</li>"); Output.WriteLine(" </ul>"); Output.WriteLine("</div>"); Output.WriteLine(); Output.WriteLine("<a name=\"template\"> </a>"); Output.WriteLine("<div id=\"tabContainer\" class=\"fulltabs\">"); Output.WriteLine(" <div class=\"tabs\">"); Output.WriteLine(" <ul>"); Output.WriteLine(" <li id=\"tabHeader_1\" class=\"tabActiveHeader\">" + BEHAVIORS + "</li>"); Output.WriteLine(" </ul>"); Output.WriteLine(" </div>"); Output.WriteLine(" <div class=\"graytabscontent\">"); Output.WriteLine(" <div class=\"tabpage\" id=\"tabpage_1\">"); Output.WriteLine(" <!-- Add SAVE and CANCEL buttons to top of form -->"); Output.WriteLine(" <script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_metadata.js\" type=\"text/javascript\"></script>"); Output.WriteLine(); Output.WriteLine(" <div class=\"sbkMySobek_RightButtons\">"); Output.WriteLine(" <button onclick=\"behaviors_cancel_form(); return false;\" class=\"sbkMySobek_BigButton\"><img src=\"" + currentMode.Base_URL + "default/images/button_previous_arrow.png\" class=\"sbkMySobek_RoundButton_LeftImg\" alt=\"\" /> CANCEL </button> "); Output.WriteLine(" <button onclick=\"behaviors_save_form(); return false;\" class=\"sbkMySobek_BigButton\"> SAVE <img src=\"" + currentMode.Base_URL + "default/images/button_next_arrow.png\" class=\"sbkMySobek_RoundButton_RightImg\" alt=\"\" /></button>"); Output.WriteLine(" </div>"); Output.WriteLine(" <br /><br />"); Output.WriteLine(); bool isMozilla = currentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0; template.Render_Template_HTML(Output, item, currentMode.Skin == currentMode.Default_Skin ? currentMode.Skin.ToUpper() : currentMode.Skin, isMozilla, user, currentMode.Language, Translator, currentMode.Base_URL, 1); // Add the second buttons at the bottom of the form Output.WriteLine(); Output.WriteLine(" <!-- Add SAVE and CANCEL buttons to bottom of form -->"); Output.WriteLine(" <div class=\"sbkMySobek_RightButtons\">"); Output.WriteLine(" <button onclick=\"behaviors_cancel_form(); return false;\" class=\"sbkMySobek_BigButton\"><img src=\"" + currentMode.Base_URL + "default/images/button_previous_arrow.png\" class=\"sbkMySobek_RoundButton_LeftImg\" alt=\"\" /> CANCEL </button> "); Output.WriteLine(" <button onclick=\"behaviors_save_form(); return false;\" class=\"sbkMySobek_BigButton\"> SAVE <img src=\"" + currentMode.Base_URL + "default/images/button_next_arrow.png\" class=\"sbkMySobek_RoundButton_RightImg\" alt=\"\" /></button>"); Output.WriteLine(" </div>"); Output.WriteLine(" <br />"); Output.WriteLine(" </div>"); Output.WriteLine(" </div>"); Output.WriteLine("</div>"); Output.WriteLine("</div>"); 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 Add_HTML_In_Main_Form(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Skins_AdminViewer.Add_HTML_In_Main_Form", "Add any popup divisions for form elements"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-1.6.2.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.8.16.custom.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_form.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_interface_tosave\" name=\"admin_interface_tosave\" value=\"\" />"); Output.WriteLine("<input type=\"hidden\" id=\"admin_interface_reset\" name=\"admin_interface_reset\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- HTML Skins Edit Form -->"); Output.WriteLine("<div class=\"admin_interface_popup_div\" id=\"form_interface\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">EDIT WEB SKIN</td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"interface_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for interface code and base interface code Output.Write(" <tr align=\"left\"><td width=\"112px\"><label for=\"form_interface_code\">Web Skin Code:</label></td>"); Output.Write("<td width=\"220px\"><span class=\"form_linkline admin_existing_code_line\" id=\"form_interface_code\"></span></td>"); Output.WriteLine("<td><label for=\"form_interface_basecode\">Base Skin Code:</label> <input class=\"admin_interface_small_input\" name=\"form_interface_basecode\" id=\"form_interface_basecode\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('form_interface_basecode', 'admin_interface_small_input_focused')\" onblur=\"javascript:textbox_leave('form_interface_basecode', 'admin_interface_small_input')\" /></td></tr>"); // Add line for banner link Output.WriteLine(" <tr align=\"left\"><td><label for=\"form_interface_link\">Banner Link:</label></td><td colspan=\"2\"><input class=\"admin_interface_large_input\" name=\"form_interface_link\" id=\"form_interface_link\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('form_interface_link', 'admin_interface_large_input_focused')\" onblur=\"javascript:textbox_leave('form_interface_link', 'admin_interface_large_input')\" /></td></tr>"); // Add line for notes Output.WriteLine(" <tr align=\"left\"><td><label for=\"form_interface_notes\">Notes:</label></td><td colspan=\"2\"><input class=\"admin_interface_large_input\" name=\"form_interface_notes\" id=\"form_interface_notes\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('form_interface_notes', 'admin_interface_large_input_focused')\" onblur=\"javascript:textbox_leave('form_interface_notes', 'admin_interface_large_input')\" /></td></tr>"); // Add checkboxes for overriding the header/footer and overriding banner Output.WriteLine(" <tr><td>Flags:</td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"form_interface_header_override\" id=\"form_interface_header_override\" checked=\"checked\" /> <label for=\"form_interface_header_override\">Override header and footer?</label></td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"form_interface_banner_override\" id=\"form_interface_banner_override\" /> <label for=\"form_interface_banner_override\">Override banner?</label></td></tr>"); Output.WriteLine(" <tr><td> </td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"form_interface_top_nav\" id=\"form_interface_top_nav\" /> <label for=\"form_interface_top_nav\">Suppress top-level navigation?</label></td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"form_interface_buildlaunch\" id=\"form_interface_buildlaunch\" /> <label for=\"form_interface_buildlaunch\">Build on launch?</label></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine(" <center><a href=\"\" onclick=\"return interface_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>"); Output.WriteLine("</div>"); Tracer.Add_Trace("Skins_AdminViewer.Add_HTML_In_Main_Form", ""); Output.WriteLine("<!-- Skins_AdminViewer.Add_HTML_In_Main_Form -->"); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"SobekHomeText\">"); if (actionMessage.Length > 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <center><b>" + actionMessage + "</b></center>"); } Output.WriteLine(" <blockquote>For clarification of any terms on this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/webskins\" target=\"ADMIN_INTERFACE_HELP\" >click here to view the help page</a>.</blockquote>"); Output.WriteLine(" <span class=\"SobekAdminTitle\">New Web Skin</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <div class=\"admin_interface_new_div\">"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for interface code and base interface code Output.Write(" <tr><td width=\"112px\"><label for=\"admin_interface_code\">Web Skin Code:</label></td>"); Output.Write("<td width=\"220px\"><input class=\"admin_interface_small_input\" name=\"admin_interface_code\" id=\"admin_interface_code\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_interface_code', 'admin_interface_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_interface_code', 'admin_interface_small_input')\" /></td>"); Output.WriteLine("<td><label for=\"admin_interface_basecode\">Base Skin Code:</label> <input class=\"admin_interface_small_input\" name=\"admin_interface_basecode\" id=\"admin_interface_basecode\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_interface_basecode', 'admin_interface_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_interface_basecode', 'admin_interface_small_input')\" /></td></tr>"); // Add line for banner link Output.WriteLine(" <tr><td><label for=\"admin_interface_link\">Banner Link:</label></td><td colspan=\"2\"><input class=\"admin_interface_large_input\" name=\"admin_interface_link\" id=\"admin_interface_link\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_interface_link', 'admin_interface_large_input_focused')\" onblur=\"javascript:textbox_leave('admin_interface_link', 'admin_interface_large_input')\" /></td></tr>"); // Add line for notes Output.WriteLine(" <tr><td><label for=\"admin_interface_notes\">Notes:</label></td><td colspan=\"2\"><input class=\"admin_interface_large_input\" name=\"admin_interface_notes\" id=\"admin_interface_notes\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_interface_notes', 'admin_interface_large_input_focused')\" onblur=\"javascript:textbox_leave('admin_interface_notes', 'admin_interface_large_input')\" /></td></tr>"); // Add checkboxes for overriding the header/footer and overriding banner Output.WriteLine(" <tr><td>Flags:</td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"admin_interface_header_override\" id=\"admin_interface_header_override\" checked=\"checked\" /> <label for=\"admin_interface_header_override\">Override header and footer?</label></td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"admin_interface_banner_override\" id=\"admin_interface_banner_override\" /> <label for=\"admin_interface_banner_override\">Override banner?</label></td></tr>"); Output.WriteLine(" <tr><td> </td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"admin_interface_top_nav\" id=\"admin_interface_top_nav\" /> <label for=\"admin_interface_top_nav\">Suppress top-level navigation?</label></td><td><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"admin_interface_buildlaunch\" id=\"admin_interface_buildlaunch\" /> <label for=\"admin_interface_buildlaunch\">Build on launch?</label></td></tr>"); Output.WriteLine(" <tr><td> </td><td colspan=\"2\"><input class=\"admin_interface_checkbox\" type=\"checkbox\" name=\"admin_interface_copycurrent\" id=\"admin_interface_copycurrent\" /> <label for=\"admin_interface_copycurrent\">Copy current files for this new web skin if folder does not exist?</label></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine(" <center><input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\" onclick=\"return save_new_interface();\"/></center>"); Output.WriteLine(" </div>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Existing Web Skins</span>"); // Get the list of all aggregations Output.WriteLine(" <blockquote>"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"180px\" align=\"left\"><span style=\"color: White\"> ACTIONS</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"left\"><span style=\"color: White\">CODE</span></th>"); Output.WriteLine(" <th width=\"90px\" align=\"left\"><span style=\"color: White\">BASE</span></th>"); Output.WriteLine(" <th width=\"300px\" align=\"left\"><span style=\"color: White\">NOTES</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>"); // Get the view URL string current_skin = currentMode.Skin; currentMode.Skin = "TESTSKINCODE"; string view_url = currentMode.Redirect_URL(); currentMode.Skin = current_skin; // Write the data for each interface foreach (DataRow thisRow in skinCollection.Skin_Table.Rows) { // Pull all these values string code = thisRow["WebSkinCode"].ToString(); string base_code = thisRow["BaseInterface"].ToString(); string notes = thisRow["Notes"].ToString(); bool overrideHeader = Convert.ToBoolean(thisRow["OverrideHeaderFooter"]); bool overrideBanner = Convert.ToBoolean(thisRow["OverrideBanner"]); bool buildOnLaunch = Convert.ToBoolean(thisRow["Build_On_Launch"]); bool suppressTopNav = Convert.ToBoolean(thisRow["SuppressTopNavigation"]); string bannerLink = thisRow["BannerLink"].ToString(); // Build the action links Output.WriteLine(" <tr align=\"left\" >"); Output.Write(" <td class=\"SobekAdminActionLink\" >( "); Output.Write("<a title=\"Click to edit\" id=\"EDIT_" + code + "\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return interface_form_popup('EDIT_" + code + "', '" + code + "','" + base_code + "','" + bannerLink + "','" + notes + "','" + overrideBanner + "','" + overrideHeader + "','" + suppressTopNav + "','" + buildOnLaunch + "');\">edit</a> | "); Output.Write("<a title=\"Click to view\" href=\"" + view_url.Replace("testskincode", code) + "\" >view</a> | "); Output.WriteLine("<a title=\"Click to reset\" href=\"javascript:reset_interface('" + code + "');\">reset</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td>" + code + "</span></td>"); Output.WriteLine(" <td>" + base_code + "</span></td>"); Output.WriteLine(" <td>" + notes + "</span></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>"); } Output.WriteLine("</table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
/// <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=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.10.3.custom.min.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=\"" + currentMode.Base_URL + "default/scripts/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=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "adminhelp/aggregations\" target=\"ADMIN_INTERFACE_HELP\" >click here to view the help page</a>.</p>"); // Find the matching type to display int index = 0; if (currentMode.My_Sobek_SubMode.Length > 0) { Int32.TryParse(currentMode.My_Sobek_SubMode, out index); } if ((index <= 0) || (index > codeManager.Types_Count)) { Output.WriteLine(" <h2>New Item Aggregation</h2>"); Output.WriteLine(" <div class=\"sbkAsav_NewDiv\">"); 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\">"); 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 codeManager.All_Aggregations) { if (enteredParent == thisAggr.ID.ToString()) { Output.WriteLine(" <option value=\"" + thisAggr.ID + "\" selected=\"selected\" >" + thisAggr.Code + " - " + thisAggr.Name + "</option>"); } else { Output.WriteLine(" <option value=\"" + thisAggr.ID + "\" >" + thisAggr.Code + " - " + 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) + "\" /></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) + "\" /></td></tr>"); // Add the link line Output.WriteLine(" <tr><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 thematicHeadings) { Output.Write(" <option value=\"" + thisHeading.ThematicHeadingID + "\">" + HttpUtility.HtmlEncode(thisHeading.ThemeName) + "</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=\"" + 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(); Output.WriteLine(" <h2 id=\"list\">Existing Item Aggregations</h2>"); Output.WriteLine(" <p>Select a type below to view all matching item aggregations:</p>"); Output.WriteLine(" <ul class=\"sbkAsav_List\">"); int i = 1; foreach (string thisType in codeManager.All_Types) { currentMode.My_Sobek_SubMode = i.ToString(); Output.WriteLine(" <li><a href=\"" + currentMode.Redirect_URL() + "\" >" + thisType.ToUpper() + "</a></li>"); i++; } currentMode.My_Sobek_SubMode = String.Empty; Output.WriteLine(" </ul>"); } else { string aggregationType = codeManager.All_Types[index - 1]; Output.WriteLine(" <h2>Other Actions</h2>"); Output.WriteLine(" <ul class=\"sbkAsav_List\">"); currentMode.My_Sobek_SubMode = String.Empty; Output.WriteLine(" <li><a href=\"" + currentMode.Redirect_URL() + "\">Add new item aggregation</a></li>"); Output.WriteLine(" <li><a href=\"" + currentMode.Redirect_URL() + "#list\">View different aggregations</a></li>"); currentMode.My_Sobek_SubMode = index.ToString(); Output.WriteLine(" </ul>"); Output.WriteLine(); Output.WriteLine(" <h2>Existing " + aggregationType + "s</h2>"); Output.WriteLine(" <table class=\"sbkAsav_Table sbkAdm_Table\">"); 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\">NAME</th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); Output.WriteLine(" <tr class=\"sbkAsav_TableTitleRow\" style=\"\" >"); if ((aggregationType.Length > 0) && (aggregationType[aggregationType.Length - 1] != 'S')) { Output.WriteLine(" <td colspan=\"3\">" + aggregationType.ToUpper() + "S</td>"); } else { Output.WriteLine(" <td colspan=\"3\">" + aggregationType.ToUpper() + "</td>"); } Output.WriteLine(" </tr>"); // Show all matching rows string last_code = String.Empty; foreach (Item_Aggregation_Related_Aggregations thisAggr in codeManager.Aggregations_By_Type(aggregationType)) { if (thisAggr.Code != last_code) { last_code = thisAggr.Code; // Build the action links Output.WriteLine(" <tr>"); Output.Write(" <td class=\"sbkAdm_ActionLink\" >( "); Output.Write("<a title=\"Click to edit this item aggregation\" href=\"" + currentMode.Base_URL + "l/admin/editaggr/" + thisAggr.Code + "\">edit</a> | "); if (thisAggr.Active) Output.Write("<a title=\"Click to view this item aggregation\" href=\"" + currentMode.Base_URL + "l/" + thisAggr.Code + "\">view</a> | "); else Output.Write("view | "); Output.Write("<a title=\"Click to delete this item aggregation\" href=\"" + currentMode.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=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return reset_aggr('" + thisAggr.Code + "');\">reset</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td>" + thisAggr.Code + "</td>"); Output.WriteLine(" <td>" + thisAggr.Name + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); } } Output.WriteLine(" </table>"); } Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
/// <summary> Adds the controls for this result viewer to the place holder on the main form </summary> /// <param name="MainPlaceHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns> public override void Add_HTML(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Brief_ResultsWriter.Add_HTML", "Rendering results in brief view"); } // If results are null, or no results, return empty string if ((Paged_Results == null) || (Results_Statistics == null) || (Results_Statistics.Total_Items <= 0)) { return; } const string VARIES_STRING = "<span style=\"color:Gray\">( varies )</span>"; // Get the text search redirect stem and (writer-adjusted) base url string textRedirectStem = Text_Redirect_Stem; string base_url = CurrentMode.Base_URL; if (CurrentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn) { base_url = CurrentMode.Base_URL + "l/"; } // Start the results StringBuilder resultsBldr = new StringBuilder(2000); resultsBldr.AppendLine("<br />"); resultsBldr.AppendLine("<table>"); // Set the counter for these results from the page int result_counter = ((CurrentMode.Page - 1) * Results_Per_Page) + 1; // Step through all the results int current_row = 0; foreach (iSearch_Title_Result titleResult in Paged_Results) { bool multiple_title = titleResult.Item_Count > 1; // Always get the first item for things like the main link and thumbnail iSearch_Item_Result firstItemResult = titleResult.Get_Item(0); // Determine the internal link to the first (possibly only) item string internal_link = base_url + titleResult.BibID + "/" + firstItemResult.VID + textRedirectStem; // For browses, just point to the title if (CurrentMode.Mode == Display_Mode_Enum.Aggregation) // browse info only { internal_link = base_url + titleResult.BibID + textRedirectStem; } // Start this row if (multiple_title) { resultsBldr.AppendLine("\t<tr valign=\"top\" onmouseover=\"this.className='tableRowHighlight'\" onmouseout=\"this.className='tableRowNormal'\" >"); } else { resultsBldr.AppendLine("\t<tr valign=\"top\" onmouseover=\"this.className='tableRowHighlight'\" onmouseout=\"this.className='tableRowNormal'\" onclick=\"window.location.href='" + internal_link + "';\" >"); } // Add the counter as the first column resultsBldr.AppendLine("\t\t<td><br /><b>" + result_counter + "</b></td>\t\t<td valign=\"top\" width=\"150\">"); //// Is this restricted? bool restricted_by_ip = false; if ((titleResult.Item_Count == 1) && (firstItemResult.IP_Restriction_Mask > 0)) { int comparison = firstItemResult.IP_Restriction_Mask & current_user_mask; if (comparison == 0) { restricted_by_ip = true; } } // Calculate the thumbnail string thumb = titleResult.BibID.Substring(0, 2) + "/" + titleResult.BibID.Substring(2, 2) + "/" + titleResult.BibID.Substring(4, 2) + "/" + titleResult.BibID.Substring(6, 2) + "/" + titleResult.BibID.Substring(8) + "/" + firstItemResult.VID + "/" + (firstItemResult.MainThumbnail).Replace("\\", "/").Replace("//", "/"); // Draw the thumbnail if ((thumb.ToUpper().IndexOf(".JPG") < 0) && (thumb.ToUpper().IndexOf(".GIF") < 0)) { resultsBldr.AppendLine("<a href=\"" + internal_link + "\"><img src=\"" + CurrentMode.Default_Images_URL + "NoThumb.jpg\" border=\"0px\" class=\"resultsThumbnail\" alt=\"MISSING THUMBNAIL\" /></a></td>"); } else { resultsBldr.AppendLine("<a href=\"" + internal_link + "\"><img src=\"" + SobekCM_Library_Settings.Image_URL + thumb + "\" class=\"resultsThumbnail\" alt=\"MISSING THUMBNAIL\" /></a></td>"); } resultsBldr.AppendLine("\t\t<td>"); // If this was access restricted, add that if (restricted_by_ip) { resultsBldr.AppendLine("<span class=\"RestrictedItemText\">" + Translator.Get_Translation("Access Restricted", CurrentMode.Language) + "</span>"); } // Add each element to this table resultsBldr.AppendLine("\t\t\t<table cellspacing=\"0px\">"); if (multiple_title) { resultsBldr.AppendLine("\t\t\t\t<tr style=\"height:40px;\" valign=\"middle\"><td colspan=\"3\"><span class=\"briefResultsTitle\"><a href=\"" + internal_link + "\">" + titleResult.GroupTitle.Replace("<", "<").Replace(">", ">") + "</a></span> </td></tr>"); } else { resultsBldr.AppendLine( "\t\t\t\t<tr style=\"height:40px;\" valign=\"middle\"><td colspan=\"3\"><span class=\"briefResultsTitle\"><a href=\"" + internal_link + "\">" + firstItemResult.Title.Replace("<", "<").Replace(">", ">") + "</a></span> </td></tr>"); } if ((titleResult.Primary_Identifier_Type.Length > 0) && (titleResult.Primary_Identifier.Length > 0)) { resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(titleResult.Primary_Identifier_Type, CurrentMode.Language) + ":</td><td> </td><td>" + titleResult.Primary_Identifier + "</td></tr>"); } if (CurrentMode.Internal_User) { resultsBldr.AppendLine("\t\t\t\t<tr><td>BibID:</td><td> </td><td>" + titleResult.BibID + "</td></tr>"); if (titleResult.OPAC_Number > 1) { resultsBldr.AppendLine("\t\t\t\t<tr><td>OPAC:</td><td> </td><td>" + titleResult.OPAC_Number + "</td></tr>"); } if (titleResult.OCLC_Number > 1) { resultsBldr.AppendLine("\t\t\t\t<tr><td>OCLC:</td><td> </td><td>" + titleResult.OCLC_Number + "</td></tr>"); } } for (int i = 0; i < Results_Statistics.Metadata_Labels.Count; i++) { string field = Results_Statistics.Metadata_Labels[i]; string value = titleResult.Metadata_Display_Values[i]; Metadata_Search_Field thisField = SobekCM_Library_Settings.Metadata_Search_Field_By_Name(field); string display_field = string.Empty; if (thisField != null) { display_field = thisField.Display_Term; } if (display_field.Length == 0) { display_field = field.Replace("_", " "); } if (value == "*") { resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(display_field, CurrentMode.Language) + ":</td><td> </td><td>" + System.Web.HttpUtility.HtmlDecode(VARIES_STRING) + "</td></tr>"); } else if (value.Trim().Length > 0) { if (value.IndexOf("|") > 0) { bool value_found = false; string[] value_split = value.Split("|".ToCharArray()); foreach (string thisValue in value_split) { if (thisValue.Trim().Trim().Length > 0) { if (!value_found) { resultsBldr.AppendLine("\t\t\t\t<tr valign=\"top\"><td>" + Translator.Get_Translation(display_field, CurrentMode.Language) + ":</td><td> </td><td>"); value_found = true; } resultsBldr.Append(System.Web.HttpUtility.HtmlDecode(thisValue) + "<br />"); } } if (value_found) { resultsBldr.AppendLine("</td></tr>"); } } else { resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(display_field, CurrentMode.Language) + ":</td><td> </td><td>" + System.Web.HttpUtility.HtmlDecode(value) + "</td></tr>"); } } } //if (titleResult.Author.Length > 0) //{ // string creatorString = "Author"; // if (titleResult.MaterialType.ToUpper().IndexOf("ARTIFACT") == 0) // { // creatorString = "Creator"; // } // if (titleResult.Author == "*") // { // resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(creatorString, CurrentMode.Language) + ":</td><td> </td><td>" + VARIES_STRING + "</td></tr>"); // } // else // { // bool author_found = false; // string[] author_split = titleResult.Author.Split("|".ToCharArray()); // foreach (string thisAuthor in author_split) // { // if (thisAuthor.ToUpper().IndexOf("PUBLISHER") < 0) // { // if (!author_found) // { // resultsBldr.AppendLine("\t\t\t\t<tr valign=\"top\"><td>" +Translator.Get_Translation(creatorString, CurrentMode.Language) + ":</td><td> </td><td>"); // author_found = true; // } // resultsBldr.Append(thisAuthor + "<br />"); // } // } // if (author_found) // { // resultsBldr.AppendLine("</td></tr>"); // } // } //} if (titleResult.Snippet.Length > 0) { resultsBldr.AppendLine("\t\t\t\t<tr><td colspan=\"3\"><br />“..." + titleResult.Snippet.Replace("<em>", "<span class=\"texthighlight\">").Replace("</em>", "</span>") + "...”</td></tr>"); } resultsBldr.AppendLine("\t\t\t</table>"); // End this row resultsBldr.AppendLine("\t\t<br />"); // Add children, if there are some if (multiple_title) { // Add this to the place holder Literal thisLiteral = new Literal { Text = resultsBldr.ToString().Replace("<role>", "<i>").Replace("</role>", "</i>") }; MainPlaceHolder.Controls.Add(thisLiteral); resultsBldr.Remove(0, resultsBldr.Length); Add_Issue_Tree(MainPlaceHolder, titleResult, current_row, textRedirectStem, base_url); } resultsBldr.AppendLine("\t\t</td>"); resultsBldr.AppendLine("\t</tr>"); // Add a horizontal line resultsBldr.AppendLine("\t<tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); // Increment the result counters result_counter++; current_row++; } // End this table resultsBldr.AppendLine("</table>"); // Add this to the HTML page Literal mainLiteral = new Literal { Text = resultsBldr.ToString().Replace("<role>", "<i>").Replace("</role>", "</i>") }; MainPlaceHolder.Controls.Add(mainLiteral); }
/// <summary> Adds the controls for this result viewer to the place holder on the main form </summary> /// <param name="MainPlaceHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns> public override void Add_HTML(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Thumbnail_ResultsWriter.Add_HTML", "Rendering results in thumbnail view"); } // If results are null, or no results, return empty string if ((Paged_Results == null) || (Results_Statistics == null) || (Results_Statistics.Total_Items <= 0)) { return; } // Get the text search redirect stem and (writer-adjusted) base url string textRedirectStem = Text_Redirect_Stem; string base_url = CurrentMode.Base_URL; if (CurrentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn) { base_url = CurrentMode.Base_URL + "l/"; } // Should the publication date be shown? bool showDate = false; if (CurrentMode.Sort >= 10) { showDate = true; } // Start this table StringBuilder resultsBldr = new StringBuilder(5000); //Add the necessary JavaScript, CSS files //resultsBldr.AppendLine("<script type=\"text/javascript\" src=\"" + CurrentMode.Base_URL + "default/scripts/jquery/jquery-1.10.2.min.js\"></script>"); //resultsBldr.AppendLine("<script type=\"text/javascript\" src=\"" + CurrentMode.Base_URL + "default/scripts/jquery/jquery.qtip.min.js\"></script>"); //resultsBldr.AppendLine(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" + CurrentMode.Base_URL + "default/scripts/jquery/jquery.qtip.min.css\" /> "); // resultsBldr.AppendLine("<script type=\"text/javascript\" src=\"" + CurrentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.10.1.js\"></script>"); resultsBldr.AppendLine(" <script type=\"text/javascript\" src=\"" + CurrentMode.Base_URL + "default/scripts/sobekcm_thumb_results.js\"></script>"); // Start this table resultsBldr.AppendLine("<table align=\"center\" width=\"100%\" cellspacing=\"15px\">"); resultsBldr.AppendLine("\t<tr>"); resultsBldr.AppendLine("\t\t<td width=\"25%\"> </td>"); resultsBldr.AppendLine("\t\t<td width=\"25%\"> </td>"); resultsBldr.AppendLine("\t\t<td width=\"25%\"> </td>"); resultsBldr.AppendLine("\t\t<td width=\"25%\"> </td>"); resultsBldr.AppendLine("\t</tr>"); resultsBldr.AppendLine("\t<tr valign=\"top\">"); // Step through all the results int col = 0; int title_count = 0; foreach (iSearch_Title_Result titleResult in Paged_Results) { title_count++; // Should a new row be started if (col == 4) { col = 0; resultsBldr.AppendLine("\t</tr>"); // Horizontal Line resultsBldr.AppendLine("\t<tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>"); resultsBldr.AppendLine("\t<tr valign=\"top\">"); } bool multiple_title = titleResult.Item_Count > 1; // Always get the first item for things like the main link and thumbnail iSearch_Item_Result firstItemResult = titleResult.Get_Item(0); // Determine the internal link to the first (possibly only) item string internal_link = base_url + titleResult.BibID + "/" + firstItemResult.VID + textRedirectStem; // For browses, just point to the title if ((CurrentMode.Mode == Display_Mode_Enum.Aggregation) && (CurrentMode.Aggregation_Type == Aggregation_Type_Enum.Browse_Info)) { internal_link = base_url + titleResult.BibID + textRedirectStem; } resultsBldr.AppendLine("\t\t<td align=\"center\" onmouseover=\"this.className='tableRowHighlight'\" onmouseout=\"this.className='tableRowNormal'\" onclick=\"window.location.href='" + internal_link + "';\" >"); string title; if (multiple_title) { // Determine term to use string multi_term = "volume"; if (titleResult.MaterialType.ToUpper() == "NEWSPAPER") { multi_term = titleResult.Item_Count > 1 ? "issues" : "issue"; } else { if (titleResult.Item_Count > 1) { multi_term = "volumes"; } } if ((showDate)) { if (firstItemResult.PubDate.Length > 0) { title = "[" + firstItemResult.PubDate + "] " + titleResult.GroupTitle; } else { title = titleResult.GroupTitle; } } else { title = titleResult.GroupTitle + "<br />( " + titleResult.Item_Count + " " + multi_term + " )"; } } else { if (showDate) { if (firstItemResult.PubDate.Length > 0) { title = "[" + firstItemResult.PubDate + "] " + firstItemResult.Title; } else { title = firstItemResult.Title; } } else { title = firstItemResult.Title; } } // Start the HTML for this item resultsBldr.AppendLine("<table width=\"150px\">"); //// Is this restricted? bool restricted_by_ip = false; if ((titleResult.Item_Count == 1) && (firstItemResult.IP_Restriction_Mask > 0)) { int comparison = firstItemResult.IP_Restriction_Mask & current_user_mask; if (comparison == 0) { restricted_by_ip = true; } } // Calculate the thumbnail // Add the thumbnail if ((firstItemResult.MainThumbnail.ToUpper().IndexOf(".JPG") < 0) && (firstItemResult.MainThumbnail.ToUpper().IndexOf(".GIF") < 0)) { resultsBldr.AppendLine("<tr><td><span id=\"sbkThumbnailSpan" + title_count + "\"><a href=\"" + internal_link + "\"><img id=\"sbkThumbnailImg" + title_count + "\" src=\"" + CurrentMode.Default_Images_URL + "NoThumb.jpg\" /></a></span></td></tr>"); } else { string thumb = SobekCM_Library_Settings.Image_URL + titleResult.BibID.Substring(0, 2) + "/" + titleResult.BibID.Substring(2, 2) + "/" + titleResult.BibID.Substring(4, 2) + "/" + titleResult.BibID.Substring(6, 2) + "/" + titleResult.BibID.Substring(8) + "/" + firstItemResult.VID + "/" + (firstItemResult.MainThumbnail).Replace("\\", "/").Replace("//", "/"); resultsBldr.AppendLine("<tr><td><span id=\"sbkThumbnailSpan" + title_count + "\"><a href=\"" + internal_link + "\"><img id=\"sbkThumbnailImg" + title_count + "\"src=\"" + thumb + "\" alt=\"MISSING THUMBNAIL\" /></a></span></td></tr>"); } #region Add the div displayed as a tooltip for this thumbnail on hover const string VARIES_STRING = "<span style=\"color:Gray\">( varies )</span>"; //Add the hidden item values for display in the tooltip resultsBldr.AppendLine("<tr style=\"display:none;\"><td colspan=\"100%\"><div id=\"descThumbnail" + title_count + "\" >"); // Add each element to this table resultsBldr.AppendLine("\t\t\t<table cellspacing=\"0px\">"); if (multiple_title) { //<a href=\"" + internal_link + "\"> resultsBldr.AppendLine("\t\t\t\t<tr style=\"height:40px;\" valign=\"middle\"><td colspan=\"3\"><span class=\"qtip_BriefTitle\" style=\"color: #a5a5a5;font-weight: bold;font-size:13px;\">" + titleResult.GroupTitle.Replace("<", "<").Replace(">", ">") + "</span> </td></tr>"); resultsBldr.AppendLine("<tr><td colspan=\"100%\"><br/></td></tr>"); } else { resultsBldr.AppendLine( "\t\t\t\t<tr style=\"height:40px;\" valign=\"middle\"><td colspan=\"3\"><span class=\"qtip_BriefTitle\" style=\"color: #a5a5a5;font-weight: bold;font-size:13px;\">" + firstItemResult.Title.Replace("<", "<").Replace(">", ">") + "</span> </td></tr><br/>"); resultsBldr.AppendLine("<tr><td colspan=\"100%\"><br/></td></tr>"); } if ((titleResult.Primary_Identifier_Type.Length > 0) && (titleResult.Primary_Identifier.Length > 0)) { resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(titleResult.Primary_Identifier_Type, CurrentMode.Language) + ":</td><td> </td><td>" + System.Web.HttpUtility.HtmlDecode(titleResult.Primary_Identifier) + "</td></tr>"); } if (CurrentMode.Internal_User) { resultsBldr.AppendLine("\t\t\t\t<tr><td>BibID:</td><td> </td><td>" + titleResult.BibID + "</td></tr>"); if (titleResult.OPAC_Number > 1) { resultsBldr.AppendLine("\t\t\t\t<tr><td>OPAC:</td><td> </td><td>" + titleResult.OPAC_Number + "</td></tr>"); } if (titleResult.OCLC_Number > 1) { resultsBldr.AppendLine("\t\t\t\t<tr><td>OCLC:</td><td> </td><td>" + titleResult.OCLC_Number + "</td></tr>"); } } for (int i = 0; i < Results_Statistics.Metadata_Labels.Count; i++) { string field = Results_Statistics.Metadata_Labels[i]; string value = titleResult.Metadata_Display_Values[i]; Metadata_Search_Field thisField = SobekCM_Library_Settings.Metadata_Search_Field_By_Name(field); string display_field = string.Empty; if (thisField != null) { display_field = thisField.Display_Term; } if (display_field.Length == 0) { display_field = field.Replace("_", " "); } if (value == "*") { resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(display_field, CurrentMode.Language) + ":</td><td> </td><td>" + System.Web.HttpUtility.HtmlDecode(VARIES_STRING) + "</td></tr>"); } else if (value.Trim().Length > 0) { if (value.IndexOf("|") > 0) { bool value_found = false; string[] value_split = value.Split("|".ToCharArray()); foreach (string thisValue in value_split) { if (thisValue.Trim().Trim().Length > 0) { if (!value_found) { resultsBldr.AppendLine("\t\t\t\t<tr valign=\"top\"><td>" + Translator.Get_Translation(display_field, CurrentMode.Language) + ":</td><td> </td><td>"); value_found = true; } resultsBldr.Append(System.Web.HttpUtility.HtmlDecode(thisValue) + "<br />"); } } if (value_found) { resultsBldr.AppendLine("</td></tr>"); } } else { resultsBldr.AppendLine("\t\t\t\t<tr><td>" + Translator.Get_Translation(display_field, CurrentMode.Language) + ":</td><td> </td><td>" + System.Web.HttpUtility.HtmlDecode(value) + "</td></tr>"); } } } if (titleResult.Snippet.Length > 0) { resultsBldr.AppendLine("\t\t\t\t<tr><td colspan=\"3\"><br />“..." + titleResult.Snippet.Replace("<em>", "<span class=\"texthighlight\">").Replace("</em>", "</span>") + "...”</td></tr>"); } resultsBldr.AppendLine("\t\t\t</table>"); // End this row // resultsBldr.AppendLine("\t\t<br />"); //// Add children, if there are some //if (multiple_title) //{ // // Add this to the place holder // Literal thisLiteral = new Literal // { Text = resultsBldr.ToString().Replace("<role>", "<i>").Replace( "</role>", "</i>") }; // MainPlaceHolder.Controls.Add(thisLiteral); // resultsBldr.Remove(0, resultsBldr.Length); // Add_Issue_Tree(MainPlaceHolder, titleResult, current_row, textRedirectStem, base_url); //} //resultsBldr.AppendLine("\t\t</td>"); //resultsBldr.AppendLine("\t</tr>"); // Add a horizontal line // resultsBldr.AppendLine("\t<tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); // End this table // resultsBldr.AppendLine("</table>"); resultsBldr.AppendLine("</div></td></tr>"); #endregion // Add the title resultsBldr.AppendLine("<tr><td align=\"center\"><span class=\"SobekThumbnailText\">" + title + "</span></td></tr>"); // If this was access restricted, add that if (restricted_by_ip) { resultsBldr.AppendLine("<tr><td align=\"center\"><span class=\"RestrictedItemText\">Access Restricted</span></td></tr>"); } // Finish this one thumbnail resultsBldr.AppendLine("</table></td>"); col++; } // Finish this row out while (col < 4) { resultsBldr.AppendLine("\t\t<td> </td>"); col++; } // End this table resultsBldr.AppendLine("\t</tr>"); resultsBldr.AppendLine("</table>"); // Add this to the html table Literal mainLiteral = new Literal { Text = resultsBldr.ToString() }; MainPlaceHolder.Controls.Add(mainLiteral); }
private void show_milestones_worklog() { // Pull the tracking information trackingInfo = SobekCM_Database.Tracking_Get_History_Archives(itemid, null); // Pull out the standard tracking milestones trackingInfoObj = new Tracking_Info(); trackingInfoObj.Set_Tracking_Info(trackingInfo); if (trackingInfoObj.Digital_Acquisition_Milestone.HasValue) { acquisitionLabel.Text = trackingInfoObj.Digital_Acquisition_Milestone.Value.ToShortDateString(); } if (trackingInfoObj.Image_Processing_Milestone.HasValue) { imageProcessingLabel.Text = trackingInfoObj.Image_Processing_Milestone.Value.ToShortDateString(); } if (trackingInfoObj.Quality_Control_Milestone.HasValue) { qcLabel.Text = trackingInfoObj.Quality_Control_Milestone.Value.ToShortDateString(); } if (trackingInfoObj.Online_Complete_Milestone.HasValue) { onlineCompleteLabel.Text = trackingInfoObj.Online_Complete_Milestone.Value.ToShortDateString(); } if (trackingInfoObj.Born_Digital) { if (trackingInfoObj.Material_Received_Date.HasValue) { if (trackingInfoObj.Material_Rec_Date_Estimated) { receivedLabel.Text = trackingInfoObj.Material_Received_Date.Value.ToShortDateString() + " (estimated - Born Digital)"; } else { receivedLabel.Text = trackingInfoObj.Material_Received_Date.Value.ToShortDateString() + " (Born Digital)"; } } else { receivedLabel.Text = "Born Digital"; } } else { if (trackingInfoObj.Material_Received_Date.HasValue) { if (trackingInfoObj.Material_Rec_Date_Estimated) { receivedLabel.Text = trackingInfoObj.Material_Received_Date.Value.ToShortDateString() + " (estimated)"; } else { receivedLabel.Text = trackingInfoObj.Material_Received_Date.Value.ToShortDateString(); } } } if (trackingInfoObj.Disposition_Date.HasValue) { adviceLinkLabel.Hide(); adviceLabel.Show(); dispositionLabel.Show(); dispositionLinkLabel.Hide(); string disposition = SobekCM_Library_Settings.Disposition_Term_Past(trackingInfoObj.Disposition_Type).ToUpper(); if (trackingInfoObj.Disposition_Notes.Trim().Length > 0) { dispositionLabel.Text = disposition + " " + trackingInfoObj.Disposition_Date.Value.ToShortDateString() + " - " + trackingInfoObj.Disposition_Notes; } else { dispositionLabel.Text = disposition + " " + trackingInfoObj.Disposition_Date.Value.ToShortDateString(); } } else { adviceLabel.Hide(); adviceLinkLabel.Show(); dispositionLabel.Hide(); dispositionLinkLabel.Show(); } if (trackingInfoObj.Disposition_Advice > 0) { string disposition = SobekCM_Library_Settings.Disposition_Term_Future(trackingInfoObj.Disposition_Advice).ToUpper(); if (trackingInfoObj.Disposition_Advice_Notes.Trim().Length > 0) { adviceLinkLabel.Text = disposition + " - " + trackingInfoObj.Disposition_Advice_Notes; adviceLabel.Text = disposition + " - " + trackingInfoObj.Disposition_Advice_Notes; } else { adviceLinkLabel.Text = disposition; adviceLabel.Text = disposition; } } if ((!trackingInfoObj.Locally_Archived) && (!trackingInfoObj.Remotely_Archived)) { archivingLabel1.Text = "NOT ARCHIVED"; archivingLabel2.Text = String.Empty; } else { if (trackingInfoObj.Locally_Archived) { archivingLabel1.Text = "Locally Stored on CD or Tape"; archivingLabel2.Text = trackingInfoObj.Remotely_Archived ? "Archived Remotely (FDA)" : String.Empty; } else { archivingLabel1.Text = "Archived Remotely (FDA)"; archivingLabel2.Text = String.Empty; } } if (trackingInfoObj.Tracking_Box.Length > 0) { trackingBoxLabel.Text = trackingInfoObj.Tracking_Box; } // Show the history table if (historyPanel == null) { historyPanel = new CustomGrid_Panel { Size = new Size(historyTabPage.Width - 20, historyTabPage.Height - 20), Location = new Point(10, 10) }; historyPanel.Style.Default_Column_Width = 80; historyPanel.Style.Default_Column_Color = Color.LightBlue; historyPanel.Style.Header_Back_Color = Color.DarkBlue; historyPanel.Style.Header_Fore_Color = Color.White; historyPanel.BackColor = Color.White; historyPanel.BorderStyle = BorderStyle.FixedSingle; historyPanel.Anchor = (((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); historyTabPage.Controls.Add(historyPanel); } historyPanel.DataTable = trackingInfo.Tables[1]; historyPanel.Style.Column_Styles[0].Visible = false; historyPanel.Style.Column_Styles[1].BackColor = Color.White; historyPanel.Style.Column_Styles[1].Width = 150; historyPanel.Style.Column_Styles[2].Width = 80; historyPanel.Style.Column_Styles[2].Header_Text = "Completed"; historyPanel.Style.Column_Styles[3].Header_Text = "User"; historyPanel.Style.Column_Styles[3].Width = 100; historyPanel.Style.Column_Styles[4].Header_Text = "Location"; historyPanel.Style.Column_Styles[5].Width = 200; }
/// <summary> Add the HTML to be displayed below 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 writes the HTML from the static browse or info page here </remarks> public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Metadata_Browse_AggregationViewer.Add_Secondary_HTML", "Adding HTML"); } // Get collection of (public) browse bys linked to this aggregation ReadOnlyCollection <Item_Aggregation_Child_Page> public_browses = currentCollection.Browse_By_Pages(currentMode.Language); // Determine if this is an internal user and create list of internal user browses List <string> internal_browses = new List <string>(); if ((currentUser != null) && ((currentUser.Is_Internal_User) || (currentUser.Is_Aggregation_Curator(currentMode.Aggregation)))) { // Just add every metadata field here foreach (Metadata_Search_Field field in SobekCM_Library_Settings.All_Metadata_Fields) { if ((field.Web_Code.Length > 0) && (currentCollection.Browseable_Fields.Contains(field.ID))) { internal_browses.Add(field.Display_Term); } } } // Retain the original short code (or the first public code) string original_browse_mode = currentMode.Info_Browse_Mode.ToLower(); // Get any paging URL and retain original page int current_page = currentMode.Page; currentMode.Page = 1; string page_url = currentMode.Redirect_URL(false); string url_options = currentMode.URL_Options(); if (url_options.Length > 0) { url_options = "?" + url_options.Replace("&", "&"); } if ((public_browses.Count > 1) || (internal_browses.Count > 0)) { Output.WriteLine("<table>"); Output.WriteLine("<tr style=\"vertical-align:top;\">"); Output.WriteLine("<td id=\"sbkMebv_FacetOuterColumn\">"); Output.WriteLine("<div class=\"sbkMebv_FacetColumn\">"); Output.WriteLine("<div class=\"sbkMebv_FacetColumnTitle\">BROWSE BY:</div>"); Output.WriteLine("<br />"); if (public_browses.Count > 0) { // Sort these by title SortedList <string, Item_Aggregation_Child_Page> sortedBrowses = new SortedList <string, Item_Aggregation_Child_Page>(); foreach (Item_Aggregation_Child_Page thisBrowse in public_browses) { if (thisBrowse.Source == Item_Aggregation_Child_Page.Source_Type.Static_HTML) { sortedBrowses[thisBrowse.Code.ToLower()] = thisBrowse; } else { Metadata_Search_Field facetField = SobekCM_Library_Settings.Metadata_Search_Field_By_Name(thisBrowse.Code); if (facetField != null) { string facetName = facetField.Display_Term; if (internal_browses.Contains(facetName)) { internal_browses.Remove(facetName); } sortedBrowses[facetName.ToLower()] = thisBrowse; } } } Output.WriteLine(internal_browses.Count > 0 ? "<b> Public Browses</b><br />" : "<b> Browses</b><br />"); Output.WriteLine("<div class=\"sbkMebv_FacetBox\">"); foreach (Item_Aggregation_Child_Page thisBrowse in sortedBrowses.Values) { // Static HTML or metadata browse by? if (thisBrowse.Source == Item_Aggregation_Child_Page.Source_Type.Static_HTML) { if (original_browse_mode != thisBrowse.Code) { currentMode.Info_Browse_Mode = thisBrowse.Code; Output.WriteLine("<a href=\"" + currentMode.Redirect_URL().Replace("&", "&") + "\">" + thisBrowse.Get_Label(currentMode.Language) + "</a><br />"); } else { Output.WriteLine(thisBrowse.Get_Label(currentMode.Language) + "<br />"); } } else { Metadata_Search_Field facetField = SobekCM_Library_Settings.Metadata_Search_Field_By_Display_Name(thisBrowse.Code); if (thisBrowse.Code.ToLower().Replace("_", " ") != original_browse_mode.Replace("_", " ")) { currentMode.Info_Browse_Mode = thisBrowse.Code.ToLower().Replace(" ", "_"); Output.WriteLine("<a href=\"" + currentMode.Redirect_URL().Replace("&", "&") + "\">" + facetField.Display_Term + "</a><br />"); } else { Output.WriteLine(facetField.Display_Term + "<br />"); } } } Output.WriteLine("</div>"); Output.WriteLine("<br />"); } if (internal_browses.Count > 0) { Output.WriteLine("<b> Internal Browses</b><br />"); Output.WriteLine("<div class=\"sbkMebv_FacetBox\">"); foreach (string thisShort in internal_browses) { Metadata_Search_Field facetField = SobekCM_Library_Settings.Metadata_Search_Field_By_Facet_Name(thisShort); if (facetField != null) { if (thisShort.ToLower() != original_browse_mode) { currentMode.Info_Browse_Mode = thisShort.ToLower().Replace(" ", "_"); Output.WriteLine("<a href=\"" + currentMode.Redirect_URL().Replace("&", "&") + "\">" + facetField.Display_Term + "</a><br />"); } else { Output.WriteLine(facetField.Display_Term + "<br />"); } } } Output.WriteLine("</div>"); Output.WriteLine("<br />"); } Output.WriteLine("<br />"); Output.WriteLine("<br />"); Output.WriteLine("<br />"); Output.WriteLine("<br />"); Output.WriteLine("<br />"); Output.WriteLine("</div>"); Output.WriteLine("</td>"); Output.WriteLine("<td>"); } Output.WriteLine("<div class=\"sbkMebv_ResultsPanel\">"); currentMode.Info_Browse_Mode = original_browse_mode; // Was this static or metadata browse by? if ((browseObject != null) && (browseObject.Source == Item_Aggregation_Child_Page.Source_Type.Static_HTML)) { // Read the content file for this browse HTML_Based_Content staticBrowseContent = browseObject.Get_Static_Content(currentMode.Language, currentMode.Base_URL, SobekCM_Library_Settings.Base_Design_Location + currentCollection.ObjDirectory, Tracer); // Apply current user settings for this string browseInfoDisplayText = staticBrowseContent.Apply_Settings_To_Static_Text(staticBrowseContent.Static_Text, currentCollection, htmlSkin.Skin_Code, htmlSkin.Base_Skin_Code, currentMode.Base_URL, currentMode.URL_Options(), Tracer); // Add this to the output stream Output.WriteLine(browseInfoDisplayText); } else { //Output the results if ((results != null) && (results.Count > 0)) { // Determine which letters appear List <char> letters_appearing = new List <char>(); char last_char = '\n'; if (results.Count > 100) { foreach (string thisValue in results) { if (thisValue.Length > 0) { char this_first_char = Char.ToLower(thisValue[0]); int ascii = this_first_char; if (ascii < 97) { this_first_char = 'a'; } if (ascii > 122) { this_first_char = 'z'; } if (this_first_char != last_char) { if (!letters_appearing.Contains(this_first_char)) { letters_appearing.Add(this_first_char); } last_char = this_first_char; } } } } // Get the search URL currentMode.Mode = Display_Mode_Enum.Results; currentMode.Search_Precision = Search_Precision_Type_Enum.Exact_Match; currentMode.Search_Type = Search_Type_Enum.Advanced; Metadata_Search_Field facetField = SobekCM_Library_Settings.Metadata_Search_Field_By_Display_Name(original_browse_mode); currentMode.Search_Fields = facetField.Web_Code; currentMode.Search_String = "\"<%TERM%>\""; string search_url = currentMode.Redirect_URL(); Output.WriteLine("<br />"); if (results.Count < 100) { foreach (string thisResult in results) { Output.WriteLine("<a href=\"" + search_url.Replace("%3c%25TERM%25%3e", thisResult.Trim().Replace(",", "%2C").Replace("&", "%26").Replace("\"", "%22").Replace("&", "&")) + "\">" + thisResult.Replace("\"", """).Replace("&", "&") + "</a><br />"); } } else if (results.Count < 500) { // Determine the actual page first int first_valid_page = -1; if ((letters_appearing.Contains('a')) || (letters_appearing.Contains('b'))) { first_valid_page = 1; } if ((letters_appearing.Contains('c')) || (letters_appearing.Contains('d')) || (letters_appearing.Contains('e'))) { if (first_valid_page < 0) { first_valid_page = 2; } } if ((letters_appearing.Contains('f')) || (letters_appearing.Contains('g')) || (letters_appearing.Contains('h'))) { if (first_valid_page < 0) { first_valid_page = 3; } } if ((letters_appearing.Contains('i')) || (letters_appearing.Contains('j')) || (letters_appearing.Contains('k'))) { if (first_valid_page < 0) { first_valid_page = 4; } } if ((letters_appearing.Contains('l')) || (letters_appearing.Contains('m')) || (letters_appearing.Contains('n'))) { if (first_valid_page < 0) { first_valid_page = 5; } } if ((letters_appearing.Contains('o')) || (letters_appearing.Contains('p')) || (letters_appearing.Contains('q'))) { if (first_valid_page < 0) { first_valid_page = 6; } } if ((letters_appearing.Contains('r')) || (letters_appearing.Contains('s')) || (letters_appearing.Contains('t'))) { if (first_valid_page < 0) { first_valid_page = 7; } } if ((letters_appearing.Contains('u')) || (letters_appearing.Contains('v')) || (letters_appearing.Contains('w'))) { if (first_valid_page < 0) { first_valid_page = 8; } } if ((letters_appearing.Contains('x')) || (letters_appearing.Contains('y')) || (letters_appearing.Contains('z'))) { if (first_valid_page < 0) { first_valid_page = 9; } } // Define the limits of the page value if ((current_page < first_valid_page) || (current_page > 9)) { current_page = first_valid_page; } // Add the links for paging through results Output.WriteLine("<div class=\"sbkMebv_NavRow\">"); if ((letters_appearing.Contains('a')) || (letters_appearing.Contains('b'))) { if (current_page == 1) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">AB</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/1" + url_options + "\" class=\"mbb1\">AB</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">AB</span> "); } if ((letters_appearing.Contains('c')) || (letters_appearing.Contains('d')) || (letters_appearing.Contains('e'))) { if (current_page == 2) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">CDE</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/2" + url_options + "\">CDE</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">CDE</span> "); } if ((letters_appearing.Contains('f')) || (letters_appearing.Contains('g')) || (letters_appearing.Contains('h'))) { if (current_page == 3) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">FGH</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/3" + url_options + "\">FGH</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">FGH</span> "); } if ((letters_appearing.Contains('i')) || (letters_appearing.Contains('j')) || (letters_appearing.Contains('k'))) { if (current_page == 4) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">IJK</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/4" + url_options + "\">IJK</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">IJK</span> "); } if ((letters_appearing.Contains('l')) || (letters_appearing.Contains('m')) || (letters_appearing.Contains('n'))) { if (current_page == 5) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">LMN</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/5" + url_options + "\">LMN</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">LMN</span> "); } if ((letters_appearing.Contains('o')) || (letters_appearing.Contains('p')) || (letters_appearing.Contains('q'))) { if (current_page == 6) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">OPQ</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/6" + url_options + "\">OPQ</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">OPQ</span> "); } if ((letters_appearing.Contains('r')) || (letters_appearing.Contains('s')) || (letters_appearing.Contains('t'))) { if (current_page == 7) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">RST</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/7" + url_options + "\">RST</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">RST</span> "); } if ((letters_appearing.Contains('u')) || (letters_appearing.Contains('v')) || (letters_appearing.Contains('w'))) { if (current_page == 8) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">UVW</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/8" + url_options + "\">UVW</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\">UVW</span> "); } if ((letters_appearing.Contains('x')) || (letters_appearing.Contains('y')) || (letters_appearing.Contains('z'))) { if (current_page == 9) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">XYZ</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/9" + url_options + "\">XYZ</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\" >XYZ</span> "); } Output.WriteLine("</div>"); Output.WriteLine("<br />"); Output.WriteLine("<br />"); // Find the start character and last character, per the page char first_char = ' '; char stop_char = 'c'; switch (current_page) { case 2: first_char = 'c'; stop_char = 'f'; break; case 3: first_char = 'f'; stop_char = 'i'; break; case 4: first_char = 'i'; stop_char = 'l'; break; case 5: first_char = 'l'; stop_char = 'o'; break; case 6: first_char = 'o'; stop_char = 'r'; break; case 7: first_char = 'r'; stop_char = 'u'; break; case 8: first_char = 'u'; stop_char = 'x'; break; case 9: first_char = 'x'; stop_char = '}'; break; } // Add the pertinent rows foreach (string thisValue in results) { if (thisValue.Length > 0) { char this_first_char = Char.ToLower(thisValue[0]); if ((this_first_char >= first_char) && (this_first_char < stop_char)) { Output.WriteLine("<a href=\"" + search_url.Replace("%3c%25TERM%25%3e", thisValue.Trim().Replace(",", "%2C").Replace("&", "%26").Replace("\"", "%22")).Replace("&", "&") + "\">" + thisValue.Replace("\"", """).Replace("&", "&") + "</a><br />"); } } } } else { // Determine the first valid page char label_char = 'a'; int first_valid_page = -1; int counter = 1; while (label_char <= 'z') { if (letters_appearing.Contains(label_char)) { if (first_valid_page < 0) { first_valid_page = counter; } } counter++; label_char = (char)((label_char) + 1); } // Define the limits of the page value if ((current_page < first_valid_page) || (current_page > 26)) { current_page = first_valid_page; } // Add the links for paging through results label_char = 'a'; counter = 1; Output.WriteLine("<div class=\"sbkMebv_NavRow\">"); while (label_char <= 'z') { if (letters_appearing.Contains(label_char)) { if (current_page == counter) { Output.WriteLine("<span class=\"sbkMebv_NavRowCurrent\">" + Char.ToUpper(label_char) + "</span> "); } else { Output.WriteLine("<a href=\"" + page_url + "/" + counter + url_options + "\" >" + Char.ToUpper(label_char) + "</a> "); } } else { Output.WriteLine("<span class=\"sbkMebv_NavRowDisabled\" >" + Char.ToUpper(label_char) + "</span> "); } counter++; label_char = (char)((label_char) + 1); } Output.WriteLine("</div>"); Output.WriteLine("<br />"); Output.WriteLine("<br />"); // Find the start character and last character, per the page char first_char = ' '; char stop_char = 'b'; if (current_page > 1) { first_char = (char)(96 + current_page); stop_char = (char)(97 + current_page); } // Add the pertinent rows foreach (string thisValue in results) { if (thisValue.Length > 0) { char this_first_char = Char.ToLower(thisValue[0]); if ((this_first_char >= first_char) && (this_first_char < stop_char)) { Output.WriteLine("<a href=\"" + search_url.Replace("%3c%25TERM%25%3e", thisValue.Trim().Replace(",", "%2C").Replace("&", "%26").Replace("\"", "%22")).Replace("&", "&") + "\">" + thisValue.Replace("\"", """).Replace("&", "&") + "</a><br />"); } } } } } else { Output.WriteLine("<br /><br /><br /><br />"); Output.WriteLine(currentMode.Info_Browse_Mode.Length == 0 ? "<center>Select a metadata field to browse by from the list on the left</center>" : "<center>NO MATCHING VALUES</center>"); Output.WriteLine("<br /><br />"); } } // Set the current mode back currentMode.Mode = Display_Mode_Enum.Aggregation; currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_By; Output.WriteLine("</div>"); Output.WriteLine("<br />"); if ((public_browses.Count > 1) || (internal_browses.Count > 0)) { Output.WriteLine("</td>"); Output.WriteLine("</tr>"); Output.WriteLine("</table>"); } Output.WriteLine(); }
/// <summary> Continuously execute the processes in a recurring background thread </summary> public void Execute_In_Background() { // Load all the settings SobekCM_Library_Settings.Refresh(Library.Database.SobekCM_Database.Get_Settings_Complete(null)); // Set the variable which will control background execution int time_between_polls = SobekCM_Library_Settings.Builder_Override_Seconds_Between_Polls; if ((time_between_polls < 0) || (SobekCM_Library_Settings.Database_Connections.Count == 1)) { time_between_polls = Convert.ToInt32(SobekCM_Library_Settings.Builder_Seconds_Between_Polls); } // Determine the new log name string log_name = "incoming_" + controllerStarted.Year + "_" + controllerStarted.Month.ToString().PadLeft(2, '0') + "_" + controllerStarted.Day.ToString().PadLeft(2, '0') + ".html"; string local_log_name = SobekCM_Library_Settings.Local_Log_Directory + "\\" + log_name; // Create the new log file LogFileXHTML preloader_logger = new LogFileXHTML(local_log_name, "SobekCM Incoming Packages Log", "UFDC_Builder.exe", true); // start with warnings on imagemagick and ghostscript not being installed if (SobekCM_Library_Settings.ImageMagick_Executable.Length == 0) { Console.WriteLine("WARNING: Could not find ImageMagick installed. Some image processing will be unavailable."); preloader_logger.AddNonError("WARNING: Could not find ImageMagick installed. Some image processing will be unavailable."); } if (SobekCM_Library_Settings.Ghostscript_Executable.Length == 0) { Console.WriteLine("WARNING: Could not find GhostScript installed. Some PDF processing will be unavailable."); preloader_logger.AddNonError("WARNING: Could not find GhostScript installed. Some PDF processing will be unavailable."); } // Set the time for the next feed building event to 10 minutes from now feedNextBuildTime = DateTime.Now.Add(new TimeSpan(0, 10, 0)); // First, step through each active configuration and see if building is currently aborted // while doing very minimal processes aborted = false; Console.WriteLine("Checking for initial abort condition"); preloader_logger.AddNonError("Checking for initial abort condition"); string abort_message = String.Empty; Builder_Operation_Flag_Enum abort_flag = Builder_Operation_Flag_Enum.STANDARD_OPERATION; foreach (Database_Instance_Configuration dbConfig in SobekCM_Library_Settings.Database_Connections) { if ((!aborted) && (dbConfig.Is_Active) && (dbConfig.Can_Abort)) { SobekCM_Database.Connection_String = dbConfig.Connection_String; Library.Database.SobekCM_Database.Connection_String = dbConfig.Connection_String; // Check that this should not be skipped or aborted Builder_Operation_Flag_Enum operationFlag = Abort_Database_Mechanism.Builder_Operation_Flag; switch (operationFlag) { case Builder_Operation_Flag_Enum.ABORT_REQUESTED: case Builder_Operation_Flag_Enum.ABORTING: abort_message = "PREVIOUS ABORT flag found in " + dbConfig.Name; abort_flag = Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED; Console.WriteLine(abort_message); preloader_logger.AddNonError(abort_message); aborted = true; Abort_Database_Mechanism.Builder_Operation_Flag = Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED; break; case Builder_Operation_Flag_Enum.NO_BUILDING_REQUESTED: abort_message = "PREVIOUS NO BUILDING flag found in " + dbConfig.Name; Console.WriteLine(abort_message); preloader_logger.AddNonError(abort_message); aborted = true; break; } } } // If initially aborted, step through each instance and set a message if (aborted) { // Add messages in each active instance foreach (Database_Instance_Configuration dbConfig in SobekCM_Library_Settings.Database_Connections) { if (dbConfig.Is_Active) { Console.WriteLine("Setting previous abort flag message in " + dbConfig.Name); preloader_logger.AddNonError("Setting previous abort flag message in " + dbConfig.Name); SobekCM_Database.Connection_String = dbConfig.Connection_String; Library.Database.SobekCM_Database.Connection_String = dbConfig.Connection_String; Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", abort_message, String.Empty); // Save information about this last run Library.Database.SobekCM_Database.Set_Setting("Builder Version", SobekCM_Library_Settings.CURRENT_BUILDER_VERSION); Library.Database.SobekCM_Database.Set_Setting("Builder Last Run Finished", DateTime.Now.ToString()); Library.Database.SobekCM_Database.Set_Setting("Builder Last Message", abort_message); // Finally, set the builder flag appropriately if (abort_flag != Builder_Operation_Flag_Enum.STANDARD_OPERATION) { Abort_Database_Mechanism.Builder_Operation_Flag = abort_flag; } } } // Do nothing else return; } // Build all the bulk loader objects List <Worker_BulkLoader> loaders = new List <Worker_BulkLoader>(); bool activeInstanceFound = false; foreach (Database_Instance_Configuration dbConfig in SobekCM_Library_Settings.Database_Connections) { if (!dbConfig.Is_Active) { loaders.Add(null); Console.WriteLine(dbConfig.Name + " is set to INACTIVE"); preloader_logger.AddNonError(dbConfig.Name + " is set to INACTIVE"); } else { activeInstanceFound = true; SobekCM_Database.Connection_String = dbConfig.Connection_String; Library.Database.SobekCM_Database.Connection_String = dbConfig.Connection_String; // At this point warn on mossing the Ghostscript and ImageMagick if (SobekCM_Library_Settings.ImageMagick_Executable.Length == 0) { Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "WARNING: Could not find ImageMagick installed. Some image processing will be unavailable.", String.Empty); } if (SobekCM_Library_Settings.Ghostscript_Executable.Length == 0) { Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "WARNING: Could not find GhostScript installed. Some PDF processing will be unavailable.", String.Empty); } Console.WriteLine(dbConfig.Name + " - Preparing to begin polling"); preloader_logger.AddNonError(dbConfig.Name + " - Preparing to begin polling"); Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "Preparing to begin polling", String.Empty); Worker_BulkLoader newLoader = new Worker_BulkLoader(preloader_logger, verbose, dbConfig.Name, dbConfig.Can_Abort); loaders.Add(newLoader); } } // If no active instances, just exit if (!activeInstanceFound) { Console.WriteLine("No active databases in the config file"); preloader_logger.AddError("No active databases in config file... Aborting"); return; } bool firstRun = true; // Loop continually until the end hour is achieved do { // Is it time to build any RSS/XML feeds? bool rebuildRssFeeds = false; if (DateTime.Compare(DateTime.Now, feedNextBuildTime) >= 0) { rebuildRssFeeds = true; feedNextBuildTime = DateTime.Now.Add(new TimeSpan(0, 10, 0)); } // Step through each instance for (int i = 0; i < SobekCM_Library_Settings.Database_Connections.Count; i++) { if (loaders[i] != null) { // Get the instance Database_Instance_Configuration dbInstance = SobekCM_Library_Settings.Database_Connections[i]; // Set the database connection strings SobekCM_Database.Connection_String = dbInstance.Connection_String; Library.Database.SobekCM_Database.Connection_String = dbInstance.Connection_String; // Look for abort if ((dbInstance.Can_Abort) && (CheckForAbort())) { aborted = true; if (Abort_Database_Mechanism.Builder_Operation_Flag != Builder_Operation_Flag_Enum.NO_BUILDING_REQUESTED) { abort_flag = Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED; Abort_Database_Mechanism.Builder_Operation_Flag = Builder_Operation_Flag_Enum.ABORTING; } break; } // Refresh all settings, etc.. loaders[i].Refresh_Settings_And_Item_List(); // Pull the abort/pause flag Builder_Operation_Flag_Enum currentPauseFlag = Abort_Database_Mechanism.Builder_Operation_Flag; // If not paused, run the prebuilder if (currentPauseFlag != Builder_Operation_Flag_Enum.PAUSE_REQUESTED) { if (firstRun) { // // Always build an endeca feed first (so it occurs once a day) // if (SobekCM_Library_Settings.Build_MARC_Feed_By_Default) // { // Create_Complete_MarcXML_Feed(false); // } //} // CLear the old logs Console.WriteLine(dbInstance.Name + " - Expiring old log entries"); preloader_logger.AddNonError(dbInstance.Name + " - Expiring old log entries"); Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "Expiring old log entries", String.Empty); Library.Database.SobekCM_Database.Builder_Expire_Log_Entries(SobekCM_Library_Settings.Builder_Log_Expiration_Days); // Rebuild all the static pages Console.WriteLine(dbInstance.Name + " - Rebuilding all static pages"); preloader_logger.AddNonError(dbInstance.Name + " - Rebuilding all static pages"); long staticRebuildLogId = Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "Rebuilding all static pages", String.Empty); Static_Pages_Builder builder = new Static_Pages_Builder(SobekCM_Library_Settings.Application_Server_URL, SobekCM_Library_Settings.Static_Pages_Location, SobekCM_Library_Settings.Application_Server_Network); builder.Rebuild_All_Static_Pages(preloader_logger, false, SobekCM_Library_Settings.Local_Log_Directory, dbInstance.Name, staticRebuildLogId); // Process any pending FDA reports from the FDA Report DropBox Process_Any_Pending_FDA_Reports(loaders[i]); } Run_BulkLoader(loaders[i], verbose); // Look for abort if ((!aborted) && (dbInstance.Can_Abort) && (CheckForAbort())) { aborted = true; if (Abort_Database_Mechanism.Builder_Operation_Flag != Builder_Operation_Flag_Enum.NO_BUILDING_REQUESTED) { abort_flag = Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED; Abort_Database_Mechanism.Builder_Operation_Flag = Builder_Operation_Flag_Enum.ABORTING; } break; } if (rebuildRssFeeds) { loaders[i].Build_Feeds(); } // Clear memory from this loader loaders[i].Clear_Item_List(); } else { preloader_logger.AddNonError(dbInstance.Name + " - Building paused"); Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "Building temporarily PAUSED", String.Empty); } } } if (aborted) { break; } // No longer the first run firstRun = false; // Publish the log publish_log_file(local_log_name); // Sleep for correct number of milliseconds Thread.Sleep(1000 * time_between_polls); } while (DateTime.Now.Hour < BULK_LOADER_END_HOUR); // Do the final work for all of the different dbInstances if (!aborted) { for (int i = 0; i < SobekCM_Library_Settings.Database_Connections.Count; i++) { if (loaders[i] != null) { // Get the instance Database_Instance_Configuration dbInstance = SobekCM_Library_Settings.Database_Connections[i]; // Set the database flag SobekCM_Database.Connection_String = dbInstance.Connection_String; // Pull the abort/pause flag Builder_Operation_Flag_Enum currentPauseFlag2 = Abort_Database_Mechanism.Builder_Operation_Flag; // If not paused, run the prebuilder if (currentPauseFlag2 != Builder_Operation_Flag_Enum.PAUSE_REQUESTED) { // Refresh all settings, etc.. loaders[i].Refresh_Settings_And_Item_List(); // Initiate the recreation of the links between metadata and collections Library.Database.SobekCM_Database.Admin_Update_Cached_Aggregation_Metadata_Links(); } // Clear the memory loaders[i].Clear_Item_List(); } } } else { // Mark the aborted in each instance foreach (Database_Instance_Configuration dbConfig in SobekCM_Library_Settings.Database_Connections) { if (dbConfig.Is_Active) { Console.WriteLine("Setting abort flag message in " + dbConfig.Name); preloader_logger.AddNonError("Setting abort flag message in " + dbConfig.Name); SobekCM_Database.Connection_String = dbConfig.Connection_String; Library.Database.SobekCM_Database.Connection_String = dbConfig.Connection_String; Library.Database.SobekCM_Database.Builder_Add_Log_Entry(-1, String.Empty, "Standard", "Building ABORTED per request from database key", String.Empty); // Save information about this last run Library.Database.SobekCM_Database.Set_Setting("Builder Version", SobekCM_Library_Settings.CURRENT_BUILDER_VERSION); Library.Database.SobekCM_Database.Set_Setting("Builder Last Run Finished", DateTime.Now.ToString()); Library.Database.SobekCM_Database.Set_Setting("Builder Last Message", "Building ABORTED per request"); // Finally, set the builder flag appropriately if (abort_flag == Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED) { Abort_Database_Mechanism.Builder_Operation_Flag = Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED; } } } } // Publish the log publish_log_file(local_log_name); //// Initiate a solr/lucene index optimization since we are done loading for a while //if (DateTime.Now.Day % 2 == 0) //{ // if (SobekCM_Library_Settings.Document_Solr_Index_URL.Length > 0) // { // Console.WriteLine("Initiating Solr/Lucene document index optimization"); // Solr_Controller.Optimize_Document_Index(SobekCM_Library_Settings.Document_Solr_Index_URL); // } //} //else //{ // if (SobekCM_Library_Settings.Page_Solr_Index_URL.Length > 0) // { // Console.WriteLine("Initiating Solr/Lucene page index optimization"); // Solr_Controller.Optimize_Page_Index(SobekCM_Library_Settings.Page_Solr_Index_URL); // } //} //// Sleep for twenty minutes to end this (the index rebuild might take some time) //Thread.Sleep(1000 * 20 * 60); }
static void Main(string[] args) { // Try to read the metadata configuration file string app_start_config = Application.StartupPath + "\\config"; if ((Directory.Exists(app_start_config)) && (File.Exists(app_start_config + "\\sobekCM_metadata.config"))) { Metadata_Configuration.Read_Metadata_Configuration(app_start_config + "\\sobekCM_metadata.config"); } bool complete_static_rebuild = false; bool marc_rebuild = false; bool run_preloader = true; bool run_background = false; bool show_help = false; bool build_production_marcxml_feed = false; bool build_test_marcxml_feed = false; string invalid_arg = String.Empty; bool refresh_oai = false; bool verbose = false; // Get values from the arguments foreach (string thisArgs in args) { bool arg_handled = false; // Check for the config flag if (thisArgs == "--config") { if (File.Exists(app_start_config + "\\SobekCM_Builder_Configuration.exe")) { Process.Start(app_start_config + "\\SobekCM_Builder_Configuration.exe"); return; } Console.WriteLine("ERROR: Unable to find configuration executable file!!"); return; } // Check for versioning option if (thisArgs == "--version") { Console.WriteLine("You are running version " + SobekCM_Library_Settings.CURRENT_BUILDER_VERSION + " of the SobekCM Builder."); return; } // Check for no loader flag if (thisArgs == "--background") { run_background = true; arg_handled = true; } // Check for verbose flag if (thisArgs == "--verbose") { verbose = true; arg_handled = true; } // Check for no loader flag if (thisArgs == "--refresh_oai") { refresh_oai = true; arg_handled = true; } // Check for no oading flag if (thisArgs == "--noload") { run_preloader = false; arg_handled = true; } // Check for static rebuild if (thisArgs == "--staticrebuild") { complete_static_rebuild = true; arg_handled = true; } // Check for static rebuild if (thisArgs == "--createmarc") { marc_rebuild = true; arg_handled = true; } // Check for marc xml feed creation flags if (thisArgs.IndexOf("--marcxml") == 0) { build_production_marcxml_feed = true; arg_handled = true; } if (thisArgs.IndexOf("--testmarcxml") == 0) { build_test_marcxml_feed = true; arg_handled = true; } // Check for help if ((thisArgs == "--help") || (thisArgs == "?") || (thisArgs == "-help")) { show_help = true; arg_handled = true; } // If not handled, set as error if (!arg_handled) { invalid_arg = thisArgs; break; } } // Was there an invalid argument or was help requested if ((invalid_arg.Length > 0) || (show_help)) { StringBuilder builder = new StringBuilder(); builder.Append("\nThis application is used to bulk load SobekCM items, perform post-processing\n"); builder.Append("for items loaded through the web, and perform some regular maintenance activities\n"); builder.Append("in support of a SobekCM web application.\n\n"); builder.Append("Usage: SobekCM_Builder [options]\n\n"); builder.Append("Options:\n\n"); builder.Append(" --config\tRuns the configuration tool\n\n"); builder.Append(" --version\tDisplays the current version of the SobekCM Builder\n\n"); builder.Append(" --verbose\tFlag indicates to be verbose in the logs and console\n\n"); builder.Append(" --background\tContinues to run in the background\n\n"); builder.Append(" --help\t\tShows these instructions\n\n"); builder.Append(" --noload\t\tSupresses the loading portion of the SobekCM Builder\n\n"); builder.Append(" --staticrebuild\tPerform a complete rebuild on static pages\n\n"); builder.Append(" --marcxml\tBuild the marcxml production feed\n\n"); builder.Append(" --testmarcxml\tBuild the marcxml test feed\n\n"); builder.Append(" --createmarc\tRecreate all of the MARC.xml files\n\n"); builder.Append(" --refresh_oai\tResave the OAI-PMH DC data for every item in the library\n\n"); builder.Append("Examples:\n\n"); builder.Append(" 1. To just rebuild all the static pages:\n"); builder.Append(" SobekCM_Builder --nopreload --noload --staticrebuild"); builder.Append(" 2. To have the SobekCM Builder constantly run in the background"); builder.Append(" SobekCM_Builder --background"); // If invalid arg, save to log file if (invalid_arg.Length > 0) { // Show INVALID ARGUMENT error in console Console.WriteLine("\nINVALID ARGUMENT PROVIDED ( " + invalid_arg + " )"); } Console.WriteLine(builder.ToString()); return; } // Now, veryify the configuration file exists string config_file = Application.StartupPath + "\\config\\sobekcm.config"; if (!File.Exists(config_file)) { Console.WriteLine("The configuration file is missing!!\n"); Console.Write("Would you like to run the configuration tool? [Y/N]: "); string result = Console.ReadLine().ToUpper(); if ((result == "Y") || (result == "YES")) { // Does the config app exist? if (File.Exists(Application.StartupPath + "\\config\\SobekCM_Builder_Configuration.exe")) { // Run the config app Process configProcess = new Process { StartInfo = { FileName = Application.StartupPath + "\\config\\SobekCM_Builder_Configuration.exe" } }; configProcess.Start(); configProcess.WaitForExit(); // If still no config file, just abort if (!File.Exists(config_file)) { Console.WriteLine("Execution aborted due to missing configuration file."); return; } } else { Console.WriteLine("ERROR: Unable to find configuration executable file!!"); return; } } else { Console.WriteLine("Execution aborted due to missing configuration file."); return; } } // Should be a config file now, so read it SobekCM_Library_Settings.Read_Configuration_File(config_file); if ((SobekCM_Library_Settings.Database_Connections.Count == 0) || (SobekCM_Library_Settings.Database_Connections[0].Connection_String.Length == 0)) { Console.WriteLine("Missing database connection string!!\n"); Console.Write("Would you like to run the configuration tool? [Y/N]: "); string result = Console.ReadLine().ToUpper(); if ((result == "Y") || (result == "YES")) { // Does the config app exist? if (File.Exists(Application.StartupPath + "\\config\\SobekCM_Builder_Configuration.exe")) { // Run the config app Process configProcess = new Process { StartInfo = { FileName = Application.StartupPath + "\\config\\SobekCM_Builder_Configuration.exe" } }; configProcess.Start(); configProcess.WaitForExit(); // If still no config file, just abort if (!File.Exists(config_file)) { Console.WriteLine("Execution aborted due to missing configuration file."); return; } } else { Console.WriteLine("ERROR: Unable to find configuration executable file!!"); return; } } else { Console.WriteLine("Execution aborted due to missing configuration file."); return; } } // Assign the connection string and test the connection (if only a single connection listed) if (SobekCM_Library_Settings.Database_Connections.Count == 1) { SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connections[0].Connection_String; if (!SobekCM_Database.Test_Connection()) { Console.WriteLine("Unable to connect to the database using provided connection string:"); Console.WriteLine(); Console.WriteLine(SobekCM_Database.Connection_String); Console.WriteLine(); Console.WriteLine("Run this application with an argument of '--config' to launch the configuration tool."); return; } } // Verify connectivity and rights on the logs subfolder SobekCM_Library_Settings.Local_Log_Directory = Application.StartupPath + "\\logs"; if (!Directory.Exists(SobekCM_Library_Settings.Local_Log_Directory)) { try { Directory.CreateDirectory(SobekCM_Library_Settings.Local_Log_Directory); } catch { Console.WriteLine("Error creating necessary logs subfolder under the application folder.\n"); Console.WriteLine("Please create manually.\n"); Console.WriteLine(SobekCM_Library_Settings.Local_Log_Directory); return; } } try { StreamWriter testWriter = new StreamWriter(SobekCM_Library_Settings.Local_Log_Directory + "\\test.log", false); testWriter.WriteLine("TEST"); testWriter.Flush(); testWriter.Close(); File.Delete(SobekCM_Library_Settings.Local_Log_Directory + "\\test.log"); } catch { Console.WriteLine("The service account needs modify rights on the logs subfolder.\n"); Console.WriteLine("Please correct manually.\n"); Console.WriteLine(SobekCM_Library_Settings.Local_Log_Directory); return; } // Look for Ghostscript from the registry, if not provided in the config file if (SobekCM_Library_Settings.Ghostscript_Executable.Length == 0) { // LOOK FOR THE GHOSTSCRIPT DIRECTORY string possible_ghost = Look_For_Variable_Registry_Key("SOFTWARE\\GPL Ghostscript", "GS_DLL"); if (!String.IsNullOrEmpty(possible_ghost)) { SobekCM_Library_Settings.Ghostscript_Executable = possible_ghost; } } // Look for Imagemagick from the registry, if not provided in the config file string possible_imagemagick = Look_For_Variable_Registry_Key("SOFTWARE\\ImageMagick", "BinPath"); if (!String.IsNullOrEmpty(possible_imagemagick)) { SobekCM_Library_Settings.ImageMagick_Executable = possible_imagemagick; } // If this is to refresh the OAI, don't use the worker controller if ((refresh_oai) && (SobekCM_Library_Settings.Database_Connections.Count == 1)) { // Set the item for the current mode int successes = 0; DataTable item_list_table = SobekCM_Database.Get_All_Groups_First_VID( ); foreach (DataRow thisRow in item_list_table.Rows) { string bibid = thisRow["BibID"].ToString(); string vid = thisRow["VID"].ToString(); int groupid = Convert.ToInt32(thisRow["groupid"]); string directory = SobekCM_Library_Settings.Image_Server_Network + bibid.Substring(0, 2) + "\\" + bibid.Substring(2, 2) + "\\" + bibid.Substring(4, 2) + "\\" + bibid.Substring(6, 2) + "\\" + bibid.Substring(8, 2) + "\\" + vid; string mets = directory + "\\" + bibid + "_" + vid + ".mets.xml"; try { SobekCM_Item thisItem = SobekCM_Item.Read_METS(mets); if (thisItem != null) { // Get the OAI-PMH dublin core information StringBuilder oaiDataBuilder = new StringBuilder(1000); StringWriter writer = new StringWriter(oaiDataBuilder); DC_METS_dmdSec_ReaderWriter.Write_Simple_Dublin_Core(writer, thisItem.Bib_Info); // Also add the URL as identifier oaiDataBuilder.AppendLine("<dc:identifier>" + SobekCM_Library_Settings.System_Base_URL + bibid + "</dc:identifier>"); Resource_Object.Database.SobekCM_Database.Save_Item_Group_OAI(groupid, oaiDataBuilder.ToString(), "oai_dc", true); writer.Flush(); writer.Close(); successes++; if (successes % 1000 == 0) { Console.WriteLine(@"{0} complete", successes); } } } catch { } } return; } // Two ways to run this... constantly in background or once Worker_Controller controller = new Worker_Controller(verbose); if (!run_background) { controller.Execute_Immediately(build_production_marcxml_feed, build_test_marcxml_feed, run_preloader, complete_static_rebuild, marc_rebuild); } else { controller.Execute_In_Background(); } // If this was set to aborting, set to last execution aborted Builder_Operation_Flag_Enum operationFlag = Abort_Database_Mechanism.Builder_Operation_Flag; if ((operationFlag == Builder_Operation_Flag_Enum.ABORTING) || (operationFlag == Builder_Operation_Flag_Enum.ABORT_REQUESTED)) { Abort_Database_Mechanism.Builder_Operation_Flag = Builder_Operation_Flag_Enum.LAST_EXECUTION_ABORTED; } }
/// <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> public override void Write_ItemNavForm_Closing(TextWriter Output, Custom_Tracer Tracer) { const string NEWVOLUME = "NEW VOLUME"; Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Write_ItemNavForm_Closing", ""); Output.WriteLine("<!-- Hidden field is used for postbacks to add new form elements (i.e., new name, new other titles, etc..) -->"); Output.WriteLine("<input type=\"hidden\" id=\"action\" name=\"action\" value=\"\" />"); Output.WriteLine("<div id=\"sbkIsw_Titlebar\">"); string grouptitle = item.Behaviors.GroupTitle; if (grouptitle.Length > 125) { Output.WriteLine("\t<h1 itemprop=\"name\"><abbr title=\"" + grouptitle + "\">" + grouptitle.Substring(0, 120) + "...</abbr></h1>"); } else { Output.WriteLine("\t<h1 itemprop=\"name\">" + grouptitle + "</h1>"); } Output.WriteLine("</div>"); Output.WriteLine("<div class=\"sbkMenu_Bar\" id=\"sbkIsw_MenuBar\" style=\"height:20px\"> </div>"); Output.WriteLine("<div id=\"container-inner1000\">"); Output.WriteLine("<div id=\"pagecontainer\">"); Output.WriteLine("<!-- Group_Add_Volume_MySobekViewer.Write_ItemNavForm_Closing -->"); Output.WriteLine("<div class=\"sbkMySobek_HomeText\">"); Output.WriteLine(" <br />"); Output.WriteLine(" <h2>Add a new volume to this existing title/item group</h2>"); Output.WriteLine(" <ul>"); Output.WriteLine(" <li>Only enter data that you wish to override the data in the existing base volume.</li>"); //Output.WriteLine(" <li>Clicking on the green plus button ( <img class=\"repeat_button\" src=\"" + currentMode.Base_URL + "default/images/new_element_demo.jpg\" /> ) will add another instance of the element, if the element is repeatable.</li>"); Output.WriteLine(" <li>Click <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "help/addvolume\" target=\"_EDIT_INSTRUCTIONS\">here for detailed instructions</a> on adding new volumes online.</li>"); Output.WriteLine(" </ul>"); Output.WriteLine("</div>"); Output.WriteLine(); if (message.Length > 0) { Output.WriteLine("" + message + "<br />"); } Output.WriteLine("<a name=\"template\"> </a>"); Output.WriteLine("<div id=\"tabContainer\" class=\"fulltabs\">"); Output.WriteLine(" <div class=\"tabs\">"); Output.WriteLine(" <ul>"); Output.WriteLine(" <li id=\"tabHeader_1\" class=\"tabActiveHeader\">" + NEWVOLUME + "</li>"); Output.WriteLine(" </ul>"); Output.WriteLine(" </div>"); Output.WriteLine(" <div class=\"graytabscontent\">"); Output.WriteLine(" <div class=\"tabpage\" id=\"tabpage_1\">"); Output.WriteLine(" <!-- Add SAVE and CANCEL buttons to top of form -->"); Output.WriteLine(" <script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_metadata.js\" type=\"text/javascript\"></script>"); Output.WriteLine(); Output.WriteLine(" <div class=\"sbkMySobek_RightButtons\">"); Output.WriteLine(" <button onclick=\"addvolume_cancel_form(); return false;\" class=\"sbkMySobek_BigButton\"><img src=\"" + currentMode.Base_URL + "default/images/button_previous_arrow.png\" class=\"sbkMySobek_RoundButton_LeftImg\" alt=\"\" /> CANCEL </button> "); Output.WriteLine(" <button onclick=\"addvolume_save_form(''); return false;\" class=\"sbkMySobek_BigButton\"> SAVE <img src=\"" + currentMode.Base_URL + "default/images/button_next_arrow.png\" class=\"sbkMySobek_RoundButton_RightImg\" alt=\"\" /></button> "); Output.WriteLine(" <button onclick=\"addvolume_save_form('_again'); return false;\" class=\"sbkMySobek_BigButton\">SAVE & ADD ANOTHER</button>"); Output.WriteLine(" </div>"); Output.WriteLine(" <br /><br />"); Output.WriteLine(); // Output.WriteLine(" <td width=\"460px\"> Import metadata and behaviors from existing volume: "); Output.WriteLine(" <div style=\"text-align:left;padding-left:58px; padding-bottom: 10px;\">Import from existing volume: "); Output.WriteLine(" <select id=\"base_volume\" name=\"base_volume\" class=\"addvolume_base_volume\">"); DataColumn vidColumn = itemsInTitle.Item_Table.Columns["VID"]; bool first = true; DataView sortedView = new DataView(itemsInTitle.Item_Table) { Sort = "VID DESC" }; foreach (DataRowView itemRowView in sortedView) { if (first) { Output.WriteLine(" <option value=\"" + itemRowView.Row[vidColumn] + "\" selected=\"selected\">" + itemRowView.Row[vidColumn] + "</option>"); first = false; } else { Output.WriteLine(" <option value=\"" + itemRowView.Row[vidColumn] + "\">" + itemRowView.Row[vidColumn] + "</option>"); } } Output.WriteLine(" </select>"); Output.WriteLine(" </div>"); Output.WriteLine(); bool isMozilla = currentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0; // Create a new blank item for display purposes SobekCM_Item displayItem = new SobekCM_Item { BibID = item.BibID }; displayItem.Behaviors.IP_Restriction_Membership = ipRestrict; displayItem.Behaviors.Serial_Info.Clear(); displayItem.Tracking.Born_Digital = bornDigital; displayItem.Tracking.Tracking_Box = trackingBox; displayItem.Tracking.Material_Received_Notes = materialRecdNotes; displayItem.Tracking.Material_Received_Date = materialRecdDate; displayItem.Tracking.Disposition_Advice = dispositionAdvice; displayItem.Tracking.Disposition_Advice_Notes = dispositionAdviceNotes; if (title.Length > 0) { displayItem.Bib_Info.Main_Title.Clear(); displayItem.Bib_Info.Main_Title.Title = title; } if (date.Length > 0) { displayItem.Bib_Info.Origin_Info.Date_Issued = date; } if ((level1.Length > 0) && (level1Order >= 0)) { displayItem.Behaviors.Serial_Info.Add_Hierarchy(1, level1Order, level1); if ((level2.Length > 0) && (level2Order >= 0)) { displayItem.Behaviors.Serial_Info.Add_Hierarchy(2, level2Order, level2); if ((level3.Length > 0) && (level3Order >= 0)) { displayItem.Behaviors.Serial_Info.Add_Hierarchy(3, level3Order, level3); } } } template.Render_Template_HTML(Output, displayItem, currentMode.Skin == currentMode.Default_Skin ? currentMode.Skin.ToUpper() : currentMode.Skin, isMozilla, user, currentMode.Language, Translator, currentMode.Base_URL, 1); // Add the second buttons at the bottom of the form Output.WriteLine(" <!-- Add SAVE and CANCEL buttons to bottom of form -->"); Output.WriteLine(" <div class=\"sbkMySobek_RightButtons\">"); Output.WriteLine(" <button onclick=\"addvolume_cancel_form(); return false;\" class=\"sbkMySobek_BigButton\"><img src=\"" + currentMode.Base_URL + "default/images/button_previous_arrow.png\" class=\"sbkMySobek_RoundButton_LeftImg\" alt=\"\" /> CANCEL </button> "); Output.WriteLine(" <button onclick=\"addvolume_save_form(''); return false;\" class=\"sbkMySobek_BigButton\"> SAVE <img src=\"" + currentMode.Base_URL + "default/images/button_next_arrow.png\" class=\"sbkMySobek_RoundButton_RightImg\" alt=\"\" /></button> "); Output.WriteLine(" </div>"); Output.WriteLine(); Output.WriteLine(" <br /><br />"); Output.WriteLine(" <hr />"); Output.WriteLine(); Output.WriteLine(" <p>In addition, the following actions are available:</p>"); Output.WriteLine(" <button onclick=\"addvolume_save_form('_edit'); return false;\" class=\"sbkMySobek_RoundButton\">SAVE & EDIT ITEM</button> "); Output.WriteLine(" <button onclick=\"addvolume_save_form('_addfiles'); return false;\" class=\"sbkMySobek_RoundButton\">SAVE & ADD FILES</button> "); Output.WriteLine(" <button onclick=\"addvolume_save_form('_again'); return false;\" class=\"sbkMySobek_RoundButton\">SAVE & ADD ANOTHER</button>"); Output.WriteLine(" </div>"); Output.WriteLine(" </div>"); Output.WriteLine("</div>"); Output.WriteLine("</div>"); Output.WriteLine("</div>"); }
/// <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) { // Should we reload the data from the exteral configuraiton file? if (Reload_All) { SobekCM_Library_Settings.Read_Configuration_File(); SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connection_String; SobekCM_Library_Settings.Refresh(SobekCM_Database.Get_Settings_Complete(null)); } // If there is no database connection string, there is a problem if (String.IsNullOrEmpty(SobekCM_Library_Settings.Database_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_Connection_String; SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_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); } } }
/// <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) { Tracer.Add_Trace("Builder_AdminViewer.Add_HTML_In_Main_Form", "Add the current status and add html controls to change status"); Output.WriteLine("<!-- Builder_AdminViewer.Add_HTML_In_Main_Form -->"); // Pull the builder settings Dictionary <string, string> builderSettings = SobekCM_Database.Get_Settings(Tracer); Output.WriteLine("<!-- Hidden field to keep the newly requested status -->"); Output.WriteLine("<input type=\"hidden\" id=\"admin_builder_tosave\" name=\"admin_builder_tosave\" value=\"\" />"); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" type=\"text/javascript\"></script>"); // Start to show the text Output.WriteLine("<div class=\"SobekHomeText\">"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" The SobekCM builder is constantly loading new items and updates and building the full text indexes. This page can be used to view and updated the current status as well as view the most recent log files.<br /><br />"); Output.WriteLine(" For more information about the builder and possible actions from this screen, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/builder\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>."); Output.WriteLine(" </blockquote>"); // If missing values, display an error if ((!builderSettings.ContainsKey("Builder Operation Flag")) || (!builderSettings.ContainsKey("Log Files URL")) || (!builderSettings.ContainsKey("Log Files Directory"))) { Output.WriteLine("<br /><br />ERROR PULLING BUILDER SETTINGS... MISSING VALUES<br /><br />"); } else { // Get the current pertinent values string operationFlag = builderSettings["Builder Operation Flag"]; string logURL = builderSettings["Log Files URL"]; Output.WriteLine(" <span class=\"SobekAdminTitle\">SobekCM Builder Status</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <table cellspacing=\"5\" cellpadding=\"5\">"); Output.WriteLine(" <tr><td>Current Status: </td><td><strong>" + operationFlag + "</strong></td><td> </td></tr>"); Output.Write(" <tr valign=\"center\"><td>Next Status: </td><td>"); Output.Write("<select class=\"admin_builder_select\" name=\"admin_builder_status\" id=\"admin_builder_status\">"); if ((operationFlag != "ABORT REQUESTED") && (operationFlag != "NO BUILDING REQUESTED")) { Output.Write("<option value=\"STANDARD OPERATION\" selected=\"selected\">STANDARD OPERATION</option>"); } else { Output.Write("<option value=\"STANDARD OPERATION\">STANDARD OPERATION</option>"); } Output.Write(operationFlag == "PAUSE REQUESTED" ? "<option value=\"PAUSE REQUESTED\" selected=\"selected\">PAUSE REQUESTED</option>" : "<option value=\"PAUSE REQUESTED\">PAUSE REQUESTED</option>"); Output.Write(operationFlag == "ABORT REQUESTED" ? "<option value=\"ABORT REQUESTED\" selected=\"selected\">ABORT REQUESTED</option>" : "<option value=\"ABORT REQUESTED\">ABORT REQUESTED</option>"); Output.Write(operationFlag == "NO BUILDING REQUESTED" ? "<option value=\"NO BUILDING REQUESTED\" selected=\"selected\" >NO BUILDING REQUESTED</option>" : "<option value=\"NO BUILDING REQUESTED\" >NO BUILDING REQUESTED</option>"); Output.Write("</select> </td><td> <input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\" onclick=\"return save_new_builder_status();\"/></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Recent Incoming Logs</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" Select a date below to view the recent incoming resources log file:"); Output.WriteLine(" <blockquote>"); string logDirectory = SobekCM_Library_Settings.Base_Design_Location + "extra\\logs"; string[] logFiles = Directory.GetFiles(logDirectory, "incoming*.html"); Output.WriteLine(" <table cellspacing=\"2\" cellpadding=\"2\">"); foreach (string logFile in logFiles) { string logName = (new FileInfo(logFile)).Name; string date_string = logName.ToLower().Replace("incoming_", "").Replace(".html", ""); if (date_string.Length == 10) { DateTime date = new DateTime(Convert.ToInt32(date_string.Substring(0, 4)), Convert.ToInt32(date_string.Substring(5, 2)), Convert.ToInt32(date_string.Substring(8))); Output.WriteLine(" <tr><td><a href=\"" + logURL + logName + "\">" + date.ToLongDateString() + "</a></td></tr>"); } } Output.WriteLine(" </table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); } Output.WriteLine(" <span class=\"SobekAdminTitle\">Related Links</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <table cellspacing=\"2\" cellpadding=\"2\">"); Output.WriteLine(" <tr><td><a href=\"" + currentMode.Base_URL + "l/internal/new\">Newly added or updated items</a></td></tr>"); Output.WriteLine(" <tr><td><a href=\"" + currentMode.Base_URL + "l/internal/failures\">Failed packages or builder errors</a></td></tr>"); Output.WriteLine(" </table>"); 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 Add_HTML_In_Main_Form(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Thematic_Headings_AdminViewer.Add_HTML_In_Main_Form", "Add any popup divisions for form elements"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-1.6.2.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.8.16.custom.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_form.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=\"admin_heading_popup_div\" id=\"form_heading\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">EDIT THEMATIC HEADING</td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"heading_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for heading Output.WriteLine(" <tr><td width=\"80px\"><label for=\"form_heading_name\">Heading:</label></td><td colspan=\"2\"><input class=\"admin_heading_input\" name=\"form_heading_name\" id=\"form_heading_name\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('form_heading_name', 'admin_heading_input_focused')\" onblur=\"javascript:textbox_leave('form_heading_name', 'admin_heading_input')\" /></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine(" <center><a href=\"\" onclick=\"return heading_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>"); Output.WriteLine("</div>"); Tracer.Add_Trace("Thematic_Headings_AdminViewer.Add_HTML_In_Main_Form", "Write the rest of the form "); Output.WriteLine("<!-- Thematic_Headings_AdminViewer.Add_HTML_In_Main_Form -->"); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"SobekHomeText\">"); if (actionMessage.Length > 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <center><b>" + actionMessage + "</b></center>"); } Output.WriteLine(" <blockquote>"); Output.WriteLine(" Thematic headings are the headings on the main library home page, under which all the item "); Output.WriteLine(" aggregation icons appear.<br /><br />"); Output.WriteLine(" For more information about thematic headings, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/headings\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>."); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <span class=\"SobekAdminTitle\">New Thematic Heading</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <div class=\"admin_heading_new_div\">"); Output.WriteLine(" <table class=\"popup_table\">"); Output.WriteLine(" <tr><td><label for=\"admin_heading_name\">Heading:</label></td><td><input class=\"admin_heading_input\" name=\"admin_heading_name\" id=\"admin_heading_name\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_heading_name', 'admin_heading_input_focused')\" onblur=\"javascript:textbox_leave('admin_heading_name', 'admin_heading_input')\" /></td>"); Output.WriteLine(" <td><input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\" onclick=\"return save_new_heading();\"/></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </div>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Existing Thematic Headings</span>"); 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=\"120px\" align=\"center\"><span style=\"color: White\">REORDER</span></th>"); Output.WriteLine(" <th width=\"350px\" align=\"left\"><span style=\"color: White\">THEMATIC HEADING</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); // Write the data for each interface int current_order = 1; foreach (Thematic_Heading thisTheme in thematicHeadings) { // Build the action links Output.WriteLine(" <tr align=\"left\" >"); Output.Write(" <td class=\"SobekAdminActionLink\" >( "); Output.Write("<a title=\"Click to edit\" id=\"VIEW_" + thisTheme.ThematicHeadingID + "\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return heading_form_popup('VIEW_" + thisTheme.ThematicHeadingID + "', '" + thisTheme.ThemeName + "','" + thisTheme.ThematicHeadingID + "');\">edit</a> | "); Output.Write("<a title=\"Delete this thematic heading\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_heading('" + thisTheme.ThematicHeadingID + "', '" + thisTheme.ThemeName.Replace("\'", "") + "');\">delete</a> )</td>"); Output.Write(" <td class=\"SobekAdminActionLink\" align=\"center\" >( "); Output.Write("<a title=\"Move this heading up in the order\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return move_heading_up('" + thisTheme.ThematicHeadingID + "', '" + current_order + "');\">up</a> | "); Output.Write("<a title=\"Move this heading down in the order\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return move_heading_down('" + thisTheme.ThematicHeadingID + "', '" + current_order + "');\">down</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td>" + thisTheme.ThemeName + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); current_order++; } Output.WriteLine("</table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
/// <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) { Tracer.Add_Trace("Aliases_AdminViewer.Add_HTML_In_Main_Form", "Add any popup divisions for form elements"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-1.6.2.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.8.16.custom.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_form.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_forwarding_tosave\" name=\"admin_forwarding_tosave\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- Item Aggregation Aliases Edit Form -->"); Output.WriteLine("<div class=\"admin_forwarding_popup_div\" id=\"form_forwarding\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">EDIT AGGREGATION ALIAS</td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"alias_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for alias Output.WriteLine(" <tr><td width=\"120px\"><label for=\"form_forwarding_alias\">Alias:</label></td><td colspan=\"2\"><span class=\"form_linkline admin_existing_code_line\" id=\"form_forwarding_alias\"></span></td></tr>"); // Add line for aggregation Output.WriteLine(" <tr><td><label for=\"form_forwarding_code\">Item Aggregation:</label></td><td colspan=\"2\"><input class=\"admin_forwarding_input\" name=\"form_forwarding_code\" id=\"form_forwarding_code\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('form_forwarding_code', 'admin_forwarding_input_focused')\" onblur=\"javascript:textbox_leave('form_forwarding_code', 'admin_forwarding_input')\" /></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine(" <center><a href=\"\" onclick=\"return alias_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>"); Output.WriteLine("</div>"); Tracer.Add_Trace("Aliases_AdminViewer.Add_HTML_In_Main_Form", "Write the rest of the form "); Output.WriteLine("<!-- Aliases_AdminViewer.Add_HTML_In_Main_Form -->"); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"SobekHomeText\">"); if (actionMessage.Length > 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <center><b>" + actionMessage + "</b></center>"); } Output.WriteLine(" <blockquote>"); Output.WriteLine(" Use item aggregation aliases to allow a term to forward to an existing item aggregation. "); Output.WriteLine(" This creates a simpler URL and can forward from a discontinued item aggregation.<br /><br />"); Output.WriteLine(" For more information about aggregation aliases and forwarding, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/aggraliases\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>."); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <span class=\"SobekAdminTitle\">New Item Aggregation Alias</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <div class=\"admin_forwarding_new_div\">"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for alias Output.WriteLine(" <tr><td width=\"120px\"><label for=\"admin_forwarding_alias\">Alias:</label></td><td colspan=\"2\"><input class=\"admin_forwarding_input\" name=\"admin_forwarding_alias\" id=\"admin_forwarding_alias\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_forwarding_alias', 'admin_forwarding_input_focused')\" onblur=\"javascript:textbox_leave('admin_forwarding_alias', 'admin_forwarding_input')\" /></td></tr>"); // Add line for aggregation Output.WriteLine(" <tr><td><label for=\"admin_forwarding_code\">Item Aggregation:</label></td><td><input class=\"admin_forwarding_input\" name=\"admin_forwarding_code\" id=\"admin_forwarding_code\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_forwarding_code', 'admin_forwarding_input_focused')\" onblur=\"javascript:textbox_leave('admin_forwarding_code', 'admin_forwarding_input')\" /></td>"); Output.WriteLine(" <td><input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\" onclick=\"return save_new_alias();\"/></td></tr>"); // Output.WriteLine(" <td><a onclick=\"return save_new_alias();\"><img border=\"0\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" alt=\"SUBMIT\" /></a></td></tr>"); Output.WriteLine(" </table>"); //Output.WriteLine(" <center><input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\"></center>"); Output.WriteLine(" </div>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Existing Item Aggregation Aliases</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"160px\" align=\"left\"><span style=\"color: White\"> ACTIONS</span></th>"); Output.WriteLine(" <th width=\"180px\" align=\"left\"><span style=\"color: White\">ALIAS</span></th>"); Output.WriteLine(" <th width=\"120px\" align=\"left\"><span style=\"color: White\">AGGREGATION</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); // Write the data for each interface foreach (KeyValuePair <string, string> thisForward in aggregationAliases) { // Build the action links Output.WriteLine(" <tr align=\"left\" >"); Output.Write(" <td class=\"SobekAdminActionLink\" >( "); Output.Write("<a title=\"Click to edit\" id=\"VIEW_" + thisForward.Key + "\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return alias_form_popup('VIEW_" + thisForward.Key + "', '" + thisForward.Key + "','" + thisForward.Value + "');\">edit</a> | "); Output.Write("<a title=\"Click to view\" href=\"" + currentMode.Base_URL + thisForward.Key + "\" target=\"_PREVIEW\">view</a> | "); Output.Write("<a title=\"Delete this alias\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_alias('" + thisForward.Key + "');\">delete</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td>" + thisForward.Key + "</span></td>"); Output.WriteLine(" <td>" + thisForward.Value + "</span></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); } Output.WriteLine("</table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
static void Main() { // Set the Gembox spreadsheet license key SpreadsheetInfo.SetLicense("EDWF-ZKV9-D793-1D2A"); Control.CheckForIllegalCrossThreadCalls = false; // Set the visual rendering Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Set some defaults for round buttons Round_Button.Inactive_Border_Color = Color.DarkGray; Round_Button.Inactive_Text_Color = Color.White; Round_Button.Inactive_Fill_Color = Color.DarkGray; Round_Button.Mouse_Down_Border_Color = Color.Gray; Round_Button.Mouse_Down_Text_Color = Color.White; Round_Button.Mouse_Down_Fill_Color = Color.Gray; Round_Button.Active_Border_Color = Color.FromArgb(25, 68, 141); Round_Button.Active_Fill_Color = Color.FromArgb(25, 68, 141); Round_Button.Active_Text_Color = Color.White; bool updating = false; // Create a version checker to see if this is the latest version VersionChecker versionChecker = new VersionChecker(); if (versionChecker.UpdateExists()) { // Later, we will determine if the update is mandatory or not here if (versionChecker.UpdateMandatory()) { MessageBox.Show(@"There is a new version of this application which must be installed. Please stand by as the installation software is launched. ", "New Version Needed", MessageBoxButtons.OK, MessageBoxIcon.Information); // Start the Setup files to update this application and then exit versionChecker.Update(); updating = true; } else { // A non-mandatory update exists DialogResult update = MessageBox.Show("A newer version of this software is available. \n\nWould you like to upgrade now?", "New Version Available", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (update.Equals(DialogResult.Yes)) { // Start the Setup files to update this application and then exit versionChecker.Update(); updating = true; } } } // Only continue if this application is not being updated if (!updating) { // Now, if an error was encountered anywhere, show an error message if (versionChecker.Error) { MessageBox.Show("An error was encountered while performing the routine Version check. \n\n" + "Your application may not be the most recent version.", "Version Check Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // Look for the configuration file string config_file = AppDomain.CurrentDomain.BaseDirectory + "\\config\\sobekcm.config"; if (!File.Exists(config_file)) { SMaRT_Config_Edit_Form editConfig = new SMaRT_Config_Edit_Form(); DialogResult result = editConfig.ShowDialog(); if ((result == DialogResult.Cancel) || (!File.Exists((config_file)))) { return; } } // References the library settings to retrieve the informatoin from the configuration file and subsequently // from the SobekCM database SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connection_String; Resource_Object.Database.SobekCM_Database.Connection_String = SobekCM_Library_Settings.Database_Connection_String; // Set the workflow and disposition types SobekCM_Library_Settings.Set_Workflow_And_Disposition_Types(SobekCM_Database.All_WorkFlow_Types, SobekCM_Database.All_Possible_Disposition_Types); // Set the metadata types SobekCM_Library_Settings.Set_Metadata_Types(SobekCM_Database.Get_Metadata_Fields(null)); // Set the search stop words SobekCM_Library_Settings.Search_Stop_Words = SobekCM_Database.Search_Stop_Words(null); // Launch the main form Application.Run(new MainForm( )); } }
/// <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) { Tracer.Add_Trace("Projects_AdminViewer.Add_HTML_In_Main_Form", "Add any popup divisions for form elements"); // Add the scripts needed Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-1.6.2.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.8.16.custom.min.js\"></script>"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_form.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(); Output.WriteLine("<!-- Projects Rename Form -->"); Output.WriteLine("<div class=\"admin_project_popup_div\" id=\"form_project\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">RENAME PROJECT</td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"project_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for code Output.Write(" <tr align=\"left\"><td width=\"120px\"><label for=\"form_project_code\">Project Code:</label></td>"); Output.Write("<td><span class=\"form_linkline admin_existing_code_line\" id=\"form_project_code\"></span></td>"); // Add line for name Output.WriteLine(" <tr><td><label for=\"form_project_name\">Project Name:</label></td><td><input class=\"admin_project_large_input\" name=\"form_project_name\" id=\"form_project_name\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('form_project_name', 'admin_project_large_input_focused')\" onblur=\"javascript:textbox_leave('form_project_name', 'admin_project_large_input')\" /></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine(" <center><a href=\"\" onclick=\"return project_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>"); Output.WriteLine("</div>"); Tracer.Add_Trace("Projects_AdminViewer.Add_HTML_In_Main_Form", "Write the rest of the form html"); // Get the list of all projects DataSet projectsSet = SobekCM_Database.Get_All_Projects_Templates(Tracer); Output.WriteLine("<!-- Projects_AdminViewer.Add_HTML_In_Main_Form -->"); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_admin.js\" type=\"text/javascript\"></script>"); Output.WriteLine("<div class=\"SobekHomeText\">"); if (actionMessage.Length > 0) { Output.WriteLine(" <br />"); Output.WriteLine(" <center><b>" + actionMessage + "</b></center>"); } Output.WriteLine(" <blockquote>For clarification of any terms on this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/projects\" target=\"PROJECTS_INTERFACE_HELP\" >click here to view the help page</a>.</blockquote>"); Output.WriteLine(" <span class=\"SobekAdminTitle\">New Project</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <div class=\"admin_project_new_div\">"); Output.WriteLine(" <table class=\"popup_table\">"); // Add line for code and base code Output.Write(" <tr><td width=\"120px\"><label for=\"admin_project_code\">Project Code:</label></td>"); Output.Write("<td><input class=\"admin_project_small_input\" name=\"admin_project_code\" id=\"admin_project_code\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_project_code', 'admin_project_small_input_focused')\" onblur=\"javascript:textbox_leave('admin_project_code', 'admin_project_small_input')\" /></td>"); Output.Write("<td width=\"285px\" ><label for=\"admin_project_base\">Base Project Code:</label> <select class=\"admin_project_select\" name=\"admin_project_base\" id=\"admin_project_base\">"); Output.Write("<option value=\"(none)\" selected=\"selected\">(none)</option>"); foreach (DataRow thisRow in projectsSet.Tables[0].Rows) { Output.Write("<option value=\"" + thisRow["ProjectCode"] + "\" >" + thisRow["ProjectCode"] + "</option>"); } Output.WriteLine("</select></td></tr>"); // Add line for name Output.WriteLine(" <tr><td><label for=\"admin_project_name\">Project Name:</label></td><td colspan=\"2\"><input class=\"admin_project_large_input\" name=\"admin_project_name\" id=\"admin_project_name\" type=\"text\" value=\"\" onfocus=\"javascript:textbox_enter('admin_project_name', 'admin_project_large_input_focused')\" onblur=\"javascript:textbox_leave('admin_project_name', 'admin_project_large_input')\" /></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" <br />"); Output.WriteLine(" <center><input type=\"image\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button.gif\" value=\"Submit\" alt=\"Submit\" onclick=\"return save_new_project();\"/></center>"); Output.WriteLine(" </div>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Existing Projects</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"110px\" align=\"left\"><span style=\"color: White\"> ACTIONS</span></th>"); Output.WriteLine(" <th width=\"140px\" align=\"left\"><span style=\"color: White\">CODE</span></th>"); Output.WriteLine(" <th width=\"450px\" align=\"left\"><span style=\"color: White\">NAME</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); currentMode.My_Sobek_SubMode = "XXXXXXX"; string redirect = currentMode.Redirect_URL(); // Write the data for each interface foreach (DataRow thisRow in projectsSet.Tables[0].Rows) { // Pull all these values string code = thisRow["ProjectCode"].ToString(); string name = thisRow["ProjectName"].ToString(); // Build the action links Output.WriteLine(" <tr align=\"left\" >"); Output.Write(" <td class=\"SobekAdminActionLink\" >( "); Output.Write("<a title=\"Click to edit this project\" id=\"EDIT_" + code + "\" href=\"" + redirect.Replace("XXXXXXX", "1" + code) + "\" >edit</a> | "); Output.Write("<a title=\"Click to change the name of this project\" id=\"RENAME_" + code + "\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return project_form_popup('RENAME_" + code + "', '" + code + "','" + name + "');\">rename</a> )</td>"); // Add the rest of the row with data Output.WriteLine(" <td>" + code + "</span></td>"); Output.WriteLine(" <td>" + name + "</span></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>"); } Output.WriteLine("</table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
private void Write_Edit_User_Group_Form(TextWriter Output, Custom_Tracer Tracer) { Output.WriteLine(" <div class=\"SobekHomeText\">"); Output.WriteLine(" <br />"); Output.WriteLine(" <b>Edit this user group's permissions and abilities</b>"); Output.WriteLine(" <ul>"); Output.WriteLine(" <li>Enter the permissions for this user group below and press the SAVE button when all your edits are complete.</li>"); Output.WriteLine(" <li>For clarification of any terms on this form, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/users\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</li>"); Output.WriteLine(" </ul>"); Output.WriteLine(" </div>"); Output.WriteLine(" <div class=\"ViewsBrowsesRow\">"); Output.WriteLine(" " + Selected_Tab_Start + " GROUP INFORMATION " + Selected_Tab_End); Output.WriteLine(" </div>"); Output.WriteLine(" <div class=\"SobekEditPanel\">"); // Add the buttons string last_mode = currentMode.My_Sobek_SubMode; currentMode.My_Sobek_SubMode = String.Empty; currentMode.Admin_Type = Admin_Type_Enum.Users; Output.WriteLine(" <table width=\"100%px\"><tr><td width=\"480px\"> </td><td align=\"right\"><a href=\"" + currentMode.Redirect_URL() + "\"><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\"></td><td width=\"20px\"> </td></tr></table>"); currentMode.My_Sobek_SubMode = last_mode; currentMode.Admin_Type = Admin_Type_Enum.User_Groups; Output.WriteLine(" <span class=\"SobekEditItemSectionTitle_first\"> Basic Information</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <table>"); Output.WriteLine(" <tr><td><b><label for=\"groupName\">Name:</label></b></td><td><input id=\"groupName\" name=\"groupName\" class=\"admin_small_input\" value=\"" + editGroup.Name + "\" type=\"text\" onfocus=\"javascript:textbox_enter('groupName', 'admin_small_input_focused')\" onblur=\"javascript:textbox_leave('groupName', 'admin_small_input')\" /></td></tr>"); Output.WriteLine(" <tr><td><b><label for=\"groupDescription\">Description:</label></b></td><td><input id=\"groupDescription\" name=\"groupDescription\" class=\"admin_large_input\" value=\"" + editGroup.Description + "\" type=\"text\" onfocus=\"javascript:textbox_enter('groupDescription', 'admin_large_input_focused')\" onblur=\"javascript:textbox_leave('groupDescription', 'admin_large_input')\" /></td></tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekEditItemSectionTitle\"> Global Permissions</span><br />"); Output.WriteLine(editGroup.Can_Submit ? " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_submit\" id=\"admin_user_submit\" checked=\"checked\" /> <label for=\"admin_user_submit\">Can submit items</label> <br />" : " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_submit\" id=\"admin_user_submit\" /> <label for=\"admin_user_submit\">Can submit items</label> <br />"); Output.WriteLine(editGroup.Is_Internal_User ? " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_internal\" id=\"admin_user_internal\" checked=\"checked\" /> <label for=\"admin_user_internal\">Is internal user</label> <br />" : " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_internal\" id=\"admin_user_internal\" /> <label for=\"admin_user_internal\">Is internal user</label> <br />"); bool canEditAll = editGroup.Editable_Regular_Expressions.Any(thisRegularExpression => thisRegularExpression == "[A-Z]{2}[A-Z|0-9]{4}[0-9]{4}"); Output.WriteLine(canEditAll ? " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_editall\" id=\"admin_user_editall\" checked=\"checked\" /> <label for=\"admin_user_editall\">Can edit <u>all</u> items</label> <br />" : " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_editall\" id=\"admin_user_editall\" /> <label for=\"admin_user_editall\">Can edit <u>all</u> items</label> <br />"); Output.WriteLine(editGroup.Is_System_Admin ? " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_admin\" id=\"admin_user_admin\" checked=\"checked\" /> <label for=\"admin_user_admin\">Is system administrator</label> <br />" : " <input class=\"admin_user_checkbox\" type=\"checkbox\" name=\"admin_user_admin\" id=\"admin_user_admin\" /> <label for=\"admin_user_admin\">Is system administrator</label> <br />"); Output.WriteLine(" <br />"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekEditItemSectionTitle\"> Templates and Projects</span>"); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <table width=\"600px\">"); DataSet projectTemplateSet = SobekCM_Database.Get_All_Projects_Templates(Tracer); Output.WriteLine(" <tr valign=\"top\" >"); Output.WriteLine(" <td wdith=\"300px\">"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsWhiteTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"180px\" align=\"left\"><span style=\"color: White\">TEMPLATES</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr ><td bgcolor=\"#e7e7e7\"></td></tr>"); ReadOnlyCollection <string> user_templates = editGroup.Templates; foreach (DataRow thisTemplate in projectTemplateSet.Tables[1].Rows) { string template_name = thisTemplate["TemplateName"].ToString(); string template_code = thisTemplate["TemplateCode"].ToString(); Output.Write(" <tr align=\"left\"><td><input type=\"checkbox\" name=\"admin_user_template_" + template_code + "\" id=\"admin_user_template_" + template_code + "\""); if (user_templates.Contains(template_code)) { Output.Write(" checked=\"checked\""); } if (template_name.Length > 0) { Output.WriteLine(" /> <acronym title=\"" + template_name.Replace("\"", "'") + "\"><label for=\"admin_user_template_" + template_code + "\">" + template_code + "</label></acronym></td></tr>"); } else { Output.WriteLine(" /> <label for=\"admin_user_template_" + template_code + "\">" + template_code + "</label></td></tr>"); } Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\"></td></tr>"); } Output.WriteLine("</table>"); Output.WriteLine(" </td>"); Output.WriteLine(" <td>"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsWhiteTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); Output.WriteLine(" <th width=\"180px\" align=\"left\"><span style=\"color: White\">PROJECTS</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\"></td></tr>"); ReadOnlyCollection <string> user_projects = editGroup.Projects; foreach (DataRow thisProject in projectTemplateSet.Tables[0].Rows) { string project_name = thisProject["ProjectName"].ToString(); string project_code = thisProject["ProjectCode"].ToString(); Output.Write(" <tr align=\"left\"><td><input type=\"checkbox\" name=\"admin_user_project_" + project_code + "\" id=\"admin_user_project_" + project_code + "\""); if (user_projects.Contains(project_code)) { Output.Write(" checked=\"checked\""); } if (project_name.Length > 0) { Output.WriteLine(" /> <acronym title=\"" + project_name.Replace("\"", "'") + "\"><label for=\"admin_user_project_" + project_code + "\">" + project_code + "</label></acronym></td></tr>"); } else { Output.WriteLine(" /> <label for=\"admin_user_project_" + project_code + "\">" + project_code + "</label></td></tr>"); } Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\"></td></tr>"); } Output.WriteLine("</table>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" </table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(" <br />"); Output.WriteLine(" <br />"); Output.WriteLine(" <span class=\"SobekEditItemSectionTitle\"> Aggregations</span>"); Output.WriteLine(" <br />"); Output.WriteLine(" <br />"); Output.WriteLine("<table><tr><td width=\"30px\"> </td><td>"); Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsWhiteTable\">"); // Get the list of collections lists in the user object ReadOnlyCollection <User_Editable_Aggregation> aggregations_in_editable_user = editGroup.Aggregations; Dictionary <string, User_Editable_Aggregation> lookup_aggs = aggregations_in_editable_user.ToDictionary(thisAggr => thisAggr.Code.ToLower()); // Step through each aggregation type foreach (string aggregationType in codeManager.All_Types) { Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" >"); if ((aggregationType.Length > 0) && (aggregationType[aggregationType.Length - 1] != 'S')) { Output.WriteLine(" <td colspan=\"6\"><span style=\"color: White\"><b>" + aggregationType.ToUpper() + "S</b></span></td>"); } else { Output.WriteLine(" <td colspan=\"6\"><span style=\"color: White\"><b>" + aggregationType.ToUpper() + "</b></span></td>"); } Output.WriteLine(" </tr>"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#7d90d5\" >"); Output.WriteLine(" <td width=\"57px\" align=\"left\"><span style=\"color: White\"><acronym title=\"Can select this aggregation when editing or submitting an item\">CAN<br />SELECT</acronym></span></td>"); Output.WriteLine(" <td width=\"50px\" align=\"left\"><span style=\"color: White\"><acronym title=\"Can edit any item in this aggregation\">CAN<br />EDIT</acronym></span></td>"); Output.WriteLine(" <td width=\"50px\" align=\"left\"><span style=\"color: White\"><acronym title=\"Can perform curatorial or collection manager tasks on this aggregation\">IS<br />CURATOR</acronym></span></td>"); Output.WriteLine(" <td align=\"left\" colspan=\"2\"><span style=\"color: White\">ITEM AGGREGATION</span></td>"); Output.WriteLine(" </tr>"); // Show all matching rows foreach (Item_Aggregation_Related_Aggregations thisAggr in codeManager.Aggregations_By_Type(aggregationType)) { Output.WriteLine(" <tr align=\"left\" >"); if (!lookup_aggs.ContainsKey(thisAggr.Code)) { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_select_" + thisAggr.Code + "\" id=\"admin_project_select_" + thisAggr.Code + "\" /></td>"); Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_edit_" + thisAggr.Code + "\" id=\"admin_project_edit_" + thisAggr.Code + "\" /></td>"); Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_admin_" + thisAggr.Code + "\" id=\"admin_project_admin_" + thisAggr.Code + "\" /></td>"); } else { if (lookup_aggs[thisAggr.Code].CanSelect) { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_select_" + thisAggr.Code + "\" id=\"admin_project_select_" + thisAggr.Code + "\" checked=\"checked\" /></td>"); } else { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_select_" + thisAggr.Code + "\" id=\"admin_project_select_" + thisAggr.Code + "\" /></td>"); } if (lookup_aggs[thisAggr.Code].CanEditItems) { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_edit_" + thisAggr.Code + "\" id=\"admin_project_edit_" + thisAggr.Code + "\" checked=\"checked\" /></td>"); } else { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_edit_" + thisAggr.Code + "\" id=\"admin_project_edit_" + thisAggr.Code + "\" /></td>"); } if (lookup_aggs[thisAggr.Code].IsCurator) { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_admin_" + thisAggr.Code + "\" id=\"admin_project_admin_" + thisAggr.Code + "\" checked=\"checked\" /></td>"); } else { Output.WriteLine(" <td><input type=\"checkbox\" name=\"admin_project_admin_" + thisAggr.Code + "\" id=\"admin_project_admin_" + thisAggr.Code + "\" /></td>"); } } Output.WriteLine(" <td>" + thisAggr.Code + "</td>"); Output.WriteLine(" <td>" + thisAggr.Name + "</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"6\"></td></tr>"); } } Output.WriteLine("</table>"); Output.WriteLine("</td></tr></table>"); Output.WriteLine("<br />"); // Add the buttons currentMode.My_Sobek_SubMode = String.Empty; Output.WriteLine(" <table width=\"100%px\"><tr><td width=\"480px\"> </td><td align=\"right\"><a href=\"" + currentMode.Redirect_URL() + "\"><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\"></td><td width=\"20px\"> </td></tr></table>"); currentMode.My_Sobek_SubMode = last_mode; Output.WriteLine("</div>"); }
private void complete_item_submission(SobekCM_Item Item_To_Complete, Custom_Tracer Tracer) { // If this is a newspaper type, and the pubdate has a value, try to use that for the serial heirarchy if ((Item_To_Complete.Behaviors.Serial_Info.Count == 0) && (Item_To_Complete.Bib_Info.Origin_Info.Date_Issued.Length > 0) && (Item_To_Complete.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Newspaper)) { DateTime asDateTime; if (DateTime.TryParse(Item_To_Complete.Bib_Info.Origin_Info.Date_Issued, out asDateTime)) { hierarchyCopiedFromDate = true; Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(1, asDateTime.Year, asDateTime.Year.ToString()); switch (asDateTime.Month) { case 1: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "January"); break; case 2: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "February"); break; case 3: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "March"); break; case 4: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "April"); break; case 5: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "May"); break; case 6: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "June"); break; case 7: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "July"); break; case 8: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "August"); break; case 9: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "September"); break; case 10: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "October"); break; case 11: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "November"); break; case 12: Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(2, asDateTime.Month, "December"); break; } Item_To_Complete.Behaviors.Serial_Info.Add_Hierarchy(3, asDateTime.Day, asDateTime.Day.ToString()); } } // Determine the in process directory for this string user_in_process_directory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + user.UserName.Replace(".", "").Replace("@", "") + "\\newitem"; if (user.UFID.Trim().Length > 0) { user_in_process_directory = SobekCM_Library_Settings.In_Process_Submission_Location + "\\" + user.UFID + "\\newitem"; } // Ensure this directory exists if (!Directory.Exists(user_in_process_directory)) { Directory.CreateDirectory(user_in_process_directory); } // Now, delete all the files in the processing directory string[] all_files = Directory.GetFiles(user_in_process_directory); foreach (string thisFile in all_files) { File.Delete(thisFile); } // Save to the database Item_To_Complete.Web.File_Root = Item_To_Complete.BibID.Substring(0, 2) + "\\" + Item_To_Complete.BibID.Substring(2, 2) + "\\" + Item_To_Complete.BibID.Substring(4, 2) + "\\" + Item_To_Complete.BibID.Substring(6, 2) + "\\" + Item_To_Complete.BibID.Substring(8, 2); SobekCM_Database.Save_New_Digital_Resource(Item_To_Complete, false, false, user.UserName, String.Empty, -1); // Assign the file root and assoc file path Item_To_Complete.Web.AssocFilePath = Item_To_Complete.Web.File_Root + "\\" + Item_To_Complete.VID + "\\"; // Create the static html pages string base_url = currentMode.Base_URL; try { Static_Pages_Builder staticBuilder = new Static_Pages_Builder(SobekCM_Library_Settings.System_Base_URL, SobekCM_Library_Settings.Base_Data_Directory, Translator, codeManager, itemList, iconList, webSkin); string filename = user_in_process_directory + "\\" + Item_To_Complete.BibID + "_" + Item_To_Complete.VID + ".html"; staticBuilder.Create_Item_Citation_HTML(Item_To_Complete, filename, String.Empty); } catch (Exception ee) { message = message + "<br /><span style=\"color: red\"><strong>" + ee.Message + "<br />" + ee.StackTrace.Replace("\n", "<br />") + "</strong></span>"; } currentMode.Base_URL = base_url; // Save the rest of the metadata Item_To_Complete.Source_Directory = user_in_process_directory; Item_To_Complete.Save_SobekCM_METS(); Item_To_Complete.Save_Citation_Only_METS(); // Add this to the cache itemList.Add_SobekCM_Item(Item_To_Complete); Database.SobekCM_Database.Add_Item_To_User_Folder(user.UserID, "Submitted Items", Item_To_Complete.BibID, Item_To_Complete.VID, 0, String.Empty, Tracer); // Save Bib_Level METS? //SobekCM.Resource_Object.Writers.OAI_Writer oaiWriter = new SobekCM.Resource_Object.Writers.OAI_Writer(); //oaiWriter.Save_OAI_File(bibPackage, resource_folder + "\\oai_dc.xml", bibPackage.Processing_Parameters.Collection_Primary.ToLower(), createDate); // If there was no match, try to save to the tracking database Database.SobekCM_Database.Tracking_Online_Submit_Complete(Item_To_Complete.Web.ItemID, user.Full_Name, String.Empty); List <string> collectionnames = new List <string>(); MarcXML_File_ReaderWriter marcWriter = new MarcXML_File_ReaderWriter(); string Error_Message; Dictionary <string, object> options = new Dictionary <string, object>(); options["MarcXML_File_ReaderWriter:Additional_Tags"] = Item_To_Complete.MARC_Sobek_Standard_Tags(collectionnames, true, SobekCM_Library_Settings.System_Name, SobekCM_Library_Settings.System_Abbreviation); marcWriter.Write_Metadata(Item_To_Complete.Source_Directory + "\\marc.xml", Item_To_Complete, options, out Error_Message); // Copy this to all the image servers SobekCM_Library_Settings.Refresh(Database.SobekCM_Database.Get_Settings_Complete(Tracer)); string[] allFiles = Directory.GetFiles(user_in_process_directory); // Copy all the files over to the server string serverNetworkFolder = SobekCM_Library_Settings.Image_Server_Network + Item_To_Complete.Web.AssocFilePath; // Create the folder if (!Directory.Exists(serverNetworkFolder)) { Directory.CreateDirectory(serverNetworkFolder); } foreach (string thisFile in allFiles) { string destination_file = serverNetworkFolder + "\\" + (new FileInfo(thisFile)).Name; File.Copy(thisFile, destination_file, true); } // Add this to the cache itemList.Add_SobekCM_Item(Item_To_Complete); // Incrememnt the count of number of items submitted by this user user.Items_Submitted_Count++; // Delete any remaining items all_files = Directory.GetFiles(user_in_process_directory); foreach (string thisFile in all_files) { File.Delete(thisFile); } }
/// <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("Aliases_AdminViewer.Write_ItemNavForm_Closing", "Add any popup divisions for form elements"); Output.WriteLine("<!-- Aliases_AdminViewer.Write_ItemNavForm_Closing -->"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/jquery/jquery-ui-1.10.3.custom.min.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_forwarding_tosave\" name=\"admin_forwarding_tosave\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- Item Aggregation Aliases Edit Form -->"); Output.WriteLine("<div class=\"sbkAav_PopupDiv\" id=\"form_forwarding\" style=\"display:none;\">"); Output.WriteLine(" <div class=\"sbkAdm_PopupTitle\"><table style=\"width:100%;\"><tr><td style=\"text-align:left;\">EDIT AGGREGATION ALIAS</td><td style=\"text-align:right;\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"alias_form_close()\">X</a> </td></tr></table></div>"); Output.WriteLine(" <br />"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for alias Output.WriteLine(" <tr style=\"height: 30px;\"><td style=\"width:120px;\"><label for=\"form_forwarding_alias\">Alias:</label></td><td colspan=\"2\"><span class=\"form_linkline admin_existing_code_line\" id=\"form_forwarding_alias\"></span></td></tr>"); // Add line for aggregation Output.WriteLine(" <tr style=\"height: 30px;\"><td><label for=\"form_forwarding_code\">Item Aggregation:</label></td><td colspan=\"2\"><input class=\"sbkAav_input sbkAdmin_Focusable\" name=\"form_forwarding_code\" id=\"form_forwarding_code\" type=\"text\" value=\"\" /></td></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 alias_form_close();\"><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 existing aggregation alias\" class=\"sbkAdm_RoundButton\" type=\"submit\">SAVE <img src=\"" + currentMode.Base_URL + "default/images/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("Aliases_AdminViewer.Write_ItemNavForm_Closing", "Write the rest of the form "); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/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>Use item aggregation aliases to allow a term to forward to an existing item aggregation. "); Output.WriteLine(" This creates a simpler URL and can forward from a discontinued item aggregation.</p>"); Output.WriteLine(" <p>For more information about aggregation aliases and forwarding, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "adminhelp/aggraliases\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</p>"); Output.WriteLine(" <h2>New Item Aggregation Alias</h2>"); Output.WriteLine(" <div class=\"sbkAav_NewDiv\">"); Output.WriteLine(" <table class=\"sbkAdm_PopupTable\">"); // Add line for alias Output.WriteLine(" <tr><td style=\"width:120px;\"><label for=\"admin_forwarding_alias\">Alias:</label></td><td colspan=\"2\"><input class=\"sbkAav_input sbkAdmin_Focusable\" name=\"admin_forwarding_alias\" id=\"admin_forwarding_alias\" type=\"text\" value=\"\" /></td></tr>"); // Add line for aggregation Output.WriteLine(" <tr><td><label for=\"admin_forwarding_code\">Item Aggregation:</label></td><td><input class=\"sbkAav_input sbkAdmin_Focusable\" name=\"admin_forwarding_code\" id=\"admin_forwarding_code\" type=\"text\" value=\"\" /></td><td><button title=\"Save new aggregation alias\" class=\"sbkAdm_RoundButton\" onclick=\"return save_new_alias();\">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(" <br />"); Output.WriteLine(" <h2>Existing Item Aggregation Aliases</h2>"); if (aggregationAliases.Count > 0) { Output.WriteLine(" <table class=\"sbkAav_Table sbkAdm_Table\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <th class=\"sbkAav_TableHeader1\">ACTIONS</th>"); Output.WriteLine(" <th class=\"sbkAav_TableHeader2\">ALIAS</th>"); Output.WriteLine(" <th class=\"sbkAav_TableHeader3\">AGGREGATION</th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); SortedList <string, string> sorter = new SortedList <string, string>(); foreach (KeyValuePair <string, string> thisForward in aggregationAliases) { sorter.Add(thisForward.Key, thisForward.Value); } // Write the data for each interface foreach (KeyValuePair <string, string> thisForward in sorter) { // Build the action links Output.WriteLine(" <tr>"); Output.Write(" <td class=\"sbkAdm_ActionLink\" >( "); Output.Write("<a title=\"Click to edit\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return alias_form_popup('" + thisForward.Key + "','" + thisForward.Value + "');\">edit</a> | "); Output.Write("<a title=\"Click to view\" href=\"" + currentMode.Base_URL + thisForward.Key + "\" target=\"_PREVIEW\">view</a> | "); if (user.Is_System_Admin) { Output.Write("<a title=\"Delete this alias\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_alias('" + thisForward.Key + "');\">delete</a> )</td>"); } else { Output.Write("<a title=\"Only SYSTEM administrators can delete aliases\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"alert('Only SYSTEM administrators can delete aliases');return false;\">delete</a> )</td>"); } // Add the rest of the row with data Output.WriteLine(" <td>" + thisForward.Key + "</span></td>"); Output.WriteLine(" <td>" + thisForward.Value + "</span></td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td class=\"sbkAdm_TableRule\" colspan=\"3\"></td></tr>"); } Output.WriteLine(" </table>"); } else { Output.WriteLine(" <p>No existing aggregation aliases exist. To add one, enter the information above and press SAVE.</p>"); } Output.WriteLine(" <br />"); Output.WriteLine("</div>"); Output.WriteLine(); }
/// <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> public override void Add_HTML_In_Main_Form(TextWriter Output, Custom_Tracer Tracer) { Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Add_HTML_In_Main_Form", ""); Output.WriteLine("<!-- Hidden field is used for postbacks to add new form elements (i.e., new name, new other titles, etc..) -->"); Output.WriteLine("<input type=\"hidden\" id=\"action\" name=\"action\" value=\"\" />"); Output.WriteLine("<!-- Group_Add_Volume_MySobekViewer.Add_HTML_In_Main_Form -->"); Output.WriteLine("<div class=\"SobekText\">"); Output.WriteLine(" <br />"); Output.WriteLine(" <b>Add a new volume to this existing title/item group.</b>"); Output.WriteLine(" <ul>"); Output.WriteLine(" <li>Only enter data that you wish to override the data in the existing base volume.</li>"); //Output.WriteLine(" <li>Clicking on the green plus button ( <img class=\"repeat_button\" src=\"" + currentMode.Base_URL + "default/images/new_element_demo.jpg\" /> ) will add another instance of the element, if the element is repeatable.</li>"); Output.WriteLine(" <li>Click <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "help/addvolume\" target=\"_EDIT_INSTRUCTIONS\">here for detailed instructions</a> on adding new volumes online.</li>"); Output.WriteLine(" </ul>"); Output.WriteLine("</div>"); Output.WriteLine(); if (message.Length > 0) { Output.WriteLine("" + message + "<br />"); } Output.WriteLine("<a name=\"template\"> </a>"); Output.WriteLine("<div class=\"ViewsBrowsesRow\">"); Output.WriteLine(Selected_Tab_Start + "NEW VOLUME" + Selected_Tab_End + " "); Output.WriteLine("</div>"); Output.WriteLine("<div class=\"SobekEditPanel\">"); Output.WriteLine("<!-- Add SAVE and CANCEL buttons to top of form -->"); Output.WriteLine("<script src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_metadata.js\" type=\"text/javascript\"></script>"); Output.WriteLine("<table width=\"100%\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td width=\"20px\"> </td>"); // Output.WriteLine(" <td width=\"460px\"> Import metadata and behaviors from existing volume: "); Output.WriteLine(" <td width=\"300px\"> Import from existing volume: "); Output.WriteLine(" <select id=\"base_volume\" name=\"base_volume\" class=\"addvolume_base_volume\">"); DataColumn vidColumn = itemsInTitle.Item_Table.Columns["VID"]; bool first = true; DataView sortedView = new DataView(itemsInTitle.Item_Table) { Sort = "VID DESC" }; foreach (DataRowView itemRowView in sortedView) { if (first) { Output.WriteLine(" <option value=\"" + itemRowView.Row[vidColumn] + "\" selected=\"selected\">" + itemRowView.Row[vidColumn] + "</option>"); first = false; } else { Output.WriteLine(" <option value=\"" + itemRowView.Row[vidColumn] + "\">" + itemRowView.Row[vidColumn] + "</option>"); } } Output.WriteLine(" </select>"); Output.WriteLine(" </td>"); Output.WriteLine(" <td align=\"right\">"); Output.WriteLine(" <a onmousedown=\"addvolume_cancel_form(); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/cancel_button_g.gif\" alt=\"CANCEL\" /></a> "); Output.WriteLine(" <a onmousedown=\"addvolume_save_form(''); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button_g.gif\" alt=\"SAVE\" /></a> "); Output.WriteLine(" <a onmousedown=\"addvolume_save_form('_again'); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_add_another.gif\" alt=\"SAVE AND ADD ANOTHER\" /></a>"); Output.WriteLine(" </td>"); Output.WriteLine(" <td width=\"20px\"> </td>"); Output.WriteLine(" </tr>"); Output.WriteLine("</table>"); bool isMozilla = false; if (currentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0) { isMozilla = true; } // Create a new blank item for display purposes SobekCM_Item displayItem = new SobekCM_Item { BibID = item.BibID }; displayItem.Behaviors.IP_Restriction_Membership = ipRestrict; displayItem.Behaviors.Serial_Info.Clear(); displayItem.Tracking.Born_Digital = bornDigital; displayItem.Tracking.Tracking_Box = trackingBox; displayItem.Tracking.Material_Received_Notes = materialRecdNotes; displayItem.Tracking.Material_Received_Date = materialRecdDate; displayItem.Tracking.Disposition_Advice = dispositionAdvice; displayItem.Tracking.Disposition_Advice_Notes = dispositionAdviceNotes; if (title.Length > 0) { displayItem.Bib_Info.Main_Title.Clear(); displayItem.Bib_Info.Main_Title.Title = title; } if (date.Length > 0) { displayItem.Bib_Info.Origin_Info.Date_Issued = date; } if ((level1.Length > 0) && (level1Order >= 0)) { displayItem.Behaviors.Serial_Info.Add_Hierarchy(1, level1Order, level1); if ((level2.Length > 0) && (level2Order >= 0)) { displayItem.Behaviors.Serial_Info.Add_Hierarchy(2, level2Order, level2); if ((level3.Length > 0) && (level3Order >= 0)) { displayItem.Behaviors.Serial_Info.Add_Hierarchy(3, level3Order, level3); } } } template.Render_Template_HTML(Output, displayItem, currentMode.Skin == currentMode.Default_Skin ? currentMode.Skin.ToUpper() : currentMode.Skin, isMozilla, user, currentMode.Language, Translator, currentMode.Base_URL, 1); // Add the second buttons at the bottom of the form Output.WriteLine("<!-- Add SAVE and CANCEL buttons to bottom of form -->"); Output.WriteLine("<table width=\"100%\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td width=\"480px\"> </td>"); Output.WriteLine(" <td align=\"right\">"); Output.WriteLine(" <a onmousedown=\"addvolume_cancel_form(); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/cancel_button_g.gif\" alt=\"CANCEL\" /></a> "); Output.WriteLine(" <a onmousedown=\"addvolume_save_form(''); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_button_g.gif\" alt=\"SAVE\" /></a>"); Output.WriteLine(" </td>"); Output.WriteLine(" <td width=\"20px\"> </td>"); Output.WriteLine(" </tr>"); Output.WriteLine("</table>"); Output.WriteLine("<br />"); Output.WriteLine("<hr />"); Output.WriteLine("<table width=\"100%\" cellspacing=\"4px\" >"); Output.WriteLine(" <tr height=\"25px\">"); Output.WriteLine(" <td width=\"20px\"> </td>"); Output.WriteLine(" <td colspan=\"2\">In addition, the following actions are available:</td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr height=\"30px\">"); Output.WriteLine(" <td> </td>"); Output.WriteLine(" <td width=\"80px\"> </td>"); Output.WriteLine(" <td>"); Output.WriteLine(" <a onmousedown=\"addvolume_save_form('_edit'); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_edit.gif\" alt=\"SAVE AND EDIT ITEM\" /></a> "); Output.WriteLine(" <a onmousedown=\"addvolume_save_form('_addfiles'); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_add_files.gif\" alt=\"SAVE AND ADD FILES\" /></a> "); // Output.WriteLine(" <img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_add_files_disabled.gif\" alt=\"SAVE AND ADD FILES\" /> "); Output.WriteLine(" <a onmousedown=\"addvolume_save_form('_again'); return false;\"><img style=\"cursor: pointer;\" border=\"0px\" src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/buttons/save_add_another.gif\" alt=\"SAVE AND ADD ANOTHER\" /></a>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine("</table>"); Output.WriteLine("<br />"); Output.WriteLine("</div>"); Output.WriteLine("<br />"); }