diff options
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/interfaces_ppps_edit.php | 202 | ||||
-rw-r--r-- | usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js | 55 |
2 files changed, 148 insertions, 109 deletions
diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php index 5d4df19..4e95852 100644 --- a/usr/local/www/interfaces_ppps_edit.php +++ b/usr/local/www/interfaces_ppps_edit.php @@ -519,38 +519,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" <option></option> </select> - <br/><span class="vexpl"><?= gettext("Interface(s) or port(s) participating in the connection."); ?></span> - </td> - </tr> - <tr name="prefil_ppp" id="prefil_ppp" style="display:none"> - <td width="22%" valign="top" class="vncell"><?= gettext("Service Provider"); ?></td> - <td width="78%" class="vtable"> - <table border="0" cellpadding="0" cellspacing="0"> - <tr id="trcountry" style="display:none"> - <td><?= gettext("Country"); ?> : </td> - <td> - <select class="formselect" name="country" id="country" onChange="providers_list()"> - <option></option> - </select> - </td> - </tr> - <tr id="trprovider" style="display:none"> - <td><?= gettext("Provider"); ?> : </td> - <td> - <select class="formselect" name="provider" id="provider" onChange="providerplan_list()"> - <option></option> - </select> - </td> - </tr> - <tr id="trproviderplan" style="display:none"> - <td><?= gettext("Plan"); ?> : </td> - <td> - <select class="formselect" name="providerplan" id="providerplan" onChange="prefill_provider()"> - <option></option> - </select> - </td> - </tr> - </table> + <br/><span class="vexpl"><?= gettext("Select at least two interfaces for Multilink (MLPPP) connections."); ?></span> </td> </tr> <tr style="display:none" name="portlists" id="portlists"> @@ -602,29 +571,6 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" </tr> <tr> - <td valign="top" class="vncell"><?= gettext("Dial On Demand"); ?></td> - <td class="vtable"> - <input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked"; ?>> <?= gettext("Enable Dial-on-Demand mode"); ?> - <br/> <span class="vexpl"><?= gettext("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."); ?> </span> - </td> - </tr> - <tr> - <td valign="top" class="vncell"><?= gettext("Idle Timeout"); ?></td> - <td class="vtable"> - <input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="12" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> <?= gettext("(seconds) Default is 0, which disables the timeout feature."); ?> - <br/> <span class="vexpl"><?= gettext("If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down. - <br/>When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed."); ?></span> - </td> - </tr> - <tr> - <td valign="top" class="vncell"><?= gettext("Uptime Logging"); ?></td> - <td class="vtable"> - <input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked"; ?>> <?= gettext("Enable persistent logging of connection uptime."); ?> - <br/> <span class="vexpl"><?= gettext("This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page."); ?></span> - </td> - </tr> - <tr> <td width="22%" valign="top" class="vncell"><?= gettext("Description"); ?></td> <td width="78%" class="vtable"> <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> @@ -636,6 +582,8 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" </tr> <tr style="display:none" name="select" id="select"> </tr> + <?php $k=0; ?> + <tr style="display:none" name="ppp" id="ppp"> <td colspan="2" style="padding:0px;"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> @@ -643,53 +591,92 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" <td colspan="2" valign="top" class="listtopic"><?= gettext("PPP configuration"); ?></td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Init String"); ?></td> + <td width="22%" valign="top" class="vncell"><?= gettext("Service Provider"); ?></td> <td width="78%" class="vtable"> - <input type="text" size="40" class="formfld unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>"> - <br/><span class="vexpl"><?= gettext("Note: Enter the modem initialization string here. Do NOT include the \"AT\" - string at the beginning of the command. Many modern USB 3G modems don't need an initialization string."); ?></span> + <table border="0" cellpadding="0" cellspacing="0"> + <tr id="trcountry" style="display:none"> + <td><?= gettext("Country"); ?> : </td> + <td> + <select class="formselect" name="country" id="country" onChange="providers_list()"> + <option></option> + </select> + </td> + </tr> + <tr id="trprovider" style="display:none"> + <td><?= gettext("Provider"); ?> : </td> + <td> + <select class="formselect" name="provider" id="provider" onChange="providerplan_list()"> + <option></option> + </select> + </td> + </tr> + <tr id="trproviderplan" style="display:none"> + <td><?= gettext("Plan"); ?> : </td> + <td> + <select class="formselect" name="providerplan" id="providerplan" onChange="prefill_provider()"> + <option></option> + </select> + </td> + </tr> + </table> + <br/><span class="vexpl"><?= gettext("Select to fill in data for your service provider."); ?></span> </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Sim PIN"); ?></td> - <td width="78%" class="vtable"> - <input name="simpin" type="text" class="formfld unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>"> - </td> + <td width="22%" valign="top" class="vncell"><?= gettext("Access Point Name (APN)"); ?></td> + <td width="78%" class="vtable"> + <input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>"> + </td> </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Sim PIN wait"); ?></td> - <td width="78%" class="vtable"> - <input name="pin-wait" type="text" class="formfld unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>"> - <br/><span class="vexpl"><?= gettext("Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds)."); ?></span> - </td> + <tr <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td width="22%" valign="top" class="vncell"><?= gettext("APN number (optional)"); ?></td> + <td width="78%" class="vtable"> + <input name="apnum" type="text" class="formfld unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>"> + <br/><span class="vexpl"><?= gettext("Note: Defaults to 1 if you set APN above. Ignored if you set no APN above."); ?></span> + </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Access Point Name (APN)"); ?></td> - <td width="78%" class="vtable"> - <input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>"> - </td> + <td width="22%" valign="top" class="vncell"><?= gettext("Phone Number"); ?></td> + <td width="78%" class="vtable"> + <input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>"> + <br/><span class="vexpl"><?= gettext("Note: Typically (*99# or *99***# or *99***1#) for GSM networks and *777 for CDMA networks"); ?></span> + </td> </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("APN number (optional)"); ?></td> - <td width="78%" class="vtable"> - <input name="apnum" type="text" class="formfld unknown" id="apnum" size="2" value="<?=htmlspecialchars($pconfig['apnum']);?>"> - <br/><span class="vexpl"><?= gettext("Note: Defaults to 1 if you set APN above. Ignored if you set no APN above."); ?></span> - </td> + <tr <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td width="22%" valign="top" class="vncell"><?= gettext("Sim PIN"); ?></td> + <td width="78%" class="vtable"> + <input name="simpin" type="text" class="formfld unknown" id="simpin" size="12" value="<?=htmlspecialchars($pconfig['simpin']);?>"> + </td> </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?= gettext("Phone Number"); ?></td> - <td width="78%" class="vtable"> - <input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>"> - <br/><span class="vexpl"><?= gettext("Note: Typically (*99# or *99***# or *99***1#) for GSM networks and *777 for CDMA networks"); ?></span> - </td> + <tr <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td width="22%" valign="top" class="vncell"><?= gettext("Sim PIN wait"); ?></td> + <td width="78%" class="vtable"> + <input name="pin-wait" type="text" class="formfld unknown" id="pin-wait" size="2" value="<?=htmlspecialchars($pconfig['pin-wait']);?>"> + <br/><span class="vexpl"><?= gettext("Note: Time to wait for SIM to discover network after PIN is sent to SIM (seconds)."); ?></span> + </td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td width="22%" valign="top" class="vncell"><?= gettext("Init String"); ?></td> + <td width="78%" class="vtable"> + <input type="text" size="40" class="formfld unknown" id="initstr" name="initstr" value="<?=htmlspecialchars($pconfig['initstr']);?>"> + <br/><span class="vexpl"><?= gettext("Note: Enter the modem initialization string here. Do NOT include the \"AT\" + string at the beginning of the command. Many modern USB 3G modems don't need an initialization string."); ?></span> + </td> + </tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%" valign="top" class="vncell"><?= gettext("Connection Timeout"); ?></td> <td width="78%" class="vtable"> <input name="connect-timeout" type="text" class="formfld unknown" id="connect-timeout" size="2" value="<?=htmlspecialchars($pconfig['connect-timeout']);?>"> <br/><span class="vexpl"><?= gettext("Note: Enter timeout in seconds for connection to be established (sec.) Default is 45 sec."); ?></span> </td> </tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td valign="top" class="vncell"><?= gettext("Uptime Logging"); ?></td> + <td class="vtable"> + <input type="checkbox" value="on" id="uptime" name="uptime" <?php if (isset($pconfig['uptime'])) echo "checked"; ?>> <?= gettext("Enable persistent logging of connection uptime."); ?> + <br/> <span class="vexpl"><?= gettext("This option causes cumulative uptime to be recorded and displayed on the Status Interfaces page."); ?></span> + </td> + </tr> </table> </td> </tr> @@ -762,7 +749,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" <td colspan="2" style="padding:0px;"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td colspan="2" valign="top" class="listtopic"><?=strtoupper($pconfig['type']); ?> <?= gettext("Configuration"); ?></td> + <td colspan="2" valign="top" class="listtopic" name="pptp_label" id="pptp_label"></td> </tr> </table> </td> @@ -794,13 +781,30 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" </table> </td> </tr><?php endfor; ?> - <tr> + + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td colspan="2" valign="top" height="16"></td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td colspan="2" valign="top" class="listtopic"><?= gettext("Advanced Options"); ?></td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td valign="top" class="vncell"><?= gettext("Dial On Demand"); ?></td> + <td class="vtable"> + <input type="checkbox" value="on" id="ondemand" name="ondemand" <?php if (isset($pconfig['ondemand'])) echo "checked"; ?>> <?= gettext("Enable Dial-on-Demand mode"); ?> + <br/> <span class="vexpl"><?= gettext("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."); ?> </span> + </td> + </tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> + <td valign="top" class="vncell"><?= gettext("Idle Timeout"); ?></td> + <td class="vtable"> + <input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="12" value="<?=htmlspecialchars($pconfig['idletimeout']);?>"> <?= gettext("(seconds) Default is 0, which disables the timeout feature."); ?> + <br/> <span class="vexpl"><?= gettext("If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down. + <br/>When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. Otherwise, the interface is brought down and all associated routes removed."); ?></span> + </td> + </tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%" valign="top" class="vncell"><?= gettext("Compression"); ?></td> <td width="78%" class="vtable"> <input type="checkbox" value="on" id="vjcomp" name="vjcomp" <?php if (isset($pconfig['vjcomp'])) echo "checked"; ?>> <?= gettext("Disable vjcomp(compression) (enabled by default)."); ?> @@ -809,7 +813,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" stamping or SACK, which modify TCP options between sequential packets.</span> </td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%" valign="top" class="vncell"><?= gettext("TCPmssFix"); ?></td> <td width="78%" class="vtable"> <input type="checkbox" value="on" id="tcpmssfix" name="tcpmssfix" <?php if (isset($pconfig['tcpmssfix'])) echo "checked"; ?>> <?= gettext("Enable tcpmssfix (disabled by default)."); ?> @@ -820,7 +824,7 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" gets to discover that it must reduce the fragment size or drop the IP Don't Fragment option from its outgoing data.</span> </td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%" valign="top" class="vncell">ShortSeq</td> <td width="78%" class="vtable"> <input type="checkbox" value="on" id="shortseq" name="shortseq" <?php if (isset($pconfig['shortseq'])) echo "checked"; ?>> <?= gettext("Disable shortseq (enabled by default)."); ?> @@ -828,21 +832,29 @@ $types = array("select" => "Select", "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" It is not necessary to disable this for connections that are not multi-link."); ?></span> </td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%" valign="top" class="vncell">ACFComp</td> <td width="78%" class="vtable"> <input type="checkbox" value="on" id="acfcomp" name="acfcomp" <?php if (isset($pconfig['acfcomp'])) echo "checked"; ?>> <?= gettext("Disable acfcomp(compression) (enabled by default)."); ?> <br/> <span class="vexpl"><?= gettext("Address and control field compression. This option only applies to asynchronous link types. It saves two bytes per frame."); ?></span> </td> </tr> - <tr> + <tr style="display:none" id="advanced_<?=$k;?>" name="advanced_<?=$k;$k++;?>"> <td width="22%" valign="top" class="vncell">ProtoComp</td> <td width="78%" class="vtable"> <input type="checkbox" value="on" id="protocomp" name="protocomp" <?php if (isset($pconfig['protocomp'])) echo "checked"; ?>> <?= gettext("Disable protocomp(compression) (enabled by default)."); ?> <br/> <span class="vexpl"><?= gettext("Protocol field compression. This option saves one byte per frame for most frames."); ?></span> </td> </tr> - + <tr id="advanced_" name="advanced_"> + <td> </td> + <td> + <p><input type="button" onClick="show_advanced(1)" value="Show advanced options"></p> + </td> + <td style="display:none" id="adv_rows" name="adv_rows"><?=$k;?></td> + <td style="display:none" id="adv_show" name="adv_show">0</td> + </tr> + <tr> <?php for($i=0; $i < $port_count; $i++) : ?> <tr style="display:none" id="link<?=$i;?>"> <td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> Link Parameters</td> diff --git a/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js b/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js index 1df660f..513dbdd 100644 --- a/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js +++ b/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js @@ -14,16 +14,34 @@ function update_select_list(new_options, select_list){ show_hide_linkfields(select_list); } -function clear_selected(list_name){ - var select_list = document.iform[list_name]; - for(var j=0; j < select_list.options.length; j++){ - select_list.options[j].selected = 0; +function show_advanced(hide){ + var select_list = document.iform["interfaces[]"].options; + var adv_rows = parseInt($('adv_rows').innerHTML); + var adv_show = Boolean(parseInt($('adv_show').innerHTML)); + var status = Boolean(parseInt(hide)); + if (status){ + $('advanced_').hide(); + for(var j=0; j < adv_rows; j++){ + var advanced = "advanced_" + j.toString(); + $(advanced).show(); + } + $('adv_show').innerHTML = "1"; + show_hide_linkfields(select_list); + } else { + $('advanced_').show(); + for(var j=0; j < adv_rows; j++){ + var advanced = "advanced_" + j.toString(); + $(advanced).hide(); + } + $('adv_show').innerHTML = "0"; + show_hide_linkfields(select_list); } } function show_hide_linkfields(options){ var i = 0; var port_count = parseInt($('port_count').innerHTML); + var adv_show = Boolean(parseInt($('adv_show').innerHTML)); for(var j=0; j < port_count; j++){ var count = j.toString(); var type = $('type').value; @@ -62,13 +80,17 @@ function show_hide_linkfields(options){ $(localip).name = "localip[" + options[i].value + "]"; $(subnet).name = "subnet[" + options[i].value + "]"; $(gateway).name = "gateway[" + options[i].value + "]"; - if (type == 'pptp' || type == 'ppp' || type == 'l2tp'){ + if (type == 'ppp' && adv_show){ $(ipfields).show(); - if (type == 'pptp' || type == 'l2tp'){ - $(subnet).disabled = false; - } } - $(link).show(); + if (type == 'pptp' || type == 'l2tp'){ + $(subnet).disabled = false; + $(ipfields).show(); + $('pptp').show(); + } + if (adv_show){ + $(link).show(); + } i++; break; } @@ -82,9 +104,11 @@ function updateType(t){ var serialports = $('serialports').innerHTML; var ports = $('ports').innerHTML; var select_list = document.iform["interfaces[]"].options; + $('adv_show').innerHTML = "0"; + show_advanced('0'); switch(t) { case "select": { - $('ppp','pppoe','pptp','prefil_ppp').invoke('hide'); + $('ppp','pppoe','pptp').invoke('hide'); select_list.length = 0; select_list[0] = new Option("Select Link Type First",""); break; @@ -92,21 +116,24 @@ function updateType(t){ case "ppp": { update_select_list(serialports, select_list); $('select','pppoe','pptp').invoke('hide'); - $('prefil_ppp').show(); country_list(); break; } case "pppoe": { update_select_list(ports, select_list); - $('select','ppp','pptp','prefil_ppp').invoke('hide'); + $('select','ppp','pptp').invoke('hide'); break; } case "l2tp": { - t = "pptp"; + $('pptp_label').innerHTML = "L2TP Configuration"; + update_select_list(ports, select_list); + $('select','ppp','pppoe').invoke('hide'); + break; } case "pptp": { update_select_list(ports, select_list); - $('select','ppp','pppoe','prefil_ppp').invoke('hide'); + $('select','ppp','pppoe').invoke('hide'); + $('pptp_label').innerHTML = "PPTP Configuration"; break; } default: |