Checkpoint for Add Person

This commit is contained in:
Rick Falkvinge
2014-12-04 17:57:55 +01:00
parent 215cb44a1c
commit ff752d5e14
5 changed files with 74 additions and 16 deletions
+4
View File
@@ -824,4 +824,8 @@
<value>MM/DD/YYYY</value>
<comment>Adapt format for culture, then translate to human-readability, not machine-readability. E.g. ÅÅÅÅ-MM-DD for Swedish.</comment>
</data>
<data name="Global_LongDateFormatSansWeekday" xml:space="preserve">
<value>MMM d, YYYY</value>
<comment>Convert the formatting only - this is machine interpreted. Example: "December 23, 1921".</comment>
</data>
</root>
@@ -117,6 +117,22 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AddPerson_ErrorCity" xml:space="preserve">
<value>A valid city is required.</value>
</data>
<data name="AddPerson_ErrorMail" xml:space="preserve">
<value>A valid email is required.</value>
</data>
<data name="AddPerson_ErrorName" xml:space="preserve">
<value>A name is required.</value>
</data>
<data name="AddPerson_ErrorStreet" xml:space="preserve">
<value>A valid street or P.O. box is required.</value>
</data>
<data name="AddPerson_Info" xml:space="preserve">
<value>This is where you enter new people into the organization. As you register them for a {0} {1}, they will receive a welcome message with a randomized login password in mail. The local officers will also be notified of the new person, for an opportunity to send them a welcome message.</value>
<comment>{0} and {1} can be "one-year" and "Membership", for example</comment>
</data>
<data name="AddPerson_Title" xml:space="preserve">
<value>Add [Regular]</value>
<comment>The [Regular] is replaced in code. Singular form gender neutral.</comment>
+31 -4
View File
@@ -59,6 +59,7 @@
setTimeout(function() {
$('#<%=this.TextPostal.ClientID%>').fadeIn(200);
}, 100);
$('#spanLabelPostal').animate({ width: 'toggle' }, 400);
postalCodeVisible = true;
}
@@ -67,6 +68,7 @@
$('#<%=this.TextPostal.ClientID%>').animate({ width: 0 }, 200).fadeOut(100);
$('#<%=this.TextCity.ClientID%>').animate({ width: "255px" }, 600);
$('#spanLabelPostal').animate({ width: 'toggle' }, 400);
postalCodeVisible = false;
}
@@ -96,7 +98,7 @@
postalCodeLength = msg.d.PostalCodeLength;
postalCodeLengthCheck = msg.d.PostalCodeLengthCheck;
$('#<%=TextPostal.ClientID%>').attr('maxlength', postalCodeLength);
$('#<%=TextPostal.ClientID%>').attr('maxlength', postalCodeLength).attr('placeholder', '12345678'.substring(0, postalCodeLength));
msg.d.PostalCodes.forEach(function (element, index, array) {
postalCodeLookup[element.Code.toLowerCase()] = element.CityId;
});
@@ -123,6 +125,30 @@
});
}
function ValidateFields() {
var isValid = true;
isValid = validateTextField('#<%=this.TextName.ClientID %>', '<asp:Literal runat="server" ID="LiteralErrorName" />') && isValid;
isValid = validateTextField('#<%=this.TextMail.ClientID %>', '<asp:Literal runat="server" ID="LiteralErrorMail" />') && isValid;
isValid = validateTextField('#<%=this.TextStreet1.ClientID %>', '<asp:Literal runat="server" ID="LiteralErrorStreet" />') && isValid;
isValid = validateTextField('#<%=this.TextCity.ClientID %>', '<asp:Literal runat="server" ID="LiteralErrorCity" />') && isValid;
// TODO: Actually validate geography?
return isValid;
}
function ValidateTextField(fieldId, message) {
if ($(fieldId).val().length == 0) {
alertify.error(message);
$(fieldId).addClass("entryError");
$(fieldId).focus();
return false;
}
return true;
}
var postalCodeLookup = {};
var cityIdLookup = {};
var cityNameLookup = {};
@@ -152,6 +178,7 @@
<Swarmops5:DropDown runat="server" ID="DropGenders" />&#8203;<br/>
&nbsp;<br/>
<asp:Label ID="LabelExpiry" runat="server" Text="YYYY-MM-DD" />&#8203;<br/>
<asp:Button ID="ButtonSubmit" runat="server" CssClass="buttonAccentColor NoInputFocus" OnClientClick="return ValidateFields();" OnClick="ButtonSubmit_Click" Text="Register"/>
</div>
<div class="entryLabels">
Name<br />
@@ -159,9 +186,9 @@
Mail<br />
Phone<br />
<h2>ADDRESS</h2>
Street 1<br />
Street 2<br />
<span id="spanLabelPostal">Postal Code, </span>City<br />
Street 1 or P.O.<br />
Street 2 (optional)<br />
<span id="spanLabelPostal" style="display:inline-block; overflow: hidden">Postal Code,&nbsp;</span><span style="display:inline-block; overflow: hidden">City</span><br />
<span id="SpanGeoDetected">Geography detected</span><span id="SpanGeoSelect" style="display:none">Select Geograhpy</span><br />
<h2>STATISTICAL DATA</h2>
Date of Birth<br />
+22 -11
View File
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Resources;
using Resources.Pages;
using Swarmops.Logic.Structure;
// ReSharper disable once CheckNamespace
namespace Swarmops.Frontend.Pages.v5.Swarm
{
public partial class AddPerson : PageV5Base
@@ -37,7 +37,7 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
foreach (Country country in allCountries)
{
string countryLocalName = Resources.GeographyNames.ResourceManager.GetString("Country_" + country.Code);
string countryLocalName = GeographyNames.ResourceManager.GetString("Country_" + country.Code);
if (string.IsNullOrEmpty(countryLocalName))
{
countryLocalName = country.Name + "*"; // In English. Asterisk indicates resource missing.
@@ -52,23 +52,34 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
}
this.DropGenders.Items.Clear();
this.DropGenders.Items.Add(new ListItem(Resources.Global.Global_UnknownUndisclosed, "Unknown"));
this.DropGenders.Items.Add(new ListItem(Resources.Global.Global_Female, "Female"));
this.DropGenders.Items.Add(new ListItem(Resources.Global.Global_Male, "Male"));
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.InfoBoxLiteral = "<strong>Work in progress</strong>";
this.InfoBoxLiteral = People.AddPerson_Info;
this.TextDateOfBirth.Attributes["placeholder"] = Resources.Global.Global_DateFormatShort;
this.TextDateOfBirth.Attributes["placeholder"] = Global.Global_DateFormatShort;
this.TextName.Attributes["placeholder"] = "Joe Smith";
this.TextMail.Attributes["placeholder"] = "joe@example.com";
this.TextPhone.Attributes["placeholder"] = "+1 263 151 1341";
this.TextStreet1.Attributes["placeholder"] = "78 West Avenue";
this.TextPostal.Attributes["placeholder"] = "123456";
this.TextPostal.Attributes["placeholder"] = "12345";
}
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
// Register user
// Send notify
// Send password in mail
}
}
}
+1 -1
View File
@@ -83,7 +83,7 @@ namespace Swarmops.Pages.Security
{
Response.AppendCookie(new HttpCookie("DashboardMessage",
HttpUtility.UrlEncode(
"<p>You have been logged on as <strong>Sandbox Administrator</strong> to the Swarmops Development Sandbox.</p><br/><p>This machine runs the latest development build, so you may run into diagnostic code and half-finished features. All data here is bogus test data and is reset every night.</p><br/><p><strong>In other words, welcome, and play away!</strong></p><br/><br/>")));
"<p>You have been logged on as <strong>Sandbox Administrator</strong> to the Swarmops Development Sandbox.</p><br/><p>This machine runs the latest development build, so you may run into diagnostic code and half-finished features. All data here is bogus test data and is reset every night.</p><br/><p><strong>In other words, welcome, and play away!</strong></p>")));
FormsAuthentication.RedirectFromLoginPage("1,1", true);
}