Module: Yast::DhcpServerDialogsInclude
- Defined in:
- ../../src/include/dhcp-server/dialogs.rb
Instance Method Summary (collapse)
-
- (Symbol) CheckConfiguredInterfaces
Detect if at least one network interface is selected.
-
- (Symbol) ClassDialog
Run class dialog.
-
- (Symbol) ConfigTypeSwitch
Detect if simple configuration dialogs should be started.
-
- (Symbol) DynDnsDialog
Run Dynamic DNS dialog.
-
- (Symbol) GlobalsDialog
Run dialog for global options.
-
- (Symbol) Groupdialog
Run group dialog.
-
- (Symbol) HostDialog
Run host dialog.
-
- (Symbol) IfacesDialog(initial)
Run interfaces and firewall dialog.
- - (Object) initialize_dhcp_server_dialogs(include_target)
-
- (Symbol) OldMainDialog
Run main dialog.
-
- (Symbol) PoolDialog
Run address pool dialog.
-
- (Object) ReadDialog
Read settings dialog.
-
- (Symbol) RunTsigKeysDialog(called_from_subnet)
Run TSIG keys management dialog.
-
- (Symbol) SectionStore
Store a section (declaration).
-
- (Symbol) SectionTypeChoose
Run shared network dialog.
-
- (Symbol) SelectEditationDialog
detect the type of edited declaration.
-
- (Symbol) SharedNetworkDialog
Run shared network dialog.
-
- (Symbol) SubnetDialog
Run subnet dialog.
-
- (Object) WriteDialog
Write settings dialog.
Instance Method Details
- (Symbol) CheckConfiguredInterfaces
Detect if at least one network interface is selected
602 603 604 605 606 |
# File '../../src/include/dhcp-server/dialogs.rb', line 602 def CheckConfiguredInterfaces ifaces_allowed = DhcpServer.GetAllowedInterfaces return :ifaces if Builtins.size(ifaces_allowed) == 0 :main end |
- (Symbol) ClassDialog
Run class dialog
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 337 338 339 |
# File '../../src/include/dhcp-server/dialogs.rb', line 308 def ClassDialog Builtins.y2milestone("Running class dialog") w = CWM.CreateWidgets(["class", "class_table"], @widgets) contents = HBox( HSpacing(2), VBox( VSpacing(1), HBox(HSpacing(2), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, HSpacing( 2 )), VSpacing(1), Ops.get_term(w, [1, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("Class") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton return CWM.Run(w, @functions) :back end |
- (Symbol) ConfigTypeSwitch
Detect if simple configuration dialogs should be started
610 611 612 613 |
# File '../../src/include/dhcp-server/dialogs.rb', line 610 def ConfigTypeSwitch return :expert if Mode.config DhcpServer.IsConfigurationSimple ? :simple : :expert end |
- (Symbol) DynDnsDialog
Run Dynamic DNS dialog
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
# File '../../src/include/dhcp-server/dialogs.rb', line 477 def DynDnsDialog Builtins.y2milestone("Running interfaces dialog") w = ["ddns_enable", "zone", "zone_ip", "reverse_zone", "reverse_ip"] contents = HBox( HStretch(), VBox( VStretch(), Left("ddns_enable"), VSpacing(2), HBox("zone", "zone_ip"), HBox("reverse_zone", "reverse_ip"), VStretch() ), HStretch() ) # dialog caption caption = _("Interface Configuration") CWM.ShowAndRun( { "widget_names" => w, "widget_descr" => @widgets, "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => @functions } ) end |
- (Symbol) GlobalsDialog
Run dialog for global options
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 |
# File '../../src/include/dhcp-server/dialogs.rb', line 105 def GlobalsDialog Builtins.y2milestone("Running global options dialog") w = CWM.CreateWidgets(["global_table"], @widgets) contents = HBox( HSpacing(2), VBox(VSpacing(1), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, VSpacing( 1 )), HSpacing(2) ) # dialog caption caption = _("Global Options") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton CWM.Run(w, @functions) end |
- (Symbol) Groupdialog
Run group dialog
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File '../../src/include/dhcp-server/dialogs.rb', line 274 def Groupdialog Builtins.y2milestone("Running group dialog") w = CWM.CreateWidgets(["group", "group_table"], @widgets) contents = HBox( HSpacing(2), VBox( VSpacing(1), HBox(HSpacing(2), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, HSpacing( 2 )), VSpacing(1), Ops.get_term(w, [1, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("Group-Specific Options") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton CWM.Run(w, @functions) end |
- (Symbol) HostDialog
Run host dialog
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 197 198 |
# File '../../src/include/dhcp-server/dialogs.rb', line 168 def HostDialog Builtins.y2milestone("Running host dialog") w = CWM.CreateWidgets(["host", "host_table"], @widgets) contents = HBox( HSpacing(2), VBox( VSpacing(1), HBox(HSpacing(2), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, HSpacing( 2 )), VSpacing(1), Ops.get_term(w, [1, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("Host with Fixed Address") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton CWM.Run(w, @functions) end |
- (Symbol) IfacesDialog(initial)
Run interfaces and firewall dialog
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File '../../src/include/dhcp-server/dialogs.rb', line 438 def IfacesDialog(initial) Builtins.y2milestone("Running interfaces dialog") w = CWM.CreateWidgets(["interfaces", "open_firewall"], @widgets) contents = HBox( HStretch(), VBox( VStretch(), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, VSpacing(3), Left(Ops.get_term(w, [1, "widget"]) { VSpacing(0) }), VStretch() ), HStretch() ) # dialog caption caption = _("Interface Configuration") help = CWM.MergeHelps(w) next_label = initial ? Label.NextButton : Label.OKButton Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, next_label ) if initial Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) else Wizard.RestoreAbortButton Wizard.RestoreBackButton end CWM.Run(w, @functions) end |
- (Object) initialize_dhcp_server_dialogs(include_target)
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File '../../src/include/dhcp-server/dialogs.rb', line 15 def initialize_dhcp_server_dialogs(include_target) textdomain "dhcp-server" Yast.import "Wizard" Yast.import "DhcpServer" Yast.import "CWM" Yast.import "Popup" Yast.import "Label" Yast.import "Confirm" @functions = { :abort => fun_ref(method(:confirmAbort), "boolean ()") } end |
- (Symbol) OldMainDialog
Run main dialog
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 |
# File '../../src/include/dhcp-server/dialogs.rb', line 62 def OldMainDialog Builtins.y2milestone("Running main dialog") w = CWM.CreateWidgets( ["start", "chroot", "ldap_support", "configtree"], @widgets ) contents = HBox( HSpacing(2), VBox( VSpacing(1), Left(Ops.get_term(w, [0, "widget"]) { VSpacing(0) }), VSpacing(1), Left(Ops.get_term(w, [1, "widget"]) { VSpacing(0) }), VSpacing(1), Left(Ops.get_term(w, [2, "widget"]) { VSpacing(0) }), VSpacing(1), Ops.get_term(w, [3, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("DHCP Server Configuration") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.FinishButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) CWM.Run( w, { :abort => fun_ref(method(:confirmAbortIfChanged), "boolean ()") } ) end |
- (Symbol) PoolDialog
Run address pool dialog
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File '../../src/include/dhcp-server/dialogs.rb', line 239 def PoolDialog Builtins.y2milestone("Running pool dialog") w = CWM.CreateWidgets(["pool", "pool_table"], @widgets) contents = HBox( HSpacing(2), VBox( VSpacing(1), HBox(HSpacing(2), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, HSpacing( 2 )), VSpacing(1), Ops.get_term(w, [1, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("Pool of Addresses") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton return CWM.Run(w, @functions) :back end |
- (Object) ReadDialog
Read settings dialog
31 32 33 34 35 36 37 38 39 40 41 |
# File '../../src/include/dhcp-server/dialogs.rb', line 31 def ReadDialog Builtins.y2milestone("Running read dialog") Wizard.RestoreHelp(Ops.get(@HELPS, "read", "")) # checking for root permissions return :abort if !Confirm.MustBeRoot ret = DhcpServer.Read return DhcpServer.WasConfigured ? :next : :wizard if ret :abort end |
- (Symbol) RunTsigKeysDialog(called_from_subnet)
Run TSIG keys management dialog
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File '../../src/include/dhcp-server/dialogs.rb', line 510 def RunTsigKeysDialog(called_from_subnet) Builtins.y2milestone("Running TSIG keys management dialog") w = ["tsig_keys"] contents = HBox( HSpacing(2), VBox(VSpacing(1), "tsig_keys", VSpacing(1)), HSpacing(2) ) # dialog caption caption = _("TSIG Key Management") ret = CWM.ShowAndRun( { "widget_names" => w, "widget_descr" => @widgets, "contents" => contents, "caption" => caption, "back_button" => Label.BackButton, "next_button" => Label.OKButton, "fallback_functions" => { :abort => fun_ref(method(:confirmAbort), "boolean ()") } } ) if ret == :next && called_from_subnet return :subnet if Builtins.size(DhcpServer.ListTSIGKeys) == 0 end ret end |
- (Symbol) SectionStore
Store a section (declaration)
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
# File '../../src/include/dhcp-server/dialogs.rb', line 563 def SectionStore if @current_operation == :edit # existing entry was edited Builtins.y2milestone("Storing changed record") DhcpServer.ChangeEntry( @original_entry_type, @original_entry_id, @current_entry_type, @current_entry_id ) # new entry was added else Builtins.y2milestone("Storing new record") DhcpServer.CreateEntry( @current_entry_type, @current_entry_id, @parent_type, @parent_id ) end DhcpServer.SetEntryDirectives( @current_entry_type, @current_entry_id, @current_entry_directives ) DhcpServer.SetEntryOptions( @current_entry_type, @current_entry_id, @current_entry_options ) DhcpServer.SetModified # DhcpServer::SetDDNSFileName (current_ddns_key_file); # DhcpServer::SetDDNSFileCreate (current_ddns_key_create); :next end |
- (Symbol) SectionTypeChoose
Run shared network dialog
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 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File '../../src/include/dhcp-server/dialogs.rb', line 343 def SectionTypeChoose Builtins.y2milestone("Running section type selection dialog") parents = [] par_id = @parent_id par_type = @parent_type while par_id != "" parents = Builtins.add(parents, par_type) p = DhcpServer.GetEntryParent(par_type, par_id) par_type = Ops.get(p, "type", "") par_id = Ops.get(p, "id", "") end possible = ["subnet", "host", "shared-network", "group", "pool", "class"] if Builtins.contains(parents, "class") || Builtins.contains(parents, "host") || Builtins.contains(parents, "pool") return :back end f = [] if Builtins.contains(parents, "subnet") f = Builtins.add(f, "subnet") f = Builtins.add(f, "shared-network") end if Builtins.contains(parents, "shared-network") f = Builtins.add(f, "shared-network") end possible = Builtins.filter(possible) { |s| !Builtins.contains(f, s) } return :back if possible == [] labels = { # radio button "subnet" => _("&Subnet"), # radio button "host" => _("&Host"), # radio button "shared-network" => _("Shared &Network"), # radio button "group" => _("&Group"), # radio button "pool" => _("&Pool of Addresses"), # radio button "class" => _("&Class") } contents = VBox() Builtins.foreach(possible) do |p| contents = Builtins.add(contents, VSpacing(1)) contents = Builtins.add( contents, Left(RadioButton(Id(p), Ops.get_string(labels, p, p))) ) end contents = Builtins.add(contents, VSpacing(1)) contents = HBox(HSpacing(5), contents, HSpacing(5)) contents = RadioButtonGroup(Id(:entry_type), contents) # frame contents = Frame(_("Declaration Types"), contents) contents = HBox( HStretch(), VBox(VStretch(), contents, VStretch()), HStretch() ) # dialog caption caption = _("Declaration Type") help = getSelectDeclarationTypeHelp(possible) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.NextButton ) Wizard.RestoreAbortButton UI.ChangeWidget(Id(Ops.get(possible, 0)), :Value, true) ret = nil while ret == nil ret = Convert.to_symbol(UI.UserInput) ret = :abort if ret == :cancel ret = nil if ret == :abort && !confirmAbort ret = nil if ret != :next && ret != :abort && ret != :back end if ret == :next @current_entry_type = Convert.to_string( UI.QueryWidget(Id(:entry_type), :CurrentButton) ) end ret end |
- (Symbol) SelectEditationDialog
detect the type of edited declaration
548 549 550 551 552 553 554 555 556 557 558 559 |
# File '../../src/include/dhcp-server/dialogs.rb', line 548 def SelectEditationDialog Builtins.y2milestone("Determining what is selected") return :global if @current_entry_type == "" return :subnet if @current_entry_type == "subnet" return :host if @current_entry_type == "host" return :pool if @current_entry_type == "pool" return :group if @current_entry_type == "group" return :shared_network if @current_entry_type == "shared-network" return :class if @current_entry_type == "class" Builtins.y2error("Unknown declaration was selected") :back end |
- (Symbol) SharedNetworkDialog
Run shared network dialog
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File '../../src/include/dhcp-server/dialogs.rb', line 202 def SharedNetworkDialog Builtins.y2milestone("Running shared network dialog") w = CWM.CreateWidgets( ["shared-network", "shared-network_table"], @widgets ) contents = HBox( HSpacing(2), VBox( VSpacing(1), HBox(HSpacing(2), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, HSpacing( 2 )), VSpacing(1), Ops.get_term(w, [1, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("Shared Network") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton CWM.Run(w, @functions) end |
- (Symbol) SubnetDialog
Run subnet dialog
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 |
# File '../../src/include/dhcp-server/dialogs.rb', line 133 def SubnetDialog Builtins.y2milestone("Running subnet dialog") w = CWM.CreateWidgets( ["subnet", "subnet_table", "dyn_dns_button"], @widgets ) contents = HBox( HSpacing(2), VBox( VSpacing(1), Ops.get_term(w, [0, "widget"]) { VSpacing(0) }, VSpacing(1), Ops.get_term(w, [1, "widget"]) { VSpacing(0) }, VSpacing(1) ), HSpacing(2) ) # dialog caption caption = _("Subnet Configuration") help = CWM.MergeHelps(w) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.RestoreAbortButton CWM.Run(w, @functions) end |
- (Object) WriteDialog
Write settings dialog
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File '../../src/include/dhcp-server/dialogs.rb', line 45 def WriteDialog Builtins.y2milestone("Running write dialog") Wizard.RestoreHelp(Ops.get(@HELPS, "write", "")) ret = DhcpServer.Write # yes-no popup if !ret && Popup.YesNo( _("Saving the configuration failed. Change the settings?") ) return :back end ret ? :next : :abort end |