A few new strings and localizations et al

This commit is contained in:
Rick Falkvinge
2018-03-13 20:44:08 +01:00
parent c76564d6a7
commit 6de74dbed8
13 changed files with 137 additions and 41 deletions
@@ -32,15 +32,26 @@ namespace Swarmops.Logic.Communications.Payload
switch (mailType)
{
case ParticipantMailType.ParticipantAddedWelcome:
case ParticipantMailType.ParticipantAddedWelcome_NoExpiry:
Strings[MailPayloadString.ActingPerson] = actingPerson.Name;
Strings[MailPayloadString.MembershipExpiry] = participation.Expires.ToLongDateString();
Strings[MailPayloadString.OrganizationName] = participation.Organization.Name;
Strings[MailPayloadString.Regularship] =
Participant.Localized (participation.Organization.RegularLabel, TitleVariant.Ship);
Strings[MailPayloadString.ExternalUrl] = SystemSettings.ExternalUrl;
BodyTemplate =
Resources.Logic_Communications_Transmission_DefaultCommTemplates
.ParticipantManualAddWelcome_Body;
if (mailType == ParticipantMailType.ParticipantAddedWelcome)
{
BodyTemplate =
Resources.Logic_Communications_Transmission_DefaultCommTemplates
.ParticipantManualAddWelcome_Body;
}
else
{
BodyTemplate =
Resources.Logic_Communications_Transmission_DefaultCommTemplates
.ParticipantManualAddWelcome_NoExpiry_Body;
}
SubjectTemplate =
Resources.Logic_Communications_Transmission_DefaultCommTemplates
@@ -136,7 +147,8 @@ namespace Swarmops.Logic.Communications.Payload
public enum ParticipantMailType
{
Unknown = 0,
ParticipantAddedWelcome
ParticipantAddedWelcome,
ParticipantAddedWelcome_NoExpiry
}
[Serializable]
@@ -148,7 +160,8 @@ namespace Swarmops.Logic.Communications.Payload
MembershipExpiry,
Regularship,
ActingPerson,
OrganizationName
OrganizationName,
ExternalUrl
}
}
@@ -103,15 +103,6 @@ namespace Swarmops.Logic.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to [[OrganizationName]] Welcome to [OrganizationName]!.
/// </summary>
internal static string ParticipantManualAddWelcome_Subject {
get {
return ResourceManager.GetString("ParticipantManualAddWelcome_Subject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Welcome to [OrganizationName]!
///
@@ -124,18 +115,27 @@ namespace Swarmops.Logic.Resources {
///
///You should log on and c [rest of string was truncated]&quot;;.
/// </summary>
internal static string ParticipantManualAddWelcomeNoExpiry_Body {
internal static string ParticipantManualAddWelcome_NoExpiry_Body {
get {
return ResourceManager.GetString("ParticipantManualAddWelcomeNoExpiry_Body", resourceCulture);
return ResourceManager.GetString("ParticipantManualAddWelcome_NoExpiry_Body", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to [[OrganizationName]] Welcome to [OrganizationName]!.
/// </summary>
internal static string ParticipantManualAddWelcomeNoExpiry_Subject {
internal static string ParticipantManualAddWelcome_NoExpiry_Subject {
get {
return ResourceManager.GetString("ParticipantManualAddWelcomeNoExpiry_Subject", resourceCulture);
return ResourceManager.GetString("ParticipantManualAddWelcome_NoExpiry_Subject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to [[OrganizationName]] Welcome to [OrganizationName]!.
/// </summary>
internal static string ParticipantManualAddWelcome_Subject {
get {
return ResourceManager.GetString("ParticipantManualAddWelcome_Subject", resourceCulture);
}
}
}
@@ -132,23 +132,6 @@ Welcome as [Aspirant] and we hope to see you as a [Regular] soon!</value>
<data name="AspirantAddWelcome_Subject" xml:space="preserve">
<value>[[OrganizationName]] Welcome as [Aspirant] to [OrganizationName]!</value>
</data>
<data name="ParticipantManualAddWelcomeNoExpiry_Body" xml:space="preserve">
<value>Welcome to [OrganizationName]!
You have been granted a [Regularship] by [ActingPerson]. It does not expire automatically by any particular time or date, so there's no rush to take action.
You should already have been contacted by people from [OrganizationName] for more information on how to get active. If not, then expect correspondence soon.
Your initial and randomly generated password to Swarmops, the software used as a back-end system, is as follows:
[RandomPassword]
You should log on and change this password to something more secure of your own choosing as soon as possible. You do so by logging on at [ExternalUrl] , and then clicking the "User" icon in the top right corner, selecting the Security tab (the one with the padlock), entering this temporary password, and then writing your new one. You should also consider enabling two-factor authentication, just as a good practice.
Welcome aboard!</value>
</data>
<data name="ParticipantManualAddWelcomeNoExpiry_Subject" xml:space="preserve">
<value>[[OrganizationName]] Welcome to [OrganizationName]!</value>
</data>
<data name="ParticipantManualAddWelcome_Body" xml:space="preserve">
<value>Welcome to [OrganizationName]!
@@ -163,6 +146,23 @@ You should log on and change this password to something more secure of your own
Welcome aboard!</value>
</data>
<data name="ParticipantManualAddWelcome_NoExpiry_Body" xml:space="preserve">
<value>Welcome to [OrganizationName]!
You have been granted a [Regularship] by [ActingPerson]. It does not expire automatically by any particular time or date, so there's no rush to take action.
You should already have been contacted by people from [OrganizationName] for more information on how to get active. If not, then expect correspondence soon.
Your initial and randomly generated password to Swarmops, the software used as a back-end system, is as follows:
[RandomPassword]
You should log on and change this password to something more secure of your own choosing as soon as possible. You do so by logging on at [ExternalUrl] , and then clicking the "User" icon in the top right corner, selecting the Security tab (the one with the padlock), entering this temporary password, and then writing your new one. You should also consider enabling two-factor authentication, just as a good practice.
Welcome aboard!</value>
</data>
<data name="ParticipantManualAddWelcome_NoExpiry_Subject" xml:space="preserve">
<value>[[OrganizationName]] Welcome to [OrganizationName]!</value>
</data>
<data name="ParticipantManualAddWelcome_Subject" xml:space="preserve">
<value>[[OrganizationName]] Welcome to [OrganizationName]!</value>
</data>
+18
View File
@@ -303,6 +303,24 @@ namespace Swarmops.Logic.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to First Gentleman.
/// </summary>
internal static string Position_Executive_FirstGentleman {
get {
return ResourceManager.GetString("Position_Executive_FirstGentleman", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to First Lady.
/// </summary>
internal static string Position_Executive_FirstLady {
get {
return ResourceManager.GetString("Position_Executive_FirstLady", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Human Resources Assistant.
/// </summary>
@@ -198,6 +198,14 @@
<data name="Position_Executive_ChiefTechnologyOfficer" xml:space="preserve">
<value>Chief Technology Officer</value>
</data>
<data name="Position_Executive_FirstGentleman" xml:space="preserve">
<value>First Gentleman</value>
<comment>For government-type organizations only, with a female President</comment>
</data>
<data name="Position_Executive_FirstLady" xml:space="preserve">
<value>First Lady</value>
<comment>For government-type organizations only</comment>
</data>
<data name="Position_Executive_HrAssistant" xml:space="preserve">
<value>Human Resources Assistant</value>
</data>
+15 -1
View File
@@ -1,3 +1,4 @@
using System;
using Swarmops.Common.Enums;
using Swarmops.Logic.Support;
@@ -149,7 +150,7 @@ namespace Swarmops.Logic.Structure
public string ParticipationDuration
{
get { return this.data.GetOptionalDataString(ObjectOptionalDataType.OrgParticipationDuration); }
get { return CustomOrDefault(this.data.GetOptionalDataString(ObjectOptionalDataType.OrgParticipationDuration), "12"); }
set { this.data.SetOptionalDataString(ObjectOptionalDataType.OrgParticipationDuration, value); }
}
public string ParticipationAcceptedMail
@@ -182,5 +183,18 @@ namespace Swarmops.Logic.Structure
get { return this.data.GetOptionalDataInt(ObjectOptionalDataType.OrgApplicationQualifyingScore); }
set { this.data.SetOptionalDataInt(ObjectOptionalDataType.OrgApplicationQualifyingScore, value); }
}
private string CustomOrDefault(string customString, string defaultString)
{
if (String.IsNullOrEmpty(customString.Trim()))
{
return defaultString;
}
return customString; // not trimmed, on purpose
}
}
}
+9
View File
@@ -1059,6 +1059,15 @@ namespace Resources {
}
}
/// <summary>
/// Looks up a localized string similar to You are entering the &lt;strong&gt;Sandbox&lt;/strong&gt; organization.&lt;br/&gt;&lt;br/&gt;This is a safe environment where you can play around with Swarmops without risking any damage to production data. Have fun all you want, and return to your production environment when you&apos;re done experimenting..
/// </summary>
internal static string Global_EnteringSandbox {
get {
return ResourceManager.GetString("Global_EnteringSandbox", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to connect WebSocket. Live updates will not be available..
/// </summary>
+3
View File
@@ -985,4 +985,7 @@
<data name="Financial_GeneralLedger" xml:space="preserve">
<value>General Ledger</value>
</data>
<data name="Global_EnteringSandbox" xml:space="preserve">
<value>You are entering the &lt;strong&gt;Sandbox&lt;/strong&gt; organization.&lt;br/&gt;&lt;br/&gt;This is a safe environment where you can play around with Swarmops without risking any damage to production data. Have fun all you want, and return to your production environment when you're done experimenting.</value>
</data>
</root>
@@ -34,6 +34,13 @@ namespace Swarmops.Frontend.Automation
bitcoinAddress = bitcoinAddress.Replace (" ", string.Empty);
// Remove a possible start of "bitcoincash:"
if (bitcoinAddress.StartsWith("bitcoincash:"))
{
bitcoinAddress = bitcoinAddress.Substring("bitcoincash:".Length);
}
if (string.IsNullOrEmpty (authData.CurrentUser.BitcoinPayoutAddress))
{
if (!BitcoinUtility.IsValidBitcoinAddress (bitcoinAddress))
+1 -1
View File
@@ -782,7 +782,7 @@ namespace Swarmops.Frontend.Pages.v5.Public
string.Empty, string.Empty, new DateTime(1972,1,21), PersonGender.Unknown);
// Add membership in Sandbox
newPerson.AddParticipation(Organization.Sandbox, DateTime.UtcNow.AddYears(25));
newPerson.AddParticipation(Organization.Sandbox, Constants.DateTimeHigh); // expires never
// Initialize staffing to System and Sandbox with the new user
Positions.CreateSysadminPositions();
@@ -2,8 +2,10 @@
using System.Globalization;
using System.Web;
using System.Web.Security;
using Swarmops.Common;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Swarm;
namespace Swarmops.Frontend.Pages.v5.Security
{
@@ -31,7 +33,14 @@ namespace Swarmops.Frontend.Pages.v5.Security
suggestedOrganization = null;
}
if (suggestedOrganization == null || !CurrentUser.ParticipatesInOrganization (suggestedOrganization))
if (suggestedOrganization.Identity == Organization.SandboxIdentity &&
!CurrentUser.ParticipatesInOrganization(suggestedOrganization))
{
// Add a forever participation in Sandbox
Participation.Create(CurrentUser, Organization.Sandbox, Constants.DateTimeHigh);
}
else if (suggestedOrganization == null || !CurrentUser.ParticipatesInOrganization (suggestedOrganization))
{
// Some work here on PPSE pilot - we want everybody to be able to switch to Sandbox, which is #1
// except for in PPSE installation, where it is... #3 or something
@@ -51,6 +60,10 @@ namespace Swarmops.Frontend.Pages.v5.Security
newAuthority.SetOrganization (suggestedOrganization); // will/can also modify Position
CurrentUser.LastLogonOrganizationId = suggestedOrganization.Identity;
// Set a dashboard message that the user is now working in Sandbox
Response.SetCookie(new HttpCookie("DashboardMessage", Resources.Global.Global_EnteringSandbox);
if (!string.IsNullOrEmpty (returnUrlString))
{
FormsAuthentication.SetAuthCookie (newAuthority.ToEncryptedXml(), true);
+13 -2
View File
@@ -4,6 +4,7 @@ using System.Runtime.Versioning;
using System.Web.UI;
using System.Web.UI.WebControls;
using Resources;
using Swarmops.Common;
using Swarmops.Common.Enums;
using Swarmops.Logic.Communications;
using Swarmops.Logic.Communications.Payload;
@@ -108,9 +109,19 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
street, this.TextPostal.Text, this.TextCity.Text, this.DropCountries.SelectedValue, dateOfBirth,
(PersonGender)Enum.Parse(typeof(PersonGender), this.DropGenders.SelectedValue));
Participation newParticipation = Participation.Create (newPerson, CurrentOrganization, DateTime.Today.AddYears (1));
DateTime participationExpiry = Constants.DateTimeHigh;
ParticipantMailType welcomeMailType = ParticipantMailType.ParticipantAddedWelcome_NoExpiry;
OutboundComm.CreateParticipantMail (ParticipantMailType.ParticipantAddedWelcome, newParticipation, CurrentUser);
int participationDurationMonths = Int32.Parse(CurrentOrganization.Parameters.ParticipationDuration);
if (participationDurationMonths < 1000)
{
participationExpiry = DateTime.Today.AddMonths(participationDurationMonths);
welcomeMailType = ParticipantMailType.ParticipantAddedWelcome;
}
Participation newParticipation = Participation.Create (newPerson, CurrentOrganization, participationExpiry);
OutboundComm.CreateParticipantMail (welcomeMailType, newParticipation, CurrentUser);
newPerson.LastLogonOrganizationId = CurrentOrganization.Identity;
@@ -75,7 +75,7 @@ namespace Swarmops.Frontend.Pages.Swarm
person.Identity,
JsonSanitize (person.Canonical),
person.GetSecureAvatarLink (16),
JsonSanitize (person.Geography.Name),
JsonSanitize (person.Geography.Localized),
JsonSanitize (person.Mail),
JsonSanitize (person.Phone),
JsonSanitize(notes)) + "," +