ACC SHELL

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

/**
 * File:	clients/remote.ycp
 * Package:	Network configuration
 * Summary:	Remote Administration
 * Authors:	Arvin Schnell <arvin@suse.de>
 *		Michal Svec <msvec@suse.cz>
 *
 * $Id: remote.ycp 23253 2005-05-03 08:00:13Z locilka $
 */

{

textdomain "network";

/* The main () */
y2milestone("----------------------------------------");
y2milestone("Remote module started");

import "Label";
import "Remote";
import "Wizard";
import "Report";

import "CommandLine";
import "RichText";

include "network/remote/dialogs.ycp";

/**
 * Main remote GUI
 */
any RemoteGUI() {
    Remote::Read();

    Wizard::CreateDialog();
    Wizard::SetDesktopIcon("remote");
    Wizard::SetNextButton(`next, Label::FinishButton() );

    any ret = RemoteMainDialog();
    if(ret == `next) Remote::Write();

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

/**
 * Handler for action "list"
 * @param options action options
 */
define boolean ListHandler(map<string, string> options) {

    string summary = "";
    /* Command line output Headline */
    summary = "\n" + _("Remote Access Configuration Summary:") + "\n\n" +
	RichText::Rich2Plain(Remote::Summary()) + "\n";

    y2debug("%1", summary);
    CommandLine::Print(summary);
    return true;
}

/**
 * Handler for action "allow"
 * @param options action options
 */
define boolean SetRAHandler (map<string, string> options) {
    string allow_ra = tolower(options["set"]:"");

    if (allow_ra != "yes" && allow_ra != "no") {
	/* Command line error message */
	Report::Error(_("Please set 'yes' to allow the remote administration
or 'no' to disallow it."));
	return false;
    }

    y2milestone("Setting AllowRemoteAdministration to '%1'", allow_ra);
    Remote::allow_administration = (allow_ra == "yes" ? true : false);

    return true;
}

/**
 * Command line definition
 */
map cmdline = $[
    /* Commandline help title */
    "help"	: _("Remote Access Configuration"),
    "id"	: "remote",
    "guihandler": RemoteGUI,
    "initialize": Remote::Read,
    "finish"	: Remote::Write,
    "actions"	: $[
	"list" : $[
	    /* Commandline command help */
	    "help"	: _("Display configuration summary"),
	    "handler"	: ListHandler,
	],
	"allow" : $[
	    /* Commandline command help */
	    "help"	: _("Allow remote access"),
	    "handler"	: SetRAHandler,
	    "example"	: [
		"allow set=yes",
		"allow set=no",
	    ],
	],
    ],
    "options" : $[
	"set" : $[
	    /* Commandline command help */
	    "help" : _("Set 'yes' to allow or 'no' to disallow the remote administration"),
	    "type" : "string",
	]
    ],
    "mappings" : $[
	"allow" : [ "set" ],
    ],
];

any ret = CommandLine::Run(cmdline);
y2debug("ret=%1", ret);

/* Finish */
y2milestone("Remote module finished");
y2milestone("----------------------------------------");
return ret;

/* EOF */
}

ACC SHELL 2018