public string BuildTextBox(string name, bool rebuilding = false, string text = "") { var textBox = new clsJQuery.jqTextBox(name, "", text, this.PageName, 20, false); var ret = ""; textBox.id = "o" + name; //If it's a location textbox, we want it to be "filled! with the current setting switch (name) { case "TextboxLocation": textBox.defaultText = _settings.Location; break; case "TextboxLocation2": textBox.defaultText = _settings.Location2; break; } if (rebuilding) { ret = textBox.Build(); this.divToUpdate.Add(name + "_div", ret); } else { ret = "<div style='float: left;' id='" + name + "_div'>" + textBox.Build() + "</div>"; } return(ret); }
private string SetUserName() { var userNameTextBox = new clsJQuery.jqTextBox(UserNameKey, "text", "", _pageName, 40, false); userNameTextBox.defaultText = _iniSettings.UserNameMelCloud; return(userNameTextBox.Build()); }
private string SetPassword() { var passwordTextBox = new clsJQuery.jqTextBox(PasswordKey, "text", "", _pageName, 40, false); passwordTextBox.defaultText = _iniSettings.PasswordMelCloud; return(passwordTextBox.Build()); }
private string BuildTextbox(string name) { var tb = new clsJQuery.jqTextBox(name, "", "", this.PageName, 20, true); tb.id = "o" + name; tb.editable = true; return(tb.Build()); }
private string CreateJqTextBox(string parameter, string defaultText, DataCurveTriggerBSettings triggerSettings, int defaultsize = 10) { var textBox = new clsJQuery.jqTextBox( parameter + triggerSettings.UID + triggerSettings.UniqueControllerId, "text", defaultText, Constants.EventsPage, defaultsize, true); textBox.left = 1; return(textBox.Build()); }
// Builds input textboxs for client-id, client-secret, pin-code, access-token private StringBuilder BuildTextBox(StringBuilder optionsString, string name, string prompt, string tooltip, string initial, int width) { clsJQuery.jqTextBox tokenTextBox = new clsJQuery.jqTextBox(name, "text", initial, this.PageName, 30, true); tokenTextBox.promptText = prompt; tokenTextBox.toolTip = tooltip; tokenTextBox.dialogWidth = width; optionsString.Append(tokenTextBox.Build()); return(optionsString); }
// Builds input textboxs for client-id, client-secret, pin-code, access-token private StringBuilder BuildTextBox(StringBuilder pluginSB, string name, string prompt, string tooltip, string initial, int width) { clsJQuery.jqTextBox tokenTextBox = new clsJQuery.jqTextBox(name, "text", initial, this.PageName, 20, false); tokenTextBox.promptText = prompt; tokenTextBox.toolTip = tooltip; tokenTextBox.dialogWidth = width; pluginSB.Append(tokenTextBox.Build()); return(pluginSB); }
public override string GetPagePlugin(string page, string user, int userRights, string queryString) { HS.WriteLog("Debug", "Requested page name " + page + " by user " + user + " with rights " + userRights); if (page != "WebSocketNotificationConfig") { return("Unknown page " + page); } PageBuilderAndMenu.clsPageBuilder pageBuilder = new PageBuilderAndMenu.clsPageBuilder(page); if ((userRights & 2) != 2) { // User is not an admin pageBuilder.reset(); pageBuilder.AddHeader(HS.GetPageHeader(page, "WebHook Notifications Settings", "", "", false, true)); pageBuilder.AddBody("<p><strong>Access Denied:</strong> You are not an administrative user.</p>"); pageBuilder.AddFooter(HS.GetPageFooter()); pageBuilder.suppressDefaultFooter = true; return(pageBuilder.BuildPage()); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append( PageBuilderAndMenu.clsPageBuilder.FormStart("wsn_config_form", "wsn_config_form", "post")); stringBuilder.Append( "<table width=\"1000px\" cellspacing=\"0\"><tr><td class=\"tableheader\" colspan=\"3\">Settings</td></tr>"); stringBuilder.Append( "<tr><td class=\"tablecell\" style=\"width:200px\" align=\"left\">WebSocket Port:</td>"); stringBuilder.Append("<td class=\"tablecell\">"); clsJQuery.jqTextBox textBox = new clsJQuery.jqTextBox("WebSocketPort", "text", _port, page, 100, true); stringBuilder.Append(textBox.Build()); stringBuilder.Append("</td></tr>"); stringBuilder.Append("</table>"); clsJQuery.jqButton doneBtn = new clsJQuery.jqButton("DoneBtn", "Done", page, false); doneBtn.url = "/"; stringBuilder.Append("<br />"); stringBuilder.Append(doneBtn.Build()); stringBuilder.Append("<br /><br />"); pageBuilder.reset(); pageBuilder.AddHeader(HS.GetPageHeader(page, "WebSocket Notifications Settings", "", "", false, true)); pageBuilder.AddBody(stringBuilder.ToString()); pageBuilder.AddFooter(HS.GetPageFooter()); pageBuilder.suppressDefaultFooter = true; return(pageBuilder.BuildPage()); }
private string CreateJqTextBox(string parameter, string defaultText, DataCurveTriggerSettings triggerSettings, int defaultsize = 10) { var textBox = new clsJQuery.jqTextBox( parameter + triggerSettings.UID + triggerSettings.UniqueControllerId, "text", defaultText, Constants.EventsPage, defaultsize, true); if (triggerSettings.FutureThresholdValue.HasValue) { textBox.defaultText = triggerSettings.FutureThresholdValue.Value.ToString(CultureInfo.CreateSpecificCulture("en-US")); } return(textBox.Build()); }
protected string FormTextBox(string name, string label, [AllowNull] string defaultText, int size = 50, string type = "text", bool autoSubmit = true) { var b = new clsJQuery.jqTextBox(name, type, defaultText ?? string.Empty, PageName, size, autoSubmit) { id = NameToIdWithPrefix(name), label = label }; return(b.Build()); }
private string SetDaysOfStorage() { var textBoxDaysOfDataStorage = new clsJQuery.jqTextBox(DaysOfDataStorageKey, "text", "", _pageName, 5, false); var currentDaysOfDataStorage = _iniSettings.DaysOfDataStorage; if (currentDaysOfDataStorage > 0) { textBoxDaysOfDataStorage.defaultText = currentDaysOfDataStorage.ToString(); } return(textBoxDaysOfDataStorage.Build()); }
public string GetPagePlugin(string pageName, string user, int userRights, string queryString) { StringBuilder pluginSB = new StringBuilder(); OptionsPage page = this; try { page.reset(); // handle queries with special data /*System.Collections.Specialized.NameValueCollection parts = null; * if ((!string.IsNullOrEmpty(queryString))) * { * parts = HttpUtility.ParseQueryString(queryString); * } * if (parts != null) * { * if (parts["myslide1"] == "myslide_name_open") * { * // handle a get for tab content * string name = parts["name"]; * return ("<table><tr><td>cell1</td><td>cell2</td></tr><tr><td>cell row 2</td><td>cell 2 row 2</td></tr></table>"); * //Return ("<div><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br></div>") * } * if (parts["myslide1"] == "myslide_name_close") * { * return ""; * } * }*/ this.AddHeader(Util.hs.GetPageHeader(pageName, Util.IFACE_NAME, "", "", false, true)); //pluginSB.Append("<link rel = 'stylesheet' href = 'hspi_rachiosiid/css/style.css' type = 'text/css' /><br>"); //page.AddHeader(pluginSB.ToString()); //page.RefreshIntervalMilliSeconds = 5000 // handler for our status div //stb.Append(page.AddAjaxHandler("/devicestatus?ref=3576", "stat")) pluginSB.Append(this.AddAjaxHandlerPost("action=updatetime", this.PageName)); // page body starts here pluginSB.Append(clsPageBuilder.DivStart("pluginpage", "")); //Dim dv As DeviceClass = GetDeviceByRef(3576) //Dim CS As CAPIStatus //CS = dv.GetStatus pluginSB.AppendLine("<table class='full_width_table' cellspacing='0' width='100%' >"); pluginSB.AppendLine("<tr><td colspan='1' >"); // Status/Options Tabs clsJQuery.jqTabs jqtabs = new clsJQuery.jqTabs("optionsTab", this.PageName); // Options Tab clsJQuery.Tab tab = new clsJQuery.Tab(); tab = new clsJQuery.Tab(); tab.tabTitle = "Options"; tab.tabDIVID = "rachiosiid-options"; var optionsString = new StringBuilder(); optionsString.Append("<table cellspacing='0' cellpadding='5' width='100%'>"); // Rachio API Access Token optionsString.Append("<tr><td class='tableheader' colspan='2'>Rachio API Access Token</td></tr>"); optionsString.Append("<tr><td class='tablecell'>API Access Token</td>"); optionsString.Append("<td class='tablecell'>"); optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("myform1", "testpage", "post")); clsJQuery.jqTextBox tokenTextBox = new clsJQuery.jqTextBox("APIToken", "text", apiKey, this.PageName, 30, true); tokenTextBox.promptText = "Enter your Rachio API access token."; tokenTextBox.toolTip = "Access Token"; tokenTextBox.dialogWidth = 600; optionsString.Append(tokenTextBox.Build()); clsJQuery.jqOverlay ol = new clsJQuery.jqOverlay("ov1", this.PageName, false, "events_overlay"); ol.toolTip = "Help with API Access Token"; ol.label = "Help?"; clsJQuery.jqButton apiBut = new clsJQuery.jqButton("apilink", "Rachio-API", this.PageName, true); apiBut.url = "https://app.rach.io/"; ol.overlayHTML = PageBuilderAndMenu.clsPageBuilder.FormStart("overlayformm", "testpage", "post"); ol.overlayHTML += "<div>If you don't have an<br>access token saved, follow<br>the button link below to<br>navigate to the Rachio API.<br>Sign in and copy the <br>API Access Token within<br> the settings menu on the<br>top-right of the page.<br><br>" + apiBut.Build() + "</div>"; ol.overlayHTML += PageBuilderAndMenu.clsPageBuilder.FormEnd(); optionsString.Append(ol.Build()); optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd()); optionsString.Append("</td></tr>"); // Rachio Options optionsString.Append("<tr><td class='tableheader' colspan='2'>Rachio Options</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Unit Type</td>"); optionsString.Append("<td class='tablecell'>"); clsJQuery.jqDropList dl = new clsJQuery.jqDropList("unitType", this.PageName, false); dl.toolTip = "Select your preferred units."; if (unitType == null || unitType.Equals("US")) { dl.AddItem("U.S. customary units (miles, °F, etc...)", "1", true); dl.AddItem("Metric system units (kms, °C, etc...)", "2", false); } else { dl.AddItem("U.S. customary units (miles, °F, etc...)", "1", false); dl.AddItem("Metric system units (kms, °C, etc...)", "2", true); } dl.autoPostBack = true; optionsString.Append(dl.Build()); clsJQuery.jqDropList dl2 = new clsJQuery.jqDropList("updateInterval", this.PageName, false); optionsString.Append("</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Update Frequency</td>"); optionsString.Append("<td class='tablecell'>"); dl2.toolTip = "Specify how often RachioSIID receives updates from the Rachio API servers."; for (int i = 1; i < 61; i++) { dl2.AddItem(i.ToString() + " Minute(s)", i.ToString(), updateInterval == i); } dl2.autoPostBack = true; optionsString.Append(dl2.Build()); optionsString.Append("</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Zones View</td>"); optionsString.Append("<td class='tablecell'>"); optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("myform2", "testpage", "post")); clsJQuery.jqOverlay ol2 = new clsJQuery.jqOverlay("ov2", this.PageName, false, "events_overlay"); ol2.toolTip = "Specify which Zone devices are in view"; ol2.label = "Zones"; ol2.overlayHTML = PageBuilderAndMenu.clsPageBuilder.FormStart("overlayformm", "testpage", "post"); ol2.overlayHTML += "<div>Select which Zones are visible:<br><br>"; for (int i = 1; i < 17; i++) { clsJQuery.jqCheckBox zoneCheck = new clsJQuery.jqCheckBox("ZoneCheck" + i, "Zone " + i, this.PageName, true, false); if (ZoneChecks != null) { zoneCheck.@checked = ZoneChecks[i - 1]; } else { zoneCheck.@checked = true; } zoneCheck.enabled = true; ol2.overlayHTML += zoneCheck.Build() + "<br>"; } ol2.overlayHTML += "</div>"; ol2.overlayHTML += PageBuilderAndMenu.clsPageBuilder.FormEnd(); optionsString.Append(ol2.Build()); optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd()); optionsString.Append("</td></tr>"); // Homeseer Device Options /*optionsString.Append("<tr><td class='header' colspan='2'>Homeseer Device Options</td></tr>"); * * optionsString.Append("<tr><td>Forecast Days</td>"); * optionsString.Append("<td>"); * dl.toolTip = "Specify the number of days to create weather forecast devices."; * * * dl.AddItem("Disabled", "1", false); * dl.AddItem("Today's Forecast", "2", true); * dl.AddItem("Today's and Tomorrow's Forecast", "3", false); * for (int i = 4; i < 9; i++) * { * dl.AddItem((i-2).ToString() + " Day Forecast", i.ToString(), false); * } * * dl.autoPostBack = true; * optionsString.Append(dl.Build()); * dl.ClearItems(); * optionsString.Append("</td></tr>"); * * optionsString.Append("<tr><td>Device Image</td>"); * optionsString.Append("<td>"); * dl.toolTip = "Select your preferred units."; * dl.AddItem("Yes", "1", true); * dl.AddItem("No", "2", false); * dl.autoPostBack = true; * optionsString.Append(dl.Build()); * dl.ClearItems(); * optionsString.Append("</td></tr>");*/ // Web Page Access /*optionsString.Append("<tr><td class='header' colspan='2'>Web Page Access</td></tr>"); * * optionsString.Append("<tr><td>Forecast Days</td>"); * optionsString.Append("<td>"); * optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("FormCheckbox", "userroles", "post")); * * clsJQuery.jqCheckBox guestCheck = new clsJQuery.jqCheckBox("guestCheck", "Guest", this.PageName, true, false); * guestCheck.@checked = false; * optionsString.Append(guestCheck.Build()); * * clsJQuery.jqCheckBox adminCheck = new clsJQuery.jqCheckBox("adminCheck", "Admin", this.PageName, true, false); * adminCheck.@checked = true; * adminCheck.enabled = false; * optionsString.Append(adminCheck.Build()); * * clsJQuery.jqCheckBox normalCheck = new clsJQuery.jqCheckBox("normalCheck", "Normal", this.PageName, true, false); * normalCheck.@checked = false; * optionsString.Append(normalCheck.Build()); * * clsJQuery.jqCheckBox localCheck = new clsJQuery.jqCheckBox("localCheck", "Local", this.PageName, true, false); * localCheck.@checked = false; * optionsString.Append(localCheck.Build()); * * optionsString.Append("</td></tr>");*/ // Applications Options optionsString.Append("<tr><td class='tableheader' colspan='2'>Applications Options</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Logging Level</td>"); optionsString.Append("<td class='tablecell'>"); clsJQuery.jqDropList dl3 = new clsJQuery.jqDropList("loggingType", this.PageName, false); dl3.toolTip = "Specifiy the plugin logging level"; if (loggingType == "Off") { dl3.AddItem("Off", "1", true); dl3.AddItem("Debug", "2", false); } else { dl3.AddItem("Off", "1", false); dl3.AddItem("Debug", "2", true); } /*var logLevel = new string[10] {"", "Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "", "Trace", "Debug"}; * for (int i = 1; i < 10; i++) * { * if(i==7) * dl.AddItem("Informational", i.ToString(), true); * else * dl.AddItem(logLevel[i], i.ToString(), false); * }*/ dl3.autoPostBack = true; optionsString.Append(dl3.Build()); optionsString.Append("</td></tr>"); optionsString.Append("</table>"); tab.tabContent = optionsString.ToString(); jqtabs.tabs.Add(tab); pluginSB.Append(jqtabs.Build()); pluginSB.AppendLine("</td></tr></table>"); // container test //Dim statCont As New clsJQuery.jqContainer("contid", "Office Lamp", "/homeseer/on.gif", 100, 100, "this is the content") //stb.Append(statCont.build) } catch (Exception ex) { pluginSB.Append("Status/Options error: " + ex.Message); } pluginSB.Append("<br>"); pluginSB.Append(DivEnd()); page.AddBody(pluginSB.ToString()); return(page.BuildPage()); }
public override string GetPagePlugin(string pageName, string user, int userRights, string queryString) { Program.WriteLog(LogType.Debug, "Requested page name " + pageName + " by user " + user + " with rights " + userRights); if (pageName != "WebHookNotificationConfig") { return("Unknown page " + pageName); } PageBuilderAndMenu.clsPageBuilder pageBuilder = new PageBuilderAndMenu.clsPageBuilder(pageName); if ((userRights & 2) != 2) { // User is not an admin pageBuilder.reset(); pageBuilder.AddHeader(hs.GetPageHeader(pageName, "WebHook Notifications Settings", "", "", false, true)); pageBuilder.AddBody("<p><strong>Access Denied:</strong> You are not an administrative user.</p>"); pageBuilder.AddFooter(hs.GetPageFooter()); pageBuilder.suppressDefaultFooter = true; return(pageBuilder.BuildPage()); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append( PageBuilderAndMenu.clsPageBuilder.FormStart("whn_config_form", "whn_config_form", "post")); stringBuilder.Append( "<table width=\"1000px\" cellspacing=\"0\"><tr><td class=\"tableheader\" colspan=\"3\">Settings</td></tr>"); clsJQuery.jqCheckBox checkBox; for (byte i = 1; i <= TOTAL_WEBHOOK_SLOTS; i++) { stringBuilder.Append( "<tr><td class=\"tablecell\" style=\"width:200px\" align=\"left\">WebHook URL " + i + ":</td>"); stringBuilder.Append("<td class=\"tablecell\">"); clsJQuery.jqTextBox textBox = new clsJQuery.jqTextBox("WebHookUrl" + i, "text", webHooks[i - 1]?.ToString(), pageName, 100, true); stringBuilder.Append(textBox.Build()); stringBuilder.Append("</td><td class=\"tablecell\" style=\"width:300px\">"); checkBox = new clsJQuery.jqCheckBox("IgnoreInvalidCertificate" + i, "Ignore invalid HTTPS certificate", pageName, true, true); checkBox.@checked = hs.GetINISetting("IgnoreCertificate", "webhook" + i, "0", IniFilename) == "1"; stringBuilder.Append(checkBox.Build()); stringBuilder.Append("</td></tr>"); } stringBuilder.Append("<tr><td class=\"tablecell\" style=\"width:200px\" align=\"left\"></td>"); stringBuilder.Append("<td class=\"tablecell\" colspan=\"2\">"); checkBox = new clsJQuery.jqCheckBox( "IgnoreTimerEvents", "Suppress WebHooks for HS3 timers", pageName, true, true ); checkBox.@checked = ignoreTimerEvents; stringBuilder.Append(checkBox.Build()); stringBuilder.Append("</td></tr>"); stringBuilder.Append("<tr><td class=\"tablecell\" style=\"width:250px\" align=\"left\"></td>"); stringBuilder.Append("<td class=\"tablecell\" colspan=\"2\">"); checkBox = new clsJQuery.jqCheckBox( "IgnoreUnchangedEvents", "Suppress WebHooks for events in which a device's value did not change (not effective on STRING_CHANGE events)", pageName, true, true ); checkBox.@checked = ignoreUnchangedEvents; stringBuilder.Append(checkBox.Build()); stringBuilder.Append("</td></tr>"); stringBuilder.Append("</table>"); clsJQuery.jqButton doneBtn = new clsJQuery.jqButton("DoneBtn", "Done", pageName, false); doneBtn.url = "/"; stringBuilder.Append("<br />"); stringBuilder.Append(doneBtn.Build()); stringBuilder.Append("<br /><br />"); pageBuilder.reset(); pageBuilder.AddHeader(hs.GetPageHeader(pageName, "WebHook Notifications Settings", "", "", false, true)); pageBuilder.AddBody(stringBuilder.ToString()); pageBuilder.AddFooter(hs.GetPageFooter()); pageBuilder.suppressDefaultFooter = true; return(pageBuilder.BuildPage()); }