Added CreateOrganization page mockup

This commit is contained in:
Rick Falkvinge
2014-10-12 13:34:37 +02:00
parent 7fc6b6831d
commit 21279148d8
12 changed files with 381 additions and 47 deletions
+4 -4
View File
@@ -4,16 +4,16 @@ namespace Swarmops.Basic.Types
{
public class BasicCurrency: IHasIdentity
{
public BasicCurrency (int currencyId, string code, string description, string sign)
public BasicCurrency (int currencyId, string code, string name, string sign)
{
this.CurrencyId = currencyId;
this.Code = code;
this.Description = description;
this.Name = name;
this.Sign = sign;
}
public BasicCurrency (BasicCurrency original)
: this (original.CurrencyId, original.Code, original.Description, original.Sign)
: this (original.CurrencyId, original.Code, original.Name, original.Sign)
{
// empty copy ctor
}
@@ -21,7 +21,7 @@ namespace Swarmops.Basic.Types
public int CurrencyId { get; private set; }
public string Code { get; private set; }
public string Description { get; private set; }
public string Name { get; private set; }
public string Sign { get; private set; }
public int Identity
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Swarmops.Basic.Types;
using Swarmops.Database;
using Swarmops.Logic.Support;
namespace Swarmops.Logic.Financial
{
public class Currencies: PluralBase<Currencies,Currency,BasicCurrency>
{
public static Currencies GetAll()
{
return FromArray(SwarmDb.GetDatabaseForReading().GetCurrencies());
}
}
}
+1
View File
@@ -94,6 +94,7 @@
<Compile Include="Communications\Transmission\NotificationPayload.cs" />
<Compile Include="Communications\Transmission\PayloadBase.cs" />
<Compile Include="Financial\BankDataReaders\SEPaymentsBankgiroReader.cs" />
<Compile Include="Financial\Currencies.cs" />
<Compile Include="Financial\IBankDataAccountStatementReader.cs" />
<Compile Include="Financial\IBankDataPaymentsReader.cs" />
<Compile Include="Financial\BankDataReaders\TabSeparatedValuesReader.cs" />
+4 -1
View File
@@ -84,6 +84,9 @@ namespace Swarmops.Logic.Support
case "Swarmops.Basic.Types.BasicSalary":
return Salary.FromBasic((BasicSalary) basic);
case "Swarmops.Basic.Types.BasicCurrency":
return Currency.FromBasic((BasicCurrency) basic);
case "Swarmops.Basic.Types.Financial.BasicFinancialTransactionTagSet":
return FinancialTransactionTagSet.FromBasic ((BasicFinancialTransactionTagSet) basic);
@@ -131,7 +134,7 @@ namespace Swarmops.Logic.Support
// ------------------ FAIL ----------------
default:
throw new NotImplementedException("Unimplemented argument type: " + argumentType);
throw new NotImplementedException("Unimplemented argument type in SingularFactory: " + argumentType);
}
+24 -2
View File
@@ -677,7 +677,7 @@
<value>Operatives</value>
</data>
<data name="Title_Operative_Ship" xml:space="preserve">
<value>NO IDEA SORRY - TODO</value>
<value>Operativehood</value>
</data>
<data name="Title_Regular_Corps" xml:space="preserve">
<value>Corps</value>
@@ -695,7 +695,7 @@
<value>Regulars</value>
</data>
<data name="Title_Regular_Ship" xml:space="preserve">
<value>I HAVE NO IDEA WHAT THIS SHOULD BE - TODO</value>
<value>Regularhood</value>
</data>
<data name="Title_Sailor_Corps" xml:space="preserve">
<value>Crew</value>
@@ -715,4 +715,26 @@
<data name="Title_Sailor_Ship" xml:space="preserve">
<value>Seamanship</value>
</data>
<data name="Global_Create" xml:space="preserve">
<value>Create</value>
<comment>Like "Create Organization"</comment>
</data>
<data name="Title_Person_Corps" xml:space="preserve">
<value>Forces</value>
</data>
<data name="Title_Person_Female" xml:space="preserve">
<value>Person</value>
</data>
<data name="Title_Person_Generic" xml:space="preserve">
<value>Person</value>
</data>
<data name="Title_Person_Male" xml:space="preserve">
<value>Person</value>
</data>
<data name="Title_Person_Plural" xml:space="preserve">
<value>People</value>
</data>
<data name="Title_Person_Ship" xml:space="preserve">
<value>Personhood</value>
</data>
</root>
+149
View File
@@ -0,0 +1,149 @@
<?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="CreateOrganization_ActivistTitle" xml:space="preserve">
<value>Activists will be called</value>
</data>
<data name="CreateOrganization_AsRoot" xml:space="preserve">
<value>Root-level organization</value>
</data>
<data name="CreateOrganization_ChildOfX" xml:space="preserve">
<value>Child of {0}</value>
<comment>"Create org as..."</comment>
</data>
<data name="CreateOrganization_CreateNewOrgAs" xml:space="preserve">
<value>Create new organization as...</value>
</data>
<data name="CreateOrganization_Info" xml:space="preserve">
<value>You can create a new organization either as a new standalone organization, or as a child organization of the current one. (In a child organization, everybody with responsibility in the parent organization automatically has corresponding rights and privileges.)</value>
</data>
<data name="CreateOrganization_NewOrgCurrency" xml:space="preserve">
<value>Operating currency</value>
</data>
<data name="CreateOrganization_NewOrgName" xml:space="preserve">
<value>The new organization's name</value>
</data>
<data name="CreateOrganization_PageTitle" xml:space="preserve">
<value>Create New Organization</value>
</data>
<data name="CreateOrganization_RegularTitle" xml:space="preserve">
<value>Regular people will be called</value>
<comment>This can be "members", etc.</comment>
</data>
</root>
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-AvailableCurrencies.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_AvailableCurrencies" %>
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using Swarmops.Logic.Financial;
using Swarmops.Logic.Structure;
namespace Swarmops.Frontend.Automation
{
public partial class Json_AvailableCurrencies : DataV5Base
{
protected void Page_Load(object sender, EventArgs e)
{
GetAuthenticationDataAndCulture();
Response.ContentType = "application/json";
// Is this stuff in cache already?
string cacheKey = "Currencies-Json-" + Thread.CurrentThread.CurrentCulture.Name;
string currenciesJson =
(string) Cache[cacheKey];
if (currenciesJson != null)
{
Response.Output.WriteLine(currenciesJson);
Response.End();
return;
}
Currencies currencies = Currencies.GetAll();
List<string> currencyStrings = new List<string>();
foreach (Currency currency in currencies)
{
currencyStrings.Add(String.Format("{0} {1}|{0}", currency.Code, currency.Name));
}
currencyStrings.Sort();
currenciesJson = "[";
foreach (string currencyString in currencyStrings)
{
string[] parts = currencyString.Split('|');
currenciesJson += "{" + String.Format("\"label\":\"{0}\",\"code\":\"{1}\"", parts[0], parts[1]) + "},";
}
currenciesJson = currenciesJson.TrimEnd(',') + "]";
Cache.Insert(cacheKey, currenciesJson, null, DateTime.Now.AddMinutes(60), TimeSpan.Zero);
// cache lasts for sixty minutes, no sliding expiration
Response.Output.WriteLine(currenciesJson);
Response.End();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+3 -3
View File
@@ -361,11 +361,11 @@
<Type>Submenu</Type>
<Children>
<!-- MainMenuItem>
<MainMenuItem>
<ResourceKey>Administration_CreateOrganization</ResourceKey>
<UserLevel>4</UserLevel>
<Permissions />
<ImageUrl>iconshock-cabinet</ImageUrl>
<ImageUrl>iconshock-organization-add</ImageUrl>
<NavigateUrl>/Pages/v5/Admin/CreateOrganization.aspx</NavigateUrl>
<Type>Link</Type>
<Children />
@@ -375,7 +375,7 @@
<UserLevel>1</UserLevel>
<Type>Separator</Type>
<Children />
</MainMenuItem> -->
</MainMenuItem>
<MainMenuItem>
<ResourceKey />
+49 -33
View File
@@ -1,23 +1,55 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="CreateOrganization.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Admin.CreateOrganization" %>
<%@ Register src="~/Controls/v5/Base/FileUpload.ascx" tagname="FileUpload" tagprefix="Swarmops5" %>
<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %>
<%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<Swarmops5:ExternalScripts ID="ExternalScripts1" Package="easyui" Control="tree" runat="server" />
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="/Scripts/jquery.fileupload/jquery.iframe-transport.js" type="text/javascript" language="javascript"></script>
<!-- The basic File Upload plugin -->
<script src="/Scripts/jquery.fileupload/jquery.fileupload.js" type="text/javascript" language="javascript"></script>
<link rel="stylesheet" type="text/css" href="/Style/v5-easyui-elements.css">
<script type="text/javascript">
$(document).ready(function () {
$('#<%=this.TextOrganizationName.ClientID %>').focus();
$('#<%=this.DropCreateChild.ClientID %>').combobox({
editable: false,
height: 30,
width: 300,
textField: 'label',
valueField: 'id',
data: [{
'label': "<%= Resources.Global.Global_SelectOne %>",
'id': '0'
}, {
'label': "<%= Resources.Pages.Admin.CreateOrganization_AsRoot%>",
'id': 'Root'
}, {
'label': "<%= String.Format(Resources.Pages.Admin.CreateOrganization_ChildOfX, this.CurrentOrganization.Name)%>",
'id': 'Child'
}]
});
$('#<%=this.DropCurrencies.ClientID%>').combobox({
editable: false,
height: 30,
width: 300
});
$('#<%=this.DropPersonLabel.ClientID%>').combobox({
editable: false,
height: 30,
width: 300
});
$('#<%=this.DropActivistLabel.ClientID%>').combobox({
editable: false,
height: 30,
width: 300
});
});
function validateFields() {
return true; // TODO: validate the input fields
}
</script>
@@ -27,34 +59,18 @@
<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div class="entryFields">
<asp:TextBox runat="server" ID="TextOrganizationName" />&#8203;<br/>
<asp:DropDownList runat="server" ID="DropCurrencies"/>
<asp:DropDownList runat="server" ID="DropPeopleLabel" />
&nbsp;<br/><!-- placeholder for label-side H2 -->
<!-- file upload begins here -->
<Swarmops5:FileUpload ID="FileUpload" runat="server" Filter="ImagesOnly" />
<!-- file upload ends -->
&nbsp;<br/><!-- placeholder for label-side H2 -->
<asp:TextBox runat="server" ID="TextBank" />&#8203;<br/>
<asp:TextBox runat="server" ID="TextClearing" />&#8203;<br/>
<asp:TextBox runat="server" ID="TextAccount" />&nbsp;<br/>
<asp:Button ID="ButtonRequest" runat="server" CssClass="buttonAccentColor NoInputFocus" OnClientClick="return validateFields();" OnClick="ButtonRequest_Click" Text="Request"/>
<asp:DropDownList runat="server" ID="DropCreateChild" />&#8203;<br/>
<asp:DropDownList runat="server" ID="DropCurrencies"/>&#8203;<br/>
<asp:DropDownList runat="server" ID="DropPersonLabel" />&#8203;<br/>
<asp:DropDownList runat="server" ID="DropActivistLabel" />&#8203;<br/>
<asp:Button ID="ButtonCreate" runat="server" CssClass="buttonAccentColor NoInputFocus" OnClientClick="return validateFields();" OnClick="ButtonCreate_Click" Text="CreateXYZ"/>
</div>
<div class="entryLabels">
<asp:Label runat="server" ID="LabelAmount" /><br/>
<asp:Label runat="server" ID="LabelPurpose" /><br/>
<asp:Label runat="server" ID="LabelBudget" /><br/>
<asp:Repeater ID="RepeaterTagLabels" runat="server"><ItemTemplate><%# Eval("TagSetLocalizedName") %><br/></ItemTemplate></asp:Repeater>
<h2><asp:Label runat="server" ID="LabelHeaderImageFiles" /></h2>
<asp:Label runat="server" ID="LabelImageFiles" /><br/>
<h2><asp:Label runat="server" ID="LabelHeaderBankDetails" /></h2>
<asp:Label runat="server" ID="LabelBankName" /><br/>
<asp:Label runat="server" ID="LabelBankClearing" /><br/>
<asp:Label runat="server" ID="LabelBankAccount" />
<asp:Label runat="server" ID="LabelOrganizationName" /><br/>
<asp:Label runat="server" ID="LabelCreateAs" /><br/>
<asp:Label runat="server" ID="LabelNativeCurrency" /><br/>
<asp:Label runat="server" ID="LabelPersonLabel" /><br/>
<asp:Label runat="server" ID="LabelActivistLabel" />
</div>
<div style="clear:both"></div>
</asp:Content>
@@ -1,5 +1,8 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI.WebControls;
using Swarmops.Logic.Financial;
namespace Swarmops.Frontend.Pages.v5.Admin
{
@@ -7,9 +10,9 @@ namespace Swarmops.Frontend.Pages.v5.Admin
{
protected void Page_Load(object sender, EventArgs e)
{
this.PageTitle = Resources.Pages.Financial.FileExpenseClaim_PageTitle;
this.PageIcon = "iconshock-moneyback";
this.InfoBoxLiteral = Resources.Pages.Financial.FileExpenseClaim_Info;
this.PageTitle = Resources.Pages.Admin.CreateOrganization_PageTitle;
this.PageIcon = "iconshock-organization-add";
this.InfoBoxLiteral = Resources.Pages.Admin.CreateOrganization_Info;
if (!Page.IsPostBack)
{
@@ -18,13 +21,73 @@ namespace Swarmops.Frontend.Pages.v5.Admin
}
private readonly string[] _personLabels =
{
"Activist", "Person", "Sailor", "Regular", "Ambassador", "Salesperson",
"Member", "Operative", "Employee", "Customer", "Conscript", "Resident", "Citizen", "Agent"
};
private void Localize()
{
this.LabelOrganizationName.Text = Resources.Pages.Admin.CreateOrganization_NewOrgName;
this.LabelActivistLabel.Text = Resources.Pages.Admin.CreateOrganization_ActivistTitle;
this.LabelCreateAs.Text = Resources.Pages.Admin.CreateOrganization_CreateNewOrgAs;
this.LabelNativeCurrency.Text = Resources.Pages.Admin.CreateOrganization_NewOrgCurrency;
this.LabelPersonLabel.Text = Resources.Pages.Admin.CreateOrganization_RegularTitle;
this.ButtonCreate.Text = Resources.Global.Global_Create;
this.DropPersonLabel.Items.Clear();
this.DropActivistLabel.Items.Clear();
this.DropCurrencies.Items.Clear();
this.DropCreateChild.Items.Clear();
this.DropPersonLabel.Items.Add(new ListItem(Resources.Global.Global_SelectOne, "0"));
this.DropActivistLabel.Items.Add(new ListItem(Resources.Global.Global_SelectOne, "0"));
this.DropCurrencies.Items.Add(new ListItem(Resources.Global.Global_SelectOne, "0"));
this.DropCreateChild.Items.Add(new ListItem(Resources.Global.Global_SelectOne, "0"));
List<string> localizedPersonLabels = new List<string>();
foreach (string personLabel in _personLabels)
{
string localizedPersonLabel =
Resources.Global.ResourceManager.GetString("Title_" + personLabel + "_Plural");
localizedPersonLabels.Add(localizedPersonLabel + "|" + personLabel);
}
localizedPersonLabels.Sort();
foreach (string localizedPersonLabel in localizedPersonLabels)
{
string[] parts = localizedPersonLabel.Split('|');
this.DropPersonLabel.Items.Add(new ListItem(parts[0], parts[1]));
this.DropActivistLabel.Items.Add(new ListItem(parts[0], parts[1]));
}
Currencies currencies = Currencies.GetAll();
List<string> currencyStrings = new List<string>();
foreach (Currency currency in currencies)
{
currencyStrings.Add(String.Format("{0} {1}|{0}", currency.Code, currency.Name));
}
currencyStrings.Sort();
foreach (string currencyString in currencyStrings)
{
string[] parts = currencyString.Split('|');
this.DropCurrencies.Items.Add(new ListItem(parts[0], parts[1]));
}
}
protected void ButtonRequest_Click(object sender, EventArgs e)
protected void ButtonCreate_Click(object sender, EventArgs e)
{
string successMessage = string.Empty;