diff --git a/Logic/App_GlobalResources/ParticipantTitles.Designer.cs b/Logic/App_GlobalResources/ParticipantTitles.Designer.cs index 53b3469d..7764394f 100644 --- a/Logic/App_GlobalResources/ParticipantTitles.Designer.cs +++ b/Logic/App_GlobalResources/ParticipantTitles.Designer.cs @@ -60,6 +60,159 @@ namespace Swarmops.Logic.App_GlobalResources { } } + /// + /// Looks up a localized string similar to Auditor. + /// + internal static string Position_Organization_Auditor { + get { + return ResourceManager.GetString("Position_Organization_Auditor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auditors. + /// + internal static string Position_Organization_Auditor_Plural { + get { + return ResourceManager.GetString("Position_Organization_Auditor_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auditor Assistant. + /// + internal static string Position_Organization_AuditorAssistant { + get { + return ResourceManager.GetString("Position_Organization_AuditorAssistant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auditor Assistants. + /// + internal static string Position_Organization_AuditorAssistant_Plural { + get { + return ResourceManager.GetString("Position_Organization_AuditorAssistant_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Board Deputy. + /// + internal static string Position_Organization_BoardDeputy { + get { + return ResourceManager.GetString("Position_Organization_BoardDeputy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Board Deputies. + /// + internal static string Position_Organization_BoardDeputy_Plural { + get { + return ResourceManager.GetString("Position_Organization_BoardDeputy_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Board Member. + /// + internal static string Position_Organization_BoardMember { + get { + return ResourceManager.GetString("Position_Organization_BoardMember", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Board Members. + /// + internal static string Position_Organization_BoardMember_Plural { + get { + return ResourceManager.GetString("Position_Organization_BoardMember_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Chairperson of the Board. + /// + internal static string Position_Organization_Chairperson { + get { + return ResourceManager.GetString("Position_Organization_Chairperson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Chairpeople of the Board. + /// + internal static string Position_Organization_Chairperson_Plural { + get { + return ResourceManager.GetString("Position_Organization_Chairperson_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Chairperson Deputy. + /// + internal static string Position_Organization_ChairpersonDeputy { + get { + return ResourceManager.GetString("Position_Organization_ChairpersonDeputy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Chairperson Deputies. + /// + internal static string Position_Organization_ChairpersonDeputy_Plural { + get { + return ResourceManager.GetString("Position_Organization_ChairpersonDeputy_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sysadmin Assistant (Read-only). + /// + internal static string Position_System_AdministratorAssistantRO { + get { + return ResourceManager.GetString("Position_System_AdministratorAssistantRO", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sysadmin Assistants (Read-only). + /// + internal static string Position_System_AdministratorAssistantRO_Plural { + get { + return ResourceManager.GetString("Position_System_AdministratorAssistantRO_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sysadmin (Read/Write). + /// + internal static string Position_System_AdministratorAssistantRW { + get { + return ResourceManager.GetString("Position_System_AdministratorAssistantRW", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sysadmins (Read/write). + /// + internal static string Position_System_AdministratorAssistantRW_Plural { + get { + return ResourceManager.GetString("Position_System_AdministratorAssistantRW_Plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Principal Sysadmin. + /// + internal static string Position_System_AdministratorMain { + get { + return ResourceManager.GetString("Position_System_AdministratorMain", resourceCulture); + } + } + /// /// Looks up a localized string similar to Activist Swarm. /// diff --git a/Logic/App_GlobalResources/ParticipantTitles.resx b/Logic/App_GlobalResources/ParticipantTitles.resx index 16bfd30b..79ed4961 100644 --- a/Logic/App_GlobalResources/ParticipantTitles.resx +++ b/Logic/App_GlobalResources/ParticipantTitles.resx @@ -117,6 +117,57 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Auditor + + + Auditor Assistant + + + Auditor Assistants + + + Auditors + + + Board Deputy + + + Board Deputies + + + Board Member + + + Board Members + + + Chairperson of the Board + + + Chairperson Deputy + + + Chairperson Deputies + + + Chairpeople of the Board + + + Sysadmin Assistant (Read-only) + + + Sysadmin Assistants (Read-only) + + + Sysadmin (Read/Write) + + + Sysadmins (Read/write) + + + Principal Sysadmin + Activist Swarm diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 47bf9b71..e733e594 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -339,6 +339,7 @@ + @@ -383,6 +384,12 @@ + + + + + + diff --git a/Logic/Swarm/Position.cs b/Logic/Swarm/Position.cs new file mode 100644 index 00000000..6222ed54 --- /dev/null +++ b/Logic/Swarm/Position.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Swarmops.Logic.App_GlobalResources; + +namespace Swarmops.Logic.Swarm +{ + public class Position + { + + public static string Localized (PositionTitle title, bool plural = false) + { + string titleString = title.ToString(); + if (plural) + { + titleString += "_Plural"; + } + + return ParticipantTitles.ResourceManager.GetString ("Position_" + titleString); + } + } + + public enum PositionTitle + { + Unknown = 0, + System_AdministratorMain, + System_AdministratorAssistantRW, + System_AdministratorAssistantRO + } +} diff --git a/Site5/App_Code/MasterV5Base.cs b/Site5/App_Code/MasterV5Base.cs index 1940c471..6dbbb9d3 100644 --- a/Site5/App_Code/MasterV5Base.cs +++ b/Site5/App_Code/MasterV5Base.cs @@ -27,6 +27,13 @@ public class MasterV5Base : MasterPage public IncludedControl IncludedControlsUsed { get; set; } // as above with IncludedScripts control // ReSharper restore InconsistentNaming + + public MasterV5Base() + { + IncludedControlsUsed = IncludedControl.JsonParameters; // Include this by default to reduce errors + } + + public DateTime PermissionCacheTimestamp { get diff --git a/Site5/App_Code/PageV5Base.cs b/Site5/App_Code/PageV5Base.cs index e1a74428..04ef3f1e 100644 --- a/Site5/App_Code/PageV5Base.cs +++ b/Site5/App_Code/PageV5Base.cs @@ -41,13 +41,13 @@ public class PageV5Base : Page } // ReSharper disable once InconsistentNaming - protected EasyUIControl EasyUIControlsUsed + private EasyUIControl EasyUIControlsUsed { get { return Master.EasyUIControlsUsed; } set { Master.EasyUIControlsUsed = value; } } - public IncludedControl IncludedControlsUsed + private IncludedControl IncludedControlsUsed { get { return Master.IncludedControlsUsed; } set { Master.IncludedControlsUsed = value; } @@ -149,6 +149,16 @@ public class PageV5Base : Page return CommonV5.GetAuthenticationDataAndCulture (HttpContext.Current); } + + public void RegisterControl (EasyUIControl control) // public for use by child controls + { + this.EasyUIControlsUsed |= control; + } + + public void RegisterControl (IncludedControl control) // public for use by child controls + { + this.IncludedControlsUsed |= control; + } } diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index 0e0c3102..affaceb6 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -572,4 +572,8 @@ Year {0} As in "the year X". + + (vacant) + For unassigned positions + \ No newline at end of file diff --git a/Site5/Automation/Json-PersonRoleTreeData.aspx b/Site5/Automation/Json-PersonRoleTreeData.aspx new file mode 100644 index 00000000..a69adf07 --- /dev/null +++ b/Site5/Automation/Json-PersonRoleTreeData.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-PersonRoleTreeData.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_PersonRoleTreeData" %> diff --git a/Site5/Automation/Json-PersonRoleTreeData.aspx.cs b/Site5/Automation/Json-PersonRoleTreeData.aspx.cs new file mode 100644 index 00000000..54a4a764 --- /dev/null +++ b/Site5/Automation/Json-PersonRoleTreeData.aspx.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Swarmops.Logic.Financial; +using Swarmops.Logic.Structure; +using Swarmops.Logic.Swarm; + +namespace Swarmops.Frontend.Automation +{ + public partial class Json_PersonRoleTreeData : DataV5Base + { + protected void Page_Load(object sender, EventArgs e) + { + Response.ContentType = "application/json"; + + // If level if system-wide, execute this block. Also, move the data to the real place, please + + JsonPositions rootPositions = new JsonPositions(); + + Organization sandbox = Organization.FromIdentity (1); // Used as sysadmin basis + + string[] writeAdminIds = sandbox.Parameters.TemporaryAccessListWrite.Split (','); + string[] readAdminIds = sandbox.Parameters.TemporaryAccessListRead.Split(','); + + JsonPosition root = new JsonPosition(); + root.Id = "Root"; // heh. Sysadmin has id "root". Heh. + root.LocalizedTitle = Position.Localized (PositionTitle.System_AdministratorMain); + root.AssignedName = Person.FromIdentity (Int32.Parse (writeAdminIds[0])).Canonical; + + root.Children.Add(new JsonPosition { Id = "AsstRW", LocalizedTitle = Position.Localized(PositionTitle.System_AdministratorAssistantRW, true), AssignedName = Resources.Global.Swarm_Vacant }); + root.Children.Add(new JsonPosition { Id = "AsstRO", LocalizedTitle = Position.Localized(PositionTitle.System_AdministratorAssistantRO, true), AssignedName = Resources.Global.Swarm_Vacant }); + + JsonPositions positions = new JsonPositions(); + positions.Add (root); + + Response.Output.WriteLine(RecursePositionTree (positions)); + + Response.End(); + } + + private string RecursePositionTree (JsonPositions positions) + { + List elements = new List(); + + foreach (JsonPosition position in positions) + { + string element = string.Format("\"id\":\"{0}\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\"", + JsonSanitize (position.Id), JsonSanitize (position.LocalizedTitle), JsonSanitize (position.AssignedName)); + + if (position.Children.Count > 0) + { + element += ",\"state\":\"open\",\"children\":" + RecursePositionTree(position.Children); + } + + elements.Add("{" + element + "}"); + } + + return "[" + String.Join(",", elements.ToArray()) + "]"; + } + + private class JsonPosition + { + public JsonPosition() + { + Children = new JsonPositions(); + } + + public string Id { get; set; } + public string LocalizedTitle { get; set; } + public string AssignedName { get; set; } + + public JsonPositions Children { get; set; } + } + + private class JsonPositions : List + { + // just a typedef + } + } +} \ No newline at end of file diff --git a/Site5/Controls/v5/Base/ComboGeographies.ascx.cs b/Site5/Controls/v5/Base/ComboGeographies.ascx.cs index 61a9d88d..f4067335 100644 --- a/Site5/Controls/v5/Base/ComboGeographies.ascx.cs +++ b/Site5/Controls/v5/Base/ComboGeographies.ascx.cs @@ -25,6 +25,11 @@ namespace Swarmops.Controls.Base } } + protected void Page_Init (object sender, EventArgs e) + { + ((PageV5Base) this.Page).RegisterControl (EasyUIControl.Tree); + } + protected void Page_Load (object sender, EventArgs e) { RootGeography = Geography.Root; // set to "world" unless manually set to something else diff --git a/Site5/Controls/v5/Base/FileUpload.ascx.cs b/Site5/Controls/v5/Base/FileUpload.ascx.cs index 2c8aae2d..4771e429 100644 --- a/Site5/Controls/v5/Base/FileUpload.ascx.cs +++ b/Site5/Controls/v5/Base/FileUpload.ascx.cs @@ -36,6 +36,12 @@ namespace Swarmops.Controls.Base public string ClientUploadCompleteCallback { get; set; } public string ClientUploadStartedCallback { get; set; } + protected void Page_Init (object sender, EventArgs e) + { + // cause master to include necessary script + ((PageV5Base)Page).RegisterControl(IncludedControl.FileUpload); + } + protected void Page_Load (object sender, EventArgs e) { if (!Page.IsPostBack) @@ -64,9 +70,6 @@ namespace Swarmops.Controls.Base { this.GuidString = this.HiddenGuid.Value; } - - ((PageV5Base) Page).IncludedControlsUsed |= IncludedControl.FileUpload; - // causes master to include necessary script } diff --git a/Site5/Controls/v5/Base/MainMenu.ascx.cs b/Site5/Controls/v5/Base/MainMenu.ascx.cs index 232f6b93..cf873582 100644 --- a/Site5/Controls/v5/Base/MainMenu.ascx.cs +++ b/Site5/Controls/v5/Base/MainMenu.ascx.cs @@ -75,7 +75,7 @@ namespace Swarmops.Controls.Base if (menuItem.Type == MenuItemType.BuildNumber) { localizedText = Swarmops.Logic.Support.Formatting.SwarmopsVersion; - cssClass = " class=\"buildId\""; + cssClass = " dir=\"ltr\""; } string iconSize = "40px"; diff --git a/Site5/Controls/v5/Financial/ComboBudgets.ascx.cs b/Site5/Controls/v5/Financial/ComboBudgets.ascx.cs index 6aa60a21..6a9ccd35 100644 --- a/Site5/Controls/v5/Financial/ComboBudgets.ascx.cs +++ b/Site5/Controls/v5/Financial/ComboBudgets.ascx.cs @@ -36,6 +36,11 @@ namespace Swarmops.Controls.Financial } } + protected void Page_Init (object sender, EventArgs e) + { + ((PageV5Base) this.Page).RegisterControl (EasyUIControl.Tree); + } + protected void Page_Load (object sender, EventArgs e) { } diff --git a/Site5/Controls/v5/Swarm/TreePersonRoles.ascx b/Site5/Controls/v5/Swarm/TreePersonRoles.ascx new file mode 100644 index 00000000..c93ae1c6 --- /dev/null +++ b/Site5/Controls/v5/Swarm/TreePersonRoles.ascx @@ -0,0 +1,38 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TreePersonRoles.ascx.cs" Inherits="Controls_v5_Swarm_TreePersonRoles" %> + + + + + + + + + + + + + + + + +
diff --git a/Site5/Controls/v5/Swarm/TreePersonRoles.ascx.cs b/Site5/Controls/v5/Swarm/TreePersonRoles.ascx.cs new file mode 100644 index 00000000..6612fc53 --- /dev/null +++ b/Site5/Controls/v5/Swarm/TreePersonRoles.ascx.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +public partial class Controls_v5_Swarm_TreePersonRoles : ControlV5Base +{ + protected void Page_Init (object sender, EventArgs e) + { + // Request control framework in Init - the Load is too late for child controls + + ((PageV5Base)this.Page).RegisterControl(EasyUIControl.Tree | EasyUIControl.DataGrid); + } + + protected void Page_Load(object sender, EventArgs e) + { + } + + public RoleLevel Level { get; set; } + public int OrganizationId { get; set; } + public int GeographyId { get; set; } + + + public enum RoleLevel + { + Unknown = 0, + Systemwide, + Organizationwide, + SuborganizationwideDefault, + OrganizationTop, + SuborganizationTopDefault, + GeographicDefault, + Geographic + } +} \ No newline at end of file diff --git a/Site5/Pages/v5/Admin/EditOrganization.aspx.cs b/Site5/Pages/v5/Admin/EditOrganization.aspx.cs index 623a5f17..27cb5fee 100644 --- a/Site5/Pages/v5/Admin/EditOrganization.aspx.cs +++ b/Site5/Pages/v5/Admin/EditOrganization.aspx.cs @@ -23,10 +23,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin Localize(); } - - EasyUIControlsUsed = EasyUIControl.Tabs; - IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.SwitchButton | - IncludedControl.JsonParameters; + RegisterControl (EasyUIControl.Tabs); + RegisterControl (IncludedControl.SwitchButton); } private void Localize() diff --git a/Site5/Pages/v5/Admin/Settings.aspx b/Site5/Pages/v5/Admin/Settings.aspx index 723d5b3c..b5a43ea1 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx +++ b/Site5/Pages/v5/Admin/Settings.aspx @@ -1,5 +1,6 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="Settings.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Admin.Settings" %> <%@ Register tagPrefix="Swarmops5" tagName="AjaxTextBox" src="~/Controls/v5/Base/AjaxTextBox.ascx" %> +<%@ Register tagPrefix="Swarmops5" tagName="TreePersonRoles" src="~/Controls/v5/Swarm/TreePersonRoles.ascx" %> @@ -27,6 +28,10 @@
+
+

System Administrators

+ +

Correspondence transmission settings

diff --git a/Site5/Pages/v5/Admin/Settings.aspx.cs b/Site5/Pages/v5/Admin/Settings.aspx.cs index 9329a2c8..1bc1a740 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx.cs +++ b/Site5/Pages/v5/Admin/Settings.aspx.cs @@ -22,8 +22,6 @@ namespace Swarmops.Frontend.Pages.v5.Admin { // HACK: The organization part must be removed once proper access control is in place this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.System, AccessType.Write); - this.IncludedControlsUsed = IncludedControl.JsonParameters | IncludedControl.SwitchButton; - this.EasyUIControlsUsed = EasyUIControl.Tabs; this.PageTitle = Resources.Pages.Admin.SystemSettings_PageTitle; this.InfoBoxLiteral = Resources.Pages.Admin.SystemSettings_Info; @@ -38,6 +36,9 @@ namespace Swarmops.Frontend.Pages.v5.Admin Localize(); } + + RegisterControl (EasyUIControl.Tabs); + RegisterControl (IncludedControl.JsonParameters | IncludedControl.SwitchButton); } private static string FormatSmtpAccessString (string user, string pass, string host, int port) diff --git a/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs b/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs index 269f5bd7..d7e99365 100644 --- a/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs +++ b/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs @@ -23,8 +23,6 @@ namespace Swarmops.Frontend.Pages.Comms this.TextMessage.Style[HtmlTextWriterStyle.Width] = "674px"; this.TextMessage.Style["resize"] = "none"; - - EasyUIControlsUsed = EasyUIControl.Tree; } private void Localize() diff --git a/Site5/Pages/v5/Financial/AttestCosts.aspx.cs b/Site5/Pages/v5/Financial/AttestCosts.aspx.cs index 890a6136..b1d4998d 100644 --- a/Site5/Pages/v5/Financial/AttestCosts.aspx.cs +++ b/Site5/Pages/v5/Financial/AttestCosts.aspx.cs @@ -38,7 +38,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial PopulateExpenses(); // PopulateSalaries(); - EasyUIControlsUsed = EasyUIControl.DataGrid; + RegisterControl(EasyUIControl.DataGrid); this.RepeaterLightboxItems.DataSource = this._documentList; this.RepeaterLightboxItems.DataBind(); diff --git a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs index e7fbd090..c3017957 100644 --- a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs +++ b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs @@ -102,10 +102,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial Localize(); } - - EasyUIControlsUsed = EasyUIControl.Tree; - IncludedControlsUsed = IncludedControl.JsonParameters; - ; } diff --git a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs index e52e0954..2dbab8e7 100644 --- a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs +++ b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs @@ -109,9 +109,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial Localize(); } - - EasyUIControlsUsed = EasyUIControl.Tree; - IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.JsonParameters; } diff --git a/Site5/Pages/v5/Financial/PayOutMoney.aspx.cs b/Site5/Pages/v5/Financial/PayOutMoney.aspx.cs index d32d4542..ea008178 100644 --- a/Site5/Pages/v5/Financial/PayOutMoney.aspx.cs +++ b/Site5/Pages/v5/Financial/PayOutMoney.aspx.cs @@ -26,7 +26,7 @@ namespace Swarmops.Frontend.Pages.Financial Localize(); } - EasyUIControlsUsed = EasyUIControl.DataGrid; + RegisterControl (EasyUIControl.DataGrid); } private void Localize() diff --git a/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs b/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs index f1890847..90d9e62d 100644 --- a/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs +++ b/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs @@ -31,9 +31,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial Localize(); } - - EasyUIControlsUsed = EasyUIControl.Tree; - IncludedControlsUsed = IncludedControl.JsonParameters; } diff --git a/Site5/Pages/v5/Financial/ValidateReceipts.aspx.cs b/Site5/Pages/v5/Financial/ValidateReceipts.aspx.cs index 31f16016..a4633d6a 100644 --- a/Site5/Pages/v5/Financial/ValidateReceipts.aspx.cs +++ b/Site5/Pages/v5/Financial/ValidateReceipts.aspx.cs @@ -38,7 +38,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial this._documentList = new List(); PopulateExpenses(); - EasyUIControlsUsed = EasyUIControl.DataGrid; + RegisterControl (EasyUIControl.DataGrid); this.RepeaterLightboxItems.DataSource = this._documentList; diff --git a/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs b/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs index d50fce14..778d1504 100644 --- a/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs +++ b/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs @@ -97,8 +97,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write); DbVersionRequired = 2; // Account reparenting - EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree; - IncludedControlsUsed |= IncludedControl.SwitchButton | IncludedControl.JsonParameters; + RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree); + RegisterControl (IncludedControl.SwitchButton); } diff --git a/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs b/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs index 9ec5ae5a..15f6f2be 100644 --- a/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs +++ b/Site5/Pages/v5/Ledgers/BalanceSheet.aspx.cs @@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers Localize(); } - EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree; + RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree); } diff --git a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs index c7a04039..cbbba8f3 100644 --- a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs +++ b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs @@ -51,7 +51,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers this.DropMonths.SelectedValue = today.Month.ToString (CultureInfo.InvariantCulture); } - EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree; + RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree); Localize(); } diff --git a/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx.cs b/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx.cs index e89484eb..d31133ee 100644 --- a/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx.cs +++ b/Site5/Pages/v5/Ledgers/ProfitLossStatement.aspx.cs @@ -30,7 +30,7 @@ public partial class Pages_v5_Ledgers_ProfitLossStatement : PageV5Base Localize(); } - EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree; + RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree); } private void Localize() diff --git a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs index 285547a3..58d8fd2d 100644 --- a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs +++ b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs @@ -75,7 +75,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers Localize(); } - EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree; + RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree); } diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx deleted file mode 100644 index 24122646..00000000 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx +++ /dev/null @@ -1,70 +0,0 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="SetRootBudgets.aspx.cs" Inherits="Pages_v5_Ledgers_SetRootBudgets" %> -<%@ Register src="~/Controls/v5/Swarm/PersonDetailPopup.ascx" tagName="PersonDetailPopup" tagPrefix="act5" %> - - - - - - - -

- - - -
-
-   
-  
-   -
- - - -
- -
- - -

- -
-
- -
-
- -

- -
-
-
-
- -

- -
-
- -
-
- - - -
- diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs deleted file mode 100644 index d5e290e3..00000000 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs +++ /dev/null @@ -1,335 +0,0 @@ -using System; -using System.Threading; -using System.Web.UI; -using System.Web.UI.WebControls; -using Resources; -using Resources.Pages; -using Swarmops.Basic.Enums; -using Swarmops.Logic.Financial; -using Swarmops.Logic.Security; -using Swarmops.Logic.Structure; -using Swarmops.Logic.Swarm; - -public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base -{ - private int _year; - - protected void Page_Init (object sender, EventArgs e) - { - if (Page.IsPostBack) - { - // Create controls, for amounts to be set in Page_Load. This is necessary for events to fire. - // We don't know the year setting here yet. - - FinancialAccounts accounts = GetRootLevelResultAccounts(); - - this.RepeaterAccountBudgets.DataSource = accounts; - this.RepeaterAccountBudgets.DataBind(); - } - } - - protected void Page_Load (object sender, EventArgs e) - { - PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write); - - this.HiddenInitOrganizationId.Value = CurrentOrganization.Identity.ToString(); - - PageIcon = "iconshock-moneybag"; - PageTitle = Ledgers.SetRootBudgets_PageTitle; - - if (!Page.IsPostBack) - { - FinancialAccounts accounts = GetRootLevelResultAccounts(); - - int currentYear = DateTime.Today.Year; - this._year = currentYear; - - do - { - this.DropYears.Items.Add (new ListItem (currentYear.ToString())); - currentYear--; - } while (accounts[0].GetTree().GetBudgetSumCents (currentYear) > 0); - - this.DropYears.SelectedIndex = 0; - - this.RepeaterAccountNames.DataSource = accounts; - this.RepeaterAccountNames.DataBind(); - - this.RepeaterAccountBudgets.DataSource = accounts; - this.RepeaterAccountBudgets.DataBind(); - - this.RepeaterAccountActuals.DataSource = accounts; - this.RepeaterAccountActuals.DataBind(); - - UpdateYearlyResult (accounts); - - this.LabelRootBudgetHeader.Text = String.Format (Ledgers.SetRootBudgets_PageHeader, - CurrentOrganization.Name); - this.LabelAccountHeader.Text = Global.Financial_BookkeepingAccountShort; - this.LabelYearlyResultLabel.Text = Global.Financial_YearlyResult; - this.ButtonSetBudgets.Text = Ledgers.SetRootBudgets_SetNewBudgets; - this.LabelBudgetOwnerHeader.Text = Ledgers.SetRootBudgets_BudgetOwnerHeader; - - this.LabelSidebarActions.Text = Global.Sidebar_Actions; - this.LabelSidebarInfo.Text = Global.Sidebar_Information; - this.LabelSidebarTodo.Text = Global.Sidebar_Todo; - this.LabelDashboardInfo.Text = Ledgers.SetRootBudgets_Info; - - LocalizeActualsHeader(); - } - else - { - this._year = Int32.Parse (this.DropYears.SelectedItem.Text); - } - - this.DropYears.Style[HtmlTextWriterStyle.FontWeight] = "bold"; - this.ButtonSetBudgets.Style[HtmlTextWriterStyle.MarginTop] = "4px"; - this.ButtonSetBudgets.Style[HtmlTextWriterStyle.MarginBottom] = "5px"; - this.ButtonSetBudgets.Style[HtmlTextWriterStyle.Padding] = "1px"; - - // RebindTooltips(); - } - - private void LocalizeActualsHeader() - { - if (CurrentOrganization.Parameters.FiscalBooksClosedUntilYear >= this._year) - { - this.LabelActualsHeader.Text = Global.Financial_Actuals; - } - else if (this._year == DateTime.Today.Year) - { - this.LabelActualsHeader.Text = Global.Financial_ActualsToDate; - } - else - { - this.LabelActualsHeader.Text = Global.Financial_ActualsPreliminary; - } - } - - protected void UpdateYearlyResult (FinancialAccounts rootAccounts) - { - Int64 budgetSum = 0; - Int64 actualSum = 0; - - foreach (FinancialAccount account in rootAccounts) - { - budgetSum += account.GetTree().GetBudgetSumCents (this._year)/100; - actualSum -= - (account.GetTree().GetDeltaCents (new DateTime (this._year, 1, 1), new DateTime (this._year + 1, 1, 1)) + - 50)/100; // negative: results accounts are sign reversed - } - - this.TextYearlyResult.Text = String.Format ("{0:N0}", budgetSum); - this.TextYearlyResult.Style[HtmlTextWriterStyle.Width] = "80px"; - this.TextYearlyResult.Style[HtmlTextWriterStyle.TextAlign] = "right"; - - this.LabelYearlyResultActuals.Text = String.Format ("{0:N0}", actualSum); - } - - protected void RepeaterAccountNames_ItemDataBound (object sender, RepeaterItemEventArgs e) - { - RepeaterItem item = e.Item; - - if (item.DataItem == null) - { - return; - } - - FinancialAccount account = (FinancialAccount) item.DataItem; - - Label labelAccountName = (Label) e.Item.FindControl ("LabelAccountName"); - Label labelAccountType = (Label) e.Item.FindControl ("LabelAccountType"); - - labelAccountName.Text = account.Name; - - // TODO: Add Type Too - - labelAccountType.Text = account.AccountType.ToString(); - } - - protected void RepeaterAccountBudgets_ItemDataBound (object sender, RepeaterItemEventArgs e) - { - RepeaterItem item = e.Item; - - if (item.DataItem == null) - { - return; - } - - FinancialAccount account = (FinancialAccount) item.DataItem; - - TextBox textBudget = (TextBox) e.Item.FindControl ("TextBudget"); - - if (this._year > 0) // called from after viewstate parsed - { - textBudget.Text = String.Format ("{0:N0}", account.GetTree().GetBudgetSumCents (this._year)/100); - textBudget.Style[HtmlTextWriterStyle.TextAlign] = "right"; - textBudget.Style[HtmlTextWriterStyle.Width] = "80px"; - } - - Label labelOwnerName = (Label) e.Item.FindControl ("LabelBudgetOwner"); - Person accountOwner = account.Owner; - if (accountOwner == null) - { - labelOwnerName.Text = Global.Global_NoOwner; - } - else - { - labelOwnerName.Text = accountOwner.Formal; - } - - // RadToolTip toolTip = (RadToolTip)e.Item.FindControl("ToolTip"); - - // Swarmops.Controls.Swarm.PersonDetailPopup personDetail = (PersonDetailPopup)toolTip.FindControl("PersonDetail"); - // personDetail.PersonChanged += new PersonChangedEventHandler(PersonDetail_PersonChanged); - - if (!Page.IsPostBack && CurrentAuthority != null) - { -/* - personDetail.Person = accountOwner; - personDetail.Cookie = account;*/ - } - - HiddenField hiddenAccountId = (HiddenField) e.Item.FindControl ("HiddenAccountId"); - hiddenAccountId.Value = account.Identity.ToString(); - - // this.TooltipManager.TargetControls.Add(labelBudgetOwner.ClientID, line.AccountIdentity.ToString(), true); - } - - /* - private void PersonDetail_PersonChanged(object sender, PersonChangedEventArgs e) - { - // Here, an owner has changed. We need to re-bind the owners column. - - // TODO: This resets the budget amounts to the values in the database, which is not really what we want. - - FinancialAccount account = (FinancialAccount) e.Cookie; - account.Owner = e.NewPerson; - - FinancialAccounts accounts = GetRootLevelResultAccounts(); - - this.RepeaterAccountBudgets.DataSource = accounts; - this.RepeaterAccountBudgets.DataBind(); - - // RebindTooltips(); - }*/ - - protected void DropYears_SelectedIndexChanged (object sender, EventArgs e) - { - FinancialAccounts accounts = GetRootLevelResultAccounts(); - - UpdateYearlyResult (accounts); - - this.RepeaterAccountBudgets.DataSource = accounts; - this.RepeaterAccountBudgets.DataBind(); - - this.RepeaterAccountActuals.DataSource = accounts; - this.RepeaterAccountActuals.DataBind(); - - LocalizeActualsHeader(); - - // this.RebindTooltips(); - } - - private FinancialAccounts GetRootLevelResultAccounts() - { - Organization org = CurrentOrganization; - - if (org == null && Page.IsPostBack) - { - // If we're being called from Page_Init to create controls just to catch events, then this.CurrentOrganization won't be set. - // We need to create it temporarily from a hidden field: - - org = Organization.FromIdentity (Int32.Parse (Request["ctl00$PlaceHolderMain$HiddenInitOrganizationId"])); - } - - FinancialAccount yearlyResult = org.FinancialAccounts.CostsYearlyResult; - FinancialAccounts allAccounts = FinancialAccounts.ForOrganization (org, FinancialAccountType.Result); - - // Select root accounts - - FinancialAccounts accounts = new FinancialAccounts(); - - foreach (FinancialAccount account in allAccounts) - { - if (account.ParentFinancialAccountId == 0 && account.Identity != yearlyResult.Identity) - { - accounts.Add (account); - } - } - - return accounts; - } - - /* - protected void RebindTooltips() - { - foreach (RepeaterItem repeaterItem in this.RepeaterAccountBudgets.Items) - { - HiddenField hiddenAccountId = (HiddenField)repeaterItem.FindControl("HiddenAccountId"); - FinancialAccount child = FinancialAccount.FromIdentity(Int32.Parse(hiddenAccountId.Value)); - RadToolTip toolTip = (RadToolTip)repeaterItem.FindControl("ToolTip"); - - PersonDetailPopup personDetail = (PersonDetailPopup)toolTip.FindControl("PersonDetail"); - - FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(hiddenAccountId.Value)); - personDetail.Person = account.Owner; - personDetail.Cookie = child; - } - }*/ - - protected void RepeaterAccountActuals_ItemDataBound (object sender, RepeaterItemEventArgs e) - { - RepeaterItem item = e.Item; - - if (item.DataItem == null) - { - return; - } - - FinancialAccount account = (FinancialAccount) item.DataItem; - - Label labelActuals = (Label) e.Item.FindControl ("LabelAccountActuals"); - - Int64 actuals = - (account.GetTree().GetDeltaCents (new DateTime (this._year, 1, 1), new DateTime (this._year + 1, 1, 1)) + 50)/ - 100; - - labelActuals.Text = String.Format ("{0:N0}", -actuals); // negative as results accounts are sign reversed - } - - - protected void ButtonSetBudgets_Click (object sender, EventArgs e) - { - foreach (RepeaterItem repeaterItem in this.RepeaterAccountBudgets.Items) - { - HiddenField hiddenAccountId = (HiddenField) repeaterItem.FindControl ("HiddenAccountId"); - TextBox textBudget = (TextBox) repeaterItem.FindControl ("TextBudget"); - FinancialAccount account = FinancialAccount.FromIdentity (Int32.Parse (hiddenAccountId.Value)); - - // TODO: Possible race condition here, fix with HiddenField - - Int64 newBudgetAmount = Int64.Parse (textBudget.Text.Replace (",", "").Replace (" ", ""), - Thread.CurrentThread.CurrentCulture); // TODO: May throw -- catch and send error message - - Int64 currentBudgetAmount = account.GetTree().GetBudgetSumCents (this._year)/100; - - // Set the new amount to the difference between the single budget of this account and the intended amount - - if (newBudgetAmount != currentBudgetAmount) - { - account.SetBudgetCents (this._year, - account.GetBudgetCents (this._year) + (newBudgetAmount - currentBudgetAmount)*100); - } - } - - // After updating budgets, rebind repeater - - FinancialAccounts accounts = GetRootLevelResultAccounts(); - - UpdateYearlyResult (accounts); - - this.RepeaterAccountBudgets.DataSource = accounts; - this.RepeaterAccountBudgets.DataBind(); - } -} \ No newline at end of file diff --git a/Site5/Pages/v5/Ledgers/TaxForms/PayrollForms.aspx.cs b/Site5/Pages/v5/Ledgers/TaxForms/PayrollForms.aspx.cs index 309067bb..b5f8f2e8 100644 --- a/Site5/Pages/v5/Ledgers/TaxForms/PayrollForms.aspx.cs +++ b/Site5/Pages/v5/Ledgers/TaxForms/PayrollForms.aspx.cs @@ -27,7 +27,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers.TaxForms Localize(); } - EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree; + RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree); } diff --git a/Site5/Pages/v5/Ledgers/ViewOutstandingAccounts.aspx.cs b/Site5/Pages/v5/Ledgers/ViewOutstandingAccounts.aspx.cs index d2545f00..143d2543 100644 --- a/Site5/Pages/v5/Ledgers/ViewOutstandingAccounts.aspx.cs +++ b/Site5/Pages/v5/Ledgers/ViewOutstandingAccounts.aspx.cs @@ -42,7 +42,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers Localize(); } } - EasyUIControlsUsed = EasyUIControl.DataGrid; + RegisterControl (EasyUIControl.DataGrid); } private void Localize() diff --git a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs index f0b2462a..f394e44a 100644 --- a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs +++ b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs @@ -38,8 +38,6 @@ namespace Swarmops.Frontend.Pages.v5.Swarm this.TextName.Focus(); } - - IncludedControlsUsed = IncludedControl.JsonParameters; } private void Populate() diff --git a/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs b/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs index dbce8137..555aec4c 100644 --- a/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs +++ b/Site5/Pages/v5/Swarm/ListFindPeople.aspx.cs @@ -22,7 +22,7 @@ namespace Swarmops.Frontend.Pages.Swarm Localize(); } - EasyUIControlsUsed = EasyUIControl.Tree | EasyUIControl.DataGrid; + RegisterControl (EasyUIControl.Tree | EasyUIControl.DataGrid); } private void Localize() diff --git a/Site5/Style/style-v5.css b/Site5/Style/style-v5.css index 46681175..2a42a4a6 100644 --- a/Site5/Style/style-v5.css +++ b/Site5/Style/style-v5.css @@ -1068,6 +1068,14 @@ nav.alertify-buttons { } +/* VARIOUS ADDITIONS - SORT LATER */ + +span.spanGrayedOut { + opacity: .5; +} + + + /* COLOR SCHEME #A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF -- blue (hue 222) diff --git a/Swarmops.sln b/Swarmops.sln index 4182ae93..4041bfa5 100644 --- a/Swarmops.sln +++ b/Swarmops.sln @@ -32,7 +32,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Site5", "Site5\", "{367F36E Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" - VWDPort = "1589" + VWDPort = "37689" VWDVirtualPath = "/" DefaultWebSiteLanguage = "Visual C#" EndProjectSection