Checkpoint commit for SendMassMessage
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="SendMassMessage_Geography" xml:space="preserve">
|
||||
<value>Who are located in</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_HeaderMessage" xml:space="preserve">
|
||||
<value>Your Message</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_Info" xml:space="preserve">
|
||||
<value>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).</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_MockMessageResult" xml:space="preserve">
|
||||
<value>This message would have been sent to the recipients. For the time being, this is a mock-up interface.</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_RecipientCount" xml:space="preserve">
|
||||
<value>No Recipients|One Recipient|{0:N0} Recipients</value>
|
||||
<comment>Vertical bar divides none|one|many</comment>
|
||||
</data>
|
||||
<data name="SendMassMessage_RecipientType" xml:space="preserve">
|
||||
<value>Send a mass message to all</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_SendMessage" xml:space="preserve">
|
||||
<value>Send Message</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_SendMessageResult" xml:space="preserve">
|
||||
<value>Your message is now being distributed to recipients. You will be notified when transmission is complete.</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_TestMessage" xml:space="preserve">
|
||||
<value>Test Message</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_TestMessageResult" xml:space="preserve">
|
||||
<value>The message has been sent to you, so you can see what it looks like before going live.</value>
|
||||
</data>
|
||||
<data name="SendMassMessage_Title" xml:space="preserve">
|
||||
<value>Send Mass Message</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -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" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<Swarmops5:ExternalScripts ID="ExternalScripts2" Package="easyui" Control="tree" runat="server" />
|
||||
<link rel="stylesheet" type="text/css" href="/Style/v5-easyui-elements.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
// Document.Ready() goes here
|
||||
});
|
||||
|
||||
var selectedReceipientClass = 1;
|
||||
var selectedGeographyId = 1; // TODO: SET ROOT GEOGRAPHY BY AUTHORITY/ACCESS
|
||||
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<div class="entryFields" style="padding-top:4px">
|
||||
<asp:DropDownList runat="server" ID="DropRecipientClasses"/><br/>
|
||||
<Swarmops5:ComboGeographies ID="ComboGeographies" runat="server" OnClientSelect="onGeographyChange" /> <br/>
|
||||
</div>
|
||||
<div class="entryLabels" style="padding-top:10px">
|
||||
<asp:Label ID="LabelRecipientType" runat="server" /><br/>
|
||||
<asp:Label ID="LabelGeography" runat="server" /><br/>
|
||||
</div>
|
||||
<h2 style="padding-top:15px"><asp:Label ID="LabelHeaderMessage" runat="server" /> (<span id="spanRecipientCount">0</span>)</h2>
|
||||
<asp:TextBox runat="server" TextMode="MultiLine" Rows="10" ID="TextMessage" />
|
||||
<asp:Button runat="server" Text="Foo"/>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user