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
|
<%pre>
#include <vdr/plugin.h>
#include <vdr/channels.h>
#include <vdr/epg.h>
#include <vdr/config.h>
#include <tnt/savepoint.h>
#include "exception.h"
#include "setup.h"
#include "tools.h"
using namespace vdrlive;
</%pre>
<%args>
int channel = -1;
</%args>
<%request scope="global">
std::string pageTitle( tr("Schedule") );
</%request>
<%cpp>
try {
cSchedulesLock schedulesLock;
cSchedules const* schedules = cSchedules::Schedules( schedulesLock );
ReadLock channelsLock( Channels );
if ( !channelsLock )
throw HtmlError( tr("Channels"), tr("Couldn't aquire access to channels, please try again later.") );
cChannel* Channel;
if ( channel > 0 )
Channel = Channels.GetByNumber( channel );
else
Channel = Channels.Get( Channels.GetNextNormal( -1 ) );
if ( Channel == 0 )
throw HtmlError( tr("Channels"), tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") );
cSchedule const* Schedule = schedules->GetSchedule( Channel );
if ( Schedule == 0 )
throw HtmlError( tr("Schedule"), tr("No schedules available for this channel.") );
tnt::Savepoint spoint( reply );
</%cpp>
<html>
<head>
<title>VDR Live - <$ pageTitle $></title>
<link rel="stylesheet" type="text/css" href="/styles.css" />
</head>
<body>
<div class="left_area">
<img src="logo.png" alt="VDR Live!" border="0" />
<& menu >
</div>
<div class="inhalt">
<div class="head_box">
<table>
<tr>
<td><? Channel ? Channel->Name() ?></td>
<td>
<form name="channels" id="channels">
<& channels_widget name=("channel") selected=(Channel ? *Channel->GetChannelID().ToString() : "")
onchange=("document.forms.channels.submit()") &>
</form>
</td>
</tr>
</table>
</div>
<table class="schedule" cellspacing="0" callpadding="0">
<{
bool active_line = false;
std::string current_day = "";
const cEvent* PresentEvent = Schedule->GetPresentEvent();
time_t now = time(NULL) - ::Setup.EPGLinger * 60;
for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) {
if (Event->EndTime() <= now && Event != PresentEvent)
continue;
active_line = !active_line;
std::string title(Event->Title() ? Event->Title() : "");
std::string short_description(Event->ShortText() ? Event->ShortText() : "");
std::string description(Event->Description() ? Event->Description() : "");
std::string start(Event->StartTime() ? FormatDateTime(tr("%I:%M %p"), Event->StartTime()) : "");
std::string end(Event->EndTime() ? FormatDateTime(tr("%I:%M %p"), Event->EndTime()) : "");
std::string day(Event->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), Event->StartTime()) : "");
if (current_day != day) {
current_day = day;
}>
<tr>
<td class="head" colspan="3"><$ current_day $></td>
</tr>
% }
<tr class="<? active_line ? "active" ?>">
<td><$ start $> - <$ end $></td>
<td><strong><$ title $></strong><br /><$ short_description $><br /></td>
<td> </td>
</tr>
% }
</table>
</div>
</body>
</html>
<%cpp>
spoint.commit();
} catch ( HtmlError const& ex ) {
cxxtools::QueryParams param = qparam;
param.add( "errorTitle", ex.GetTitle() );
param.add( "errorMessage", ex.GetMessage() );
callComp( "error", request, reply, param );
}
</%cpp>
|