| 4 | | |
|---|
| 5 | | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
|---|
| 6 | | <title>pyTivo Web Configuration</title> |
|---|
| 7 | | |
|---|
| 8 | | |
|---|
| 9 | | <script language="javascript" type="text/javascript"> |
|---|
| 10 | | function fillBlank(){ |
|---|
| 11 | | var texts=document.getElementsByTagName('input') |
|---|
| 12 | | for (var i_tem = 0; i_tem < texts.length; i_tem++) |
|---|
| 13 | | if (texts[i_tem].value=='') |
|---|
| 14 | | texts[i_tem].value=' ' |
|---|
| 15 | | } |
|---|
| 16 | | function switchDiv(pass, type){ |
|---|
| 17 | | hideallids(type); |
|---|
| 18 | | showDiv(pass); |
|---|
| 19 | | } |
|---|
| 20 | | function hideallids(type){ |
|---|
| 21 | | //loop through the array and hide each element by id |
|---|
| 22 | | var divs = document.getElementsByTagName('div'); |
|---|
| 23 | | for (var i=0;i<divs.length;i++){ |
|---|
| 24 | | if(divs[i].id.match(type)){ |
|---|
| 25 | | hideDiv(divs[i].id); |
|---|
| 26 | | } |
|---|
| 27 | | } } |
|---|
| 28 | | function hideDiv(pass) { |
|---|
| 29 | | var divs = document.getElementsByTagName('div'); |
|---|
| 30 | | for(i=0;i<divs.length;i++){ |
|---|
| 31 | | if(divs[i].id.match(pass)){//if they are 'see' divs |
|---|
| 32 | | if (document.getElementById) // DOM3 = IE5, NS6 |
|---|
| 33 | | divs[i].style.visibility="hidden";// show/hide |
|---|
| 34 | | else |
|---|
| 35 | | if (document.layers) // Netscape 4 |
|---|
| 36 | | document.layers[divs[i]].display = 'hidden'; |
|---|
| 37 | | else // IE 4 |
|---|
| 38 | | document.all.hideshow.divs[i].visibility = 'hidden'; |
|---|
| 39 | | } |
|---|
| 40 | | } |
|---|
| 41 | | } |
|---|
| 42 | | function showDiv(pass) { |
|---|
| 43 | | var divs = document.getElementsByTagName('div'); |
|---|
| 44 | | for(i=0;i<divs.length;i++){ |
|---|
| 45 | | if(divs[i].id == pass){ |
|---|
| 46 | | if (document.getElementById) |
|---|
| 47 | | divs[i].style.visibility=""; |
|---|
| 48 | | else |
|---|
| 49 | | if (document.layers) // Netscape 4 |
|---|
| 50 | | document.layers[divs[i]].display = ''; |
|---|
| 51 | | else // IE 4 |
|---|
| 52 | | document.all.hideshow.divs[i].visibility = ''; |
|---|
| 53 | | } |
|---|
| 54 | | } |
|---|
| 55 | | } |
|---|
| 56 | | function deleteSection(id){ |
|---|
| 57 | | if (select_section.section.options[id].text == 'Global Server Settings'){ |
|---|
| 58 | | alert('Delete Error:\n\nSorry the Global Server Settings Section is required for pyTivo to run and cannot be deleted'); |
|---|
| 59 | | return true; |
|---|
| 60 | | } |
|---|
| 61 | | var name = select_section.section.options[id].text; |
|---|
| 62 | | var answer = confirm("Are you sure you wish to delete the '" + name + "' Section?") |
|---|
| 63 | | if (answer){ |
|---|
| 64 | | switchDiv('set-delete', 'set-'); |
|---|
| 65 | | select_section.section.options[id] = null; |
|---|
| 66 | | var field = document.getElementById(name).value; |
|---|
| 67 | | document.getElementById(field).value = 'Delete_Me'; |
|---|
| 68 | | saveNotify(); |
|---|
| 69 | | return true; |
|---|
| 70 | | } |
|---|
| 71 | | else{ |
|---|
| 72 | | //Don't delete |
|---|
| 73 | | } |
|---|
| 74 | | } |
|---|
| 75 | | function resetpyTivo(){ |
|---|
| 76 | | var answer = confirm("Are you sure you wish to reset the pyTivo Server? Any unsaved changes will be lost!") |
|---|
| 77 | | if (answer){ |
|---|
| 78 | | window.location="/TiVoConnect?Command=Reset&Container=$container" |
|---|
| 79 | | } |
|---|
| 80 | | else{ |
|---|
| 81 | | //Don't reset |
|---|
| 82 | | } |
|---|
| 83 | | } |
|---|
| 84 | | function showData(form) { |
|---|
| 85 | | var section = "" |
|---|
| 86 | | var setting = "" |
|---|
| 87 | | re=/[\[\]<>|]/; |
|---|
| 88 | | inputs = form.getElementsByTagName("input"); |
|---|
| 89 | | for (i = 0; i < inputs.length; i++){ |
|---|
| 90 | | if (inputs[i].type == 'text' && re.exec(inputs[i].value)){ |
|---|
| 91 | | setting = inputs[i].name; |
|---|
| 92 | | break; |
|---|
| 93 | | } |
|---|
| 94 | | } |
|---|
| 95 | | if (setting != ""){ |
|---|
| 96 | | var map = document.getElementById('Section_Map').value.split(']'); |
|---|
| 97 | | map.pop(); |
|---|
| 98 | | splitSetting = setting.split('.'); |
|---|
| 99 | | for(i=0;i<map.length;i++){ |
|---|
| 100 | | key = map[i].split('|'); |
|---|
| 101 | | //buffer += key[0] + "---" + key[1] + "===" + splitSetting[0] + "\n"; |
|---|
| 102 | | if (splitSetting[0] == 'Server'){ |
|---|
| 103 | | section = 'server'; |
|---|
| 104 | | break; |
|---|
| 105 | | } |
|---|
| 106 | | if (key[0] == splitSetting[0]){ |
|---|
| 107 | | section = key[1]; |
|---|
| 108 | | break; |
|---|
| | 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
|---|
| | 5 | <title>pyTivo Web Configuration</title> |
|---|
| | 6 | <script language="javascript" type="text/javascript"> |
|---|
| | 7 | function fillBlank(){ |
|---|
| | 8 | var texts=document.getElementsByTagName('input'); |
|---|
| | 9 | for (var i_tem = 0; i_tem < texts.length; i_tem++){ |
|---|
| | 10 | if (texts[i_tem].value==''){ |
|---|
| | 11 | texts[i_tem].value=' '; |
|---|
| | 12 | } |
|---|
| 111 | | alert("Invalid Entry:\nSorry these are not allowed \n[]<>|"); |
|---|
| 112 | | switchDiv('set-' + section, 'set-'); |
|---|
| 113 | | document.getElementById(setting).select(); |
|---|
| 114 | | return false; |
|---|
| 115 | | } |
|---|
| 116 | | fillBlank(); |
|---|
| 117 | | document.config.submit(); |
|---|
| 118 | | } |
|---|
| 119 | | function saveNotify(){ |
|---|
| 120 | | document.getElementById('B1').style.fontWeight= 'bold'; |
|---|
| 121 | | document.getElementById('B2').disabled = true; |
|---|
| 122 | | } |
|---|
| 123 | | </script> |
|---|
| | 15 | function switchDiv(pass, type){ |
|---|
| | 16 | hideallids(type); |
|---|
| | 17 | showDiv(pass); |
|---|
| | 18 | } |
|---|
| | 19 | function hideallids(type){ |
|---|
| | 20 | //loop through the array and hide each element by id |
|---|
| | 21 | var divs = document.getElementsByTagName('div'); |
|---|
| | 22 | for (var i=0;i<divs.length;i++){ |
|---|
| | 23 | if(divs[i].id.match(type)){ |
|---|
| | 24 | hideDiv(divs[i].id); |
|---|
| | 25 | } |
|---|
| | 26 | } |
|---|
| | 27 | } |
|---|
| | 28 | function hideDiv(pass) { |
|---|
| | 29 | var divs = document.getElementsByTagName('div'); |
|---|
| | 30 | for(i=0;i<divs.length;i++){ |
|---|
| | 31 | if(divs[i].id.match(pass)){//if they are 'see' divs |
|---|
| | 32 | if (document.getElementById){// DOM3 = IE5, NS6 |
|---|
| | 33 | divs[i].style.visibility="hidden";// show/hide |
|---|
| | 34 | } |
|---|
| | 35 | else{ |
|---|
| | 36 | if (document.layers){ // Netscape 4 |
|---|
| | 37 | document.layers[divs[i]].display = 'hidden'; |
|---|
| | 38 | } |
|---|
| | 39 | else{ // IE 4 |
|---|
| | 40 | document.all.hideshow.divs[i].visibility = 'hidden'; |
|---|
| | 41 | } |
|---|
| | 42 | } |
|---|
| | 43 | } |
|---|
| | 44 | } |
|---|
| | 45 | } |
|---|
| | 46 | function showDiv(pass) { |
|---|
| | 47 | var divs = document.getElementsByTagName('div'); |
|---|
| | 48 | for(i=0;i<divs.length;i++){ |
|---|
| | 49 | if(divs[i].id == pass){ |
|---|
| | 50 | if (document.getElementById){ |
|---|
| | 51 | divs[i].style.visibility=""; |
|---|
| | 52 | } |
|---|
| | 53 | else { |
|---|
| | 54 | if (document.layers){ // Netscape 4 |
|---|
| | 55 | document.layers[divs[i]].display = ''; |
|---|
| | 56 | } |
|---|
| | 57 | else{ // IE 4 |
|---|
| | 58 | document.all.hideshow.divs[i].visibility = ''; |
|---|
| | 59 | } |
|---|
| | 60 | } |
|---|
| | 61 | } |
|---|
| | 62 | } |
|---|
| | 63 | } |
|---|
| | 64 | function deleteSection(id){ |
|---|
| | 65 | if (select_section.section.options[id].text == 'Global Server Settings'){ |
|---|
| | 66 | alert('Delete Error:\n\nSorry the Global Server Settings Section is required for pyTivo to run and cannot be deleted'); |
|---|
| | 67 | return true; |
|---|
| | 68 | } |
|---|
| | 69 | var name = select_section.section.options[id].text; |
|---|
| | 70 | var answer = confirm("Are you sure you wish to delete the '" + name + "' Section?") |
|---|
| | 71 | if (answer){ |
|---|
| | 72 | switchDiv('set-delete', 'set-'); |
|---|
| | 73 | select_section.section.options[id] = null; |
|---|
| | 74 | var field = document.getElementById(name).value; |
|---|
| | 75 | document.getElementById(field).value = 'Delete_Me'; |
|---|
| | 76 | saveNotify(); |
|---|
| | 77 | return true; |
|---|
| | 78 | } |
|---|
| | 79 | } |
|---|
| | 80 | function resetpyTivo(){ |
|---|
| | 81 | var answer = confirm("Are you sure you wish to reset the pyTivo Server? Any unsaved changes will be lost!") |
|---|
| | 82 | if (answer){ |
|---|
| | 83 | window.location="/TiVoConnect?Command=Reset&Container=$container" |
|---|
| | 84 | } |
|---|
| | 85 | } |
|---|
| | 86 | function showData(form) { |
|---|
| | 87 | var section = "" |
|---|
| | 88 | var setting = "" |
|---|
| | 89 | re=/[\[\]<>|]/; |
|---|
| | 90 | inputs = form.getElementsByTagName("input"); |
|---|
| | 91 | for (i = 0; i < inputs.length; i++){ |
|---|
| | 92 | if (inputs[i].type == 'text' && re.exec(inputs[i].value)){ |
|---|
| | 93 | setting = inputs[i].name; |
|---|
| | 94 | break; |
|---|
| | 95 | } |
|---|
| | 96 | } |
|---|
| | 97 | if (setting != ""){ |
|---|
| | 98 | var map = document.getElementById('Section_Map').value.split(']'); |
|---|
| | 99 | map.pop(); |
|---|
| | 100 | splitSetting = setting.split('.'); |
|---|
| | 101 | for(i=0;i<map.length;i++){ |
|---|
| | 102 | key = map[i].split('|'); |
|---|
| | 103 | //buffer += key[0] + "---" + key[1] + "===" + splitSetting[0] + "\n"; |
|---|
| | 104 | if (splitSetting[0] == 'Server'){ |
|---|
| | 105 | section = 'server'; |
|---|
| | 106 | break; |
|---|
| | 107 | } |
|---|
| | 108 | if (key[0] == splitSetting[0]){ |
|---|
| | 109 | section = key[1]; |
|---|
| | 110 | break; |
|---|
| | 111 | } |
|---|
| | 112 | } |
|---|
| | 113 | alert("Invalid Entry:\nSorry these are not allowed \n[]<>|"); |
|---|
| | 114 | switchDiv('set-' + section, 'set-'); |
|---|
| | 115 | document.getElementById(setting).select(); |
|---|
| | 116 | return false; |
|---|
| | 117 | } |
|---|
| | 118 | fillBlank(); |
|---|
| | 119 | document.config.submit(); |
|---|
| | 120 | } |
|---|
| | 121 | function saveNotify(){ |
|---|
| | 122 | document.getElementById('B1').style.fontWeight= 'bold'; |
|---|
| | 123 | document.getElementById('B2').disabled = true; |
|---|
| | 124 | } |
|---|
| | 125 | </script> |
|---|