home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / root / usr / share / YaST2 / include / iscsi-client / dialogs.ycp < prev    next >
Text File  |  2006-11-29  |  11KB  |  337 lines

  1. /**
  2.  * File:    include/iscsi-client/dialogs.ycp
  3.  * Package:    Configuration of iscsi-client
  4.  * Summary:    Dialogs definitions
  5.  * Authors:    Michal Zugec <mzugec@suse.cz>
  6.  *
  7.  * $Id: dialogs.ycp 31426 2006-06-09 16:27:17Z mzugec $
  8.  */
  9.  
  10. {
  11.  
  12. textdomain "iscsi-client";
  13.  
  14. import "Label";
  15. import "Wizard";
  16. import "IscsiClient";
  17. import "CWMServiceStart";
  18. import "CWMFirewallInterfaces";
  19. import "CWMTab";
  20. import "CWM";
  21. import "Stage";
  22.  
  23. string current_tab = "general";
  24.  
  25. include "iscsi-client/helps.ycp";
  26. include "iscsi-client/widgets.ycp";
  27.  
  28. map<string, map <string, any> > widgets = $[
  29.             "auto_start_up" : CWMServiceStart::CreateAutoStartWidget ($[
  30.                 "get_service_auto_start" : IscsiClient::GetStartService,
  31.                 "set_service_auto_start" : IscsiClient::SetStartService,
  32.                 // radio button (starting SLP service - option 1)
  33.                 "start_auto_button" : _("When &Booting"),
  34.                 // radio button (starting SLP service - option 2)
  35.                 "start_manual_button" : _("&Manually"),
  36.                 "help" : sformat (CWMServiceStart::AutoStartHelpTemplate (),
  37.                     // part of help text, used to describe radiobuttons (matching starting SLP service but without "&")
  38.                     _("When Booting"),
  39.                     // part of help text, used to describe radiobuttons (matching starting SLP service but without "&")
  40.                     _("Manually")
  41.                 ),
  42.             ]),
  43.  
  44.     // table of connected targets
  45.        "connected_table" : $[
  46.         "widget" : `custom,
  47.         "custom_widget"    :
  48.          `VBox(
  49.           `Table(`id(`connected), `opt(`notify, `immediate ),
  50.             `header(_("Portal Address"), _("Target Name"), _("Start-Up")),
  51.             []
  52.             ),
  53.           `Left(`HBox(
  54.             `PushButton(`id(`add), _("Add")),
  55.             `PushButton(`id(`del), _("Log Out")),
  56.             `PushButton(`id(`toggle), _("Toggle Start-Up"))
  57.             ))
  58.           ),
  59.         "init"    : initConnectedTable,
  60.         "handle" : handleConnectedTable,
  61.         "help"    : HELPS["server_table"]:""
  62.         ],
  63.  
  64.     // table of discovered targets
  65.        "discovered_table" : $[
  66.         "widget" : `custom,
  67.         "custom_widget"    :
  68.          `VBox(
  69.           `Table(`id(`discovered), `opt(`notify, `immediate ),
  70.             `header(_("Portal Address"), _("Target Name"), _("Connected")),
  71.             []
  72.             ),
  73.           `Left(`HBox(
  74.             `PushButton(`id(`discovery), _("Discovery")),
  75.             `PushButton(`id(`connect), _("Log In")),
  76.             `PushButton(`id(`delete), Label::DeleteButton())
  77.  
  78.             ))
  79.           ),
  80.         "help"    : HELPS["discovered"]:"",
  81.         "init" : initDiscoveredTable,
  82.         "handle" : handleDiscoveredTable
  83.         ],
  84.  
  85.     // dialog for all targets from portal (connected/disconnected)
  86.        "targets_table" : $[
  87.         "widget" : `custom,
  88.         "custom_widget"    :
  89.          `VBox(
  90.           `Table(`id(`targets), `opt(`notify, `immediate),
  91.             `header(_("Portal Address"), _("Target Name"), _("Connected")),
  92.             []
  93.             ),
  94.           `Left(`HBox(
  95.             `PushButton(`id(`connect), _("Connect"))
  96.  
  97.             ))
  98.           ),
  99.         "init" : initTargetTable,
  100.         "handle" : handleTargetTable
  101.         ],
  102.  
  103.     // authentification dialog for add/discovery target
  104.     "discovery_auth" : $[
  105.                "widget" : `custom,
  106.                 "custom_widget" :
  107.                  `VBox(
  108.             `Left( `CheckBox(`id(`auth_none),`opt(`notify), _("No Authentication"), true) ),
  109.             `VSpacing(2),
  110.             `Left( `CheckBox(`id(`auth_in),`opt(`notify), _("Incoming Authentication"), false) ),
  111.             `HBox(
  112.                 `TextEntry(`id(`user_in), _("Username")), `Password(`id(`pass_in), _("Password"))
  113.               ),
  114.             `VSpacing(2),
  115.             `Left( `CheckBox(`id(`auth_out),`opt(`notify), _("Outgoing Authentication"), false) ),
  116.             `HBox(
  117.                 `TextEntry(`id(`user_out), _("Username")), `Password(`id(`pass_out), _("Password"))
  118.               )
  119.                   ),
  120.         "init"    : initDiscAuth,
  121.         "handle" : handleDiscAuth,
  122.         "validate_type" : `function,
  123.         "validate_function" : validateDiscAuth,
  124.         "help"    :    HELPS["conn_auth"]:""
  125.     ],
  126.  
  127.     // authentication dialog for add target
  128.     "conn_auth" : $[
  129.                "widget" : `custom,
  130.                 "custom_widget" :
  131.                  `VBox(
  132.             `Left( `CheckBox(`id(`auth_none),`opt(`notify), _("No Authentication"), true) ),
  133.             `VSpacing(2),
  134.             `Left( `CheckBox(`id(`auth_in),`opt(`notify), _("Incoming Authentication"), false) ),
  135.             `HBox(
  136.                 `TextEntry(`id(`user_in), _("Username")), `Password(`id(`pass_in), _("Password"))
  137.               ),
  138.             `VSpacing(2),
  139.             `Left( `CheckBox(`id(`auth_out),`opt(`notify), _("Outgoing Authentication"), false) ),
  140.             `HBox(
  141.                 `TextEntry(`id(`user_out), _("Username")), `Password(`id(`pass_out), _("Password"))
  142.               )
  143.                   ),
  144.         "init"  : initConnAuth,
  145.         "handle" : handleDiscAuth,
  146.         "validate_type" : `function,
  147.         "validate_function" : validateConnAuth,
  148.         "help"    : HELPS["conn_auth"]:""
  149.     ],
  150.  
  151.     // widget for portal address
  152.     "server_location" : $[
  153.         "widget" : `custom,
  154.         "custom_widget" : `HBox(
  155.         `TextEntry(`id(`hostname), _("IP Address")),
  156.                 `IntField(`id(`port), _("Port"), 0,65535,3260)
  157.         ),
  158.                    "validate_type" : `function,
  159.                    "validate_function" : validateServerLocation
  160.     ]
  161.     ];
  162.  
  163.  
  164. map tabs_descr = $[
  165.  
  166.     // service status dialog
  167.         "general":$[
  168.          "header"       : _("Service"),
  169.          "contents"     :
  170.                           `VBox(
  171.                           `VStretch(),
  172.                           `HBox(
  173.                            `HStretch(),
  174.                            `HSpacing (1),
  175.                             `VBox(
  176.                                 "auto_start_up",
  177.                                 `VSpacing (2)
  178.                                 ),
  179.                            `HSpacing (1),
  180.                            `HStretch()
  181.                               ),
  182.                           `VStretch()
  183.                         ),
  184.          "widget_names" : [ "auto_start_up" ]
  185.         ],
  186.  
  187.     // list og connected targets
  188.         "client":$[
  189.          "header"       : _("Connected Targets"),
  190.          "contents"     :
  191.                           `VBox(
  192.                           `VStretch(),
  193.                           `HBox(
  194.                            `HSpacing (1),
  195.                             `VBox(
  196.                                 "connected_table"
  197.                                  ),
  198.                            `HSpacing (1)
  199.                                ),
  200.                           `VStretch()
  201.                         ),
  202.          "widget_names" : [ "connected_table" ]
  203.         ],
  204.  
  205.     // list of discovered targets
  206.         "discovered":$[
  207.          "header"       : _("Discovered Targets"),
  208.          "contents"     :
  209.                          `VBox(
  210.                           `VStretch(),
  211.                           `HBox(
  212.                            `HSpacing (1),
  213.                             `VBox(
  214.                                 "discovered_table"
  215.                                  ),
  216.                            `HSpacing (1)
  217.                                ),
  218.                           `VStretch()
  219.                         ),
  220.          "widget_names" : [ "discovered_table" ]
  221.         ]
  222.       ];
  223.  
  224.  
  225.  
  226. // main tabbed dialog
  227. any GlobalDialog() {
  228.     string caption = _("iSCSI Initiator Overview");
  229.  
  230.     map widget_descr = $[
  231.     "tab": CWMTab::CreateWidget($[
  232.             "tab_order": (Stage::initial()) ? ["client"] : [ "general", "client", "discovered" ],
  233.             "tabs": tabs_descr,
  234.             "widget_descr": widgets,
  235.             "initial_tab" : (Stage::initial()) ? "client" : current_tab,
  236.             "tab_help" : _("<h1>iSCSI Initiator</h1>"),
  237.         ]),
  238.     ];
  239.  
  240.     term contents = `VBox( "tab" );
  241.     list<map <string, any> > w = CWM::CreateWidgets (["tab"], (map <string, map <string, any> >)widget_descr);
  242.     string help = CWM::MergeHelps(w);
  243.     contents = CWM::PrepareDialog(contents, w);
  244.     Wizard::SetContentsButtons(caption, contents, help, Label::NextButton (), Label::FinishButton ());
  245.     Wizard::HideBackButton();
  246.     symbol ret = CWM::Run(w, $[`abort:ReallyAbort ]);
  247.     return ret;
  248. }
  249.  
  250. // authentication dialog for add new target
  251. any DiscAuthDialog (string return_to){
  252.      current_tab = return_to;
  253.     string caption = _("iSCSI Initiator Discovery"); // bug #148963 _("iSCSI Target Login");
  254.     list<map <string, any> > w = CWM::CreateWidgets (["server_location", "discovery_auth"],
  255.                                 (map <string, map <string, any> >)widgets);
  256.         term contents =
  257.                           `VBox(
  258.                           `VStretch(),
  259.                           `HBox(
  260.                            `HStretch(),
  261.                            `HSpacing (1),
  262.                             `VBox(
  263.                                 w[0, "widget"]:`VSpacing (1),
  264.                                 `VSpacing (2),
  265.                                 w[1, "widget"]:`VSpacing (1),
  266.                                 `VSpacing (2)
  267.                                 ),
  268.                            `HSpacing (1),
  269.                            `HStretch()
  270.                                ),
  271.                           `VStretch()
  272.                         );
  273.  
  274.     string help = CWM::MergeHelps(w);
  275.     contents = CWM::PrepareDialog(contents, w);
  276.     Wizard::SetContentsButtons(caption, contents, HELPS["discovery"]:"",
  277.             Label::BackButton(), Label::NextButton());
  278.  
  279.     any ret = CWM::Run(w, $[`abort:ReallyAbort ]);
  280.     return ret;
  281. }
  282.  
  283. // list of connected targets
  284. any TargetsDialog(){
  285.      current_tab = "client";
  286.     string caption = _("iSCSI Initiator Discovery");
  287.     list<map <string, any> > w = CWM::CreateWidgets (["targets_table"], (map <string, map <string, any> >)widgets);
  288.         term contents =`VBox(
  289.                           `VStretch(),
  290.                           `HBox(
  291.                            `HSpacing (1),
  292.                             `VBox(
  293.                                 w[0, "widget"]:`VSpacing (1)
  294.                                  ),
  295.                            `HSpacing (1)
  296.                                ),
  297.                           `VStretch()
  298.                         );
  299.     string help = CWM::MergeHelps(w);
  300.     contents = CWM::PrepareDialog(contents, w);
  301.     Wizard::SetContentsButtons(caption, contents, HELPS["targets_table"]:"", Label::BackButton(), Label::NextButton());
  302.     any ret = CWM::Run(w, $[`abort:ReallyAbort ]);
  303.     return ret;
  304. }
  305.  
  306. // authentication for connect to portal
  307. any ConnAuthDialog(string return_to){
  308.      current_tab = return_to;
  309.     string caption = _("iSCSI Initiator Discovery");
  310.     list<map <string, any> > w = CWM::CreateWidgets (["conn_auth"], (map <string, map <string, any> >)widgets);
  311.         term contents =
  312.                           `VBox(
  313.                           `VStretch(),
  314.                           `HBox(
  315.                            `HStretch(),
  316.                            `HSpacing (1),
  317.                             `VBox(
  318.                                 w[0, "widget"]:`VSpacing (1),
  319.                 `VSpacing (2)
  320.                                 ),
  321.                            `HSpacing (1),
  322.                            `HStretch()
  323.                                ),
  324.                           `VStretch()
  325.                         );
  326.  
  327.     string help = CWM::MergeHelps(w);
  328.     contents = CWM::PrepareDialog(contents, w);
  329.     Wizard::SetContentsButtons(caption, contents, HELPS["conn_auth"]:"", Label::BackButton(), Label::NextButton());
  330.     any ret = CWM::Run(w, $[`abort:ReallyAbort ]);
  331.     return ret;
  332. }
  333.  
  334.  
  335. /* EOF */
  336. }
  337.