Work on Dashboard and Positions

This commit is contained in:
Rick Falkvinge
2017-01-14 03:39:05 +01:00
parent bb81cc369b
commit d345b1ba7b
19 changed files with 153 additions and 25 deletions
+2 -1
View File
@@ -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
}
}
+9
View File
@@ -456,6 +456,15 @@ namespace Swarmops.Logic.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Geographic Subleaders.
/// </summary>
internal static string Position_Geographic_ExpandingSubleaderNode {
get {
return ResourceManager.GetString("Position_Geographic_ExpandingSubleaderNode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Information Leader.
/// </summary>
@@ -249,6 +249,10 @@
<data name="Position_Geographic_Deputy_Plural" xml:space="preserve">
<value>Deputies</value>
</data>
<data name="Position_Geographic_ExpandingSubleaderNode" xml:space="preserve">
<value>Geographic Subleaders</value>
<comment>Leaders for geographies below the one displayed</comment>
</data>
<data name="Position_Geographic_InfoLeader" xml:space="preserve">
<value>Information Leader</value>
</data>
+1 -1
View File
@@ -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 (
+6 -1
View File
@@ -61,7 +61,12 @@ namespace Swarmops.Logic.Swarm
Tree<Geography> 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<Position> expandingNode = treeResult.RootNodes[0].AddChild(expandingSubleaderNode);
ForOrganizationGeographyRecurse (geoTree.RootNodes[0], expandingNode, geographyLeaderTemplate, 2);
return treeResult;
}
+10 -1
View File
@@ -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 {
}
}
/// <summary>
/// Looks up a localized string similar to Leaders of subdivisions.
/// </summary>
internal static string Positions_Subleaders {
get {
return ResourceManager.GetString("Positions_Subleaders", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Do Not Terminate.
/// </summary>
@@ -193,4 +193,7 @@
<data name="Positions_CreatePosition" xml:space="preserve">
<value>Create new position...</value>
</data>
<data name="Positions_Subleaders" xml:space="preserve">
<value>Leaders of subdivisions</value>
</data>
</root>
+29 -5
View File
@@ -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? @"&infin;" : 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
? @"&infin;"
: 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
? @"&infin;"
: position.MaxCount.ToString(CultureInfo.InvariantCulture),
position.MaxCount == 1 ? "Person" : "Group",
action, position.GeographyId);
}
// TODO: Add all assignments after the first one right here
+1 -1
View File
@@ -173,7 +173,7 @@
</script>
<table id="<%=this.ClientID %>_tablePositions" title="" class="easyui-treegrid" style="width:680px;height:600px"
<table id="<%=this.ClientID %>_tablePositions" title="" class="easyui-treegrid" style="width:680px<%=this.HeightField%>"
url="/Automation/Json-PositionsTree.aspx?Level=<%=this.Level%>&GeographyId=<%=this.GeographyId %>&Cookie=<%=this.Cookie %>"
rownumbers="false"
animate="true"
@@ -61,6 +61,18 @@ namespace Swarmops.Frontend.Controls.Swarm
public int GeographyId { get; set; }
public string Cookie { get; set; }
public int Height { get; set; }
protected string HeightField
{
get
{
if (Height == 0)
{
return string.Empty;
}
return String.Format(";height={0}px", Height);
}
}
}
}
+5 -5
View File
@@ -1,4 +1,4 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Default" Codebehind="Default.aspx.cs" %>
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Default" CodeFile="Default.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<!-- Odometer -->
@@ -9,7 +9,7 @@
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div class="box" style="background-image: url(/Images/Other/member-background-istockphoto.jpg); background-size: 700px"><div class="content">
<div class="odometer-wrapper"><div class="elementFloatFar odometer odometer-integer nocents" id="odoGlobalParticipation">123402500</div><div class="odometer-label">Current Participants (Testing new code)</div>
<div class="odometer-wrapper"><div class="elementFloatFar odometer odometer-integer nocents" id="odoGlobalParticipation">12342500</div><div class="odometer-label">Current Participants (Testing new code)</div>
</div>
<div class="odometer-wrapper"><div class="elementFloatFar odometer odometer-integer nocents" id="odoActiveParticipation">125498</div><div class="odometer-label">Active Participants Last 30 Days (Testing new code)</div>
@@ -28,10 +28,10 @@
</div></div></div>
<div class="box"><div class="content">
<h2>Dashboard Placeholder</h2>
<p>Dashboard is being constructed in preparation for beta release. Lots of code are in testing (visible on the Sandbox).</p>
<h2><asp:Label ID="LabelHeaderLocal" runat="server" /></h2>
<Swarmops5:TreePositions ID="TreePositions" Level="Geography" runat="server" />
</div></div>
</div></div>
</asp:Content>
+31
View File
@@ -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;
}
}
}
+18
View File
@@ -11,5 +11,23 @@ namespace Swarmops.Frontend {
public partial class Default {
/// <summary>
/// LabelHeaderLocal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelHeaderLocal;
/// <summary>
/// TreePositions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Swarm.TreePositions TreePositions;
}
}
+1 -1
View File
@@ -246,7 +246,7 @@
<div class="content">
<asp:Repeater runat="server" ID="RepeaterTodoItems"><ItemTemplate>
<div class="link-row-encaps" onclick="<%# DataBinder.Eval(Container.DataItem, "OnClick") %>" >
<div class="link-row-icon" style="background-image:url('<%# DataBinder.Eval(Container.DataItem, "Icon") %>')"></div>
<div class="link-row-icon" style="background-size: 16px; background-image:url('<%# DataBinder.Eval(Container.DataItem, "Icon") %>')"></div>
<asp:Label ID="Label1" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>' runat="server" />
</div>
</ItemTemplate></asp:Repeater>
+4 -4
View File
@@ -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 @@
<div id="divTabs" class="easyui-tabs" data-options="tabWidth:70,tabHeight:70">
<div title="<img src='/Images/Icons/iconshock-general-128px.png' width='64' height='64' />">
<h2><asp:Label ID="LabelHeaderStrategic" runat="server" /></h2>
<Swarmops5:TreePositions ID="TreePositionsStrategic" Level="OrganizationStrategic" Cookie="Strategic" runat="server" />
<Swarmops5:TreePositions ID="TreePositionsStrategic" Level="OrganizationStrategic" Cookie="Strategic" Height="600" runat="server" />
</div>
<div title="<img src='/Images/Icons/iconshock-executive-128px.png' width='64' height='64' />">
<h2><asp:Label ID="LabelHeaderExecutive" runat="server" /></h2>
<Swarmops5:TreePositions ID="TreePositionsExecutive" Level="OrganizationExecutive" Cookie="Executive" runat="server" />
<Swarmops5:TreePositions ID="TreePositionsExecutive" Level="OrganizationExecutive" Cookie="Executive" Height="600" runat="server" />
</div>
<div title="<img src='/Images/Icons/iconshock-foreman-128px.png' width='64' height='64' />">
<h2><asp:Label ID="LabelHeaderGeographicDefault" runat="server" /></h2>
<Swarmops5:TreePositions ID="TreePositionsGeographic" Level="GeographyDefault" Cookie="Local" runat="server" />
<Swarmops5:TreePositions ID="TreePositionsGeographic" Level="GeographyDefault" Cookie="Local" Height="600" runat="server" />
</div>
<div title="<img src='/Images/Icons/iconshock-redshirt-128px.png' width='64' height='64' />">
<h2><asp:Label ID="LabelHeaderVolunteers" runat="server" /></h2>
+2 -2
View File
@@ -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 @@
</div>
<div title="<img src='/Images/Icons/iconshock-group-diversified-64px.png' />">
<h2><asp:Label ID="LabelHeaderSysops" runat="server" /></h2>
<Swarmops5:TreePositions ID="TreePositions" Level="SystemWide" runat="server" />
<Swarmops5:TreePositions ID="TreePositions" Level="SystemWide" runat="server" Height="600" />
</div>
<div title="<img src='/Images/Icons/iconshock-mail-open-64px.png' />">
<h2><asp:Label ID="LabelHeaderCorrespondenceTransmission" runat="server" /></h2>
@@ -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" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
+1 -1
View File
@@ -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://');
+14
View File
@@ -724,8 +724,13 @@
<Content Include="Images\Flags\us-24px.png" />
<Content Include="Images\Icons\bitcoin-icon-128px.png" />
<Content Include="Images\Icons\bitcoin-icon-16px.png" />
<Content Include="Images\Icons\bitcoin-icon-256px.png" />
<Content Include="Images\Icons\iconshock-add-16px.png" />
<Content Include="Images\Icons\iconshock-add-96px.png" />
<Content Include="Images\Icons\iconshock-balloon-128x96px-hot.png" />
<Content Include="Images\Icons\iconshock-balloon-128x96px.png" />
<Content Include="Images\Icons\iconshock-balloon-defer-128x96px-hot.png" />
<Content Include="Images\Icons\iconshock-balloon-defer-128x96px.png" />
<Content Include="Images\Icons\iconshock-balloon-no-128x96px-disabled.png" />
<Content Include="Images\Icons\iconshock-balloon-no-128x96px-hot-disabled.png" />
<Content Include="Images\Icons\iconshock-balloon-no-128x96px-hot.png" />
@@ -737,6 +742,8 @@
<Content Include="Images\Icons\iconshock-balloon-undo-128x96px.png" />
<Content Include="Images\Icons\iconshock-balloon-undo-16px-hot.png" />
<Content Include="Images\Icons\iconshock-balloon-undo-16px.png" />
<Content Include="Images\Icons\iconshock-balloon-wrench-128x96px-hot.png" />
<Content Include="Images\Icons\iconshock-balloon-wrench-128x96px.png" />
<Content Include="Images\Icons\iconshock-balloon-yes-128x96px-disabled.png" />
<Content Include="Images\Icons\iconshock-balloon-yes-128x96px-gold.png" />
<Content Include="Images\Icons\iconshock-balloon-yes-128x96px-hot-disabled.png" />
@@ -804,6 +811,12 @@
<Content Include="Images\Icons\iconshock-settings-16px.png" />
<Content Include="Images\Icons\iconshock-soldier-128px.png" />
<Content Include="Images\Icons\iconshock-star-gold-64px.png" />
<Content Include="Images\Icons\iconshock-stars-1-128x96px.png" />
<Content Include="Images\Icons\iconshock-stars-2-128x96px.png" />
<Content Include="Images\Icons\iconshock-stars-3-128x96px.png" />
<Content Include="Images\Icons\iconshock-stars-4-128x96px.png" />
<Content Include="Images\Icons\iconshock-stars-5-128x96px.png" />
<Content Include="Images\Icons\iconshock-stars-6-128x96px.png" />
<Content Include="Images\Icons\iconshock-switch-red-64px-hot.png" />
<Content Include="Images\Icons\iconshock-switch-red-64px.png" />
<Content Include="Images\Icons\iconshock-user-16px.png" />
@@ -820,6 +833,7 @@
<Content Include="Images\Icons\iconshock-warning-red-24x16px.png" />
<Content Include="Images\Icons\iconshock-warning-red-96px.png" />
<Content Include="Images\Icons\iconshock-workchair-16px.png" />
<Content Include="Images\Icons\iconshock-wrench-128x96px-centered.png" />
<Content Include="Images\Icons\iconshock-wrench-16px-hot.png" />
<Content Include="Images\Icons\iconshock-wrench-16px.png" />
<Content Include="Images\Icons\undo-16px.png" />