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

using namespace vdrlive;

</%pre>
<%args>
	name = "channel";
	selected;
	onchange;
	bool channelid = false;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<{
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
}>
<%cpp>
	ReadLock channelsLock( Channels );
	if ( !channelsLock )
		throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") );
</%cpp>
<select name="<$ name $>" id="<$ name $>" <{ reply.out() << ( !onchange.empty() ? "onchange=\""+onchange+"\"" : "" ); }>>
%	for ( cChannel *listChannel = Channels.First(); listChannel; listChannel = Channels.Next( listChannel ) ) {
%		if ( listChannel->GroupSep() || *listChannel->Name() == '\0' )
%			continue;
%
%		std::string listChannelId = *listChannel->GetChannelID().ToString();
		<option value="<? channelid ? *listChannel->GetChannelID().ToString() ?><? !channelid ? listChannel->Number() ?>" 
			<{ reply.out() << ( listChannelId == selected ? "selected=\"selected\"" : "" ); }>><$ listChannel->Name() $></option>
%	}
</select>