Added more proper beta menu
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Swarmops.Logic.Support
|
||||
public static class Formatting
|
||||
{
|
||||
private static string _swarmopsVersion;
|
||||
private static DateTime? _swarmopsBuildDateTime = null;
|
||||
|
||||
public static string SwarmopsVersion
|
||||
{
|
||||
@@ -73,6 +74,62 @@ namespace Swarmops.Logic.Support
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime SwarmopsBuildTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_swarmopsBuildDateTime != null)
|
||||
{
|
||||
return (DateTime) _swarmopsBuildDateTime;
|
||||
}
|
||||
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
_swarmopsBuildDateTime = DateTime.Now;
|
||||
GuidCache.Set("_swarmopsBuildDateTime", _swarmopsBuildDateTime);
|
||||
return (DateTime) _swarmopsBuildDateTime;
|
||||
}
|
||||
|
||||
// if we still don't have it, check the cache and possibly return
|
||||
|
||||
_swarmopsBuildDateTime = (DateTime?) GuidCache.Get("_swarmopsBuildDateTime");
|
||||
|
||||
if (_swarmopsBuildDateTime != null)
|
||||
{
|
||||
return (DateTime) _swarmopsBuildDateTime;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (HttpContext.Current != null) // frontend: use friendly format
|
||||
{
|
||||
using (
|
||||
StreamReader reader =
|
||||
File.OpenText(HttpContext.Current.Request.MapPath("~/BuildDateTime.txt")))
|
||||
{
|
||||
_swarmopsBuildDateTime = DateTime.Parse(reader.ReadLine());
|
||||
}
|
||||
}
|
||||
else // backend: use build ID only
|
||||
{
|
||||
using (
|
||||
StreamReader reader =
|
||||
File.OpenText("/usr/share/swarmops/backend/BuildDateTime.txt"))
|
||||
{
|
||||
_swarmopsBuildDateTime = DateTime.Parse(reader.ReadLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_swarmopsBuildDateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
GuidCache.Set("_swarmopsBuildDateTime", _swarmopsBuildDateTime);
|
||||
return (DateTime) _swarmopsBuildDateTime;
|
||||
}
|
||||
}
|
||||
|
||||
public static string CleanNumber (string input)
|
||||
{
|
||||
return LogicServices.CleanNumber (input);
|
||||
|
||||
+28
-1
@@ -19,7 +19,7 @@ namespace Resources {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option or rebuild the Visual Studio project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "11.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "14.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Menu5 {
|
||||
@@ -132,6 +132,33 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Built on {0:MMM d, yyyy}.
|
||||
/// </summary>
|
||||
internal static string Menu5_Beta_BuildTime {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu5_Beta_BuildTime", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0:N0} lines of code.
|
||||
/// </summary>
|
||||
internal static string Menu5_Beta_LinesOfCode {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu5_Beta_LinesOfCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Report a Swarmops Bug (on Github).
|
||||
/// </summary>
|
||||
internal static string Menu5_Beta_ReportBug {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu5_Beta_ReportBug", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Communications.
|
||||
/// </summary>
|
||||
|
||||
@@ -423,4 +423,14 @@
|
||||
<data name="Menu5_Ledgers_BitcoinHotwallet" xml:space="preserve">
|
||||
<value>Bitcoin Hotwallet</value>
|
||||
</data>
|
||||
<data name="Menu5_Beta_BuildTime" xml:space="preserve">
|
||||
<value>Built on {0:MMM d, yyyy}</value>
|
||||
<comment>Change date format as appropriate for language (here it's "Jan 21, 1972")</comment>
|
||||
</data>
|
||||
<data name="Menu5_Beta_LinesOfCode" xml:space="preserve">
|
||||
<value>{0:N0} lines of code</value>
|
||||
</data>
|
||||
<data name="Menu5_Beta_ReportBug" xml:space="preserve">
|
||||
<value>Report a Swarmops Bug (on Github)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -6,6 +6,7 @@ using System.Web.UI;
|
||||
using System.Xml.Serialization;
|
||||
using Swarmops.Frontend;
|
||||
using Swarmops.Interface.Objects;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
|
||||
@@ -52,7 +53,20 @@ namespace Swarmops.Controls.Base
|
||||
protected override void Render (HtmlTextWriter output)
|
||||
{
|
||||
output.Write ("<ul id='MainMenuContainer' class='sf-menu'>");
|
||||
output.Write(("<li class='Submenu' id='LiSwarmopsLogo'><div id='DivSwarmopsLogo'></div></li>")); // Swarmops logo
|
||||
|
||||
// Hard coded beta menu with build statistics, bug reporting option
|
||||
|
||||
output.Write(("<li class='Submenu' id='LiSwarmopsLogo'><div id='DivSwarmopsLogo'></div><ul>")); // Swarmops logo
|
||||
output.Write("<li class='BuildNumber' dir='ltr'><a href='#builddata'><img src='/Images/PageIcons/swarmops-builder-40px.png' height='20' width='20' />" + Formatting.SwarmopsVersion + "</a></li>");
|
||||
output.Write(
|
||||
"<li class='Disabled' dir='ltr'><a href='#builddata'><img src='/Images/PageIcons/transparency-16px.png' height='20' width='20' />" +
|
||||
String.Format(Resources.Menu5.Menu5_Beta_BuildTime, Formatting.SwarmopsBuildTime) + "</a></li>");
|
||||
output.Write("<li class='Disabled' dir='ltr'><a href='#builddata'><img src='/Images/PageIcons/transparency-16px.png' height='20' width='20' />" + String.Format(Resources.Menu5.Menu5_Beta_LinesOfCode, @"<!--KaylockCount-->140,936<!--EndKaylock-->") + "</a></li>");
|
||||
output.Write("<li class='Separator'> <hr/></li>");
|
||||
output.Write("<li class='Link'><a target='_blank' href='https://github.com/Swarmops/Swarmops/issues/new'><img src='/Images/Icons/iconshock-warning-24px.png' height='20' width='20' />" + Resources.Menu5.Menu5_Beta_ReportBug + "</a></li>");
|
||||
output.Write("</ul></li>"); // End of beta menu
|
||||
|
||||
|
||||
foreach (MainMenuItem menuItem in MainMenuData)
|
||||
{
|
||||
WriteMenuItem (menuItem, output);
|
||||
|
||||
@@ -197,7 +197,7 @@ body.rtl .topSearchBox input {
|
||||
|
||||
|
||||
#MainMenuContainer {
|
||||
margin-left: -80px !important;
|
||||
margin-left: -75px !important;
|
||||
}
|
||||
|
||||
#MainMenuContainer #LiSwarmopsLogo {
|
||||
|
||||
Reference in New Issue
Block a user