Commit 61e23cac by Antti Tönkyrä

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

2 parents 435fa2c8 9b5ee3e2
......@@ -8,6 +8,7 @@
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
<f:event type="preRenderView" listener="#{userView.initView}" />
<f:event type="preRenderView" listener="#{userView.setCaptureForwardUrl('/admin/adduser/capturesuccess')}" />
</f:metadata>
<ui:define name="topbar">
......
<?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"
xmlns:p="http://primefaces.org/ui">
<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">
<composite:interface>
<composite:attribute name="creating" required="false" default="false" />
<composite:attribute name="commitvalue" required="true" />
<composite:attribute name="commitaction" required="true"
method-signature="java.lang.String action()" />
<composite:attribute name="commitaction" required="true" method-signature="java.lang.String action()" />
</composite:interface>
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js"
target="head" />
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<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}">
<p:overlayPanel id="chartPanel" for="webcamButton"
hideEffect="fade">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}"
update="@all" />
<p:commandButton type="button" value="Capture"
onclick="pc.capture()" />
<p:overlayPanel id="chartPanel" for="webcamButton" dynamic="true">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
<p:commandButton type="button" value="Capture" onclick="pc.capture()" />
</p:overlayPanel>
<h:outputText rendered="#{empty userView.user.currentImage}"
value="#{i18n['user.noCurrentImage']}" />
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.user.currentImage}">
<img style="width: 150px;"
src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img"
alt="image" />
<img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
</ui:fragment>
<br />
<p:commandButton id="webcamButton"
value="#{i18n['userimage.webcam']}" type="button" />
<p:commandButton id="webcamButton" value="#{i18n['userimage.webcam']}" type="button" />
<br />
<br />
<p:fileUpload id="uploadfile" required="TRUE"
requiredMessage="Required!"
invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024"
value="#{userView.image}" mode="simple" />
<p:fileUpload id="uploadfile" required="TRUE" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" value="#{userView.image}" mode="simple" />
<p:message for="uploadfile" />
<p:commandButton action="#{userView.sendImage}" ajax="false"
value="#{i18n['user.imagesubmit']}" />
<p:commandButton action="#{userView.sendImage}" ajax="false" value="#{i18n['user.imagesubmit']}" />
</ui:fragment>
</h:form>
<ui:fragment rendered="#{cc.attrs.creating}">
<h:outputLabel value="#{i18n['user.login']}" for="mklogin" />
<ui:fragment rendered="#{cc.attrs.creating}">
<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 />
<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 rendered="#{cc.attrs.creating}" emptyLabel="#{i18n['user.insert']}">
<p:password validator="#{userValidator.password}" id="passwordcheck" value="#{userView.passwordcheck}" />
</p:inplace>
<p:message for="login" />
<p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<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 />
<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:panelGroup>
</h:form>
<h:form>
......@@ -103,114 +75,64 @@
<table>
<ui:fragment rendered="#{!cc.attrs.creating}">
<tr>
<td colspan="2"><h:outputLabel for="login"
value="#{i18n['user.login']}" /><br /> <h:outputText
value="#{userView.selectedUser.login}" id="login" /></td>
<td colspan="2"><h:outputLabel for="login" value="#{i18n['user.login']}" /><br /> <h:outputText value="#{userView.selectedUser.login}" id="login" /></td>
</tr>
</ui:fragment>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}"
for="nick" /> <br /> <p:inplace
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="nick"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.nick}" />
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> <br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.nick}" />
</p:inplace></td>
</tr>
<tr>
<td><h:outputLabel value="#{i18n['user.firstNames']}"
for="firstnames" /><br /> <p:inplace
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="22" id="firstnames"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.firstnames}" />
<td><h:outputLabel value="#{i18n['user.firstNames']}" for="firstnames" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="22" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.firstnames}" />
</p:inplace></td>
<td><h:outputLabel value="#{i18n['user.lastName']}"
for="lastname" /><br /> <p:inplace
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="30" id="lastname"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.lastname}" />
<td><h:outputLabel value="#{i18n['user.lastName']}" for="lastname" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.lastname}" />
</p:inplace></td>
</tr>
<tr>
<td><h:outputLabel for="birthday"
value="#{i18n['user.birthday']}" /><br />
<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}" />
<td><h:outputLabel for="birthday" value="#{i18n['user.birthday']}" /><br /> <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:inplace>
<h:message
for="birthday" /></td>
<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}">
<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:inplace> <h:message for="birthday" /></td>
<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}">
<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>
</tr>
</table>
<table>
<tr>
<td colspan="2"><p:outputLabel
value="#{i18n['user.address']}" for="address" /><br /> <p:inplace
emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="address"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.address}" />
<td colspan="2"><p:outputLabel value="#{i18n['user.address']}" for="address" /><br /> <p:inplace emptyLabel="#{i18n['user.insert']}">
<p:inputText size="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
</p:inplace></td>
</tr>
<tr>
<td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br />
<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}" />
<td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br /> <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:inplace> <p:message for="zip" /></td>
<td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br />
<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}" />
<td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br /> <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:inplace> <p:message for="town" /></td>
</tr>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.email']}"
for="email" /> <br /> <p:inplace
emptyLabel="#{i18n['user.insert']}">
<p:inputText validator="#{userValidator.validateEmail}"
size="45" id="email"
disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.email}" />
<td colspan="2"><h:outputLabel value="#{i18n['user.email']}" for="email" /> <br /> <p:inplace 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>
</tr>
<tr>
<td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br />
<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}" />
<td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <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:inplace> <p:message for="phone" /></td>
</tr>
</table>
<p:commandButton rendered="#{cc.attrs.creating or userView.canSave}"
id="commitbtn" action="#{cc.attrs.commitaction}" ajax="false"
value="#{cc.attrs.commitvalue}" />
<p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" ajax="false" value="#{cc.attrs.commitvalue}" />
</h:panelGroup>
</h:form>
......
<?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">
<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:attribute name="tabId" type="java.lang.String" required="true" />
</composite:interface>
<composite:implementation>
<h:outputStylesheet library="templates/#{sessionHandler.templateName}/css" name="tabnav.css" />
<div class="userstatus" style="float: right; margin-right: 10px; color: #7DAC0C; font-size: 16px;">
<h:outputStylesheet library="templates/#{sessionHandler.templateName}/css" name="tabnav.css" />
<h2>
<h:outputText value="#{i18n['usertitle.managingUser']}: #{userView.user.nick} / #{userView.user.wholeName} " />
</h2>
<h2>
<h:outputText value="#{i18n['user.cardPower']}: #{userView.usersCardtemplate.name}" />
</div>
<ui:fragment rendered="#{!userView.currentUser}">
<h2>
<h:outputText value="#{i18n['usertitle.managingUser']}: #{userView.user.nick} / #{userView.user.wholeName} " />
</h2>
</ui:fragment>
</h2>
<div id="#{cc.attrs.tabId}">
<ul id="usertabnav">
<li class="edit"><h:link outcome="/useradmin/edit" value="#{i18n['user.edit']}">
......@@ -41,13 +40,10 @@
<li class="picture"><h:link outcome="/useradmin/sendPicture" value="#{i18n['submenu.user.sendPicture']}">
<f:param name="userid" value="#{userView.user.user.id}" />
</h:link>
</li>
<li class="foodwave">
<h:link outcome="/useradmin/foodwaveshop" value="#{i18n['submenu.user.foodwave']}">
</h:link></li>
<li class="foodwave"><h:link outcome="/useradmin/foodwaveshop" value="#{i18n['submenu.user.foodwave']}">
<f:param name="userid" value="#{userView.user.user.id}" />
</h:link>
</li>
</h:link></li>
</ul>
</div>
......
......@@ -23,7 +23,7 @@
<h:message for="allowStats" />
</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>
</ui:define>
......
......@@ -6,8 +6,9 @@
<h:body>
<ui:composition template="#{sessionHandler.template}">
<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.setCaptureForwardUrl('')}" />
</f:metadata>
<ui:define name="title">
......
......@@ -104,7 +104,8 @@ public class UserView extends GenericCDIView {
private MassPrintResult mpr = null;
private boolean waitForAcceptance = false;
private String captureForwardUrl = "";
@Produces
@LoggedIn
public EventUser getCurrentUser() {
......@@ -116,7 +117,9 @@ public class UserView extends GenericCDIView {
byte[] data = captureEvent.getData();
UserImage img = userbean.uploadImage(user, "image/png", data, "userimage.png", "Uploaded image");
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
......@@ -431,4 +434,12 @@ public class UserView extends GenericCDIView {
public void setStreamedFile(StreamedContent 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!