/*********************************************************************** * * Copyright (C) 2006 Novell, Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, Novell, Inc. * * To contact Novell about this file by physical or electronic mail, * you may find current contact information at www.novell.com. * ***********************************************************************/ /** * File: include/casa-ats/dialogs.ycp * Package: Configuration of casa-ats * Summary: Dialogs definitions * Authors: Ryan Partridge * * $Id: dialogs.ycp 27914 2006-02-13 14:32:08Z locilka $ */ { textdomain "casa-ats"; import "Label"; import "Wizard"; import "Popup"; import "Address"; import "CasaAts"; include "casa-ats/helps.ycp"; /** * Authentication Token Service dialog * @return dialog result */ any ATSInfoDialog () { /* CasaAts configure1 dialog caption */ string caption = _("CASA Authentication Token Service Configuration"); boolean enable = CasaAts::Settings["CONFIG_CASAATS_ENABLE"]:false; string realm = CasaAts::Settings["CONFIG_CASAATS_REALM"]:""; string host = CasaAts::Settings["CONFIG_CASAATS_HOST"]:""; string proxy_username = CasaAts::Settings["CONFIG_CASAATS_PROXY_USERNAME"]:""; string proxy_password = CasaAts::Settings["CONFIG_CASAATS_PROXY_PASSWORD"]:""; boolean open_port = CasaAts::Settings["CONFIG_CASAATS_OPEN_PORT"]:false; /* CasaAts ATSInfo dialog contents */ term contents = `HVSquash ( `VBox ( `Left(`CheckBox(`id(`enable), `opt(`notify), _("&Enable CASA Authentication Token Service"), enable)), `VSpacing(1.0), `TextEntry(`id(`realm), _("&Realm name:"), realm), `TextEntry(`id(`host), _("&Host server (IP address or DNS name):"), host), `TextEntry(`id(`proxy_username), _("&Proxy username (i.e. cn=admin,o=novell):"), proxy_username), `Password(`id(`proxy_password), _("Pa&ssword for proxy user:"), proxy_password), `VSpacing(1.0), `Left(`CheckBox(`id(`firewall), _("&Open service port in firewall"), open_port)) ) ); Wizard::SetContentsButtons(caption, contents, HELPS["atsinfo"]:"", Label::BackButton(), Label::FinishButton()); UI::SetFocus(`id(`enable)); UI::ChangeWidget(`id(`realm), `Enabled, enable); UI::ChangeWidget(`id(`host), `Enabled, enable); UI::ChangeWidget(`id(`proxy_username), `Enabled, enable); UI::ChangeWidget(`id(`proxy_password), `Enabled, enable); UI::ChangeWidget(`id(`firewall), `Enabled, enable); map event = nil; any ret = nil; while(true) { event = UI::WaitForEvent (); ret = event["ID"]:nil; /* abort? */ if(ret == `abort || ret == `cancel) { if(ReallyAbort()) break; else continue; } else if (ret == `enable) { y2milestone("Changing enable/diable state"); boolean enableFields = (boolean)UI::QueryWidget(`enable, `Value); UI::ChangeWidget(`id(`realm), `Enabled, enableFields); UI::ChangeWidget(`id(`host), `Enabled, enableFields); UI::ChangeWidget(`id(`proxy_username), `Enabled, enableFields); UI::ChangeWidget(`id(`proxy_password), `Enabled, enableFields); UI::ChangeWidget(`id(`firewall), `Enabled, enableFields); } else if(ret == `next) { enable = (boolean)UI::QueryWidget(`enable, `Value); CasaAts::Settings["CONFIG_CASAATS_ENABLE"] = enable; if (enable) { realm = (string)UI::QueryWidget(`realm, `Value); if (realm == nil || realm == "") { Popup::Error(_("The Realm cannot be blank")); continue; } CasaAts::Settings["CONFIG_CASAATS_REALM"] = realm; host = (string)UI::QueryWidget(`host, `Value); if (host == nil || host == "") { Popup::Error(_("The Host cannot be blank")); continue; } else if (!Address::Check4(host)) { Popup::Error(_("The Host must be a valid IP address or DNS name")); continue; } CasaAts::Settings["CONFIG_CASAATS_HOST"] = host; proxy_username = (string)UI::QueryWidget(`proxy_username, `Value); if (proxy_username == nil || proxy_username == "") { Popup::Error(_("The Proxy username cannot be blank")); continue; } CasaAts::Settings["CONFIG_CASAATS_PROXY_USERNAME"] = proxy_username; proxy_password = (string)UI::QueryWidget(`proxy_password, `Value); if (proxy_password == nil || proxy_password == "") { Popup::Error(_("The Proxy user password cannot be blank")); continue; } CasaAts::Settings["CONFIG_CASAATS_PROXY_PASSWORD"] = proxy_password; open_port = (boolean)UI::QueryWidget(`firewall, `Value); CasaAts::Settings["CONFIG_CASAATS_OPEN_PORT"] = open_port; } else { CasaAts::Settings["CONFIG_CASAATS_OPEN_PORT"] = false; } break; } else if(ret == `back) { break; } } return ret; } /* EOF */ }