create.xhtml
6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?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">
<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:interface>
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<!-- <h2>
<h:outputText rendered="#{!cc.attrs.creating}" disabled="#{!cc.attrs.creating and !userView.canSave}" id="viewlogin" value="#{userView.selectedUser.login}" />
</h2>
-->
<h:form id="userform" enctype="multipart/form-data">
<h:panelGrid columns="2">
<h:panelGroup>
<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>
<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" />
</ui:fragment>
<br />
<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:message for="uploadfile" />
<p:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" />
</ui:fragment>
<ui:fragment rendered="#{cc.attrs.creating}">
<h:outputLabel value="#{i18n['user.login']}" for="login" />
<br />
<p:inputText size="25" id="login" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.login}" />
<p:message for="login" />
<br />
</ui:fragment>
<br />
<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="password" value="#{userView.password}" />
<p:message rendered="#{cc.attrs.creating}" for="password" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="passwordcheck" value="#{userView.passwordcheck}" />
<p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<br />
</h:panelGroup>
<h:panelGroup>
<table>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> <br /> <p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.nick}" /></td>
</tr>
<tr>
<td><h:outputLabel value="#{i18n['user.firstNames']}" for="firstnames" /><br /> <p:inputText size="22" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.firstnames}" /></td>
<td><h:outputLabel value="#{i18n['user.lastName']}" for="lastname" /><br /> <p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.lastname}" /></td>
</tr>
<tr>
<td><h:outputLabel for="birthday" value="#{i18n['user.birthday']}" /><br /> <p:calendar id="birthday" navigator="true" yearRange="c-80:c-0" locale="fi"
value="#{userView.selectedUser.birthday}" pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" /> <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:inputText size="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.address}" /></td>
</tr>
<tr>
<td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br /> <p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.zip}" /> <p:message for="zip" /></td>
<td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br /> <p:inputText styleClass="ui-input" size="25" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}"
value="#{userView.selectedUser.town}" /> <p:message for="town" /></td>
</tr>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.email']}" for="email" /> <br /> <p:inputText validator="#{userValidator.validateEmail}" size="45" id="email"
disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" /></td>
</tr>
</table>
<p:commandButton rendered="#{cc.attrs.creating or userView.canSave}" id="commitbtn" action="#{cc.attrs.commitaction}" value="#{cc.attrs.commitvalue}" />
</h:panelGroup>
</h:panelGrid>
</h:form>
</composite:implementation>
</html>