CASA/casa-yast/src/complex.ycp

242 lines
6.0 KiB
Plaintext
Raw Normal View History

2006-04-14 22:38:26 +02:00
/**
* File: include/novell-casa/complex.ycp
* Package: Configuration of novell-casa
* Summary: Dialogs definitions
* Authors: casa <casa@novell.com>
*
* $Id: complex.ycp,v 1.6 2004/02/05 15:16:57 msvec Exp $
*/
{
textdomain "novell-casa";
import "Label";
import "Popup";
import "Wizard";
//import "Wizard_hw";
import "NovellCasa";
include "novell-casa/helps.ycp";
/**
* Return a modification status
* @return true if data was modified
*/
boolean Modified() {
return NovellCasa::Modified();
}
boolean ReallyAbort() {
return !NovellCasa::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"]:"");
// NovellCasa::AbortFunction = PollAbort;
boolean ret = NovellCasa::Read();
return ret ? `next : `abort;
}
/**
* Write settings dialog
* @return `abort if aborted and `next otherwise
*/
symbol WriteDialog() {
Wizard::RestoreHelp(HELPS["write"]:"");
// NovellCasa::AbortFunction = PollAbort;
boolean ret = NovellCasa::Write();
return ret ? `next : `abort;
}
/**
* Summary dialog
* @return dialog result
*/
any SummaryDialog() {
/* NovellCasa summary dialog caption */
string caption = _("Novell CASA Configuration");
/* FIXME */
list summary = NovellCasa::Summary();
list unconfigured = summary[1]:[];
string configured = summary[0]:"";
/* Frame label */
// term contents = Wizard_hw::DetectedContent(_("NovellCasa to Configure"),
// unconfigured, false, configured);
term contents = `Frame(_(" Novell CASA Configuration Wizard Pages "),
`VBox(
`VSpacing(),
`VSpacing(),
`PushButton(`id(`install_casa_button),`opt(`default), _("&Configure CASA")),
`VSpacing(),
`VSpacing(),
`PushButton(`id(`uninstall_casa_button),`opt(`default), _("&Unconfigure CASA")),
`VSpacing(),
`VSpacing()
));
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 if(ret == `install_casa_button) {
// launch the install script here
y2milestone ("SummaryDialog() launch the install script");
integer iInstall_CASAReturn = (integer)SCR::Execute(.target.bash, "/usr/sbin/casacfgpam");
if(iInstall_CASAReturn == 0)
{
y2milestone(sformat("SummaryDialog() SCR::Execute(.target.bash, /usr/sbin/casacfgpam) returned: %1",iInstall_CASAReturn));
Popup::Message(sformat("YaST Configured CASA successfully."));
}
else if(iInstall_CASAReturn == 127)
{
Popup::Error(sformat("YaST was unable to find the casacfgpam script."));
}
else
{
Popup::Error(sformat("The install_casa script returned an unknown error: %1",iInstall_CASAReturn));
}
continue;
}
else if(ret == `uninstall_casa_button) {
// launch the uninstall script here
y2milestone ("SummaryDialog() launch the uninstall script");
integer iUninstall_CASAReturn = (integer)SCR::Execute(.target.bash, "/usr/sbin/casaucfgpam");
if(iUninstall_CASAReturn == 0)
{
y2milestone(sformat("SummaryDialog() SCR::Execute(.target.bash, /usr/sbin/casaucfgpam) returned: %1",iUninstall_CASAReturn));
Popup::Message(sformat("YaST Unconfigured CASA successfully."));
}
else if(iUninstall_CASAReturn == 127)
{
Popup::Error(sformat("YaST was unable to find the casaucfgpam script."));
}
else
{
Popup::Error(sformat("The uninstall_casa script returned an unknown error: %1",iUninstall_CASAReturn));
}
continue;
}
else {
y2error("unexpected retcode: %1", ret);
continue;
}
}
return ret;
}
/**
* Overview dialog
* @return dialog result
*/
any OverviewDialog() {
/* NovellCasa overview dialog caption */
string caption = _("Novell CASA Overview");
list overview = NovellCasa::Overview();
/* FIXME table header */
// term contents = Wizard_hw::ConfiguredContent(
// /* Table header */
// `header(_("Number"), _("Novell CASA")),
// overview, nil, nil, nil, nil );
// contents = Wizard_hw::SpacingAround(contents, 1.5, 1.5, 1.0, 1.0);
term contents = `Frame(_("Novell Client Configuration Wizard Pages"),
`VBox(
`VSpacing(),
`VSpacing(),
`PushButton(`id(`start_wizard_button),`opt(`default), _("Re&start Wizard")),
`VSpacing()
));
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 */
}