();
- foreach (string personLabel in this._personLabels)
+ foreach (ParticipantTitle title in (ParticipantTitle[]) Enum.GetValues(typeof(ParticipantTitle)))
{
string localizedPersonLabel =
- Resources.Global.ResourceManager.GetString("Title_" + personLabel + "_Plural");
+ Participant.Localized(title, TitleVariant.Plural);
- localizedPersonLabels.Add(localizedPersonLabel + "|" + personLabel);
+ localizedPersonLabels.Add(localizedPersonLabel + "|" + title.ToString());
}
localizedPersonLabels.Sort(); // Sorts _localized_
@@ -98,7 +92,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
protected void ButtonCreate_Click(object sender, EventArgs e)
{
string activistLabel = this.DropActivistLabel.SelectedValue;
- string peopleLabel = this.DropPersonLabel.SelectedValue;
+ ParticipantTitle peopleLabel = (ParticipantTitle)(Enum.Parse(typeof(ParticipantTitle),this.DropPersonLabel.SelectedValue));
string asRoot = this.DropCreateChild.SelectedValue;
string currencyCode = this.DropCurrencies.SelectedValue;
string newOrgName = this.TextOrganizationName.Text;
@@ -108,7 +102,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
throw new ArgumentException("Organization name can't be empty");
}
- if (activistLabel == "0" || peopleLabel == "0" || asRoot == "0" || currencyCode == "0")
+ if (activistLabel == "0" || peopleLabel == ParticipantTitle.Unknown || asRoot == "0" || currencyCode == "0")
{
throw new ArgumentException("Necessary argument was not supplied (did client-side validation run?)");
}
@@ -130,8 +124,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
Membership.Create(CurrentUser, newOrganization, DateTime.UtcNow.AddYears(2));
- string successMessage = String.Format(Resources.Pages.Admin.CreateOrganization_Success,
- Resources.Global.ResourceManager.GetString("Title_" + peopleLabel + "_Ship"));
+ string successMessage = String.Format (Resources.Pages.Admin.CreateOrganization_Success,
+ Participant.Localized (peopleLabel, TitleVariant.Ship));
Response.AppendCookie(new HttpCookie("DashboardMessage", HttpUtility.UrlEncode(successMessage)));
diff --git a/Site5/Pages/v5/Admin/EditOrganization.aspx.cs b/Site5/Pages/v5/Admin/EditOrganization.aspx.cs
index 544e61e7..cb17d473 100644
--- a/Site5/Pages/v5/Admin/EditOrganization.aspx.cs
+++ b/Site5/Pages/v5/Admin/EditOrganization.aspx.cs
@@ -5,6 +5,7 @@ using Swarmops.Basic.Enums;
using Swarmops.Logic.Financial;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
+using Swarmops.Logic.Swarm;
namespace Swarmops.Frontend.Pages.v5.Admin
{
@@ -30,10 +31,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
private void Localize()
{
- string participants =
- Resources.Global.ResourceManager.GetString("Title_" + CurrentOrganization.RegularLabel + "_Plural");
- string participantship =
- Resources.Global.ResourceManager.GetString("Title_" + CurrentOrganization.RegularLabel + "_Ship");
+ string participants = Participant.Localized (CurrentOrganization.RegularLabel, TitleVariant.Plural);
+ string participantship = Participant.Localized (CurrentOrganization.RegularLabel, TitleVariant.Ship);
this.LabelParticipationEntry.Text =
String.Format(Resources.Pages.Admin.EditOrganization_ParticipationBeginsWhen, participants);
@@ -72,8 +71,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
this.DropMembersWhere.Items.Add(new ListItem("All applicable organizations", "All"));
this.DropMembershipDuration.Items.Clear();
- this.DropMembershipDuration.Items.Add(new ListItem("One month", "Month"));
- this.DropMembershipDuration.Items.Add(new ListItem("One year", "Year"));
+ this.DropMembershipDuration.Items.Add(new ListItem("One month", "OneMonth"));
+ this.DropMembershipDuration.Items.Add(new ListItem("One year", "OneYear"));
this.DropMembershipDuration.Items.Add(new ListItem("Two years", "TwoYears"));
this.DropMembershipDuration.Items.Add(new ListItem("Five years", "FiveYears"));
this.DropMembershipDuration.Items.Add(new ListItem("Forever", "Forever"));
diff --git a/Site5/Pages/v5/Swarm/AddPerson.aspx b/Site5/Pages/v5/Swarm/AddPerson.aspx
index 2d593aa7..501f90da 100644
--- a/Site5/Pages/v5/Swarm/AddPerson.aspx
+++ b/Site5/Pages/v5/Swarm/AddPerson.aspx
@@ -16,6 +16,10 @@
$('#<%=this.TextCity.ClientID%>').on('input', function () {
CheckPostalCity();
});
+
+ if (onDocReadyAlert.length > 0) {
+ alertify.log(onDocReadyAlert);
+ }
});
function CheckPostalCity() {
@@ -128,10 +132,10 @@
function ValidateFields() {
var isValid = true;
- isValid = validateTextField('#<%=this.TextName.ClientID %>', '') && isValid;
- isValid = validateTextField('#<%=this.TextMail.ClientID %>', '') && isValid;
- isValid = validateTextField('#<%=this.TextStreet1.ClientID %>', '') && isValid;
- isValid = validateTextField('#<%=this.TextCity.ClientID %>', '') && isValid;
+ isValid = ValidateTextField('#<%=this.TextCity.ClientID %>', "") && isValid;
+ isValid = ValidateTextField('#<%=this.TextStreet1.ClientID %>', "") && isValid;
+ isValid = ValidateTextField('#<%=this.TextMail.ClientID %>', "") && isValid;
+ isValid = ValidateTextField('#<%=this.TextName.ClientID %>', "") && isValid;
// TODO: Actually validate geography?
@@ -139,6 +143,7 @@
}
function ValidateTextField(fieldId, message) {
+ $(fieldId).removeClass("entryError");
if ($(fieldId).val().length == 0) {
alertify.error(message);
$(fieldId).addClass("entryError");
@@ -158,6 +163,8 @@
var postalCodeVisible = true;
var postalCodeIdentified = false;
+ var onDocReadyAlert = '';
+
@@ -176,8 +183,6 @@
-
-
@@ -193,9 +198,8 @@
STATISTICAL DATA
Date of Birth
Legal gender
- SIGNING UP AS
- [Regular] until
+
diff --git a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs
index e2829317..3199906d 100644
--- a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs
+++ b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs
@@ -2,7 +2,9 @@
using System.Web.UI;
using System.Web.UI.WebControls;
using Resources;
+using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
+using Swarmops.Logic.Swarm;
// ReSharper disable once CheckNamespace
@@ -53,17 +55,20 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
this.DropGenders.Items.Add(new ListItem(Global.Global_UnknownUndisclosed, "Unknown"));
this.DropGenders.Items.Add(new ListItem(Global.Global_Female, "Female"));
this.DropGenders.Items.Add(new ListItem(Global.Global_Male, "Male"));
-
- this.LabelExpiry.Text = DateTime.Today.AddYears(1).ToString(Global.Global_LongDateFormatSansWeekday);
}
private void Localize()
{
- // TODO
+ this.LiteralErrorCity.Text = Resources.Pages.Swarm.AddPerson_ErrorCity;
+ this.LiteralErrorMail.Text = Resources.Pages.Swarm.AddPerson_ErrorMail;
+ this.LiteralErrorName.Text = Resources.Pages.Swarm.AddPerson_ErrorName;
+ this.LiteralErrorStreet.Text = Resources.Pages.Swarm.AddPerson_ErrorStreet;
- InfoBoxLiteral = Resources.Pages.Swarm.AddPerson_Info;
+ InfoBoxLiteral = String.Format(Resources.Pages.Swarm.AddPerson_Info, Global.Timespan_OneYear,
+ Participant.Localized (CurrentOrganization.RegularLabel, TitleVariant.Ship),
+ DateTime.Today.AddYears(1).ToLongDateString());
- this.TextDateOfBirth.Attributes["placeholder"] = Global.Global_DateFormatShort;
+ this.TextDateOfBirth.Attributes["placeholder"] = Global.Global_DateFormatShortReadable;
this.TextName.Attributes["placeholder"] = "Joe Smith";
this.TextMail.Attributes["placeholder"] = "joe@example.com";
this.TextPhone.Attributes["placeholder"] = "+1 263 151 1341";
@@ -73,11 +78,33 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
- // Register user
+ string randomPassword = Authentication.CreateRandomPassword(24);
+
+
+
+ // Person.Create()
// Send notify
+ // "Welcome to Swarmops. Your password is:\r\n\r\n" + randomPassword;
+
// Send password in mail
+
+
+ // Clear form and make way for next person
+
+ this.TextName.Text = string.Empty;
+ this.TextStreet1.Text = string.Empty;
+ this.TextStreet2.Text = string.Empty;
+ this.TextMail.Text = string.Empty;
+ this.TextPhone.Text = string.Empty;
+ this.TextPostal.Text = string.Empty;
+ this.TextCity.Text = string.Empty;
+ this.TextDateOfBirth.Text = string.Empty;
+ this.DropGenders.SelectedValue = "Unknown";
+
+ this.TextName.Focus();
+ this.LiteralLoadAlert.Text = Resources.Pages.Swarm.AddPerson_PersonSuccessfullyRegistered;
}
}
}
\ No newline at end of file
diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs
index f9f88f0d..413e4667 100644
--- a/Site5/Security/Login.aspx.cs
+++ b/Site5/Security/Login.aspx.cs
@@ -268,7 +268,7 @@ namespace Swarmops.Pages.Security
private void Localize()
{
this.LabelCurrentOrganizationName.Text = Resources.Global.Global_Organization;
- this.LabelCurrentUserName.Text = Resources.Global.Title_Person_Generic;
+ this.LabelCurrentUserName.Text = Participant.Localized (ParticipantTitle.Person, TitleVariant.Generic);
this.LabelPageTitle.Text = Resources.Pages.Security.Login_PageTitle;
this.LabelPreferences.Text = Resources.Global.Global_NA;
this.LabelSidebarInfoHeader.Text = Resources.Global.Sidebar_Information;