dnscrypto-proxy: Update to release 1.3.0
[tomato.git] / release / src / router / www / tools-shell.asp
blob553bf795f5c59528e2a9a337f185ff73fd69b541
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
5 For use with Tomato Firmware only.
6 No part of this file may be used without permission.
7 -->
8 <html>
9 <head>
10 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
11 <meta name='robots' content='noindex,nofollow'>
12 <title>[<% ident(); %>] Tools: System Commands</title>
13 <link rel='stylesheet' type='text/css' href='tomato.css'>
14 <link rel='stylesheet' type='text/css' href='color.css'>
15 <script type='text/javascript' src='tomato.js'></script>
17 <!-- / / / -->
19 <style type='text/css'>
20 textarea {
21 font: 12px monospace;
22 width: 99%;
23 height: 12em;
25 </style>
27 <script type='text/javascript' src='debug.js'></script>
28 <script type='text/javascript'>
30 // <% nvram(''); %> // http_id
32 var cmdresult = '';
33 var cmd = null;
38 var ref = new TomatoRefresh('update.cgi', '', 0, 'tools-shell_refresh');
40 ref.refresh = function(text)
42 execute();
47 function verifyFields(focused, quiet)
49 return 1;
52 function escapeText(s)
54 function esc(c) {
55 return '&#' + c.charCodeAt(0) + ';';
57 return s.replace(/[&"'<>]/g, esc).replace(/\n/g, ' <br>').replace(/ /g, '&nbsp;');
60 function spin(x)
62 E('execb').disabled = x;
63 E('_f_cmd').disabled = x;
64 E('wait').style.visibility = x ? 'visible' : 'hidden';
65 if (!x) cmd = null;
68 function updateResult()
70 E('result').innerHTML = '<tt>' + escapeText(cmdresult) + '</tt>';
71 cmdresult = '';
72 spin(0);
75 function execute()
77 // Opera 8 sometimes sends 2 clicks
78 if (cmd) return;
79 spin(1);
81 cmd = new XmlHttp();
82 cmd.onCompleted = function(text, xml) {
83 eval(text);
84 updateResult();
86 cmd.onError = function(x) {
87 cmdresult = 'ERROR: ' + x;
88 updateResult();
91 var s = E('_f_cmd').value;
92 cmd.post('shell.cgi', 'action=execute&command=' + escapeCGI(s.replace(/\r/g, '')));
93 cookie.set('shellcmd', escape(s));
96 function init()
98 var s;
99 if ((s = cookie.get('shellcmd')) != null) E('_f_cmd').value = unescape(s);
101 if (((s = cookie.get('tools_shell_notes_vis')) != null) && (s == '1')) {
102 toggleVisibility("notes");
106 function toggleVisibility(whichone) {
107 if (E('sesdiv_' + whichone).style.display == '') {
108 E('sesdiv_' + whichone).style.display = 'none';
109 E('sesdiv_' + whichone + '_showhide').innerHTML = '(Click here to show)';
110 cookie.set('status_overview_' + whichone + '_vis', 0);
111 } else {
112 E('sesdiv_' + whichone).style.display='';
113 E('sesdiv_' + whichone + '_showhide').innerHTML = '(Click here to hide)';
114 cookie.set('status_overview_' + whichone + '_vis', 1);
118 </script>
120 </head>
122 <body onload='init()'>
123 <form action='javascript:{}'>
124 <table id='container' cellspacing=0>
125 <tr><td colspan=2 id='header'>
126 <div class='title'>Tomato</div>
127 <div class='version'>Version <% version(); %></div>
128 </td></tr>
129 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
130 <td id='content'>
131 <div id='ident'><% ident(); %></div>
133 <!-- / / / -->
135 <div class='section-title'>Execute System Commands</div>
136 <div class='section'>
137 <script type='text/javascript'>
138 createFieldTable('', [
139 { title: 'Command', name: 'f_cmd', type: 'textarea', wrap: 'off', value: '' }
141 </script>
142 <div style='float:left'><input type='button' value='Execute' onclick='execute()' id='execb'></div>
143 <script type='text/javascript'>genStdRefresh(1,1,'ref.toggle()');</script>
144 </div>
146 <div class='section-title'>Notes <small><i><a href='javascript:toggleVisibility("notes");'><span id='sesdiv_notes_showhide'>(Click here to show)</span></a></i></small></div>
147 <div class='section' id='sesdiv_notes' style='display:none'>
148 <ul>
149 <li><b>TIP</b> - Use the command "nvram export --set" or "nvram export --set | grep qos" to cut and paste configuration
150 </ul>
151 </div>
154 <div style="visibility:hidden;text-align:right" id="wait">Please wait... <img src='spin.gif' style="vertical-align:top"></div>
155 <pre id='result'></pre>
157 <!-- / / / -->
159 </td></tr>
160 <tr><td id='footer' colspan=2>&nbsp;</td></tr>
161 </table>
162 </form>
163 </body>
164 </html>