Namespace and localization work

This commit is contained in:
Rick Falkvinge
2016-10-02 06:50:39 +02:00
parent 01b5ac2383
commit 92b2fa888f
6 changed files with 176 additions and 145 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.BalanceSheet" Codebehind="BalanceSheet.aspx.cs" %>
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.Ledgers.BalanceSheet" Codebehind="BalanceSheet.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<script type="text/javascript">
@@ -27,8 +27,8 @@
var selectedYear = $('#<%=DropYears.ClientID %>').val();
$('div#linkDownloadReport').attr("onclick", "document.location='Csv-BalanceData.aspx?Year=" + selectedYear + "';");
$('#spanDownloadText').text('<%=Resources.Pages.Ledgers.BalanceSheet_DownloadFileName %>' + selectedYear + "-<%=DateTime.Today.ToString("yyyyMMdd") %>.csv");
$('#headerStartYear').text('<%=Resources.Pages.Ledgers.BalanceSheet_StartYear %>'.replace('XXXX',selectedYear));
$('#spanDownloadText').text(SwarmopsJS.unescape('<%= this.Localized_DownloadFileName %>') + selectedYear + "-<%=DateTime.Today.ToString("yyyyMMdd") %>.csv");
$('#headerStartYear').text(SwarmopsJS.unescape('<%= this.Localized_StartYear %>'.replace('XXXX',selectedYear)));
if (selectedYear == currentYear)
{
@@ -37,7 +37,7 @@
}
else
{
$('#previousYtd').text('<%=Resources.Pages.Ledgers.BalanceSheet_EndYear %>'.replace('XXXX', selectedYear));
$('#previousYtd').text(SwarmopsJS.unescape('<%= this.Localized_EndYear %>'.replace('XXXX', selectedYear)));
$('span.currentYearHeader').hide();
$('span.previousYearsHeader').show();
+21 -2
View File
@@ -2,7 +2,7 @@
using System.Globalization;
using Swarmops.Logic.Security;
namespace Swarmops.Frontend.Pages.v5.Ledgers
namespace Swarmops.Frontend.Pages.Ledgers
{
public partial class BalanceSheet : PageV5Base
{
@@ -10,7 +10,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
{
if (!CurrentOrganization.IsEconomyEnabled)
{
Response.Redirect ("/Pages/v5/Financial/EconomyNotEnabled.aspx", true);
Response.Redirect ("/Financial/EconomyNotEnabled", true);
return;
}
@@ -59,5 +59,24 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
this.LiteralHeaderYtd.Text = Resources.Pages.Ledgers.BalanceSheet_Current;
this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.BalanceSheet_AccountName;
}
// Localized strings for direct access from ASPX
// ReSharper disable InconsistentNaming
public string Localized_StartYear
{
get { return JavascriptEscape(Resources.Pages.Ledgers.BalanceSheet_StartYear); }
}
public string Localized_EndYear
{
get { return JavascriptEscape(Resources.Pages.Ledgers.BalanceSheet_EndYear); }
}
public string Localized_DownloadFileName
{
get { return JavascriptEscape(Resources.Pages.Ledgers.BalanceSheet_DownloadFileName); }
}
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Swarmops.Frontend.Pages.v5.Ledgers {
namespace Swarmops.Frontend.Pages.Ledgers {
public partial class BalanceSheet {
@@ -1,4 +1,4 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Pages_v5_Ledgers_ProfitLossStatement" Codebehind="ProfitLossStatement.aspx.cs" %>
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.Ledgers.ProfitLossStatement" Codebehind="ProfitLossStatement.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
@@ -28,7 +28,7 @@
var selectedYear = $('#<%=DropYears.ClientID %>').val();
$('div#linkDownloadReport').attr("onclick", "document.location='Csv-ProfitLossData.aspx?Year=" + selectedYear + "';");
$('#spanDownloadText').text('<%=Resources.Pages.Ledgers.ProfitLossStatement_DownloadFileName %>' + selectedYear + "-<%=DateTime.Today.ToString("yyyyMMdd") %>.csv");
$('#spanDownloadText').text(SwarmopsJS.unescape('<%= this.Localized_DownloadFileName %>') + selectedYear + "-<%=DateTime.Today.ToString("yyyyMMdd") %>.csv");
if (selectedYear == currentYear)
{
@@ -4,59 +4,69 @@ using Resources;
using Swarmops.Frontend;
using Swarmops.Logic.Security;
public partial class Pages_v5_Ledgers_ProfitLossStatement : PageV5Base
namespace Swarmops.Frontend.Pages.Ledgers
{
protected void Page_Load (object sender, EventArgs e)
public partial class ProfitLossStatement : PageV5Base
{
if (!CurrentOrganization.IsEconomyEnabled)
protected void Page_Load (object sender, EventArgs e)
{
Response.Redirect ("/Pages/v5/Financial/EconomyNotEnabled.aspx", true);
return;
}
PageIcon = "iconshock-abacus";
PageTitle = Resources.Pages.Ledgers.ProfitLossStatement_PageTitle;
InfoBoxLiteral = Resources.Pages.Ledgers.ProfitLossStatement_Info;
// Security: If the org has open ledgers, then anyone may read. Otherwise, Financials.Read.
if (!String.IsNullOrEmpty(CurrentOrganization.OpenLedgersDomain))
{
PageAccessRequired = new Access(AccessAspect.Null, AccessType.Read);
}
else
{
PageAccessRequired = new Access(CurrentOrganization, AccessAspect.Financials, AccessType.Read);
}
if (!Page.IsPostBack)
{
int year = DateTime.Today.Year;
int firstFiscalYear = CurrentOrganization.FirstFiscalYear;
while (year >= firstFiscalYear)
if (!CurrentOrganization.IsEconomyEnabled)
{
this.DropYears.Items.Add (year.ToString (CultureInfo.InvariantCulture));
year--;
Response.Redirect ("/Financial/EconomyNotEnabled", true);
return;
}
Localize();
PageIcon = "iconshock-abacus";
PageTitle = Resources.Pages.Ledgers.ProfitLossStatement_PageTitle;
InfoBoxLiteral = Resources.Pages.Ledgers.ProfitLossStatement_Info;
// Security: If the org has open ledgers, then anyone may read. Otherwise, Financials.Read.
if (!String.IsNullOrEmpty (CurrentOrganization.OpenLedgersDomain))
{
PageAccessRequired = new Access (AccessAspect.Null, AccessType.Read);
}
else
{
PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Financials, AccessType.Read);
}
if (!Page.IsPostBack)
{
int year = DateTime.Today.Year;
int firstFiscalYear = CurrentOrganization.FirstFiscalYear;
while (year >= firstFiscalYear)
{
this.DropYears.Items.Add (year.ToString (CultureInfo.InvariantCulture));
year--;
}
Localize();
}
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
}
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
private void Localize()
{
this.LabelContentHeader.Text = string.Format (Resources.Pages.Ledgers.ProfitLossStatement_ContentHeader,
CurrentOrganization.Name);
this.LiteralHeaderLastYear.Text = Resources.Pages.Ledgers.ProfitLossStatement_LastYear;
this.LiteralHeaderQ1.Text = Global.Global_Q1;
this.LiteralHeaderQ2.Text = Global.Global_Q2;
this.LiteralHeaderQ3.Text = Global.Global_Q3;
this.LiteralHeaderQ4.Text = Global.Global_Q4;
this.LiteralHeaderYtd.Text = Resources.Pages.Ledgers.ProfitLossStatement_Ytd;
this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.ProfitLossStatement_AccountName;
}
public string Localized_DownloadFileName
{
get { return JavascriptEscape (Resources.Pages.Ledgers.ProfitLossStatement_DownloadFileName); }
}
}
private void Localize()
{
this.LabelContentHeader.Text = string.Format (Resources.Pages.Ledgers.ProfitLossStatement_ContentHeader,
CurrentOrganization.Name);
this.LiteralHeaderLastYear.Text = Resources.Pages.Ledgers.ProfitLossStatement_LastYear;
this.LiteralHeaderQ1.Text = Global.Global_Q1;
this.LiteralHeaderQ2.Text = Global.Global_Q2;
this.LiteralHeaderQ3.Text = Global.Global_Q3;
this.LiteralHeaderQ4.Text = Global.Global_Q4;
this.LiteralHeaderYtd.Text = Resources.Pages.Ledgers.ProfitLossStatement_Ytd;
this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.ProfitLossStatement_AccountName;
}
}
+93 -91
View File
@@ -7,97 +7,99 @@
// </auto-generated>
//------------------------------------------------------------------------------
public partial class Pages_v5_Ledgers_ProfitLossStatement {
namespace Swarmops.Frontend.Pages.Ledgers {
/// <summary>
/// LabelContentHeader 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 LabelContentHeader;
/// <summary>
/// DropYears 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.DropDownList DropYears;
/// <summary>
/// LiteralHeaderAccountName 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.Literal LiteralHeaderAccountName;
/// <summary>
/// LiteralHeaderLastYear 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.Literal LiteralHeaderLastYear;
/// <summary>
/// LiteralHeaderQ1 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.Literal LiteralHeaderQ1;
/// <summary>
/// LiteralHeaderQ2 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.Literal LiteralHeaderQ2;
/// <summary>
/// LiteralHeaderQ3 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.Literal LiteralHeaderQ3;
/// <summary>
/// LiteralHeaderQ4 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.Literal LiteralHeaderQ4;
/// <summary>
/// LiteralHeaderYtd 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.Literal LiteralHeaderYtd;
/// <summary>
/// LabelSidebarDownload 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 LabelSidebarDownload;
public partial class ProfitLossStatement {
/// <summary>
/// LabelContentHeader 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 LabelContentHeader;
/// <summary>
/// DropYears 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.DropDownList DropYears;
/// <summary>
/// LiteralHeaderAccountName 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.Literal LiteralHeaderAccountName;
/// <summary>
/// LiteralHeaderLastYear 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.Literal LiteralHeaderLastYear;
/// <summary>
/// LiteralHeaderQ1 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.Literal LiteralHeaderQ1;
/// <summary>
/// LiteralHeaderQ2 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.Literal LiteralHeaderQ2;
/// <summary>
/// LiteralHeaderQ3 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.Literal LiteralHeaderQ3;
/// <summary>
/// LiteralHeaderQ4 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.Literal LiteralHeaderQ4;
/// <summary>
/// LiteralHeaderYtd 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.Literal LiteralHeaderYtd;
/// <summary>
/// LabelSidebarDownload 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 LabelSidebarDownload;
}
}