Deck list and deck modified mark.

This commit is contained in:
marcins78@gmail.com
2012-03-31 11:51:31 +00:00
parent 65f5cb6e56
commit 3b6704cb82
3 changed files with 22 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@@ -89,7 +90,8 @@ public class DeckResource extends AbstractResource {
public String getDeckList(
@QueryParam("deckName") String deckName,
@QueryParam("participantId") String participantId,
@Context HttpServletRequest request) {
@Context HttpServletRequest request,
@Context HttpServletResponse response) {
Player resourceOwner = getResourceOwnerSafely(request, participantId);
LotroDeck deck = _deckDao.getDeckForPlayer(resourceOwner, deckName);
@@ -129,6 +131,8 @@ public class DeckResource extends AbstractResource {
result.append("</body></html>");
response.setCharacterEncoding("UTF-8");
return result.toString();
}

View File

@@ -272,6 +272,7 @@ var GempLotrCommunication = Class.extend({
type: "POST",
url: this.url + "/deck",
cache: false,
async: false,
data: {
participantId: getUrlParam("participantId"),
deckName: deckName,

View File

@@ -99,7 +99,7 @@ var GempLotrDeckBuildingUI = Class.extend({
newDeckBut.click(
function() {
that.deckName = null;
$("#editingDeck").html("New deck");
$("#editingDeck").text("New deck");
that.clearDeck();
});
@@ -147,7 +147,7 @@ var GempLotrDeckBuildingUI = Class.extend({
copyDeckBut.click(
function() {
that.deckName = null;
$("#editingDeck").html("New deck");
$("#editingDeck").text("New deck");
});
deckListBut.click(
@@ -342,7 +342,7 @@ var GempLotrDeckBuildingUI = Class.extend({
function() {
if (that.deckName == deckName) {
that.deckName = null;
$("#editingDeck").html("New deck");
$("#editingDeck").text("New deck");
that.clearDeck();
}
@@ -538,6 +538,7 @@ var GempLotrDeckBuildingUI = Class.extend({
alert("Deck must contain at least Ring-bearer, The One Ring and 9 sites");
else
this.comm.saveDeck(this.deckName, deckContents, function(xml) {
that.deckModified(false);
alert("Deck was saved");
});
},
@@ -561,6 +562,7 @@ var GempLotrDeckBuildingUI = Class.extend({
that.showNormalFilter();
that.layoutSpecialGroups();
that.deckDirty = true;
that.deckModified(true);
};
},
@@ -584,6 +586,15 @@ var GempLotrDeckBuildingUI = Class.extend({
div.addClass("cardInDeck");
that.siteGroup.layoutCards();
}
that.deckModified(true);
},
deckModified: function(value) {
var name = (this.deckName == null) ? "New deck" : this.deckName;
if (value)
$("#editingDeck").text(name + " - modified");
else
$("#editingDeck").text(name);
},
addCardToDeck: function(blueprintId, side) {
@@ -663,6 +674,7 @@ var GempLotrDeckBuildingUI = Class.extend({
this.layoutDeck();
this.deckDirty = true;
this.deckModified(true);
},
clearDeck: function() {
@@ -705,6 +717,7 @@ var GempLotrDeckBuildingUI = Class.extend({
this.cardFilter.getCollection();
}
this.deckModified(false);
},
clearCollection: function() {