summaryrefslogtreecommitdiff
path: root/pages/channels_widget.ecpp
diff options
context:
space:
mode:
Diffstat (limited to 'pages/channels_widget.ecpp')
-rw-r--r--pages/channels_widget.ecpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/pages/channels_widget.ecpp b/pages/channels_widget.ecpp
index 5bd69b2..bdc526c 100644
--- a/pages/channels_widget.ecpp
+++ b/pages/channels_widget.ecpp
@@ -1,5 +1,6 @@
<%pre>
#include <vdr/channels.h>
+#include "exception.h"
#include "setup.h"
#include "tools.h"
@@ -13,17 +14,19 @@ selected;
onchange;
bool channelId = false;
</%args>
-
+<%cpp>
+ReadLock channelsLock( Channels );
+if ( !channelsLock )
+ throw HtmlError( tr("Channels"), tr("Couldn't aquire access to channels, please try again later.") );
+</%cpp>
<select name="<$ name $>" <{ reply.out() << ( !onchange.empty() ? "onchange=\""+onchange+"\"" : "" ); }>>
-<{
- for (cChannel *listChannel = Channels.First(); listChannel && listChannel->Number() <= lastChannel; listChannel = Channels.Next(listChannel)) {
- if (!listChannel->GroupSep() && *listChannel->Name()) {
- std::string listChannelId = *listChannel->GetChannelID().ToString();
-}>
- <option value="<? channelId ? *listChannel->GetChannelID().ToString() ?><? !channelId ? listChannel->Number() ?>"
- <{ reply.out() << ( listChannelId == selected ? "selected=\"selected\"" : "" ); }>><$ listChannel->Name() $></option>
-<{
- }
- }
-}>
+% for ( cChannel *listChannel = Channels.First(); listChannel && listChannel->Number() <= lastChannel;
+% 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>