blob: a810908ce04604c61fe4b1983e47972fc1c54069 (
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
|
<%pre>
#include <vdr/recording.h>
#include <vdr/config.h>
#include <vdr/i18n.h>
#include "exception.h"
#include "tools.h"
#include "epg_events.h"
#include "recman.h"
#include "setup.h"
#include "i18n.h"
#include "livefeatures.h"
#include "users.h"
using namespace std;
using namespace vdrlive;
</%pre>
<%args>
// input parameters
string recid;
string async;
// form parameters
string name = "";
string directory = "";
string options[];
</%args>
<%session scope="global">
bool logged_in(false);
string edit_rec_referer;
</%session>
<%request scope="page">
const cRecording* recording;
</%request>
<%include>page_init.eh</%include>
<%cpp>
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
if (!cUser::CurrentUserHasRightTo(UR_EDITRECS))
throw HtmlError( tr("Sorry, no permission. Please contact your administrator!") );
bool ajaxReq = !async.empty() && (lexical_cast<int>(async) != 0);
string message;
recording = NULL;
if (!recid.empty()) {
recording = LiveRecordingsManager()->GetByMd5Hash(recid);
if (!recording)
throw HtmlError(tr("Couldn't find recording. Maybe you mistyped your request?"));
}
if (request.getMethod() == "POST") {
if (name.empty())
message = tr("Please set a name for the recording!");
else if (recording) {
bool copy_only = false;
for (options_type::const_iterator it = options.begin(); it != options.end(); ++it) {
if (*it == "delresume")
LiveRecordingsManager()->DeleteResume(recording);
else if (*it == "delmarks")
LiveRecordingsManager()->DeleteMarks(recording);
else if (*it == "copy")
copy_only = true;
}
options.clear();
string filename = directory.empty() ? name : StringReplace(directory, "/", "~") + "~" + name;
if (LiveRecordingsManager()->MoveRecording(recording, FileSystemExchangeChars(filename, true), copy_only))
return reply.redirect(!edit_rec_referer.empty() ? edit_rec_referer : "recordings.html");
else
message = tr("Cannot copy, rename or move the recording.");
}
}
if (message.empty())
edit_rec_referer = request.getHeader("Referer:", "recordings.html");
if (recording) {
string path = recording->Name();
size_t found = path.find_last_of("~");
if (found != string::npos) {
directory = StringReplace(path.substr(0, found), "~", "/");
name = path.substr(found + 1);
}
else {
directory = "";
name = path;
}
}
</%cpp>
<& pageelems.doc_type &>
<html>
<head>
<title>VDR Live - <$ tr("Edit recording") $></title>
<%cpp>
if (!ajaxReq) {
</%cpp>
<& pageelems.stylesheets &>
<& pageelems.ajax_js &>
<%cpp>
}
</%cpp>
</head>
<body>
<%cpp>
if (!ajaxReq) {
</%cpp>
<& pageelems.logo &>
<& menu active=("recordings") &>
<%cpp>
}
</%cpp>
<div class="inhalt">
<form method="post" name="edit_recording" id="<$ recid $>" action="edit_recording.ecpp">
<input type="hidden" name="recid" value="<$ recid $>"/>
<table class="formular" cellpadding="0" cellspacing="0">
<tr class="head">
<td class="toprow leftcol rightcol" colspan="2"><div class="boxheader"><div><div class="caption"><$ tr("Edit recording") $></div></div></div></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Name") $>:</div></td>
<td class="rightcol"><input type="text" name="name" value="<$ name $>" size="80"/></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Directory") $>:</div></td>
<td class="rightcol">
<select name="directory" size="1" id="directory" style="margin-top: 5px">
<%cpp>
DirectoryListPtr dirList(LiveRecordingsManager()->GetDirectoryList());
DirectoryList::DirVecType::const_iterator dir;
for (dir = dirList->begin(); dir != dirList->end(); ++dir) {
</%cpp>
<option value="<$ *dir $>"<$ (*dir == directory) ? "selected=\"selected\"" : "" $>><$ *dir $></option>
<%cpp>
}
</%cpp>
</select>
</td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Delete resume information") $>:</div></td>
<td class="rightcol"><input type="checkbox" name="options" value="delresume"/></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Delete marks information") $>:</div></td>
<td class="rightcol"><input type="checkbox" name="options" value="delmarks"/></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Copy only") $>:</div></td>
<td class="rightcol"><input type="checkbox" name="options" value="copy"/></td>
</tr>
<%cpp>
if (recording && recording->Info()->ShortText()) {
</%cpp>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Short description") $>:</div></td>
<td class="rightcol"><$ recording->Info()->ShortText() $></td>
</tr>
<%cpp>
}
if (recording && recording->Info()->Description()) {
</%cpp>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Description") $>:</div></td>
<td class="rightcol"><$ recording->Info()->Description() $></td>
</tr>
<%cpp>
}
if (recording && recording->Info()->Aux()) {
</%cpp>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Auxiliary info") $>:</div></td>
<td class="rightcol"><$ recording->Info()->Aux() $></td>
</tr>
<%cpp>
}
</%cpp>
<tr>
<td class="buttonpanel leftcol rightcol bottomrow" colspan="2">
<div class="withmargin">
<button class="green" type="submit"><$ tr("Save") $></button>
<button class="red" type="button" onclick="history.back()"><$ tr("Cancel") $></button>
</div>
</td>
</tr>
</table>
</form>
<div style="color: red; margin: 0 auto;">
<$ message $>
</div>
</div>
</body>
</html>
<%include>page_exit.eh</%include>
|