Commit bc07959d authored by Franco Fichtner's avatar Franco Fichtner

wizard: rework modelling and UX

PR: https://github.com/opnsense/core/issues/1359

(cherry picked from commit fc3fcf8a)
(cherry picked from commit 53bf7022)
(cherry picked from commit 597adf4f)
(cherry picked from commit bf1e663a)
(cherry picked from commit d63442d5)
(cherry picked from commit 9073176f)
(cherry picked from commit 6ba6098b)
(cherry picked from commit 367d2e20)
(cherry picked from commit 7b6ab769)
(cherry picked from commit 1f3458ec)
(cherry picked from commit 540f537a)
(cherry picked from commit 4f3239c7)
parent cc1007ad
...@@ -920,7 +920,7 @@ ...@@ -920,7 +920,7 @@
/usr/local/sbin/ppp-uptime.sh /usr/local/sbin/ppp-uptime.sh
/usr/local/sbin/prefixes.php /usr/local/sbin/prefixes.php
/usr/local/wizard/openvpn.xml /usr/local/wizard/openvpn.xml
/usr/local/wizard/setup.xml /usr/local/wizard/system.xml
/usr/local/www/carp_status.php /usr/local/www/carp_status.php
/usr/local/www/crash_reporter.php /usr/local/www/crash_reporter.php
/usr/local/www/csrf.inc /usr/local/www/csrf.inc
......
...@@ -43,6 +43,11 @@ global $config; ...@@ -43,6 +43,11 @@ global $config;
$config = parse_config(true); $config = parse_config(true);
if (count($argv) > 1 && is_numeric($argv[1])) {
// starting delayed.
sleep($argv[1]);
}
log_error("rc.reload_all: Reloading web GUI."); log_error("rc.reload_all: Reloading web GUI.");
system_webgui_configure(true); system_webgui_configure(true);
...@@ -61,7 +66,6 @@ services_dyndns_configure('', true); ...@@ -61,7 +66,6 @@ services_dyndns_configure('', true);
system_cron_configure(true); system_cron_configure(true);
mwexec_bg('/usr/local/etc/rc.sshd'); mwexec_bg('/usr/local/etc/rc.sshd');
mwexec_bg('/usr/local/etc/rc.restart_webgui');
if (function_exists('plugins_configure')) { if (function_exists('plugins_configure')) {
log_error("rc.reload_all: Reloading all plugin settings."); log_error("rc.reload_all: Reloading all plugin settings.");
......
<menu> <menu>
<Lobby order="10" cssClass="fa fa-laptop"> <Lobby order="10" cssClass="fa fa-laptop">
<Dashboard order="0" url="/index.php" cssClass="fa fa-dashboard fa-fw"> <Dashboard order="0" url="/index.php" cssClass="fa fa-dashboard fa-fw">
<Args url="/index.php*" visibility="hidden"/>
<Root url="/" visibility="hidden"/> <Root url="/" visibility="hidden"/>
</Dashboard> </Dashboard>
<License order="1" url="/license.php" cssClass="fa fa-balance-scale fa-fw"/> <License order="1" url="/license.php" cssClass="fa fa-balance-scale fa-fw"/>
...@@ -71,8 +72,8 @@ ...@@ -71,8 +72,8 @@
</Tunables> </Tunables>
</Settings> </Settings>
<LogFile order="150" VisibleName="Log File" url="/diag_logs.php" cssClass="fa fa-eye fa-fw"/> <LogFile order="150" VisibleName="Log File" url="/diag_logs.php" cssClass="fa fa-eye fa-fw"/>
<Wizard order="140" url="/wizard.php" cssClass="fa fa-magic fa-fw"> <Wizard order="140" url="/wizard.php?xml=system" cssClass="fa fa-magic fa-fw">
<Step url="/wizard.php*" visibility="hidden"/> <Step url="/wizard.php?xml=system*" visibility="hidden"/>
</Wizard> </Wizard>
<Access order="10" cssClass="fa fa-users fa-fw"> <Access order="10" cssClass="fa fa-users fa-fw">
<Users order="10" url="/system_usermanager.php"> <Users order="10" url="/system_usermanager.php">
...@@ -283,6 +284,7 @@ ...@@ -283,6 +284,7 @@
<OpenVPN cssClass="fa fa-lock fa-fw" order="20"> <OpenVPN cssClass="fa fa-lock fa-fw" order="20">
<Servers order="10" url="/vpn_openvpn_server.php"> <Servers order="10" url="/vpn_openvpn_server.php">
<Edit url="/vpn_openvpn_server.php?*" visibility="hidden"/> <Edit url="/vpn_openvpn_server.php?*" visibility="hidden"/>
<Step url="/wizard.php?xml=openvpn*" visibility="hidden"/>
</Servers> </Servers>
<Clients order="20" url="/vpn_openvpn_client.php"> <Clients order="20" url="/vpn_openvpn_client.php">
<Edit url="/vpn_openvpn_client.php?*" visibility="hidden"/> <Edit url="/vpn_openvpn_client.php?*" visibility="hidden"/>
......
...@@ -449,12 +449,12 @@ ...@@ -449,12 +449,12 @@
<pattern>interfaces_wireless.php*</pattern> <pattern>interfaces_wireless.php*</pattern>
</patterns> </patterns>
</page-interfaces-wireless> </page-interfaces-wireless>
<page-pfsensewizardsubsystem> <page-wizard-system>
<name>Wizard subsystem</name> <name>System Setup Wizard</name>
<patterns> <patterns>
<pattern>wizard.php*</pattern> <pattern>wizard.php?xml=system*</pattern>
</patterns> </patterns>
</page-pfsensewizardsubsystem> </page-wizard-system>
<page-services-dhcprelay> <page-services-dhcprelay>
<name>Services: DHCP Relay</name> <name>Services: DHCP Relay</name>
<patterns> <patterns>
...@@ -936,6 +936,7 @@ ...@@ -936,6 +936,7 @@
<name>VPN: OpenVPN: Server</name> <name>VPN: OpenVPN: Server</name>
<patterns> <patterns>
<pattern>vpn_openvpn_server.php*</pattern> <pattern>vpn_openvpn_server.php*</pattern>
<pattern>wizard.php?xml=openvpn*</pattern>
</patterns> </patterns>
</page-openvpn-server> </page-openvpn-server>
<page-xmlrpclibrary> <page-xmlrpclibrary>
......
[reload|restart.all] [reload.delay]
command:/usr/local/etc/rc.reload_all 2
parameters:
type:script
message:Reloading all (delayed)
[reload.all]
command:/usr/local/etc/rc.reload_all command:/usr/local/etc/rc.reload_all
parameters: parameters:
type:script type:script
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<opnsensewizard> <wizard>
<copyright> <copyright>
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
<totalsteps>12</totalsteps> <totalsteps>12</totalsteps>
<step> <step>
<id>1</id> <id>1</id>
<title>OpenVPN Wizard: Authentication Type Selection</title> <title>Authentication Type Selection</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -70,9 +68,7 @@ ...@@ -70,9 +68,7 @@
</step> </step>
<step> <step>
<id>2</id> <id>2</id>
<title>OpenVPN Wizard: LDAP Server Selection</title> <title>LDAP Server Selection</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -105,9 +101,7 @@ ...@@ -105,9 +101,7 @@
</step> </step>
<step> <step>
<id>3</id> <id>3</id>
<title>OpenVPN Wizard: Add LDAP Server</title> <title>Add LDAP Server</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -231,9 +225,7 @@ ...@@ -231,9 +225,7 @@
</step> </step>
<step> <step>
<id>4</id> <id>4</id>
<title>OpenVPN Wizard: RADIUS Server Selection</title> <title>RADIUS Server Selection</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -266,9 +258,7 @@ ...@@ -266,9 +258,7 @@
</step> </step>
<step> <step>
<id>5</id> <id>5</id>
<title>OpenVPN Wizard: Add RADIUS Server</title> <title>Add RADIUS Server</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -314,9 +304,7 @@ ...@@ -314,9 +304,7 @@
</step> </step>
<step> <step>
<id>6</id> <id>6</id>
<title>OpenVPN Wizard: Certificate Authority Selection</title> <title>Certificate Authority Selection</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<name>Choose a Certificate Authority (CA)</name> <name>Choose a Certificate Authority (CA)</name>
...@@ -342,9 +330,7 @@ ...@@ -342,9 +330,7 @@
</step> </step>
<step> <step>
<id>7</id> <id>7</id>
<title>OpenVPN Wizard: Add Certificate Authority</title> <title>Add Certificate Authority</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<name>Create a New Certificate Authority (CA) Certificate</name> <name>Create a New Certificate Authority (CA) Certificate</name>
...@@ -443,9 +429,7 @@ ...@@ -443,9 +429,7 @@
</step> </step>
<step> <step>
<id>8</id> <id>8</id>
<title>OpenVPN Wizard: Server Certificate Selection</title> <title>Server Certificate Selection</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<name>Choose a Server Certificate</name> <name>Choose a Server Certificate</name>
...@@ -471,9 +455,7 @@ ...@@ -471,9 +455,7 @@
</step> </step>
<step> <step>
<id>9</id> <id>9</id>
<title>OpenVPN Wizard: Add a Server Certificate</title> <title>Add a Server Certificate</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<name>Create a New Server Certificate</name> <name>Create a New Server Certificate</name>
...@@ -572,9 +554,7 @@ ...@@ -572,9 +554,7 @@
</step> </step>
<step> <step>
<id>10</id> <id>10</id>
<title>OpenVPN Wizard: Server Setup</title> <title>Server Setup</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -906,9 +886,7 @@ ...@@ -906,9 +886,7 @@
</step> </step>
<step> <step>
<id>11</id> <id>11</id>
<title>OpenVPN Wizard: Firewall Rule Configuration</title> <title>Firewall Rule Configuration</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field> <field>
<type>listtopic</type> <type>listtopic</type>
...@@ -948,14 +926,8 @@ ...@@ -948,14 +926,8 @@
</step> </step>
<step> <step>
<id>12</id> <id>12</id>
<title>OpenVPN Wizard: Finished!</title> <title>Finished!</title>
<description>OpenVPN Remote Access Server Setup Wizard</description>
<disableheader>on</disableheader>
<fields> <fields>
<field>
<type>listtopic</type>
<name>Configuration Complete!</name>
</field>
<field> <field>
<type>text</type> <type>text</type>
<description>Your configuration is now complete.</description> <description>Your configuration is now complete.</description>
...@@ -967,4 +939,4 @@ ...@@ -967,4 +939,4 @@
</fields> </fields>
<stepsubmitphpaction>step12_submitphpaction();</stepsubmitphpaction> <stepsubmitphpaction>step12_submitphpaction();</stepsubmitphpaction>
</step> </step>
</opnsensewizard> </wizard>
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<opnsensewizard> <wizard>
<copyright> <copyright>
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
...@@ -31,10 +31,12 @@ ...@@ -31,10 +31,12 @@
<totalsteps>9</totalsteps> <totalsteps>9</totalsteps>
<step> <step>
<id>1</id> <id>1</id>
<title>OPNsense Setup Wizard</title> <title>General Setup</title>
<disableheader>true</disableheader>
<description>This wizard will guide you through the initial configuration of OPNsense.&lt;br/&gt;&lt;br/&gt; The wizard may be stopped at any time by clicking the logo image at the top of the screen.</description>
<fields> <fields>
<field>
<type>text</type>
<description>This wizard will guide you through the initial system configuration. The wizard may be stopped at any time by clicking the logo image at the top of the screen.</description>
</field>
<field> <field>
<name>Next</name> <name>Next</name>
<type>submit</type> <type>submit</type>
...@@ -50,7 +52,6 @@ ...@@ -50,7 +52,6 @@
<step> <step>
<id>2</id> <id>2</id>
<title>General Information</title> <title>General Information</title>
<description>On this screen you will set the general OPNsense parameters.</description>
<fields> <fields>
<field> <field>
<name>Hostname</name> <name>Hostname</name>
...@@ -134,7 +135,6 @@ ...@@ -134,7 +135,6 @@
<step> <step>
<id>3</id> <id>3</id>
<title>Time Server Information</title> <title>Time Server Information</title>
<description>Please enter the time, date and time zone.</description>
<fields> <fields>
<field> <field>
<name>Time server hostname</name> <name>Time server hostname</name>
...@@ -167,7 +167,6 @@ ...@@ -167,7 +167,6 @@
<id>4</id> <id>4</id>
<disableallfieldsbydefault>true</disableallfieldsbydefault> <disableallfieldsbydefault>true</disableallfieldsbydefault>
<title>Configure WAN Interface</title> <title>Configure WAN Interface</title>
<description>On this screen we will configure the Wide Area Network information.</description>
<javascriptafterformdisplay> <javascriptafterformdisplay>
var selectedItem = 0; var selectedItem = 0;
if(jQuery('#ipaddress').val() == 'dhcp') { if(jQuery('#ipaddress').val() == 'dhcp') {
...@@ -544,8 +543,7 @@ ...@@ -544,8 +543,7 @@
</step> </step>
<step> <step>
<id>6</id> <id>6</id>
<title>Set Admin WebGUI Password</title> <title>Set Admin Web GUI Password</title>
<description>On this screen we will set the admin password, which is used to access the WebGUI and also SSH services if you wish to enable them.</description>
<fields> <fields>
<field> <field>
<name>Admin Password</name> <name>Admin Password</name>
...@@ -576,10 +574,12 @@ ...@@ -576,10 +574,12 @@
</step> </step>
<step> <step>
<id>7</id> <id>7</id>
<title>Reload configuration</title> <title>Reload Configuration</title>
<disableheader>true</disableheader>
<description>Click 'Reload' to reload OPNsense with new changes.</description>
<fields> <fields>
<field>
<type>text</type>
<description>Click 'Reload' to reload to apply the changes.</description>
</field>
<field> <field>
<name>Reload</name> <name>Reload</name>
<type>submit</type> <type>submit</type>
...@@ -629,28 +629,21 @@ ...@@ -629,28 +629,21 @@
<step> <step>
<id>8</id> <id>8</id>
<title>Reload in progress</title> <title>Reload in progress</title>
<description> <fields>
A reload is now in progress. Please wait. &lt;p&gt; <field>
&lt;meta http-equiv="refresh" content="5; url=wizard.php?xml=setup&amp;stepid=8" &gt; <type>text</type>
&lt;p&gt; <description>A reload is now in progress. The wizard will redirect you to the dashboard once the reload is completed.</description>
The wizard will redirect to the next step once the reload is completed. </field>
</description> <field>
<type>refresh</type>
<time>5</time>
<page>index.php?wizard_done</page>
</field>
</fields>
<stepafterformdisplay> <stepafterformdisplay>
<![CDATA[ <![CDATA[
configd_run('service reload all', true); configd_run('service reload delay', true);
]]> ]]>
</stepafterformdisplay> </stepafterformdisplay>
</step> </step>
<step> </wizard>
<id>9</id>
<title>Wizard completed.</title>
<description>
<![CDATA[
Congratulations! OPNsense is now configured.<p/>
Please consider donating to the project to help us with our overhead costs.<p/>
See <a target='_new' href='https://opnsense.org/'>OPNsense.org</a> to donate or purchase services offered by the OPNsense team.<p/>
Click <a href='$myurl'>here</a> to continue on to OPNsense web GUI.
]]>
</description>
</step>
</opnsensewizard>
...@@ -29,34 +29,6 @@ ...@@ -29,34 +29,6 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/* Determine automated help URL. Should output the page name and
parameters separately */
$uri_split = "";
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
/* If there was no match, there were no parameters, just grab the filename
Otherwise, use the matched filename from above. */
if (empty($uri_split[0])) {
$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
} else {
$pagename = $uri_split[1];
}
/* If the page name is still empty, the user must have requested / (index.php) */
if (empty($pagename)) {
$pagename = "index.php";
}
/* If the filename is wizard.php, reparse looking for the .xml filename */
if ($pagename == 'wizard.php') {
$param_split = explode('&', $uri_split[2]);
foreach ($param_split as $param) {
if (substr($param, 0, 4) == "xml=") {
$xmlfile = explode('=', $param);
$pagename = $xmlfile[1];
}
}
}
$aclObj = new \OPNsense\Core\ACL(); $aclObj = new \OPNsense\Core\ACL();
/* display a top alert bar if need be */ /* display a top alert bar if need be */
......
...@@ -15,18 +15,18 @@ function system_get_language_code() { ...@@ -15,18 +15,18 @@ function system_get_language_code() {
// link menu system // link menu system
$menu = new OPNsense\Base\Menu\MenuSystem(); $menu = new OPNsense\Base\Menu\MenuSystem();
/* XXX generating breadcrumbs requires getItems() call */
$menuSystem = $menu->getItems($_SERVER['REQUEST_URI']); $menuSystem = $menu->getItems($_SERVER['REQUEST_URI']);
$menuBreadcrumbs = $menu->getBreadcrumbs();
/* XXX workaround for dashboard */ if (isset($extraBreadcrumb)) {
if (!isset($menuBreadcrumbs)) { $menuBreadcrumbs[] = array('name' => $extraBreadcrumb);
/* XXX generating breadcrumbs requires getItems() call */
$menuBreadcrumbs = $menu->getBreadcrumbs();
} }
$themename = htmlspecialchars(get_current_theme()); $themename = html_safe(get_current_theme());
$pagetitle = gentitle(array_reverse($menuBreadcrumbs), ' | '); $pagetitle = gentitle(array_reverse($menuBreadcrumbs), ' | ');
$pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system']['domain']); $pagetitle .= html_safe(sprintf(' | %s.%s', $config['system']['hostname'], $config['system']['domain']));
?><!doctype html> ?><!doctype html>
<!--[if IE 8 ]><html lang="<?=system_get_language_code();?>" class="ie ie8 lte9 lte8 no-js"><![endif]--> <!--[if IE 8 ]><html lang="<?=system_get_language_code();?>" class="ie ie8 lte9 lte8 no-js"><![endif]-->
......
...@@ -100,7 +100,9 @@ include("head.inc"); ...@@ -100,7 +100,9 @@ include("head.inc");
include("fbegin.inc");?> include("fbegin.inc");?>
<?php <?php
if (isset($config['trigger_initial_wizard'])) :?> ?>
<?php
if (isset($config['trigger_initial_wizard']) || isset($_GET['wizard_done'])): ?>
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$(".page-content-head:first").hide(); $(".page-content-head:first").hide();
...@@ -108,7 +110,14 @@ include("fbegin.inc");?> ...@@ -108,7 +110,14 @@ include("fbegin.inc");?>
</script> </script>
<header class="page-content-head"> <header class="page-content-head">
<div class="container-fluid"> <div class="container-fluid">
<?php
if (isset($config['trigger_initial_wizard'])): ?>
<h1><?= gettext("Starting initial configuration!") ?></h1> <h1><?= gettext("Starting initial configuration!") ?></h1>
<?php
else: ?>
<h1><?= gettext("Finished initial configuration!") ?></h1>
<?php
endif ?>
</div> </div>
</header> </header>
<section class="page-content-main"> <section class="page-content-main">
...@@ -121,10 +130,18 @@ include("fbegin.inc");?> ...@@ -121,10 +130,18 @@ include("fbegin.inc");?>
<br /> <br />
<div class="content-box-main"> <div class="content-box-main">
<?php <?php
echo sprintf(gettext("Welcome to %s!"), $g['product_name']) . "<p>\n"; if (isset($config['trigger_initial_wizard'])) {
echo gettext("One moment while we start the initial setup wizard.") . "<p>\n"; echo '<p>' . sprintf(gettext('Welcome to %s!'), $g['product_name']) . "</p>\n";
echo gettext("Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.") . "<p>\n"; echo '<p>' . gettext('One moment while we start the initial setup wizard.') . "</p>\n";
echo gettext("To bypass the wizard, click on the logo in the upper left corner.") . "\n"; echo '<p class="__nomb">' . gettext('To bypass the wizard, click on the logo in the upper left corner.') . "</p>\n";
} else {
echo '<p>' . sprintf(gettext('Congratulations! %s is now configured.'), $g['product_name']) . "</p>\n";
echo '<p>' . sprintf(gettext(
'Please consider donating to the project to help us with our overhead costs. ' .
'See %sour website%s to donate or purchase available %s support services.'),
'<a target="_new" href="' . $g['product_website'] . '">', '</a>', $g['product_name']) . "</p>\n";
echo '<p class="__nomb">' . sprintf(gettext('Click to %scontinue to the dashboard%s.'), '<a href="/">', '</a>') . "</p>\n";
}
?> ?>
</div> </div>
<div> <div>
...@@ -133,7 +150,11 @@ include("fbegin.inc");?> ...@@ -133,7 +150,11 @@ include("fbegin.inc");?>
</div> </div>
</div> </div>
</section> </section>
<meta http-equiv="refresh" content="3;url=wizard.php"> <?php
if (isset($config['trigger_initial_wizard'])): ?>
<meta http-equiv="refresh" content="5;url=/wizard.php?xml=system">
<?php
endif ?>
<?php <?php
// normal dashboard // normal dashboard
else:?> else:?>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment