ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/media_proposal.ycp

/**
 * Module:	media_proposal.ycp
 *
 * Author:	Arvin Schnell <arvin@suse.de>
 *
 * Purpose:	Initialize the installation media.
 *
 * $Id: media_proposal.ycp 41684 2007-10-31 13:15:08Z locilka $
 *
 */
{
    textdomain "packager";

    import "HTML";
    import "Mode";
    import "Language";
    import "Packages";
    import "PackageCallbacks";

    import "Installation";


    string func = (string) WFM::Args(0);
    map param = (map) WFM::Args(1);
    map <string, any> ret = $[];


    if ( func == "MakeProposal" )
    {
	boolean force_reset      = param["force_reset"     ]:false;
	boolean language_changed = param["language_changed"]:false;

	UI::OpenDialog (`opt(`decorated),
			// intermediate popup while initializing internal packagemanagement
			`Label(_("Reading package information. One moment please...")));

	Packages::Init (true);

	UI::CloseDialog();

	integer num = size (Packages::theSources);
	if (num <= 0)
	{
	    y2error ("Invalid repository");
	    ret = $[ "warning" :
                     // Proposal for system to update, part of the richtext
                     _("No Valid Installation Media"),
                     "warning_level" : `blocker
            ];
	}
	else
	{
	    list <string> tmp = [];

	    foreach (integer i, Packages::theSources, {
		map new_product = Pkg::SourceProductData (i);
		tmp = add (tmp, new_product["label"]:"?");
	    });

	    ret = $[ "preformatted_proposal" : HTML::List (tmp) ];
	}
    }
    else if ( func == "AskUser" )
    {
	boolean has_next = param["has_next"]:false;

	// call some function that displays a user dialog
	// or a sequence of dialogs here:
	//
	// sequence = DummyMod::AskUser( has_next );

	symbol result = (symbol) WFM::CallFunction ("inst_media", [true, has_next]);

	// Fill return map

	ret = $[ "workflow_sequence" : result ];
    }
    else if ( func == "Description" )
    {
	// Fill return map.
	//
	// Static values do just nicely here, no need to call a function.

	ret =
	    $[
	      // this is a heading
	      "rich_text_title"	:	_("Installation Media"),
	      // this is a menu entry
	      "menu_title"	:	_("&Media"),
	      "id"		:	"media_stuff"
	    ];
    }

    return ret;
}

ACC SHELL 2018