This commit is contained in:
Rick Falkvinge
2015-02-12 14:23:43 +01:00
38 changed files with 470 additions and 444 deletions
+153
View File
@@ -60,6 +60,159 @@ namespace Swarmops.Logic.App_GlobalResources {
}
}
/// <summary>
/// Looks up a localized string similar to Auditor.
/// </summary>
internal static string Position_Organization_Auditor {
get {
return ResourceManager.GetString("Position_Organization_Auditor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Auditors.
/// </summary>
internal static string Position_Organization_Auditor_Plural {
get {
return ResourceManager.GetString("Position_Organization_Auditor_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Auditor Assistant.
/// </summary>
internal static string Position_Organization_AuditorAssistant {
get {
return ResourceManager.GetString("Position_Organization_AuditorAssistant", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Auditor Assistants.
/// </summary>
internal static string Position_Organization_AuditorAssistant_Plural {
get {
return ResourceManager.GetString("Position_Organization_AuditorAssistant_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Board Deputy.
/// </summary>
internal static string Position_Organization_BoardDeputy {
get {
return ResourceManager.GetString("Position_Organization_BoardDeputy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Board Deputies.
/// </summary>
internal static string Position_Organization_BoardDeputy_Plural {
get {
return ResourceManager.GetString("Position_Organization_BoardDeputy_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Board Member.
/// </summary>
internal static string Position_Organization_BoardMember {
get {
return ResourceManager.GetString("Position_Organization_BoardMember", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Board Members.
/// </summary>
internal static string Position_Organization_BoardMember_Plural {
get {
return ResourceManager.GetString("Position_Organization_BoardMember_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chairperson of the Board.
/// </summary>
internal static string Position_Organization_Chairperson {
get {
return ResourceManager.GetString("Position_Organization_Chairperson", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chairpeople of the Board.
/// </summary>
internal static string Position_Organization_Chairperson_Plural {
get {
return ResourceManager.GetString("Position_Organization_Chairperson_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chairperson Deputy.
/// </summary>
internal static string Position_Organization_ChairpersonDeputy {
get {
return ResourceManager.GetString("Position_Organization_ChairpersonDeputy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chairperson Deputies.
/// </summary>
internal static string Position_Organization_ChairpersonDeputy_Plural {
get {
return ResourceManager.GetString("Position_Organization_ChairpersonDeputy_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sysadmin Assistant (Read-only).
/// </summary>
internal static string Position_System_AdministratorAssistantRO {
get {
return ResourceManager.GetString("Position_System_AdministratorAssistantRO", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sysadmin Assistants (Read-only).
/// </summary>
internal static string Position_System_AdministratorAssistantRO_Plural {
get {
return ResourceManager.GetString("Position_System_AdministratorAssistantRO_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sysadmin (Read/Write).
/// </summary>
internal static string Position_System_AdministratorAssistantRW {
get {
return ResourceManager.GetString("Position_System_AdministratorAssistantRW", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sysadmins (Read/write).
/// </summary>
internal static string Position_System_AdministratorAssistantRW_Plural {
get {
return ResourceManager.GetString("Position_System_AdministratorAssistantRW_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Principal Sysadmin.
/// </summary>
internal static string Position_System_AdministratorMain {
get {
return ResourceManager.GetString("Position_System_AdministratorMain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Activist Swarm.
/// </summary>
@@ -117,6 +117,57 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Position_Organization_Auditor" xml:space="preserve">
<value>Auditor</value>
</data>
<data name="Position_Organization_AuditorAssistant" xml:space="preserve">
<value>Auditor Assistant</value>
</data>
<data name="Position_Organization_AuditorAssistant_Plural" xml:space="preserve">
<value>Auditor Assistants</value>
</data>
<data name="Position_Organization_Auditor_Plural" xml:space="preserve">
<value>Auditors</value>
</data>
<data name="Position_Organization_BoardDeputy" xml:space="preserve">
<value>Board Deputy</value>
</data>
<data name="Position_Organization_BoardDeputy_Plural" xml:space="preserve">
<value>Board Deputies</value>
</data>
<data name="Position_Organization_BoardMember" xml:space="preserve">
<value>Board Member</value>
</data>
<data name="Position_Organization_BoardMember_Plural" xml:space="preserve">
<value>Board Members</value>
</data>
<data name="Position_Organization_Chairperson" xml:space="preserve">
<value>Chairperson of the Board</value>
</data>
<data name="Position_Organization_ChairpersonDeputy" xml:space="preserve">
<value>Chairperson Deputy</value>
</data>
<data name="Position_Organization_ChairpersonDeputy_Plural" xml:space="preserve">
<value>Chairperson Deputies</value>
</data>
<data name="Position_Organization_Chairperson_Plural" xml:space="preserve">
<value>Chairpeople of the Board</value>
</data>
<data name="Position_System_AdministratorAssistantRO" xml:space="preserve">
<value>Sysadmin Assistant (Read-only)</value>
</data>
<data name="Position_System_AdministratorAssistantRO_Plural" xml:space="preserve">
<value>Sysadmin Assistants (Read-only)</value>
</data>
<data name="Position_System_AdministratorAssistantRW" xml:space="preserve">
<value>Sysadmin (Read/Write)</value>
</data>
<data name="Position_System_AdministratorAssistantRW_Plural" xml:space="preserve">
<value>Sysadmins (Read/write)</value>
</data>
<data name="Position_System_AdministratorMain" xml:space="preserve">
<value>Principal Sysadmin</value>
</data>
<data name="Title_Activist_Corps" xml:space="preserve">
<value>Activist Swarm</value>
</data>
+7
View File
@@ -339,6 +339,7 @@
<Compile Include="Swarm\People.cs" />
<Compile Include="Swarm\Person.cs" />
<Compile Include="Swarm\PersonRole.cs" />
<Compile Include="Swarm\Position.cs" />
<Compile Include="Swarm\RoleLookup.cs" />
<Compile Include="Swarm\Roles.cs" />
<Compile Include="Swarm\Volunteer.cs" />
@@ -383,6 +384,12 @@
<EmbeddedResource Include="App_GlobalResources\de-DE\Logic.Communications.Transmission.NotificationPayload.de-DE.resx" />
<EmbeddedResource Include="App_GlobalResources\de-DE\Logic.Financial.FinancialTransactionTagSetTypesStock.de-DE.resx" />
<EmbeddedResource Include="App_GlobalResources\de-DE\Logic.Swarm.DashboardTodos.de-DE.resx" />
<EmbeddedResource Include="App_GlobalResources\el-GR\Logic.Communications.Transmission.DefaultCommTemplates.el-GR.resx" />
<EmbeddedResource Include="App_GlobalResources\el-GR\Logic.Communications.Transmission.MailPayload.el-GR.resx" />
<EmbeddedResource Include="App_GlobalResources\el-GR\Logic.Communications.Transmission.NotificationPayload.el-GR.resx" />
<EmbeddedResource Include="App_GlobalResources\el-GR\Logic.Financial.FinancialTransactionTagSetTypesStock.el-GR.resx" />
<EmbeddedResource Include="App_GlobalResources\el-GR\Logic.Swarm.DashboardTodos.el-GR.resx" />
<EmbeddedResource Include="App_GlobalResources\el-GR\ParticipantTitles.el-GR.resx" />
<EmbeddedResource Include="App_GlobalResources\es-ES\Logic.Communications.Transmission.NotificationPayload.es-ES.resx" />
<EmbeddedResource Include="App_GlobalResources\es-ES\Logic.Financial.FinancialTransactionTagSetTypesStock.es-ES.resx" />
<EmbeddedResource Include="App_GlobalResources\es-ES\Logic.Swarm.DashboardTodos.es-ES.resx" />
+32
View File
@@ -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
}
}
+7
View File
@@ -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
+12 -2
View File
@@ -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;
}
}
+4
View File
@@ -572,4 +572,8 @@
<value>Year {0}</value>
<comment>As in "the year X".</comment>
</data>
<data name="Swarm_Vacant" xml:space="preserve">
<value>(vacant)</value>
<comment>For unassigned positions</comment>
</data>
</root>
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-PersonRoleTreeData.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_PersonRoleTreeData" %>
@@ -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<string> elements = new List<string>();
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<JsonPosition>
{
// just a typedef
}
}
}
@@ -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
+6 -3
View File
@@ -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
}
+1 -1
View File
@@ -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";
@@ -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)
{
}
@@ -0,0 +1,38 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TreePersonRoles.ascx.cs" Inherits="Controls_v5_Swarm_TreePersonRoles" %>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#<%=this.ClientID%>_tablePositions').treegrid(
{
onLoadSuccess: function () {
// Anything here
}
});
});
</script>
<table id="<%=this.ClientID %>_tablePositions" title="" class="easyui-treegrid" style="width:680px;height:600px"
url="/Automation/Json-PersonRoleTreeData.aspx"
rownumbers="false"
animate="true"
fitColumns="true"
idField="id" treeField="positionTitle">
<thead>
<tr>
<th field="positionTitle" width="160"><asp:Literal ID="LiteralHeaderPosition" Text="Position XYZ" runat="server"/></th>
<th field="assignedName" width="160"><asp:Literal ID="LiteralHeaderQ1" Text="AssignedName XYZ" runat="server" /></th>
<th field="dateExpires" width="80"><asp:Literal ID="LiteralHeaderExpires" Text="ExpiresDate XYZ" runat="server" /></th>
<th field="reportsToName" width="120"><asp:Literal ID="LiteralHeaderReportsTo" Text="ReportsTo XYZ" runat="server" /></th>
<th field="flags" width="50" align="center"><asp:Literal ID="Literal2" Text="FLAGS" runat="server" /></th>
<th field="vol" width="30" align="center"><asp:Literal ID="Literal3" Text="VOL" runat="server" /></th>
<th field="editIcon" width="30" align="center"><asp:Literal ID="Literal1" Text="EDIT" runat="server" /></th>
</tr>
</thead>
</table>
@@ -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
}
}
@@ -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()
+5
View File
@@ -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" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
@@ -27,6 +28,10 @@
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div id="divTabs" class="easyui-tabs" data-options="tabWidth:70,tabHeight:70">
<div title="<img src='/Images/Icons/iconshock-group-diversified-64px.png' />">
<h2>System Administrators</h2>
<Swarmops5:TreePersonRoles ID="TreeRoles" runat="server" />
</div>
<div title="<img src='/Images/Icons/iconshock-mail-open-64px.png' />">
<h2>Correspondence transmission settings</h2>
<div class="entryFields">
+3 -2
View File
@@ -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)
@@ -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()
+1 -1
View File
@@ -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();
@@ -102,10 +102,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
Localize();
}
EasyUIControlsUsed = EasyUIControl.Tree;
IncludedControlsUsed = IncludedControl.JsonParameters;
;
}
@@ -109,9 +109,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
Localize();
}
EasyUIControlsUsed = EasyUIControl.Tree;
IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.JsonParameters;
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Swarmops.Frontend.Pages.Financial
Localize();
}
EasyUIControlsUsed = EasyUIControl.DataGrid;
RegisterControl (EasyUIControl.DataGrid);
}
private void Localize()
@@ -31,9 +31,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
Localize();
}
EasyUIControlsUsed = EasyUIControl.Tree;
IncludedControlsUsed = IncludedControl.JsonParameters;
}
@@ -38,7 +38,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
this._documentList = new List<RepeatedDocument>();
PopulateExpenses();
EasyUIControlsUsed = EasyUIControl.DataGrid;
RegisterControl (EasyUIControl.DataGrid);
this.RepeaterLightboxItems.DataSource = this._documentList;
+2 -2
View File
@@ -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);
}
+1 -1
View File
@@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
Localize();
}
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
}
@@ -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();
}
@@ -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()
@@ -75,7 +75,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
Localize();
}
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
}
@@ -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" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<asp:HiddenField ID="HiddenInitOrganizationId" Value="" runat="server" />
<h2><asp:Label ID="LabelRootBudgetHeader" Text="Root Budgets For Org [LOC]" runat="server" /><div style="float:right"><asp:DropDownList ID="DropYears" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropYears_SelectedIndexChanged" /></div></h2>
<div class="entryLabelsAdmin" style="margin-right:30px;width:200px">
<strong><asp:Label ID="LabelAccountHeader" Text="Account [LOC]" runat="server" /></strong><br/>
<asp:Repeater ID="RepeaterAccountNames" runat="server" OnItemDataBound="RepeaterAccountNames_ItemDataBound" ><ItemTemplate><asp:Label ID="LabelAccountName" runat="server" Text="Unset Account Name" /> <em>(<asp:Label ID="LabelAccountType" runat="server" Text="Type [LOC]" />)</em><br /></ItemTemplate></asp:Repeater>
<em><asp:Label ID="LabelYearlyResultLabel" runat="server" Text="Yearly Result [LOC]" /></em>
</div>
<div class="entryFieldsAdmin">
<strong><asp:Label ID="LabelBudgetOwnerHeader" runat="server" Text="Budget, Owner [LOC]" /></strong><br/>
<asp:Repeater ID="RepeaterAccountBudgets" OnItemDataBound="RepeaterAccountBudgets_ItemDataBound" runat="server"><ItemTemplate><asp:HiddenField runat="server" ID="HiddenAccountId" /><asp:HiddenField runat="server" ID="HiddenCurrentBudget" /><asp:TextBox ID="TextBudget" runat="server" Text="Not set" />&nbsp;&nbsp;<span style="border-bottom: dashed 1px #808080;cursor:pointer"><asp:Label ID="LabelBudgetOwner" runat="server" /></span><br/></ItemTemplate></asp:Repeater>
<asp:TextBox ID="TextYearlyResult" Text="Yearly Result (fill in programmatically)" runat="server" ReadOnly="true" Enabled="false" />&nbsp;<br/>
<asp:Button ID="ButtonSetBudgets" Text="Set New Budgets [LOC]" OnClick="ButtonSetBudgets_Click" runat="server" />&nbsp;
</div>
<div class="entryLabelsAdmin" style="margin-left:20px;width:100px;text-align:right">
<strong><asp:Label ID="LabelActualsHeader" Text="Actuals [LOC]" runat="server" /></strong><br/>
<asp:Repeater ID="RepeaterAccountActuals" runat="server" OnItemDataBound="RepeaterAccountActuals_ItemDataBound"><ItemTemplate><asp:Label ID="LabelAccountActuals" Text="Unset actuals" runat="server" /><br/></ItemTemplate></asp:Repeater>
<asp:Label ID="LabelYearlyResultActuals" runat="server" Text="Yearly Result [LOC]" /><br/>
</div>
<div style="clear:both"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" Text="INFO [Loc]" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelDashboardInfo" Text="You have not localized the dashboard information box." runat="server" /></a>
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" Text="ACTIONS [Loc]" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content"><!--
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/Vote.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-vote-16px.png')"></div>
<asp:Label ID="LabelActionVote" runat="server" />
</div>
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/ListMotions.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motions-16px.png')"></div>
<asp:Label ID="LabelActionListMotions" runat="server" />
</div>-->
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" Text="TODO [Loc]" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
@@ -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();
}
}
@@ -27,7 +27,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers.TaxForms
Localize();
}
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
}
@@ -42,7 +42,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
Localize();
}
}
EasyUIControlsUsed = EasyUIControl.DataGrid;
RegisterControl (EasyUIControl.DataGrid);
}
private void Localize()
-2
View File
@@ -38,8 +38,6 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
this.TextName.Focus();
}
IncludedControlsUsed = IncludedControl.JsonParameters;
}
private void Populate()
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Swarmops.Frontend.Pages.Swarm
Localize();
}
EasyUIControlsUsed = EasyUIControl.Tree | EasyUIControl.DataGrid;
RegisterControl (EasyUIControl.Tree | EasyUIControl.DataGrid);
}
private void Localize()
+8
View File
@@ -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)
+1 -1
View File
@@ -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