blob: 4499e98e3a2836afb59e3748eae94f70cbdd2e35 (
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
|
<%pre>
#include <vdr/tools.h>
#include "setup.h"
#include "tools.h"
using namespace vdrlive;
using namespace std;
</%pre>
<%args>
string lastchannel;
bool useauth = 0;
string login;
string pass;
string times;
string startscreen;
string theme;
string localnetmask;
int authchanged = 0;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%include>page_init.eh</%include>
<{
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
}>
<%cpp>
#define SELECTIF(x) reply.out() << ( (x) ? "selected=\"selected\"" : "" );
std::string message;
if ( request.getMethod() == "POST") {
if (authchanged && useauth && (login.empty() || pass.empty()))
message = tr("Please set login and password!");
else
{
LiveSetup().SetLastChannel(lastchannel != "" ? lexical_cast< int >(lastchannel):0);
LiveSetup().SetUseAuth(useauth);
if (useauth) {
LiveSetup().SetAdminLogin(login);
if (pass != "")
LiveSetup().SetAdminPassword(pass);
LiveSetup().SetLocalNetMask(localnetmask);
LiveSetup().CheckLocalNet(request.getPeerIp());
}
LiveSetup().SetTimes(times);
LiveSetup().SetStartScreen(startscreen);
LiveSetup().SetTheme(theme);
LiveSetup().SaveSetup();
message = tr("Setup saved.");
}
}
pageTitle = tr("Setup");
int ilastchannel = LiveSetup().GetLastChannel();
if (ilastchannel == std::numeric_limits< int >::max())
lastchannel = "";
else
lastchannel = lexical_cast<std::string, int>(ilastchannel);
login = LiveSetup().GetAdminLogin();
useauth = LiveSetup().GetUseAuth();
times = LiveSetup().GetTimes();
startscreen = LiveSetup().GetStartScreen();
theme = LiveSetup().GetTheme();
localnetmask = LiveSetup().GetLocalNetMask();
</%cpp>
<& pageelems.doc_type &>
<html>
<head>
<title>VDR-Live - <$ pageTitle $></title>
<& pageelems.stylesheets &>
<& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &>
<& pageelems.ajax_js &>
<script type="text/javascript"><!--
function initform()
{
changeduseauth(document.getElementById("useauth"));
if (document.getElementById("message").value != "")
alert(document.getElementById("message").value);
}
function changeduseauth(selection)
{
document.getElementById("authsection").style.display = (selection.checked ? "block" : "none");
}
function setauthchanged(selection)
{
document.getElementById("authchanged").value = 1;
}
//--></script>
</head>
<body onload="<& pageelems.infobox_start_update &>; initform()">
<& pageelems.logo &>
<& menu active=("setup") &>
<div class="inhalt">
<form method="POST" name="setup" action="setup.ecpp">
<input type="hidden" name="authchanged" value="<$ authchanged $>" id="authchanged"/>
<input type="hidden" name="message" value="<$ message $>" id="message"/>
<table class="formular" cellpadding="0" cellspacing="0">
<tr class="head">
<td class="toprow leftcol rightcol" colspan="2"><div class="boxheader"><div><div><$ tr("Setup") $></div></div></div></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Last channel to display") $>:</div></td>
<td class="rightcol"><input type="text" name="lastchannel" value="<$ lastchannel $>" id="lastchannel" /></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Use authentication") $>:</div></td>
<td class="rightcol">
<input type="checkbox" name="useauth" id="useauth" value="1" <{ reply.out() << ( useauth ? "checked=\"checked\"" : "" ); }> onclick="changeduseauth(this)"/>
<div id="authsection" style="display: none">
<table border="0" cellpadding="0" cellspacing="0" class="dependent">
<tr>
<td class="label"><div class="withmargin"><$ tr("Admin login") $>:</div></td>
<td><input type="text" name="login" value="<$ login $>" id="login" onchange="setauthchanged(this)" /></td>
</tr>
<tr>
<td class="label"><div class="withmargin"><$ tr("Admin password") $>:</div></td>
<td><input type="password" name="pass" value="<$ pass $>" id="pass" onchange="setauthchanged(this)" /></td>
</tr>
<tr>
<td class="label"><div class="withmargin"><$ tr("Local net (no login required)") $>:</div></td>
<td><input type="text" name="localnetmask" value="<$ localnetmask $>" id="localnetmask" /></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("additional fixed times in 'What's on?'") $>:</div></td>
<td class="rightcol"><input type="text" name="times" value="<$ times $>" id="times" />
<& tooltip.help text=(tr("Format is HH:MM. Separate multiple times with a semicolon")) &></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Start page") $>:</div></td>
<td class="rightcol"><select name="startscreen" size="1" id="startscreen">
<option value="whatsonnow" <{ SELECTIF(startscreen == "whatsonnow") }>><$ tr("What's on now?") $></option>
<option value="whatsonnext" <{ SELECTIF(startscreen == "whatsonnext") }>><$ tr("What's on next?") $></option>
<option value="schedule" <{ SELECTIF(startscreen == "schedule") }>><$ tr("Schedule") $></option>
<option value="recordings" <{ SELECTIF(startscreen == "recordings") }>><$ tr("Recordings") $></option>
<option value="timers" <{ SELECTIF(startscreen == "timers") }>><$ tr("Timers") $></option>
</select></td>
</tr>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Theme") $>:</div></td>
<td class="rightcol"><select name="theme" size="1" id="theme">
<%cpp>
{
cReadDir d((Plugin::GetConfigDirectory() + "/themes").c_str());
struct dirent* e;
string parent("..");
string current(".");
while ((e = d.Next())) {
if ((current == e->d_name) || (parent == e->d_name)) {
continue;
}
if (DT_DIR != e->d_type) {
continue;
}
</%cpp>
<option value="<$ e->d_name $>" <{ SELECTIF(theme == e->d_name) }>><$ e->d_name $></option>
<%cpp>
}
}
</%cpp>
</select></td>
</tr>
<tr>
<td class="buttonpanel leftcol rightcol bottomrow" colspan="2">
<div class="withmargin">
<button class="green" type="submit" name="save" ><$ tr("Save") $></button>
</div>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%include>page_exit.eh</%include>
|