update.xhtml 3.67 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="/resources/templates/#{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:event type="preRenderView" listener="#{userView.setCaptureForwardUrl('/admin/adduser/update')}"/>

		</f:metadata>

		<ui:define name="topbar">
			<h:form id="readyform">
				<h:commandLink id="pictureReady" styleClass="userbackbutton" action="#{userView.incomingPhotoReady}" value="Valmis">
					<div>#{i18n['adduser.back']}</div>
				</h:commandLink>
			</h:form>

		</ui:define>

		<ui:define name="content">
			<div style="text-align: center; margin-top: 10em;">

				<div style="display: none; font-size:5em;" id="pictureTakenConfirm">Kuva otettu</div>

				<h:form styleClass="captureForm">
					<h:panelGrid columns="2">

						<h:panelGroup style="vertical-align:top">
							<h1>#{i18n["adduser.update"]}</h1>
							<br/>
							<br/>
							<a class="touchItem" href="javascript:dophoto(PF('pc'));">
								<div>#{i18n["adduser.takePhoto"]}</div>
							</a>
						</h:panelGroup>


						<h:panelGroup style="vertical-align:top">
							<div id="webcamcontainer">


								<p:photoCam widgetVar="pc" listener="#{userView.oncapture}"/>
								<!--p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" -->
								<div id="borderstuff" style="border-style:solid; border-width: 2px; border-color:red; position:relative; height: 205px; width:150px; top: -225px; right:-85px">&nbsp;</div>
								<div id="count" style="padding: 95px 0 0 150px; top: -400px; position:relative;"/>
								<!--  <p:commandButton type="button" value="Capture" onclick="dophoto(pc)" />
								 -->
							</div>
						</h:panelGroup>
					</h:panelGrid>
				</h:form>

			</div>
			<div style="display: none;">
				<h:form id="incomingpictureform">


					<p:fragment rendered="#{!empty userView.selectedUser.currentImage}">
						<p:graphicImage value="/dydata/userimage/#{userView.selectedUser.currentImage.id}.img" alt="image"/>
					</p:fragment>
					<h:commandLink rendered="#{!empty userView.selectedUser.currentImage}" style="margin: 0 auto; font-size: 3em;" action="#{userView.incomingPhotoReady}" value="Valmis"/>
					<br/>

				</h:form>
			</div>

			<script type="text/javascript">
				function dophoto(pc) {
					docount(3, 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();
							$('#pictureTakenConfirm').show();
							window.setTimeout(function () {
								$('#readyform\\:pictureReady').trigger('click');
							}, 1500);
						}

					});
				}
			</script>
			<style type="text/css">
				#count {
					font-size: 25pt;
					text-align: center;
					width: 30px;
					postition: relative;
					top: -5em;
					background: none;
				}

				td {
					vertical-align: top;
				}
			</style>
		</ui:define>

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