ACC SHELL

Path : /usr/share/YaST2/include/network/remote/
File Upload :
Current File : //usr/share/YaST2/include/network/remote/dialogs.ycp

/**
 * File:	remote/dialogs.ycp
 * Module:	Network configuration
 * Summary:	Dialog for Remote Administration
 * Authors:	Arvin Schnell <arvin@suse.de>
 *
 * $Id: dialogs.ycp 54992 2009-01-26 11:43:30Z mzugec $
 */

{

textdomain "network";

import "Label";
import "Remote";
import "Wizard";
import "CWMFirewallInterfaces";

include "network/routines.ycp";

/**
 * Remote administration dialog
 * @return dialog result
 */
define symbol RemoteMainDialog() {

    ScreenName("remote");

    /* Ramote Administration dialog caption */
    string caption = _("Remote Administration");

    term allow_buttons = `RadioButtonGroup(
	`VBox (
	    /* RadioButton label */
	    `Left(`RadioButton(`id(`allow), _("&Allow Remote Administration"), false)),
	    /* RadioButton label */
	    `Left(`RadioButton(`id(`disallow), _("&Do Not Allow Remote Administration"), false))
	)
    );

    map<string,any> firewall_widget = CWMFirewallInterfaces::CreateOpenFirewallWidget ($[
	//Service vnc renamed to service:xorg-x11-server (#431971)
	"services" : [ "service:xorg-x11-server" ],
	"display_details" : true,
    ]);
    term firewall_layout = firewall_widget["custom_widget"]:`VBox ();
    string firewall_help = firewall_widget["help"]:"";

    /* Remote Administration dialog help
       %1 and %2 are port numbers for vnc and vnchttp, eg. 5901, 5801 */
    string help = sformat (
_("<p><b><big>Remote Administration Settings</big></b></p>
<p>If this feature is enabled, you can
administer this machine remotely from another machine. Use a VNC
client, such as krdc (connect to <tt>&lt;hostname&gt;:%1</tt>), or
a Java-capable Web browser (connect to <tt>http://&lt;hostname&gt;:%2/</tt>).
This form of remote administration is less secure than using SSH.</p>
"), 5901, 5801) + firewall_help;

    /* Remote Administration dialog contents */
    term contents = `HBox(
	`HStretch(),
	`VBox (
	    `Frame (
		/* Dialog frame title */
		_("Remote Administration Settings"),
		allow_buttons
	    ),
	    `VSpacing (1),
	    `Frame (
		/* Dialog frame title */
		_("Firewall Settings"),
		firewall_layout
	    )
	),
	`HStretch()
    );

    Wizard::SetContentsButtons(caption, contents, help,
	    Label::BackButton(), Label::FinishButton());
    Wizard::SetNextButton(`next, Label::OKButton());
    Wizard::SetAbortButton(`abort, Label::CancelButton());
    Wizard::HideBackButton();

    UI::ChangeWidget(`id(`allow), `Value, Remote::allow_administration);
    UI::ChangeWidget(`id(`disallow), `Value, !Remote::allow_administration);

    CWMFirewallInterfaces::OpenFirewallInit (firewall_widget, "");

    any ret = nil;
    map event = nil;

    repeat {
	event = UI::WaitForEvent ();
	ret = event["ID"]:nil;

	CWMFirewallInterfaces::OpenFirewallHandle (firewall_widget, "", event);

	if(ret == `abort)
	{
	    break;
	}
	else if(ret == `help)
	{
	    Wizard::ShowHelp(help);
	}
	else if(ret == `cancel)
	{
	   break;
	}

    } until( ret == `next || ret == `back );

    if(ret == `next)
    {
	CWMFirewallInterfaces::OpenFirewallStore (firewall_widget, "", event);
	Remote::allow_administration = (boolean) UI::QueryWidget(`id(`allow), `Value);
    }

    return (symbol) ret;
}

/* EOF */
}

ACC SHELL 2018