1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2009 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.
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>
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
);
38 function verifyFields(focused
, quiet
)
41 var unc
, user
, pass
, dom
, exec
;
43 for (i
= 1; i
<= 2; ++i
) {
46 user
= E(p
+ '_user');
47 pass
= E(p
+ '_pass');
49 exec
= E(p
+ '_exec');
51 b
= !E(p
+ '_enable').checked
;
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
);
68 ferror
.clear(unc
, user
, pass
, dom
, exec
);
79 if (!verifyFields(null, 0)) return;
81 for (i
= 1; i
<= 2; ++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);
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>
98 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
100 <div id='ident'
><%
ident(); %></div>
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('', [
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
: 32, 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)' },
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
: 32, size
: 34, value
: b
[2] },
136 { title
: 'Password', indent
: 2, name
: 'f_cifs2_pass', type
: 'password', maxlen
: 32, 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)' }
144 <script type='text/javascript'
>show_notice1('<% notice("cifs"); %>');</script>
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();'
>
157 <script type='text/javascript'
>verifyFields(null, 1);</script>