private void Add_Setting_UI(string key, int fixed_input_size, string[] options, string help_message, bool is_florida_sus_setting, string default_value) { // Create the settings option struct Variable_Setting_Info newSettingInfo = new Variable_Setting_Info(key, fixed_input_size, options, help_message, is_florida_sus_setting, default_value); // First, save this in the setting dictionary idToSetting[settingCounter] = newSettingInfo; // Increment in preparation for any next setting settingCounter++; }
private void Add_Setting_UI(string Key, string Category, int FixedInputSize, string[] Options, string HelpMessage, bool IsFloridaSusSetting, string DefaultValue) { // Create the settings option struct Variable_Setting_Info newSettingInfo = new Variable_Setting_Info(Key, FixedInputSize, Options, HelpMessage, IsFloridaSusSetting, DefaultValue ); // First, save this in the setting dictionary idToSetting[settingCounter] = newSettingInfo; settingToId[newSettingInfo] = settingCounter; // Does this category already exist? if (!categorizedSettings.ContainsKey(Category)) { List<Setting_Info> settingsList = new List<Setting_Info>(); categorizedSettings[Category] = settingsList; } // Add this to the categorized settings categorizedSettings[Category].Add(newSettingInfo); // Increment in preparation for any next setting settingCounter++; // Add this key as a standard key, so they are left out of the custom settings portion standardSettingKeys.Add(Key); }
private void Add_Setting_UI(string key, int fixed_input_size, string[] options, string help_message, bool is_florida_sus_setting, string default_value) { // Create the settings option struct Variable_Setting_Info newSettingInfo = new Variable_Setting_Info(key, fixed_input_size, options, help_message, is_florida_sus_setting, default_value ); // First, save this in the setting dictionary idToSetting[settingCounter] = newSettingInfo; // Increment in preparation for any next setting settingCounter++; }
/// <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("Settings_AdminViewer.Add_HTML_In_Main_Form", "Write the rest of the form "); // 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_settings_action\" name=\"admin_settings_action\" value=\"\" />"); Output.WriteLine(); Output.WriteLine("<!-- Settings_AdminViewer.Add_HTML_In_Main_Form -->"); Output.WriteLine("<script type=\"text/javascript\" src=\"" + currentMode.Base_URL + "default/scripts/sobekcm_form.js\" ></script>"); 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>"); } // Determine if the Florida SUS settings should be displayed bool show_florida_sus = false; if ((settings.ContainsKey("Show Florida SUS Settings")) && (String.Compare(settings["Show Florida SUS Settings"], "true", true) == 0)) { show_florida_sus = true; } Output.WriteLine(" <blockquote>"); Output.WriteLine(" This form allows a user to view and edit all the main system-wide settings which allow the SobekCM web application and assorted related applications to function correctly within each custom architecture and each institution.<br /><br />"); Output.WriteLine(" For more information about these settings, <a href=\"" + SobekCM_Library_Settings.Help_URL(currentMode.Base_URL) + "admin/settings\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>."); Output.WriteLine(" </blockquote>"); Output.WriteLine(); Output.WriteLine(" <table width=\"100%\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td width=\"300px\" align=\"left\">"); Output.WriteLine(" <span class=\"SobekAdminTitle\">Current System-Wide Settings</span>"); Output.WriteLine(" </td>"); Output.WriteLine(" <td align=\"right\">"); Output.WriteLine(" <a onmousedown=\"window.location.href='" + currentMode.Base_URL + "my/admin'; 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=\"admin_settings_save(); 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(); Output.WriteLine(" <blockquote>"); Output.WriteLine(" <table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\" width=\"100%\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\" height=\"30px\" >"); Output.WriteLine(" <th width=\"230px\" align=\"left\"><span style=\"color: White\"> SETTING KEY</span></th>"); Output.WriteLine(" <th width=\"420px\" align=\"center\"><span style=\"color: White\">SETTING VALUE</span></th>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"2\"></td></tr>"); // Write the data for each interface bool odd_row = true; foreach (int setting_counter in idToSetting.Keys) { // Get the current setting information Setting_Info settingInfo = idToSetting[setting_counter]; // If no Florida SUS-specific settings should be displayed, check to see // if this setting should be skipped if ((show_florida_sus) || (!settingInfo.Is_Florida_SUS_Setting)) { // Also, look for this value in the current settings string setting_value = String.Empty; if (settingInfo.isVariable) { if (settings.ContainsKey(settingInfo.Key)) { setting_value = settings[settingInfo.Key]; } if ((setting_value.Length == 0) && (((Variable_Setting_Info)settingInfo).Default_Value.Length > 0)) { setting_value = ((Variable_Setting_Info)settingInfo).Default_Value; } } else { setting_value = ((Constant_Setting_Info)settingInfo).Value; } // Build the action links Output.WriteLine(odd_row ? " <tr align=\"left\" valign=\"middle\" height=\"30px\" >" : " <tr align=\"left\" valign=\"middle\" height=\"30px\" bgcolor=\"#eeeeee\" >"); Output.WriteLine(" <td><strong>" + settingInfo.Key + ":</strong></td>"); Output.WriteLine(" <td>"); Output.WriteLine(" <table>"); Output.WriteLine(" <tr valign=\"middle\">"); Output.WriteLine(" <td>"); // Is this a variable setting, which the user can change? if (settingInfo.isVariable) { Variable_Setting_Info varSettingInfo = (Variable_Setting_Info)settingInfo; if (varSettingInfo.Options.Length > 0) { Output.WriteLine(" <select id=\"setting" + setting_counter + "\" name=\"setting" + setting_counter + "\" class=\"admin_settings_select\" >"); bool option_found = false; foreach (string thisValue in varSettingInfo.Options) { if (String.Compare(thisValue, setting_value, true) == 0) { option_found = true; Output.WriteLine(" <option selected=\"selected\">" + setting_value + "</option>"); } else { Output.WriteLine(" <option>" + thisValue + "</option>"); } } if (!option_found) { Output.WriteLine(" <option selected=\"selected\">" + setting_value + "</option>"); } Output.WriteLine(" </select>"); } else { if ((varSettingInfo.Fixed_Input_Size > 0) && (varSettingInfo.Fixed_Input_Size < 360)) { Output.WriteLine(" <input id=\"setting" + setting_counter + "\" name=\"setting" + setting_counter + "\" class=\"admin_settings_input\" type=\"text\" style=\"width: " + varSettingInfo.Fixed_Input_Size + "px;\" value=\"" + HttpUtility.HtmlEncode(setting_value) + "\" onfocus=\"javascript:textbox_enter('setting" + setting_counter + "', 'admin_settings_input_focused')\" onblur=\"javascript:textbox_leave('setting" + setting_counter + "', 'admin_settings_input')\" />"); } else { Output.WriteLine(" <input id=\"setting" + setting_counter + "\" name=\"setting" + setting_counter + "\" class=\"admin_settings_input\" type=\"text\" style=\"width: 360px;\" value=\"" + HttpUtility.HtmlEncode(setting_value) + "\" onfocus=\"javascript:textbox_enter('setting" + setting_counter + "', 'admin_settings_input_focused')\" onblur=\"javascript:textbox_leave('setting" + setting_counter + "', 'admin_settings_input')\" />"); } } } else { if (setting_value.Trim().Length == 0) { Output.WriteLine(" <em>( no value )</em>"); } else { Output.WriteLine(" " + HttpUtility.HtmlEncode(setting_value)); } } Output.WriteLine(" </td>"); Output.WriteLine(" <td>"); Output.WriteLine(" <img border=\"0px\" style=\"padding-left:5px; margin-top:3px; cursor:pointer; cursor:hand;\" src=\"" + currentMode.Base_URL + "default/images/help_button.jpg\" onclick=\"alert('" + settingInfo.Help_Message.Replace("'", "").Replace("\\", "\\\\").Replace("\n", "\\n") + "');\" />"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr valign=\"middle\">"); Output.WriteLine(" </table>"); Output.WriteLine(" </td>"); Output.WriteLine(" </tr>"); Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"2\"></td></tr>"); odd_row = !odd_row; } } Output.WriteLine(" </table>"); Output.WriteLine(" </blockquote>"); Output.WriteLine(); Output.WriteLine(" <table width=\"100%\">"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td width=\"300px\" align=\"left\"> </td>"); Output.WriteLine(" <td align=\"right\">"); Output.WriteLine(" <a onmousedown=\"window.location.href='" + currentMode.Base_URL + "my/admin'; 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=\"admin_settings_save(); 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("</div>"); Output.WriteLine(); }