/**
 * File:	clients/autoinst_scripts.ycp
 * Package:	Autoinstallation Configuration System
 * Summary:	Scripts
 * Authors:	Anas Nashif<nashif@suse.de>
 *
 * $Id: scripts_auto.ycp 19262 2004-09-12 21:31:48Z nashif $
 */
{
    textdomain "autoinst";

    import "AutoinstScripts";
    import "Wizard";
    import "Summary";

    import "Label";
    import "Popup";

    include "autoinstall/script_dialogs.ycp";

    any ret = nil;
    string func = "";
    map param = $[];

    /* Check arguments */
    if(size(WFM::Args()) > 0 && is(WFM::Args(0), string))
    {
	func = (string) WFM::Args(0);
	if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
	{
	    param = (map) WFM::Args(1);
	}
    }

    y2debug("func=%1", func);
    y2debug("param=%1", param);

    if (func == "Import")
    {
	ret = AutoinstScripts::Import(param);
    }
    /* create a  summary*/
    else if (func == "Summary")
    {
	ret =  AutoinstScripts::Summary();
    }
    else if (func == "Reset")
    {
	AutoinstScripts::Import($[]);
	ret =  $[];
    }
    else if (func == "GetModified")
    {
	ret = AutoinstScripts::GetModified();
    }
    else if (func == "SetModified")
    {
	AutoinstScripts::SetModified();
    }
    else if (func == "Change") {
        Wizard::CreateDialog();
        Wizard::SetDesktopIcon("autoyast");
	ret = ScriptsDialog();
	Wizard::CloseDialog();
    }
    else if (func == "Export")
    {
	ret = AutoinstScripts::Export();
    }
    /* unknown function */
    else {
	y2error("unknown function: %1", func);
	ret = false;
    }

    y2debug("ret=%1", ret);
    y2milestone("scripts auto finished");
    y2milestone("----------------------------------------");

    return ret;
}


