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() { ...@@ -393,7 +393,7 @@ function showchange() {
if(!$field['dontcombinecells']) if(!$field['dontcombinecells'])
echo "<td class=\"vtable\">\n"; 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']) if($field['size'])
echo " size='" . $field['size'] . "' "; echo " size='" . $field['size'] . "' ";
if($field['validate']) if($field['validate'])
...@@ -677,7 +677,7 @@ function showchange() { ...@@ -677,7 +677,7 @@ function showchange() {
} }
if(!$field['dontcombinecells']) if(!$field['dontcombinecells'])
echo "<td class=\"vtable\">"; 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++) { for($x=1; $x<33; $x++) {
$CHECKED = ""; $CHECKED = "";
if($value == $x) $CHECKED = " selected=\"selected\""; if($value == $x) $CHECKED = " selected=\"selected\"";
...@@ -842,7 +842,8 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") { ...@@ -842,7 +842,8 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
array_push($fieldnames_array, $field['name']); array_push($fieldnames_array, $field['name']);
$fieldname = preg_replace("/\s+/", "", $field['name']); $fieldname = preg_replace("/\s+/", "", $field['name']);
$fieldname = strtolower($fieldname); $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'] <> "") { ...@@ -862,7 +863,8 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
$fieldname = preg_replace("/\s+/", "", $efs); $fieldname = preg_replace("/\s+/", "", $efs);
$fieldname = strtolower($fieldname); $fieldname = strtolower($fieldname);
if($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; echo $onchange;
} }
} }
...@@ -882,12 +884,13 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") { ...@@ -882,12 +884,13 @@ if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
NiftyCheck();
var bgcolor = document.getElementsByTagName("body")[0].style.backgroundColor; // After reload/redirect functions are not loaded, so check first.
Rounded("div#roundme","all",bgcolor,"#FFFFFF","smooth"); if (typeof enablechange == 'function') {
enablechange(); enablechange();
disablechange(); disablechange();
showchange(); showchange();
}
//]]> //]]>
</script> </script>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<type>input</type> <type>input</type>
<bindstofield>wizardtemp->system->hostname</bindstofield> <bindstofield>wizardtemp->system->hostname</bindstofield>
<description>EXAMPLE: myserver</description> <description>EXAMPLE: myserver</description>
<validate>^[a-z0-9.|-]+$</validate> <validate>^[A-Za-z0-9.|-]+$</validate>
<message>Invalid Hostname</message> <message>Invalid Hostname</message>
</field> </field>
<field> <field>
...@@ -164,21 +164,21 @@ ...@@ -164,21 +164,21 @@
<description>On this screen we will configure the Wide Area Network information.</description> <description>On this screen we will configure the Wide Area Network information.</description>
<javascriptafterformdisplay> <javascriptafterformdisplay>
var selectedItem = 0; var selectedItem = 0;
if(document.forms[0].ipaddress.value == 'dhcp') { if(jQuery('#ipaddress').val() == 'dhcp') {
selectedItem = 1; selectedItem = 1;
document.forms[0].ipaddress.value = ''; jQuery('#ipaddress').val('');
} else if(document.forms[0].ipaddress.value == 'pppoe') { } else if(jQuery('#ipaddress').val() == 'pppoe') {
selectedItem = 2; selectedItem = 2;
document.forms[0].ipaddress.value = ''; jQuery('#ipaddress').val('');
} else if(document.forms[0].ipaddress.value == 'pptp') { } else if(jQuery('#ipaddress').val() == 'pptp') {
selectedItem = 3; selectedItem = 3;
document.forms[0].ipaddress.value = ''; jQuery('#ipaddress').val('');
} else if(document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') { } else if(jQuery('#ipaddress').val() == 'ppp' || jQuery('#ipaddress').val() == 'l2tp') {
document.forms[0].ipaddress.value = ''; jQuery('#ipaddress').val('');
} else { } else {
selectedItem = 0; selectedItem = 0;
} }
document.forms[0].selectedtype.selectedIndex = selectedItem; jQuery('#selectedtype').prop('selectedIndex',selectedItem);
enableitems(selectedItem); enableitems(selectedItem);
</javascriptafterformdisplay> </javascriptafterformdisplay>
<fields> <fields>
...@@ -579,7 +579,7 @@ ...@@ -579,7 +579,7 @@
<title>Reload in progress</title> <title>Reload in progress</title>
<description> <description>
A reload is now in progress. Please wait. &lt;p&gt; 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; &lt;p&gt;
The wizard will redirect to the next step once the reload is completed. The wizard will redirect to the next step once the reload is completed.
</description> </description>
...@@ -625,19 +625,11 @@ ...@@ -625,19 +625,11 @@
<step> <step>
<id>9</id> <id>9</id>
<title>Wizard completed.</title> <title>Wizard completed.</title>
<stepbeforeformdisplay>
<![CDATA[
if($g['product_name'] <> 'pfSense') {
header("Location: " . fixup_string("\$myurl"));
exit;
}
]]>
</stepbeforeformdisplay>
<description> <description>
<![CDATA[ <![CDATA[
Congratulations! OPNsense is now configured.<p/> Congratulations! OPNsense is now configured.<p/>
Please consider donating to the project to help us with our overhead costs.<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. Click <a href='$myurl'>here</a> to continue on to OPNsense webConfigurator.
]]> ]]>
</description> </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