diff --git a/Site5/Automation/SwarmFunctions.aspx.cs b/Site5/Automation/SwarmFunctions.aspx.cs
index 97cf7e35..89fcae58 100644
--- a/Site5/Automation/SwarmFunctions.aspx.cs
+++ b/Site5/Automation/SwarmFunctions.aspx.cs
@@ -1,4 +1,5 @@
using System;
+using System.Activities.Statements;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@@ -118,6 +119,40 @@ namespace Swarmops.Frontend.Automation
return new AjaxCallResult {Success = true};
}
+ [WebMethod]
+ static public AssignmentData GetAssignmentData (int assignmentId)
+ {
+ AuthenticationData authData = GetAuthenticationDataAndCulture();
+ PositionAssignment assignment = PositionAssignment.FromIdentity (assignmentId);
+
+ if (authData.Authority.CanAccess (assignment, AccessType.Read))
+ {
+ return new AssignmentData
+ {
+ Success = true,
+ AssignedPersonCanonical = assignment.Person.Canonical,
+ AssignedPersonId = assignment.PersonId,
+ PositionAssignmentId = assignment.Identity,
+ PositionId = assignment.PositionId,
+ PositionLocalized = assignment.Position.Localized()
+ };
+ }
+ else
+ {
+ return new AssignmentData {Success = false};
+ }
+
+ }
+
+ public class AssignmentData : AjaxCallResult
+ {
+ public int PositionAssignmentId { get; set; }
+ public int PositionId { get; set; }
+ public string PositionLocalized { get; set; }
+ public int AssignedPersonId { get; set; }
+ public string AssignedPersonCanonical { get; set; }
+ }
+
public class AvatarData : AjaxCallResult
{
public int PersonId { get; set; }
diff --git a/Site5/Controls/v5/Swarm/TreePositions.ascx b/Site5/Controls/v5/Swarm/TreePositions.ascx
index 74834e9e..946de8d6 100644
--- a/Site5/Controls/v5/Swarm/TreePositions.ascx
+++ b/Site5/Controls/v5/Swarm/TreePositions.ascx
@@ -9,7 +9,7 @@
}
preload([
- '/Images/Abstract/ajaxloader-medium.gif',
+ '/Images/Abstract/ajaxloader-48x36px.gif',
'/Images/Icons/iconshock-balloon-no-128x96px-hot.png'
]);
$(document).ready(function() {
@@ -48,10 +48,12 @@
}
});
- $('.LocalIconTerminate.LocalPosition<%=this.Cookie%>').click(function () {
+ $('.LocalIconTerminate.LocalPosition<%=this.Cookie%>').click(function() {
if ($(this).attr("rel") != "loading") {
$(this).attr("rel", "loading");
+ $(this).attr("src", "/Images/Abstract/ajaxloader-48x36px.gif");
+
var okLabel = decodeURIComponent('');
var cancelLabel = decodeURIComponent('');
var confirmQuestion = decodeURIComponent('');
@@ -67,18 +69,35 @@
ok: okLabel,
cancel: cancelLabel
},
- buttonFocus: 'cancel'
+ buttonFocus: 'cancel'
});
- alertify.confirm(confirmQuestion,
- $.proxy(function (response) {
- if (response) {
- // user clicked the GREEN button, which is "confirm termination"
+ $('#spanTerminatePersonName').text('[...]');
- onConfirmTermination($(this).attr("assignmentId"));
- }
- $(this).attr("rel", ""); // clear state
- }, this));
+ alertify.confirm(confirmQuestion,
+ $.proxy(function(response) {
+ if (response) {
+ // user clicked the GREEN button, which is "confirm termination"
+ onConfirmTermination($(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");
+ }
+ $(this).attr("rel", ""); // clear state
+ }, this));
+
+ // Fill in the name and position that are now on-screen in a question
+
+ SwarmopsJS.ajaxCall("/Automation/SwarmFunctions.aspx/GetAssignmentData",
+ {assignmentId: $(this).attr("assignmentId") },
+ function (result) {
+ if (result.Success) {
+ $('#spanTerminatePersonName').text(result.AssignedPersonCanonical);
+ $('#spanTerminatePositionName').text(result.PositionLocalized);
+ } else {
+ $('#spanTerminatePersonName,#spanTerminatePositionName').text('[-ERROR-]');
+ }
+ });
return; // Do not process here - must wait for confirm dialog to return
@@ -97,7 +116,7 @@
return;
}
- // TODO: Check existing position for person; can't have two positions
+ // TODO: Check existing position for person; can't have two positions, at least not within same org
SwarmopsJS.ajaxCall(
"/Automation/SwarmFunctions.aspx/AssignPosition",
diff --git a/Site5/MainMenu-v5.xml b/Site5/MainMenu-v5.xml
index f21661e7..3dc4e233 100644
--- a/Site5/MainMenu-v5.xml
+++ b/Site5/MainMenu-v5.xml
@@ -450,7 +450,7 @@
iconshock-group-diversified
/Pages/v5/Admin/OrgStaff.aspx
- Disabled
+ Link