www.usr.com/support/gpl/USR9108_release1.5.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / html / usr_menus_build.js
1 /* -------------------------------------------------------------------------- */
2 /*
3    (c) 2004-2005 U.S. Robotics Corporation.
4 */
5 /* -------------------------------------------------------------------------- */
6
7
8 /*
9         Arguments:
10                 User name:              "admin" or "power" or "user"
11                 Standard:               "annex_c" or ... what?
12                 Protocol:               "Bridge" or ... what?
13                 IP extension:   0 | 1
14                 Firewall:               0 | 1
15                 NAT:                            0 | 1
16                 Wireless:               0 | 1
17                 QoS:                            0 | 1
18 */
19 function createMenu()
20 {
21         var strUsername = "<%ejGetJS(curUserName)%>";
22         if (strUsername == "user")
23                 return createMenuUser();
24         else
25                 return createMenuAdmin();
26 }
27
28
29 /* --------------------------------------------------------------------------
30
31         These represent the various menus. There is a main menu bar and some sub-menus.
32
33         The second and third strings in each item need to be translated.
34         The first string is a filename and does not need to be translated.
35
36         This is the only section that contains text to be translated.
37
38         The tag below must not be modified. It is used by
39         Translation to extract the text to be translated.
40         *** TRANSLATION START -->
41 */
42
43 // N.B.: All filenames must be in lowercase here.
44
45 function createMenuUser()
46 {
47         var strWireless = "<%ejGetWlJS(wlInterface)%>";
48
49         var bar = new MenuBar(7);
50
51         var dropdown = bar.addDropdown("Status", 10);
52         dropdown.addItem("General", "", "info.html");
53         dropdown.addItem("DSL", "", "wancfg.cmd?action=view");
54         dropdown.addItem("System Log", "", "logintro.html");
55         dropdown.addItem("LAN Statistics", "", "statsifc.html");
56         dropdown.addItem("WAN Statistics", "", "statswan.cmd");
57         dropdown.addItem("ATM Statistics", "", "statsatm.cmd");
58         dropdown.addItem("ADSL Statistics", "", "statsadsl.html");
59
60         dropdown = bar.addDropdown("LAN", 10);
61         dropdown.addItem("Routing - Routing Table", "", "rtroutecfg.cmd?action=view");
62         dropdown.addItem("Routing - ARP Table", "", "arpview.cmd");
63
64         dropdown = bar.addDropdown("Device", 10);
65         dropdown.addItem("Back up Settings", "", "backupsettings.html");
66         dropdown.addItem("Diagnostics", "", "diag.html");
67         if      (strWireless == "1")
68                 dropdown.addItem("SNMP", "", "snmpconfig.html");
69
70         return bar;
71 }
72
73
74 function createMenuAdmin()
75 {
76         var strStd = "<%ejGetOther(sysInfo, adslStd)%>";
77         var strProtocol = "<%ejGetOther(sysInfo, noBrPrtcl)%>";
78         var bIPext = <%ejGetOther(sysInfo, pppIpExtension)%>;
79         var bFirewall = <%ejGetOther(sysInfo, enblFirewall)%>;
80         var bNAT = <%ejGetOther(sysInfo, enblNat)%>;
81         var bQoS = <%ejGetJS(enblQos)%>;
82         var strWireless = "<%ejGetWlJS(wlInterface)%>";
83
84         var bar = new MenuBar(7);
85
86         /*
87                 STATUS
88         */
89         var dropdown = bar.addDropdown("Status", 10);
90         dropdown.addItem("General", "", "info.html");
91         dropdown.addItem("DSL", "", "wancfg.cmd?action=view");
92         dropdown.addItem("System Log", "", "logview.cmd");
93         dropdown.addItem("LAN Statistics", "", "statsifc.html");
94         dropdown.addItem("WAN Statistics", "", "statswan.cmd");
95         dropdown.addItem("ATM Statistics", "", "statsatm.cmd");
96         dropdown.addItem("ADSL Statistics", "", "statsadsl.html");
97
98
99         /*
100                 INTERNET
101         */
102         dropdown = bar.addDropdown("Internet", 17);
103         dropdown.addItem("WAN Setup", "", "wancfg.cmd");
104         if (strStd == "annex_c")
105                 dropdown.addItem("ADSL Settings", "", "adslcfgc.html");
106         else
107                 dropdown.addItem("ADSL Settings", "", "adslcfg.html");
108
109         // Only add these if VPN is unlocked
110         if (<%ejGetOther(sysInfo,enblVpn)%> == 1)
111         {
112                 dropdown.addItem("VPN", "", "ipsec.cmd?action=view");
113                 dropdown.addItem("VPN Local Certificates", "", "certlocal.cmd");
114                 dropdown.addItem("VPN Trusted Certificates", "", "certca.cmd");
115         }
116         else
117                 dropdown.addItem("Purchase VPN", "", "purchase.html");
118
119         if (    ((strProtocol == "PPPoE") && !bIPext) ||
120                         ((strProtocol == "PPPoA") && !bIPext) ||
121                         (strProtocol == "MER") ||
122                         (strProtocol == "IPoA"))
123         {
124                 dropdown.addItem("Default Gateway", "", "rtdefaultcfg.html");
125                 dropdown.addItem("DNS Server", "", "dnscfg.html");
126         }
127
128         if (strProtocol != "Bridge")
129         {
130                 dropdown.addItem("Access Control - IP Addresses", "", "scacccntr.cmd?action=view");
131                 dropdown.addItem("Access Control - Services", "", "scsrvcntr.cmd?action=view");
132         }
133         dropdown.addItem("Dynamic DNS", "", "ddnsmngr.cmd");
134
135
136         /*
137                 LAN
138         */
139         if (    ((strProtocol == "PPPoE") && !bIPext) ||
140                         ((strProtocol == "PPPoA") && !bIPext) ||
141                         (strProtocol == "MER") ||
142                         (strProtocol == "IPoA") ||
143                         (strProtocol == "Bridge"))
144         {
145                 dropdown = bar.addDropdown("LAN", 13);
146                 if (    ((strProtocol == "PPPoE") && !bIPext) ||
147                                 ((strProtocol == "PPPoA") && !bIPext) ||
148                                 (strProtocol == "MER") ||
149                                 (strProtocol == "IPoA"))
150                 {
151                         dropdown.addItem("DHCP Server", "", "lancfg2.html");
152                         dropdown.addItem("Mapped Interfaces", "", "portmap.cmd");
153                         dropdown.addItem("Routing - Routing Table", "", "rtroutecfg.cmd?action=view");
154                         dropdown.addItem("Routing - Static Routes", "", "rtroutecfg.cmd?action=viewcfg");
155                         dropdown.addItem("Routing - RIP", "", "ripcfg.cmd?action=view");
156                         dropdown.addItem("Routing - ARP Table", "", "arpview.cmd");
157                         dropdown.addItem("DHCP Clients", "", "dhcpinfo.html");
158                         if (bQoS)
159                                 dropdown.addItem("Quality of Service", "", "qoscls.cmd?action=view");
160                 }
161                 else if (strProtocol == "Bridge")
162                 {
163                         dropdown.addItem("DHCP Server", "", "lancfg2.html");
164                         dropdown.addItem("Mapped Interfaces", "", "portmap.cmd");
165
166                         if (bQoS)
167                                 dropdown.addItem("Quality of Service", "", "qoscls.cmd?action=view");
168                 }
169         }
170
171
172         /*
173                 WIRELESS
174         */
175         if (strWireless == "1")
176         {
177                 dropdown = bar.addDropdown("Wireless", 11);
178                 dropdown.addItem("Setup", "", "wlcfg.html");
179                 dropdown.addItem("Client List", "", "wlstationlist.cmd?");
180                 dropdown.addItem("AP Mode", "", "wlwds.cmd?action=view");
181                 dropdown.addItem("Advanced Settings", "", "wlcfgadv.html");
182                 dropdown.addItem("Quality of Service", "", "wlqos.cmd");
183         }
184
185
186         /*
187                 SECURITY
188         */
189         dropdown = bar.addDropdown("Security", 17);
190         if (strWireless == "1")
191         {
192                 dropdown.addItem("Wireless", "", "wlsecurity.html");
193                 dropdown.addItem("MAC Filter", "", "wlmacflt.cmd?action=view");
194         }
195 //WHY?  if (strProtocol != "Bridge")
196         dropdown.addItem("Device Login", "", "password.html");
197         if ((strProtocol != "Not Applicable") && !bIPext)
198         {
199                 if (strProtocol == "Bridge")
200                 {
201                         dropdown.addItem("Internet Access Control", "", "todmngr.tod?action=view");
202                         dropdown.addItem("LAN MAC Filter", "", "scmacflt.cmd?action=view");
203                 }
204
205                 /*
206                         If it's not a bridge and the firewall is on, display filter commands
207                 */
208                 if ((strProtocol != "Bridge") && bFirewall)
209                 {
210                         dropdown.addItem("Internet Access Control", "", "todmngr.tod?action=view");
211                         dropdown.addItem("IP Filtering - Outbound Filters", "", "scoutflt.cmd?action=view");
212                         dropdown.addItem("IP Filtering - Inbound Filters", "", "scinflt.cmd?action=view");
213                 }
214
215                 /*
216                         If NAT is enabled, display virtual server commands
217                 */
218                 if (bNAT)
219                 {
220                         dropdown.addItem("Virtual Servers", "", "scvrtsrv.cmd?action=view");
221                         dropdown.addItem("Port Triggering", "", "scprttrg.cmd?action=view");
222                         dropdown.addItem("DMZ Host", "", "scdmz.html");
223                 }
224         }
225
226
227         /*
228                 DEVICE
229         */
230         dropdown = bar.addDropdown("Device", 10);
231         dropdown.addItem("Time", "", "sntpcfg.html");
232         dropdown.addItem("Print Server", "", "ippcfg.html");
233         dropdown.addItem("Back Up Settings", "", "backupsettings.html");
234         dropdown.addItem("Restore Settings", "", "updatesettings.html");
235         dropdown.addItem("Restart", "", "resetrouter.html");
236         dropdown.addItem("Upgrade", "", "upload.html");
237         dropdown.addItem("Restore Defaults", "", "defaultsettings.html");
238         dropdown.addItem("Diagnostics", "", "diag.html");
239         if      (strWireless == "1")
240                 dropdown.addItem("SNMP", "", "snmpconfig.html");
241
242         return bar;
243 }
244
245 /*
246         <-- TRANSLATION END ***
247         Nothing after this needs to be translated.
248         The above tag must not be modified. It is used by
249         Translation to extract the text to be translated.
250 */