Commit 9366fc3c by Tuomas Riihimäki

Merge branch 'kioskifixi' into 'master'

Kioskifixi

Vectoramassa tehdyt muutokset ja korjailut tunnusluontiin. Sekä incomingflowiin koodilistan päivittymättömyyskorjaus.
2 parents cf983633 1af12c52
...@@ -50,6 +50,10 @@ import fi.codecrew.moya.util.MailMessage; ...@@ -50,6 +50,10 @@ import fi.codecrew.moya.util.MailMessage;
@DeclareRoles({ UserPermission.S_WRITE_ROLES }) @DeclareRoles({ UserPermission.S_WRITE_ROLES })
public class CardTemplateBean implements CardTemplateBeanLocal { public class CardTemplateBean implements CardTemplateBeanLocal {
private static final Logger logger = LoggerFactory.getLogger(CardTemplateBean.class); private static final Logger logger = LoggerFactory.getLogger(CardTemplateBean.class);
/** /**
......
...@@ -172,10 +172,18 @@ public class ReaderBean implements ReaderBeanLocal { ...@@ -172,10 +172,18 @@ public class ReaderBean implements ReaderBeanLocal {
@Override @Override
public ReaderEvent assocCodeToCard(ReaderEvent readerEvent, PrintedCard card) { public ReaderEvent assocCodeToCard(ReaderEvent readerEvent, PrintedCard card) {
// you can select between this and flushCache.
card = cardfacade.reload(card);
CardCode code = new CardCode(card, readerEvent.getReader().getType(), readerEvent.getValue(), eventbean.getCurrentEvent()); CardCode code = new CardCode(card, readerEvent.getReader().getType(), readerEvent.getValue(), eventbean.getCurrentEvent());
cardCodeFacade.create(code); cardCodeFacade.create(code);
card.getCardCodes().add(code);
return readerEvent; return readerEvent;
} }
......
...@@ -8,17 +8,25 @@ ...@@ -8,17 +8,25 @@
<f:metadata> <f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" /> <f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" /> <f:event type="preRenderView" listener="#{userView.initView}" />
<f:event type="preRenderView" listener="#{userView.setCaptureForwardUrl('/admin/adduser/capturesuccess')}" /> <f:event type="preRenderView" listener="#{userView.setCaptureForwardUrl('/admin/adduser/update')}" />
</f:metadata> </f:metadata>
<ui:define name="topbar"> <ui:define name="topbar">
<h:link styleClass="userbackbutton" outcome="/admin/adduser/index"> <h:form>
<div>#{i18n['adduser.back']}</div> <h:commandLink styleClass="userbackbutton" action="#{userView.incomingPhotoReady}" value="Valmis">
</h:link> <div>#{i18n['adduser.back']}</div>
</h:commandLink>
</h:form>
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
<div style="text-align: center;"> <div style="text-align: center;">
<h:form styleClass="captureForm"> <h:form styleClass="captureForm">
<h:panelGrid columns="2"> <h:panelGrid columns="2">
...@@ -31,28 +39,42 @@ ...@@ -31,28 +39,42 @@
</a> </a>
</h:panelGroup> </h:panelGroup>
<h:panelGroup> <h:panelGroup>
<div id="webcamcontainer"> <div id="webcamcontainer">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" />
<div id="count" /> <div id="count" />
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<!-- <p:commandButton type="button" value="Capture" onclick="dophoto(pc)" /> <!-- <p:commandButton type="button" value="Capture" onclick="dophoto(pc)" />
--> -->
</div> </div>
</h:panelGroup> </h:panelGroup>
</h:panelGrid> </h:panelGrid>
</h:form> </h:form>
</div> </div>
<div style=""> <div style="">
<h:link style="margin: 0 auto; font-size: 3em;" outcome="/admin/adduser/index" value="Valmis"/> <h:form id="incomingpictureform">
<h:commandLink rendered="#{!empty userView.selectedUser.currentImage}" style="margin: 0 auto; font-size: 3em;" action="#{userView.incomingPhotoReady}" value="Valmis" />
<br />
<p:fragment rendered="#{!empty userView.selectedUser.currentImage}">
<p:graphicImage value="/dydata/userimage/#{userView.selectedUser.currentImage.id}.img" alt="image" />
</p:fragment>
</h:form>
</div> </div>
<script> <script>
function dophoto(pc) { function dophoto(pc) {
docount(5,pc); docount(5, pc);
} }
function docount(count,pc) { function docount(count, pc) {
$('#count').html(count); $('#count').html(count);
$('#count').css("opacity", 1); $('#count').css("opacity", 1);
$('#count').css("font-size", "28pt"); $('#count').css("font-size", "28pt");
...@@ -63,9 +85,9 @@ ...@@ -63,9 +85,9 @@
}, 1500, function() { }, 1500, function() {
if (count > 1) if (count > 1)
docount(count - 1, pc); docount(count - 1, pc);
if (count == 1) { if (count == 1) {
pc.capture(); pc.capture();
} }
}); });
} }
......
...@@ -84,6 +84,22 @@ public class AuthView extends GenericCDIView { ...@@ -84,6 +84,22 @@ public class AuthView extends GenericCDIView {
return "/frontpage"; return "/frontpage";
} }
public void executeLogoutNoRedirect() {
HttpServletRequest req = getRequest();
if (permbean.isLoggedIn()) {
try {
req.logout();
} catch (ServletException e) {
logger.warn("Error executing logout", e);
}
}
req.getSession().invalidate();
}
public void executeLogin() { public void executeLogin() {
executeLogin(null); executeLogin(null);
......
...@@ -154,6 +154,12 @@ public class UserView extends GenericCDIView { ...@@ -154,6 +154,12 @@ public class UserView extends GenericCDIView {
} }
/** /**
* This is the user we are currently editing, if that is not found we user * This is the user we are currently editing, if that is not found we user
* current user * current user
...@@ -395,7 +401,7 @@ public class UserView extends GenericCDIView { ...@@ -395,7 +401,7 @@ public class UserView extends GenericCDIView {
public String createUserAdduserView() { public String createUserAdduserView() {
userbean.createNewUser(user, getPassword()); userbean.createNewUser(user, getPassword());
// authView.executeAdduserAutoLogin(user, getPassword()); authView.executeAdduserAutoLogin(user, getPassword());
return "/admin/adduser/update"; return "/admin/adduser/update";
} }
...@@ -404,6 +410,14 @@ public class UserView extends GenericCDIView { ...@@ -404,6 +410,14 @@ public class UserView extends GenericCDIView {
canSave = permbean.hasPermission(UserPermission.MODIFY); canSave = permbean.hasPermission(UserPermission.MODIFY);
return "/useradmin/edit"; return "/useradmin/edit";
} }
// /admin/adduser/index
public String incomingPhotoReady() {
authView.executeLogoutNoRedirect();
navihandler.forward("/admin/adduser/index?faces-redirect=true");
return "/admin/adduser/index";
}
public void setUserid(Integer userid) { public void setUserid(Integer userid) {
this.userid = userid; this.userid = userid;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!