/// <summary> /// Builds the web page body for the configuration page. /// The page has separate forms so that only the data in the appropriate form is returned when a button is pressed. /// </summary> private string BuildWebPageBody() { int i = 0; StringBuilder stb = new StringBuilder(); var tabs = new clsJQuery.jqTabs("tab1id", PageName); var tab1 = new clsJQuery.Tab(); tab1.tabTitle = "Settings"; tab1.tabDIVID = Invariant($"tabs{i++}"); tab1.tabContent = BuildSettingTab(); tabs.tabs.Add(tab1); foreach (var deviceDefintion in WUWeatherData.DeviceDefinitions) { var tab = new clsJQuery.Tab(); tab.tabTitle = deviceDefintion.Name; tab.tabDIVID = Invariant($"tabs{i++}"); tab.tabContent = BuildTab(deviceDefintion); tabs.tabs.Add(tab); } tabs.postOnTabClick = false; stb.Append(tabs.Build()); return(stb.ToString()); }
/// <summary> /// Builds the web page body for the configuration page. /// The page has separate forms so that only the data in the appropriate form is returned when a button is pressed. /// </summary> private string BuildDefaultWebPageBody(NameValueCollection parts) { this.UsesJqTabs = true; string tab = parts[TabId] ?? "0"; int defaultTab = 0; int.TryParse(tab, out defaultTab); int i = 0; StringBuilder stb = new StringBuilder(); IncludeDataTableFiles(stb); var tabs = new clsJQuery.jqTabs("tab1id", PageName); var tab1 = new clsJQuery.Tab(); tab1.tabTitle = "DB Settings"; tab1.tabDIVID = Invariant($"tabs{i++}"); tab1.tabContent = BuildDBSettingTab(); tabs.tabs.Add(tab1); var tab2 = new clsJQuery.Tab(); tab2.tabTitle = "Persistence"; tab2.tabDIVID = Invariant($"tabs{i++}"); tab2.tabContent = BuildPersistenceTab(parts); tabs.tabs.Add(tab2); var tab3 = new clsJQuery.Tab(); tab3.tabTitle = "Devices Import"; tab3.tabDIVID = Invariant($"tabs{i++}"); tab3.tabContent = BuildImportDevicesTab(parts); tabs.tabs.Add(tab3); switch (defaultTab) { case 0: tabs.defaultTab = tab1.tabDIVID; break; case 1: tabs.defaultTab = tab2.tabDIVID; break; case 2: tabs.defaultTab = tab3.tabDIVID; break; } tabs.postOnTabClick = false; stb.Append(tabs.Build()); return(stb.ToString()); }
/// <summary> /// Builds the web page body for the configuration page. /// The page has separate forms so that only the data in the appropriate form is returned when a button is pressed. /// </summary> private string BuildWebPageBody() { int i = 0; StringBuilder stb = new StringBuilder(); var tabs = new clsJQuery.jqTabs("tab1id", PageName); var tab1 = new clsJQuery.Tab(); tab1.tabTitle = "Twilio Settings"; tab1.tabDIVID = String.Format(CultureInfo.InvariantCulture, "tabs{0}", i++); tab1.tabContent = BuildSettingTab(); tabs.tabs.Add(tab1); tabs.postOnTabClick = false; stb.Append(tabs.Build()); return(stb.ToString()); }
public string BuildTabs() { var stb = new StringBuilder(); var tabs = new clsJQuery.jqTabs("oTabs", this.PageName); var tab = new clsJQuery.Tab(); tabs.postOnTabClick = true; tab.tabTitle = "Listbox"; tab.tabDIVID = "oTabLB"; tab.tabContent = "<div id='TabLB_div'>" + BuildTabLB() + "</div>"; tabs.tabs.Add(tab); tab = new clsJQuery.Tab(); tab.tabTitle = "Checkbox"; tab.tabDIVID = "oTabCB"; tab.tabContent = "<div id='TabCB_div'>" + BuildTabCB() + "</div>"; tabs.tabs.Add(tab); tab = new clsJQuery.Tab(); tab.tabTitle = "Drop Down"; tab.tabDIVID = "oTabDD"; tab.tabContent = "<div id='TabDD_div'>" + BuildTabDD() + "</div>"; tabs.tabs.Add(tab); tab = new clsJQuery.Tab(); tab.tabTitle = "Slider"; tab.tabDIVID = "oTabSL"; tab.tabContent = "<div id='TabSL_div'>" + BuildTabSL() + "</div>"; tabs.tabs.Add(tab); tab = new clsJQuery.Tab(); tab.tabTitle = "Sliding Tab"; tab.tabDIVID = "oTabST"; tab.tabContent = "<div id='TabST_div'>" + BuildTabST() + "</div>"; tabs.tabs.Add(tab); return(tabs.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_nestsiid/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 = "nestsiid-options"; var optionsString = new StringBuilder(); optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("myform1", "testpage", "post")); optionsString.Append("<table>"); optionsString.Append("<tr><td class='tableheader' colspan='2'>Follow the inputs below to retrieve/reset your API access token</td></tr>"); // Nest API Access Token optionsString.Append("<tr><td class='tableheader' colspan='2'>Nest API Access Token</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Follow the Retrieve Pin-Code link to obtain a pin-code</td>"); optionsString.Append("<td class='tablecell'>"); optionsString = BuildLinkButton(optionsString, "pin_button", "Retrieve Pin-Code", "https://home.nest.com/login/oauth2?client_id=7ba01588-498d-4f20-a524-14c3c8f9134a&state=STATE"); optionsString.Append("</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Copy the Pin-Code into this box</td>"); optionsString.Append("<td class='tablecell'>"); optionsString = BuildTextBox(optionsString, "pin_code", "Pin-Code", "Pin-Code", "", 200); optionsString.Append("</td></tr>"); optionsString.Append("<tr><td class='tablecell'>Hit the Reset button to renew your access token</td>"); optionsString.Append("<td class='tablecell'>"); optionsString = BuildLinkButton(optionsString, "access_button", "Reset Access-Token", ""); optionsString.Append("</td></tr>"); optionsString.Append("</table><br>"); optionsString.Append("<p>If the Reset was successful, restart the plugin and the new token should connect.</p>"); optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd()); tab.tabContent = optionsString.ToString(); jqtabs.tabs.Add(tab); pluginSB.Append(jqtabs.Build()); pluginSB.AppendLine("</td></tr></table>"); } catch (Exception ex) { pluginSB.Append("Status/Options error: " + ex.Message); } pluginSB.Append("<br>"); pluginSB.Append(DivEnd()); page.AddBody(pluginSB.ToString()); return(page.BuildPage()); }
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()); }
/// <summary> /// Builds the web page body for the configuration page. /// The page has separate forms so that only the data in the appropriate form is returned when a button is pressed. /// </summary> private string BuildDefaultWebPageBody(NameValueCollection parts) { UsesJqTabs = true; string tab = parts[TabId] ?? "0"; if (!int.TryParse(tab, out int defaultTab)) { defaultTab = 0; } int i = 0; StringBuilder stb = new StringBuilder(); var tabs = new clsJQuery.jqTabs("tab1id", PageName); var tab1 = new clsJQuery.Tab { tabTitle = "Settings", tabDIVID = Invariant($"tabs{i++}"), tabContent = BuildMainSettingTab() }; tabs.tabs.Add(tab1); var tab2 = new clsJQuery.Tab { tabTitle = "Cameras", tabDIVID = Invariant($"tabs{i++}"), tabContent = BuildCamerasTab() }; tabs.tabs.Add(tab2); var tab3 = new clsJQuery.Tab { tabTitle = "ISAPI Properties", tabDIVID = Invariant($"tabs{i}"), tabContent = BuildHikvsionISAPICamerasPropertiesTab() }; tabs.tabs.Add(tab3); switch (defaultTab) { case 0: tabs.defaultTab = tab1.tabDIVID; break; case 1: tabs.defaultTab = tab2.tabDIVID; break; case 2: tabs.defaultTab = tab3.tabDIVID; break; } tabs.postOnTabClick = false; stb.Append(tabs.Build()); return(stb.ToString()); }