create.xhtml 6.42 KB
<?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="admincreate" required="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="#{cc.attrs.creating?'':'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>

			</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>

					<tr>
						<td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <p:inputText size="9" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" /> <p:message for="phone" /></td>
					</tr>
				</table>
				<br />
				<ui:fragment rendered="#{cc.attrs.creating}">
					<h:outputLabel value="#{i18n['user.login']}" for="login" />
					<br />

					<p:inputText size="25" id="login" validator="#{userValidator.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}" />

				<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}" />

				<br />

				<p:commandButton ajax="false" 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>