test file for index_wstatus2.asp
[linksys-wrt3g-tools.git] / tests / index_wstatus2-connected.htm
1 <!--
2 *********************************************************
3 *   Copyright 2003, CyberTAN  Inc.  All Rights Reserved *
4 *********************************************************
5
6 This is UNPUBLISHED PROPRIETARY SOURCE CODE of CyberTAN Inc.
7 the contents of this file may not be disclosed to third parties,
8 copied or duplicated in any form without the prior written
9 permission of CyberTAN Inc.
10
11 This software should be used as a reference only, and it not
12 intended for production use!
13
14
15 THIS SOFTWARE IS OFFERED "AS IS", AND CYBERTAN GRANTS NO WARRANTIES OF ANY
16 KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE.  CYBERTAN
17 SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
18 FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE
19 -->
20
21
22 <HTML><HEAD><TITLE>WWAN Status2</TITLE>
23 <meta http-equiv="expires" content="0">
24 <meta http-equiv="cache-control" content="no-cache">
25 <meta http-equiv="pragma" content="no-cache">
26
27 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
28
29 <link rel="stylesheet" type="text/css" href="style.css">
30 <style fprolloverstyle>
31 A:hover {color: #00FFFF}
32 .small A:hover {color: #00FFFF}
33 </style>
34 <script src="common.js"></script>
35 <SCRIPT language="Javascript" type="text/javascript" src="lang_pack/capsec.js"></SCRIPT>
36 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/share.js"></SCRIPT>
37 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/help.js"></SCRIPT>
38 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/capapp.js"></SCRIPT>
39 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/capasg.js"></SCRIPT>
40 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/capsetup.js"></SCRIPT>
41 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/capwrt54g.js"></SCRIPT>
42 <SCRIPT language="Javascript" type="text/javascript" src="lang_pack/capstatus.js"></SCRIPT>
43 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/timezone.js"></SCRIPT>
44 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/layout.js"></SCRIPT>
45 <SCRIPT language="javascript" type="text/javascript" src="lang_pack/gprs.js"></SCRIPT>
46 <SCRIPT language=JavaScript>
47 var value=0;
48 function Refresh()
49 {
50         var net_name = "BASE DE";
51         var refresh_time = "60000";
52         if(refresh_time == "60000")  refresh_time = 20000;
53         if( ( net_name == "Acquiring" ) && (  refresh_time > "5000") )
54         {
55                 //refresh_time = "15000";
56                 refresh_time = "3000";
57         }
58         if("" == "restart_wan")
59         {
60                 refresh_time = "3000";
61                 choose_disable(document.wwan_connect.mbut);
62         }
63         if(refresh_time == "")  refresh_time = 20000;
64         if (value>=1)
65         {
66                 window.location.replace("index_wstatus2.asp");
67         }
68         value++;
69         timerID=setTimeout("Refresh()",refresh_time);
70 }
71
72 function ShowAlert(M)
73 {
74         //=> Disable mobile wan connecting fail alert error message
75         Refresh();
76         return -1;
77         //<= Disable mobile wan connecting fail alert error message
78
79         var str = "";
80         var mode = "";
81         var wan_ip = "";
82         //var wan_proto = "dhcp";
83         var wan_proto = "wwan";
84         var ac_name = "";
85         var srv_name = "";
86
87         //if(document.status.wan_proto.value == "pppoe")
88         //      mode = "PPPoE";
89         //else if(document.status.wan_proto.value == "l2tp")
90         //      mode = "L2TP";
91         //else if(document.status.wan_proto.value == "heartbeat")
92         //      mode = "HBS";
93         //else
94         //      mode = "PPTP";
95         mode = "3G/GPRS network";
96
97         if(M == "AUTH_FAIL" || M == "PAP_AUTH_FAIL" || M == "CHAP_AUTH_FAIL")
98                 str = mode + hstatrouter2.authfail;
99 //              str = mode + " authentication fail";
100         else if(M == "IP_FAIL" || (M == "TIMEOUT" && wan_ip == "0.0.0.0"))
101                 str = hstatrouter2.noip + mode + hstatrouter2.server;
102 //              str = "Can not get a IP address from " + mode + " server";
103         else if(M == "NEG_FAIL")
104                 str = mode + hstatrouter2.negfail;
105 //              str = mode + " negotication fail";
106         else if(M == "LCP_FAIL")
107                 str = mode + hstatrouter2.lcpfail;
108 //              str = mode + " LCP negotication fail";
109         else if(M == "TCP_FAIL" || (M == "TIMEOUT" && wan_ip != "0.0.0.0" && wan_proto == "heartbeat"))
110                 str = hstatrouter2.tcpfail + mode + hstatrouter2.server;
111 //              str = "Can not build a TCP connection to " + mode + " server";
112         else 
113                 str = hstatrouter2.noconn + mode + hstatrouter2.server;
114 //              str = "Can not connect to " + mode + " server";
115
116         alert(str);
117
118         Refresh();
119 }
120
121 function Connect(F,I)
122 {
123         var sim_check = '';     
124         var card_check = '';
125         var pincode_error = '0';
126
127         if (parseInt(pincode_error, 10)) {
128                 alert(GPRS_ERR.WRONGPINCODE);
129                 window.location.replace('Wireless_Wan.asp');
130                 return;
131         }
132
133         if( card_check == "NO_CARD")    
134                 alert(GPRS_ERR.NOCARD);
135         else if( sim_check == "NO_SIM" )        
136                 alert(GPRS_ERR.NOSIM);
137         else if( sim_check == "NEED_PINCODE" )
138         {
139                 alert(GPRS_ERR.NEEDPINCODE);
140                 window.location.replace('Wireless_Wan.asp');
141         }
142         else if( sim_check == "SIM_LOCK" )
143         {
144                 alert(GPRS_ERR.SIMLOCK);
145         }
146         else
147         {
148                 F.submit_type.value = I;
149                 F.submit_button.value = "index";
150                 F.change_action.value = "gozila_cgi";
151                 F.next_page.value = "index_wstatus2.asp";
152                 choose_disable(F.mbut);
153                 F.submit();
154         }
155 }
156
157 function init()
158 {
159         Refresh();
160 }
161 </SCRIPT>
162 </HEAD>
163 <BODY onload=init();>
164 <FORM name=wwan_connect method=post action=apply.cgi>
165 <input type=hidden name=submit_button>
166 <input type=hidden name=change_action>
167 <input type=hidden name=submit_type>
168 <input type=hidden name=next_page>
169 <!-- TABLE vlign=top align=left cellSpacing=0 cellPadding=0 border=0 width=397 height=25 style="margin-left: -5" --> 
170 <TABLE vlign=top align=left cellSpacing=0 cellPadding=0 border=0 width=397 height=25> 
171         <TR>
172           <TD height=25 width=102>&nbsp;<script>Capture(GPRS_MSG.WW)</script>&nbsp;:&nbsp;</TD>
173           <TD height=25 width=295>
174                 <B>
175                         <script language=javascript>
176                                 var status1 = "Status";
177                                 var status2 = "Connected";
178                                 if(status1 == "Status")         status1 = bmenu.statu;
179                                 if(status2 == "Connecting")     status2 = hstatrouter2.connecting;
180                                 else    if(status2 == "Disconnected")   status2 = hstatrouter2.disconnected;
181                                 else    if(status2 == "Connected")      status2 = stacontent.conn;
182                                 document.write(status2);
183                                 document.write("&nbsp;&nbsp;");
184
185                                 var but_arg = "Disconnect";
186                                 //var wan_proto = "dhcp";
187                                 var wan_proto = "wwan";
188                                 var but_type = "";
189                                 if(but_arg == "Connect")        but_value = stacontent.connect;
190                                 else if(but_arg == "Disconnect")        but_value = hstatrouter2.disconnect;
191                                 but_type = but_arg +"_" + wan_proto;
192 //20060403######################################################################################
193                                 if( '1' == '1' )
194                                 {
195                                         document.write("<INPUT name=mbut type=button value='"+but_value+"' onClick=Connect(this.form,'"+but_type+"')>");
196                                 }
197 //20060403######################################################################################
198                                 else if( ('BASE DE' == 'Acquiring') ||
199                                         ('' == 'NO_CARD') ||
200                                         ( status2 == "Connecting" )
201                                 )
202                                         document.write("<INPUT name=mbut type=button value='"+but_value+"' disabled=true>");
203                                 else
204                                         document.write("<INPUT name=mbut type=button value='"+but_value+"' onClick=Connect(this.form,'"+but_type+"')>");
205                         </script>       
206                 </B>
207           </TD>
208 </TABLE>
209 </FORM>
210 </BODY>
211 </HTML>