sendImage.xhtml
3.14 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
<?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/cditools"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<h:outputScript target="head" library="script" name="jquery.min.js" />
<h:outputScript target="head" library="jpegcam" name="webcam.js" />
<h:outputScript target="head">
webcam.set_api_url( '#{request.contextPath}/UploadServlet?type=userimage&id=#{userView.user.id}' );
webcam.set_hook('onComplete', 'my_completion_handler');
webcam.set_swf_url('#{request.contextPath}/resources/jpegcam/webcam.swf');
webcam.set_shutter_sound(true,'#{request.contextPath}/resources/jpegcam/shutter.mp3');
function my_completion_handler(msg) {
// extract URL out of PHP output
if (msg.match(/(http\:\/\/\S+)/)) {
var image_url = RegExp.$1;
alert(image_url);
}
}
</h:outputScript>
<button onclick="$('#webcamcontainer').prepend(webcam.get_html(320, 240));$('#webcamcontainer').show();$(this).hide();">#{i18n['userimage.webcam']}</button>
<div id="webcamcontainer" style="display: none;">
asd
<button onclick="webcam.configure()">Configure</button>
<button onclick="webcam.snap()">Ota kuva</button>
</div>
<form
onsubmit="window.open('', 'imagesubmitpopup', 'height=240,width=320'); this.target='imagesubmitpopup'; return true; "
action="#{request.contextPath}/UploadServlet?type=userimage" enctype="multipart/form-data" method="post"
>
<p>
<input type="hidden" name="id" value="#{userView.user.id}" /> Voit lisätä kuvan kävijälippuasi varten. Näin nopeutat
asiointiasi tapahtumaan tullessasi.
</p>
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['imagefile.file']}" />
<input type="file" name="file" />
<!-- <h:outputLabel value="#{i18n['imagefile.description']}"/><input type="text" name="description" /> -->
<h:panelGroup>
<input type="submit" name="submit" value="#{i18n['user.imagesubmit']}" />
</h:panelGroup>
</h:panelGrid>
</form>
<h2>#{i18n['user.thisIsCurrentImage']}</h2>
<h:form>
<h:commandButton action="#{userView.reloadUser()}" value="Päivitä kuva" />
</h:form>
<h:outputText rendered="#{empty userView.user.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<h:panelGroup rendered="#{!empty userView.user.currentImage}">
<img width="300" src="#{request.contextPath}/Userimage?imageid=#{userView.user.currentImage.id}" alt="image" />
</h:panelGroup>
<tools:canWrite rendered="#{!empty userView.user.currentImage}" target="USER_MANAGEMENT">
<div>
<h:outputText value="Mime: #{userView.user.currentImage.mimeType}" />
<h:form id="imageconvert">
<h:commandButton action="#{userView.recheckImagetype()}" value="Check imagetype" />
</h:form>
</div>
</tools:canWrite>
</composite:implementation>
</html>