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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File '../../src/include/nis_server/details.rb', line 58
def DetailsDialog
srcdir = NisServer.pwd_srcdir
minuid = NisServer.minuid
mingid = NisServer.mingid
merge_passwd = NisServer.merge_passwd
helptext = _(
"<p>You can change NIS server source directory (usually\n<i>'/etc'</i>).</p>"
)
helptext = Ops.add(
helptext,
_(
"<p>Select if your <i>passwd</i> file should be merged with the <i>shadow</i>\nfile (only possible if the <i>shadow</i> file exists).</p>\n"
)
)
helptext = Ops.add(
helptext,
_("<p>You can also adjust the minimum user and group id.</p>")
)
minimals = HBox(
IntField(Id(:minuid), _("Minimum &UID"), 0, 50000, minuid),
HSpacing(),
IntField(Id(:mingid), _("Minimum &GID"), 0, 50000, mingid)
)
contents = HVSquash(
VBox(
InputField(
Id(:srcdir),
Opt(:notify, :hstretch),
_("&YP Source directory"),
srcdir
),
VSpacing(0.5),
Left(CheckBox(Id(:merge_passwd), _("Merge pa&sswords"), merge_passwd)),
VSpacing(0.5),
minimals
)
)
Wizard.SetContents(
_("NIS Master Server Details Setup"),
contents,
helptext,
true,
true
)
Wizard.SetBackButton(:back, Label.CancelButton)
Wizard.SetNextButton(:next, Label.OKButton)
Wizard.HideAbortButton
srcdir_exists = nil
shadow_exists = nil
change_enabled = true
ui = :again
begin
if change_enabled
srcdir_exists = SCR.Read(path(".target.dir"), srcdir) != nil
shadow_exists = !srcdir_exists ||
SCR.Read(
path(".target.size"),
Builtins.sformat("%1/shadow", srcdir)
) != -1
UI.ChangeWidget(Id(:merge_passwd), :Enabled, shadow_exists)
end
ui = Convert.to_symbol(UI.UserInput)
ui = :abort if ui == :cancel
change_enabled = ui == :srcdir
srcdir = Convert.to_string(UI.QueryWidget(Id(:srcdir), :Value))
ui = :again if ui == :abort && !Popup.ReallyAbort(NisServer.modified)
if ui == :next
if SCR.Read(path(".target.dir"), srcdir) == nil && !Mode.config
UI.SetFocus(Id(:srcdir))
ui = Popup.YesNo(Message.DirectoryDoesNotExistCreate(srcdir)) ? :next : :again
end
merge_passwd = Convert.to_boolean(
UI.QueryWidget(Id(:merge_passwd), :Value)
)
minuid = Convert.to_integer(UI.QueryWidget(Id(:minuid), :Value))
mingid = Convert.to_integer(UI.QueryWidget(Id(:mingid), :Value))
if NisServer.minuid != minuid || NisServer.mingid != mingid ||
NisServer.merge_passwd != merge_passwd ||
NisServer.pwd_srcdir != srcdir
NisServer.modified = true
NisServer.minuid = minuid
NisServer.mingid = mingid
NisServer.merge_passwd = merge_passwd
NisServer.pwd_srcdir = srcdir
end
end
end until Builtins.contains([:back, :next, :abort], ui)
Wizard.RestoreBackButton
Wizard.RestoreNextButton
Wizard.RestoreAbortButton
ui
end
|