summaryrefslogtreecommitdiff
path: root/pages/recordings.ecpp
blob: 499328419222e8fb9731876a9f9797fbbd828e9b (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
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
<%pre>
#include <vdr/plugin.h>
#include <vdr/config.h>

#include "exception.h"
#include "tools.h"
#include "epg_events.h"

#include "recordings.h"
#include "setup.h"

using namespace vdrlive;
using namespace std;

</%pre>
<%args>
</%args>
<%session scope="global">
	bool logged_in(false);
</%session>
<%request scope="page">
RecordingsTree recordingsTree(LiveRecordingsManager());
EpgEvents epgEvents;
</%request>
<%include>page_init.eh</%include>
<%cpp>
	if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");

	pageTitle = tr("Recordings");
</%cpp>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ pageTitle $></title>
		<link rel="stylesheet" type="text/css" href="styles.css" />
		<& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &>
		<& pageelems.ajax_js &>
		<script type="text/javascript" src="treeview.js"></script>
	</head>
	<body onload="<& pageelems.infobox_start_update &>">
		<& pageelems.logo &>
		<& menu active=("recordings") &>
		<div class="inhalt">
			<div class="boxheader"><div><div><$ tr("List of recordings") $></div></div></div>
%			if (Recordings.Count() == 0) {
				<$ tr("No recordings found") $>
%			} else {
			<div class="recordings">
			<ul class="recordingslist" style="display: block;">
<& recordings.recordings_item &>
			</ul>
			</div>
			<div class="epg_data" style="display: none;">
<& recordings.recordings_data &>
			</div>
%			}
		</div>
	</body>
</html>
<%include>page_exit.eh</%include>

<# ---------------------------------------------------------------------- #>

<%def recordings_item>
<%args>
	path[];
	int level = 0;
</%args>
<%cpp>
RecordingsTree::Map::iterator iter;
RecordingsTree::Map::iterator end = recordingsTree.end(path);

for (iter = recordingsTree.begin(path); iter != end; ++iter) {
	RecordingsTree::RecordingsItemPtr recItem = iter->second;
	string folderimg("folder_closed.png");
	string collapseimg("plus.png");
	if (recItem->IsDir()) {
</%cpp>
	<li class="recording">
		<& rec_item_dir name=(recItem->Name()) level=(level) &>
<%cpp>
		cxxtools::QueryParams recItemParams(qparam, false);
		for (path_type::const_iterator i = path.begin(); i != path.end(); ++i) {
			recItemParams.add("path", *i);
		}
		recItemParams.add("path", recItem->Name());
		recItemParams.add("level", lexical_cast<string, int>(level + 1));
</%cpp>
		<ul class="recordingslist" style="display: none;">
%		callComp("recordings.recordings_item", request, reply, recItemParams);
    	</ul>
	</li>
%	}
%}
<%cpp>
for (iter = recordingsTree.begin(path); iter != end; ++iter) {
	RecordingsTree::RecordingsItemPtr recItem = iter->second;
    if (!recItem->IsDir()) {
		EpgEventPtr epgEvent(RecordingsTree::CreateEpgEvent(recItem));
		if (epgEvent) {
			epgEvents.push_back(epgEvent);
		}
		string day(FormatDateTime("%a,", recItem->StartTime()));
		string dayLen(lexical_cast<string, int>(day.length() - 1) + ".25em;");
		string shortDescr(tr("Click to view details.")); if (epgEvent && !epgEvent->ShortDescr().empty()) shortDescr = (epgEvent->ShortDescr() + string("<br />") + shortDescr);
</%cpp>
	<li class="recording">
	<& rec_item_file name=(recItem->Name()) level=(level) id=(recItem->Id()) day=(day) dayLen=(dayLen) startTime=(recItem->StartTime()) shortDescr=(shortDescr) archived=(epgEvent ? epgEvent->Archived() : "") archiveId=(recItem->ArchiveId()) &>
    </li>
<%cpp>
	}
}
</%cpp>
</%def>

<# ---------------------------------------------------------------------- #>

<%def recordings_data>
<%cpp>
	// create hidden div for the tooltip hints.
	for (vector<EpgEventPtr>::iterator i = epgEvents.begin(); i != epgEvents.end(); ++i) {
		EpgEventPtr epg = *i;
		string start(epg->StartTime("%a,") + string(" ")
				+ epg->StartTime(tr("%b %d %y")) + string(" ")
				+ epg->StartTime(tr("%I:%M %p")));
		string tools_component = epg->Archived().empty() ? "recordings.rec_tools" : "recordings.archived_disc" ;
</%cpp>
		<& pageelems.epg_tt_box boxId=(epg->Id()) caption=(epg->Caption()) tools_comp=(tools_component) time=(start) title=(epg->Title()) short_descr=(epg->ShortDescr()) long_descr=(epg->LongDescr()) archived=(epg->Archived()) elapsed=(epg->Elapsed()) &>
<%cpp>
	}
</%cpp>
</%def>

<# ---------------------------------------------------------------------- #>

<%def rec_tools>
<%args>
	string id;
</%args>
<& pageelems.ajax_action_href action="play_recording" param=(id) tip=(tr("play this recording.")) image="play.png" alt="" &>
</%def>

<# ---------------------------------------------------------------------- #>

<%def archived_disc>
<%args>
	string archived;
</%args>
<img src="on_dvd.png" alt="on_dvd" <& tooltip.hint text=(archived) &> />
</%def>

<# ---------------------------------------------------------------------- #>

<%def rec_item_dir>
<%args>
	string name;
	int level;
	string collapseimg = "plus.png";
	string folderimg = "folder_closed.png";
</%args>
	<div class="recording_item" onclick="Toggle(this)">
	<div class="recording_imgs"><%cpp> reply.out() << StringRepeat(level, "<img src=\"transparent.png\" alt=\"\" width=\"16px\" height=\"16px\" />"); </%cpp><img class="recording_expander" src="<$ collapseimg $>" alt="" /><img class="recording_folder" src="<$ folderimg $>" alt="" /></div>
	<div class="recording_spec">
	  <div class="recording_name"><$ name $></div>
    </div>
	<div class="recording_actions">&nbsp;</div>
	</div>
</%def>

<# ---------------------------------------------------------------------- #>

<%def rec_item_file>
<%args>
	string name;
	int level;
	string id;
	string day;
	string dayLen;
	time_t startTime;
	string shortDescr;
	string archived;
	string archiveId;
</%args>
	<div class="recording_item">
	<div class="recording_imgs"><%cpp> reply.out() << StringRepeat(level + 1, "<img src=\"transparent.png\" alt=\"\" width=\"16px\" height=\"16px\" />"); </%cpp><%cpp> if (!archived.empty()) { </%cpp><& archived_disc archived=(archived) &><%cpp> } else { </%cpp><img src="movie.png" alt="movie" /><%cpp> } </%cpp></div>
	<div class="recording_spec">
		<div class="recording_day" style="width: <$ dayLen $>"><$ day $></div>
		<div class="recording_date"><$ FormatDateTime(tr("%b %d %y"), startTime) $></div>
		<div class="recording_time"><$ FormatDateTime(tr("%I:%M %p"), startTime) $></div>
		<div class="recording_name" <& tooltip.hint text=(shortDescr) &><& tooltip.display domId=(id) &>><$ name $></div>
		<%cpp> if (! archived.empty()) { </%cpp><div><$ archived $></div><%cpp> } </%cpp>
	</div>
	<div class="recording_actions">
<%cpp>
		if (archived.empty()) {
</%cpp>
		<& pageelems.ajax_action_href action="play_recording" param=(id) tip=(tr("play this recording.")) image="play.png" alt="" &>
<%cpp>
	    }
		else {
</%cpp>
		<img src="transparent.png" alt="" width="16px" height="16px" />
<%cpp>
		}
</%cpp>
		<img src="edit.png" alt="" />
		<img src="del.png" alt="" />
	</div>
	</div>
</%def>