Commit 9a73dd21 authored by Jos Schellevis's avatar Jos Schellevis

Fixed wizzard default settings and reload/redirect, fixes #16

parent 4608ae4b
......@@ -393,7 +393,7 @@ function showchange() {
if(!$field['dontcombinecells'])
echo "<td class=\"vtable\">\n";
echo "<input class='form-control unknown' id='" . $name . "' name='" . $name . "' value=\"" . htmlspecialchars($value) . "\"";
echo "<input class='form-control unknown' type='text' id='" . $name . "' name='" . $name . "' value=\"" . htmlspecialchars($value) . "\"";
if($field['size'])
echo " size='" . $field['size'] . "' ";
if($field['validate'])
......@@ -677,7 +677,7 @@ function showchange() {
}
if(!$field['dontcombinecells'])
echo "<td class=\"vtable\">";
echo "<select class='form-control' name='{$name}'>\n";
echo "<select class='form-control' name='{$name}' style='max-width:5em;'>\n";
for($x=1; $x<33; $x++) {
$CHECKED = "";
if($value == $x) $CHECKED = " selected=\"selected\"";
......@@ -842,7 +842,8 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
array_push($fieldnames_array, $field['name']);
$fieldname = preg_replace("/\s+/", "", $field['name']);
$fieldname = strtolower($fieldname);
echo "\tdocument.forms[0]." . $fieldname . ".disabled = 1;\n";
//echo "\tdocument.forms[0]." . $fieldname . ".disabled = 1;\n";
echo "\tjQuery('#". $fieldname . "').prop('disabled', true);\n";
}
}
}
......@@ -862,7 +863,8 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
$fieldname = preg_replace("/\s+/", "", $efs);
$fieldname = strtolower($fieldname);
if($fieldname <> "") {
$onchange = "\t\t\tdocument.forms[0]." . $fieldname . ".disabled = 0; \n";
//$onchange = "\t\t\tdocument.forms[0]." . $fieldname . ".disabled = 0; \n";
$onchange = "\t\t\tjQuery('#" . $fieldname . "').prop('disabled',false)\n";
echo $onchange;
}
}
......@@ -882,12 +884,13 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
<script type="text/javascript">
//<![CDATA[
NiftyCheck();
var bgcolor = document.getElementsByTagName("body")[0].style.backgroundColor;
Rounded("div#roundme","all",bgcolor,"#FFFFFF","smooth");
enablechange();
disablechange();
showchange();
// After reload/redirect functions are not loaded, so check first.
if (typeof enablechange == 'function') {
enablechange();
disablechange();
showchange();
}
//]]>
</script>
......
......@@ -56,7 +56,7 @@
<type>input</type>
<bindstofield>wizardtemp->system->hostname</bindstofield>
<description>EXAMPLE: myserver</description>
<validate>^[a-z0-9.|-]+$</validate>
<validate>^[A-Za-z0-9.|-]+$</validate>
<message>Invalid Hostname</message>
</field>
<field>
......@@ -164,21 +164,21 @@
<description>On this screen we will configure the Wide Area Network information.</description>
<javascriptafterformdisplay>
var selectedItem = 0;
if(document.forms[0].ipaddress.value == 'dhcp') {
if(jQuery('#ipaddress').val() == 'dhcp') {
selectedItem = 1;
document.forms[0].ipaddress.value = '';
} else if(document.forms[0].ipaddress.value == 'pppoe') {
jQuery('#ipaddress').val('');
} else if(jQuery('#ipaddress').val() == 'pppoe') {
selectedItem = 2;
document.forms[0].ipaddress.value = '';
} else if(document.forms[0].ipaddress.value == 'pptp') {
jQuery('#ipaddress').val('');
} else if(jQuery('#ipaddress').val() == 'pptp') {
selectedItem = 3;
document.forms[0].ipaddress.value = '';
} else if(document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') {
document.forms[0].ipaddress.value = '';
jQuery('#ipaddress').val('');
} else if(jQuery('#ipaddress').val() == 'ppp' || jQuery('#ipaddress').val() == 'l2tp') {
jQuery('#ipaddress').val('');
} else {
selectedItem = 0;
}
document.forms[0].selectedtype.selectedIndex = selectedItem;
jQuery('#selectedtype').prop('selectedIndex',selectedItem);
enableitems(selectedItem);
</javascriptafterformdisplay>
<fields>
......@@ -579,7 +579,7 @@
<title>Reload in progress</title>
<description>
A reload is now in progress. Please wait. &lt;p&gt;
&lt;meta http-equiv="refresh" content="5; url=wizard.php?xml=setup_wizard.xml&amp;stepid=9" &gt;
&lt;meta http-equiv="refresh" content="5; url=wizard.php?xml=setup_wizard.xml&amp;stepid=8" &gt;
&lt;p&gt;
The wizard will redirect to the next step once the reload is completed.
</description>
......@@ -625,19 +625,11 @@
<step>
<id>9</id>
<title>Wizard completed.</title>
<stepbeforeformdisplay>
<![CDATA[
if($g['product_name'] <> 'pfSense') {
header("Location: " . fixup_string("\$myurl"));
exit;
}
]]>
</stepbeforeformdisplay>
<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://www.opnsense.org/j.php?jumpto=donate'>OPNsense.org</a> to donate or purchase services offered by the OPNsense team.<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 webConfigurator.
]]>
</description>
......
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