Module: Yast::IplbGlobalConfInclude

Defined in:
../../src/include/iplb/global_conf.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) fill_global_entries

fill the widgets accord to the Iplb::global_conf



116
117
118
119
120
121
122
123
124
125
126
127
128
# File '../../src/include/iplb/global_conf.rb', line 116

def fill_global_entries
  l_global_conf = deep_copy(Iplb.global_conf)

  Builtins.foreach(@global_entries) do |key|
    name = Builtins.substring(Builtins.tostring(key), 1) # remove '`' char
    val = Ops.get_string(l_global_conf, name, "")
    if Ops.greater_than(Builtins.size(val), 0)
      UI.ChangeWidget(key, :Value, val)
    end
  end

  nil
end

- (Object) global_dialog

the entry to golbal configure stuff return ok,cancel or `vserver_tab



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File '../../src/include/iplb/global_conf.rb', line 159

def global_dialog
  ret = nil

  my_SetContents("global_conf", global_layout)
  fill_global_entries

  while true
    ret = UI.UserInput

    myHelp("global_conf") if ret == :help

    break if ret == :cancel && ReallyAbort()

    break if ret == :ok || ret == :vserver_tab
  end

  retrieve_global_entries
  deep_copy(ret)
end

- (Object) global_layout



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
# File '../../src/include/iplb/global_conf.rb', line 64

def global_layout
  VBox(
    DumbTab(
      [
        Item(Id(:global_tab), _("&Global Configuration"), true),
        Item(Id(:vserver_tab), _("&Virtual Server Configuration"))
      ],
      VBox(
        VSpacing(0.7),
        HBox(
          HSpacing(0.7),
          TextEntry(Id(:checkinterval), _("Check Interval"), ""),
          TextEntry(Id(:checktimeout), _("Check Timeout"), ""),
          HSpacing(3),
          TextEntry(Id(:failurecount), _("Failure Count"), ""),
          TextEntry(Id(:negotiatetimeout), _("Negotiate Timeout"), "")
        ),
        VSpacing(1),
        HBox(
          HSpacing(0.7),
          VBox(
            TextEntry(Id(:fallback), _("Fallback"), ""),
            TextEntry(Id(:callback), _("Callback"), ""),
            TextEntry(Id(:execute), _("Execute"), "")
          ),
          HSpacing(3),
          VBox(
            TextEntry(Id(:emailalert), _("Email Alert"), ""),
            TextEntry(Id(:emailalertfreq), _("Email Alert Freq"), ""),
            TextEntry(Id(:emailalertstatus), _("Email Alert Status"), "")
          )
        ),
        VSpacing(2),
        HBox(
          HSpacing(0.7),
          HBox(
            ComboBox(Id(:autoreload), _("Auto Reload"), @yesno),
            ComboBox(Id(:quiescent), _("Quiescent"), @yesno),
            ComboBox(Id(:fork), _("Fork"), @yesno),
            ComboBox(Id(:supervised), _("Supervised"), @yesno)
          ),
          HSpacing(3),
          VBox(TextEntry(Id(:logfile), _("Log File"), ""))
        ),
        VStretch()
      )
    )
  )
end

- (Object) initialize_iplb_global_conf(include_target)



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File '../../src/include/iplb/global_conf.rb', line 32

def initialize_iplb_global_conf(include_target)
  textdomain "iplb"
  Yast.import "Label"
  Yast.import "Wizard"
  Yast.import "Iplb"

  Yast.include include_target, "iplb/helps.rb"
  Yast.include include_target, "iplb/common.rb"


  # ids of widget of global dialog
  @global_entries = [
    :checkinterval,
    :checktimeout,
    :failurecount,
    :negotiatetimeout,
    :fallback,
    :logfile,
    :emailalert,
    :emailalertfreq,
    :emailalertstatus,
    :callback,
    :execute,
    :autoreload,
    :quiescent,
    :fork,
    :supervised
  ]

  @yesno = ["", _("yes"), _("no")]
end

- (Object) retrieve_global_entries

retrieve the value from widgets, save to Iplb::global_conf



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File '../../src/include/iplb/global_conf.rb', line 132

def retrieve_global_entries
  l_global_conf = deep_copy(Iplb.global_conf)

  Builtins.foreach(@global_entries) do |key|
    name = Builtins.substring(Builtins.tostring(key), 1) # remove '`' char
    val_old = Ops.get_string(l_global_conf, name, "")
    val_new = Convert.to_string(UI.QueryWidget(key, :Value))
    if Ops.greater_than(Builtins.size(val_new), 0)
      Ops.set(l_global_conf, name, val_new)
    elsif Ops.greater_than(Builtins.size(val_old), 0)
      # assigning nil to remove it from conf file
      Ops.set(l_global_conf, name, nil)
    end
  end

  Iplb.global_conf = Convert.convert(
    l_global_conf,
    :from => "map",
    :to   => "map <string, string>"
  )

  nil
end