Module: Yast::HttpServerDialogsInclude

Defined in:
../../src/include/http-server/dialogs.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) Abort

Abort dialog

Returns:

  • (Boolean)

    do abort



101
102
103
# File '../../src/include/http-server/dialogs.rb', line 101

def Abort
  !HttpServer.modified || Popup.ReallyAbort(true)
end

- (Symbol) AddHost

Return wizard for adding new virtual host

Returns:

  • (Symbol)

    (browse,abort, cancel,next)



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File '../../src/include/http-server/dialogs.rb', line 227

def AddHost
  w = CWM.CreateWidgets(
    ["vhost_id", "vhost_res"],
    HttpServerWidgets.widgets
  )
  contents = HBox(
    HSpacing(0.5),
    VBox(
      Ops.get_term(w, [0, "widget"]) { VSpacing(0) },
      VSpacing(1),
      Ops.get_term(w, [1, "widget"]) { VSpacing(0) },
      HSpacing(0.5)
    )
  )

  # translators: dialog caption
  caption = _("New Host Information")

  help = Ops.get_string(@HELPS, "add_host_general", "")


  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.NextButton
  )

  CWM.Run(w, { :abort => fun_ref(method(:Abort), "boolean ()") })
end

- (Symbol) DirDialog

Directory dialog

Returns:

  • (Symbol)

    from directory widget



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File '../../src/include/http-server/dialogs.rb', line 340

def DirDialog
  w = CWM.CreateWidgets(["dir_name", "dir"], HttpServerWidgets.widgets)
  contents = HBox(
    HSpacing(0.5),
    VBox(
      Ops.get_term(w, [0, "widget"]) { VSpacing(0) },
      VSpacing(1),
      Ops.get_term(w, [1, "widget"]) { VSpacing(0) },
      HSpacing(0.5)
    )
  )

  # translators: dialog caption, %1 is the host name
  caption = Builtins.sformat(
    _("Dir Configuration for '%1'"),
    # translators: human-readable "default host"
    HttpServerWidgets.currenthost == "defaulthost" ?
      _("Default Host") :
      HttpServerWidgets.get_host_value(
        "ServerName",
        YaST::HTTPDData.GetHost(HttpServerWidgets.currenthost),
        HttpServerWidgets.currenthost
      )
  )

  help = CWM.MergeHelps(w)

  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.OKButton
  )

  CWM.Run(w, { :abort => fun_ref(method(:Abort), "boolean ()") })
end

- (Symbol) HostDialog

Run single host configuration dialog

Returns:

  • (Symbol)

    for wizard sequencer



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File '../../src/include/http-server/dialogs.rb', line 155

def HostDialog
  w = CWM.CreateWidgets(["host", "vhost_res"], HttpServerWidgets.widgets)
  contents = HBox(
    HSpacing(1),
    VBox(
      VSpacing(1),
      Ops.get_term(w, [0, "widget"]) { VSpacing(1) },
      Ops.get_term(w, [1, "widget"]) { VSpacing(1) }
    ),
    HSpacing(1)
  )

  # translators: dialog caption
  caption = Builtins.sformat(
    _("Host '%1' Configuration"),
    # translators: human-readable "default host"
    HttpServerWidgets.currenthost == "main" ?
      _("Main Host") :
      HttpServerWidgets.get_host_value(
        "ServerName",
        YaST::HTTPDData.GetHost(HttpServerWidgets.currenthost),
        HttpServerWidgets.currenthost
      )
  )

  help = CWM.MergeHelps(w)

  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.OKButton
  )

  ret = CWM.Run(
    w,
    { :abort => fun_ref(method(:ReallyAbort), "boolean ()") }
  )
  HttpServerWidgets.setHostOptions(nil) if ret == :back
  ret
end

- (Symbol) HostsDialog

Run virtual host list dialog

Returns:

  • (Symbol)

    for wizard sequencer



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File '../../src/include/http-server/dialogs.rb', line 201

def HostsDialog
  w = CWM.CreateWidgets(["hosts"], HttpServerWidgets.widgets)
  contents = HBox(
    HSpacing(1),
    VBox(VSpacing(1), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, VSpacing(
      1
    )),
    HSpacing(1)
  )

  # dialog caption
  caption = _("Configured Hosts")
  help = CWM.MergeHelps(w)

  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.OKButton
  )

  CWM.Run(w, { :abort => fun_ref(method(:Abort), "boolean ()") })
end

- (Object) initialize_http_server_dialogs(include_target)



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
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
# File '../../src/include/http-server/dialogs.rb', line 11

def initialize_http_server_dialogs(include_target)
  textdomain "http-server"

  Yast.import "YaST::HTTPDData"
  Yast.import "HttpServer"
  Yast.import "HttpServerWidgets"

  Yast.import "Mode"
  Yast.import "Popup"
  Yast.import "ProductFeatures"
  Yast.import "Label"
  Yast.import "CWM"
  Yast.import "CWMTab"
  Yast.import "Wizard"
  Yast.import "Service"
  Yast.import "TablePopup"
  Yast.import "Package"


  @tabs_descr = {
    "listen"    => {
      "header"       => _("Listen Ports and Addresses"),
      "contents"     => HBox(
        HStretch(),
        HSpacing(1),
        VBox(
          "server_enable", #,
          #			    `VSpacing(1)
          #		            `VSpacing (1),
          "LISTEN",
          #			    `VSpacing (1),
          "firewall_adapt",
          #		            `VSpacing (1),
          "logs"
        ),
        #			`HSpacing (1),
        HStretch()
      ),
      "widget_names" => [
        "server_enable",
        "LISTEN",
        "firewall_adapt",
        "logs"
      ]
    },
    "modules"   => {
      "header"       => _("Server Modules"),
      "contents"     => HBox(
        HSpacing(1),
        VBox(VSpacing(1), "MODULES", VSpacing(1)),
        HSpacing(1)
      ),
      "widget_names" => ["MODULES"]
    },
    "main_host" => {
      "header"       => _("Main Host"),
      "contents"     => HBox(
        HSpacing(1),
        VBox(VSpacing(1), "MAIN_HOST", VSpacing(1)),
        HSpacing(1)
      ),
      "widget_names" => ["MAIN_HOST"]
    },
    "hosts"     => {
      "header"       => _("Hosts"),
      "contents"     => HBox(
        HSpacing(1),
        VBox(
          VSpacing(1), #, `PushButton( `id( `set_default ), _("Set as De&fault") )
          "HOSTS",
          #`PushButton( `id( `set_default ), _("Set as De&fault") ),
          VSpacing(1)
        ),
        HSpacing(1)
      ),
      "widget_names" => ["HOSTS"]
    }
  }

  @descr = []
end

- (Symbol) OverviewDialog

Run server overview dialog

Returns:

  • (Symbol)

    for wizard sequencer



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
# File '../../src/include/http-server/dialogs.rb', line 107

def OverviewDialog
  caption = _("HTTP Server Configuration")
  #    if (HttpServer::firewall_first) tabs_descr["listen", "widget_names"]= [ "server_enable", "LISTEN", "logs" ];
  widget_descr = {
    "tab" => CWMTab.CreateWidget(
      {
        "tab_order"    => ["listen", "modules", "main_host", "hosts"],
        "tabs"         => @tabs_descr,
        "widget_descr" => HttpServerWidgets.widgets,
        "initial_tab"  => HttpServerWidgets.init_tab,
        "tab_help"     => ""
      }
    )
  }
  contents = VBox("tab")

  w = CWM.CreateWidgets(
    ["tab"],
    Convert.convert(
      widget_descr,
      :from => "map",
      :to   => "map <string, map <string, any>>"
    )
  )
  help = CWM.MergeHelps(w)
  contents = CWM.PrepareDialog(contents, w)

  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.FinishButton
  )
  Wizard.RestoreAbortButton
  Wizard.DisableBackButton

  ret = CWM.Run(
    w,
    { :abort => fun_ref(method(:ReallyAbort), "boolean ()") }
  )

  ret
end

- (Object) ReallyAbortAlways

Ask for confirmation (always)

Returns:

  • true if abort is confirmed



95
96
97
# File '../../src/include/http-server/dialogs.rb', line 95

def ReallyAbortAlways
  Popup.ReallyAbort(true)
end

- (Symbol) SetVHostOptions

Set virtual host options

Returns:

  • (Symbol)

    from host widget



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File '../../src/include/http-server/dialogs.rb', line 261

def SetVHostOptions
  w = CWM.CreateWidgets(["vhost_details"], HttpServerWidgets.widgets)
  contents = HBox(
    HSpacing(0.5),
    VBox(Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, HSpacing(0.5))
  )

  # translators: dialog caption
  caption = _("Virtual Host Details")

  help = Ops.get_string(@HELPS, "set_vhost", "")


  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.NextButton
  )

  CWM.Run(w, { :abort => fun_ref(method(:Abort), "boolean ()") })
end

- (Symbol) SSLDialog

Run host SSL dialog

Returns:

  • (Symbol)

    for wizard sequencer



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File '../../src/include/http-server/dialogs.rb', line 287

def SSLDialog
  w = CWM.CreateWidgets(["ssl"], HttpServerWidgets.widgets)
  contents = HBox(
    HSpacing(1),
    VBox(VSpacing(1), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, VSpacing(
      1
    )),
    HSpacing(1)
  )

  # translators: dialog caption, %1 is the host name
  caption = Builtins.sformat(
    _("SSL Configuration for '%1'"),
    # translators: human-readable "default host"
    HttpServerWidgets.currenthost == "main" ?
      _("Default Host") :
      HttpServerWidgets.get_host_value(
        "ServerName",
        YaST::HTTPDData.GetHost(HttpServerWidgets.currenthost),
        HttpServerWidgets.currenthost
      )
  )

  help = CWM.MergeHelps(w)

  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.OKButton
  )
  if ProductFeatures.GetFeature("globals", "ui_mode") != "simple"
    UI.ReplaceWidget(
      Id(:_tp_table_repl),
      #translators: pop up menu
      MenuButton(
        _("Certificates"),
        [
          #translators: Certificates pop-up menu item
          Item(Id(:import_certificate), _("&Import Server Certificate...")),
          #translators: Certificates pop-up menu item
          Item(Id(:common_certificate), _("&Use Common Server Certificate"))
        ]
      )
    )
  end

  CWM.Run(w, { :abort => fun_ref(method(:Abort), "boolean ()") })
end