diff --git a/Logic/Resources/Logic.Swarm.Position.Designer.cs b/Logic/Resources/Logic.Swarm.Position.Designer.cs index 4c294e92..c73f15c4 100644 --- a/Logic/Resources/Logic.Swarm.Position.Designer.cs +++ b/Logic/Resources/Logic.Swarm.Position.Designer.cs @@ -69,6 +69,24 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Secretary General Assistant. + /// + internal static string Position_Executive_CeoAssistant_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_CeoAssistant_Nonprofit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Secretary General Assistants. + /// + internal static string Position_Executive_CeoAssistant_Nonprofit_Plural { + get { + return ResourceManager.GetString("Position_Executive_CeoAssistant_Nonprofit_Plural", resourceCulture); + } + } + /// /// Looks up a localized string similar to CEO Assistants. /// @@ -87,6 +105,24 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Financial Assistant. + /// + internal static string Position_Executive_CfoAssistant_Nonprofict { + get { + return ResourceManager.GetString("Position_Executive_CfoAssistant_Nonprofict", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Financial Assistants. + /// + internal static string Position_Executive_CfoAssistant_Nonprofit_Plural { + get { + return ResourceManager.GetString("Position_Executive_CfoAssistant_Nonprofit_Plural", resourceCulture); + } + } + /// /// Looks up a localized string similar to CFO Assistants. /// @@ -105,6 +141,15 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Secretary General. + /// + internal static string Position_Executive_ChiefExecutiveOfficer_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_ChiefExecutiveOfficer_Nonprofit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Chief Financial Officer. /// @@ -114,6 +159,15 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Treasurer. + /// + internal static string Position_Executive_ChiefFinancialOfficer_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_ChiefFinancialOfficer_Nonprofit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Chief Human Resources Officer. /// @@ -123,6 +177,15 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Chief Community Officer. + /// + internal static string Position_Executive_ChiefHrOfficer_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_ChiefHrOfficer_Nonprofit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Chief Information Officer. /// @@ -141,6 +204,15 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Chief Outreach Officer. + /// + internal static string Position_Executive_ChiefMarketingOfficer_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_ChiefMarketingOfficer_Nonprofit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Chief Operations Officer. /// @@ -150,6 +222,15 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Chief Activism Officer. + /// + internal static string Position_Executive_ChiefOperationsOfficer_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_ChiefOperationsOfficer_Nonprofit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Chief of Staff. /// @@ -177,6 +258,24 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Community Assistant. + /// + internal static string Position_Executive_HrAssistant_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_HrAssistant_Nonprofit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Community Assistants. + /// + internal static string Position_Executive_HrAssistant_Nonprofit_Plural { + get { + return ResourceManager.GetString("Position_Executive_HrAssistant_Nonprofit_Plural", resourceCulture); + } + } + /// /// Looks up a localized string similar to Human Resources Assistants. /// @@ -195,6 +294,24 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Outreach Assistant. + /// + internal static string Position_Executive_MarketingAssistant_Nonprofit { + get { + return ResourceManager.GetString("Position_Executive_MarketingAssistant_Nonprofit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Outreach Assistants. + /// + internal static string Position_Executive_MarketingAssistant_Nonprofit_Plural { + get { + return ResourceManager.GetString("Position_Executive_MarketingAssistant_Nonprofit_Plural", resourceCulture); + } + } + /// /// Looks up a localized string similar to Marketing Assistants. /// diff --git a/Logic/Resources/Logic.Swarm.Position.resx b/Logic/Resources/Logic.Swarm.Position.resx index b2abca10..d1af6616 100644 --- a/Logic/Resources/Logic.Swarm.Position.resx +++ b/Logic/Resources/Logic.Swarm.Position.resx @@ -120,33 +120,60 @@ CEO Assistant + + Secretary General Assistant + + + Secretary General Assistants + CEO Assistants CFO Assistant + + Financial Assistant + + + Financial Assistants + CFO Assistants Chief Executive Officer + + Secretary General + Chief Financial Officer + + Treasurer + Chief Human Resources Officer + + Chief Community Officer + Chief Information Officer Chief Marketing Officer + + Chief Outreach Officer + Chief Operations Officer + + Chief Activism Officer + Chief of Staff @@ -156,12 +183,24 @@ Human Resources Assistant + + Community Assistant + + + Community Assistants + Human Resources Assistants Marketing Assistant + + Outreach Assistant + + + Outreach Assistants + Marketing Assistants diff --git a/Logic/Swarm/Position.cs b/Logic/Swarm/Position.cs index acafbb8b..2dbc6b3d 100644 --- a/Logic/Swarm/Position.cs +++ b/Logic/Swarm/Position.cs @@ -89,25 +89,16 @@ namespace Swarmops.Logic.Swarm } - - public PositionAssignment Assign (Person person, Organization organization, Geography geography, - Person assignedByPerson, Position assignedByPosition, string assignmentNotes, DateTime? expiresUtc) + public PositionAssignment Assign(Person person, Geography geography, Person assignedByPerson, Position assignedByPosition, string assignmentNotes, DateTime? expiresUtc) { - return PositionAssignment.Create (organization, geography, this, person, assignedByPerson, - assignedByPosition, expiresUtc, assignmentNotes); - } - - public PositionAssignment Assign(Person person, Geography geography, Person assignedByPerson, Position assignedByPosition, - string assignmentNotes, DateTime? expiresUtc) - { - return PositionAssignment.Create(this.Organization, geography, this, person, assignedByPerson, + return PositionAssignment.Create (this, geography, person, assignedByPerson, assignedByPosition, expiresUtc, assignmentNotes); } public PositionAssignment Assign(Person person, Person assignedByPerson, Position assignedByPosition, string assignmentNotes, DateTime? expiresUtc) { - return PositionAssignment.Create(this.Organization, this.Geography, this, person, assignedByPerson, + return PositionAssignment.Create(this, null, person, assignedByPerson, assignedByPosition, expiresUtc, assignmentNotes); } diff --git a/Logic/Swarm/PositionAssignment.cs b/Logic/Swarm/PositionAssignment.cs index 9ed64fdc..9d61ef9c 100644 --- a/Logic/Swarm/PositionAssignment.cs +++ b/Logic/Swarm/PositionAssignment.cs @@ -51,27 +51,10 @@ namespace Swarmops.Logic.Swarm get { return Position.FromIdentity (base.PositionId); } } - public static PositionAssignment Create (Organization organization, Geography geography, Position position, + public static PositionAssignment Create(Position position, Geography geography, Person person, Person createdByPerson, Position createdByPosition, DateTime? expiresDateTimeUtc, string assignmentNotes) { - int organizationId = 0; - - if (position.PositionLevel != PositionLevel.OrganizationWideDefaultUnused && - position.PositionLevel != PositionLevel.SystemWide) - { - organizationId = organization.Identity; // can't be null in these cases - } - else - { - if (organization != null) - { - // MUST be null in these cases - - throw new ArgumentException ("Organization cannot be defined when position is systemwide"); - } - } - int geographyId = 0; if (position.PositionLevel == PositionLevel.Geography) @@ -92,7 +75,7 @@ namespace Swarmops.Logic.Swarm // TODO: Verify constraints of max/min counts for position int positionAssignmentId = SwarmDb.GetDatabaseForWriting() - .CreatePositionAssignment (organizationId, geographyId, position.Identity, person.Identity, + .CreatePositionAssignment (position.OrganizationId, geographyId, position.Identity, person.Identity, createdByPersonId, createdByPositionId, expiresDateTimeUtc == null ? DateTime.MaxValue : (DateTime) expiresDateTimeUtc, assignmentNotes); diff --git a/Logic/Swarm/Positions.cs b/Logic/Swarm/Positions.cs index 6adccef7..57b3bbd8 100644 --- a/Logic/Swarm/Positions.cs +++ b/Logic/Swarm/Positions.cs @@ -158,7 +158,7 @@ namespace Swarmops.Logic.Swarm PositionType.Geographic_Deputy, titleType, true, false, localLeader, null, 1, 0); /*Position localAssistants =*/ Position.Create(organization, PositionLevel.GeographyDefault, null, null, - PositionType.Geographic_Assistant, titleType, false, false, localLeader, null, 1, 0); + PositionType.Geographic_Assistant, titleType, false, false, localLeader, null, 0, 0); Position localOutreachLead = Position.Create(organization, PositionLevel.GeographyDefault, null, null, PositionType.Geographic_OutreachLeader, titleType, true, true, localLeader, cmo, 0, 1); diff --git a/Site5/App_GlobalResources/Controls.Swarm.resx b/Site5/App_GlobalResources/Controls.Swarm.resx index a36ab9f1..33eabec7 100644 --- a/Site5/App_GlobalResources/Controls.Swarm.resx +++ b/Site5/App_GlobalResources/Controls.Swarm.resx @@ -187,4 +187,10 @@ Terminate Assignment + + (assign under My Organization) + + + Create new position... + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Admin.resx b/Site5/App_GlobalResources/Pages.Admin.resx index ea8f0dfe..d8c83c13 100644 --- a/Site5/App_GlobalResources/Pages.Admin.resx +++ b/Site5/App_GlobalResources/Pages.Admin.resx @@ -200,6 +200,23 @@ Organization Vanity Domain + + Executive Positions For {0} + The {0} is the org name. + + + Local Builder Positions (At Every Geography) + + + Staff Payroll + + + Strategic Positions For {0} + The {0} is the org name. + + + Volunteers Awating Response + Admin Notifications From Address diff --git a/Site5/Automation/Json-PositionsTree.aspx.cs b/Site5/Automation/Json-PositionsTree.aspx.cs index 371329a3..59462b69 100644 --- a/Site5/Automation/Json-PositionsTree.aspx.cs +++ b/Site5/Automation/Json-PositionsTree.aspx.cs @@ -4,6 +4,7 @@ using System.Globalization; using Swarmops.Common.Enums; using Swarmops.Common.Generics; using Swarmops.Logic.Financial; +using Swarmops.Logic.Security; using Swarmops.Logic.Structure; using Swarmops.Logic.Swarm; @@ -25,6 +26,12 @@ namespace Swarmops.Frontend.Automation if (level == PositionLevel.SystemWide) { Tree systemPositions = Positions.ForSystem().Tree; + + if (CurrentAuthority.HasSystemAccess()) + { + _assignable = true; + } + Response.Output.WriteLine (RecursePositionTree (systemPositions.RootNodes)); Response.End(); return; @@ -42,6 +49,11 @@ namespace Swarmops.Frontend.Automation throw new InvalidOperationException("Positions are not initialized or are missing."); } + if (CurrentAuthority.HasAccess (new Access (CurrentOrganization, AccessAspect.Administration))) + { + _assignable = true; + } + Response.Output.WriteLine(RecursePositionTree(orgStrategicPositions.Tree.RootNodes)); } @@ -55,6 +67,12 @@ namespace Swarmops.Frontend.Automation throw new InvalidOperationException("Positions are not initialized or are missing."); } + if (CurrentAuthority.HasAccess(new Access(CurrentOrganization, AccessAspect.Administration)) || + CurrentAuthority.HasAccess (new Access (CurrentOrganization, Geography.Root, AccessAspect.Administration))) + { + _assignable = true; + } + Response.Output.WriteLine(RecursePositionTree(orgExecutivePositions.Tree.RootNodes)); } @@ -92,7 +110,17 @@ namespace Swarmops.Frontend.Automation string expires = string.Empty; string action = string.Empty; - string assignedName = string.Format("{2} {0}", Resources.Controls.Swarm.Positions_Vacant, _customCookieClass, Resources.Controls.Swarm.Positions_AssignFirstPerson, position.Identity, JavascriptEscape(position.Localized())); + string assignedName = Resources.Controls.Swarm.Positions_Vacant; + + if (_assignable) + { + assignedName = + string.Format ( + "{2} {0}", + Resources.Controls.Swarm.Positions_Vacant, _customCookieClass, + Resources.Controls.Swarm.Positions_AssignFirstPerson, position.Identity, + JavascriptEscape (position.Localized())); + } if (localizedPositionName == null) { @@ -107,7 +135,14 @@ namespace Swarmops.Frontend.Automation { expires = assignments[0].ExpiresDateTimeUtc.ToString("yyyy-MMM-dd"); } - action = String.Format("", assignments[0].Identity, _customCookieClass, assignments[0].PersonId == CurrentUser.Identity? "self='true'": string.Empty); + if (_assignable) + { + action = + String.Format ( + "", + assignments[0].Identity, _customCookieClass, + assignments[0].PersonId == CurrentUser.Identity ? "self='true'" : string.Empty); + } } string element = string.Format("\"id\":\"{0}-1\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\",\"expires\":\"{3}\",\"minMax\":\"{4} / {5}\",\"iconType\":\"{6}\",\"actions\":\"{7}\"", @@ -127,7 +162,14 @@ namespace Swarmops.Frontend.Automation elements.Add ("{" + element + "}"); expires = string.Empty; - action = String.Format("", assignments[assignmentCount].Identity, _customCookieClass, assignments[0].PersonId == CurrentUser.Identity ? "self='true'" : string.Empty); + if (_assignable) + { + action = + String.Format ( + "", + assignments[assignmentCount].Identity, _customCookieClass, + assignments[0].PersonId == CurrentUser.Identity ? "self='true'" : string.Empty); + } int expireYear = assignments[assignmentCount].ExpiresDateTimeUtc.Year; if (expireYear > 2000 && expireYear < 3000) // as in, "is defined" @@ -142,9 +184,9 @@ namespace Swarmops.Frontend.Automation assignmentCount++; } - if (assignmentCount < position.MaxCount || (position.MaxCount == 0 && position.Assignments.Count > 0)) + if (_assignable && (assignmentCount < position.MaxCount || (position.MaxCount == 0 && position.Assignments.Count > 0))) { - // finally, if the assigned count is less than max count, add a "assign another person" link + // finally, if the assigned count is less than max count, add a "assign another person" link if _assignable is true int count = position.Assignments.Count; if (count > 6) @@ -187,12 +229,9 @@ namespace Swarmops.Frontend.Automation return "[" + String.Join(",", elements.ToArray()) + "]"; } - private bool HasHiringFiringPrivileges (Position position) - { - return false; - } - private string _customCookieClass; + private bool _assignable = false; // TODO: Maybe make this more dynamic later + private class JsonPosition { diff --git a/Site5/Automation/SwarmFunctions.aspx.cs b/Site5/Automation/SwarmFunctions.aspx.cs index 89fcae58..c5b0845f 100644 --- a/Site5/Automation/SwarmFunctions.aspx.cs +++ b/Site5/Automation/SwarmFunctions.aspx.cs @@ -21,12 +21,11 @@ namespace Swarmops.Frontend.Automation } [WebMethod] - public static AjaxCallResult AssignPosition (int personId, int positionId, int durationMonths, int organizationId, int geographyId) + public static AjaxCallResult AssignPosition (int personId, int positionId, int durationMonths, int geographyId) { AuthenticationData authData = GetAuthenticationDataAndCulture(); Position position = Position.FromIdentity (positionId); Person person = Person.FromIdentity (personId); - Organization organization = (organizationId == 0 ? null : Organization.FromIdentity (organizationId)); Geography geography = (geographyId == 0 ? null : Geography.FromIdentity (geographyId)); if ((position.OrganizationId > 0 && authData.CurrentOrganization.Identity != position.OrganizationId) || person.Identity < 0) @@ -59,7 +58,7 @@ namespace Swarmops.Frontend.Automation try { - PositionAssignment.Create (organization, geography, position, person, authData.CurrentUser, currentUserPosition, + PositionAssignment.Create (position, geography, person, authData.CurrentUser, currentUserPosition, expiresUtc, string.Empty); } catch (DatabaseConcurrencyException) diff --git a/Site5/Controls/v5/Swarm/TreePositions.ascx b/Site5/Controls/v5/Swarm/TreePositions.ascx index c5df2b20..e8a883fb 100644 --- a/Site5/Controls/v5/Swarm/TreePositions.ascx +++ b/Site5/Controls/v5/Swarm/TreePositions.ascx @@ -26,7 +26,7 @@ onLoadSuccess: function () { $('.LocalAssignPerson.LocalPosition<%=this.Cookie%>').click(function () { - currentPositionId = $(this).attr("positionId"); + current<%=this.Cookie%>PositionId = $(this).attr("positionId"); $('#<%= this.ClientID %>_modalPositionName').text(decodeURIComponent($(this).attr("positionName"))); <%= this.DropPerson.ClientID%>_clear(); $('#<%= this.DropDuration.ClientID%>').val("12"); // reset to 12-month default @@ -78,7 +78,7 @@ $.proxy(function(response) { if (response) { // user clicked the GREEN button, which is "confirm termination" - onConfirmTermination($(this).attr("assignmentId")); + onConfirmTermination<%=this.ClientID%>($(this).attr("assignmentId")); } else { // if cancel termination, restore icon from loader to action icon again $(this).attr("src", "/Images/Icons/iconshock-balloon-no-128x96px.png"); @@ -120,7 +120,7 @@ SwarmopsJS.ajaxCall( "/Automation/SwarmFunctions.aspx/AssignPosition", - { personId: personId, positionId: currentPositionId, durationMonths: $('#<%= this.DropDuration.ClientID%>').val(), organizationId: 0, geographyId: 0 }, + { personId: personId, positionId: current<%=this.Cookie%>PositionId, durationMonths: $('#<%= this.DropDuration.ClientID%>').val(), geographyId: 0 }, function (result) { // Close modal and reload grid regardless of success or not // (the only failure here should be a concurrency error, in which case @@ -138,11 +138,12 @@ }); - function onConfirmTermination(assignmentId) { + function onConfirmTermination<%=this.ClientID%> (assignmentId) { SwarmopsJS.ajaxCall("/Automation/SwarmFunctions.aspx/TerminatePositionAssignment", { assignmentId: assignmentId }, - function(result) { + function (result) { if (result.Success) { + <%= this.DialogAdd.ClientID %>_close(); $('#<%=this.ClientID%>_tablePositions').treegrid('reload'); } else { alertify.error(result.DisplayMessage); @@ -150,7 +151,7 @@ }); } - var currentPositionId = ''; + var current<%=this.Cookie%>PositionId = ''; diff --git a/Site5/Images/Icons/iconshock-executive-128px.png b/Site5/Images/Icons/iconshock-executive-128px.png new file mode 100644 index 00000000..36a9f43e Binary files /dev/null and b/Site5/Images/Icons/iconshock-executive-128px.png differ diff --git a/Site5/Images/Icons/iconshock-foreman-128px.png b/Site5/Images/Icons/iconshock-foreman-128px.png new file mode 100644 index 00000000..806cc417 Binary files /dev/null and b/Site5/Images/Icons/iconshock-foreman-128px.png differ diff --git a/Site5/Images/Icons/iconshock-general-128px.png b/Site5/Images/Icons/iconshock-general-128px.png new file mode 100644 index 00000000..c6c54819 Binary files /dev/null and b/Site5/Images/Icons/iconshock-general-128px.png differ diff --git a/Site5/Images/Icons/iconshock-redshirt-128px.png b/Site5/Images/Icons/iconshock-redshirt-128px.png new file mode 100644 index 00000000..6577b194 Binary files /dev/null and b/Site5/Images/Icons/iconshock-redshirt-128px.png differ diff --git a/Site5/Images/Icons/iconshock-soldier-128px.png b/Site5/Images/Icons/iconshock-soldier-128px.png new file mode 100644 index 00000000..1d681aeb Binary files /dev/null and b/Site5/Images/Icons/iconshock-soldier-128px.png differ diff --git a/Site5/Pages/v5/Admin/OrgStaffing.aspx b/Site5/Pages/v5/Admin/OrgStaffing.aspx index 407a5be5..ed0dfeb2 100644 --- a/Site5/Pages/v5/Admin/OrgStaffing.aspx +++ b/Site5/Pages/v5/Admin/OrgStaffing.aspx @@ -18,17 +18,25 @@
-
+

- +
-
+

- +
-
+

- + +
+
+

+ +
+
+

+
diff --git a/Site5/Pages/v5/Admin/OrgStaffing.aspx.cs b/Site5/Pages/v5/Admin/OrgStaffing.aspx.cs index 65b29a42..f185919f 100644 --- a/Site5/Pages/v5/Admin/OrgStaffing.aspx.cs +++ b/Site5/Pages/v5/Admin/OrgStaffing.aspx.cs @@ -77,7 +77,11 @@ namespace Swarmops.Frontend.Pages.v5.Admin private void Localize() { - // TODO + this.LabelHeaderStrategic.Text = String.Format(Resources.Pages.Admin.OrgStaffing_Header_StrategicPositions, CurrentOrganization.Name); + this.LabelHeaderExecutive.Text = String.Format(Resources.Pages.Admin.OrgStaffing_Header_ExecutivePositions, CurrentOrganization.Name); + this.LabelHeaderGeographicDefault.Text = Resources.Pages.Admin.OrgStaffing_Header_LocalDefaultPositions; + this.LabelHeaderVolunteers.Text = Resources.Pages.Admin.OrgStaffing_Header_WaitingVolunteers; + this.LabelHeaderPayroll.Text = Resources.Pages.Admin.OrgStaffing_Header_Payroll; }