update.xhtml 2.25 KB
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui" xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop" xmlns:tools="http://java.sun.com/jsf/composite/cditools">
<h:body>
	<ui:composition template="/layout/#{sessionHandler.adduserfullscreen}/template.xhtml">
		<ui:param name="thispage" value="page.user.create" />
		<f:metadata>
			<f:viewParam name="userid" value="#{userView.userid}" />
			<f:event type="preRenderView" listener="#{userView.initView}" />
		</f:metadata>


		<ui:define name="content">
			<div style="text-align: center;">
				<h:panelGrid columns="2">
					<h:panelGroup>
						<h1>#{i18n["adduser.update"]}</h1>

						<div id="webcamcontainer">
							<h:form styleClass="captureForm">
								<div id="count" />
								<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="@all" />
								<p:commandButton type="button" value="Capture" onclick="dophoto(pc)" />

							</h:form>
						</div>
					</h:panelGroup>
					
					<h:panelGroup styleClass="top">
						<h2>#{i18n['user.thisIsCurrentImage']}</h2>
						<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
						<ui:fragment rendered="#{!empty userView.user.currentImage}">
							<img width="300" src="#{request.contextPath}/dydata/userimage/#{userView.user.currentImage.id}.img" alt="image" />
						</ui:fragment>
					</h:panelGroup>
				</h:panelGrid>
			</div>


			<script>
				function dophoto(pc) {
					docount(5,pc);
				}

				function docount(count,pc) {
					$('#count').html(count);
					$('#count').css("opacity", 1);
					$('#count').css("font-size", "28pt");

					$('#count').animate({
						opacity : 0,
						fontSize : 0
					}, 1500, function() {
						if (count > 1)
							docount(count - 1, pc);
						if (count == 1) { 
							pc.capture();
					}

					});
				}
			</script>
			<style>
#count {
	font-size: 25pt;
	text-align: center;
	width: 30px;
}
</style>
		</ui:define>

	</ui:composition>
</h:body>
</html>