Signup works. Almost done for Alpha-09.
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
<Compile Include="Types\Governance\BasicBallot.cs" />
|
||||
<Compile Include="Types\Swarm\BasicPosition.cs" />
|
||||
<Compile Include="Types\Swarm\BasicPositionAssignment.cs" />
|
||||
<Compile Include="Types\Swarm\BasicVolunteerPosition.cs" />
|
||||
<Compile Include="Types\System\BasicSwarmopsLogEntry.cs" />
|
||||
<Compile Include="Types\Communications\BasicOutboundComm.cs" />
|
||||
<Compile Include="Types\Communications\BasicOutboundCommRecipient.cs" />
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Common.Interfaces;
|
||||
|
||||
namespace Swarmops.Basic.Types.Swarm
|
||||
{
|
||||
public class BasicVolunteerPosition : IHasIdentity
|
||||
{
|
||||
// TODO
|
||||
|
||||
public int Identity { get; private set; }
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -939,7 +939,7 @@ namespace Swarmops
|
||||
{
|
||||
Console.WriteLine ("[!!] " + member.Name);
|
||||
|
||||
member.AddMembership (1, membership.Expires);
|
||||
member.AddParticipation (1, membership.Expires);
|
||||
Console.WriteLine (" - added membership in PP");
|
||||
|
||||
PWEvents.CreateEvent(EventSource.PirateBot, EventType.AddedMembership,
|
||||
|
||||
@@ -58,54 +58,6 @@ namespace Swarmops.Database
|
||||
}
|
||||
}
|
||||
|
||||
public BasicVolunteerRole GetVolunteerRole (int volunteerRoleId)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand (
|
||||
"SELECT VolunteerRoleId,VolunteerId,OrganizationId,GeographyId,RoleTypeId,Open,Assigned FROM VolunteerRoles WHERE VolunteerRoleId=" +
|
||||
volunteerRoleId + ";", connection);
|
||||
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
return ReadVolunteerRoleFromDataReader (reader);
|
||||
}
|
||||
|
||||
throw new ArgumentException ("Unknown VolunteerId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public BasicVolunteerRole[] GetVolunteerRolesByVolunteer (int volunteerId)
|
||||
{
|
||||
List<BasicVolunteerRole> result = new List<BasicVolunteerRole>();
|
||||
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand (
|
||||
"SELECT VolunteerRoleId,VolunteerId,OrganizationId,GeographyId,RoleTypeId,Open,Assigned FROM VolunteerRoles WHERE VolunteerId=" +
|
||||
volunteerId + ";", connection);
|
||||
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
result.Add (ReadVolunteerRoleFromDataReader (reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
|
||||
private BasicVolunteer ReadVolunteerFromDataReader (DbDataReader reader)
|
||||
@@ -123,18 +75,9 @@ namespace Swarmops.Database
|
||||
}
|
||||
|
||||
|
||||
private BasicVolunteerRole ReadVolunteerRoleFromDataReader (DbDataReader reader)
|
||||
private BasicVolunteerPosition ReadVolunteerPositionFromDataReader (DbDataReader reader)
|
||||
{
|
||||
int volunteerRoleId = reader.GetInt32 (0);
|
||||
int volunteerId = reader.GetInt32 (1);
|
||||
int organizationId = reader.GetInt32 (2);
|
||||
int geographyId = reader.GetInt32 (3);
|
||||
int roleTypeId = reader.GetInt32 (4);
|
||||
bool open = reader.GetBoolean (5);
|
||||
bool assigned = reader.GetBoolean (6);
|
||||
|
||||
return new BasicVolunteerRole (volunteerRoleId, volunteerId, organizationId, geographyId,
|
||||
(RoleType) roleTypeId, open, assigned);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
@@ -149,25 +92,24 @@ namespace Swarmops.Database
|
||||
|
||||
AddParameterWithName (command, "personId", personId);
|
||||
AddParameterWithName (command, "ownerPersonId", ownerPersonId);
|
||||
AddParameterWithName (command, "openedDateTime", DateTime.Now);
|
||||
AddParameterWithName (command, "openedDateTime", DateTime.UtcNow);
|
||||
|
||||
return Convert.ToInt32 (command.ExecuteScalar());
|
||||
}
|
||||
}
|
||||
|
||||
public int CreateVolunteerRole (int volunteerId, int organizationId, int geographyId, RoleType roleType)
|
||||
public int CreateVolunteerPosition (int volunteerId, int positionId, int geographyId)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand ("CreateVolunteerRole", connection);
|
||||
DbCommand command = GetDbCommand ("CreateVolunteerPosition", connection);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameterWithName (command, "volunteerId", volunteerId);
|
||||
AddParameterWithName (command, "organizationId", organizationId);
|
||||
AddParameterWithName (command, "positionId", positionId);
|
||||
AddParameterWithName (command, "geographyId", geographyId);
|
||||
AddParameterWithName (command, "roleTypeId", (int) roleType);
|
||||
|
||||
return Convert.ToInt32 (command.ExecuteScalar());
|
||||
}
|
||||
|
||||
@@ -142,7 +142,6 @@ namespace Swarmops.Logic.Cache
|
||||
throw new ArgumentException ("No such OrganizationId: " + OrganizationId.ToString());
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -387,6 +387,7 @@
|
||||
<Compile Include="Swarm\RoleLookup.cs" />
|
||||
<Compile Include="Swarm\Roles.cs" />
|
||||
<Compile Include="Swarm\Volunteer.cs" />
|
||||
<Compile Include="Swarm\VolunteerPosition.cs" />
|
||||
<Compile Include="Swarm\VolunteerRole.cs" />
|
||||
<Compile Include="Swarm\VolunteerRoles.cs" />
|
||||
<Compile Include="Swarm\Volunteers.cs" />
|
||||
|
||||
@@ -785,14 +785,14 @@ namespace Swarmops.Logic.Swarm
|
||||
return newPerson;
|
||||
}
|
||||
|
||||
public Participation AddMembership (Organization organization, DateTime expires)
|
||||
public Participation AddParticipation (Organization organization, DateTime expires)
|
||||
{
|
||||
return AddMembership (organization.Identity, expires);
|
||||
return AddParticipation (organization.Identity, expires);
|
||||
}
|
||||
|
||||
public Participation AddMembership (int organizationId, DateTime expires)
|
||||
private Participation AddParticipation (int organizationId, DateTime expires)
|
||||
{
|
||||
return Participation.Create (Identity, organizationId, expires);
|
||||
return Participation.Create (this.Identity, organizationId, expires);
|
||||
}
|
||||
|
||||
private bool? HasExplicitSubscription (int newsletterFeedId)
|
||||
@@ -1156,6 +1156,11 @@ namespace Swarmops.Logic.Swarm
|
||||
return assignment.Position;
|
||||
}
|
||||
|
||||
public Volunteer CreateVolunteer()
|
||||
{
|
||||
return Volunteer.Create (this);
|
||||
}
|
||||
|
||||
// A couple of special cases
|
||||
|
||||
public const int OpenLedgersIdentity = -1;
|
||||
|
||||
+21
-26
@@ -33,19 +33,24 @@ namespace Swarmops.Logic.Swarm
|
||||
return new Volunteer (basic);
|
||||
}
|
||||
|
||||
public static Volunteer Create (Person person, Person owner)
|
||||
public static Volunteer Create (Person person)
|
||||
{
|
||||
return Create (person.Identity, owner.Identity);
|
||||
return Create (person, null);
|
||||
}
|
||||
|
||||
public static Volunteer Create (int personId, int ownerPersonId)
|
||||
public static Volunteer Create (Person person, Person owner)
|
||||
{
|
||||
return Create (person.Identity, owner != null? owner.Identity: 0);
|
||||
}
|
||||
|
||||
private static Volunteer Create (int personId, int ownerPersonId)
|
||||
{
|
||||
return FromIdentity (SwarmDb.GetDatabaseForWriting().CreateVolunteer (personId, ownerPersonId));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Geography geography;
|
||||
private Geography _geography;
|
||||
private Person ownerPerson;
|
||||
private Person person;
|
||||
|
||||
@@ -78,7 +83,7 @@ namespace Swarmops.Logic.Swarm
|
||||
get
|
||||
{
|
||||
PopulateCache();
|
||||
return this.geography;
|
||||
return this._geography;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +102,7 @@ namespace Swarmops.Logic.Swarm
|
||||
get
|
||||
{
|
||||
PopulateCache();
|
||||
return this.geography.Name;
|
||||
return this._geography.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,23 +124,6 @@ namespace Swarmops.Logic.Swarm
|
||||
}
|
||||
}
|
||||
|
||||
public VolunteerRoles Roles
|
||||
{
|
||||
get
|
||||
{
|
||||
return VolunteerRoles.FromArray (SwarmDb.GetDatabaseForReading().GetVolunteerRolesByVolunteer (Identity));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRole (Organization organization, Geography geography, RoleType roleType)
|
||||
{
|
||||
AddRole (organization.Identity, geography.Identity, roleType);
|
||||
}
|
||||
|
||||
public void AddRole (int organizationId, int geographyId, RoleType roleType)
|
||||
{
|
||||
SwarmDb.GetDatabaseForWriting().CreateVolunteerRole (Identity, organizationId, geographyId, roleType);
|
||||
}
|
||||
|
||||
public void Close (string comments)
|
||||
{
|
||||
@@ -154,19 +142,26 @@ namespace Swarmops.Logic.Swarm
|
||||
this.ownerPerson = Person.FromIdentity (OwnerPersonId);
|
||||
}
|
||||
|
||||
if (this.geography == null)
|
||||
if (this._geography == null)
|
||||
{
|
||||
if (this.person.GeographyId != 0)
|
||||
{
|
||||
this.geography = this.person.Geography;
|
||||
this._geography = this.person.Geography;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.geography = Geography.Root;
|
||||
this._geography = Geography.Root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPosition (Position position, Geography geography = null)
|
||||
{
|
||||
int geographyId = (geography == null ? 0 : geography.Identity);
|
||||
|
||||
SwarmDb.GetDatabaseForWriting().CreateVolunteerPosition (this.Identity, position.Identity, geographyId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Assign the volunteer to a suitable owner will try to assign to ElectoralCircuit lead
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Swarmops.Basic.Types.Swarm;
|
||||
|
||||
namespace Swarmops.Logic.Swarm
|
||||
{
|
||||
public class VolunteerPosition: BasicVolunteerPosition
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Swarmops.Basic.Types;
|
||||
using Swarmops.Basic.Types.Swarm;
|
||||
using Swarmops.Database;
|
||||
@@ -24,7 +25,7 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
public static VolunteerRole FromIdentity (int identity)
|
||||
{
|
||||
return FromBasic (SwarmDb.GetDatabaseForReading().GetVolunteerRole (identity));
|
||||
throw new NotImplementedException(); // This entire class is legacy
|
||||
}
|
||||
|
||||
public void Close (bool wasAssigned)
|
||||
|
||||
@@ -145,6 +145,14 @@
|
||||
<data name="Signup_ActivationVolunteerHeader" xml:space="preserve">
|
||||
<value>Officer Volunteer</value>
|
||||
</data>
|
||||
<data name="Signup_DashboardMessage" xml:space="preserve">
|
||||
<value>Welcome! This is the <em>Dashboard,</em> where you can access internal functionality of {0}. You will get more information in mail shortly.<br/><br/>
|
||||
|
||||
If you volunteered for taking formal responsibility, somebody (probably also a volunteer, like yourself) will contact you to discuss more about the opportunities.</value>
|
||||
</data>
|
||||
<data name="Signup_Error_MailExists" xml:space="preserve">
|
||||
<value>You have already signed up to this Swarmops server. Please use the Reset Password function from the login screen instead of creating a new account.</value>
|
||||
</data>
|
||||
<data name="Signup_Error_NeedPassword" xml:space="preserve">
|
||||
<value>Please select and retype a password.</value>
|
||||
</data>
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin.Hacks
|
||||
newPerson.Longitude = lineParts[10];
|
||||
newPerson.Latitude = lineParts[11];
|
||||
|
||||
newPerson.AddMembership (1, DateTime.Today.AddDays (random.Next (365)));
|
||||
newPerson.AddParticipation (Organization.Sandbox, DateTime.Today.AddDays (random.Next (365)));
|
||||
}
|
||||
|
||||
GuidCache.Set (guid + "-Progress", 100);
|
||||
|
||||
@@ -682,7 +682,7 @@ namespace Swarmops.Frontend.Pages.v5.Public
|
||||
HttpUtility.UrlDecode (password), string.Empty, string.Empty, string.Empty,
|
||||
string.Empty, string.Empty, DateTime.MinValue, PersonGender.Unknown);
|
||||
|
||||
newPerson.AddMembership (1, DateTime.MaxValue); // Add membership in Sandbox
|
||||
newPerson.AddParticipation (Organization.Sandbox, DateTime.MaxValue); // Add membership in Sandbox
|
||||
newPerson.AddRole (RoleType.SystemAdmin, 0, 0); // Add role System Admin
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,10 @@
|
||||
<!-- UGLY HACK: Control ExternalScripts requires authentication for some reason. This is a bug. But to get alpha-09 out on time, we're
|
||||
circumventing the bug by hardcoding the hosted scripts - this needs fixing. -->
|
||||
|
||||
<script src="//hostedscripts.falkvinge.net/staging/easyui/jquery.easyui.min.js" type="text/javascript"></script>␍ <link rel="stylesheet" type="text/css" href="//hostedscripts.falkvinge.net/staging/easyui/themes/icon.css" />␍ <link rel="stylesheet" type="text/css" href="//hostedscripts.falkvinge.net/staging/easyui/themes/default/easyui.css" />␍ <link href="/Style/v5-easyui-overrides.css" rel="stylesheet" type="text/css" />
|
||||
<script src="//hostedscripts.falkvinge.net/staging/easyui/jquery.easyui.min.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="//hostedscripts.falkvinge.net/staging/easyui/themes/icon.css" />
|
||||
<link rel="stylesheet" type="text/css" href="//hostedscripts.falkvinge.net/staging/easyui/themes/default/easyui.css" />
|
||||
<link href="/Style/v5-easyui-overrides.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- Swarmops common JS functions, incl. EasyUI behavior overrides -->
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/Swarmops-v5.js" ></script>
|
||||
@@ -104,23 +107,6 @@
|
||||
}
|
||||
|
||||
|
||||
.swMain ul.anchor li a.crossout, .swMain ul.anchor li a.crossout:hover { /* cross out step 5 if it is skipped - if so, it gets marked disabled */
|
||||
background:
|
||||
linear-gradient(to top left,
|
||||
rgba(0,0,0,0) 0%,
|
||||
rgba(0,0,0,0) calc(50% - 2px),
|
||||
rgba(0,0,0,.2) 50%,
|
||||
rgba(0,0,0,0) calc(50% + 2px),
|
||||
rgba(0,0,0,0) 100%),
|
||||
linear-gradient(to top right,
|
||||
rgba(0,0,0,0) 0%,
|
||||
rgba(0,0,0,0) calc(50% - 2px),
|
||||
rgba(0,0,0,.2) 50%,
|
||||
rgba(0,0,0,0) calc(50% + 2px),
|
||||
rgba(0,0,0,0) 100%);
|
||||
}
|
||||
|
||||
|
||||
.entryFieldsAdmin, .entryLabelsAdmin {
|
||||
font-size: 16px;
|
||||
}
|
||||
@@ -298,7 +284,30 @@
|
||||
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;
|
||||
if (isValid) {
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.mail = $('#<%= TextMail.ClientID %>').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Public/Signup.aspx/CheckMailFree",
|
||||
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;
|
||||
$('#<%= this.TextMail.ClientID %>').addClass("entryError");
|
||||
alertify.error("<asp:Literal runat="server" ID="LiteralErrorMailExists" />");
|
||||
$('#<%=this.TextMail.ClientID %>').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function ValidateTextField(fieldId, message) {
|
||||
@@ -355,8 +364,39 @@
|
||||
}
|
||||
|
||||
function onFinishCallback(obj) {
|
||||
alert("On Finish Callback");
|
||||
// $('#LOGINBUTTONID').click();
|
||||
var positionIdArray = [];
|
||||
|
||||
$('a.buttonFinish').addClass('buttonDisabled').css('cursor', 'wait');
|
||||
|
||||
if (selectedPositions.length > 0) {
|
||||
selectedPositions.forEach(function(currentValue, index, array) {
|
||||
positionIdArray.push(parseInt(currentValue.positionId));
|
||||
});
|
||||
}
|
||||
|
||||
SwarmopsJS.ajaxCall("/Pages/v5/Public/Signup.aspx/SignupParticipant",
|
||||
{
|
||||
name: $('#<%=this.TextName.ClientID%>').val(),
|
||||
organizationId: <%= this.Organization.Identity %>,
|
||||
mail: $('#<%=this.TextMail.ClientID%>').val(),
|
||||
phone: $('#<%=this.TextPhone.ClientID%>').val(),
|
||||
password: $('#<%=this.TextPassword1.ClientID%>').val(),
|
||||
street1: $('#<%=this.TextStreet1.ClientID%>').val(),
|
||||
street2: $('#<%=this.TextStreet2.ClientID%>').val(),
|
||||
postalCode: $('#<%=this.TextPostal.ClientID%>').val(),
|
||||
city: $('#<%=this.TextCity.ClientID%>').val(),
|
||||
countryCode: $('#<%=this.DropCountries.ClientID%>').val(),
|
||||
dateOfBirth: $('#<%=this.TextDateOfBirth.ClientID%>').val(),
|
||||
geographyId: currentGeographyId,
|
||||
activist: $('input:radio[name="ActivationLevel"]:checked').val() != "RadioActivationPassive",
|
||||
gender: $('#<%=this.DropGenders.ClientID%>').val(),
|
||||
positionIdsVolunteer: positionIdArray
|
||||
|
||||
},
|
||||
function() {
|
||||
// On success, the participant is created and an authentication cookie has been set. Redirect to Dashboard.
|
||||
document.location = "/";
|
||||
});
|
||||
}
|
||||
|
||||
function validateStep(stepNumber) {
|
||||
@@ -403,36 +443,46 @@
|
||||
alertify.error("<asp:Literal runat='server' ID='LiteralErrorSelectActivationLevel' />");
|
||||
}
|
||||
|
||||
if (selectedOption != "RadioActivationVolunteer" && isValid) {
|
||||
|
||||
// If we're NOT an officer volunteer...
|
||||
|
||||
suppressChecks = true; // prevents foreverlooping into this check
|
||||
$('#wizard').smartWizard('goToStep', 6);
|
||||
setTimeout(function() {
|
||||
$('a[rel="5"]').addClass("disabled").addClass("crossout").removeClass("selected");
|
||||
$('a.buttonNext').addClass("buttonDisabled"); // hacks because SmartWizard doesn't handle skipping steps
|
||||
}, 250);
|
||||
suppressChecks = false;
|
||||
} else if (isValid) {
|
||||
if (selectedOption == "RadioActivationVolunteer" && isValid) {
|
||||
|
||||
// If we ARE an officer volunteer...
|
||||
|
||||
$('a[rel="5"]').removeClass("crossout"); // if user navigating back and forth, need to remove the crossout here
|
||||
|
||||
setTimeout(function() {
|
||||
$('#tableVolunteerPositions').datagrid({ url: '/Pages/v5/Public/Json-SignupVolunteerPositions.aspx?OrganizationId=<%=Organization.Identity%>&GeographyId=' + currentGeographyId });
|
||||
//$('#tableVolunteerPositions').datagrid('reload');
|
||||
}, 250);
|
||||
} else {
|
||||
// Otherwise, jump to step 6
|
||||
|
||||
// This is NOT how you do it. The SmartWizard doesn't want to do DisableStep (so that a step is skipped), and doesn't do GoToStep either.
|
||||
// These hacks mean that backstepping becomes shit ugly if you go to step 6 and backstep to 4. Need to fix. BUGBUG TODO
|
||||
|
||||
if (!suppressChecks) {
|
||||
suppressChecks = true;
|
||||
$('#wizard').smartWizard('goToStep', '6');
|
||||
setTimeout(function() {
|
||||
$('#step-5').hide();
|
||||
$('a.buttonNext').addClass('buttonDisabled');
|
||||
$('a[rel="5"]').removeClass('selected').removeClass('done').addClass('disabled');
|
||||
}, 250); // needs to be at least 250ms to happen after... what? BUG here, there has to be a better way to do this
|
||||
suppressChecks = false;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (stepNumber == 5) {
|
||||
isValid = true; // assume true, make false as we go
|
||||
|
||||
selectedPositions = $('#tableVolunteerPositions').datagrid('getChecked');
|
||||
if (selectedPositions.length == 0) {
|
||||
isValid = false;
|
||||
alertify.error("<asp:Literal runat='server' ID='LiteralErrorSelectVolunteerPosition' />");
|
||||
if ($('input:radio[name="ActivationLevel"]:checked').val() == "RadioActivationVolunteer") {
|
||||
// if step 5 active...
|
||||
|
||||
selectedPositions = $('#tableVolunteerPositions').datagrid('getChecked');
|
||||
if (selectedPositions.length == 0) {
|
||||
isValid = false;
|
||||
alertify.error("<asp:Literal runat='server' ID='LiteralErrorSelectVolunteerPosition' />");
|
||||
}
|
||||
} else {
|
||||
// If we should just skip step 5
|
||||
$('a[rel="5"]').addClass("disabled").addClass("crossout");
|
||||
selectedPositions = {};
|
||||
}
|
||||
|
||||
} else if (stepNumber == 6) {
|
||||
@@ -446,6 +496,17 @@
|
||||
UpdatePostalPrefix('oldValueDummy', $('#<%=this.DropCountries.ClientID%>').val());
|
||||
});
|
||||
|
||||
$('input:radio[name="ActivationLevel"]').click(function() {
|
||||
if ($('input:radio[name="ActivationLevel"]:checked').val() == "RadioActivationVolunteer") {
|
||||
$('#wizard').smartWizard('enableStep', '5');
|
||||
$('a[rel="5"]').removeClass("crossout");
|
||||
} else {
|
||||
$('#wizard').smartWizard('disableStep', '5');
|
||||
$('a[rel="5"]').addClass("crossout");
|
||||
selectedPositions = {};
|
||||
}
|
||||
});
|
||||
|
||||
}); // end of document.ready
|
||||
|
||||
var disableNext = false;
|
||||
|
||||
@@ -3,9 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Resources;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Swarm;
|
||||
@@ -106,6 +109,7 @@ namespace Swarmops.Frontend.Pages.Public
|
||||
this.LiteralErrorPasswordMismatch.Text = Resources.Pages.Public.Signup_Error_PasswordMismatch;
|
||||
this.LiteralErrorSelectActivationLevel.Text = Resources.Pages.Public.Signup_Error_SelectActivationLevel;
|
||||
this.LiteralErrorSelectVolunteerPosition.Text = Resources.Pages.Public.Signup_Error_SelectPosition;
|
||||
this.LiteralErrorMailExists.Text = Resources.Pages.Public.Signup_Error_MailExists;
|
||||
|
||||
this.LabelWelcomeHeader.Text = String.Format (Resources.Pages.Public.Signup_Welcome, Organization.Name);
|
||||
this.LabelHeader.Text = String.Format(Resources.Pages.Public.Signup_SigningUp, Organization.Name).ToUpperInvariant();
|
||||
@@ -189,5 +193,73 @@ namespace Swarmops.Frontend.Pages.Public
|
||||
|
||||
|
||||
protected Organization Organization;
|
||||
|
||||
[WebMethod]
|
||||
public static AjaxCallResult SignupParticipant (string name, int organizationId, string mail, string password, string phone,
|
||||
string street1, string street2, string postalCode, string city, string countryCode, string dateOfBirth,
|
||||
int geographyId, bool activist, PersonGender gender, int[] positionIdsVolunteer)
|
||||
{
|
||||
CommonV5.CulturePreInit (HttpContext.Current.Request); // Set culture, for date parsing
|
||||
|
||||
if (geographyId == 0)
|
||||
{
|
||||
geographyId = Geography.RootIdentity; // if geo was undetermined, set it to "Global"
|
||||
}
|
||||
|
||||
Organization organization = Organization.FromIdentity (organizationId);
|
||||
DateTime parsedDateOfBirth = new DateTime (1800, 1, 1); // Default if unspecified
|
||||
|
||||
if (dateOfBirth.Length > 0)
|
||||
{
|
||||
parsedDateOfBirth = DateTime.Parse (dateOfBirth);
|
||||
}
|
||||
|
||||
Person newPerson = Person.Create (name, mail, password, phone, street1 + "\n" + street2.Trim(), postalCode,
|
||||
city, countryCode, parsedDateOfBirth, gender);
|
||||
newPerson.AddParticipation (organization, DateTime.UtcNow.AddYears (1)); // TODO: set duration from organization settings of Participantship
|
||||
|
||||
// TODO: SEND NOTIFICATIONS
|
||||
|
||||
if (activist)
|
||||
{
|
||||
newPerson.CreateActivist (false, false);
|
||||
}
|
||||
|
||||
if (positionIdsVolunteer.Length > 0)
|
||||
{
|
||||
Volunteer volunteer = newPerson.CreateVolunteer();
|
||||
foreach (int positionId in positionIdsVolunteer)
|
||||
{
|
||||
volunteer.AddPosition (Position.FromIdentity (positionId));
|
||||
}
|
||||
}
|
||||
|
||||
newPerson.LastLogonOrganizationId = organizationId;
|
||||
|
||||
// Create a welcome message to the Dashboard
|
||||
|
||||
HttpContext.Current.Response.AppendCookie (new HttpCookie ("DashboardMessage", CommonV5.JavascriptEscape(String.Format(Resources.Pages.Public.Signup_DashboardMessage, organization.Name))));
|
||||
|
||||
// Set authentication cookie, which will log the new person in using the credentials just given
|
||||
|
||||
FormsAuthentication.SetAuthCookie (Authority.FromLogin (newPerson).ToEncryptedXml(), true);
|
||||
|
||||
AjaxCallResult result = new AjaxCallResult {Success = true};
|
||||
return result;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static AjaxCallResult CheckMailFree (string mail)
|
||||
{
|
||||
People people = People.FromMail (mail);
|
||||
// This should be zero
|
||||
|
||||
if (people.Count == 0)
|
||||
{
|
||||
return new AjaxCallResult {Success = true};
|
||||
}
|
||||
|
||||
return new AjaxCallResult {Success = false};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ body.rtl .swMain ul.anchor li a .stepDesc {
|
||||
/* background: #EA8511; */
|
||||
}
|
||||
|
||||
.swMain ul.anchor li a.done {
|
||||
.swMain ul.anchor li a.done:not(.crossout) {
|
||||
position:relative;
|
||||
color:#FFF;
|
||||
background: #8CC63F;
|
||||
@@ -228,6 +228,24 @@ body.rtl .swMain ul.anchor li a .stepDesc {
|
||||
background: #F8F8F8;
|
||||
}
|
||||
|
||||
|
||||
.swMain ul.anchor li a.crossout, .swMain ul.anchor li a.crossout:hover {
|
||||
background:
|
||||
linear-gradient(to top left,
|
||||
rgba(0,0,0,0) 0%,
|
||||
rgba(0,0,0,0) calc(50% - 2px),
|
||||
rgba(0,0,0,.2) 50%,
|
||||
rgba(0,0,0,0) calc(50% + 2px),
|
||||
rgba(0,0,0,0) 100%),
|
||||
linear-gradient(to top right,
|
||||
rgba(0,0,0,0) 0%,
|
||||
rgba(0,0,0,0) calc(50% - 2px),
|
||||
rgba(0,0,0,.2) 50%,
|
||||
rgba(0,0,0,0) calc(50% + 2px),
|
||||
rgba(0,0,0,0) 100%);
|
||||
}
|
||||
|
||||
|
||||
.swMain ul.anchor li a.error {
|
||||
color:#6c6c6c !important;
|
||||
background: #f08f75 !important;
|
||||
|
||||
Reference in New Issue
Block a user