summaryrefslogtreecommitdiff
path: root/pages/switch_channel.ecpp
blob: 9b8b48b016ec188216e256537de9de75a67501a0 (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
<%pre>
#include <vdr/channels.h>
#include "exception.h"
#include "tasks.h"
#include "tools.h"

using namespace std;
using namespace vdrlive;

</%pre>
<%args>
	tChannelID param;
	string async;
</%args>
<%cpp>
	bool ajaxReq = !async.empty() && (lexical_cast<int>(async) != 0);
	string referrer;

	if (ajaxReq) {
		reply.setContentType( "application/xml" );
	}
	else {
		referrer = request.getHeader("Referer:");
	}

	SwitchChannelTask task( param );
	LiveTaskManager().Execute( task );

	if (!ajaxReq) {
		if (!referrer.empty()) {
			return reply.redirect(referrer);
		}
</%cpp>
Normale Seite:<br/>
channel: <$ param $><br/>
result: <$ (task.Result()) $><br/>
error: <$ (task.Error()) $><br />
Seitenende!
<%cpp>
	}
	else {
</%cpp>
<& xmlresponse.ajax name=("switch_channel") pname=("channel") value=(param) result=(task.Result()) error=(task.Error()) &>
<%cpp>
	}
</%cpp>