2006-04-14 22:38:26 +02:00
|
|
|
/**
|
2006-04-19 00:12:38 +02:00
|
|
|
* File: include/CASA/complex.ycp
|
|
|
|
* Package: Configuration of CASA
|
2006-04-14 22:38:26 +02:00
|
|
|
* Summary: Dialogs definitions
|
|
|
|
* Authors: casa <casa@novell.com>
|
|
|
|
*
|
2006-04-19 00:12:38 +02:00
|
|
|
*********************************************************************
|
|
|
|
* Copyright (C) 2005-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.
|
|
|
|
*
|
|
|
|
*********************************************************************
|
|
|
|
*
|
2006-04-14 22:38:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
|
|
|
|
2006-04-19 00:12:38 +02:00
|
|
|
textdomain "CASA";
|
2006-04-14 22:38:26 +02:00
|
|
|
|
|
|
|
import "Label";
|
|
|
|
import "Popup";
|
|
|
|
import "Wizard";
|
|
|
|
//import "Wizard_hw";
|
|
|
|
import "NovellCasa";
|
|
|
|
|
2006-04-19 00:12:38 +02:00
|
|
|
include "CASA/helps.ycp";
|
2006-04-14 22:38:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 */
|
|
|
|
}
|