Advertisement
Guest User

Untitled

a guest
Mar 5th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 113.13 KB | None | 0 0
  1. Em.I18n.addTranslations({
  2. "wan.title" : "Internet Ayarları",
  3. "internet.status.title" : "Ä°nternet Durumu",
  4. "internet.profile.title" : "Ä°nternet Profilleri",
  5. "wan.description" : "HG255s öğesinin bağlantı durumunu görüntüleyebilir ve kullanım senaryolarına göre bağlantı parametreleri üzerinde değişiklik yapabilirsiniz.",
  6. "wan.basic.title" : "Temel Bilgiler",
  7. "wan.link.title" : "Bağlantı Bilgisi",
  8. "wan.ppp.title" : "PPP Bilgisi",
  9. "wan.ip.title" : "IP Bilgisi",
  10. "internet.status.title.description" : "<b>{{internet.status.title}}</b>, HG255s öğesinin internete bağlı olduğu modu ve bağlantı durumunu görüntüler.",
  11. "internet.profile.description" : "<b>{{internet.profile.title}}</b> internet eriÅŸim modunu ve ilgili parametreleri görüntüler.<ul>      <li>{{wan.profile}}:<ul>      <li>{{wan.profile_Cable}}:<p>Ä°nternete aÄŸ kabloları veya telefon hatları üzerinden baÄŸlanan kullanıcılar için bu modu seçin.</p></li>     <li>{{wan.profile_UMTS}}:<p>Mobil iletiÅŸim servis saÄŸlayıcıları tarafından saÄŸlanan veri kanalları üzerinden internete baÄŸlanan kullanıcılar için bu modu seçin. Veri kartı HG255s öğesinin USB baÄŸlantı noktasına takılmalıdır.</p></li>     </ul></li>     <li>{{wan.VLANEnable}}:<p>Bir VLAN etkinleÅŸtirin. Ä°lgili parametreler servis saÄŸlayıcınız tarafından saÄŸlanır.</p></li>     <li>{{backup.Mode}}:<p>Sabit hat ve veri kartı hesapları arasında geçiÅŸ yaptığınız modu ayarlayın.</p><ul>      <li>{{backup.Mode_Disable}}:<p>HG255s internete mevcut oturum açma hesabından baÄŸlanır.</p></li>     <li>{{backup.Mode_Backup_Confirm}}:<p>Ä°nternete sabit hat hesabından eriÅŸemediÄŸinizde veri kartı hesabına geçiÅŸ yapıp yapmayacağınızı belirleyin. Bir web sayfasına eriÅŸemezseniz, sistem bir bildirim görüntüler.</p></li>     <li>{{backup.Mode_Backup_Auto}}:<p>HG255s internete sabit hat hesabınız üzerinden baÄŸlanır. Sabit hat hesabınız çalışmazsa, HG255s veri kartı hesabınıza geçiÅŸ yapar.</p></li></ul></li>     <li>{{wan.PPPTrigger}}:<ul>      <li>{{wan.PPPTrigger_AlwaysOn}}:<p>HG255s açıldığında, HG255s internete bir çevirmeli baÄŸlantı üzerinden baÄŸlanır. Aylık veya yıllık bir paket kullanıyorsanız bu modu seçin.</p></li>     <li>{{wan.PPPTrigger_Manual}}:<p>HG255s açıldıktan sonra, manuel olarak bir çevirmeli aÄŸ baÄŸlantısı oluÅŸturmak için HG255s web sayfasına oturum açın. Ä°nternet eriÅŸimine gerek duymuyorsanız, aÄŸ baÄŸlantısını sonlandırın. Süre temelli bir paket kullanıyorsanız bu modu seçin Ä°nternet eriÅŸim ücretlerini düşürmenize yardımcı olabilir.</p></li>     <li>{{wan.PPPTrigger_OnDemand}}:<p>HG255s açıldıktan sonra, internet eriÅŸimine gerek duyduÄŸunuzu tespit ettiÄŸinde bir çevirmeli baÄŸlantı oluÅŸturur. HG255s otomatik baÄŸlantı kesilmesi bekleme süresi içinde internet eriÅŸimi istekleri tespit etmezse, HG255s aÄŸ baÄŸlantısını sonlandırır. Farklı zamanlarda internet eriÅŸimine gerek duyuyor ve manuel bir baÄŸlantı oluÅŸturmada sorun yaşıyorsanız bu modu seçin.</p></li></ul></li>     <li>{{wan.IPVer}}:<p>DeÄŸeri servis saÄŸlayıcınız tarafından istenen ÅŸekilde ayarlayın. IPv4 ana akım protokoldür ve IPv6 IPv4\'ün bir uzantısıdır.</p></li>     <li>{{wan.IPv6AddrType}}:<ul>      <li>{{wan.IPv4AddrType_DHCP}}:<p>Servis saÄŸlayıcınızın sunucusu bilgisayarınıza otomatik olarak bir IP adresi tahsis eder.</p></li>     <li>{{wan.IPv4AddrType_Static}}:<p>Sabit IP adresi servis saÄŸlayıcınnız tarafından saÄŸlanır.</p></li>     <li>{{wan.IPv6AddrType_SLAAC}}:<p>Ä°nternete ilk defa eriÅŸtiÄŸinizde, sistem bir adres türü yapılandırır</p></li></ul></li>     <li>{{wan.MacColoneEn}}:<p>HG255s bilgisayarınızın MAC adresini internete baÄŸlanmak için kendi MAC adresi olarak kullanır. ÖrneÄŸin, internete baÄŸlanmak için tek bir bilgisayar kullanıyorsanız, servis saÄŸlayıcı çevrimiçi hesabınızı bilgisayarın MAC adresiyle iliÅŸkilendirir. Bilgisayarın MAC adresini klonlamak için HG255s öğesini kullanabilirsiniz, böylece HG255s servis saÄŸlayıcınızın kimlik doÄŸrulamasını geçebiir ve birden fazla baÄŸlı bilgisayarların internete eriÅŸmesine izin verebilir.</p></li></ul>",
  12. "wan.advanved.hbody" : "GeliÅŸmiÅŸ internet baÄŸlantı parametreleri belirleyebilirsiniz.<ul>     <li>{{wan.ServiceList}}:<p>Ä°nternet baÄŸlantı servisi türü. Genel olarak bir aÄŸa eriÅŸtiÄŸinizde <b>INTERNET</b> seçimini yapın.</p></li>     <li>{{wan.PPPAuthMode}}:<p><b>{{wan.ConnectionType}}</b> <b>PPP</b> olduÄŸunda doÄŸrulama modu.</p><ul>      <li>{{wan.PPPAuthMode_PAP}}:<p>Basit düz metin kimlikd oÄŸrulama modu. Bu mod en az güvenli olandır. Kullanıcı adları ve ÅŸifrelerin kırılması nispeten kolaydır.</p></li>     <li>{{wan.PPPAuthMode_CHAP}}:<p>ŞifrelenmiÅŸ kimlik doÄŸrulama modu. Bu mod en güvenli olandır. Şifreniz iletilmedi.</p></li>     <li>{{wan.PPPAuthMode_AUTO}}:<p>HG255s servis saÄŸlayıcınızın gerektirdiÄŸi ÅŸekilde bir kimlik doÄŸrulama modu seçer.</p></li></ul></li></ul>",
  13. "wan.NewItemName" : "Yeni WAN bağlantısı",
  14. "wan.LanIntf" : "LAN arayüzü",
  15. "wan.Alias" : "Ad",
  16. "wan.Enable" : "Bağlantıyı etkinleştir",
  17. "wan.SelectOther" : "DiÄŸer",
  18. "wan.AccessType" : "Erişim türü",
  19. "wan.AccessType_DSL" : "ATM çıkış yolu",
  20. "wan.AccessType_VDSL" : "PTM çıkış yolu",
  21. "wan.AccessType_Ethernet" : "Ethernet çıkış yolu",
  22. "wan.AccessType_UMTS" : "UMTS",
  23. "wan.profile" : "Ä°nternet profili",
  24. "wan.profile_Cable" : "Sabit hat",
  25. "wan.profile_UMTS" : "Veri kartı",
  26. "wan.PVC" : "VPI/VCI",
  27. "wan.LinkType" : "Bağlantı modu",
  28. "wan.LinkType_EoA" : "EoA",
  29. "wan.LinkType_PPPoA" : "PPPoA",
  30. "wan.LinkType_IPoA" : "IPoA",
  31. "wan.EncapMode" : "Sarma modu",
  32. "wan.EncapMode_LLC" : "LLC",
  33. "wan.EncapMode_VCMUX" : "VCMUX",
  34. "wan.AtmQoS" : "Servis türü",
  35. "wan.AtmQoS_UBR" : "PCR olmadan UBR",
  36. "wan.AtmQoS_UBR+" : "PCR ile UBR",
  37. "wan.AtmQoS_CBR" : "CBR",
  38. "wan.AtmQoS_VBR-nrt" : "Gerçek zamanlı olmayan VBR",
  39. "wan.AtmQoS_VBR-rt" : "Gerçek zamanlı VBR",
  40. "wan.DslPeakRate" : "En yüksek hız (hücre/s)",
  41. "wan.DslSupportRate" : "Desteklenen hız (hücre/s)",
  42. "wan.DslSupportRate_err" : "Destek hızı, En yüksek hızdan daha büyük olmamalıdır.",
  43. "wan.DslMaxBurstRate" : "Maksimum çoğuşma değeri (hücre/s)",
  44. "wan.VLANEnable" : "VLAN\'ı etkinleştir",
  45. "wan.VLANId" : "VLAN kimliÄŸi",
  46. "wan.VLAN1p" : "802.1p",
  47. "wan.Username" : "İnternet hesabı",
  48. "wan.Password" : "Ä°nternet ÅŸifresi",
  49. "wan.APN" : "APN",
  50. "wan.DialNum" : "Çevirme numarası",
  51. "wan.ServiceList" : "Servis türü",
  52. "wan.ServiceList_err" : "IPTV seçeneğini seçerseniz, TR069, INTERNET, veya SES servisleri seçilemez.",
  53. "wan.ConnectionType" : "Bağlantı tipi",
  54. "wan.ConnectionType_PPP_Routed" : "IP yönlendirme (PPP)",
  55. "wan.ConnectionType_IP_Routed" : "IP yönlendirme (IP)",
  56. "wan.ConnectionType_Bridged" : "Köprülü",
  57. "wan.ConnectionType_DHCP_Spoofed" : "DHCP kimlik gizlendi",
  58. "wan.dhcpspoof_server_err" : "DHCP ile kimlik gizlenen WAN\'lar {{arg1}} ile iliÅŸkilendirilemiyor.",
  59. "wan.connType_ipoe" : "IPoE",
  60. "wan.connType_pppoe" : "PPP",
  61. "wan.connType_bridge" : "Köprü modu",
  62. "wan.connType_wauto" : "Otomatik olarak bağlanın",
  63. "wan.connType_wautohelp" : "Cihaz internete otomatik olarak eriÅŸmeyi deneyecektir.",
  64. "wan.connType_disconnected" : "İnternete bağlı değilsiniz. Otomatik olarak bağlanma girişiminde bulunmak için bu seçeneği seçin.",
  65. "wan.connType_wpppoe" : "Kullanıcı hesabıyla bağlanın",
  66. "wan.connType_wpppoehelp" : "İnternet servisinize abone olduğunuzda, sağlayıcınızdan bir bağlantı hesabı ve şifresi aldınız. Bu çoğu ev ağları için geçerlidir.",
  67. "wan.connType_wipoe" : "Kullanıcı hesabı olmadan bağlanın",
  68. "wan.connType_wipoehelp" : "İnternet servisinize abone olduğunuzda, sağlayıcınızdan bir bağlantı hesabı ve şifresi almadınız. Bu okul ve şirket ağları için geçerlidir.",
  69. "wan.connType_wbridge" : "Başka bir modemle bağlanın",
  70. "wan.connType_wbridgehelp" : "Köprü modu en iyi halihazırda bir modem bulunan evlerde veya internete bağlanmak için bir bilgisayar çevirmeli bağlantı kullananlarda kullanılır.",
  71. "wan.connType_wipstatic" : "IP adresini girin",
  72. "wan.connType_wipstatichelp" : "İnternet servis sağlayıcınız internet erişimi için size bir IP adresi sağlamıştır. Bu bazı ev ağları için kullanılır.",
  73. "wan.account_err" : "Yanlış internet hesabı tespit edildi.",
  74. "wan.account_none_err" : "İnternet hesabı boş bırakılamaz. Hesabınızı girin ve tekrar deneyin.",
  75. "wan.wpin_err" : "Girdiniz yanlıştır. Kalan girişimler: {{arg1}}",
  76. "wan.pvcscanbtn" : "Tara",
  77. "wan.pvcconfigbtn" : "Tarama Listesini düzenle",
  78. "wan.MTU" : "MTU",
  79. "wan.MRU" : "MRU",
  80. "wan.MSS" : "MSS",
  81. "wan.IPv4Enable" : "IPv4\'ü destekle",
  82. "wan.IPv6Enable" : "IPv6\'yı destekle",
  83. "wan.NATType" : "NAT türü",
  84. "wan.NATType_1" : "NAPT",
  85. "wan.NATType_2" : "Tam konik NAT",
  86. "wan.NATType_0" : "Devre Dışı",
  87. "wan.PPPAuthMode" : "PPP kimlik doÄŸrulama modu",
  88. "wan.PPPAuthMode_AUTO" : "Otomatik",
  89. "wan.PPPAuthMode_PAP" : "PAP",
  90. "wan.PPPAuthMode_CHAP" : "CHAP",
  91. "wan.PPPTrigger" : "PPP tetikleyici modu",
  92. "wan.PPPTrigger_AlwaysOn" : "Her zaman çevrimiçi",
  93. "wan.PPPTrigger_Manual" : "Manuel olarak çevir",
  94. "wan.PPPTrigger_OnDemand" : "İstek üzerine çevir",
  95. "wan.PPPTrigger_OnDemand2" : "Otomatik bağlantıyı kesme ",
  96. "wan.PPPIdletime" : "Boş süre",
  97. "wan.PPPIdletime_60" : "1 dakika",
  98. "wan.PPPIdletime_120" : "2 dakika",
  99. "wan.PPPIdletime_180" : "3 dakika",
  100. "wan.PPPIdletime_300" : "5 dakika",
  101. "wan.PPPIdletime_600" : "10 dakika",
  102. "wan.PPPIdletimeOther" : "Boş süreyi manuel olarak ayarla (saniye)",
  103. "wan.PPPIdletime_tail" : "",
  104. "wan.PPPoEServiceName" : "PPP servis adı",
  105. "wan.IPVer" : "IP protokolü sürümü",
  106. "wan.IPVer_IPv4" : "IPv4",
  107. "wan.IPVer_IPv6" : "IPv6",
  108. "wan.IPVer_Both" : "IPv4 + IPv6",
  109. "wan.IPv4AddrType" : "IPv4 adres türü",
  110. "wan.IPv4AddrType_DHCP" : "DHCP",
  111. "wan.IPv4AddrType_Static" : "Statik",
  112. "wan.IPv4Status" : "IPv4 durumu",
  113. "wan.IPv4Addr" : "IPv4 adresi",
  114. "wan.IPv4Mask" : "IPv4 aÄŸ maskesi",
  115. "wan.IPv4Gateway" : "IPv4 varsayılan ağ geçidi",
  116. "wan.IPv4PriDns" : "IPv4 birincil DNS sunucusu",
  117. "wan.IPv4SecDns" : "IPv4 ikincil DNS sunucusu",
  118. "wan.IPv6AddrType" : "IPv6 adres türü",
  119. "wan.IPv6AddrType_SLAAC" : "SLAAC",
  120. "wan.IPv6AddrType_DHCP" : "DHCP",
  121. "wan.IPv6AddrType_Static" : "Statik",
  122. "wan.IPv6Status" : "IPv6 durumu",
  123. "wan.IPv6Addr" : "IPv6 adresi",
  124. "wan.IPv6Gateway" : "IPv6 varsayılan ağ geçidi",
  125. "wan.IPv6PriDns" : "IPv6 birincil DNS sunucusu",
  126. "wan.IPv6SecDns" : "IPv6 ikincil DNS sunucusu",
  127. "wan.PrefixList" : "IPv6 adresi ön ek listesi",
  128. "wan.Status" : "Bağlantı Durumu",
  129. "wan.Connected" : "Bağlandı",
  130. "wan.Disconnected" : "Bağlı değil",
  131. "wan.AccessTitle_DSL" : "DSL bağlantısı",
  132. "wan.AccessTitle_VDSL" : "VDSL bağlantısı",
  133. "wan.AccessTitle_Ethernet" : "Ethernet bağlantısı",
  134. "wan.AccessTitle_UMTS" : "UMTS kablosuz bağlantı",
  135. "wan.too_many_err" : "Bağlantı oluşturma başarısız.",
  136. "wan.ipoa_err" : "IPoA yalnızca bir IP bağlantısını destekleyebilir.",
  137. "wan.pppoa_err" : "PPPoA yalnızca bir PPP bağlantısını destekleyebilir.",
  138. "wan.link_cap_err" : "Bu bağlantı için yalnızca {{arg1}} bağlantıya izin verilmektedir.",
  139. "wan.ip_conn_err" : "IP ve IP olmayan bağlantılar karıştırılamaz.",
  140. "wan.bridge_num_err" : "Bu bağlantı için yalnızca bir köprüye izin verilmektedir.",
  141. "wan.bridge_server_err" : "Köprü modu WAN\'lar {{arg1}} ile ilişkilendirilemiyor.",
  142. "wan.vlan_err" : "Yalnızca {{arg1}} VLAN\'a izin verilmektedir.",
  143. "wan.pvc_err" : "Yalnızca {{arg1}} PVC\'ye izin verilmektedir.",
  144. "wan.pvcnum_err" : "Geçersiz PVC.",
  145. "wan.MSS_err" : "TCP MSS için değer aralığı [{{arg1}}]. 0 varsayılan değeri ifade eder.",
  146. "wan.MSS_MTU_err" : "(MTU-MSS) in değerleri 40 tan az olmamalı.",
  147. "wan.MSS_MRU_err" : "(MRU-MSS) in değerleri 40 tan az olmamalı.",
  148. "wan.Username_err" : "Yanlış kullanıcı adı.",
  149. "wan.Password_err" : "Girilen parola geçersiz karakterler içeriyor. Geçerli karakterler rakamları, harfleri ve şu sembolleri içerir: ~ ! @ # $ % ^ & * ( ) - _ + = { } [ ] ?",
  150. "wan.Password_notinit_err" : "Lütfen parolayı girin.",
  151. "wan.tunnel_cap_err" : "IP Tüneli etkinleştirildiğinden yalnızca {{arg1}} WAN oluşturulabilir.",
  152. "wan.ondemand_err" : "Yalnızca INTERNET WAN bağlantıları isteğe bağlı modunu destekleyebilir.",
  153. "wan.too_many_link_err" : "",
  154. "wan.MacColoneEn" : "MAC adresini klonla",
  155. "wan.MacColone" : "MAC adresi kaynağı",
  156. "wan.CloneMacaddr" : "MAC adresi",
  157. "wan.CloneMacaddr_err" : "MAC adresi geçerli değil.",
  158. "wan.WANDHCPOption60" : "",
  159. "wan.WANDHCPOption60_err" : "",
  160. "wan.BindDhcpsMacAddr" : "",
  161. "wan.BindDhcpsMacAddr_err" : "",
  162. "wan.PeakRate_err" : "En yüksek hızın aralığı [{{arg1}}].",
  163. "wan.SupportRate_err" : "Destek hızı aralığı: [{{arg1}}]",
  164. "wan.MaxBurstRate_err" : "Maksimum çoğuşma değerinin aralığı [{{arg1}}].",
  165. "wan.confirmdelete" : "Bu WAN bağlantısını silmek istediğinizden emin misiniz?",
  166. "wan.confirmsubmit" : "Değişiklik bu WAN üzerindeki uygulamaları etkileyebilir. Devam edilsin mi?",
  167. "wan.4in6_ipv4_err" : "",
  168. "wan.6in4_ipv6_err" : "IPv6 WAN bağlantısına bir 6IN4 tüneli zaten mevcut olduğunda izin verilmez.",
  169. "wan.wizard.operation" : "",
  170. "wan.wizard.title" : "Ä°nternete BaÄŸlan",
  171. "wan.IPv4Addr_err" : "IPv4 adresi geçerli değil.",
  172. "wan.IPv4Mask_err" : "IPv4 ağ maskesi geçerli değil.",
  173. "wan.IPv4Gateway_err" : "IPv4 varsayılan ağ geçidi geçerli değil.",
  174. "wan.IPv4PriDns_err" : "IPv4 birincil DNS sunucusu geçerli değil.",
  175. "wan.IPv4SecDns_err" : "IPv4 ikincil DNS sunucusu geçerli değil.",
  176. "wan.IPv6Addr_err" : "IPv6 adresi geçerli değil.",
  177. "wan.IPv6Gateway_err" : "IPv6 varsayılan ağ geçidi geçerli değil.",
  178. "wan.IPv6PriDns_err" : "IPv6 birincil DNS sunucusu geçerli değil.",
  179. "wan.IPv6SecDns_err" : "IPv6 ikincil DNS sunucusu geçerli değil.",
  180. "wan.tunnel_err" : "VPN tüneli etkin olduğunda IP tüneli çalışamaz.",
  181. "wan.advanved" : "GeliÅŸmiÅŸ",
  182. "wan.DNSOverrideAllowed" : "Statik DNS",
  183. "wan.ACName" : "PPPoE AC-Adı",
  184. "wan.PPPReset" : "PPPoE\'yi yeniden baÅŸlat",
  185. "wan.DialNum_err" : "",
  186. "wan.Username_datacard_err" : "",
  187. "wan.Password_datacard_err" : "",
  188. "mwan.title" : "İnternet olmayan WAN Bağlantıları",
  189. "mwan.description" : "Burada listelenen WAN bağlantıları internet erişimi için değildir. Başlıca olarak IPTV, VoIP ve daha fazlası için kullanılmaktadırlar. Genel olarak, bunların hiçbiri üzerinde değişiklik yapmanız gerekmeyecektir.",
  190. "eth.title" : "Ethernet Bilgisi",
  191. "eth.Status" : "Durum",
  192. "eth.Status_Up" : "Bağlandı",
  193. "eth.Status_Down" : "Bağlantı kesildi",
  194. "eth.MaxBitRate" : "Hız (Mbps)",
  195. "eth.DuplexMode" : "Mod",
  196. "eth.DuplexMode_Half" : "Yarı çift yönlü",
  197. "eth.DuplexMode_Full" : "Tam çift yönlü",
  198. "umts.title" : "Mobil GeniÅŸ Bant Bilgisi",
  199. "umts.nodatacard" : "Mobil geniÅŸ bant mevcut deÄŸildir.",
  200. "umts.Mode" : "Sistem modu",
  201. "umts.Order" : "AÄŸ eriÅŸim dizisi",
  202. "umts.Band" : "Frekans bandı",
  203. "umts.Band_DCSSystem" : "GSM DCS sistemleri",
  204. "umts.Band_ExtGSM900" : "GeniÅŸletilmiÅŸ GSM 900",
  205. "umts.Band_PriGSM900" : "Birincil GSM 900",
  206. "umts.Domain" : "Etki alanı",
  207. "umts.UpstreamMaxRate" : "Maksimum yukarı akım hızı",
  208. "umts.DownstreamMaxRate" : "Maksimum aşağı akım hızı",
  209. "umts.SignalQuality" : "Sinyal gücü",
  210. "umts.ServiceStatus" : "Servis durumu",
  211. "umts.ServiceDomain" : "Servis etki alanı",
  212. "umts.RoamStatus" : "Dolaşım durum bilgisi",
  213. "umts.SystemMode" : "Sistem modu",
  214. "umts.SIMStatus" : "SIM kart durum bilgisi",
  215. "umts.SysSubMode" : "Sistem alt modu",
  216. "umts.UpLoadData" : "Yükleme Verisi",
  217. "umts.DownLoadData" : "Ä°ndirme Verisi",
  218. "umts.CurrentUpstreamRate" : "Geçerli yukarı akım hızı",
  219. "umts.CurrentDownstreamRate" : "Geçerli aşağı akım hızı",
  220. "umts.NoChange" : "DeÄŸiÅŸiklik yok",
  221. "umts.Order_GSM" : "GSM\'ye Öncelik Ver",
  222. "umts.Order_WCDMA" : "WCDMA\'ya öncelik ver",
  223. "umts.Order_LTE" : "LTE\'ye öncelik tanı",
  224. "umts.Domain_Any" : "Herhangi bir",
  225. "umts.Domain_CSOnly" : "Yalnızca CS\'yi destekle",
  226. "umts.Domain_PSOnly" : "Yalnızca PS\'yi destekle",
  227. "umts.Domain_CS_PS" : "CS ve PS destekle",
  228. "umts.srvStatus_NoService" : "Servis yok",
  229. "umts.srvStatus_LimitedService" : "Sınırlı servis",
  230. "umts.srvStatus_AvailableService" : "Kullanılabilir servis",
  231. "umts.srvStatus_LimitedRegionalService" : "Sınırlı bölgesel servis",
  232. "umts.srvStatus_SleepService" : "Uyku durumu",
  233. "umts.srvDom_CS_Capable" : "Yalnızca CS",
  234. "umts.srvDom_PS_Capable" : "Yalnızca PS",
  235. "umts.srvDom_CS_PS_Capable" : "CS ve PS",
  236. "umts.srvDom_Searching" : "Aranıyor...",
  237. "umts.Roam_Normal" : "Normal",
  238. "umts.Roam" : "Dolaşım",
  239. "umts.sim_Valid" : "Geçerli",
  240. "umts.sim_Invalid" : "Geçersiz",
  241. "umts.sim_CS_Invalid" : "CS\'de geçersiz",
  242. "umts.sim_PS_Invalid" : "PS\'de geçersiz",
  243. "umts.sim_PS_CS_Invalid" : "CS ve PS\'de geçersiz",
  244. "umts.sim_NoCard" : "Kart yok",
  245. "umts.apn_Char_Err" : "",
  246. "umts.internet_wizard_login_title" : "Şebeke erişimi ile ilgili problem olabilir. Aşağıda bu problem ile ilgili bilgiler yer almaktadır:",
  247. "umts.internet_wizard_login_title1" : "1.ETH kablosu bağlı değil. Kabloyu kontrol edin.",
  248. "umts.internet_wizard_login_title2" : "2.USB aktif. 3G bağlantısını yönetmek için \" 3G \" butonuna tıklayınız.",
  249. "umts.internet_wizard_login_title3" : "Şebekeye Erişilemiyor.",
  250. "umts.RedirectLogin" : "GiriÅŸ yap",
  251. "umts.RedirectWizard" : "3G",
  252. "umts.RegistedNetwork" : "Registed Network",
  253. "wan.NetType" : "Network",
  254. "wan.NetType_Auto" : "Auto",
  255. "wan.NetType_3G_preferred" : "3G preferred",
  256. "wan.NetType_3G_only" : "3G only",
  257. "wan.NetType_2G_preferred" : "2G preferred",
  258. "wan.NetType_2G_only" : "2G only",
  259. "wan.Username_notinit_err" : "Kullanıcı adı girin.",
  260. "atp" : "atp"
  261. });
  262. Em.I18n.addTranslations({
  263. "pin.title":"PIN yönetimi",
  264. "pin.pin_help":"PIN ...",
  265. "pin.Status":"PIN durumu",
  266. "pin.NoDatacard":"Lütfen bir SIM kart takın.",
  267. "pin.initing":"Veri kartı başlatılıyor... Lütfen bekleyin.",
  268. "pin.Disabled":"SIM kartınızın PIN yönetimi işlevi devre dışı bırakılmıştır. Etkinleştirmek için PIN'inizi girin.",
  269. "pin.Ready":"PIN doğrulandı.",
  270. "pin.pinRequired":"PIN doğrulanmalıdır.",
  271. "pin.pukRequired":"PIN'iniz kilitlenmiştir. SIM kartınız için yeni bir PIN kodu ayarlamak için PUK'u girin.",
  272. "pin.block":"Yanlış PUK. SIM kart daimi olarak kilitlendi.",
  273. "pin.error":"SIM kartı bulunamıyor. Kartı doğru bir biçimde taktığınızdan emin olun.",
  274. "pin.description":"Bu sayfada PIN durumunu kontrol edebilir ve PIN'ı yönetebilirsiniz.",
  275. "pin.op.enable":"PIN'i etkinleÅŸtir",
  276. "pin.op.save":"PIN'i bu aygıta kaydet",
  277. "pin.op.disable":"PIN'i devre dışı bırak",
  278. "pin.op.modify":"PIN üzerinde değişiklik yap",
  279. "pin.op.delete":"Bu aygıtta saklanan PIN'i sil",
  280. "pin.PINCode":"PIN",
  281. "pin.PUKCode":"PUK",
  282. "pin.NewPIN":"Yeni PIN",
  283. "pin.PINConfirm":"PIN'i onayla",
  284. "pin.RemainTimes":"Kalan yeniden deneme sayısı",
  285. "pin.pin_err":"Hatalı PIN.",
  286. "pin.pinopter_err":"PIN işlemi başarısız.",
  287. "pin.puk_err":"Yanlış PUK.",
  288. "pin.pwd_err":"Şifreler eşleşmelidir.",
  289. "backup.PinOper":"Veri kartını kullanmak için PIN'i girin.",
  290. "backup.Help":"Sabit bir kablodan internete erişemezsiniz. Veri kartını kullanın.",
  291. "backup.Mode":"Veri kartı internet modu",
  292. "backup.Mode_Disable":"Yedekleme Yok",
  293. "backup.Mode_Backup_Confirm":"Manüel yedekleme",
  294. "backup.Mode_Backup_Auto":"Otomatik yedekleme",
  295. "backup.Idletime":"Gecikme zamanını değiştirin",
  296. "backup.IdletimeNum_err":"Bu değer 15'in katı olmalıdır.",
  297. "HybridRouteBalance.Bonding":"Hibrid baÄŸlanma"
  298. });
  299. var MACRO_NO_SIM_CARD       = 255;  
  300. var MACRO_PIN_DISABLE       = 258;  
  301. var MACRO_PIN_VALIDATE      = 259;  
  302. var MACRO_PIN_REQ           = 260;  
  303. var MACRO_PUK_REQ           = 261;  
  304. var SIM_CARD_BLOCK          = 263;  
  305. var SIM_CARD_ERROR          = 264;  
  306. var DATACARD_INIT_START     = 289;  
  307. function pageload(controller){
  308. if (controller) {
  309. controller.load();
  310. return;
  311. }
  312. }
  313. function callback_verify_pin(value) {
  314. var curState = Atp.PinController.content.get("SimState");
  315. Em.Logger.log(curState);
  316. if ((!((MACRO_PIN_VALIDATE == curState) &&
  317. (1 == Atp.PinController.get("action")))) &&
  318. (MACRO_PUK_REQ != curState)) {
  319. return null;
  320. }
  321. Em.Logger.log("Check now ...");
  322. var errStruct;
  323. errStruct = AtpValidator.validate_field(Atp.PinController.get("newpin"), "required", "pin.NewPIN");
  324. if (errStruct) {
  325. return errStruct;
  326. }
  327. errStruct = null;
  328. errStruct = AtpValidator.validate_field(Atp.PinController.get("newpinconfirm"), "required", "pin.PINConfirm");
  329. if (errStruct) {
  330. return errStruct;
  331. }
  332. if (Atp.PinController.get("newpin") == value) {
  333. return null;
  334. }
  335. var errStruct = utilCreateDftErrStruct();
  336. errStruct.resId = "pin.PINConfirm";
  337. errStruct.errId = "pin.pwd_err";
  338. errStruct['delete'] = false;
  339. return errStruct;
  340. }
  341. Atp.PinModel = Em.Object.extend({
  342. infoStr: function() {
  343. var status = this.get("SimState");
  344. switch (status) {
  345. case MACRO_NO_SIM_CARD:
  346. return Em.I18n.t("pin.NoDatacard");
  347. case SIM_CARD_BLOCK:
  348. return Em.I18n.t("pin.block");
  349. case SIM_CARD_ERROR:
  350. return Em.I18n.t("pin.error");
  351. case DATACARD_INIT_START:
  352. return Em.I18n.t("pin.initing");
  353. case MACRO_PIN_DISABLE:
  354. return Em.I18n.t("pin.Disabled");
  355. case MACRO_PIN_VALIDATE:
  356. return Em.I18n.t("pin.Ready");
  357. case MACRO_PIN_REQ:
  358. return Em.I18n.t("pin.pinRequired");
  359. case MACRO_PUK_REQ:
  360. return Em.I18n.t("pin.pukRequired");
  361. default:
  362. return "";
  363. }
  364. }.property("SimState"),
  365. pinContentIsReady:function(){
  366. if( typeof this.get("SimState") != "undefined"){
  367. return true;
  368. }
  369. return false;
  370. }.property("SimState"),
  371. datacardConnected: function() {
  372. if (MACRO_NO_SIM_CARD == this.get("SimState")) {
  373. return false;
  374. }
  375. return true;
  376. }.property("SimState"),
  377. datacardReady: function () {
  378. if ((MACRO_PIN_VALIDATE == this.get("SimState")) ||
  379. (MACRO_PIN_DISABLE == this.get("SimState"))) {
  380. return true;
  381. }
  382. return false;
  383. }.property("SimState"),
  384. pukRequired: function () {
  385. if (MACRO_PUK_REQ == this.get("SimState")) {
  386. return true;
  387. }
  388. return false;
  389. }.property("SimState"),
  390. showenablePin: function () {
  391. if (MACRO_PIN_DISABLE == this.get("SimState"))
  392. {
  393. return true;
  394. }
  395. return false;
  396. }.property("SimState"),
  397. curIsSavePin: function () {
  398. if (0 == this.get("PinSaveState"))
  399. {
  400. return false;
  401. }
  402. return true;
  403. }.property("PinSaveState"),
  404. showPin: function () {
  405. if ((MACRO_PIN_VALIDATE == this.get("SimState")) ||
  406. (MACRO_PIN_DISABLE == this.get("SimState")) ||
  407. (MACRO_PIN_REQ == this.get("SimState"))) {
  408. return true;
  409. }
  410. return false;
  411. }.property("SimState"),
  412. showSubmit: function () {
  413. if (this.get("showPin") || (MACRO_PUK_REQ == this.get("SimState"))) {
  414. return true;
  415. }
  416. return false;
  417. }.property("SimState")
  418. });
  419. Atp.PinController = Atp.SingleObjController.create({
  420. objName: 'ntwk/pin',
  421. contentType:"application/json;charset=UTF-8;enc",
  422. modelClass: Atp.PinModel,
  423. action: 0,
  424. pin: "",
  425. puk: "",
  426. newpin: "",
  427. newpinconfirm: "",
  428. checkProc: function () {
  429. var errStruct = null;
  430. utilRemoveErrors(this);
  431. if (MACRO_PUK_REQ == this.content.get("SimState")) {
  432. errStruct = AtpValidator.validate_field(this.get("puk"), "required", "pin.PUKCode");
  433. }
  434. if (errStruct) {
  435. errStruct['delete'] = true;
  436. utilErrStructPush(this, errStruct);
  437. }
  438. errStruct = null;
  439. if (this.content.get("showPin")) {
  440. errStruct = AtpValidator.validate_field(this.get("pin"), "required", "pin.PINCode");
  441. }
  442. if (errStruct) {
  443. errStruct['delete'] = true;
  444. utilErrStructPush(this, errStruct);
  445. }
  446. errStruct = callback_verify_pin(this.get("newpinconfirm"));
  447. if (errStruct) {
  448. errStruct['delete'] = true;
  449. utilErrStructPush(this, errStruct);
  450. }
  451. utilErrInfoUpdate(this);
  452. },
  453. getActionName: function() {
  454. var curState = this.content.get("SimState");
  455. if (MACRO_PUK_REQ == curState) {
  456. return "puk";
  457. } else if (MACRO_PIN_REQ == curState) {
  458. return "validate";
  459. } else if (MACRO_PIN_DISABLE == curState) {
  460. return "enable";
  461. }
  462. else if (MACRO_PIN_VALIDATE != curState) {
  463. return "";
  464. }
  465. if (0 == this.get("action")) {
  466. return "disable";
  467. } else if (1 == this.get("action")) {
  468. return "modify";
  469. } else if (2 == this.get("action")) {
  470. if( 0 == this.content.get("PinSaveState")){
  471. return "save";
  472. }else{
  473. return "delete";
  474. }
  475. }
  476. return "delete";
  477. },
  478. createSubmitData: function() {
  479. var data = {};
  480. data["action"] = this.getActionName();
  481. data["PINCode"] = this.get("pin");
  482. data["PUKCode"] = this.get("puk");
  483. data["newPIN"] = this.get("newpin");
  484. return utilGetJson(Em.Object.create(data));
  485. },
  486. finishProc: function(result) {
  487. Em.Logger.log("Finish proc now ...");
  488. if (0 != result.errcode) {
  489. pageload(this);
  490. } else {
  491. this.set("pin", "");
  492. this.set("puk", "");
  493. this.set("newpin", "");
  494. this.set("newpinconfirm", "");
  495. }
  496. },
  497. showChangeContent: function() {
  498. if (MACRO_PIN_VALIDATE == this.content.get("SimState")) {
  499. if (1 == this.get("action")) {
  500. return true;
  501. }
  502. return false;
  503. }
  504. if (MACRO_PUK_REQ == this.content.get("SimState")) {
  505. return true;
  506. }
  507. return false;
  508. }.property("content.SimState", "action")
  509. });
  510. Atp.PinOperationRadioButton = Atp.RadioButton.extend ({
  511. group: 'pin_operation'
  512. });
  513. Atp.PinView = Em.View.extend({
  514. controller: Atp.PinController,
  515. contentBinding: "Atp.PinController.content",
  516. template: Em.Handlebars.compile(
  517. '{{view Atp.SuccessView}}\
  518. <div class="form-horizontal width_100p"> \
  519. {{ view Atp.LabelView textType="label" labelID="pin.Status" valueBinding="view.content.infoStr" }} \
  520. {{#if view.content.datacardReady}} \
  521. <div class="control-group">\
  522. <label class="control-label">&nbsp;</label> \
  523. <div class="controls">\
  524. {{#if view.content.showenablePin}}\
  525. {{ view Atp.PinOperationRadioButton titleID="pin.op.enable" option="0" valueBinding="Atp.PinController.action"}} \
  526. {{else}}\
  527. {{ view Atp.PinOperationRadioButton titleID="pin.op.disable" option="0" valueBinding="Atp.PinController.action"}} \
  528. {{ view Atp.PinOperationRadioButton titleID="pin.op.modify" option="1" valueBinding="Atp.PinController.action"}} \
  529. {{#if view.content.curIsSavePin}}\
  530. {{ view Atp.PinOperationRadioButton titleID="pin.op.delete" option="2" valueBinding="Atp.PinController.action"}} \
  531. {{else}}\
  532. {{ view Atp.PinOperationRadioButton titleID="pin.op.save" option="2" valueBinding="Atp.PinController.action"}} \
  533. {{/if}}\
  534. {{/if}}\
  535. </div>\
  536. </div> \
  537. {{/if}} \
  538. {{#if view.content.pukRequired}} \
  539. {{ view Atp.LabelView labelID="pin.PUKCode" rule="is_natural|exact_length[8]" valueBinding="view.controller.puk" }} \
  540. {{/if}} \
  541. {{#if view.content.showPin}} \
  542. {{ view Atp.LabelView labelID="pin.PINCode" rule="is_natural|lenrange[4~8]" valueBinding="view.controller.pin" }} \
  543. {{/if}} \
  544. {{#if view.controller.showChangeContent}} \
  545. {{ view Atp.LabelView labelID="pin.NewPIN" rule="is_natural|lenrange[4~8]" valueBinding="view.controller.newpin" }} \
  546. {{ view Atp.LabelView labelID="pin.PINConfirm" rule="is_natural|lenrange[4~8]|callback_pwdMatch" valueBinding="view.controller.newpinconfirm" }} \
  547. {{/if}} \
  548. {{#if view.content.showSubmit}} \
  549. {{ view Atp.LabelView textType="label" labelID="pin.RemainTimes" valueBinding="view.content.RemainTime" }} \
  550. {{ view Atp.MySubmitButton}}\
  551. {{/if}} \
  552. </div>')
  553. });
  554. Atp.WanBackup = Em.Object.extend({
  555. showIdleTime: function() {
  556. if ("Disable" == this.get("Mode")) {
  557. return false;
  558. }
  559. return true;
  560. }.property("Mode")
  561. });
  562. Atp.WanbackupController = Atp.SingleObjController.create({
  563. modelClass: Atp.WanBackup,
  564. objName: 'ntwk/wanbackup',
  565. checkProc: function() {
  566. utilRemoveErrors(Atp.WanbackupController);
  567. if (!((Atp.WanbackupController.content.get("Idletime"))%15)) {
  568. return;
  569. }
  570. var errStruct = utilCreateDftErrStruct();
  571. errStruct['delete'] = true;
  572. errStruct.resId = "backup.Idletime";
  573. errStruct.errId = "backup.IdletimeNum_err";
  574. utilErrStructPush(Atp.WanbackupController, errStruct);
  575. this.showError();
  576. },
  577. postMoreWan: function(callback){
  578. var csrf_obj = utilGetCsrf();
  579. var post_data = {
  580. "csrf": csrf_obj,
  581. "data": this.createSubmitData()
  582. };
  583. var self = this;
  584. this.post($.toJSON(post_data),
  585. function (result) {
  586. if (0 != result.errcode) {
  587. utilStopSubmitDialog();
  588. utilMarkErrorFields(self, result);
  589. } else {
  590. if (callback){
  591. callback();
  592. }
  593. }
  594. });
  595. },
  596. postData: function() {
  597. utilStartSubmitDialog();
  598. var csrf_obj = utilGetCsrf();
  599. var post_data = {
  600. "csrf": csrf_obj,
  601. "data": this.createSubmitData()
  602. };
  603. var self = this;
  604. this.post($.toJSON(post_data),
  605. function (result) {
  606. if (0 != result.errcode) {
  607. utilStopSubmitDialog();
  608. utilMarkErrorFields(self, result);
  609. } else {
  610. Atp.WanController.submitDftWan(false, function () {
  611. pageload();
  612. Atp.WanController.set("saved", true);
  613. utilStopSubmitDialog();
  614. });
  615. }
  616. });
  617. }
  618. });
  619. Atp.backupTypeRadioButton = Atp.RadioButton.extend ({
  620. group: 'backup_type'
  621. });
  622. Atp.WanbackupView = Em.View.extend({
  623. controller: Atp.WanbackupController,
  624. classNames:'clearboth',
  625. contentBinding: "Atp.WanbackupController.content",
  626. change: function() {
  627. Atp.WanbackupController.checkProc();
  628. },
  629. template: Em.Handlebars.compile(
  630. '{{#if Atp.WanController.activeItem.isDatacardMode}} \
  631. {{view Atp.PinView}} \
  632. <br> \
  633. {{view Atp.SuccessView}}\
  634. <div class="form-horizontal width_100p clearboth"> \
  635. <div class="control-group">\
  636. <label class="control-label third_menu_below_config_font">\
  637. {{t backup.Mode}}: \
  638. </label> \
  639. {{#if view.content.BondingEnable}}\
  640. <div class="controls paddingtop_8 wordbreak">{{t HybridRouteBalance.Bonding}}</div> \
  641. {{else}}\
  642. <div class="controls">\
  643. {{ view Atp.backupTypeRadioButton titleID="backup.Mode_Backup_Confirm" option="Backup_Confirm" valueBinding="view.content.Mode"}} \
  644. {{ view Atp.backupTypeRadioButton titleID="backup.Mode_Backup_Auto" option="Backup_Auto" valueBinding="view.content.Mode"}} \
  645. </div>\
  646. {{/if}}\
  647. </div>\
  648. {{#if view.content.showIdleTime}}\
  649. {{ view Atp.LabelView labelID="backup.Idletime" valueBinding="view.content.Idletime" }} \
  650. {{/if}} \
  651. </div>\
  652. {{/if}}')
  653. });
  654. Atp.WizardRedirectView = Em.View.extend({
  655. controller: Atp.WanbackupController,
  656. classNames:'clearboth',
  657. contentBinding: "Atp.WanbackupController.content",
  658. template: Em.Handlebars.compile(
  659. '<div class="form-horizontal"> \
  660. <div class="control-group">\
  661. <label class="control-label third_menu_below_config_font">\
  662. {{t backup.Mode}}: \
  663. </label> \
  664. <div class="controls">\
  665. {{ view Atp.backupTypeRadioButton titleID="backup.Mode_Disable" option="Disable" valueBinding="view.content.Mode"}} \
  666. {{ view Atp.backupTypeRadioButton titleID="backup.Mode_Backup_Confirm" option="Backup_Confirm" valueBinding="view.content.Mode"}} \
  667. {{ view Atp.backupTypeRadioButton titleID="backup.Mode_Backup_Auto" option="Backup_Auto" valueBinding="view.content.Mode"}} \
  668. </div>\
  669. </div>\
  670. {{#if view.content.showIdleTime}}\
  671. {{ view Atp.LabelView labelID="backup.Idletime" valueBinding="view.content.Idletime" }} \
  672. {{/if}} \
  673. </div>')
  674. });
  675. Atp.WizardPinView = Em.View.extend({
  676. controller: Atp.PinController,
  677. contentBinding: "Atp.PinController.content",
  678. template: Em.Handlebars.compile(
  679. '<div class="form-horizontal"> \
  680. {{#if view.content.datacardReady}} \
  681. <img {{bindAttr src="Atp.WanController.umtsWan.iconPath"}}></img>{{Atp.WanController.umtsWan.connStatusText}}<br/>\
  682. <img {{bindAttr src="Atp.WanController.defaultWan.iconPath"}}>{{Atp.WanController.defaultWan.connStatusText}}</img>\
  683. <button class="atp_button" {{action "dialupUmts" target="Atp.WanController"}}>{{Atp.WanController.umtsWan.connActionText}}</button> \
  684. {{else}} \
  685. {{view Atp.SuccessView}}\
  686. {{ t backup.PinOper}} \
  687. {{#if view.content.pukRequired}} \
  688. {{ view Atp.LabelView labelID="pin.PUKCode" rule="is_natural|exact_length[8]" valueBinding="view.controller.puk" }} \
  689. {{/if}} \
  690. {{#if view.content.showPin}} \
  691. {{ view Atp.LabelView labelID="pin.PINCode" rule="is_natural|lenrange[4~8]" valueBinding="view.controller.pin" }} \
  692. {{/if}} \
  693. {{#if view.controller.showChangeContent}} \
  694. {{ view Atp.LabelView labelID="pin.NewPIN" rule="is_natural|lenrange[4~8]" valueBinding="view.controller.newpin" }} \
  695. {{ view Atp.LabelView labelID="pin.PINConfirm" rule="is_natural|lenrange[4~8]|callback_pwdMatch" valueBinding="view.controller.newpinconfirm" }} \
  696. {{/if}} \
  697. </div> \
  698. {{#if view.content.showSubmit}} \
  699. {{ view Atp.LabelView textType="label" labelID="pin.RemainTimes" valueBinding="view.content.RemainTime" }} \
  700. {{ view Atp.MySubmitButton}}\
  701. {{/if}} \
  702. <br/>\
  703. {{/if}}')
  704. });
  705. var MAX_WAN_PER_LINK = 4;
  706. var MAX_VLAN_LINKS   = 8;
  707. var MAX_PVC_NUM      = 4;
  708. var MAX_TOTAL_WAN = 8;
  709. var MAX_PPP_PASSWORD_LENGTH = 64;
  710. var wanppppasswordrule = "";
  711. function callback_check_mss_value(value) {
  712. var intVal = parseInt(value);
  713. var errStruct = utilCreateDftErrStruct();
  714. errStruct.resId = "wan_internal_edit_view_wan_MSS";
  715. errStruct.errId = "wan.MSS_err";
  716. errStruct['delete'] = false;
  717. var range = "100~1452";
  718. errStruct.arg1 = "100~1452";
  719. if ("IP_Routed" == Atp.WanController.activeItem.get("ConnectionType")) {
  720. range = "100~1460";
  721. errStruct.arg1 = "100~1460";
  722. } else if ("PPP_Routed" != Atp.WanController.activeItem.get("ConnectionType")) {
  723. return null;
  724. }
  725. if (Atp.WanController.activeItem.get("IPv6Enable")) {
  726. if ("100~1452" == range) {
  727. range = "1240~1452";
  728. errStruct.arg1 = "1240~1452";
  729. }
  730. else if ("100~1460" == range) {
  731. range = "1240~1460";
  732. errStruct.arg1 = "1240~1460";
  733. }
  734. }
  735. if(!AtpValidator._hooks.integer(value)){
  736. return errStruct;
  737. }
  738. if (0 == intVal) {
  739. return null;
  740. }
  741. if (!AtpValidator._hooks.range(value, range)) {
  742. return errStruct;
  743. }
  744. return null;
  745. }
  746. function callback_check_idletime_value(value) {
  747. if ("OnDemand" == Atp.WanController.activeItem.get("PPPTrigger")) {
  748. if(/^(\+|-)?\d+$/.test(value) == false){
  749. var errStruct = utilCreateDftErrStruct();
  750. errStruct.resId = "wan.PPPIdletimeOther";
  751. errStruct['delete'] = true;
  752. errStruct.resId = errStruct.resId.replace(/\./g, "_");
  753. errStruct.errId = "Menu.integer_err";
  754. return errStruct;
  755. }
  756. if ( (parseInt(value) < 30) || (parseInt(value) > 31536000) ){
  757. var errStruct = utilCreateDftErrStruct();
  758. errStruct.resId = "wan.PPPIdletimeOther";
  759. errStruct['delete'] = true;
  760. errStruct.resId = errStruct.resId.replace(/\./g, "_");
  761. errStruct.errId = "Menu.range_err";
  762. errStruct.arg1 = "30~31536000";
  763. return errStruct;
  764. }
  765. }
  766. return null;
  767. }
  768. function check_mac_addr(value, errStruct){
  769. var c = '';
  770. var i = 0, j = 0;
  771. var num = 0;
  772. if ( value == '00:00:00:00:00:00' )
  773. {
  774. return errStruct;
  775. }
  776. addrParts = value.split(':');
  777. if ( addrParts.length != 6 ) return errStruct;
  778. for (i = 0; i < 6; i++) {
  779. if ( addrParts[i] == '' )
  780. return errStruct;
  781. if ( addrParts[i].length != 2)
  782. {
  783. return errStruct;
  784. }
  785. for ( j = 0; j < addrParts[i].length; j++ ) {
  786. c = addrParts[i].toLowerCase().charAt(j);
  787. if ((c >= '0' && c <= '9') ||
  788. (c >= 'a' && c <= 'f'))
  789. continue;
  790. else
  791. return errStruct;
  792. }
  793. if (i == 0){
  794. c = addrParts[i].toLowerCase().charAt(1);
  795. Em.Logger.log("first two letter "+ c);
  796. if (c > 'a')
  797. {
  798. if ((c == 'b') || (c == 'd') || (c == 'f'))
  799. {
  800. num = 1;
  801. }
  802. else
  803. {
  804. num = 0;
  805. }
  806. }
  807. else if (c == 'a')
  808. {
  809. num = 1;
  810. }
  811. else
  812. {
  813. num = c - '0';
  814. }
  815. Em.Logger.log("num "+ num);
  816. if (0 != num%2)
  817. {
  818. return errStruct;
  819. }
  820. }
  821. }
  822. return null;
  823. }
  824. function callback_check_macclone_value(value) {
  825. var errStruct = utilCreateDftErrStruct();
  826. errStruct.resId = "wan.CloneMacaddr";
  827. errStruct.errId = "wan.CloneMacaddr_err";
  828. errStruct['delete'] = false;
  829. Em.Logger.log("callback_check_macclone_value"+ value);
  830. return check_mac_addr(value, errStruct);
  831. }
  832. function callback_check_dhcp_restriction_value(value) {
  833. var errStruct = utilCreateDftErrStruct();
  834. errStruct.resId = "wan.BindDhcpsMacAddr";
  835. errStruct.errId = "wan.BindDhcpsMacAddr_err";
  836. errStruct['delete'] = false;
  837. Em.Logger.log("callback_check_dhcp_restriction_value"+ value);
  838. return check_mac_addr(value, errStruct);
  839. }
  840. function isInteger(value)
  841. {
  842. if (/^(\+|-)?\d+$/.test(value))
  843. {
  844. return true;
  845. }
  846. else
  847. {
  848. return false;
  849. }
  850. }
  851. function isValidIpAddress(address) {
  852. var i = 0;
  853. if ( address == '0.0.0.0' ||address == '127.0.0.1'||
  854. address == '255.255.255.255' )
  855. return false;
  856. var addrParts = address.split('.');
  857. if ( addrParts.length != 4 ) return false;
  858. for (i = 0; i < 4; i++) {
  859. if (isNaN(addrParts[i]) || addrParts[i] ==""
  860. || addrParts[i].charAt(0) == '+' ||  addrParts[i].charAt(0) == '-'
  861. || (addrParts[i].charAt(0) == '0' && addrParts[i].length > 1))
  862. return false;
  863. if (addrParts[i].length > 3 || addrParts[i].length < 1)
  864. {
  865. return false;
  866. }
  867. if (!isInteger(addrParts[i]) || addrParts[i] < 0)
  868. {
  869. return false;
  870. }
  871. num = parseInt(addrParts[i]);
  872. if (i == 0 && num == 0)
  873. {
  874. return false;
  875. }
  876. if ( num < 0 || num > 255 )
  877. return false;
  878. }
  879. return true;
  880. }
  881. function getLeftMostZeroBitPos(num)
  882. {
  883. var i = 0;
  884. var numArr = [128, 64, 32, 16, 8, 4, 2, 1];
  885. for ( i = 0; i < numArr.length; i++ )
  886. if ( (num & numArr[i]) == 0 )
  887. return i;
  888. return numArr.length;
  889. }
  890. function getRightMostOneBitPos(num) {
  891. var i = 0;
  892. var numArr = [1, 2, 4, 8, 16, 32, 64, 128];
  893. for ( i = 0; i < numArr.length; i++ )
  894. if ( ((num & numArr[i]) >> i) == 1 )
  895. return (numArr.length - i - 1);
  896. return -1;
  897. }
  898. function isValidSubnetMask(mask) {
  899. var i = 0, num = 0;
  900. var zeroBitPos = 0, oneBitPos = 0;
  901. var zeroBitExisted = false;
  902. if (mask == '0.0.0.0' || mask == '255.255.255.255')
  903. return false;
  904. var maskParts = mask.split('.');
  905. if ( maskParts.length != 4 ) return false;
  906. for (i = 0; i < 4; i++) {
  907. if ( isNaN(maskParts[i]) == true || maskParts[i] == ""
  908. || maskParts[i].charAt(0) == '+' ||  maskParts[i].charAt(0) == '-'
  909. || (maskParts[i].charAt(0) == '0'
  910. && maskParts[i].length > 1))
  911. return false;
  912. if (!isInteger(maskParts[i]) || maskParts[i] < 0)
  913. {
  914. return false;
  915. }
  916. num = parseInt(maskParts[i]);
  917. if ( num < 0 || num > 255 )
  918. return false;
  919. if ( zeroBitExisted == true && num != 0 )
  920. return false;
  921. zeroBitPos = getLeftMostZeroBitPos(num);
  922. oneBitPos = getRightMostOneBitPos(num);
  923. if ( zeroBitPos < oneBitPos )
  924. return false;
  925. if ( zeroBitPos < 8 )
  926. zeroBitExisted = true;
  927. }
  928. return true;
  929. }
  930. function IpAddress2DecNum(address)
  931. {
  932. if (isValidIpAddress(address) == false)
  933. {
  934. return -1;
  935. }
  936. var addrParts = address.split('.');
  937. var num = 0;
  938. for (i = 0; i < 4; i++)
  939. {
  940. num += parseInt(addrParts[i]) * Math.pow(256, 3 - i);
  941. }
  942. return num;
  943. }
  944. function isBroadcastIpAddress(address)
  945. {
  946. if (isValidIpAddress(address) == false)
  947. {
  948. return false;
  949. }
  950. var addrParts = address.split('.');
  951. if (addrParts[3] == '255')
  952. {
  953. return true;
  954. }
  955. return false;
  956. }
  957. function isBroadcastIp(ipAddress, subnetMask)
  958. {
  959. var maskLenNum = 0;
  960. tmpMask = subnetMask.split('.');
  961. tmpIp = ipAddress.split('.');
  962. if((parseInt(tmpIp[0]) > 223) || ( 127 == parseInt(tmpIp[0])))
  963. {
  964. return true;
  965. }
  966. for(maskLenNum = 0; maskLenNum < 4; maskLenNum++)
  967. {
  968. if(parseInt(tmpMask[maskLenNum]) < 255)
  969. break;
  970. }
  971. tmpNum0 = parseInt(tmpIp[maskLenNum]);
  972. tmpNum1 = 255 - parseInt(tmpMask[maskLenNum]);
  973. tmpNum2 = tmpNum0 & tmpNum1;
  974. if((tmpNum2 != 0) && (tmpNum2 != tmpNum1))
  975. {
  976. return false;
  977. }
  978. if(maskLenNum == 3)
  979. {
  980. return true;
  981. }
  982. else if(maskLenNum == 2)
  983. {
  984. if(((tmpIp[3] == 0)&&(tmpNum2 == 0))||
  985. ((tmpIp[3] == 255)&&(tmpNum2 == tmpNum1)))
  986. {
  987. return true;
  988. }
  989. }
  990. else if(maskLenNum == 1)
  991. {
  992. if(((tmpNum2 == 0)&&(tmpIp[3] == 0)&&(tmpIp[2] == 0)) ||
  993. ((tmpNum2 == tmpNum1)&&(tmpIp[3] == 255)&&(tmpIp[2] == 255)))
  994. {
  995. return true;
  996. }
  997. }
  998. else if(maskLenNum == 0)
  999. {
  1000. if(((tmpNum2 == 0)&&(tmpIp[3] == 0)&&(tmpIp[2] == 0)&&(tmpIp[1] == 0)) ||
  1001. ((tmpNum2 == tmpNum1)&&(tmpIp[3] == 255)&&(tmpIp[2] == 255) &&(tmpIp[1] == 255)))
  1002. {
  1003. return true;
  1004. }
  1005. }
  1006. return false;
  1007. }
  1008. function isHostIpWithSubnetMask(address, subnet)
  1009. {
  1010. if (isValidIpAddress(address) == false)
  1011. {
  1012. return false;
  1013. }
  1014. if (isValidSubnetMask(subnet) == false)
  1015. {
  1016. return false;
  1017. }
  1018. var addr = IpAddress2DecNum(address);
  1019. var mask = IpAddress2DecNum(subnet);
  1020. if (0 == (addr & (~mask)))
  1021. {
  1022. return false;
  1023. }
  1024. if (isBroadcastIp(address,subnet) == true)
  1025. {
  1026. return false;
  1027. }
  1028. return true;
  1029. }
  1030. function isAbcIpAddress(address)
  1031. {
  1032. if (isValidIpAddress(address) == false)
  1033. {
  1034. return false;
  1035. }
  1036. var addrParts = address.split('.');
  1037. var num = 0;
  1038. num = parseInt(addrParts[0]);
  1039. if (num < 1 || num >= 224 || num == 127)
  1040. {
  1041. return false;
  1042. }
  1043. num = parseInt(addrParts[3]);
  1044. if (num == 255)
  1045. {
  1046. return false;
  1047. }
  1048. return true;
  1049. }
  1050. function callback_check_ipv4static_value(curwan) {
  1051. var errStruct = utilCreateDftErrStruct();
  1052. if (!isValidIpAddress(curwan.get('IPv4Addr')))
  1053. {
  1054. errStruct.resId = "wan.IPv4Addr";
  1055. errStruct.errId = "wan.IPv4Addr_err";
  1056. return errStruct;
  1057. }
  1058. if (!isValidSubnetMask(curwan.get('IPv4Mask')))
  1059. {
  1060. errStruct.resId = "wan.IPv4Mask";
  1061. errStruct.errId = "wan.IPv4Mask_err";
  1062. return errStruct;
  1063. }
  1064. if (!isHostIpWithSubnetMask(curwan.get('IPv4Addr'), curwan.get('IPv4Mask')))
  1065. {
  1066. errStruct.resId = "wan.IPv4Addr";
  1067. errStruct.errId = "wan.IPv4Addr_err";
  1068. return errStruct;
  1069. }
  1070. if (!isAbcIpAddress(curwan.get('IPv4Gateway')))
  1071. {
  1072. errStruct.resId = "wan.IPv4Gateway";
  1073. errStruct.errId = "wan.IPv4Gateway_err";
  1074. return errStruct;
  1075. }
  1076. if (!isAbcIpAddress(curwan.get('IPv4PriDns')))
  1077. {
  1078. errStruct.resId = "wan.IPv4PriDns";
  1079. errStruct.errId = "wan.IPv4PriDns_err";
  1080. return errStruct;
  1081. }
  1082. if (curwan.get('IPv4SecDns') != '' && !isAbcIpAddress(curwan.get('IPv4SecDns')))
  1083. {
  1084. errStruct.resId = "wan.IPv4SecDns";
  1085. errStruct.errId = "wan.IPv4SecDns_err";
  1086. return errStruct;
  1087. }
  1088. return null;
  1089. }
  1090. function callback_is_apn(value)
  1091. {
  1092. var errStruct = utilCreateDftErrStruct();
  1093. errStruct.resId = "internet_profile_view_data_edit_wan_APN";
  1094. errStruct.errId = "umts.apn_Char_Err";
  1095. errStruct['delete'] = false;
  1096. var reg = /^(\s|!|#|\$|\(|\)|\*|-|\.|\/|[0-9A-Za-z]|=|@|\[|\]|\^|_|`|\{|\v|\}|~|[\x7F])*$/;
  1097. if(!reg.exec(value))
  1098. {
  1099. return errStruct;
  1100. }
  1101. return null;
  1102. }
  1103. function callback_is_dial_number(value)
  1104. {
  1105. var errStruct = utilCreateDftErrStruct();
  1106. errStruct.resId = "internet_profile_view_data_edit_wan_DialNum";
  1107. errStruct.errId = "wan.DialNum_err";
  1108. errStruct['delete'] = false;
  1109. var re=/^([0-9\*#\+WP])*$/
  1110. if (value.search(re)==-1)
  1111. {
  1112. return errStruct;
  1113. }
  1114. return null;
  1115. }
  1116. function callback_is_username(value) {
  1117. var errStruct = utilCreateDftErrStruct();
  1118. errStruct.resId = "internet_profile_view_data_edit_wan_Username";
  1119. errStruct.errId = "wan.Username_datacard_err";
  1120. errStruct['delete'] = false;
  1121. var patrn=/^(\s|!|#|\$|\(|\)|\*|-|\.|\/|[0-9A-Za-z]|=|@|\[|\]|\^|_|`|\{|\v|\}|~|[\x7F])*$/;
  1122. if(!patrn.exec(value))
  1123. {
  1124. return errStruct;
  1125. }
  1126. return null;
  1127. }
  1128. function callback_check_ppp_password_value_datacard(value) {
  1129. var errStruct = utilCreateDftErrStruct();
  1130. errStruct.resId = "internet_profile_view_data_edit_wan_Password";
  1131. errStruct.errId = "wan.Password_datacard_err";
  1132. errStruct['delete'] = false;
  1133. needRestorePassword = false;
  1134. var patrn=/^(\s|!|#|\$|\(|\)|\*|-|\.|\/|[0-9A-Za-z]|=|@|\[|\]|\^|_|`|\{|\v|\}|~|[\x7F])*$/;
  1135. if(!patrn.exec(value))
  1136. {
  1137. return errStruct;
  1138. }
  1139. return null;
  1140. }
  1141. var needRestorePassword = false;
  1142. function password_focus_proc() {
  1143. needRestorePassword = false;
  1144. if (!Atp.WanController || !Atp.WanController.activeItem) {
  1145. return;
  1146. }
  1147. if ("@1GV)Z+!" == Atp.WanController.activeItem.get("Password")) {
  1148. Atp.WanController.activeItem.set("Password", "");
  1149. needRestorePassword = true;
  1150. }
  1151. }
  1152. function password_focusout_proc() {
  1153. if (!Atp.WanController || !Atp.WanController.activeItem) {
  1154. return;
  1155. }
  1156. if (needRestorePassword && ("" == Atp.WanController.activeItem.get("Password"))) {
  1157. Atp.WanController.activeItem.set("Password", "@1GV)Z+!");
  1158. }
  1159. }
  1160. function callback_check_ppp_password_value(value) {
  1161. var intVal = parseInt(value);
  1162. var errStruct = utilCreateDftErrStruct();
  1163. errStruct.resId = "internet_profile_view_data_edit_wan_Password";
  1164. errStruct.errId = "wan.Password_err";
  1165. errStruct['delete'] = false;
  1166. needRestorePassword = false;
  1167. if (value.length > MAX_PPP_PASSWORD_LENGTH) {
  1168. errStruct.errId = "Menu.lenrange_err";
  1169. errStruct.arg1 = "0~64";
  1170. return errStruct;
  1171. }
  1172. if(wanppppasswordrule == ""){
  1173. var patrn=/^[A-Za-z0-9~!@#\$%\^&\*\(\)\-_\+=\{\}\[\]\?]{0,64}$/;
  1174. if(!patrn.exec(value))
  1175. {
  1176. return errStruct;
  1177. }
  1178. }
  1179. return null;
  1180. }
  1181. Atp.AccessTypeController = Atp.SelectController.create({
  1182. prefixName: 'wan.AccessType',
  1183. values: [
  1184. , "Ethernet"
  1185. , "UMTS"
  1186. ]
  1187. });
  1188. function WanBackupData() {
  1189. Atp.WanController.content.forEach(function (wanData){
  1190. wanData.set("originPPPTrigger", wanData.get("PPPTrigger"));
  1191. wanData.set("prevConnectionType", wanData.get("ConnectionType"));
  1192. wanData.set("originConnectionType", wanData.get("ConnectionType"));
  1193. });
  1194. }
  1195. function WanConnTypeChangeProc(wanItem) {
  1196. if (!wanItem) {
  1197. return;
  1198. }
  1199. var curConnType = wanItem.get("ConnectionType");
  1200. if ("Bridged" == wanItem.get("prevConnectionType")) {
  1201. if ("0" == wanItem.get("NATType")) {
  1202. wanItem.set("NATType", "1");
  1203. selectControllerInit(wanItem, "NATType", Atp.NatTypeController);
  1204. }
  1205. }
  1206. wanItem.set("prevConnectionType", curConnType);
  1207. }
  1208. Atp.ConnectionTypeController = Atp.SelectController.create({
  1209. prefixName: 'wan.ConnectionType',
  1210. values: [ "PPP_Routed", "IP_Routed", "Bridged"
  1211. ]
  1212. });
  1213. Atp.NatTypeController = Atp.SelectController.create({
  1214. prefixName: 'wan.NATType',
  1215. values: [ "1",
  1216. "2",
  1217. "0"]
  1218. });
  1219. Atp.UMTSNetTypeController = Atp.SelectController.create({
  1220. prefixName: 'wan.NetType',
  1221. values: [ "Auto", "3G_preferred", "3G_only", "2G_preferred", "2G_only"]
  1222. });
  1223. Atp.IPVersionController = Atp.SelectController.create({
  1224. prefixName: 'wan.IPVer',
  1225. values: [ "IPv4", "IPv6", "Both"]
  1226. });
  1227. Atp.IPv4AddrTypeController = Atp.SelectController.create({
  1228. prefixName: 'wan.IPv4AddrType',
  1229. values: [ "DHCP", "Static"]
  1230. });
  1231. Atp.IPv6AddrTypeController = Atp.SelectController.create({
  1232. prefixName: 'wan.IPv6AddrType',
  1233. values: [ "SLAAC", "Static"]
  1234. });
  1235. Atp.PPPAuthModeController = Atp.SelectController.create({
  1236. prefixName: 'wan.PPPAuthMode',
  1237. values: [ "AUTO", "PAP", "CHAP"]
  1238. });
  1239. Atp.PPPDialIpModeController = Atp.SelectController.create({
  1240. prefixName: 'wan.PPPDialIpMode',
  1241. values: [ "dynamic", "static"]
  1242. });
  1243. Atp.PPPDialModeController = Atp.SelectController.create({
  1244. prefixName: 'wan.PPPTrigger',
  1245. values: [ "AlwaysOn", "Manual", "OnDemand"]
  1246. });
  1247. Atp.AutoDisconnectTimeController = Atp.SelectController.create ({
  1248. prefixName: 'wan.PPPIdletime',
  1249. values: [ "60", "120", "180", "300", "600"],
  1250. otherValue: "",
  1251. isManual: false,
  1252. init: function() {
  1253. this._super();
  1254. this.content.pushObject(Em.Object.create({"name": Em.I18n.t("wan.SelectOther"), "value":"Other"}));
  1255. },
  1256. selectedValue: function(key, value) {
  1257. var self = this;
  1258. if (1 == arguments.length) {
  1259. if (Atp.WanController.activeItem) {
  1260. var selected = self.findProperty('value', Atp.WanController.activeItem.get('PPPIdletime'));
  1261. if (selected && (!self.get('isManual'))) {
  1262. return Atp.WanController.activeItem.get('PPPIdletime');
  1263. }
  1264. else {
  1265. self.set('otherValue', Atp.WanController.activeItem.get('PPPIdletime'));
  1266. return "Other";
  1267. }
  1268. }
  1269. return "Other";
  1270. } else {
  1271. if (value != "Other") {
  1272. self.set('isManual', false);
  1273. Atp.WanController.activeItem.set('PPPIdletime', value);
  1274. }
  1275. else {
  1276. Atp.WanController.activeItem.set('PPPIdletime', self.get("otherValue"));
  1277. }
  1278. return value;
  1279. }
  1280. }.property('Atp.WanController.activeItem.PPPIdletime'),
  1281. valueObserves: function() {
  1282. this.set('isManual', true);
  1283. }.observes('otherValue'),
  1284. isSelectedOther: function() {
  1285. return (this.get('selectedValue') == "Other");
  1286. }.property('selectedValue')
  1287. });
  1288. Atp.ConnTypeRadioButton = Atp.RadioButton.extend ({
  1289. group: 'conn_type'
  1290. });
  1291. Atp.InternetConnTypeRadioButton = Atp.RadioButton.extend ({
  1292. group: 'internet_conn_type'
  1293. });
  1294. Atp.IptvConnTypeRadioButton = Atp.RadioButton.extend ({
  1295. group: 'iptv_conn_type'
  1296. });
  1297. Atp.PPPTriggerRadioButton = Atp.RadioButton.extend ({
  1298. group: 'ppp_type'
  1299. });
  1300. Atp.wanPPPTriggerRadioButton = Atp.RadioButton.extend ({
  1301. group: 'wan_ppp_type'
  1302. });
  1303. Atp.internetPPPTriggerRadioButton = Atp.RadioButton.extend ({
  1304. group: 'internet_ppp_type'
  1305. });
  1306. Atp.Wan = Em.Object.extend({
  1307. newCreated: false,
  1308. init: function() {
  1309. this._super();
  1310. selectControllerInit(this, "AccessType", Atp.AccessTypeController);
  1311. selectControllerInit(this, "ConnectionType", Atp.ConnectionTypeController);
  1312. selectControllerInit(this, "NATType", Atp.NatTypeController);
  1313. selectControllerInit(this, "IPVer", Atp.IPVersionController);
  1314. selectControllerInit(this, "IPv6AddrType", Atp.IPv6AddrTypeController);
  1315. selectControllerInit(this, "IPv4AddrType", Atp.IPv4AddrTypeController);
  1316. selectControllerInit(this, "PPPAuthMode", Atp.PPPAuthModeController);
  1317. selectControllerInit(this, "PPPDialIpMode", Atp.PPPDialIpModeController);
  1318. selectControllerInit(this, "PPPIdletime", Atp.AutoDisconnectTimeController);
  1319. selectControllerInit(this, "NetType", Atp.UMTSNetTypeController);
  1320. },
  1321. updateAccessType: function() {
  1322. selectControllerUpdate(this, "AccessType");
  1323. }.observes("AccessTypeSelected"),
  1324. updateConnectionType: function(){
  1325. selectControllerUpdate(this, "ConnectionType");
  1326. }.observes("ConnectionTypeSelected"),
  1327. updateNATType: function(){
  1328. selectControllerUpdate(this, "NATType");
  1329. }.observes("NATTypeSelected"),
  1330. updateIPVer: function(){
  1331. selectControllerUpdate(this, "IPVer");
  1332. }.observes("IPVerSelected"),
  1333. updateIPv4AddrType: function(){
  1334. selectControllerUpdate(this, "IPv4AddrType");
  1335. }.observes("IPv4AddrTypeSelected"),
  1336. updateIPv6AddrType: function(){
  1337. selectControllerUpdate(this, "IPv6AddrType");
  1338. }.observes("IPv6AddrTypeSelected"),
  1339. updatePPPAuthMode: function() {
  1340. selectControllerUpdate(this, "PPPAuthMode");
  1341. }.observes("PPPAuthModeSelected"),
  1342. updatePPPDialIpMode: function() {
  1343. selectControllerUpdate(this, "PPPDialIpMode");
  1344. }.observes("PPPDialIpModeSelected"),
  1345. updatePPPTrigger: function() {
  1346. selectControllerUpdate(this, "PPPTrigger");
  1347. }.observes("PPPTriggerModeSelected"),
  1348. updatePPPIdletime: function() {
  1349. selectControllerUpdate(this, "PPPIdletime");
  1350. }.observes("PPPIdletimeSelected"),
  1351. updateNetType: function() {
  1352. selectControllerUpdate(this, "NetType");
  1353. }.observes("NetTypeSelected"),
  1354. iconPath: function() {
  1355. if ("UMTS" == this.get("AccessType")) {
  1356. return "/res/top/datacard.png";
  1357. } else if ("Ethernet" == this.get("AccessType")) {
  1358. return "/res/top/ethernet.jpg";
  1359. }
  1360. return "/res/top/dsl.jpg";
  1361. }.property("AccessType"),
  1362. linkLayer: function() {
  1363. if (typeof this.get("LowerLayer") == 'undefined' ){
  1364. return null;
  1365. }
  1366. var wanconndev = this.get("LowerLayer").replace("X_ATP_", "X_");
  1367. var link = null;
  1368. if (!Atp.LinkController) {
  1369. return null;
  1370. }
  1371. Atp.LinkController.content.forEach(function (item) {
  1372. if (item.get("ID") == wanconndev) {
  1373. link = item;
  1374. }
  1375. });
  1376. return link;
  1377. }.property("Atp.LinkController.content.@each.ID", "LowerLayer"),
  1378. isPPPoA: function(){
  1379. var link = this.get("linkLayer");
  1380. if (!link){
  1381. return false;
  1382. }
  1383. if ("PPPoA" == link.get("LinkType")){
  1384. return true;
  1385. }
  1386. return false;
  1387. }.property("Atp.LinkController.content.@each.ID", "Atp.LinkController.content.@each.LinkType", "LowerLayer"),
  1388. needDialButton: function() {
  1389. if ("" == this.get("ID")) {
  1390. return false;
  1391. }
  1392. if (("Manual" == this.get("PPPTrigger")) && ("PPP_Routed" == this.get("ConnectionType"))) {
  1393. return true;
  1394. }
  1395. return false;
  1396. }.property("PPPTrigger", "ID"),
  1397. ipv4StatusText: function() {
  1398. if ("Connected" == this.get("ConnectionStatus")) {
  1399. return Em.I18n.t("Menu.Connected");
  1400. }
  1401. else if ("Connecting" == this.get("ConnectionStatus")) {
  1402. return Em.I18n.t("Menu.Connecting");
  1403. }
  1404. return Em.I18n.t("Menu.Disconnected");
  1405. }.property("ConnectionStatus"),
  1406. ipv6StatusText: function() {
  1407. if ("Connected" == this.get("IPv6ConnectionStatus")) {
  1408. return Em.I18n.t("Menu.Connected");
  1409. }
  1410. else if ("Connecting" == this.get("IPv6ConnectionStatus")) {
  1411. return Em.I18n.t("Menu.Connecting");
  1412. }
  1413. return Em.I18n.t("Menu.Disconnected");
  1414. }.property("IPv6ConnectionStatus"),
  1415. datacardBackupText: function () {
  1416. if (this.get("showDisconnect")) {
  1417. return Em.I18n.t('home.datacard_disconnect');
  1418. }
  1419. return Em.I18n.t('home.datacard_connect');
  1420. }.property("ConnectionStatus", "IPv6ConnectionStatus"),
  1421. connActionText: function () {
  1422. if (this.get("showDisconnect")) {
  1423. return Em.I18n.t('Menu.Disconnect');
  1424. }
  1425. return Em.I18n.t('Menu.Connect');
  1426. }.property("ConnectionStatus", "IPv6ConnectionStatus"),
  1427. showV4Status: function() {
  1428. if (this.get("IPv4Enable")) {
  1429. return true;
  1430. }
  1431. if ("Bridged" == this.get("ConnectionType")) {
  1432. return true;
  1433. }
  1434. return false;
  1435. }.property("IPv4Enable", "ConnectionType"),
  1436. showV6Status: function() {
  1437. if ("Bridged" == this.get("ConnectionType")) {
  1438. return false;
  1439. }
  1440. if (this.get("IPv6Enable")) {
  1441. return true;
  1442. }
  1443. return false;
  1444. }.property("IPv6Enable", "ConnectionType"),
  1445. showStatus: function() {
  1446. return ("Bridged" == this.get("ConnectionType"));
  1447. }.property("ConnectionType"),
  1448. connected: function() {
  1449. if ("Connected" == this.get("ConnectionStatus")) {
  1450. return true;
  1451. }
  1452. if ("Connected" == this.get("IPv6ConnectionStatus")) {
  1453. return true;
  1454. }
  1455. return false;
  1456. }.property("IPv6ConnectionStatus", "ConnectionStatus"),
  1457. showACName: function(){
  1458. if (this.get("connected") && this.get("isPPP") && !this.get("isPPPoA")){
  1459. return true;
  1460. }
  1461. return false;
  1462. }.property("IPv6ConnectionStatus", "ConnectionStatus", "ConnectionType"),
  1463. ipv4Connected: function() {
  1464. if ("Bridged" == this.get("ConnectionType")) {
  1465. return false;
  1466. }
  1467. if ("Connected" == this.get("ConnectionStatus")) {
  1468. return true;
  1469. }
  1470. return false;
  1471. }.property("ConnectionType", "ConnectionStatus"),
  1472. ipv6Connected: function() {
  1473. if ("Connected" == this.get("IPv6ConnectionStatus")) {
  1474. return true;
  1475. }
  1476. return false;
  1477. }.property("IPv6ConnectionStatus"),
  1478. isDialButtonDisabled: function() {
  1479. if (("Connecting" == this.get("ConnectionStatus")) ||
  1480. ("Connecting" == this.get("IPv6ConnectionStatus"))) {
  1481. return true;
  1482. }
  1483. if (("Disconnecting" == this.get("ConnectionStatus")) ||
  1484. ("Disconnecting" == this.get("IPv6ConnectionStatus"))) {
  1485. return true;
  1486. }
  1487. return false;
  1488. }.property("ConnectionStatus", "IPv6ConnectionStatus"),
  1489. showDisconnect: function() {
  1490. if (("Connected" == this.get("ConnectionStatus")) ||
  1491. ("Connected" == this.get("IPv6ConnectionStatus"))) {
  1492. return true;
  1493. }
  1494. if (("Connecting" == this.get("ConnectionStatus")) ||
  1495. ("Connecting" == this.get("IPv6ConnectionStatus"))) {
  1496. return true;
  1497. }
  1498. return false;
  1499. }.property("ConnectionStatus", "IPv6ConnectionStatus"),
  1500. showLinkAccess: function() {
  1501. if ("" == this.get("ID")) {
  1502. if (Atp.AccessTypeController.content.length > 1) {
  1503. return true;
  1504. }
  1505. return false;
  1506. }
  1507. return false;
  1508. }.property('ID'),
  1509. FriendlyName: function(key, value) {
  1510. return this.get('Name');
  1511. }.property('Name'),
  1512. IPv4PriDns: function (key, value) {
  1513. var servers = this.get("IPv4DnsServers");
  1514. if (1 == arguments.length) {
  1515. var sep = servers.indexOf(",");
  1516. if (-1 != sep) {
  1517. return servers.substring(0, sep);
  1518. }
  1519. return servers;
  1520. } else {
  1521. var sep = servers.indexOf(",");
  1522. if (-1 != sep) {
  1523. servers = value + "," + servers.substring(sep+1);
  1524. } else {
  1525. servers = value;
  1526. }
  1527. this.set("IPv4DnsServers", servers);
  1528. return value;
  1529. }
  1530. }.property("IPv4DnsServers"),
  1531. IPv4SecDns: function (key, value) {
  1532. var servers = this.get("IPv4DnsServers");
  1533. if (1 == arguments.length) {
  1534. var sep = servers.indexOf(",");
  1535. if (-1 != sep) {
  1536. return servers.substring(sep+1);
  1537. }
  1538. return "";
  1539. } else {
  1540. var sep = servers.indexOf(",");
  1541. if (-1 != sep) {
  1542. servers = servers.substring(0, sep+1) + value;
  1543. } else {
  1544. servers = servers + "," + value;
  1545. }
  1546. this.set("IPv4DnsServers", servers);
  1547. return value;
  1548. }
  1549. }.property("IPv4DnsServers"),
  1550. IPv6PriDns: function (key, value) {
  1551. var servers = this.get("IPv6DnsServers");
  1552. if (1 == arguments.length) {
  1553. var sep = servers.indexOf(",");
  1554. if (-1 != sep) {
  1555. return servers.substring(0, sep);
  1556. }
  1557. return servers;
  1558. } else {
  1559. var sep = servers.indexOf(",");
  1560. if (-1 != sep) {
  1561. servers = value + "," + servers.substring(sep+1);
  1562. } else {
  1563. servers = value;
  1564. }
  1565. this.set("IPv6DnsServers", servers);
  1566. return value;
  1567. }
  1568. }.property("IPv6DnsServers"),
  1569. IPv6SecDns: function (key, value) {
  1570. var servers = this.get("IPv6DnsServers");
  1571. if (1 == arguments.length) {
  1572. var sep = servers.indexOf(",");
  1573. if (-1 != sep) {
  1574. return servers.substring(sep+1);
  1575. }
  1576. return "";
  1577. } else {
  1578. var sep = servers.indexOf(",");
  1579. if (-1 != sep) {
  1580. servers = servers.substring(0, sep+1) + value;
  1581. } else {
  1582. servers = servers + "," + value;
  1583. }
  1584. this.set("IPv6DnsServers", servers);
  1585. return value;
  1586. }
  1587. }.property("IPv6DnsServers"),
  1588. IPVer: function(key, value) {
  1589. if (1 == arguments.length) {
  1590. if (this.get("IPv6Enable")) {
  1591. if (this.get("IPv4Enable")) {
  1592. return "Both";
  1593. }
  1594. return "IPv6";
  1595. }
  1596. return "IPv4";
  1597. } else {
  1598. this.set("IPv4Enable", true);
  1599. if ("IPv6" == value) {
  1600. this.set("IPv6Enable", true);
  1601. this.set("IPv4Enable", false);
  1602. } else if ("IPv4" == value) {
  1603. this.set("IPv6Enable", false);
  1604. } else {
  1605. this.set("IPv6Enable", true);
  1606. }
  1607. return value;
  1608. }
  1609. }.property("IPv4Enable", "IPv6Enable"),
  1610. isAtmMode: function() {
  1611. if ("DSL" == this.get("linkLayer").get("AccessType")) {
  1612. return true;
  1613. }
  1614. return false;
  1615. }.property("AccessType"),
  1616. isEthernetMode: function() {
  1617. if ("Ethernet" == this.get("linkLayer").get("AccessType")) {
  1618. return true;
  1619. }
  1620. return false;
  1621. }.property("AccessType"),
  1622. notDatacardMode: function() {
  1623. if ("UMTS" == this.get("AccessType")) {
  1624. return false;
  1625. }
  1626. return true;
  1627. }.property("AccessType"),
  1628. isDatacardMode: function() {
  1629. if ("UMTS" == this.get("AccessType")) {
  1630. return true;
  1631. }
  1632. return false;
  1633. }.property("AccessType"),
  1634. hasServiceList: function() {
  1635. if (("IP_Routed" == this.get("ConnectionType")) || ("PPP_Routed" == this.get("ConnectionType")) ||
  1636. ("Bridged" == this.get("ConnectionType"))) {
  1637. return true;
  1638. }
  1639. return false;
  1640. }.property("ConnectionType"),
  1641. isRouted: function() {
  1642. if (("IP_Routed" == this.get("ConnectionType")) || ("PPP_Routed" == this.get("ConnectionType"))) {
  1643. return true;
  1644. }
  1645. return false;
  1646. }.property("ConnectionType"),
  1647. isBridge: function() {
  1648. if ("Bridged" == this.get("ConnectionType")) {
  1649. return true;
  1650. }
  1651. return false;
  1652. }.property("ConnectionType"),
  1653. needPPP: function() {
  1654. if (("PPP_Routed" == this.get("ConnectionType")) || ("DHCP_Spoofed" == this.get("ConnectionType"))) {
  1655. return true;
  1656. }
  1657. return false;
  1658. }.property("ConnectionType"),
  1659. isPPP: function(){
  1660. if ("PPP_Routed" !== this.get("ConnectionType")){
  1661. return false;
  1662. }
  1663. return true;
  1664. }.property("ConnectionType"),
  1665. isStaticPPP: function(){
  1666. if ("static" == this.get("PPPDialIpMode")){
  1667. return true;
  1668. }
  1669. return false;
  1670. }.property("PPPDialIpMode"),
  1671. needIPv4AddrType: function() {
  1672. if ("IP_Routed" == this.get("ConnectionType")) {
  1673. if (this.get("IPv4Enable")) {
  1674. return true;
  1675. }
  1676. }
  1677. return false;
  1678. }.property("ConnectionType", "IPv4Enable"),
  1679. needDns:function(){
  1680. if ("IP_Routed" == this.get("ConnectionType") || ("PPP_Routed" == this.get("ConnectionType")) ) {
  1681. if (this.get("IPv4Enable")) {
  1682. return true;
  1683. }
  1684. }
  1685. return false;
  1686. }.property("ConnectionType","IPv4Enable"),
  1687. needIPv6AddrType: function() {
  1688. if (this.get("isRouted")) {
  1689. if ("UMTS" == this.get("AccessType")) {
  1690. return false;
  1691. }
  1692. if (this.get("IPv6Enable")) {
  1693. return true;
  1694. }
  1695. }
  1696. return false;
  1697. }.property("IPv6Enable", "isRouted"),
  1698. isStaticIPv6: function() {
  1699. if ("Static" == this.get("IPv6AddrType")) {
  1700. return true;
  1701. }
  1702. return false;
  1703. }.property("IPv6AddrType"),
  1704. isStaticIPv4: function() {
  1705. if (true == this.get("isPPP")){
  1706. return false;
  1707. }
  1708. if ("Static" == this.get("IPv4AddrType")) {
  1709. return true;
  1710. }
  1711. return false;
  1712. }.property("IPv4AddrType", "ConnectionType"),
  1713. notDhcpSpoof: function() {
  1714. if ("DHCP_Spoofed" == this.get("ConnectionType")) {
  1715. return false;
  1716. }
  1717. return true;
  1718. }.property("ConnectionType"),
  1719. isPPPOnDemand: function() {
  1720. if ("PPP_Routed" == this.get("ConnectionType")) {
  1721. if ("OnDemand" == this.get("PPPTrigger")) {
  1722. return true;
  1723. }
  1724. }
  1725. return false;
  1726. }.property("ConnectionType", "PPPTrigger"),
  1727. IPv4MaskStr: function() {
  1728. if (("" == this.get("IPv4Mask")) && ("PPP_Routed" == this.get("ConnectionType")))
  1729. {
  1730. return "255.255.255.255";
  1731. }
  1732. return this.get("IPv4Mask");
  1733. }.property("IPv4Mask", "ConnectionType"),
  1734. supportTunnel: function() {
  1735. var supportIPv4 = this.get("IPv4Enable");
  1736. var supportIPv6 = this.get("IPv6Enable");
  1737. if (supportIPv4 && supportIPv6) {
  1738. return false;
  1739. }
  1740. if ("UMTS" == this.get("AccessType")) {
  1741. return false;
  1742. }
  1743. if (("IP_Routed" != this.get("ConnectionType")) && ("PPP_Routed" != this.get("ConnectionType"))) {
  1744. return false;
  1745. }
  1746. if ("PPP_Routed" == this.get("ConnectionType")) {
  1747. if ("OnDemand" == this.get("PPPTrigger")) {
  1748. return false;
  1749. }
  1750. }
  1751. return (this.get("ServiceList") == "INTERNET");
  1752. }.property("IPv4Enable", "IPv6Enable", "ConnectionType", "PPPTrigger", "AccessType", "ServiceList"),
  1753. isLoadFinish:function(){
  1754. if ( (typeof this.get("ConnectionStatus") != "undefined") ||
  1755. (typeof this.get("IPv6ConnectionStatus") != "undefined")) {
  1756. return true;
  1757. }
  1758. return false;
  1759. }.property("ConnectionStatus","IPv6ConnectionStatus")
  1760. });
  1761. Atp.DslLinkTypeController = Atp.SelectController.create({
  1762. prefixName: 'wan.LinkType',
  1763. values: [ "EoA", "PPPoA", "IPoA"]
  1764. });
  1765. Atp.DslEncapModeController = Atp.SelectController.create({
  1766. prefixName: 'wan.EncapMode',
  1767. values: [ "LLC", "VCMUX"]
  1768. });
  1769. Atp.DslAtmQoSController = Atp.SelectController.create({
  1770. prefixName: 'wan.AtmQoS',
  1771. values: [ "UBR", "UBR+", "CBR", "VBR-nrt", "VBR-rt"]
  1772. });
  1773. Atp.Link = Em.Object.extend({
  1774. init: function() {
  1775. this._super();
  1776. Em.Logger.log("Init for Link now ...");
  1777. },
  1778. init_for_selectbox: function () {
  1779. selectControllerInit(this, "LinkType", Atp.DslLinkTypeController);
  1780. selectControllerInit(this, "EncapMode", Atp.DslEncapModeController);
  1781. selectControllerInit(this, "AtmQoS", Atp.DslAtmQoSController);
  1782. },
  1783. updateLinkType: function() {
  1784. selectControllerUpdate(this, "LinkType");
  1785. }.observes("LinkTypeSelected"),
  1786. updateEncapMode: function() {
  1787. selectControllerUpdate(this, "EncapMode");
  1788. }.observes("EncapModeSelected"),
  1789. updateAtmQoS: function() {
  1790. selectControllerUpdate(this, "AtmQoS");
  1791. }.observes("AtmQoSSelected"),
  1792. isAtmMode: function () {
  1793. if ("DSL" == this.get("AccessType")) {
  1794. return true;
  1795. }
  1796. return false;
  1797. }.property("AccessType"),
  1798. needAtmQoS: function() {
  1799. var atmqos = this.get("AtmQoS");
  1800. if ("UBR" != atmqos) {
  1801. return true;
  1802. }
  1803. return false;
  1804. }.property("AtmQoS"),
  1805. needAllAtmQos: function() {
  1806. var atmqos = this.get("AtmQoS");
  1807. if (("VBR-nrt" == atmqos) || ("VBR-rt" == atmqos)) {
  1808. return true;
  1809. }
  1810. return false;
  1811. }.property("AtmQoS"),
  1812. syncVlanParams: function(link_to_sync) {
  1813. this.set("VLANEnable", link_to_sync.get("VLANEnable"));
  1814. this.set("VLANId", link_to_sync.get("VLANId"));
  1815. this.set("VLAN1p", link_to_sync.get("VLAN1p"));
  1816. },
  1817. isLinkSame: function(link_to_compare) {
  1818. if (link_to_compare.get("AccessType") != this.get("AccessType")) {
  1819. return false;
  1820. }
  1821. if ("DSL" == this.get("AccessType")) {
  1822. if (link_to_compare.get("PVC") != this.get("PVC")) {
  1823. return false
  1824. }
  1825. }
  1826. if (link_to_compare.get("VLANEnable") != this.get("VLANEnable")) {
  1827. return false;
  1828. }
  1829. if (false != this.get("VLANEnable")) {
  1830. if (link_to_compare.get("VLANId") != this.get("VLANId")) {
  1831. return false;
  1832. }
  1833. }
  1834. return true;
  1835. },
  1836. actualWanNum: function() {
  1837. var num = 0;
  1838. var sameLink = Atp.LinkController.getSameLink(this);
  1839. if (sameLink) {
  1840. num = sameLink.get("wanNum") + 1;
  1841. } else {
  1842. num = this.get("wanNum");
  1843. }
  1844. return num;
  1845. }.property().cacheable(false),
  1846. wanNum: function() {
  1847. var num = 0;
  1848. var self = this;
  1849. Atp.WanController.content.forEach(function (item) {
  1850. if (self.get("ID") == item.get("LowerLayer")) {
  1851. num = num + 1;
  1852. }
  1853. });
  1854. return num;
  1855. }.property().cacheable(false),
  1856. bridgeNum: function() {
  1857. var num = 0;
  1858. var self = this;
  1859. Atp.WanController.content.forEach(function (item) {
  1860. if ("Bridged" == item.get("ConnectionType")) {
  1861. if (item.get("linkLayer") == self) {
  1862. num = num + 1;
  1863. }
  1864. }
  1865. });
  1866. return num;
  1867. }.property().cacheable(false),
  1868. vlanNum: function() {
  1869. var num = 0;
  1870. var self = this;
  1871. Atp.LinkController.content.forEach(function(item) {
  1872. if (item != self) {
  1873. if (item.get("PVC") == self.get("PVC")) {
  1874. num = num + 1;
  1875. }
  1876. }
  1877. });
  1878. return num;
  1879. }.property().cacheable(false),
  1880. ipNum: function() {
  1881. var num = 0;
  1882. var self = this;
  1883. Atp.WanController.content.forEach(function (item) {
  1884. if ("IP_Routed" == item.get("ConnectionType")) {
  1885. if (item.get("linkLayer") == self) {
  1886. num = num + 1;
  1887. }
  1888. }
  1889. });
  1890. return num;
  1891. }.property().cacheable(false),
  1892. isVlanChanged: function() {
  1893. if (this.get("VLANEnable") != this.get("origVLANEnable")) {
  1894. return true;
  1895. }
  1896. if (this.get("VLANId") != this.get("origVLANId")) {
  1897. return true;
  1898. }
  1899. return false;
  1900. }.property("VLANEnable", "VLANId", "origVLANEnable", "origVLANId"),
  1901. isPvcChanged: function() {
  1902. if (this.get("PVC") != this.get("origPVC")) {
  1903. return true;
  1904. }
  1905. return false;
  1906. }.property("PVC", "origPVC"),
  1907. getActualVlanNum: function() {
  1908. var num = 0;
  1909. if ("" == this.get("ID")) {
  1910. if (this.get("VLANEnable")) {
  1911. if (!Atp.LinkController.getSameLink(this)) {
  1912. num = 1;
  1913. }
  1914. }
  1915. return num;
  1916. }
  1917. if (!this.get("VLANEnable")) {
  1918. if (this.get("origVLANEnable")) {
  1919. if (this.get("wanNum") > 1) {
  1920. num = num + 1;
  1921. }
  1922. }
  1923. return num;
  1924. }
  1925. num = num + 1;
  1926. var hasSameLink = Atp.LinkController.getSameLink(this);
  1927. if (this.get("isVlanChanged")) {
  1928. if (hasSameLink) {
  1929. num = num - 1;
  1930. }
  1931. if ((this.get("wanNum") > 1) && this.get("origVLANEnable")) {
  1932. num = num + 1;
  1933. }
  1934. } else if (this.get("isPvcChanged")) {
  1935. if (hasSameLink) {
  1936. num = num - 1;
  1937. }
  1938. if (this.get("wanNum") > 1) {
  1939. num = num + 1;
  1940. }
  1941. }
  1942. return num;
  1943. },
  1944. init: function () {
  1945. this._super();
  1946. }
  1947. });
  1948. function utilIsItemInArray(item, array, num) {
  1949. var idx = 0;
  1950. while (idx < num) {
  1951. if (item == array[idx]) {
  1952. return true;
  1953. }
  1954. idx = idx + 1;
  1955. }
  1956. return false;
  1957. }
  1958. Atp.LinkController = Atp.MultiObjController.create({
  1959. modelClass: Atp.Link,
  1960. objName: 'ntwk/link',
  1961. init: function() {
  1962. this._super();
  1963. },
  1964. getPvcNum: function() {
  1965. var num = 0;
  1966. var pvcs = [];
  1967. this.content.forEach(function (item) {
  1968. if ("DSL" == item.get("AccessType")) {
  1969. if (!utilIsItemInArray(item.get("PVC"), pvcs, num)) {
  1970. if ((item.get("vlanNum") > 0) ||
  1971. (item.get("wanNum") > 0)) {
  1972. pvcs[num] = item.get("PVC");
  1973. num = num + 1;
  1974. }
  1975. }
  1976. }
  1977. });
  1978. return num;
  1979. },
  1980. getVlanNum: function() {
  1981. var num = 0;
  1982. this.content.forEach(function (item) {
  1983. num = num + item.getActualVlanNum();
  1984. });
  1985. return num;
  1986. },
  1987. getSameLink: function(link) {
  1988. var res = null;
  1989. this.content.forEach(function (item) {
  1990. if (item != link) {
  1991. if (item.isLinkSame(link)) {
  1992. res = item;
  1993. }
  1994. }
  1995. });
  1996. return res;
  1997. },
  1998. backupKeyParas: function() {
  1999. this.content.forEach(function(item) {
  2000. item.set("origPVC", item.get("PVC"));
  2001. item.set("origVLANEnable", item.get("VLANEnable"));
  2002. item.set("origVLANId", item.get("VLANId"));
  2003. });
  2004. },
  2005. build_link_err: function(errStruct, sameLink, connType, offset) {
  2006. if ((sameLink.get("bridgeNum") > offset) &&
  2007. ("Bridged" == connType)) {
  2008. errStruct.errId = "wan.bridge_num_err";
  2009. return;
  2010. }
  2011. if (sameLink.get("wanNum") >= (MAX_WAN_PER_LINK + offset)) {
  2012. errStruct.errId = "wan.too_many_link_err";
  2013. return;
  2014. }
  2015. },
  2016. build_server_err: function(errStruct, tr069serverlist, voiceserverlist,connType) {
  2017. if (("Bridged" == connType)
  2018. && (-1 != tr069serverlist)) {
  2019. errStruct.arg1 = "TR069";
  2020. errStruct.errId = "wan.bridge_server_err";
  2021. return;
  2022. }
  2023. if (("Bridged" == connType)
  2024. && (-1 != voiceserverlist)) {
  2025. errStruct.arg1 = "VOICE";
  2026. errStruct.errId = "wan.bridge_server_err";
  2027. return;
  2028. }
  2029. if (("DHCP_Spoofed" == connType)
  2030. && (-1 != tr069serverlist)) {
  2031. errStruct.arg1 = "TR069";
  2032. errStruct.errId = "wan.dhcpspoof_server_err";
  2033. return;
  2034. }
  2035. if (("DHCP_Spoofed" == connType)
  2036. && (-1 != voiceserverlist)) {
  2037. errStruct.arg1 = "VOICE";
  2038. errStruct.errId = "wan.dhcpspoof_server_err";
  2039. return;
  2040. }
  2041. },
  2042. checkConnType: function(connType) {
  2043. var curLink = Atp.LinkController.activeItem;
  2044. if (!curLink) {
  2045. return;
  2046. }
  2047. if ("DSL" != curLink.get("AccessType")) {
  2048. return;
  2049. }
  2050. if ((curLink.get("LinkType") != "IPoA") && (curLink.get("LinkType") != "PPPoA")) {
  2051. return;
  2052. }
  2053. var errStruct = utilCreateDftErrStruct();
  2054. errStruct.resId = "wan.LinkType";
  2055. if (curLink.get("LinkType") == "IPoA") {
  2056. if (("IP_Routed" != connType) ||
  2057. (curLink.get("actualWanNum") > 1)) {
  2058. errStruct.errId = "wan.ipoa_err";
  2059. }
  2060. } else if (curLink.get("LinkType") == "PPPoA") {
  2061. if (("PPP_Routed" != connType) ||
  2062. (curLink.get("actualWanNum") > 1)) {
  2063. errStruct.errId = "wan.pppoa_err";
  2064. }
  2065. }
  2066. if ("" != errStruct.errId) {
  2067. utilErrStructPush(Atp.WanController, errStruct);
  2068. }
  2069. },
  2070. checkTotalPVC: function() {
  2071. var errStruct = utilCreateDftErrStruct();
  2072. errStruct.resId = "wan.PVC";
  2073. var curPVC = Atp.LinkController.getPvcNum();
  2074. Em.Logger.log("Cur PVC number: " + curPVC);
  2075. if (curPVC > MAX_PVC_NUM) {
  2076. errStruct.errId = "wan.pvc_err";
  2077. errStruct.arg1 = MAX_PVC_NUM;
  2078. utilErrStructPush(Atp.WanController, errStruct);
  2079. return true;
  2080. }
  2081. return false;
  2082. },
  2083. checkTotalVlan: function() {
  2084. var errStruct = utilCreateDftErrStruct();
  2085. errStruct.resId = "wan.VLANId";
  2086. var curVlan = Atp.LinkController.getVlanNum();
  2087. Em.Logger.log("Cur VLAN number: " + curVlan);
  2088. if (curVlan > MAX_VLAN_LINKS) {
  2089. errStruct.errId = "wan.vlan_err";
  2090. errStruct.arg1 = MAX_VLAN_LINKS;
  2091. utilErrStructPush(Atp.WanController, errStruct);
  2092. return true;
  2093. }
  2094. return false;
  2095. },
  2096. checkcurPVC: function() {
  2097. if ("DSL" != Atp.LinkController.activeItem.get("AccessType")) {
  2098. return false;
  2099. }
  2100. var curpvc = Atp.LinkController.activeItem.PVC;
  2101. var errStruct = utilCreateDftErrStruct();
  2102. errStruct.resId = "wan.PVC";
  2103. if ((curpvc == "PVC:/") || (curpvc == ""))
  2104. {
  2105. errStruct.errId = "wan.pvcnum_err";
  2106. utilErrStructPush(Atp.WanController, errStruct);
  2107. return true;
  2108. }
  2109. var vpi = curpvc.split('/')[0];
  2110. var vci = curpvc.split('/')[1];
  2111. vpi = vpi.split(':')[1];
  2112. if ((vpi == "") || (vci == "")
  2113. || (vpi.length > 1 && vpi[0] == "0")
  2114. || (vci.length > 1 && vci[0] == "0"))
  2115. {
  2116. errStruct.errId = "wan.pvcnum_err";
  2117. utilErrStructPush(Atp.WanController, errStruct);
  2118. return true;
  2119. }
  2120. return false;
  2121. },
  2122. checkProc: function(isMoreWan) {
  2123. if (!Atp.WanController) {
  2124. return;
  2125. }
  2126. if (this.checkTotalPVC()) {
  2127. return;
  2128. }
  2129. if (this.checkcurPVC()){
  2130. return;
  2131. }
  2132. if (this.checkTotalVlan()) {
  2133. return;
  2134. }
  2135. var selected = this.get("activeItem");
  2136. if (!selected) {
  2137. return;
  2138. }
  2139. if (!Atp.WanController.activeItem) {
  2140. return;
  2141. }
  2142. var tr069serverlist = Atp.WanController.activeItem.get("ServiceList").indexOf("TR069");
  2143. var otherserverlist = Atp.WanController.activeItem.get("ServiceList").indexOf("IPTV");
  2144. var voiceserverlist = Atp.WanController.activeItem.get("ServiceList").indexOf("VOICE");
  2145. var internetserverlist = Atp.WanController.activeItem.get("ServiceList").indexOf("INTERNET");
  2146. var connType = Atp.WanController.activeItem.get("ConnectionType");
  2147. var errStruct = utilCreateDftErrStruct();
  2148. errStruct.resId = "wan.ServiceList";
  2149. if ((-1 != otherserverlist)
  2150. && ((-1 != tr069serverlist) || (-1 != internetserverlist)
  2151. || (-1 != voiceserverlist)
  2152. )) {
  2153. errStruct.errId = "wan.ServiceList_err";
  2154. }
  2155. if ("" != errStruct.errId) {
  2156. utilErrStructPush(Atp.WanController, errStruct);
  2157. }
  2158. var errStruct = utilCreateDftErrStruct();
  2159. errStruct.resId = "wan.ConnectionType";
  2160. this.build_server_err(errStruct, tr069serverlist, voiceserverlist,connType);
  2161. if ("" != errStruct.errId) {
  2162. utilErrStructPush(Atp.WanController, errStruct);
  2163. }
  2164. var errStruct = utilCreateDftErrStruct();
  2165. errStruct.resId = "wan.DslSupportRate";
  2166. Em.Logger.log("AtmQoS:"+Atp.LinkController.activeItem.get("AtmQoS"));
  2167. if(("VBR-nrt" == Atp.LinkController.activeItem.get("AtmQoS")) || ("VBR-rt" == Atp.LinkController.activeItem.get("AtmQoS")))
  2168. {
  2169. Em.Logger.log("AtmQoS check come in");
  2170. Em.Logger.log("SupportRate:"+Atp.LinkController.activeItem.get("SupportRate"));
  2171. Em.Logger.log("PeakRate:"+Atp.LinkController.activeItem.get("PeakRate"));
  2172. if (parseInt(Atp.LinkController.activeItem.get("SupportRate")) > parseInt(Atp.LinkController.activeItem.get("PeakRate")))
  2173. {
  2174. errStruct.errId = "wan.DslSupportRate_err";
  2175. }
  2176. }
  2177. if ("" != errStruct.errId) {
  2178. utilErrStructPush(Atp.WanController, errStruct);
  2179. }
  2180. Em.Logger.log("tr069:"+ tr069serverlist + ", other:" + otherserverlist + ", internet:" + internetserverlist);
  2181. var errStruct = utilCreateDftErrStruct();
  2182. errStruct.resId = "wan.ConnectionType";
  2183. var sameLink;
  2184. sameLink = Atp.LinkController.getSameLink(selected);
  2185. var offSet = 0;
  2186. if ("" == selected.get("ID")) {
  2187. if (!sameLink) {
  2188. return;
  2189. }
  2190. } else if (!sameLink) {
  2191. sameLink = selected;
  2192. offSet = 1;
  2193. }
  2194. this.build_link_err(errStruct, sameLink, connType, offSet);
  2195. if ("" != errStruct.errId) {
  2196. utilErrStructPush(Atp.WanController, errStruct);
  2197. }
  2198. },
  2199. newLink: function (AccessType) {
  2200. if (this.newItem) {
  2201. this.newItem.set("AccessType", AccessType);
  2202. this.set("activeItem", this.newItem);
  2203. return;
  2204. }
  2205. var linkData = {
  2206. "ID": "",
  2207. "Name": "NewLink",
  2208. "AccessType": AccessType,
  2209. "LowerLayer": "",
  2210. "PVC": "PVC:8/35",
  2211. "LinkType": "EoA",
  2212. "EncapMode": "LLC",
  2213. "AtmQoS": "UBR",
  2214. "PeakRate": 0,
  2215. "SupportRate": 0,
  2216. "MaxBurstRate": 0,
  2217. "VLANEnable": false,
  2218. "VLANId": "",
  2219. "VLAN1p": ""
  2220. };
  2221. var link = Atp.Link.create(linkData);
  2222. this.pushObject(link);
  2223. this.set("newItem", link);
  2224. this.set("activeItem", link);
  2225. },
  2226. createNewLink: function(wanID) {
  2227. var link = Atp.Link.create();
  2228. link.set("ID", wanID);
  2229. this.pushObject(link);
  2230. return link;
  2231. }
  2232. });
  2233. Atp.VlanCheckBoxView = Em.View.extend({
  2234. classNames: 'control-group width_100p',
  2235. controllerBinding: 'parentView.controller',
  2236. labelID:'',
  2237. vlanresid:'',
  2238. vlanresip:'',
  2239. isIptv:false,
  2240. elementId:function(){
  2241. return this.get("labelID").replace(/\./g,'_') + this.get("vlanresid") +'vlan';
  2242. }.property(),
  2243. labelinfoID:function(){
  2244. return this.get("elementId")+"_labelinfo";
  2245. }.property(),
  2246. labelText: function(){
  2247. return Em.I18n.t(this.labelID);
  2248. }.property('labelID'),
  2249. checkBoxCtrlId: function() {
  2250. return this.get("elementId") + "_ctrl_checkbox";
  2251. }.property(),
  2252. change:function(){
  2253. var vlanid = 1;
  2254. var vlan1p = 0;
  2255. var vlanebale = true;
  2256. if(this.get("isIptv")){
  2257. vlanid = Atp.IPTVController.content.get("VLANId");
  2258. vlan1p = Atp.IPTVController.content.get("VLAN1p");
  2259. vlanebale = Atp.IPTVController.content.get("VLANEnable");
  2260. }else{
  2261. if(null != Atp.LinkController.activeItem){
  2262. vlanid = Atp.LinkController.activeItem.get("VLANId");
  2263. vlan1p = Atp.LinkController.activeItem.get("VLAN1p");
  2264. vlanebale = Atp.LinkController.activeItem.get("VLANEnable");
  2265. }
  2266. }
  2267. if(vlanebale == false){
  2268. var vlanreg=/^[0-9]+$/;
  2269. var illegalflag  = false;
  2270. if(!vlanreg.test(vlanid)){
  2271. utilErrStructRemove(this.get("controller"),this.get("vlanresid"));
  2272. illegalflag = true;
  2273. }else if(parseInt(vlanid) < 0 || parseInt(vlanid) > 4094){
  2274. utilErrStructRemove(this.get("controller"),this.get("vlanresid"));
  2275. illegalflag = true;
  2276. }
  2277. if(illegalflag == true){
  2278. if(this.get("isIptv")){
  2279. Atp.IPTVController.content.set("VLANId",Atp.IPTVController.content.get("VLANId_temp"));
  2280. }else{
  2281. Atp.LinkController.activeItem.set("VLANId",Atp.LinkController.activeItem.get("VLANId_temp"));
  2282. }
  2283. }
  2284. var vlan1preg=/^[0-9]+$/;
  2285. illegalflag  = false;
  2286. if(!vlan1preg.test(vlan1p)){
  2287. utilErrStructRemove(this.get("controller"),this.get("vlanresip"));
  2288. illegalflag = true;
  2289. }else if(parseInt(vlan1p) < 0 || parseInt(vlan1p) > 7){
  2290. utilErrStructRemove(this.get("controller"),this.get("vlanresip"));
  2291. illegalflag = true;
  2292. }
  2293. if(illegalflag == true){
  2294. if(this.get("isIptv")){
  2295. Atp.IPTVController.content.set("VLANId",Atp.IPTVController.content.get("VLAN1p_temp"));
  2296. }else{
  2297. Atp.LinkController.activeItem.set("VLAN1p",Atp.LinkController.activeItem.get("VLAN1p_temp"));
  2298. }
  2299. }
  2300. }
  2301. },
  2302. template: Em.Handlebars.compile(' \
  2303. <label {{bindAttr id="view.labelinfoID"}} class="control-label third_menu_below_config_font"> \
  2304. {{view.labelText}}: \
  2305. </label> \
  2306. <div class="controls paddingtop_12"> \
  2307. {{view Atp.Checkbox elementIdBinding="view.checkBoxCtrlId" valueBinding="view.value"}} \
  2308. </div>\
  2309. ')
  2310. })
  2311. Atp.LinkView = Em.View.extend({
  2312. contentBinding: 'parentView.link',
  2313. controller: Atp.WanController,
  2314. elementId: function() {
  2315. return this.get('parentView').get('elementId') + "_link_edit";
  2316. }.property(),
  2317. template: Em.Handlebars.compile(
  2318. '{{#if view.content.isAtmMode }} \
  2319. {{ view Atp.PVCField labelID="wan.PVC" valueBinding="view.content.PVC" }} \
  2320. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.LinkType" controllerBinding="Atp.DslLinkTypeController" valueBinding="view.content.LinkTypeSelected"}} \
  2321. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.AtmQoS" controllerBinding="Atp.DslAtmQoSController" valueBinding="view.content.AtmQoSSelected"}} \
  2322. {{#if view.content.needAtmQoS}} \
  2323. {{ view Atp.LabelView labelID="wan.DslPeakRate" rule="integer" valueBinding="view.content.PeakRate" }} \
  2324. {{#if view.content.needAllAtmQos}} \
  2325. {{ view Atp.LabelView labelID="wan.DslSupportRate" rule="integer" valueBinding="view.content.SupportRate" }} \
  2326. {{ view Atp.LabelView labelID="wan.DslMaxBurstRate" rule="integer" valueBinding="view.content.MaxBurstRate" }} \
  2327. {{/if}} \
  2328. {{/if}} \
  2329. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.EncapMode" controllerBinding="Atp.DslEncapModeController" valueBinding="view.content.EncapModeSelected"}} \
  2330. {{/if}} \
  2331. {{view Atp.VlanCheckBoxView labelID="wan.VLANEnable" valueBinding="view.content.VLANEnable" vlanresip="wan_internal_edit_view_link_edit_wan_VLAN1p" vlanresid="wan_internal_edit_view_link_edit_wan_VLANId"}} \
  2332. {{#if view.content.VLANEnable}} \
  2333. {{ view Atp.LabelView labelID="wan.VLANId" rule="integer||range[0~4094]" valueBinding="view.content.VLANId" }} \
  2334. {{ view Atp.LabelView labelID="wan.VLAN1p" rule="integer||range[0~7]" valueBinding="view.content.VLAN1p" }} \
  2335. {{/if}}')
  2336. });
  2337. var wanpppusernamerule = "";
  2338. var wanppppasswordrule = "";
  2339. function isChineseCharacter(str)
  2340. {
  2341. var reg = /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
  2342. if (reg.test(str))
  2343. return true;
  2344. else
  2345. return false;
  2346. }
  2347. Atp.WanModalController = Atp.ModalController.create ({
  2348. header: Em.I18n.t("Menu.tipheader"),
  2349. body: Em.I18n.t("Menu.tipbody")
  2350. });
  2351. Atp.WanController = Atp.MultiObjController.create({
  2352. modelClass: Atp.Wan,
  2353. objName: 'ntwk/wan',
  2354. submittocontinue:false,
  2355. isAutoRefresh:true,
  2356. isEditing:false,
  2357. contentType:"application/json;charset=UTF-8;enp",
  2358. getCurInternetWan: function() {
  2359. var curWanType = Atp.WanController.get("curWan");
  2360. if ("UMTS" == curWanType) {
  2361. curWan = Atp.WanController.get("umtsWan");
  2362. this.set("isCable", false);
  2363. } else {
  2364. curWan = Atp.WanController.getDefaultWan();
  2365. this.set("isCable", true);
  2366. }
  2367. if ("" == curWanType) {
  2368. curWan = null;
  2369. }
  2370. return curWan;
  2371. },
  2372. showpwdtip: function() {
  2373. return (this.content.length < MAX_TOTAL_WAN);
  2374. }.property('content.length'),
  2375. umtsWan: function() {
  2376. var wan = null;
  2377. this.content.forEach(function (item){
  2378. if ("UMTS" == item.get("AccessType")) {
  2379. wan = item;
  2380. }
  2381. });
  2382. return wan;
  2383. }.property("content.@each.AccessType"),
  2384. getWanByID: function(ID) {
  2385. var wan = null;
  2386. this.content.forEach(function (item){
  2387. if (ID == item.get("ID")) {
  2388. wan = item;
  2389. }
  2390. });
  2391. return wan;
  2392. },
  2393. getInternetWanCnt: function() {
  2394. var cnt = 0;
  2395. this.content.forEach(function (item) {
  2396. if (item.get("IsDefault")) {
  2397. if ("UMTS" != item.get("AccessType")) {
  2398. cnt = cnt + 1;
  2399. }
  2400. }
  2401. });
  2402. return cnt;
  2403. },
  2404. getDefaultWan: function() {
  2405. var dsl = null;
  2406. var vdsl = null;
  2407. var eth = null;
  2408. this.content.forEach(function (item) {
  2409. if (item.get("IsDefault")) {
  2410. if ("DSL" == item.get("AccessType")) {
  2411. dsl = item;
  2412. } else if ("VDSL" == item.get("AccessType")) {
  2413. vdsl = item;
  2414. } else if ("Ethernet" == item.get("AccessType")) {
  2415. eth = item;
  2416. }
  2417. }
  2418. });
  2419. if (dsl && dsl.get("connected")) {
  2420. return dsl;
  2421. }
  2422. if (vdsl && vdsl.get("connected")) {
  2423. return vdsl;
  2424. }
  2425. if (eth && eth.get("connected")) {
  2426. return eth;
  2427. }
  2428. if (dsl && ("Down" != dsl.get("AccessStatus"))) {
  2429. return dsl;
  2430. }
  2431. if (vdsl && ("Down" != vdsl.get("AccessStatus"))) {
  2432. return vdsl;
  2433. }
  2434. if (eth && ("Down" != eth.get("AccessStatus"))) {
  2435. return eth;
  2436. }
  2437. if (dsl) {
  2438. return dsl;
  2439. }
  2440. if (vdsl) {
  2441. return vdsl;
  2442. }
  2443. return eth;
  2444. },
  2445. curWan: "",
  2446. checkBridgeNum: function() {
  2447. },
  2448. checkUsername: function(value) {
  2449. var errStruct = utilCreateDftErrStruct();
  2450. errStruct.resId = "wan.Username";
  2451. errStruct.errId = "wan.Username_err";
  2452. errStruct['delete'] = false;
  2453. if(wanpppusernamerule == ""){
  2454. if(value.length > 64)
  2455. {
  2456. return errStruct;
  2457. }
  2458. }
  2459. else{
  2460. var re = eval(wanpppusernamerule);
  2461. if(!re.exec(value)){
  2462. return errStruct;
  2463. }
  2464. }
  2465. return null;
  2466. },
  2467. checkPassword: function(value) {
  2468. return callback_check_ppp_password_value(value);
  2469. },
  2470. checkAlias:function(isMoreWan) {
  2471. if (!isMoreWan) {
  2472. return;
  2473. }
  2474. var alias = Atp.WanController.activeItem.get("Alias");
  2475. if (!alias)
  2476. {
  2477. return;
  2478. }
  2479. alias = alias.replace(/(^\s*)|(\s*$)/g, "");
  2480. if ("" == alias)
  2481. {
  2482. return;
  2483. }
  2484. Atp.WanController.activeItem.set("Alias", alias);
  2485. var passed = true;
  2486. Atp.WanController.content.forEach(function(item) {
  2487. if (item != Atp.WanController.activeItem) {
  2488. if (item.get("Alias") == alias) {
  2489. passed = false;
  2490. }
  2491. }
  2492. });
  2493. if (passed) {
  2494. return;
  2495. }
  2496. var errStruct = utilCreateDftErrStruct();
  2497. errStruct.resId = "wan.Alias";
  2498. errStruct.errId = "Menu.dup_err";
  2499. utilErrStructPush(Atp.WanController, errStruct);
  2500. },
  2501. checkProc: function(isMoreWan) {
  2502. if((Atp.WanController.activeItem.get("AccessType") != "UMTS") && (Atp.WanController.activeItem.get("ConnectionType") == "PPP_Routed"))
  2503. {
  2504. if(Atp.WanController.activeItem.get("Username") == "")
  2505. return this.createErrStruct('wan.Username_notinit_err', 'wan_Username');
  2506. if(Atp.WanController.activeItem.get("Password") == "")
  2507. return this.createErrStruct('wan.Password_notinit_err', 'wan_Password');
  2508. }
  2509. password_focusout_proc();
  2510. utilRemoveErrors(Atp.WanController);
  2511. utilRemoveErrors(Atp.LinkController);
  2512. utilErrInfoUpdate(this);
  2513. Atp.LinkController.checkConnType(Atp.WanController.activeItem.get("ConnectionType"));
  2514. this.checkAlias(isMoreWan);
  2515. var errStruct = callback_check_mss_value(Atp.WanController.activeItem.get("MSS"));
  2516. if (errStruct) {
  2517. errStruct['delete'] = true;
  2518. utilErrStructPush(Atp.WanController, errStruct);
  2519. }
  2520. var conntype = Atp.WanController.activeItem.get("ConnectionType");
  2521. if (isChineseCharacter(Atp.WanController.activeItem.get("Username"))) {
  2522. return this.createErrStruct('menu.ChineseErr', 'wan_Username');
  2523. }
  2524. if("PPP_Routed" == conntype || "DHCP_Spoofed" == conntype)
  2525. {
  2526. var errStruct = this.checkUsername(Atp.WanController.activeItem.get("Username"));
  2527. if(errStruct){
  2528. errStruct['delete'] = true;
  2529. utilErrStructPush(Atp.WanController, errStruct);
  2530. }
  2531. errStruct = this.checkPassword(Atp.WanController.activeItem.get("Password"));
  2532. if(errStruct){
  2533. errStruct['delete'] = true;
  2534. utilErrStructPush(Atp.WanController, errStruct);
  2535. }
  2536. }
  2537. var enable = Atp.WanController.activeItem.get("MACColoneEnable");
  2538. if ((!isMoreWan) && (enable)) {
  2539. var errStruct = callback_check_macclone_value(Atp.WanController.activeItem.get("MACColone"));
  2540. if (errStruct) {
  2541. errStruct['delete'] = true;
  2542. utilErrStructPush(Atp.WanController, errStruct);
  2543. }
  2544. }
  2545. if("PPP_Routed" != conntype)
  2546. {
  2547. var dhcpmode = Atp.WanController.activeItem.get("IPv4AddrType");
  2548. if ("Static" == dhcpmode && "IPv6" !== Atp.WanController.activeItem.get("IPVer"))
  2549. {
  2550. var errStruct = callback_check_ipv4static_value(Atp.WanController.activeItem);
  2551. if (errStruct) {
  2552. errStruct['delete'] = true;
  2553. utilErrStructPush(Atp.WanController, errStruct);
  2554. }
  2555. }
  2556. }
  2557. if (("IPoA" == Atp.LinkController.activeItem.get("LinkType")) && ("PPP_Routed" == Atp.WanController.activeItem.get("ConnectionType"))) {
  2558. var errStruct = utilCreateDftErrStruct();
  2559. errStruct.resId = "wan.LinkType";
  2560. errStruct.errId = "wan.ipoa_err";
  2561. errStruct['delete'] = true;
  2562. utilErrStructPush(Atp.WanController, errStruct);
  2563. }
  2564. if ("IP_Routed" == Atp.WanController.activeItem.get("ConnectionType")) {
  2565. if (("IPoA" == Atp.LinkController.activeItem.get("LinkType")) && ("DHCP" == Atp.WanController.activeItem.get("IPv4AddrType"))) {
  2566. var errStruct = utilCreateDftErrStruct();
  2567. errStruct.resId = "wan.IPv4AddrType";
  2568. errStruct.errId = "wan.IPoA_DHCP_err";
  2569. errStruct['delete'] = true;
  2570. utilErrStructPush(Atp.WanController, errStruct);
  2571. }
  2572. }
  2573. errStruct = utilCreateDftErrStruct();
  2574. errStruct['delete'] = true;
  2575. if ((-1 == this.activeItem.get("ServiceList").indexOf("INTERNET")) &&
  2576. (-1 == this.activeItem.get("ServiceList").indexOf("IPTV")) &&
  2577. this.activeItem.get("needPPP") &&
  2578. ("OnDemand" == this.activeItem.get("PPPTrigger"))) {
  2579. errStruct.resId = "wan.ServiceList";
  2580. errStruct.errId = "wan.ondemand_err";
  2581. }
  2582. if ("" != errStruct.resId) {
  2583. utilErrStructPush(Atp.WanController, errStruct);
  2584. }
  2585. if (isMoreWan) {
  2586. this.checkBridgeNum();
  2587. }
  2588. Atp.LinkController.checkProc(isMoreWan);
  2589. utilErrInfoUpdate(this);
  2590. },
  2591. dslWan: function() {
  2592. var dsl = null;
  2593. this.content.forEach(function (item){
  2594. if ("DSL" == item.get("AccessType")) {
  2595. dsl = item;
  2596. }
  2597. });
  2598. return dsl;
  2599. }.property(),
  2600. createDefaultObj: function () {
  2601. if (Atp.WanController.content.length >= MAX_TOTAL_WAN) {
  2602. return null;
  2603. }
  2604. if (Atp.WanController.content.length >= MAX_TOTAL_WAN - 1)
  2605. {
  2606. this.set("showpwdtip", false);
  2607. }
  2608. else
  2609. {
  2610. this.set("showpwdtip", true);
  2611. }
  2612. if (this.newItem) {
  2613. this.set("activeItem", this.newItem);
  2614. Atp.LinkController.newLink(this.newItem.get("AccessType"));
  2615. return this.newItem;
  2616. }
  2617. var wanData = {
  2618. "ID": "",
  2619. "Name": Em.I18n.t("wan.NewItemName"),
  2620. "Enable": true,
  2621. "AccessType": Atp.AccessTypeController.values[0],
  2622. "ConnectionType": Atp.ConnectionTypeController.values[0],
  2623. "LowerLayer": "",
  2624. "Username": "",
  2625. "Password": "",
  2626. "NetType": Atp.UMTSNetTypeController.values[0],
  2627. "APN": "123",
  2628. "DialNum": "*99#",
  2629. "ServiceList": "INTERNET",
  2630. "MTU": 1500,
  2631. "MRU": 1492,
  2632. "MSS": 0,
  2633. "MACColoneEnable": false,
  2634. "MACColone": "",
  2635. "NATType": Atp.NatTypeController.values[0],
  2636. "PPPAuthMode": Atp.PPPAuthModeController.values[0],
  2637. "PPPTrigger": Atp.PPPDialModeController.values[0],
  2638. "PPPIdletime": 300,
  2639. "PPPoEServiceName": '',
  2640. "IPv4Enable": true,
  2641. "IPv4AddrType": Atp.IPv4AddrTypeController.values[0],
  2642. "IPv4Addr": "",
  2643. "IPv4Mask": "",
  2644. "IPv4Gateway": "",
  2645. "IPv4DnsServers": "",
  2646. "IPv6Enable": true,
  2647. "IPv6AddrType": 'SLAAC',
  2648. "IPv6Addr": "",
  2649. "IPv6AddrPrefixLen": 64,
  2650. "IPv6Gateway": "",
  2651. "IPv6DnsServers": "",
  2652. "DNSOverrideAllowed": false,
  2653. "IsDefault": false
  2654. };
  2655. Atp.LinkController.newLink(wanData.AccessType);
  2656. var wan = Atp.Wan.create(wanData);
  2657. return wan;
  2658. },
  2659. click_proc: function() {
  2660. Em.Logger.log("click_proc....");
  2661. var self = this;
  2662. if (self.get("submittocontinue") == false)
  2663. {
  2664. this.deleteItem();
  2665. }
  2666. else
  2667. {
  2668. this.submitItem();
  2669. }
  2670. self.set("submittocontinue", false);
  2671. Atp.WanController.set("isAutoRefresh",true);
  2672. },
  2673. modal_cancel: function() {
  2674. Em.Logger.log("modal_cancel....");
  2675. this.set("submittocontinue", false);
  2676. if(Atp.WanController.get("isEditing")){
  2677. Atp.WanController.set("isAutoRefresh",false);
  2678. }else{
  2679. Atp.WanController.set("isAutoRefresh",true);
  2680. }
  2681. },
  2682. deleteItem: function(evt) {
  2683. Em.Logger.log("deleteItem wan.....");
  2684. Atp.WanController.set("isAutoRefresh",false);
  2685. if (false == this.get("showpwdtip"))
  2686. {
  2687. this.set("showpwdtip", true);
  2688. }
  2689. if (evt) {
  2690. var wan = evt.view.get("content");
  2691. this.set("activeItem", wan);
  2692. }
  2693. if (this.get("newItem") == this.get("activeItem")) {
  2694. if (Em.View.views.wan_container) {
  2695. Em.View.views.wan_container.delete_new_wan();
  2696. return;
  2697. }
  2698. }
  2699. if (evt) {
  2700. var self = this;
  2701. var body = Em.I18n.t("wan.confirmdelete");
  2702. Atp.WanModalController.set('body', body);
  2703. Atp.WanModalController.set('controller', self);
  2704. Atp.WanModalController.show();
  2705. return;
  2706. }
  2707. this._super(false, function() {
  2708. utilStopSubmitDialog();
  2709. reloadWanData();
  2710. });
  2711. },
  2712. dialupUmts: function() {
  2713. this.set("activeItem", this.get("umtsWan"));
  2714. this.dialup();
  2715. },
  2716. detectWanStatus: function(curWan) {
  2717. Atp.WanController.load(function() {
  2718. var wanObj = Atp.WanController.getWanByID(curWan);
  2719. if (wanObj && (!wanObj.get("isDialButtonDisabled"))) {
  2720. if (wanObj.get("IPv6Enable")) {
  2721. setTimeout(function () {
  2722. Atp.WanController.delayedReloadData();
  2723. }, 3000);
  2724. } else {
  2725. Atp.WanController.delayedReloadData();
  2726. }
  2727. return;
  2728. }
  2729. var retryCnt = Atp.WanController.get("dialDetectCnt");
  2730. retryCnt = retryCnt + 1;
  2731. if (retryCnt >= 10) {
  2732. Atp.WanController.delayedReloadData();
  2733. return;
  2734. }
  2735. Atp.WanController.set("dialDetectCnt", retryCnt);
  2736. setTimeout(function () {
  2737. Atp.WanController.detectWanStatus(curWan);
  2738. }, 2000);
  2739. });
  2740. },
  2741. delayedReloadData: function() {
  2742. utilStopSubmitDialog();
  2743. if (!(typeof(pageload) == "undefined")) {
  2744. pageload();
  2745. } else if (reloadWanData) {
  2746. reloadWanData();
  2747. }
  2748. },
  2749. dialup: function(evt) {
  2750. Em.Logger.log("dialup.....")
  2751. if (evt) {
  2752. this.set("activeItem", evt.view.get("content"));
  2753. }
  2754. if (!this.get("activeItem")) {
  2755. return;
  2756. }
  2757. Atp.WanController.set("isAutoRefresh",false);
  2758. var content = {};
  2759. content["Path"] = this.get("activeItem").get("ID");
  2760. var trigger = 2;    
  2761. if (this.get("activeItem").get("showDisconnect")) {
  2762. trigger = 1;    
  2763. }
  2764. content["Trigger"] = trigger;
  2765. var csrf_obj = utilGetCsrf();
  2766. var post_data = {
  2767. "csrf": csrf_obj,
  2768. "action": "trigger",
  2769. "data": utilGetJson(Em.Object.create(content))
  2770. };
  2771. utilStartSubmitDialog();
  2772. if(typeof post_data["data"]["Password"] != "undefined"){
  2773. post_data["data"]["Password"] = this.enc(post_data["data"]["Password"]);
  2774. }
  2775. var self = this;
  2776. this.post($.toJSON(post_data), function (result) {
  2777. if (1 == trigger) {
  2778. setTimeout(function () {
  2779. Atp.WanController.delayedReloadData();
  2780. }, 2000);
  2781. } else {
  2782. Atp.WanController.set("dialDetectCnt", 0);
  2783. var detectDelay = 2000;
  2784. if ("UMTS" == self.get("activeItem").get("AccessType")) {
  2785. detectDelay = 4000;
  2786. }
  2787. setTimeout(function () {
  2788. Atp.WanController.detectWanStatus(content["Path"]);
  2789. }, detectDelay);
  2790. }
  2791. Atp.WanController.set("isAutoRefresh",true);
  2792. });
  2793. },
  2794. syncVlanParamsForDftWan: function() {
  2795. var activeLink = Atp.LinkController.get("activeItem");
  2796. if (!activeLink) {
  2797. return;
  2798. }
  2799. this.content.forEach(function(item) {
  2800. if (item.get("IsDefault")
  2801. && item.get('linkLayer')
  2802. && ("UMTS" != item.get("AccessType"))) {
  2803. item.get("linkLayer").syncVlanParams(activeLink);
  2804. }
  2805. });
  2806. },
  2807. submitDftWan: function(haslink, callback) {
  2808. var csrf_obj = utilGetCsrf();
  2809. var jsonData = this.createSubmitData();
  2810. if (haslink) {
  2811. var linkData = Atp.LinkController.createSubmitData();
  2812. jsonData.linkdata = linkData;
  2813. }
  2814. var post_data = {
  2815. "csrf": csrf_obj,
  2816. "action": "update",
  2817. "data": jsonData
  2818. };
  2819. post_data.data.EncodeUsername = true;
  2820. post_data.data.Username = encodeURIComponent(post_data.data.Username);
  2821. if(typeof post_data["data"]["Password"] != "undefined"){
  2822. post_data["data"]["Password"] = this.enc(post_data["data"]["Password"]);
  2823. }
  2824. post_data.data.EncodePPPoEServiceName = true;
  2825. post_data.data.PPPoEServiceName = encodeURIComponent(post_data.data.PPPoEServiceName);
  2826. var self = this;
  2827. this.post($.toJSON(post_data), function (result) {
  2828. if(callback){
  2829. callback(result);
  2830. }
  2831. });
  2832. },
  2833. submitItemWan: function(evt) {
  2834. Em.Logger.log("submitItemWan wan.....");
  2835. this.set("activeItem", evt.view.get("content"));
  2836. this.submitItem();
  2837. },
  2838. submitWanConnection: function(callback){
  2839. Em.Logger.log("submitWanConnection proc....");
  2840. var self = this;
  2841. var csrf_obj = utilGetCsrf();
  2842. var action = "update";
  2843. if (self.activeItem.get("ID") == "") {
  2844. action = "create";
  2845. }
  2846. var linkData = Atp.LinkController.createSubmitData();
  2847. var jsonData = utilGetJson(self.get("activeItem"));
  2848. jsonData.linkdata = linkData;
  2849. var post_data = {
  2850. "csrf": csrf_obj,
  2851. "action": action,
  2852. "data": jsonData
  2853. };
  2854. post_data.data.EncodeUsername = true;
  2855. post_data.data.Username = encodeURIComponent(post_data.data.Username);
  2856. if(typeof post_data["data"]["Password"] != "undefined"){
  2857. post_data["data"]["Password"] = this.enc(post_data["data"]["Password"]);
  2858. }
  2859. post_data.data.EncodePPPoEServiceName = true;
  2860. post_data.data.PPPoEServiceName = encodeURIComponent(post_data.data.PPPoEServiceName);
  2861. self.post($.toJSON(post_data), function (result) {
  2862. if (0 != result.errcode) {
  2863. utilStopSubmitDialog();
  2864. utilMarkErrorFields(self, result);
  2865. bRefresh = false;
  2866. return;
  2867. }
  2868. if (callback && (Em.typeOf(callback) === 'function')) {
  2869. callback(result, self);
  2870. } else {
  2871. self.set("saved", true);
  2872. self.set("show", false);
  2873. self.set("curLine", null);
  2874. reloadWanData();
  2875. utilStopSubmitDialog();
  2876. }
  2877. });
  2878. },
  2879. submitItem: function(callback) {
  2880. Em.Logger.log("submitItem proc....");
  2881. var link = this.activeItem.get("linkLayer");
  2882. Atp.LinkController.set("activeItem", link);
  2883. this.checkProc(true);
  2884. if (this.showError()) {
  2885. return;
  2886. }
  2887. var self = this;
  2888. if ((self.activeItem.get("ID") != "") && (self.activeItem.get("originConnectionType") != self.activeItem.get("ConnectionType"))
  2889. && (self.get("submittocontinue") == false)) {
  2890. Em.Logger.log("ConnectionType changed.");
  2891. var body = Em.I18n.t("wan.confirmsubmit");
  2892. Atp.WanModalController.set('body', body);
  2893. Atp.WanModalController.set('controller', self);
  2894. Atp.WanModalController.show();
  2895. self.set("submittocontinue", true);
  2896. return;
  2897. }
  2898. utilStartSubmitDialog();
  2899. if ("UMTS" == self.activeItem.get("AccessType")) {
  2900. Atp.WanbackupController.postMoreWan(function(){
  2901. self.submitWanConnection(callback);
  2902. });
  2903. return;
  2904. }
  2905. this.submitWanConnection(callback);
  2906. },
  2907. cancel: function(evt) {
  2908. Em.Logger.log("cancel proc....");
  2909. if (evt && evt.view) {
  2910. if (Em.View.views.wan_container) {
  2911. Em.View.views.wan_container.hide_edit_view(evt.view.get("content"));
  2912. this.set('activeItem', null);
  2913. }
  2914. }
  2915. if (Atp.WanDetectController) {
  2916. Atp.WanDetectController.cancel();
  2917. }
  2918. Atp.WanController.set("isAutoRefresh",true);
  2919. },
  2920. pppReset: function(evt){
  2921. Em.Logger.log("pppReset.....");
  2922. if (evt) {
  2923. this.set("activeItem", evt.view.get("content"));
  2924. }
  2925. if (!this.get("activeItem")) {
  2926. return;
  2927. }
  2928. Atp.WanController.set("isAutoRefresh",false);
  2929. var content = {};
  2930. content["ID"] = this.get("activeItem").get("ID");
  2931. var csrf_obj = utilGetCsrf();
  2932. var post_data = {
  2933. "csrf": csrf_obj,
  2934. "action": "pppreset",
  2935. "data": utilGetJson(Em.Object.create(content))
  2936. };
  2937. if(typeof post_data["data"]["Password"] != "undefined"){
  2938. post_data["data"]["Password"] = this.enc(post_data["data"]["Password"]);
  2939. }
  2940. utilStartSubmitDialog();
  2941. var self = this;
  2942. this.post($.toJSON(post_data), function (result) {
  2943. setTimeout(function () {
  2944. Atp.WanController.delayedReloadData();
  2945. Atp.WanController.set("isAutoRefresh",true);
  2946. }, 2000);
  2947. });
  2948. },
  2949. changectrl: function(evt) {
  2950. Em.Logger.log("changectrl wan.....");
  2951. Atp.WanController.content.forEach(function(item) {
  2952. if (Em.View.views.wan_container) {
  2953. Em.View.views.wan_container.hide_edit_view(item);
  2954. }
  2955. });
  2956. var wan = evt.view.get("content");
  2957. if (this.get('activeItem') == wan) {
  2958. this.set('activeItem', null);
  2959. return;
  2960. }
  2961. this.set("activeItem", wan);
  2962. Atp.LinkController.set("activeItem", wan.get("linkLayer"));
  2963. if (Em.View.views.wan_container) {
  2964. Em.View.views.wan_container.show_edit_view(wan);
  2965. }
  2966. }
  2967. });
  2968. Atp.WANTblView = Atp.TableView.extend({
  2969. controller: Atp.WanController,
  2970. DataView: Em.View.extend({
  2971. template: Em.Handlebars.compile(
  2972. '{{view Atp.CheckCtrl labelBinding="content.Name"}}')
  2973. })
  2974. });
  2975. Atp.ServiceListField = Atp.CommaStrField.extend({
  2976. sep: '_',
  2977. data: ["INTERNET"
  2978. ,"TR069"
  2979. ,"VOICE"
  2980. ,"IPTV"
  2981. ],
  2982. updateValue: function(newValue) {
  2983. var childViews = this.get('childViews');
  2984. var listView = childViews[0];
  2985. listView.updateValue(newValue);
  2986. }
  2987. });
  2988. Atp.WanSubmitCtrl = Atp.SubmitCtrl.extend({
  2989. contentBinding: 'parentView.content',
  2990. template: Em.Handlebars.compile('\
  2991. <button class="atp_button" id="wan_submit_cancel" {{action "cancel" target="view.controller"}}>{{t Menu.Cancel}}</button> \
  2992. <button class="atp_button fontweight_thick" id="wan_submit_item" {{action "submitItemWan" target="view.controller"}}>{{t Menu.Submit}}</button>')
  2993. });
  2994. Atp.WANViewInternal = Em.View.extend({
  2995. contentBinding: 'parentView.content',
  2996. linkBinding: 'parentView.link',
  2997. controller: Atp.WanController,
  2998. classNames: 'wanedit width_100p',
  2999. elementId: 'wan_internal_edit_view',
  3000. editViewId: function() {
  3001. var controller = this.get("controller");
  3002. if (controller){
  3003. controller.set("editViewId", this.get('elementId'));
  3004. }
  3005. return this.get('elementId');
  3006. }.property(),
  3007. change: function () {
  3008. var curWan = this.get("content");
  3009. this.controller.set("activeItem", curWan);
  3010. if (Atp.LinkController) {
  3011. Atp.LinkController.set("activeItem", curWan.get("linkLayer"));
  3012. curWan.get("linkLayer").set("AccessType", curWan.get("AccessType"));
  3013. }
  3014. Em.Logger.log("WAN parameters view changed.");
  3015. },
  3016. connTypeChanged: function () {
  3017. if (Atp.WanController) {
  3018. WanConnTypeChangeProc(Atp.WanController.activeItem);
  3019. }
  3020. }.observes("Atp.WanController.activeItem.ConnectionType"),
  3021. template: Em.Handlebars.compile('{{view Atp.SuccessView}} \
  3022. <div class="form-horizontal paddingleft_87"> \
  3023. <p><span class="fontweight_thick">{{t wan.basic.title}}</span></p> \
  3024. {{ view Atp.LabelView textType="checkbox" labelID="wan.Enable" valueBinding="view.content.Enable" }} \
  3025. {{ view Atp.LabelView labelID="wan.Alias" maxlen="64" valueBinding="view.content.Alias" }} \
  3026. {{ view Atp.ServiceListField labelID="wan.ServiceList" valueBinding="view.content.ServiceList" }} \
  3027. {{#if view.content.showLinkAccess}} \
  3028. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.AccessType" controllerBinding="Atp.AccessTypeController" valueBinding="view.content.AccessTypeSelected" }} \
  3029. {{/if}} \
  3030. {{#if view.content.notDatacardMode}} \
  3031. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.ConnectionType" controllerBinding="Atp.ConnectionTypeController" valueBinding="view.content.ConnectionTypeSelected" }} \
  3032. {{#if view.content.isRouted}} \
  3033. {{#if view.content.needPPP}} \
  3034. {{ view Atp.LabelView labelID="wan.MRU" valueBinding="view.content.MRU" }} \
  3035. {{else}} \
  3036. {{ view Atp.LabelView labelID="wan.MTU" valueBinding="view.content.MTU" }} \
  3037. {{/if}} \
  3038. {{ view Atp.LabelView labelID="wan.MSS" rule="callback_MSS" valueBinding="view.content.MSS" }} \
  3039. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.NATType" controllerBinding="Atp.NatTypeController" valueBinding="view.content.NATTypeSelected"}} \
  3040. {{/if}} \
  3041. <p><span class="fontweight_thick">{{t wan.link.title}}</span></p> \
  3042. {{view Atp.LinkView}} \
  3043. {{else}} \
  3044. {{view Atp.WanbackupView}} \
  3045. {{/if}} \
  3046. {{#if view.content.needPPP}} \
  3047. <p><span class="fontweight_thick">{{t wan.ppp.title}}</span></p> \
  3048. {{#if view.content.notDatacardMode}} \
  3049. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.PPPAuthMode" controllerBinding="Atp.PPPAuthModeController" valueBinding="view.content.PPPAuthModeSelected"}} \
  3050. {{/if}} \
  3051. <div class="control-group"> \
  3052. <label class="control-label third_menu_below_config_font">\
  3053. {{t wan.PPPTrigger}}: \
  3054. </label> \
  3055. <div class="controls">\
  3056. {{ view Atp.wanPPPTriggerRadioButton  kind="wanppp" titleID="wan.PPPTrigger_AlwaysOn" option="AlwaysOn" valueBinding="view.content.PPPTrigger"}} \
  3057. {{ view Atp.wanPPPTriggerRadioButton  kind="wanppp" titleID="wan.PPPTrigger_Manual" option="Manual" valueBinding="view.content.PPPTrigger"}} \
  3058. {{#if view.content.notDhcpSpoof}} \
  3059. {{ view Atp.wanPPPTriggerRadioButton kind="wanppp" titleID="wan.PPPTrigger_OnDemand" option="OnDemand" valueBinding="view.content.PPPTrigger"}} \
  3060. {{/if}} \
  3061. </div>\
  3062. </div>\
  3063. {{#if view.content.isPPPOnDemand}} \
  3064. {{view Atp.LabelView textType="selectbox" labelID="wan.PPPIdletime" controllerBinding="Atp.AutoDisconnectTimeController"}}\
  3065. {{#if Atp.AutoDisconnectTimeController.isSelectedOther }} \
  3066. {{ view Atp.LabelView labelID="wan.PPPIdletimeOther" rule="integer||range[30~31536000]" valueBinding="view.content.PPPIdletime" }} \
  3067. {{/if}} \
  3068. {{/if}} \
  3069. {{ view Atp.LabelView labelID="wan.Username" maxlen="64" valueBinding="view.content.Username" }} \
  3070. {{ view Atp.LabelView labelID="wan.Password" rule="callback_Password" passwordEnable="true" valueBinding="view.content.Password" }} \
  3071. {{#if view.content.isPPPoA}} \
  3072. {{else}} \
  3073. {{ view Atp.LabelView labelID="wan.PPPoEServiceName" maxlen="256" valueBinding="view.content.PPPoEServiceName"}} \
  3074. {{/if}} \
  3075. {{#if view.content.isDatacardMode}} \
  3076. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.NetType" controllerBinding="Atp.UMTSNetTypeController" valueBinding="view.content.NetTypeSelected"}} \
  3077. {{ view Atp.LabelView labelID="wan.APN" maxlen="32" rule="callback_APN" valueBinding="view.content.APN" }} \
  3078. {{ view Atp.LabelView labelID="wan.DialNum" maxlen="32" rule="callback_DialNum" valueBinding="view.content.DialNum" }} \
  3079. {{/if}} \
  3080. {{/if}} \
  3081. {{#if view.content.isRouted}} \
  3082. <p><span class="fontweight_thick">{{t wan.ip.title}}</span></p>\
  3083. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.IPVer" controllerBinding="Atp.IPVersionController" valueBinding="view.content.IPVerSelected" }} \
  3084. {{/if}}\
  3085. {{#if view.content.needIPv4AddrType}} \
  3086. \
  3087. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.IPv4AddrType" controllerBinding="Atp.IPv4AddrTypeController" valueBinding="view.content.IPv4AddrTypeSelected"}} \
  3088. {{#if view.content.isStaticIPv4}} \
  3089. {{ view Atp.IPAddrField labelID="wan.IPv4Addr" valueBinding="view.content.IPv4Addr" }} \
  3090. {{ view Atp.IPAddrField labelID="wan.IPv4Mask" valueBinding="view.content.IPv4Mask" }} \
  3091. {{ view Atp.IPAddrField labelID="wan.IPv4Gateway" valueBinding="view.content.IPv4Gateway" }} \
  3092. {{else}} \
  3093. {{/if}} \
  3094. {{/if}} \
  3095. {{#if view.content.needDns}} \
  3096. {{#if view.content.isStaticIPv4}} \
  3097. {{ view Atp.IPAddrField labelID="wan.IPv4PriDns" valueBinding="view.content.IPv4PriDns" }} \
  3098. {{ view Atp.IPAddrField labelID="wan.IPv4SecDns" valueBinding="view.content.IPv4SecDns" }} \
  3099. {{else}} \
  3100. {{ view Atp.LabelView textType="checkbox" labelID="wan.DNSOverrideAllowed" valueBinding="view.content.DNSOverrideAllowed" }} \
  3101. {{#if view.content.DNSOverrideAllowed}} \
  3102. {{ view Atp.IPAddrField labelID="wan.IPv4PriDns" valueBinding="view.content.IPv4PriDns" }} \
  3103. {{ view Atp.IPAddrField labelID="wan.IPv4SecDns" valueBinding="view.content.IPv4SecDns" }} \
  3104. {{/if}} \
  3105. {{/if}} \
  3106. {{/if}} \
  3107. {{#if view.content.needIPv6AddrType}} \
  3108. {{ view Atp.LabelView textType="selectboxSep" labelID="wan.IPv6AddrType" controllerBinding="Atp.IPv6AddrTypeController" valueBinding="view.content.IPv6AddrTypeSelected" }} \
  3109. {{#if view.content.isStaticIPv6}} \
  3110. {{ view Atp.IPv6AddrField labelID="wan.IPv6Addr" valueBinding="view.content.IPv6AddrSet" lenBinding="view.content.IPv6AddrPrefixLen" controllerBinding="view.controller" }} \
  3111. {{ view Atp.LabelView labelID="wan.IPv6Gateway" valueBinding="view.content.IPv6Gateway" }} \
  3112. {{ view Atp.LabelView labelID="wan.IPv6PriDns" valueBinding="view.content.IPv6PriDns" }} \
  3113. {{ view Atp.LabelView labelID="wan.IPv6SecDns" valueBinding="view.content.IPv6SecDns" }} \
  3114. {{/if}} \
  3115. {{/if}} \
  3116. {{ view Atp.WanSubmitCtrl}}<br> \
  3117. </div><br>')
  3118. });
  3119. Atp.WANViewInternal2 = Em.View.extend({
  3120. contentBinding: 'parentView.content',
  3121. linkBinding: 'parentView.link',
  3122. controller: Atp.WanController,
  3123. classNames: 'wanedit width_100p',
  3124. elementId: 'wan_internal_edit_view',
  3125. editViewId: function() {
  3126. var controller = this.get("controller");
  3127. if (controller){
  3128. controller.set("editViewId", this.get('elementId'));
  3129. }
  3130. return this.get('elementId');
  3131. }.property(),
  3132. change: function () {
  3133. var curWan = this.get("content");
  3134. this.controller.set("activeItem", curWan);
  3135. if (Atp.LinkController) {
  3136. Atp.LinkController.set("activeItem", curWan.get("linkLayer"));
  3137. curWan.get("linkLayer").set("AccessType", curWan.get("AccessType"));
  3138. }
  3139. Em.Logger.log("WAN parameters view changed.");
  3140. },
  3141. connTypeChanged: function () {
  3142. if (Atp.WanController) {
  3143. WanConnTypeChangeProc(Atp.WanController.activeItem);
  3144. }
  3145. }.observes("Atp.WanController.activeItem.ConnectionType"),
  3146. template: Em.Handlebars.compile('{{view Atp.SuccessView}} \
  3147. <div class="margintop_10"> \
  3148. {{ view Atp.LabelView labelID="wan.Username" maxlen="64" valueBinding="view.content.Username" }} \
  3149. {{ view Atp.LabelView labelID="wan.Password" rule="callback_Password" passwordEnable="true" valueBinding="view.content.Password" }} \
  3150. <div class="submit_ctrl_pos margintop_10"> \
  3151. <button class="atp_button fontweight_thick" id="wan_submit_aitem" {{action "submitItemWan" target="view.controller"}}>{{t Menu.Submit}}</button> \
  3152. </div></div><br>')
  3153. });
  3154. Atp.AddWanCtrl = Em.View.extend({
  3155. tagName: 'span',
  3156. attributeBindings: ['style'],
  3157. 'style': 'color=#6C6C6C',
  3158. controller: Atp.WanController,
  3159. click: function(evt) {
  3160. Em.Logger.log("AddWanCtrl click.....");
  3161. Em.View.views.wan_container.create_new_wan();
  3162. Atp.WanController.set("isAutoRefresh",false);
  3163. },
  3164. template: Em.Handlebars.compile('<br><div class="pull-left ic-new ie6image"></div>\
  3165. <a href="#internet" id="create_wan" class="linkcolor">\
  3166. {{t wan.NewItemName}}</a>')
  3167. });
  3168. Atp.WanOperationView = Em.View.extend ({
  3169. contentBinding: 'parentView.content',
  3170. controller: Atp.WanController,
  3171. canEditBinding: 'parentView.canEdit',
  3172. isNotUmtswan: true,
  3173. elementId:function(){
  3174. var content  = this.get('content');
  3175. var id = "";
  3176. if("UMTS" == content.get("AccessType")){
  3177. this.set("isNotUmtswan",false);
  3178. }
  3179. if (null === content){
  3180. id = "wan_setup_internet_";
  3181. }
  3182. else{
  3183. if (typeof(content.get("ID")) !== "undefined"){
  3184. id = "wan_setup_"+content.get("ID").replace(/\./g, "_");
  3185. }
  3186. }
  3187. return id;
  3188. }.property(),
  3189. deleteId: function(){
  3190. return this.get("elementId") + "_delete";
  3191. }.property('elementId'),
  3192. changeId: function(){
  3193. return this.get("elementId") + "_change";
  3194. }.property('elementId'),
  3195. pppresetId: function(){
  3196. return this.get("elementId") + "_reset";
  3197. }.property('elementId'),
  3198. template: Em.Handlebars.compile(' \
  3199. {{#if view.content.needDialButton}} \
  3200. <button class="atp_button" {{action "dialup" target="Atp.WanController"}}>{{view.content.connActionText}}</button>\
  3201. {{/if}}\
  3202. {{#if view.canEdit}}\
  3203. {{#if view.isNotUmtswan}}\
  3204. <button class="atp_button" {{bindAttr id="view.deleteId"}} {{action "deleteItem" target="Atp.WanController"}}>{{t Menu.Delete}}</button>\
  3205. {{/if}}\
  3206. <button class="atp_button" {{bindAttr id="view.changeId"}} {{action "changectrl" target="Atp.WanController"}}>{{t Menu.Change}}</button>\
  3207. {{#if view.content.isPPP}}\
  3208. <button class="atp_button" {{bindAttr id="view.pppresetId"}} {{action "pppReset" target="Atp.WanController"}}>{{t wan.PPPReset}}</button>\
  3209. {{/if}}\
  3210. {{/if}}')
  3211. });
  3212. Atp.WanOperationView2 = Em.View.extend ({
  3213. contentBinding: 'parentView.content',
  3214. controller: Atp.WanController,
  3215. canEditBinding: 'parentView.canEdit',
  3216. elementId:function(){
  3217. var content  = this.get('content');
  3218. var id = "";
  3219. if (null === content){
  3220. id = "wan_setup_internet_";
  3221. }
  3222. else{
  3223. if (typeof(content.get("ID")) !== "undefined"){
  3224. id = "wan_setup_"+content.get("ID").replace(/\./g, "_");
  3225. }
  3226. }
  3227. return id;
  3228. }.property(),
  3229. changeId: function(){
  3230. return this.get("elementId") + "_change";
  3231. }.property('elementId'),
  3232. template: Em.Handlebars.compile(' \
  3233. {{#if view.content.isEthernetMode}} \
  3234. {{#if view.content.isPPP}} \
  3235. {{ view Atp.WANViewInternal2 }} \
  3236. {{/if}} \
  3237. {{/if}} \
  3238. {{#if view.content.isDatacardMode}} \
  3239. {{ view Atp.PinView }} \
  3240. <br><br> \
  3241. <div class="margintop_10"> \
  3242. {{ view Atp.LabelView labelID="wan.APN" maxlen="32" rule="callback_APN" valueBinding="view.content.APN" }} \
  3243. <div class="submit_ctrl_pos margintop_10"> \
  3244. <button class="atp_button fontweight_thick" id="wan_submit_aitem" {{action "submitItemWan" target="view.controller"}}>{{t Menu.Submit}}</button> \
  3245. </div></div>\
  3246. {{/if}}')
  3247. });
  3248. Atp.WanStatusView = Em.View.extend ({
  3249. canEdit: false,
  3250. init: function() {
  3251. this._super();
  3252. if (this.get("parentView")) {
  3253. this.get("parentView").set("isClosed", false);
  3254. }
  3255. },
  3256. isEdit: function() {
  3257. return Atp.UserLevelController.get('isAdminUser');
  3258. }.property(),
  3259. template: Em.Handlebars.compile('\
  3260. <div class="form-horizontal paddingleft_87"> \
  3261. {{ view Atp.LabelView textType="label" labelID="wan.AccessType" valueBinding="view.content.AccessType" }} \
  3262. {{#if view.content.showV4Status}}\
  3263. {{#if view.content.showStatus}}\
  3264. {{ view Atp.LabelView textType="label" labelID="wan.Status" valueBinding="view.content.ipv4StatusText" }} \
  3265. {{else}}\
  3266. {{ view Atp.LabelView textType="label" labelID="wan.IPv4Status" valueBinding="view.content.ipv4StatusText" }} \
  3267. {{/if}}\
  3268. {{#if view.content.ipv4Connected}}\
  3269. {{ view Atp.LabelView textType="label" labelID="wan.IPv4Addr" valueBinding="view.content.IPv4Addr" }} \
  3270. {{ view Atp.LabelView textType="label" labelID="wan.IPv4PriDns" valueBinding="view.content.IPv4PriDns" }} \
  3271. {{ view Atp.LabelView textType="label" labelID="wan.IPv4SecDns" valueBinding="view.content.IPv4SecDns" }} \
  3272. {{#if view.content.needIPv4AddrType}} \
  3273. {{ view Atp.LabelView textType="label" labelID="wan.IPv4Gateway" valueBinding="view.content.IPv4Gateway" }} \
  3274. {{/if}}\
  3275. {{/if}}\
  3276. {{/if}}\
  3277. {{#if view.content.showV6Status}}\
  3278. {{ view Atp.LabelView textType="label" labelID="wan.IPv6Status" valueBinding="view.content.ipv6StatusText" }} \
  3279. {{#if view.content.ipv6Connected}}\
  3280. {{ view Atp.LabelView textType="label" labelID="wan.IPv6Addr" valueBinding="view.content.IPv6Addr" }} \
  3281. {{ view Atp.LabelView textType="label" labelID="wan.IPv6PriDns" valueBinding="view.content.IPv6PriDns" }} \
  3282. {{ view Atp.LabelView textType="label" labelID="wan.IPv6SecDns" valueBinding="view.content.IPv6SecDns" }} \
  3283. {{ view Atp.LabelView textType="label" labelID="wan.PrefixList" valueBinding="view.content.IPv6PrefixList" }} \
  3284. {{/if}}\
  3285. {{/if}}\
  3286. {{#if view.content.showACName}} \
  3287. {{#if Atp.UserLevelController.isAdminUser}} \
  3288. {{ view Atp.LabelView textType="label" labelID="wan.ACName" valueBinding="view.content.PPPoEACName" }} \
  3289. {{/if}} \
  3290. {{/if}} \
  3291. {{#if view.isEdit}} \
  3292. {{ view Atp.WanOperationView}} \
  3293. {{else}}\
  3294. {{ view Atp.WanOperationView2}} \
  3295. {{/if}} \
  3296. </div>')
  3297. });
  3298. Atp.WANEntryViewCollapse = Atp.CollapseView.extend({
  3299. LabelRes: function() {
  3300. return this.get("LabelId");
  3301. }.property(),
  3302. ctrlId: function() {
  3303. var contentId = this.get('content').ID;
  3304. if (contentId == '') {
  3305. return "new_wan_ctrl";
  3306. }
  3307. return contentId.replace(/\./g, "_") + "_ctrl";
  3308. }.property(),
  3309. toggle_edit_view: function(show) {
  3310. var childViews = this.get('childViews');
  3311. var dataView = childViews[1];
  3312. dataView.toggle_edit_view(show);
  3313. },
  3314. DataView: Em.ContainerView.extend({
  3315. init: function() {
  3316. this._super();
  3317. this.set("editView", null);
  3318. this.get("parentView").set("isClosed", false);
  3319. },
  3320. linkBinding: 'parentView.link',
  3321. contentBinding: 'parentView.content',
  3322. controller: Atp.WanController,
  3323. didInsertElement: function() {
  3324. this.add_status_view();
  3325. },
  3326. add_status_view: function() {
  3327. var childView = Atp.WanStatusView.create(
  3328. {parent: this, content: this.content,
  3329. link: this.content.get("linkLayer"),
  3330. canEdit: true});
  3331. this.get('childViews').pushObject(childView);
  3332. },
  3333. toggle_edit_view: function(show) {
  3334. var childViews = this.get('childViews');
  3335. var dataView = childViews[1];
  3336. if (dataView) {
  3337. if (!show) {
  3338. this.get('childViews').removeAt(1);
  3339. }
  3340. return;
  3341. }
  3342. if (!show) {
  3343. return;
  3344. }
  3345. if (!Atp.UserLevelController.get('isAdminUser')) {
  3346. return;
  3347. }
  3348. var childView = this.createChildView(Atp.WANViewInternal,
  3349. {parent: this, content: this.content,
  3350. link: this.content.get("linkLayer")});
  3351. this.get('childViews').pushObject(childView);
  3352. }
  3353. })
  3354. });
  3355. Atp.WanContainerView = Em.ContainerView.extend({
  3356. didInsertElement:function(){
  3357. setInterval(function(){
  3358. if(Atp.WanController.get("isAutoRefresh")){
  3359. Em.Logger.log("refresh wan data....",Atp.WanController.get("isAutoRefresh"));
  3360. Atp.LinkController.load(function() {
  3361. Atp.LinkController.backupKeyParas();
  3362. Atp.WanController.load(function() {
  3363. WanBackupData();
  3364. if (Em.View.views.wan_container) {
  3365. Em.View.views.wan_container.update_child_views();
  3366. } else {
  3367. setTimeout(function() {
  3368. Em.View.views.wan_container.update_child_views();
  3369. },10);
  3370. }
  3371. });
  3372. });
  3373. }
  3374. },30000);
  3375. },
  3376. show_edit_view: function(wan) {
  3377. Em.Logger.log("show_edit_view...",wan);
  3378. Atp.WanController.set("isEditing",true);
  3379. Atp.WanController.set("isAutoRefresh",false);
  3380. var wanView = this.get_entry_view_by_wan(wan);
  3381. if (wanView) {
  3382. wanView.toggle_edit_view(true);
  3383. }
  3384. },
  3385. hide_edit_view: function(wan) {
  3386. Em.Logger.log("hide_edit_view...",wan);
  3387. var wanView = this.get_entry_view_by_wan(wan);
  3388. if (wanView) {
  3389. wanView.toggle_edit_view(false);
  3390. }
  3391. },
  3392. get_entry_view_by_wan: function(wan) {
  3393. var len = this.get('childViews').length;
  3394. var idx = 0;
  3395. while (idx < len) {
  3396. if (this.get('childViews')[idx].get("content") == wan) {
  3397. return this.get('childViews')[idx];
  3398. }
  3399. idx = idx + 1;
  3400. }
  3401. return null;
  3402. },
  3403. delete_new_wan: function() {
  3404. Em.Logger.log("delete_new_wan......");
  3405. var item = Atp.WanController.newItem;
  3406. if (!item) {
  3407. return;
  3408. }
  3409. var newWanView = this.get_entry_view_by_wan(item);
  3410. if (!newWanView) {
  3411. return;
  3412. }
  3413. Atp.WanController.removeObject(item);
  3414. Atp.WanController.set("newItem", null);
  3415. Atp.WanController.set("activeItem", null);
  3416. this.get('childViews').removeObject(newWanView);
  3417. },
  3418. create_new_wan: function() {
  3419. Em.Logger.log("create_new_wan......");
  3420. if (true != Atp.WanController.hasNewItem()) {
  3421. var newItem = Atp.WanController.createDefaultObj();
  3422. if (newItem) {
  3423. Atp.WanController.pushObject(newItem);
  3424. Atp.WanController.set("newItem", newItem);
  3425. }
  3426. } else {
  3427. return;
  3428. }
  3429. var item = Atp.WanController.newItem;
  3430. if (item) {
  3431. Atp.WanController.set("activeItem", null);
  3432. } else {
  3433. return;
  3434. }
  3435. var childView = this.createChildView(Atp.WANEntryViewCollapse,
  3436. {
  3437. parent: this, content: item,
  3438. link: item.get("linkLayer"),
  3439. LabelId: item.get("Name")
  3440. }
  3441. );
  3442. this.get('childViews').insertAt(0, childView);
  3443. },
  3444. update_child_views: function() {
  3445. var self = this;
  3446. var idx = self.get('childViews').length;
  3447. while (0 != idx) {
  3448. idx = idx - 1;
  3449. self.get('childViews').removeAt(idx);
  3450. }
  3451. Atp.WanController.content.forEach(function (item) {
  3452. var childView = self.createChildView(Atp.WANEntryViewCollapse,
  3453. {parent: self, content: item,
  3454. link: item.get("linkLayer"),
  3455. LabelId: item.get("Name")});
  3456. self.get('childViews').pushObject(childView);
  3457. });
  3458. }
  3459. });
  3460. function reloadWanData() {
  3461. Atp.WanController.set("isAutoRefresh",true);
  3462. Atp.WanController.set("isEditing",false);
  3463. $("#wan_Password").live("focus", password_focus_proc);
  3464. $("#wan_Password").live("focusout", password_focusout_proc);
  3465. Atp.WanController.set("content", []);
  3466. Atp.WanController.set("newItem", null);
  3467. Atp.LinkController.set("content", []);
  3468. Atp.LinkController.set("newItem", null);
  3469. Em.Logger.log("reloadWanData...");
  3470. Atp.LinkController.load(function() {
  3471. Atp.LinkController.backupKeyParas();
  3472. Atp.WanController.load(function() {
  3473. WanBackupData();
  3474. if (Em.View.views.wan_container) {
  3475. Em.View.views.wan_container.update_child_views();
  3476. } else {
  3477. setTimeout(function() {
  3478. Em.View.views.wan_container.update_child_views();
  3479. },10);
  3480. }
  3481. });
  3482. });
  3483. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement