summaryrefslogtreecommitdiff
path: root/pages/timers.ecpp
blob: db661b2d05612103cc06f586ba939d59dbdcbde1 (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
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
<%pre>
#include <set>
#include <vdr/i18n.h>
#include "timers.h"
#include "tools.h"
#include "setup.h"

using namespace std;
using namespace vdrlive;

</%pre>
<%args>
	// input parameters
	string timerid;
	string action;
</%args>
<%session scope="global">
	bool logged_in(false);
</%session>
<%request scope="page">
	cTimer* timer;
</%request>
<%include>page_init.eh</%include>
<%cpp>
	if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");

	pageTitle = trVDR("Timers");

	cMutexLock timersLock( &LiveTimerManager() );
	SortedTimers& timers = LiveTimerManager().GetTimers();

	timer = 0;
	if ( !timerid.empty() ) {
		timer = timers.GetByTimerId( timerid );
		if ( timer == 0 )
			throw HtmlError( tr("Couldn't find timer. Maybe you mistyped your request?") );
		if (action == "delete")
			LiveTimerManager().DelTimer(timer);
		if (action == "toggle")
			LiveTimerManager().ToggleTimerActive(timer);
	}

	string previousDay = "";
</%cpp>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ pageTitle $></title>
		<& pageelems.stylesheets &>
		<& pageelems.ajax_js &>
	</head>
	<body>
		<& pageelems.logo &>
		<& menu active=("timers") component=("timers.timer_actions")>
		<div class="inhalt">
%			if (timers.size() == 0) {
				<$ tr("No timer defined") $>
%			} else {
			<table class="listing" cellspacing="0" cellpadding="0">
<%cpp>
				// output of the timer list:
				for (SortedTimers::iterator timer = timers.begin(); timer != timers.end(); ++timer) {
					string currentDay = SortedTimers::GetTimerDays(*timer);
					SortedTimers::iterator nextTimer = timer; ++nextTimer;
					bool bottom = false;
					if (nextTimer == timers.end())
						bottom = true;
					else {
						string nextDay = SortedTimers::GetTimerDays(*nextTimer);
						bottom = (currentDay != nextDay);
					}
					if (previousDay != currentDay) {
						if (!previousDay.empty()) {
</%cpp>
						<tr class="spacer">
							<td colspan="8"/>
						</tr>
<%cpp>
						}
						previousDay = currentDay;
</%cpp>
				<tr class="head">
					<td colspan="8">
						<div class="boxheader"><div><div>
							<$ currentDay $>
						</div></div></div>
					</td>
				</tr>
				<tr class="description">
					<td class="leftcol"><img src="/img/transparent.png" alt="" width="16px" height="16px" /></td>
					<td><div class="withmargin"><$ tr("Channel") $></div></td>
					<td><div class="withmargin"><$ tr("Start") $></div></td>
					<td><div class="withmargin"><$ tr("Stop") $></div></td>
					<td><div class="withmargin"><$ tr("File") $></div></td>
					<td class="action"><img src="/img/transparent.png" alt="" width="16px" height="16px" /></td>
					<td class="action"><img src="/img/transparent.png" alt="" width="16px" height="16px" /></td>
					<td class="action rightcol"><img src="/img/transparent.png" alt="" width="16px" height="16px" /></td>
				</tr>
<%cpp>
					}
					std::string timerStateImg = "transparent.png";
					if (timer->Recording())
						timerStateImg = "arrow_rec.gif";
					else if (timer->Flags() & tfActive)
						timerStateImg = "arrow.png";
</%cpp>
				<tr>
					<td class="leftcol <? bottom ? "bottomrow" ?>"><img src="<$ LiveSetup().GetThemedLink("img", timerStateImg) $>" alt=""></img></td>
					<td class="<? bottom ? "bottomrow" ?>"><div class="withmargin"><a href="schedule.html?channel=<$ timer->Channel()->Number()$>"><$ timer->Channel()->Name() $></a></div></td>
					<td class="<? bottom ? "bottomrow" ?>"><div class="withmargin"><$ FormatDateTime(tr("%I:%M %p"), timer->StartTime()) $></div></td>
					<td class="<? bottom ? "bottomrow" ?>"><div class="withmargin"><$ FormatDateTime(tr("%I:%M %p"), timer->StopTime()) $></div></td>
					<td class="<? bottom ? "bottomrow" ?>"><div class="withmargin"><$ timer->File() $></div></td>
					<td class="action <? bottom ? "bottomrow" ?>"><a href="timers.html?timerid=<$ timers.GetTimerId(*timer) $>&action=toggle"><img src="<$ LiveSetup().GetThemedLink("img", (timer->Flags() & tfActive) ? "active.png" : "inactive.png") $>" alt="" <& tooltip.hint text=(tr("Toggle timer active/inactive")) &>></img></a></td>
					<td class="action <? bottom ? "bottomrow" ?>"><a href="edit_timer.html?timerid=<$ timers.GetTimerId(*timer) $>"><img src="<$ LiveSetup().GetThemedLink("img", "edit.png") $>" alt="" <& tooltip.hint text=(tr("Edit timer")) &>></img></a></td>
					<td class="action rightcol <? bottom ? "bottomrow" ?>"><a href="timers.html?timerid=<$ timers.GetTimerId(*timer) $>&action=delete"><img src="<$ LiveSetup().GetThemedLink("img", "del.png") $>" alt="" <& tooltip.hint text=(tr("Delete timer")) &>></img></a></td>
				</tr>
<%cpp>
				}
			}
</%cpp>
			</table>
		</div>
	</body>
</html>
<%include>page_exit.eh</%include>

<%def timer_actions>
<a href="edit_timer.html"><$ tr("New timer") $></a>
</%def>