Commit eda91b75 by Juho Salli

Compolist-juttuja

1 parent 5d3fcbb0
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import java.util.List;
import javax.ejb.Local; import javax.ejb.Local;
import fi.insomnia.bortal.model.Compo; import fi.insomnia.bortal.model.Compo;
...@@ -7,4 +9,5 @@ import fi.insomnia.bortal.model.Compo; ...@@ -7,4 +9,5 @@ import fi.insomnia.bortal.model.Compo;
@Local @Local
public interface VotingBeanLocal { public interface VotingBeanLocal {
public void createCompo(Compo c); public void createCompo(Compo c);
public List<Compo> getCompoList();
} }
...@@ -117,6 +117,15 @@ ...@@ -117,6 +117,15 @@
<redirect /> <redirect />
</navigation-case> </navigation-case>
</navigation-rule> </navigation-rule>
<navigation-rule>
<display-name>voting/create</display-name>
<from-view-id>/voting/create.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/voting/compolist.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
</faces-config> </faces-config>
......
<!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:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"> xmlns:p="http://primefaces.org/ui">
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /--> <!-- <f:event type="preRenderView" listener="#{votingCompoListView.initView}" /> -->
</f:metadata> </f:metadata>
<ui:define name="content"> <ui:define name="content">
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> --> <!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>#{i18n['voting.allcompos.header']}</h1> <h1>#{i18n['voting.allcompos.header']}</h1>
<p>#{i18n['voting.allcompos.description']}</p> <p>#{i18n['voting.allcompos.description']}</p>
<div class="clearfix"></div> <div class="clearfix"></div>
<div id="compolist">
</ui:define>
</ui:composition> <h:dataTable styleClass="bordertable" rowClasses="roweven,rowodd" id="compolisttable" value="#{votingCompoListView.compos}" var="compo">
</h:body> <h:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#{compo.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Kuvaus" />
</f:facet>
<h:outputText value="#{compo.description}" />
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="Max parts" />
</f:facet>
<h:outputText value="#{compo.maxParticipantCount}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Start time" />
</f:facet>
<h:outputText value="#{compo.startTime.time}" >
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="End time" />
</f:facet>
<h:outputText value="#{compo.endTime.time}" >
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="Vote start" />
</f:facet>
<h:outputText value="#{compo.voteStart.time}" >
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="Vote end" />
</f:facet>
<h:outputText value="#{compo.voteEnd.time}" >
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Submit start" />
</f:facet>
<h:outputText value="#{compo.submitStart.time}" >
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Submit end" />
</f:facet>
<h:outputText value="#{compo.submitEnd.time}" >
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
</h:outputText>
</h:column>
</h:dataTable>
</div>
</ui:define>
</ui:composition>
</h:body>
</html> </html>
\ No newline at end of file
package fi.insomnia.bortal.web.cdiview.voting; package fi.insomnia.bortal.web.cdiview.voting;
import javax.faces.bean.RequestScoped;
import javax.inject.Named; import java.util.List;
import fi.insomnia.bortal.web.cdiview.GenericCDIView; import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
@Named import javax.faces.bean.RequestScoped;
@RequestScoped import javax.inject.Named;
public class VotingCompoListView extends GenericCDIView {
import fi.insomnia.bortal.beans.VotingBeanLocal;
/** import fi.insomnia.bortal.model.Compo;
* import fi.insomnia.bortal.web.cdiview.GenericCDIView;
*/
private static final long serialVersionUID = 4166316634472472472L; @ManagedBean
@Named
} @RequestScoped
public class VotingCompoListView extends GenericCDIView {
/**
*
*/
private static final long serialVersionUID = 4166316634472472472L;
@EJB
private VotingBeanLocal votbean;
public List<Compo> getCompos() {
return votbean.getCompoList();
}
}
...@@ -128,7 +128,7 @@ public class VotingCreateView extends GenericCDIView { ...@@ -128,7 +128,7 @@ public class VotingCreateView extends GenericCDIView {
se.setTime(submitEnd); se.setTime(submitEnd);
co.setSubmitEnd(se); co.setSubmitEnd(se);
votbean.createCompo(co); votbean.createCompo(co);
return "success."; return "success";
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!