Added support class for readability

This commit is contained in:
Rick Falkvinge
2015-01-24 20:08:03 +01:00
parent c9ece1398a
commit 96a94cda7e
5 changed files with 113 additions and 17 deletions
@@ -122,7 +122,7 @@ namespace Swarmops.Logic.App_GlobalResources {
/// <summary>
/// Looks up a localized string similar to [ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName].
///
///Please log on to Swarmops at [SystemUrl] to attest or deny..
///Please log on to Swarmops at [ExternalUrl] to attest or deny..
/// </summary>
internal static string CashAdvance_Requested_Body {
get {
@@ -160,7 +160,7 @@ namespace Swarmops.Logic.App_GlobalResources {
/// <summary>
/// Looks up a localized string similar to [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim.
///
///Please log on to Swarmops at [SystemUrl] to attest or deny..
///Please log on to Swarmops at [ExternalUrl] to attest or deny..
/// </summary>
internal static string ExpenseClaim_Created_Body {
get {
@@ -278,7 +278,7 @@ namespace Swarmops.Logic.App_GlobalResources {
/// <summary>
/// Looks up a localized string similar to An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout.
///
///Please log on to Swarmops at [SystemUrl] to attest or deny..
///Please log on to Swarmops at [ExternalUrl] to attest or deny..
/// </summary>
internal static string InboundInvoice_Created_Body {
get {
@@ -405,9 +405,9 @@ namespace Swarmops.Logic.App_GlobalResources {
///
///If you did not just perform this password change, there has been a security breach. If this is the case, please block your account IMMEDIATELY by clicking the following link:
///
///[SystemUrl]Security/LockoutAccount?Email=[EmailAddress]&amp;Ticket=[LockoutTicket]
///[ExternalUrl]Security/LockoutAccount?Email=[EmailAddress]&amp;Ticket=[LockoutTicket]
///
///For security purposes, there will not be a confirmation dialog: your account will be locked the instant you go to this link, and administrators will contact you to verify what happened and work with y [rest of string was truncated]&quot;;.
///For security purposes, there will not be a confirmation dialog: your account will be locked the instant you go to this link, and administrators will contact you to verify what happened and work with [rest of string was truncated]&quot;;.
/// </summary>
internal static string Password_Changed_Body {
get {
@@ -429,9 +429,9 @@ namespace Swarmops.Logic.App_GlobalResources {
///
///Please follow this link to reset your password and re-enable any two-factor authentication, if it was previously enabled:
///
///[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
///[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
///
///This ticket will expire in 24 hours. If you do not reset your password in this time frame, you will need to contact the administrators at [OrganizationName] to issu [rest of string was truncated]&quot;;.
///This ticket will expire in 24 hours. If you do not reset your password in this time frame, you will need to contact the administrators at [OrganizationName] to is [rest of string was truncated]&quot;;.
/// </summary>
internal static string Password_ResetByCrew_Body {
get {
@@ -451,9 +451,9 @@ namespace Swarmops.Logic.App_GlobalResources {
/// <summary>
/// Looks up a localized string similar to Somebody, most likely you, requested a reset of the password associated with this email address at [OrganizationName]. If this was you, please follow the link below in the next 60 minutes to complete the password reset procedure:
///
///[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
///[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
///
///If you did NOT request a password reset, you can (and should) ignore this mail. The password reset request will expire in one hour. (If you are getting a large number of these password reset links that you did not [rest of string was truncated]&quot;;.
///If you did NOT request a password reset, you can (and should) ignore this mail. The password reset request will expire in one hour. (If you are getting a large number of these password reset links that you did n [rest of string was truncated]&quot;;.
/// </summary>
internal static string Password_ResetOnRequest_Body {
get {
@@ -473,7 +473,7 @@ namespace Swarmops.Logic.App_GlobalResources {
/// <summary>
/// Looks up a localized string similar to Receipts have been filed that need validation for their financial processes to continue.
///
///Please log on to Swarmops at [SystemUrl] to confirm or reject them..
///Please log on to Swarmops at [ExternalUrl] to confirm or reject them..
/// </summary>
internal static string Receipts_Filed_Body {
get {
@@ -142,7 +142,7 @@ This means you should see the amount on your account shortly.</value>
<data name="CashAdvance_Requested_Body" xml:space="preserve">
<value>[ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName].
Please log on to Swarmops at [SystemUrl] to attest or deny.</value>
Please log on to Swarmops at [ExternalUrl] to attest or deny.</value>
<comment>This is sent to the budget owner(s) only.</comment>
</data>
<data name="CashAdvance_Requested_Subject" xml:space="preserve">
@@ -158,7 +158,7 @@ Please log on to Swarmops at [SystemUrl] to attest or deny.</value>
<data name="ExpenseClaim_Created_Body" xml:space="preserve">
<value>[ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim.
Please log on to Swarmops at [SystemUrl] to attest or deny.</value>
Please log on to Swarmops at [ExternalUrl] to attest or deny.</value>
<comment>This is sent to the budget owner(s)only.</comment>
</data>
<data name="ExpenseClaim_Created_Subject" xml:space="preserve">
@@ -209,7 +209,7 @@ The claim will be paid out to you when the amount has also been attested by the
<data name="InboundInvoice_Created_Body" xml:space="preserve">
<value>An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout.
Please log on to Swarmops at [SystemUrl] to attest or deny.</value>
Please log on to Swarmops at [ExternalUrl] to attest or deny.</value>
</data>
<data name="InboundInvoice_Created_Subject" xml:space="preserve">
<value>[[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed</value>
@@ -258,7 +258,7 @@ Thank you for your understanding.</value>
If you did not just perform this password change, there has been a security breach. If this is the case, please block your account IMMEDIATELY by clicking the following link:
[SystemUrl]Security/LockoutAccount?Email=[EmailAddress]&amp;Ticket=[LockoutTicket]
[ExternalUrl]Security/LockoutAccount?Email=[EmailAddress]&amp;Ticket=[LockoutTicket]
For security purposes, there will not be a confirmation dialog: your account will be locked the instant you go to this link, and administrators will contact you to verify what happened and work with you to re-enable your account.
@@ -272,7 +272,7 @@ However, if it was you yourself who changed the password, and thereby caused thi
Please follow this link to reset your password and re-enable any two-factor authentication, if it was previously enabled:
[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
This ticket will expire in 24 hours. If you do not reset your password in this time frame, you will need to contact the administrators at [OrganizationName] to issue a new password reset ticket.</value>
</data>
@@ -282,7 +282,7 @@ This ticket will expire in 24 hours. If you do not reset your password in this t
<data name="Password_ResetOnRequest_Body" xml:space="preserve">
<value>Somebody, most likely you, requested a reset of the password associated with this email address at [OrganizationName]. If this was you, please follow the link below in the next 60 minutes to complete the password reset procedure:
[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket]
If you did NOT request a password reset, you can (and should) ignore this mail. The password reset request will expire in one hour. (If you are getting a large number of these password reset links that you did not request, please notify the administrator.)</value>
</data>
@@ -292,7 +292,7 @@ If you did NOT request a password reset, you can (and should) ignore this mail.
<data name="Receipts_Filed_Body" xml:space="preserve">
<value>Receipts have been filed that need validation for their financial processes to continue.
Please log on to Swarmops at [SystemUrl] to confirm or reject them.</value>
Please log on to Swarmops at [ExternalUrl] to confirm or reject them.</value>
</data>
<data name="Receipts_Filed_Subject" xml:space="preserve">
<value>[[OrganizationName] - ACTION ITEM] Receipts Filed - Validation Needed</value>
@@ -61,6 +61,7 @@ namespace Swarmops.Logic.Communications.Transmission
input = input.Replace ("[HostName]", Dns.GetHostName());
input = input.Replace ("[DbVersion]", SwarmDb.DbVersionExpected.ToString(CultureInfo.InvariantCulture));
input = input.Replace ("[SwarmopsVersion]", Formatting.SwarmopsVersion);
input = input.Replace ("[ExternalUrl]", SystemSettings.ExternalUrl);
// Loop through supplied strings and replace them in the resource. Not very efficient but who cares
+3
View File
@@ -306,6 +306,7 @@
<Compile Include="Support\SingularFactory.cs" />
<Compile Include="Support\SwarmopsLog.cs" />
<Compile Include="Support\SwarmopsLogEntry.cs" />
<Compile Include="Support\SystemSettings.cs" />
<Compile Include="Support\TemporaryIdentity.cs" />
<Compile Include="Support\UrlTranslations.cs" />
<Compile Include="Swarm\Activists.cs" />
@@ -402,6 +403,7 @@
<EmbeddedResource Include="App_GlobalResources\Logic.Communications.Transmission.NotificationPayload.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Logic.Communications.Transmission.NotificationPayload.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="App_GlobalResources\nb-NO\Logic.Communications.Transmission.NotificationPayload.nb-NO.resx" />
<EmbeddedResource Include="App_GlobalResources\nb-NO\Logic.Financial.FinancialTransactionTagSetTypesStock.nb-NO.resx" />
@@ -422,6 +424,7 @@
<EmbeddedResource Include="App_GlobalResources\Logic.Communications.Transmission.MailPayload.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Logic.Communications.Transmission.MailPayload.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="App_GlobalResources\ru-RU\Logic.Communications.Transmission.NotificationPayload.ru-RU.resx" />
<EmbeddedResource Include="App_GlobalResources\ru-RU\Logic.Financial.FinancialTransactionTagSetTypesStock.ru-RU.resx" />
+92
View File
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// This class is just for readability of other code. Doesn't add any logic at all, really - just readability, like SystemSettings.SmtpHost instead of Persistence.blahblah.
namespace Swarmops.Logic.Support
{
public class SystemSettings
{
static public string SmtpHost
{
get
{
return GetDefaultedPersistedKey("SmtpHost", "localhost");
}
set
{
Persistence.Key["SmtpHost"] = value;
}
}
static public int SmtpPort
{
get
{
string smtpPortString = Persistence.Key["SmtpPort"];
int smtpPort = 25;
if (!string.IsNullOrEmpty(smtpPortString))
{
smtpPort = Int32.Parse(smtpPortString); // bad place to get out of if this throws
}
return smtpPort;
}
set
{
Persistence.Key["SmtpPort"] = value.ToString(CultureInfo.InvariantCulture);
}
}
static public string SmtpUser
{
get
{
return Persistence.Key["SmtpUser"];
}
set
{
Persistence.Key["SmtpUser"] = value;
}
}
static public string SmtpPassword
{
get
{
return Persistence.Key["SmtpPassword"];
}
set
{
Persistence.Key["SmtpPassword"] = value;
}
}
static public string ExternalUrl
{
get
{
return Persistence.Key["ExternalUrl"];
}
set
{
Persistence.Key["ExternalUrl"] = value;
}
}
static private string GetDefaultedPersistedKey (string key, string defaultValue)
{
string result = Persistence.Key[key];
if (string.IsNullOrEmpty(result))
{
return defaultValue;
}
return result;
}
}
}