summaryrefslogtreecommitdiff
path: root/pages/remote.ecpp
blob: dd45cd0a15ef264dc96611361c46fb8fa306270c (plain)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<%pre>
#include <locale>
#include <vdr/i18n.h>
#include <vdr/keys.h>
#include <vdr/device.h>
#include "grab.h"
#include "setup.h"
#include "tools.h"

using namespace std;
using namespace vdrlive;

</%pre>
<%args>
	int channel = -1;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%request scope="page">
	cChannel* Channel;
</%request>
<%include>page_init.eh</%include>
<{
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
}>
<%cpp>
	pageTitle = tr("Remote Control");

	ReadLock channelsLock( Channels );
	if ( !channelsLock )
		throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") );

	// cChannel* Channel; (see %request above)
	if ( channel > 0 ) {
		Channel = Channels.GetByNumber( channel );
	}
	else {
		if (cDevice::CurrentChannel()) {
			Channel = Channels.GetByNumber(cDevice::CurrentChannel());
		}
		else {
			Channel = Channels.Get( Channels.GetNextNormal( -1 ) );
		}
	}
	if ( Channel == 0 )
		throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") );

</%cpp>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ pageTitle $></title>
		<& pageelems.stylesheets &>
		<& pageelems.ajax_js &>
		<script type="text/javascript"><!--
		var newImg = new Image();
		var imgsrc = "";
		var interval = -1;

		function StreamLoad()
		{
			uniq = new Date();
			uniq = uniq.getTime();
			document.images.vdrlive.src=newImg.src;
			newImg.src=imgsrc+"?"+uniq;
		}

		function StreamInit()
		{
			imgsrc = document.images.vdrlive.src;
			uniq = new Date();
			uniq = uniq.getTime();
			newImg.src=imgsrc+"?"+uniq;
			interval = window.setInterval("StreamLoad()", 1000);
		}

		function ChangeInterval()
		{
			var element = document.getElementsByName('interval').item(0);
			var timeout = element.value;
			window.clearInterval(interval);
			interval = window.setInterval("StreamLoad()", timeout);
		}

		function KeyPress(keycode)
		{
			LiveSimpleAjaxRequest('keypress.xml', 'keycode', keycode);
		}

		function FillIntervals()
		{
			var element = document.getElementsByName('interval').item(0);
			var items = new Array(1000, 2000, 5000);
			element.options.length = items.length;
			for (i = 0; i < items.length; ++i) {
				element.options[i].value = items[i];
				element.options[i].text = (items[i] / 1000) + " s";
				if (items[i] == <$ ConvertToString( LiveSetup().GetScreenshotInterval(), locale("C") ) $>)
					element.selectedIndex = i;
			}
		}
		//--></script>
% reply.sout().imbue(locale());
	</head>
	<body onload="StreamInit(); FillIntervals();">
		<& pageelems.logo &>
		<& menu active="remote" component=("remote.remote_actions")>
		<div class="inhalt">
			<div class="screenshot">
<{				if (!LiveGrabImageManager().CanGrab()) {	}>
					bloek
<{				} else {									}>
					<img src="screenshot.jpg" name="vdrlive" /><br />
<{				}											}>
			</div>
			<div>
			<img src="<$ LiveSetup().GetThemedLink("img", "remotecontrol.jpg") $>" width="162" height="363" border="0" usemap="#remote" alt="" />
			     <map name="remote">
			     	  <area href="#" shape="circle" coords="37,36,10" alt="Power" onclick="KeyPress(<$ kPower $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="27,60,59,75" alt="1" onclick="KeyPress(<$ k1 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="64,59,98,75" alt="2" onclick="KeyPress(<$ k2 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="103,59,137,75" alt="3" onclick="KeyPress(<$ k3 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="25,82,60,98" alt="4" onclick="KeyPress(<$ k4 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="65,82,98,99" alt="5" onclick="KeyPress(<$ k5 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="103,83,137,99" alt="6" onclick="KeyPress(<$ k6 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="26,106,60,121" alt="7"  onclick="KeyPress(<$ k7 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="65,105,97,121" alt="8" onclick="KeyPress(<$ k8 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="104,106,137,122" alt="9" onclick="KeyPress(<$ k9 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="66,128,98,144" alt="0" onclick="KeyPress(<$ k0 $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="37,157,13" alt="Vol+" onclick="KeyPress(<$ kVolUp $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="37,190,13" alt="Vol-" onclick="KeyPress(<$ kVolDn $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="125,157,13" alt="P+" onclick="KeyPress(<$ kChanUp $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="125,190,13" alt="P-" onclick="KeyPress(<$ kChanDn $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="81,174,8" alt="Mute" onclick="KeyPress(<$ kMute $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="81,202,11" alt="Record" onclick="KeyPress(<$ kRecord $>)" nohref="nohref" alt="" />
				  <area href="#" shape="poly" coords="39,215,29,227,30,235,39,236,51,222,49,215,43,213" alt="Menu" onclick="KeyPress(<$ kMenu $>)" nohref="nohref" alt="" />
				  <area href="#" shape="poly" coords="119,213,127,219,135,230,132,235,127,236,119,231,114,223,113,215" alt="Exit" onclick="KeyPress(<$ kBack $>)" nohref="nohref" alt="" />
				  <area href="#" shape="poly" coords="58,230,70,223,82,223,91,223,105,231,96,240,87,237,78,236,69,240,66,241,58,232" alt="Up" onclick="KeyPress(<$ kUp $>)" nohref="nohref" alt="" />
				  <area href="#" shape="poly" coords="111,237,119,249,121,259,119,275,113,285,109,284,101,276,104,270,107,260,106,253,101,245" alt="Right" onclick="KeyPress(<$ kRight $>)" nohref="nohref" alt="" />
				  <area href="#" shape="poly" coords="66,281,75,285,86,285,95,281,106,291,100,295,87,300,73,300,58,291,57,289,58,289" alt="Down" onclick="KeyPress(<$ kDown $>)" nohref="nohref" alt="" />
				  <area href="#" shape="poly" coords="51,236,61,245,56,256,57,266,61,277,52,285,47,278,42,264,43,252,49,240" alt="Left" onclick="KeyPress(<$ kLeft $>)" nohref="nohref" alt="" />
				  <area href="#" shape="circle" coords="81,261,17" alt="Ok" onclick="KeyPress(<$ kOk $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="25,309,52,324" alt="Red" onclick="KeyPress(<$ kRed $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="53,309,81,324" alt="Green" onclick="KeyPress(<$ kGreen $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="83,309,109,324" alt="Yellow" onclick="KeyPress(<$ kYellow $>)" nohref="nohref" alt="" />
				  <area href="#" shape="rect" coords="110,310,137,323" alt="Blue" onclick="KeyPress(<$ kBlue $>)" nohref="nohref" alt="" />
			     </map>
			</div>
		</div>
	</body>
</html>
<%include>page_exit.eh</%include>

<%def remote_actions>
<$ tr("Snapshot interval") $>: <select name="interval" onchange="ChangeInterval()"></select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<& pageelems.vlc_stream_channel channelId=(Channel->GetChannelID()) &>
</%def>