www.usr.com/support/gpl/USR9107_release.1.4.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / html / pppoe.html
index b8c0c0a..8058e58 100755 (executable)
@@ -7,7 +7,7 @@
        <title></title>
 
        <link href="usr_main.css" rel="stylesheet" type="text/css">
-       <script src="usr_menus.js" type="text/javascript"></script>
+       <link href="usr_menus.css" rel="stylesheet" type="text/css"><script src="usr_menus.js" type="text/javascript"></script><script src="usr_menus_build.js" type="text/javascript"></script>
        <script src="usr_common.js" type="text/javascript"></script>
 
        <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
        <script type="text/javascript" src="util.js"></script>
        <script type="text/javascript">
 <!-- hide
-setPageTitle("<%ejGetWl(wlInterface)%>");
-
-var timeOut = '<%ejGet(pppTimeOut)%>';
-var onDemand = '<%ejGet(enblOnDemand)%>';
-var ipExtension = '<%ejGet(pppIpExtension)%>';
-var authMethod = '<%ejGet(pppAuthMethod)%>';
-var qs = '<%ejGet(quickSetup)%>';
-var auto = '<%ejGet(enblAutoScan)%>';
+setPageTitle("<%ejGetWlJS(wlInterface)%>");
+
+var timeOut = '<%ejGetJS(pppTimeOut)%>';
+var onDemand = '<%ejGetJS(enblOnDemand)%>';
+var ipExtension = '<%ejGetJS(pppIpExtension)%>';
+var authMethod = '<%ejGetJS(pppAuthMethod)%>';
+var qs = '<%ejGetJS(quickSetup)%>';
+var auto = '<%ejGetJS(enblAutoScan)%>';
 var prtcl = '<%ejGetOther(memInfo, ntwkPrtcl)%>';
+var enblIpAddr = '<%ejGetJS(useStaticIpAddress)%>';
+var localIpAddr = '<%ejGetJS(pppLocalIpAddress)%>';
 
 function frmLoad() {
    with ( document.forms[0] ) {
@@ -33,10 +35,17 @@ function frmLoad() {
          showPppoe(0);
       if ( onDemand == '1' ) {
          enblOnDemand.checked = true;
-         hideInfo(0);
+         hideOnDemandInfo(0);
       } else {
          enblOnDemand.checked = false;
-         hideInfo(1);
+         hideOnDemandInfo(1);
+      }
+      if ( enblIpAddr == '1' ) {
+         enblPppIpAddress.checked = true;
+         hidePppIpAddressInfo(0);
+      } else {
+         enblPppIpAddress.checked = false;
+         hidePppIpAddressInfo(1);
       }
 
       if ( ipExtension == '1' )
@@ -53,14 +62,16 @@ function frmLoad() {
       else
          pppAuthMethod.selectedIndex = 0;
 
-      pppUserName.value = '<%ejGet(pppUserName)%>';
-      pppPassword.value = '<%ejGet(pppPassword)%>';
+      pppUserName.value = '<%ejGetJS(pppUserName)%>';
+      pppPassword.value = '<%ejGetJS(pppPassword)%>';
       pppTimeOut.value = timeOut;
-      if ( prtcl == 'PPPoE' ) {
-         pppServerName.value = '<%ejGet(pppServerName)%>';
-         pppMTU.value = '<%ejGet(pppoeMTU)%>';
-      } else
-         pppMTU.value = '<%ejGet(pppMTU)%>';
+      pppLocalIpAddress.value = localIpAddr;
+      if ( prtcl == 'PPPoE' && !(auto == '1' && qs == '1') )
+         pppServerName.value = '<%ejGetJS(pppServerName)%>';
+      if ( prtcl == 'PPPoA' )
+         pppMTU.value = '<%ejGetJS(pppMTU)%>';
+      else
+         pppMTU.value = '<%ejGetJS(pppoeMTU)%>';
    }
 }
 
@@ -70,12 +81,14 @@ function btnNext() {
       if (!validateUsername(pppUserName))
           return;
 
+      if (!inRange("MTU", pppMTU, 1, (prtcl == 'PPPoE') ? 1492 : 1500))
+          return;
+
       // validate inactivity timeout
       if ( enblOnDemand.checked == true ) {
          if ( isNaN(parseInt(pppTimeOut.value)) )
          {
-            msg = 'Inactivity timeout "' + pppTimeOut.value + '" must be a number.';
-            alert(msg);
+            alert('Inactivity timeout "' + pppTimeOut.value + '" must be a number.');
             return;
          }
          timeOutNum = parseInt(pppTimeOut.value);
@@ -85,16 +98,33 @@ function btnNext() {
             return;
          }
       }
+      // validate ppp IP address
+      if ( enblPppIpAddress.checked == true ) {
+         if ( isValidIpAddress(pppLocalIpAddress.value) == false ) {
+            alert('The IP address "' + pppLocalIpAddress.value + '" is invalid.');
+            return;
+         }
+      }
       // validate authentication method
       if ( pppAuthMethod.selectedIndex < 0 ) {
-         msg = 'No selection for authentication method.';
-         alert(msg);
+         alert('Please select an authentication method.');
          return;
       }
+      // validate server name
+      if ( prtcl == 'PPPoE' && !(auto == '1' && qs == '1') ) {
+         len = pppServerName.value.length;
+         if ( len > 32 ) {
+            msg = 'The length of PPP service (' + len + ') is too long. It must be between zero and thirty-two characters, inclusive.';
+            alert(msg);
+            return;
+         }
+      }
 
-          var loc = 'enblservice.cgi?';
-      if ((qs == '1') && (auto == '1'))
-                       loc = 'pppauthinfo.cgi?';
+      if ( qs == '1' ) {
+         if ( auto == '1' )
+            loc = 'pppauthinfo.cgi?';
+      } else
+         loc = 'enblservice.cgi?';
 
       loc += 'pppUserName=' + encodeUrl(pppUserName.value);
       loc += '&pppPassword=' + encodeUrl(pppPassword.value);
@@ -106,18 +136,24 @@ function btnNext() {
          loc += '&enblOnDemand=0';
          loc += '&pppTimeOut=' + timeOut;
       }
+      if ( enblPppIpAddress.checked == true ) {
+         loc += '&useStaticIpAddress=1';
+         loc += '&pppLocalIpAddress=' + pppLocalIpAddress.value;
+      } else {
+         loc += '&useStaticIpAddress=0';
+         loc += '&pppLocalIpAddress=' + localIpAddr;
+      }
       if ( pppIpExtension.checked == true )
-         loc += '&pppIpExtension=1&enblNat=0&enblFirewall=0';
+         loc += '&pppIpExtension=on&enblNat=0&enblFirewall=0';
       else
          loc += '&pppIpExtension=0&enblFirewall=1&enblNat=1';
 
       var idx = pppAuthMethod.selectedIndex;
       loc += '&pppAuthMethod=' + pppAuthMethod.options[idx].value;
-      if ( prtcl == 'PPPoE' )
+      if ( prtcl == 'PPPoE' && !(auto == '1' && qs == '1') )
          loc += '&pppServerName=' + encodeUrl(pppServerName.value);
    }
-
-   var code = 'location.assign("' + loc + '")';
+   var code = 'location = "' + loc + '"';
    eval(code);
 }
 
@@ -126,7 +162,7 @@ function btnBack() {
    if ( qs == '1' && auto == '1' )
       loc = 'vpivci.html';
 
-   var code = 'location.assign("' + loc + '")';
+   var code = 'location = "' + loc + '"';
    eval(code);
 }
 
@@ -141,7 +177,7 @@ function showPppoe(show) {
       document.all.pppoeSN.style.visibility = status;
 }
 
-function hideInfo(hide) {
+function hideOnDemandInfo(hide) {
    var status = 'visible';
    if ( hide == 1 )
       status = 'hidden';
@@ -152,44 +188,58 @@ function hideInfo(hide) {
          if ( hide == 1 )
             document.forms[0].pppTimeOut.value = '';
          else
-            document.forms[0].pppTimeOut.value = '<%ejGet(pppTimeOut)%>';
+            document.forms[0].pppTimeOut.value = '<%ejGetJS(pppTimeOut)%>';
       } else  // IE 4
          document.all.pppInfo.style.visibility = status;
    }
 }
 
-function cbClick(cb) {
-   if (cb.checked)
-      hideInfo(0);
+function dialOnDemandClick(cb) {
+   if ( cb.checked == true )
+      hideOnDemandInfo(0);
    else
-      hideInfo(1);
+      hideOnDemandInfo(1);
+}
+
+function hidePppIpAddressInfo(hide) {
+   var status = 'visible';
+   if ( hide == 1 )
+      status = 'hidden';
+   if (document.getElementById)  // DOM3 = IE5, NS6
+      document.getElementById('pppIpAddressInfo').style.visibility = status;
+   else {
+      if (document.layers) { // Netscape 4
+         if ( hide == 1 )
+            document.forms[0].pppLocalIpAddress.value = '';
+         else
+            document.forms[0].pppLocalIpAddress.value = '<%ejGetJS(pppLocalIpAddress)%>';
+      } else  // IE 4
+         document.all.pppIpAddressInfo.style.visibility = status;
+   }
+}
+
+function pppIpAddressClick(cb) {
+   if ( cb.checked == true )
+      hidePppIpAddressInfo(0);
+   else
+      hidePppIpAddressInfo(1);
 }
 
 // done hiding -->
 </script>
 </head>
-<body onload="initMenu('idMenu'); frmLoad();">
+<body onload="initMenu(); frmLoad();">
 
 <script type="text/javascript">
-       writeHeader("PPP User Name and Password", "<%ejGet(curUserName)%>", "<%ejGetOther(sysInfo, adslStd)%>", "<%ejGetOther(sysInfo, noBrPrtcl)%>", <%ejGetOther(sysInfo, pppIpExtension)%>, <%ejGetOther(sysInfo, enblFirewall)%>, <%ejGetOther(sysInfo, enblNat)%>, "<%ejGetWl(wlInterface)%>", <%ejGet(enblQos)%>);
+       writeHeader("PPP User Name and Password", "<%ejGetJS(curUserName)%>", "<%ejGetOther(sysInfo, adslStd)%>", "<%ejGetOther(sysInfo, noBrPrtcl)%>", <%ejGetOther(sysInfo, pppIpExtension)%>, <%ejGetOther(sysInfo, enblFirewall)%>, <%ejGetOther(sysInfo, enblNat)%>, "<%ejGetWlJS(wlInterface)%>", <%ejGetJS(enblQos)%>);
 </script>
 
 <p>PPP usually requires that you have a user name and password to establish your
 Internet connection. Please enter the user name and password your ISP provided.</p>
 
 <form>
-   <div id='pppoeSN'>
-      <table border="0" cellpadding="0" cellspacing="0">
-         <tr>
-            <td><label for="">PPPoE service name:</td>
-            <td>
-               <b><%ejGetOther(memInfo, pppoeServiceName)%></b>
-            </td>
-         </tr>
-         <br>
-      </table>
-   </div>
-   <table border="0" cellpadding="0" cellspacing="0">
+       <p id="pppoeSN"><label>PPPoE service name:</label> <b><%ejGetOther(memInfo, pppoeServiceName)%></b></p>
+   <table border="0">
       <tr>
          <td><label for="pppUserName">User name:</label></td>
          <td><input type='text' name='pppUserName' id='pppUserName' maxlength="256"></td>
@@ -200,11 +250,11 @@ Internet connection. Please enter the user name and password your ISP provided.<
       </tr>
 <script type="text/javascript">
 <!-- hide
-if ( prtcl == 'PPPoE' ) {
-   document.writeln("               <tr>");
-   document.writeln("                 <td><label for='pppServerName'>PPPoE service name:</label></td>");
-   document.writeln("                 <td><input type='text' name='pppServerName' id='pppServerName' maxlength=\"32\"></td>");
-   document.writeln("               </tr>");
+if ( prtcl == 'PPPoE' && !(auto == '1' && qs == '1') ) {
+   document.writeln("<tr>");
+   document.writeln("\t<td><label for='pppServerName'>PPPoE service name:</label></td>");
+   document.writeln("\t<td><input type='text' name='pppServerName' id='pppServerName' maxlength=\"32\"></td>");
+   document.writeln("</tr>");
 }
 // done hiding -->
 </script>
@@ -222,7 +272,7 @@ if ( prtcl == 'PPPoE' ) {
        <p><label for="pppMTU">MTU:</label> <input type='text' name='pppMTU' id='pppMTU' maxlength='4' size='10'> bytes (PPPoE: 1-1492, PPPoA: 1-1500)</p>
 
        <p>
-               <input type='checkbox' name='enblOnDemand' id='enblOnDemand' onClick='cbClick(this)'>
+               <input type='checkbox' name='enblOnDemand' id='enblOnDemand' onClick='dialOnDemandClick(this)'>
                        <label for="enblOnDemand">Dial on demand (with idle timeout timer)</label>
 
                <div id='pppInfo'>
@@ -230,7 +280,17 @@ if ( prtcl == 'PPPoE' ) {
                </div>
        </p>
 
-       <p><input type='checkbox' name='pppIpExtension' id='pppIpExtension'> <label for="pppIpExtension">PPP IP extension</label></p>
+       <p><input type='checkbox' name='pppIpExtension' id='pppIpExtension'>
+                       <label for="pppIpExtension">PPP IP extension</label></p>
+
+       <p><input type='checkbox' name='enblPppIpAddress' id='enblPppIpAddress' onClick='pppIpAddressClick(this)'>
+                       <label for="enblPppIpAddress">Static IP address</label>
+
+               <div id='pppIpAddressInfo'>
+                       <label for="pppLocalIpAddress">IP address:</label>
+                       <input type='text' name='pppLocalIpAddress' id='pppLocalIpAddress'>
+               </div>
+       </p>
 
        <p><input type='button' onClick='btnBack()' value='Back'> <input type='button' onClick='btnNext()' value='Next'></p>
 </form>