luci-app-cifsd: fix typo
[project/luci.git] / applications / luci-app-cifsd / htdocs / luci-static / resources / view / cifsd.js
1 'use strict';
2 'require fs';
3 'require form';
4 'require tools.widgets as widgets';
5
6 return L.view.extend({
7 load: function() {
8 return Promise.all([
9 L.resolveDefault(fs.stat('/sbin/block'), null),
10 L.resolveDefault(fs.stat('/etc/config/fstab'), null),
11 ]);
12 },
13 render: function(stats) {
14 var m, s, o;
15
16 m = new form.Map('cifsd', _('Network Shares'));
17
18 s = m.section(form.TypedSection, 'globals');
19 s.anonymous = true;
20
21 s.tab('general', _('General Settings'));
22 s.tab('template', _('Edit Template'));
23
24 s.taboption('general', widgets.NetworkSelect, 'interface', _('Interface'),
25 _('Listen only on the given interface or, if unspecified, on lan'));
26
27 o = s.taboption('general', form.Value, 'workgroup', _('Workgroup'));
28 o.placeholder = 'WORKGROUP';
29
30 o = s.taboption('general', form.Value, 'description', _('Description'));
31 o.placeholder = 'Cifsd on OpenWrt';
32
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."));
37 o.rows = 20;
38 o.cfgvalue = function(section_id) {
39 return fs.trimmed('/etc/cifs/smb.conf.template');
40 };
41 o.write = function(section_id, formvalue) {
42 return fs.write('/etc/cifs/smb.conf.template', formvalue.trim().replace(/\r\n/g, '\n') + '\n');
43 };
44
45
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.'));
48 s.anonymous = true;
49 s.addremove = true;
50
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');
55 }
56
57 o = s.option(form.Flag, 'browseable', _('Browse-able'));
58 o.enabled = 'yes';
59 o.disabled = 'no';
60 o.default = 'yes';
61
62 o = s.option(form.Flag, 'read_only', _('Read-only'));
63 o.enabled = 'yes';
64 o.disabled = 'no';
65 o.default = 'yes';
66
67 s.option(form.Flag, 'force_root', _('Force Root'));
68
69 o = s.option(form.Value, 'users', _('Allowed users'));
70 o.rmempty = true;
71
72 o = s.option(form.Flag, 'guest_ok', _('Allow guests'));
73 o.enabled = 'yes';
74 o.disabled = 'no';
75 o.default = 'no';
76
77 o = s.option(form.Flag, 'inherit_owner', _('Inherit owner'));
78 o.enabled = 'yes';
79 o.disabled = 'no';
80 o.default = 'no';
81
82 s.option(form.Flag, 'hide_dot_files', _('Hide dot files'));
83
84 o = s.option(form.Value, 'create_mask', _('Create mask'));
85 o.rmempty = true;
86 o.maxlength = 4;
87 o.placeholder = '0666';
88
89 o = s.option(form.Value, 'dir_mask', _('Directory mask'));
90 o.rmempty = true;
91 o.maxlength = 4;
92 o.placeholder = '0777';
93
94 return m.render();
95 }
96 });