ACC SHELL

Path : /proc/self/root/usr/share/YaST2/clients/
File Upload :
Current File : //proc/self/root/usr/share/YaST2/clients/nfs-client4part.ycp

/**
 * File:	clients/
 * Summary:	nfs-client stuff made accesible from
 * Author:	Bubli <kmachalkova@suse.cz>
 *
 */

{
    textdomain "nfs";

    import "Nfs";
    import "Wizard";
    include "nfs/ui.ycp";

    /*y2milestone("----------------------------------------");
    y2milestone("Nfs client proposal started");
    y2milestone("Arguments: %1", WFM::Args());*/

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

    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);
    }

    map <string, any> ToStorage ( map <string, any> entry )
    {
	map <string, any> ret = $[];

	if (entry != nil && entry != $[])
	{
	    ret =  $[
		"device" : entry["spec"]:"",
		"mount" : entry["file"]:"",
		"fstopt" : entry["mntops"]:"",
		"vfstype" : entry["vfstype"]:"nfs"
	    ];
	    if (haskey ( entry, "old" ))
		ret = add(ret,  "old_device" , entry["old"]:"" );
	}
	return ret;
    }

    if (func == "CreateUI")
    {
	Wizard::SetHelpText( help_text1 );
	return MainDialogLayout();
    }

    else if ( func == "FromStorage" )
    {
	list <map <string, any> > shares = ( list < map <string, any> >) param["shares"]:[];

	Nfs::nfs_entries = maplist( map <string, any> entry, shares, {
	    return ( $[
		"spec" : entry["device"]:"",
	        "file" : entry["mount"]:"",
		"vfstype" : entry["used_fs"]:`nfs == `nfs ? "nfs" : "nfs4",
		"mntops": entry["fstopt"]:""
	    ]);
	});
	y2milestone("Nfs shares imported from storage %1", Nfs::nfs_entries);
        nfs_entries = Nfs::nfs_entries;
	InitFstabEntries();

    }
    else if (func == "Read")
    {
	Nfs::skip_fstab = true;
	Nfs::Read();
    }
    else if (func == "HandleEvent")
    {
	any widget_id = param["widget_id"]:nil;
	list <symbol> w_ids = [ `newbut, `editbut, `delbut ];

	HandleEvent( widget_id);
	y2milestone("%1", modify_line);
        Nfs::nfs_entries = nfs_entries;

	if ( contains( w_ids, (symbol) widget_id ))
	    return ToStorage( modify_line );
	else
	   return nil;
    }

}

ACC SHELL 2018