ACC SHELL

Path : /usr/share/YaST2/include/ntp-client/
File Upload :
Current File : //usr/share/YaST2/include/ntp-client/wizards.ycp

/**
 * File:	include/ntp-client/wizards.ycp
 * Package:	Configuration of ntp-client
 * Summary:	Wizards definitions
 * Authors:	Jiri Srain <jsrain@suse.cz>
 *
 * $Id: wizards.ycp 23428 2005-05-17 13:29:36Z locilka $
 */

{

textdomain "ntp-client";

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

include "ntp-client/dialogs.ycp";

/**
 * Complex workflow of the ntp-client configuration
 * @return sequence result
 */
define symbol ComplexSequence() ``{

    map aliases = $[
	"main"		:   ``(MainDialog ()),
	"type_select"	:   ``(TypeSelectDialog ()),
	"server"	:   ``(ServerDialog ()),
	"server_select_local"	:   ``(LocalServerSelectionDialog ()),
	"server_select_public"	:   ``(PublicServerSelectionDialog ()),
	"peer"		:   ``(PeerDialog ()),
	"clock"		:   ``(RadioDialog ()),
	"fudge"		:   ``(FudgeDialog ()),
	"bcast"		:   ``(BCastDialog ()),
	"bcastclient"	:   ``(BCastClientDialog ()),
	"store_record"	: [ ``(StoreRecord ()), true],
    ];

    map sequence = $[
	"ws_start" : "main",
	"main" : $[
	    `abort	: `abort,
	    `next	: `next,
	    `peer	: "peer",
	    `server	: "server",
	    `clock	: "clock",
	    `bcast	: "bcast",
	    `bcastclient: "bcastclient",
	    `add	: "type_select",
	],
	"type_select" : $[
	    `abort	: `abort,
	    `peer	: "peer",
	    `server	: "server",
	    `clock	: "clock",
	    `bcast	: "bcast",
	    `bcastclient: "bcastclient",
	],
	"peer" : $[
	    `abort	: `abort,
	    `next	: "store_record",
	],
	"server" : $[
	    `abort	: `abort,
	    `next	: "store_record",
	    `select_local	: "server_select_local",
	    `select_public	: "server_select_public",
	],
	"server_select_local" : $[
	    `abort	: `abort,
	    `next	: "server",
	    `back	: "server",
	],
	"server_select_public" : $[
	    `abort	: `abort,
	    `next	: "server",
	    `back	: "server",
	],
	"clock" : $[
	    `abort	: `abort,
	    `next	: "store_record",
	    `fudge	: "fudge"
	],
	"fudge" : $[
	    `abort	: `abort,
	    `next	: "clock",
	],
	"bcast" : $[
	    `abort	: `abort,
	    `next	: "store_record",
	],
	"bcastclient" : $[
	    `abort	: `abort,
	    `next	: "store_record",
	],
	"store_record" : $[
	    `abort	: `abort,
	    `next	: "main",
	],
    ];

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

    return ret;
}

/**
  * The simple workflow for the NTP client
  * @return sequence result
  */
define symbol SimpleSequence () ``{

    NtpClient::selected_record = $[
	"type" : "__clock",
	"address" : "127.127.3.2",
    ];

    map aliases = $[
	"switcher"	:[``(SelectConfigType ()), true ],
	"simple_pre"	:[``(SimpleDialogPrepare ()), true ],
	"simple"	: ``(SimpleDialog ()),
	"simple_post"	:[``(SimpleDialogFinish ()), true ],
	"server_select_local"	: ``(LocalServerSelectionDialog ()),
	"server_select_public"	: ``(PublicServerSelectionDialog ()),
	"complex"	: ``(ComplexSequence ()),
    ];

    map sequence = $[
	"ws_start" : "switcher",
	"switcher" : $[
	    `simple : "simple_pre",
	    `complex : "complex",
	],
	"simple_pre" : $[
	    `abort	: `abort,
	    `next	: "simple",
	],
	"simple" : $[
	    `abort	: `abort,
	    `next	: "simple_post",
	    `complex	: "complex",
	    `select_local	: "server_select_local",
	    `select_public	: "server_select_public",
	],
	"simple_post" : $[
	    `abort	: `abort,
	    `next	: `next,
	],
	"server_select_local" : $[
	    `abort	: `abort,
	    `next	: "simple",
	    `back	: "simple",
	],
	"server_select_public" : $[
	    `abort	: `abort,
	    `next	: "simple",
	    `back	: "simple",
	],
	"complex" : $[
	    `abort	: `abort,
	    `next	: `next,
	],
    ];

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

    return ret;
}

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

    map aliases = $[
	"read"	: [ ``( ReadDialog() ), true ],
	"main"	:   ``( SimpleSequence() ),
	"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("ntp-client");
    symbol ret = Sequencer::Run(aliases, sequence);

    UI::CloseDialog();
    return ret;
}

/**
 * Autoyast configuration of ntp-client
 * @return sequence result
 */
define symbol NtpClientAutoSequence() ``{

    map aliases = $[
	"main"	:   ``( ComplexSequence() )
    ];

    map sequence = $[
	"ws_start" : "main",
	"main" : $[
	    `abort  : `abort,
	    `next   : `next
	]
    ];

    // dialog caption
    string caption = _("NTP Client Configuration");
    // label
    term contents = `Label(_("Initializing ..."));

    Wizard::CreateDialog();
    Wizard::SetDesktopIcon("ntp-client");
    Wizard::SetContentsButtons(caption, contents, "",
	    Label::BackButton(), Label::NextButton());

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

    UI::CloseDialog();
    return ret;
}
/* EOF */
}

ACC SHELL 2018