More work on self-signup

This commit is contained in:
Rick Falkvinge
2015-05-09 16:57:37 +02:00
parent ae2dd041c6
commit 54149d534a
8 changed files with 595 additions and 73 deletions
+2
View File
@@ -181,6 +181,8 @@ namespace Swarmops.Logic.Swarm
public void Terminate (EventSource eventSource, Person actingPerson, string description)
{
// TODO: This needs a new overload for v5, which adds the Position and possibly removes the EventSource
if (base.Active)
{
+7
View File
@@ -1,5 +1,7 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json.Converters;
namespace Swarmops.Frontend.Controls.v5.Base
{
@@ -24,6 +26,11 @@ namespace Swarmops.Frontend.Controls.v5.Base
get { return this.ClientID + "_DropControl"; }
}
public DropDownList ClientControl
{
get { return this.DropControl; }
}
protected void Page_Load (object sender, EventArgs e)
{
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

+2 -1
View File
@@ -42,7 +42,8 @@
<ResourceKey>People_SelfSignup</ResourceKey>
<UserLevel>2</UserLevel>
<Permissions />
<Type>SpecialSelfSignup</Type>
<ImageUrl>iconshock-database-star</ImageUrl>
<Type>SpecialSelfSignup</Type>
<Children />
</MainMenuItem>
@@ -0,0 +1,187 @@
 <script type="text/javascript" language="javascript">
// This code is common to Swarm/AddPerson and to Signup, so it's placed in a separate file,
// which is server-side-included by both functionalities. It can also be included by
// plugins which wish to save on this particular work, as it's located in the Public
// folder.
$(document).ready(function() {
UpdatePostalPrefix('XX', $('#<%= DropCountries.ClientControlID %>').val());
$('#<%= TextPostal.ClientID %>').on('input', function() {
if (CheckPostalCode()) {
if ($('#<%= TextPostal.ClientID %>').val().length == postalCodeLength) {
$('#<%= TextDateOfBirth.ClientID %>').focus();
}
}
});
$('#<%= TextCity.ClientID %>').on('input', function() {
CheckPostalCity();
});
});
function CheckPostalCity() {
var currentCity = $('#<%= TextCity.ClientID %>').val().toLowerCase();
if (currentCity in cityNameLookup) {
var geoId = cityNameLookup[currentCity];
$('#spanDetectedGeo').text(geographyIdLookup[geoId]);
} else {
$('#spanDetectedGeo').text('');
}
}
function CheckPostalCode() {
var currentPostalCode = $('#<%= TextPostal.ClientID %>').val().toLowerCase();
if (currentPostalCode.length > postalCodeLengthCheck) {
currentPostalCode = currentPostalCode.substring(0, postalCodeLengthCheck);
}
if (currentPostalCode in postalCodeLookup) {
var cityId = postalCodeLookup[currentPostalCode];
$('#<%= TextCity.ClientID %>').attr("disabled", "disabled").val(cityIdLookup[cityId].Name);
$('#spanDetectedGeo').text(geographyIdLookup[cityIdLookup[cityId].GeoId]);
postalCodeIdentified = true;
return true;
} else if (postalCodeIdentified) {
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
$('#spanDetectedGeo').text('');
postalCodeIdentified = false;
}
return false;
}
function AnimatePostalCodeLength() {
if (postalCodeLength > 0) {
var postalTargetLength = postalCodeLength * 15 - 5;
var cityTargetLength = 235 - 15 * postalCodeLength;
$('#<%= TextPostal.ClientID %>').animate({ width: postalTargetLength + "px" });
$('#<%= TextCity.ClientID %>').animate({ width: cityTargetLength + "px" });
if (!postalCodeVisible) {
setTimeout(function() {
$('#<%= TextPostal.ClientID %>').fadeIn(200);
}, 100);
$('#spanLabelPostal').animate({ width: 'toggle' }, 400);
postalCodeVisible = true;
}
} else if (postalCodeVisible) {
// Remove postal code altogether, if visible now
$('#<%= TextPostal.ClientID %>').animate({ width: 0 }, 200).fadeOut(100);
$('#<%= TextCity.ClientID %>').animate({ width: "255px" }, 600);
$('#spanLabelPostal').animate({ width: 'toggle' }, 400);
postalCodeVisible = false;
}
}
function UpdatePostalPrefix(oldValue, newValue) {
$('#spanCountryPrefix').text(newValue);
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
$('#spanDetectedGeo').text('');
// Get postal code data for country. Heavy op; should not be done from mobile
var jsonData = {};
jsonData.countryCode = newValue;
$.ajax({
type: "POST",
url: "/Automation/FieldValidation.aspx/GetPostalCodesCities",
data: $.toJSON(jsonData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
postalCodeLookup = {};
cityIdLookup = {};
cityNameLookup = {};
geographyIdLookup = {};
postalCodeLength = msg.d.PostalCodeLength;
postalCodeLengthCheck = msg.d.PostalCodeLengthCheck;
$('#<%= 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;
});
msg.d.CityNames.forEach(function(element, index, array) {
cityIdLookup[element.Id] = {};
cityIdLookup[element.Id].Name = element.Name;
cityIdLookup[element.Id].GeoId = element.GeographyId;
cityNameLookup[element.Name.toLowerCase()] = element.GeographyId;
});
msg.d.Geographies.forEach(function(element, index, array) {
geographyIdLookup[element.Id] = element.Name;
});
AnimatePostalCodeLength();
CheckPostalCode();
},
error: function(msg) {
console.log(msg);
geographyIdLookup = {};
postalCodeLookup = {};
cityIdLookup = {};
cityNameLookup = {};
}
});
}
function ValidateFields() {
var isValid = true;
var dateFieldContents = $('#<%= TextDateOfBirth.ClientID%>').val();
if (dateFieldContents.length > 0) {
var jsonData = {};
jsonData.input = dateFieldContents;
$.ajax({
type: "POST",
url: "/Automation/FieldValidation.aspx/IsDateValid",
data: $.toJSON(jsonData),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false, // blocks until function returns - race conditions otherwise
success: function (msg) {
if (msg.d != true) {
isValid = false;
$('#<%= TextDateOfBirth.ClientID %>').addClass("entryError");
alertify.error("<asp:Literal runat="server" ID="LiteralErrorDate" />");
$('#<%=this.TextDateOfBirth.ClientID %>').focus();
}
}
});
}
isValid = ValidateTextField('#<%= TextCity.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorCity" />") && isValid;
isValid = ValidateTextField('#<%= TextStreet1.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorStreet" />") && isValid;
isValid = ValidateTextField('#<%= TextMail.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorMail" />") && isValid;
isValid = ValidateTextField('#<%= TextName.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorName" />") && isValid; // TODO: Actually validate geography?
return isValid;
}
function ValidateTextField(fieldId, message) {
$(fieldId).removeClass("entryError");
if ($(fieldId).val().length == 0) {
alertify.error(message);
$(fieldId).addClass("entryError");
$(fieldId).focus();
return false;
}
return true;
}
var postalCodeLookup = {};
var cityIdLookup = {};
var cityNameLookup = {};
var geographyIdLookup = {};
var postalCodeLength = 0;
var postalCodeLengthCheck = 0;
var postalCodeVisible = true;
var postalCodeIdentified = false;
</script>
+300 -53
View File
@@ -11,6 +11,7 @@
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript" src="/Scripts/jquery.leanModal.min.js" ></script>
<script language="javascript" type="text/javascript" src="/Scripts/jquery.smartWizard-2.0.min.js"></script>
<script language="javascript" type="text/javascript" src="/Scripts/alertify.min.js"></script>
<script language="javascript" type="text/javascript" src="/Scripts/jquery.json.min.js"></script>
<!-- fonts -->
@@ -22,6 +23,8 @@
<title><%=Organization.Name %> - Signup</title>
<link href="/Style/style-v5.css" rel="stylesheet" type="text/css" />
<link href="/Style/alertify.core.css" rel="stylesheet" type="text/css" />
<link href="/Style/alertify.default.css" rel="stylesheet" type="text/css" />
<link href="WizardStyle.css" rel="stylesheet" type="text/css" />
<!-- initialize all modal popups -->
@@ -47,6 +50,25 @@
font-size: 200%;
text-align: center;
}
.swMain {
height: 420px !important;
}
.stepContainer {
height: 380px !important;
}
div.stepContainer > div.content {
overflow: initial !important;
}
.entryLabelsAdmin {
width: 280px;
}
</style>
</head>
@@ -54,79 +76,274 @@
<form id="form2" runat="server">
<asp:ScriptManager runat="server" ID="ScriptManagerBlahblah" />
<script type="text/javascript">
// Functions copied from Swarm / Add Person and adapted. It would be nice if this could be reconciled to one source,
// but ASP.Net server-side includes don't work well, and a JavaScript include isn't compatible with the
// ASP.Net inline evaluations.
$(document).ready(function () {
UpdatePostalPrefix('XX', $('#<%= DropCountries.ClientID %>').val());
$('#<%= TextPostal.ClientID %>').on('input', function () {
if (CheckPostalCode()) {
if ($('#<%= TextPostal.ClientID %>').val().length == postalCodeLength) {
$('#<%= TextDateOfBirth.ClientID %>').focus();
}
}
});
$('#<%= TextCity.ClientID %>').on('input', function () {
CheckPostalCity();
});
});
function CheckPostalCity() {
var currentCity = $('#<%= TextCity.ClientID %>').val().toLowerCase();
if (currentCity in cityNameLookup) {
var geoId = cityNameLookup[currentCity];
$('#spanDetectedGeo').text(geographyIdLookup[geoId]);
} else {
$('#spanDetectedGeo').text('');
}
}
function CheckPostalCode() {
var currentPostalCode = $('#<%= TextPostal.ClientID %>').val().toLowerCase();
if (currentPostalCode.length > postalCodeLengthCheck) {
currentPostalCode = currentPostalCode.substring(0, postalCodeLengthCheck);
}
if (currentPostalCode in postalCodeLookup) {
var cityId = postalCodeLookup[currentPostalCode];
$('#<%= TextCity.ClientID %>').attr("disabled", "disabled").val(cityIdLookup[cityId].Name);
$('#spanDetectedGeo').text(geographyIdLookup[cityIdLookup[cityId].GeoId]);
postalCodeIdentified = true;
return true;
} else if (postalCodeIdentified) {
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
$('#spanDetectedGeo').text('');
postalCodeIdentified = false;
}
return false;
}
function AnimatePostalCodeLength() {
if (postalCodeLength > 0) {
var postalTargetLength = postalCodeLength * 8 - 5;
var cityTargetLength = 135 - 8 * postalCodeLength;
$('#<%= TextPostal.ClientID %>').animate({ width: postalTargetLength + "px" });
$('#<%= TextCity.ClientID %>').animate({ width: cityTargetLength + "px" });
if (!postalCodeVisible) {
setTimeout(function() {
$('#<%= TextPostal.ClientID %>').fadeIn(200);
}, 100);
$('#spanLabelPostal').animate({ width: 'toggle' }, 400);
postalCodeVisible = true;
}
} else if (postalCodeVisible) {
// Remove postal code altogether, if visible now
$('#<%= TextPostal.ClientID %>').animate({ width: 0 }, 200).fadeOut(100);
$('#<%= TextCity.ClientID %>').animate({ width: "255px" }, 600);
$('#spanLabelPostal').animate({ width: 'toggle' }, 400);
postalCodeVisible = false;
}
}
function UpdatePostalPrefix(oldValue, newValue) {
$('#spanCountryPrefix').text(newValue);
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
$('#spanDetectedGeo').text('');
// Get postal code data for country. Heavy op; should not be done from mobile
var jsonData = {};
jsonData.countryCode = newValue;
$.ajax({
type: "POST",
url: "/Automation/FieldValidation.aspx/GetPostalCodesCities",
data: $.toJSON(jsonData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
postalCodeLookup = {};
cityIdLookup = {};
cityNameLookup = {};
geographyIdLookup = {};
postalCodeLength = msg.d.PostalCodeLength;
postalCodeLengthCheck = msg.d.PostalCodeLengthCheck;
$('#<%= 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;
});
msg.d.CityNames.forEach(function(element, index, array) {
cityIdLookup[element.Id] = {};
cityIdLookup[element.Id].Name = element.Name;
cityIdLookup[element.Id].GeoId = element.GeographyId;
cityNameLookup[element.Name.toLowerCase()] = element.GeographyId;
});
msg.d.Geographies.forEach(function(element, index, array) {
geographyIdLookup[element.Id] = element.Name;
});
AnimatePostalCodeLength();
CheckPostalCode();
},
error: function(msg) {
console.log(msg);
geographyIdLookup = {};
postalCodeLookup = {};
cityIdLookup = {};
cityNameLookup = {};
}
});
}
function ValidatePersonFields() {
var isValid = true;
var dateFieldContents = $('#<%= TextDateOfBirth.ClientID%>').val();
if (dateFieldContents.length > 0) {
var jsonData = {};
jsonData.input = dateFieldContents;
$.ajax({
type: "POST",
url: "/Automation/FieldValidation.aspx/IsDateValid",
data: $.toJSON(jsonData),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false, // blocks until function returns - race conditions otherwise
success: function (msg) {
if (msg.d != true) {
isValid = false;
$('#<%= TextDateOfBirth.ClientID %>').addClass("entryError");
alertify.error("<asp:Literal runat="server" ID="LiteralErrorDate" />");
$('#<%=this.TextDateOfBirth.ClientID %>').focus();
}
}
});
}
isValid = ValidateTextField('#<%= TextCity.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorCity" />") && isValid;
isValid = ValidateTextField('#<%= TextStreet1.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorStreet" />") && isValid;
isValid = ValidateTextField('#<%= TextMail.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorMail" />") && isValid;
isValid = ValidateTextField('#<%= TextName.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorName" />") && isValid; // TODO: Actually validate geography?
return isValid;
}
function ValidateTextField(fieldId, message) {
$(fieldId).removeClass("entryError");
if ($(fieldId).val().length == 0) {
alertify.error(message);
$(fieldId).addClass("entryError");
$(fieldId).focus();
return false;
}
return true;
}
var postalCodeLookup = {};
var cityIdLookup = {};
var cityNameLookup = {};
var geographyIdLookup = {};
var postalCodeLength = 0;
var postalCodeLengthCheck = 0;
var postalCodeVisible = true;
var postalCodeIdentified = false;
$(document).ready(function () {
// Initialize Smart Wizard
$('#wizard').smartWizard({
transitionEffect: 'fade',
keyNavigation: false,
onLeaveStep: leaveAStepCallback,
onFinish: onFinishCallback
});
$(document).ready(function () {
function leaveAStepCallback(obj) {
if (disableNext) {
return false;
}
// Doc.Ready instance 2. Smart Wizard initialization.
// This is a separate Doc.Ready as I hope to break out the
// above code some day to a common file between this file
// and Swarm / Add. (TODO.)
var stepNum = obj.attr('rel');
return validateStep(stepNum);
}
function onFinishCallback(obj) {
// $('#LOGINBUTTONID').click();
}
$('#wizard').smartWizard({
transitionEffect: 'fade',
keyNavigation: false,
onLeaveStep: leaveAStepCallback,
onFinish: onFinishCallback
});
function validateStep(stepNumber) {
var isValid = true; // assume true and set false underway
function leaveAStepCallback(obj) {
if (disableNext) {
return false;
}
if (stepNumber == 1) {
isValid = true;
// Blah
var stepNum = obj.attr('rel');
return validateStep(stepNum);
}
function onFinishCallback(obj) {
// $('#LOGINBUTTONID').click();
}
function validateStep(stepNumber) {
var isValid = true; // assume true and set false underway
if (stepNumber == 1) {
isValid = true;
// Blah
$('#<%= TextName.ClientID %>').focus();
} else if (stepNumber == 2) {
isValid = true; // assume true, make false as we go
isValid = ValidatePersonFields();
} else if (stepNumber == 3) {
isValid = true;
isValid = true;
} else if (stepNumber == 4) {
isValid = true; // assume true, make false as we go
} else if (stepNumber == 4) {
isValid = true; // assume true, make false as we go
} else if (stepNumber == 5) {
// If we get here, we're always good
} else if (stepNumber == 5) {
isValid = true; // assume true, make false as we go
isValid = true;
}
} else if (stepNumber == 6) {
// If we get here, we're always good
return isValid;
}
isValid = true;
}
}); // end of document.ready
return isValid;
}
var disableNext = false;
$('#<%=this.DropCountries.ClientID%>').change(function() {
UpdatePostalPrefix('oldValueDummy', $('#<%=this.DropCountries.ClientID%>').val());
});
function DisableNext() {
$('a.buttonNext').addClass("buttonDisabled");
disableNext = true;
}
}); // end of document.ready
function EnableNext() {
$('a.buttonNext').removeClass("buttonDisabled");
disableNext = false;
}
var disableNext = false;
function ClickNext() {
$('a.buttonNext').click();
}
function DisableNext() {
$('a.buttonNext').addClass("buttonDisabled");
disableNext = true;
}
function EnableNext() {
$('a.buttonNext').removeClass("buttonDisabled");
disableNext = false;
}
function ClickNext() {
$('a.buttonNext').click();
}
</script>
</script>
<!-- Main menu, dynamically constructed -->
@@ -167,12 +384,19 @@
<li><a href="#step-4">
<label class="stepNumber">4</label>
<span class="stepDesc">
Activity<br />
Activity 1<br />
<small>How much do you wish to engage?</small>
</span>
</a></li>
<li><a href="#step-5">
<label class="stepNumber">5</label>
<span class="stepDesc">
Activity 2<br />
<small>What would you like to engage in?</small>
</span>
</a></li>
<li><a href="#step-6">
<label class="stepNumber">6</label>
<span class="stepDesc">
Complete<br />
<small>All done. Let's login!</small>
@@ -184,11 +408,34 @@
<p>This is the organization's custom welcome text. It has not yet been written; it is set in Admin / Org Settings.</p>
</div>
<div id="step-2">
<h2>Initializing database</h2>
<div class="entryLabelsAdmin">
<asp:Label ID="LabelName" runat="server" /><br />
<asp:Label ID="LabelCountry" runat="server" /><br />
<asp:Label ID="LabelMail" runat="server" /><br />
<asp:Label ID="LabelPhone" runat="server" /><br />
<asp:Label ID="LabelStreet1" runat="server" /><br />
<asp:Label ID="LabelStreet2" runat="server" /><br />
<span id="spanLabelPostal" style="display: inline-block; overflow: hidden"><asp:Label ID="LabelPostalCode" runat="server" />,&nbsp;</span><span style="display: inline-block; overflow: hidden"><asp:Label runat="server" ID="LabelCity" /></span><br />
<span id="SpanGeoDetected"><asp:Label ID="LabelGeographyDetected" runat="server" /></span><span id="SpanGeoSelect" style="display: none"><asp:Label ID="LabelSelectGeography" runat="server" Text="XYZ Select Geography" /></span><br />
<asp:Label ID="LabelDateOfBirth" runat="server" /><br />
<asp:Label ID="LabelLegalGender" runat="server" /><br />
</div>
<div class="entryFieldsAdmin">
<asp:TextBox runat="server" ID="TextName" />&#8203;<br/>
<asp:DropDownList runat="server" ID="DropCountries"/>&#8203;<br/>
<asp:TextBox runat="server" ID="TextMail" />&#8203;<br/>
<asp:TextBox runat="server" ID="TextPhone" />&#8203;<br/>
<asp:TextBox runat="server" ID="TextStreet1" />&#8203;<br/>
<asp:TextBox runat="server" ID="TextStreet2" />&#8203;<br/>
<div style="float: right; margin-right: -1px"><asp:TextBox runat="server" ID="TextPostal" />&nbsp;<asp:TextBox runat="server" ID="TextCity" /></div><div style="width: 22px; overflow: hidden"><span id="spanCountryPrefix">XX</span>&ndash;</div>
<span id="spanDetectedGeo">...</span>&nbsp;<br/>
<asp:TextBox runat="server" ID="TextDateOfBirth" />&#8203;<br/>
<asp:DropDownList runat="server" ID="DropGenders" />&#8203;<br/>
</div>
</div>
<div id="step-3">
<h2>Initializing database</h2>
<h2>Your Logon</h2>
</div>
<div id="step-4">
<h2>Creating the first user</h2>
+76
View File
@@ -4,7 +4,10 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Resources;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Swarm;
namespace Swarmops.Frontend.Pages.Public
{
@@ -24,8 +27,81 @@ namespace Swarmops.Frontend.Pages.Public
{
throw new ArgumentException("Organization not specified"); // TODO: make a friendly landing page instead
}
// Override style widths - (this will cause problems with a future responsive design; come back here to fix that)
this.DropCountries.Style[HtmlTextWriterStyle.Width] = "162px";
/*
this.BoxTitle.Text = PageTitle = String.Format(Resources.Pages.Swarm.AddPerson_Title,
Participant.Localized(CurrentOrganization.RegularLabel));
InfoBoxLiteral = String.Format(Resources.Pages.Swarm.AddPerson_Info, Global.Timespan_OneYear,
Participant.Localized(CurrentOrganization.RegularLabel, TitleVariant.Ship),
DateTime.Today.AddYears(1).ToLongDateString());*/
if (!Page.IsPostBack)
{
Localize();
Populate();
this.TextName.Focus();
}
}
private void Populate()
{
Countries allCountries = Countries.All;
this.DropCountries.Items.Clear();
foreach (Country country in allCountries)
{
string countryLocalName = country.Localized;
string countryDisplay = country.Code + " " + countryLocalName;
this.DropCountries.Items.Add (new ListItem (countryDisplay, country.Code));
}
if (this.Organization.DefaultCountry != null)
{
this.DropCountries.SelectedValue = this.Organization.DefaultCountry.Code;
}
this.DropGenders.Items.Clear();
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"));
}
private void Localize()
{
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;
this.LiteralErrorDate.Text = Resources.Pages.Swarm.AddPerson_ErrorDate;
this.LabelName.Text = Resources.Global.Global_Name;
this.LabelCountry.Text = Resources.Global.Global_Country;
this.LabelMail.Text = Resources.Global.Global_Mail;
this.LabelPhone.Text = Resources.Global.Global_Phone;
this.LabelStreet1.Text = Resources.Pages.Swarm.AddPerson_Street1PO;
this.LabelStreet2.Text = Resources.Pages.Swarm.AddPerson_Street2;
this.LabelPostalCode.Text = Resources.Global.Global_PostalCode;
this.LabelCity.Text = Resources.Global.Global_City;
this.LabelGeographyDetected.Text = Resources.Pages.Swarm.AddPerson_GeographyDetected;
this.LabelDateOfBirth.Text = Resources.Global.Global_DateOfBirth;
this.LabelLegalGender.Text = Resources.Pages.Swarm.AddPerson_LegalGender;
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";
this.TextStreet1.Attributes["placeholder"] = "78 West Avenue";
this.TextPostal.Attributes["placeholder"] = "12345";
}
protected Organization Organization;
}
}
+21 -19
View File
@@ -3,17 +3,17 @@
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(document).ready(function () {
UpdatePostalPrefix('XX', $('#<%= DropCountries.ClientControlID %>').val());
$('#<%= TextPostal.ClientID %>').on('input', function() {
$('#<%= TextPostal.ClientID %>').on('input', function () {
if (CheckPostalCode()) {
if ($('#<%= TextPostal.ClientID %>').val().length == postalCodeLength) {
$('#<%= TextDateOfBirth.ClientID %>').focus();
}
}
});
$('#<%= TextCity.ClientID %>').on('input', function() {
$('#<%= TextCity.ClientID %>').on('input', function () {
CheckPostalCity();
});
@@ -24,16 +24,16 @@
function CheckPostalCity() {
var currentCity = $('#<%= TextCity.ClientID %>').val().toLowerCase();
if (currentCity in cityNameLookup) {
var geoId = cityNameLookup[currentCity];
$('#spanDetectedGeo').text(geographyIdLookup[geoId]);
} else {
$('#spanDetectedGeo').text('');
}
}
if (currentCity in cityNameLookup) {
var geoId = cityNameLookup[currentCity];
$('#spanDetectedGeo').text(geographyIdLookup[geoId]);
} else {
$('#spanDetectedGeo').text('');
}
}
function CheckPostalCode() {
var currentPostalCode = $('#<%= TextPostal.ClientID %>').val().toLowerCase();
function CheckPostalCode() {
var currentPostalCode = $('#<%= TextPostal.ClientID %>').val().toLowerCase();
if (currentPostalCode.length > postalCodeLengthCheck) {
currentPostalCode = currentPostalCode.substring(0, postalCodeLengthCheck);
}
@@ -45,9 +45,9 @@
return true;
} else if (postalCodeIdentified) {
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
$('#spanDetectedGeo').text('');
postalCodeIdentified = false;
}
$('#spanDetectedGeo').text('');
postalCodeIdentified = false;
}
return false;
}
@@ -76,11 +76,11 @@
postalCodeVisible = false;
}
}
}
function UpdatePostalPrefix(oldValue, newValue) {
$('#spanCountryPrefix').text(newValue);
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
function UpdatePostalPrefix(oldValue, newValue) {
$('#spanCountryPrefix').text(newValue);
$('#<%= TextCity.ClientID %>').removeAttr("disabled").val('');
$('#spanDetectedGeo').text('');
// Get postal code data for country. Heavy op; should not be done from mobile
@@ -186,7 +186,9 @@
var postalCodeIdentified = false;
var onDocReadyAlert = '<asp:Literal ID="LiteralLoadAlert" runat="server" />';
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">