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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
<%pre>
#include <vdr/plugin.h>
#include <vdr/channels.h>
#include <vdr/epg.h>
#include <vdr/config.h>
#include <vdr/i18n.h>
#include "setup.h"
#include "tools.h"
#include "epg_events.h"
using namespace std;
using namespace vdrlive;
</%pre>
<%args>
type = "now";
mode = "detail";
string attime;
string fixtime;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%request scope="page">
string current_type;
string current_mode;
string current_attime;
string current_fixtime;
string current_displaytime;
</%request>
<%include>page_init.eh</%include>
<{
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
cSchedulesLock schedulesLock;
const cSchedules* Schedules = cSchedules::Schedules(schedulesLock);
string head;
time_t seektime = 0;
string displaytime;
current_type = type;
current_mode = mode;
current_attime = attime;
current_fixtime = fixtime;
if (type == "now") {
head = tr("What's running at")+string(" ")+FormatDateTime(tr("%I:%M %p"), time(0));
} else if (type == "next") {
head = tr("What's on next?");
} else if (type == "at") {
if (attime != "")
displaytime = ExpandTimeString(attime);
else if (fixtime != "")
displaytime = ExpandTimeString(fixtime);
current_displaytime = displaytime;
seektime = GetTimeT(displaytime);
if (seektime - time(0) + 3600 < 0) // if wanted time is past more then 1h, then use tomorrow
seektime += SECSINDAY;
head = tr("What's running at") + string(" ") + FormatDateTime(tr("%I:%M %p"), seektime) +string(" (") +FormatDateTime(tr("%a, %b %d"), seektime) + string(")");
}
}>
<& pageelems.doc_type &>
<html>
<head>
<title>VDR-Live - <$ head $></title>
<& pageelems.stylesheets &>
<& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &>
<& pageelems.ajax_js &>
<script type="text/javascript"><!--
function showtime(selection)
{
if (selection.options[selection.selectedIndex].value != "")
window.location.href = "whats_on.html?type=at&mode=<$ current_mode $>&fixtime=" + selection.options[selection.selectedIndex].value;
}
function showspectime(selection)
{
if (selection.value != "")
window.location.href = "whats_on.html?type=at&mode=<$ current_mode $>&attime=" + selection.value;
}
//--></script>
</head>
<body onload="<& pageelems.infobox_start_update &>">
<& pageelems.logo &>
<& menu active=("whats_on") component=("whats_on.whats_on_actions")>
<div class="inhalt">
% if (mode == "list") {
<table class="schedule" cellspacing="0" cellpadding="0">
<tr>
<td class="day" colspan="5"><div class="boxheader"><div><div><$ head $></div></div></div></td>
</tr>
% }
<{
EpgEvents epgEvents;
ReadLock channelsLock( Channels );
if (channelsLock) {
bool active_line = false;
int evntNr = 0;
for (cChannel *Channel = Channels.First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep()) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel);
if (Schedule) {
const cEvent *Event = NULL;
if (type == "now")
Event = Schedule->GetPresentEvent();
else if (type == "next")
Event = Schedule->GetFollowingEvent();
else if (type == "at")
Event = Schedule->GetEventAround(seektime);
if (Event) {
string evntId("eventId_");
evntId += lexical_cast<std::string, int>(++evntNr);
EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name()));
epgEvents.push_back(epgEvent);
tChannelID channel_id(Channel->GetChannelID());
tEventID event = Event->EventID();
bool truncated = false;
string description();
}>
% if (mode == "detail") {
<div class="event">
<div class="station">
<div><div><div><a href="schedule.html?channel=<$ Channel->Number() $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div></div></div>
</div>
<div class="content">
<div class="tools">
<& pageelems.event_timer channelid=(channel_id) eventid=(event) &>
% if (type == "now") {
<& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &>
% }
% if (LiveSetup().HaveEPGSearch()) {
<a href="searchresults.html?searchplain=<$ StringEscapeAndBreak(epgEvent->Title()) $>"><img src="/search.png" border="0" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a>
% }
<a href="http://akas.imdb.com/Tsearch?title=<$ StringUrlEncode(epgEvent->Title()) $>"><img src="imdb.png" border="0" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>></img></a>
</div>
<div>
<div class="info"><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
% if (epgEvent->Elapsed() >= 0) {
<div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
% }
<div class="title"><$ (epgEvent->Title()) $></div>
<div class="short"><$ (epgEvent->ShortDescr()) $></div>
<div class="description"><$ (StringWordTruncate(epgEvent->LongDescr(), 150, truncated)) $></div>
<div class="more"<& tooltip.hint text=(StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), 300, truncated)) + string("<br />") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><$ (string(tr("more")) + string(" ...")) $></div>
</div>
</div>
</div>
% } else { // mode == "list"
<tr class="<? active_line ? "active" ?>">
<td style="border-left: 1px solid black"><& pageelems.event_timer channelid=(channel_id) eventid=(event) &>
% if (type == "now") {
<& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &>
% }
% if (LiveSetup().HaveEPGSearch()) {
<a href="searchresults.html?searchplain=<$ StringUrlEncode(epgEvent->Title()) $>"><img src="/search.png" border="0" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a>
% }
<a href="http://akas.imdb.com/Tsearch?title=<$ StringUrlEncode(epgEvent->Title()) $>"><img src="imdb.png" border="0" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>></img></a>
</td>
<td>
<div><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
% if (epgEvent->Elapsed() >= 0) {
<div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
% }
</td>
<td>
<div class="more"<& tooltip.hint text=(StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), 300, truncated)) + string("<br />") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><strong><$ (epgEvent->Title()) $></strong></div><$ (epgEvent->ShortDescr()) $><br />
</td>
<td><div class="station"><a href="schedule.html?channel=<$ Channel->Number() $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div></td>
<td style="border-right: 1px solid black"> </td>
</tr>
% }
<{
}
}
}
}
}
}>
</div>
<div class="epg_data" style="display: none;">
<{
// create hidden div for the tooltip hints.
for (vector<EpgEventPtr>::iterator i = epgEvents.begin(); i != epgEvents.end(); ++i) {
EpgEventPtr epg = *i;
}>
<& pageelems.epg_tt_box boxId=(epg->Id()) caption=(epg->Caption()) time=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) short_descr=(epg->ShortDescr()) long_descr=(epg->LongDescr()) elapsed=(epg->Elapsed()) &>
<{
}
}>
% if (mode == "list") {
<tr>
<td colspan="5" style="border-top: 1px solid black; background-image: none; border-bottom: none"> </td>
</tr>
</table>
% }
</div>
</body>
</html>
<%include>page_exit.eh</%include>
<%def whats_on_actions>
<a class="<? current_type == "now" ? "active" ?>" href="whats_on.html?type=now&mode=<$ current_mode $>" id="nowhref"><$ tr("Now") $></a>
<span class="sep">|</span>
<a class="<? current_type == "next" ? "active" ?>" href="whats_on.html?type=next&mode=<$ current_mode $>" id="nexthref"><$ tr("Next") $></a>
<span class="sep">|</span>
<span><$ tr("What's on") $></span>
<select name="userdeftimes" size="1" id="userdeftimes" onchange="showtime(this)">
<option value="0"/>
<{
vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' );
vector< string >::const_iterator part = parts.begin();
for ( int i = 0; part != parts.end(); ++i, ++part ) {
}>
<option <{ reply.out() << ( (current_fixtime != "" && *part == current_displaytime) ? "selected=\"selected\"" : "" ); }> value="<$ *part $>"> <$ tr("at") + string(" ") + *part $></option>
<{
}
}>
</select>
<span class="sep">|</span>
<span><$ tr("at") $></span>
<input type="text" size="6" name="spectime" id="spectime" value = "<? current_attime != "" ? current_displaytime ?>" onchange="showspectime(this)"/>
<span class="sep">|</span>
% if ( current_mode == "list" ) {
<a href="whats_on.html?mode=detail&type=<$ current_type $>&attime=<$ current_attime $>&fixtime=<$ current_fixtime $>"><$ tr("Details view") $></a>
% } else {
<a href="whats_on.html?mode=list&type=<$ current_type $>&attime=<$ current_attime $>&fixtime=<$ current_fixtime $>"><$ tr("List view") $></a>
% }
</%def>
|