diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/ui.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/ui.js
index 339a3d0fe..e2832c184 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/ui.js
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/ui.js
@@ -299,8 +299,10 @@ var GempLotrUI = Class.extend({
this.multipleChoiceDecision(decision);
} else if (decisionType == "ARBITRARY_CARDS") {
this.arbitraryCardsDecision(decision);
- } else if (decisionType == "CARD_ACTION_CHOICE") {
+ } else if (decisionType == "ACTION_CHOICE") {
this.actionChoiceDecision(decision);
+ } else if (decisionType == "CARD_ACTION_CHOICE") {
+ this.cardActionChoiceDecision(decision);
} else if (decisionType == "CARD_SELECTION") {
this.cardSelectionDecision(decision);
} else if (decisionType == "ASSIGN_MINIONS") {
@@ -591,8 +593,8 @@ var GempLotrUI = Class.extend({
this.dialogInstance.dialog("open");
},
- createCardDiv: function(card) {
- var cardDiv = $("
");
+ createCardDiv: function(card, text) {
+ var cardDiv = $("
" + ((text != null) ? text : "") + "
");
cardDiv.data("card", card);
var borderDiv = $("");
cardDiv.append(borderDiv);
@@ -673,7 +675,7 @@ var GempLotrUI = Class.extend({
this.dialogInstance.dialog("open");
},
- actionChoiceDecision: function (decision) {
+ cardActionChoiceDecision: function (decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");
@@ -717,6 +719,60 @@ var GempLotrUI = Class.extend({
};
},
+ actionChoiceDecision: function (decision) {
+ var id = decision.getAttribute("id");
+ var text = decision.getAttribute("text");
+
+ var blueprintIds = this.getDecisionParameters(decision, "blueprintId");
+ var actionIds = this.getDecisionParameters(decision, "actionId");
+ var actionTexts = this.getDecisionParameters(decision, "actionText");
+
+ var that = this;
+
+ this.dialogInstance
+ .html("")
+ .dialog("option", "title", text)
+ .dialog("option", "buttons", {})
+ .dialog("option", "width", "600")
+ .dialog("option", "height", "300");
+
+ var cardIds = new Array();
+
+ for (var i = 0; i < blueprintIds.length; i++) {
+ var blueprintId = blueprintIds[i];
+
+ cardIds.push("temp" + i);
+ var card = new Card(blueprintId, "SPECIAL", "temp" + i, this.selfParticipantId);
+
+ var cardDiv = this.createCardDiv(card, actionTexts[i]);
+
+ $("#arbitraryChoice").append(cardDiv);
+ }
+
+ this.selectionFunction = function(cardId) {
+ var actionId = actionIds[parseInt(cardId.substring(4))];
+
+ this.dialogInstance.dialog("option", "buttons", {
+ "DONE": function() {
+ $(this).dialog("close");
+ $("#arbitraryChoice").html("");
+ that.clearSelection();
+ that.decisionFunction(id, "" + actionId);
+ }
+ });
+
+ that.clearSelection();
+ $(".card:cardId(" + cardId + ")").addClass("selectedCard");
+ };
+
+ $(".card:cardId(" + cardIds + ")").addClass("selectableCard");
+
+ this.specialGroup.setBounds(10, 10, 547, 188);
+
+ $(".ui-dialog-titlebar").show();
+ this.dialogInstance.dialog("open");
+ },
+
cardSelectionDecision: function(decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");