9
using namespace vdrlive;
20
string scheduleDuration;
29
string showChannelsWithoutEPG;
34
<%session scope="global">
35
bool logged_in(false);
37
<%include>page_init.eh</%include>
39
if (!logged_in && LiveSetup().UseAuth() ) return reply.redirect("login.html");
40
if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
41
throw HtmlError( tr("Sorry, no permission. Please contact your administrator!") );
43
#define SELECTIF(x) reply.out() << ( (x) ? "selected=\"selected\"" : "" );
44
#define CHECKIF(x) reply.out() << ( (x) ? "checked=\"checked\"" : "" );
48
if ( request.getMethod() == "POST") {
49
if (authchanged && useauth && (login.empty() || pass.empty()))
50
message = tr("Please set login and password!");
53
LiveSetup().SetLastChannel(lastchannel != "" ? lexical_cast< int >(lastchannel):0);
54
LiveSetup().SetUseAuth(useauth);
56
LiveSetup().SetAdminLogin(login);
58
LiveSetup().SetAdminPassword(pass);
59
LiveSetup().SetLocalNetMask(localnetmask);
60
LiveSetup().CheckLocalNet(request.getPeerIp());
62
LiveSetup().SetTimes(times);
63
LiveSetup().SetChannelGroups(channelGroups);
64
LiveSetup().SetScheduleDuration(scheduleDuration);
65
LiveSetup().SetStartScreen(startscreen);
66
LiveSetup().SetTheme(theme);
67
LiveSetup().SetShowLogo(!showLogo.empty());
68
LiveSetup().SetUseAjax(!useAjax.empty());
69
if (LiveSetup().GetUseAjax()) {
70
LiveSetup().SetShowInfoBox(!showInfoBox.empty());
72
LiveSetup().SetUseStreamdev(!useStreamdev.empty());
73
LiveSetup().SetStreamdevPort(streamdevport.empty() ? 3000 : lexical_cast<int>(streamdevport));
74
LiveSetup().SetStreamdevType(streamdevtype.empty() ? "PES" : streamdevtype);
75
LiveSetup().SetShowIMDb(!showIMDb.empty());
76
LiveSetup().SetShowChannelsWithoutEPG(!showChannelsWithoutEPG.empty());
77
LiveSetup().SaveSetup();
79
message = tr("Setup saved.");
82
pageTitle = tr("Setup");
83
int ilastchannel = LiveSetup().GetLastChannel();
84
if (ilastchannel == std::numeric_limits< int >::max())
87
lastchannel = lexical_cast<std::string, int>(ilastchannel);
89
login = LiveSetup().GetAdminLogin();
90
useauth = LiveSetup().GetUseAuth();
91
times = LiveSetup().GetTimes();
92
channelGroups = LiveSetup().GetChannelGroups();
93
scheduleDuration = LiveSetup().GetScheduleDuration();
94
startscreen = LiveSetup().GetStartScreen();
95
theme = LiveSetup().GetTheme();
96
localnetmask = LiveSetup().GetLocalNetMask();
97
showLogo = LiveSetup().GetShowLogo() ? "1" : "";
98
useAjax = LiveSetup().GetUseAjax() ? "1" : "";
99
showInfoBox = LiveSetup().GetShowInfoBox() ? "1" : "";
100
useStreamdev = LiveSetup().GetUseStreamdev() ? "1" : "";
101
streamdevport = lexical_cast<std::string, int>(LiveSetup().GetStreamdevPort());
102
streamdevtype = LiveSetup().GetStreamdevType();
103
showIMDb = LiveSetup().GetShowIMDb() ? "1" : "";
104
showChannelsWithoutEPG = LiveSetup().GetShowChannelsWithoutEPG() ? "1" : "";
106
<& pageelems.doc_type &>
109
<title>VDR-Live - <$ pageTitle $></title>
110
<& pageelems.stylesheets &>
111
<& pageelems.ajax_js &>
112
<script type="text/javascript"><!--
115
changeduseauth(document.getElementById("useauth"));
116
changeduseajax(document.getElementById("useAjax"));
117
changedusestreamdev(document.getElementById("useStreamdev"));
118
if (document.getElementById("message").value != "")
119
alert(document.getElementById("message").value);
121
function changeduseauth(selection)
123
document.getElementById("authsection").style.display = (selection.checked ? "block" : "none");
125
function setauthchanged(selection)
127
document.getElementById("authchanged").value = 1;
129
function changeduseajax(selection)
131
document.getElementById("ajaxsection").style.display = (selection.checked ? "block" : "none");
133
function changedusestreamdev(selection)
135
document.getElementById("streamdevsection").style.display = (selection.checked ? "block" : "none");
139
<body onload="initform()">
141
<& menu active=("setup") &>
143
<form method="post" action="setup.html">
144
<input type="hidden" name="authchanged" value="<$ authchanged $>" id="authchanged"/>
145
<input type="hidden" name="message" value="<$ message $>" id="message"/>
146
<table class="formular" cellpadding="0" cellspacing="0">
148
<td class="toprow leftcol rightcol" colspan="2"><div class="boxheader"><div><div><$ tr("Setup") $></div></div></div></td>
151
<td class="label leftcol"><div class="withmargin"><$ tr("Use authentication") $>:</div></td>
152
<td class="rightcol">
153
<input type="checkbox" name="useauth" id="useauth" value="1" <%cpp> CHECKIF(useauth); </%cpp> onclick="changeduseauth(this)"/>
154
<div id="authsection" style="display: none">
155
<table border="0" cellpadding="0" cellspacing="0" class="dependent">
157
<td class="label"><div class="withmargin"><$ tr("Admin login") $>:</div></td>
158
<td><input type="text" name="login" value="<$ login $>" id="login" onchange="setauthchanged(this)" /></td>
161
<td class="label"><div class="withmargin"><$ tr("Admin password") $>:</div></td>
162
<td><input type="password" name="pass" value="<$ pass $>" id="pass" onchange="setauthchanged(this)" /></td>
165
<td class="label"><div class="withmargin"><a href="users.html"><$ tr("User management") $></a></div></td>
169
<td class="label"><div class="withmargin"><$ tr("Local net (no login required)") $>:</div></td>
170
<td><input type="text" name="localnetmask" value="<$ localnetmask $>" id="localnetmask" /></td>
177
<td class="label leftcol"><div class="withmargin"><$ tr("Show live logo image") $>:</div></td>
178
<td class="rightcol">
179
<input type="checkbox" name="showLogo" id="showLogo" value="1" <%cpp> CHECKIF(!showLogo.empty()); </%cpp>/>
183
<td class="label leftcol"><div class="withmargin"><$ tr("Use ajax technology") $>:</div></td>
184
<td class="rightcol">
185
<input type="checkbox" name="useAjax" id="useAjax" value="1" <%cpp> CHECKIF(!useAjax.empty()); </%cpp> onclick="changeduseajax(this)"/>
186
<div id="ajaxsection" style="display: none">
187
<table border="0" cellpadding="0" cellspacing="0" class="dependent">
189
<td class="label"><div class="withmargin"><$ tr("Show dynamic VDR information box") $>:</div></td>
190
<td><input type="checkbox" name="showInfoBox" id="showInfoBox" value="1" <%cpp> CHECKIF(!showInfoBox.empty()); </%cpp>/></td>
197
<td class="label leftcol"><div class="withmargin"><$ tr("Allow video streaming") $>:</div></td>
198
<td class="rightcol">
199
<input type="checkbox" name="useStreamdev" id="useStreamdev" value="1" <%cpp> CHECKIF(!useStreamdev.empty()); </%cpp> onclick="changedusestreamdev(this)"/>
200
<div id="streamdevsection" style="display: none">
201
<table border="0" cellpadding="0" cellspacing="0" class="dependent">
203
<td class="label"><div class="withmargin"><$ tr("Streamdev server port") $>:</div></td>
204
<td><input type="text" name="streamdevport" id="streamdevport" value="<$ streamdevport $>" /></td>
207
<td class="label"><div class="withmargin"><$ tr("Streamdev stream type") $>:</div></td>
208
<td><select name="streamdevtype" size="1" id="streamdevtype">
209
<option value="TS" <%cpp> SELECTIF(streamdevtype == "TS") </%cpp>>TS</option>
210
<option value="PES" <%cpp> SELECTIF(streamdevtype == "PES") </%cpp>>PES</option>
211
<option value="PS" <%cpp> SELECTIF(streamdevtype == "PS") </%cpp>>PS</option>
212
<option value="ES" <%cpp> SELECTIF(streamdevtype == "ES") </%cpp>>ES</option>
213
<option value="EXT" <%cpp> SELECTIF(streamdevtype == "EXT") </%cpp>>EXT</option>
221
<td class="label leftcol"><div class="withmargin"><$ tr("Add links to IMDb") $>:</div></td>
222
<td class="rightcol">
223
<input type="checkbox" name="showIMDb" id="showIMDb" value="1" <%cpp> CHECKIF(!showIMDb.empty()); </%cpp>/>
227
<td class="label leftcol"><div class="withmargin"><$ tr("Last channel to display") $>:</div></td>
228
<td class="rightcol"><input type="text" name="lastchannel" value="<$ lastchannel $>" id="lastchannel" /></td>
231
<td class="label leftcol"><div class="withmargin"><$ tr("Additional fixed times in 'What's on?'") $>:</div></td>
232
<td class="rightcol"><input type="text" name="times" value="<$ times $>" id="times" />
233
<& tooltip.help text=(tr("Format is HH:MM. Separate multiple times with a semicolon")) &></td>
236
<td class="label leftcol"><div class="withmargin"><$ tr("Channel groups for MultiSchedule") $>:</div></td>
237
<td class="rightcol"><input type="text" name="channelGroups" value="<$ channelGroups $>" id="channelGroups" />
238
<& tooltip.help text=(tr("Separate channels with a comma ',', separate groups with a semi-colon ';'")) &></td>
241
<td class="label leftcol"><div class="withmargin"><$ tr("Duration of MultiSchedule in hours") $>:</div></td>
242
<td class="rightcol"><input type="text" name="scheduleDuration" value="<$ scheduleDuration $>" id="scheduleDuration" />
246
<td class="label leftcol"><div class="withmargin"><$ tr("Show channels without EPG") $>:</div></td>
247
<td class="rightcol">
248
<input type="checkbox" name="showChannelsWithoutEPG" id="showChannelsWithoutEPG" value="1" <%cpp> CHECKIF(!showChannelsWithoutEPG.empty()); </%cpp>/>
253
<td class="label leftcol"><div class="withmargin"><$ tr("Start page") $>:</div></td>
254
<td class="rightcol"><select name="startscreen" size="1" id="startscreen">
255
<option value="whatsonnow" <%cpp> SELECTIF(startscreen == "whatsonnow") </%cpp>><$ trVDR("What's on now?") $></option>
256
<option value="whatsonnext" <%cpp> SELECTIF(startscreen == "whatsonnext") </%cpp>><$ trVDR("What's on next?") $></option>
257
<option value="schedule" <%cpp> SELECTIF(startscreen == "schedule") </%cpp>><$ trVDR("Schedule") $></option>
258
<option value="multischedule" <%cpp> SELECTIF(startscreen == "multischedule") </%cpp>><$ tr("MultiSchedule") $></option>
259
<option value="recordings" <%cpp> SELECTIF(startscreen == "recordings") </%cpp>><$ trVDR("Recordings") $></option>
260
<option value="timers" <%cpp> SELECTIF(startscreen == "timers") </%cpp>><$ trVDR("Timers") $></option>
264
<td class="label leftcol"><div class="withmargin"><$ tr("Theme") $>:</div></td>
265
<td class="rightcol"><select name="theme" size="1" id="theme">
268
const string dirPath(Plugin::GetConfigDirectory() + "/themes");
269
cReadDir d(dirPath.c_str());
273
string cvsDir("CVS");
274
while ((e = d.Next())) {
275
if ((current == e->d_name) || (parent == e->d_name) || (cvsDir == e->d_name)) {
278
/* Check if entry is a directory: I do not rely on e->d_type
279
here because on some systems it is allways DT_UNKNOWN. Also
280
testing for DT_DIR does not take into account symbolic
281
links to directories.
284
if ((stat((dirPath + "/" + e->d_name).c_str(), &buf) != 0) || (!S_ISDIR(buf.st_mode))) {
288
<option value="<$ e->d_name $>" <%cpp> SELECTIF(theme == e->d_name) </%cpp>><$ e->d_name $></option>
296
<td class="buttonpanel leftcol rightcol bottomrow" colspan="2">
297
<div class="withmargin">
298
<button class="green" type="submit" name="save" ><$ tr("Save") $></button>
308
<%include>page_exit.eh</%include>