28 namespace Ntp.Analyzer.Render.Host
33 : base(config.WebPath)
37 this.refresh = refresh;
41 private readonly
string ip;
51 var builder =
new StringBuilder();
52 builder.AppendLine(
string.Empty);
54 DateTime now = DateTime.Now;
56 builder.AppendLine(
"<br>");
58 if (config.ShowUtc == DateTimeKind.Utc)
60 builder.Append(
"Time is ");
61 builder.Append(now.ToLongDateString() +
" ");
62 builder.Append(TimeZoneInfo.Utc.StandardName);
66 builder.Append(
"Local time is ");
67 builder.Append(now.ToLongDateString() +
" ");
68 builder.Append(TimeZoneInfo.Local.IsDaylightSavingTime(now)
69 ? TimeZoneInfo.Local.DaylightName
70 : TimeZoneInfo.Local.StandardName);
72 builder.Append(
" " + now.ToShortTimeString() +
". ");
74 builder.AppendLine(
"<br><br>");
75 if (config.PoolMember)
77 string poolLink =
"http://www.pool.ntp.org/scores/" + ip;
78 string poolText = $
@"<a href=""{poolLink}"">pool.ntp.org</a>";
79 builder.Append(
"Server is pool member on ");
80 builder.Append(poolText);
83 if (config.PeerSummaries.Pages.Count() != 0)
85 builder.AppendLine(
"<br><br>");
86 builder.Append(
"Peer graphs are available with ");
87 builder.Append(
@"<a href=""");
88 builder.Append(config.PeerSummaries.Pages.First().Link.ToHtmlString());
89 builder.Append(
@""">");
90 builder.Append(config.PeerSummaries.Pages.First().Title);
91 builder.Append(
@"</a> and ");
92 builder.Append(
@"<a href=""");
93 builder.Append(config.PeerSummaries.Pages.ToList()[1].Link.ToHtmlString());
94 builder.Append(
@""">");
95 builder.Append(config.PeerSummaries.Pages.ToList()[1].Title);
96 builder.Append(
@"</a>.");
99 builder.AppendLine(
"<br><br>");
100 builder.AppendLine(
"Page refreshes every 5 minutes.");
102 builder.AppendLine(
"</body>");
103 builder.AppendLine(
"</html>");
105 return builder.ToString();
110 var builder =
new StringBuilder();
112 builder.AppendLine(
"<!DOCTYPE html>");
113 builder.AppendLine(
"<html><head>");
114 builder.AppendLine(
@"<meta charset=""UTF-8"">");
115 builder.AppendLine(
@"<style type=""text/css"" media=""screen"">");
116 builder.AppendLine(
"body {font-family: monospace; line-height:100%; }");
117 builder.AppendLine(
"table { border-collapse:collapse; border-spacing: 0; width: 940px; }");
119 "th { text-align: left; font-weight: bold; border-bottom: 2px solid; padding: 0px; padding-top: 5px; padding-bottom: 3px;}");
121 "td { padding: 0px; padding-right: 7px; padding-left: 2px; padding-top: 2px; padding-bottom: 2px; }");
122 builder.AppendLine(
"td.aright { text-align: right; padding-right: 17px;}");
123 builder.AppendLine(
"td.spc { padding: 0px; line-height: 5px; }");
124 builder.AppendLine(
"td.but { border-top: 2px solid; padding: 0px; padding-top: 2px; line-height: 7px; }");
125 builder.AppendLine(
"a:link { color:#33348e; text-decoration: none; }");
126 builder.AppendLine(
"a:visited { color:#33348e; text-decoration: none; }");
127 builder.AppendLine(
"a:hover { color:#33348e; text-decoration: underline;; }");
128 builder.AppendLine(
"a:active { color:#7476b4; text-decoration: underline; }");
129 builder.AppendLine(
"</style>");
130 builder.AppendLine(
"<title>");
131 builder.AppendLine(config.ServerName);
132 builder.AppendLine(
"</title>");
133 builder.AppendLine($
@"<meta http-equiv=""refresh"" content=""{refresh}"">");
134 builder.AppendLine(
"</head>");
135 return builder.ToString();
Configuration for a HTML page showing status and graphs for a hosted NTP server.