Commit 61e23cac by Antti Tönkyrä

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

2 parents 435fa2c8 9b5ee3e2
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<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:metadata> </f:metadata>
<ui:define name="topbar"> <ui:define name="topbar">
......
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <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" xmlns:p="http://primefaces.org/ui">
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"
xmlns:p="http://primefaces.org/ui">
<composite:interface> <composite:interface>
<composite:attribute name="creating" required="false" default="false" /> <composite:attribute name="creating" required="false" default="false" />
<composite:attribute name="commitaction" required="true" method-signature="java.lang.String action()" />
<composite:attribute name="commitvalue" required="true" />
<composite:attribute name="commitaction" required="true"
method-signature="java.lang.String action()" />
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" <h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
target="head" />
<h:panelGrid columns="2"> <h:panelGrid columns="2">
<h:form id="userform" enctype="multipart/form-data">
<h:panelGroup>
<h:panelGroup>
<h:form id="userform" enctype="multipart/form-data">
<ui:fragment rendered="#{not empty userView.user.id}"> <ui:fragment rendered="#{not empty userView.user.id}">
<p:overlayPanel id="chartPanel" for="webcamButton" <p:overlayPanel id="chartPanel" for="webcamButton" dynamic="true">
hideEffect="fade"> <p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" <p:commandButton type="button" value="Capture" onclick="pc.capture()" />
update="@all" />
<p:commandButton type="button" value="Capture"
onclick="pc.capture()" />
</p:overlayPanel> </p:overlayPanel>
<h:outputText rendered="#{empty userView.user.currentImage}" <h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}"> <ui:fragment rendered="#{!empty userView.user.currentImage}">
<img style="width: 150px;" <img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img"
alt="image" />
</ui:fragment> </ui:fragment>
<br /> <br />
<p:commandButton id="webcamButton" <p:commandButton id="webcamButton" value="#{i18n['userimage.webcam']}" type="button" />
value="#{i18n['userimage.webcam']}" type="button" />
<br /> <br />
<br /> <br />
<p:fileUpload id="uploadfile" required="TRUE" <p:fileUpload id="uploadfile" required="TRUE" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" value="#{userView.image}" mode="simple" />
requiredMessage="Required!"
invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024"
value="#{userView.image}" mode="simple" />
<p:message for="uploadfile" /> <p:message for="uploadfile" />
<p:commandButton action="#{userView.sendImage}" ajax="false" <p:commandButton action="#{userView.sendImage}" ajax="false" value="#{i18n['user.imagesubmit']}" />
value="#{i18n['user.imagesubmit']}" />
</ui:fragment> </ui:fragment>
</h:form>
<ui:fragment rendered="#{cc.attrs.creating}"> <ui:fragment rendered="#{cc.attrs.creating}">
<h:outputLabel value="#{i18n['user.login']}" for="mklogin" /> <h:outputLabel value="#{i18n['user.login']}" for="mklogin" />
<br />
<p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="25" id="mklogin" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.login}" />
</p:inplace>
<p:message for="login" />
<br />
</ui:fragment>
<br />
<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<br />
<p:inplace rendered="#{cc.attrs.creating}" emptyLabel="#{i18n['user.insert']}">
<p:password validator="#{userValidator.password}" id="password" value="#{userView.password}" />
</p:inplace>
<p:message rendered="#{cc.attrs.creating}" for="password" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br /> <br />
<p:inplace emptyLabel="#{i18n['user.insert']}"> <p:inplace rendered="#{cc.attrs.creating}" emptyLabel="#{i18n['user.insert']}">
<p:inputText size="25" id="mklogin" <p:password validator="#{userValidator.password}" id="passwordcheck" value="#{userView.passwordcheck}" />
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.login}" />
</p:inplace> </p:inplace>
<p:message for="login" /> <p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<br /> <br />
</ui:fragment> </h:panelGroup>
<br /> </h:form>
<h:outputLabel rendered="#{cc.attrs.creating}"
value="#{i18n['user.password']}" for="password" />
<br />
<p:inplace rendered="#{cc.attrs.creating}"
emptyLabel="#{i18n['user.insert']}">
<p:password validator="#{userValidator.password}" id="password"
value="#{userView.password}" />
</p:inplace>
<p:message rendered="#{cc.attrs.creating}" for="password" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}"
value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br />
<p:inplace rendered="#{cc.attrs.creating}"
emptyLabel="#{i18n['user.insert']}">
<p:password validator="#{userValidator.password}" id="passwordcheck"
value="#{userView.passwordcheck}" />
</p:inplace>
<p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<br />
</h:panelGroup>
<h:form> <h:form>
...@@ -103,114 +75,64 @@ ...@@ -103,114 +75,64 @@
<table> <table>
<ui:fragment rendered="#{!cc.attrs.creating}"> <ui:fragment rendered="#{!cc.attrs.creating}">
<tr> <tr>
<td colspan="2"><h:outputLabel for="login" <td colspan="2"><h:outputLabel for="login" value="#{i18n['user.login']}" /><br /> <h:outputText value="#{userView.selectedUser.login}" id="login" /></td>
value="#{i18n['user.login']}" /><br /> <h:outputText
value="#{userView.selectedUser.login}" id="login" /></td>
</tr> </tr>
</ui:fragment> </ui:fragment>
<tr> <tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" <td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> <br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
for="nick" /> <br /> <p:inplace <p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.nick}" />
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="nick"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.nick}" />
</p:inplace></td> </p:inplace></td>
</tr> </tr>
<tr> <tr>
<td><h:outputLabel value="#{i18n['user.firstNames']}" <td><h:outputLabel value="#{i18n['user.firstNames']}" for="firstnames" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
for="firstnames" /><br /> <p:inplace <p:inputText size="22" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.firstnames}" />
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="22" id="firstnames"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.firstnames}" />
</p:inplace></td> </p:inplace></td>
<td><h:outputLabel value="#{i18n['user.lastName']}" <td><h:outputLabel value="#{i18n['user.lastName']}" for="lastname" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
for="lastname" /><br /> <p:inplace <p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.lastname}" />
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="30" id="lastname"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.lastname}" />
</p:inplace></td> </p:inplace></td>
</tr> </tr>
<tr> <tr>
<td><h:outputLabel for="birthday" <td><h:outputLabel for="birthday" value="#{i18n['user.birthday']}" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
value="#{i18n['user.birthday']}" /><br /> <p:calendar id="birthday" navigator="true" yearRange="c-80:c-0" value="#{userView.selectedUser.birthday}">
<f:convertDateTime pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" />
<p:inplace emptyLabel="#{i18n['user.insert']}">
<p:calendar id="birthday" navigator="true" yearRange="c-80:c-0"
value="#{userView.selectedUser.birthday}"
>
<f:convertDateTime pattern="#{sessionHandler.dateFormat}"
timeZone="#{sessionHandler.timezone}" />
</p:calendar> </p:calendar>
</p:inplace> </p:inplace> <h:message for="birthday" /></td>
<h:message <td><h:outputLabel value="#{i18n['user.sex']}" for="sex" /> <br /> <p:selectOneMenu disabled="#{!cc.attrs.creating and !userView.canSave}" id="sex" value="#{userView.selectedUser.gender}">
for="birthday" /></td> <f:selectItem id="undefined" itemLabel="#{i18n['user.sex.UNDEFINED']}" itemValue="UNDEFINED" />
<td><h:outputLabel value="#{i18n['user.sex']}" for="sex" /> <f:selectItem id="male" itemLabel="#{i18n['user.sex.MALE']}" itemValue="MALE" />
<br /> <f:selectItem id="female" itemLabel="#{i18n['user.sex.FEMALE']}" itemValue="FEMALE" />
<p:selectOneMenu
disabled="#{!cc.attrs.creating and !userView.canSave}" id="sex"
value="#{userView.selectedUser.gender}">
<f:selectItem id="undefined"
itemLabel="#{i18n['user.sex.UNDEFINED']}" itemValue="UNDEFINED" />
<f:selectItem id="male" itemLabel="#{i18n['user.sex.MALE']}"
itemValue="MALE" />
<f:selectItem id="female" itemLabel="#{i18n['user.sex.FEMALE']}"
itemValue="FEMALE" />
</p:selectOneMenu></td> </p:selectOneMenu></td>
</tr> </tr>
</table> </table>
<table> <table>
<tr> <tr>
<td colspan="2"><p:outputLabel <td colspan="2"><p:outputLabel value="#{i18n['user.address']}" for="address" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
value="#{i18n['user.address']}" for="address" /><br /> <p:inplace <p:inputText size="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="address"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.address}" />
</p:inplace></td> </p:inplace></td>
</tr> </tr>
<tr> <tr>
<td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br /> <td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inplace emptyLabel="#{i18n['user.insert']}"> <p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.zip}" />
<p:inputText styleClass="ui-input" size="7" id="zip"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.zip}" />
</p:inplace> <p:message for="zip" /></td> </p:inplace> <p:message for="zip" /></td>
<td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br /> <td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inplace emptyLabel="#{i18n['user.insert']}"> <p:inputText styleClass="ui-input" size="25" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.town}" />
<p:inputText styleClass="ui-input" size="25" id="town"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.town}" />
</p:inplace> <p:message for="town" /></td> </p:inplace> <p:message for="town" /></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.email']}" <td colspan="2"><h:outputLabel value="#{i18n['user.email']}" for="email" /> <br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
for="email" /> <br /> <p:inplace <p:inputText validator="#{userValidator.validateEmail}" size="45" id="email" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" />
emptyLabel="#{i18n['user.insert']}">
<p:inputText validator="#{userValidator.validateEmail}"
size="45" id="email"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.email}" />
</p:inplace></td> </p:inplace></td>
</tr> </tr>
<tr> <tr>
<td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inplace emptyLabel="#{i18n['user.insert']}"> <p:inputText styleClass="ui-input" size="7" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" />
<p:inputText styleClass="ui-input" size="7" id="phone"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.phone}" />
</p:inplace> <p:message for="phone" /></td> </p:inplace> <p:message for="phone" /></td>
</tr> </tr>
</table> </table>
<p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" <p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" ajax="false" value="#{cc.attrs.commitvalue}" />
id="commitbtn" action="#{cc.attrs.commitaction}" ajax="false"
value="#{cc.attrs.commitvalue}" />
</h:panelGroup> </h:panelGroup>
</h:form> </h:form>
......
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "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" <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">
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:attribute name="tabId" type="java.lang.String" required="true" /> <composite:attribute name="tabId" type="java.lang.String" required="true" />
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<h:outputStylesheet library="templates/#{sessionHandler.templateName}/css" name="tabnav.css" /> <h:outputStylesheet library="templates/#{sessionHandler.templateName}/css" name="tabnav.css" />
<div class="userstatus" style="float: right; margin-right: 10px; color: #7DAC0C; font-size: 16px;">
<h2>
<h:outputText value="#{i18n['usertitle.managingUser']}: #{userView.user.nick} / #{userView.user.wholeName} " />
</h2>
<h2>
<h:outputText value="#{i18n['user.cardPower']}: #{userView.usersCardtemplate.name}" /> <h:outputText value="#{i18n['user.cardPower']}: #{userView.usersCardtemplate.name}" />
</div> </h2>
<ui:fragment rendered="#{!userView.currentUser}">
<h2>
<h:outputText value="#{i18n['usertitle.managingUser']}: #{userView.user.nick} / #{userView.user.wholeName} " />
</h2>
</ui:fragment>
<div id="#{cc.attrs.tabId}"> <div id="#{cc.attrs.tabId}">
<ul id="usertabnav"> <ul id="usertabnav">
<li class="edit"><h:link outcome="/useradmin/edit" value="#{i18n['user.edit']}"> <li class="edit"><h:link outcome="/useradmin/edit" value="#{i18n['user.edit']}">
...@@ -41,13 +40,10 @@ ...@@ -41,13 +40,10 @@
<li class="picture"><h:link outcome="/useradmin/sendPicture" value="#{i18n['submenu.user.sendPicture']}"> <li class="picture"><h:link outcome="/useradmin/sendPicture" value="#{i18n['submenu.user.sendPicture']}">
<f:param name="userid" value="#{userView.user.user.id}" /> <f:param name="userid" value="#{userView.user.user.id}" />
</h:link> </h:link></li>
</li> <li class="foodwave"><h:link outcome="/useradmin/foodwaveshop" value="#{i18n['submenu.user.foodwave']}">
<li class="foodwave">
<h:link outcome="/useradmin/foodwaveshop" value="#{i18n['submenu.user.foodwave']}">
<f:param name="userid" value="#{userView.user.user.id}" /> <f:param name="userid" value="#{userView.user.user.id}" />
</h:link> </h:link></li>
</li>
</ul> </ul>
</div> </div>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<h:message for="allowStats" /> <h:message for="allowStats" />
</h:panelGrid> </h:panelGrid>
<p:inputTextarea rendered="#{productShopView.gatherrBillInfo}" value="#{productShopView.otherInfo}" label="#{i18n['otherInfo']}"/> <p:inputTextarea rendered="#{productShopView.gatherBillInfo}" value="#{productShopView.otherInfo}" label="#{i18n['otherInfo']}"/>
</h:form> </h:form>
</ui:define> </ui:define>
......
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
<h:body> <h:body>
<ui:composition template="#{sessionHandler.template}"> <ui:composition template="#{sessionHandler.template}">
<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('')}" />
</f:metadata> </f:metadata>
<ui:define name="title"> <ui:define name="title">
......
...@@ -104,7 +104,8 @@ public class UserView extends GenericCDIView { ...@@ -104,7 +104,8 @@ public class UserView extends GenericCDIView {
private MassPrintResult mpr = null; private MassPrintResult mpr = null;
private boolean waitForAcceptance = false; private boolean waitForAcceptance = false;
private String captureForwardUrl = "";
@Produces @Produces
@LoggedIn @LoggedIn
public EventUser getCurrentUser() { public EventUser getCurrentUser() {
...@@ -116,7 +117,9 @@ public class UserView extends GenericCDIView { ...@@ -116,7 +117,9 @@ public class UserView extends GenericCDIView {
byte[] data = captureEvent.getData(); byte[] data = captureEvent.getData();
UserImage img = userbean.uploadImage(user, "image/png", data, "userimage.png", "Uploaded image"); UserImage img = userbean.uploadImage(user, "image/png", data, "userimage.png", "Uploaded image");
user = userbean.getEventUser(img.getUser()); user = userbean.getEventUser(img.getUser());
super.navihandler.forward("/admin/adduser/capturesuccess"); // super.navihandler.forward("/admin/adduser/capturesuccess");
if (getCaptureForwardUrl().equals(""))
super.navihandler.forward(getCaptureForwardUrl());
} }
@Produces @Produces
...@@ -431,4 +434,12 @@ public class UserView extends GenericCDIView { ...@@ -431,4 +434,12 @@ public class UserView extends GenericCDIView {
public void setStreamedFile(StreamedContent streamedFile) { public void setStreamedFile(StreamedContent streamedFile) {
this.streamedFile = streamedFile; this.streamedFile = streamedFile;
} }
public String getCaptureForwardUrl() {
return captureForwardUrl;
}
public void setCaptureForwardUrl(String captureForwardUrl) {
this.captureForwardUrl = captureForwardUrl;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!