CASA/casa-yast/src/NovellCasa.ycp
2006-04-14 20:38:26 +00:00

268 lines
6.0 KiB
Plaintext

/**
* File: modules/NovellCasa.ycp
* Package: Configuration of novell-casa
* Summary: NovellCasa settings, input and output functions
* Authors: casa <casa@novell.com>
*
* $Id: NovellCasa.ycp,v 1.13 2004/03/15 13:18:08 mvidner Exp $
*
* Representation of the configuration of novell-casa.
* Input and output routines.
*/
{
module "NovellCasa";
textdomain "novell-casa";
import "Progress";
import "Report";
import "Summary";
/**
* Prototypes
*/
global boolean Modified();
/**
* 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;
}
// Settings: Define all variables needed for configuration of novell-casa
// TODO FIXME: Define all the variables necessary to hold
// TODO FIXME: the configuration here (with the appropriate
// TODO FIXME: description)
// TODO FIXME: For example:
// /**
// * List of the configured cards.
// */
// list cards = [];
//
// /**
// * Some additional parameter needed for the configuration.
// */
// boolean additional_parameter = true;
/**
* Read all novell-casa settings
* @return true on success
*/
global boolean Read() {
/* NovellCasa read dialog caption */
string caption = _("Initializing novell-casa Configuration");
// TODO FIXME 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/3 */
_("Read the database"),
/* Progress stage 2/3 */
_("Read the previous settings"),
/* Progress stage 3/3 */
_("Detect the devices")
], [
/* Progress step 1/3 */
_("Reading the database..."),
/* Progress step 2/3 */
_("Reading the previous settings..."),
/* Progress step 3/3 */
_("Detecting the devices..."),
/* Progress finished */
_("Finished")
],
""
);
// read database
if(Abort()) return false;
Progress::NextStage();
/* Error message */
if(false) Report::Error(_("Cannot read the database1."));
sleep(sl);
// read another database
if(Abort()) return false;
Progress::NextStep();
/* Error message */
if(false) Report::Error(_("Cannot read the database2."));
sleep(sl);
// read current settings
if(Abort()) return false;
Progress::NextStage();
/* Error message */
if(false) Report::Error(_("Cannot read current settings."));
sleep(sl);
// detect devices
if(Abort()) return false;
Progress::NextStage();
/* Error message */
if(false) Report::Warning(_("Cannot detect devices."));
sleep(sl);
if(Abort()) return false;
/* Progress finished */
Progress::NextStage();
sleep(sl);
if(Abort()) return false;
modified = false;
return true;
}
/**
* Write all novell-casa settings
* @return true on success
*/
global boolean Write() {
/* NovellCasa read dialog caption */
string caption = _("Saving novell-casa Configuration");
// TODO FIXME And 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 */
_("Write the settings"),
/* Progress stage 2/2 */
_("Run SuSEconfig")
], [
/* Progress step 1/2 */
_("Writing the settings..."),
/* Progress step 2/2 */
_("Running SuSEconfig..."),
/* Progress finished */
_("Finished")
],
""
);
// write settings
if(Abort()) return false;
Progress::NextStage();
/* Error message */
if(false) Report::Error (_("Cannot write settings."));
sleep(sl);
// run SuSEconfig
if(Abort()) return false;
Progress::NextStage ();
/* Error message */
if(false) Report::Error (_("SuSEconfig script failed."));
sleep(sl);
if(Abort()) return false;
/* Progress finished */
Progress::NextStage();
sleep(sl);
if(Abort()) return false;
return true;
}
/**
* Get all novell-casa 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 novell-casa 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":[] ];
}
/* EOF */
}