diff options
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/wizard.php | 220 | ||||
-rw-r--r-- | usr/local/www/wizards/setup_wizard.xml | 388 |
2 files changed, 547 insertions, 61 deletions
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 68c96ec..553f817 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -102,6 +102,12 @@ function update_config_field($field, $updatetext, $unset, $arraynum) { } } +if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { + // handle before form display event. + // good for modifying posted values, etc. + eval($pkg['step'][$stepid]['stepbeforeformdisplay']); +} + ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> @@ -123,22 +129,20 @@ function update_config_field($field, $updatetext, $unset, $arraynum) { <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> - </td> - </tr> - <tr> - <td><center> - <table> - <!-- wizard goes here --> - <tr><td> </td></tr> - <tr><td colspan='2'><center><b><?= $description ?></b></center></td></tr><tr><td> </td></tr> - <?php - foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { - - $value = $field['value']; +<table width="600" cellspacing="0" cellpadding="3"> + <!-- wizard goes here --> + <tr><td> </td></tr> + <tr><td colspan='2'><center><b><?= $description ?></b></center></td></tr><tr><td> </td></tr> + <?php + if(!$pkg['step'][$stepid]['disableheader']) + echo "<tr><td colspan=\"2\" class=\"listtopic\">" . $title . "</td></tr>"; + ?> + + <?php + if($pkg['step'][$stepid]['fields']['field'] <> "") { + foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { + + $value = $field['value']; $name = $field['name']; $name = ereg_replace(" ", "", $name); @@ -149,61 +153,167 @@ function update_config_field($field, $updatetext, $unset, $arraynum) { $field_conv = ""; $field_split = split("->", $field['bindstofield']); // arraynum is used in cases where there is an array of the same field - // name such as dnsserver (2 of them) + // name such as dnsserver (2 of them) if($field['arraynum'] <> "") $arraynum = "[" . $field['arraynum'] . "]"; foreach ($field_split as $f) $field_conv .= "['" . $f . "']"; $toeval = "\$value = \$config" . $field_conv . $arraynum . ";"; eval($toeval); } - if ($field['type'] == "input") { - echo "<tr><td align='right'>"; - echo $field['name']; - echo ":</td><td>"; - echo "<input name='" . $name . "' value='" . $value . "'>\n"; - } else if ($field['type'] == "password") { - echo "<tr><td align='right'>"; - echo $field['name']; - echo ":</td><td>"; - echo "<input name='" . $name . "' value='" . $value . "' type='password'>\n"; - } else if ($field['type'] == "select") { - echo "<tr><td align='right'>"; - echo $field['name']; - echo ":</td><td>"; - // XXX: TODO: set $selected - if($field['size']) $size = " size='" . $field['size'] . "' "; - if($field['multiple'] == "yes") $multiple = "MULTIPLE "; - echo "<select " . $multiple . $size . "id='" . $field['fieldname'] . "' name='" . $name . "'>\n"; - foreach ($field['options']['option'] as $opt) { + if(!$field['combinefieldsend']) + echo "<tr>"; + + if ($field['type'] == "input") { + if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['name']; + echo ":</td>\n"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">\n"; + echo "<input id='" . $name . "' name='" . $name . "' value='" . $value . "'>\n"; + } else if ($field['type'] == "password") { + if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['name']; + echo ":</td>\n"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">"; + echo "<input id='" . $name . "' name='" . $name . "' value='" . $value . "' type='password'>\n"; + } else if ($field['type'] == "select") { + if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['name']; + echo ":</td>\n"; + } + // XXX: TODO: set $selected + if($field['size']) $size = " size='" . $field['size'] . "' "; + if($field['multiple'] == "yes") $multiple = "MULTIPLE "; + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">\n"; + $onchange = ""; + foreach ($field['options']['option'] as $opt) { + if($opt['enablefields'] <> "") { + $onchange = "onchange=\"enableitems(this.selectedIndex);\" "; + } + } + echo "<select " . $onchange . $multiple . $size . "id='" . $name . "' name='" . $name . "'>\n"; + foreach ($field['options']['option'] as $opt) { $selected = ""; if($value == $opt['value']) $selected = " SELECTED"; - echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'" . $selected . ">" . $opt['name'] . "</option>\n"; - } - echo "</select>\n"; - } else if ($field['type'] == "textarea") { - echo "<tr><td align='right'>"; - echo $field['name']; - echo ":</td><td>"; - echo "<textarea name='" . $name . ">" . $value . "</textarea>\n"; - } else if ($field['type'] == "submit") { - echo "<tr><td> <br></td></tr>"; + echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'" . $selected . ">" . $opt['name'] . "</option>\n"; + } + echo "</select>\n"; + } else if ($field['type'] == "textarea") { + if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['name']; + echo ":</td>"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">"; + echo "<textarea id='" . $name . "' name='" . $name . ">" . $value . "</textarea>\n"; + } else if ($field['type'] == "submit") { + echo "<td> <br></td></tr>"; echo "<tr><td colspan='2'><center>"; echo "<input type='submit' name='" . $name . "' value='" . $field['name'] . "'>\n"; - echo "</td><td>"; + } else if ($field['type'] == "listtopic") { + echo "<td> </td><tr>"; + echo "<tr><td colspan=\"2\" class=\"listtopic\">" . $field['name'] . "<br></td>\n"; + } else if ($field['type'] == "checkbox") { + if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['name']; + echo ":</td>"; + } + $checked = ""; + if($value) $checked = " CHECKED"; + echo "<td class=\"vtable\"><input type='checkbox' id='" . $name . "' name='" . $name . "' " . $checked . ">\n"; + } + + if($field['typehint'] <> "") { + echo $field['typehint']; } + if($field['description'] <> "") { echo "<br>" . $field['description']; - echo "</td></tr><tr><td> </td></tr>"; + echo "</td>"; } - echo "</td></tr>"; - } - ?> - </table> - <br> - </td> - </tr> + + if(!$field['combinefieldsbegin']) + echo "</tr>\n"; + } + } + ?> </table> </form> </body> </html> + +<?php + +$fieldnames_array = Array(); +if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") { + // create a fieldname loop that can be used with javascript + // hide and enable features. + echo "\n<script language=\"JavaScript\">\n"; + echo "function disableall() {\n"; + foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { + if($field['type'] <> "submit" and $field['type'] <> "listtopic") { + if(!$field['donotdisable'] <> "") { + array_push($fieldnames_array, $field['name']); + $fieldname = ereg_replace(" ", "", $field['name']); + $fieldname = strtolower($fieldname); + echo "\tdocument.forms[0]." . $fieldname . ".disabled = 1;\n"; + } + } + } + echo "}\ndisableall();\n"; + echo "function enableitems(selectedindex) {\n"; + echo "disableall();\n"; + $idcounter = 0; + if($pkg['step'][$stepid]['fields']['field'] <> "") { + echo "\tswitch(selectedindex) {\n"; + foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { + if($field['options']['option'] <> "") { + foreach ($field['options']['option'] as $opt) { + if($opt['enablefields'] <> "") { + echo "\t\tcase " . $idcounter . ":\n"; + $enablefields_split = split(",", $opt['enablefields']); + foreach ($enablefields_split as $efs) { + $fieldname = ereg_replace(" ", "", $efs); + $fieldname = strtolower($fieldname); + if($fieldname <> "") { + $onchange = "\t\t\tdocument.forms[0]." . $fieldname . ".disabled = 0; \n"; + echo $onchange; + } + } + echo "\t\t\tbreak;\n"; + } + $idcounter = $idcounter + 1; + } + } + } + echo "\t}\n"; + } + echo "}\n"; + echo "disableall();\n"; + echo "</script>\n\n"; +} + + +if($pkg['step'][$stepid]['stepafterformdisplay'] <> "") { + // handle after form display event. + eval($pkg['step'][$stepid]['stepafterformdisplay']); +} + +if($pkg['step'][$stepid]['javascriptafterformdisplay'] <> "") { + // handle after form display event. + echo "\n<script language=\"JavaScript\">\n"; + echo $pkg['step'][$stepid]['javascriptafterformdisplay'] . "\n"; + echo "</script>\n\n"; +} + +?> diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml index 4d73b22..3a00913 100644 --- a/usr/local/www/wizards/setup_wizard.xml +++ b/usr/local/www/wizards/setup_wizard.xml @@ -4,6 +4,7 @@ <step> <id>1</id> <title>pfSense Setup Wizard</title> + <disableheader>true</disableheader> <description>This wizard will guide you through installing pfSense initially.</description> <fields> <field> @@ -1721,16 +1722,79 @@ </step> <step> <id>4</id> + <disableallfieldsbydefault>true</disableallfieldsbydefault> <title>Configure WAN Interface</title> <description>On this screen we will configure the Wide Area Network information.</description> + <javascriptafterformdisplay> + enableitems(document.forms[0].selectedtype.selectedIndex); + </javascriptafterformdisplay> <fields> + <field> + <name>SelectedType</name> + <type>select</type> + <donotdisable>true</donotdisable> + <options> + <option> + <name>Static</name> + <value>Static</value> + <enablefields>ipaddress,subnetmask,gateway</enablefields> + </option> + <option> + <name>DHCP</name> + <value>dhcp</value> + <enablefields>dhcphostname</enablefields> + </option> + <option> + <name>PPPoE</name> + <value>PPPoE</value> + <enablefields>pppoeusername,pppoepassword,pppoeservicename,pppoedialondemand,pppoeidletimeout</enablefields> + </option> + <option> + <name>PPTP</name> + <value>PPTP</value> + <enablefields>pptpusername,pptppassword,pptplocalipaddress,pptplocalsubnet,pptpremoteipaddress,pptpdialondemand,pptpidletimeout + </enablefields> + </option> + <option> + <name>BigPond</name> + <value>BigPond</value> + <enablefields>bigpondusername,bigpondpassword,bigpondauthenticationserver,bigpondauthenticationdomain,bigpondminheartbeatinterval</enablefields> + </option> + </options> + </field> + <field> + <name>General configuration</name> + <type>listtopic</type> + </field> + <field> + <donotdisable>true</donotdisable> + <name>MAC Address</name> + <bindstofield>interfaces->wan->spoofmac</bindstofield> + <type>input</type> + <description> This field can be used to modify ("spoof") the MAC address of the WAN interface (may be required with some cable connections) Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank</description> + </field> <field> - <name>WAN IP Address</name> + <donotdisable>true</donotdisable> + <name>MTU</name> + <type>input</type> + <bindstofield>interfaces->wan->mtu</bindstofield> + <description> If you enter a value in this field, then MSS clamping for TCP connections to the value entered above minus 40 (TCP/IP header size) will be in effect. If you leave this field blank, an MTU of 1492 bytes for PPPoE and 1500 bytes for all other connection types will be assumed.</description> + </field> + <field> + <name>Static IP Configuration</name> + <type>listtopic</type> + </field> + <field> + <name>IP Address</name> <bindstofield>interfaces->wan->ipaddr</bindstofield> <type>input</type> - <description>Type dhcp if this interface uses dhcp to obtain its ip address.</description> + <typehint> / </typehint> + <combinefieldsbegin>true</combinefieldsbegin> </field> <field> + <combinefieldsend>true</combinefieldsend> + <dontdisplayname>true</dontdisplayname> + <dontcombinecells>true</dontcombinecells> <name>Subnet Mask</name> <bindstofield>interfaces->wan->subnet</bindstofield> <type>select</type> @@ -1866,6 +1930,317 @@ </options> </field> <field> + <name>Gateway</name> + <bindstofield>interfaces->wan->gateway</bindstofield> + <type>input</type> + </field> + <field> + <name>Bandwidth Management (Traffic Shaping)</name> + <type>listtopic</type> + </field> + <field> + <name>Scheduler</name> + <donotdisable>true</donotdisable> + <type>select</type> + <bindstofield>interfaces->wan->schedulertype</bindstofield> + <description>Select which type of queueing you would like to use</description> + <options> + <option><name>Priority Based Queueing</name><value>priq</value></option> + <option><name>Class Based Queueing</name><value>cbq</value></option> + <option><name>Hierarchical Fair Service Curve queueing</name><value>hfsc</value></option> + </options> + </field> + <field> + <combinefieldsbegin>true</combinefieldsbegin> + <donotdisable>true</donotdisable> + <name>Interface Bandwidth Speed</name> + <type>input</type> + <typehint> | </typehint> + <bindstofield>interfaces->wan->bandwidth</bindstofield> + </field> + <field> + <name>Speed Type</name> + <donotdisable>true</donotdisable> + <type>select</type> + <combinefieldsend>true</combinefieldsend> + <dontdisplayname>true</dontdisplayname> + <dontcombinecells>true</dontcombinecells> + <bindstofield>interfaces->wan->bandwidthtype</bindstofield> + <options> + <option> + <name>bit/s</name> + </option> + <option> + <name>Kilobit/s</name> + </option> + <option> + <name>Megabit/s</name> + </option> + <option> + <name>Gigabit/s</name> + </option> + </options> + </field> + <field> + <name>DHCP client configuration</name> + <type>listtopic</type> + </field> + <field> + <name>DHCP Hostname</name> + <type>input</type> + <bindstofield>interfaces->wan->dhcphostname</bindstofield> + <description> The value in this field is sent as the DHCP client identifier and hostname when requesting a DHCP lease. Some ISPs may require this (for client identification).</description> + </field> + <field> + <name>PPPoE configuration</name> + <type>listtopic</type> + </field> + <field> + <name>PPPoE Username</name> + <type>input</type> + <bindstofield>pppoe->username</bindstofield> + </field> + <field> + <name>PPPoE Password</name> + <type>input</type> + <bindstofield>pppoe->password</bindstofield> + </field> + <field> + <name>PPPoE Service name</name> + <type>input</type> + <description>Hint: this field can usually be left empty</description> + </field> + <field> + <name>PPPoE Dial on demand</name> + <typehint>Enable Dial-On-Demand mode</typehint> + <type>checkbox</type> + <description>This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</description> + </field> + <field> + <name>PPPoE Idle timeout</name> + <type>input</type> + <description>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</description> + </field> + <field> + <name>PPTP configuration</name> + <type>listtopic</type> + </field> + <field> + <name>PPTP Username</name> + <type>input</type> + <bindstofield>pptp->username</bindstofield> + </field> + <field> + <name>PPTP Password</name> + <type>input</type> + <bindstofield>pptp->password</bindstofield> + </field> + <field> + <combinefieldsbegin>true</combinefieldsbegin> + <name>PPTP Local IP Address</name> + <type>input</type> + <typehint> / </typehint> + <bindstofield>pptp->local</bindstofield> + </field> + <field> + <combinefieldsend>true</combinefieldsend> + <dontdisplayname>true</dontdisplayname> + <dontcombinecells>true</dontcombinecells> + <name>pptplocalsubnet</name> + <bindstofield>pptp->subnet</bindstofield> + <type>select</type> + <options> + <option> + <name>1</name> + <value>1</value> + </option> + <option> + <name>2</name> + <value>2</value> + </option> + <option> + <name>3</name> + <value>3</value> + </option> + <option> + <name>4</name> + <value>4</value> + </option> + <option> + <name>5</name> + <value>5</value> + </option> + <option> + <name>6</name> + <value>6</value> + </option> + <option> + <name>7</name> + <value>7</value> + </option> + <option> + <name>8</name> + <value>8</value> + </option> + <option> + <name>9</name> + <value>9</value> + </option> + <option> + <name>10</name> + <value>10</value> + </option> + <option> + <name>11</name> + <value>11</value> + </option> + <option> + <name>12</name> + <value>12</value> + </option> + <option> + <name>13</name> + <value>13</value> + </option> + <option> + <name>14</name> + <value>14</value> + </option> + <option> + <name>15</name> + <value>15</value> + </option> + <option> + <name>16</name> + <value>16</value> + </option> + <option> + <name>17</name> + <value>17</value> + </option> + <option> + <name>18</name> + <value>18</value> + </option> + <option> + <name>19</name> + <value>19</value> + </option> + <option> + <name>20</name> + <value>20</value> + </option> + <option> + <name>21</name> + <value>21</value> + </option> + <option> + <name>22</name> + <value>22</value> + </option> + <option> + <name>23</name> + <value>23</value> + </option> + <option> + <name>24</name> + <value>24</value> + </option> + <option> + <name>25</name> + <value>25</value> + </option> + <option> + <name>26</name> + <value>26</value> + </option> + <option> + <name>27</name> + <value>27</value> + </option> + <option> + <name>28</name> + <value>28</value> + </option> + <option> + <name>29</name> + <value>29</value> + </option> + <option> + <name>30</name> + <value>30</value> + </option> + <option> + <name>31</name> + <value>31</value> + </option> + <option> + <name>32</name> + <value>32</value> + </option> + </options> + </field> + <field> + <name>PPTP Remote IP Address</name> + <type>input</type> + </field> + <field> + <name>PPTP Dial on demand</name> + <typehint>Enable Dial-On-Demand mode</typehint> + <type>checkbox</type> + <description>This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</description> + </field> + <field> + <name>PPTP Idle timeout</name> + <type>input</type> + <description>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</description> + </field> + <field> + <name>BigPond configuration</name> + <type>listtopic</type> + </field> + <field> + <name>BigPond Username</name> + <type>input</type> + <bindstofield>bigpond->username</bindstofield> + </field> + <field> + <name>BigPond Password</name> + <type>input</type> + <bindstofield>bigpond->password</bindstofield> + </field> + <field> + <name>BigPond Authentication server</name> + <type>input</type> + <bindstofield>bigpond->authserver</bindstofield> + <description>If this field is left empty, the default ("dce-server") is used.</description> + </field> + <field> + <name>BigPond Authentication domain</name> + <type>input</type> + <bindstofield>bigpond->authdomain</bindstofield> + <description>If this field is left empty, the domain name assigned via DHCP will be used. Note: the BigPond client implicitly sets the "Allow DNS server list to be overridden by DHCP/PPP on WAN" on the System: General setup page.</description> + </field> + <field> + <name>BigPond min heartbeat interval</name> + <type>input</type> + <typehint>seconds</typehint> + <bindstofield>bigpond->minheartbeatinterval</bindstofield> + <description> Setting this to a sensible value (e.g. 60 seconds) can protect against DoS attacks.</description> + </field> + <field> + <name>RFC1918 Networks</name> + <type>listtopic</type> + </field> + <field> + <donotdisable>true</donotdisable> + <name>Block RFC1918 Private Networks</name> + <description> When set, this option blocks traffic from IP addresses that are reserved for private networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as well as loopback addresses (127/8). You should generally leave this option turned on, unless your WAN network lies in such a private address space, too.</description> + <type>checkbox</type> + <bindstofield>interfaces->wan->blockpriv</bindstofield> + <typehint>Block private networks from entering via WAN</typehint> + </field> + <field> <name>Next</name> <type>submit</type> </field> @@ -2059,6 +2434,7 @@ <step> <id>7</id> <title>Reboot</title> + <disableheader>true</disableheader> <description>On this screen we will reboot pfSense so your changes will take affect..</description> <fields> <field> @@ -2067,13 +2443,13 @@ <type>submit</type> </field> </fields> - <stepsubmitphpaction> - system("/sbin/shutdown -r now"); - </stepsubmitphpaction> </step> <step> <id>8</id> <title>Reboot in progress</title> - <description>A reboot is now in progress.</description> + <description>A reboot is now in progress. Please wait.</description> + <stepafterformdisplay> + system("/sbin/shutdown -r now"); + </stepafterformdisplay> </step> </pfsensewizard>
\ No newline at end of file |