diff --git a/Common/Enums/PositionType.cs b/Common/Enums/PositionType.cs index ebd85868..ee7d16f1 100644 --- a/Common/Enums/PositionType.cs +++ b/Common/Enums/PositionType.cs @@ -46,7 +46,8 @@ namespace Swarmops.Common.Enums Geographic_ActivismLeader, /* dotreports to Operations */ Geographic_ActivismLeaderAssistant, Geographic_OutreachLeader, /* dotreports to Marketing */ - Geographic_OutreachLeaderAssistant + Geographic_OutreachLeaderAssistant, + Geographic_ExpandingSubleaderNode /* Just a UX element, not a position */ // ReSharper restore InconsistentNaming } } diff --git a/Logic/Resources/Logic.Swarm.Position.Designer.cs b/Logic/Resources/Logic.Swarm.Position.Designer.cs index f351d6d2..dd17caf6 100644 --- a/Logic/Resources/Logic.Swarm.Position.Designer.cs +++ b/Logic/Resources/Logic.Swarm.Position.Designer.cs @@ -456,6 +456,15 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Geographic Subleaders. + /// + internal static string Position_Geographic_ExpandingSubleaderNode { + get { + return ResourceManager.GetString("Position_Geographic_ExpandingSubleaderNode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Information Leader. /// diff --git a/Logic/Resources/Logic.Swarm.Position.resx b/Logic/Resources/Logic.Swarm.Position.resx index 4f3e21f6..3dc05527 100644 --- a/Logic/Resources/Logic.Swarm.Position.resx +++ b/Logic/Resources/Logic.Swarm.Position.resx @@ -249,6 +249,10 @@ Deputies + + Geographic Subleaders + Leaders for geographies below the one displayed + Information Leader diff --git a/Logic/Swarm/DashboardTodos.cs b/Logic/Swarm/DashboardTodos.cs index ca90a087..d8de992c 100644 --- a/Logic/Swarm/DashboardTodos.cs +++ b/Logic/Swarm/DashboardTodos.cs @@ -44,7 +44,7 @@ namespace Swarmops.Logic.Swarm DashboardTodo todo = new DashboardTodo(); todo.Description = Logic_Swarm_DashboardTodos.Bitcoin_SetPayoutAddress; - todo.Icon = "/Images/Icons/bitcoin-icon-16px.png"; + todo.Icon = "/Images/Icons/bitcoin-icon-256px.png"; todo.JavaScript = "alertify.prompt(decodeURIComponent('" + Uri.EscapeDataString ( Logic_Swarm_DashboardTodos.Bitcoin_SetPayoutAddress_Prompt.Replace ( diff --git a/Logic/Swarm/Positions.cs b/Logic/Swarm/Positions.cs index 2d549c35..d7112820 100644 --- a/Logic/Swarm/Positions.cs +++ b/Logic/Swarm/Positions.cs @@ -61,7 +61,12 @@ namespace Swarmops.Logic.Swarm Tree geoTree = geography.Tree; - ForOrganizationGeographyRecurse (geoTree.RootNodes[0], treeResult.RootNodes[0], geographyLeaderTemplate, 2); + Position expandingSubleaderNode = + Position.FromBasic(new BasicPosition(0, PositionLevel.GeographyDefault, organization.Identity, geography.Identity, 0, 0, 0, DateTime.Today, + "Geographic_ExpandingSubleaderNode", "Default", false, true, false, false, false, 0, 0, 0, 0)); // UX element, not real position + TreeNode expandingNode = treeResult.RootNodes[0].AddChild(expandingSubleaderNode); + + ForOrganizationGeographyRecurse (geoTree.RootNodes[0], expandingNode, geographyLeaderTemplate, 2); return treeResult; } diff --git a/Site/App_GlobalResources/Controls.Swarm.designer.cs b/Site/App_GlobalResources/Controls.Swarm.designer.cs index bcdde755..f4c0d765 100644 --- a/Site/App_GlobalResources/Controls.Swarm.designer.cs +++ b/Site/App_GlobalResources/Controls.Swarm.designer.cs @@ -19,7 +19,7 @@ namespace Resources.Controls { // 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 Swarm { @@ -222,6 +222,15 @@ namespace Resources.Controls { } } + /// + /// Looks up a localized string similar to Leaders of subdivisions. + /// + internal static string Positions_Subleaders { + get { + return ResourceManager.GetString("Positions_Subleaders", resourceCulture); + } + } + /// /// Looks up a localized string similar to Do Not Terminate. /// diff --git a/Site/App_GlobalResources/Controls.Swarm.resx b/Site/App_GlobalResources/Controls.Swarm.resx index aa0caa40..67759237 100644 --- a/Site/App_GlobalResources/Controls.Swarm.resx +++ b/Site/App_GlobalResources/Controls.Swarm.resx @@ -193,4 +193,7 @@ Create new position... + + Leaders of subdivisions + \ No newline at end of file diff --git a/Site/Automation/Json-PositionsTree.aspx.cs b/Site/Automation/Json-PositionsTree.aspx.cs index ad62cd60..1e505c08 100644 --- a/Site/Automation/Json-PositionsTree.aspx.cs +++ b/Site/Automation/Json-PositionsTree.aspx.cs @@ -130,6 +130,7 @@ namespace Swarmops.Frontend.Automation nodeState = "closed"; } + string expires = string.Empty; string action = string.Empty; string assignedName = string.Empty; @@ -172,12 +173,35 @@ namespace Swarmops.Frontend.Automation assignments[0].PersonId == CurrentUser.Identity ? "self='true'" : string.Empty); } } + string element = string.Empty; - string element = string.Format("\"id\":\"{0}-1-{8}\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\",\"expires\":\"{3}\",\"minMax\":\"{4} / {5}\",\"iconType\":\"{6}\",\"actions\":\"{7}\"", - position.Identity, JsonSanitize (localizedPositionName), JsonSanitize (assignedName), JsonSanitize (expires), position.MinCount, - position.MaxCount == 0? @"∞" : position.MaxCount.ToString(CultureInfo.InvariantCulture), - position.MaxCount == 1? "Person" : "Group", - action, position.GeographyId); + if (position.Identity > 0) // regular + { + element = + string.Format( + "\"id\":\"{0}-1-{8}\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\",\"expires\":\"{3}\",\"minMax\":\"{4} / {5}\",\"iconType\":\"{6}\",\"actions\":\"{7}\"", + position.Identity, JsonSanitize(localizedPositionName), JsonSanitize(assignedName), + JsonSanitize(expires), position.MinCount, + position.MaxCount == 0 + ? @"∞" + : position.MaxCount.ToString(CultureInfo.InvariantCulture), + position.MaxCount == 1 ? "Person" : "Group", + action, position.GeographyId); + } + else // UX element + { + nodeState = "closed"; + element = + string.Format( + "\"id\":\"{0}-1-{8}\",\"positionTitle\":\"{1}\",\"assignedName\":\"\",\"expires\":\"\",\"minMax\":\"\",\"iconType\":\"{6}\",\"actions\":\"\"", + position.Identity, JsonSanitize(localizedPositionName), JsonSanitize(assignedName), + JsonSanitize(expires), position.MinCount, + position.MaxCount == 0 + ? @"∞" + : position.MaxCount.ToString(CultureInfo.InvariantCulture), + position.MaxCount == 1 ? "Person" : "Group", + action, position.GeographyId); + } // TODO: Add all assignments after the first one right here diff --git a/Site/Controls/v5/Swarm/TreePositions.ascx b/Site/Controls/v5/Swarm/TreePositions.ascx index d55ce461..bced3b2c 100644 --- a/Site/Controls/v5/Swarm/TreePositions.ascx +++ b/Site/Controls/v5/Swarm/TreePositions.ascx @@ -173,7 +173,7 @@ - +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Default" CodeFile="Default.aspx.cs" %> @@ -9,7 +9,7 @@
-
123402500
Current Participants (Testing new code)
+
12342500
Current Participants (Testing new code)
125498
Active Participants Last 30 Days (Testing new code)
@@ -28,10 +28,10 @@
-

Dashboard Placeholder

-

Dashboard is being constructed in preparation for beta release. Lots of code are in testing (visible on the Sandbox).

+

+ -
+
diff --git a/Site/Default.aspx.cs b/Site/Default.aspx.cs index f3990d55..8c2b21e9 100644 --- a/Site/Default.aspx.cs +++ b/Site/Default.aspx.cs @@ -4,6 +4,7 @@ using Swarmops.Logic.Financial; using Swarmops.Logic.Security; using Swarmops.Logic.Support; using Swarmops.Logic.Swarm; +using Swarmops.Logic.Structure; namespace Swarmops.Frontend { @@ -28,6 +29,8 @@ namespace Swarmops.Frontend InfoBoxLiteral = "This is a Dashboard placeholder. It will contain a snapshot of the state of things as soon as the basic functions are re-implemented in the new interface."; + InitializePositionPanel(); + // If Open Ledgers, redirect to Balance Sheet: Don't show Dashboard if (CurrentUser.Identity == Person.OpenLedgersIdentity) @@ -35,5 +38,33 @@ namespace Swarmops.Frontend Response.Redirect ("/Ledgers/BalanceSheet"); } } + + internal void InitializePositionPanel() + { + Geography displayGeography = CurrentUser.Geography; + + if (CurrentAuthority.Position != null && CurrentAuthority.Position.Geography != CurrentUser.Geography) + { + if (CurrentAuthority.Position.Geography == null) + { + displayGeography = Geography.Root; + } + else + { + displayGeography = CurrentAuthority.Position.Geography; + } + } + + if (displayGeography.Identity == Geography.RootIdentity) + { + this.LabelHeaderLocal.Text = Resources.Pages.Swarm.LocalOrganization_HeaderGlobal; + } + else + { + this.LabelHeaderLocal.Text = String.Format(Resources.Pages.Swarm.LocalOrganization_Header, displayGeography.Name); + } + + this.TreePositions.GeographyId = displayGeography.Identity; + } } } \ No newline at end of file diff --git a/Site/Default.aspx.designer.cs b/Site/Default.aspx.designer.cs index ef4fc046..48c3d304 100644 --- a/Site/Default.aspx.designer.cs +++ b/Site/Default.aspx.designer.cs @@ -11,5 +11,23 @@ namespace Swarmops.Frontend { public partial class Default { + + /// + /// LabelHeaderLocal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelHeaderLocal; + + /// + /// TreePositions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Swarmops.Frontend.Controls.Swarm.TreePositions TreePositions; } } diff --git a/Site/Master-v5.master b/Site/Master-v5.master index a7d8938d..11946297 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -246,7 +246,7 @@
diff --git a/Site/Pages/v5/Admin/OrgStaffing.aspx b/Site/Pages/v5/Admin/OrgStaffing.aspx index 59223966..5a246de3 100644 --- a/Site/Pages/v5/Admin/OrgStaffing.aspx +++ b/Site/Pages/v5/Admin/OrgStaffing.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Admin.OrganizationStaffing" Codebehind="OrgStaffing.aspx.cs" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Admin.OrganizationStaffing" CodeFile="OrgStaffing.aspx.cs" %> <%@ Register tagPrefix="Swarmops5" tagName="AjaxTextBox" src="~/Controls/v5/Base/AjaxTextBox.ascx" %> <%@ Register tagPrefix="Swarmops5" tagName="TreePositions" src="~/Controls/v5/Swarm/TreePositions.ascx" %> @@ -20,15 +20,15 @@

- +

- +

- +

diff --git a/Site/Pages/v5/Admin/SystemSettings.aspx b/Site/Pages/v5/Admin/SystemSettings.aspx index de2ffdd4..9eb280e8 100644 --- a/Site/Pages/v5/Admin/SystemSettings.aspx +++ b/Site/Pages/v5/Admin/SystemSettings.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.Admin.SystemSettingsPage" Codebehind="SystemSettings.aspx.cs" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.Admin.SystemSettingsPage" CodeFile="SystemSettings.aspx.cs" %> <%@ Register tagPrefix="Swarmops5" tagName="AjaxTextBox" src="~/Controls/v5/Base/AjaxTextBox.ascx" %> <%@ Register tagPrefix="Swarmops5" tagName="TreePositions" src="~/Controls/v5/Swarm/TreePositions.ascx" %> <%@ Register tagPrefix="Swarmops5" tagName="DropDown" src="~/Controls/v5/Base/DropDown.ascx" %> @@ -118,7 +118,7 @@

- +

diff --git a/Site/Pages/v5/Swarm/LocalOrganization.aspx b/Site/Pages/v5/Swarm/LocalOrganization.aspx index 99782976..92d3659e 100644 --- a/Site/Pages/v5/Swarm/LocalOrganization.aspx +++ b/Site/Pages/v5/Swarm/LocalOrganization.aspx @@ -1,6 +1,4 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Swarm.LocalOrganization" CodeFile="LocalOrganization.aspx.cs" %> -<%@ Register tagPrefix="Swarmops5" tagName="AjaxTextBox" src="~/Controls/v5/Base/AjaxTextBox.ascx" %> -<%@ Register tagPrefix="Swarmops5" tagName="TreePositions" src="~/Controls/v5/Swarm/TreePositions.ascx" %> diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 2ed21ad5..c66ff704 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -50,7 +50,7 @@ function _masterInitializeSocket(authenticationTicket) { } function getMasterSocketAddress() { - if (location.host.includes ("localhost")) { // Assume dev environment, go for sandbox socket + if (location.host.indexOf ("localhost") >= 0) { // Assume dev environment, go for sandbox socket return 'ws://sandbox.swarmops.com/ws/Master'; } else { var protocol = ('https:' == document.location.protocol ? 'wss://' : 'ws://'); diff --git a/Site/Site.csproj b/Site/Site.csproj index c60c2d2c..9be968ce 100644 --- a/Site/Site.csproj +++ b/Site/Site.csproj @@ -724,8 +724,13 @@ + + + + + @@ -737,6 +742,8 @@ + + @@ -804,6 +811,12 @@ + + + + + + @@ -820,6 +833,7 @@ +