diff --git a/CASA-auth-token/yast2-casa-ats/MAINTAINER b/CASA-auth-token/yast2-casa-ats/MAINTAINER new file mode 100644 index 00000000..4bca6a1e --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/MAINTAINER @@ -0,0 +1 @@ +Ryan Partridge diff --git a/CASA-auth-token/yast2-casa-ats/Makefile.svn b/CASA-auth-token/yast2-casa-ats/Makefile.svn new file mode 100644 index 00000000..1126d55b --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/Makefile.svn @@ -0,0 +1,18 @@ +# +# Makefile.cvs +# +configure: all + ./configure + +all: + y2tool y2autoconf + y2tool y2automake + autoreconf --force --install + +install: configure + make + make install + +reconf: all + ./config.status --recheck + ./config.status diff --git a/CASA-auth-token/yast2-casa-ats/RPMNAME b/CASA-auth-token/yast2-casa-ats/RPMNAME new file mode 100644 index 00000000..9728af84 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/RPMNAME @@ -0,0 +1 @@ +yast2-casa-ats diff --git a/CASA-auth-token/yast2-casa-ats/VERSION b/CASA-auth-token/yast2-casa-ats/VERSION new file mode 100644 index 00000000..fb2c0766 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/VERSION @@ -0,0 +1 @@ +2.13.0 diff --git a/CASA-auth-token/yast2-casa-ats/agents/Makefile.am b/CASA-auth-token/yast2-casa-ats/agents/Makefile.am new file mode 100644 index 00000000..a4da4e47 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/agents/Makefile.am @@ -0,0 +1,7 @@ +# Makefile.am for casa-ats/agents + +agent_SCRIPTS = + +scrconf_DATA = cfg_casa-ats.scr + +EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA) diff --git a/CASA-auth-token/yast2-casa-ats/agents/cfg_casa-ats.scr b/CASA-auth-token/yast2-casa-ats/agents/cfg_casa-ats.scr new file mode 100644 index 00000000..488f5c22 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/agents/cfg_casa-ats.scr @@ -0,0 +1,17 @@ +/** + * File: + * cfg_casa-ats.scr + * Summary: + * SCR Agent for reading/writing /etc/sysconfig/casa-ats + * using the sysconfig-agent + * + * $Id: cfg_casa-ats.scr,v 1.1.2.3 2006/11/13 21:16:33 rpartridge Exp $ + * + * Read/Sets the values defined in /etc/sysconfig/casa-ats + * in an easy manner. + */ +.sysconfig.casa-ats + +`ag_ini( + `SysConfigFile("/etc/sysconfig/casa-ats") +) diff --git a/CASA-auth-token/yast2-casa-ats/configure.in.in b/CASA-auth-token/yast2-casa-ats/configure.in.in new file mode 100644 index 00000000..0a9d6398 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/configure.in.in @@ -0,0 +1,12 @@ +## YCP module configure.in.in + +## Initialize +@YAST2-INIT-COMMON@ +@YAST2-INIT-YCP@ + +## some common checks +@YAST2-CHECKS-COMMON@ +@YAST2-CHECKS-YCP@ + +## and generate the output... +@YAST2-OUTPUT@ diff --git a/CASA-auth-token/yast2-casa-ats/doc/Makefile.am b/CASA-auth-token/yast2-casa-ats/doc/Makefile.am new file mode 100644 index 00000000..3ada1912 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/doc/Makefile.am @@ -0,0 +1,10 @@ +# Makefile.am for casa-ats/doc + +SUBDIRS = autodocs + +htmldir = $(docdir) + +doc_DATA = +html_DATA = + +EXTRA_DIST = $(doc_DATA) $(html_DATA) diff --git a/CASA-auth-token/yast2-casa-ats/doc/autodocs/Makefile.am b/CASA-auth-token/yast2-casa-ats/doc/autodocs/Makefile.am new file mode 100644 index 00000000..6bbd765d --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/doc/autodocs/Makefile.am @@ -0,0 +1,3 @@ +# Makefile.am for casa-ats/doc/autodocs + +include $(top_srcdir)/autodocs-ycp.ami diff --git a/CASA-auth-token/yast2-casa-ats/package/yast2-casa-ats.changes b/CASA-auth-token/yast2-casa-ats/package/yast2-casa-ats.changes new file mode 100644 index 00000000..363f9560 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/package/yast2-casa-ats.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Tue Oct 24 10:59:35 2006 - rpartridge@novell.com + +- initial version diff --git a/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp b/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp new file mode 100644 index 00000000..8d909b65 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp @@ -0,0 +1,384 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may find + * current contact information at www.novell.com. + * ------------------------------------------------------------------------------ + */ + +/** + * File: modules/CasaAts.ycp + * Package: Configuration of casa-ats + * Summary: CasaAts settings, input and output functions + * Authors: Ryan Partridge + * + * $Id: CasaAts.ycp 27914 2006-02-13 14:32:08Z locilka $ + * + * Representation of the configuration of casa-ats. + * Input and output routines. + */ + +{ + +module "CasaAts"; +textdomain "casa-ats"; + +import "Progress"; +import "Report"; +import "Summary"; +import "Message"; +import "SuSEFirewall"; +import "FileUtils"; +import "Service"; + +/** + * Settings Map + */ +global map Settings = $[]; + +string port = "2645"; +string service_name = "casa_atsd"; + +/** + * Prototypes + */ +global boolean Modified(); + +boolean ModifyFirewallPort(); + +/** + * Data was modified? + */ +global boolean modified = false; + +/** + */ +global boolean proposal_valid = false; + +/** + * Write only, used during autoinstallation. + * Don't run services and SuSEconfig, it's all done at one place. + */ +global boolean write_only = false; + +/** + * Abort function + * return boolean return true if abort + */ +global boolean() AbortFunction = Modified; + +/** + * Abort function + * @return boolean return true if abort + */ +global define boolean Abort() ``{ + if(AbortFunction != nil) + { + return AbortFunction () == true; + } + return false; +} + +/** + * Data was modified? + * @return true if modified + */ +global boolean Modified() { + y2debug("modified=%1",modified); + return modified; +} + +/** + * Read all casa-ats settings + * @return true on success + */ +global boolean Read() { + + /* CasaAts read dialog caption */ + string caption = _("Initializing CASA ATS Configuration"); + + // TODO FIXME Set the right number of stages + integer steps = 2; + + integer sl = 500; + sleep(sl); + + // TODO FIXME Names of real stages + // We do not set help text here, because it was set outside + Progress::New( caption, " ", steps, [ + /* Progress stage 1/2 */ + _("Read the previous settings"), + /* Progress stage 2/2 */ + _("Read the firewall status") + ], [ + /* Progress step 1/2 */ + _("Reading the settings file..."), + /* Progress step 2/2 */ + _("Reading the firewall status..."), + /* Progress finished */ + _("Finished") + ], + "" + ); + + // read settings file + if(Abort()) return false; + Progress::NextStage(); + if (FileUtils::Exists("/etc/sysconfig/casa-ats")) + { + Settings["CONFIG_CASAATS_ENABLE"] = tolower((string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_ENABLE)) == "yes"; + Settings["CONFIG_CASAATS_REALM"] = (string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_REALM); + Settings["CONFIG_CASAATS_HOST"] = (string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_HOST); + Settings["CONFIG_CASAATS_PROXY_USERNAME"] = (string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_PROXY_USERNAME); + Settings["CONFIG_CASAATS_OPEN_PORT"] = tolower((string)SCR::Read(.sysconfig.casa-ats.CONFIG_CASAATS_OPEN_PORT)) == "yes"; + } + /* Error message */ + if(false) Report::Error(_("Cannot read settings file.")); + sleep(sl); + + // read firewall settings + if(Abort()) return false; + Progress::NextStage(); + Progress::set(false); + SuSEFirewall::Read(); + Progress::set(true); + /* Error message */ + if(false) Report::Error(_("Cannot read firewall status.")); + sleep(sl); + + if(Abort()) return false; + /* Progress finished */ + Progress::NextStage(); + Progress::Finish(); + sleep(sl); + + if(Abort()) return false; + modified = false; + return true; +} + +/** + * Write all casa-ats settings + * @return true on success + */ +global boolean Write() { + + /* CasaAts read dialog caption */ + string caption = _("Saving CASA ATS Configuration"); + + // TODO FIXME And set the right number of stages + integer steps = 4; + + integer sl = 500; + sleep(sl); + + // TODO FIXME Names of real stages + // We do not set help text here, because it was set outside + Progress::New(caption, " ", steps, [ + /* Progress stage 1/4 */ + _("Write the settings"), + /* Progress stage 2/4 */ + _("Execute configuration script"), + /* Progress stage 3/4 */ + _("Update runlevel settings"), + /* Progress stage 4/4 */ + _("Adjust firewall") + ], [ + /* Progress step 1/4 */ + _("Writing the settings..."), + /* Progress step 2/4 */ + _("Executing configuration script..."), + /* Progress step 3/4 */ + _("Updating runlevel settings..."), + /* Progress step 4/4 */ + _("Adjusting firewall..."), + /* Progress finished */ + _("Finished") + ], + "" + ); + + // write the settings in /etc/sysconfig/casa-ats + if(Abort()) return false; + Progress::NextStage(); + SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_ENABLE, Settings["CONFIG_CASAATS_ENABLE"]:false ? "yes" : "no"); + SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_REALM, Settings["CONFIG_CASAATS_REALM"]:""); + SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_HOST, Settings["CONFIG_CASAATS_HOST"]:""); + SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_PROXY_USERNAME, Settings["CONFIG_CASAATS_PROXY_USERNAME"]:""); + SCR::Write(.sysconfig.casa-ats.CONFIG_CASAATS_OPEN_PORT, Settings["CONFIG_CASAATS_OPEN_PORT"]:false ? "yes" : "no"); + /* Error message */ + if(false) Report::Error (_("Cannot write settings.")); + sleep(sl); + + // run the configure script + if(Abort()) return false; + Progress::NextStage(); + string cmd = "/usr/share/java/CASA/authtoken/bin/CasaBasicATSSetup.sh"; + cmd = "PROXY_USER_PW=\"%1\" " + cmd; + cmd = "PROXY_USER_NAME=\"" + Settings["CONFIG_CASAATS_PROXY_USERNAME"]:"" + "\" " + cmd; + cmd = "LDAP_HOST_NAME=\"" + Settings["CONFIG_CASAATS_HOST"]:"" + "\" " + cmd; + cmd = "REALM=\"" + Settings["CONFIG_CASAATS_REALM"]:"" + "\" " + cmd; + y2milestone("Running CASA-ATS configuration script:"); + y2milestone(cmd, "******"); + map retval = (map)SCR::Execute(.target.bash_output, sformat(cmd, Settings["CONFIG_CASAATS_PROXY_USERNAME"]:"")); + y2milestone("Return code: %1", retval["exit"]:0); + /* Error message */ + if(false) Report::Error (_("Error executing script.")); + sleep(sl); + + // enable/disable and start/stop service as needed + if(Abort()) return false; + Progress::NextStage(); + if (Settings["CONFIG_CASAATS_ENABLE"]:false) + { + if (!Service::Enabled(service_name)) + { + Service::Enable(service_name); + } + if (Service::Status(service_name) != 0) + { + Service::Start(service_name); + } + else + { + Service::Restart(service_name); + } + } + else + { + if (Service::Enabled(service_name)) + { + Service::Disable(service_name); + } + if (Service::Status(service_name) == 0) + { + Service::Stop(service_name); + } + } + /* Error message */ + if(false) Report::Error (_("Error updating runlevels.")); + sleep(sl); + + // adjust firewall as needed + if(Abort()) return false; + Progress::NextStage(); + if (ModifyFirewallPort()) + { + // write settings + Progress::set(false); + SuSEFirewall::WriteOnly(); + if (!write_only) + { + SuSEFirewall::ActivateConfiguration(); + } + Progress::set(true); + } + /* Error message */ + if(false) Report::Error (_("Error adjusting firewall.")); + sleep(sl); + + if(Abort()) return false; + /* Progress finished */ + Progress::NextStage(); + Progress::Finish(); + sleep(sl); + + if(Abort()) return false; + return true; +} + +/** + * Get all casa-ats settings from the first parameter + * (For use by autoinstallation.) + * @param settings The YCP structure to be imported. + * @return boolean True on success + */ +global boolean Import (map settings) { + // TODO FIXME: your code here (fill the above mentioned variables)... + return true; +} + +/** + * Dump the casa-ats settings to a single map + * (For use by autoinstallation.) + * @return map Dumped settings (later acceptable by Import ()) + */ +global map Export () { + // TODO FIXME: your code here (return the above mentioned variables)... + return $[]; +} + +/** + * Create a textual summary and a list of unconfigured cards + * @return summary of the current configuration + */ +global list Summary() { + // TODO FIXME: your code here... + /* Configuration summary text for autoyast */ + return [ _("Configuration summary..."), [] ]; +} + +/** + * Create an overview table with all configured cards + * @return table items + */ +global list Overview() { + // TODO FIXME: your code here... + return []; +} + +/** + * Return packages needed to be installed and removed during + * Autoinstallation to insure module has all needed software + * installed. + * @return map with 2 lists. + */ +global map AutoPackages() { + // TODO FIXME: your code here... + return $[ "install":[], "remove":[] ]; +} + +global boolean IsPortOpen() +{ + return contains(SuSEFirewall::GetAdditionalServices("TCP", "EXT"), port); +} + +boolean ModifyFirewallPort() +{ + boolean retVal = false; + list services = SuSEFirewall::GetAdditionalServices("TCP", "EXT"); + if (!contains(services, port) && Settings["CONFIG_CASAATS_OPEN_PORT"]:false) + { + services = add(services, port); + retVal = true; + } + else if (contains(services, port) && !Settings["CONFIG_CASAATS_OPEN_PORT"]:false) + { + services = filter(string service, services, + { + return (service != port); + } + ); + retVal = true; + } + if (retVal) + { + SuSEFirewall::SetAdditionalServices("TCP", "EXT", services); + } + return retVal; +} + +/* EOF */ +} diff --git a/CASA-auth-token/yast2-casa-ats/src/Makefile.am b/CASA-auth-token/yast2-casa-ats/src/Makefile.am new file mode 100644 index 00000000..3b7182cc --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/Makefile.am @@ -0,0 +1,27 @@ +# Makefile.am for casa-ats/src + +yncludedir = @yncludedir@/casa-ats + +client_DATA = \ + casa-ats.ycp + +ynclude_DATA = \ + helps.ycp \ + wizards.ycp \ + dialogs.ycp \ + complex.ycp + +desktop_DATA = \ + casa-ats.desktop + +module_DATA = \ + CasaAts.ycp + +# create a symlink for local build, #145327 +casa-ats: + ln -sf . $@ +ycpchook = casa-ats + +EXTRA_DIST = $(client_DATA) $(ynclude_DATA) $(module_DATA) $(desktop_DATA) + +include $(top_srcdir)/Makefile.am.common diff --git a/CASA-auth-token/yast2-casa-ats/src/casa-ats.desktop b/CASA-auth-token/yast2-casa-ats/src/casa-ats.desktop new file mode 100644 index 00000000..fcfc984b --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/casa-ats.desktop @@ -0,0 +1,24 @@ +[Desktop Entry] +Type=Application +Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Misc; + +X-KDE-ModuleType=Library +X-KDE-RootOnly=true +X-KDE-HasReadOnlyMode=true +X-KDE-Library=yast2 +X-SuSE-YaST-Call=casa-ats + +X-SuSE-YaST-Group=Misc +X-SuSE-YaST-Argument= +X-SuSE-YaST-RootOnly=true +X-SuSE-YaST-AutoInst= +X-SuSE-YaST-Geometry= +X-SuSE-YaST-SortKey= +X-SuSE-YaST-AutoInstResource=casa-ats + +Icon=yast-casa-ats +Exec=/sbin/yast2 casa-ats + +Name=CasaAts +GenericName=casa-ats +X-KDE-SubstituteUID=true diff --git a/CASA-auth-token/yast2-casa-ats/src/casa-ats.ycp b/CASA-auth-token/yast2-casa-ats/src/casa-ats.ycp new file mode 100644 index 00000000..353aa938 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/casa-ats.ycp @@ -0,0 +1,93 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may find + * current contact information at www.novell.com. + * ------------------------------------------------------------------------------ + */ + +/** + * File: clients/casa-ats.ycp + * Package: Configuration of casa-ats + * Summary: Main file + * Authors: Ryan Partridge + * + * $Id: casa-ats.ycp 27914 2006-02-13 14:32:08Z locilka $ + * + * Main file for casa-ats configuration. Uses all other files. + */ + +{ + +/*** + *

Configuration of casa-ats

+ */ + +textdomain "casa-ats"; + +/* The main () */ +y2milestone ("----------------------------------------"); +y2milestone ("CasaAts module started"); + +import "Progress"; +import "Report"; +import "Summary"; + +import "CommandLine"; +include "casa-ats/wizards.ycp"; + +map cmdline_description = $[ + "id" : "casa-ats", + /* Command line help text for the Xcasa-ats module */ + "help" : _("Configuration of casa-ats"), + "guihandler" : CasaAtsSequence, + "initialize" : CasaAts::Read, + "finish" : CasaAts::Write, + "actions" : $[ + // FIXME TODO: fill the functionality description here + ], + "options" : $[ + // FIXME TODO: fill the option descriptions here + ], + "mappings" : $[ + // FIXME TODO: fill the mappings of actions and options here + ] +]; + +/* is this proposal or not? */ +boolean propose = false; +list args = WFM::Args(); +if(size(args) > 0) { + if(is(WFM::Args(0), path) && WFM::Args(0) == .propose) { + y2milestone("Using PROPOSE mode"); + propose = true; + } +} + +/* main ui function */ +any ret = nil; + +if(propose) ret = CasaAtsAutoSequence(); +else ret = CommandLine::Run(cmdline_description); +y2debug("ret=%1", ret); + +/* Finish */ +y2milestone("CasaAts module finished"); +y2milestone("----------------------------------------"); + +return ret; + +/* EOF */ +} diff --git a/CASA-auth-token/yast2-casa-ats/src/complex.ycp b/CASA-auth-token/yast2-casa-ats/src/complex.ycp new file mode 100644 index 00000000..021ece7b --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/complex.ycp @@ -0,0 +1,205 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact 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/complex.ycp + * Package: Configuration of casa-ats + * Summary: Dialogs definitions + * Authors: Ryan Partridge + * + * $Id: complex.ycp 29363 2006-03-24 08:20:43Z mzugec $ + */ + +{ + +textdomain "casa-ats"; + +import "Label"; +import "Popup"; +import "Wizard"; +import "Wizard_hw"; +import "Confirm"; +import "CasaAts"; + + +include "casa-ats/helps.ycp"; + +/** + * Return a modification status + * @return true if data was modified + */ +boolean Modified() { + return CasaAts::Modified(); +} + +boolean ReallyAbort() { + return !CasaAts::Modified() || Popup::ReallyAbort(true); +} + +boolean PollAbort() { + return UI::PollInput() == `abort; +} + +/** + * Read settings dialog + * @return `abort if aborted and `next otherwise + */ +symbol ReadDialog() { + Wizard::RestoreHelp(HELPS["read"]:""); + // CasaAts::AbortFunction = PollAbort; + if (!Confirm::MustBeRoot()) return `abort; + boolean ret = CasaAts::Read(); + return ret ? `next : `abort; +} + +/** + * Write settings dialog + * @return `abort if aborted and `next otherwise + */ +symbol WriteDialog() { + Wizard::RestoreHelp(HELPS["write"]:""); + // CasaAts::AbortFunction = PollAbort; + boolean ret = CasaAts::Write(); + return ret ? `next : `abort; +} + +/** + * Summary dialog + * @return dialog result + */ +any SummaryDialog() { + + /* CasaAts summary dialog caption */ + string caption = _("CasaAts Configuration"); + + /* FIXME */ + list summary = CasaAts::Summary(); + list unconfigured = summary[1]:[]; + string configured = summary[0]:""; + + /* Frame label */ + term contents = Wizard_hw::DetectedContent(_("CasaAts to Configure"), + unconfigured, false, configured); + + Wizard::SetContentsButtons(caption, contents, HELPS["summary"]:"", + Label::BackButton(), Label::FinishButton()); + + any ret = nil; + while(true) { + + ret = UI::UserInput(); + + /* abort? */ + if(ret == `abort || ret == `cancel || ret == `back) { + if(ReallyAbort()) break; + else continue; + } + /* overview dialog */ + else if(ret == `edit_button) { + ret = `overview; + break; + } + /* configure the selected device */ + else if(ret == `configure_button) { + // TODO FIXME: check for change of the configuration + any selected = UI::QueryWidget(`id(`detected_selbox), `CurrentItem); + if(selected == `other) { + ret = `other; + } + else { + ret = `configure; + } + break; + } + else if(ret == `next) { + break; + } + else { + y2error("unexpected retcode: %1", ret); + continue; + } + } + + return ret; +} + +/** + * Overview dialog + * @return dialog result + */ +any OverviewDialog() { + + /* CasaAts overview dialog caption */ + string caption = _("CasaAts Overview"); + + list overview = CasaAts::Overview(); + + /* FIXME table header */ + term contents = Wizard_hw::ConfiguredContent( + /* Table header */ + `header(_("Number"), _("CasaAts")), + overview, nil, nil, nil, nil ); + + contents = Wizard_hw::SpacingAround(contents, 1.5, 1.5, 1.0, 1.0); + + Wizard::SetContentsButtons(caption, contents, HELPS["overview"]:"", + Label::BackButton(), Label::FinishButton()); + + any ret = nil; + while(true) { + + ret = UI::UserInput(); + + /* abort? */ + if(ret == `abort || ret == `cancel) { + if(ReallyAbort()) break; + else continue; + } + /* add */ + else if(ret == `add_button) { + /* FIXME */ + ret = `add; + break; + } + /* edit */ + else if(ret == `edit_button) { + /* FIXME */ + ret = `edit; + break; + } + /* delete */ + else if(ret == `delete_button) { + /* FIXME */ + continue; + } + else if(ret == `next || ret == `back) { + break; + } + else { + y2error("unexpected retcode: %1", ret); + continue; + } + } + + return ret; +} + +/* EOF */ +} diff --git a/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp b/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp new file mode 100644 index 00000000..b727ceed --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/dialogs.ycp @@ -0,0 +1,170 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact 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 */ +} diff --git a/CASA-auth-token/yast2-casa-ats/src/helps.ycp b/CASA-auth-token/yast2-casa-ats/src/helps.ycp new file mode 100644 index 00000000..d040d28f --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/helps.ycp @@ -0,0 +1,69 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact 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/helps.ycp + * Package: Configuration of casa-ats + * Summary: Help texts of all the dialogs + * Authors: Ryan Partridge + * + * $Id: helps.ycp 27914 2006-02-13 14:32:08Z locilka $ + */ + +{ + +textdomain "casa-ats"; + +/** + * All helps are here + */ +map HELPS = $[ + + /* Read dialog help 1/2 */ + "read" : _("

Initializing CASA Authentication Token Service Configuration
+Please wait...

+") + + + /* Read dialog help 2/2 */ + _("

Aborting Initialization:
+Safely abort the configuration utility by pressing Abort now.

+"), + + /* Write dialog help 1/2 */ + "write" : _("

Saving CASA Authentication Token Service Configuration
+Please wait...

+") + + + /* Write dialog help 2/2 */ +_("

Aborting Saving:
+Abort the save procedure by pressing Abort. +An additional dialog informs whether it is safe to do so. +

+"), + + /* ATS info dialog help 1/3 */ + "atsinfo" : _("

CASA Authentication Token Service Configuration
+Configure the CASA Authentication Token Service here.

+"), + +]; + +/* EOF */ +} diff --git a/CASA-auth-token/yast2-casa-ats/src/wizards.ycp b/CASA-auth-token/yast2-casa-ats/src/wizards.ycp new file mode 100644 index 00000000..0bb377fd --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/src/wizards.ycp @@ -0,0 +1,147 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved. + * + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of version 2 of the GNU General Public License as published by the + * Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, contact 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/wizards.ycp + * Package: Configuration of casa-ats + * Summary: Wizards definitions + * Authors: Ryan Partridge + * + * $Id: wizards.ycp 27914 2006-02-13 14:32:08Z locilka $ + */ + +{ + +textdomain "casa-ats"; + +import "Sequencer"; +import "Wizard"; + +include "casa-ats/complex.ycp"; +include "casa-ats/dialogs.ycp"; + +/** + * Add a configuration of casa-ats + * @return sequence result + */ +any AddSequence() { + + /* FIXME: adapt to your needs */ + map aliases = $[ + "atsinfo" : ``(ATSInfoDialog()), + ]; + + /* FIXME: adapt to your needs */ + map sequence = $[ + "ws_start" : "config1", + "atsinfo" : $[ + `abort : `abort, + `next : `next + ] + ]; + + return Sequencer::Run(aliases, sequence); +} + +/** + * Main workflow of the casa-ats configuration + * @return sequence result + */ +any MainSequence() { + + /* FIXME: adapt to your needs */ + map aliases = $[ + "atsinfo" : ``( ATSInfoDialog() ) + ]; + + /* FIXME: adapt to your needs */ + map sequence = $[ + "ws_start" : "atsinfo", + "atsinfo" : $[ + `abort : `abort, + `next : `next + ] + ]; + + any ret = Sequencer::Run(aliases, sequence); + + return ret; +} + +/** + * Whole configuration of casa-ats + * @return sequence result + */ +any CasaAtsSequence() { + + map aliases = $[ + "read" : [ ``( ReadDialog() ), true ], + "main" : ``( MainSequence() ), + "write" : [ ``( WriteDialog() ), true ] + ]; + + map sequence = $[ + "ws_start" : "read", + "read" : $[ + `abort : `abort, + `next : "main" + ], + "main" : $[ + `abort : `abort, + `next : "write" + ], + "write" : $[ + `abort : `abort, + `next : `next + ] + ]; + + Wizard::CreateDialog(); + + any ret = Sequencer::Run(aliases, sequence); + + UI::CloseDialog(); + return ret; +} + +/** + * Whole configuration of casa-ats but without reading and writing. + * For use with autoinstallation. + * @return sequence result + */ +any CasaAtsAutoSequence() { + + /* Initialization dialog caption */ + string caption = _("CasaAts Configuration"); + /* Initialization dialog contents */ + term contents = `Label(_("Initializing...")); + + Wizard::CreateDialog(); + Wizard::SetContentsButtons(caption, contents, "", + Label::BackButton(), Label::NextButton()); + + any ret = MainSequence(); + + UI::CloseDialog(); + return ret; +} + +/* EOF */ +} diff --git a/CASA-auth-token/yast2-casa-ats/testsuite/Makefile.am b/CASA-auth-token/yast2-casa-ats/testsuite/Makefile.am new file mode 100644 index 00000000..d9b12b09 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/testsuite/Makefile.am @@ -0,0 +1,21 @@ +# +# Makefile.am for .../testsuite +# +# Do not edit this file (Makefile.am) as it will be overwritten! +# + +AUTOMAKE_OPTIONS = dejagnu +EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.ycp) $(wildcard tests/*.yh) + +testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite + +all-local: $(testsuite_prepare) + make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) + +clean-local: $(testsuite_prepare) + make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean + +check-local: $(testsuite_prepare) + make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check + +# EOF diff --git a/CASA-auth-token/yast2-casa-ats/yast2-casa-ats.spec.in b/CASA-auth-token/yast2-casa-ats/yast2-casa-ats.spec.in new file mode 100644 index 00000000..97bda4d4 --- /dev/null +++ b/CASA-auth-token/yast2-casa-ats/yast2-casa-ats.spec.in @@ -0,0 +1,30 @@ +@HEADER-COMMENT@ + +@HEADER@ +Requires: yast2 +BuildRequires: perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite + +BuildArchitectures: noarch + +Summary: Configuration of casa-ats + +%description +- + +@PREP@ + +@BUILD@ + +@INSTALL@ + +@CLEAN@ + +%files +%defattr(-,root,root) +%dir @yncludedir@/casa-ats +@yncludedir@/casa-ats/* +@scrconfdir@/*.scr +@clientdir@/*.ycp +@moduledir@/CasaAts.* +@desktopdir@/casa-ats.desktop +%doc @docdir@