/**
 * File:	include/ldap-client/wizards.ycp
 * Package:	Configuration of ldap-client
 * Summary:	Wizards definitions
 * Authors:	Jiri Suchomel <jsuchome@suse.cz>
 *
 * $Id: wizards.ycp 20588 2004-12-16 14:55:20Z jsuchome $
 */

{

textdomain "ldap-client";

import "Sequencer";
import "Wizard";
import "Label";

include "ldap/ui.ycp";

/**
 * Main workflow of the ldap-client configuration
 * @return sequence result
 */
define any MainSequence() ``{

    map aliases = $[
	"ldap"		: ``( LdapDialog() ),
	"advanced"	: ``( AdvancedConfigurationDialog ()),
	"configure"	: ``( ModuleConfigurationDialog ()),
	"read_ldap"	: [``(LDAPReadDialog ()), true ],
    ];

    map sequence = $[
	"ws_start"	: "ldap",
	"ldap" : $[
	    `abort	: `abort,
	    `cancel	: `abort,
	    `advanced	: "advanced",
	    `next	: `next
	],
	"read_ldap": $[
	    `abort	: `abort,
	    `cancel	: `abort,
	    `next	: "configure",
	    `skip	: "ldap"
	],
	"advanced": $[
	    `abort	: `abort,
	    `cancel	: `abort,
	    `next	: "ldap",
	    `configure	: "read_ldap"
	],
	"configure": $[
	    `abort	: `abort,
	    `cancel	: `abort,
	    `next	: "advanced",
	],
    ];

    any ret = Sequencer::Run (aliases, sequence);

    return ret;
}

/**
 * Whole configuration of ldap-client but without reading and writing.
 * For use with autoinstallation.
 * @return sequence result
 */
define symbol LdapAutoSequence() ``{

    string caption = _("LDAP Client Configuration");
    term contents = `Label(_("Initializing ..."));

    Wizard::CreateDialog();
    Wizard::SetDesktopIcon("ldap");
    Wizard::SetContentsButtons(caption, contents, "",
	    Label::BackButton(), Label::NextButton());

    any ret = MainSequence();

    UI::CloseDialog();
    return (symbol) ret;
}

/**
 * Whole configuration of ldap-client
 * @return sequence result
 */
define symbol LdapSequence() ``{

    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();
    Wizard::SetDesktopIcon("ldap");

    any ret = Sequencer::Run (aliases, sequence);

    UI::CloseDialog();
    return (symbol) ret;
}

/* EOF */
}
