Added position theme select on Create Org

This commit is contained in:
Rick Falkvinge
2015-05-02 13:51:09 +02:00
parent 8b11b72d4d
commit 539b2aafcc
9 changed files with 70 additions and 13 deletions
+6 -1
View File
@@ -11,10 +11,15 @@ namespace Swarmops.Common.Enums
Unknown = 0,
/// <summary>
/// Use the default title for the position type (commercial titles).
/// Use the default title for the position type (kind-of-commercial titles).
/// </summary>
Default,
/// <summary>
/// Use titles that are typical of a commercial corporation.
/// </summary>
Commercial,
/// <summary>
/// Use titles that are customized for nonprofit organizations ("secretary general" instead of "ceo", etc).
/// </summary>
+18
View File
@@ -339,6 +339,24 @@ namespace Swarmops.Logic.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Deputy Secretary General.
/// </summary>
internal static string Position_Executive_VicePresident_Nonprofit {
get {
return ResourceManager.GetString("Position_Executive_VicePresident_Nonprofit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Deputies Secretary General.
/// </summary>
internal static string Position_Executive_VicePresident_Nonprofit_Plural {
get {
return ResourceManager.GetString("Position_Executive_VicePresident_Nonprofit_Plural", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Vice Presidents.
/// </summary>
@@ -210,6 +210,12 @@
<data name="Position_Executive_VicePresident" xml:space="preserve">
<value>Vice President</value>
</data>
<data name="Position_Executive_VicePresident_Nonprofit" xml:space="preserve">
<value>Deputy Secretary General</value>
</data>
<data name="Position_Executive_VicePresident_Nonprofit_Plural" xml:space="preserve">
<value>Deputies Secretary General</value>
</data>
<data name="Position_Executive_VicePresident_Plural" xml:space="preserve">
<value>Vice Presidents</value>
</data>
+1 -5
View File
@@ -430,7 +430,7 @@ namespace Swarmops.Logic.Swarm
return null;
}
return Image.FromFile (@"C:\Data\Uploads\PirateWeb\" + docs[0].ServerFileName);
return Image.FromFile (@"/usr/share/swarmops/upload/" + docs[0].ServerFileName);
}
}
@@ -615,10 +615,6 @@ namespace Swarmops.Logic.Swarm
// Note "for writing". Intentional. Queries master db and bypasses replication lag.
}
public Authority GetDefaultAuthority()
{
throw new NotImplementedException();
}
public Memberships GetMemberships (bool includeTerminated)
{
+15 -3
View File
@@ -184,13 +184,23 @@ namespace Swarmops.Logic.Swarm
public static string Localized(PositionType type, PositionTitle title, bool plural = false)
{
string titleString = type.ToString();
string titleStringUntyped = type.ToString();
string titleStringTyped = titleStringUntyped + "_" + title.ToString();
if (plural)
{
titleString += "_Plural";
titleStringUntyped += "_Plural";
titleStringTyped += "_Plural";
}
return Logic_Swarm_Position.ResourceManager.GetString("Position_" + titleString);
string testResult = Logic_Swarm_Position.ResourceManager.GetString("Position_" + titleStringTyped);
if (!String.IsNullOrEmpty (testResult))
{
return testResult;
}
return Logic_Swarm_Position.ResourceManager.GetString("Position_" + titleStringUntyped);
}
@@ -203,6 +213,8 @@ namespace Swarmops.Logic.Swarm
throw new ArgumentNullException ("access", @"Access requested must always be specified. Use AccessAspect.Null if null access is desired (and access should always be true).");
}
return false;
}
}
@@ -150,6 +150,15 @@
<value>The new organization has been created. You have been given an initial two-year {0} in the organization, so you can work with it and set it up properly. To switch to working with your new organization, use the control panel top right.</value>
<comment>The {0} is membership, employment, citizenship, residence, etc.</comment>
</data>
<data name="CreateOrganization_Titles" xml:space="preserve">
<value>Default position titles at start</value>
</data>
<data name="CreateOrganization_Titles_Commercial" xml:space="preserve">
<value>Commercial</value>
</data>
<data name="CreateOrganization_Titles_Nonprofit" xml:space="preserve">
<value>Nonprofit</value>
</data>
<data name="EditOrganization_Info" xml:space="preserve">
<value>&lt;strong&gt;WORK IN PROGRESS.&lt;/strong&gt; Most of these options don't save yet.</value>
</data>
+3 -2
View File
@@ -1,5 +1,4 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="CreateOrganization.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Admin.CreateOrganization" %>
<%@ Register TagPrefix="Swarmops5" TagName="DropDown" Src="~/Controls/v5/Base/DropDown.ascx" %>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<script type="text/javascript">
@@ -24,6 +23,7 @@
<Swarmops5:DropDown runat="server" ID="DropCurrencies"/>&#8203;<br/>
<Swarmops5:DropDown runat="server" ID="DropPersonLabel" />&#8203;<br/>
<Swarmops5:DropDown runat="server" ID="DropActivistLabel" />&#8203;<br/>
<Swarmops5:DropDown runat="server" ID="DropPositionLabel" />&#8203;<br/>
<asp:Button ID="ButtonCreate" runat="server" CssClass="buttonAccentColor NoInputFocus" OnClientClick=" return validateFields(); " OnClick="ButtonCreate_Click" Text="CreateXYZ"/>
</div>
<div class="entryLabels">
@@ -31,7 +31,8 @@
<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" />
<asp:Label runat="server" ID="LabelActivistLabel" /><br/>
<asp:Label runat="server" ID="LabelPositionLabel" />
</div>
<div style="clear: both"></div>
</asp:Content>
@@ -4,6 +4,7 @@ using System.Globalization;
using System.Web;
using System.Web.UI.WebControls;
using Resources;
using Swarmops.Common.Enums;
using Swarmops.Interface.Support;
using Swarmops.Logic.Financial;
using Swarmops.Logic.Security;
@@ -36,19 +37,22 @@ namespace Swarmops.Frontend.Pages.v5.Admin
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.LabelPositionLabel.Text = Resources.Pages.Admin.CreateOrganization_Titles;
this.ButtonCreate.Text = Global.Global_Create;
this.DropPersonLabel.Items.Clear();
this.DropActivistLabel.Items.Clear();
this.DropCurrencies.Items.Clear();
this.DropCreateChild.Items.Clear();
this.DropPositionLabel.Items.Clear();
this.DropPersonLabel.Items.Add (new ListItem (Global.Global_SelectOne, "0"));
this.DropActivistLabel.Items.Add (new ListItem (Global.Global_SelectOne, "0"));
this.DropCurrencies.Items.Add (new ListItem (Global.Global_SelectOne, "0"));
this.DropCreateChild.Items.Add (new ListItem (Global.Global_SelectOne, "0"));
this.DropPositionLabel.Items.Add (new ListItem(Resources.Pages.Admin.CreateOrganization_Titles_Nonprofit, "Nonprofit"));
this.DropPositionLabel.Items.Add (new ListItem(Resources.Pages.Admin.CreateOrganization_Titles_Commercial, "Commercial"));
this.DropCreateChild.Items.Add (new ListItem (Resources.Pages.Admin.CreateOrganization_AsRoot, "Root"));
this.DropCreateChild.Items.Add (
@@ -128,6 +132,11 @@ namespace Swarmops.Frontend.Pages.v5.Admin
newOrganization.RegularLabel = peopleLabel;
newOrganization.ActivistLabel = activistLabel;
PositionTitle titleType =
(PositionTitle) (Enum.Parse (typeof (PositionTitle), this.DropPositionLabel.SelectedValue));
Positions.CreateOrganizationDefaultPositions (newOrganization, titleType);
Membership.Create (CurrentUser, newOrganization, DateTime.UtcNow.AddYears (2));
string successMessage = String.Format (Resources.Pages.Admin.CreateOrganization_Success,
@@ -140,7 +149,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
Response.Redirect (
"/Pages/v5/Security/SetCurrentOrganization.aspx?OrganizationId=" +
newOrganization.Identity.ToString (CultureInfo.InvariantCulture) +
"&ReturnUrl=/Pages/v5/Admin/EditOrganization.aspx", true);
"&ReturnUrl=/Admin/OrgSettings", true);
}
}
}
+1
View File
@@ -26,6 +26,7 @@
</authorization>
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
<controls>
<add tagPrefix="Swarmops5" tagName="DropDown" src="~/Controls/v5/Base/DropDown.ascx" />
<add tagPrefix="Swarmops5" tagName="ComboPeople" src="~/Controls/v5/Swarm/ComboPeople.ascx" />
<add tagPrefix="Swarmops5" tagName="AjaxTextBox" src="~/Controls/v5/Base/AjaxTextBox.ascx" />
<add tagPrefix="Swarmops5" tagName="AjaxComboPeople" src="~/Controls/v5/Swarm/ComboPeople.ascx" />