Get rid of "Interrupted service call" messages in syslog
[tomato.git] / release / src / router / www / admin-cifs.asp
blobc505015b3adcdb68dd969e872087b08a9cad9175
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2008 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Admin: CIFS Client</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <script type='text/javascript' src='debug.js'></script>
23 <script type='text/javascript'>
25 // <% nvram("cifs1,cifs2"); %>
27 function v_nodelim(e, quiet, name)
29 e.value = e.value.trim();
30 if (e.value.indexOf('<') != -1) {
31 ferror.set(e, 'Invalid ' + name, quiet);
32 return 0;
34 ferror.clear(e);
35 return 1;
38 function verifyFields(focused, quiet)
40 var i, p, b;
41 var unc, user, pass, dom, exec;
43 for (i = 1; i <= 2; ++i) {
44 p = '_f_cifs' + i;
45 unc = E(p + '_unc');
46 user = E(p + '_user');
47 pass = E(p + '_pass');
48 dom = E(p + '_dom');
49 exec = E(p + '_exec');
51 b = !E(p + '_enable').checked;
52 unc.disabled = b;
53 user.disabled = b;
54 pass.disabled = b;
55 exec.disabled = b;
56 dom.disabled = b;
57 if (!b) {
58 if ((!v_nodelim(unc, quiet, 'UNC')) || (!v_nodelim(user, quiet, 'username')) || (!v_nodelim(pass, quiet, 'password')) ||
59 (!v_nodelim(dom, quiet, 'domain')) || (!v_nodelim(exec, quiet, 'exec path'))) return 0;
60 if ((!v_length(user, quiet, 1)) || (!v_length(pass, quiet, 1))) return 0;
61 unc.value = unc.value.replace(/\//g, '\\');
62 if (!unc.value.match(/^\\\\.+\\/)) {
63 ferror.set(unc, 'Invalid UNC', quiet);
64 return 0;
67 else {
68 ferror.clear(unc, user, pass, dom, exec);
72 return 1;
75 function save()
77 var i, p;
79 if (!verifyFields(null, 0)) return;
81 for (i = 1; i <= 2; ++i) {
82 p = '_f_cifs' + i;
83 E('cifs' + i).value = (E(p + '_enable').checked ? '1' : '0') + '<' + E(p + '_unc').value + '<' +
84 E(p + '_user').value + '<' + E(p + '_pass').value + '<' + E(p + '_dom').value + '<' + E(p + '_exec').value
86 form.submit('_fom', 0);
88 </script>
90 </head>
91 <body>
92 <form id='_fom' method='post' action='tomato.cgi'>
93 <table id='container' cellspacing=0>
94 <tr><td colspan=2 id='header'>
95 <div class='title'>Tomato</div>
96 <div class='version'>Version <% version(); %></div>
97 </td></tr>
98 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
99 <td id='content'>
100 <div id='ident'><% ident(); %></div>
102 <!-- / / / -->
104 <input type='hidden' name='_nextpage' value='admin-cifs.asp'>
105 <input type='hidden' name='_nextwait' value='10'>
106 <input type='hidden' name='_service' value='cifs-restart'>
108 <input type='hidden' name='cifs1' id='cifs1'>
109 <input type='hidden' name='cifs2' id='cifs2'>
111 <div class='section-title'>CIFS Client</div>
112 <div class='section'>
113 <script type='text/javascript'>
114 a = b = [0, '\\\\192.168.1.5\\shared_example', '', '', '', ''];
116 if (r = nvram.cifs1.match(/^(0|1)<(\\\\.+)<(.*)<(.*)<(.*)<(.*)$/)) a = r.splice(1, 6);
117 if (r = nvram.cifs2.match(/^(0|1)<(\\\\.+)<(.*)<(.*)<(.*)<(.*)$/)) b = r.splice(1, 6);
119 // <% statfs("/cifs1", "cifs1"); %>
120 // <% statfs("/cifs2", "cifs2"); %>
122 createFieldTable('', [
123 { title: '/cifs1' },
124 { title: 'Enable', indent: 2, name: 'f_cifs1_enable', type: 'checkbox', value: a[0]*1 },
125 { title: 'UNC', indent: 2, name: 'f_cifs1_unc', type: 'text', maxlen: 128, size: 64, value: a[1] },
126 { title: 'Username', indent: 2, name: 'f_cifs1_user', type: 'text', maxlen: 32, size: 34, value: a[2] },
127 { title: 'Password', indent: 2, name: 'f_cifs1_pass', type: 'password', maxlen: 16, size: 34, value: a[3] },
128 { title: 'Domain', indent: 2, name: 'f_cifs1_dom', type: 'text', maxlen: 32, size: 34, value: a[4] },
129 { title: 'Execute When Mounted', indent: 2, name: 'f_cifs1_exec', type: 'text', maxlen: 64, size: 34, value: a[5] },
130 { title: 'Total / Free Size', indent: 2, text: cifs1.size ? (scaleSize(cifs1.size) + ' / ' + scaleSize(cifs1.free)) : '(not mounted)' },
131 null,
132 { title: '/cifs2' },
133 { title: 'Enable', indent: 2, name: 'f_cifs2_enable', type: 'checkbox', value: b[0]*1 },
134 { title: 'UNC', indent: 2, name: 'f_cifs2_unc', type: 'text', maxlen: 128, size: 64, value: b[1] },
135 { title: 'Username', indent: 2, name: 'f_cifs2_user', type: 'text', maxlen: 64, size: 34, value: b[2] },
136 { title: 'Password', indent: 2, name: 'f_cifs2_pass', type: 'password', maxlen: 16, size: 34, value: b[3] },
137 { title: 'Domain', indent: 2, name: 'f_cifs2_dom', type: 'text', maxlen: 32, size: 34, value: b[4] },
138 { title: 'Execute When Mounted', indent: 2, name: 'f_cifs2_exec', type: 'text', maxlen: 64, size: 34, value: b[5] },
139 { title: 'Total / Free Size', indent: 2, text: cifs2.size ? (scaleSize(cifs2.size) + ' / ' + scaleSize(cifs2.free)) : '(not mounted)' }
141 </script>
142 </div>
144 <script type='text/javascript'>show_notice1('<% notice("cifs"); %>');</script>
147 <!-- / / / -->
149 </td></tr>
150 <tr><td id='footer' colspan=2>
151 <span id='footer-msg'></span>
152 <input type='button' value='Save' id='save-button' onclick='save()'>
153 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
154 </td></tr>
155 </table>
156 </form>
157 <script type='text/javascript'>verifyFields(null, 1);</script>
158 </body>
159 </html>