diff --git a/Site5/App_GlobalResources/Pages.Comms.resx b/Site5/App_GlobalResources/Pages.Comms.resx new file mode 100644 index 00000000..64516259 --- /dev/null +++ b/Site5/App_GlobalResources/Pages.Comms.resx @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Who are located in + + + Your Message + + + Send a message to a group of people in the organization. You can send the message by mail (good for newsletters and general information) or to their phones (very intrusive, and also costs a bit). + + + This message would have been sent to the recipients. For the time being, this is a mock-up interface. + + + No Recipients|One Recipient|{0:N0} Recipients + Vertical bar divides none|one|many + + + Send a mass message to all + + + Send Message + + + Your message is now being distributed to recipients. You will be notified when transmission is complete. + + + Test Message + + + The message has been sent to you, so you can see what it looks like before going live. + + + Send Mass Message + + \ No newline at end of file diff --git a/Site5/Pages/v5/Comms/SendMassMessage.aspx b/Site5/Pages/v5/Comms/SendMassMessage.aspx new file mode 100644 index 00000000..ad642081 --- /dev/null +++ b/Site5/Pages/v5/Comms/SendMassMessage.aspx @@ -0,0 +1,36 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="SendMassMessage.aspx.cs" Inherits="Swarmops.Frontend.Pages.Comms.SendMassMessage" %> +<%@ Register src="~/Controls/v5/UI/ExternalScripts.ascx" tagname="ExternalScripts" tagprefix="Swarmops5" %> +<%@ Register src="~/Controls/v5/Base/ComboGeographies.ascx" tagname="ComboGeographies" tagprefix="Swarmops5" %> + + + + + + + + + +
+
+  
+
+
+
+
+
+

(0)

+ + +
+ + + diff --git a/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs b/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs new file mode 100644 index 00000000..90a9e8ec --- /dev/null +++ b/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceModel.Security; +using System.Web; +using System.Web.Services; +using System.Web.UI; +using System.Web.UI.WebControls; +using Swarmops.Basic.Enums; +using Swarmops.Database; +using Swarmops.Logic.Financial; +using Swarmops.Logic.Security; + +namespace Swarmops.Frontend.Pages.Comms +{ + public partial class SendMassMessage : PageV5Base + { + protected void Page_Load(object sender, EventArgs e) + { + this.PageIcon = "iconshock-group-search"; + + if (!Page.IsPostBack) + { + Localize(); + } + + this.TextMessage.Style[HtmlTextWriterStyle.Width] = "674px"; + this.TextMessage.Style["resize"] = "none"; + } + + private void Localize() + { + this.PageTitle = Resources.Pages.Comms.SendMassMessage_Title; + this.InfoBoxLiteral = Resources.Pages.People.ListFindPeople_Info; + this.LabelGeography.Text = Resources.Pages.Comms.SendMassMessage_Geography; + this.LabelRecipientType.Text = Resources.Pages.Comms.SendMassMessage_RecipientType; + this.LabelHeaderMessage.Text = Resources.Pages.Comms.SendMassMessage_HeaderMessage; + + this.DropRecipientClasses.Items.Clear(); + this.DropRecipientClasses.Items.Add(new ListItem(Resources.Global.Global_SelectOne)); + this.DropRecipientClasses.Items.Add(new ListItem("[Regulars]", "1")); + this.DropRecipientClasses.Items.Add(new ListItem("[Agents]", "2")); + this.DropRecipientClasses.Items.Add(new ListItem("Officers", "3")); + this.DropRecipientClasses.Items.Add(new ListItem("Volunteers", "4")); + } + + public struct ConfirmPayoutResult + { + public int AssignedId; + public string DisplayMessage; + }; + + [WebMethod] + public static ConfirmPayoutResult ConfirmPayout (string protoIdentity) + { + protoIdentity = HttpUtility.UrlDecode(protoIdentity); + + AuthenticationData authData = GetAuthenticationDataAndCulture(); + + if (!authData.CurrentUser.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials, AccessType.Write))) + { + throw new SecurityAccessDeniedException("Insufficient privileges for operation"); + } + + ConfirmPayoutResult result = new ConfirmPayoutResult(); + + Payout payout = Payout.CreateFromProtoIdentity(authData.CurrentUser, protoIdentity); + Swarmops.Logic.Support.PWEvents.CreateEvent(EventSource.PirateWeb, EventType.PayoutCreated, + authData.CurrentUser.Identity, 1, 1, 0, payout.Identity, + protoIdentity); + + // Create result and return it + + result.AssignedId = payout.Identity; + result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCreated, payout.Identity, + payout.Recipient); + + result.DisplayMessage = HttpUtility.UrlEncode(result.DisplayMessage).Replace("+", "%20"); + + return result; + } + + public struct UndoPayoutResult + { + public bool Success; + public string DisplayMessage; + } + + [WebMethod] + public static UndoPayoutResult UndoPayout (int databaseId) + { + AuthenticationData authData = GetAuthenticationDataAndCulture(); + UndoPayoutResult result = new UndoPayoutResult(); + + Payout payout = Payout.FromIdentity(databaseId); + + if (!payout.Open) + { + // this payout has already been settled, or picked up for settling + + result.Success = false; + result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCannotUndo, + databaseId); + + return result; + } + + payout.UndoPayout(); + + result.DisplayMessage = HttpUtility.UrlEncode(String.Format(Resources.Pages.Financial.PayOutMoney_PayoutUndone, databaseId)).Replace("+","%20"); + result.Success = true; + return result; + } + } + +} \ No newline at end of file