Commit dcd4df0b by Tuomas Riihimäki

Event property editing stuff

 - Delete event property
1 parent a6f3be31
...@@ -273,4 +273,23 @@ public class EventBean implements EventBeanLocal { ...@@ -273,4 +273,23 @@ public class EventBean implements EventBeanLocal {
return eventFacade.find(id); return eventFacade.find(id);
} }
@Override
@RolesAllowed(EventPermission.S_MANAGE_EVENT)
public LanEvent deleteProperty(LanEventProperty property) {
property = eventPropertyFacade.reload(property);
LanEvent event = property.getEvent();
event.getProperties().remove(property);
eventPropertyFacade.refresh(property);
return event;
}
@Override
@RolesAllowed({ EventPermission.S_MANAGE_PRIVATE_PROPERTIES, EventPermission.S_MANAGE_EVENT })
public LanEvent deletePrivateProperty(LanEventPrivateProperty property) {
LanEventPrivateProperty prop = eventPrivatePropertyFacade.reload(property);
LanEvent event = prop.getEvent();
eventPrivatePropertyFacade.remove(property);
return event;
}
} }
...@@ -264,6 +264,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -264,6 +264,7 @@ public class MenuBean implements MenuBeanLocal {
gamenavi.addPage(menuitemfacade.findOrCreate("/license/manageCodes"), LicensePermission.MANAGE); gamenavi.addPage(menuitemfacade.findOrCreate("/license/manageCodes"), LicensePermission.MANAGE);
adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/editEvent"), EventPermission.MANAGE_PROPERTIES); adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/editEvent"), EventPermission.MANAGE_PROPERTIES);
adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/edit"), EventPermission.MANAGE_PROPERTIES).setVisible(false);
MenuNavigation tournamentsadm = adminmenu.addPage(null, null); MenuNavigation tournamentsadm = adminmenu.addPage(null, null);
tournamentsadm.setKey("tournaments.menutitle"); tournamentsadm.setKey("tournaments.menutitle");
......
...@@ -40,4 +40,8 @@ public interface EventBeanLocal { ...@@ -40,4 +40,8 @@ public interface EventBeanLocal {
LanEvent getEventById(Integer id); LanEvent getEventById(Integer id);
LanEvent deleteProperty(LanEventProperty property);
LanEvent deletePrivateProperty(LanEventPrivateProperty property);
} }
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<h:outputLabel for="defaultrole" value="#{i18n['event.defaultRole']}:" /> <h:outputLabel for="defaultrole" value="#{i18n['event.defaultRole']}:" />
<h:selectOneMenu id="defaultrole" converter="#{roleConverter}" value="#{eventorgView.event.defaultRole}"> <h:selectOneMenu id="defaultrole" converter="#{roleConverter}" value="#{eventorgView.event.defaultRole}">
<f:selectItem itemLabel="---" /> <f:selectItem itemLabel="---" />
<f:selectItems var="role" itemLabel="#{role.name}" value="#{eventorgView.event.roles}" /> <f:selectItems var="role" itemLabel="#{role.name}" value="#{eventorgView.event.roles}" />
</h:selectOneMenu> </h:selectOneMenu>
<h:message for="defaultrole" /> <h:message for="defaultrole" />
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<h2>#{i18n['event.domains.title']}</h2> <h2>#{i18n['event.domains.title']}</h2>
<h:form> <h:form id="newDomainForm">
<h:inputText value="#{eventorgView.newdomain}" /> <h:inputText value="#{eventorgView.newdomain}" />
<h:commandButton action="#{eventorgView.addDomain()}" value="#{i18n['eventdomain.add']}" /> <h:commandButton action="#{eventorgView.addDomain()}" value="#{i18n['eventdomain.add']}" />
<h:dataTable var="domain" value="#{eventorgView.eventdomains}"> <h:dataTable var="domain" value="#{eventorgView.eventdomains}">
...@@ -70,8 +70,8 @@ ...@@ -70,8 +70,8 @@
</h:form> </h:form>
<h2>#{i18n['event.properties.title']}</h2> <h2>#{i18n['event.properties.title']}</h2>
<h:form> <h:form id="propertyListForm">
<h:dataTable var="prop" value="#{eventPropertyView.properties}"> <h:dataTable var="prop" id="propertyListTable" value="#{eventPropertyView.properties}">
<h:column> <h:column>
<f:facet name="header">#{i18n['lanEventProperty.key']}</f:facet> <f:facet name="header">#{i18n['lanEventProperty.key']}</f:facet>
<h:outputText value="#{prop.key}" /> <h:outputText value="#{prop.key}" />
...@@ -89,24 +89,25 @@ ...@@ -89,24 +89,25 @@
</h:column> </h:column>
<h:column> <h:column>
<h:commandButton action="#{eventPropertyView.editProperty}" value="#{i18n['lanEventProperty.editProperty']}"> <p:commandButton ajax="false" action="#{eventPropertyView.editProperty}" value="#{i18n['lanEventProperty.editProperty']}" update=":propertyEditForm" />
<!-- <f:ajax render="@all" execute="@form"/> -->
</h:commandButton>
</h:column> </h:column>
<h:column>
<p:commandButton ajax="false" action="#{eventPropertyView.deleteProperty}" onclick="return confirm('#{i18n['lanEventProperty.confirmDelete']}')"
value="#{i18n['lanEventProperty.deleteProperty']}" update=":propertyListForm" />
</h:column>
</h:dataTable> </h:dataTable>
</h:form> </h:form>
<h:form> <h:form id="propertyCreateForm">
<h:selectOneMenu id="propval" value="#{eventPropertyView.createKey}"> <h:selectOneMenu id="propval" value="#{eventPropertyView.createKey}">
<f:selectItems value="#{eventPropertyView.availablePropertyKeys}" /> <f:selectItems value="#{eventPropertyView.availablePropertyKeys}" />
</h:selectOneMenu> </h:selectOneMenu>
<h:commandButton action="#{eventPropertyView.initPropertyKeyCreate}" value="#{i18n['lanEventProperty.createProperty']}"> <p:commandButton ajax="false" action="#{eventPropertyView.initPropertyKeyCreate}" value="#{i18n['lanEventProperty.createProperty']}" update=":propertyCreateForm,:propertyEditForm" />
<!-- <f:ajax render="@all" execute="@form" /> -->
</h:commandButton>
<h:message for="propval" /> <h:message for="propval" />
</h:form> </h:form>
<h:form rendered="#{!empty eventPropertyView.property}" enctype="#{eventPropertyView.property.key.data?'multipart/form-data':''}"> <h:form id="propertyEditForm" rendered="#{!empty eventPropertyView.property}" enctype="#{eventPropertyView.property.key.data?'multipart/form-data':''}">
<h:panelGrid columns="3"> <h:panelGrid columns="3">
<h:outputLabel for="key" value="#{i18n['lanEventProperty.key']}" /> <h:outputLabel for="key" value="#{i18n['lanEventProperty.key']}" />
<h:outputText value="#{eventPropertyView.property.key}" id="key" /> <h:outputText value="#{eventPropertyView.property.key}" id="key" />
...@@ -140,14 +141,13 @@ ...@@ -140,14 +141,13 @@
<h:message rendered="#{eventPropertyView.property.key.long}" for="longval" /> <h:message rendered="#{eventPropertyView.property.key.long}" for="longval" />
</h:panelGrid> </h:panelGrid>
<h:commandButton action="#{eventPropertyView.saveProperty}" value="#{i18n['lanEventProperty.save']}" /> <p:commandButton ajax="false" action="#{eventPropertyView.saveProperty}" value="#{i18n['lanEventProperty.save']}" update=":propertyEditForm,:propertyListForm" />
</h:form> </h:form>
<ui:fragment id="privatePropertyEditor" rendered="#{eventPropertyView.privatePropertyPermission}">
<ui:fragment rendered="#{eventPropertyView.privatePropertyPermission}">
<h2>#{i18n['event.privateProperties.title']}</h2> <h2>#{i18n['event.privateProperties.title']}</h2>
<h:form> <h:form id="privPropList">
<h:dataTable var="prop" value="#{eventPropertyView.privateProperties}"> <h:dataTable var="prop" value="#{eventPropertyView.privateProperties}">
<h:column> <h:column>
<f:facet name="header">#{i18n['lanEventPrivateProperty.key']}</f:facet> <f:facet name="header">#{i18n['lanEventPrivateProperty.key']}</f:facet>
...@@ -163,9 +163,13 @@ ...@@ -163,9 +163,13 @@
</h:column> </h:column>
<h:column> <h:column>
<h:commandButton action="#{eventPropertyView.editPrivateProperty}" value="#{i18n['lanEventPrivateProperty.editProperty']}"> <p:commandButton ajax="false" action="#{eventPropertyView.editPrivateProperty}" value="#{i18n['lanEventPrivateProperty.editProperty']}">
<!-- <f:ajax render="@all" execute="@form"/> --> <!-- <f:ajax render="@all" execute="@form"/> -->
</h:commandButton> </p:commandButton>
</h:column>
<h:column>
<p:commandButton ajax="false" action="#{eventPropertyView.deletePrivateProperty}" onclick="return confirm('#{i18n['lanEventProperty.confirmDelete']}')"
value="#{i18n['lanEventProperty.deleteProperty']}" update="@form" />
</h:column> </h:column>
</h:dataTable> </h:dataTable>
</h:form> </h:form>
...@@ -174,9 +178,8 @@ ...@@ -174,9 +178,8 @@
<h:selectOneMenu id="propval" value="#{eventPropertyView.createPrivateKey}"> <h:selectOneMenu id="propval" value="#{eventPropertyView.createPrivateKey}">
<f:selectItems value="#{eventPropertyView.availablePrivatePropertyKeys}" /> <f:selectItems value="#{eventPropertyView.availablePrivatePropertyKeys}" />
</h:selectOneMenu> </h:selectOneMenu>
<h:commandButton action="#{eventPropertyView.initPrivatePropertyKeyCreate}" value="#{i18n['lanEventPrivateProperty.createProperty']}"> <p:commandButton ajax="false" action="#{eventPropertyView.initPrivatePropertyKeyCreate}" value="#{i18n['lanEventPrivateProperty.createProperty']}" update=":privatePropertyEditor" />
<!-- <f:ajax render="@all" execute="@form" /> -->
</h:commandButton>
<h:message for="propval" /> <h:message for="propval" />
</h:form> </h:form>
...@@ -199,7 +202,7 @@ ...@@ -199,7 +202,7 @@
<h:message rendered="#{eventPropertyView.privateProperty.key.date}" for="textval" /> <h:message rendered="#{eventPropertyView.privateProperty.key.date}" for="textval" />
</h:panelGrid> </h:panelGrid>
<h:commandButton action="#{eventPropertyView.savePrivateProperty}" value="#{i18n['lanEventPrivateProperty.save']}" /> <p:commandButton ajax="false" action="#{eventPropertyView.savePrivateProperty}" value="#{i18n['lanEventPrivateProperty.save']}" update=":privatePropertyEditor" />
</h:form> </h:form>
......
...@@ -105,6 +105,18 @@ public class EventPropertyView extends GenericCDIView { ...@@ -105,6 +105,18 @@ public class EventPropertyView extends GenericCDIView {
return null; return null;
} }
public String deleteProperty() {
eventbean.deleteProperty(properties.getRowData());
properties = null;
return null;
}
public String deletePrivateProperty() {
eventbean.deletePrivateProperty(privateProperties.getRowData());
privateProperties = null;
return null;
}
public String savePrivateProperty() public String savePrivateProperty()
{ {
logger.info("Saving property {}, eventorg {}, key {}", new Object[] { privateProperty.getEvent(), privateProperty.getEventorg(), privateProperty.getKey() }); logger.info("Saving property {}, eventorg {}, key {}", new Object[] { privateProperty.getEvent(), privateProperty.getEventorg(), privateProperty.getKey() });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!