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()); }
/// <summary> /// Get the web page string for the configuration page. /// </summary> /// <returns> /// System.String. /// </returns> public string GetWebPage(string queryString) { try { NameValueCollection parts = HttpUtility.ParseQueryString(queryString); string pageType = parts[PageTypeId]; reset(); System.Text.StringBuilder stb = new System.Text.StringBuilder(); stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(DivStart("pluginpage", string.Empty)); switch (pageType) { case EditDevicePageType: pluginConfig.Devices.TryGetValue(parts[DeviceIdId], out var device); stb.Append(BuildAddNewWebPageBody(device)); break; case MainPageType: case null: default: stb.Append(BuildMainWebPageBody()); break; } stb.Append(DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); suppressDefaultFooter = true; return(BuildPage()); } catch (Exception) { return("error"); } }
/// <summary> /// Get the web page string for the configuration page. /// </summary> /// <returns> /// System.String. /// </returns> public string GetWebPage() { try { reset(); AddHeader(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); System.Text.StringBuilder stb = new System.Text.StringBuilder(); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", "")); stb.Append(BuildWebPageBody()); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); suppressDefaultFooter = true; return(BuildPage()); } catch (Exception) { return("error"); } }
/// <summary> /// Get the web page string for the configuration page. /// </summary> /// <returns> /// System.String. /// </returns> public string GetWebPage(string queryString) { try { reset(); this.UsesJqAll = false; NameValueCollection parts = HttpUtility.ParseQueryString(queryString); string pageType = parts[PageTypeId]; StringBuilder stb = new StringBuilder(); switch (pageType) { case EditDevicePageType: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); pluginConfig.DevicePersistenceData.TryGetValue(parts[RecordId], out var data); stb.Append(BuildAddNewPersistenceWebPageBody(data)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); } break; case EditDeviceImportPageType: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); pluginConfig.ImportDevicesData.TryGetValue(parts[RecordId], out var data); stb.Append(BuildAddNewDeviceImportWebPageBody(data)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); } break; case DeviceDataTablePageType: { string pageDivId = "tablepage"; CreatePageWithAjaxLoad(parts, stb, pageDivId, BuildTablePage); } break; case DeviceChartTablePageType: { string pageDivId = "chartPage"; CreatePageWithAjaxLoad(parts, stb, pageDivId, BuildChartsPage); } break; case DeviceStatsPageType: { string pageDivId = "statspage"; CreatePageWithAjaxLoad(parts, stb, pageDivId, BuildStatsPage); } break; case HistoryDevicePageType: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); if (pluginConfig.DevicePersistenceData.TryGetValue(parts[RecordId], out var data)) { stb.Append(BuildHistoryPage(parts, data)); } else { stb.Append(BuildDefaultWebPageBody(parts)); } stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); } break; default: case null: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); stb.Append(BuildDefaultWebPageBody(parts)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); break; } } suppressDefaultFooter = true; return(BuildPage()); } catch (Exception) { return("error"); } }
protected string GetWebPage(PageType pageType, NameValueCollection parts) { StringBuilder stb = new StringBuilder(); switch (pageType) { case PageType.EditHikvisionIsapiCamera: case PageType.AddHikvisionIsapiCamera: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); pluginConfig.HikvisionIsapiCameras.TryGetValue(parts[RecordId], out var camera); stb.Append(BuildAddNewHikvisionIsapiCameraWebPageBody(camera)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); break; } case PageType.AddOnvifCamera: case PageType.EditOnvifCamera: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); pluginConfig.OnvifCameras.TryGetValue(parts[RecordId], out var camera); stb.Append(BuildAddNewOnvifCameraWebPageBody(camera)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); break; } case PageType.EditHikvisionIsapiCameraProperty: case PageType.AddHikvisionIsapiCameraProperty: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); pluginConfig.HikvisionIsapiCameraProperties.TryGetValue(parts[RecordId], out var cameraProperty); stb.Append(BuildAddNewCameraPropertyWebPageBody(cameraProperty)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); break; } default: case PageType.Default: { stb.Append(HS.GetPageHeader(Name, "Configuration", string.Empty, string.Empty, false, false)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivStart("pluginpage", string.Empty)); stb.Append(BuildDefaultWebPageBody(parts)); stb.Append(PageBuilderAndMenu.clsPageBuilder.DivEnd()); AddBody(stb.ToString()); AddFooter(HS.GetPageFooter()); break; } } suppressDefaultFooter = true; return(BuildPage()); }