1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
\r
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
\r
5 <title>pyTivo Web Configuration</title>
\r
6 <script language="javascript" type="text/javascript">
\r
10 var texts = document.getElementsByTagName('input');
\r
11 for (var i_tem = 0; i_tem < texts.length; i_tem++) {
\r
12 if (texts[i_tem].value == '') {
\r
13 texts[i_tem].value = ' ';
\r
18 function switchDiv(pass, type)
\r
20 //loop through the array and hide/show each element by id
\r
21 var divs = document.getElementsByTagName('div');
\r
22 for (var i = 0; i < divs.length; i++) {
\r
23 if (divs[i].id.match(type)) {
\r
24 if (divs[i].id == pass) {
\r
25 divs[i].style.visibility = ''
\r
27 divs[i].style.visibility = 'hidden'
\r
33 function deleteSection(id)
\r
35 var name = select_section.section.options[id].text;
\r
36 if (name == 'Global Server Settings') {
\r
37 alert('Delete Error:\n\nSorry the Global Server Settings ' +
\r
38 'Section is required for pyTivo to run and cannot be deleted');
\r
41 var answer = confirm("Are you sure you wish to delete the '" + name +
\r
44 switchDiv('set-delete', 'set-');
\r
45 select_section.section.options[id] = null;
\r
46 var field = document.getElementById(name).value;
\r
47 document.getElementById(field).value = 'Delete_Me';
\r
53 function resetpyTivo()
\r
55 var answer = confirm("Are you sure you wish to reset the pyTivo " +
\r
56 "Server? Any unsaved changes will be lost!")
\r
59 "/TiVoConnect?Command=Reset&Container=$quote($container)"
\r
63 function showData(form)
\r
68 inputs = form.getElementsByTagName("input");
\r
69 for (i = 0; i < inputs.length; i++) {
\r
70 if (inputs[i].type == 'text' && re.exec(inputs[i].value)) {
\r
71 setting = inputs[i].name;
\r
75 if (setting != "") {
\r
76 var map = document.getElementById('Section_Map').value.split(']');
\r
78 splitSetting = setting.split('.');
\r
79 for (i = 0; i < map.length; i++) {
\r
80 key = map[i].split('|');
\r
81 if (splitSetting[0] == 'Server') {
\r
85 if (key[0] == splitSetting[0]) {
\r
90 alert("Invalid Entry:\nSorry these are not allowed \n[]<>|");
\r
91 switchDiv('set-' + section, 'set-');
\r
92 document.getElementById(setting).select();
\r
96 document.config.submit();
\r
99 function saveNotify()
\r
101 document.getElementById('B1').style.fontWeight = 'bold';
\r
102 document.getElementById('B2').disabled = true;
\r
107 <body style="background-color: rgb(250, 250, 250)">
\r
109 #def row($i, $key, $section, $source)
\r
111 <tr style="background-color: rgb(240, 240, 240)">
\r
117 <input size="20" id="$section.$key" name="$section.$key"
\r
118 #if $key in $source
\r
119 value="$source[$key]"
\r
123 onChange="saveNotify();" onfocus="switchDiv('help-$key', 'help-');
\r
124 return true;" type="text">
\r
129 #def rows($section, $source_data, $source_known)
\r
130 <hr style="width: 100%; height: 2px;">
\r
131 <table align="center">
\r
133 #for $key in $source_known
\r
135 $row($i, $key, $section, $source_data)
\r
138 <tr><td colspan="2" align="center" style="border-bottom:
\r
139 1px solid rgb(153, 153, 153);">User Defined Settings:</td></tr>
\r
142 #for $key in $source_data
\r
143 #if not $key in $source_known
\r
145 $row($i, $key, $section, $source_data)
\r
151 #def add_setting($name, $section)
\r
152 <div style="width: 330px; position: relative;">
\r
153 <div id="add-$name-button" style="width: 330px; position: absolute;
\r
154 left: 0px; top: 0px;">
\r
157 <input type="button" value="Add Setting"
\r
158 onclick="switchDiv('add-$name-field', 'add-$name-');
\r
162 <div id="add-$name-field" style="position: absolute;
\r
163 left: 0px; top: 0px; visibility: hidden;">
\r
164 <table style="width: 315px;">
\r
166 <td colspan="2" align="center" style="border-bottom: 1px solid
\r
167 rgb(153, 153, 153);">Add a Setting</td>
\r
169 <tr><td>Setting Name:</td><td>Setting Value:</td></tr>
\r
171 #for $x in ('setting', 'value')
\r
173 <input size="16" type="text" onChange="saveNotify();"
\r
174 id="$(section).new_$x" name="$(section).new__$x" value="">
\r
183 #set $section_size = 'width: 200px; height: 100%'
\r
184 #set $settings_size = 'width: 350px; height: 100%; overflow: auto'
\r
185 #set $help_size = 'width: 350px; height: 100%; overflow: auto'
\r
187 <p align="center"><font size="6">pyTivo Web Configuration</font>
\r
188 <a href="javascript:switchDiv('help-Instructions', 'help-');">help</a></p>
\r
190 <table style="border: 1px solid rgb(220, 220, 220); height: 85%;
\r
191 background-color: rgb(255, 255, 255); text-align: left; margin-left: auto;
\r
192 margin-right: auto;" border="0" cellpadding="0" cellspacing="4">
\r
196 <td style="border-right: 1px dotted rgb(153, 153, 153);
\r
197 vertical-align: top;">
\r
198 <div id="leftframe" style="position: relative; text-align: center;
\r
200 <form name="select_section">Sections
\r
201 <select name="section" size="7"
\r
202 onclick="switchDiv(options[selectedIndex].value, 'set-');
\r
204 <option value="set-server">Global Server Settings</option>
\r
205 <option value="set-hd_tivos">HD TiVo Settings</option>
\r
206 <option value="set-sd_tivos">SD TiVo Settings</option>
\r
207 #for $name, $data in $shares_data
\r
208 <option value="set-$name">$name</option>
\r
210 #for $name, $data in $tivos_data
\r
211 <option value="set-$name">$name</option>
\r
215 <input name="B4" value="Delete Section" type="button"
\r
216 onclick="deleteSection(select_section.section.selectedIndex)">
\r
217 <input name="B5" value="Add Section" type="button"
\r
218 onclick="switchDiv('set-add', 'set-');return true;"></form>
\r
221 <form method="post">
\r
222 <p align="center"><input name="B1" id="B1" value="Save Changes"
\r
223 type="button" onclick="showData(document.config); return true;">
\r
224 <input id="B2" name="B2" value="Soft Reset pyTivo" type="button"
\r
225 onclick="resetpyTivo();"></p>
\r
230 <td style="vertical-align: top;">
\r
232 <div id="settings" style="$settings_size; position: relative;">
\r
234 <form name="config" method="POST" action="TiVoConnect"
\r
235 onsubmit="fillBlank(); showData(this);">
\r
237 <input type="hidden" name="Command" value="UpdateSettings">
\r
238 <input type="hidden" name="Container" value="$container">
\r
240 <div id="set-server" style="$settings_size; text-align: center;
\r
241 position: absolute; left: 0px; top: 0px; visibility: hidden">
\r
242 <b>Global Server Settings</b><br>
\r
243 $rows('Server', $server_data, $server_known)
\r
244 $add_setting('server', 'Server')
\r
247 <div id="set-hd_tivos" style="$settings_size; text-align: center;
\r
248 position: absolute; left: 0px; top: 0px; visibility: hidden">
\r
249 <b>HD TiVo Settings</b><br>
\r
250 $rows('_tivo_HD', $hd_tivos_data, $hd_tivos_known)
\r
251 $add_setting('hd_tivos', '_tivo_HD')
\r
254 <div id="set-sd_tivos" style="$settings_size; text-align: center;
\r
255 position: absolute; left: 0px; top: 0px; visibility: hidden">
\r
256 <b>SD TiVo Settings</b><br>
\r
257 $rows('_tivo_SD', $sd_tivos_data, $sd_tivos_known)
\r
258 $add_setting('sd_tivos', '_tivo_SD')
\r
261 #set $section_count = 0
\r
262 #set $section_map = ''
\r
263 #for $name, $data in $shares_data
\r
264 #set $section_count += 1
\r
265 #set $section_number = 'section-' + str($section_count)
\r
266 <input type="hidden" name="$name" id="$name" value="$section_number">
\r
267 #set $section_map += $section_number + '|' + $name + ']'
\r
268 <div id="set-$name" style="text-align: center; position: absolute;
\r
269 $settings_size; left: 0px; top: 0px; visibility: hidden">
\r
270 [<input size="20" onChange="saveNotify();" id="$section_number"
\r
271 name="$section_number" value="$name">]<br>
\r
272 $rows($section_number, $data, $shares_known)
\r
273 $add_setting($name, $section_number)
\r
277 #for $name, $data in $tivos_data
\r
278 #set $section_count += 1
\r
279 #set $section_number = 'section-' + str($section_count)
\r
280 <input type="hidden" name="$name" id="$name" value="$section_number">
\r
281 #set $section_map += $section_number + '|' + $name + ']'
\r
282 <div id="set-$name" style="text-align: center; position: absolute;
\r
283 $settings_size; left: 0px; top: 0px; visibility: hidden">
\r
284 [<input size="20" onChange="saveNotify();" id="$section_number"
\r
285 name="$section_number" value="$name">]<br>
\r
286 $rows($section_number, $data, $tivos_known)
\r
287 $add_setting($name, $section_number)
\r
290 <div id="set-add" style="text-align: center;position: absolute; left: 0px;
\r
291 top: 0px; visibility: hidden; $settings_size">
\r
296 <td> Section Name :</td><td>
\r
297 <input onChange="saveNotify();" type="text" size="20"
\r
298 name="new_Section" value=""
\r
299 onfocus="switchDiv('help-Add a New Section', 'help-'); return true;">
\r
301 The new section name will be added to the pyTivo.conf file when
\r
302 you click <b>Save Changes</b>.
\r
304 <div id="set-delete" style="text-align: center; position: absolute;
\r
305 left: 0px; top: 0px; visibility: hidden; $settings_size">
\r
309 The Section has been marked for deletion. However it will not be
\r
310 actually deleted until you click the <b>Save Changes</b> button.
\r
312 <input type="hidden" id="Section_Map" name="Section_Map" value="$section_map">
\r
319 <td style="border-left: 1px dotted rgb(153, 153, 153);
\r
320 vertical-align: top;">
\r
321 <div id="sidesections" style="$help_size; position: relative;">
\r
322 <!-- HELP SECTIONS -->
\r
323 #for $setting in $help_list
\r
324 #if $setting == 'Instructions'
\r
325 #set $vis = 'visible'
\r
327 #set $vis = 'hidden'
\r
329 <div id="help-$setting" style="visibility: $vis; $help_size;
\r
330 position: absolute; left: 0px; top: 0px;">
\r
331 <p align="center"><strong>$setting</strong></p>
\r
332 #for $line in $help_list[$setting]
\r
333 <p><strong>$(line.split(':', 1)[0]):</strong>
\r
334 $(line.split(':', 1)[1])</p>
\r
338 <!-- END HELP SECTIONS -->
\r