Commit 439d8512 by Tuukka Kivilahti

Merge branch 'devel' of codecrew.fi:bortal into devel

2 parents 033f3e9f b3829744
...@@ -271,4 +271,27 @@ public class CardTemplateBean implements CardTemplateBeanLocal { ...@@ -271,4 +271,27 @@ public class CardTemplateBean implements CardTemplateBeanLocal {
return printedcardfacade.findByState(state); return printedcardfacade.findByState(state);
} }
@Override
public PrintedCard setCardState(int cardId, CardState state) throws Exception {
PrintedCard card = printedcardfacade.find(cardId);
switch (state)
{
case PRINTED:
card.setPrintCount(card.getPrintCount() + 1);
break;
case PRINTING_IN_PROGRESS:
if (card.getCardState().equals(CardState.PRINTING_IN_PROGRESS)
|| card.getCardState().equals(CardState.PRINTED)) {
String response = "Unable to change type to PRINTING_IN_PROGRESS value is already {}" + card.getCardState();
logger.warn(response);
throw new Exception(response);
}
break;
default:
break;
}
card.setCardState(state);
return card;
}
} }
...@@ -44,4 +44,6 @@ public interface CardTemplateBeanLocal extends EntityFinderBean<CardTemplate> { ...@@ -44,4 +44,6 @@ public interface CardTemplateBeanLocal extends EntityFinderBean<CardTemplate> {
List<PrintedCard> getCardsByState(CardState... pendingPrint); List<PrintedCard> getCardsByState(CardState... pendingPrint);
PrintedCard setCardState(int cardId, CardState printed) throws Exception;
} }
...@@ -8,7 +8,6 @@ public enum CardState { ...@@ -8,7 +8,6 @@ public enum CardState {
PENDING_VALIDATION, PENDING_VALIDATION,
REJECTED, REJECTED,
VALIDATED, VALIDATED,
PENDING_PRINT,
PRINTING_IN_PROGRESS, PRINTING_IN_PROGRESS,
PRINTED; PRINTED;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="MoyaWeb"> <wb-module deploy-name="MoyaWeb">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
......
.ui-widget, .ui-widget,.ui-widget .ui-widget,.ui-button-text, .ui-wizard-step-title {
.ui-widget .ui-widget, .ui-button-text {
font-size: 90% !important; font-size: 90% !important;
} }
...@@ -13,7 +11,6 @@ ...@@ -13,7 +11,6 @@
color: #101D27; color: #101D27;
font-style: italic; font-style: italic;
font-weight: lighter; font-weight: lighter;
} }
.center h1 { .center h1 {
...@@ -44,13 +41,10 @@ ...@@ -44,13 +41,10 @@
.center { .center {
font-family: Oxygen, Calibri; font-family: Oxygen, Calibri;
font-size: 10pt; font-size: 10pt;
} }
.center p { .center p {
padding-left: 5em; padding-left: 5em;
} }
.right { .right {
...@@ -71,26 +65,25 @@ ...@@ -71,26 +65,25 @@
} }
label { label {
color: #000; color: #000;
font-weight: 100; font-weight: 100;
font-family: Oxygen; font-family: Oxygen;
font-size: 10pt; font-size: 10pt;
} }
input, textarea {
input,textarea {
padding: 3px; padding: 3px;
border: solid 1px #E5E5E5; border: solid 1px #E5E5E5;
outline: 0; outline: 0;
font: normal 13px/100% Verdana, Tahoma, sans-serif; font: normal 13px/100% Verdana, Tahoma, sans-serif;
margin: 0.25em 0; margin: 0.25em 0;
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF)); background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF),
color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px); background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
-moz-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; -moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
-webkit-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
} }
textarea { textarea {
...@@ -100,8 +93,7 @@ textarea { ...@@ -100,8 +93,7 @@ textarea {
line-height: 150%; line-height: 150%;
} }
input:hover, textarea:hover, input:hover,textarea:hover,input:focus,textarea:focus {
input:focus, textarea:focus {
border-color: #C9C9C9; border-color: #C9C9C9;
-webkit-box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 8px; -webkit-box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 8px;
} }
...@@ -110,9 +102,12 @@ input:focus, textarea:focus { ...@@ -110,9 +102,12 @@ input:focus, textarea:focus {
/* /*
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,audio,canvas,details,figcaption,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}body{line-height:1;}article,aside,dialog,figure,footer,header,hgroup,nav,section,blockquote{display:block;}nav ul{list-style:none;}ol{list-style:decimal;}ul{list-style:disc;}ul ul{list-style:circle;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:none;}ins{text-decoration:underline;}del{text-decoration:line-through;}mark{background:none;}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help;}table{border-collapse:collapse;border-spacing:0;}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0;}input[type=submit],input[type=button],button{margin:0!important;padding:0!important;}input,select,a img{vertical-align:middle;} html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,audio,canvas,details,figcaption,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}body{line-height:1;}article,aside,dialog,figure,footer,header,hgroup,nav,section,blockquote{display:block;}nav ul{list-style:none;}ol{list-style:decimal;}ul{list-style:disc;}ul ul{list-style:circle;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:none;}ins{text-decoration:underline;}del{text-decoration:line-through;}mark{background:none;}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help;}table{border-collapse:collapse;border-spacing:0;}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0;}input[type=submit],input[type=button],button{margin:0!important;padding:0!important;}input,select,a img{vertical-align:middle;}
*/ */
@font-face { font-family: Oxygen; src: url('Oxygen-Regular.ttf'); } @font-face {
font-family: Oxygen;
src: url('Oxygen-Regular.ttf');
}
body, html{ body,html {
margin: 0; margin: 0;
padding: 0; padding: 0;
background: url("../img/bg.png"); background: url("../img/bg.png");
...@@ -133,37 +128,34 @@ h1 { ...@@ -133,37 +128,34 @@ h1 {
float: left; float: left;
padding-left: 3em; padding-left: 3em;
} }
#nav_left img { #nav_left img {
padding-top: 1em; padding-top: 1em;
} }
.right { .right {
width: 180px !important; width: 180px !important;
} }
.right input[type="text"], .right input[type="password"] { .right input[type="text"],.right input[type="password"] {
width: 140px; width: 140px;
} }
.right a { .right a {
font-family: sans-serif, Calibri; font-family: sans-serif, Calibri;
font-size: 10pt; font-size: 10pt;
} }
.colleft { .colleft {
padding-top: 1em; padding-top: 1em;
} }
.colleft ul { .colleft ul {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
} }
.colleft a { .colleft a {
color: black; color: black;
text-decoration: none; text-decoration: none;
...@@ -173,12 +165,11 @@ h1 { ...@@ -173,12 +165,11 @@ h1 {
color: black; color: black;
text-decoration: underline; text-decoration: underline;
} }
.clear { .clear {
clear: both; clear: both;
} }
#footer { #footer {
border-top: 1px solid black; border-top: 1px solid black;
border-bottom: 1px solid black; border-bottom: 1px solid black;
...@@ -187,75 +178,84 @@ h1 { ...@@ -187,75 +178,84 @@ h1 {
padding: 0.25em 0; padding: 0.25em 0;
} }
#header { #header {
clear:both; clear: both;
float:left; float: left;
width:100%; width: 100%;
border-bottom: 4px solid #333; border-bottom: 4px solid #333;
} }
/* column container */ /* column container */
.colmask { .colmask {
position:relative; /* This fixes the IE7 overflow hidden bug */ position: relative; /* This fixes the IE7 overflow hidden bug */
clear:both; clear: both;
float:left; float: left;
width:100%; /* width of whole page */ width: 100%; /* width of whole page */
overflow:hidden; /* This chops off any overhanging divs */ overflow: hidden; /* This chops off any overhanging divs */
} }
/* common column settings */ /* common column settings */
.colright, .colright, .colmid, .colleft {
.colmid, float: left;
.colleft { width: 100%; /* width of page */
float:left; position: relative;
width:100%; /* width of page */ }
position:relative;
} .col1, .col2, .col3 {
.col1, float: left;
.col2, position: relative;
.col3 { padding: 0 0 0 0;
float:left; /* no left and right padding on columns, we just make them narrower instead
position:relative;
padding:0 0 0 0; /* no left and right padding on columns, we just make them narrower instead
only padding top and bottom is included here, make it whatever value you need */ only padding top and bottom is included here, make it whatever value you need */
overflow:hidden; overflow: hidden;
} }
/* 3 Column settings */ /* 3 Column settings */
.threecol { /* right */ .threecol { /* right */
} }
.threecol .colmid { .threecol .colmid {
right:25%; /* width of the right column */ right: 25%; /* width of the right column */
background-color: white; background-color: white;
border-right: 1px solid black; border-right: 1px solid black;
min-height: 500px; min-height: 500px;
} }
.threecol .colleft { .threecol .colleft {
right:60%; /* width of the middle column */ right: 60%; /* width of the middle column */
background-color: white; background-color: white;
min-height: 500px; min-height: 500px;
border-right: 1px dashed #ddd; border-right: 1px dashed #ddd;
} }
.threecol .col1 { .threecol .col1 {
width:56%; /* width of center column content (column width minus padding on either side) */ width: 56%;
left:102%; /* 100% plus left padding of center column */ /* width of center column content (column width minus padding on either side) */
left: 102%; /* 100% plus left padding of center column */
} }
.threecol .col2 { .threecol .col2 {
width:12%; /* Width of left column content (column width minus padding on either side) */ width: 12%;
left:31%; /* width of (right column) plus (center column left and right padding) plus (left column left padding) */ /* Width of left column content (column width minus padding on either side) */
left: 31%;
/* width of (right column) plus (center column left and right padding) plus (left column left padding) */
} }
.threecol .col3 { .threecol .col3 {
width:21%; /* Width of right column content (column width minus padding on either side) */ width: 21%;
left:95%; /* Please make note of the brackets here: /* Width of right column content (column width minus padding on either side) */
left: 95%; /* Please make note of the brackets here:
(100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */ (100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */
} }
/* Footer styles */ /* Footer styles */
#footer { #footer {
clear:both; clear: both;
float:left; float: left;
width:75%; width: 75%;
border-top:1px solid #000; border-top: 1px solid #000;
color: white; color: white;
font-size: 9pt; font-size: 9pt;
text-align: center; text-align: center;
...@@ -275,11 +275,12 @@ h1 { ...@@ -275,11 +275,12 @@ h1 {
#tournamentMenu ul { #tournamentMenu ul {
margin-left: 2em; margin-left: 2em;
list-style-type: square !important; list-style-type: square !important;
} }
#main h1 { #main h1 {
color: black; color: black;
} }
#main a { #main a {
color: #2694e8; color: #2694e8;
} }
...@@ -296,4 +297,3 @@ h1 { ...@@ -296,4 +297,3 @@ h1 {
#header_right { #header_right {
text-align: right; text-align: right;
} }
\ No newline at end of file
<!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:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<!-- <f:event type="preRenderView" listener="#{userOverviewView.initView()}" /> -->
</f:metadata>
<ui:define name="content">
<h1>Create tournament</h1>
<h:form>
<p:wizard widgetVar="wiz" flowListener="#{tournamentCreateView.onFlowProcess}">
<p:tab id="selectGame" title="Select a game">
<p:panel header="Select a game">
<h:messages errorClass="error" />
Select a game
<p:selectOneMenu>
<f:selectItem itemLabel="" />
<f:selectItem itemLabel="spurdo spärde" />
<f:selectItem itemLabel="cockmaster" />
</p:selectOneMenu>
<h2>Create new game</h2>
<h:panelGrid columns="2">
<h:outputText value="Name" />
<h:outputText value="Description" />
<p:inputText />
<p:inputText />
<h:outputText value="Upload image" />
<h:outputText value="" />
<p:fileUpload mode="simple" />
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="selectRuleset" title="Select a ruleset">
<p:panel header="Select a ruleset">
<h:messages errorClass="error" />
Select a ruleset
<p:selectOneMenu>
<f:selectItem itemLabel="" />
<f:selectItem itemLabel="Pro-rules" />
<f:selectItem itemLabel="N00b-rules" />
</p:selectOneMenu>
<br />
<h2>Create new ruleset</h2>
<h:outputText value="Rule Name" />
<br />
<p:inputText />
<br />
<h:outputText value="Description" />
<br />
<p:inputTextarea />
</p:panel>
</p:tab>
<p:tab id="selectRegTimes" title="Set registration times">
<p:panel header="Select registration times">
<h:messages errorClass="error" />
<h2>Registration</h2>
<h:panelGrid columns="2">
<h:outputText value="Opens" />
<h:outputText value="Closees" />
<p:calendar stepHour="1" stepMinute="10" pattern="dd.MM.yyyy hh:mm" />
<p:calendar stepHour="1" stepMinute="10" pattern="dd.MM.yyyy hh:mm" />
</h:panelGrid>
<h2>Event Start time</h2>
<h:panelGrid>
<h:outputText value="Start time" />
<p:calendar stepHour="1" stepMinute="10" pattern="dd.MM.yyyy hh:mm" />
</h:panelGrid>
</p:panel>
<div style="float: right;">
<p:commandButton icon="apply" value="Create event" />
</div>
</p:tab>
</p:wizard>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!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:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<!-- <f:event type="preRenderView" listener="#{userOverviewView.initView()}" /> -->
</f:metadata>
<ui:define name="content">
<h1>Tournaments</h1>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -39,12 +39,35 @@ public class PrinterRestView { ...@@ -39,12 +39,35 @@ public class PrinterRestView {
private static final Logger logger = LoggerFactory.getLogger(PrinterRestView.class); private static final Logger logger = LoggerFactory.getLogger(PrinterRestView.class);
@GET @GET
@Path("/Reserve/{id}/")
public Response reserveCardForPrinting(@PathParam("id") int cardId, @QueryParam("key") String hash) throws Exception {
ResponseBuilder ret = null;
try {
PrintedCard card = cardbean.setCardState(cardId, CardState.PRINTING_IN_PROGRESS);
if (card.getCardState().equals(CardState.PRINTING_IN_PROGRESS)) {
ret = Response.ok(new PrintedCardRestPojo(card));
}
} catch (Exception e) {
ret = null;
logger.warn("Caught exception while reserving card for printing" + cardId, e);
}
if (ret == null) {
ret = Response.status(Response.Status.CONFLICT);
}
return ret.build();
}
@GET
@Path("/Printed/{id}/") @Path("/Printed/{id}/")
public PrintedCardRestPojo setCardPrinted(@PathParam("id") int cardId, @QueryParam("key") String hash) throws Exception { public PrintedCardRestPojo setCardPrinted(@PathParam("id") int cardId, @QueryParam("key") String hash) throws Exception {
PrintedCard card = cardbean.findCard(cardId); return new PrintedCardRestPojo(cardbean.setCardState(cardId, CardState.PRINTED));
card.setCardState(CardState.PRINTED); // PrintedCard card = cardbean.findCard(cardId);
card = cardbean.saveCard(card); // card.setCardState(CardState.PRINTED);
return new PrintedCardRestPojo(card); // card.setPrintCount(card.getPrintCount() + 1);
// card = cardbean.saveCard(card);
// return new PrintedCardRestPojo(card);
} }
@GET @GET
...@@ -76,7 +99,7 @@ public class PrinterRestView { ...@@ -76,7 +99,7 @@ public class PrinterRestView {
@GET @GET
@Path("/ListUnprinted") @Path("/ListUnprinted")
public List<PrintedCardRestPojo> getUserCard(@QueryParam("key") String key) throws Exception { public List<PrintedCardRestPojo> getUserCard(@QueryParam("key") String key) throws Exception {
List<PrintedCardRestPojo> ret = PrintedCardRestPojo.parseCards(cardbean.getCardsByState(CardState.PENDING_PRINT)); List<PrintedCardRestPojo> ret = PrintedCardRestPojo.parseCards(cardbean.getCardsByState(CardState.VALIDATED));
logger.info("Returning card pojos: {} for key {}", ret, key); logger.info("Returning card pojos: {} for key {}", ret, key);
return ret; return ret;
} }
......
package fi.codecrew.moya.web.cdiview.tournaments;
import java.io.Serializable;
import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.faces.event.ActionEvent;
import javax.inject.Named;
import org.primefaces.event.FlowEvent;
@Named
@ConversationScoped
public class TournamentCreateView implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2547358764980373797L;
// called on finish
public void save(ActionEvent actionEvent) {
}
public String onFlowProcess(FlowEvent event) {
return event.getNewStep();
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!