56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File '../../src/include/nis_server/maps.rb', line 56
def MapsDialog
helptext = _(
"<p>With this dialog, adjust which maps will be available.</p>"
)
all = NisServer.GetAllMaps
passwd_tables = ["passwd", "group", "passwd.adjunct", "shadow"]
passwd_dir = NisServer.pwd_srcdir
files = Builtins.listmap(all) do |table|
{ table => Builtins.sformat("/etc/%1", table) }
end
Builtins.foreach(passwd_tables) do |table|
Ops.set(files, table, Builtins.sformat("%1/%2", passwd_dir, table))
end
Ops.set(files, "netgrp", "/etc/netgroup")
Ops.set(files, "mail", "/etc/mail/aliases")
enabled = Builtins.listmap(all) { |table| { table => false } }
enabled = Builtins.remove(enabled, "shadow") if NisServer.merge_passwd
enabled = Builtins.filter(enabled) do |table, dummy|
Ops.greater_or_equal(
SCR.Read(path(".target.size"), Ops.get_string(files, table, "/")),
0
)
end
current = deep_copy(NisServer.maps)
Builtins.foreach(current) { |table| Ops.set(enabled, table, true) }
items = Builtins.maplist(enabled) { |table, e| Item(Id(table), table, e) }
contents = MultiSelectionBox(
Id(:current),
_("&Maps"),
items
)
Wizard.SetContents(
_("NIS Server Maps Setup"),
contents,
helptext,
true,
true
)
ui = nil
begin
ui = Convert.to_symbol(UI.UserInput)
ui = :abort if ui == :cancel
ui = :again if ui == :abort && !Popup.ReallyAbort(NisServer.modified)
end until Builtins.contains([:back, :next, :abort], ui)
current = Convert.convert(
UI.QueryWidget(Id(:current), :SelectedItems),
:from => "any",
:to => "list <string>"
)
if ui == :next && Builtins.sort(current) != Builtins.sort(NisServer.maps)
NisServer.maps = deep_copy(current)
NisServer.modified = true
end
ui
end
|