summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2004-12-18 20:24:50 +0000
committerScott Ullrich <sullrich@pfsense.org>2004-12-18 20:24:50 +0000
commite48fc17dce36492e61fc7be6d953813953fd82cd (patch)
tree6615a2b732c8bf37c910fd4f2c7b62dd9aa31008 /usr
parent57333fa05a7270f0d6e51c78f64b7e1ab968b7ce (diff)
downloadpfsense-e48fc17dce36492e61fc7be6d953813953fd82cd.zip
pfsense-e48fc17dce36492e61fc7be6d953813953fd82cd.tar.gz
The wizard system now works!
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/wizard.php57
-rw-r--r--usr/local/www/wizards/setup_wizard.xml25
2 files changed, 53 insertions, 29 deletions
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php
index e09828a..5f8b7d5 100755
--- a/usr/local/www/wizard.php
+++ b/usr/local/www/wizard.php
@@ -56,19 +56,40 @@ $title = $pkg['step'][$stepid]['title'];
$description = $pkg['step'][$stepid]['description'];
if ($_POST) {
- foreach ($pkg['step'][$stepid]['fields'] as $field) {
- if($field['bindtofield'] <> "") {
- // update field with posted values.
-
+ foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
+ if($field['bindstofield'] <> "" and $field['type'] <> "submit") {
+ $fieldname = $field['name'];
+ $unset_fields = "";
+ $fieldname = ereg_replace(" ", "", $fieldname);
+ $fieldname = strtolower($fieldname);
+ // update field with posted values.
+ if($field['unsetfield'] <> "") $unset_fields = "yes";
+ if($field['bindstofield'])
+ update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields);
}
if($pkg['step'][$stepid]['stepsubmitphpaction']) {
- eval($pkg['step'][$stepid]['stepsubmitphpaction']);
+ // run custom php code embedded in xml config.
+ eval($pkg['step'][$stepid]['stepsubmitphpaction']);
}
+ write_config();
}
+ $stepid++;
}
-function update_config_field($field, $updatetext) {
- $config[$field] = $updatetext;
+function update_config_field($field, $updatetext, $unset) {
+ global $config;
+ $field_split = split("->",$field);
+ foreach ($field_split as $f) $field_conv .= "['" . $f . "']";
+ if($field_conv == "") return;
+ if($unset <> "") {
+ $text = "unset(\$config" . $field_conv . ");";
+ eval($text);
+ $text = "\$config" . $field_conv . "[] = \"" . $updatetext . "\";";
+ eval($text);
+ } else {
+ $text = "\$config" . $field_conv . "[] = \"" . $updatetext . "\";";
+ eval($text);
+ }
}
?>
@@ -81,19 +102,18 @@ function update_config_field($field, $updatetext) {
</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-$config_tmp = $config;
-$config = $pfSense_config;
-include("fbegin.inc");
-$config = $config_tmp;
-?>
-<p class="pgtitle"><?=$title?></p>
<form action="wizard.php" method="post">
<input type="hidden" name="xml" value="<?= $xml ?>">
-<input type="hidden" name="stepid" value="<?= $stepid+1 ?>">
+<input type="hidden" name="stepid" value="<?= $stepid ?>">
<?php if ($savemsg) print_info_box($savemsg); ?>
-<table width="100%" border="1" cellpadding="6" cellspacing="0">
+<center>
+
+&nbsp;<br>
+
+<img src="/logo.gif"><p>
+
+<table width="500" border="1" cellpadding="6" cellspacing="0">
<tr>
<td bgcolor="#990000">
<font color="white"><center><b><?= $title ?></b></center></font>
@@ -142,7 +162,7 @@ $config = $config_tmp;
echo ":</td><td>";
echo "<textarea name='" . $name . ">" . $value . "</textarea>\n";
} else if ($field['type'] == "submit") {
- echo "<tr><td>&nbsp;</td></tr>";
+ echo "<tr><td>&nbsp;<br></td></tr>";
echo "<tr><td colspan='2'><center>";
echo "<input type='submit' name='" . $name . "' value='" . $field['name'] . "'>\n";
echo "</td><td>";
@@ -152,12 +172,11 @@ $config = $config_tmp;
}
?>
</table>
- &nbsp;<br>&nbsp;
+ &nbsp;<br>&nbsp;
</td>
</tr>
</table>
</form>
-<?php include("fend.inc"); ?>
</body>
</html>
diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml
index 8baec75..1eca410 100644
--- a/usr/local/www/wizards/setup_wizard.xml
+++ b/usr/local/www/wizards/setup_wizard.xml
@@ -1,13 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
-<pfSenseWizard>
+<pfsensewizard>
<totalsteps>2</totalsteps>
<step>
<id>1</id>
<title>pfSense Setup Wizard</title>
<description>This wizard will guide you through installing pfSense initially.</description>
<fields>
- <name>Next</name>
- <type>submit</type>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
</fields>
</step>
<step>
@@ -18,10 +20,14 @@
<field>
<name>Primary DNS Server</name>
<type>input</type>
+ <bindstofield>system->dnsserver</bindstofield>
+ <!-- we must unset the fields because this is an array. -->
+ <unsetfield>yes</unsetfield>
</field>
<field>
<name>Secondary DNS Server</name>
<type>input</type>
+ <bindstofield>system->dnsserver</bindstofield>
</field>
<field>
<name>Next</name>
@@ -1696,16 +1702,16 @@
</field>
</fields>
<stepsubmitphpaction>
- mwxec("date " . $_POST['Date'] . $_POST['Time']);
+ system("date " . $_POST['Date'] . $_POST['Time']);
</stepsubmitphpaction>
</step>
<step>
<id>4</id>
- <title>Configure WAN</title>
+ <title>Configure WAN Interface</title>
<description>On this screen we will configure the Wide Area Network information.</description>
<fields>
<field>
- <name>WAN IP Address:</name>
+ <name>WAN IP Address</name>
<type>input</type>
</field>
<field>
@@ -1850,11 +1856,11 @@
</step>
<step>
<id>5</id>
- <title>Configure LAN</title>
+ <title>Configure LAN Interface</title>
<description>On this screen we will configure the Local Area Network information.</description>
<fields>
<field>
- <name>LAN IP Address:</name>
+ <name>LAN IP Address</name>
<type>input</type>
</field>
<field>
@@ -1989,7 +1995,6 @@
<name>32</name>
<value>32</value>
</option>
-
</options>
</field>
</fields>
@@ -2020,4 +2025,4 @@
</field>
</fields>
</step>
-</pfSenseWizard> \ No newline at end of file
+</pfsensewizard> \ No newline at end of file
OpenPOWER on IntegriCloud