Module: Yast::NisServerDetailsInclude

Defined in:
../../src/include/nis_server/details.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) DetailsDialog

Details dialog

Returns:

  • back,abort or `next



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

  # help text 1/3
  helptext = _(
    "<p>You can change NIS server source directory (usually\n<i>'/etc'</i>).</p>"
  )

  # help text 2/3
  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"
    )
  )

  # help text 3/3
  helptext = Ops.add(
    helptext,
    _("<p>You can also adjust the minimum user and group id.</p>")
  )

  minimals = HBox(
    # To translators: intfield label
    IntField(Id(:minuid), _("Minimum &UID"), 0, 50000, minuid),
    HSpacing(),
    # To translators: intfield label
    IntField(Id(:mingid), _("Minimum &GID"), 0, 50000, mingid)
  )

  contents = HVSquash(
    VBox(
      InputField(
        Id(:srcdir),
        Opt(:notify, :hstretch),
        # To translators: textentry label
        _("&YP Source directory"),
        srcdir
      ),
      VSpacing(0.5),
      # check box label
      Left(CheckBox(Id(:merge_passwd), _("Merge pa&sswords"), merge_passwd)),
      VSpacing(0.5),
      minimals
    )
  )

  # To translators: dialog label
  Wizard.SetContents(
    _("NIS Master Server Details Setup"),
    contents,
    helptext,
    true,
    true
  )

  Wizard.SetBackButton(:back, Label.CancelButton)
  Wizard.SetNextButton(:next, Label.OKButton)
  Wizard.HideAbortButton

  # If the source directory does not exist, it will be created
  # with empty passwd, group, shadow
  # If it already exists, check whether shadow exist
  # and disable some options accordingly.
  # (#15624)
  srcdir_exists = nil
  shadow_exists = nil
  change_enabled = true

  ui = :again
  begin
    if change_enabled
      # srcdir now has an up-to-date value
      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

- (Object) initialize_nis_server_details(include_target)



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File '../../src/include/nis_server/details.rb', line 41

def initialize_nis_server_details(include_target)
  Yast.import "UI"

  textdomain "nis_server"

  Yast.import "Label"
  Yast.import "Message"
  Yast.import "Mode"
  Yast.import "NisServer"
  Yast.import "Popup"
  Yast.import "Wizard"

  Yast.include include_target, "nis_server/routines.rb"
end