www.usr.com/support/gpl/USR9107_release.1.4.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / html / ntwkprtcl.html
index 91d4b7a..1d10a5a 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)%>");
+setPageTitle("<%ejGetWlJS(wlInterface)%>");
 
-var qs = '<%ejGet(quickSetup)%>';
+var qs = '<%ejGetJS(quickSetup)%>';
 var prtcl = '<%ejGetOther(memInfo, ntwkPrtcl)%>';
-var eMode = '<%ejGet(encapMode)%>';
-var srvname = '<%ejGet(serviceName)%>';
-var vpi = '<%ejGet(atmVpi)%>';
-var vci = '<%ejGet(atmVci)%>';
-var existedProtocol = '<%ejGet(existedProtocol)%>';
-var enblEnetWan = '<%ejGet(enblEnetWan)%>';
+var eMode = '<%ejGetJS(encapMode)%>';
+var srvname = '<%ejGetJS(serviceName)%>';
+var vpi = '<%ejGetJS(atmVpi)%>';
+var vci = '<%ejGetJS(atmVci)%>';
+var existedProtocol = '<%ejGetJS(existedProtocol)%>';
+var enblEnetWan = '<%ejGetJS(enblEnetWan)%>';
+var enblVlan = '<%ejGetJS(enblVlan)%>';
+var vlanId = '<%ejGetJS(vlanId)%>';
+
+/*
+       Use this because there can be anywhere from one to five radio buttons.
+*/
+function isChecked(rb)
+{
+       if (rb == null)
+               return false;
+       return rb.checked;
+}
 
 function frmLoad() {
    with ( document.forms[0] ) {
@@ -36,13 +48,13 @@ function frmLoad() {
             else
                ntwkPrtcl[1].checked = true;
       } else if ( existedProtocol == 'MER' ) {
-         // if MER is existed in this PVC and MER is editting then 
+         // if MER exists in this PVC and MER is editting then 
          // allow PPPoE or MER to be added
          if ( prtcl == 'MER' )
             ntwkPrtcl[1].checked = true;
          else
-         // if MER is existed and PPPoE is editting then only allow PPPoE to be added
-            ntwkPrtcl.checked = true;
+         // if MER exists and PPPoE is editting then only allow PPPoE to be added
+            ntwkPrtcl.checked = true;  // only one radio btn so no subscript
       } else if ( existedProtocol == 'PPPoE' ) {
          // if (PPPoE is existed then only allow PPPoE or MER to be added
          if ( prtcl == 'MER' )
@@ -72,7 +84,7 @@ function btnNext() {
 
    with ( document.forms[0] ) {
       if ( enblEnetWan == 1 ) {
-         if ( ntwkPrtcl[0].checked == true ) {
+         if ( isChecked(ntwkPrtcl[0]) ) {
                loc = 'pppoe.cgi?ntwkPrtcl=0';
                service = 'pppoe_' + 'eth' + '_' + vpi + '_' + conId;
          } else {
@@ -80,10 +92,10 @@ function btnNext() {
                service = 'eth_' + vpi;
          }
       } else if ( existedProtocol == 'MER' ) {
-         // if MER is existed in this PVC and MER is editting then 
+         // if MER exists in this PVC and MER is editting then 
          // allow PPPoE or MER to be added
          if ( prtcl == 'MER' ) {
-            if ( ntwkPrtcl[1].checked == true ) {
+            if ( isChecked(ntwkPrtcl[1]) ) {
                loc = 'wancfg.cgi?ntwkPrtcl=2';
                service = 'mer_' + vpi + '_' + vci;
             } else {
@@ -98,29 +110,29 @@ function btnNext() {
          }
       } else if ( existedProtocol == 'PPPoE' ) {
          // if PPPoE is existed then only allow PPPoE or MER to be added
-         if ( ntwkPrtcl[0].checked == true ) {
+         if ( isChecked(ntwkPrtcl[0]) ) {
             loc = 'pppoe.cgi?ntwkPrtcl=0';
             service = 'pppoe_' + vpi + '_' + vci + '_' + conId;
          }
-         else if ( ntwkPrtcl[1].checked == true ) {
+         else if ( isChecked(ntwkPrtcl[1]) ) {
             loc = 'wancfg.cgi?ntwkPrtcl=2';
             service = 'mer_' + vpi + '_' + vci;
          }
       } else {
          // otherwise no restriction
-         if ( ntwkPrtcl[0].checked == true ) {
+         if ( isChecked(ntwkPrtcl[0]) ) {
             loc = 'pppoe.cgi?ntwkPrtcl=1';
             service = 'pppoa_' + vpi + '_' + vci + '_' + conId;
          }
-         else if ( ntwkPrtcl[1].checked == true ) {
+         else if ( isChecked(ntwkPrtcl[1]) ) {
             loc = 'pppoe.cgi?ntwkPrtcl=0';
             service = 'pppoe_' + vpi + '_' + vci + '_' + conId;
          }
-         else if ( ntwkPrtcl[2].checked == true ) {
+         else if ( isChecked(ntwkPrtcl[2]) ) {
             loc = 'wancfg.cgi?ntwkPrtcl=2';
             service = 'mer_' + vpi + '_' + vci;
          }
-         else if ( ntwkPrtcl[3].checked == true ) {
+         else if ( isChecked(ntwkPrtcl[3]) ) {
             loc = 'ipoacfg.cgi?ntwkPrtcl=5';
             service = 'ipoa_' + vpi + '_' + vci;
          }
@@ -130,25 +142,56 @@ function btnNext() {
          }
       }
       loc += '&encapMode=' + encSel.options[encSel.selectedIndex].value;
+      if (enblVlan == 1) {
+         if (cbVlan.checked) {
+            if (vlanIdText.value >= 0 && vlanIdText.value < 4096 && vlanIdText.value != '')
+               loc += '&vlanId=' + vlanIdText.value;
+            else {
+               alert('Invalid vlan id value ' + vlanIdText.value + '.');
+               return;
+            }
+         }
+         else
+            loc += '&vlanId=-1';
+      }   
    }
    if ( srvname == '' || qs == '1' )
       loc += '&serviceName=' + encodeUrl(service);
    else
       loc += '&serviceName=' + encodeUrl(srvname);
 
-   var code = 'location.assign("' + loc + '")';
+   var code = 'location = "' + loc + '"';
    eval(code);
 }
 
 function btnBack() {
    if (qs == 0)
-      var code = 'location.assign("' + 'pvccfg.html' + '")';
+      var code = 'location = "' + 'pvccfg.html' + '"';
    else
-      var code = 'location.assign("' + 'vpivci.html' + '")';
+      var code = 'location = "' + 'vpivci.html' + '"';
 
    eval(code);
 }
 
+function hidevlanEnblInfo(status) {
+   if (document.getElementById)  // DOM3 = IE5, NS6
+      document.getElementById('vlanEnblInfo').style.visibility = status;
+   else {
+      if (document.layers == false) // IE4
+         document.all.vlanEnblInfo.style.visibility = status;
+   }
+}
+
+function hideVlanIdInfo(status) {
+   if (document.getElementById)  // DOM3 = IE5, NS6
+      document.getElementById('vlanIdInfo').style.visibility = status;
+   else {
+      if (document.layers == false) // IE4
+         document.all.vlanIdInfo.style.visibility = status;
+   }
+}
+
+
 function encDisplay(mode)
 {
    with ( document.forms[0] ) {
@@ -156,26 +199,43 @@ function encDisplay(mode)
          encSel.selectedIndex = 0;
          if (mode == 1)
             encSel.selectedIndex = 1;
+
          // if MER or PPPoE is existed in this PVC
          if ( existedProtocol == 'MER' || existedProtocol == 'PPPoE' ) {
             encSel.options[0].text = "LLC/SNAP-BRIDGING";
             encSel.options[1].text = "VC/MUX";
-         } else {
+         }
          // otherwise no restriction
-            if ( ntwkPrtcl[0].checked == true ) {
-               encSel.options[0].text = "VC/MUX";
-               encSel.options[1].text = "LLC/ENCAPSULATION";
-            }
-            else if ( ntwkPrtcl[3].checked == true ) {
-               encSel.options[0].text = "LLC/SNAP-ROUTING";
-               encSel.options[1].text = "VC/MUX";
-            }
-            else {
-               encSel.options[0].text = "LLC/SNAP-BRIDGING";
-               encSel.options[1].text = "VC/MUX";
-            }
+         else if ( isChecked(ntwkPrtcl[0]) ) {
+            encSel.options[0].text = "VC/MUX";
+            encSel.options[1].text = "LLC/ENCAPSULATION";
+         }
+         else if ( isChecked(ntwkPrtcl[3]) ) {
+            encSel.options[0].text = "LLC/SNAP-ROUTING";
+            encSel.options[1].text = "VC/MUX";
+         }
+         else {
+            encSel.options[0].text = "LLC/SNAP-BRIDGING";
+            encSel.options[1].text = "VC/MUX";
          }
       }
+      if (enblVlan == 1) {
+         // only for PPPoE, MER and BRIDGE
+                       if (isChecked(idPPPoE) || isChecked(idMER) || isChecked(idBridging))
+                       {
+            if (vlanId >= 0 && vlanId < 4096) {
+               cbVlan.checked = true;
+               vlanIdText.value = vlanId;
+            } else if (vlanId == -1)
+               vlanIdText.value = '';
+            hidevlanEnblInfo('visible');
+            vidClick(); 
+         }
+         else {
+            hidevlanEnblInfo('hidden');      
+            hideVlanIdInfo('hidden');
+         }
+      }                    
    }
 }
 
@@ -183,18 +243,29 @@ function prtClick() {
    encDisplay(0);
 }
 
+function vidClick()
+{
+   with (document.forms[0]) {
+      if (cbVlan.checked)
+         hideVlanIdInfo('visible');
+      else
+         hideVlanIdInfo('hidden');
+   }
+}
+
 // done hiding -->
 </script>
             <base target="_self">
 </head>
-<body onload="initMenu('idMenu'); frmLoad();">
+<body onload="initMenu(); frmLoad();">
 
 <script type="text/javascript">
-       writeHeader("Connection Type", "<%ejGet(curUserName)%>", "<%ejGetOther(sysInfo, adslStd)%>", "<%ejGetOther(sysInfo, noBrPrtcl)%>", <%ejGetOther(sysInfo, pppIpExtension)%>, <%ejGetOther(sysInfo, enblFirewall)%>, <%ejGetOther(sysInfo, enblNat)%>, "<%ejGetWl(wlInterface)%>", <%ejGet(enblQos)%>);
+       writeHeader("Connection Type", "<%ejGetJS(curUserName)%>", "<%ejGetOther(sysInfo, adslStd)%>", "<%ejGetOther(sysInfo, noBrPrtcl)%>", <%ejGetOther(sysInfo, pppIpExtension)%>, <%ejGetOther(sysInfo, enblFirewall)%>, <%ejGetOther(sysInfo, enblNat)%>, "<%ejGetWlJS(wlInterface)%>", <%ejGetJS(enblQos)%>);
 </script>
 
 <p>Select the type of network protocol and encapsulation mode over the ATM PVC
-   that your ISP has instructed you to use.</p>
+               that your ISP has instructed you to use. Note that 802.1q VLAN tagging is only available 
+                for PPPoE, MER, and Bridging.</p>
 
 <form>
 <script type="text/javascript">
@@ -212,7 +283,7 @@ else if ( existedProtocol == 'MER' )
       document.writeln("<input type='radio' name='ntwkPrtcl' id='idPPPoE' onClick='prtClick()'> <label for='idPPPoE'>PPP over Ethernet (PPPoE)</label><br/>");
       document.writeln("<input type='radio' name='ntwkPrtcl' id='idMER' onClick='prtClick()'> <label for='idMER'>MAC Encapsulation Routing (MER)</label><br/>");
    }
-   else        // if MER is existed in this PVC and PPPoE is editting then only allow PPPoE to be added
+   else        // if MER exists in this PVC and PPPoE is editting then only allow PPPoE to be added
       document.writeln("<input type='radio' name='ntwkPrtcl' id='idPPPoE' onClick='prtClick()'> <label for='idPPPoE'>PPP over Ethernet (PPPoE)</label><br/>");
 }
 else if ( existedProtocol == 'PPPoE' )
@@ -234,13 +305,28 @@ else      // otherwise no restriction
 </table>
 
 <div id='enetWan'>
-       <p><label for="encSel">Encapsulation mode:</label>
+       <p><label>Encapsulation mode:</label>
        <select name='encSel' id='encSel'>
                <option value="0">LLC/SNAP-Bridging</option>
                <option value="1">VC/MUX</option>
        </select></p>
 </div>
 
+<script type="text/javascript">
+<!-- hide
+if (enblVlan == 1) {
+    document.writeln("<div id='vlanEnblInfo'>");
+    document.writeln("<p>");
+    document.writeln(" <input type='checkbox' name='cbVlan' id='cbVlan' onclick='vidClick(this)'> <label for=\"cbVlan\">802.1q</label>");
+    document.writeln("<\/p>");
+    document.writeln("<p id='vlanIdInfo'>");
+    document.writeln(" <label for=\"vlanIdText\">VLAN ID:</label> <input type='text' name='vlanIdText' id='vlanIdText' size='4'> <span=\"clsNote\">(0-4095)<\/span>");
+    document.writeln("<\/p>");
+    document.writeln("<\/div>");
+}    
+// done hiding -->
+</script>
+
 <p><input type='button' onClick='btnBack()' value='Back'> <input type='button' onClick='btnNext()' value='Next'></p>
 </form>