Checkpoint commit on Signup

This commit is contained in:
Rick Falkvinge
2015-05-18 12:51:21 +02:00
parent 095e87cc32
commit e3f9c73267
6 changed files with 782 additions and 675 deletions
@@ -228,6 +228,18 @@
<data name="Signup_Todo_Complete" xml:space="preserve">
<value>Complete signup.</value>
</data>
<data name="Signup_VolunteerHeader" xml:space="preserve">
<value>What position are you interested in?</value>
</data>
<data name="Signup_VolunteerTableHeaderGeography" xml:space="preserve">
<value>Highest Geography</value>
</data>
<data name="Signup_VolunteerTableHeaderPosition" xml:space="preserve">
<value>Position</value>
</data>
<data name="Signup_VolunteerText" xml:space="preserve">
<value>Check the position you'd like to volunteer/apply for. You can check several.</value>
</data>
<data name="Signup_Welcome" xml:space="preserve">
<value>Welcome to {0}</value>
<comment>The {0} is the organization name</comment>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!--
The only override for the Pages/Public, Style, Images, and Security folders is that no authentication is required.
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</configuration>
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-SignupVolunteerPositions.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Public.Json_SignupVolunteerPositions" %>
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Swarmops.Common.Enums;
using Swarmops.Logic.Financial;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Swarm;
namespace Swarmops.Frontend.Pages.v5.Public
{
public partial class Json_SignupVolunteerPositions : DataV5Base
{
protected void Page_Load (object sender, EventArgs e)
{
// No access control on page - this is called from Signup
_organization = Organization.FromIdentity (Convert.ToInt32 (Request["OrganizationId"]));
int geographyId = Convert.ToInt32 (Request["GeographyId"]);
if (geographyId != 0)
{
_geography = Geography.FromIdentity (geographyId);
}
Positions positions = Positions.ForOrganization (_organization).AtLevel (PositionLevel.GeographyDefault);
// Format as JSON and return
CommonV5.CulturePreInit (Request); // Sets the culture
Response.ContentType = "application/json";
string json = FormatAsJson (positions);
Response.Output.WriteLine (json);
Response.End();
}
private Organization _organization;
private Geography _geography;
private string FormatAsJson (Positions positions)
{
StringBuilder result = new StringBuilder (16384);
result.Append ("[");
foreach (Position position in positions)
{
if (position.Volunteerable)
{
StringBuilder extraTags = new StringBuilder();
result.Append ("{");
result.AppendFormat (
"\"positionId\":\"{0}\",\"positionTitle\":\"{1}\",\"highestGeography\":\"{2}\",\"positionDescription\":\"{3}\"",
position.Identity, JsonSanitize(position.Localized()), string.Empty /* geography */, string.Empty /* description */);
result.Append ("},");
}
}
if (result.Length > 0)
{
result.Remove (result.Length - 1, 1); // remove last comma
}
result.Append ("]");
return result.ToString();
}
}
}
File diff suppressed because it is too large Load Diff
+5
View File
@@ -156,6 +156,11 @@ namespace Swarmops.Frontend.Pages.Public
this.RadioActivationVolunteer.Text = Resources.Pages.Public.Signup_ActivationVolunteerHeader;
this.LabelActivationVolunteerText.Text = Resources.Pages.Public.Signup_ActivationVolunteer;
this.LabelVolunteerHeaderHighestGeography.Text = Resources.Pages.Public.Signup_VolunteerTableHeaderGeography;
this.LabelVolunteerHeaderPositionTitle.Text = Resources.Pages.Public.Signup_VolunteerTableHeaderPosition;
this.LabelVolunteerPositionHeader.Text = Resources.Pages.Public.Signup_VolunteerHeader;
this.LabelVolunteerPositionText.Text = Resources.Pages.Public.Signup_VolunteerText;
// Enable support for RTL languages
if (Thread.CurrentThread.CurrentCulture.TextInfo.IsRightToLeft)