Commit 1458594e by Tuomas Riihimäki

Merge branch 'master' of dev.insomnia.fi:/data/bortal

2 parents 920b089c cc1b9527
package fi.insomnia.bortal.beans;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.facade.OrgRoleFacade;
import fi.insomnia.bortal.model.OrgRole;
/**
* Session Bean implementation class OrgRoleBean
*/
@Stateless
@LocalBean
public class OrgRoleBean implements OrgRoleBeanLocal {
private static final Logger logger = LoggerFactory
.getLogger(OrgRoleBean.class);
@EJB
private EventBeanLocal eventBean;
@EJB
private OrgRoleFacade orgRoleFacade;
public OrgRoleBean() {
}
@Override
public List<OrgRole> listOrgRoles() {
return orgRoleFacade.findByOrganizer(eventBean.getCurrentEvent()
.getOrganiser());
}
}
...@@ -58,4 +58,13 @@ public class OrgRoleFacade extends IntegerPkGenericFacade<OrgRole> { ...@@ -58,4 +58,13 @@ public class OrgRoleFacade extends IntegerPkGenericFacade<OrgRole> {
return getEm().createQuery(cq).getResultList(); return getEm().createQuery(cq).getResultList();
} }
public List<OrgRole> findByOrganizer(EventOrganiser organiser) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<OrgRole> cq = cb.createQuery(OrgRole.class);
Root<OrgRole> root = cq.from(OrgRole.class);
cq.where(cb.equal(root.get(OrgRole_.eventOrganizer), organiser));
return getEm().createQuery(cq).getResultList();
}
} }
package fi.insomnia.bortal.beans;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.bortal.model.OrgRole;
@Local
public interface OrgRoleBeanLocal {
List<OrgRole> listOrgRoles();
}
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"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"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:orgrole="http://java.sun.com/jsf/composite/cditools/orgrole"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition
template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:param name="thispage" value="page.orgrole.list" />
<f:metadata>
<f:event type="preRenderView"
listener="#{orgRoleView.permissionRead()}" />
</f:metadata>
<ui:define name="content">
<orgrole:list />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<?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:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form id="orgrolelist">
<h:dataTable border="1" id="user" value="#{orgRoleDataView.orgRoles}"
var="orgRole">
<h:column>
<f:facet name="header">
<h:outputText value="#" />
</f:facet>
<h:outputText value="#{orgRole.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['orgrole.name']}" />
</f:facet>
<h:outputText value="#{orgRole.name}" />
</h:column>
<h:column>
<h:link outcome="/orgrole/edit" value="#{i18n['orgrole.edit']}">
<f:param name="orgroleid" value="#{orgRole.id}" />
</h:link>
</h:column>
</h:dataTable>
</h:form>
</composite:implementation>
</html>
\ No newline at end of file
...@@ -93,6 +93,15 @@ ...@@ -93,6 +93,15 @@
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" /> <f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText> </h:outputText>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Submit entry" />
</f:facet>
<h:link outcome="addentry">
<f:param name="compoId" value="#{compo.id}" />
Submit entry
</h:link>
</h:column>
</h:dataTable> </h:dataTable>
</div> </div>
......
...@@ -526,6 +526,8 @@ userview.userExists = Username already exists! please select another. ...@@ -526,6 +526,8 @@ userview.userExists = Username already exists! please select another.
viewexpired.body = Please login again. viewexpired.body = Please login again.
viewexpired.title = Login expired. Please login again. viewexpired.title = Login expired. Please login again.
voting.allcompos.description = List of all compos and NIIDEN information.
voting.allcompos.header = All compos
voting.create.compoEnd = End time voting.create.compoEnd = End time
voting.create.compoStart = Start time voting.create.compoStart = Start time
voting.create.createButton = Create voting.create.createButton = Create
......
...@@ -516,6 +516,8 @@ userview.userExists = K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Ole ...@@ -516,6 +516,8 @@ userview.userExists = K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Ole
viewexpired.body = Ole hyv\u00E4 ja kirjaudu sis\u00E4\u00E4n uudelleen. viewexpired.body = Ole hyv\u00E4 ja kirjaudu sis\u00E4\u00E4n uudelleen.
viewexpired.title = N\u00E4kym\u00E4 on vanhentunut viewexpired.title = N\u00E4kym\u00E4 on vanhentunut
voting.allcompos.description = Compojen informaatiot.
voting.allcompos.header = Kaikki compot
voting.create.compoEnd = Lopetusaika voting.create.compoEnd = Lopetusaika
voting.create.compoStart = Aloitusaika voting.create.compoStart = Aloitusaika
voting.create.createButton = Luo voting.create.createButton = Luo
......
package fi.insomnia.bortal.web.cdiview.user;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import fi.insomnia.bortal.beans.OrgRoleBeanLocal;
import fi.insomnia.bortal.model.OrgRole;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
@Named
@RequestScoped
public class OrgRoleDataView extends GenericCDIView {
private static final long serialVersionUID = -607046631885684171L;
private transient ListDataModel<OrgRole> orgRoles;
@EJB
OrgRoleBeanLocal orgRolesBean;
public ListDataModel<OrgRole> getOrgRoles() {
if (orgRoles == null) {
orgRoles = new ListDataModel<OrgRole>(orgRolesBean.listOrgRoles());
}
return orgRoles;
}
}
...@@ -28,6 +28,14 @@ public class VotingCompoAddEntryView { ...@@ -28,6 +28,14 @@ public class VotingCompoAddEntryView {
private Integer compoId; private Integer compoId;
public Integer getCompoId() {
return compoId;
}
public void setCompoId(Integer compoId) {
this.compoId = compoId;
}
public UploadedFile getUploadedFile() { public UploadedFile getUploadedFile() {
return uploadedFile; return uploadedFile;
} }
......
...@@ -7,6 +7,8 @@ import javax.enterprise.context.RequestScoped; ...@@ -7,6 +7,8 @@ import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
import javax.inject.Named; import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.VotingBeanLocal; import fi.insomnia.bortal.beans.VotingBeanLocal;
import fi.insomnia.bortal.model.Compo; import fi.insomnia.bortal.model.Compo;
...@@ -29,6 +31,8 @@ public class VotingCompoListView extends GenericCDIView { ...@@ -29,6 +31,8 @@ public class VotingCompoListView extends GenericCDIView {
boolean curEntries; boolean curEntries;
boolean maxParts; boolean maxParts;
private static final Logger logger = LoggerFactory.getLogger(VotingCompoListView.class);
public boolean isCurEntries() { public boolean isCurEntries() {
return curEntries; return curEntries;
} }
...@@ -55,10 +59,12 @@ public class VotingCompoListView extends GenericCDIView { ...@@ -55,10 +59,12 @@ public class VotingCompoListView extends GenericCDIView {
if(requirePermissions(CompoPermission.VIEW_COMPOS) && role == null) { if(requirePermissions(CompoPermission.VIEW_COMPOS) && role == null) {
curEntries = true; curEntries = true;
maxParts = true; maxParts = true;
logger.info("Permission to view full compo listing.");
} }
else { else {
curEntries = false; curEntries = false;
maxParts = false; maxParts = false;
logger.info("Not enough rights to view full compo listing.");
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!