1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
\r
2 "http://www.w3.org/TR/html4/strict.dtd">
\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
\r
6 <title>pyTivo Web Configuration</title>
\r
7 <style type="text/css">
\r
14 background-color: rgb(250, 250, 250)
\r
18 background-color: rgb(240, 240, 240)
\r
22 background-color: rgb(255, 255, 255);
\r
23 border: 1px solid rgb(220, 220, 220);
\r
30 <script type="text/javascript">
\r
32 function fillBlank()
\r
34 var texts = document.getElementsByTagName('input');
\r
35 for (var i_tem = 0; i_tem < texts.length; i_tem++) {
\r
36 if (texts[i_tem].value == '') {
\r
37 texts[i_tem].value = ' ';
\r
42 function switchDiv(pass, type)
\r
44 //loop through the array and hide/show each element by id
\r
45 var divs = document.getElementsByTagName('div');
\r
46 for (var i = 0; i < divs.length; i++) {
\r
47 if (divs[i].id.match(type)) {
\r
48 if (divs[i].id == pass) {
\r
49 divs[i].style.visibility = 'visible'
\r
51 divs[i].style.visibility = 'hidden'
\r
57 function deleteSection(id)
\r
59 var name = select_section.section.options[id].text;
\r
60 if (name == 'Global Server Settings') {
\r
61 alert('Delete Error:\n\nSorry the Global Server Settings ' +
\r
62 'Section is required for pyTivo to run and cannot be deleted');
\r
65 var answer = confirm("Are you sure you wish to delete the '" + name +
\r
68 switchDiv('set-delete', 'set-');
\r
69 select_section.section.options[id] = null;
\r
70 var field = document.getElementById(name).value;
\r
71 document.getElementById(field).value = 'Delete_Me';
\r
77 function resetpyTivo()
\r
79 var answer = confirm("Are you sure you wish to reset the pyTivo " +
\r
80 "Server? Any unsaved changes will be lost!")
\r
83 "/TiVoConnect?Command=Reset&Container=$quote($container)"
\r
87 function showData(form)
\r
92 inputs = form.getElementsByTagName("input");
\r
93 for (i = 0; i < inputs.length; i++) {
\r
94 if (inputs[i].type == 'text' && re.exec(inputs[i].value)) {
\r
95 setting = inputs[i].name;
\r
99 if (setting != "") {
\r
100 var map = document.getElementById('Section_Map').value.split(']');
\r
102 splitSetting = setting.split('.');
\r
103 for (i = 0; i < map.length; i++) {
\r
104 key = map[i].split('|');
\r
105 if (splitSetting[0] == 'Server') {
\r
106 section = 'server';
\r
109 if (key[0] == splitSetting[0]) {
\r
114 alert("Invalid Entry:\nSorry these are not allowed \n[]<>|");
\r
115 switchDiv('set-' + section, 'set-');
\r
116 document.getElementById(setting).select();
\r
120 document.config.submit();
\r
123 function saveNotify()
\r
125 document.getElementById('B1').style.fontWeight = 'bold';
\r
126 document.getElementById('B2').disabled = true;
\r
133 #def row($i, $key, $section, $source)
\r
135 <tr class="row$(j)">
\r
136 <td style="text-align: left">$key:</td>
\r
138 <input size="20" id="opts.$section.$key" name="opts.$section.$key"
\r
139 #if $key in $source
\r
140 value="$source[$key]"
\r
144 onChange="saveNotify();" onfocus="switchDiv('help-$key', 'help-');
\r
145 return true;" type="text">
\r
150 #def rows($section, $source_data, $source_known)
\r
151 <hr style="width: 100%; height: 2px;">
\r
152 <table style="margin-left: auto; margin-right: auto">
\r
154 #for $key in $source_known
\r
156 $row($i, $key, $section, $source_data)
\r
159 <tr><td colspan="2" align="center" style="border-bottom:
\r
160 1px solid rgb(153, 153, 153);">User Defined Settings:</td></tr>
\r
163 #for $key in $source_data
\r
164 #if not $key in $source_known
\r
166 $row($i, $key, $section, $source_data)
\r
172 #def add_setting($name, $section)
\r
173 <div style="width: 330px; position: relative;">
\r
174 <div id="add-$name-button" style="width: 330px; position: absolute;
\r
175 left: 0px; top: 0px;">
\r
177 <input type="button" value="Add Setting"
\r
178 onclick="switchDiv('add-$name-field', 'add-$name-');
\r
181 <div id="add-$name-field" style="position: absolute;
\r
182 left: 0px; top: 0px; visibility: hidden;">
\r
183 <table style="width: 315px;">
\r
185 <td colspan="2" align="center" style="border-bottom: 1px solid
\r
186 rgb(153, 153, 153);">Add a Setting</td>
\r
188 <tr><td>Setting Name:</td><td>Setting Value:</td></tr>
\r
190 #for $x in ('setting', 'value')
\r
192 <input size="16" type="text" onChange="saveNotify();"
\r
193 id="opts.$(section).new_$x" name="opts.$(section).new__$x" value="">
\r
202 #set $section_size = 'width: 200px; height: 100%'
\r
203 #set $settings_size = 'width: 350px; height: 100%; overflow: auto'
\r
204 #set $help_size = 'width: 350px; height: 100%; overflow: auto'
\r
206 <p style="text-align: center"><big><big><big>pyTivo Web
\r
207 Configuration</big></big></big>
\r
208 <a href="javascript:switchDiv('help-Instructions', 'help-');">help</a></p>
\r
209 <table id="main" border="0" cellpadding="0" cellspacing="4">
\r
211 <tr style="height: 100%">
\r
213 <td style="border-right: 1px dotted rgb(153, 153, 153);
\r
214 vertical-align: top; overflow: hidden; height: 100%">
\r
215 <div id="leftframe" style="position: relative; text-align: center;
\r
217 <form name="select_section" action="NOTUSED"><p>Sections<br>
\r
218 <select name="section" size="7"
\r
219 onclick="switchDiv(options[selectedIndex].value, 'set-');
\r
221 <option value="set-server">Global Server Settings</option>
\r
222 <option value="set-hd_tivos">HD TiVo Settings</option>
\r
223 <option value="set-sd_tivos">SD TiVo Settings</option>
\r
224 #for $name, $data in $shares_data
\r
225 <option value="set-$name">$name</option>
\r
227 #for $name, $data in $tivos_data
\r
228 <option value="set-$name">$name</option>
\r
232 <input name="B4" value="Delete Section" type="button"
\r
233 onclick="deleteSection(select_section.section.selectedIndex)">
\r
234 <input name="B5" value="Add Section" type="button"
\r
235 onclick="switchDiv('set-add', 'set-');return true;">
\r
239 <form action="NOTUSED">
\r
240 <p><input name="B1" id="B1" value="Save Changes"
\r
241 type="button" onclick="showData(document.config); return true;">
\r
242 <input id="B2" name="B2" value="Soft Reset pyTivo" type="button"
\r
243 onclick="resetpyTivo();"></p>
\r
249 <td style="vertical-align: top; height: 100%">
\r
251 <div id="settings" style="$settings_size; position: relative;">
\r
253 <form name="config" method="POST" action="TiVoConnect"
\r
254 onsubmit="fillBlank(); showData(this);"><div style="height: 100%">
\r
256 <input type="hidden" name="Command" value="UpdateSettings">
\r
257 <input type="hidden" name="Container" value="$container">
\r
259 <div id="set-server" style="$settings_size; text-align: center;
\r
260 position: absolute; left: 0px; top: 0px; visibility: hidden">
\r
261 <b>Global Server Settings</b><br>
\r
262 $rows('Server', $server_data, $server_known)
\r
263 $add_setting('server', 'Server')
\r
266 <div id="set-hd_tivos" style="$settings_size; text-align: center;
\r
267 position: absolute; left: 0px; top: 0px; visibility: hidden">
\r
268 <b>HD TiVo Settings</b><br>
\r
269 $rows('_tivo_HD', $hd_tivos_data, $hd_tivos_known)
\r
270 $add_setting('hd_tivos', '_tivo_HD')
\r
273 <div id="set-sd_tivos" style="$settings_size; text-align: center;
\r
274 position: absolute; left: 0px; top: 0px; visibility: hidden">
\r
275 <b>SD TiVo Settings</b><br>
\r
276 $rows('_tivo_SD', $sd_tivos_data, $sd_tivos_known)
\r
277 $add_setting('sd_tivos', '_tivo_SD')
\r
280 #set $section_count = 0
\r
281 #set $section_map = ''
\r
282 #for $name, $data in $shares_data
\r
283 #set $section_count += 1
\r
284 #set $section_number = 'section-' + str($section_count)
\r
285 <input type="hidden" name="opts.$name" id="opts.$name"
\r
286 value="$section_number">
\r
287 #set $section_map += $section_number + '|' + $name + ']'
\r
288 <div id="set-$name" style="text-align: center; position: absolute;
\r
289 $settings_size; left: 0px; top: 0px; visibility: hidden">
\r
290 [<input size="20" onChange="saveNotify();" id="$section_number"
\r
291 name="$section_number" value="$name">]<br>
\r
292 $rows($section_number, $data, $shares_known)
\r
293 $add_setting($name, $section_number)
\r
297 #for $name, $data in $tivos_data
\r
298 #set $section_count += 1
\r
299 #set $section_number = 'section-' + str($section_count)
\r
300 <input type="hidden" name="opts.$name" id="opts.$name"
\r
301 value="$section_number">
\r
302 #set $section_map += $section_number + '|' + $name + ']'
\r
303 <div id="set-$name" style="text-align: center; position: absolute;
\r
304 $settings_size; left: 0px; top: 0px; visibility: hidden">
\r
305 [<input size="20" onChange="saveNotify();" id="$section_number"
\r
306 name="$section_number" value="$name">]<br>
\r
307 $rows($section_number, $data, $tivos_known)
\r
308 $add_setting($name, $section_number)
\r
311 <div id="set-add" style="text-align: center;position: absolute; left: 0px;
\r
312 top: 0px; visibility: hidden; $settings_size">
\r
317 <td> Section Name :</td><td>
\r
318 <input onChange="saveNotify();" type="text" size="20"
\r
319 name="new_Section" value=""
\r
320 onfocus="switchDiv('help-Add_a_New_Section', 'help-'); return true;">
\r
322 The new section name will be added to the pyTivo.conf file when
\r
323 you click <b>Save Changes</b>.
\r
325 <div id="set-delete" style="text-align: center; position: absolute;
\r
326 left: 0px; top: 0px; visibility: hidden; $settings_size">
\r
330 The Section has been marked for deletion. However it will not be
\r
331 actually deleted until you click the <b>Save Changes</b> button.
\r
333 <input type="hidden" id="Section_Map" name="Section_Map" value="$section_map">
\r
340 <td style="border-left: 1px dotted rgb(153, 153, 153);
\r
341 vertical-align: top; height: 100%">
\r
342 <div id="sidesections" style="$help_size; position: relative;">
\r
343 <!-- HELP SECTIONS -->
\r
344 #for $setting in $help_list
\r
345 #if $setting == 'Instructions'
\r
346 #set $vis = 'visible'
\r
348 #set $vis = 'hidden'
\r
350 <div id="help-$setting" style="visibility: $vis; $help_size;
\r
351 position: absolute; left: 0px; top: 0px;">
\r
352 <p style="text-align: center"><strong>$setting</strong></p>
\r
353 #for $line in $help_list[$setting]
\r
354 <p><strong>$(line.split(':', 1)[0]):</strong>
\r
355 $(line.split(':', 1)[1])</p>
\r
359 <!-- END HELP SECTIONS -->
\r