4 'require tools.widgets as widgets';
9 L
.resolveDefault(fs
.stat('/sbin/block'), null),
10 L
.resolveDefault(fs
.stat('/etc/config/fstab'), null),
13 render: function(stats
) {
16 m
= new form
.Map('cifsd', _('Network Shares'));
18 s
= m
.section(form
.TypedSection
, 'globals');
21 s
.tab('general', _('General Settings'));
22 s
.tab('template', _('Edit Template'));
24 s
.taboption('general', widgets
.NetworkSelect
, 'interface', _('Interface'),
25 _('Listen only on the given interface or, if unspecified, on lan'));
27 o
= s
.taboption('general', form
.Value
, 'workgroup', _('Workgroup'));
28 o
.placeholder
= 'WORKGROUP';
30 o
= s
.taboption('general', form
.Value
, 'description', _('Description'));
31 o
.placeholder
= 'Cifsd on OpenWrt';
33 o
= s
.taboption('template', form
.TextValue
, '_tmpl',
34 _('Edit the template that is used for generating the cifsd configuration.'),
35 _("This is the content of the file '/etc/cifs/smb.conf.template' from which your cifsd configuration will be generated. \
36 Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab."));
38 o
.cfgvalue = function(section_id
) {
39 return fs
.trimmed('/etc/cifs/smb.conf.template');
41 o
.write = function(section_id
, formvalue
) {
42 return fs
.write('/etc/cifs/smb.conf.template', formvalue
.trim().replace(/\r\n/g
, '\n') + '\n');
46 s
= m
.section(form
.TableSection
, 'share', _('Shared Directories'),
47 _('Please add directories to share. Each directory refers to a folder on a mounted device.'));
51 s
.option(form
.Value
, 'name', _('Name'));
52 o
= s
.option(form
.Value
, 'path', _('Path'));
53 if (stats
[0] && stats
[1]) {
54 o
.titleref
= L
.url('admin', 'system', 'mounts');
57 o
= s
.option(form
.Flag
, 'browseable', _('Browse-able'));
62 o
= s
.option(form
.Flag
, 'read_only', _('Read-only'));
67 s
.option(form
.Flag
, 'force_root', _('Force Root'));
69 o
= s
.option(form
.Value
, 'users', _('Allowed users'));
72 o
= s
.option(form
.Flag
, 'guest_ok', _('Allow guests'));
77 o
= s
.option(form
.Flag
, 'inherit_owner', _('Inherit owner'));
82 s
.option(form
.Flag
, 'hide_dot_files', _('Hide dot files'));
84 o
= s
.option(form
.Value
, 'create_mask', _('Create mask'));
87 o
.placeholder
= '0666';
89 o
= s
.option(form
.Value
, 'dir_mask', _('Directory mask'));
92 o
.placeholder
= '0777';