Commit 65fee7e9 by Tuukka Kivilahti

Merge branch 'master' of codecrew.fi:codecrew/moya into manageParticipants

Conflicts:
	code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
	code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
	code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
2 parents 05c013a2 f2a58344
...@@ -234,14 +234,19 @@ public class TournamentBean implements TournamentBeanLocal { ...@@ -234,14 +234,19 @@ public class TournamentBean implements TournamentBeanLocal {
EventUser executor = permissionBean.getCurrentUser(); EventUser executor = permissionBean.getCurrentUser();
// Assert we have permission to remove participant // Assert we have permission to remove participant
// TODO: this will include check for remove any participation too! if(tp.getParticipator().equals(executor)) {
if (!permissionBean.hasPermission(TournamentPermission.REMOVE_OWN_PARTICIPATION) || !tp.getParticipator().equals(executor)) { // own participation, can we delete?
if(!permissionBean.hasPermission(TournamentPermission.REMOVE_OWN_PARTICIPATION)) {
throw new Exception("tournaments.can_only_remove_own_participations"); throw new Exception("tournaments.can_only_remove_own_participations");
} }
} else {
if(!permissionBean.hasPermission(TournamentPermission.MANAGE_ALL)) {
throw new Exception("tournaments.cannot_remove_others_participations");
}
}
// Assert that tournament has not closed participation // Assert that tournament has not closed participation
// TODO: admin exception! if (!permissionBean.hasPermission(TournamentPermission.MANAGE_ALL) && !tp.getTournament().getRegistrationClosesAt().after(new Date())) {
if (!tp.getTournament().getRegistrationClosesAt().after(new Date())) {
throw new Exception("tournaments.cannot_remove_participation_from_closed_tournament"); throw new Exception("tournaments.cannot_remove_participation_from_closed_tournament");
} }
......
...@@ -20,6 +20,11 @@ public class ProductLimitation extends GenericEntity { ...@@ -20,6 +20,11 @@ public class ProductLimitation extends GenericEntity {
*/ */
private static final long serialVersionUID = 1373535658851118597L; private static final long serialVersionUID = 1373535658851118597L;
public ProductLimitationType[] getAvailableTypes()
{
return ProductLimitationType.values();
}
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@Column(nullable = false) @Column(nullable = false)
private ProductLimitationType type; private ProductLimitationType type;
...@@ -109,4 +114,12 @@ public class ProductLimitation extends GenericEntity { ...@@ -109,4 +114,12 @@ public class ProductLimitation extends GenericEntity {
this.matchingRoles = matchingRoles; this.matchingRoles = matchingRoles;
} }
public boolean getLast() {
return last;
}
public void setLast(boolean last) {
this.last = last;
}
} }
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:products="http://java.sun.com/jsf/composite/cditools/products" xmlns:p="http://primefaces.org/ui">
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:products="http://java.sun.com/jsf/composite/cditools/products"
>
<h:head> <h:head>
<title></title> <title></title>
...@@ -20,15 +18,13 @@ ...@@ -20,15 +18,13 @@
<products:edit commitaction="#{productView.saveProduct()}" commitvalue="#{i18n['products.save']}" /> <products:edit commitaction="#{productView.saveProduct()}" commitvalue="#{i18n['products.save']}" />
<hr />
<h:form id="discounts"> <h:form id="discounts">
<h:commandButton rendered="#{!empty productView.product.id}" action="#{productView.initCreateDiscount()}" <h:commandButton rendered="#{!empty productView.product.id}" action="#{productView.initCreateDiscount()}" value="#{i18n['product.createDiscount']}">
value="#{i18n['product.createDiscount']}"
>
</h:commandButton> </h:commandButton>
<h:dataTable border="1" id="discount" value="#{productView.productDiscounts}" var="discount" rendered="#{!empty productView.product.id and !empty productView.product.discounts}">
<h:dataTable border="1" id="discount" value="#{productView.productDiscounts}" var="discount"
rendered="#{!empty productView.product.id and !empty productView.product.discounts}"
>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['discount.percentage']}" /> <h:outputText value="${i18n['discount.percentage']}" />
...@@ -83,6 +79,27 @@ ...@@ -83,6 +79,27 @@
</h:dataTable> </h:dataTable>
</h:form> </h:form>
<hr />
<h:form id="limits">
<h:commandButton rendered="#{!empty productView.product.id}" action="#{productView.initCreateLimit()}" value="#{i18n['product.createLimit']}">
</h:commandButton>
<p:dataTable border="1" id="discount" value="#{productView.productLimits}" var="limit" rendered="#{!empty productView.product.id and !empty productView.product.productLimits}">
<p:column rowHeader="#{i18n['productLimit.name']}">
<h:outputText value="#{limit.name}" />
</p:column>
<p:column rowHeader="#{i18n['productLimit.type']}">
<h:outputText value="#{limit.type}" />
</p:column>
<p:column rowHeader="#{i18n['productLimit.upperLimit']}">
<h:outputText value="#{limit.lowerLimit}" />
</p:column>
<p:column>
<p:commandButton ajax="false" action="#{productView.editLimit()}" value="#{i18n['productLimit.edit']}" />
</p:column>
</p:dataTable>
</h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<h:head>
<title></title>
</h:head>
<h:body>
<ui:composition template="#{sessionHandler.template}">
<ui:define name="content">
<h:form id="discountform">
<h:link id="back" outcome="/product/edit" value="#{i18n['product.returnProductEdit']} #{productView.product.name}">
<f:param name="productid" value="#{productView.product.id}" />
</h:link>
<p:panelGrid columns="3">
<p:outputLabel for="name" value="#{i18n['productLimit.name']}:" />
<p:inputText id="name" value="#{productView.limit.name}" />
<p:message for="name" />
<p:outputLabel for="description" value="#{i18n['productLimit.description']}:" />
<p:inputText id="description" value="#{productView.limit.description}" />
<p:message for="description" />
<p:outputLabel for="type" value="#{i18n['productLimit.type']}:" />
<p:selectOneMenu id="type" value="#{productView.limit.type}">
<f:selectItem itemValue="" itemLabel="---" />
<f:selectItems var="type" itemLabel="#{type}" itemDescription="#{i18n[type]}" value="#{productView.limit.availableTypes}" />
</p:selectOneMenu>
<p:message for="type" />
<p:outputLabel for="sort" value="#{i18n['productLimit.sort']}:" />
<p:inputText id="sort" value="#{productView.limit.sort}" />
<p:message for="sort" />
<p:outputLabel for="last" value="#{i18n['productLimit.last']}" />
<p:selectBooleanCheckbox id="last" value="#{productView.limit.last}" />
<p:message for="last" />
<p:outputLabel for="upperLimit" value="#{i18n['productLimit.upperLimit']}:" />
<p:inputText id="upperLimit" value="#{productView.limit.upperLimit}" />
<h:message for="upperLimit" />
<h:outputLabel for="lowerLimit" value="#{i18n['productLimit.lowerLimit']}:" />
<p:inputText id="lowerLimit" value="#{productView.limit.lowerLimit}" />
<h:message for="lowerLimit" />
<h:outputLabel for="roles" value="#{i18n['productLimit.roles']}:" />
<p:selectManyCheckbox layout="pageDirection" id="roles" value="#{productView.limit.matchingRoles}" converter="#{roleConverter}">
<f:selectItems var="role" itemLabel="#{role.name}" value="#{roleDataView.roleList}" />
</p:selectManyCheckbox>
<h:message for="roles" />
</p:panelGrid>
<p:commandButton id="commitbtn" action="#{productView.saveLimit}" value="#{i18n['productLimit.save']}" />
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
...@@ -117,9 +117,6 @@ ...@@ -117,9 +117,6 @@
color: #006600; color: #006600;
} }
.lectureCalendar, .lectureCalendar,
.lectureCalendarParticipating, .lectureCalendarParticipating,
.lectureCalendarDisabled { .lectureCalendarDisabled {
...@@ -136,3 +133,13 @@ ...@@ -136,3 +133,13 @@
background-color: gray; background-color: gray;
} }
.noBorders tr, .noBorders td {
background: none !important;
border: none !important;
}
.inlineRow > td {
padding: 0 !important;
margin: 0;
padding-left: 40px !important;
}
...@@ -38,7 +38,18 @@ ...@@ -38,7 +38,18 @@
<h:outputText value="#{groupMembership.placeReservation.name}" />&nbsp; <h:outputText value="#{groupMembership.placeReservation.name}" />&nbsp;
</ui:repeat> </ui:repeat>
</p:column> </p:column>
<p:column>
<p:commandButton value="#{i18n['delete']}" actionListener="#{tournamentParticipantsView.deleteParticipation}" update="@form">
<p:confirm header="#{i18n['confirmdialog.header']}" message="#{i18n['confirmdialog.are_you_sure']}" icon="ui-icon-alert" />
<f:attribute name="participantid" value="#{participant.id}" />
</p:commandButton>
<p:confirmDialog global="true">
<p:commandButton value="#{i18n['confirmdialog.yes']}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="#{i18n['confirmdialog.no']}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</p:column>
</p:dataTable> </p:dataTable>
</h:form> </h:form>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<p>#{i18n['tournaments.admin.view_tournament_description_teamview_addition']}</p> <p>#{i18n['tournaments.admin.view_tournament_description_teamview_addition']}</p>
<h:form> <h:form>
<p:dataTable value="#{tournamentParticipantsView.tournament.participants}" var="participant"> <p:dataTable value="#{tournamentParticipantsView.tournament.participants}" var="participant">
<p:column style="width:2%"> <p:column style="width:20px">
<p:rowToggler /> <p:rowToggler />
</p:column> </p:column>
<p:column> <p:column>
...@@ -28,32 +28,50 @@ ...@@ -28,32 +28,50 @@
</f:facet> </f:facet>
<h:outputText value="#{participant.participator.nick}" /> <h:outputText value="#{participant.participator.nick}" />
</p:column> </p:column>
<p:rowExpansion> <p:column>
<h:panelGrid id="display" columns="2" cellpadding="4" styleClass=" ui-widget-content grid"> <p:commandButton value="#{i18n['delete']}" actionListener="#{tournamentParticipantsView.deleteParticipation}" update="@form">
<h:outputText value="#{i18n['tournament.team_members']}" /> <p:confirm header="#{i18n['confirmdialog.header']}" message="#{i18n['confirmdialog.are_you_sure']}" icon="ui-icon-alert" />
<h:panelGroup> <f:attribute name="participantid" value="#{participant.id}" />
<ul> </p:commandButton>
<ui:repeat var="member" value="#{participant.teamMembers}"> <p:confirmDialog global="true">
<li> <p:commandButton value="#{i18n['confirmdialog.yes']}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="#{i18n['confirmdialog.no']}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</p:column>
<p:rowExpansion styleClass="inlineRow">
<p:dataTable value="#{participant.teamMembers}" var="member">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['user.nick']}" />
</f:facet>
<h:outputText value="#{member.eventUser.nick}" /> <h:outputText value="#{member.eventUser.nick}" />
<ul> </p:column>
<li>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.participant_gameid']}" />
</f:facet>
<h:outputText value="#{tournamentParticipantsView.eventUserGameID[member.eventUser.id]}" /> <h:outputText value="#{tournamentParticipantsView.eventUserGameID[member.eventUser.id]}" />
</li> </p:column>
<li>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['user.email']}" />
</f:facet>
<h:outputText value="#{member.eventUser.email}" /> <h:outputText value="#{member.eventUser.email}" />
</li> </p:column>
<li>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['place.code']}" />
</f:facet>
<ui:repeat rendered="#{not empty member.eventUser.groupMemberships}" var="groupMembership" value="#{member.eventUser.groupMemberships}"> <ui:repeat rendered="#{not empty member.eventUser.groupMemberships}" var="groupMembership" value="#{member.eventUser.groupMemberships}">
<h:outputText value="#{groupMembership.placeReservation.name}" />&nbsp; <h:outputText value="#{groupMembership.placeReservation.name}" />&nbsp;
</ui:repeat> </ui:repeat>
</li> </p:column>
</ul>
</li> </p:dataTable>
</ui:repeat>
</ul>
</h:panelGroup>
</h:panelGrid>
</p:rowExpansion> </p:rowExpansion>
</p:dataTable> </p:dataTable>
</h:form> </h:form>
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
<p>#{i18n['tournaments.description']}</p> <p>#{i18n['tournaments.description']}</p>
<h2>#{i18n['tournaments.open_tournaments']}</h2> <h2>#{i18n['tournaments.open_tournaments']}</h2>
<p:dataTable value="#{tournamentListView.setupPhaseTournaments}" var="tournament"> <p:dataTable value="#{tournamentListView.setupPhaseTournaments}" var="tournament">
<p:column style="width:2%">
<p:column style="width:20px">
<p:rowToggler /> <p:rowToggler />
</p:column> </p:column>
<p:column> <p:column>
...@@ -96,7 +97,7 @@ ...@@ -96,7 +97,7 @@
</p:dataTable> </p:dataTable>
<h2>#{i18n['tournaments.setup_closed_tournaments']}</h2> <h2>#{i18n['tournaments.setup_closed_tournaments']}</h2>
<p:dataTable value="#{tournamentListView.setupClosedPhaseTournaments}" var="tournament"> <p:dataTable value="#{tournamentListView.setupClosedPhaseTournaments}" var="tournament">
<p:column style="width:2%"> <p:column style="width:20px">
<p:rowToggler /> <p:rowToggler />
</p:column> </p:column>
<p:column> <p:column>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<h2>#{i18n['tournaments.participate_team_members']}</h2> <h2>#{i18n['tournaments.participate_team_members']}</h2>
<p:messages autoUpdate="true" redisplay="false"></p:messages> <p:messages autoUpdate="true" redisplay="false"></p:messages>
<h:form> <h:form>
<p:commandButton style="width: 0px; height: 0px;" value="" action="#{tournamentParticipateView.addMainPlayerToTeam}" update="@form"/>
<h3>#{i18n['tournaments.team_details']}</h3> <h3>#{i18n['tournaments.team_details']}</h3>
<h:panelGrid columns="2"> <h:panelGrid columns="2">
<h:outputText value="#{i18n['tournament.team_name']}" /> <h:outputText value="#{i18n['tournament.team_name']}" />
......
...@@ -915,6 +915,7 @@ product.cashed = Cashpaid ...@@ -915,6 +915,7 @@ product.cashed = Cashpaid
product.color = Color in UI product.color = Color in UI
product.create = Create product product.create = Create product
product.createDiscount = Add volumediscount product.createDiscount = Add volumediscount
product.createLimit = Create product limitation
product.edit = edit product.edit = edit
product.inventoryQuantity = Inventory count product.inventoryQuantity = Inventory count
product.name = Name of product product.name = Name of product
...@@ -939,6 +940,17 @@ productFlag.PREPAID_INSTANT_CREATE = Prepaid instant create ...@@ -939,6 +940,17 @@ productFlag.PREPAID_INSTANT_CREATE = Prepaid instant create
productFlag.RESERVE_PLACE_WHEN_BOUGHT = Reserve place when bought productFlag.RESERVE_PLACE_WHEN_BOUGHT = Reserve place when bought
productFlag.USER_SHOPPABLE = User shoppable productFlag.USER_SHOPPABLE = User shoppable
productLimit.description = Description
productLimit.edit = Edit
productLimit.last = Last limitation
productLimit.lowerLimit = Lower limit
productLimit.name = Type
productLimit.roles = Roles
productLimit.save = Save
productLimit.sort = Sort number
productLimit.type = Limitation type
productLimit.upperLimit = Upper limit
products.create = Create product products.create = Create product
products.save = Save products.save = Save
......
...@@ -898,6 +898,7 @@ product.cashed = Ostettu k\u00E4teisell\u00E4 ...@@ -898,6 +898,7 @@ product.cashed = Ostettu k\u00E4teisell\u00E4
product.color = V\u00E4ri k\u00E4ytt\u00F6liittym\u00E4ss\u00E4 product.color = V\u00E4ri k\u00E4ytt\u00F6liittym\u00E4ss\u00E4
product.create = Luo tuote product.create = Luo tuote
product.createDiscount = Lis\u00E4\u00E4 m\u00E4\u00E4r\u00E4alennus product.createDiscount = Lis\u00E4\u00E4 m\u00E4\u00E4r\u00E4alennus
product.createLimit = Luo tuoterajoite
product.edit = Muokkaa product.edit = Muokkaa
product.inventoryQuantity = Varastotilanne product.inventoryQuantity = Varastotilanne
product.name = Tuotteen nimi product.name = Tuotteen nimi
...@@ -922,6 +923,17 @@ productFlag.PREPAID_INSTANT_CREATE = Ostettaessa luotava tuote ...@@ -922,6 +923,17 @@ productFlag.PREPAID_INSTANT_CREATE = Ostettaessa luotava tuote
productFlag.RESERVE_PLACE_WHEN_BOUGHT = Varaa paikka ostettaessa productFlag.RESERVE_PLACE_WHEN_BOUGHT = Varaa paikka ostettaessa
productFlag.USER_SHOPPABLE = K\u00E4ytt\u00E4jien ostettavissa productFlag.USER_SHOPPABLE = K\u00E4ytt\u00E4jien ostettavissa
productLimit.description = Kuvaus
productLimit.edit = Muokkaa
productLimit.last = Viimeinen rajoite
productLimit.lowerLimit = Alarajoite
productLimit.name = Tyyppi
productLimit.roles = roolit
productLimit.save = Tallenna
productLimit.sort = J\u00E4rjestysnumero
productLimit.type = Rajoitteen tyyppi
productLimit.upperLimit = Yl\u00E4rajoite
productShopView.readBarcode = Lue viivakoodi productShopView.readBarcode = Lue viivakoodi
products.create = Luo tuote products.create = Luo tuote
......
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -18,6 +19,7 @@ import fi.codecrew.moya.enums.apps.ShopPermission; ...@@ -18,6 +19,7 @@ import fi.codecrew.moya.enums.apps.ShopPermission;
import fi.codecrew.moya.model.Discount; import fi.codecrew.moya.model.Discount;
import fi.codecrew.moya.model.Product; import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ProductFlag; import fi.codecrew.moya.model.ProductFlag;
import fi.codecrew.moya.model.ProductLimitation;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named @Named
...@@ -40,12 +42,16 @@ public class ProductView extends GenericCDIView { ...@@ -40,12 +42,16 @@ public class ProductView extends GenericCDIView {
private transient ListDataModel<Discount> productDiscounts; private transient ListDataModel<Discount> productDiscounts;
private ProductLimitation limit;
private ListDataModel<ProductLimitation> productLimits;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(ProductView.class); private static final Logger logger = LoggerFactory.getLogger(ProductView.class);
public void initEditView() { public void initEditView() {
if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && product == null) { if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && product == null) {
product = prodbean.findById(getProductId()); product = prodbean.findById(productId);
if (super.requirePermissions(product != null)) { if (super.requirePermissions(product != null)) {
super.beginConversation(); super.beginConversation();
} }
...@@ -108,6 +114,33 @@ public class ProductView extends GenericCDIView { ...@@ -108,6 +114,33 @@ public class ProductView extends GenericCDIView {
return "/product/createDiscount"; return "/product/createDiscount";
} }
public String saveLimit()
{
if (product.getProductLimits() == null) {
product.setProductLimits(new ArrayList<ProductLimitation>());
}
if (!product.getProductLimits().contains(limit)) {
product.getProductLimits().add(limit);
}
prodbean.mergeChanges(product);
limit = null;
return "/product/edit";
}
public String initCreateLimit()
{
setLimit(new ProductLimitation());
getLimit().setProducts(new ArrayList<>(Arrays.asList(product)));
return "/product/editLimit";
}
public String editLimit()
{
limit = productLimits.getRowData();
return "/product/editLimit";
}
public String editDiscount() public String editDiscount()
{ {
discount = productDiscounts.getRowData(); discount = productDiscounts.getRowData();
...@@ -120,8 +153,22 @@ public class ProductView extends GenericCDIView { ...@@ -120,8 +153,22 @@ public class ProductView extends GenericCDIView {
return productDiscounts; return productDiscounts;
} }
public ListDataModel<ProductLimitation> getProductLimits()
{
productLimits = new ListDataModel<ProductLimitation>(product.getProductLimits());
return productLimits;
}
public List<ProductFlag> getProductFlags() public List<ProductFlag> getProductFlags()
{ {
return Arrays.asList(ProductFlag.values()); return Arrays.asList(ProductFlag.values());
} }
public ProductLimitation getLimit() {
return limit;
}
public void setLimit(ProductLimitation limit) {
this.limit = limit;
}
} }
...@@ -4,6 +4,8 @@ import java.util.HashMap; ...@@ -4,6 +4,8 @@ import java.util.HashMap;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import javax.inject.Named; import javax.inject.Named;
import fi.codecrew.moya.beans.TournamentBeanLocal; import fi.codecrew.moya.beans.TournamentBeanLocal;
...@@ -12,6 +14,7 @@ import fi.codecrew.moya.model.GameID; ...@@ -12,6 +14,7 @@ import fi.codecrew.moya.model.GameID;
import fi.codecrew.moya.model.Tournament; import fi.codecrew.moya.model.Tournament;
import fi.codecrew.moya.model.TournamentParticipant; import fi.codecrew.moya.model.TournamentParticipant;
import fi.codecrew.moya.model.TournamentTeamMember; import fi.codecrew.moya.model.TournamentTeamMember;
import fi.codecrew.moya.utilities.jsf.MessageHelper;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named @Named
...@@ -27,7 +30,7 @@ public class TournamentParticipantsView extends GenericCDIView { ...@@ -27,7 +30,7 @@ public class TournamentParticipantsView extends GenericCDIView {
public String showView(Integer tournamentId) { public String showView(Integer tournamentId) {
if(eventUserGameID == null) { if(eventUserGameID == null) {
this.setTournament(tournamentBean.getTournamentById(tournamentId)); this.tournament = tournamentBean.getTournamentById(tournamentId);
this.beginConversation(); this.beginConversation();
eventUserGameID = new HashMap<Integer, String>(); eventUserGameID = new HashMap<Integer, String>();
for(TournamentParticipant tp : tournament.getParticipants()) { for(TournamentParticipant tp : tournament.getParticipants()) {
...@@ -46,6 +49,17 @@ public class TournamentParticipantsView extends GenericCDIView { ...@@ -46,6 +49,17 @@ public class TournamentParticipantsView extends GenericCDIView {
return "/tournaments/admin/view_tournament_team.xhtml"; return "/tournaments/admin/view_tournament_team.xhtml";
} }
public void deleteParticipation(ActionEvent ae) {
try {
Integer id = (Integer)ae.getComponent().getAttributes().get("participantid");
tournamentBean.deleteParticipationById(id);
this.tournament = tournamentBean.getTournamentById(this.tournament.getId());
} catch(Exception e) {
MessageHelper.err(e.getMessage());
}
}
public String cancel() { public String cancel() {
this.endConversation(); this.endConversation();
return "/tournaments/admin/index.xhtml"; return "/tournaments/admin/index.xhtml";
......
...@@ -28,6 +28,11 @@ public class RoleDataView extends GenericCDIView { ...@@ -28,6 +28,11 @@ public class RoleDataView extends GenericCDIView {
private static final Logger logger = LoggerFactory.getLogger(RoleDataView.class); private static final Logger logger = LoggerFactory.getLogger(RoleDataView.class);
public List<Role> getRoleList()
{
return rolebean.listRoles();
}
public ListDataModel<Role> getRoles() { public ListDataModel<Role> getRoles() {
if (roles == null) { if (roles == null) {
roles = new ListDataModel<Role>(rolebean.listRoles()); roles = new ListDataModel<Role>(rolebean.listRoles());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!