Skip to content

Instantly share code, notes, and snippets.

@lacostej
Last active December 10, 2015 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lacostej/4375322 to your computer and use it in GitHub Desktop.
Save lacostej/4375322 to your computer and use it in GitHub Desktop.
A simple proof of concept to dump Livebox2 WAN status
var AllTranslations = {};
AllTranslations["en"] =
{
"general":
{
"label":
{
"password":"password",
"login":"login",
"internet":"internet",
"phone":"phone",
"tv":"TV",
"info":"info",
"wifienable":"WiFi on",
"wifidisable":"WiFi off",
"available":"available",
"unavailable":"unavailable",
"nonsubscribe":"not subscribed",
"unmanaged":"unknown",
"help":"help",
"destroy":"delete",
"enable":"activate",
"disable":"deactivate",
"enabled":"activated",
"disabled":"deactivated",
"nodevices":"no device connected",
"logout":"logout",
"usbphone":"livephone",
"wifi":"WiFi",
"yes":"yes",
"no":"no",
"port":"port",
"ip":"ip address",
"url":"url",
"filename":"file name",
"legalinfo":"lawful information",
"days":
{
"day":"day",
"monday":"monday",
"tuesday":"tuesday",
"wednesday":"wednesday",
"thursday":"thursday",
"friday":"friday",
"saturday":"saturday",
"sunday":"sunday"
},
"months":
{
"january":"January",
"february":"February",
"march":"March",
"april":"April",
"may":"May",
"june":"June",
"july":"July",
"august":"August",
"september":"September",
"october":"October",
"november":"November",
"december":"December"
},
"vmenu":
{
"home":
{
"title":"my home page"
},
"config":
{
"title":"settings",
"wireless":"WiFi network",
"devices":"my devices"
},
"support":
{
"title":"support",
"livebox":"Livebox",
"hotline":"advanced support &amp;<br/> customer support",
"systeminformation":"information system"
},
"advconfig":
{
"title":"advanced settings",
"network":"network"
}
}
},
"link":
{
"definitions":"&gt; d&eacute;finitions",
"legalinfo":"legal information"
},
"btn":
{
"backup":"save",
"restore":"restore",
"reset":"factory reset",
"files":"access to my files",
"eject":"eject",
"refresh":"refresh",
"enable":"activate",
"disable":"deactivate",
"cancel":"cancel",
"save":"save",
"restart":"reboot",
"startagain":"start again",
"test":"test",
"findnewestversion":"find a new version",
"back":"back",
"customize":"customize",
"stop":"stop",
"start":"start",
"interfaceaccess":
{
"fr":"go to orange.fr",
"pl":"go to configuration pages",
"mini_fr":"go to orange.fr"
},
"interfaceaccessurl":
{
"fr":"http://www.orange.fr",
"pl":"http://livebox",
"mini_fr":"http://www.orange.fr"
},
"extend":"extend",
"update":"update",
"reinit":"restart",
"scan":"scan",
"add":"add",
"ok":"ok",
"yes":"yes",
"no":"no",
"valid":"validate",
"generate":"generate",
"push":"connect"
},
"country":
{
"france":"France",
"belgium":"Belgium",
"spain":"Spain",
"unitedkingdom":"England",
"netherland":"Netherlands",
"poland":"Poland"
},
"device":
{
"Device1":"device 1",
"Device2":"device 2",
"Device3":"device 3",
"Device4":"device 4",
"Device5":"device 5",
"Device6":"device 6",
"Device7":"device 7",
"Device8":"device 8",
"Device9":"device 9"
}
},
"setup":
{
"accesstype":
{
"label":
{
"title":"internet connection",
"subtitle":"you are connected for the first time to your Livebox or you just made a factory reset ?<br/>this page allow you to configure your Livebox and to access to internet",
"restore":
{
"linklabel":"If you have a backup file for the Livebox, you can",
"link":"restore the settings",
"title":"To restore my Livebox",
"todomsg":"<p>To restore the Livebox settings, select the backup file first with the « Browse » button then clic on the « restore » button.</p><p>You don\'t need to fill the user name and password fields again.<br/>The already connected devices will be connected themselves automatically.<br/>Your others settings (firewall, network…) will be also restored.</p>",
"browsfieldlabel":"File name",
"stependmsg":"<p>The restoration is in progress. Your Livebox will reboot automatically. Please wait for few minutes…</p><p>Once the restoration is terminated, you will be able to surf on Internet.</p><p>If you want to access again to the interface, type livebox in your browser address bar.</p><p>In case of Livebox exchange:<br/>The WiFi settings to use to connect again by WiFi are those of the previous Livebox (Network name (SSID) and security key).<br/>The already connected devices of the previous Livebox will be connected themselves automatically.</p>"
},
"error":
{
"nofilelabel":"error",
"nofiledesc":"no file to restore",
"uploadlabel":"error",
"uploaddesc":"invalid file"
},
"offer":"choose the offer you subscribed",
"howtoinstall":"enter your login and your connection password",
"login":"connection login",
"password":"connection password",
"warning":
{
"fr":"your login and password are available in the welcome letter",
"pl":"your login and password were generated in registration process",
"mini_fr":"your login and password are available in the welcome letter"
}
},
"offer":
{
"radiobutton":
{
"adsl":"ADSL",
"fiber":"The fiber"
}
},
"error":
{
"empty":
{
"label":"login and/or password not correct",
"description":"verify that your login and password are correct"
},
"running":
{
"label":"authentication",
"description":"authentication in progress"
},
"adsl_link":
{
"label":"ADSL error",
"description":"ADSL not synchronized"
},
"ftth_link":
{
"label":"Fiber error",
"description":"Fibre connection not available"
},
"ppp_server":
{
"label":"PPP error",
"description":"fail to connect to PPP server"
},
"authentication":
{
"label":"login and/or password not correct",
"description":"verify them and enter them again"
},
"ppp_timeout":
{
"label":"PPP error",
"description":"no response from PPP server"
}
}
},
"accessconfirmation":
{
"label":
{
"title":"your Livebox is connected to internet"
},
"info":
{
"comment":"you can access to the Livebox settings interface by entering <a href=\'http://livebox\' target=\'_blank\'>http://livebox</a> in the navigation bar of your browser"
}
}
},
"home":
{
"label":
{
"title":"devices connected to the Livebox",
"subtitle":"to define a device type and rename it, click on it.",
"refresh":"to refresh the home page<br/>click on refresh button",
"services":"services",
"wired":"wired network",
"wireless":"WiFi network",
"usb":"USB",
"devices":
{
"massstorage":
{
"title":"USB mass storage",
"eject":"to remove your USB device safely, click on the eject button",
"ejected":"you can unplug your USB mass storage",
"busy":"your USB mass storage is in use. please try again later",
"unsupported":"your USB mass storage is not recognized by the Livebox",
"invalid":"the format of your USB mass storage is not supported. the Livebox support FAT, FAT32, NTFS, Ext2, Ext3, HFS and HFS+"
}
}
},
"didyouknow":
{
"label":"did you know ?",
"description":
{
"first":"you can access to your content on a USB key or external hard drive connected to the Livebox and share from any computers. We recommand to use the USB port on the left side of the Livebox",
"second":"You can share a USB printer connected to the Livebox on different computers. You can print a document or a photo from any computers.",
"third":"you can connect many computers or games consoles by wire on your Livebox (ethernet ports on the back face of the Livebox)",
"fourth":"you can schedule internet access by day and hour for any computer connected to the Livebox. You can prevent your children to access internet during some hours",
"fiveth":"if you switch off your Livebox by using the on/off button on the left side of the Livebox, you won\'t have access to any services",
"sixth":"you can schedule WiFi activation by day and hour from Settings page."
}
},
"usb":
{
"access":
{
"comment":"fill the path below in your browser to access your files."
}
},
"devicescustomize":
{
"label":
{
"title":"customize your device",
"type":
{
"title":"define the type of device",
"computer":"desktop",
"laptop":"laptop",
"game":"game console",
"mobile":"phone",
"tv":"TV",
"photo":"photo frame",
"liveradio":"LiveRadio",
"stb":"set top box",
"massstorage":"USB",
"printer":"printer"
},
"name":
{
"title":"name your device",
"info":"the name of your device is limited to 64 characters",
"error":
{
"length":"limited to 64 characters",
"empty":"empty name is forbidden"
}
}
}
},
"authentication":
{
"label":
{
"title":"Please enter your login and password to continue",
"subtitle":"enter your Livebox login and password",
"login":"login",
"password":"password"
},
"info":
{
"comment":"by default your login is \"admin\" and your password is \"admin\""
},
"error":
{
"empty":"empty login or password",
"invalid":"invalid login or password"
}
}
},
"config":
{
"wifi":
{
"general":
{
"label":
{
"title":"WiFi",
"subtitle":"configure WiFi",
"ssid":"WiFi network name (SSID)",
"status":"WiFi status"
},
"link":
{
"ssid":"modify",
"wifischeduling":"define WiFi scheduling"
},
"text":
{
"help":"<h6>WiFi on/off</h6>if there is no WiFi device in your network, it is recommanded to switch off the WiFi</br></br><h6>WiFi network name (SSID)</h6>you can modify the name of the WiFi to customize it.</br></br>define WiFi scheduling</h6>by default your WiFi is always on. You can schedule days and hours where WiFi is activated by clicking on \" Define WiFi scheduling\""
},
"definition":
{
"ssid":
{
"title":"SSID",
"description":"SSID is the Livebox WiFi network name"
},
"canal":
{
"title":"channel",
"description":""
},
"security":
{
"title":"security key",
"description":"security key allows to have a securised WiFi access"
}
},
"info":
{
"wificom":"If you deactivate WiFi on the Livebox, the mode Orange wifi will not be available. Would you like to continue ?"
}
},
"ssid":
{
"label":
{
"title":"WiFi name",
"subtitle":"you can modify the name (SSID) of the WiFi network of your Livebox",
"description":"enter the new WiFi name in the field below:",
"error":
{
"invalid":"SSID not valid",
"length":"SSID to long",
"orange":"SSID \'orange\' is forbiden"
}
},
"info":
{
"comment":"the WiFi name cannot have more than 32 characters"
}
},
"scheduling":
{
"label":
{
"title":"WiFi scheduling",
"subtitle":"you can activate WiFi by choosing day and time slots",
"enable":"activate WiFi permanently",
"greenbox":"WiFi is on for time slots displayed in green",
"redbox":"WiFi is off for time slots displayed in red",
"allday":"check to activate the whole day"
},
"text":
{
"help":"<h6>WiFi scheduling</h6>you can define WiFi activation/ deactivation time slots in the table below."
}
},
"definitions":
{
"label":
{
"title":"definition",
"ssid":"SSID",
"channel":
{
"title":"channel",
"description":""
},
"securitykey":"",
"securitymode":"",
"macaddress":""
},
"description":
{
"ssid":""
}
},
"orange":
{
"label":
{
"title":"Orange wifi",
"subtitle":"",
"ssid":"Orange wifi name (SSID)",
"status":"Orange wifi status",
"wifienable":"Orange wifi activated",
"wifidisable":"Orange wifi deactivated"
},
"manage":
{
"link":"ckick here",
"linkurl":"http://r.orange.fr/r?ref=MCI_livebox_wificom&url=http://r.orange.fr/r/Omoncompteinternet_messervices_wificom"
},
"info":
{
"comment":"to activate or deactivate \"Orange WiFi\" service"
},
"text":
{
"help":"<h5>Why activate Orange wifi?</h5> « Orange wifi » offers the possibility to access free internet on the Orange wifi network outside home.Your Livebox broadcasts a new network named « orange » and joins the Orange hotspots community. Your security and usage experience are identical. <br/><br/><h5>How to activate or deactivate Orange wifi? </h5> Activation or deactivation of « Orange wifi » is authorized only from your internet connection at home. Click on the link above to be connected on Orange portal to manage the function status (Orange.fr > Espace Client > Mon compte Internet > Mes Services).To take into account the modification, you need to switch off and switch on your Livebox. Activation will be effective after few hours ( up to 24 hours): you will be therefore able to connect to Orange wifi network outside home.<h5> How to connect to Orange wifi</h5><br/><br/>To connect to Orange wifi from any laptop, mobile or any other WiFi compliant device:1/ choose WiFi network named <span class=\'basecolor\'><b>orange</b></span><br/>2/ use your Orange email and associated password ( eg: <span class=\'basecolor\'>name@orange.fr</span>) in the Orange wifi connection page. They are available on your internet subscription welcome letter"
},
"definition":
{
"example":
{
"title":"",
"description":""
}
}
}
},
"computers":
{
"label":
{
"title":"computers",
"subtitle":"internet access restriction for your computers"
},
"link":
{
"accessscheduling":"internet access restriction"
},
"info":
{
"comment":"you can limit access to internet on this computer by day and time slots of your choice.",
"question":"Are you sure?"
},
"text":
{
"help":"<h6>define internet access scheduling</h6> you can limit the access to internet of any computers connected to the livebox by day and time slots by clicking on \"internet access restriction\""
}
},
"access":
{
"scheduling":
{
"label":
{
"title":"internet access scheduling",
"subtitle":"you can restrain internet access of this device by days and time slots of your choice",
"enable":"allow internet access permanently",
"greenbox":"internet access is allowed during time slots in green",
"redbox":"internet access is forbidden during time slots in red",
"allday":"check to activate the whole day"
},
"text":
{
"help":"by default all devices can access to internet all the time but you can define days and time slots where your devices can access or not by selecting them in the table below."
}
}
},
"printer":
{
"label":
{
"title":"printer sharing",
"subtitle":"Livebox can share a USB printer between differents computers connected"
},
"link":
{
"more":"&gt; more information",
"moreurl":
{
"fr":"http://assistance.orange.fr/partager-imprimante-usb-avec-livebox-2-47.php",
"pl":"http://www.tp.pl/konfiguracja-drukarki-livebox2",
"mini_fr":"http://assistance.orange.fr/partager-imprimante-usb-avec-livebox-2-47.php"
}
},
"info":
{
"comment":"<h5>actions to be done:</h5><br/>1- install the USB printer drivers on each computer with CD.<br/><br/>2- connect the printer to your Livebox<br/><br/>3- configure your printer on each computer"
},
"text":
{
"help":"<h6>USB printer sharing</h6><br/>- it is possible to print a document from any computer<br/>- to follow printing status in progress<br/>- to cancel printing"
},
"definition":
{
"example":
{
"title":"printer",
"description":"definition"
}
}
},
"others":
{
"label":
{
"title":"other devices",
"subtitle":"internet access restriction for other devices"
},
"link":
{
"accessscheduling":"internet access restriction"
},
"info":
{
"comment":"you can restrain internet access to this devices by day and time slots of your choice."
},
"text":
{
"help":"<h6>define internet access scheduling</h6>you can limit access to internet for any device connected to your Livebox days and time slots of your choice by clicking on \" restrain internet access\"."
}
}
},
"support":
{
"ledsstatus":
{
"label":
{
"title":"leds status",
"led":"led",
"icon":"led icon",
"state":"led status",
"description":"meaning",
"adsl":"internet",
"phone":"phone",
"wired":"local network",
"wireless":"WiFi"
},
"text":
{
"help":"LEDs displayed on this screen correspond to the one visible on the front panel of the Livebox. They provide status on internet, phone and WiFi services."
},
"comment":
{
"gray":
{
"phone":"you do not have internet phone service",
"network":"no data traffic between the Livebox and connected devices",
"wireless":"WiFi is off"
},
"green_solid":
{
"adsl":"internet connection is on",
"phone":"internet phone is on and available",
"wireless":"WiFi is on"
},
"green_slow":
{
"phone":"phone call in progress",
"network":"exchange of data traffic between the Livebox and connected devices",
"wireless":"easy pairing is on going with a WiFi device"
},
"green-fast":
{
"phone":"phone call in progress"
},
"green_fast":
{
"network":"exchange of data traffic between the Livebox and connected devices",
"wireless":"easy pairing is on going with a WiFi device"
},
"red_fast":
{
"adsl":"Livebox was not able to connect to internet ( not synchronized)"
},
"orange_slow":
{
"adsl":"internet connection in progress"
}
},
"definition":
{
"example":
{
"title":"",
"description":""
}
}
},
"phoneringtest":
{
"label":
{
"title":"test the internet phone",
"service":"internet phone status",
"number":"phone number:",
"nonumber":"no phone number",
"unknownnumber":"phone number unavailable"
},
"info":
{
"comment":"to verify phone connected to your Livebox functionning click on \"test\" button."
}
},
"phoneringtestrunning":
{
"label":
{
"title":"internet phone test"
},
"info":
{
"comment":"the test of the internet phone connected to your Livebox is in progress.<br/><br/>if the phone rings, it is correctly connected and available. Clic on \"back\" button.<br/><br/>if the phone does not ring, it might be not correctly plugged. Please verify and click \"start again\"."
}
},
"restartreset":
{
"label":
{
"title":"reboot the Livebox"
},
"restart":
{
"label":
{
"title":"reboot the Livebox",
"subtitle":"you can reboot the Livebox by clicking the button \"reboot\"",
"warning":"warning !"
},
"info":
{
"comment":"during the Livebox boot, all services (internet, phone and TV) will be unavailable.",
"question":"are you sure ?"
}
},
"reset":
{
"label":
{
"title":"reset the Livebox",
"subtitle":"you can reset the Livebox by clicking on \"factory reset\". This service erases your personal parameters ( identifiers, NAT rules, dynDNS…)",
"warning":"warning !"
},
"info":
{
"comment":"Your personal parameters will be erased. Save them by <a href=\'http://livebox/supportSaveAndRestore.html\' >clicking here</a>",
"question":"are you sure ?"
}
}
},
"systeminformation":
{
"general":
{
"label":
{
"title":"general",
"status":
{
"connected":"connected",
"synchronized":"synchronized",
"disconnected":"disconnected",
"unconfigured":"not configured",
"authenticating":"authenticating",
"connecting":"connecting",
"up":"on",
"down":"off",
"unavailable":"unavailable",
"initializing":"initializing",
"listening":"listening"
},
"nbmanufacturer":"1.1",
"manufacturer":"manufacturer",
"nbmodel":"1.2",
"model":"model name",
"nbcountry":"1.3",
"country":"country",
"nbserialnumber":"1.4",
"serialnumber":"serial number",
"nbfirmwareversion":"1.5",
"firmwareversion":"SoftAtHome firmware version",
"softathome":"SoftAtHome",
"nbfirmwareversionft":"1.6",
"firmwareversionft":"orange firmware version",
"nbdeviceuptime":"1.7",
"deviceuptime":"uptime",
"nbsynchrostatus":"1.8",
"synchrostatus":"synchronization status",
"nbadsllinkstatus":"1.9",
"adsllinkstatus":"ADSL status",
"nbaccountstatus":"1.10",
"accountstatus":"account status",
"nbpppusername":"1.11",
"pppusername":"PPP login",
"nbwanip":"1.12",
"wanip":"WAN IP address",
"nbbasip":"1.13",
"basip":"BAS IP address",
"nbdnsprimary":"1.14",
"dnsprimary":"primary DNS IP",
"nbdnssecondary":"1.15",
"dnssecondary":"secondary DNS IP"
}
},
"adsl":
{
"label":
{
"title":"ADSL",
"technical":"technical characteristics",
"status":
{
"up":"on",
"down":"off",
"initializing":"Initializing",
"unavailable":"Unavailable"
},
"nbadsllinkstatus":"2.1",
"adsllinkstatus":"ADSL link status",
"nbwanmacaddress":"2.2",
"wanmacaddress":"MAC address",
"nbsynchrostatus":"2.3",
"synchrostatus":"synchronization status",
"nbadslsynchrolast":"2.4",
"adslsynchrolast":"ADSL last synchronization",
"nbadslsynchroduration":"2.5",
"adslsynchroduration":"ADSL synchronization uptime",
"nbpppconnectionstatus":"2.6",
"pppconnectionstatus":"PPP status",
"nbpppaccountstatus":"2.7",
"pppaccountstatus":"account status",
"nbpppusername":"2.8",
"pppusername":"PPP login",
"nbpppauthentificationmode":"2.9",
"pppauthentificationmode":"PPP authentication mode",
"nbpppconnectionlast":"2.10",
"pppconnectionlast":"PPP last connection",
"nbpppconnectionduration":"2.11",
"pppconnectionduration":"PPP connection uptime",
"nbpppprotocoltype":"2.12",
"pppprotocoltype":"PPP protocol",
"nbpppconnectionlasterror":"2.13",
"pppconnectionlasterror":"PPP errors last connection",
"nbpppconnectionlastdisconnect":"2.14",
"pppconnectionlastdisconnect":"PPP last connection date",
"nbatmvpvc":"2.15",
"atmvpvc":"ATM VP/VC",
"nbadslmode":"2.16",
"adslmode":"mode",
"nbencapsulation":"2.17",
"encapsulation":"encapsulation",
"nbdatapath":"2.18",
"datapath":"",
"nbmtu":"2.19",
"mtu":"MTU",
"nbwanip":"2.20",
"wanip":"WAN IP address",
"nbbasip":"2.21",
"basip":"BAS IP address",
"nbdnsprimary":"2.22",
"dnsprimary":"primary DNS",
"nbdnssecondary":"2.23",
"dnssecondary":"secondary DNS",
"nbattenuationup":"1.16",
"attenuationup":"attenuation up",
"nbattenuationdown":"1.17",
"attenuationdown":"attenuation down",
"nbnoisemarginup":"1.18",
"noisemarginup":"noise margin up",
"nbnoisemargindown":"1.19",
"noisemargindown":"noise margin down",
"nbmaxrateup":"1.20",
"maxrateup":"maximum upload rate",
"nbmaxratedown":"1.21",
"maxratedown":"maximum download rate",
"nbatmrateup":"1.22",
"atmrateup":"synchronization up",
"nbatmratedown":"1.23",
"atmratedown":"synchronization down",
"nbpowerupstream":"1.24",
"powerupstream":"power stream up",
"nbpowerdownstream":"1.25",
"powerdownstream":"power stream down",
"nbblocksreceived":"1.26",
"blocksreceived":"packets received",
"nbblockstransmitted":"1.27",
"blockstransmitted":"packets transmitted",
"nberrorslof":"1.28",
"errorslof":"packets lost",
"nblinkretrain":"1.29",
"linkretrain":"link retrain",
"nberrorsfec":"1.30",
"errorsfec":"FEC errors (up/down)",
"nberrorshec":"1.31",
"errorshec":"HEC errors (up/down)",
"nberrorscrc":"1.32",
"errorscrc":"CRC errors (up/down)"
},
"3g":
{
"label":
{
"status":"",
"linkstatus":"",
"operator":"",
"network":"",
"wanipaddress":"",
"maxrateup":"",
"maxratedown":""
}
}
},
"wifi":
{
"label":
{
"title":"WiFi",
"status":
{
"up":"on",
"down":"off",
"enabled":"on",
"disabled":"off"
},
"nbcurstatus":"3.1",
"curstatus":"WiFi status",
"nblinkstatus":"3.2",
"linkstatus":"status",
"nbmacaddress":"3.3",
"macaddress":"WiFi MAC address",
"nbssid":"3.4",
"ssid":"SSID",
"nbchannel":"3.5",
"channel":"channel",
"nbstandard":"3.6",
"standard":"standard",
"nbmaxbitrate":"3.7",
"maxbitrate":"maximum speed",
"nbencryption":"3.8",
"encryption":"security",
"nbencryptionoptio":"3.9",
"encryptionoption":"security option",
"nbmacaccesslist":"3.10",
"macaccesslist":"MAC filtering",
"nbbytessent":"3.11",
"bytessent":"bytes send",
"nbbytesreceived":"3.12",
"bytesreceived":"bytes receive"
}
},
"lan":
{
"label":
{
"title":"LAN",
"yes":"yes",
"no":"no",
"auto":"auto",
"status":
{
"enabled":"on",
"disabled":"off"
}
},
"status":
{
"link":"link",
"nolink":"no link"
},
"mode":
{
"InternetTV":"internet &amp; TV",
"internet":"internet",
"tv":"TV",
"internetONT":"FTTH",
"disable":"off"
},
"dhcp":
{
"label":
{
"nbstatus":"4.1",
"status":"DHCP status",
"nbstartip":"4.2",
"startip":"start IP address",
"nbendip":"4.3",
"endip":"end IP address",
"nbnetmask":"4.4",
"netmask":"subnet mask",
"nbleasetime":"4.5",
"leasetime":"DHCP lease time",
"nbgateway":"4.6",
"gateway":"DHCP gateway",
"nbmac":"4.7",
"mac":"MAC address"
}
},
"red":
{
"label":
{
"title":"red ethernet port",
"nbmode":"4.8",
"mode":"mode",
"nbenabled":"4.9",
"enabled":"status",
"nbstatus":"4.10",
"status":"status",
"nbautoconfig":"4.11",
"autoconfig":"auto configuration",
"nbmacaddress":"4.12",
"macaddress":"MAC address",
"nbmaxbitrate":"4.13",
"maxbitrate":"maximum speed",
"nbduplexmode":"4.14",
"duplexmode":"duplex mode"
}
},
"yellow":
{
"label":
{
"title":"yellow ethernet port",
"nbmode":"4.15",
"mode":"mode",
"nbenabled":"4.16",
"enabled":"status",
"nbstatus":"4.17",
"status":"status",
"nbautoconfig":"4.18",
"autoconfig":"auto configuration",
"nbmacaddress":"4.19",
"macaddress":"MAC address",
"nbmaxbitrate":"4.20",
"maxbitrate":"maximum speed",
"nbduplexmode":"4.21",
"duplexmode":"duplex mode"
}
},
"green":
{
"label":
{
"title":"green ethernet port",
"nbmode":"4.22",
"mode":"mode",
"nbenabled":"4.23",
"enabled":"status",
"nbstatus":"4.24",
"status":"status",
"nbautoconfig":"4.25",
"autoconfig":"auto configuration",
"nbmacaddress":"4.26",
"macaddress":"MAC address",
"nbmaxbitrate":"4.27",
"maxbitrate":"maximum speed",
"nbduplexmode":"4.28",
"duplexmode":"duplex mode"
}
},
"white":
{
"label":
{
"title":"white ethernet port",
"nbmode":"4.29",
"mode":"mode",
"nbenabled":"4.30",
"enabled":"status",
"nbstatus":"4.31",
"status":"status",
"nbautoconfig":"4.32",
"autoconfig":"auto configuration",
"nbmacaddress":"4.33",
"macaddress":"MAC address",
"nbmaxbitrate":"4.34",
"maxbitrate":"maximum speed",
"nbduplexmode":"4.35",
"duplexmode":"duplex mode"
}
}
},
"voip":
{
"label":
{
"title":"VoIP",
"available":"available",
"unavailable":"unavailable",
"status":
{
"up":"on",
"down":"off"
},
"nbcurstatus":"5.1",
"curstatus":"status",
"nbphonenumber":"5.2",
"phonenumber":"VoIP phone number",
"nbvpvc":"5.3",
"vpvc":"VP/VC used",
"nblinkstatus":"5.4",
"linkstatus":"link status",
"nbprotocol":"5.5",
"protocol":"protocol"
}
},
"usb":
{
"label":
{
"title":"USB"
},
"first":
{
"label":
{
"title":"USB 1",
"nblinkstatus":"6.1",
"linkstatus":"link status",
"nbfunc":"6.2",
"func":"function",
"nbvendorId":"6.3",
"vendorId":"vendor",
"nbmanufacturer":"6.4",
"manufacturer":"manufacturer",
"nbproductId":"6.5",
"productId":"version",
"nbproduct":"6.6",
"product":"product",
"nbserialNumber":"6.7",
"serialNumber":"serial number"
}
},
"second":
{
"label":
{
"title":"USB 2",
"nblinkstatus":"6.8",
"linkstatus":"link status",
"nbfunc":"6.9",
"func":"function",
"nbvendorId":"6.10",
"vendorId":"vendor",
"nbmanufacturer":"6.11",
"manufacturer":"manufacturer",
"nbproductId":"6.12",
"productId":"version",
"nbproduct":"6.13",
"product":"product",
"nbserialNumber":"6.14",
"serialNumber":"serial number"
}
},
"func":
{
"massstorage":"mass storage",
"printer":"printer",
"phone":"livephone",
"undefined":"undefined"
}
},
"tv":
{
"label":
{
"title":"TV",
"available":"available",
"unavailable":"unavailable",
"status":
{
"up":"on",
"down":"off"
}
},
"channel1":
{
"label":
{
"title":"channel 1",
"nbstatus":"7.1",
"status":"status",
"nbvpvc":"7.2",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.3",
"linkstatus":"link status"
}
},
"channel2":
{
"label":
{
"title":"channel 2",
"nbstatus":"7.4",
"status":"status",
"nbvpvc":"7.5",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.6",
"linkstatus":"link status"
}
},
"vod":
{
"label":
{
"title":"VoD",
"nbstatus":"7.7",
"status":"status",
"nbvpvc":"7.8",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.9",
"linkstatus":"link status"
}
},
"zapping":
{
"label":
{
"title":"zapping",
"nbstatus":"7.10",
"status":"status",
"nbvpvc":"7.11",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.12",
"linkstatus":"link status"
}
}
},
"ftth":
{
"label":
{
"title":"FTTH",
"technical":"technical requirements",
"status":
{
"up":"",
"down":"",
"initializing":"Initializing",
"unavailable":"Unavailable"
},
"nbadsllinkstatus":"2.1",
"adsllinkstatus":"FTTH link status",
"nbwanmacaddress":"2.2",
"wanmacaddress":"WAN MAC address",
"nbsynchrostatus":"2.3",
"synchrostatus":"synchronization status",
"nbadslsynchrolast":"2.4",
"adslsynchrolast":"FTTH last synchronization",
"nbadslsynchroduration":"2.5",
"adslsynchroduration":"FTTH synchronization uptime",
"nbpppconnectionstatus":"2.6",
"pppconnectionstatus":"PPP status",
"nbpppaccountstatus":"2.7",
"pppaccountstatus":"account status",
"nbpppusername":"2.8",
"pppusername":"PPP login",
"nbpppauthentificationmode":"2.9",
"pppauthentificationmode":"PPP authentication mode",
"nbpppconnectionlast":"2.10",
"pppconnectionlast":"PPP last connection",
"nbpppconnectionduration":"2.11",
"pppconnectionduration":"PPP uptime",
"nbpppprotocoltype":"2.12",
"pppprotocoltype":"PPP protocol",
"nbpppconnectionlasterror":"2.13",
"pppconnectionlasterror":"PPP last connection error",
"nbpppconnectionlastdisconnect":"2.14",
"pppconnectionlastdisconnect":"PPP last connection date",
"nbatmvpvc":"2.15",
"atmvpvc":"ATM VP/VC",
"nbadslmode":"2.16",
"adslmode":"mode",
"nbencapsulation":"2.17",
"encapsulation":"encapsulation",
"nbdatapath":"2.18",
"datapath":"data path",
"nbmtu":"2.19",
"mtu":"MTU",
"nbwanip":"2.20",
"wanip":"WAN IP address",
"nbbasip":"2.21",
"basip":"BAS IP address",
"nbdnsprimary":"2.22",
"dnsprimary":"primary DNS",
"nbdnssecondary":"2.23",
"dnssecondary":"secondary DNS",
"nbattenuationup":"1.16",
"attenuationup":"attenuation up",
"nbattenuationdown":"1.17",
"attenuationdown":"attenuation down",
"nbnoisemarginup":"1.18",
"noisemarginup":"noise margin up",
"nbnoisemargindown":"1.19",
"noisemargindown":"noise margin down",
"nbmaxrateup":"1.20",
"maxrateup":"maximum upload rate",
"nbmaxratedown":"1.21",
"maxratedown":"maximum download rate",
"nbatmrateup":"1.22",
"atmrateup":"synchronization up",
"nbatmratedown":"1.23",
"atmratedown":"synchronization down",
"nbpowerupstream":"1.24",
"powerupstream":"power stream up",
"nbpowerdownstream":"1.25",
"powerdownstream":"power stream down",
"nbblocksreceived":"1.26",
"blocksreceived":"packets received",
"nbblockstransmitted":"1.27",
"blockstransmitted":"packets transmitted",
"nberrorslof":"1.28",
"errorslof":"packets lost",
"nblinkretrain":"1.29",
"linkretrain":"link retrain",
"nberrorsfec":"1.30",
"errorsfec":"FEC errors (up/down)",
"nberrorshec":"1.31",
"errorshec":"HEC errors (up/down)",
"nberrorscrc":"1.32",
"errorscrc":"CRC errors (up/down)"
},
"3g":
{
"label":
{
"status":"",
"linkstatus":"",
"operator":"",
"network":"",
"wanipaddress":"",
"maxrateup":"",
"maxratedown":""
}
}
}
},
"firmwareupgrade":
{
"label":
{
"title":"firmware update",
"subtitle":"to update the firmware, click on the button \"find a new version\"",
"version":"current firmware:",
"softathome":"SoftAtHome",
"duringsearch":"Please wait while searching a new firmware...",
"nofirmavailable":"There is no new version of the firmware available",
"whileupgrading":"a firmware upgrade is in progess. During this process, the blue led of your Livebox will blink during 15mn. When it will be finish, your Livebox will reboot automaticaly.<br/><br/><br/>please do not switch off your Livebox or disconnect the ADSL link during the blue led blinking. this upgrade can\'t be stopped.<br/><br/><br/>after the upgrade, you will use some new Livebox functions<br/><br/><br/>please, do not switch off your Livebox during the upgrade. if you have any problems, please contact the technical support.<br/><br/>"
},
"text":
{
"help1":"<h6>the firmware can be updated remotely by orange for new services</h6>if an update is available, the download will be automatic and the blue led will blink.<h6>Please do not switch off Livebox or disconnect ADSL cable during upgrade</h6>",
"help2":"<h6>Firmware error upgrade</h6> an error occured during upgrade procedure. Push on/off button on Livebox and wait Livebox restart. If problem is still present, unplug and replug power supply.",
"helpbesearch":"<p>If a new frimware version is available, your Livebox will become unavailable during the upgrade process.</p><p>To avoid any risk to damage the Livebox, please do not turn off or unplug the power supply before the upgrade end.</p><p>Do you want to upgrade your Livebox now?</p>"
},
"info":
{
"question":"are you sure ?"
}
},
"saveandrestore":
{
"label":
{
"title":"save and restore the configuration",
"subtitle":"to save the Livebox configuration (login, password, NAT rules, dynDNS …) in a local file, click on the button \"save\".",
"restore":
{
"stependmsg":"<p>The restoration is in progress. Your Livebox will reboot automatically. Please wait for few minutes…</p><p>Once the restoration is terminated, you will be able to surf on Internet.</p><p>If you want to access again to the interface, type livebox in your browser address bar.</p><p>In case of Livebox exchange:<br/>The WiFi settings to use to connect again by WiFi are those of the previous Livebox (Network name (SSID) and security key).<br/>The already connected devices of the previous Livebox will be connected themselves automatically.</p>"
}
},
"info":
{
"comment":"to restore the Livebox configuration, choose the restore file whith the \"browse\" button and clic on button \"restore\"."
}
},
"saverestore":
{
"nofile":
{
"error":
{
"label":"error",
"description":"no file to restore"
}
},
"upload":
{
"error":
{
"label":"error",
"description":"invalid file"
}
}
},
"remoteaccess":
{
"label":
{
"title":"user remote access",
"subtitle":"you can remotly access to the Livebox settings interface. For easier access, you can configure the dynDNS service.",
"here":"here",
"enable":"&nbsp;enable the user remote access",
"youripaddress":"your current IP address:",
"yoururl":"your current URL is:"
},
"login":
{
"error":
{
"label":"not correct",
"description":"login not correct"
}
},
"password":
{
"error":
{
"label":"not correct",
"description":"password not correct"
}
},
"port":
{
"error":
{
"label":"not correct",
"description":"port number not correct"
}
},
"info":
{
"comment":"after clicking on \"save\", the URL which allows you to have a remote access will be displayed."
},
"text":
{
"help":"<h6>you can configure a remote access from internet to the Livebox settings.</span></h6><br/>you must enter a login and password to access to the Livebox. Remember them because they will be required to access remotely to the Livebox interface.<br/><br/>your login can\'t be more than 32 characters. your password must have 8 characters minimum with a number and a special character</span><br/><br/>the port number is by default 10000 but you can change it with a port betwwen 10000 and 30000."
},
"definition":
{
"example":
{
"title":"",
"description":""
}
},
"authentication":
{
"label":
{
"title":"authentication",
"subtitle":"enter your remote access login and password",
"login":"login",
"password":"password",
"warning":"remote access to the Livebox"
},
"error":
{
"title":"login and/or password not correct",
"description":"verify that your login and password are correct"
}
}
},
"hotline":
{
"label":
{
"title":"customer support remote access",
"subtitle":"you can give temporaly an access to the customer support",
"duration":
{
"title":"time for remote access",
"first":"0 mn",
"second":"5 min",
"third":"10 min",
"fourth":"15 min"
}
},
"info":
{
"comment":"information required for remote access"
},
"text":
{
"help":"for any support, the temporary acces allows the customer support to access to your Livebox during 15mn.<br/><br/>to start remote access for customer support, click on \"start\" button. The settings will be displayed. You can give them to the support.<br/> <br/>To deactivate remote access to customer support, click on \"stop\" button."
}
}
},
"advconfig":
{
"wifi":
{
"label":
{
"title":"WiFi",
"subtitle":"advanced WiFi settings",
"state":"WiFi status",
"ssid":"WiFi name (SSID)",
"broadcast":"broadcast SSID",
"securitymode":"seurity mode",
"securitykey":"security key",
"nosecurity":"No security",
"channel":"channel",
"channelused":"utilised channel",
"pairingtitle":"Connect your devices by WiFi",
"easypairing":"easy WiFi",
"macfiltering":"MAC filtering",
"devicesauthorised":"devices allowed to connect by WiFi",
"name":"name",
"ipadress":"IP address",
"macaddress":"MAC address",
"editnewmac":"new…",
"unknownmac":"unknown",
"wifipushbutton":"WiFi Protected Setup (WPS) Push Button",
"wifipairing":"generate a Livebox WPS Pin Code",
"addclientpush":"connect a device by WPS Push Button",
"addclientpin":"Type PIN code of WPS equipment",
"info":
{
"disable":"enable Wifi to take advantage of Wifi advanced settings"
}
},
"link":
{
"scheduling":"define WiFi scheduling",
"ssid":"modify",
"securitykey":"modify"
},
"text":
{
"help":"<h6>security mode</h6><h6>- no security</h6>your WiFi network is open ( non recommanded mode<h6>- WEP</h6>A 26 hexadecimal characters key is used. Do not allow WiFi n use but only WiFi b/g<h6>- WPA-PSK (TKIP)</h6>key must contain at least 8 characters ( alphanumerical and special characters). Do not alllow WiFin use but only WiFi b/g<br/><h6>- WPA2-PSK (AES)</h6>key must contain at least 8 characters ( alphanumerical and special characters). <h6>- WPA/WPA2 Mixed</h6>key must contain at least 8 characters ( alphanumerical and special characters). Default mode selecting the best mode for your device<br/><br/><h6>-Easy WiFi</h6>This option allows to connect a computer with installation kit by pushing the WiFi button in front of the Livebox<br/><br/><h6>- WiFi Protected SetUp (WPS) Push Button</h6>Activation of recommanded method to connect WPS certified devices<br/><h6>Generate Livebox PIN code </h6>If you activate this option, by pushing on generate button, you get a Livebox PIN code. Type it on the WPS certified device you wish to connect.<br/><h6>Connect a device by WPSPushButton</h6>Push on \"connect\" button ( or briefly on the WiFi button in front of the Livebox) then on the WPS button of your device.<br/><h6>Type WPS PIN code of your device</h6> PIN code is available on your device ( generated or on a sticker). Type it here and click on add to connect it<br/><br/><h6>MAC filtering</h6>When enabling MAC filtering, if you wish to connect a new device to your Livebox, you have to press WiFi button on your Livebox. If MAC filtering is disabled (default case), then any wireless device knowing security key can connect to your Livebox."
},
"definition":
{
"example":
{
"title":"",
"description":""
}
},
"error":
{
"wepkey":"invalid key. Must contain 26 characters",
"presharedkey":"Invalid key. Must contain between 8 and 63 characters",
"ssid":"Invalid SSID",
"moden":"WiFi N is not available with this security mode",
"macaddress":"Invalid MAC address",
"wpsclientpin":"Invalid Client Pin Code"
},
"general":
{
"info":
{
"wificom":"If you deactivate WiFi on the Livebox, the mode Orange wifi will not be available. Would you like to continue ?"
}
},
"securitykey":
{
"label":
{
"title":"security key",
"subtitle":"you can modify the security key"
},
"description":"enter the new security key",
"info":
{
"comment":"26 hexadecimals characters if using WEP<br/>between 8 and 63 characters if using WPA/WPA2"
},
"error":
{
"wep":"wrong WEP key. It must contains a string of 26 Hexadecimal characters (0-9 and A-F).",
"wpa":"wrong WPA passphrase. It must be longer than 8 characters."
}
}
},
"firewalladv":
{
"label":
{
"title":"firewall",
"subtitle":"firewall customization<br/><br/>on this page you can add customized filtering rules. for novice users, it is recommended to use one of the security levels predefined on the previous page. a bad firewall configuration may prevent you from accessing to the internet service.",
"ping":"the ping respond option allows the Livebox to respond to ping request. option activated by default.",
"pinganswer":"respond to ping",
"reinit":"reset the firewall rules (back to rule define in the high level)",
"personalrules":"customized rules",
"application":"application / service",
"source":"source<br/>IP<br/>address",
"mask":"IP<br/>mask<br/>address",
"sourceport":"source port",
"destination":"destination<br/>IP<br/>address",
"destinationport":"destination port",
"action":"action",
"order":"order",
"staticip":"static IP address",
"protocol":"protocol",
"accept":"accept",
"drop":"drop",
"editnewrule":"new…",
"bothprotocol":"both"
},
"error":
{
"description":"invalide description",
"sourceip":"bad source ip address",
"sourceipmask":"bad source ip mask",
"sourceport":"wrong source port. It should be a value between 1 to 65535",
"sourcerange":"wrong source port. It should be a value between 1 to 65535",
"destip":"bad destination ip address",
"destipmask":"bad Destination ip mask",
"destport":"wrong destination port. It should be a value between 1 to 65535",
"destrange":"wrong destination port. It should be a value between 1 to 65535"
},
"tooltip":
{
"sourceport":"enter a port value or a port range (ex: 200-300)",
"destinationport":"enter a port value or a port range (ex: 200-300)"
}
},
"firewall":
{
"label":
{
"title":"firewall",
"subtitle":"configure the firewall.<br/><br/>you can configure the protection level of the livebox. The level by default (medium) is enough and recommanded",
"offer":"choose the security level",
"low":"low",
"medium":"medium",
"high":"high",
"customize":"customize",
"warn":"Applications (ex: LiveMessenger, peer-to-peer applications, games) relying on the NAT-traversal facilities provided by UPnP IGD will not work properly any more."
},
"description":
{
"low":"The firewall does not filter anything. Be careful, this level is reserved to advanced users to whom security is not a priority. Note also that even in this mode, a connection iniated from Internet will not be permitted if a NAT/PAT rule is not created on purpose.",
"medium":"The firewall drops all entering connections. Outcoming traffic is allowed except Netbios services. This mode is the recommended one.",
"high":"The firewall allows the exit of standard services (www,ftp,mail,news,...) and drops unexpected entering connections. This setting is recommended to have a maximal security level. Warning : incompatible with Unik and other services.",
"customize":"This profile allows you to customize your firewall. Thus, you can define some specific filtering rules. (Reserved to expert users)."
}
},
"network":
{
"natpat":
{
"label":
{
"title":"network",
"tab":"NAT/PAT",
"setup":"NAT/PAT settings",
"description":"NAT/PAT settings",
"info":"these rules are needed to authorise a remote communication from internet to reach a specific device of your LAN. you can also define the ports(s) that this communication will use.",
"warning":"warning : make sure you have not filtered these ports in the firewall.",
"personaltunes":"customize rules",
"application":"<b>application / service</b>",
"internalport":"<b>internal<br/>port</b>",
"externalport":"<b>external<br/>port</b>",
"protocol":"<b>protocol</b>",
"device":"<b>device</b>",
"bothprotocol":"both",
"editnewline":"new…",
"editnewhost":"new…",
"error":"fields shoud not be empty",
"error1":"bad port number or range.",
"error2":"port value is reserved for internal use",
"error3":"rule already exists",
"error4":"the new rule conflicts with previous one",
"error5":"new rule conflicts with a UPnP rule",
"error6":"Invalid IP address or IP address ouside of the Livebox network"
},
"text":
{
"help":"<h6>What is NAT/PAT ?</h6><br/>some applications require to open specific ports to have a correct funcitonning. It can be some on line games, FTP server, SSH, web...<br/><br/>to allow communication between your device and the distant server or client you must enter a NAT rule specifying the type of application, internal ( local network) and external (internet) ports, protocols and device receiving information."
},
"tooltip":
{
"externalport":"(ex:1000-2000)",
"internalport":"(ex:1000)"
}
},
"dhcp":
{
"label":
{
"title":"network",
"subtitle":"the DHCP server of the Livebox allows to attribute an IP address to each device connected to your local network",
"tab":"DHCP",
"editnewlease":"new…",
"setup":"DHCP settings",
"server":"DHCP server",
"liveboxip":"Livebox IP address",
"mask":"LAN subnet mask",
"startip":"start IP address",
"endip":"end IP address",
"info":"you can see the dynamic IP addresses allocated by the DHCP server",
"dynamicip":"dynamic IP address",
"name":"name",
"ip":"IP address",
"macaddress":"MAC address",
"delete":"delete",
"staticip":"static IP address"
},
"info":
{
"comment":"you can book a static IP address to each device of you local network. The device will always have the same IP address"
},
"error":
{
"empty":
{
"label":"error",
"description":"empty field"
},
"withinsubnet":"IP Address should be within the subnetwork",
"withinrange":"IP Address should be within the DHCP range",
"reservedip":"This is a reserved IP Address",
"limitedipaddress":"IP Address should be between Min IP Address and Max IP Address",
"macaddress":"Bad MAC Address",
"subnetMask":"Bad SubnetMask",
"ipaddress":
{
"bad":"bad IP address",
"maxAddress":"Bad End IP address",
"minAddress":"Bad Start IP address",
"device":"Modification impossible due to connected devices"
},
"usedmacaddress":"MAC address already used",
"usedipaddress":"IP address already used",
"conflict":
{
"subnet192168128":"current subnetwork is in conflict with 192.168.128.0/24 reserved subnetwork",
"subnet192168002":"current subnetwork is in conflict with 192.168.2.0/24 reserved subnetwork"
},
"outofrangestaticip":"At least one static IP address is out of DHCP range defined. Please modify the DHCP range or delete the device defined in the static IP address list."
}
},
"dns":
{
"label":
{
"title":"network",
"subtitle":"the DNS server is here to convert domain name in IP address.",
"tab":"DNS",
"setup":"DNS settings",
"primary":"primary DNS",
"secondary":"secondary DNS",
"info":"you can see all the devices of your local network",
"localnetwork":"local network devices",
"name":"name",
"dnsname":"DNS name",
"ipaddress":"IP address"
},
"text":
{
"help":"<h6>DNS</h6>lthe orange DNS servers are configured by default and can not be modify on the Livebox<br/><h6>DNS name in the local network</h6>you can give a name to each device to facilitate their research if you need."
},
"error":
{
"empty":
{
"description":"empty value"
},
"length":
{
"description":"value limited to 64 characters"
},
"invalid":
{
"description":"Invalid device name"
}
}
},
"upnp":
{
"label":
{
"title":"network",
"subtitle":"UPnP IGD allows applications to open automatically and forward ports of the access point (useful for instant messaging, online gaming ...).",
"tab":"UPnP",
"setup":"UPnP settings",
"info":"&nbsp;enable UPnP IGD",
"table":"UPnP IGD rules table",
"application":"application/service",
"externport":"external port",
"internport":"internal port",
"protocol":"protocol",
"nameadress":"name / IP address",
"hostipaddress":"host IP address"
},
"warning":"applications that created some NAT rules with UPnP IGD can\'t work correctly",
"text":
{
"help":"<h6>enable UPnP IGD</h6>UPnP IGD is enabled by default. you can disable it if you want to avoid forwarding ports created automatically by applications.<br/><br/><h6>if you want to disable/enable this service,</h6>do not forget to click \"save\" button."
}
},
"dyndns":
{
"label":
{
"title":"network",
"subtitle":"This page enables you to configure the DynDNS service. Use a DynDNS to map a static or dynamic IP address or long URL to an easy to remember subdomain such as mydomain.dyndns.org. Thus you will be able to access to your server on your LAN.",
"tab":"DynDNS",
"info":"using DynDNS can be useful if you host a web site, ftp server or any type of server behind the Livebox. You can find it easily with a name like thisiscool.dyndns.org",
"setup":"DynDNS settings",
"localnetwork":"",
"hostname":"full host<br/>name",
"username":"user name<br/>email",
"lastupdate":"last update",
"service":"service",
"none":"none"
},
"text":
{
"help":"<h6>service</h6>choose your DynDNS name provider.<br/><br/><h6>host name</h6>choose your domain name.<br/><br/><h6>identifier/e-mail</h6> type user name of your DynDNS account.<br/><br/><h6>password</h6>type your DynDNS account password<br/>"
},
"error":"invalid dynDNS server",
"errorduplicate":"hostname already configured on another service"
},
"dmz":
{
"label":
{
"title":"network",
"subtitle":"This page enables you to configure a DMZ on a computer. This computer can be reachable from the Internet.",
"tab":"DMZ",
"setup":"DMZ settings",
"info":"computer DMZ settings",
"dmz":"DMZ",
"name":"name",
"ip":"IP address",
"macaddress":"MAC address",
"warning":"you need to associate a static IP address with this device on the DHCP settings",
"current":"current DMZ is:",
"nodmz":"no DMZ",
"staticip":"statique address…"
},
"text":
{
"help":"<h6>DMZ configuration</h6>all computer ports will be accessible from internet and rerouted toward computer IP address. <br/><br/>in order to set up a DMZ on your computer, you must associate a static IP address to this computer on the DHCP page. <br/>"
},
"error":
{
"ipaddress":
{
"bad":"Bad IP Address"
}
}
},
"ntp":
{
"label":
{
"title":"network",
"subtitle":"configure time zone for the Livebox",
"tab":"NTP",
"currentdate":"current date",
"timezone":"choose time zone"
}
}
},
"ports":
{
"label":
{
"title":"ports settings",
"subtitle":"ethernet settings or TV",
"fullrouted":"I don\'t have orange set top box<br />or I have one orange set top box",
"bridged":"I have more than one orange set top box",
"bridged2":"I have more than one internet set top box",
"fullrouted2":"I have no set top box or one set top box<br/>( internet TV or satellite TV)",
"info":"I can connect my devices to internet and my 2 set top boxes to the eternet ports:",
"liveboxports":"Livebox ports",
"computers":"computers",
"stb":"set top box",
"sat":"Satellite TV",
"iptv":"Internet TV",
"iptv1":"Internet TV 1",
"iptv2":"Internet TV 2",
"ftth":"FTTH",
"automatic":
{
"mode":"Automatically"
},
"manually":
{
"mode":"Manually",
"bridged":"Bridged",
"routed":"Routed",
"disabled":"Disabled"
}
},
"info":
{
"comment":"if you have 2 set top boxes, you can not use the \"multimedia access\" to the the Livebox ans set top box"
},
"text":
{
"help":"<h6>orange TV</h6>it\'s exclusive channels, video on deman, catch up TV and more !"
}
},
"accesstype":
{
"label":
{
"title":"internet connection",
"subtitle":"",
"offer":"choose the offer you subscribed",
"howtoinstall":"enter your login and your connection password",
"login":"connection login",
"password":"connection password",
"warning":
{
"fr":"your login and password are available in the welcome letter",
"pl":"your login and password were generated in registration process",
"mini_fr":"your login and password are available in the welcome letter"
}
},
"offer":
{
"adsl":
{
"radiobutton":"ADSL"
},
"fiber":
{
"radiobutton":"The fiber"
}
},
"error":
{
"label":"login and/or password not correct",
"description":"verify that your login and password are correct",
"orange":
{
"label":"warning",
"description":"you can not modify your internet connection settings while \"Orange WiFi\" service is activated"
},
"empty":
{
"label":"login and/or password not correct",
"description":"verify that your login and password are correct"
},
"running":
{
"label":"authentication",
"description":"authentication in progress"
},
"adsl_link":
{
"label":"ADSL error",
"description":"ADSL not synchronized"
},
"ftth_link":
{
"label":"FTTH error",
"description":"FTTH connexion not available"
},
"ppp_server":
{
"label":"PPP error",
"description":"failed to connect to PPP server"
},
"authentication":
{
"label":"error",
"description":"authentication error"
},
"ppp_timeout":
{
"label":"PPP error",
"description":"no response from PPP server"
},
"restart":
{
"label":"authentication",
"description":"authentication in progress"
}
},
"connected":
{
"label":"connected",
"description":"connected"
},
"text":
{
"help":
{
"fr":"<h6>connection type</h6>your Livebox can work on ADSL network and fiber network. only one connexion mode is available at the same time<br/><br/><h6>connection login</h6>this login allows orange to authenticate you as customer and benefit of internet access. it start by fti/ (ex: fti/abcdef12). keep it safe, it could be usefull if you need to configure again your connection.<br/><br/><h6>connection password</h6>your connection login, it\'s the key to access to internet.",
"pl":"<h6>connection type</h6>your Livebox can work on ADSL network and fiber network. only one connexion mode is available at the same time<br/><br/><h6>connection login</h6>this login allows network to authenticate you as customer and benefit an internet access. keep it safe, it could be usefull if you need to configure again your connection.<br/><br/><h6>connection password</h6>your connection password, it\'s the key to access to internet.",
"mini_fr":"<h6>connection type</h6>your Livebox can work on ADSL network and fiber network. only one connexion mode is available at the same time<br/><br/><h6>connection login</h6>this login allows orange to authenticate you as customer and benefist an internet access. it start by fti/ (ex: fti/abcdef12). keep it safe, it could be usefull if you need to configure again your connection.<br/><br/><h6>connection password</h6>your connection login, it\'s the key to access to internet."
}
}
},
"admin":
{
"label":
{
"title":"administration",
"subtitle":"change the Livebox administration password",
"info":"administration account: admin",
"password":"current password:",
"newpassword":"new password:",
"confirmnewpassword":"confirm the new password:",
"passwordmodified":"your password has been modified"
},
"text":
{
"help":"<h6>Livebox administration account</h6>the account login can\'t be modify.<h6>Livebox administration password</h6>the Livebox administration password allow you to authenticate to your Livebox. It will be asked each time you connect to the pages settings, support and advanced settings."
},
"error":
{
"label":
{
"currentpassword":"error",
"newpassword":"error",
"confirmnewpassword":"error"
},
"description":
{
"currentpassword":"password not valid",
"newpassword":"Password not valid. Must contains between 4 and 32 characters",
"confirmnewpassword":"Passwords are differents",
"success":"password changed successfully",
"empty":"empty password"
}
}
},
"fxo":
{
"label":
{
"title":"phone line configuration",
"subtitle":"If phone line is configured as activated, you can receive and make calls using your fix line number on the telephone connected to the livebox. In case it is deactivated, only internet line phone calls can be received and initialized via the telephone connected to the livebox.",
"activated":"activated",
"deactivated":"deactivated"
}
}
},
"rescuefirmware":
{
"label":
{
"title":"rescue firmware",
"subtitle":"a firmware upgrade is in progress. Time is approximatly between 5 to 15mn. During this time you can\'t access to internet. At the end, your Livebox reboot automatically.",
"offer":"select the offer you subscribed",
"howtoinstall":"enter your connection login and your password",
"login":"login",
"password":"password",
"warning":"your login and password are available in the welcome letter"
},
"offer":
{
"radiobutton":
{
"adsl":"ADSL",
"fiber":"La fibre"
}
},
"error":
{
"label":"warning",
"description":"do not switch off your Livebox during a firmware upgrade"
}
},
"firmwareupgrade":
{
"label":
{
"title":"rescue firmware",
"subtitle":"a firmware upgrade is in progess. During this process, the blue led of your Livebox will blink during 15mn. When it will be finish, your Livebox will reboot automaticaly.<br/><br/><br/>please do not switch off your Livebox or disconnect the ADSL link during the blue led blinking. this upgrade can\'t be stopped.<br/><br/><br/>after the upgrade, you will use some new Livebox functions<br/><br/><br/>please, do not switch off your Livebox during the upgrade. if you have any problems, please contact the technical support.<br/><br/>"
}
},
"legal":
{
"label":
{
"title":"legal information",
"comment":"The Livebox home gateway uses free or open source licensed software, such as for example the Linux kernel, Busybox and Iptables software all published under the terms and conditions of the GNU General Public License (GNU GPL). The customer may consult the list of concerned software, their licenses and download their complete and corresponding source code on the following web site: <a href=\'http://www.livebox-floss.com\' target=\'_blank\'>http://www.livebox-floss.com</a>. For each version, such information will remain accessible as long as said version is available in the Livebox, and for the next three (3) years starting from the launch of a new software version or from the expiration of the availability of the said version via the Livebox. Prior to use one of these software available on the web site <a href=\'http://www.livebox-floss.com\' target=\'_blank\'>http://livebox-floss.com</a>, the customer shall acknowledge and accept the terms and conditions of the associated license. Furthermore, the customer acknowledges that these software packages are provided as is without any implied warranty in accordance with the provisions of the applicable license."
}
}
};
AllTranslations["fr"] =
{
"general":
{
"label":
{
"password":"mot de passe",
"login":"identifiant",
"internet":"internet",
"phone":"t&eacute;l&eacute;phonie",
"tv":"TV",
"info":"info",
"wifienable":"WiFi activ&eacute;",
"wifidisable":"WiFi d&eacute;sactiv&eacute;",
"available":"disponible",
"unavailable":"indisponible",
"nonsubscribe":"non souscrit",
"unmanaged":"inconnu",
"help":"aide",
"destroy":"supprimer",
"enable":"activer",
"disable":"d&eacute;sactiver",
"enabled":"activ&eacute;",
"disabled":"d&eacute;sactiv&eacute;",
"nodevices":"aucun appareil connect&eacute;",
"logout":"d&eacute;connexion",
"usbphone":"livephone",
"wifi":"WiFi",
"yes":"oui",
"no":"non",
"port":"port",
"ip":"adresse ip",
"url":"url",
"filename":"nom du fichier:",
"legalinfo":"informations l&eacute;gales",
"days":
{
"day":"jour",
"monday":"lundi",
"tuesday":"mardi",
"wednesday":"mercredi",
"thursday":"jeudi",
"friday":"vendredi",
"saturday":"samedi",
"sunday":"dimanche"
},
"months":
{
"january":"janvier",
"february":"f&eacute;vrier",
"march":"mars",
"april":"avril",
"may":"mai",
"june":"juin",
"july":"juillet",
"august":"ao&ucirc;t",
"september":"septembre",
"october":"octobre",
"november":"novembre",
"december":"d&eacute;cembre"
},
"vmenu":
{
"home":
{
"title":"ma page d\'accueil"
},
"config":
{
"title":"configuration",
"wireless":"r&eacute;seau sans fil",
"devices":"mes appareils"
},
"support":
{
"title":"assistance",
"livebox":"Livebox",
"hotline":"assistance avanc&eacute;e &amp;<br/> support client",
"systeminformation":"informations syst&egrave;me"
},
"advconfig":
{
"title":"configuration avanc&eacute;e",
"network":"r&eacute;seau"
}
}
},
"link":
{
"definitions":"&gt; d&eacute;finitions",
"legalinfo":"informations l&eacute;gales"
},
"btn":
{
"backup":"sauver",
"restore":"restaurer",
"reset":"remise à zéro",
"files":"accéder à mes fichiers",
"eject":"éjecter",
"refresh":"rafraichir",
"enable":"activer",
"disable":"désactiver",
"cancel":"annuler",
"save":"enregistrer",
"restart":"redémarrer",
"startagain":"redémarrer",
"test":"tester",
"findnewestversion":"rechercher une version plus récente",
"back":"retour",
"customize":"personnaliser",
"stop":"arrêter",
"start":"démarrer",
"interfaceaccess":
{
"fr":"accéder à orange.fr",
"pl":"",
"mini_fr":"accéder à orange.fr"
},
"interfaceaccessurl":
{
"fr":"http://www.orange.fr",
"pl":"",
"mini_fr":"http://www.orange.fr"
},
"extend":"prolonger",
"update":"actualiser",
"reinit":"relancer",
"scan":"scanner",
"add":"ajouter",
"ok":"ok",
"yes":"oui",
"no":"non",
"valid":"valider",
"generate":"générer",
"push":"connecter"
},
"country":
{
"france":"France",
"belgium":"Belgique",
"spain":"Espagne",
"unitedkingdom":"Royaume-Uni",
"netherland":"Pays-Bas",
"poland":"Pologne"
},
"device":
{
"Device1":"appareil 1",
"Device2":"appareil 2",
"Device3":"appareil 3",
"Device4":"appareil 4",
"Device5":"appareil 5",
"Device6":"appareil 6",
"Device7":"appareil 7",
"Device8":"appareil 8",
"Device9":"appareil 9"
}
},
"setup":
{
"accesstype":
{
"label":
{
"title":"connexion internet",
"subtitle":"vous vous connectez pour la premi&egrave;re fois &agrave; votre Livebox ou vous venez d\'effectuer une remise &agrave; z&eacute;ro ?<br/>cette page vous permet de configurer votre Livebox et d\'avoir acc&egrave;s &agrave; internet.",
"restore":
{
"linklabel":"Si vous disposez d’un fichier de sauvegarde de votre Livebox vous pouvez",
"link":"restaurer la configuration",
"title":"Restaurer ma Livebox",
"todomsg":"<p>Pour restaurer la configuration de la Livebox, veuillez sélectionner le fichier de restauration avec le bouton « parcourir » puis cliquez sur le bouton « restaurer ».</p><p>Vous n’avez pas besoin de saisir votre identifiant et mot de passe de connexion.<br/>Les appareils déjà connectés se reconnecteront automatiquement.<br/>Vos autres paramètres ( pare feu, réseau…) seront aussi restaurés.</p>",
"browsfieldlabel":"Nom du fichier",
"stependmsg":"<p>La restauration de la configuration est en cours. Votre Livebox va redémarrer automatiquement. Veuillez patienter quelques minutes…</p><p>Une fois la restauration terminée, vous pourrez naviguer sur internet.</p><p>Si vous souhaitez de nouveau accéder à l’interface, tapez livebox dans la barre d’adresse de votre navigateur.</p><p>En cas d’échange de Livebox:<br/>Les paramètres WiFi à utiliser pour connecter de nouveaux appareils en WiFi sont ceux de votre précédente Livebox ( nom du réseau (SSID) et clé de sécurité).<br/>Les appareils déjà connectés sur la précédente Livebox se reconnecteront automatiquement.</p>"
},
"error":
{
"nofilelabel":"erreur",
"nofiledesc":"aucun fichier &agrave restaurer",
"uploadlabel":"erreur",
"uploaddesc":"fichier invalide"
},
"offer":"veuillez s&eacute;lectionner l\'offre &agrave; laquelle vous avez souscrit:",
"howtoinstall":"veuillez saisir votre identifiant et votre mot de passe de connexion.",
"login":"identifiant<br/> de connexion",
"password":"mot de passe <br/>de connexion",
"warning":
{
"fr":"votre identifiant et votre mot de passe de connexion sont disponibles dans votre lettre de confirmation d\'abonnement",
"pl":"",
"mini_fr":"votre identifiant et votre mot de passe de connexion sont disponibles dans votre lettre de confirmation d\'abonnement"
}
},
"offer":
{
"radiobutton":
{
"adsl":"ADSL",
"fiber":"La fibre"
}
},
"error":
{
"empty":
{
"label":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement saisi votre identifiant et votre mot de passe de connexion."
},
"running":
{
"label":"authentification",
"description":"authentification en cours"
},
"adsl_link":
{
"label":"probl&egrave;me de connexion ADSL",
"description":"la d&eacute;tection de la ligne ADSL a &eacute;chou&eacute;. il est possible que votre ligne ADSL ne soit pas encore active et cela peut prendre jusqu\'&agrave; 15 jours apr&egrave;s la signature du contrat."
},
"ftth_link":
{
"label":"probl&egrave;me de connexion fibre",
"description":"la d&eacute;tection de la ligne fibre a échoué."
},
"ppp_server":
{
"label":"erreur PPP",
"description":"&eacute;chec de connexion au serveur PPP"
},
"authentication":
{
"label":"identifiant et/ou mot de passe de connexion incorrect",
"description":"veuillez les v&eacute;rifier et les saisir &agrave; de nouveau"
},
"ppp_timeout":
{
"label":"erreur PPP",
"description":"pas de r&eacute;ponse du serveur PPP"
}
}
},
"accessconfirmation":
{
"label":
{
"title":"votre Livebox est connect&eacute;e &agrave; internet"
},
"info":
{
"comment":"vous pouvez aussi acc&eacute;der &agrave; l’interface de configuration de la Livebox en saisissant <a href=\'http://livebox\' target=\'_blank\'>http://livebox</a> dans la barre d’adresse de votre navigateur"
}
}
},
"home":
{
"label":
{
"title":"appareils connect&eacute;s &agrave; la Livebox",
"subtitle":"pour d&eacute;finir un type d\'appareil et le nommer, cliquez dessus.",
"refresh":"pour actualiser l\'affichage de vos<br/>appareils connect&eacute;s, cliquez sur rafraichir",
"services":"services",
"wired":"r&eacute;seau filaire",
"wireless":"r&eacute;seau sans fil",
"usb":"USB",
"devices":
{
"massstorage":
{
"title":"p&eacute;riph&eacute;rique de stockage USB",
"eject":"pour retirer votre p&eacute;riph&eacute;rique USB en toute s&eacute;curit&eacute;, veuillez cliquer sur le bouton &eacute;jecter.",
"ejected":"vous pouvez retirer votre p&eacute;riph&eacute;rique de stockage USB en toute s&eacute;curit&eacute;.",
"busy":"votre p&eacute;riph&eacute;rique de stockage USB est en cours d\'utilisation, veuillez r&eacute;essayez ult&eacute;rieurement.",
"unsupported":"votre p&eacute;riph&eacute;rique de stockage USB n\'est pas reconnu par la Livebox.",
"invalid":"le format de votre p&eacute;riph&eacute;rique de stockage USB n\'est pas support&eacute; par la Livebox. la Livebox supporte uniquement les formats FAT, FAT32, NTFS, Ext2, Ext3, HFS et HFS+"
}
}
},
"didyouknow":
{
"label":"le saviez vous ?",
"description":
{
"first":"Vous pouvez acc&eacute;der &agrave; vos contenus stock&eacute;s sur une clef USB ou un disque dur externe branch&eacute; &agrave; la Livebox et les partager depuis n\'importe quel ordinateur. nous vous recommandons d\'utiliser le port USB qui se trouve sur la face gauche de votre Livebox.",
"second":"Vous pouvez partager une imprimante USB entre les diff&eacute;rents ordinateurs de la maison pour imprimer un document ou une photo depuis n’importe ou.",
"third":"Vous pouvez brancher plusieurs ordinateurs ou consoles de jeux en filaire sur votre Livebox (ports ethernet en face arri&egrave;re).",
"fourth":"Vous pouvez autoriser l’acc&egrave;s &agrave; internet selon les jours et plages horaires de votre choix sur n’importe quel ordinateur connect&eacute; &agrave; la Livebox. pratique si vous ne souhaitez pas que vos enfants acc&egrave;dent &agrave; internet tard le soir.",
"fiveth":"Si vous &eacute;teignez votre Livebox &agrave; partir du bouton marche/arrêt qui se trouve sur la face gauche de la Livebox, vous n’aurez plus acc&egrave;s &agrave; vos services.",
"sixth":"Vous pouvez d&eacute;finir les jours et plages horaires d’activation du WiFi de votre Livebox &agrave; partir de l’interface de configuration de la Livebox."
}
},
"usb":
{
"access":
{
"comment":"Copiez le chemin d\'accès ci-dessous dans la barre d\'adresse de votre fenêtre d\'exploration pour acc&eacute;der a vos fichiers"
}
},
"devicescustomize":
{
"label":
{
"title":"personnalisez votre appareil",
"type":
{
"title":"d&eacute;finissez le type d\'appareil",
"computer":"ordinateur",
"laptop":"ordinateur portable",
"game":"console de jeu",
"mobile":"t&eacute;l&eacute;phone",
"tv":"TV",
"photo":"cadre photo",
"liveradio":"LiveRadio",
"stb":"d&eacute;codeur TV",
"massstorage":"USB",
"printer":"imprimante"
},
"name":
{
"title":"nommez votre appareil",
"info":"le nom de votre appareil ne doit pas d&eacute;passer 64 caract&egrave;res",
"error":
{
"length":"ne doit pas d&eacute;passer 64 caract&egrave;res",
"empty":"ne doit pas être vide"
}
}
}
},
"authentication":
{
"label":
{
"title":"Identifiez vous pour continuer",
"subtitle":"veuillez saisir votre identifiant et votre mot de passe<br/>d\'administration de la Livebox",
"login":"identifiant",
"password":"mot de passe"
},
"info":
{
"comment":"par d&eacute;faut votre identifiant est \"admin\" et votre mot de passe est \"admin\""
},
"error":
{
"empty":"login ou mot de passe vide",
"invalid":"login ou mot de passe invalide"
}
}
},
"config":
{
"wifi":
{
"general":
{
"label":
{
"title":"WiFi",
"subtitle":"configurer l\'acc&egrave;s WiFi",
"ssid":"nom du r&eacute;seau WiFi (SSID)",
"status":"&eacute;tat de la connexion WiFi"
},
"link":
{
"ssid":"modifier",
"wifischeduling":"d&eacute;finir les plages d\'activation du WiFi"
},
"text":
{
"help":"<h6>activer/d&eacute;sactiver le WiFi</h6>si votre r&eacute;seau n\'est muni d\'aucun appareil sans fil, il est conseill&eacute; de d&eacute;sactiver le WiFi<br/><br/><h6>nom du r&eacute;seau WiFi (SSID)</h6>vous pouvez modifier le nom du r&eacute;seau WiFi de votre Livebox pour le personnaliser<br/><br/><h6>d&eacute;finir les plages d\'activation de mon WiFi</h6>par d&eacute;faut, votre WiFi est activ&eacute; en permanence (7j/7j et 24h/24h), vous pouvez d&eacute;finir des jours et plages horaires d\'activation de votre WiFi en cliquant sur « d&eacute;finir les plages d\'activation de du WiFi »"
},
"definition":
{
"ssid":
{
"title":"SSID",
"description":"le SSID correspond au nom du réseau WiFi de votre Livebox"
},
"canal":
{
"title":"CANAL",
"description":"le WiFi utilise une bande de fréquences specifiques…"
},
"security":
{
"title":"CLE DE SECURITE",
"description":"la cl&eacute; de s&eacute;curit&eacute; permet de s&eacute;curiser votre r&eacute;seau…"
}
},
"info":
{
"wificom":"Si vous d&eacute;sactivez le WiFi sur la Livebox, le mode wifi partag&eacute; sera aussi désactiv&eacute;. Voulez vous continuer?"
}
},
"ssid":
{
"label":
{
"title":"nom du r&eacute;seau WiFi",
"subtitle":"vous pouvez modifier le nom du r&eacute;seau WiFi (SSID) de votre Livebox pour le personnaliser.",
"description":"veuillez saisir le nouveau nom du r&eacute;seau WiFi de votre Livebox dans le champ ci-dessous:",
"error":
{
"invalid":"le SSID est invalide",
"length":"le SSID est trop long",
"orange":"Impossible d’utiliser le SSID « orange » car il est déjà utilisé pour le Wifi partagé"
}
},
"info":
{
"comment":"le nom du r&eacute;seau WiFi ne doit pas d&eacute;passer 32 caract&egrave;res"
}
},
"scheduling":
{
"label":
{
"title":"planificateur WiFi",
"subtitle":"vous pouvez activer le WiFi selon les jours et plages horaires de votre choix.",
"enable":"activer le WiFi en permanence",
"greenbox":"le WiFi est activ&eacute; sur les plages horaires affich&eacute;es en vert",
"redbox":"le WiFi est d&eacute;sactiv&eacute; sur les plages horaires affich&eacute;es en rouge",
"allday":"cochez pour activer la journ&eacute;e enti&egrave;re"
},
"text":
{
"help":"<h6>restreindre l\'activation du WiFi</h6>vous pouvez d&eacute;finir les plages d\'activation ou de d&eacute;sactivation du WiFi en s&eacute;lectionnant les horaires dans le tableau ci-dessous."
}
},
"definitions":
{
"label":
{
"title":"d&eacute;finitions",
"ssid":"SSID",
"channel":
{
"title":"CANAL",
"description":"le WiFi utilise une bande de fr&eacute;quences sp&eacute;cifique qui est sous-divis&eacute;e en canaux. Il y a 13 canaux disponibles."
},
"securitykey":"> CLE DE SECURITETranslations.wifi.definitions.securitykey.description > la cl&eacute; de s&eacute;curit&eacute; permet de s&eacute;curiser votre r&eacute;seau WiFi. Par d&eacute;faut, elle prend la valeur de la cl&eacute; WEP indiiqu&eacute;e sur l\'&eacute;tiquette de la Livebox.<br/>La cl&eacute; WEP est compos&eacute;e de 26 caract&egrave;res h&eacute;xad&eacute;cimaux (chiffres de 0 &agrave; 9 et les lettres A, B, C, D, E et F) et est totalement confidentielle.",
"securitymode":"> MODE DE SECURITETranslations.wifi.definitions.securitymode.description afin d\'empêcher toute personne de p&eacute;n&eacute;trer dans votre r&eacute;seau sans fil, les connexions WiFi sont crypt&eacute;es via les protocoles WEP ou WPA. Seuls les terminaux ayant fourni la cl&eacute; WEP ou WPA de votre Livebox peuvent acc&eacute;der &agrave; votre r&eacute;seau sans fil.",
"macaddress":"> ADRESSE MAC<chaque p&eacute;riph&eacute;rique poss&egrave;de une adresse physique qui lui est propre, appel&eacute;e adresse MAC. Cette adresse est repr&eacute;sent&eacute;e par 12 chiffres h&eacute;xad&eacute;cimaux group&eacute;s par paires et s&eacute;par&eacute;s par des tirets ou des double-points."
},
"description":
{
"ssid":"le SSID correspond au nom du r&eacute;seau WiFi de votre Livebox . il permet d\'identifier votre r&eacute;seau WiFi parmi les diff&eacute;rents r&eacute;seaux WiFi environnants. par d&eacute;faut, il correspond au nom de votre Livebox et est indiqu&eacute; sur l\'&eacute;tiquette."
}
},
"orange":
{
"label":
{
"title":"wifi partag&eacute;",
"subtitle":"",
"ssid":"nom du r&eacute;seau le wifi d\'Orange (SSID)",
"status":"statut wifi partag&eacute;",
"wifienable":"wifi partag&eacute; activ&eacute;",
"wifidisable":"wifi partag&eacute; d&eacute;sactiv&eacute;"
},
"manage":
{
"link":"cliquez ici",
"linkurl":"http://r.orange.fr/r?ref=MCI_livebox_wificom&url=http://r.orange.fr/r/Omoncompteinternet_messervices_wificom"
},
"info":
{
"comment":"pour activer ou d&eacute;sactiver le wifi partag&eacute;"
},
"text":
{
"help":"<h5>pourquoi activer le wifi partag&eacute;?</h5>le wifi partag&eacute; c’est la possibilit&eacute; d’acc&eacute;der gratuitement &agrave; Internet en toute libert&eacute; sur tout le r&eacute;seau wifi d’Orange en dehors de chez vous. Votre Livebox diffuse un nouveau r&eacute;seau appel&eacute; « orange » et rejoint la communaut&eacute; des hotspots wifi d’Orange. Votre s&eacute;curit&eacute; et votre confort d’utilisation &agrave; votre domicile restent identiques.<br/><br/><h5>Comment activer ou d&eacute;sactiver le wifi partag&eacute; ?</h5>l’activation ou la d&eacute;sactivation du « wifi partag&eacute; » n’est autoris&eacute;e qu’&agrave; partir de votre connexion Internet &agrave; domicile.cliquez sur le lien ci-dessus pour vous connecter &agrave; la rubrique « mes services » de votre espace client (orange.fr > espace client> mon compte internet > mes services).pour la prise en compte effective de cette modification, il vous faudra &eacute;teindre puis rallumer votre Livebox.quelques heures apr&egrave;s activation (au maximum 24h), vous pourrez vous connecter en dehors de chez vous au r&eacute;seau wifi d’Orange<br/><br/><h5>Comment se connecter au wifi d’Orange ?</h5>Pour vous connecter au wifi d’Orange &agrave; partir de votre ordinateur portable, de votre tablette, de votre smartphone ou de n’importe quel &eacute;quipement Wifi :1/ s&eacute;lectionnez le r&eacute;seau Wifi dont le nom est <span class=\'basecolor\'><b>orange</b></span><br/>2/ lancez votre navigateur Internet<br/>3/ identifiez-vous en utilisant simplement <span class=\'basecolor\'>votre adresse de messagerie Orange habituelle et votre mot de passe associ&eacute;</span> (exemple: <span class=\'basecolor\'>pr&eacute;nom.nom@orange.fr</span>) dans la page de connexion du wifi d’Orange."
},
"definition":
{
"example":
{
"title":"ORANGE WIFI",
"description":"ceci est la definition"
}
}
}
},
"computers":
{
"label":
{
"title":"ordinateurs",
"subtitle":"restriction d\'acc&egrave;s &agrave; internet de vos ordinateurs"
},
"link":
{
"accessscheduling":"restreindre l\'acc&egrave;s &agrave; internet"
},
"info":
{
"comment":"vous pouvez restreindre l\'acc&egrave;s de cet ordinateur &agrave; internet selon les jours et plages horaires de votre choix.",
"question":"Etes vous sûr de vouloir supprimer ce périphérique?"
},
"text":
{
"help":"<h6>d&eacute;finir l\'emploi du temps d\'acc&egrave;s &agrave; internet</h6>vous pouvez restreindre l\'acc&egrave;s &agrave; internet de n\'importe quel ordinateur connect&eacute; &agrave; votre Livebox selon les jours et plages horaires de votre choix en cliquant sur « restreindre l\'acc&egrave;s &agrave; internet »."
}
},
"access":
{
"scheduling":
{
"label":
{
"title":"restriction d\'acc&egrave;s &agrave; internet",
"subtitle":"vous pouvez restreindre l\'acc&egrave;s de cet appareil &agrave;<br/> internet selon les jours et plages horaires de votre choix.",
"enable":"autoriser l\'acc&egrave;s &agrave; internet en permanence",
"greenbox":"l\'acc&eacute;s &agrave; internet est autoris&eacute; sur les plages horaires affich&eacute;es en vert",
"redbox":"l\'acc&egrave;s &agrave; internet est restreint sur les plages horaires affich&eacute;es en rouge",
"allday":"cochez pour activer la journ&eacute;e enti&egrave;re"
},
"text":
{
"help":"par d&eacute;faut internet est accessible en permanence (7j/7, 24h/24). vous pouvez d&eacute;finir les plages de restriction d\'acc&egrave;s &agrave; internet sur tous vos appareils s&eacute;lectionnant les horaires dans le tableau ci-dessous."
}
}
},
"printer":
{
"label":
{
"title":"partager une imprimante",
"subtitle":"la Livebox vous permet de partager une imprimante USB entre les diff&eacute;rents ordinateurs de la maison."
},
"link":
{
"more":"&gt; en savoir plus",
"moreurl":
{
"fr":"http://assistance.orange.fr/partager-imprimante-usb-avec-livebox-2-47.php",
"pl":"",
"mini_fr":"http://assistance.orange.fr/partager-imprimante-usb-avec-livebox-2-47.php"
}
},
"info":
{
"comment":"<h5>voici les grandes &eacute;tapes que vous devrez r&eacute;aliser:</h5><br/>1- Installez les pilotes de votre imprimante USB<br/> sur chaque ordinateur &agrave; l\'aide de son CD-rom d\'installation.<br/><br/>2- Branchez votre imprimante sur votre Livebox.<br/><br/>3- D&eacute;clarez votre imprimante partag&eacute;e sur chaque ordinateur.<br/><br/>"
},
"text":
{
"help":"<h6>partager une imprimante USB</h6></br>- il est possible d\'imprimer un document depuis n\'importe quel ordinateur<br/>- de suivre l\'&eacute;tat des impressions en cours<br/>- d\'annuler une impression"
},
"definition":
{
"example":
{
"title":"IMPRIMANTE",
"description":"ceci est la definition"
}
}
},
"others":
{
"label":
{
"title":"autres appareils",
"subtitle":"restriction d\'acc&egrave;ss &agrave; internet de vos autres appareils"
},
"link":
{
"accessscheduling":"restreindre l\'acc&egrave;s &agrave; internet"
},
"info":
{
"comment":"vous pouvez restreindre l\'acc&egrave;s de cet appareil &agrave; internet selon les jours et plages horaires de votre choix."
},
"text":
{
"help":"<h6>d&eacute;finir l\'emploi du temps d\'acc&egrave;s &agrave; internet</h6>vous pouvez restreindre l\'acc&egrave;s de n\'importe quel appareil connect&eacute; &agrave; votre Livebox selon les jours et plages horaires de votre choix en cliquant sur « restreindre l\'acc&egrave;s &agrave; internet »."
}
}
},
"support":
{
"ledsstatus":
{
"label":
{
"title":"&eacute;tats des voyants",
"led":"voyant",
"icon":"ic&ocirc;ne<br/>voyant",
"state":"&eacute;tat du<br/>voyant",
"description":"signification",
"adsl":"internet",
"phone":"t&eacute;l&eacute;phone par internet",
"wired":"r&eacute;seau local",
"wireless":"WiFi"
},
"text":
{
"help":"Les voyants affich&eacute;s sur cette page correspondent &agrave; ceux visibles sur la face avant de la Livebox. Ils vous donnent l\'&eacute;tat des services internet, t&eacute;l&eacute;phone et WiFi."
},
"comment":
{
"gray":
{
"phone":"vous ne b&eacute;n&eacute;ficiez pas du service t&eacute;l&eacute;phone par internet",
"network":"aucune information n\'est &eacute;chang&eacute;e entre la Livebox et les appareils",
"wireless":"la fonctionnalit&eacute; WiFi est d&eacute;sactiv&eacute;e"
},
"green_solid":
{
"adsl":"la Livebox est connect&eacute;e &agrave; internet",
"phone":"le t&eacute;l&eacute;phone par internet est activ&eacute; et disponible",
"wireless":"la fonctionnalit&eacute; WiFi est activ&eacute;e"
},
"green_slow":
{
"phone":"le t&eacute;l&eacute;phone reli&eacute; &agrave; la Livebox est d&eacute;croch&eacute; ou une communication t&eacute;l&eacute;phonique est en cours",
"network":"des informations sont &eacute;chang&eacute;es entre la Livebox et d\'autres appareils !!",
"wireless":"Livebox en cours d\'association facile avec un appareil WiFi"
},
"green-fast":
{
"phone":"le t&eacute;l&eacute;phone reli&eacute; &agrave; la Livebox est d&eacute;croch&eacute; ou une communication t&eacute;l&eacute;phonique est en cours"
},
"green_fast":
{
"network":"des informations sont &eacute;chang&eacute;es entre la Livebox et d\'autres appareils",
"wireless":"Livebox en cours d\'association facile avec un appareil WiFi"
},
"red_fast":
{
"adsl":"la Livebox n\'a pas pu se connecter &agrave internet ( non synchronis&eacute;e)"
},
"orange_slow":
{
"adsl":"La Livebox est en cours de connexion &agrave; internet"
}
},
"definition":
{
"example":
{
"title":"VOYANT",
"description":"ceci est la definition"
}
}
},
"phoneringtest":
{
"label":
{
"title":"tester le t&eacute;l&eacute;phone par internet",
"service":"&eacute;tat du t&eacute;l&eacute;phone par internet:",
"number":"num&eacute;ro de t&eacute;l&eacute;phone est:",
"nonumber":"aucun num&eacute;ro assign&eacute;",
"unknownnumber":"num&eacute;ro non disponible"
},
"info":
{
"comment":"pour v&eacute;rifier le fonctionnement du t&eacute;l&eacute;phone branch&eacute; &agrave; votre Livebox<br/>cliquer sur le bouton \"tester\"."
}
},
"phoneringtestrunning":
{
"label":
{
"title":"tester le t&eacute;l&eacute;phone par internet"
},
"info":
{
"comment":"le t&eacute;l&eacute;phone connect&eacute; &agrave; votre Livebox est en cours de test.<br/><br/>- si le t&eacute;l&eacute;phone sonne, cel&agrave; confirme qu\'il est correctement connect&eacute; &agrave; la Livebox et qu\'il est disponible. cliquez sur le bouton retour.<br/><br/>- si le t&eacute;l&eacute;phone ne sonne pas, c\'est qu\'il est sans doute mal connect&eacute;. V&eacute;rifiez qu\'il est correctement branch&eacute; et cliquer sur red&eacute;marrer."
}
},
"restartreset":
{
"label":
{
"title":"red&eacute;marrer la Livebox"
},
"restart":
{
"label":
{
"title":"red&eacute;marrer la Livebox",
"subtitle":"vous pouvez red&eacute;marrer la Livebox en cliquant sur le bouton \"red&eacute;marrer\"",
"warning":"attention !"
},
"info":
{
"comment":"pendant le red&eacute;marrage de la Livebox, tous les services (internet, t&eacute;l&eacute;phone et TV) seront indisponibles.",
"question":"&ecirc;tes-vous s&ucirc;r ?"
}
},
"reset":
{
"label":
{
"title":"r&eacute;initialiser la Livebox",
"subtitle":"vous pouvez r&eacute;initialiser la Livebox en cliquant sur le bouton \"remise &agrave; z&eacute;ro\". Attention cette op&eacute;ration efface tous vos param&egrave;tres personnels (identifiants de connexion, r&egrave;gles de NAT, dynDNS …).",
"warning":"attention !"
},
"info":
{
"comment":"Vos param&egrave;tres personnels vont être effac&eacute;s. Sauvegardez-les en <a href=\'http://livebox/supportSaveAndRestore.html\' >cliquant ici</a>",
"question":"&ecirc;tes-vous s&ucirc;r ?"
}
}
},
"systeminformation":
{
"general":
{
"label":
{
"title":"g&eacute;n&eacute;ral",
"status":
{
"connected":"connect&eacute;",
"synchronized":"synchronis&eacute;",
"disconnected":"d&eacute;connect&eacute;",
"unconfigured":"non configur&eacute;",
"authenticating":"en cours d\'autentification",
"connecting":"en cours de connexion",
"up":"actif",
"down":"inactif",
"unavailable":"non disponible",
"initializing":"en cours d\'initialisation",
"listening":"en cours d\'&eacute;coute"
},
"nbmanufacturer":"1.1",
"manufacturer":"fabricant",
"nbmodel":"1.2",
"model":"mod&egrave;le",
"nbcountry":"1.3",
"country":"pays",
"nbserialnumber":"1.4",
"serialnumber":"num&eacute;ro de s&eacute;rie",
"nbfirmwareversion":"1.5",
"firmwareversion":"version de firmware SoftAtHome",
"softathome":"SoftAtHome",
"nbfirmwareversionft":"1.6",
"firmwareversionft":"version de firmware orange",
"nbdeviceuptime":"1.7",
"deviceuptime":"dur&eacute;e de fonctionnement",
"nbsynchrostatus":"1.8",
"synchrostatus":"&eacute;tat de synchronisation",
"nbadsllinkstatus":"1.9",
"adsllinkstatus":"&eacute;tat du lien ADSL",
"nbaccountstatus":"1.10",
"accountstatus":"statut du compte",
"nbpppusername":"1.11",
"pppusername":"identifiant PPP",
"nbwanip":"1.12",
"wanip":"adresse IP WAN",
"nbbasip":"1.13",
"basip":"adresse IP BAS",
"nbdnsprimary":"1.14",
"dnsprimary":"adresse IP du DNS primaire",
"nbdnssecondary":"1.15",
"dnssecondary":"adresse IP du DNS secondaire"
}
},
"adsl":
{
"label":
{
"title":"ADSL",
"technical":"caract&eacute;ristiques techniques",
"status":
{
"up":"actif",
"down":"inactif",
"initializing":"initialisation",
"unavailable":"non disponible"
},
"nbadsllinkstatus":"2.1",
"adsllinkstatus":"statut du lien ADSL",
"nbwanmacaddress":"2.2",
"wanmacaddress":"WAN adresse MAC",
"nbsynchrostatus":"2.3",
"synchrostatus":"status de synchronisation",
"nbadslsynchrolast":"2.4",
"adslsynchrolast":"derni&egrave;re synchronisation ADSL",
"nbadslsynchroduration":"2.5",
"adslsynchroduration":"dur&eacute;e de la synchronisation ADSL",
"nbpppconnectionstatus":"2.6",
"pppconnectionstatus":"statut de la connexion PPP",
"nbpppaccountstatus":"2.7",
"pppaccountstatus":"statut du compte",
"nbpppusername":"2.8",
"pppusername":"PPP nom d\'utilisateur",
"nbpppauthentificationmode":"2.9",
"pppauthentificationmode":"PPP mode d\'authentification",
"nbpppconnectionlast":"2.10",
"pppconnectionlast":"PPP derni&egrave;re connexion",
"nbpppconnectionduration":"2.11",
"pppconnectionduration":"PPP dur&eacute;e de la connexion",
"nbpppprotocoltype":"2.12",
"pppprotocoltype":"PPP type du protocol",
"nbpppconnectionlasterror":"2.13",
"pppconnectionlasterror":"PPP error de la derni&egrave;re connexion",
"nbpppconnectionlastdisconnect":"2.14",
"pppconnectionlastdisconnect":"PPP date de la derni&egrave;re d&eacute;connexion",
"nbatmvpvc":"2.15",
"atmvpvc":"ATM VP/VC",
"nbadslmode":"2.16",
"adslmode":"mode",
"nbencapsulation":"2.17",
"encapsulation":"encapsulation",
"nbdatapath":"2.18",
"datapath":"chemin de donn&eacute;e",
"nbmtu":"2.19",
"mtu":"taille MTU",
"nbwanip":"2.20",
"wanip":"WAN adresse IP",
"nbbasip":"2.21",
"basip":"BAS adresse IP",
"nbdnsprimary":"2.22",
"dnsprimary":"DNS primaire",
"nbdnssecondary":"2.23",
"dnssecondary":"DNS secondaire",
"nbattenuationup":"1.16",
"attenuationup":"att&eacute;nuation montante",
"nbattenuationdown":"1.17",
"attenuationdown":"att&eacute;nuation descendante",
"nbnoisemarginup":"1.18",
"noisemarginup":"marge de bruit montante",
"nbnoisemargindown":"1.19",
"noisemargindown":"marge de bruit descendante",
"nbmaxrateup":"1.20",
"maxrateup":"taux montant maximum",
"nbmaxratedown":"1.21",
"maxratedown":"taux descendant maximum",
"nbatmrateup":"1.22",
"atmrateup":"synchronisation montante",
"nbatmratedown":"1.23",
"atmratedown":"synchronisation descendante",
"nbpowerupstream":"1.24",
"powerupstream":"puissance du flux montant",
"nbpowerdownstream":"1.25",
"powerdownstream":"puissance du flux descendant",
"nbblocksreceived":"1.26",
"blocksreceived":"paquetss reçus",
"nbblockstransmitted":"1.27",
"blockstransmitted":"paquets &eacute;mis",
"nberrorslof":"1.28",
"errorslof":"paquets perdus",
"nblinkretrain":"1.29",
"linkretrain":"link retrain",
"nberrorsfec":"1.30",
"errorsfec":"erreurs FEC (Up/Down)",
"nberrorshec":"1.31",
"errorshec":"erreurs HEC (Up/Down)",
"nberrorscrc":"1.32",
"errorscrc":"erreurs CRC (Up/Down)"
},
"3g":
{
"label":
{
"status":"",
"linkstatus":"",
"operator":"",
"network":"",
"wanipaddress":"",
"maxrateup":"",
"maxratedown":""
}
}
},
"wifi":
{
"label":
{
"title":"WiFi",
"status":
{
"up":"actif",
"down":"inactif",
"enabled":"actif",
"disabled":"inactif"
},
"nbcurstatus":"3.1",
"curstatus":"&eacute;tat du WiFi",
"nblinkstatus":"3.2",
"linkstatus":"&eacute;tat du lien",
"nbmacaddress":"3.3",
"macaddress":"adresse MAC WiFi",
"nbssid":"3.4",
"ssid":"SSID",
"nbchannel":"3.5",
"channel":"canal",
"nbstandard":"3.6",
"standard":"standard",
"nbmaxbitrate":"3.7",
"maxbitrate":"vitesse maximum",
"nbencryption":"3.8",
"encryption":"s&eacute;curit&eacute;",
"nbencryptionoptio":"3.9",
"encryptionoption":"option de s&eacute;curit&eacute;",
"nbmacaccesslist":"3.10",
"macaccesslist":"filtrage MAC",
"nbbytessent":"3.11",
"bytessent":"octets envoy&eacute;s",
"nbbytesreceived":"3.12",
"bytesreceived":"octets reçus"
}
},
"lan":
{
"label":
{
"title":"LAN",
"yes":"oui",
"no":"non",
"auto":"auto",
"status":
{
"enabled":"actif",
"disabled":"inactif"
}
},
"status":
{
"link":"lien",
"nolink":"pas de lien"
},
"mode":
{
"InternetTV":"internet &amp; TV",
"internet":"internet",
"tv":"TV",
"internetONT":"FTTH",
"disable":"inactif"
},
"dhcp":
{
"label":
{
"nbstatus":"4.1",
"status":"&eacute;tat DHCP",
"nbstartip":"4.2",
"startip":"adresse IP de d&eacute;but",
"nbendip":"4.3",
"endip":"adresse IP de fin",
"nbnetmask":"4.4",
"netmask":"masque de sous r&eacute;seau",
"nbleasetime":"4.5",
"leasetime":"bail DHCP",
"nbgateway":"4.6",
"gateway":"passerelle DHCP",
"nbmac":"4.7",
"mac":"adresse MAC"
}
},
"red":
{
"label":
{
"title":"port ethernet rouge",
"nbmode":"4.8",
"mode":"mode",
"nbenabled":"4.9",
"enabled":"activ&eacute;",
"nbstatus":"4.10",
"status":"&eacute;tat",
"nbautoconfig":"4.11",
"autoconfig":"configuration auto",
"nbmacaddress":"4.12",
"macaddress":"adresse MAC",
"nbmaxbitrate":"4.13",
"maxbitrate":"vitesse maximum",
"nbduplexmode":"4.14",
"duplexmode":"mode duplex"
}
},
"yellow":
{
"label":
{
"title":"port ethernet jaune",
"nbmode":"4.15",
"mode":"mode",
"nbenabled":"4.16",
"enabled":"activ&eacute;",
"nbstatus":"4.17",
"status":"&eacute;tat",
"nbautoconfig":"4.18",
"autoconfig":"configuration auto",
"nbmacaddress":"4.19",
"macaddress":"adresse MAC",
"nbmaxbitrate":"4.20",
"maxbitrate":"vitesse maximum",
"nbduplexmode":"4.21",
"duplexmode":"mode duplex"
}
},
"green":
{
"label":
{
"title":"port ethernet vert",
"nbmode":"4.22",
"mode":"mode",
"nbenabled":"4.23",
"enabled":"activ&eacute;",
"nbstatus":"4.24",
"status":"&eacute;tat",
"nbautoconfig":"4.25",
"autoconfig":"configuration auto",
"nbmacaddress":"4.26",
"macaddress":"adresse MAC",
"nbmaxbitrate":"4.27",
"maxbitrate":"vitesse maximum",
"nbduplexmode":"4.28",
"duplexmode":"mode duplex"
}
},
"white":
{
"label":
{
"title":"port ethernet blanc",
"nbmode":"4.29",
"mode":"mode",
"nbenabled":"4.30",
"enabled":"activ&eacute;",
"nbstatus":"4.31",
"status":"&eacute;tat",
"nbautoconfig":"4.32",
"autoconfig":"configuration auto",
"nbmacaddress":"4.33",
"macaddress":"adresse MAC",
"nbmaxbitrate":"4.34",
"maxbitrate":"vitesse maximum",
"nbduplexmode":"4.35",
"duplexmode":"mode duplex"
}
}
},
"voip":
{
"label":
{
"title":"VoIP",
"available":"disponible",
"unavailable":"indisponible",
"status":
{
"up":"actif",
"down":"inactif"
},
"nbcurstatus":"5.1",
"curstatus":"&eacute;tat",
"nbphonenumber":"5.2",
"phonenumber":"num&eacute;ro t&eacute;l&eacute;phonique VoIP",
"nbvpvc":"5.3",
"vpvc":"VP/VC utilis&eacute;",
"nblinkstatus":"5.4",
"linkstatus":"&eacute;tat du lien",
"nbprotocol":"5.5",
"protocol":"protocole"
}
},
"usb":
{
"label":
{
"title":"USB"
},
"first":
{
"label":
{
"title":"USB 1",
"nblinkstatus":"6.1",
"linkstatus":"&eacute;tat du lien",
"nbfunc":"6.2",
"func":"fonction",
"nbvendorId":"6.3",
"vendorId":"fournisseur",
"nbmanufacturer":"6.4",
"manufacturer":"constructeur",
"nbproductId":"6.5",
"productId":"version",
"nbproduct":"6.6",
"product":"produit",
"nbserialNumber":"6.7",
"serialNumber":"num&eacute;ro de s&eacute;rie"
}
},
"second":
{
"label":
{
"title":"USB 2",
"nblinkstatus":"6.8",
"linkstatus":"&eacute;tat du lien",
"nbfunc":"6.9",
"func":"fonction",
"nbvendorId":"6.10",
"vendorId":"fournisseur",
"nbmanufacturer":"6.11",
"manufacturer":"constructeur",
"nbproductId":"6.12",
"productId":"version",
"nbproduct":"6.13",
"product":"produit",
"nbserialNumber":"6.14",
"serialNumber":"num&eacute;ro de s&eacute;rie"
}
},
"func":
{
"massstorage":"stockage",
"printer":"imprimante",
"phone":"livephone",
"undefined":"non d&eacute;finie"
}
},
"tv":
{
"label":
{
"title":"TV",
"available":"disponible",
"unavailable":"indisponible",
"status":
{
"up":"actif",
"down":"inactif"
}
},
"channel1":
{
"label":
{
"title":"canal 1",
"nbstatus":"7.1",
"status":"&eacute;tat",
"nbvpvc":"7.2",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.3",
"linkstatus":"&eacute;tat du lien"
}
},
"channel2":
{
"label":
{
"title":"canal 2",
"nbstatus":"7.4",
"status":"&eacute;tat",
"nbvpvc":"7.5",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.6",
"linkstatus":"&eacute;tat du lien"
}
},
"vod":
{
"label":
{
"title":"vid&eacute;o &agrave; la demande",
"nbstatus":"7.7",
"status":"&eacute;tat",
"nbvpvc":"7.8",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.9",
"linkstatus":"&eacute;tat du lien"
}
},
"zapping":
{
"label":
{
"title":"zapping",
"nbstatus":"7.10",
"status":"&eacute;tat",
"nbvpvc":"7.11",
"vpvc":"VP/VC",
"vlan":"VLAN",
"nblinkstatus":"7.12",
"linkstatus":"&eacute;tat du lien"
}
}
},
"ftth":
{
"label":
{
"title":"FTTH",
"technical":"caract&eacute;ristiques techniques",
"status":
{
"up":"actif",
"down":"inactif",
"initializing":"initialisation",
"unavailable":"non disponible"
},
"nbadsllinkstatus":"2.1",
"adsllinkstatus":"statut du lien FTTH",
"nbwanmacaddress":"2.2",
"wanmacaddress":"addresse MAC WAN",
"nbsynchrostatus":"2.3",
"synchrostatus":"status de synchronisation",
"nbadslsynchrolast":"2.4",
"adslsynchrolast":"derni&egrave;re synchronisation FTTH",
"nbadslsynchroduration":"2.5",
"adslsynchroduration":"dur&eacute;e de la synchronisation FTTH",
"nbpppconnectionstatus":"2.6",
"pppconnectionstatus":"statut de la connexion PPP",
"nbpppaccountstatus":"2.7",
"pppaccountstatus":"statut du compte",
"nbpppusername":"2.8",
"pppusername":"PPP nom d\'utilisateur",
"nbpppauthentificationmode":"2.9",
"pppauthentificationmode":"PPP mode d\'authentification",
"nbpppconnectionlast":"2.10",
"pppconnectionlast":"PPP derni&egrave;re connexion",
"nbpppconnectionduration":"2.11",
"pppconnectionduration":"PPP dur&eacute;e de la connexion",
"nbpppprotocoltype":"2.12",
"pppprotocoltype":"PPP type du protocol",
"nbpppconnectionlasterror":"2.13",
"pppconnectionlasterror":"PPP error de la derni&egrave;re connexion",
"nbpppconnectionlastdisconnect":"2.14",
"pppconnectionlastdisconnect":"PPP date de la derni&egrave;re d&eacute;connexion",
"nbatmvpvc":"2.15",
"atmvpvc":"ATM VP/VC",
"nbadslmode":"2.16",
"adslmode":"mode",
"nbencapsulation":"2.17",
"encapsulation":"encapsulation",
"nbdatapath":"2.18",
"datapath":"chemin de donn&eacute;e",
"nbmtu":"2.19",
"mtu":"taille MTU",
"nbwanip":"2.20",
"wanip":"WAN adresse IP",
"nbbasip":"2.21",
"basip":"BAS adresse IP",
"nbdnsprimary":"2.22",
"dnsprimary":"DNS primaire",
"nbdnssecondary":"2.23",
"dnssecondary":"DNS secondaire",
"nbattenuationup":"1.16",
"attenuationup":"att&eacute;nuation montante",
"nbattenuationdown":"1.17",
"attenuationdown":"att&eacute;nuation descendente",
"nbnoisemarginup":"1.18",
"noisemarginup":"marge de bruit montante",
"nbnoisemargindown":"1.19",
"noisemargindown":"marge de bruit descendante",
"nbmaxrateup":"1.20",
"maxrateup":"taux montant maximum",
"nbmaxratedown":"1.21",
"maxratedown":"taux descendant maximum",
"nbatmrateup":"1.22",
"atmrateup":"synchronisation montante",
"nbatmratedown":"1.23",
"atmratedown":"synchronisation descendante",
"nbpowerupstream":"1.24",
"powerupstream":"puissance du flux montant",
"nbpowerdownstream":"1.25",
"powerdownstream":"puissance du flux descendant",
"nbblocksreceived":"1.26",
"blocksreceived":"paquets reçus",
"nbblockstransmitted":"1.27",
"blockstransmitted":"paquets &eacute;mis",
"nberrorslof":"1.28",
"errorslof":"paquets perdus",
"nblinkretrain":"1.29",
"linkretrain":"link retrain",
"nberrorsfec":"1.30",
"errorsfec":"erreurs FEC (Up/Down)",
"nberrorshec":"1.31",
"errorshec":"erreurs HEC (Up/Down)",
"nberrorscrc":"1.32",
"errorscrc":"erreurs CRC (Up/Down)"
},
"3g":
{
"label":
{
"status":"",
"linkstatus":"",
"operator":"",
"network":"",
"wanipaddress":"",
"maxrateup":"",
"maxratedown":""
}
}
}
},
"firmwareupgrade":
{
"label":
{
"title":"mise &agrave; jour du logiciel de la Livebox",
"subtitle":"pour mettre &agrave; jour le logiciel de la Livebox, <br/>cliquez sur le bouton \"rechercher une version plus r&eacute;cente\".",
"version":"version logicielle courante:",
"softathome":"SoftAtHome",
"duringsearch":"Veuillez patienter pendant la recherche d’une nouvelle version logicielle...",
"nofirmavailable":"Il n’y a pas de version logicielle plus r&eacute;cente de disponible",
"whileupgrading":"une mise &agrave; jour du logiciel de la Livebox est en cours d\'installation. pendant cette proc&eacute;dure, le voyant bleu de votre Livebox va clignoter et vous ne pourrez pas acc&eacute;der &agrave; internet pendant 15 minutes. quand ça sera termin&eacute;, votre Livebox va red&eacute;marrer automatiquement.<br/><br/><br/>merci de ne pas &eacute;teindre votre Livebox ou de d&eacute;brancher le lien ADSL tant que le voyant bleu clignote. cette mise &agrave; jour ne peut être arrêt&eacute;e.<br/><br/><br/>apr&egrave;s la mise &agrave; jour, vous pourrez utiliser de nouvelles fonctions de votre Livebox.<br/><br/><br/>merci de ne pas &eacute;teindre votre Livebox pendant la mise &agrave; jour. si vous rencontrez un probl&egrave;me merci de contacter le support t&eacute;l&eacute;phonique.<br/><br/>"
},
"text":
{
"help1":"<h6>le logiciel de votre Livebox est mis &agrave; jour &agrave; distance pour que vous b&eacute;n&eacute;ficiez des derniers services disponibles. Orange le met &agrave; jour r&eacute;guli&egrave;rement automatiquement, de nuit, pour ne pas gêner l’utilisation de la Livebox.</h6>si une mise &agrave; jour est disponible, le t&eacute;l&eacute;chargement se fera automatiquement et le voyant de mise &agrave; jour bleu clignotera jusqu’&agrave; la fin du processus. <h6>Ne pas éteindre la Livebox ou retirer le cable ADSL lors d\'une mise à jour</h6>",
"help2":"<h6>Erreur dans la mise à jour</h6> une erreur est survenue pendant une mise à jour: appuyez sur le bouton \"Marche/Arrêt\" de la Livebox puis patientez le temps que la Livebox redémarre. Si la situation perdure, débranchez puis rebranchez électriquement la Livebox.",
"helpbesearch":"<p>Si une version logicielle plus r&eacute;cente est disponible, votre livebox deviendra indisponible pendant la proc&eacute;dure de mise à jour.</p><p>Pour &eacute;viter tout risque de d&eacute;t&eacute;rioration, veuillez ne pas d&eacute;brancher votre livebox avant que la proc&eacute;dure de mise à jour soit termin&eacute;e.</p><p>Souhaitez-vous mettre à jour votre Livebox maintenant ?</p>"
},
"info":
{
"question":"&ecirc;tes-vous s&ucirc;r ?"
}
},
"saveandrestore":
{
"label":
{
"title":"sauvegarder et restaurer la configuration",
"subtitle":"<h6>pour sauvegarder la configuration de la Livebox (identifiants, r&egrave;gles NAT, dynDNS …) sur un fichier sur votre ordinateur, veuillez cliquer sur le bouton \"enregistrer\".</h6>",
"restore":
{
"stependmsg":"<p>La restauration de la configuration est en cours. Votre Livebox va redémarrer automatiquement. Veuillez patienter quelques minutes…</p><p>Une fois la restauration terminée, vous pourrez naviguer sur internet.</p><p>Si vous souhaitez de nouveau accéder à l’interface, tapez livebox dans la barre d’adresse de votre navigateur.</p><p>En cas d’échange de Livebox:<br/>Les paramètres WiFi à utiliser pour connecter de nouveaux appareils en WiFi sont ceux de votre précédente Livebox ( nom du réseau (SSID) et clé de sécurité).<br/>Les appareils déjà connectés sur la précédente Livebox se reconnecteront automatiquement.</p>"
}
},
"info":
{
"comment":"<h6>pour restaurer la configuration de la Livebox, veuillez s&eacute;lectionner le fichier de restauration avec le bouton \"parcourir\" puis cliquez sur le bouton \"restaurer\".</h6>"
}
},
"saverestore":
{
"nofile":
{
"error":
{
"label":"erreur",
"description":"aucun fichier &agrave restaurer"
}
},
"upload":
{
"error":
{
"label":"erreur",
"description":"fichier invalide"
}
}
},
"remoteaccess":
{
"label":
{
"title":"acc&egrave;s &agrave; distance utilisateur",
"subtitle":"cette page vous permet d’acc&eacute;der &agrave; distance &agrave; l’interface de configuration de la Livebox. pour un acc&egrave;s plus facile, vous pouvez configurer le service dynDNS",
"here":"ici",
"enable":"&nbsp;activer l\'administration &agrave; distance",
"youripaddress":"votre adresse IP est actuellement :",
"yoururl":"votre URL est actuellement:"
},
"login":
{
"error":
{
"label":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement<br/>saisi votre identifiant."
}
},
"password":
{
"error":
{
"label":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement<br/>saisi votre mot de passe."
}
},
"port":
{
"error":
{
"label":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement<br/>saisi le num&eacute;ro de port"
}
},
"info":
{
"comment":"apr&egrave;s avoir cliqu&eacute; sur \"enregistrer\", l\'URL permettant d’acc&eacute;der &agrave; distance &agrave; l’interface de configuration de la Livebox sera affich&eacute;e."
},
"text":
{
"help":"<h6>cette rubrique vous permet de configurer un acc&egrave;s &agrave; l\'interface de configuration de la Livebox depuis internet.</span></h6><br/>vous devez saisir un identifiant et un mot de passe d’acc&egrave;s &agrave; la Livebox. retenez les bien car ils vous seront demand&eacute;s lorsque vous tenterez d\'acc&eacute;der &agrave; distance &agrave; votre Livebox.<br/><br/>votre identifiant ne doit pas d&eacute;passer 32 caract&egrave;res. votre mot de passe doit compter au minimum 8 caract&egrave;res dont un chiffre et un caract&egrave;re sp&eacute;cial.</span><br/><br/>le num&eacute;ro de port de votre Livebox est par d&eacute;faut 10000. vous pouvez toutefois s&eacute;lectionner un num&eacute;ro de port entre 10000 et 30000."
},
"definition":
{
"example":
{
"title":"ACCES DISTANT",
"description":"ceci est la definition"
}
},
"authentication":
{
"label":
{
"title":"authentification",
"subtitle":"veuillez saisir votre identifiant et votre mot de passe d\'acc&egrave; distant",
"login":"identifiant",
"password":"mot de passe",
"warning":"acc&egrave;s distant &agrave; la Livebox"
},
"error":
{
"title":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement saisi votre identifiant et votre mot de passe de connexion."
}
}
},
"hotline":
{
"label":
{
"title":"acc&egrave;s &agrave; distance support client",
"subtitle":"cette page vous permet de donner un acc&egrave;s temporaire au support technique orange.",
"duration":
{
"title":"dur&eacute;e restante pour l\'administration &agrave; distance:",
"first":"0 mn",
"second":"5 min",
"third":"10 min",
"fourth":"15 min"
}
},
"info":
{
"comment":"informations requises pour l\'acc&eacute;s distant :"
},
"text":
{
"help":"pour tout d&eacute;pannage, l’acc&egrave;s temporaire permet &agrave; un t&eacute;l&eacute;conseiller du support technique (t&eacute;l&eacute;phone au 3900) d’acc&eacute;der temporairement (15 mintutes) et avec votre accord &agrave; votre Livebox.<br/> <br/>pour lancer un acc&egrave;s support client pendant 15 minutes, cliquez sur le bouton \"d&eacute;marrer\". les param&egrave;tres d’acc&egrave;s &agrave distance vont apparaître &agrave l’&eacute;cran. communiquez-les uniquement au t&eacute;l&eacute;conseiller. <br/> <br/>pour d&eacute;sactiver l’acc&egrave;s temporaire au support client, cliquer sur le bouton \"arr&ecirc;ter\"."
}
}
},
"advconfig":
{
"wifi":
{
"label":
{
"title":"WiFi",
"subtitle":"configuration avanc&eacute;e des param&egrave;tres WiFi",
"state":"&eacute;tat de la connexion WiFi",
"ssid":"nom du r&eacute;seau WiFi (SSID)",
"broadcast":"diffuser le SSID",
"securitymode":"mode de s&eacute;curit&eacute;",
"securitykey":"cl&eacute; de s&eacute;curit&eacute;",
"nosecurity":"Pas de s&eacute;curit&eacute;",
"channel":"canal",
"channelused":"canal utilis&eacute;",
"pairingtitle":"connecter vos appareils en WiFi",
"easypairing":"WiFi facile",
"macfiltering":"filtrage MAC",
"devicesauthorised":"appareils autoris&eacute;s &agrave; se connecter en WiFi &agrave; la Livebox",
"name":"nom",
"ipadress":"adresse IP",
"macaddress":"adresse MAC",
"editnewmac":"nouveau …",
"unknownmac":"inconnu",
"wifipushbutton":"WiFi Protected Setup (WPS) Push Button",
"wifipairing":"générer un code PIN WPS de la Livebox",
"addclientpush":"connecter un appareil par WPS Push Button",
"addclientpin":"saisir le code PIN d\'un appareil WPS",
"info":
{
"disable":"activez le Wifi pour b&eacute;n&eacute;ficier de la configuration avanc&eacute;e du Wifi"
}
},
"link":
{
"scheduling":"d&eacute;finir les plages d\'activation du WiFi",
"ssid":"modifier",
"securitykey":"modifier"
},
"text":
{
"help":"<h6>mode de s&eacute;curit&eacute;</h6><h6>- pas de s&eacute;curit&eacute;</h6>votre r&eacute;seau domestique est ouvert et accessible par tous (mode non recommand&eacute;)<br/><h6>- WEP</h6>Utilisation d\'une cl&eacute; de 26 caractères hexad&eacute;cimaux.Ne permet pas l\'utilisation du WiFi n mais seulement du WiFi b/g<br/><h6>- WPA-PSK (TKIP):</h6>utilisation d\'une cl&eacute; d\'au moins 8 caractères (alphanum&eacute;rique et caractères sp&eacute;ciaux). Ce mode ne permet pas l\'utilisation du WiFi n mais seulement du WiFi b/g<br/><h6>- WPA2-PSK (AES) :</h6>utilisation d\'une cl&eacute; d\'au moins 8 caractères (alphanum&eacute;rique et caractères sp&eacute;ciaux).<br/><h6>- WPA/WPA2 Mixed</h6>Mode par d&eacute;faut qui sélectionne automatiquement le meilleur mode pour votre appareil <br/><br/><h6>WiFi facile</h6>Cette option vous permet de connecter un ordinateur via le kit d\'installation simplement en appuyant sur le bouton WiFi de la Livebox<br/><br/><h6>WiFi Protected SetUp Push (WPS) Button</h6>activation de la m&eacute;thode recommand&eacute;e pour connecter les appareils certifi&eacute;s WPS<br/><h6>code PIN WPS de la Livebox</h6>Si vous activez cette option, en appuyant sur le bouton générer, vous obtenez un code PIN Livebox. Saisissez-le sur l\'appareil certifi&eacute; WPS que vous souhaitez connecter.<br/><h6>Connecter un appareil par WPS Push Button</h6>Appuyez sur le bouton \"connecter\" (ou brièvement sur le bouton WiFi de la Livebox) puis sur le bouton WPS de votre appareil<br/><h6>Saisie du PIN code WPS de votre appareil</h6> Un code PIN est disponible sur votre appareil (généré ou sur une etiquette). Saisissez le ici et cliquez sur ajouter pour le connecter<br/><br/><h6>filtrage MAC</h6>Lorsque vous activez le filtrage MAC, et si vous voulez autoriser un nouvel appareil &agrave; s’associer en WiFi avec votre Livebox, vous devez appuyer sur le bouton WiFi de votre Livebox. Si ce filtrage est d&eacute;sactiv&eacute; (par d&eacute;faut), tout appareil qui connait la cl&eacute; de s&eacute;curit&eacute; peut se connecter &agrave; la Livebox."
},
"definition":
{
"example":
{
"title":"WIFI AVANCE",
"description":"ceci est la definition"
}
},
"error":
{
"wepkey":"cl&eacute; invalide. Elle doit contenir 26 caract&egrave;res h&eacute;xad&eacute;cimaux",
"presharedkey":"cl&eacute; invalide. Elle doit contenir entre 8 et 63 caract&egrave;res h&eacute;xad&eacute;cimaux",
"ssid":"SSID invalide",
"moden":"le WiFi N n\'est pas disponible<br/>dans ce mode de sécurité",
"macaddress":"adresse MAC invalide",
"wpsclientpin":"PIN code client invalide"
},
"general":
{
"info":
{
"wificom":"Si vous d&eacute;sactivez le WiFi sur la Livebox, le mode wifi partag&eacute; sera aussi désactiv&eacute;. Voulez vous continuer?"
}
},
"securitykey":
{
"label":
{
"title":"cl&eacute; de s&eacute;curit&eacute;",
"subtitle":"vous pouvez modifier la cl&eacute; de s&eacute;curit&eacute;."
},
"description":"veuillez saisir la nouvelle cl&eacute; de s&eacute;curit&eacute;",
"info":
{
"comment":"26 caract&egrave;res h&eacute;xad&eacute;cimaux en mode WEP<br/>entre 8 et 63 caract&eacute;res pour WPA/WPA2"
},
"error":
{
"wep":"cl&eacute; WEP incorrecte. Doit contenir 26 caract&egrave;res hexad&eacute;cimaux ( 0-9 et A-F)",
"wpa":"cl&eacute; WPA incorrecte. Doit poss&eacute;der plus de 8 caract&egrave;res"
}
}
},
"firewalladv":
{
"label":
{
"title":"pare-feu",
"subtitle":"Configuration personnalis&eacute;e du pare-feu<br/><br/> Vous pouvez ajouter ou supprimer les r&egrave;gles que vous voulez. Attention une mauvaise configuration du pare-feu peut vous empêcher d’acc&eacute;der &agrave; internet ! Pour les utilisateurs non avancés, il est recommand&eacute; d\'utiliser les niveaux de s&eacute;curit&eacute; d&eacute;finis dans la page pr&eacute;c&eacute;dente.",
"ping":"l\'option r&eacute;ponse au ping autorise la Livebox &agrave; r&eacute;pondre aux requ&ecirc;tes de ping (test de l’&eacute;tat de la Livebox sur un r&eacute;seau). Cette option est activ&eacute;e par d&eacute;faut.",
"pinganswer":"r&eacute;pondre au ping",
"reinit":"r&eacute;initialiser les r&egrave;gles du pare-feu (retour aux r&egrave;gles d&eacute;finies dans le niveau &eacute;lev&eacute;)",
"personalrules":"r&egrave;gles personnalis&eacute;es",
"application":"application / service",
"source":"IP<br/>source<br/>adresse",
"mask":"masque<br/>IP<br/>addresse",
"sourceport":"port source",
"destination":"IP<br/>destination<br/>adresse",
"destinationport":"port destination",
"action":"action",
"order":"ordre",
"staticip":"adresse IP statique",
"protocol":"protocole",
"accept":"accepter",
"drop":"rejeter",
"editnewrule":"nouveau…",
"bothprotocol":"les deux"
},
"error":
{
"description":"description invalide",
"sourceip":"ip source invalide",
"sourceipmask":"masque d\'ip source invalide",
"sourceport":"port source invalide. Valeur entre 1 et 65535",
"sourcerange":"port source invalide. Valeur entre 1 et 65535",
"destip":"ip destination invalide",
"destipmask":"masque d\'ip destination invalide",
"destport":"port destination invalide. Valeur entre 1 et 65535",
"destrange":"port destination invalide. Valeur entre 1 et 65535"
},
"tooltip":
{
"sourceport":"saisir un num&eacute;ro ou une plage de port (ex: 200-300)",
"destinationport":"saisir un num&eacute;ro ou une plage de port (ex: 200-300)"
}
},
"firewall":
{
"label":
{
"title":"pare-feu",
"subtitle":"configuration du pare-feu (firewall).<br/><br/>vous pouvez configurer le niveau de protection de la Livebox. le niveau par d&eacute;faut (moyen) est satisfaisant et recommand&eacute;.",
"offer":"choisir le niveau de s&eacute;curit&eacute;",
"low":"faible",
"medium":"moyen",
"high":"&eacute;lev&eacute;",
"customize":"personnaliser",
"warn":"les applications (ex: LiveMessenger, peer-to-peer applications, games) qui reposent sur des r&egrave;gles NAT fournies par UPnP IGD ne fonctionneront plus correctement."
},
"description":
{
"low":"le pare-feu ne filtre rien. attention, ce niveau est r&eacute;serv&eacute; aux utilisateurs avanc&eacute;s pour lesquels la s&eacute;curit&eacute; n\'est pas une priorit&eacute;. veuillez noter aussi que m&ecirc;me dans ce mode une connexion initi&eacute;e depuis internet sera rejet&eacute;e si une r&egrave;gle NAT/PAT correspondante n\'a pas &eacute;t&eacute; cr&eacute;ee.",
"medium":"le pare-feu filtre toutes les connexions entrantes. le trafic sortant est autoris&eacute; &agrave; l\'exception des services netbios. il est recommand&eacute; d\'utiliser ce mode.",
"high":"le pare-feu vous permet d\'utiliser les applications standards sur internet (web, mail, news...) et rejette les connexions entrantes non d&eacute;sir&eacute;es. ce choix est recommand&eacute; pour disposer d\'un niveau de s&eacute;curit&eacute; maximal. attention : incompatible avec Unik et d\'autres services.",
"customize":"ce profil vous permet de personnaliser votre pare-feu. vous pouvez ainsi d&eacute;finir des r&egrave;gles de filtrage sp&eacute;cifiques. (r&eacute;serv&eacute; aux utilisateurs experts)."
}
},
"network":
{
"natpat":
{
"label":
{
"title":"r&eacute;seau",
"tab":"NAT/PAT",
"setup":"configuration des r&egrave;gles de NAT/PAT.",
"description":"configuration NAT/PAT",
"info":"les r&egrave;gles NAT/PAT sont n&eacute;cessaires pour autoriser une communication initi&eacute;e depuis Internet pour atteindre un appareil sp&eacute;cifique de votre r&eacute;seau. Vous pouvez aussi d&eacute;finir le(s) port(s) sur lequel cette communication sera achemin&eacute;e.",
"warning":"assurez-vous de ne pas avoir filtr&eacute; ces ports dans le pare-feu",
"personaltunes":"r&egrave;gles personnalis&eacute;es",
"application":"<b>application / service</b>",
"internalport":"<b>port<br/>interne</b>",
"externalport":"<b>port<br/>externe</b>",
"protocol":"<b>protocole</b>",
"device":"<b>appareil</b>",
"bothprotocol":"les deux",
"editnewline":"nouveau…",
"editnewhost":"nouveau…",
"error":"les champs ne doivent pas &ecirc;tre vides",
"error1":"Valeur de port invalide",
"error2":"la valeur du port externe est une valeur r&eacute;serv&eacute;e",
"error3":"la r&egrave;gle existe d&eacute;ja",
"error4":"la r&egrave;gle est en conflit avec une r&egrave;gle existante",
"error5":"la nouvelle r&egrave;gle est en conflit avec une r&egrave;gle UPnP",
"error6":"Adresse IP est invalide ou situ&eacute;e en dehors du sous r&eacute;seau de la Livebox"
},
"text":
{
"help":"<h6>NAT/PAT c\'est quoi ?</h6><br/>certaines applications n&eacute;cessitent d\'ouvrir des ports sp&eacute;cifiques pour fonctionner correctement. Il peut s\'agir de certains jeux en ligne ou de serveurs type FTP, SSH, web...<br/><br/>Pour permettre la communication entre votre appareil et le serveur (ou client) distant il vous faudra alors configurer une r&egrave;gle de NAT en indiquant le type d\'application, les ports interne (r&eacute;seau local) et externe (internet) ainsi que le protocole et l\'appareil qui doit recevoir les informations."
},
"tooltip":
{
"externalport":"(ex:1000-2000)",
"internalport":"(ex:1000)"
}
},
"dhcp":
{
"label":
{
"title":"r&eacute;seau",
"subtitle":"le serveur DHCP de la Livebox permet d’attribuer une addresse IP &agrave; chaque appareil de votre r&eacute;seau local.",
"tab":"DHCP",
"editnewlease":"nouveau…",
"setup":"configuration DHCP",
"server":"serveur DHCP",
"liveboxip":"adresse IP de la Livebox",
"mask":"masque de sous-r&eacute;seau du LAN",
"startip":"adresse IP de d&eacute;but",
"endip":"adresse IP de fin",
"info":"vous pouvez visualiser les addresses IP dynamiques attribu&eacute;es par le serveur DHCP de la Livebox.",
"dynamicip":"adresse IP dynamique",
"name":"nom",
"ip":"adresse IP",
"macaddress":"adresse MAC",
"delete":"supprimer",
"staticip":"adresse IP statique"
},
"info":
{
"comment":"vous pouvez r&eacute;server une addresse IP statique &agrave; chaque &eacute;quipement de votre r&eacute;seau local. L’&eacute;quipement aura donc syst&eacute;matiquement la même addresse sur votre r&eacute;seau local."
},
"error":
{
"empty":
{
"label":"erreur",
"description":"champ vide"
},
"withinsubnet":"L\'adresse IP doit figurer dans le sous r&eacute;seau",
"withinrange":"L\'adresse IP doit figurer dans l\'intervalle DHCP",
"reservedip":"Il s\'agit d\'une adresse IP réservée",
"limitedipaddress":"l\'adresse IP doit figurer dans l\'intervalle",
"macaddress":"mauvaise adresse MAC",
"subnetMask":"mauvais masque",
"ipaddress":
{
"bad":"mauvaise adresse IP",
"maxAddress":"mauvaise adresse de fin",
"minAddress":"mauvaise adresse de d&eacute;but",
"device":"Modification impossible du fait d\'&eacute;quipements connect&eacute;s"
},
"usedmacaddress":"adresse MAC utilis&eacute;",
"usedipaddress":"adresse IP utilis&eacute;",
"conflict":
{
"subnet192168128":"Le sous réseau est en conflit avec le sous réseau réservé 192.168.128.0/24",
"subnet192168002":"Le sous réseau est en conflit avec le sous réseau réservé 192.168.2.0/24"
},
"outofrangestaticip":"Au moins une adresse IP statique est en dehors de l\'intervalle DHCP défini. Il faut soit modifier l\'intervalle DHCP choisi ou supprimer l\'appareil enregistré avec une adresse IP statique."
}
},
"dns":
{
"label":
{
"title":"r&eacute;seau",
"subtitle":"le serveur DNS sert &agrave; convertir les noms de domaine en adresses IP et inversement.",
"tab":"DNS",
"setup":"Configuration DNS",
"primary":"DNS primaire",
"secondary":"DNS secondaire",
"info":"vous pouvez visualiser tous les appareils de votre r&eacute;seau local",
"localnetwork":"appareils du r&eacute;seau local",
"name":"nom",
"dnsname":"nom DNS",
"ipaddress":"adresse IP"
},
"text":
{
"help":"<h6>DNS</h6>les serveurs DNS d’orange sont utilis&eacute;s par d&eacute;faut et ne sont pas modifiable sur la Livebox<br/><h6>noms DNS sur le r&eacute;seau local</h6>vous pouvez donner un nom &agrave; chacun de vos appareils pour mieux les retrouver si vous en avez besoin."
},
"error":
{
"empty":
{
"description":"valeur vide"
},
"length":
{
"description":"valeur limit&eacute;e &agrave; 64 caract&egrave;res"
},
"invalid":
{
"description":"Nom de p&eacute;riph&eacute;rique invalide"
}
}
},
"upnp":
{
"label":
{
"title":"r&eacute;seau",
"subtitle":"la fonction UPnP IGD permet aux applications d\'ouvrir des r&egrave;gles NAT/PAT automatiquement en toute s&eacute;curit&eacute; (utile pour messagerie instantanée, jeux en ligne ...)",
"tab":"UPnP",
"setup":"configuration UPnP",
"info":"&nbsp;activer UPnP IGD",
"table":"table des r&egrave;gles UPnP IGD",
"application":"application/service",
"externport":"port externe",
"internport":"port interne",
"protocol":"protocole",
"nameadress":"nom / adresse IP",
"hostipaddress":"addresse IP hote"
},
"warning":"les applications qui ont cr&eacute;&eacute;es des r&eacute;gles de NAT via UPnP IGD peuvent ne plus fonctionner correctement",
"text":
{
"help":"<h6>activer UPnP IGD</h6>le service UPnP IGD est activ&eacute; par d&eacute;faut. vous pouvez le d&eacute;sactiver si vous ne souhaitez pas que les apllications cr&eacute;ent automatiquement des redirections de ports.<br/><br/><h6>si vous souhaitez d&eacute;sactiver / activer ce service,</h6>n\'oubliez pas de cliquer sur le bouton \"enregistrer\" pour que ce changement soit pris en compte."
}
},
"dyndns":
{
"label":
{
"title":"r&eacute;seau",
"subtitle":"Cette page vous permet de configurer une DynDNS. Le service DynDNS vous permet d’attribuer un nom de domaine et d’hôte fixe, facile &agrave; m&eacute;moriser, &agrave; une adresse IP statique ou dynamique ou une longue URL. Ainsi vous pourrez acc&eacute;der &agrave; votre serveur sur votre r&eacute;seau local.",
"tab":"DynDNS",
"info":"Utiliser DynDNS peut s’av&eacute;rer utile si vous h&eacute;bergez un site web, un serveur FTP ou tout autre type de serveur derri&egrave;re votre Livebox. Vous pourrez ainsi le retrouver avec un nom du type monserveur.dyndns.org",
"setup":"configuration DynDNS",
"localnetwork":"",
"hostname":"nom d\'h&ocirc;te<br/>complet",
"username":"nom d\'utilisateur<br/>email",
"lastupdate":"derni&egrave;re mise &agrave; jour",
"service":"service",
"none":"aucune"
},
"text":
{
"help":"<h6>service</h6>choisissez le fournisseur DynDNS auquel vous avez souscrit le nom DynDNS.<br/><br/><h6>nom d\'hôte</h6>choisissez votre nom de domaine.<br/><br/><h6>identifiant / e-mail</h6>saisissez le nom d\'utilisateur correspondant &agrave; votre compte DynDNS.<br/><br/><h6>mot de passe</h6>saisissez le mot de passe correspondant &agrave; votre compte DynDNS<br/>"
},
"error":"serveur dynDNS invalide",
"errorduplicate":"nom d\'hote d&eacute;j&agrave; utilis&eacute; par un autre service"
},
"dmz":
{
"label":
{
"title":"r&eacute;seau",
"subtitle":"la fonction DMZ permet &agrave; un de vos ordinateurs d\'être accessible depuis Internet.",
"tab":"DMZ",
"setup":"configuration DMZ",
"info":"configurer une DMZ sur un ordinateur",
"dmz":"DMZ",
"name":"nom",
"ip":"adresse IP",
"macaddress":"adresse MAC",
"warning":"vous devez associer une adresse IP statique &agrave; cet appareil dans la page DHCP",
"current":"la DMZ actuelle est :",
"nodmz":"aucune",
"staticip":"adresse statique..."
},
"text":
{
"help":"<h6>configurer une DMZ</h6>tous les ports de votre ordinateur seront accessbiles depuis Internet et redirig&eacute;s vers l\'adresse IP de l\'&eacute;quipement. <br/><br/>pour configurer une DMZ sur votre ordinateur, vous devez associer une adresse IP statique &agrave; cet &eacute;quipement dans la page DHCP. <br/>"
},
"error":
{
"ipaddress":
{
"bad":"adresse IP invalide"
}
}
},
"ntp":
{
"label":
{
"title":"r&eacute;seau",
"subtitle":"configurer le fuseau horaire de la Livebox",
"tab":"NTP",
"currentdate":"date courante:",
"timezone":"s&eacute;lectionner un fuseau horaire:"
}
}
},
"ports":
{
"label":
{
"title":"configuration des ports",
"subtitle":"configuration des ports ethernet pour la TV",
"fullrouted":"je n\'ai pas de d&eacute;codeur TV Orange<br />ou j\'ai un d&eacute;codeur TV Orange",
"bridged":"j\'ai plusieurs d&eacute;codeurs TV Orange",
"bridged2":"I have more than one internet set top box",
"fullrouted2":"I have no set top box or one set top box ( internet TV or satellite TV)",
"info":"je peux brancher mes appareils &agrave; Internet et mes deux d&eacute;codeurs TV sur les ports Ethernet suivants:",
"liveboxports":"ports de la Livebox",
"computers":"ordinateurs",
"stb":"d&eacute;codeur tv",
"sat":"Satellite TV",
"iptv":"Internet TV",
"iptv1":"Internet TV 1",
"iptv2":"Internet TV 2",
"ftth":"FTTH",
"automatic":
{
"mode":"Automatiquement"
},
"manually":
{
"mode":"Manuellement",
"bridged":"Bridged",
"routed":"Routed",
"disabled":"Désactivé"
}
},
"info":
{
"comment":"si vous avez deux d&eacute;codeurs TV, vous ne pouvez pas b&eacute;n&eacute;ficier du service \"acc&egrave;s multim&eacute;dia\" de la Livebox et du d&eacute;codeur TV"
},
"text":
{
"help":"<h6>la TV par orange</h6>ce sont des chaines exclusives, des offres de vid&eacute;o &agrave; la demande, la TV de rattrapage et bien plus encore."
}
},
"accesstype":
{
"label":
{
"title":"connexion &agrave; internet",
"subtitle":"",
"offer":"veuillez s&eacute;lectionner l\'offre &agrave; laquelle vous avez souscrit:",
"howtoinstall":"veuillez saisir votre identifiant et votre mot de passe de connexion.",
"login":"identifiant<br/>de connexion",
"password":"mot de passe<br/>de connexion",
"warning":
{
"fr":"votre identifiant et votre mot de passe de connexion sont disponibles dans votre lettre de confirmation d\'abonnement",
"pl":"",
"mini_fr":"votre identifiant et votre mot de passe de connexion sont disponibles dans votre lettre de confirmation d\'abonnement"
}
},
"offer":
{
"adsl":
{
"radiobutton":"ADSL"
},
"fiber":
{
"radiobutton":"La fibre"
}
},
"error":
{
"label":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement saisi votre identifiant et votre mot de passe de connexion.",
"orange":
{
"label":"attention",
"description":"vous ne pourvez pas modifier vos param&egrave;tres de connexion internet tant que le service \'Orange Wifi\' est activ&eacute;."
},
"empty":
{
"label":"saisie incorrecte",
"description":"v&eacute;rifiez que vous avez correctement saisi votre identifiant et votre mot de passe de connexion."
},
"running":
{
"label":"authentification",
"description":"authentification en cours"
},
"adsl_link":
{
"label":"erreur ADSL",
"description":"liaison ADSL non disponible"
},
"ftth_link":
{
"label":"erreur FTTH",
"description":"liaison FTTH non disponible"
},
"ppp_server":
{
"label":"erreur PPP",
"description":"&eacute;chec de connexion au serveur PPP"
},
"authentication":
{
"label":"erreur",
"description":"erreur d\'authentification"
},
"ppp_timeout":
{
"label":"erreur PPP",
"description":"pas de r&eacute;ponse du serveur PPP"
},
"restart":
{
"label":"authentification",
"description":"authentification en cours"
}
},
"connected":
{
"label":"connect&eacute;",
"description":"connect&eacute;"
},
"text":
{
"help":
{
"fr":"<h6>type de connexion</h6>votre Livebox est conçue pour fonctionner &agrave; la fois sur le r&eacute;seau ADSL et sur le r&eacute;seau Fibre. Un seul des modes de connexion est disponible &agrave; la fois.<br/><br/><h6>identifiant de connexion</h6>cet identifiant vous identifie en tant que client Orange et vous permet de b&eacute;n&eacute;ficier d\'Internet et de tous vos services Orange. Il commence par fti/ (ex: fti/wwpfiz27). Conservez-le pr&eacute;cieusement, il pourra vous servir si vous devez reconfigurer vorte connexion (changement d\'ordinateur,…).<br/><br/><h6>mot de passe de connexion</h6>associ&eacute; &agrave; votre identifiant de connexion, c’est la \"cl&eacute;\" qui vous ouvre les porte d\'internet.",
"pl":"",
"mini_fr":"<h6>type de connexion</h6>votre Livebox est conçue pour fonctionner &agrave; la fois sur le r&eacute;seau ADSL et sur le r&eacute;seau Fibre. Un seul des modes de connexion est disponible &agrave; la fois.<br/><br/><h6>identifiant de connexion</h6>cet identifiant permet aux serveurs Orange de vous reconnaître en tant que client et vous permet de b&eacute;n&eacute;ficier &agrave; Internet. Il commence par fti/ (ex: fti/wwpfiz27). Conservez-le pr&eacute;cieusement, il pourra vous servir si vous devez reconfigurer vorte connexion (changement d\'ordinateur,…).<br/><br/><h6>mot de passe de connexion</h6>associ&eacute; &agrave; votre identifiant de connexion, c’est la \"cl&eacute;\" qui vous ouvre les porte d\'internet."
}
}
},
"admin":
{
"label":
{
"title":"administration",
"subtitle":"modifier le mot de passe d\'administration de la Livebox",
"info":"compte d\'administration : admin",
"password":"mot de passe courant :",
"newpassword":"nouveau mot de passe :",
"confirmnewpassword":"confirmation du nouveau mot de passe :",
"passwordmodified":"votre mot de passe a &eacute;t&eacute; modifi&eacute;"
},
"text":
{
"help":"<h6>compte d\'administration de la Livebox</h6>le compte d\'administration admin n\'est pas modifiable. <h6>mot de passe d\'administration de la Livebox</h6>le mot de passe d\'administration de la Livebox vous permet de vous authentifier sur votre Livebox. Il est modifiable et il vous sera demand&eacute; &agrave; chaque connexion pour acc&eacute;der aux pages \"configuration\", \"assistance\" et “configuration avanc&eacute;e”"
},
"error":
{
"label":
{
"currentpassword":"mot de passe invalide",
"newpassword":"mot de passe invalide",
"confirmnewpassword":"mot de passe invalide"
},
"description":
{
"currentpassword":"mot de passe courant invalide",
"newpassword":"Mot de passe invalide. Il doit comporter entre 4 et 32 caract&egrave;res",
"confirmnewpassword":"Les mots de passe sont diff&eacute;rents",
"success":"le mot de passe a &eacute;t&eacute; chang&eacute; avec succ&egrave;s",
"empty":"mot de passe vide"
}
}
},
"fxo":
{
"label":
{
"title":"configuration de la ligne t&eacute;l&eacute;phonique",
"subtitle":"If phone line is configured as activated, you can receive and make calls using your fix line number on the telephone connected to the livebox. In case it is deactivated, only internet line phone calls can be received and initialized via the telephone connected to the livebox.",
"activated":"activated",
"deactivated":"deactivated"
}
}
},
"rescuefirmware":
{
"label":
{
"title":"rescue firmware",
"subtitle":"une mise &agrave; jour du logiciel est en cours dans votre Livebox. cette mise &agrave; jour dure entre 5 et 15 minutes, p&eacute;riode durant laquelle vous ne pouvez pas avoir acc&egrave;s &agrave; Internet. a la fin de la mise &agrave; jour, votre Livebox red&eacute;marre automatiquement.",
"offer":"veuillez s&eacute;lectionner l\'offre &agrave; laquelle vous avez souscrit:",
"howtoinstall":"veuillez saisir votre identifiant et votre mot de passe de connexion.",
"login":"identifiant<br/>de connexion",
"password":"mot de passe<br/>de connexion",
"warning":"votre identifiant et votre mot de passe de connexion sont disponibles dans votre lettre de confirmation d\'abonnement"
},
"offer":
{
"radiobutton":
{
"adsl":"ADSL",
"fiber":"La fibre"
}
},
"error":
{
"label":"attention",
"description":"n\'&eacute;teignez pas votre Livebox durant la mise &agrave; jour du logiciel."
}
},
"firmwareupgrade":
{
"label":
{
"title":"rescue firmware",
"subtitle":"une mise &agrave; jour du logiciel de la Livebox est en cours d\'installation. pendant cette proc&eacute;dure, le voyant bleu de votre Livebox va clignoter et vous ne pourrez pas acc&eacute;der &agrave; internet pendant 15 minutes. quand ça sera termin&eacute;, votre Livebox va red&eacute;marrer automatiquement.<br/><br/><br/>merci de ne pas &eacute;teindre votre Livebox ou de d&eacute;brancher le lien ADSL tant que le voyant bleu clignote. cette mise &agrave; jour ne peut être arrêt&eacute;e.<br/><br/><br/>apr&egrave;s la mise &agrave; jour, vous pourrez utiliser de nouvelles fonctions de votre Livebox.<br/><br/><br/>merci de ne pas &eacute;teindre votre Livebox pendant la mise &agrave; jour. si vous rencontrez un probl&egrave;me merci de contacter le support t&eacute;l&eacute;phonique.<br/><br/>"
}
},
"legal":
{
"label":
{
"title":"informations l&eacute;gales",
"comment":"La passerelle domestique Livebox se base notamment sur des logiciels publi&eacute;s sous une licence dite libre ou open source, comme par exemple le noyau Linux, Busybox ou Iptables, tous les trois publi&eacute;s selon les termes de la licence GNU General Public License (GNU GPL). Le client peut consulter la liste des logiciels concern&eacute;s, leur licence et t&eacute;l&eacute;charger leur code source complet et correspondant sur le site web <a href=\'http://www.livebox-floss.com\' target=\'_blank\'>http://www.livebox-floss.com</a>. Pour chaque version d\'un logiciel concern&eacute;, le client pourra acc&eacute;der à l\'ensemble de ces informations tant que cette version sera mise à disposition via la Livebox, puis pendant trois (3) ans après la date de d&eacute;ploiement d\'une nouvelle version du logiciel ou du terme d&eacute;finitif de la mise à disposition de ladite version via la Livebox. Avant d\'utiliser l\'un de ces logiciels disponibles sur le site web <a href=\'http://www.livebox-floss.com\' target=\'_blank\'>http://www.livebox-floss.com</a>, le client devra pr&eacute;alablement prendre connaissance de la licence associ&eacute;e et en accepter les termes et conditions. En outre, le client reconnaît que ces logiciels ne font pas l\'objet de garantie conform&eacute;ment aux termes de la licence qui leur est applicable."
}
}
};
var Translations = AllTranslations["fr"];
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/ctl.js */
/* Cytadelle Technology Light JavaScript framework, version 1.0
*
* This file is part of Cytadelle Technology Light JavaScript framework.
* Developped by Arnaud BELDAME
*
* Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
* The licensor permits others to copy, distribute,
* display, and perform the work. In return,
* licensees must give the original author credit.
*
* The licensor permits others to copy, distribute,
* display, and perform the work. In return, licensees
* may not use the work for commercial purposes --
* unless they get the licensor's permission.
*
* The licensor permits others to distribute derivative
* works only under a license identical to the one that
* governs the licensor's work
*/
function $CYT(selector,oParent)
{
if (oParent == undefined ) oParent = document;
var i, n;
var szItem;
var oElement = null;
var tElements = [];
var oContext;
if(/^#/.test(selector) && !/\s/.test(selector) && !/\./.test(selector)) // Id
{
return oParent.getElementById(selector.replace(/#/,''));
}
else if(/^\[/.test(selector) && !/\s/.test(selector)) // Form
{
if (/\./.test(selector))
{
oContext = $CYT(selector.split(/\./)[0]);
szItem = selector.split(/\./)[1];
oElement = null;
tElements = [];
for (i=0,n=oContext.elements.length;i<n;i++)
if (oContext.elements[i].name == szItem)
{
tElements.push(oContext.elements[i]);
}
if (tElements.length == 0) return [];
return tElements;
}
else
{
szItem = selector.replace('[','').replace(']','');
oElement = null;
for (i=0,n=document.forms.length;i<n;i++)
if (document.forms[i].name == szItem)
{
oElement = document.forms[i];
break;
}
return oElement;
}
}
else // Tag or Class
{
var szTagOrStyle;
var szTagName;
var szStyleName;
if(/\./.test(selector)) // class
{
oContext = (/\s/.test(selector))? $CYT(selector.split(/\s/)[0],oParent) : oParent;
szTagOrStyle = (/\s/.test(selector))? selector.split(/\s/)[1] : selector;
szTagName = (/^\./.test(szTagOrStyle))? "*" : szTagOrStyle.split(/\./)[0];
szStyleName = (/^\./.test(szTagOrStyle))? szTagOrStyle.replace(/\./,'') : szTagOrStyle.substr(szTagName.length +1);
}
else // tag
{
oContext = (/\s/.test(selector))? $CYT(selector.split(/\s/)[0],oParent) : oParent;
szTagName = (/\s/.test(selector))? selector.split(/\s/)[1] : selector;
}
tElements = [], tTags = oContext.getElementsByTagName(szTagName), oReturn = null;
for (i=0,n=tTags.length;i<n; i++)
{
if(szStyleName)
{
if(RegExp("(^|\\s)"+szStyleName+"(\\s|$)").test(tTags[i].className))
tElements.push(tTags[i]);
}else{
tElements.push(tTags[i]);
}
}
if (tElements.length == 0) return [];
return tElements;
}
}
var ctl = {
preload : (function()
{
// Object
var _toString = Object.prototype.toString;
function extend(destination, source)
{
for (var property in source)
destination[property] = source[property];
return destination;
}
function getAncestors(object,szTagName)
{
var tObjects = [];
while(object != null && object != document)
{
if (object.tagName == szTagName || isUndefined(szTagName))
tObjects.push(object);
object = object.parentNode;
}
return tObjects;
}
function getFirstChildByTagName(object,szTagName)
{
for(var i=0,n=object.childNodes.length;i<n;i++)
if (object.childNodes[i].tagName == szTagName)
return object.childNodes[i];
return undefined;
}
function getChildsByTagName(object,szTagName)
{
var tRes = Array();
for(var i=0,n=object.childNodes.length;i<n;i++)
if (object.childNodes[i].tagName == szTagName)
tRes.push(object.childNodes[i]);
return tRes;
}
function isElement(object) {return !!(object && object.nodeType == 1);}
function isArray(object) {return _toString.call(object) == "[object Array]";}
function isFunction(object) {return typeof object === "function";}
function isString(object) {return _toString.call(object) == "[object String]";}
function isNumber(object) {return _toString.call(object) == "[object Number]";}
function isUndefined(object){return typeof object === "undefined";}
function isEmpty(object) {return (typeof object === "undefined" || object == "");}
// CLEAN OBJECT FROM MEMORY
function clean(object)
{
if (!object) return;
// Clean attributes
var a = object.attributes, i, l, n;
if (a)
{
l = a.length;
for (i = 0; i < l; i += 1)
{
try
{
n = a[i].name;
if (typeof object[n] === 'function')
object[n] = null;
}catch(e){}
}
}
// Clean child nodes
a = object.childNodes;
if (a)
{
while (object.childNodes.length > 0)
{
Object.clean(object.firstChild);
object.removeChild(object.firstChild);
}
}
}
function clone(object) {return extend({ }, object);}
function forEach(tArray,fnDelegate,ownpropertiesonly)
{
if (typeof(fnDelegate) == "function")
{
if (this instanceof Array && typeof(ownpropertiesonly) == "undefined")
ownpropertiesonly = true;
for (key in tArray)
{
var ok = (!ownpropertiesonly);
if (!ok)
{
try{ok = tArray.hasOwnProperty(key);}catch(ex){}
}
if (ok)
{
try{ fnDelegate(tArray[key],key,tArray);}catch(ex){}
}
}
}
}
function map(tArray,fnIterator)
{
var tResult = [];
if (typeof fnIterator != "function")
throw new TypeError();
for(var i=0,n=tArray.length;i<n;i++)
tResult[i] = fnIterator.call(arguments[1], tArray[i],i,tArray)
return tResult;
}
extend(Object, {
extend: extend,
getChildsByTagName: getChildsByTagName,
getFirstChildByTagName: getFirstChildByTagName,
getAncestors :getAncestors,
clone: clone,
clean: clean,
isElement: isElement,
isArray: isArray,
isFunction: isFunction,
isString: isString,
isNumber: isNumber,
isUndefined: isUndefined,
isEmpty: isEmpty,
forEach: forEach,
map: map
});
// Functions
// Object.extend(Function.prototype, (function()
// {
// function bind(context)
// {
// if (Object.isUndefined(arguments[0])) return this;
// var _fnMethod = this; //, _tArgs = _slice.call(arguments, 1);
//
// return function()
// {
// //var a = merge(_tArgs, arguments);
// //return _fnMethod.apply(context, a);
// return _fnMethod.apply(context, arguments);
// }
// }
//
// return {
// bind:bind
// }
// })());
// String
Object.extend(String.prototype,(function()
{
function extractTags(tag)
{
var matchAll = new RegExp('(?:<' + tag + '.*?>)((\n|\r|.)*?)(?:<\/' + tag + '>)','img');
var matchOne = new RegExp('(?:<' + tag + '.*?>)((\n|\r|.)*?)(?:<\/' + tag + '>)','im');
var tMatched = (this.match(matchAll) || []);
return Object.map(tMatched,function(scriptTag){ return (scriptTag.match(matchOne) || ['', ''])[1];});
}
function urlencode()
{
var szStr = escape(this);
return szStr.replace(/[*+\/@&,=\s]/g,function (s)
{
switch (s)
{
case " ": s = "%20"; break;
case "*": s = "%2A"; break;
case "+": s = "%2B"; break;
case ",": s = "%2C"; break;
case "/": s = "%2F"; break;
case "=": s = "%3D"; break;
case "@": s = "%40"; break;
case "&": s = "%26"; break;
}
return s;
});
}
return {
extractTags: extractTags,
urlencode: urlencode
}
})());
return true;
})(),
/*log:
{
enable : true,
log : function(szText) {if (this._console && this.enable) this._console.log(szText);},
info : function(szText) {if (this._console && this.enable) this._console.info(szText);},
error : function(szText) {if (this._console && this.enable) this._console.error(szText);},
warn : function(szText) {if (this._console && this.enable) this._console.warn(szText);},
_console : (console ? console : (window.console ? window.console : null))
},*/
window :
{
size :
{
Get : function()
{
var iWinW = 630, iWinH = 460;
if (parseInt(navigator.appVersion,10)>3)
{
if (navigator.appName=="Netscape")
{
iWinW = window.innerWidth -16;
iWinH = window.innerHeight -16;
}
if (navigator.appName.indexOf("Microsoft")!=-1)
{
var hDoc = $CYT('#document');
if (hDoc)
{
iWinW = hDoc.offsetWidth;
iWinH = hDoc.offsetHeight;
}else{
iWinW = document.body.offsetWidth;
iWinH = document.body.offsetHeight;
}
}
}
return {"Screen":{"Width":screen.availWidth, "Height":screen.availHeight},"Window": {"X":0, "Y":0, "Width":iWinW, "Height":iWinH}};
},
Set : function(iX,iY,iWidth,iHeight)
{
//if (iX != undefined)
// ;
window.resizeTo(iWidth,iHeight);
}
}
},
msgbox :
{
QUESTION : {OK : 0, YES_NO : 1, YES_CANCEL : 2, VALID_CANCEL : 3, INFO : 4},
_tQueue : [],
_bRunning : false,
Show : function(parQuestionType,parMsg,parCallBackBtn1,parCallBackBtn2,parCallBackParam)
{
// Add to the msgbox Queue
this._tQueue.push({
"QuestionType":parQuestionType,
"Message":parMsg,
"CallBackBtn1":parCallBackBtn1,
"CallBackBtn2":parCallBackBtn2,
"CallBackParam":parCallBackParam
});
// Try to display the dialog box
this._Show();
},
_Show : function()
{
var jMsgBox, fnCallBackButton1 = 0, fnCallBackButton2 = 0;
// If the msgbox is already visible then leave
if (this._Running == true) return;
if (this._tQueue.length == 0) return;
// Display the msgbox
this._bRunning = true;
jMsgBox = this._tQueue.shift();
// Set the popup message
$CYT('#ct-msgbox-msg').innerHTML = jMsgBox.Message;
// If the callback btn1
fnCallBackButton1 = function(){
$CYT("#ct-msgbox").style.display = 'none';
$CYT("#ct-backlayer").style.display = 'none';
if (jMsgBox.CallBackBtn1 != undefined)
jMsgBox.CallBackBtn1(jMsgBox.CallBackParam);
this._bRunning = false;
this._Show();
return false;
};
// If the callback btn2
fnCallBackButton2 = function(){
$CYT("#ct-msgbox").style.display = 'none';
$CYT("#ct-backlayer").style.display = 'none';
if (jMsgBox.CallBackBtn2 != undefined)
jMsgBox.CallBackBtn2(jMsgBox.CallBackParam);
this._bRunning = false;
this._Show();
return false;
};
//
var oBtn1 = $CYT('#ct-msgbox-button1');
var oBtn2 = $CYT('#ct-msgbox-button2');
var oBtn3 = $CYT('#ct-msgbox-button3');
var ico = $CYT('#ct-msgbox-img');
switch(jMsgBox.QuestionType)
{
case this.QUESTION.INFO:
oBtn1.style.display = 'none';
oBtn2.style.display = 'none';
oBtn3.style.display = 'block';
oBtn3.value = t("general.btn.ok");
oBtn3.className = 'png input-btn input-btn-orange-small';
oBtn3.onclick = fnCallBackButton1.bind(this);
ico.className = 'mb-info';
break;
case this.QUESTION.YES_NO:
oBtn1.style.display = 'block';
oBtn1.value = t("general.btn.yes");
oBtn1.className = 'png input-btn input-btn-orange-small';
oBtn1.onclick = fnCallBackButton2.bind(this);
oBtn2.style.display = 'block';
oBtn2.value = t("general.btn.no");
oBtn2.className = 'png input-btn input-btn-gray-small';
oBtn2.onclick = fnCallBackButton1.bind(this);
oBtn3.style.display = 'none';
ico.className = 'mb-yesno';
break;
case this.QUESTION.YES_CANCEL:
oBtn1.style.display = 'block';
oBtn1.value = t("general.btn.cancel");
oBtn1.className = 'png input-btn input-btn-gray-small';
oBtn1.onclick = fnCallBackButton1.bind(this);
oBtn2.style.display = 'block';
oBtn2.value = t("general.btn.yes");
oBtn2.className = 'png input-btn input-btn-orange-small';
oBtn2.onclick = fnCallBackButton2.bind(this);
oBtn3.style.display = 'none';
ico.className = 'mb-yescancel';
break;
case this.QUESTION.VALID_CANCEL:
oBtn1.style.display = 'block';
oBtn1.value = t("general.btn.cancel");
oBtn1.className = 'png input-btn input-btn-gray-small';
oBtn1.onclick = fnCallBackButton1.bind(this);
oBtn2.style.display = 'inline';
oBtn2.value = t("general.btn.valid");
oBtn2.className = 'png input-btn input-btn-orange-small';
oBtn2.onclick = fnCallBackButton2.bind(this);
oBtn3.style.display = 'none';
ico.className = 'mb-validcancel';
break;
default:
oBtn1.style.display = 'none';
oBtn2.style.display = 'none';
oBtn3.style.display = 'block';
oBtn3.value = t("general.btn.ok");
oBtn3.className = 'png input-btn input-btn-orange-small';
oBtn3.onclick = fnCallBackButton1.bind(this);
ico.className = 'mb-ok';
break;
}
// Display animation
ctl.animations.Create('linear',0,100,function()
{
var oCTBacklayer = $CYT("#ct-backlayer");
oCTBacklayer.style.opacity = '.0';
oCTBacklayer.style.filter = 'alpha(opacity=0)';
oCTBacklayer.style.display = "block";
return true;
},
function(iValue)
{
var oCTBacklayer = $CYT("#ct-backlayer");
oCTBacklayer.style.opacity = '.' + ((iValue * 0.003) + "").substring(2);
oCTBacklayer.style.filter = 'alpha(opacity=' + (iValue * 0.3) + ')';
return true;
},
function()
{
var oCTMsgBox = $CYT("#ct-msgbox");
oCTMsgBox.style.display = "block";
return true;
});
ctl.animations.Start();
/* Set the focus */
window.setTimeout(function () {
if ($CYT('#ct-msgbox-button3').style.display != 'none')
$CYT('#ct-msgbox-button3').focus();
else
$CYT('#ct-msgbox-button1').focus();
}, 1300);
}
},
waiting:
{
Show : function()
{
var oCTBacklayer = $CYT("#ct-backlayer");
oCTBacklayer.style.opacity = '.15';
oCTBacklayer.style.filter = 'alpha(opacity=15)';
oCTBacklayer.style.display = "block";
$CYT('#ct-waiting img')[0].src = appUrl + '/images/' + appConfig + '/common/waiting.gif';
$CYT("#ct-waiting").style.display = 'block';
},
Hide : function()
{
$CYT("#ct-backlayer").style.display = 'none';
$CYT("#ct-waiting").style.display = 'none';
}
},
popup:
{
_is_opened:false,
Load : function(szUrl)
{
ctl.ajax.Get(szUrl,"",function(szData)
{
ctl.popup.LoadContent(szData);
});
},
Resize : function(iWidth,iHeight)
{
var oCTPopup = $CYT("#ct-popup");
oCTPopup.style.width = (iWidth - 4 ) + 'px';
oCTPopup.style.marginLeft = (- (iWidth / 2)) + 'px';
oCTPopup.style.height = (iHeight - 8) + 'px';
oCTPopup.style.marginTop = (- (iHeight / 2)) + 'px';
oCTPopup.childNodes[3].style.height = (iHeight - 4 - 40) + 'px';
},
SetTitle : function(szTitle)
{
var oCTPopup = $CYT("#ct-popup");
oCTPopup.childNodes[1].firstChild.innerHTML = szTitle;
},
Open : function(szTitle,szContent,iWidth,iHeight)
{
var oCTPopup = $CYT("#ct-popup");
var oCTBacklayer = $CYT("#ct-backlayer");
// Multi popup bloker
if (this._is_opened) return;
this._is_opened = true;
// Set internal content
oCTPopup.childNodes[3].innerHTML = szContent;
oCTPopup.childNodes[1].firstChild.innerHTML = szTitle;
// Prepare to display the popup
oCTPopup.style.display = 'none';
this.Resize(iWidth,iHeight);
this.Show();
},
Show : function()
{
// Display animation
ctl.animations.Create('linear',0,100,function()
{
var oCTBacklayer = $CYT("#ct-backlayer");
oCTBacklayer.style.opacity = '.0';
oCTBacklayer.style.filter = 'alpha(opacity=0)';
oCTBacklayer.style.display = "block";
return true;
},
function(iValue)
{
var oCTBacklayer = $CYT("#ct-backlayer");
oCTBacklayer.style.opacity = '.' + ((iValue * 0.003) + "").substring(2);
oCTBacklayer.style.filter = 'alpha(opacity=' + (iValue * 0.3) + ')';
return true;
},
function()
{
var oCTPopup = $CYT("#ct-popup");
oCTPopup.style.display = "block";
return true;
});
ctl.animations.Start();
},
Close : function ()
{
var oCTPopup = $CYT("#ct-popup");
var oCTBacklayer = $CYT("#ct-backlayer");
// Clear motion in case of
if (this._motion_int != null)
{
clearInterval(this._motion_int);
this._motion_int = null;
this._motion_cur = 0;
}
// Hide popup
oCTPopup.style.display = 'none';
// Hide backlayer
oCTBacklayer.style.display = 'none';
// Reset flag
this._is_opened = false;
},
LoadContent : function(parContent)
{
// Get the div target
var oCTPopup = $CYT("#ct-popup");
var oTarget = oCTPopup.childNodes[3];
Object.clean(oTarget);
// Clean the div
oTarget.innerHTML = parContent;
// Find all scripts and concat them
szFullScript = "";
szFullStyle = "";
parContent.extractTags("script").each(function(szScript){szFullScript += szScript;});
parContent.extractTags("style").each(function(szStyle){szFullStyle += szStyle;});
// Create and add the new script tag withing the JS code to execute
var oScript = document.createElement('SCRIPT');
oScript.setAttribute("type","text/javascript");
oScript.text = szFullScript;
oTarget.appendChild(oScript);
// Create and add the new style tag withing the CSS code
var oStyle = document.createElement('STYLE');
oStyle.setAttribute("type","text/css");
oStyle = oTarget.appendChild(oStyle);
if(oStyle.styleSheet) // IE
{
oStyle.styleSheet.cssText = szFullStyle;
}
else // w3c
{
var cssText = document.createTextNode(szFullStyle);
oStyle.appendChild(cssText);
}
// Activate translation mechanism
Sah.translator.refresh();
}
},
mouse :
{
GetEvent : function(oEvent,hWindow)
{
// --------------------------------------------------------------------------------------------
// Variables
var iPosX = 0,iPosY = 0, oTarget, oResult, iButton;
if (!hWindow) hWindow = window;
if (!oEvent) oEvent = hWindow.event;
// --------------------------------------------------------------------------------------------
// Get data from event data if this is a fake dispatch
if (typeof oEvent.event_data != "undefined")
{
iPosX = oEvent.event_data.X;
iPosY = oEvent.event_data.Y;
iButton = oEvent.event_data.Button;
oTarget = oEvent.event_data.Target;
}
else
// --------------------------------------------------------------------------------------------
// Compute position and get objects
{
// Get button
iButton = (oEvent.which ? (oEvent.which == 3 ? 2:1): (oEvent.button== 2 ? 2:1));
// Get pos X and Y
if (oEvent.pageX || oEvent.pageY)
{
iPosX = oEvent.pageX;
iPosY = oEvent.pageY;
}
// IE
else if (oEvent.clientX || oEvent.clientY)
{
iPosX = oEvent.clientX;
iPosY = oEvent.clientY;
if (hWindow.document)
{
if (hWindow.document.body) iPosX += hWindow.document.body.scrollLeft;
if (hWindow.document.body) iPosY += hWindow.document.body.scrollTop;
if (hWindow.document.documentElement) iPosX += hWindow.document.documentElement.scrollLeft;
if (hWindow.document.documentElement) iPosY += hWindow.document.documentElement.scrollTop;
}
}
// Clicked
if (oEvent.target)
oTarget=oEvent.target;
else if (oEvent.srcElement)
oTarget=oEvent.srcElement;
if (oTarget.nodeType==3) // Defeat Safari bug
oTarget = oTarget.parentNode;
}
// --------------------------------------------------------------------------------------------
// Result
oResult = { "X": iPosX,
"Y": iPosY,
"Target":oTarget,
"Event": oEvent.type,
"Button":iButton};
return oResult;
}
},
event :
{
Bind : function(oElem, sEvType, parFnCallback)
{
var fnOldCB = oElem['on' + sEvType] = parFnCallback;
if (typeof(oElem['on' + sEvType]) != "function")
oElem['on' + sEvType] = parCallBack;
else
{
oElem['on' + sEvType] = function()
{
var bRes = parFnCallback();
if (!bRes) return false;
return fnOldCB();
}
}
},
Add : function(oElem, sEvType, parFnCallback, bCapture)
{
return oElem.addEventListener? oElem.addEventListener(sEvType, parFnCallback, bCapture):
oElem.attachEvent? oElem.attachEvent('on' + sEvType, parFnCallback):oElem['on' + sEvType] = parFnCallback;
},
Remove : function(oElem, sEvType, parFnCallback, bCapture)
{
return oElem.removeEventListener? oElem.removeEventListener(sEvType, parFnCallback, bCapture):
oElem.detachEvent? oElem.detachEvent('on' + sEvType, parFnCallback):oElem['on' + sEvType] = "";
},
PreventDefault : function(oEvent)
{
if (oEvent.preventDefault)
oEvent.preventDefault();
return false;
}
},
style :
{
Get : function(oElem)
{
return (oElem.getAttribute("style") || "");
},
Set : function(oElem,szStyle)
{
if (oElem.style.setAttribute)
oElem.style.setAttribute("cssText",szStyle);
else
oElem.setAttribute("style",szStyle);
},
GetSheet : function(oElem)
{
if(document.defaultView && document.defaultView.getComputedStyle)
return document.defaultView.getComputedStyle(oElem,"");
else if(oElem.currentStyle)
return oElem.currentStyle;
},
GetStyle : function(oElem,szStyle)
{
var oStyleSheet = this.GetSheet(oElem);
return oStyleSheet[szStyle];
},
GetDimensions : function (oElem)
{
var szStyleDisplay = this.GetStyle(oElem,"display");
if (szStyleDisplay != 'none' && szStyleDisplay != null) // Safari bug
return {width: oElem.offsetWidth, height: oElem.offsetHeight};
// Save original values
var oElemStyle = oElem.style;
var szOrigVisibility = oElemStyle.visibility;
var szOrigPosition = oElemStyle.position;
var szOrigDisplay = oElemStyle.display;
// Display block but hidden
oElemStyle.visibility = 'hidden';
oElemStyle.position = 'absolute';
oElemStyle.display = 'block';
// Save values
var iWidth = oElem.clientWidth;
var iHeight = oElem.clientHeight;
// Restore original values
oElemStyle.display = szOrigDisplay;
oElemStyle.position = szOrigPosition;
oElemStyle.visibility = szOrigVisibility;
return {width: iWidth, height: iHeight};
},
GetPosition : function (oObject)
{
var jOffset = {"X":0,"Y":0}, oCur = oObject;
while( oCur != null && oCur != document)
{
jOffset.X += oCur.offsetLeft;
jOffset.Y += oCur.offsetTop;
oCur = oCur.offsetParent;
}
return jOffset;
},
klass: {
Add : function(oElem,szStyle)
{
if (oElem == null || oElem == undefined || typeof(oElem) != "object") return false;
if (Object.isArray(oElem))
{
for(var i=0,n=oElem.length;i<n;i++)
{
if (!this.Has(oElem[i],szStyle))
oElem[i].className += " " + szStyle;
}
}
else
{
if (!this.Has(oElem,szStyle))
oElem.className += " " + szStyle;
}
return true;
},
Remove : function(oElem,szStyle)
{
if (oElem == null || oElem == undefined || typeof(oElem) != "object") return false;
if (Object.isArray(oElem))
{
for(var i=0,n=oElem.length;i<n;i++)
{
if (oElem[i].className != "")
oElem[i].className = oElem[i].className.replace(new RegExp('(\\s|^)'+szStyle+'(\\s|$)'),' ');
}
}
else
{
if (oElem.className != "")
oElem.className = oElem.className.replace(new RegExp('(\\s|^)'+szStyle+'(\\s|$)'),' ');
}
return true;
},
Has : function(oElem,szStyle)
{
if (oElem == null || oElem == undefined || typeof(oElem) != "object") return "";
return (oElem.className.match(new RegExp('(\\s|^)'+szStyle+'(\\s|$)')) != null);
}
}
},
animations :
{
_tAnimations : [],
_tAnimationsTypes : {
'default' : [1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1],
'blast' : [12,12,11,10,10,9,8,7,6,5,4,3,2,1],
'linear' : [10,10,10,10,10,10,10,10,10,10]
},
_bActive : false,
_iTickInterval : 20,
_oTickTimer : null,
Create : function(szType,iStart,iEnd,fnOnBegin,fnOnFrame,fnOnComplete)
{
//ctl.log.Debug('ctl.animator.Create()');
szType = szType || 'default';
// Add to the animation queue
var oObject = new Object();
oObject.onBegin = (fnOnBegin ? fnOnBegin : null);
oObject.onFrame = (fnOnFrame ? fnOnFrame : null);
oObject.onComplete = (fnOnComplete ? fnOnComplete : null);
oObject.bActive = true;
oObject.iFrameCount = this._tAnimationsTypes[szType].length;
oObject.iFrame = 0;
// Crate motion tween
var tTween = [iStart];
var iTmp = iStart;
var iDiff = iEnd - iStart;
for (var i=0 ; i < oObject.iFrameCount; i++)
{
iTmp += iDiff * this._tAnimationsTypes[szType][i] * 0.01;
tTween[i] = {};
tTween[i].data = iTmp;
tTween[i].event = null;
}
oObject.tTween = tTween;
// Push new animation into the array
this._tAnimations.push(oObject);
},
Start : function()
{
// Verify if the motion engine is already started
if (this._oTickTimer || this._bActive)
return false;
// Start the motion engine
this._bActive = true;
this._oTickTimer = setInterval(ctl.animations._onTick.bind(this),this._iTickInterval);
return true;
},
Stop : function()
{
// Verify if the motion engine is already stopped
if (!this._oTickTimer || !this._bActive)
return false;
clearInterval(this._oTickTimer);
this._oTickTimer = null;
this._bActive = false;
this._tAnimations = [];
return true;
},
_onFrame : function(iIndex)
{
// Get current animation
var oAnim = this._tAnimations[iIndex];
if (!oAnim.bActive)
return false;
// On begin
if (oAnim.iFrame == 0)
{
if (oAnim.onBegin)
if (!oAnim.onBegin())
oAnim.iFrame = oAnim.iFrameCount - 1;
}
// Call the tween callback
if (oAnim.onFrame && oAnim.tTween[oAnim.iFrame])
{
if (!oAnim.onFrame(oAnim.tTween[oAnim.iFrame].data))
oAnim.iFrame = oAnim.iFrameCount - 1;
}
// On complete
if (oAnim.iFrame++ >= oAnim.iFrameCount - 1)
{
oAnim.bActive = false;
oAnim.iFrame = 0;
if (oAnim.onComplete)
oAnim.onComplete();
return false;
}
return true;
},
_onTick : function()
{
var iActive = 0;
for (var i=0; i< this._tAnimations.length; i++)
{
if (this._tAnimations[i].bActive)
{
if (!this._onFrame(i))
{
this._tAnimations.splice(i,1);
i--;
}
else
{
iActive++;
}
}
}
if (iActive == 0 && this._oTickTimer)
this.Stop();
}
},
ajax :
{
// System attributes
_tQueue : [],
_bRunning : false,
_jAjaxRequest : null,
_fnReadyStateChanged : null,
_oTimeOut : null,
_fnWatchDog : null,
_oXMLHttp : (function()
{
try { return new XMLHttpRequest();} // Mozilla / Safari
catch (e)
{
// IE
var tXMLHttp = ['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'];
for (var i=0;i < tXMLHttp.length; i++)
{
try{ return new ActiveXObject(tXMLHttp[i]);}
catch (e){}
}
alert("<b>Ajax</b><br/>Unable to create XMLHttpRequest!");
//alert("<b>Ajax</b><br/>Unable to create XMLHttpRequest!");
return null;
}
})(),
// Public methods
Get : function(parUrl,parData,parCallBackFn,parCallBackParams,parErrorsHandler)
{
this.Request('GET',parUrl,parData,parCallBackFn,parCallBackParams,parErrorsHandler);
return false;
},
Post : function(parUrl,parData,parCallBackFn,parCallBackParams,parErrorsHandler)
{
this.Request('POST',parUrl,parData,parCallBackFn,parCallBackParams,parErrorsHandler);
return false;
},
Abort : function()
{
// Clear the watchdog
clearTimeout(this._oTimeOut);
this._oTimeOut = null;
// Abort
this._oXMLHttp.abort();
// Clean the request
delete this._jAjaxRequest;
this._jAjaxRequest = null;
// Retry
this._bRunning = false;
this._Request();
},
Request: function(parMethod,parUrl,parParams,parCallBackFn,parCallBackParam,parErrorsHandler)
{
if (this._tQueue.length > 20)
{
alert("<b>Ajax error</b><br/><br/>The message queue is full!");
//alert("<b>Ajax error</b><br/><br/>The message queue is full!");
return;
}
this._tQueue.push({
"Method":parMethod,
"Url":parUrl,
"Params":parParams,
"CallBackFn":parCallBackFn,
"CallBackParam":parCallBackParam,
"ErrorsHandler":parErrorsHandler,
"Response":""
});
this._Request();
},
// Private methods
_Request : function()
{
// Init the callback the first time
if (this._fnOnReadyStateChanged == null)
{
this._fnReadyStateChanged = this._RequestOnReadyStateChanged.bind(this);
this._oXMLHttp.onreadystatechange = this._fnReadyStateChanged;
this._fnWatchDog = this._WatchDog.bind(this);
}
// Verify is the ajax component is running and if the queue is not empty
if (this._tQueue.length <= 0) return;
if (this._bRunning == true) return;
this._bRunning = true;
// Get the next item in the queue
this._jAjaxRequest = this._tQueue.shift();
if (this._jAjaxRequest.Params == undefined) this._jAjaxRequest.Params = "";
// Start the watchdog 5 sec
this._oTimeOut = setTimeout(this._fnWatchDog,8000);
// Try to connect to the page
try
{
// Connection to the specified URL
if (/POST/.test(this._jAjaxRequest.Method))
this._oXMLHttp.open("POST",this._jAjaxRequest.Url,true);
else
this._oXMLHttp.open("GET", this._jAjaxRequest.Url + "?" + this._jAjaxRequest.Params,true);
// JSON or URLENCODED
if (/JSON/.test(this._jAjaxRequest.Method))
this._oXMLHttp.setRequestHeader('Content-Type','application/json');
else
this._oXMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
this._oXMLHttp.setRequestHeader("Cache-Control","no-cache");
// POST or GET
if (/POST/.test(this._jAjaxRequest.Method))
this._oXMLHttp.send(this._jAjaxRequest.Params);
else
this._oXMLHttp.send("");
// Clean the params
this._jAjaxRequest.Params = "";
}
catch(e)
{
if (this._jAjaxRequest == null)
{
this.Abort();
return;
}
// User errors handler
if (typeof(this._jAjaxRequest.ErrorsHandler) == "function")
this._jAjaxRequest.ErrorsHandler(e.name,this._jAjaxRequest.CallBackParam);
else
alert("<b>Ajax error</b><br/>" + e.name + "<br/>" + e.message);
//alert("<b>Ajax error</b><br/>" + e.name + "<br/>" + e.message);
this.Abort();
return;
}
},
_WatchDog : function(){ this.Abort();},
_RequestOnReadyStateChanged: function()
{
// Ready state management
switch(this._oXMLHttp.readyState)
{
case 0:return; // Not initalize
case 1:return; // Loading
case 2:return; // Loaded
case 3:return; // Interacting
case 4:break; // Finished
default:
alert("<b>Internal ajax error</b><br/><br/>State " + this._oXMLHttp.readyState + "<br/>Http bad state<br/>Method:" + this._jAjaxRequest.Method + "<br/>Url:" + this._jAjaxRequest.Url);
//alert("<b>Internal ajax error</b><br/><br/>State " + this._oXMLHttp.readyState + "<br/>Http bad state<br/>Method:" + this._jAjaxRequest.Method + "<br/>Url:" + this._jAjaxRequest.Url);
this.Abort();
return;
}
// The request has been performed
if (this._oXMLHttp.status == 200)
{
// Verify if an error exists
if (/MKO STDIO ERROR/.test(this._oXMLHttp.responseText) ||
/<b>Warning<\/b>/.test(this._oXMLHttp.responseText) ||
/<b>Fatal error<\/b>/.test(this._oXMLHttp.responseText))
{
alert(this._jAjaxRequest.Url + "\n" + this._oXMLHttp.responseText);
}
else if (this._jAjaxRequest.CallBackFn != undefined && this._jAjaxRequest.CallBackFn != "")
{
this._jAjaxRequest.CallBackFn(this._oXMLHttp.responseText,this._jAjaxRequest.CallBackParam);
}
this.Abort();
return;
}
// User errors handler
if (this._jAjaxRequest.ErrorsHandler != undefined && this._jAjaxRequest.ErrorsHandler != "")
{
this._jAjaxRequest.ErrorsHandler(this._oXMLHttp.status,this._jAjaxRequest.CallBackParam);
}
// Default errors handler
else switch(this._oXMLHttp.status)
{
case 0:break;
case 301:alert("<b>Internal ajax error 301</b><br/><br/>This page has been moved!<br/>" + this._jAjaxRequest.Url); break;
case 400:alert("<b>Internal ajax error 400</b><br/><br/>Bad request!<br/>" + this._jAjaxRequest.Url); break;
case 401:alert("<b>Internal ajax error 401</b><br/><br/>Not authorized!<br/>" + this._jAjaxRequest.Url); break;
case 403:alert("<b>Internal ajax error 403</b><br/><br/>Forbidden!<br/>" + this._jAjaxRequest.Url); break;
case 404:alert("<b>Internal ajax error 404</b><br/><br/>This page doesn't exists!<br/>" + this._jAjaxRequest.Url); break;
case 500:alert("<b>Internal ajax error 500</b><br/><br/>Internal error!<br/>" + this._jAjaxRequest.Url); break;
case 501:alert("<b>Internal ajax error 501</b><br/><br/>Not implemented!<br/>" + this._jAjaxRequest.Url); break;
default: alert("<b>Internal ajax error " + this._oXMLHttp.status + "</b><br/><br/>Bad response: " + this._oXMLHttp.statusText + "<br/>" + this._jAjaxRequest.Url); break;
}
this.Abort();
return;
}
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/prototype.js */
/* Prototype JavaScript framework, version 1.6.1
* (c) 2005-2009 Sam Stephenson
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://www.prototypejs.org/
*
*--------------------------------------------------------------------------*/
var Prototype = {
Version: '1.6.1',
Browser: (function(){
var ua = navigator.userAgent;
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
return {
IE: !!window.attachEvent && !isOpera,
Opera: isOpera,
WebKit: ua.indexOf('AppleWebKit/') > -1,
Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
MobileSafari: /Apple.*Mobile.*Safari/.test(ua),
Chrome: ua.toLowerCase().indexOf('chrome') > -1
}
})(),
BrowserFeatures: {
XPath: !!document.evaluate,
SelectorsAPI: !!document.querySelector,
ElementExtensions: (function() {
var constructor = window.Element || window.HTMLElement;
return !!(constructor && constructor.prototype);
})(),
SpecificElementExtensions: (function() {
if (typeof window.HTMLDivElement !== 'undefined')
return true;
var div = document.createElement('div');
var form = document.createElement('form');
var isSupported = false;
if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
isSupported = true;
}
div = form = null;
return isSupported;
})()
},
ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
emptyFunction: function() { },
K: function(x) { return x }
};
if (Prototype.Browser.MobileSafari)
Prototype.BrowserFeatures.SpecificElementExtensions = false;
var Abstract = { };
var Try = {
these: function() {
var returnValue;
for (var i = 0, length = arguments.length; i < length; i++) {
var lambda = arguments[i];
try {
returnValue = lambda();
break;
} catch (e) { }
}
return returnValue;
}
};
/* Based on Alex Arnell's inheritance implementation. */
var Class = (function() {
function subclass() {};
function create() {
var parent = null, properties = $A(arguments);
if (Object.isFunction(properties[0]))
parent = properties.shift();
function klass() {
this.initialize.apply(this, arguments);
}
Object.extend(klass, Class.Methods);
klass.superclass = parent;
klass.subclasses = [];
if (parent) {
subclass.prototype = parent.prototype;
klass.prototype = new subclass;
parent.subclasses.push(klass);
}
for (var i = 0; i < properties.length; i++)
klass.addMethods(properties[i]);
if (!klass.prototype.initialize)
klass.prototype.initialize = Prototype.emptyFunction;
klass.prototype.constructor = klass;
return klass;
}
function addMethods(source) {
var ancestor = this.superclass && this.superclass.prototype;
var properties = Object.keys(source);
if (!Object.keys({ toString: true }).length) {
if (source.toString != Object.prototype.toString)
properties.push("toString");
if (source.valueOf != Object.prototype.valueOf)
properties.push("valueOf");
}
for (var i = 0, length = properties.length; i < length; i++) {
var property = properties[i], value = source[property];
if (ancestor && Object.isFunction(value) &&
value.argumentNames().first() == "$super") {
var method = value;
value = (function(m) {
return function() { return ancestor[m].apply(this, arguments); };
})(property).wrap(method);
value.valueOf = method.valueOf.bind(method);
value.toString = method.toString.bind(method);
}
this.prototype[property] = value;
}
return this;
}
return {
create: create,
Methods: {
addMethods: addMethods
}
};
})();
(function() {
var _toString = Object.prototype.toString;
function extend(destination, source) {
for (var property in source)
destination[property] = source[property];
return destination;
}
function inspect(object) {
try {
if (isUndefined(object)) return 'undefined';
if (object === null) return 'null';
return object.inspect ? object.inspect() : String(object);
} catch (e) {
if (e instanceof RangeError) return '...';
throw e;
}
}
function toJSON(object) {
var type = typeof object;
switch (type) {
case 'undefined':
case 'function':
case 'unknown': return;
case 'boolean': return object.toString();
}
if (object === null) return 'null';
if (object.toJSON) return object.toJSON();
if (isElement(object)) return;
var results = [];
for (var property in object) {
var value = toJSON(object[property]);
if (!isUndefined(value))
results.push(property.toJSON() + ': ' + value);
}
return '{' + results.join(', ') + '}';
}
function toQueryString(object, order) {
return $H(object).toQueryString(order);
}
function toHTML(object) {
return object && object.toHTML ? object.toHTML() : String.interpret(object);
}
function keys(object) {
var results = [];
for (var property in object)
results.push(property);
return results;
}
function values(object) {
var results = [];
for (var property in object)
results.push(object[property]);
return results;
}
function clone(object) {
return extend({ }, object);
}
function isElement(object) {
return !!(object && object.nodeType == 1);
}
function isArray(object) {
return _toString.call(object) == "[object Array]";
}
function isHash(object) {
return object instanceof Hash;
}
function isFunction(object) {
return typeof object === "function";
}
function isString(object) {
return _toString.call(object) == "[object String]";
}
function isNumber(object) {
return _toString.call(object) == "[object Number]";
}
function isUndefined(object) {
return typeof object === "undefined";
}
extend(Object, {
extend: extend,
inspect: inspect,
toJSON: toJSON,
toQueryString: toQueryString,
toHTML: toHTML,
keys: keys,
values: values,
clone: clone,
isElement: isElement,
isArray: isArray,
isHash: isHash,
isFunction: isFunction,
isString: isString,
isNumber: isNumber,
isUndefined: isUndefined
});
})();
Object.extend(Function.prototype, (function() {
var slice = Array.prototype.slice;
function update(array, args) {
var arrayLength = array.length, length = args.length;
while (length--) array[arrayLength + length] = args[length];
return array;
}
function merge(array, args) {
array = slice.call(array, 0);
return update(array, args);
}
function argumentNames() {
var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
.replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
.replace(/\s+/g, '').split(',');
return names.length == 1 && !names[0] ? [] : names;
}
function bind(context) {
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
var __method = this, args = slice.call(arguments, 1);
return function() {
var a = merge(args, arguments);
return __method.apply(context, a);
}
}
function bindAsEventListener(context) {
var __method = this, args = slice.call(arguments, 1);
return function(event) {
var a = update([event || window.event], args);
return __method.apply(context, a);
}
}
function curry() {
if (!arguments.length) return this;
var __method = this, args = slice.call(arguments, 0);
return function() {
var a = merge(args, arguments);
return __method.apply(this, a);
}
}
function delay(timeout) {
var __method = this, args = slice.call(arguments, 1);
timeout = timeout * 1000
return window.setTimeout(function() {
return __method.apply(__method, args);
}, timeout);
}
function defer() {
var args = update([0.01], arguments);
return this.delay.apply(this, args);
}
function wrap(wrapper) {
var __method = this;
return function() {
var a = update([__method.bind(this)], arguments);
return wrapper.apply(this, a);
}
}
function methodize() {
if (this._methodized) return this._methodized;
var __method = this;
return this._methodized = function() {
var a = update([this], arguments);
return __method.apply(null, a);
};
}
return {
argumentNames: argumentNames,
bind: bind,
bindAsEventListener: bindAsEventListener,
curry: curry,
delay: delay,
defer: defer,
wrap: wrap,
methodize: methodize
}
})());
Date.prototype.toJSON = function() {
return '"' + this.getUTCFullYear() + '-' +
(this.getUTCMonth() + 1).toPaddedString(2) + '-' +
this.getUTCDate().toPaddedString(2) + 'T' +
this.getUTCHours().toPaddedString(2) + ':' +
this.getUTCMinutes().toPaddedString(2) + ':' +
this.getUTCSeconds().toPaddedString(2) + 'Z"';
};
RegExp.prototype.match = RegExp.prototype.test;
RegExp.escape = function(str) {
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};
var PeriodicalExecuter = Class.create({
initialize: function(callback, frequency) {
this.callback = callback;
this.frequency = frequency;
this.currentlyExecuting = false;
this.registerCallback();
},
registerCallback: function() {
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
},
execute: function() {
this.callback(this);
},
stop: function() {
if (!this.timer) return;
clearInterval(this.timer);
this.timer = null;
},
onTimerEvent: function() {
if (!this.currentlyExecuting) {
try {
this.currentlyExecuting = true;
this.execute();
this.currentlyExecuting = false;
} catch(e) {
this.currentlyExecuting = false;
throw e;
}
}
}
});
Object.extend(String, {
interpret: function(value) {
return value == null ? '' : String(value);
},
specialChar: {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'\\': '\\\\'
}
});
Object.extend(String.prototype, (function() {
function prepareReplacement(replacement) {
if (Object.isFunction(replacement)) return replacement;
var template = new Template(replacement);
return function(match) { return template.evaluate(match) };
}
function gsub(pattern, replacement) {
var result = '', source = this, match;
replacement = prepareReplacement(replacement);
if (Object.isString(pattern))
pattern = RegExp.escape(pattern);
if (!(pattern.length || pattern.source)) {
replacement = replacement('');
return replacement + source.split('').join(replacement) + replacement;
}
while (source.length > 0) {
if (match = source.match(pattern)) {
result += source.slice(0, match.index);
result += String.interpret(replacement(match));
source = source.slice(match.index + match[0].length);
} else {
result += source, source = '';
}
}
return result;
}
function sub(pattern, replacement, count) {
replacement = prepareReplacement(replacement);
count = Object.isUndefined(count) ? 1 : count;
return this.gsub(pattern, function(match) {
if (--count < 0) return match[0];
return replacement(match);
});
}
function scan(pattern, iterator) {
this.gsub(pattern, iterator);
return String(this);
}
function truncate(length, truncation) {
length = length || 30;
truncation = Object.isUndefined(truncation) ? '...' : truncation;
return this.length > length ?
this.slice(0, length - truncation.length) + truncation : String(this);
}
function strip() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
}
function stripTags() {
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '');
}
function stripScripts() {
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
}
function extractScripts() {
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
return (this.match(matchAll) || []).map(function(scriptTag) {
return (scriptTag.match(matchOne) || ['', ''])[1];
});
}
function evalScripts() {
return this.extractScripts().map(function(script) { return eval(script) });
}
function escapeHTML() {
return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
}
function unescapeHTML() {
return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
}
function toQueryParams(separator) {
var match = this.strip().match(/([^?#]*)(#.*)?$/);
if (!match) return { };
return match[1].split(separator || '&').inject({ }, function(hash, pair) {
if ((pair = pair.split('='))[0]) {
var key = decodeURIComponent(pair.shift());
var value = pair.length > 1 ? pair.join('=') : pair[0];
if (value != undefined) value = decodeURIComponent(value);
if (key in hash) {
if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
hash[key].push(value);
}
else hash[key] = value;
}
return hash;
});
}
function toArray() {
return this.split('');
}
function succ() {
return this.slice(0, this.length - 1) +
String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
}
function times(count) {
return count < 1 ? '' : new Array(count + 1).join(this);
}
function camelize() {
var parts = this.split('-'), len = parts.length;
if (len == 1) return parts[0];
var camelized = this.charAt(0) == '-'
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
: parts[0];
for (var i = 1; i < len; i++)
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
return camelized;
}
function capitalize() {
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
}
function underscore() {
return this.replace(/::/g, '/')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/-/g, '_')
.toLowerCase();
}
function dasherize() {
return this.replace(/_/g, '-');
}
function inspect(useDoubleQuotes) {
var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
if (character in String.specialChar) {
return String.specialChar[character];
}
return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
});
if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
}
function toJSON() {
return this.inspect(true);
}
function unfilterJSON(filter) {
return this.replace(filter || Prototype.JSONFilter, '$1');
}
function isJSON() {
var str = this;
if (str.blank()) return false;
str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
}
function evalJSON(sanitize) {
var start = new Date();
var json = this.unfilterJSON();
try {
if (!sanitize || json.isJSON()) {
start = new Date();
var obj = eval('(' + json + ')');
return obj;
}
} catch (e) { }
throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
}
function include(pattern) {
return this.indexOf(pattern) > -1;
}
function startsWith(pattern) {
return this.indexOf(pattern) === 0;
}
function endsWith(pattern) {
var d = this.length - pattern.length;
return d >= 0 && this.lastIndexOf(pattern) === d;
}
function empty() {
return this == '';
}
function blank() {
return /^\s*$/.test(this);
}
function interpolate(object, pattern) {
return new Template(this, pattern).evaluate(object);
}
return {
gsub: gsub,
sub: sub,
scan: scan,
truncate: truncate,
strip: String.prototype.trim ? String.prototype.trim : strip,
stripTags: stripTags,
stripScripts: stripScripts,
extractScripts: extractScripts,
evalScripts: evalScripts,
escapeHTML: escapeHTML,
unescapeHTML: unescapeHTML,
toQueryParams: toQueryParams,
parseQuery: toQueryParams,
toArray: toArray,
succ: succ,
times: times,
camelize: camelize,
capitalize: capitalize,
underscore: underscore,
dasherize: dasherize,
inspect: inspect,
toJSON: toJSON,
unfilterJSON: unfilterJSON,
isJSON: isJSON,
evalJSON: evalJSON,
include: include,
startsWith: startsWith,
endsWith: endsWith,
empty: empty,
blank: blank,
interpolate: interpolate
};
})());
var Template = Class.create({
initialize: function(template, pattern) {
this.template = template.toString();
this.pattern = pattern || Template.Pattern;
},
evaluate: function(object) {
if (object && Object.isFunction(object.toTemplateReplacements))
object = object.toTemplateReplacements();
return this.template.gsub(this.pattern, function(match) {
if (object == null) return (match[1] + '');
var before = match[1] || '';
if (before == '\\') return match[2];
var ctx = object, expr = match[3];
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
match = pattern.exec(expr);
if (match == null) return before;
while (match != null) {
var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
ctx = ctx[comp];
if (null == ctx || '' == match[3]) break;
expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
match = pattern.exec(expr);
}
return before + String.interpret(ctx);
});
}
});
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
var $break = { };
var Enumerable = (function() {
function each(iterator, context) {
var index = 0;
try {
this._each(function(value) {
iterator.call(context, value, index++);
});
} catch (e) {
if (e != $break) throw e;
}
return this;
}
function eachSlice(number, iterator, context) {
var index = -number, slices = [], array = this.toArray();
if (number < 1) return array;
while ((index += number) < array.length)
slices.push(array.slice(index, index+number));
return slices.collect(iterator, context);
}
function all(iterator, context) {
iterator = iterator || Prototype.K;
var result = true;
this.each(function(value, index) {
result = result && !!iterator.call(context, value, index);
if (!result) throw $break;
});
return result;
}
function any(iterator, context) {
iterator = iterator || Prototype.K;
var result = false;
this.each(function(value, index) {
if (result = !!iterator.call(context, value, index))
throw $break;
});
return result;
}
function collect(iterator, context) {
iterator = iterator || Prototype.K;
var results = [];
this.each(function(value, index) {
results.push(iterator.call(context, value, index));
});
return results;
}
function detect(iterator, context) {
var result;
this.each(function(value, index) {
if (iterator.call(context, value, index)) {
result = value;
throw $break;
}
});
return result;
}
function findAll(iterator, context) {
var results = [];
this.each(function(value, index) {
if (iterator.call(context, value, index))
results.push(value);
});
return results;
}
function grep(filter, iterator, context) {
iterator = iterator || Prototype.K;
var results = [];
if (Object.isString(filter))
filter = new RegExp(RegExp.escape(filter));
this.each(function(value, index) {
if (filter.match(value))
results.push(iterator.call(context, value, index));
});
return results;
}
function include(object) {
if (Object.isFunction(this.indexOf))
if (this.indexOf(object) != -1) return true;
var found = false;
this.each(function(value) {
if (value == object) {
found = true;
throw $break;
}
});
return found;
}
function inGroupsOf(number, fillWith) {
fillWith = Object.isUndefined(fillWith) ? null : fillWith;
return this.eachSlice(number, function(slice) {
while(slice.length < number) slice.push(fillWith);
return slice;
});
}
function inject(memo, iterator, context) {
this.each(function(value, index) {
memo = iterator.call(context, memo, value, index);
});
return memo;
}
function invoke(method) {
var args = $A(arguments).slice(1);
return this.map(function(value) {
return value[method].apply(value, args);
});
}
function max(iterator, context) {
iterator = iterator || Prototype.K;
var result;
this.each(function(value, index) {
value = iterator.call(context, value, index);
if (result == null || value >= result)
result = value;
});
return result;
}
function min(iterator, context) {
iterator = iterator || Prototype.K;
var result;
this.each(function(value, index) {
value = iterator.call(context, value, index);
if (result == null || value < result)
result = value;
});
return result;
}
function partition(iterator, context) {
iterator = iterator || Prototype.K;
var trues = [], falses = [];
this.each(function(value, index) {
(iterator.call(context, value, index) ?
trues : falses).push(value);
});
return [trues, falses];
}
function pluck(property) {
var results = [];
this.each(function(value) {
results.push(value[property]);
});
return results;
}
function reject(iterator, context) {
var results = [];
this.each(function(value, index) {
if (!iterator.call(context, value, index))
results.push(value);
});
return results;
}
function sortBy(iterator, context) {
return this.map(function(value, index) {
return {
value: value,
criteria: iterator.call(context, value, index)
};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}).pluck('value');
}
function toArray() {
return this.map();
}
function zip() {
var iterator = Prototype.K, args = $A(arguments);
if (Object.isFunction(args.last()))
iterator = args.pop();
var collections = [this].concat(args).map($A);
return this.map(function(value, index) {
return iterator(collections.pluck(index));
});
}
function size() {
return this.toArray().length;
}
function inspect() {
return '#<Enumerable:' + this.toArray().inspect() + '>';
}
return {
each: each,
eachSlice: eachSlice,
all: all,
every: all,
any: any,
some: any,
collect: collect,
map: collect,
detect: detect,
findAll: findAll,
select: findAll,
filter: findAll,
grep: grep,
include: include,
member: include,
inGroupsOf: inGroupsOf,
inject: inject,
invoke: invoke,
max: max,
min: min,
partition: partition,
pluck: pluck,
reject: reject,
sortBy: sortBy,
toArray: toArray,
entries: toArray,
zip: zip,
size: size,
inspect: inspect,
find: detect
};
})();
function $A(iterable) {
if (!iterable) return [];
if ('toArray' in Object(iterable)) return iterable.toArray();
var length = iterable.length || 0, results = new Array(length);
while (length--) results[length] = iterable[length];
return results;
}
function $w(string) {
if (!Object.isString(string)) return [];
string = string.strip();
return string ? string.split(/\s+/) : [];
}
Array.from = $A;
(function() {
var arrayProto = Array.prototype,
slice = arrayProto.slice,
_each = arrayProto.forEach; // use native browser JS 1.6 implementation if available
function each(iterator) {
for (var i = 0, length = this.length; i < length; i++)
iterator(this[i]);
}
if (!_each) _each = each;
function clear() {
this.length = 0;
return this;
}
function first() {
return this[0];
}
function last() {
return this[this.length - 1];
}
function compact() {
return this.select(function(value) {
return value != null;
});
}
function flatten() {
return this.inject([], function(array, value) {
if (Object.isArray(value))
return array.concat(value.flatten());
array.push(value);
return array;
});
}
function without() {
var values = slice.call(arguments, 0);
return this.select(function(value) {
return !values.include(value);
});
}
function reverse(inline) {
return (inline !== false ? this : this.toArray())._reverse();
}
function uniq(sorted) {
return this.inject([], function(array, value, index) {
if (0 == index || (sorted ? array.last() != value : !array.include(value)))
array.push(value);
return array;
});
}
function intersect(array) {
return this.uniq().findAll(function(item) {
return array.detect(function(value) { return item === value });
});
}
function clone() {
return slice.call(this, 0);
}
function size() {
return this.length;
}
function inspect() {
return '[' + this.map(Object.inspect).join(', ') + ']';
}
function toJSON() {
var results = [];
this.each(function(object) {
var value = Object.toJSON(object);
if (!Object.isUndefined(value)) results.push(value);
});
return '[' + results.join(', ') + ']';
}
function indexOf(item, i) {
i || (i = 0);
var length = this.length;
if (i < 0) i = length + i;
for (; i < length; i++)
if (this[i] === item) return i;
return -1;
}
function lastIndexOf(item, i) {
i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
var n = this.slice(0, i).reverse().indexOf(item);
return (n < 0) ? n : i - n - 1;
}
function concat() {
var array = slice.call(this, 0), item;
for (var i = 0, length = arguments.length; i < length; i++) {
item = arguments[i];
if (Object.isArray(item) && !('callee' in item)) {
for (var j = 0, arrayLength = item.length; j < arrayLength; j++)
array.push(item[j]);
} else {
array.push(item);
}
}
return array;
}
Object.extend(arrayProto, Enumerable);
if (!arrayProto._reverse)
arrayProto._reverse = arrayProto.reverse;
Object.extend(arrayProto, {
_each: _each,
clear: clear,
first: first,
last: last,
compact: compact,
flatten: flatten,
without: without,
reverse: reverse,
uniq: uniq,
intersect: intersect,
clone: clone,
toArray: clone,
size: size,
inspect: inspect,
toJSON: toJSON
});
var CONCAT_ARGUMENTS_BUGGY = (function() {
return [].concat(arguments)[0][0] !== 1;
})(1,2)
if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;
if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
})();
function $H(object) {
return new Hash(object);
};
var Hash = Class.create(Enumerable, (function() {
function initialize(object) {
this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
}
function _each(iterator) {
for (var key in this._object) {
var value = this._object[key], pair = [key, value];
pair.key = key;
pair.value = value;
iterator(pair);
}
}
function set(key, value) {
return this._object[key] = value;
}
function get(key) {
if (this._object[key] !== Object.prototype[key])
return this._object[key];
}
function unset(key) {
var value = this._object[key];
delete this._object[key];
return value;
}
function toObject() {
return Object.clone(this._object);
}
function keys() {
return this.pluck('key');
}
function values() {
return this.pluck('value');
}
function index(value) {
var match = this.detect(function(pair) {
return pair.value === value;
});
return match && match.key;
}
function merge(object) {
return this.clone().update(object);
}
function update(object) {
return new Hash(object).inject(this, function(result, pair) {
result.set(pair.key, pair.value);
return result;
});
}
function toQueryPair(key, value) {
if (Object.isUndefined(value)) return key;
return key + '=' + encodeURIComponent(String.interpret(value));
}
function toQueryString(order) {
var ordered = null;
var done = {};
if (order) {
ordered = $A(order).inject([], function (results, p) {
var key = encodeURIComponent(p), values = this._object[p];
done[p] = true;
if (values && typeof values == 'object') {
if (Object.isArray(values))
return results.concat(values.map(toQueryPair.curry(key)));
} else results.push(toQueryPair(key, values));
return results;
}, this).join('&');
}
var normal = this.inject([], function(results, pair) {
if (done[pair.key])
return results;
var key = encodeURIComponent(pair.key), values = pair.value;
if (values && typeof values == 'object') {
if (Object.isArray(values))
return results.concat(values.map(toQueryPair.curry(key)));
} else results.push(toQueryPair(key, values));
return results;
}).join('&');
if (ordered && normal)
return ordered + "&" + normal;
else if (ordered)
return ordered;
else
return normal;
}
function inspect() {
return '#<Hash:{' + this.map(function(pair) {
return pair.map(Object.inspect).join(': ');
}).join(', ') + '}>';
}
function toJSON() {
return Object.toJSON(this.toObject());
}
function clone() {
return new Hash(this);
}
return {
initialize: initialize,
_each: _each,
set: set,
get: get,
unset: unset,
toObject: toObject,
toTemplateReplacements: toObject,
keys: keys,
values: values,
index: index,
merge: merge,
update: update,
toQueryString: toQueryString,
inspect: inspect,
toJSON: toJSON,
clone: clone
};
})());
Hash.from = $H;
Object.extend(Number.prototype, (function() {
function toColorPart() {
return this.toPaddedString(2, 16);
}
function succ() {
return this + 1;
}
function times(iterator, context) {
$R(0, this, true).each(iterator, context);
return this;
}
function toPaddedString(length, radix) {
var string = this.toString(radix || 10);
return '0'.times(length - string.length) + string;
}
function toJSON() {
return isFinite(this) ? this.toString() : 'null';
}
function abs() {
return Math.abs(this);
}
function round() {
return Math.round(this);
}
function ceil() {
return Math.ceil(this);
}
function floor() {
return Math.floor(this);
}
return {
toColorPart: toColorPart,
succ: succ,
times: times,
toPaddedString: toPaddedString,
toJSON: toJSON,
abs: abs,
round: round,
ceil: ceil,
floor: floor
};
})());
function $R(start, end, exclusive) {
return new ObjectRange(start, end, exclusive);
}
var ObjectRange = Class.create(Enumerable, (function() {
function initialize(start, end, exclusive) {
this.start = start;
this.end = end;
this.exclusive = exclusive;
}
function _each(iterator) {
var value = this.start;
while (this.include(value)) {
iterator(value);
value = value.succ();
}
}
function include(value) {
if (value < this.start)
return false;
if (this.exclusive)
return value < this.end;
return value <= this.end;
}
return {
initialize: initialize,
_each: _each,
include: include
};
})());
var Ajax = {
getTransport: function() {
return Try.these(
function() {return new XMLHttpRequest()},
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
) || false;
},
activeRequestCount: 0
};
Ajax.Responders = {
responders: [],
_each: function(iterator) {
this.responders._each(iterator);
},
register: function(responder) {
if (!this.include(responder))
this.responders.push(responder);
},
unregister: function(responder) {
this.responders = this.responders.without(responder);
},
dispatch: function(callback, request, transport, json) {
this.each(function(responder) {
if (Object.isFunction(responder[callback])) {
try {
responder[callback].apply(responder, [request, transport, json]);
} catch (e) { }
}
});
}
};
Object.extend(Ajax.Responders, Enumerable);
Ajax.Responders.register({
onCreate: function() { Ajax.activeRequestCount++ },
onComplete: function() { Ajax.activeRequestCount-- }
});
Ajax.Base = Class.create({
initialize: function(options) {
this.options = {
method: 'post',
asynchronous: true,
contentType: 'application/x-www-form-urlencoded',
encoding: 'UTF-8',
parameters: '',
evalJSON: true,
evalJS: true,
username: undefined,
password: undefined
};
Object.extend(this.options, options || { });
this.options.method = this.options.method.toLowerCase();
if (Object.isString(this.options.parameters))
this.options.parameters = this.options.parameters.toQueryParams();
else if (Object.isHash(this.options.parameters))
this.options.parameters = this.options.parameters.toObject();
}
});
Ajax.Request = Class.create(Ajax.Base, {
_complete: false,
initialize: function($super, url, options) {
$super(options);
this.transport = Ajax.getTransport();
this.request(url);
},
request: function(url) {
this.url = url;
this.method = this.options.method;
var params = Object.clone(this.options.parameters);
if (!['get', 'post'].include(this.method)) {
params['_method'] = this.method;
this.method = 'post';
}
this.parameters = params;
if (params = Object.toQueryString(params, this.options.order)) {
/* always include parameters in URL */
this.url += (this.url.include('?') ? '&' : '?') + params;
if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)&& this.method!='get')
params += '&_=';
}
try {
var response = new Ajax.Response(this);
if (this.options.onCreate) this.options.onCreate(response);
Ajax.Responders.dispatch('onCreate', this, response);
this.transport.open(this.method.toUpperCase(), this.url,
this.options.asynchronous, this.options.username, this.options.password);
if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
this.transport.onreadystatechange = this.onStateChange.bind(this);
this.setRequestHeaders();
this.body = this.method == 'post' ? (this.options.postBody || params) : null;
this.transport.send(this.body);
/* Force Firefox to handle ready state 4 for synchronous requests */
if (!this.options.asynchronous && this.transport.overrideMimeType)
this.onStateChange();
}
catch (e) {
this.dispatchException(e);
}
},
onStateChange: function() {
var readyState = this.transport.readyState;
if (readyState > 1 && !((readyState == 4) && this._complete))
this.respondToReadyState(this.transport.readyState);
},
setRequestHeaders: function() {
var headers = {
// 'X-Requested-With': 'XMLHttpRequest',
// 'X-Prototype-Version': Prototype.Version,
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
};
if (this.method == 'post') {
// headers['Content-type'] = this.options.contentType +
// (this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
headers['Connection'] = 'close';
}
if (typeof this.options.requestHeaders == 'object') {
var extras = this.options.requestHeaders;
if (Object.isFunction(extras.push))
for (var i = 0, length = extras.length; i < length; i += 2)
headers[extras[i]] = extras[i+1];
else
$H(extras).each(function(pair) { headers[pair.key] = pair.value });
}
for (var name in headers)
this.transport.setRequestHeader(name, headers[name]);
},
success: function() {
var status = this.getStatus();
return !status || (status >= 200 && status < 300);
},
getStatus: function() {
try {
return this.transport.status || 0;
} catch (e) { return 0 }
},
respondToReadyState: function(readyState) {
var state = Ajax.Request.Events[readyState];
var response = new Ajax.Response(this);
if (state == 'Complete') {
try {
this._complete = true;
(this.options['on' + response.status]
|| this.options['on' + (this.success() ? 'Success' : 'Failure')]
|| Prototype.emptyFunction)(response, response.headerJSON);
} catch (e) {
this.dispatchException(e);
}
var contentType = response.getHeader('Content-type');
if (this.options.evalJS == 'force'
|| (this.options.evalJS && (true || this.isSameOrigin()) && contentType
&& contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
this.evalResponse();
}
try {
(this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
} catch (e) {
this.dispatchException(e);
}
if (state == 'Complete') {
this.transport.onreadystatechange = Prototype.emptyFunction;
}
},
isSameOrigin: function() {
var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
protocol: location.protocol,
domain: document.domain,
port: location.port ? ':' + location.port : ''
}));
},
getHeader: function(name) {
try {
return this.transport.getResponseHeader(name) || null;
} catch (e) { return null; }
},
evalResponse: function() {
try {
var start = new Date();
var str = (this.transport.responseText ? '(' + this.transport.responseText + ')' : '').unfilterJSON();
start = new Date();
var obj = eval(str);
return obj;
} catch (e) {
this.dispatchException(e);
}
},
dispatchException: function(exception) {
(this.options.onException || Prototype.emptyFunction)(this, exception);
Ajax.Responders.dispatch('onException', this, exception);
}
});
Ajax.Request.Events =
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
Ajax.Response = Class.create({
initialize: function(request){
this.request = request;
var transport = this.transport = request.transport,
readyState = this.readyState = transport.readyState;
if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
this.status = this.getStatus();
this.statusText = this.getStatusText();
this.responseText = String.interpret(transport.responseText);
this.headerJSON = this._getHeaderJSON();
}
if(readyState == 4) {
var xml = transport.responseXML;
this.responseXML = Object.isUndefined(xml) ? null : xml;
this.responseJSON = this._getResponseJSON();
}
},
status: 0,
statusText: '',
getStatus: Ajax.Request.prototype.getStatus,
getStatusText: function() {
try {
return this.transport.statusText || '';
} catch (e) { return '' }
},
getHeader: Ajax.Request.prototype.getHeader,
getAllHeaders: function() {
try {
return this.getAllResponseHeaders();
} catch (e) { return null }
},
getResponseHeader: function(name) {
return this.transport.getResponseHeader(name);
},
getAllResponseHeaders: function() {
return this.transport.getAllResponseHeaders();
},
_getHeaderJSON: function() {
var json = this.getHeader('X-JSON');
if (!json) return null;
json = decodeURIComponent(escape(json));
try {
return json.evalJSON(this.request.options.sanitizeJSON ||
!this.request.isSameOrigin());
} catch (e) {
this.request.dispatchException(e);
}
},
_getResponseJSON: function() {
var options = this.request.options;
if (!options.evalJSON || (options.evalJSON != 'force' &&
!(this.getHeader('Content-type') || '').include('application/json')) ||
this.responseText.blank())
return null;
try {
return this.responseText.evalJSON(options.sanitizeJSON);
} catch (e) {
this.request.dispatchException(e);
}
}
});
Ajax.Updater = Class.create(Ajax.Request, {
initialize: function($super, container, url, options) {
this.container = {
success: (container.success || container),
failure: (container.failure || (container.success ? null : container))
};
options = Object.clone(options);
var onComplete = options.onComplete;
options.onComplete = (function(response, json) {
this.updateContent(response.responseText);
if (Object.isFunction(onComplete)) onComplete(response, json);
}).bind(this);
$super(url, options);
},
updateContent: function(responseText) {
var receiver = this.container[this.success() ? 'success' : 'failure'],
options = this.options;
if (!options.evalScripts) responseText = responseText.stripScripts();
if (receiver = $(receiver)) {
if (options.insertion) {
if (Object.isString(options.insertion)) {
var insertion = { }; insertion[options.insertion] = responseText;
receiver.insert(insertion);
}
else options.insertion(receiver, responseText);
}
else receiver.update(responseText);
}
}
});
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
initialize: function($super, container, url, options) {
$super(options);
this.onComplete = this.options.onComplete;
this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);
this.updater = { };
this.container = container;
this.url = url;
this.start();
},
start: function() {
this.options.onComplete = this.updateComplete.bind(this);
this.onTimerEvent();
},
stop: function() {
this.updater.options.onComplete = undefined;
clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},
updateComplete: function(response) {
if (this.options.decay) {
this.decay = (response.responseText == this.lastText ?
this.decay * this.options.decay : 1);
this.lastText = response.responseText;
}
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
},
onTimerEvent: function() {
this.updater = new Ajax.Updater(this.container, this.url, this.options);
}
});
function $(element) {
if (arguments.length > 1) {
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push($(arguments[i]));
return elements;
}
if (Object.isString(element))
element = document.getElementById(element);
return Element.extend(element);
}
if (Prototype.BrowserFeatures.XPath) {
document._getElementsByXPath = function(expression, parentElement) {
var results = [];
var query = document.evaluate(expression, $(parentElement) || document,
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0, length = query.snapshotLength; i < length; i++)
results.push(Element.extend(query.snapshotItem(i)));
return results;
};
}
/*--------------------------------------------------------------------------*/
if (!window.Node) var Node = { };
if (!Node.ELEMENT_NODE) {
Object.extend(Node, {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3,
CDATA_SECTION_NODE: 4,
ENTITY_REFERENCE_NODE: 5,
ENTITY_NODE: 6,
PROCESSING_INSTRUCTION_NODE: 7,
COMMENT_NODE: 8,
DOCUMENT_NODE: 9,
DOCUMENT_TYPE_NODE: 10,
DOCUMENT_FRAGMENT_NODE: 11,
NOTATION_NODE: 12
});
}
(function(global) {
var SETATTRIBUTE_IGNORES_NAME = (function(){
var elForm = document.createElement("form");
var elInput = document.createElement("input");
var root = document.documentElement;
elInput.setAttribute("name", "test");
elForm.appendChild(elInput);
root.appendChild(elForm);
var isBuggy = elForm.elements
? (typeof elForm.elements.test == "undefined")
: null;
root.removeChild(elForm);
elForm = elInput = null;
return isBuggy;
})();
var element = global.Element;
global.Element = function(tagName, attributes) {
attributes = attributes || { };
tagName = tagName.toLowerCase();
var cache = Element.cache;
if (SETATTRIBUTE_IGNORES_NAME && attributes.name) {
tagName = '<' + tagName + ' name="' + attributes.name + '">';
delete attributes.name;
return Element.writeAttribute(document.createElement(tagName), attributes);
}
if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
};
Object.extend(global.Element, element || { });
if (element) global.Element.prototype = element.prototype;
})(this);
Element.cache = { };
Element.idCounter = 1;
Element.Methods = {
visible: function(element) {
return $(element).style.display != 'none';
},
toggle: function(element) {
element = $(element);
Element[Element.visible(element) ? 'hide' : 'show'](element);
return element;
},
hide: function(element) {
element = $(element);
element.style.display = 'none';
return element;
},
show: function(element) {
element = $(element);
element.style.display = '';
return element;
},
remove: function(element) {
element = $(element);
element.parentNode.removeChild(element);
return element;
},
update: (function(){
var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
var el = document.createElement("select"),
isBuggy = true;
el.innerHTML = "<option value=\"test\">test</option>";
if (el.options && el.options[0]) {
isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
}
el = null;
return isBuggy;
})();
var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
try {
var el = document.createElement("table");
if (el && el.tBodies) {
el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>";
var isBuggy = typeof el.tBodies[0] == "undefined";
el = null;
return isBuggy;
}
} catch (e) {
return true;
}
})();
var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () {
var s = document.createElement("script"),
isBuggy = false;
try {
s.appendChild(document.createTextNode(""));
isBuggy = !s.firstChild ||
s.firstChild && s.firstChild.nodeType !== 3;
} catch (e) {
isBuggy = true;
}
s = null;
return isBuggy;
})();
function update(element, content) {
element = $(element);
if (content && content.toElement)
content = content.toElement();
if (Object.isElement(content))
return element.update().insert(content);
content = Object.toHTML(content);
var tagName = element.tagName.toUpperCase();
if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
element.text = content;
return element;
}
if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) {
if (tagName in Element._insertionTranslations.tags) {
while (element.firstChild) {
element.removeChild(element.firstChild);
}
Element._getContentFromAnonymousElement(tagName, content.stripScripts())
.each(function(node) {
element.appendChild(node)
});
}
else {
element.innerHTML = content.stripScripts();
}
}
else {
element.innerHTML = content.stripScripts();
}
content.evalScripts.bind(content).defer();
return element;
}
return update;
})(),
replace: function(element, content) {
element = $(element);
if (content && content.toElement) content = content.toElement();
else if (!Object.isElement(content)) {
content = Object.toHTML(content);
var range = element.ownerDocument.createRange();
range.selectNode(element);
content.evalScripts.bind(content).defer();
content = range.createContextualFragment(content.stripScripts());
}
element.parentNode.replaceChild(content, element);
return element;
},
insert: function(element, insertions) {
element = $(element);
if (Object.isString(insertions) || Object.isNumber(insertions) ||
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
insertions = {bottom:insertions};
var content, insert, tagName, childNodes;
for (var position in insertions) {
content = insertions[position];
position = position.toLowerCase();
insert = Element._insertionTranslations[position];
if (content && content.toElement) content = content.toElement();
if (Object.isElement(content)) {
insert(element, content);
continue;
}
content = Object.toHTML(content);
tagName = ((position == 'before' || position == 'after')
? element.parentNode : element).tagName.toUpperCase();
childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
if (position == 'top' || position == 'after') childNodes.reverse();
childNodes.each(insert.curry(element));
content.evalScripts.bind(content).defer();
}
return element;
},
wrap: function(element, wrapper, attributes) {
element = $(element);
if (Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes || { });
else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
else wrapper = new Element('div', wrapper);
if (element.parentNode)
element.parentNode.replaceChild(wrapper, element);
wrapper.appendChild(element);
return wrapper;
},
inspect: function(element) {
element = $(element);
var result = '<' + element.tagName.toLowerCase();
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
var property = pair.first(), attribute = pair.last();
var value = (element[property] || '').toString();
if (value) result += ' ' + attribute + '=' + value.inspect(true);
});
return result + '>';
},
recursivelyCollect: function(element, property) {
element = $(element);
var elements = [];
while (element = element[property])
if (element.nodeType == 1)
elements.push(Element.extend(element));
return elements;
},
ancestors: function(element) {
return Element.recursivelyCollect(element, 'parentNode');
},
descendants: function(element) {
return Element.select(element, "*");
},
firstDescendant: function(element) {
element = $(element).firstChild;
while (element && element.nodeType != 1) element = element.nextSibling;
return $(element);
},
immediateDescendants: function(element) {
if (!(element = $(element).firstChild)) return [];
while (element && element.nodeType != 1) element = element.nextSibling;
if (element) return [element].concat($(element).nextSiblings());
return [];
},
previousSiblings: function(element) {
return Element.recursivelyCollect(element, 'previousSibling');
},
nextSiblings: function(element) {
return Element.recursivelyCollect(element, 'nextSibling');
},
siblings: function(element) {
element = $(element);
return Element.previousSiblings(element).reverse()
.concat(Element.nextSiblings(element));
},
match: function(element, selector) {
if (Object.isString(selector))
selector = new Selector(selector);
return selector.match($(element));
},
up: function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return $(element.parentNode);
var ancestors = Element.ancestors(element);
return Object.isNumber(expression) ? ancestors[expression] :
Selector.findElement(ancestors, expression, index);
},
down: function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return Element.firstDescendant(element);
return Object.isNumber(expression) ? Element.descendants(element)[expression] :
Element.select(element, expression)[index || 0];
},
previous: function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
var previousSiblings = Element.previousSiblings(element);
return Object.isNumber(expression) ? previousSiblings[expression] :
Selector.findElement(previousSiblings, expression, index);
},
next: function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
var nextSiblings = Element.nextSiblings(element);
return Object.isNumber(expression) ? nextSiblings[expression] :
Selector.findElement(nextSiblings, expression, index);
},
select: function(element) {
var args = Array.prototype.slice.call(arguments, 1);
return Selector.findChildElements(element, args);
},
adjacent: function(element) {
var args = Array.prototype.slice.call(arguments, 1);
return Selector.findChildElements(element.parentNode, args).without(element);
},
identify: function(element) {
element = $(element);
var id = Element.readAttribute(element, 'id');
if (id) return id;
do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
Element.writeAttribute(element, 'id', id);
return id;
},
readAttribute: function(element, name) {
element = $(element);
if (Prototype.Browser.IE) {
var t = Element._attributeTranslations.read;
if (t.values[name]) return t.values[name](element, name);
if (t.names[name]) name = t.names[name];
if (name.include(':')) {
return (!element.attributes || !element.attributes[name]) ? null :
element.attributes[name].value;
}
}
return element.getAttribute(name);
},
writeAttribute: function(element, name, value) {
element = $(element);
var attributes = { }, t = Element._attributeTranslations.write;
if (typeof name == 'object') attributes = name;
else attributes[name] = Object.isUndefined(value) ? true : value;
for (var attr in attributes) {
name = t.names[attr] || attr;
value = attributes[attr];
if (t.values[attr]) name = t.values[attr](element, value);
if (value === false || value === null)
element.removeAttribute(name);
else if (value === true)
element.setAttribute(name, name);
else element.setAttribute(name, value);
}
return element;
},
getHeight: function(element) {
return Element.getDimensions(element).height;
},
getWidth: function(element) {
return Element.getDimensions(element).width;
},
classNames: function(element) {
return new Element.ClassNames(element);
},
hasClassName: function(element, className) {
if (!(element = $(element))) return;
var elementClassName = element.className;
return (elementClassName.length > 0 && (elementClassName == className ||
new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
},
addClassName: function(element, className) {
if (!(element = $(element))) return;
if (!Element.hasClassName(element, className))
element.className += (element.className ? ' ' : '') + className;
return element;
},
removeClassName: function(element, className) {
if (!(element = $(element))) return;
element.className = element.className.replace(
new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
return element;
},
toggleClassName: function(element, className) {
if (!(element = $(element))) return;
return Element[Element.hasClassName(element, className) ?
'removeClassName' : 'addClassName'](element, className);
},
cleanWhitespace: function(element) {
element = $(element);
var node = element.firstChild;
while (node) {
var nextNode = node.nextSibling;
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
element.removeChild(node);
node = nextNode;
}
return element;
},
empty: function(element) {
return $(element).innerHTML.blank();
},
descendantOf: function(element, ancestor) {
element = $(element), ancestor = $(ancestor);
if (element.compareDocumentPosition)
return (element.compareDocumentPosition(ancestor) & 8) === 8;
if (ancestor.contains)
return ancestor.contains(element) && ancestor !== element;
while (element = element.parentNode)
if (element == ancestor) return true;
return false;
},
scrollTo: function(element) {
element = $(element);
var pos = Element.cumulativeOffset(element);
window.scrollTo(pos[0], pos[1]);
return element;
},
getStyle: function(element, style) {
element = $(element);
style = style == 'float' ? 'cssFloat' : style.camelize();
var value = element.style[style];
if (!value || value == 'auto') {
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css[style] : null;
}
if (style == 'opacity') return value ? parseFloat(value) : 1.0;
return value == 'auto' ? null : value;
},
getOpacity: function(element) {
return $(element).getStyle('opacity');
},
setStyle: function(element, styles) {
element = $(element);
var elementStyle = element.style, match;
if (Object.isString(styles)) {
element.style.cssText += ';' + styles;
return styles.include('opacity') ?
element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
}
for (var property in styles)
if (property == 'opacity') element.setOpacity(styles[property]);
else
elementStyle[(property == 'float' || property == 'cssFloat') ?
(Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
property] = styles[property];
return element;
},
setOpacity: function(element, value) {
element = $(element);
element.style.opacity = (value == 1 || value === '') ? '' :
(value < 0.00001) ? 0 : value;
return element;
},
getDimensions: function(element) {
element = $(element);
var display = Element.getStyle(element, 'display');
if (display != 'none' && display != null) // Safari bug
return {width: element.offsetWidth, height: element.offsetHeight};
var els = element.style;
var originalVisibility = els.visibility;
var originalPosition = els.position;
var originalDisplay = els.display;
els.visibility = 'hidden';
if (originalPosition != 'fixed') // Switching fixed to absolute causes issues in Safari
els.position = 'absolute';
els.display = 'block';
var originalWidth = element.clientWidth;
var originalHeight = element.clientHeight;
els.display = originalDisplay;
els.position = originalPosition;
els.visibility = originalVisibility;
return {width: originalWidth, height: originalHeight};
},
makePositioned: function(element) {
element = $(element);
var pos = Element.getStyle(element, 'position');
if (pos == 'static' || !pos) {
element._madePositioned = true;
element.style.position = 'relative';
if (Prototype.Browser.Opera) {
element.style.top = 0;
element.style.left = 0;
}
}
return element;
},
undoPositioned: function(element) {
element = $(element);
if (element._madePositioned) {
element._madePositioned = undefined;
element.style.position =
element.style.top =
element.style.left =
element.style.bottom =
element.style.right = '';
}
return element;
},
makeClipping: function(element) {
element = $(element);
if (element._overflow) return element;
element._overflow = Element.getStyle(element, 'overflow') || 'auto';
if (element._overflow !== 'hidden')
element.style.overflow = 'hidden';
return element;
},
undoClipping: function(element) {
element = $(element);
if (!element._overflow) return element;
element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
element._overflow = null;
return element;
},
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return Element._returnOffset(valueL, valueT);
},
positionedOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
if (element) {
if (element.tagName.toUpperCase() == 'BODY') break;
var p = Element.getStyle(element, 'position');
if (p !== 'static') break;
}
} while (element);
return Element._returnOffset(valueL, valueT);
},
absolutize: function(element) {
element = $(element);
if (Element.getStyle(element, 'position') == 'absolute') return element;
var offsets = Element.positionedOffset(element);
var top = offsets[1];
var left = offsets[0];
var width = element.clientWidth;
var height = element.clientHeight;
element._originalLeft = left - parseFloat(element.style.left || 0);
element._originalTop = top - parseFloat(element.style.top || 0);
element._originalWidth = element.style.width;
element._originalHeight = element.style.height;
element.style.position = 'absolute';
element.style.top = top + 'px';
element.style.left = left + 'px';
element.style.width = width + 'px';
element.style.height = height + 'px';
return element;
},
relativize: function(element) {
element = $(element);
if (Element.getStyle(element, 'position') == 'relative') return element;
element.style.position = 'relative';
var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
element.style.top = top + 'px';
element.style.left = left + 'px';
element.style.height = element._originalHeight;
element.style.width = element._originalWidth;
return element;
},
cumulativeScrollOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.scrollTop || 0;
valueL += element.scrollLeft || 0;
element = element.parentNode;
} while (element);
return Element._returnOffset(valueL, valueT);
},
getOffsetParent: function(element) {
if (element.offsetParent) return $(element.offsetParent);
if (element == document.body) return $(element);
while ((element = element.parentNode) && element != document.body)
if (Element.getStyle(element, 'position') != 'static')
return $(element);
return $(document.body);
},
viewportOffset: function(forElement) {
var valueT = 0, valueL = 0;
var element = forElement;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
if (element.offsetParent == document.body &&
Element.getStyle(element, 'position') == 'absolute') break;
} while (element = element.offsetParent);
element = forElement;
do {
if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
valueT -= element.scrollTop || 0;
valueL -= element.scrollLeft || 0;
}
} while (element = element.parentNode);
return Element._returnOffset(valueL, valueT);
},
clonePosition: function(element, source) {
var options = Object.extend({
setLeft: true,
setTop: true,
setWidth: true,
setHeight: true,
offsetTop: 0,
offsetLeft: 0
}, arguments[2] || { });
source = $(source);
var p = Element.viewportOffset(source);
element = $(element);
var delta = [0, 0];
var parent = null;
if (Element.getStyle(element, 'position') == 'absolute') {
parent = Element.getOffsetParent(element);
delta = Element.viewportOffset(parent);
}
if (parent == document.body) {
delta[0] -= document.body.offsetLeft;
delta[1] -= document.body.offsetTop;
}
if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
if (options.setWidth) element.style.width = source.offsetWidth + 'px';
if (options.setHeight) element.style.height = source.offsetHeight + 'px';
return element;
}
};
Object.extend(Element.Methods, {
getElementsBySelector: Element.Methods.select,
childElements: Element.Methods.immediateDescendants
});
Element._attributeTranslations = {
write: {
names: {
className: 'class',
htmlFor: 'for'
},
values: { }
}
};
if (Prototype.Browser.Opera) {
Element.Methods.getStyle = Element.Methods.getStyle.wrap(
function(proceed, element, style) {
switch (style) {
case 'left': case 'top': case 'right': case 'bottom':
if (proceed(element, 'position') === 'static') return null;
case 'height': case 'width':
if (!Element.visible(element)) return null;
var dim = parseInt(proceed(element, style), 10);
if (dim !== element['offset' + style.capitalize()])
return dim + 'px';
var properties;
if (style === 'height') {
properties = ['border-top-width', 'padding-top',
'padding-bottom', 'border-bottom-width'];
}
else {
properties = ['border-left-width', 'padding-left',
'padding-right', 'border-right-width'];
}
return properties.inject(dim, function(memo, property) {
var val = proceed(element, property);
return val === null ? memo : memo - parseInt(val, 10);
}) + 'px';
default: return proceed(element, style);
}
}
);
Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
function(proceed, element, attribute) {
if (attribute === 'title') return element.title;
return proceed(element, attribute);
}
);
}
else if (Prototype.Browser.IE) {
Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
function(proceed, element) {
element = $(element);
try { element.offsetParent }
catch(e) { return $(document.body) }
var position = element.getStyle('position');
if (position !== 'static') return proceed(element);
element.setStyle({ position: 'relative' });
var value = proceed(element);
element.setStyle({ position: position });
return value;
}
);
$w('positionedOffset viewportOffset').each(function(method) {
Element.Methods[method] = Element.Methods[method].wrap(
function(proceed, element) {
element = $(element);
try { element.offsetParent }
catch(e) { return Element._returnOffset(0,0) }
var position = element.getStyle('position');
if (position !== 'static') return proceed(element);
var offsetParent = element.getOffsetParent();
if (offsetParent && offsetParent.getStyle('position') === 'fixed')
offsetParent.setStyle({ zoom: 1 });
element.setStyle({ position: 'relative' });
var value = proceed(element);
element.setStyle({ position: position });
return value;
}
);
});
Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
function(proceed, element) {
try { element.offsetParent }
catch(e) { return Element._returnOffset(0,0) }
return proceed(element);
}
);
Element.Methods.getStyle = function(element, style) {
element = $(element);
style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
var value = element.style[style];
if (!value && element.currentStyle) value = element.currentStyle[style];
if (style == 'opacity') {
if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
if (value[1]) return parseFloat(value[1]) / 100;
return 1.0;
}
if (value == 'auto') {
if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
return element['offset' + style.capitalize()] + 'px';
return null;
}
return value;
};
Element.Methods.setOpacity = function(element, value) {
function stripAlpha(filter){
return filter.replace(/alpha\([^\)]*\)/gi,'');
}
element = $(element);
var currentStyle = element.currentStyle;
if ((currentStyle && !currentStyle.hasLayout) ||
(!currentStyle && element.style.zoom == 'normal'))
element.style.zoom = 1;
var filter = element.getStyle('filter'), style = element.style;
if (value == 1 || value === '') {
(filter = stripAlpha(filter)) ?
style.filter = filter : style.removeAttribute('filter');
return element;
} else if (value < 0.00001) value = 0;
style.filter = stripAlpha(filter) +
'alpha(opacity=' + (value * 100) + ')';
return element;
};
Element._attributeTranslations = (function(){
var classProp = 'className';
var forProp = 'for';
var el = document.createElement('div');
el.setAttribute(classProp, 'x');
if (el.className !== 'x') {
el.setAttribute('class', 'x');
if (el.className === 'x') {
classProp = 'class';
}
}
el = null;
el = document.createElement('label');
el.setAttribute(forProp, 'x');
if (el.htmlFor !== 'x') {
el.setAttribute('htmlFor', 'x');
if (el.htmlFor === 'x') {
forProp = 'htmlFor';
}
}
el = null;
return {
read: {
names: {
'class': classProp,
'className': classProp,
'for': forProp,
'htmlFor': forProp
},
values: {
_getAttr: function(element, attribute) {
return element.getAttribute(attribute);
},
_getAttr2: function(element, attribute) {
return element.getAttribute(attribute, 2);
},
_getAttrNode: function(element, attribute) {
var node = element.getAttributeNode(attribute);
return node ? node.value : "";
},
_getEv: (function(){
var el = document.createElement('div');
el.onclick = Prototype.emptyFunction;
var value = el.getAttribute('onclick');
var f;
if (String(value).indexOf('{') > -1) {
f = function(element, attribute) {
attribute = element.getAttribute(attribute);
if (!attribute) return null;
attribute = attribute.toString();
attribute = attribute.split('{')[1];
attribute = attribute.split('}')[0];
return attribute.strip();
};
}
else if (value === '') {
f = function(element, attribute) {
attribute = element.getAttribute(attribute);
if (!attribute) return null;
return attribute.strip();
};
}
el = null;
return f;
})(),
_flag: function(element, attribute) {
return $(element).hasAttribute(attribute) ? attribute : null;
},
style: function(element) {
return element.style.cssText.toLowerCase();
},
title: function(element) {
return element.title;
}
}
}
}
})();
Element._attributeTranslations.write = {
names: Object.extend({
cellpadding: 'cellPadding',
cellspacing: 'cellSpacing'
}, Element._attributeTranslations.read.names),
values: {
checked: function(element, value) {
element.checked = !!value;
},
style: function(element, value) {
element.style.cssText = value ? value : '';
}
}
};
Element._attributeTranslations.has = {};
$w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
Element._attributeTranslations.has[attr.toLowerCase()] = attr;
});
(function(v) {
Object.extend(v, {
href: v._getAttr2,
src: v._getAttr2,
type: v._getAttr,
action: v._getAttrNode,
disabled: v._flag,
checked: v._flag,
readonly: v._flag,
multiple: v._flag,
onload: v._getEv,
onunload: v._getEv,
onclick: v._getEv,
ondblclick: v._getEv,
onmousedown: v._getEv,
onmouseup: v._getEv,
onmouseover: v._getEv,
onmousemove: v._getEv,
onmouseout: v._getEv,
onfocus: v._getEv,
onblur: v._getEv,
onkeypress: v._getEv,
onkeydown: v._getEv,
onkeyup: v._getEv,
onsubmit: v._getEv,
onreset: v._getEv,
onselect: v._getEv,
onchange: v._getEv
});
})(Element._attributeTranslations.read.values);
if (Prototype.BrowserFeatures.ElementExtensions) {
(function() {
function _descendants(element) {
var nodes = element.getElementsByTagName('*'), results = [];
for (var i = 0, node; node = nodes[i]; i++)
if (node.tagName !== "!") // Filter out comment nodes.
results.push(node);
return results;
}
Element.Methods.down = function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return element.firstDescendant();
return Object.isNumber(expression) ? _descendants(element)[expression] :
Element.select(element, expression)[index || 0];
}
})();
}
}
else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
Element.Methods.setOpacity = function(element, value) {
element = $(element);
element.style.opacity = (value == 1) ? 0.999999 :
(value === '') ? '' : (value < 0.00001) ? 0 : value;
return element;
};
}
else if (Prototype.Browser.WebKit) {
Element.Methods.setOpacity = function(element, value) {
element = $(element);
element.style.opacity = (value == 1 || value === '') ? '' :
(value < 0.00001) ? 0 : value;
if (value == 1)
if(element.tagName.toUpperCase() == 'IMG' && element.width) {
element.width++; element.width--;
} else try {
var n = document.createTextNode(' ');
element.appendChild(n);
element.removeChild(n);
} catch (e) { }
return element;
};
Element.Methods.cumulativeOffset = function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
if (element.offsetParent == document.body)
if (Element.getStyle(element, 'position') == 'absolute') break;
element = element.offsetParent;
} while (element);
return Element._returnOffset(valueL, valueT);
};
}
if ('outerHTML' in document.documentElement) {
Element.Methods.replace = function(element, content) {
element = $(element);
if (content && content.toElement) content = content.toElement();
if (Object.isElement(content)) {
element.parentNode.replaceChild(content, element);
return element;
}
content = Object.toHTML(content);
var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
if (Element._insertionTranslations.tags[tagName]) {
var nextSibling = element.next();
var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
parent.removeChild(element);
if (nextSibling)
fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
else
fragments.each(function(node) { parent.appendChild(node) });
}
else element.outerHTML = content.stripScripts();
content.evalScripts.bind(content).defer();
return element;
};
}
Element._returnOffset = function(l, t) {
var result = [l, t];
result.left = l;
result.top = t;
return result;
};
Element._getContentFromAnonymousElement = function(tagName, html) {
var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
if (t) {
div.innerHTML = t[0] + html + t[1];
t[2].times(function() { div = div.firstChild });
} else div.innerHTML = html;
return $A(div.childNodes);
};
Element._insertionTranslations = {
before: function(element, node) {
element.parentNode.insertBefore(node, element);
},
top: function(element, node) {
element.insertBefore(node, element.firstChild);
},
bottom: function(element, node) {
element.appendChild(node);
},
after: function(element, node) {
element.parentNode.insertBefore(node, element.nextSibling);
},
tags: {
TABLE: ['<table>', '</table>', 1],
TBODY: ['<table><tbody>', '</tbody></table>', 2],
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
SELECT: ['<select>', '</select>', 1]
}
};
(function() {
var tags = Element._insertionTranslations.tags;
Object.extend(tags, {
THEAD: tags.TBODY,
TFOOT: tags.TBODY,
TH: tags.TD
});
})();
Element.Methods.Simulated = {
hasAttribute: function(element, attribute) {
attribute = Element._attributeTranslations.has[attribute] || attribute;
var node = $(element).getAttributeNode(attribute);
return !!(node && node.specified);
}
};
Element.Methods.ByTag = { };
Object.extend(Element, Element.Methods);
(function(div) {
if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) {
window.HTMLElement = { };
window.HTMLElement.prototype = div['__proto__'];
Prototype.BrowserFeatures.ElementExtensions = true;
}
div = null;
})(document.createElement('div'))
Element.extend = (function() {
function checkDeficiency(tagName) {
if (typeof window.Element != 'undefined') {
var proto = window.Element.prototype;
if (proto) {
var id = '_' + (Math.random()+'').slice(2);
var el = document.createElement(tagName);
proto[id] = 'x';
var isBuggy = (el[id] !== 'x');
delete proto[id];
el = null;
return isBuggy;
}
}
return false;
}
function extendElementWith(element, methods) {
for (var property in methods) {
var value = methods[property];
if (Object.isFunction(value) && !(property in element))
element[property] = value.methodize();
}
}
var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');
if (Prototype.BrowserFeatures.SpecificElementExtensions) {
if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
return function(element) {
if (element && typeof element._extendedByPrototype == 'undefined') {
var t = element.tagName;
if (t && (/^(?:object|applet|embed)$/i.test(t))) {
extendElementWith(element, Element.Methods);
extendElementWith(element, Element.Methods.Simulated);
extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
}
}
return element;
}
}
return Prototype.K;
}
var Methods = { }, ByTag = Element.Methods.ByTag;
var extend = Object.extend(function(element) {
if (!element || typeof element._extendedByPrototype != 'undefined' ||
element.nodeType != 1 || element == window) return element;
var methods = Object.clone(Methods),
tagName = element.tagName.toUpperCase();
if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
extendElementWith(element, methods);
element._extendedByPrototype = Prototype.emptyFunction;
return element;
}, {
refresh: function() {
if (!Prototype.BrowserFeatures.ElementExtensions) {
Object.extend(Methods, Element.Methods);
Object.extend(Methods, Element.Methods.Simulated);
}
}
});
extend.refresh();
return extend;
})();
Element.hasAttribute = function(element, attribute) {
if (element.hasAttribute) return element.hasAttribute(attribute);
return Element.Methods.Simulated.hasAttribute(element, attribute);
};
Element.addMethods = function(methods) {
var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
if (!methods) {
Object.extend(Form, Form.Methods);
Object.extend(Form.Element, Form.Element.Methods);
Object.extend(Element.Methods.ByTag, {
"FORM": Object.clone(Form.Methods),
"INPUT": Object.clone(Form.Element.Methods),
"SELECT": Object.clone(Form.Element.Methods),
"TEXTAREA": Object.clone(Form.Element.Methods)
});
}
if (arguments.length == 2) {
var tagName = methods;
methods = arguments[1];
}
if (!tagName) Object.extend(Element.Methods, methods || { });
else {
if (Object.isArray(tagName)) tagName.each(extend);
else extend(tagName);
}
function extend(tagName) {
tagName = tagName.toUpperCase();
if (!Element.Methods.ByTag[tagName])
Element.Methods.ByTag[tagName] = { };
Object.extend(Element.Methods.ByTag[tagName], methods);
}
function copy(methods, destination, onlyIfAbsent) {
onlyIfAbsent = onlyIfAbsent || false;
for (var property in methods) {
var value = methods[property];
if (!Object.isFunction(value)) continue;
if (!onlyIfAbsent || !(property in destination))
destination[property] = value.methodize();
}
}
function findDOMClass(tagName) {
var klass;
var trans = {
"OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
"FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
"DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
"H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
"INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
"TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
"TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
"TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
"FrameSet", "IFRAME": "IFrame"
};
if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
if (window[klass]) return window[klass];
klass = 'HTML' + tagName + 'Element';
if (window[klass]) return window[klass];
klass = 'HTML' + tagName.capitalize() + 'Element';
if (window[klass]) return window[klass];
var element = document.createElement(tagName);
var proto = element['__proto__'] || element.constructor.prototype;
element = null;
return proto;
}
var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
Element.prototype;
if (F.ElementExtensions) {
copy(Element.Methods, elementPrototype);
copy(Element.Methods.Simulated, elementPrototype, true);
}
if (F.SpecificElementExtensions) {
for (var tag in Element.Methods.ByTag) {
var klass = findDOMClass(tag);
if (Object.isUndefined(klass)) continue;
copy(T[tag], klass.prototype);
}
}
Object.extend(Element, Element.Methods);
delete Element.ByTag;
if (Element.extend.refresh) Element.extend.refresh();
Element.cache = { };
};
document.viewport = {
getDimensions: function() {
return { width: this.getWidth(), height: this.getHeight() };
},
getScrollOffsets: function() {
return Element._returnOffset(
window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
}
};
(function(viewport) {
var B = Prototype.Browser, doc = document, element, property = {};
function getRootElement() {
if (B.WebKit && !doc.evaluate)
return document;
if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
return document.body;
return document.documentElement;
}
function define(D) {
if (!element) element = getRootElement();
property[D] = 'client' + D;
viewport['get' + D] = function() { return element[property[D]] };
return viewport['get' + D]();
}
viewport.getWidth = define.curry('Width');
viewport.getHeight = define.curry('Height');
})(document.viewport);
Element.Storage = {
UID: 1
};
Element.addMethods({
getStorage: function(element) {
if (!(element = $(element))) return;
var uid;
if (element === window) {
uid = 0;
} else {
if (typeof element._prototypeUID === "undefined")
element._prototypeUID = [Element.Storage.UID++];
uid = element._prototypeUID[0];
}
if (!Element.Storage[uid])
Element.Storage[uid] = $H();
return Element.Storage[uid];
},
store: function(element, key, value) {
if (!(element = $(element))) return;
if (arguments.length === 2) {
Element.getStorage(element).update(key);
} else {
Element.getStorage(element).set(key, value);
}
return element;
},
retrieve: function(element, key, defaultValue) {
if (!(element = $(element))) return;
var hash = Element.getStorage(element), value = hash.get(key);
if (Object.isUndefined(value)) {
hash.set(key, defaultValue);
value = defaultValue;
}
return value;
},
clone: function(element, deep) {
if (!(element = $(element))) return;
var clone = element.cloneNode(deep);
clone._prototypeUID = void 0;
if (deep) {
var descendants = Element.select(clone, '*'),
i = descendants.length;
while (i--) {
descendants[i]._prototypeUID = void 0;
}
}
return Element.extend(clone);
}
});
/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
* license. Please see http://www.yui-ext.com/ for more information. */
var Selector = Class.create({
initialize: function(expression) {
this.expression = expression.strip();
if (this.shouldUseSelectorsAPI()) {
this.mode = 'selectorsAPI';
} else if (this.shouldUseXPath()) {
this.mode = 'xpath';
this.compileXPathMatcher();
} else {
this.mode = "normal";
this.compileMatcher();
}
},
shouldUseXPath: (function() {
var IS_DESCENDANT_SELECTOR_BUGGY = (function(){
var isBuggy = false;
if (document.evaluate && window.XPathResult) {
var el = document.createElement('div');
el.innerHTML = '<ul><li></li></ul><div><ul><li></li></ul></div>';
var xpath = ".//*[local-name()='ul' or local-name()='UL']" +
"//*[local-name()='li' or local-name()='LI']";
var result = document.evaluate(xpath, el, null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
isBuggy = (result.snapshotLength !== 2);
el = null;
}
return isBuggy;
})();
return function() {
if (!Prototype.BrowserFeatures.XPath) return false;
var e = this.expression;
if (Prototype.Browser.WebKit &&
(e.include("-of-type") || e.include(":empty")))
return false;
if ((/(\[[\w-]*?:|:checked)/).test(e))
return false;
if (IS_DESCENDANT_SELECTOR_BUGGY) return false;
return true;
}
})(),
shouldUseSelectorsAPI: function() {
if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
if (Selector.CASE_INSENSITIVE_CLASS_NAMES) return false;
if (!Selector._div) Selector._div = new Element('div');
try {
Selector._div.querySelector(this.expression);
} catch(e) {
return false;
}
return true;
},
compileMatcher: function() {
var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
c = Selector.criteria, le, p, m, len = ps.length, name;
if (Selector._cache[e]) {
this.matcher = Selector._cache[e];
return;
}
this.matcher = ["this.matcher = function(root) {",
"var r = root, h = Selector.handlers, c = false, n;"];
while (e && le != e && (/\S/).test(e)) {
le = e;
for (var i = 0; i<len; i++) {
p = ps[i].re;
name = ps[i].name;
if (m = e.match(p)) {
this.matcher.push(Object.isFunction(c[name]) ? c[name](m) :
new Template(c[name]).evaluate(m));
e = e.replace(m[0], '');
break;
}
}
}
this.matcher.push("return h.unique(n);\n}");
eval(this.matcher.join('\n'));
Selector._cache[this.expression] = this.matcher;
},
compileXPathMatcher: function() {
var e = this.expression, ps = Selector.patterns,
x = Selector.xpath, le, m, len = ps.length, name;
if (Selector._cache[e]) {
this.xpath = Selector._cache[e]; return;
}
this.matcher = ['.//*'];
while (e && le != e && (/\S/).test(e)) {
le = e;
for (var i = 0; i<len; i++) {
name = ps[i].name;
if (m = e.match(ps[i].re)) {
this.matcher.push(Object.isFunction(x[name]) ? x[name](m) :
new Template(x[name]).evaluate(m));
e = e.replace(m[0], '');
break;
}
}
}
this.xpath = this.matcher.join('');
Selector._cache[this.expression] = this.xpath;
},
findElements: function(root) {
root = root || document;
var e = this.expression, results;
switch (this.mode) {
case 'selectorsAPI':
if (root !== document) {
var oldId = root.id, id = $(root).identify();
id = id.replace(/([\.:])/g, "\\$1");
e = "#" + id + " " + e;
}
results = $A(root.querySelectorAll(e)).map(Element.extend);
root.id = oldId;
return results;
case 'xpath':
return document._getElementsByXPath(this.xpath, root);
default:
return this.matcher(root);
}
},
match: function(element) {
this.tokens = [];
var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
var le, p, m, len = ps.length, name;
while (e && le !== e && (/\S/).test(e)) {
le = e;
for (var i = 0; i<len; i++) {
p = ps[i].re;
name = ps[i].name;
if (m = e.match(p)) {
if (as[name]) {
this.tokens.push([name, Object.clone(m)]);
e = e.replace(m[0], '');
} else {
return this.findElements(document).include(element);
}
}
}
}
var match = true, name, matches;
for (var i = 0, token; token = this.tokens[i]; i++) {
name = token[0], matches = token[1];
if (!Selector.assertions[name](element, matches)) {
match = false; break;
}
}
return match;
},
toString: function() {
return this.expression;
},
inspect: function() {
return "#<Selector:" + this.expression.inspect() + ">";
}
});
if (Prototype.BrowserFeatures.SelectorsAPI &&
document.compatMode === 'BackCompat') {
Selector.CASE_INSENSITIVE_CLASS_NAMES = (function(){
var div = document.createElement('div'),
span = document.createElement('span');
div.id = "prototype_test_id";
span.className = 'Test';
div.appendChild(span);
var isIgnored = (div.querySelector('#prototype_test_id .test') !== null);
div = span = null;
return isIgnored;
})();
}
Object.extend(Selector, {
_cache: { },
xpath: {
descendant: "//*",
child: "/*",
adjacent: "/following-sibling::*[1]",
laterSibling: '/following-sibling::*',
tagName: function(m) {
if (m[1] == '*') return '';
return "[local-name()='" + m[1].toLowerCase() +
"' or local-name()='" + m[1].toUpperCase() + "']";
},
className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
id: "[@id='#{1}']",
attrPresence: function(m) {
m[1] = m[1].toLowerCase();
return new Template("[@#{1}]").evaluate(m);
},
attr: function(m) {
m[1] = m[1].toLowerCase();
m[3] = m[5] || m[6];
return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
},
pseudo: function(m) {
var h = Selector.xpath.pseudos[m[1]];
if (!h) return '';
if (Object.isFunction(h)) return h(m);
return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
},
operators: {
'=': "[@#{1}='#{3}']",
'!=': "[@#{1}!='#{3}']",
'^=': "[starts-with(@#{1}, '#{3}')]",
'$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
'*=': "[contains(@#{1}, '#{3}')]",
'~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
'|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
},
pseudos: {
'first-child': '[not(preceding-sibling::*)]',
'last-child': '[not(following-sibling::*)]',
'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
'empty': "[count(*) = 0 and (count(text()) = 0)]",
'checked': "[@checked]",
'disabled': "[(@disabled) and (@type!='hidden')]",
'enabled': "[not(@disabled) and (@type!='hidden')]",
'not': function(m) {
var e = m[6], p = Selector.patterns,
x = Selector.xpath, le, v, len = p.length, name;
var exclusion = [];
while (e && le != e && (/\S/).test(e)) {
le = e;
for (var i = 0; i<len; i++) {
name = p[i].name
if (m = e.match(p[i].re)) {
v = Object.isFunction(x[name]) ? x[name](m) : new Template(x[name]).evaluate(m);
exclusion.push("(" + v.substring(1, v.length - 1) + ")");
e = e.replace(m[0], '');
break;
}
}
}
return "[not(" + exclusion.join(" and ") + ")]";
},
'nth-child': function(m) {
return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
},
'nth-last-child': function(m) {
return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
},
'nth-of-type': function(m) {
return Selector.xpath.pseudos.nth("position() ", m);
},
'nth-last-of-type': function(m) {
return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
},
'first-of-type': function(m) {
m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
},
'last-of-type': function(m) {
m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
},
'only-of-type': function(m) {
var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
},
nth: function(fragment, m) {
var mm, formula = m[6], predicate;
if (formula == 'even') formula = '2n+0';
if (formula == 'odd') formula = '2n+1';
if (mm = formula.match(/^(\d+)$/)) // digit only
return '[' + fragment + "= " + mm[1] + ']';
if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
if (mm[1] == "-") mm[1] = -1;
var a = mm[1] ? Number(mm[1]) : 1;
var b = mm[2] ? Number(mm[2]) : 0;
predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
"((#{fragment} - #{b}) div #{a} >= 0)]";
return new Template(predicate).evaluate({
fragment: fragment, a: a, b: b });
}
}
}
},
criteria: {
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
className: 'n = h.className(n, r, "#{1}", c); c = false;',
id: 'n = h.id(n, r, "#{1}", c); c = false;',
attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
attr: function(m) {
m[3] = (m[5] || m[6]);
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
},
pseudo: function(m) {
if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
},
descendant: 'c = "descendant";',
child: 'c = "child";',
adjacent: 'c = "adjacent";',
laterSibling: 'c = "laterSibling";'
},
patterns: [
{ name: 'laterSibling', re: /^\s*~\s*/ },
{ name: 'child', re: /^\s*>\s*/ },
{ name: 'adjacent', re: /^\s*\+\s*/ },
{ name: 'descendant', re: /^\s/ },
{ name: 'tagName', re: /^\s*(\*|[\w\-]+)(\b|$)?/ },
{ name: 'id', re: /^#([\w\-\*]+)(\b|$)/ },
{ name: 'className', re: /^\.([\w\-\*]+)(\b|$)/ },
{ name: 'pseudo', re: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/ },
{ name: 'attrPresence', re: /^\[((?:[\w-]+:)?[\w-]+)\]/ },
{ name: 'attr', re: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }
],
assertions: {
tagName: function(element, matches) {
return matches[1].toUpperCase() == element.tagName.toUpperCase();
},
className: function(element, matches) {
return Element.hasClassName(element, matches[1]);
},
id: function(element, matches) {
return element.id === matches[1];
},
attrPresence: function(element, matches) {
return Element.hasAttribute(element, matches[1]);
},
attr: function(element, matches) {
var nodeValue = Element.readAttribute(element, matches[1]);
return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
}
},
handlers: {
concat: function(a, b) {
for (var i = 0, node; node = b[i]; i++)
a.push(node);
return a;
},
mark: function(nodes) {
var _true = Prototype.emptyFunction;
for (var i = 0, node; node = nodes[i]; i++)
node._countedByPrototype = _true;
return nodes;
},
unmark: (function(){
var PROPERTIES_ATTRIBUTES_MAP = (function(){
var el = document.createElement('div'),
isBuggy = false,
propName = '_countedByPrototype',
value = 'x'
el[propName] = value;
isBuggy = (el.getAttribute(propName) === value);
el = null;
return isBuggy;
})();
return PROPERTIES_ATTRIBUTES_MAP ?
function(nodes) {
for (var i = 0, node; node = nodes[i]; i++)
node.removeAttribute('_countedByPrototype');
return nodes;
} :
function(nodes) {
for (var i = 0, node; node = nodes[i]; i++)
node._countedByPrototype = void 0;
return nodes;
}
})(),
index: function(parentNode, reverse, ofType) {
parentNode._countedByPrototype = Prototype.emptyFunction;
if (reverse) {
for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
var node = nodes[i];
if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
}
} else {
for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
}
},
unique: function(nodes) {
if (nodes.length == 0) return nodes;
var results = [], n;
for (var i = 0, l = nodes.length; i < l; i++)
if (typeof (n = nodes[i])._countedByPrototype == 'undefined') {
n._countedByPrototype = Prototype.emptyFunction;
results.push(Element.extend(n));
}
return Selector.handlers.unmark(results);
},
descendant: function(nodes) {
var h = Selector.handlers;
for (var i = 0, results = [], node; node = nodes[i]; i++)
h.concat(results, node.getElementsByTagName('*'));
return results;
},
child: function(nodes) {
var h = Selector.handlers;
for (var i = 0, results = [], node; node = nodes[i]; i++) {
for (var j = 0, child; child = node.childNodes[j]; j++)
if (child.nodeType == 1 && child.tagName != '!') results.push(child);
}
return results;
},
adjacent: function(nodes) {
for (var i = 0, results = [], node; node = nodes[i]; i++) {
var next = this.nextElementSibling(node);
if (next) results.push(next);
}
return results;
},
laterSibling: function(nodes) {
var h = Selector.handlers;
for (var i = 0, results = [], node; node = nodes[i]; i++)
h.concat(results, Element.nextSiblings(node));
return results;
},
nextElementSibling: function(node) {
while (node = node.nextSibling)
if (node.nodeType == 1) return node;
return null;
},
previousElementSibling: function(node) {
while (node = node.previousSibling)
if (node.nodeType == 1) return node;
return null;
},
tagName: function(nodes, root, tagName, combinator) {
var uTagName = tagName.toUpperCase();
var results = [], h = Selector.handlers;
if (nodes) {
if (combinator) {
if (combinator == "descendant") {
for (var i = 0, node; node = nodes[i]; i++)
h.concat(results, node.getElementsByTagName(tagName));
return results;
} else nodes = this[combinator](nodes);
if (tagName == "*") return nodes;
}
for (var i = 0, node; node = nodes[i]; i++)
if (node.tagName.toUpperCase() === uTagName) results.push(node);
return results;
} else return root.getElementsByTagName(tagName);
},
id: function(nodes, root, id, combinator) {
var targetNode = $(id), h = Selector.handlers;
if (root == document) {
if (!targetNode) return [];
if (!nodes) return [targetNode];
} else {
if (!root.sourceIndex || root.sourceIndex < 1) {
var nodes = root.getElementsByTagName('*');
for (var j = 0, node; node = nodes[j]; j++) {
if (node.id === id) return [node];
}
}
}
if (nodes) {
if (combinator) {
if (combinator == 'child') {
for (var i = 0, node; node = nodes[i]; i++)
if (targetNode.parentNode == node) return [targetNode];
} else if (combinator == 'descendant') {
for (var i = 0, node; node = nodes[i]; i++)
if (Element.descendantOf(targetNode, node)) return [targetNode];
} else if (combinator == 'adjacent') {
for (var i = 0, node; node = nodes[i]; i++)
if (Selector.handlers.previousElementSibling(targetNode) == node)
return [targetNode];
} else nodes = h[combinator](nodes);
}
for (var i = 0, node; node = nodes[i]; i++)
if (node == targetNode) return [targetNode];
return [];
}
return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
},
className: function(nodes, root, className, combinator) {
if (nodes && combinator) nodes = this[combinator](nodes);
return Selector.handlers.byClassName(nodes, root, className);
},
byClassName: function(nodes, root, className) {
if (!nodes) nodes = Selector.handlers.descendant([root]);
var needle = ' ' + className + ' ';
for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
nodeClassName = node.className;
if (nodeClassName.length == 0) continue;
if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
results.push(node);
}
return results;
},
attrPresence: function(nodes, root, attr, combinator) {
if (!nodes) nodes = root.getElementsByTagName("*");
if (nodes && combinator) nodes = this[combinator](nodes);
var results = [];
for (var i = 0, node; node = nodes[i]; i++)
if (Element.hasAttribute(node, attr)) results.push(node);
return results;
},
attr: function(nodes, root, attr, value, operator, combinator) {
if (!nodes) nodes = root.getElementsByTagName("*");
if (nodes && combinator) nodes = this[combinator](nodes);
var handler = Selector.operators[operator], results = [];
for (var i = 0, node; node = nodes[i]; i++) {
var nodeValue = Element.readAttribute(node, attr);
if (nodeValue === null) continue;
if (handler(nodeValue, value)) results.push(node);
}
return results;
},
pseudo: function(nodes, name, value, root, combinator) {
if (nodes && combinator) nodes = this[combinator](nodes);
if (!nodes) nodes = root.getElementsByTagName("*");
return Selector.pseudos[name](nodes, value, root);
}
},
pseudos: {
'first-child': function(nodes, value, root) {
for (var i = 0, results = [], node; node = nodes[i]; i++) {
if (Selector.handlers.previousElementSibling(node)) continue;
results.push(node);
}
return results;
},
'last-child': function(nodes, value, root) {
for (var i = 0, results = [], node; node = nodes[i]; i++) {
if (Selector.handlers.nextElementSibling(node)) continue;
results.push(node);
}
return results;
},
'only-child': function(nodes, value, root) {
var h = Selector.handlers;
for (var i = 0, results = [], node; node = nodes[i]; i++)
if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
results.push(node);
return results;
},
'nth-child': function(nodes, formula, root) {
return Selector.pseudos.nth(nodes, formula, root);
},
'nth-last-child': function(nodes, formula, root) {
return Selector.pseudos.nth(nodes, formula, root, true);
},
'nth-of-type': function(nodes, formula, root) {
return Selector.pseudos.nth(nodes, formula, root, false, true);
},
'nth-last-of-type': function(nodes, formula, root) {
return Selector.pseudos.nth(nodes, formula, root, true, true);
},
'first-of-type': function(nodes, formula, root) {
return Selector.pseudos.nth(nodes, "1", root, false, true);
},
'last-of-type': function(nodes, formula, root) {
return Selector.pseudos.nth(nodes, "1", root, true, true);
},
'only-of-type': function(nodes, formula, root) {
var p = Selector.pseudos;
return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
},
getIndices: function(a, b, total) {
if (a == 0) return b > 0 ? [b] : [];
return $R(1, total).inject([], function(memo, i) {
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
return memo;
});
},
nth: function(nodes, formula, root, reverse, ofType) {
if (nodes.length == 0) return [];
if (formula == 'even') formula = '2n+0';
if (formula == 'odd') formula = '2n+1';
var h = Selector.handlers, results = [], indexed = [], m;
h.mark(nodes);
for (var i = 0, node; node = nodes[i]; i++) {
if (!node.parentNode._countedByPrototype) {
h.index(node.parentNode, reverse, ofType);
indexed.push(node.parentNode);
}
}
if (formula.match(/^\d+$/)) { // just a number
formula = Number(formula);
for (var i = 0, node; node = nodes[i]; i++)
if (node.nodeIndex == formula) results.push(node);
} else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
if (m[1] == "-") m[1] = -1;
var a = m[1] ? Number(m[1]) : 1;
var b = m[2] ? Number(m[2]) : 0;
var indices = Selector.pseudos.getIndices(a, b, nodes.length);
for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
for (var j = 0; j < l; j++)
if (node.nodeIndex == indices[j]) results.push(node);
}
}
h.unmark(nodes);
h.unmark(indexed);
return results;
},
'empty': function(nodes, value, root) {
for (var i = 0, results = [], node; node = nodes[i]; i++) {
if (node.tagName == '!' || node.firstChild) continue;
results.push(node);
}
return results;
},
'not': function(nodes, selector, root) {
var h = Selector.handlers, selectorType, m;
var exclusions = new Selector(selector).findElements(root);
h.mark(exclusions);
for (var i = 0, results = [], node; node = nodes[i]; i++)
if (!node._countedByPrototype) results.push(node);
h.unmark(exclusions);
return results;
},
'enabled': function(nodes, value, root) {
for (var i = 0, results = [], node; node = nodes[i]; i++)
if (!node.disabled && (!node.type || node.type !== 'hidden'))
results.push(node);
return results;
},
'disabled': function(nodes, value, root) {
for (var i = 0, results = [], node; node = nodes[i]; i++)
if (node.disabled) results.push(node);
return results;
},
'checked': function(nodes, value, root) {
for (var i = 0, results = [], node; node = nodes[i]; i++)
if (node.checked) results.push(node);
return results;
}
},
operators: {
'=': function(nv, v) { return nv == v; },
'!=': function(nv, v) { return nv != v; },
'^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
'$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
'*=': function(nv, v) { return nv == v || nv && nv.include(v); },
'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
'|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
'-').include('-' + (v || "").toUpperCase() + '-'); }
},
split: function(expression) {
var expressions = [];
expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
expressions.push(m[1].strip());
});
return expressions;
},
matchElements: function(elements, expression) {
var matches = $$(expression), h = Selector.handlers;
h.mark(matches);
for (var i = 0, results = [], element; element = elements[i]; i++)
if (element._countedByPrototype) results.push(element);
h.unmark(matches);
return results;
},
findElement: function(elements, expression, index) {
if (Object.isNumber(expression)) {
index = expression; expression = false;
}
return Selector.matchElements(elements, expression || '*')[index || 0];
},
findChildElements: function(element, expressions) {
expressions = Selector.split(expressions.join(','));
var results = [], h = Selector.handlers;
for (var i = 0, l = expressions.length, selector; i < l; i++) {
selector = new Selector(expressions[i].strip());
h.concat(results, selector.findElements(element));
}
return (l > 1) ? h.unique(results) : results;
}
});
if (Prototype.Browser.IE) {
Object.extend(Selector.handlers, {
concat: function(a, b) {
for (var i = 0, node; node = b[i]; i++)
if (node.tagName !== "!") a.push(node);
return a;
}
});
}
function $$() {
return Selector.findChildElements(document, $A(arguments));
}
var Form = {
reset: function(form) {
form = $(form);
form.reset();
return form;
},
serializeElements: function(elements, options) {
if (typeof options != 'object') options = { hash: !!options };
else if (Object.isUndefined(options.hash)) options.hash = true;
var key, value, submitted = false, submit = options.submit;
var data = elements.inject({ }, function(result, element) {
if (!element.disabled && element.name) {
key = element.name; value = $(element).getValue();
if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
submit !== false && (!submit || key == submit) && (submitted = true)))) {
if (key in result) {
if (!Object.isArray(result[key])) result[key] = [result[key]];
result[key].push(value);
}
else result[key] = value;
}
}
return result;
});
return options.hash ? data : Object.toQueryString(data);
}
};
Form.Methods = {
serialize: function(form, options) {
return Form.serializeElements(Form.getElements(form), options);
},
getElements: function(form) {
var elements = $(form).getElementsByTagName('*'),
element,
arr = [ ],
serializers = Form.Element.Serializers;
for (var i = 0; element = elements[i]; i++) {
arr.push(element);
}
return arr.inject([], function(elements, child) {
if (serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));
return elements;
})
},
getInputs: function(form, typeName, name) {
form = $(form);
var inputs = form.getElementsByTagName('input');
if (!typeName && !name) return $A(inputs).map(Element.extend);
for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
var input = inputs[i];
if ((typeName && input.type != typeName) || (name && input.name != name))
continue;
matchingInputs.push(Element.extend(input));
}
return matchingInputs;
},
disable: function(form) {
form = $(form);
Form.getElements(form).invoke('disable');
return form;
},
enable: function(form) {
form = $(form);
Form.getElements(form).invoke('enable');
return form;
},
findFirstElement: function(form) {
var elements = $(form).getElements().findAll(function(element) {
return 'hidden' != element.type && !element.disabled;
});
var firstByIndex = elements.findAll(function(element) {
return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
}).sortBy(function(element) { return element.tabIndex }).first();
return firstByIndex ? firstByIndex : elements.find(function(element) {
return /^(?:input|select|textarea)$/i.test(element.tagName);
});
},
focusFirstElement: function(form) {
form = $(form);
form.findFirstElement().activate();
return form;
},
request: function(form, options) {
form = $(form), options = Object.clone(options || { });
var params = options.parameters, action = form.readAttribute('action') || '';
if (action.blank()) action = window.location.href;
options.parameters = form.serialize(true);
if (params) {
if (Object.isString(params)) params = params.toQueryParams();
Object.extend(options.parameters, params);
}
if (form.hasAttribute('method') && !options.method)
options.method = form.method;
return new Ajax.Request(action, options);
}
};
/*--------------------------------------------------------------------------*/
Form.Element = {
focus: function(element) {
$(element).focus();
return element;
},
select: function(element) {
$(element).select();
return element;
}
};
Form.Element.Methods = {
serialize: function(element) {
element = $(element);
if (!element.disabled && element.name) {
var value = element.getValue();
if (value != undefined) {
var pair = { };
pair[element.name] = value;
return Object.toQueryString(pair);
}
}
return '';
},
getValue: function(element) {
element = $(element);
var method = element.tagName.toLowerCase();
return Form.Element.Serializers[method](element);
},
setValue: function(element, value) {
element = $(element);
var method = element.tagName.toLowerCase();
Form.Element.Serializers[method](element, value);
return element;
},
clear: function(element) {
$(element).value = '';
return element;
},
present: function(element) {
return $(element).value != '';
},
activate: function(element) {
element = $(element);
try {
element.focus();
if (element.select && (element.tagName.toLowerCase() != 'input' ||
!(/^(?:button|reset|submit)$/i.test(element.type))))
element.select();
} catch (e) { }
return element;
},
disable: function(element) {
element = $(element);
element.disabled = true;
return element;
},
enable: function(element) {
element = $(element);
element.disabled = false;
return element;
}
};
/*--------------------------------------------------------------------------*/
var Field = Form.Element;
var $F = Form.Element.Methods.getValue;
/*--------------------------------------------------------------------------*/
Form.Element.Serializers = {
input: function(element, value) {
switch (element.type.toLowerCase()) {
case 'checkbox':
case 'radio':
return Form.Element.Serializers.inputSelector(element, value);
default:
return Form.Element.Serializers.textarea(element, value);
}
},
inputSelector: function(element, value) {
if (Object.isUndefined(value)) return element.checked ? element.value : null;
else element.checked = !!value;
},
textarea: function(element, value) {
if (Object.isUndefined(value)) return element.value;
else element.value = value;
},
select: function(element, value) {
if (Object.isUndefined(value))
return this[element.type == 'select-one' ?
'selectOne' : 'selectMany'](element);
else {
var opt, currentValue, single = !Object.isArray(value);
for (var i = 0, length = element.length; i < length; i++) {
opt = element.options[i];
currentValue = this.optionValue(opt);
if (single) {
if (currentValue == value) {
opt.selected = true;
return;
}
}
else opt.selected = value.include(currentValue);
}
}
},
selectOne: function(element) {
var index = element.selectedIndex;
return index >= 0 ? this.optionValue(element.options[index]) : null;
},
selectMany: function(element) {
var values, length = element.length;
if (!length) return null;
for (var i = 0, values = []; i < length; i++) {
var opt = element.options[i];
if (opt.selected) values.push(this.optionValue(opt));
}
return values;
},
optionValue: function(opt) {
return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
}
};
/*--------------------------------------------------------------------------*/
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
initialize: function($super, element, frequency, callback) {
$super(callback, frequency);
this.element = $(element);
this.lastValue = this.getValue();
},
execute: function() {
var value = this.getValue();
if (Object.isString(this.lastValue) && Object.isString(value) ?
this.lastValue != value : String(this.lastValue) != String(value)) {
this.callback(this.element, value);
this.lastValue = value;
}
}
});
Form.Element.Observer = Class.create(Abstract.TimedObserver, {
getValue: function() {
return Form.Element.getValue(this.element);
}
});
Form.Observer = Class.create(Abstract.TimedObserver, {
getValue: function() {
return Form.serialize(this.element);
}
});
/*--------------------------------------------------------------------------*/
Abstract.EventObserver = Class.create({
initialize: function(element, callback) {
this.element = $(element);
this.callback = callback;
this.lastValue = this.getValue();
if (this.element.tagName.toLowerCase() == 'form')
this.registerFormCallbacks();
else
this.registerCallback(this.element);
},
onElementEvent: function() {
var value = this.getValue();
if (this.lastValue != value) {
this.callback(this.element, value);
this.lastValue = value;
}
},
registerFormCallbacks: function() {
Form.getElements(this.element).each(this.registerCallback, this);
},
registerCallback: function(element) {
if (element.type) {
switch (element.type.toLowerCase()) {
case 'checkbox':
case 'radio':
Event.observe(element, 'click', this.onElementEvent.bind(this));
break;
default:
Event.observe(element, 'change', this.onElementEvent.bind(this));
break;
}
}
}
});
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
getValue: function() {
return Form.Element.getValue(this.element);
}
});
Form.EventObserver = Class.create(Abstract.EventObserver, {
getValue: function() {
return Form.serialize(this.element);
}
});
(function() {
var Event = {
KEY_BACKSPACE: 8,
KEY_TAB: 9,
KEY_RETURN: 13,
KEY_ESC: 27,
KEY_LEFT: 37,
KEY_UP: 38,
KEY_RIGHT: 39,
KEY_DOWN: 40,
KEY_DELETE: 46,
KEY_HOME: 36,
KEY_END: 35,
KEY_PAGEUP: 33,
KEY_PAGEDOWN: 34,
KEY_INSERT: 45,
cache: {}
};
var docEl = document.documentElement;
var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
&& 'onmouseleave' in docEl;
var _isButton;
if (Prototype.Browser.IE) {
var buttonMap = { 0: 1, 1: 4, 2: 2 };
_isButton = function(event, code) {
return event.button === buttonMap[code];
};
} else if (Prototype.Browser.WebKit) {
_isButton = function(event, code) {
switch (code) {
case 0: return event.which == 1 && !event.metaKey;
case 1: return event.which == 1 && event.metaKey;
default: return false;
}
};
} else {
_isButton = function(event, code) {
return event.which ? (event.which === code + 1) : (event.button === code);
};
}
function isLeftClick(event) { return _isButton(event, 0) }
function isMiddleClick(event) { return _isButton(event, 1) }
function isRightClick(event) { return _isButton(event, 2) }
function element(event) {
event = Event.extend(event);
var node = event.target, type = event.type,
currentTarget = event.currentTarget;
if (currentTarget && currentTarget.tagName) {
if (type === 'load' || type === 'error' ||
(type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
&& currentTarget.type === 'radio'))
node = currentTarget;
}
if (node.nodeType == Node.TEXT_NODE)
node = node.parentNode;
return Element.extend(node);
}
function findElement(event, expression) {
var element = Event.element(event);
if (!expression) return element;
var elements = [element].concat(element.ancestors());
return Selector.findElement(elements, expression, 0);
}
function pointer(event) {
return { x: pointerX(event), y: pointerY(event) };
}
function pointerX(event) {
var docElement = document.documentElement,
body = document.body || { scrollLeft: 0 };
return event.pageX || (event.clientX +
(docElement.scrollLeft || body.scrollLeft) -
(docElement.clientLeft || 0));
}
function pointerY(event) {
var docElement = document.documentElement,
body = document.body || { scrollTop: 0 };
return event.pageY || (event.clientY +
(docElement.scrollTop || body.scrollTop) -
(docElement.clientTop || 0));
}
function stop(event) {
Event.extend(event);
event.preventDefault();
event.stopPropagation();
event.stopped = true;
}
Event.Methods = {
isLeftClick: isLeftClick,
isMiddleClick: isMiddleClick,
isRightClick: isRightClick,
element: element,
findElement: findElement,
pointer: pointer,
pointerX: pointerX,
pointerY: pointerY,
stop: stop
};
var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
m[name] = Event.Methods[name].methodize();
return m;
});
if (Prototype.Browser.IE) {
function _relatedTarget(event) {
var element;
switch (event.type) {
case 'mouseover': element = event.fromElement; break;
case 'mouseout': element = event.toElement; break;
default: return null;
}
return Element.extend(element);
}
Object.extend(methods, {
stopPropagation: function() { this.cancelBubble = true },
preventDefault: function() { this.returnValue = false },
inspect: function() { return '[object Event]' }
});
Event.extend = function(event, element) {
if (!event) return false;
if (event._extendedByPrototype) return event;
event._extendedByPrototype = Prototype.emptyFunction;
var pointer = Event.pointer(event);
Object.extend(event, {
target: event.srcElement || element,
relatedTarget: _relatedTarget(event),
pageX: pointer.x,
pageY: pointer.y
});
return Object.extend(event, methods);
};
} else {
Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
Object.extend(Event.prototype, methods);
Event.extend = Prototype.K;
}
function _createResponder(element, eventName, handler) {
var registry = Element.retrieve(element, 'prototype_event_registry');
if (Object.isUndefined(registry)) {
CACHE.push(element);
registry = Element.retrieve(element, 'prototype_event_registry', $H());
}
var respondersForEvent = registry.get(eventName);
if (Object.isUndefined(respondersForEvent)) {
respondersForEvent = [];
registry.set(eventName, respondersForEvent);
}
if (respondersForEvent.pluck('handler').include(handler)) return false;
var responder;
if (eventName.include(":")) {
responder = function(event) {
if (Object.isUndefined(event.eventName))
return false;
if (event.eventName !== eventName)
return false;
Event.extend(event, element);
handler.call(element, event);
};
} else {
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
(eventName === "mouseenter" || eventName === "mouseleave")) {
if (eventName === "mouseenter" || eventName === "mouseleave") {
responder = function(event) {
Event.extend(event, element);
var parent = event.relatedTarget;
while (parent && parent !== element) {
try { parent = parent.parentNode; }
catch(e) { parent = element; }
}
if (parent === element) return;
handler.call(element, event);
};
}
} else {
responder = function(event) {
Event.extend(event, element);
handler.call(element, event);
};
}
}
responder.handler = handler;
respondersForEvent.push(responder);
return responder;
}
function _destroyCache() {
for (var i = 0, length = CACHE.length; i < length; i++) {
Event.stopObserving(CACHE[i]);
CACHE[i] = null;
}
}
var CACHE = [];
if (Prototype.Browser.IE)
window.attachEvent('onunload', _destroyCache);
if (Prototype.Browser.WebKit)
window.addEventListener('unload', Prototype.emptyFunction, false);
var _getDOMEventName = Prototype.K;
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
_getDOMEventName = function(eventName) {
var translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
return eventName in translations ? translations[eventName] : eventName;
};
}
function observe(element, eventName, handler) {
element = $(element);
var responder = _createResponder(element, eventName, handler);
if (!responder) return element;
if (eventName.include(':')) {
if (element.addEventListener)
element.addEventListener("dataavailable", responder, false);
else {
element.attachEvent("ondataavailable", responder);
element.attachEvent("onfilterchange", responder);
}
} else {
var actualEventName = _getDOMEventName(eventName);
if (element.addEventListener)
element.addEventListener(actualEventName, responder, false);
else
element.attachEvent("on" + actualEventName, responder);
}
return element;
}
function stopObserving(element, eventName, handler) {
element = $(element);
var registry = Element.retrieve(element, 'prototype_event_registry');
if (Object.isUndefined(registry)) return element;
if (eventName && !handler) {
var responders = registry.get(eventName);
if (Object.isUndefined(responders)) return element;
responders.each( function(r) {
Element.stopObserving(element, eventName, r.handler);
});
return element;
} else if (!eventName) {
registry.each( function(pair) {
var eventName = pair.key, responders = pair.value;
responders.each( function(r) {
Element.stopObserving(element, eventName, r.handler);
});
});
return element;
}
var responders = registry.get(eventName);
if (!responders) return;
var responder = responders.find( function(r) { return r.handler === handler; });
if (!responder) return element;
var actualEventName = _getDOMEventName(eventName);
if (eventName.include(':')) {
if (element.removeEventListener)
element.removeEventListener("dataavailable", responder, false);
else {
element.detachEvent("ondataavailable", responder);
element.detachEvent("onfilterchange", responder);
}
} else {
if (element.removeEventListener)
element.removeEventListener(actualEventName, responder, false);
else
element.detachEvent('on' + actualEventName, responder);
}
registry.set(eventName, responders.without(responder));
return element;
}
function fire(element, eventName, memo, bubble) {
element = $(element);
if (Object.isUndefined(bubble))
bubble = true;
if (element == document && document.createEvent && !element.dispatchEvent)
element = document.documentElement;
var event;
if (document.createEvent) {
event = document.createEvent('HTMLEvents');
event.initEvent('dataavailable', true, true);
} else {
event = document.createEventObject();
event.eventType = bubble ? 'ondataavailable' : 'onfilterchange';
}
event.eventName = eventName;
event.memo = memo || { };
if (document.createEvent)
element.dispatchEvent(event);
else
element.fireEvent(event.eventType, event);
return Event.extend(event);
}
Object.extend(Event, Event.Methods);
Object.extend(Event, {
fire: fire,
observe: observe,
stopObserving: stopObserving
});
Element.addMethods({
fire: fire,
observe: observe,
stopObserving: stopObserving
});
Object.extend(document, {
fire: fire.methodize(),
observe: observe.methodize(),
stopObserving: stopObserving.methodize(),
loaded: false
});
if (window.Event) Object.extend(window.Event, Event);
else window.Event = Event;
})();
(function() {
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
var timer;
function fireContentLoadedEvent() {
if (document.loaded) return;
if (timer) window.clearTimeout(timer);
document.loaded = true;
document.fire('dom:loaded');
}
function checkReadyState() {
if (document.readyState === 'complete') {
document.stopObserving('readystatechange', checkReadyState);
fireContentLoadedEvent();
}
}
function pollDoScroll() {
try { document.documentElement.doScroll('left'); }
catch(e) {
timer = pollDoScroll.defer();
return;
}
fireContentLoadedEvent();
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
} else {
document.observe('readystatechange', checkReadyState);
if (window == top)
timer = pollDoScroll.defer();
}
Event.observe(window, 'load', fireContentLoadedEvent);
})();
Element.addMethods();
/*------------------------------- DEPRECATED -------------------------------*/
Hash.toQueryString = Object.toQueryString;
var Toggle = { display: Element.toggle };
Element.Methods.childOf = Element.Methods.descendantOf;
var Insertion = {
Before: function(element, content) {
return Element.insert(element, {before:content});
},
Top: function(element, content) {
return Element.insert(element, {top:content});
},
Bottom: function(element, content) {
return Element.insert(element, {bottom:content});
},
After: function(element, content) {
return Element.insert(element, {after:content});
}
};
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
var Position = {
includeScrollOffsets: false,
prepare: function() {
this.deltaX = window.pageXOffset
|| document.documentElement.scrollLeft
|| document.body.scrollLeft
|| 0;
this.deltaY = window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop
|| 0;
},
within: function(element, x, y) {
if (this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element, x, y);
this.xcomp = x;
this.ycomp = y;
this.offset = Element.cumulativeOffset(element);
return (y >= this.offset[1] &&
y < this.offset[1] + element.offsetHeight &&
x >= this.offset[0] &&
x < this.offset[0] + element.offsetWidth);
},
withinIncludingScrolloffsets: function(element, x, y) {
var offsetcache = Element.cumulativeScrollOffset(element);
this.xcomp = x + offsetcache[0] - this.deltaX;
this.ycomp = y + offsetcache[1] - this.deltaY;
this.offset = Element.cumulativeOffset(element);
return (this.ycomp >= this.offset[1] &&
this.ycomp < this.offset[1] + element.offsetHeight &&
this.xcomp >= this.offset[0] &&
this.xcomp < this.offset[0] + element.offsetWidth);
},
overlap: function(mode, element) {
if (!mode) return 0;
if (mode == 'vertical')
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
element.offsetHeight;
if (mode == 'horizontal')
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
element.offsetWidth;
},
cumulativeOffset: Element.Methods.cumulativeOffset,
positionedOffset: Element.Methods.positionedOffset,
absolutize: function(element) {
Position.prepare();
return Element.absolutize(element);
},
relativize: function(element) {
Position.prepare();
return Element.relativize(element);
},
realOffset: Element.Methods.cumulativeScrollOffset,
offsetParent: Element.Methods.getOffsetParent,
page: Element.Methods.viewportOffset,
clone: function(source, target, options) {
options = options || { };
return Element.clonePosition(target, source, options);
}
};
/*--------------------------------------------------------------------------*/
if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
function iter(name) {
return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
}
instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
function(element, className) {
className = className.toString().strip();
var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
} : function(element, className) {
className = className.toString().strip();
var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
if (!classNames && !className) return elements;
var nodes = $(element).getElementsByTagName('*');
className = ' ' + className + ' ';
for (var i = 0, child, cn; child = nodes[i]; i++) {
if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
(classNames && classNames.all(function(name) {
return !name.toString().blank() && cn.include(' ' + name + ' ');
}))))
elements.push(Element.extend(child));
}
return elements;
};
return function(className, parentElement) {
return $(parentElement || document.body).getElementsByClassName(className);
};
}(Element.Methods);
/*--------------------------------------------------------------------------*/
Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
initialize: function(element) {
this.element = $(element);
},
_each: function(iterator) {
this.element.className.split(/\s+/).select(function(name) {
return name.length > 0;
})._each(iterator);
},
set: function(className) {
this.element.className = className;
},
add: function(classNameToAdd) {
if (this.include(classNameToAdd)) return;
this.set($A(this).concat(classNameToAdd).join(' '));
},
remove: function(classNameToRemove) {
if (!this.include(classNameToRemove)) return;
this.set($A(this).without(classNameToRemove).join(' '));
},
toString: function() {
return $A(this).join(' ');
}
};
Object.extend(Element.ClassNames.prototype, Enumerable);
/*--------------------------------------------------------------------------*/
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/utils/cookie.js */
/**
* @author Ryan Johnson <http://syntacticx.com/>
* @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
* @package LivePipe UI
* @license MIT
* @url http://livepipe.net/controls/hotkey/
* @attribution http://www.quirksmode.org/js/cookies.html
*/
/*global document, Prototype, $A */
if(typeof(Prototype) == "undefined") {
throw "Cookie requires Prototype to be loaded."; }
var Cookie = {
build: function() {
return $A(arguments).compact().join("; ");
},
secondsFromNow: function(seconds) {
var d = new Date();
d.setTime(d.getTime() + (seconds * 1000));
return d.toGMTString();
},
set: function(name,value,seconds){
var expiry = seconds ? 'expires=' + Cookie.secondsFromNow(seconds) : null;
document.cookie = Cookie.build(window.appUid + "/" + name + "=" + value, expiry, "path=" + window.appUrl);
},
get: function(name){
var valueMatch = new RegExp(window.appUid + "/" + name + "=([^;]+)").exec(document.cookie);
return valueMatch ? valueMatch[1] : null;
},
unset: function(name){
Cookie.set(name,'',-1);
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/script.js */
/* -------------------------------------------------------------------------------------------------
Tooltip
------------------------------------------------------------------------------------------------- */
// Tooltip
var _global_tooltip = false;
ctl.event.Add(document,"mouseover",function(oEvent)
{
// Get the selected item and looks into ancestors for the LI
var oMouseEvent = ctl.mouse.GetEvent(oEvent);
var oItem = oMouseEvent.Target;
if (!oItem || !oItem.getAttribute) return;
for(var i=0;i<3;i++)
{
if (oItem.getAttribute('x-sah-tooltip')) break;
oItem = oItem.parentNode;
if (!oItem || !oItem.getAttribute) return;
}
if (i == 3)return;
// Get dimensions
var oTooltip = $CYT("#ct-tooltip");
var oDoc = $CYT("#document-container");
var jElemDim = ctl.style.GetDimensions(oItem);
var jElemPos = ctl.style.GetPosition(oItem);
// Set the content, then get the tooltip dimensions, then move it
oTooltip.innerHTML = oItem.getAttribute('x-sah-tooltip');
oTooltip.style.display = "block";
var jToolDim = ctl.style.GetDimensions(oTooltip);
oTooltip.style.left = (jElemPos.X + jElemDim.width / 2 - jToolDim.width / 2 - oDoc.scrollLeft) + 'px';
oTooltip.style.top = (jElemPos.Y + jElemDim.height - oDoc.scrollTop) + 'px';
_global_tooltip = true;
},true);
ctl.event.Add(document,"mouseout",function(oEvent)
{
// Get the selected item and looks into ancestors for the LI
var oMouseEvent = ctl.mouse.GetEvent(oEvent);
var oItem = oMouseEvent.Target;
if (!oItem || !oItem.getAttribute) return;
for(var i=0;i<3;i++)
{
if (oItem.getAttribute('x-sah-tooltip')) break;
oItem = oItem.parentNode;
if (!oItem || !oItem.getAttribute) return;
}
if (i == 3)
{
$CYT('#ct-tooltip').style.display = "none";
_global_tooltip = false;
}
},true);
/* -------------------------------------------------------------------------------------------------
Button pushed
------------------------------------------------------------------------------------------------- */
// Click
ctl.event.Add(document,"mousedown",function(oEvent)
{
// Get the selected item and looks into ancestors for the LI
var oMouseEvent = ctl.mouse.GetEvent(oEvent);
var oBtn = oMouseEvent.Target;
if (!/input-btn/.test(oBtn.className))
return;
// Remove each pushed button
$$('input.input-btn').each(function(oItem)
{
oItem.className = oItem.className.replace(/-pushed/,'');
});
// Add class
oBtn.className = oBtn.className.replace(/input-btn-([a-z\-]+)/,oBtn.className.match(/input-btn-([a-z\-]+)/)[0] + '-pushed');
},true);
ctl.event.Add(document,"mouseup",function(oEvent)
{
// Remove each pushed button
$$('input.input-btn').each(function(oItem)
{
oItem.className = oItem.className.replace(/-pushed/,'');
});
},true);
/* -------------------------------------------------------------------------------------------------
Menu
------------------------------------------------------------------------------------------------- */
var _global_init_menu_ul = null;
function global_init_menu()
{
var oMenu = $('content-left-vmenu');
if (!oMenu) return;
// Manage open and close
oMenu.observe("click",function(event)
{
var oLI = Event.element(event);
for(var i=0;i<10;i++)
{
if (oLI.tagName == "LI") break;
oLI = oLI.parentNode;
}
if (i == 10)return;
var oUL = oLI.parentNode;
if (!/categories/.test(oUL.className) || /subcategories/.test(oUL.className)) return;
var oULChild = Element.extend(oLI.getElementsByTagName("UL")[0]);
if(oULChild.down(".orangeWifi"))
{
if (Cookie.get('orangeWifiEnable') == "1")
{
oULChild.down(".orangeWifi").show();
}
else
{
oULChild.down(".orangeWifi").hide();
}
}
if( appConfig === 'pl' )
{
$("advConfigAdmin").removeClassName();
$("advConfigAdmin").addClassName("auth-required");
}
else
{
$("advConfigAdmin").removeClassName();
$("advConfigAdmin").addClassName("last-page auth-required");
$("advConfigFxo").hide();
}
if((oULChild.down(".configPorts")))
{
if (Cookie.get('wanInterfaceType') == "DSL" || appConfig ==='pl')
{
$$(".configPorts-"+appConfig).each(function(obj){
obj.show();
});
}
else
{
$$(".configPorts").each(function(obj){
obj.hide();
});
}
}
var bOpen = (oULChild.style.display == "block" || !oULChild.style.display ? false : true);
var iHeight = Element.getDimensions(oULChild).height;
var iFrom = (!bOpen ? iHeight : 0);
var iTo = (bOpen ? iHeight : 0);
ctl.animations.Create('default',iFrom,iTo,function()
{
oULChild.style.height = "0px";
oULChild.style.display = "block";
},
function(iValue)
{
oULChild.style.height = iValue + "px";
},
function()
{
if (!bOpen) { oULChild.style.display= "none"; }
oULChild.style.height = iHeight + "px";
});
ctl.animations.Start();
},true);
// Manage mouse over out
oMenu.observe("mouseover",function(event)
{
var oLI = Event.element(event);
for(var i=0;i<10;i++)
{
if (oLI.tagName == "LI") break;
oLI = oLI.parentNode;
}
if (i == 10)return;
var oUL = oLI.parentNode;
if (!/pages/.test(oUL.className)) return;
var oLIActive = $$('#content-left-vmenu li.active')[0];
if (oLIActive) Element.removeClassName(oLIActive,"active");
Element.addClassName(oLI,"active");
},true);
oMenu.observe("mouseout",function()
{
var oLIActive = $$('#content-left-vmenu li.active')[0];
if (oLIActive) Element.removeClassName(oLIActive,"active");
},true);
}
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah.js */
/**
* @namespace
*/
var Sah = {};
/**
* The custom prefix used in the datamodel
*/
Sah.prefix = "X_ORANGE-COM_";
/**
* @namespace
*/
Sah.Config = {};
Sah.Config.environment = "production";
Sah.Config.logLevel = "INFO";
Sah.Config.language = "en";
Sah.Config.webserviceUrl = "/rest";
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/log.js */
/**
* @namespace
*/
Sah.Log = {};
/** log level for debugging messages */
Sah.Log.DEBUG = 4;
/** log level for informative messages */
Sah.Log.INFO = 3;
/** log level for warning messages */
Sah.Log.WARN = 2;
/** log level for error messages */
Sah.Log.ERROR = 1;
/** log level for no messages */
Sah.Log.NONE = 0;
/** current log level */
Sah.Log.level = (Sah.Config.LogLevel ? Sah.Log[Sah.Config.LogLevel.toUpperCase()] : Sah.Log.INFO);
/**
* Which logger should be enabed. Use an array of logger
* names or the string "all" to enable all loggers.
*/
Sah.Log.enable = "none";
Sah.Log.Logger = Class.create(
/** @lends Sah.Log.Logger# */
{
/**
* Create an new logger instance
* @class A logger class using the firebug console
* @constructs
*/
initialize: function (name)
{
this.name = name;
},
/**
* Returns true if this logger is enabled
* @returns {Boolean}
*/
enabled: function (level)
{
return (window.console && window.console.firebug && console && level <= Sah.Log.level &&
((Object.isString(Sah.Log.enable) && Sah.Log.enable == "none")
|| (Object.isArray(Sah.Log.enabled) && Sah.Log.enable.indexOf(this.name) != -1)));
},
/**
* Output a debug message
*/
debug: function (object)
{
arguments[0] = "[" + this.name + "] " + arguments[0];
if (this.enabled(Sah.Log.DEBUG))
console.debug.apply(this, arguments);
},
/**
* Output an informative message
*/
info: function (object)
{
arguments[0] = "[" + this.name + "] " + arguments[0];
if (this.enabled(Sah.Log.INFO))
console.info.apply(this, arguments);
},
/**
* Output a warning message
*/
warn: function (object)
{
arguments[0] = "[" + this.name + "] " + arguments[0];
if (this.enabled(Sah.Log.WARN))
console.warn.apply(this, arguments);
},
/**
* Output an error message
*/
error: function (object)
{
arguments[0] = "[" + this.name + "] " + arguments[0];
if (arguments[1] && arguments[1].message) {
if (this.enabled(Sah.Log.ERROR)) {
var error = arguments[1];
console.error(arguments[0] + ": " + error.message);
console.error(error);
}
} else {
if (this.enabled(Sah.Log.ERROR))
console.error.apply(this, arguments);
}
},
/**
* Verify an assertion
*/
assert: function (expression)
{
if (this.enabled(Sah.Log.DEBUG))
console.assert.apply(this, expression);
}
}
);
Sah.logger = new Sah.Log.Logger("default");
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/utils.js */
/**
* Invoke a function for each maching elements after the document
* is loaded.
*
* It takes a css descriptor and a function/class as an argument.
* For each of the matched element, the function is called or
* the class is instanciated with the element as argument when
* the browser has finished loading the page.
*
* @param {String} selector prototypejs selector (css)
* @param {Function} func the function to call for each of the matched elements.
*/
Sah.behave = function (selector, func)
{
Event.observe(document, "dom:loaded", function (event) {
$$(selector).each(function (element) {
new func(element);
});
});
};
/**
* Include a javascript file and make sure this is only done once
*/
Sah.include = function (fileName, loadedCallback)
{
if (Sah.included[fileName]) {
(loadedCallback || Prototype.emptyFunction)(fileName);
return;
}
Sah.included[fileName] = true;
var element = new Element('script', { type: 'text/javascript', src: fileName });
$$("head")[0].appendChild(element);
element.observe('readystatechange', function () {
if (!this.loaded && (this.readyState === 'complete' || this.readyState === 'loaded')) {
this.loaded = true;
try {
(loadedCallback || Prototype.emptyFunction)(fileName);
} catch (error) {
Sah.logger.error("error in include callback", error);
}
}
});
element.observe('load', function () {
if (!this.loaded) {
this.loaded = true;
try {
(loadedCallback || Prototype.emptyFunction)(fileName);
} catch (error) {
Sah.logger.error("error in include callback", error);
}
}
});
};
Sah.included = {};
/**
* the decorator pattern for the handlers
*/
Sah.decorateHandlers = function (context, oldHandlers, decorators)
{
if (Object.isFunction(oldHandlers)) {
oldHandlers = { "onSuccess": oldHandlers };
}
var localHandlers = Object.clone(oldHandlers);
var keys = $A($H(localHandlers).keys().concat($H(decorators).keys())).uniq();
keys.each(function (key) {
if (decorators[key]) {
localHandlers[key] = function (object, response) {
var oldHandler = (oldHandlers[key] ? oldHandlers[key] : Prototype.emptyFunction);
decorators[key].call(context, oldHandler, object, response);
};
}
});
return localHandlers;
};
/**
* resolve parameter
*/
Sah.strToBus = function (string) {
return string.replace("$", Sah.prefix);
};
Sah.strFromBus = function (string) {
return string.replace(Sah.prefix, "$");
};
var $TB = Sah.strToBus;
var $FB = Sah.strFromBus;
Sah.redirect = function (location)
{
Event.fire(document, 'sah:redirect', location);
return false;
};
/**
* Create a url to a resource
*/
Sah.res = function (path) {
return window.appUrl + path + "?" + window.appUid;
};
/**
* Create a url to a resource
*/
Sah.img = function (path) {
return window.appUrl + "/images/" + window.appConfig + path + "?" + window.appUid;
};
/**
* Create a url to an html file
*/
Sah.link = function (path) {
return window.appUrl + path;
};
/**
*
*/
Sah.deprecated = function (symbol, bug) {
Sah.logger.warn("The symbol %s is deprecated. Please report it in Bug%d with context informations like the page, the call stack, ...", symbol, bug);
};
Sah.set = function(mixed, value){
if(typeof mixed == 'string'){
Sah.__globals__[mixed] = value;
}else{
for(var key in mixed){
Sah.__globals__[key] = mixed[key];
}
}
};
Sah.get = function(key){
return Sah.__globals__[key];
}
Sah.__globals__ = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/bus.js */
/**
* @namespace
*/
Sah.Bus = {};
/**
* A logger for the Sah.Bus namespace
*/
Sah.Bus.logger = new Sah.Log.Logger("bus");
/**
* The default url to connect to
*/
Sah.Bus.defaultUrl = (Sah.Config.webserviceUrl || "");
Sah.Bus.Error = Class.create(
/** @lends Sah.Bus.Error# */
{
/**
* Create a new Sah.Bus.Error
* @class thrown on a bus access error
* @param message the message of the exception
* @constructs
*/
initialize: function (message)
{
/** the name of the error */
this.name = "sahbus error";
/** the error message */
this.message = message;
},
toString: function ()
{
return this.name + ":" + this.message;
}
});
/**
* convert a parameter, replacing $ with X_000E50
* @returns {String} the parameter name with $ replaced by X_000E50
*/
Sah.Bus.parameterToBus = function (parameter)
{
return parameter.replace("$", Sah.prefix);
};
/**
* convert a parameter replacing X_000E50 by $
* @returns {String} the parameter name with X_000E50 replaced by $
*/
Sah.Bus.parameterFromBus = function (parameter)
{
return parameter.replace(Sah.prefix, "$");
};
/**
* regular expression to strip the leading path from the object path
*/
Sah.Bus.stripPath = new RegExp("^" + Sah.Config.webserviceUrl.replace(/^\//, "") + "\\.");
Sah.Bus.Object = Class.create(
/** @lends Sah.Bus.Object# */
{
/**
* Create a new Sah.Bus.Object
* @class This class maps a sahbus object to a javascript object
* @param {Sah.Bus.Client} client the client that will be used for operation on the object
* @param {Object} resource the resource received from the web service and defining the object
* @constructs
*/
initialize: function (client, resource, depth)
{
this._logger = Sah.Bus.logger;
this._client = client;
if (resource)
this._populate(resource, depth);
this._errors = $A();
this._validations = [];
this._order = null;
},
/**
* Populate the public properties based on the private resources
* @private
*/
_populate: function (resource, depth)
{
this._path = (resource.objectInfo.indexPath + "." + resource.objectInfo.name).replace(Sah.Bus.stripPath, "");
this._depth = depth || 0;
this._parameters = null;
this._multiInstance = resource.objectInfo.attributes.template;
this._key = resource.objectInfo.key;
this._name = resource.objectInfo.name;
if (this._multiInstance)
this._children = resource.instances;
else
this._children = resource.children;
if (resource.parameters) {
this._parameters = {};
resource.parameters.each(function (parameter) {
this._parameters[parameter.name] = parameter.value;
this[Sah.Bus.parameterFromBus(parameter.name)] = parameter.value;
}, this);
}
if (this._children) {
this._children.each(function (child) {
var object = null;
if (child.objectInfo.attributes.template) {
object = new Sah.Bus.MultiInstanceObject(this._client, child, this._depth - 1);
} else {
object = new Sah.Bus.Object(this._client, child, this._depth - 1);
}
if (this._multiInstance) {
this.__appendChild(child.objectInfo.name, object);
} else {
this[Sah.Bus.parameterFromBus(child.objectInfo.name)] = object;
}
}, this);
}
},
/**
* Fetch an update the parameters from sahbus
* @public
* @param {Object} handlers the callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure
*/
_load: function (handlers)
{
var localHandlers = Sah.decorateHandlers(this, handlers, {
onSuccess: function (oldHandler, object, response) {
var resource = response.responseJSON;
this._populate(resource, this._depth);
response.sahbusObject = this;
oldHandler(object, response);
}
});
this._client.get(this._path, this._depth, localHandlers);
},
/**
* Update the attribute of an object with another object
*
* Pay attention that this function do not update the object on the server, use
* {@link Sah.Bus.Object#_save} for that.
*
* <pre>
* env._update({ Name: "foo", Value: "bar"})
* </pre>
*
* @public
* @param {Object} object the list of parameter values to update
* @param {Array} additionnalParameters the list of parameters not in this object but that you
* still want to save
*/
_update: function (object, additionnalParameter)
{
for (parameter in this._parameters) {
var localName = Sah.Bus.parameterFromBus(parameter);
if (object[localName] != null) {
var value = object[localName];
if (value === true) {
value = 1;
} else if (value === false) {
value = 0;
}
this[localName] = value;
}
}
return this;
},
/**
* Return the list of modified fields
* @public
* @returns {Array} the list of modified parameters
*/
_updated: function ()
{
var parameters = [];
for (parameter in this._parameters) {
var localName = Sah.Bus.parameterFromBus(parameter);
if (this[localName] != this._parameters[parameter]) {
parameters.push(localName);
}
}
return parameters;
},
/**
* Return true if the objects has been updated
* @public
* @returns {Boolean} true if the object has been updated
*/
_changed: function ()
{
var parameters = [];
if (this._parameters == null)
return true;
for (parameter in this._parameters) {
if (this[Sah.Bus.parameterFromBus(parameter)] != this._parameters[parameter])
return true;
}
return false;
},
/**
* Return true if the objects has been updated (excluding parameter)
* @public
* @returns {Boolean} true if the object has been updated
*/
_changedExcluding: function (param)
{
var parameters = [];
for (parameter in this._parameters) {
if (parameter != param)
{
if (this[Sah.Bus.parameterFromBus(parameter)] != this._parameters[parameter])
return true;
}
}
return false;
},
/**
* Return true if a parameter of an object has been updated
* @public
* @returns {Boolean} true if the object has been updated
*/
_changedParameter: function (param)
{
var parameters = [];
for (parameter in this._parameters) {
if (parameter == param)
{
if (this[Sah.Bus.parameterFromBus(parameter)] != this._parameters[parameter])
return true;
}
}
return false;
},
/**
* return an object containing only the parameters
*/
_getParameters: function (forced)
{
var parameters = {};
for (parameter in this._parameters) {
/* if we have a list of parameters to save, make sure that we are only saving those */
if (forced && forced.length > 0) {
var found = false;
for (var i = 0; i < forced.length; i++) {
if (forced[i] == parameter) {
found = true;
break;
}
}
if (!found) {
this._logger.debug("skipping parameter " + parameter);
continue;
}
}
var localName = Sah.Bus.parameterFromBus(parameter);
if (found || this[localName] != this._parameters[parameter]) {
this._logger.info("setting %s to %s", parameter, this[localName]);
parameters[parameter] = this[localName];
}
}
return parameters;
},
/**
* Save the object into sahbus
* @public
* @param {Object} handlers The callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure.
* @param [parameters] The list of parameters to save, leave empty for none
*/
_save: function (handlers)
{
/* check if we are valid */
if (!this._valid()) {
(handlers["onFailure"] || Prototype.emptyFunction)(this, null);
return;
}
var args = $A(arguments);
args.shift();
var parameters = this._getParameters(args);
var order = this._getOrder();
var localHandlers = Sah.decorateHandlers(this, handlers, {
onSuccess: function (oldHandler, object, response) {
/* work arround for FF bug #488605 */
if (!object)
{
handlers["onFailure"](null, response);
return;
}
response.sahbusObject = this;
response.sahbusObject._populate(response.responseJSON);
oldHandler(object, response);
}
});
this._client.set(this._path, parameters, localHandlers, order);
},
/**
* Destroy this object
* @public
* @param {Object} handlers the callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure
*/
_destroy: function (handlers)
{
if (this.parent) {
this.parent._delete(this);
this.parent = null;
}
this._client.del(this._path, handlers);
},
/**
* Reset some parameters, takes the names of the parameters you want to reset as arguments
* @public
*/
_resetParameters: function ()
{
var parameters = (arguments.lentgh > 0 ? arguments : Object.keys(this._parameters));
for (var i = 0; i < arguments.length; i++) {
var parameter = arguments[i];
this._logger.debug("resetting %s to %s", parameter, this._parameters[parameter]);
this[Sah.Bus.parameterFromBus(parameter)] = this._parameters[parameter];
}
},
/**
* Add an error
* @private
*/
_addError: function (param, message,key)
{
var label = key || "";
this._errors.push({ parameter: param, message: message,label: label});
},
/**
* Return errors for a parameter
*/
_getErrors: function (param)
{
return this._errors.select(function (e) { return e.parameter == param; }).map(function (e) { return e.message; });
},
/**
* Add a validation function
* @private
*/
_addValidation: function (validationFunc)
{
this._validations.push(validationFunc);
},
/**
* Validates the object
*/
_valid: function ()
{
this._errors = $A();
this._validations.each(function (validationFunc) {
validationFunc(this);
}, this);
return this._errors.length == 0;
},
/**
* Set the order in which parameter should be set
*/
_setOrder: function ()
{
this._order = $A(arguments).clone();
},
_getOrder: function ()
{
if (!this._order)
return null;
var order = $A();
var parameters = this._getParameters();
this._order.each(function (p) { if (parameters[p]) order.push(p); });
return order;
}
}
);
Sah.Bus.MultiInstanceObject = Class.create(Sah.Bus.Object, Enumerable,
/** @lengs Sah.Bus.MultiInstanceObject */
{
/**
* Create a new Sah.Bus.Object
* @class This class maps a sahbus object to a javascript object
* @param {Sah.Bus.Client} client the client that will be used for operation on the object
* @param {Object} resource the resource received from the web service and defining the object
* @constructs
*/
initialize: function ($super, client, resource, depth)
{
this._childs = new Array();
$super(client, resource, depth);
},
/**
* Append a child to the list of children
* @private
* @param {String} index the sahbus key where the object is located
* @param {Sah.Bus.Object} object append a childe
*/
__appendChild: function (index, object)
{
this._childs.push(object);
this[index] = object;
object.parent = this;
},
/**
* Add a new child
*/
_add: function (handlers, parameters, order)
{
var params = {};
for (name in parameters) {
params[Sah.Bus.parameterToBus(name)] = parameters[name];
}
var localHandlers = Sah.decorateHandlers(this, handlers, {
onSuccess: function (oldHandler, object, response) {
object._path.match(/([^.]+)$/);
this.__appendChild(RegExp.$1, object);
oldHandler(object, response);
}
});
this._client.add(this._path, params, localHandlers, order);
},
/**
* Remove the child
*/
_delete: function (child)
{
this._childs = this._childs.without(child);
},
/**
* An iterator
*/
_each: function (iterator)
{
this._childs.each(iterator);
},
/**
* Create a new object
*/
_new: function (object)
{
var obj = new Sah.Bus.Object(null, null, 0);
obj._parameters = {};
Object.keys(object).each(function (parameter) {
obj._parameters[parameter] = null;
obj[Sah.Bus.parameterFromBus(parameter)] = object[parameter];
});
return obj;
}
}
);
Sah.Bus.Client = Class.create(
/** @lends Sah.Bus.Client# */
{
/**
* Create a new Sah.Bus.Client for the specified host or the default host {@link Sah.Bus.defaultHost}
* @class this is a basic client that allows one to execute gets, sets adds and deletes on a webservice enabled sahbus host.
* @constructs
* @param {String} host The host to connect to. If it is not given, connect to {@link Sah.Bus.defaultHost}
*/
initialize: function (host)
{
this.logger = Sah.Bus.logger;
this.host = (host || Sah.Bus.defaultHost);
this.ajaxOptions = {
method: "get",
evalJSON: "force",
evalJS: "force",
parameters: {},
requestHeaders: { "Accept": "text/javascript" }
};
this.defaultHandlers = {
onFailure: function (o) { Sah.Bus.logger.error(o.responseJSON); }
};
},
/**
* Create the resource URL from a path
* @private
* @param {String} path the sahbus object path
* @returns {String} the resource URL
*/
url: function (path)
{
var members = path.replace("$", "X_ORANGE-COM_").split(".");
if (members[0] == "igd") {
var dm = members.shift();
if (members[0] != "InternetGatewayDevice" && members[0] != "$triggers")
members.unshift("InternetGatewayDevice");
members.unshift(dm);
}
return Sah.Bus.defaultUrl + "/" + members.join("/");
},
/**
* Wrap the handlers to add a response.responseSahbus object
* @private
* @param {Object} handlers The handlers to wrap
*/
handlers: function(handlers)
{
var ret = {};
var client = this;
for (key in handlers) {
if (key.startsWith("on")) {
ret[key] = (function (handler, response) {
if (response.responseJSON) {
var object = null;
if (response.responseJSON.objectInfo) {
var start = new Date();
if (response.responseJSON.objectInfo.attributes.template)
object = new Sah.Bus.MultiInstanceObject(client, response.responseJSON, response.request.parameters["_restDepth"]);
else {
object = new Sah.Bus.Object(client, response.responseJSON, response.request.parameters["_restDepth"]);
}
response.sahbusResponse = response.sahbusObject = object;
} else {
response.sahbusResponse = response.responseJSON;
}
}
handler(response.sahbusResponse, response);
}).curry(handlers[key]);
}
}
return ret;
},
/**
* Create the various options for the AJAX call
* @private
* @param {Object} handlers the handlers to be called after the request is executed
* @param {Object} parameters the query parameters
* @param {Object} ajax the prototypejs AJAX options
*/
options: function (handlers, parameters, ajax)
{
if (!ajax)
ajax = {};
if (!parameters)
parameters = {};
if (!handlers)
handlers = {};
if (Object.isFunction(handlers)) {
var onSuccess = handlers;
handlers = Object.clone(this.defaultHandlers);
handlers.onSuccess = onSuccess;
}
var options = {};
Object.extend(options, this.ajaxOptions);
Object.extend(options, ajax);
options.requestHeaders = Object.clone(this.ajaxOptions.requestHeaders);
options.parameters = Object.clone(this.ajaxOptions.parameters);
Object.extend(options, this.handlers(handlers));
Object.extend(options.parameters, parameters);
Object.extend(options.requestHeaders, ajax.requestHeaders);
return options;
},
/**
* Get a sahbus object
* @param {String} path the path of the object. Start the path with igd or atomic depending
* on the datamodel you want to use.
* @param {Integer} depth use 1 for fetching objects parameters and children list,
* more to recursively fetch childrens.
* @param {Object} handlers the callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure.
* @returns {Object} a javascript object
*/
get: function (path, options, handlers)
{
this.logger.info("GET %s", path);
var attributes = "getObject_parameters";
var notation = null;
var depth = -1;
if (options instanceof Object) {
notation = options.notation;
depth = options.depth || depth;
}
if (notation == "key")
attributes += ",common_key_notation";
new Ajax.Request(this.url(path), this.options(handlers, { "_restDepth": depth, "_restAttributes": attributes }, {}));
},
/**
* Update a sahbus object
* @param {String} path the path of the object. Start the path with igd or atomic depending
* on the datamodel you want to use.
* @param {Object} parameters the various parameters to update and their values.
* @param {Object} handlers the callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure.
* @returns {Object} the javascript object as updated
*/
set: function (path, parameters, handlers, order)
{
this.logger.info("PUT %s to %o", path, parameters);
var params = Object.clone(parameters);
params._restAction = "put";
params._restAttributes = "getObject_parameters";
var options = this.options(handlers, params, { "method": "post", "requestHeaders": { "X-PCB-Attributes": "getObject_parameters"}});
if (order)
options.order = order;
new Ajax.Request(this.url(path), options);
},
/**
* Add a sahbus object
* @param {String} path the path of the object. Start the path with igd or atomic depending
* on the datamodel you want to use.
* @param {Object} handlers the callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure
* @returns {Object} the newly created javascript object
*/
add: function (path, parameters, handlers, order)
{
this.logger.info("POST %s to %o", path, parameters);
var params = Object.clone(parameters);
params._restAction = "post";
params._restAttributes = "getObject_parameters";
var options = this.options(handlers, params, { "method": "post", "requestHeaders": { "X-PCB-Attributes": "getObject_parameters"}});
if (order)
options.order = order;
new Ajax.Request(this.url(path), options);
},
/**
* Delete a sahbus object
* @param {String} path the path of the object. Start the path with igd or atomic depending
* on the datamodel you want to use.
* @param {Object} handlers the callbacks that will be called. If it is a function, that function
* will be called if the request succeed. Otherwise it can be an object
* with two properties defined as function: onSuccess and onFailure
*/
del: function (path, handlers)
{
this.logger.info("DELETE %s", path);
new Ajax.Request(this.url(path), this.options(handlers, { "_restAction": "delete" }, { "method": "post"}));
}
});
Sah.Bus.Path = Class.create(Enumerable,
/** @lends Sah.Bus.Path# */
{
initialize: function (o)
{
if (Object.isString(o))
this.components = o.split(/\./);
else if (Object.isArray(o))
this.components = o;
else
this.components = o.components;
this._each = this.components._each;
},
toString: function ()
{
return this.components.join(".");
},
toJavascript: function ()
{
return this.components.map(function (e) {
return "['" + e + "']";
}).join("");
},
butLast: function (i)
{
if (arguments.length == 0)
i = 1;
i *= -1;
return new Sah.Bus.Path(this.components.slice(0, i));
}
}
);
/* by default, log exceptions that happends in ajax request handlers */
Ajax.Responders.register({ onException: function (request, error) { ctl.waiting.Hide(); Sah.Bus.logger.error("error handling ajax request", error); } });
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/translate.js */
if (AllTranslations == undefined)
AllTranslations = {};
Sah.Translate = Class.create(
/** @lends Sah.Translate# */
{
initialize: function ()
{
this.client = new Sah.Bus.Client();
this.language = Cookie.get("language");
this.possibleLanguages = (Cookie.get("possibleLanguages") ? Cookie.get("possibleLanguages").split(",") : []);
this.loaded = false;
this.translations = AllTranslations || {};
},
setup: function ()
{
if (this.language && this.language.match && this.language.match(/^\w\w$/)) {
this.setLanguage(this.language, this.possibleLanguages);
} else {
this.client.get("Language", 0, (function (object, response) { this.setLanguage(object.Language, object.PossibleLanguages.split(/\s*,\s*/).uniq()); }).bind(this));
}
return this;
},
setLanguage: function (language, possibleLanguages)
{
Cookie.set("language", language);
Cookie.set("possibleLanguages", possibleLanguages.join(","));
this.language = language;
this.possibleLanguages = possibleLanguages;
var trFileUrl = Sah.res("/translations/" + language + ".js");
//new Ajax.Request(trFileUrl, { onSuccess: this.update.bind(this) });
if (this.translations[language]) {
Translations = this.translations[language];
this.update(language);
} else {
Sah.include(trFileUrl, this.update.bind(this, language));
}
},
setAndSaveLanguage: function (language)
{
if (language == this.language)
return;
this.setLanguage(language, this.possibleLanguages);
this.client.set("Language", { "Language": language });
},
update: function (language, parent)
{
if (!parent)
parent = document.body;
this.translations[language] = Translations;
parent.select(".translation").each(function (element) {
var transClassName = element.classNames().find(function (n) { return n.match("Translations."); });
if (!transClassName)
return;
var label = transClassName.replace("Translations.", "");
var text = t(label, element.value || element.innerHTML);
if (text) {
this.updateElement(element, text);
element.addClassName("translated");
}
}, this);
document.fire('sah:translations:language:set', this);
if (!this.loaded)
document.fire('sah:translations:loaded', Translations);
this.loaded = true;
},
refresh: function (element)
{
this.update(this.language, element);
},
/**
* Update an element content
*/
updateElement: function (element, text)
{
/* for options, only translate the content, not the value */
if (element.tagName.match(/^OPTION$/i))
element.update(text);
/* if this is an input, translate value */
else if (element.tagName.match(/^INPUT$/i))
element.value = text;
/* otherwise update content of the element */
else
element.update(text);
},
/**
* Update the element to use a new label
*/
change: function (element, label, text)
{
var transClassName = element.classNames().find(function (n) { return n.match("Translations."); });
if (transClassName)
element.removeClassName(transClassName);
if (label) {
element.addClassName("translation");
element.addClassName("Translations." + label);
this.updateElement(element, t(label, text));
} else {
element.removeClassName("translation");
element.update();
}
}
}
);
Sah.Translate.updated = function (handler) {
try {
if (Sah.translator.loaded)
handler(Sah.translator);
else
document.observe('sah:translations:language:set', handler);
} catch (error) {
document.observe('sah:translations:language:set', handler);
}
};
Sah.Translate.loaded = function (handler) {
try {
if (Translations)
handler(Translations);
else
document.observe('sah:translations:loaded', handler);
} catch (error) {
document.observe('sah:translations:loaded', handler);
}
};
Sah.Translate.logger = new Sah.Log.Logger("Translations");
Sah.behave("body", function () { Sah.translator = new Sah.Translate(); window.setTimeout(function () { Sah.translator.setup();}, 200); });
var t = function (label, text)
{
var translation = text;
try {
label = label.replace(/(\.delete$)/, "['delete']");
label = label.replace(/(\.new$)/, "['new']");
label = label.replace(/[^\w\.]/g, "_");
if (Translations)
eval("translation = Translations." + label + ";");
if (!Object.isString(translation)) {
Sah.Translate.logger.error("wrong translation label: " + label);
translation = text;
}
} catch (error) {
Sah.Translate.logger.error("unable to find translation for " + label, error);
translation = text;
}
if (arguments.length > 2) {
for (var i = 2; i <= arguments.length; i++) {
translation = translation.replace("%" + (i - 1), arguments[i]);
}
}
return translation;
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/form.js */
Sah.Form = Class.create(
/** @lends Sah.Form# */
{
/**
* Create an new instance mapped to the given HTML element
* @class Map a HTML form to a javascript controller.
* @constructs
*/
initialize: function (element)
{
/** The form name */
this.name = element.name;
/** A logger for this form */
this.logger = new Sah.Log.Logger(this.name);
/** The form element */
this.form = element;
/** The objects fetched from sahbus */
this.objects = new Object();
/** The sahbus client */
this.client = new Sah.Bus.Client();
/** Manually added form elements */
this.addedElements = $A();
/** The form elements */
this.elements = this._loadElements();
/** True if the form is loaded */
this.loaded = false;
/** The parent element */
this.parent = this.form.up("div");
this.form.observe("submit", function (event) { Event.stop(event); return false; });
Sah.Forms.push(this);
/**
* The needed object from sahbus
* @private
*/
this.needed = $A();
/**
* The needed templates
*/
this.neededTemplate = $A();
this.templates = $A();
this.logger.info("initializing " + this.name);
},
/**
* fetch the elements
*/
_getElements: function ()
{
/* filter elements to remove the ones that have no removeClassName to fix an IE7 bug in fromObject */
return (this.form.getElements().concat(this.addedElements).concat(this.form.select("div.display"))).select(function (e) { return e.removeClassName != null; });
},
/**
* return an object mapping the form name to the form elements
*/
_loadElements: function ()
{
var parse = function (obj, members, element)
{
var parent = members.shift();
/* termination is a simple string */
if (members.length == 0) {
obj[parent] = element;
}
else {
if (obj[parent] == null)
obj[parent] = new Object();
parse(obj[parent], members, element);
}
return obj;
};
var obj = {};
this._getElements().each(function (e) {
var name = (e.name ? e.name : e.id);
parse(obj, name.split('.'), e);
});
this.loaded = true;
return obj;
},
/**
* Convert the HTML form to a javascript object
*
* For each of the HTML form field, an object where the properties are
* recursively matched is created. For example if the form is
*
* <pre>
* &lt;form>
* &lt;input name="Foo.Bar" value="value1"/>
* &lt;input name="Foo.Baz" value="value2"/>
* &lt;input name="Another.Obj" value="value3"/>
* &lt;/form>
* </pre>
*
* the returned object will be
*
* <pre>
* {
* Foo: { Bar: "value1", Baz: "value2" },
* Another: { Obj: "value3" }
* }
* </pre>
*
* @returns {Object} the mapped object
* @see Sah.Form#fromObject
*/
toObject: function (root)
{
var parse = function (obj, members, value)
{
var parent = members.shift();
/* termination is a simple string */
if (members.length == 0) {
obj[parent] = value;
}
else {
if (obj[parent] == null)
obj[parent] = new Object();
parse(obj[parent], members, value);
}
return obj;
};
var obj = {};
var elements;
if (root)
elements = root.descendants();
else
elements = this._getElements();
elements.each (function (e) {
if (e.name) {
var value = $F(e);
if (e.type && e.type.match(/checkbox|radio/i) && value == null)
value = false;
var name = (e.name ? e.name : e.id);
parse(obj, name.split('.'), value);
}
});
return obj;
},
/**
* Update the form with the values of a javascript object
*
* Each of the HTML form field is set with the values of an objects properties.
* For example
*
* <pre>
* this.form.fromObject({
* Foo: { Bar: "value1", Baz: "value2" },
* Another: { Obj: "value3" }
* });
* </pre>
*
* will set the values of the form fields to
*
* <pre>
* &lt;form>
* &lt;input name="Foo.Bar" value="value1"/>
* &lt;input name="Foo.Baz" value="value2"/>
* &lt;input name="Another.Obj" value="value3"/>
* &lt;/form>
* </pre>
*
* the returned object will be
*
*
* @returns {Object} the mapped object
* @see Sah.Form#toObject
*/
fromObject: function (obj,tr)
{
var set = function (obj, members, element) {
var parent = members.shift();
if (members.length == 0) {
if (obj[parent]) {
var value = obj[parent];
/* remove the style related to the error notification in case it exists */
element.removeClassName("error");
/* handle checkbox special case */
if (element.type && element.type.match(/checkbox/i))
value = (value == "1");
if (element.setValue)
element.setValue(value);
else
element.innerHTML = value;
/* set the error class */
if (obj._getErrors(parent).size() > 0)
element.addClassName("error");
}
}
else {
if (obj[parent])
set(obj[parent], members, element);
}
};
var elements;
if (tr)
elements = tr.descendants();
else
elements = this._getElements();
elements.each (function (e) {
var name = (e.name ? e.name : e.id);
set(obj, name.split('.'), e);
});
},
/**
* Hides a form element, including its matching label and list elements
* @see Sah.Form#show
*/
hide: function (element)
{
if (Object.isString(element))
element = $(this.form[element]);
element.up("dd").previous("dt").hide();
element.up("dd").hide();
},
/**
* Shows a form element, including its matching label and list elements
* @see Sah.Form#hide
*/
show: function (element)
{
if (Object.isString(element))
element = $(this.form[element]);
element.up("dd").previous("dt").show();
element.up("dd").show();
},
/**
* apply a template to a list of objects
* @param {String} templateId the id of the to template element
* @param {Array} objects the list of objects for wich to use the template
* if it is a single object the template will be called once and
* the element created will be returned
* @param {Function} callback this function will be called with each of the created elements
* @returns {Element} void if given multiple object, the element created if called with a
* single object
*/
applyTemplate: function (templateId, objects, callback)
{
var element = $(templateId);
element.hide();
var prepare = function (object) {
var template = element.clone(true);
for (var key in object) {
var e = template.select("." + key)[0];
if (Object.isElement(e)) {
e.innerHTML = object[key];
}
}
if (callback)
callback(template, object);
template.show();
return template;
};
if (Object.isArray(objects)) {
return objects.map(prepare);
} else {
return prepare(objects);
}
},
/**
* Fetches an object from the sahbus client
*
* <p>The valid options are path and depth. The options can be string or functions
* in which case they will be valuated in the context of the object.</p>
*
* <p>The function will fetch the object and store it in this.objects.ObjectName.
* When all the objects are loaded, the objectsLoaded function will be called. This
* function must populate the form (for example by using the fromObject method.</p>
*
* <p>If a method exist with a form of whenObjectNameLoaded exists it will be called
* when the object is loaded. If an object load fail and a onLoadFailure methode
* exists, it will be called.</p>
*
* @param {String} name the name of the this.objects property where to store the object.
* @param {Object} options an object with a path and a depth property
* @returns {Sah.Bus.Object}
* @see Sah.Form#load, Sah.Bus.Client#get
*/
needs: function (name, options)
{
if (this.needed.detect(function (n) { return n.name == name; })) {
this.logger.debug(name + " already loadedd");
return;
}
if (arguments.length == 1) {
if (!Sah.Bookmarks[name])
throw "no bookmark by name " + name;
Sah.Bookmarks[name].load(this);
} else {
if (!Object.isNumber(options.depth))
options.depth = -1;
this.needed.push(Object.extend({ "name": name }, options));
}
},
/**
* Fetches a template
*/
needsTemplate: function (name)
{
if (this.neededTemplate.detect(function (n) { return n == name; })) {
this.logger.debug("template " + name + " already loadedd");
return;
}
},
/**
* Load the objects
*
* The objects requested with the {@link Sah.Form#needs} method are fetched using
* {@link Sah.Bus}. When all the objects are loaded the objectsLoaded() method is called
* if it is defined.
* @see Sah.Form#needs
*/
load: function ()
{
if (!this.loaded)
Sah.Translate.loaded(this._loadTemplates.bind(this));
},
/**
* Load the needed templates
*/
_loadTemplates: function (event)
{
/* wait for the next template to be loaded */
if (this.neededTemplate.length > 0) {
this.neededTemplate.each(function (tpl) {
/* if it is already loaded */
if (Sah.Template[tpl]) {
this.templates[tpl] = Sah.Template[tpl];
this.neededTemplate = this.neededTemplate.without(tpl);
} else {
/* wait for a template loaded event */
document.observe('sah:template:loaded', this._loadTemplates.bind(this));
}
}, this);
} else {
/* all the templates are loaded */
this._loadNeeded();
}
},
/**
* load the needed objects
*/
_loadNeeded: function (need, object, response)
{
this.loaded = true;
this.hideAll();
if (arguments.length > 0) {
var parse = function (obj, members, value)
{
var parent = members.shift();
/* termination is a simple string */
if (members.length == 0) {
obj[parent] = value;
}
else {
if (obj[parent] == null)
obj[parent] = new Object();
parse(obj[parent], members, value);
}
return obj;
};
parse(this.objects, need.name.split('.'), object);
try {
(this["when" + need.name + "Loaded"] || Prototype.emptyFunction).bind(this)();
} catch (error) {
this.logger.error("unable to execute when" + need.name + "Loaded callback", error);
}
(need.callback || Prototype.emptyFunction)();
}
/* if we still have things to load, load them */
if (this.needed.length > 0) {
var nextNeed = this.needed.shift();
var path = (Object.isFunction(nextNeed.path) ? nextNeed.path.bind(this)() : nextNeed.path);
var depth = (Object.isFunction(nextNeed.depth) ? nextNeed.depth.bind(this)() : nextNeed.depth);
Sah.Form.load({ path: path, depth: depth, name: nextNeed.name, notation: nextNeed.notation },
{
onSuccess: this._loadNeeded.bind(this, nextNeed),
onFailure: this._loadFailed.bind(this, nextNeed)
},
this);
}
/* call the objectsLoaded handler*/
else {
this.logger.info("needed objects are loaded");
try {
(this["objectsLoaded"] || Prototype.emptyFunction).bind(this)();
} catch (error) {
this.logger.error("unable to execute objectsLoaded callback", error);
}
this.showAll();
}
},
markAsLoading: function ()
{
ctl.waiting.Show();
if (!document.waitingSince) {
document.waitingSince = new Date();
}
},
/**
* show a form, including the parent div
*/
markAsLoaded: function ()
{
ctl.waiting.Hide();
if (document.waitingSince) {
this.logger.info("controller was loading for %d", ((new Date()) - document.waitingSince) / 1000);
document.waitingSince = null;
}
},
/**
* Hide a form, including the parent div
*/
hideAll: function ()
{
// if (this.parent)
// this.parent.addClassName("loading");
},
/**
* show a form, including the parent div
*/
showAll: function ()
{
if (this.parent) {
// Effect.Appear(this.parent);
// this.parent.removeClassName("loading");
}
},
_loadFailed: function (need, object, response)
{
this.logger.error("unable to load " + need.path + " into " + need.name);
(this["onLoadFailure"] || Prototype.emptyFunction)(need.name, object, response);
},
/**
* check the changes in the form for disabling or enabling the save ans cancel buttons
*/
checkSaveCancel : function (saveClass, cancelClass){
var state = "disable";
if (this.isChanged())
{
state ="enable";
}
$$(saveClass).each(function(button){
button[state]();
},this);
$$(cancelClass).each(function(button){
button[state]();
},this);
},
/**
* add new elements to the form
*/
addElements: function (elements)
{
this.addedElements = this.addedElements.concat(elements);
},
/**
* mark a form as busy
*/
makeBusy: function ()
{
this.logger.info("now busy");
if ($("idle"))
$("idle").remove();
window.busy = 1;
},
/**
* mark a form as idle
*/
makeIdle: function ()
{
this.logger.info("now idle");
idle = new Element("div");
idle.id = "idle";
idle.setStyle({ "display": "none" });
document.body.insert(idle);
window.busy = 0;
},
/**
* redirect
*/
redirect: function (path)
{
window.location = Sah.link(path);
}
});
Sah.AuthenticatedForm = Class.create(Sah.Form,
/** @lends Sah.AuthenticatedForm# */
{
initialize: function ($super, element)
{
$super(element);
this.authenticated = true;
},
load: function ($super)
{
var auth = new Sah.Auth(this.client);
if (auth.authenticate()) {
$super();
} else {
this.logger.error("user should be authenticated");
this.parent.hide();
}
}
}
);
Sah.Form.CacheInfo = Class.create(
/** @lends Sah.Form.CacheInfo# */
{
/**
* Caches the form needed request
* @class Sah.Form.CacheInfo
* @constructs
*/
initialize: function (client, needed)
{
this.needed = needed;
this.client = client;
this.stillLoading = true;
this.object = null;
this.response = null;
this.success = null;
this.callbacks = [];
this.requester = [];
Sah.Form.CacheInfo.logger.info("loading " + needed.path + " (" + needed.depth + ") into " + needed.name);
this.client.get(needed.path, needed, {
onSuccess: this.onSuccess.bind(this),
onFailure: this.onFailure.bind(this)
});
},
request: function (needed, callbacks, who)
{
this.requester.push({ who: who, needs: needed });
/* if we are still loading, add the callbacks to the list */
if (this.stillLoading)
this.callbacks.push(callbacks);
/* if it is loaded and successful invoke success callback */
else if (this.success)
(callbacks.onSuccess || Prototype.emptyFunction)(this.object, this.response);
/* otherwise invoke the failure callback */
else
(callbacks.onFailure || Prototype.emptyFunction)(this.object, this.response);
},
onSuccess: function (object, response)
{
this.object = object;
this.response = response;
this.stillLoading = false;
this.success = true;
Sah.Form.CacheInfo.logger.info(this.object, this.response);
this.callbacks.each(function (cb) { (cb.onSuccess || Prototype.emptyFunction)(this.object, this.response); }, this);
},
onFailure: function (object, response)
{
this.object = object;
this.response = response;
this.stillLoading = false;
this.success = false;
this.callbacks.each(function (cb) { (cb.onFailure || Prototype.emptyFunction)(this.object, this.response); }, this);
}
}
);
Sah.Form.CacheInfo.logger = new Sah.Log.Logger("CacheInfo");
/**
* A list of all the needed data for this page to avoid duplicate loading
*/
Sah.Form.cache = {};
/**
* Load a needed object
*/
Sah.Form.load = function (needed, callbacks, who)
{
var cacheInfo = (Sah.Form.cache[needed.path] || (Sah.Form.cache[needed.path] = new Sah.Form.CacheInfo(who.client, needed)));
cacheInfo.request(needed, callbacks, who);
};
/**
* The list of forms for this page
*/
Sah.Forms = [];
Sah.Form.include = function (form, klassName, components, name)
{
/*
* Load independent files in debug mode and the concatenated file in production mode
*/
if (Sah.Config.environment == "production" || components.length == 0) {
var klass = null;
try {
klass = eval(klassName);
} catch (error) {
Sah.Form.CacheInfo.logger.error("unable to load " + klassName, error);
}
if (klass) {
try {
new klass(form);
} catch (error) {
Sah.Form.CacheInfo.logger.error("unable to load " + klassName, error);
throw error;
}
} else {
Sah.Form.CacheInfo.logger.error("unable to load " + klassName + " for " + form.name);
}
} else {
var component = components.shift();
component.match(/^(.)(.*)$/);
name += "/" + RegExp.$1.toLowerCase() + RegExp.$2;
var fileName = Sah.res("/js/controllers" + name + ".js");
window.setTimeout(function () {
Sah.include(fileName, function () { Sah.Form.include(form, klassName, components, name); });
}, 200);
}
};
Sah.Form.includeForm = function (form)
{
if (form.name) {
Sah.Form.include(form, form.name.replace(/\//g, "."), form.name.split("/"), "");
}
};
/**
* on startup, try to automatically load the form if the class matching the name
* exists
*/
Sah.behave("form", function (form) {
var head = $$("head")[0];
if (form.name) {
Sah.Form.include(form, form.name.replace(/\//g, "."), form.name.split("/"), "");
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/template.js */
/**
* the list of all available templates
*/
Sah.Templates = {};
Sah.Template = Class.create(
/** @lends Sah.Template# */
{
/**
* Create an new instance mapped to the given HTML element
* @class Map a HTML form to a javascript controller.
* @constructs
*/
initialize: function (element)
{
/** The template name */
this.name = element.id;
/** The template element */
this.element = element;
/** A default callback */
this.callback = Prototype.emptyFunction;
this.element.hide();
Sah.Templates[this.name] = this;
document.fire('sah:template:loaded', this);
},
/**
* get an element for a parameter
*/
getElementForParameter: function (element, name)
{
var reg = new RegExp("^sah:" + name + "$");
return element.descendants().detect(function (e) {
return e.classNames().detect(function (klass) {
return klass.match(reg);
});
});
},
/**
* Iterate over all the template elements of a template
* @private
*/
eachElement: function (element, func)
{
element.descendants().each(function (e) {
e.classNames().each(function (klass) {
if (klass.match(/^sah:([^:]+)$/)) {
func.call(this, e, RegExp.$1);
}
}, this);
}, this);
},
/**
* Apply a template to a list of objects
* @param {Array} objects the list of objects for wich to use the template
* if it is a single object the template will be called once and
* the element created will be returned
* @param {Function} callback this function will be called with each of the created elements
* @returns {Element} void if given multiple object, the element created if called with a
* single object
*/
apply: function (objects, callback)
{
var single = !Object.isArray(objects);
if (callback == undefined)
callback = this.callback;
if (single)
objects = [ objects ];
var templates = [];
objects.each(function (object) {
var template = this.element.clone(true);
template.sahObject = object;
this.eachElement(template, function (element, parameter) {
/* get and hide the widget */
var widget = element.down();
if (widget) {
element.widget = widget;
widget.hide();
widget.setValue(object[parameter] || "");
}
/* insert the value */
var div = new Element("div");
div.innerHTML = (object[parameter] || "");
element.value = div;
element.insert(div);
});
callback(template, object);
template.show();
templates.push(template);
Sah.translator.refresh(template);
}, this);
if (single)
return templates[0];
else
return templates;
},
/**
* Update a template with the form values
*/
update: function (element, object)
{
this.eachElement(element, function (e, parameter) {
e.value.innerHTML = (object[parameter] || "");
if (e.widget)
e.widget.setValue(object[parameter] || "");
});
},
/**
* Convert a template part to a form
*/
showForm: function (element)
{
this.eachElement(element, function (element, parameter) {
if (element.widget) {
element.value.hide();
element.widget.show();
}
});
},
/**
* Hide a template part from a form
*/
hideForm: function (element)
{
this.eachElement(element, function (element, parameter) {
if (element.widget) {
element.widget.hide();
element.value.show();
}
});
}
});
/**
* on startup, try to automatically load the templates if the class matching the name
* exists
*/
Sah.behave(".template", Sah.Template);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi.js */
/**
* @namespace Holds the wifi entity and its associated forms
*/
var Wifi = {};/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/summary.js */
Wifi.Summary = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/summary/general.js */
/*
*
* Wifi Summary General ( wifi/summaryGeneral )
*
*/
Wifi.Summary.General = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.Summary.General# */
{
initialize: function ($super, form)
{
$super (form);
/* TODO : add needed parameters in grom_webui.map */
this.needs("Wifi", { path: "Wifi.Summary.General.WLANConfiguration", depth: -1 });
this.markAsLoading();
this.load();
},
objectsLoaded : function ()
{
/* uncomment this line after fixing grom_webui.map */
this.objects.Wifi.Standard = this.translate_Standard(this.objects.Wifi.Standard);
this.objects.Wifi.BeaconType = this.translate_BeaconType(this.objects.Wifi.BeaconType);
this.objects.WifiSummary = this.objects.Wifi;
this.prepareForm(this);
this.fromObject(this.objects);
/* Wifi Status */
if (this.objects.Wifi.Enable == "1") {
Sah.translator.change($('WifiSummary.Enable'), "support.systeminformation.wifi.label.status.enabled","X Enabled");
}
else
{ Sah.translator.change($('WifiSummary.Enable'), "support.systeminformation.wifi.label.status.disabled","X Disabled"); }
this.markAsLoaded();
},
prepareForm : function ()
{
if ( this.objects.Wifi.OperationalDataTransmitRates )
{ this.objects.WifiSummary.MaxBitRate = this.objects.Wifi.OperationalDataTransmitRates.split(",").last()+" Mb/s"; }
if(this.objects.Wifi.MACAddressControlEnabled=="1")
{
Sah.translator.change($("MacFiltering.Status"), "general.btn.enable","X Enabled");
}
else
{
Sah.translator.change($("MacFiltering.Status"), "general.btn.disable","X Disable");
}
},
/* translate parameter Standard */
translate_Standard : function (text)
{
return "802.11" + text;
},
/* translate parameter BeaconType */
translate_BeaconType : function (text)
{
switch(text) {
case("No Security") : text = "None";break;
case("Basic") : text = "WEP-128";break;
case("SWPA") : text = "WPA-PSK/TKIP";break;
case("11i") : text = "WPA-PSK/AES";break;
case("WPAand11i") : text = "WPA/WPA2 Mixed";break;
}
return text;
}
}
);
Wifi.Summary.General.UpDown = {
"Up" : "support.systeminformation.wifi.label.status.up",
"Down" : "support.systeminformation.wifi.label.status.down"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/scheduling.js */
Wifi.Scheduling = {};/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/scheduling/period.js */
/**
* TODO: fixup documentation
* Scheduling Period
*
*/
Wifi.Scheduling.Period = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.Scheduling.Period# **/
{
initialize: function($super, form)
{
$super(form);
/* $("Scheduling/Activation/Cancel").observe("click", this.onCancelActivation.bind(this));
$("Scheduling/Activation/Save").observe("click", this.onSaveActivation.bind(this));
$("Scheduling/Period/Save").observe("click", this.onSave.bind(this));
$("Scheduling/Period/Delete").observe("click", this.onDelete.bind(this));
$("Scheduling/Period/Add").observe("click", this.onAdd.bind(this));
$("UpdateEndHour").observe("change",this.populateMinute.bind(this));*/
$$(".WifiSchedulingManagementCancel").each(function (b) { b.observe("click", this.onCancel.bind(this)); }, this);
document.observe("sah:wifi:scheduling:management:enableOrDisableScheduling", this.drawTable.bind(this));
document.stopObserving("sah:wifi:scheduling:onSave",document.onSaveWifiPeriod);
document.onSaveWifiPeriod = this.onSave.bind(this);
document.observe("sah:wifi:scheduling:onSave", document.onSaveWifiPeriod);
this.needs("Scheduling", {path: "igd.Services.$SchedWLAN",depth: 0});
this.needs("Entries", {path: "igd.Services.$SchedWLAN.Entry",depth: 3});
$CYT('#scheduling span.box-0([1-7])-([0-9]+)h').each(function (element) {
Element.observe(element, "click",this.toggleState.bind(this,element));
}, this);
this.fillWithGreen();
this.form.disable();
if(Sah.Form.cache["igd.Services.$SchedWLAN.Entry"])
{
Sah.Form.cache["igd.Services.$SchedWLAN"] = false;
Sah.Form.cache["igd.Services.$SchedWLAN.Entry"] = false;
}
this.load();
},
objectsLoaded: function()
{
if (this.objects.Scheduling.Enable && this.objects.Scheduling.Enable !="0")
{ this.fillForm();
this.form.enable();
}else {
this.disableCheckBox();
}
},
getObjects: function()
{
this.client.get("igd.Services.$SchedWLAN.Entry",3,(function(object,response)
{
this.objects.Entries = object;
if(this.objects.Entries)
{
this.form.enable();
}
else{
// alert('instance of object is not defined in DM. Please insert the instance');
$("info").update('object requested does not existe in Data Model. Please verify the Data Model');
}
}).bind(this));
},
/**
*Draw each instance in sahbus on the calendar */
fillForm: function()
{
this.objects.Entries.each(function(entry)
{
var day = entry.Weekday;
var dayNumber = Wifi.Scheduling.Period.Day[day];
if(dayNumber){
var start = parseInt(entry.Start/3600,10);
var end = parseInt(entry.End/3600,10);;
var id = entry._path;
var color = entry.Enable==1?"red":"green";
var invert = entry.Invert;
$$("#scheduling tr.day-"+dayNumber+" input")[0].checked=false;
this.drawPeriod(day,dayNumber, start-1, end,id,color,invert);
}
}, this);
},
drawPeriod: function(inDay,idDay, start, end,id,color,invert)
{ $$("#scheduling tr.day-"+idDay+" input")[0].checked=false;
for (var index = start; index < end-1; index++) {
this.setInputBoxClass($$(".box-0"+idDay+"-"+Wifi.Scheduling.Period.Hour[index+1]+"h")[0],color,invert);
}
},
setInputBoxClass: function(element,color,invert){
if(color =="red"){
element.removeClassName("input-box-green");
element.addClassName("input-box-red");
} else {
element.removeClassName("input-box-red");
element.addClassName("input-box-green");
}
},
onClickPeriod:function(inDay,startH,startM,endH,endM,id,event)
{
},
onClickRow:function(idTr)
{
},
onCancel: function()
{
//this.fromObject(this.objects);
},
toggleState: function (element)
{
if( $$("input[name='WifiScheduling.Enable']")[1].checked){
if (element.hasClassName("input-box-red"))
{
element.removeClassName("input-box-red");
element.addClassName("input-box-green");
}
else
{
element.removeClassName("input-box-green");
element.addClassName("input-box-red");
if(element.up("tr").down("input").checked==true){
element.up("tr").down("input").checked=false;
}
}
}
},
onSave:function(event)
{
event.stop();
this.markAsLoading();
this.wifiScheduleInfo=new Object();
this.wifiScheduleInfo.queryNumber = 0;
this.wifiScheduleInfo.deleteQueryNumber = 0;
if($$('input[name="WifiScheduling.Enable"]')[1].checked ==true){
this.onDelete();
var numberRedBox = $$(".input-box-red").length;
var reg = /([0-9]+)h/;
for( var i=1; i<8;i++)
{
var periods= $$('#scheduling tr.day-'+i+' span.input-box-red');
if(periods.length>0)
{
var startTime =parseInt(reg.exec(periods[0].className)[1],10);
var endTime=parseInt(reg.exec(periods[periods.length-1].className)[1],10);
for (var j=0;j<periods.length-1; j++)
{
var classes=periods[j].className;
var aResult= reg.exec(classes);
var temp1=parseInt(aResult[1],10);
var classes2 = periods[j+1].className;
var aResult2 = reg.exec(classes2);
var temp2= parseInt(aResult2[1],10);
if(temp2-temp1>1){
this.onAdd(i,startTime,temp1);
startTime =temp2;
}
}
this.onAdd(i,startTime,endTime);
}
}
}
this.checkForEnd();
},
whenSaved: function (obj)
{
},
/**
* called when the form was not correctly saved
*/
whenNotSaved: function (obj)
{
},
onDelete: function()
{
this.markAsLoading();
this.wifiScheduleInfo.deleteQueryNumber = 0;
this.objects.Entries._childs.each(function(entry)
{
this.wifiScheduleInfo.deleteQueryNumber++;
entry._destroy({ onSuccess: this.deleteEntrySuccess.bind(this),onFailure: this.deleteEntryFailure.bind(this) });
}, this);
},
deleteEntrySuccess: function(obj){
this.logger.info("object deleted");
this.wifiScheduleInfo.deleteQueryNumber--;
this.checkForEnd();
},
deleteEntryFailure: function(obj){
// this.logger.info("failed to delete object");
this.wifiScheduleInfo.deleteQueryNumber--;
this.checkForEnd();
},
checkForEnd: function ($super) {
if (this.wifiScheduleInfo.deleteQueryNumber == 0 && this.wifiScheduleInfo.queryNumber == 0) {
document.fire("sah:wifi:scheduling:period:done");
}
},
onAdd: function (day, start, end)
{
this.wifiScheduleInfo.queryNumber++;
/* add the object */
var entry = {
Weekday: Wifi.Scheduling.Period.DayNumber[day],
Start: start * 3600,
End: (end + 1) * 3600,
Enable: 1,
Invert: 1
};
this.objects.Entries._add({onSuccess: this.whenPeriodSaved.bind(this), onFailure: this.addEntryFailure.bind(this)}, entry);
return false;
},
whenPeriodSaved : function (obj)
{
this.wifiScheduleInfo.queryNumber--;
this.checkForEnd();
},
addEntryFailure: function (obj)
{
this.wifiScheduleInfo.queryNumber--;
this.checkForEnd();
},
fillWithGreen : function ()
{
$CYT("#scheduling input").each(function (input){
input.checked=true;
input.observe("click", this.clickCheckBox.bind(this, input));
var spans = $$("#scheduling ."+input.up("tr").className+" span");
for(var i=1;i<spans.length ; i++)
{
spans[i].removeClassName("input-box-red");
spans[i].addClassName("input-box-green");
}
},this);
},
clickCheckBox : function (input,event) {
if(input.checked==true) {
var spans = $$("#scheduling ."+input.up("tr").className+" span");
for(var i=1;i<spans.length ; i++)
{
spans[i].removeClassName("input-box-red");
spans[i].addClassName("input-box-green");
}
}
},
drawTable : function (event) {
if($$('input[name="WifiScheduling.Enable"]')[1].checked ==true)
{
this.fillForm();
this.form.enable();
}
else
{
this.fillWithGreen();
this.disableCheckBox();
}
},
disableCheckBox :function () {
$$("#scheduling input").each(function (input){
input.disabled=true;
},this);
}
});
Wifi.Scheduling.Period.Day = {
"monday": "1",
"tuesday": "2",
"wednesday": "3",
"thursday": "4",
"friday": "5",
"saturday": "6",
"sunday": "7"
};
Wifi.Scheduling.Period.DayNumber = {
"1":"monday",
"2":"tuesday",
"3":"wednesday",
"4":"thursday",
"5":"friday",
"6":"saturday",
"7":"sunday"
};
Wifi.Scheduling.Period.Hour = {
"0" : "00",
"1": "01",
"2": "02",
"3": "03",
"4": "04",
"5": "05",
"6": "06",
"7": "07",
"8":"08",
"9":"09",
"10":"10",
"11":"11",
"12":"12",
"13":"13",
"14":"14",
"15":"15",
"16":"16",
"17":"17",
"18":"18",
"19":"19",
"20":"20",
"21":"21",
"22":"22",
"23":"23"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/scheduling/management.js */
/**
* The wifi scheduling/management form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Wifi.Scheduling.Management = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.Scheduling.Management */
{
initialize: function ($super, form)
{
$super(form);
document.fire("sah:wifi:scheduling:management:loaded");
/* initialize events handler */
$$(".WifiSchedulingManagementSave").each(function (b) { b.observe("click", this.onSave.bind(this)); }, this);
$$(".WifiSchedulingManagementCancel").each(function (b) { b.observe("click", this.onCancel.bind(this)); }, this);
$$("input[type=radio][name=WifiScheduling.Enable]").each(function (radio) {
radio.observe("click",this.onChangeRadio.bind(this));}, this);
/* prepare to load the objects we need */
this.needs("WifiScheduling", { path: "igd.Services.$SchedWLAN", depth: 0 });
this.needs("WifiBasic", { path: "Wifi.General.Basic", depth: -1 });
/* disable the form while loading */
// this.form.disable();
/* load the needed objects into this.objects */
if(Sah.Form.cache["igd.Services.$SchedWLAN"])
{
Sah.Form.cache["Wifi.General.Basic"] = false;
Sah.Form.cache["igd.Services.$SchedWLAN"] = false;
}
this.load();
},
/**
* called when the needed objects are loaded
*/
objectsLoaded: function ()
{
$$(".WifiSchedulingManagementCancel")[0].enable();
//$("WifiSchedulingManagementSave").enable()
this.fillForm();
/* enable the form but not the save button */
// this.form.enable();
},
/**
* set the values read from sahbus to the form elements
*/
fillForm: function ()
{
/* map the value directly to the form, ie the form element with an id matching
* a path from this.objects will be set automatically. */
this.fromObject(this.objects);
/* check for radio instead of checkbox */
$$("input[type=radio][name=WifiScheduling.Enable]").each(function (radio) {
if (radio.value == this.objects.WifiScheduling.Enable)
radio.checked = true;
}, this);
},
/**
* update the object in mbus
*/
onSave: function (event)
{
event.stop(event);
this.markAsLoading();
document.fire('sah:wifi:scheduling:onSave');
/* update the WifiBasic object using the form */
this.objects.WifiScheduling._update(this.toObject().WifiScheduling);
if (this.objects.WifiScheduling._changed()) {
this.objects.WifiScheduling._save({ onSuccess: this.whenWifiSchedulingSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
} else {
this.whenSaved();
}
return false;
},
/**
* called when WifiScheduling params were correctly saved
*/
whenWifiSchedulingSaved: function (obj)
{
if ( (this.objects.WifiBasic.Enable == "0") && (this.objects.WifiScheduling.Enable == "0") )
{
this.objects.WifiBasic.Enable = "1";
this.objects.WifiBasic._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
} else {
document.fire("sah:wifi:scheduling:management:done");
}
},
/**
* called when the form was correctly saved
*/
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fromObject(this.objects);
document.fire('sah:wifi:scheduling:management:onSave', obj);
var wifiScheduleInfo=new Object();
wifiScheduleInfo.queryNumber = 0;
document.fire("sah:wifi:scheduling:management:done");
if(this.objects.WifiScheduling.Enable == "0")
{
this.markAsLoaded();
}
},
/**
* called when the form was not correctly saved
*/
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
},
/**
* cancel all modifcations to the form
*/
onCancel: function(event){
this.fillForm();
document.fire("sah:wifi:scheduling:management:cancel");
},
onChangeRadio : function (event) {
document.fire("sah:wifi:scheduling:management:enableOrDisableScheduling");
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/orangeConfig.js */
Wifi.OrangeConfig = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.OrangeConfig */
{
initialize: function ($super, form)
{
$super(form);
/* prepare to load the objects we need */
this.needs("OrangeWifi", { path: "Wifi.Comm", depth: -1 });
this.load();
},
objectsLoaded: function ()
{
this.fillForm();
},
fillForm: function ()
{
$("OrangeWifi.SSIDv").innerHTML = this.objects.OrangeWifi.SSIDv;
if (this.objects.OrangeWifi.Status == "Enabled" || this.objects.OrangeWifi.Status == "Waiting")
{
$("OrangeWifiEnabled").show();
$("OrangeWifiDisabled").hide();
}
else
{
$("OrangeWifiEnabled").hide();
$("OrangeWifiDisabled").show();
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/mac.js */
Wifi.Mac = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/mac/statusFiltering.js */
/* TODO: documentation */
Wifi.Mac.StatusFiltering = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.Mac.StatusFiltering# */
{
initialize: function ($super, form)
{
$super(form);
$$(".LanMacAdd").each(function (b) { b.observe("click", this.onSave.bind(this)); }, this);
this.host = this.form.down("select[name='Mac.Host']");
this.host.addClassName("hosts");
this.host.observe("change", this.onHostChanged.bind(this));
document.observe("sah:wifi:mac:status:change",this.onSecurityChange.bind(this));
this.needs("MacStatus", { path: "Wifi.Mac.StatusFiltering", depth: -1 });
/* show the lement form */
this.form.disable();
this.load();
},
/* enable mac filtering if Mode Security is "None" */
deviceChanged: function (event)
{
this.objects.SecurityMode = event.memo;
if (this.objects.SecurityMode == "None")
{
this.objects.MacStatus.MACAddressControlEnabled = "1";
this.markAsLoading();
this.objects.MacStatus._save({ onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this) });
$("MacfilteringEnabling").setStyle("display:block;");
}
},
objectsLoaded: function ()
{
$$(".td-mac").each(function(elem) {
elem.remove();
}, this);
$$(".hosts option").each(function(elem) {
elem.remove();
}, this);
this.HostsByMac = $H();
this.FiltredHostsByMac = $H();
this.objects.Host = this.objects.MacStatus.Host.select(function (h) { return (h.InterfaceType=="802.11" && h.HostName != "localhost" && h.MACAddress != "00:00:00:00:00:00"); });
this.objects.Host.each(function (h) { this.HostsByMac[h.MACAddress] = h; }, this);
this.objects.MacStatus.MAC._childs.each(function (h) { this.FiltredHostsByMac[h.MACAddress] = h; }, this);
this.fillHostSelect();
/* setup needed templates */
this.macTemplate = Sah.Templates['MacRule'];
this.macTemplate.callback = this.appendMac.bind(this);
this.macTemplate.apply(this.objects.MacStatus.MAC._childs);
this.onHostChanged();
this.onSecurityChange({ "memo": this.objects.MacStatus.MACAddressControlEnabled });
},
fillHostSelect: function ()
{
var select = this.host;
select.update("");
select.up("tr").hide();
this.objects.Host.each(function (host) {
if (this.FiltredHostsByMac[host.MACAddress])
return;
var option = new Element("option", { "value": host.MACAddress });
option.update(host.$UserFriendlyName);
option.host = host;
select.insert(option);
select.up("tr").show();
}, this);
// this.newIpOption = new Element("option", { "value": "CUSTOM" });
// this.newIpOption.update(t("advconfig.wifi.label.editnewmac", "X Edit New MAC Address"));
// select.insert(this.newIpOption);
},
onHostChanged: function ()
{
if(this.host.selectedIndex>=0)
{
this.host.up("tr").show();
this.loadHostInForm(this.host.options[this.host.selectedIndex].host);
}
else
{
this.host.up("tr").hide();
}
},
loadHostInForm: function (host)
{
if (host) {
this.form.down(".IPAddress").innerHTML =host.IPAddress;
this.form.down("span[name='Mac.MACAddress']").innerHTML=host.MACAddress;
} else {
this.form.down("span[name='Mac.MACAddress']").innerHTML="";
//this.form.down("input[name='Mac.MACAddress']").disabled=false;
}
},
setMacHost: function (mac)
{
var host = this.HostsByMac[mac.MACAddress];
if (host) {
mac._host = host;
mac.Name = host.$UserFriendlyName;
mac.IPAddress = host.IPAddress;
} else {
mac.Name = t("advconfig.wifi.label.unknownmac", "unknown (%1)", mac.Name);
mac.IPAddress = "Unknown";
}
},
appendMac: function (element, mac)
{
element.id = mac._path;
element.addClassName("td-mac");
this.setMacHost(mac);
this.macTemplate.getElementForParameter(element, "Name").update(mac.Name);
this.macTemplate.getElementForParameter(element, "IPAddress").update(mac.IPAddress);
element.del = element.down(".delete");
element.del.observe("click", this.deleteMac.bind(this, element, mac));
element.down(".mac-garbage").observe("click", this.deleteMac.bind(this, element, mac));
$('MacAddresses').down("tbody").insert(element);
},
onSave: function (event)
{
Event.stop(event);
$("config.wifi.macerror").hide();
$("mac_error").innerHTML="";
this.logger.info("adding static ip");
var json = { "Name": this.host.options[this.host.selectedIndex].host.$UserFriendlyName,
"MACAddress": this.host.options[this.host.selectedIndex].host.MACAddress };
var mac = this.objects.MacStatus.MAC._new(json);
/* if (!this.validateMac(mac)) {
$("mac_error").innerHTML=t("advconfig.wifi.error.macaddress", "Invalid MAC Address");
$("config.wifi.macerror").show();
this.logger.error("unable to save mac", mac._errors);
return false;
} */
this.objects.MacStatus.MAC._add(this.whenSaved.bind(this), mac._getParameters());
return false;
},
/*
* Validate Mac Row Before Saving
*/
validateMac : function (obj)
{
var bValid = true ;
if(!Sah.Validations.isValidMacAddress(obj.MACAddress))
{
obj._errors["MACAddress"] = t("advconfig.wifi.error.macaddress","Wrong Mac Address.");
this.logger.info("Wrong Mac Address.");
bValid = false;
}
return bValid ;
},
/*
* Delete Mac Row
*/
deleteMac: function (element, mac)
{
this.logger.info("deleting mac");
if($$("form[name='Wifi/Mac/StatusFiltering']")[0].getAttribute("status") && $$("form[name='Wifi/Mac/StatusFiltering']")[0].getAttribute("status")=="enabled") {
mac._destroy({ onSuccess: this.deleteMacSuccess.bind(this, element, mac),
onFailure: this.deleteMacFailure.bind(this, element, mac) });
}
},
deleteMacSuccess: function (element, mac)
{
element.remove();
var host = this.HostsByMac[mac.MACAddress];
if (host) {
var option = new Element("option", { "value": host.MACAddress });
option.update(host.$UserFriendlyName);
option.host = host;
this.host.insert(option);
this.onHostChanged();
}
},
deleteMacFailure: function (element, mac)
{
//alert("unable to remove mac");
},
/*
* EnableMacFiltering checkbox
*/
whenSaved: function (mac)
{
this.macTemplate.apply(mac);
var hostOpt = $A(this.host.options).detect(function (o) { return (o.host && o.host.MACAddress == mac.MACAddress); });
if (hostOpt)
{
hostOpt.remove();
this.onHostChanged();
}
},
whenNotSaved: function (obj)
{
/* TODO: fixup logging */
this.logger.warn("failed to save object");
this.logger.warn(obj);
},
/* TODO: fixup coding style */
onChangeMacFiltering : function (event)
{
},
onSecurityChange : function (event)
{
if(event.memo==1 ||event.memo=="1")
{
$("macFilteringForm").show();
$$("form[name='Wifi/Mac/StatusFiltering']")[0].show();
$$("form[name='Wifi/Mac/StatusFiltering']")[0].enable();
$$("form[name='Wifi/Mac/StatusFiltering']")[0].setAttribute("status","enabled");
}else {
$("macFilteringForm").hide();
$$("form[name='Wifi/Mac/StatusFiltering']")[0].hide();
$$("form[name='Wifi/Mac/StatusFiltering']")[0].disable();
$$("form[name='Wifi/Mac/StatusFiltering']")[0].setAttribute("status","disabled");
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/mac/status.js */
/**
* The wifi mac/status form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Wifi.Mac.Status = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.Mac.Status# */
{
initialize: function ($super, form)
{
$super(form);
/* initialize events handler */
this.needs("StatusMac", { path: "Wifi.Mac.Status", depth: -1 });
this.form.disable();
this.oldValue=-1;
this.firstCall=1;
// document.observe("sah:wifi:mac:status:nosecurity:select",this.onNoSecuritySelect.bind(this));
document.observe("sah:wifi:general:basic:save:nosecurity",this.onSaveNoSecurity.bind(this));
document.observe("sah:wifi:general:basic:save:security",this.onSaveSecurity.bind(this));
document.observe("sah:wifi:general:basic:save:wep",this.onSaveSecurity.bind(this));
/* load the needed objects into this.objects */
this.load();
},
/**
* called when the needed objects are loaded
*/
objectsLoaded: function ()
{
/* $$("#bt_cancel_pairing").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save_pairing").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this); */
$$("input[name='Status.MACAddressControlEnabled']").each( function (btn) {
btn.observe("click", this.onMacFilteringChange.bind(this));
},this);
/* fill the form with the values fetched from sahbus */
if(this.state)
{
this.objects.StatusMac.MACAddressControlEnabled=1;
}
this.fillForm();
/* enable the form but not the save button */
this.form.enable();
},
/**
* set the values read from sahbus to the form elements
*/
fillForm: function ()
{
this.fromObject(this.objects);
if(this.objects.StatusMac.MACAddressControlEnabled=="1")
{
Sah.translator.change($("MacFiltering.Status"), "general.label.enabled","X Enabled");
$("Status.yes").checked=true;
$("Status.no").checked=false;
}
else
{
Sah.translator.change($("MacFiltering.Status"), "general.label.disabled","X Disabled");
$("Status.yes").checked=false;
$("Status.no").checked=true;
}
document.fire("sah:wifi:mac:status:change",this.objects.StatusMac.MACAddressControlEnabled);
},
/**
* update the object in mbus
*/
onSave: function ()
{
//event.stop(event);
/* if the form is changed, save it.
* The onSuccess and onFailure options allows one to set function that will be called when,
* guess it, the save succeede */
if (this.objects.StatusMac._changed() ){
this.objects.StatusMac._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.markAsLoaded();
this.logger.info("nothing has changed in Wifi/Mac/Status, skipping save");
}
return false;
},
/**
* called when the form was correctly saved
*/
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fillForm();
this.markAsLoaded();
},
/**
* called when the form was not correctly saved
*/
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.fillForm();
this.markAsLoaded();
},
/**
* cancel all modifcations to the form
*/
onCancel: function(event){
this.objects.StatusMac.MACAddressControlEnabled = this.objects.StatusMac._parameters.MACAddressControlEnabled;
this.fillForm();
this.markAsLoaded();
},
onMacFilteringChange : function (event)
{
if($("Status.yes").checked)
{
this.objects.StatusMac.MACAddressControlEnabled=1;
}
else
{
this.objects.StatusMac.MACAddressControlEnabled=0;
}
this.markAsLoading();
this.onSave();
document.fire("sah:wifi:mac:status:change",this.objects.StatusMac.MACAddressControlEnabled);
},
onNoSecuritySelect : function (event){
if(event.memo =="None" && this.firstCall==0)
{
if(this.objects.StatusMac) {
$("Status.yes").checked=true;
$("Status.no").checked=false;
this.oldValue=this.objects.StatusMac.MACAddressControlEnabled;
this.objects.StatusMac.MACAddressControlEnabled=1;
document.fire("sah:wifi:mac:status:change",this.objects.StatusMac.MACAddressControlEnabled);
// this.objects.StatusMac._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}else {
this.state =true;
}
}
else if(this.oldValue!= -1)
{
if(this.oldValue==0)
{
$("Status.yes").checked=false;
$("Status.no").checked=true;
}else {
$("Status.yes").checked=true;
$("Status.no").checked=false;
}
this.objects.StatusMac.MACAddressControlEnabled=this.oldValue;
//this.objects.StatusMac._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
this.firstCall=0;
},
onSaveNoSecurity :function (event)
{
this.objects.StatusMac.MACAddressControlEnabled=1;
this.oldValue =1;
this.objects.StatusMac._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
},
onSaveSecurity :function (event)
{
if(event.memo==1)
{ this.objects.StatusMac.MACAddressControlEnabled=0;
this.oldValue =0;
this.objects.StatusMac._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/general.js */
Wifi.General = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/general/pairing.js */
Wifi.General.Pairing = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.General.Basic */
{
initialize: function ($super, form)
{
$super(form);
$$(".wps-row").each(function(tr) {
tr.hide();
},this);
this.selectChannels = $("WifiBasic.Channel");
document.observe("sah:wifi:general:basic:save:nosecurity",this.onSaveNoSecurity.bind(this));
document.observe("sah:wifi:general:basic:save:wep",this.onSaveNoSecurity.bind(this));
document.observe("sah:wifi:general:basic:save:security",this.onSaveSecurity.bind(this));
/* prepare to load the objects we need */
this.needs("Pairing", { path: "Wifi.Pairing", depth: -1 });
this.load();
},
objectsLoaded: function ()
{
/* $$("#bt_cancel_pairing").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save_pairing").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this); */
$$("input[name='EasyPairing.Enable']").each( function (btn) {
btn.observe("click", this.onEasyPairingChange.bind(this));
},this);
$$("input[name='WPS.Enable']").each( function (btn) {
btn.observe("click", this.onWpsPairingChange.bind(this));
},this);
$$("input[name='Pin.Enable']").each( function (btn) {
btn.observe("click", this.onPairingChange.bind(this));
},this);
$("bt_add").observe("click", this.onAddClientPinCode.bind(this));
$("bt_push").observe("click", this.onPushButton.bind(this));
$("bt_generate").observe("click", this.onGeneratePinCode.bind(this));
this.fillForm();
this.fillPinForm();
this.form.enable();
this.logger.info("object loaded done");
},
fillForm: function ()
{
this.fromObject(this.objects.Pairing);
if(this.objects.Pairing.EasyPairing.Enable=="1")
{
Sah.translator.change($("EasyPairing.Status"), "general.label.enabled","X Enabled");
$("EasyPairing.yes").checked=true;
$("EasyPairing.no").checked=false;
}
else
{
Sah.translator.change($("EasyPairing.Status"), "general.label.disabled","X Disabled");
$("EasyPairing.yes").checked=false;
$("EasyPairing.no").checked=true;
}
},
fillPinForm : function()
{
// this.fromObject(this.objects.Pairing.Wps);
if(this.objects.Pairing.Wps.Enable=="1")
{
if (this.objects.Pairing.Wps.Method == "SELFPIN")
{
Sah.translator.change($("Pin.Status"), "general.label.enabled","X Enabled");
Sah.translator.change($("WPS.Status"), "general.label.disabled","X Disabled");
$("Wps.Selfpin").setValue(this.objects.Pairing.Wps.Selfpin);
$("WPS.no").checked=true;
$("WPS.yes").checked=false;
$("Pin.yes").checked=true;
$("Pin.no").checked=false;
this.showPinBlock();
}
else{
Sah.translator.change($("WPS.Status"), "general.label.enabled","X Enabled");
Sah.translator.change($("Pin.Status"), "general.label.disabled","X Disabled");
$("Wps.Clientpin").setValue(this.objects.Pairing.Wps.Clientpin);
$("WPS.yes").checked=true;
$("WPS.no").checked=false;
$("Pin.no").checked=true;
$("Pin.yes").checked=false;
this.hidePinBlock();
}
$$(".wps-push-btn").each( function (elem) {
elem.show();
},this);
}
else
{
Sah.translator.change($("WPS.Status"), "general.label.disabled","X Disabled");
Sah.translator.change($("Pin.Status"), "general.label.disabled","X Disabled");
$("WPS.yes").checked=false;
$("WPS.no").checked=true;
$("Pin.yes").checked=false;
$("Pin.no").checked=true;
this.hidePinBlock();
$$(".wps-push-btn").each( function (elem) {
elem.hide();
},this);
}
},
onSave: function ()
{
// TODO: fixup this
/* do not update channel if it is automatically choosen */
$("config.wifi.pairingerror").hide();
$("pairing_error").innerHTML="";
this.markAsLoading();
this.objects.Pairing.Wps._update(this.toObject().EasyPairing || {});
if(this.objects.Pairing.EasyPairing._changed())
{
this.objects.Pairing.EasyPairing._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this)});
}else {
this.markAsLoaded();
}
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fillForm();
this.markAsLoaded();
},
whenPinSaved: function (obj)
{
this.logger.info("object saved");
this.fillPinForm();
this.markAsLoaded();
},
whenNoSecuritySaved: function (obj)
{
$$(".wps-row").each(function(tr) {
tr.hide();
},this);
},
whenNotSaved: function (obj)
{
this.markAsLoaded();
this.logger.warn("failed to save object");
this.logger.warn(obj);
this.fillForm();
},
onCancel: function(event) {
this.objects.Pairing.EasyPairing.Enable = this.objects.Pairing.EasyPairing._parameters.Enable;
this.objects.Pairing.Wps.Enable = this.objects.Pairing.Wps._parameters.Enable;
this.fillForm();
return true;
},
onEasyPairingChange : function (event)
{
if($("EasyPairing.yes").checked)
{
this.objects.Pairing.EasyPairing.Enable=1;
}
else
{
this.objects.Pairing.EasyPairing.Enable=0;
}
this.onSave();
},
onWpsPairingChange : function (event)
{
if($("WPS.yes").checked)
{
$("Pin.yes").checked=false;
$("Pin.no").checked=true;
if(this.objects.Pairing.Wps.Method == "SELFPIN")
{
this.markAsLoading();
this.objects.Pairing.Wps.Enable=0;
this.objects.Pairing.Wps._save({ onSuccess: this.updateButtonMethod.bind(this), onFailure: this.whenNotSaved.bind(this) });
}else
{
this.updateButtonMethod();
}
}
else
{
this.objects.Pairing.Wps.Enable=0;
if(this.objects.Pairing.Wps._changed())
{
this.markAsLoading();
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
}
},
updateButtonMethod : function (obj)
{
this.objects.Pairing.Wps.Enable=1;
this.objects.Pairing.Wps.Method = "BUTTON";
if(this.objects.Pairing.Wps._changed())
{
this.markAsLoading();
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
this.hidePinBlock();
} else {
this.markAsLoaded();
}
},
onPairingChange : function (event)
{
if($("Pin.yes").checked)
{
$("WPS.yes").checked=false;
$("WPS.no").checked=true;
// this.objects.Pairing.Wps.GenerateSelfPin = "1";
// this.objects.Pairing.Wps.Enable=1;
// this.objects.Pairing.Wps.Method = "SELFPIN";
// if(this.objects.Pairing.Wps._changed())
// {
// this.markAsLoading();
// this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
this.onGeneratePinCode(event);
this.showPinBlock();
// }
}
else
{
this.objects.Pairing.Wps.Enable=0;
if(this.objects.Pairing.Wps._changed())
{
this.markAsLoading();
this.hidePinBlock();
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
}
},
onGeneratePinCode : function (event)
{
event.stop();
this.markAsLoading();
this.objects.Pairing.Wps.Enable = 0;
this.objects.Pairing.Wps._save(function () {
this.objects.Pairing.Wps.GenerateSelfPin = "1";
this.objects.Pairing.Wps.Enable=1;
this.objects.Pairing.Wps.Method = "SELFPIN";
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}.bind(this));
},
onAddClientPinCode : function (event)
{
event.stop();
$("config.wifi.pairingerror").hide();
$("pairing_error").innerHTML="";
if(Sah.Validations.isValidPinCode($("Wps.Clientpin").getValue())){
this.markAsLoading();
if(this.objects.Pairing.Wps.Method=="SELFPIN")
{
this.objects.Pairing.Wps.Enable="0";
this.objects.Pairing.Wps._save({ onSuccess: this.UpdateClientPinCode.bind(this), onFailure: this.whenNotClientPinSaved.bind(this) });
} else {
this.UpdateClientPinCode();
}
} else {
Sah.translator.change($("pairing_error"),"advconfig.wifi.error.wpsclientpin", "Invalid Client Pin Code");
$("config.wifi.pairingerror").show();
}
},
UpdateClientPinCode : function(obj)
{
var oldMethod = this.objects.Pairing.Wps.Method;
this.objects.Pairing.Wps.Method = "CLIENTPIN";
if(this.objects.Pairing.Wps._parameters["Clientpin"] != $("Wps.Clientpin").getValue())
{
this.objects.Pairing.Wps.Clientpin=$("Wps.Clientpin").getValue();
this.checkClientPin = true ;
this.newClientPin = this.objects.Pairing.Wps.Clientpin;
}else
{
this.checkClientPin=false;
}
this.objects.Pairing.Wps._save({ onSuccess: this.whenClientPinSaved.bind(this,oldMethod), onFailure: this.whenNotClientPinSaved.bind(this,oldMethod) });
},
onPushButton : function (event)
{
event.stop();
this.objects.Pairing.Wps.Enable=1;
// this.objects.Pairing.Wps.Method = "BUTTON";
this.objects.Pairing.Wps.Start = "1";
this.logger.info("object saved");
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
},
hidePinBlock : function ()
{
$$(".generate-pin").each( function (elem) {
elem.hide();
},this);
},
showPinBlock : function ()
{
$$(".generate-pin").each( function (elem) {
elem.show();
},this);
},
onSaveNoSecurity :function (event)
{
this.objects.Pairing.Wps.Enable=0;
this.objects.Pairing.Wps._save({ onSuccess: this.whenNoSecuritySaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
},
onSaveSecurity :function (event)
{
$("WPS.yes").checked=true;
this.onWpsPairingChange(event);
$$(".wps-row").each(function(tr) {
tr.show();
},this);
},
whenNotClientPinSaved: function (oldMethod,obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
if(this.checkClientPin && this.newClientPin != this.objects.Pairing.Wps.Clientpin)
{
Sah.translator.change($("pairing_error"),"advconfig.wifi.error.wpsclientpin", "Invalid Client Pin Code");
$("config.wifi.pairingerror").show();
}
this.objects.Pairing.Wps.Enable="1";
this.objects.Pairing.Wps.Start="1";
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
},
whenClientPinSaved: function (oldMethod,obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
if(this.checkClientPin && this.newClientPin != this.objects.Pairing.Wps.Clientpin)
{
Sah.translator.change($("pairing_error"),"advconfig.wifi.error.wpsclientpin", "Invalid Client Pin Code");
$("config.wifi.pairingerror").show();
}
this.objects.Pairing.Wps.Enable="1";
this.objects.Pairing.Wps.Start="1";
this.objects.Pairing.Wps._save({ onSuccess: this.whenPinSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/general/basicSimple.js */
Wifi.General.BasicSimple = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.General.Basic */
{
initialize: function ($super, form)
{
$super(form);
/* prepare to load the objects we need */
this.needs("WifiBasic", { path: "Wifi.General.Basic", depth: -1 });
document.observe("sah:wifi:scheduling:period:done",this.markAsLoaded.bind(this));
document.observe("sah:wifi:shceduling:period:add",this.onSchedulingPeriodAdd.bind(this));
this.load();
},
objectsLoaded: function ()
{
/* set the wep key and PreSharedKey. The Wep key used in case of WEP mode and the PreShared key used in other cases */
this.objects.KeyWep = this.objects.WifiBasic.WEPKey;
this.objects.KeyPreshared = this.objects.WifiBasic.PreSharedKey;
document.observe("sah:wifi:general:basicSimple:ssidPopupLoaded", this.ssidPopupLoaded.bind(this));
//document.observe('sah:wifi:scheduling:management:onSave', this.fillForm.bind(this));
$('bt_enable').observe('click', this.toggleWifi.bind(this, "1"));
$('bt_disable').observe('click', this.toggleWifi.bind(this, "0"));
this.fillForm();
this.form.enable();
this.logger.info("object loaded done");
},
fillForm: function ()
{
this.fromObject(this.objects);
if (this.objects.WifiBasic.Enable == "1") {
$("wifiEnabled").show();
$("wifiDisabled").hide();
} else {
$("wifiDisabled").show();
$("wifiEnabled").hide();
}
},
ssidPopupLoaded: function ()
{
/* add the form element */
this.addElements($('ct-popup').select("input"));
/* when the form is submitted, call the onSave method of this class */
$$("#bt_cancel").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this);
this.fillForm();
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.orange","X orange is forbidden");
},
toggleWifi: function (value)
{
if(this.objects.WifiBasic.Comm.Enable.match(/1|enabled/i) && value === "0") {
this.objects.WifiBasic.Enable = value;
ctl.msgbox.Show(ctl.msgbox.QUESTION.YES_NO,t('config.wifi.general.info.wificom','X wifi comm sera désactivé'),undefined,(function(){this.onSave();}).bind(this));
}else {
this.objects.WifiBasic.Enable = value;
this.onSave(); }
},
onSave: function (event)
{
// TODO: fixup this
/* do not update channel if it is automatically choosen */
this.objects.WifiBasic._update(this.toObject().WifiBasic || {});
if(this.objects.WifiBasic._changed())
{
if(this.objects.WifiBasic.SSID.toLowerCase() !== this.objects.WifiBasic.Comm.SSID.toLowerCase() && Sah.Validations.isValidSSID(this.objects.WifiBasic.SSID))
{
this.objects.WifiBasic._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this)});
}else if(this.objects.WifiBasic.SSID.toLowerCase() === this.objects.WifiBasic.Comm.SSID.toLowerCase())
{
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.orange","X orange is forbidden");
this.objects.WifiBasic.SSID =this.objects.WifiBasic._parameters["SSID"];
}else if (this.objects.WifiBasic.SSID.length>32){
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.length","X ssid too long");
this.objects.WifiBasic.SSID =this.objects.WifiBasic._parameters["SSID"];
}else{
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.invalid","X invalid ssid");
this.objects.WifiBasic.SSID =this.objects.WifiBasic._parameters["SSID"];
}
} else {
this.whenSaved();
}
return true;
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fillForm();
ctl.popup.Close();
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
var notification = new Sah.Widget.ObjectNotification(obj, t("config.wifi.general.label.title", "X Wifi"));
notification.show();
this.fillForm();
},
onCancel: function(event) {
this.fillForm();
ctl.popup.Close();
return true;
},
refresh : function() {
this.objects.WifiBasic._load({onSuccess : this.refreshWifiStatus.bind(this), onFailure: function(obj) {} });
},
refreshWifiStatus : function (obj)
{
this.periodicalExecuter.stop();
if (this.objects.WifiBasic.Enable == "1") {
$("wifiEnabled").show();
$("wifiDisabled").hide();
} else {
$("wifiDisabled").show();
$("wifiEnabled").hide();
}
},
onSchedulingPeriodAdd : function (event)
{
var wifiScheduleInfo = event.memo;
if(wifiScheduleInfo.queryNumber ==0)
{
this.markAsLoaded();
this.periodicalExecuter = new PeriodicalExecuter(this.refresh.bind(this), 5);
}
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wifi/general/basicAdvanced.js */
Wifi.General.BasicAdvanced = Class.create(Sah.AuthenticatedForm,
/** @lends Wifi.General.Basic */
{
initialize: function ($super, form)
{
$super(form);
this.selectChannels = $("WifiBasic.Channel");
this.selectChannels.addClassName("channels");
document.observe("sah:wifi:scheduling:period:done",this.onSchedulingDone.bind(this));
document.observe("sah:wifi:scheduling:management:done",this.onSchedulingDone.bind(this));
document.observe("sah:wifi:scheduling:management:loaded",this.hideInIEVersion.bind(this));
document.observe("sah:wifi:scheduling:management:cancel",this.setForIEVersion.bind(this));
/* prepare to load the objects we need */
this.needs("WifiBasic", {
path: "Wifi.General.Advanced",
depth: -1
});
this.load();
},
objectsLoaded: function ()
{
$$(".channels option").each(function(elem) {
elem.remove();
}, this);
/* set the wep key and PreSharedKey. The Wep key used in case of WEP mode and the PreShared key used in other cases */
this.objects.KeyWep = this.objects.WifiBasic.WEPKey;
this.objects.KeyPreshared = this.objects.WifiBasic.PreSharedKey;
this.BeaconAdvertisementEnabled = this.objects.WifiBasic.BeaconAdvertisementEnabled;
document.observe("sah:wifi:general:basicSimple:ssidPopupLoaded", this.ssidPopupLoaded.bind(this));
document.observe('sah:wifi:general:basicAdvanced:securityKeyLoaded',this.securityKeyLoaded.bind(this));
$('bt_enable').observe('click', this.toggleWifi.bind(this, "1"));
$('bt_disable').observe('click', this.toggleWifi.bind(this, "0"));
$$("#bt_cancel").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this);
$$("#bt_scan").each( function (btn) {
btn.observe("click", this.onScan.bind(this));
},this);
$("WifiBasic.BeaconType").observe("change", this.onBeaconTypeChange.bind(this));
$("WifiBasic.Channel").observe("change",this.onChannelChange.bind(this));
$$(".bssid").each(function(radio) {
radio.observe("click", this.onBssidChange.bind(this));
},this);
$$(".wifiWarn").each(function(elem){
elem.observe("click",this.showWarningBox.bind(this));
},this);
window.onload = this.wifiWarnReload.bind(this);
this.prepareForm();
this.fillForm();
if(!$F("WifiBasic.BeaconType").match(/none|wep|basic/i))
{
$$(".wps-row").each(function(tr) {
tr.show();
},this);
}
this.form.enable();
//this.periodicalExecuter = new PeriodicalExecuter(this.refresh.bind(this), 10);
this.logger.info("object loaded done");
},
prepareForm: function ()
{
/* set the wifi mode option based on the SupportedStandards in IGD
* if more option are needed they should be added in the sahbus defaults */
/* Wifi Channel Auto */
var option = new Element("option", {
value: "Auto"
});
option.insert("Auto");
this.selectChannels.insert(option);
this.objects.WifiBasic.PossibleChannels.split(/\s*,\s*/).each(function (channels)
{
/* create a new option element */
var option = new Element("option", {
value: channels
});
/* translate the option text */
option.insert(channels);
/* insert the option in the select box */
this.selectChannels.insert(option);
}, this);
},
fillForm: function ()
{
this.objects.WifiBasic.ChannelUsed = this.objects.WifiBasic.Channel;
Sah.translator.change($("WifiBasic.ChannelUsed"), "advconfig.wifi.label.channelused","X canal utilisé");
$("WifiBasic.ChannelUsedValue").innerHTML=" : "+this.objects.WifiBasic.ChannelUsed;
this.fromObject(this.objects);
if (this.objects.WifiBasic.Enable == "1") {
$("wifiEnabled").show();
$("wifiDisabled").hide();
} else {
$("wifiDisabled").show();
$("wifiEnabled").hide();
}
var option = $("WifiBasic.BeaconType").options[$("WifiBasic.BeaconType").selectedIndex];
if (this.objects.WifiBasic.ChannelMode == "Auto")
{
$("WifiBasic.Channel").setValue("Auto");
$("bt_scan").show();
}
else
{
$("WifiBasic.Channel").setValue(this.objects.WifiBasic.Channel);
$("bt_scan").hide();
}
if(this.objects.WifiBasic.BeaconAdvertisementEnabled=="0")
{
$("wifi.bssid.radio.yes").checked=false;
$("wifi.bssid.radio.no").checked=true;
}
else
{
$("wifi.bssid.radio.yes").checked=true;
$("wifi.bssid.radio.no").checked=false;
}
this.wifiWarnToggle(!this.isWifiActivated());
this.setForIEVersion();
this.onBeaconTypeChange();
this.wifiWarnReload();
window.setTimeout(this.wifiWarnReload.bind(this),250);
},
wifiWarnToggle: function (show) {
var wifiWarn = $$(".wifiWarn")[0];
if ((show && wifiWarn.visible()) || (!show && !wifiWarn.visible()))
return;
if (show) {
wifiWarn.show();
} else {
wifiWarn.hide();
}
this.wifiWarnReload();
},
wifiWarnReload:function(){
var wifiWarn = $$(".wifiWarn")[0];
var et = $("top_left");
var eb = $("bottom_right");
var top = et.positionedOffset()[1] + 2;
var height = eb.positionedOffset()[1] - top;
try {
wifiWarn.setStyle({ top:top + 'px', height: height + 'px'});
} catch (e) {};
this.form.setStyle({ zIndex: 5 });
},
ssidPopupLoaded: function ()
{
/* add the form element */
this.addElements($('ct-popup').select("input"));
$$(".wifiSSID")[0].setValue(this.objects.WifiBasic.SSID);
/* when the form is submitted, call the onSave method of this class */
$$("#bt_cancel").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this);
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.orange","X orange is forbidden");
this.popupSsid="loaded";
},
securityKeyLoaded: function ()
{
/* add the form element */
this.addElements($('ct-popup').select("input"));
$("Wifi.SecurityKey").setValue(this.SecurityKey);
/* when the form is submitted, call the onSave method of this class */
$$("#bt_cancel").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save_security").each( function (btn) {
btn.observe("click", this.onSaveSecurity.bind(this));
},this);
},
toggleWifi: function (value)
{
if(this.objects.WifiBasic.Comm.Enable.match(/1|enabled/i) && value === "0") {
this.objects.WifiBasic.Enable = value;
ctl.msgbox.Show(ctl.msgbox.QUESTION.YES_NO,t('config.wifi.general.info.wificom','X wifi comm sera désactivé'),undefined,(function(){this.onSave();}).bind(this));
}else {
this.objects.WifiBasic.Enable = value;
this.onSave();
}
},
onSave: function (event)
{
// TODO: fixup this
/* do not update channel if it is automatically choosen */
this.markAsLoading();
this.channelChanged = false;
this.objects.WifiBasic._update(this.toObject().WifiBasic || {});
this.objects.WifiBasic.Encryption=this.encryptionType;
this.objects.WifiBasic.BeaconAdvertisementEnabled = this.BeaconAdvertisementEnabled;
if(this.objects.WifiBasic._changed())
{
this.channelChanged = this.objects.WifiBasic._changedParameter("Channel") || this.objects.WifiBasic._changedParameter("ChannelMode") ;
if(this.objects.WifiBasic.SSID.toLowerCase() !== this.objects.WifiBasic.Comm.SSID.toLowerCase() && Sah.Validations.isValidSSID(this.objects.WifiBasic.SSID))
{
var bssid = this.objects.WifiBasic.BeaconAdvertisementEnabled;
this.objects.WifiBasic._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}else if(this.objects.WifiBasic.SSID.toLowerCase() === this.objects.WifiBasic.Comm.SSID.toLowerCase())
{
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.orange","le nom orange est interdit");
this.objects.WifiBasic.SSID =this.objects.WifiBasic._parameters["SSID"];
}else if (this.objects.WifiBasic.SSID.length>32){
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.length","le ssid est très long");
this.objects.WifiBasic.SSID =this.objects.WifiBasic._parameters["SSID"];
}else{
Sah.translator.change($("ssid_error"), "config.wifi.ssid.label.error.invalid","le ssid est invalide");
this.objects.WifiBasic.SSID =this.objects.WifiBasic._parameters["SSID"];
}
} else {
this.whenSaved();
}
if(this.objects.WifiBasic.PreSharedKey._changed())
{
this.objects.WifiBasic.PreSharedKey._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
if(this.objects.WifiBasic.WEPKey._changed()) {
this.objects.WifiBasic.WEPKey._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
if(this.objects.WifiBasic._parameters["BeaconType"] !=$F("WifiBasic.BeaconType")) {
if ( ( $F("WifiBasic.BeaconType") == "None" )) {
document.fire('sah:wifi:general:basic:save:nosecurity');
}else if( $F("WifiBasic.BeaconType") == "Basic" ) {
document.fire('sah:wifi:general:basic:save:wep');
} else {
document.fire('sah:wifi:general:basic:save:security');
}
}
},
onSaveSecurity :function (event) {
if ($F("WifiBasic.BeaconType") == "Basic") {
if (Sah.Validations.isValidWEPKey($F("Wifi.SecurityKey"))) {
this.SecurityKey = $("Wifi.SecurityKey").getValue();
this.objects.WifiBasic.WEPKey.WEPKey = this.SecurityKey ;
this.saveSecurityKey();
Sah.translator.change($("WifiBasic.SecurityKey"));
} else {
Sah.translator.change($("securityKey_warning"), "advconfig.wifi.error.wepkey", "X Wrong WEP key");
$("securitykey_description").hide();
$("securityKey_error").show();
}
}
else if ($F("WifiBasic.BeaconType") != "None") {
if (Sah.Validations.isValidWPAKey($F("Wifi.SecurityKey"))) {
this.SecurityKey = $("Wifi.SecurityKey").getValue();
this.objects.WifiBasic.PreSharedKey.PreSharedKey= this.SecurityKey;
this.saveSecurityKey();
Sah.translator.change($("WifiBasic.SecurityKey"));
} else {
Sah.translator.change($("securityKey_warning"), "advconfig.wifi.error.presharedkey", "X Wrong WPA passphrase");
$("securitykey_description").hide();
$("securityKey_error").show();
}
}
},
saveSecurityKey :function ()
{
if (this.objects.WifiBasic.PreSharedKey._changed()) {
this.objects.WifiBasic.PreSharedKey._save({
onSuccess: function (obj) {
this.onBeaconTypeChange();
ctl.popup.Close();
}.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
if (this.objects.WifiBasic.WEPKey._changed()) {
this.objects.WifiBasic.WEPKey._save({
onSuccess: function (obj) {
this.onBeaconTypeChange();
ctl.popup.Close();
}.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
},
fireBeaconTypeSaved: function (obj)
{
this.markAsLoaded();
this.whenKeySaved(obj);
this.whenBeaconTypeSaved(obj);
/* Fire Wifi BeaconType */
if (this.objects.WifiBasic.BeaconType == "None") {
document.fire('sah:wifi:general:basic:deviceChanged', "None");
}
},
whenSaved: function ()
{
if (this.channelChanged) {
this.logger.info("channel has been changed, waiting for it to update");
window.setTimeout(function () {
this.channelChanged = false;
this.objects.WifiBasic._load(this.whenSaved.bind(this));
}.bind(this), 15000);
} else {
this.logger.info("object saved");
ctl.popup.Close();
this.fillForm();
this.markAsLoaded();
}
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
this.markAsLoaded();
// this.fillForm();
},
onCancel: function(event) {
this.objects.WifiBasic.ChannelMode=this.objects.WifiBasic._parameters["ChannelMode"];
this.objects.WifiBasic.Channel=this.objects.WifiBasic._parameters["Channel"];
this.BeaconAdvertisementEnabled= this.objects.WifiBasic._parameters["BeaconAdvertisementEnabled"];
this.objects.WifiBasic.BeaconAdvertisementEnabled = this.objects.WifiBasic._parameters["BeaconAdvertisementEnabled"];
this.fillForm();
this.setForIEVersion();
ctl.popup.Close();
ctl.popup.open=0;
if(this.popupSsid=="loaded")
{
$$(".wifiSSID")[0].setValue(this.objects.WifiBasic._parameters["SSID"]);
}
this.markAsLoaded();
return true;
},
/**
* check the SSID, it should be between 1 and 32 character
*/
validateWifiBasicSSID: function(obj)
{
if (!Sah.Validations.isValidSSID(obj.SSID)) {
obj._addError("SSID", t("advconfig.wifi.error.ssid", "X invalid SSID"));
}
},
/**
* event handler for when the security mode is changed
*/
onBeaconTypeChange: function (event)
{
document.fire("sah:wifi:mac:status:nosecurity:select",$F("WifiBasic.BeaconType"));
this.encryptionType= this.objects.WifiBasic.Encryption;
var beaconTypeError = $("WifiBasic.BeaconType").up("div").previous("div");
Sah.translator.change(beaconTypeError);
/* hide wep key if no security */
if ($F("WifiBasic.BeaconType") == "None") {
$("WifiBasic.SecurityKey").update();
$$("a.securityKey")[0].hide();
this.SecurityKey = "";
}
/* otherwise show the wep key */
else {
if ($F("WifiBasic.BeaconType").include('Basic')) {
$("WifiBasic.SecurityKey").update(this.objects.WifiBasic.WEPKey.WEPKey);
$$("a.securityKey")[0].show();
this.SecurityKey = this.objects.WifiBasic.WEPKey.WEPKey;
if (appConfig != 'mini-fr') {
Sah.translator.change(beaconTypeError, "advconfig.wifi.error.moden","error msg mode N");
}
} else {
$("WifiBasic.SecurityKey").update(this.objects.WifiBasic.PreSharedKey.PreSharedKey);
$$("a.securityKey")[0].show();
this.SecurityKey = this.objects.WifiBasic.PreSharedKey.PreSharedKey;
if($F("WifiBasic.BeaconType")=="WPA") {
this.encryptionType="TKIP";
if (appConfig != 'mini-fr') {
Sah.translator.change(beaconTypeError, "advconfig.wifi.error.moden","error msg mode N");
}
} else if ($F("WifiBasic.BeaconType")=="lli") {
this.encryptionType="AES";
} else if ($F("WifiBasic.BeaconType")=="WPAand11i") {
this.encryptionType="TKIP+AES";
}
}
this.formatKey();
}
// var option = $("WifiBasic.BeaconType").options[$("WifiBasic.BeaconType").selectedIndex];
},
formatKey: function ()
{
var e = $("WifiBasic.SecurityKey");
var key = e.innerHTML;
if (key.length > 30) {
e.update(key.substring(0, 30) + " ...");
e.setAttribute("x-sah-tooltip", key);
} else {
e.removeAttribute("x-sah-tooltip");
}
},
onChannelChange : function(event)
{
if($F("WifiBasic.Channel") =="Auto")
{
this.objects.WifiBasic.ChannelMode="Auto";
this.objects.WifiBasic.Channel=this.objects.WifiBasic._parameters["Channel"];
$("bt_scan").show();
}else
{
this.objects.WifiBasic.ChannelMode="Manual";
this.objects.WifiBasic.Channel= $F("WifiBasic.Channel");
$("bt_scan").hide();
}
},
onBssidChange : function (event)
{
if($("wifi.bssid.radio.yes").checked==true)
{
this.BeaconAdvertisementEnabled="1";
}
else
{
this.BeaconAdvertisementEnabled="0";
}
},
validateForm :function (objects,obj)
{
var bValid = true;
if (objects.WifiBasic.BeaconType =="Basic" && !Sah.Validations.isValidWEPKey(objects.KeyWep.WEPKey)) {
objects.KeyWep._addError("WEPKey", t("advconfig.wifi.error.wepkey", " X Wrong WEP key"));
objects.WifiBasic._addError("WEPKey", t("advconfig.wifi.error.wepkey", "X Wrong WEP key"));
bValid = false;
} else if (objects.WifiBasic.BeaconType != "None" && !Sah.Validations.isValidWPAKey(objects.KeyPreshared.PreSharedKey)) {
objects.KeyPreshared._addError("PreSharedKey", t("advconfig.wifi.error.presharedkey", "X Wrong WPA key"));
objects.WifiBasic._addError("PreSharedKey", t("advconfig.wifi.error.presharedkey", "X Wrong WPA key"));
bValid = false;
}
return bValid;
},
refresh : function() {
this.objects.WifiBasic._load({
onSuccess : this.refreshWifiStatus.bind(this),
onFailure: function(obj) {}
});
},
refreshWifiStatus : function (obj)
{
this.periodicalExecuter.stop();
this.wifiWarnToggle(this.objects.WifiBasic.Enable != "1");
if (this.objects.WifiBasic.Enable == "1") {
$("wifiEnabled").show();
$("wifiDisabled").hide();
} else {
$("wifiDisabled").show();
$("wifiEnabled").hide();
}
this.setForIEVersion();
},
onSchedulingDone : function (event)
{
if (event.eventName.match(/management/))
this.managementDone = true;
if (event.eventName.match(/period/))
this.periodDone = true;
if (this.managementDone && this.periodDone) {
this.markAsLoaded();
this.periodicalExecuter = new PeriodicalExecuter(this.refresh.bind(this), 5);
this.managementDone = false;
this.periodDone = false;
}
},
onScan : function (event)
{
this.markAsLoading();
this.objects.WifiBasic.ChannelMode="Manual";
this.objects.WifiBasic._save({
onSuccess: this.whenChannelSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenChannelSaved: function (obj)
{
this.objects.WifiBasic.ChannelMode="Auto";
this.objects.WifiBasic._save({
onSuccess: this.whenChannelModeSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenChannelModeSaved: function (obj)
{
this.logger.info("object saved");
ctl.popup.Close();
if (this.objects.WifiBasic.ChannelMode == "Auto")
{
$("WifiBasic.Channel").setValue("Auto");
$("bt_scan").show();
}
else
{
$("WifiBasic.Channel").setValue(this.objects.WifiBasic.Channel);
$("bt_scan").hide();
}
this.markAsLoaded();
},
isWifiActivated : function ()
{
if (this.objects.WifiBasic.Enable=="0")
{
return false ;
}
return true ;
},
showWarningBox : function ()
{
ctl.msgbox.Show(ctl.msgbox.QUESTION.OK,t('advconfig.wifi.label.info.disable','X settings are not possible while Wifi is disabled'),(function(){
return true
}));
},
setBssid : function (bssid)
{
this.objects.WifiBasic.BeaconAdvertisementEnabled=bssid;
this.objects.WifiBasic._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
setForIEVersion : function()
{
var ieVersion = Sah.Tools.getIEVersion();
if(ieVersion && ieVersion=="6")
{
if(this.isWifiActivated())
{
$("WifiBasic.BeaconType").show();
$("WifiBasic.Channel").show();
}else
{
$("WifiBasic.BeaconType").hide();
$("WifiBasic.Channel").hide();
}
}
},
hideInIEVersion : function()
{
if(Sah.Tools.getIEVersion()&& Sah.Tools.getIEVersion()=="6")
{
$("WifiBasic.BeaconType").hide();
$("WifiBasic.Channel").hide();
}
}
}
);
Wifi.General.BasicAdvanced.PossibleChannels = {
"Channel1": "1",
"Channel2": "2",
"Channel3": "3",
"Channel4": "4",
"Channel5": "5",
"Channel6": "6",
"Channel7": "7",
"Channel8": "8",
"Channel9": "9",
"Channel10": "10",
"Channel11": "11",
"Channel12": "12",
"Channel13": "13"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan.js */
/**
* @namespace Holds the wan entity and its associated forms
*/
var Wan = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/statistics.js */
/*
*
* Broadband Statistics [DSL ONLY]
*
* ( Wan Statistics )
*
*/
Wan.Statistics = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.Statistics# */
{
initialize: function ($super, form)
{
$super (form);
/* --WANDSL Interface Config-- */
this.needs("Wan", { path: "SI.Wan"});
this.load();
},
objectsLoaded : function ()
{
this.objects.WANDSLInterfaceConfig = this.objects.Wan.Statistics.WANDSLInterfaceConfig;
this.objects.DeviceConfig = this.objects.Wan.Statistics.DeviceConfig;
this.prepareForm();
this.fillForm();
},
prepareForm: function ()
{
var is_DSL = this.objects.DeviceConfig.WANInterfaceType;
},
fillForm: function ()
{
this.fromObject(this.objects);
if ( $("WANDSLInterfaceConfig.UpstreamAttenuation") )
$("WANDSLInterfaceConfig.UpstreamAttenuation").innerHTML = (parseInt(this.objects.WANDSLInterfaceConfig.UpstreamAttenuation,10)/10) + " dB";
if ( $("WANDSLInterfaceConfig.DownstreamAttenuation") )
$("WANDSLInterfaceConfig.DownstreamAttenuation").innerHTML = (parseInt(this.objects.WANDSLInterfaceConfig.DownstreamAttenuation,10)/10) + " dB";
if ( $("WANDSLInterfaceConfig.UpstreamNoiseMargin") )
$("WANDSLInterfaceConfig.UpstreamNoiseMargin").innerHTML = (parseInt(this.objects.WANDSLInterfaceConfig.UpstreamNoiseMargin,10)/10) + " dB";
if ( $("WANDSLInterfaceConfig.DownstreamNoiseMargin") )
$("WANDSLInterfaceConfig.DownstreamNoiseMargin").innerHTML = (parseInt(this.objects.WANDSLInterfaceConfig.DownstreamNoiseMargin,10)/10) + " dB";
if ( $("WANDSLInterfaceConfig.UpstreamPower") )
$("WANDSLInterfaceConfig.UpstreamPower").innerHTML = (parseInt(this.objects.WANDSLInterfaceConfig.UpstreamPower,10)/10) + " dB";
if ( $("WANDSLInterfaceConfig.DownstreamPower") )
$("WANDSLInterfaceConfig.DownstreamPower").innerHTML = (parseInt(this.objects.WANDSLInterfaceConfig.DownstreamPower,10)/10) + " dB";
if ( $("WANDSLInterfaceConfig.UpstreamCurrRate") )
$("WANDSLInterfaceConfig.UpstreamCurrRate").innerHTML = this.objects.WANDSLInterfaceConfig.UpstreamCurrRate + " Kb/s";
if ( $("WANDSLInterfaceConfig.DownstreamCurrRate") )
$("WANDSLInterfaceConfig.DownstreamCurrRate").innerHTML = this.objects.WANDSLInterfaceConfig.DownstreamCurrRate + " Kb/s";
if ( $("WANDSLInterfaceConfig.UpstreamMaxRate") )
$("WANDSLInterfaceConfig.UpstreamMaxRate").innerHTML = this.objects.WANDSLInterfaceConfig.UpstreamMaxRate + " Kb/s";
if ( $("WANDSLInterfaceConfig.DownstreamMaxRate") )
$("WANDSLInterfaceConfig.DownstreamMaxRate").innerHTML = this.objects.WANDSLInterfaceConfig.DownstreamMaxRate + " Kb/s";
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/quality.js */
/*
*
* Wan Quality
*
* ( Wan Quality )
*
*/
Wan.Quality = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.Quality **/
{
initialize: function ($super, form)
{
$super (form);
this.needs("Wan", { path: "SI.Wan" });
this.load();
},
objectsLoaded : function ()
{
this.objects.Total = this.objects.Wan.Quality.Total;
this.objects.WANDSLLinkConfig = this.objects.Wan.Quality.WANDSLLinkConfig;
if(this.objects.WANDSLLinkConfig.Stats)
{
if (!this.objects.WANDSLLinkConfig.Stats.QuarterHour) {
this.objects.QuarterHour = this.objects.WANDSLLinkConfig.Stats.QuarterHour;
/* Parse Clients Objects */
}
}
this.fromObject(this.objects);
if(!this.objects.QuarterHour) {
Sah.translator.change($('QuarterHour.LossOfFraming'), "general.label.unavailable", "unavailable");
Sah.translator.change($('QuarterHour.ReceiveBlocks'), "general.label.unavailable", "unavailable");
Sah.translator.change($('QuarterHour.TransmitBlocks'), "general.label.unavailable", "unavailable");
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/networkDetails.js */
Wan.NetworkDetails = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/networkDetails/linkType.js */
/*
*
* Broadband Network Details
*
* ( Link Type )
*
*/
Wan.NetworkDetails.LinkType = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.NetworkDetails.LinkType# */
{
initialize: function ($super, form)
{
$super (form);
this.needs("Wan", { path: "SI.Wan"});
this.markAsLoading();
this.load();
},
objectsLoaded : function ()
{
this.objects.DeviceConfig = this.objects.Wan.NetworkDetails.LinkType.DeviceConfig;
this.objects.WANCommonInterfaceConfig = this.objects.Wan.NetworkDetails.LinkType.WANCommonInterfaceConfig;
this.objects.WANDSLInterfaceConfig = this.objects.Wan.Statistics.WANDSLInterfaceConfig;
this.objects.Intf = this.objects.Wan.NetworkDetails.LinkType.Intf;
this.objects.WANPPPConnection = this.objects.Wan.NetworkDetails.LinkType.WANPPPConnection;
this.objects.WANIPConnection = this.objects.Wan.NetworkDetails.LinkType.WANIPConnection;
this.objects.WANDSLLinkConfig = this.objects.Wan.NetworkDetails.LinkType.WANDSLLinkConfig;
this.objects.Intf.each(function (intf) {
if ( ( intf.Name === "bridge" ) && $("IP.MACAddress") )
{
$("IP.MACAddress").innerHTML = intf.MACAddress;
}
if ( intf.Name === "ppp_0" )
{
$("IP.MTU").innerHTML = intf.MTU + " B";
}
});
this.prepareForm();
this.fillForm();
this.markAsLoaded();
},
prepareForm: function ()
{
var DestAddress = this.objects.WANDSLLinkConfig.DestinationAddress;
this.objects.WANDSLLinkConfig.DestinationAddress = this.translate_DestAddres(DestAddress);
var is_DSL = this.objects.DeviceConfig.$WANInterfaceType;
var is_PPP = this.objects.WANDSLLinkConfig.LinkType;
/* When Internet link type is set to PPP (PPPoA or PPPoE) ... otherwise ...*/
if ((is_PPP.include("PPP") || is_PPP=="EoA" || is_PPP=="ETHoA") && (this.objects.Wan.Autodetect.Protocol!="DHCP")) {
this.objects.Wan_Ip = this.objects.WANPPPConnection;
}
else {
this.objects.Wan_Ip = this.objects.WANIPConnection;
$$(".protocol").each(function(elem){
elem.hide();
});
}
},
fillForm: function ()
{
var is_DSL = this.objects.DeviceConfig.$WANInterfaceType;
var connectionStatus = Wan.NetworkDetails.LinkType.SynchroStatus[this.objects.Wan_Ip.ConnectionStatus];
//this.objects.Wan_Ip.ConnectionStatus = t( connectionStatus, this.objects.Wan_Ip.ConnectionStatus );
var physicalLinkStatus = Wan.NetworkDetails.LinkType.DslUpDown[this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus];
//this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus = t( physicalLinkStatus, this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus );
this.fromObject(this.objects);
if ( $('WANCommonInterfaceConfig.PhysicalLinkStatus') )
Sah.translator.change($('WANCommonInterfaceConfig.PhysicalLinkStatus'), physicalLinkStatus, this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus);
Sah.translator.change($('Wan_Ip.ConnectionStatus'), connectionStatus, this.objects.Wan_Ip.ConnectionStatus);
if ( is_DSL === "DSL" )
Sah.translator.change($('WANDSLLinkConfig.LinkType'), Wan.NetworkDetails.LinkType.DslUpDown[this.objects.WANDSLLinkConfig.LinkStatus], this.objects.WANDSLLinkConfig.LinkStatus);
else
Sah.translator.change($('WANDSLLinkConfig.LinkType'), Wan.NetworkDetails.LinkType.FtthUpDown[this.objects.WANDSLLinkConfig.LinkStatus], this.objects.WANDSLLinkConfig.LinkStatus);
$("WANDSLInterfaceConfig.ShowtimeStart").innerHTML = this.objects.WANDSLInterfaceConfig.ShowtimeStart + " s";
$("WANPPPConnection.Uptime").innerHTML = this.objects.WANPPPConnection.Uptime + " s";
if(this.objects.WANPPPConnection.Lastppp_up_time == null)
{
Sah.translator.change($('WANPPPConnection.Lastppp_up_time'), "general.label.unavailable", "unavailable");
}
if(this.objects.WANPPPConnection.LastShowtime == null && is_DSL === "DSL" )
{
Sah.translator.change($('WANPPPConnection.LastShowtime'), "general.label.unavailable", "unavailable");
}
$$(".notavailable").each(function(elem) {
Sah.translator.change(elem, "general.label.unavailable", "unavailable");
},this)
},
/* translate parameter WANDSLLinkConfig.DestinationAddress */
translate_DestAddres : function (text)
{
return text.substring(4,9);
}
}
);
Wan.NetworkDetails.LinkType.SynchroStatus = {
"Connected" : "support.systeminformation.general.label.status.connected",
"Disconnected" : "support.systeminformation.general.label.status.disconnected",
"Unconfigured" : "support.systeminformation.general.label.status.unconfigured",
"Authenticating" : "support.systeminformation.general.label.status.authenticating",
"Connecting" : "support.systeminformation.general.label.status.connecting"
};
Wan.NetworkDetails.LinkType.DslUpDown = {
"Up" : "support.systeminformation.adsl.label.status.up",
"Down" : "support.systeminformation.adsl.label.status.down",
"Initializing" : "support.systeminformation.adsl.label.status.initializing",
"Unavailable" : "support.systeminformation.adsl.label.status.unavailable"
};
Wan.NetworkDetails.LinkType.FtthUpDown = {
"Up" : "support.systeminformation.ftth.label.status.up",
"Down" : "support.systeminformation.ftth.label.status.down",
"Initializing" : "support.systeminformation.ftth.label.status.initializing",
"Unavailable" : "support.systeminformation.ftth.label.status.unavailable"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/dynDNS.js */
/* TODO: documentation */
Wan.DynDNS = Class.create(Sah.AuthenticatedForm, {
initialize: function ($super, form)
{
$super(form);
this.services = this.form.down("select[name='Line.Service']");
/* setup events */
$$(".WanDynDNSAdd").each(function (b) { b.observe("click", this.onSave.bind(this)); }, this);
/* fetch needed data */
this.needs("DynDNS", { path: "Wan.DynDNS" });
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.Clients = this.objects.DynDNS.Client;
this.objects.Services = this.objects.DynDNS.Service;
this.objects.Hosts = $A();
this.objects.Clients.each(function (cl) {
if (cl.Hostname)
cl.Hostname.each(function (host) { host.client = cl; this.objects.Hosts.push(host); }, this);
}, this);
/* setup needed templates */
this.dynDNSTemplate = Sah.Templates['DynDNS'];
this.dynDNSTemplate.callback = this.appendDynDNS.bind(this);
this.dynDNSTemplate.apply(this.objects.Hosts);
this.fillServicesSelect();
this.form.enable();
this.markAsLoaded();
},
deleteHostname: function (tr, host)
{
host._destroy(this.deleteClient.bind(this, tr, host.client));
},
deleteClient: function (tr, client)
{
tr.remove();
if (client.Hostname._childs.length == 0)
client._destroy();
},
parseLastUpdate: function (str)
{
str.match(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)Z/);
return RegExp.$3 + "/" + RegExp.$2 + "/" + RegExp.$1 + " " + RegExp.$4 + ":" + RegExp.$5 + ":" + RegExp.$6;
},
appendDynDNS: function (element, hostName)
{
var dynDNS = hostName.client;
element.id = dynDNS._path;
var spath = dynDNS.Service.replace('InternetGatewayDevice.Services.' + Sah.prefix + 'DynamicDNS', 'Wan.DynDNS');
var service = this.objects.Services.detect(function (s) { return (s._path == spath); });
this.dynDNSTemplate.getElementForParameter(element, "Name").update(service.Name);
this.dynDNSTemplate.getElementForParameter(element, "Username").update(dynDNS.Username);
this.dynDNSTemplate.getElementForParameter(element, "Password").update("********");
this.dynDNSTemplate.getElementForParameter(element, "HostName").update(hostName.Name);
var date = null;
if (hostName.LastUpdate == "0001-01-01T00:00:00Z")
{
Sah.translator.change(this.dynDNSTemplate.getElementForParameter(element, "LastUpdate"), "advconfig.network.dyndns.label.none", "X none");
}
else
{
date = this.parseLastUpdate(hostName.LastUpdate);
this.dynDNSTemplate.getElementForParameter(element, "LastUpdate").update(date);
}
/* when clicking delete remove the element */
element.del = element.down(".WanDynDNSDelete");
element.del.observe("click", this.deleteHostname.bind(this, element, hostName));
this.form.down("tbody").insert(element);
},
fillServicesSelect: function ()
{
this.objects.Services.each(function (service) {
/* create a new option element */
var option = new Element("option", { value: service._path.replace(/^igd\./, '') });
option.service = service;
/* translate the option text */
option.update(service.Name);
/* insert the option in the select box */
this.services.insert(option);
}, this);
},
saveDone: function (client, hostName)
{
hostName.client = client;
this.dynDNSTemplate.apply(hostName);
},
onSave : function ()
{
$("dyndns_error").innerHTML="";
$("config.wan.dyndnserror").hide();
var hostname = this.form.down("input[name='Line.HostName']").getValue();
var username = this.form.down("input[name='Line.Username']").getValue();
var password = this.form.down("input[name='Line.Password']").getValue();
var service = this.services.options[this.services.selectedIndex].service._path.replace(/^Wan\.DynDNS/, 'InternetGatewayDevice.Services.' + Sah.prefix + 'DynamicDNS');
var iface = this.objects.DynDNS.WANConnection;
if(!hostname.match(/^[\w_\.-]+$/) || !username.match(/\S/) || !password.match(/\S/))
{
Sah.translator.change($("dyndns_error"), "advconfig.network.dyndns.error","X Invalid DynDns Fields");
$("config.wan.dyndnserror").show();
return false ;
}
var clientParams = { "Enable": "0",
"Interface": iface,
"Username": username,
"Password": password,
"Service": service };
this.isDuplicated = false;
this.objects.Clients._childs.each(function(hostname,cl){
/* avoid duplicates */
if (cl.Hostname && cl.Hostname._childs) {
if (cl.Hostname.detect(function (h) { return (h.Name == hostname); })) {
Sah.translator.change($("dyndns_error"), "advconfig.network.dyndns.errorduplicate","X hostname already configured for another service");
$("config.wan.dyndnserror").show();
this.isDuplicated = true;
// return false ;
}
}
}.curry(hostname),this);
if(this.isDuplicated)
{
return false ;
}
/* check if we already have a client */
var cl = this.objects.Clients.detect(function (c) { return (c.Service == service && c.Username == username ); });
if (!cl) {
cl = this.objects.Clients._new(clientParams);
this.objects.Clients._add(this.updateHostName.bind(this, hostname), cl._getParameters());
} else {
/* avoid duplicates */
if (cl.Hostname && cl.Hostname._childs) {
if (cl.Hostname.detect(function (h) { return (h.Name == hostname); })) {
Sah.translator.change($("dyndns_error"), "advconfig.network.dyndns.errorduplicate","X hostname already configured for another service");
$("config.wan.dyndnserror").show();
return false ;
}
}
cl._update(clientParams);
if (cl._changed()) {
cl._save(this.updateHostName.bind(this, hostname, cl));
} else {
this.updateHostName(hostname, cl);
}
}
return false;
},
updateHostName: function(hostname, client)
{
var path = client._path + ".Hostname";
/* look for a matching host name */
if (client.Hostname && client.Hostname._childs) {
var hn = client.Hostname.detect(function (h) { return (h.Name == hostname); });
if (hn) {
/* we first need to delete the previous one */
hn._destroy(function () {
client.Hostname._add(this.enableClient.bind(this, client), { Name: hostname });
}.bind(this));
} else {
client.Hostname._add(this.enableClient.bind(this, client), { Name: hostname });
}
} else {
this.client.get(path, -1, function (object) {
client.Hostname = object;
client.Hostname._add(this.enableClient.bind(this, client), { Name: hostname });
}.bind(this));
}
},
enableClient: function (client,obj)
{
client.Enable = "1";
client._save(this.saveDone.bind(this, client,obj));
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/dnsSummary.js */
/**
* The wan DnsSummary form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Wan.DnsSummary = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.DnsSummary */
{
initialize: function ($super, form)
{
$super(form);
this.needs("Wan", { path: "SI.Wan"});
this.load();
},
objectsLoaded: function ()
{
/* get the inet DHCP Client */
this.objects.Wan.DnsSummary.DHCPClient.Intf.each(function (client)
{
if (client.Name === "inet")
{
this.objects.Client = client;
}
},this);
/* prepare the form */
if (this.objects.Wan.Autodetect.Protocol!="DHCP")
{
this.objects.WanDNS = this.objects.Wan.DnsSummary.WANPPPConnection;
}else
{
this.objects.WanDNS = this.objects.Client;
this.objects.WanDNS.DNSPrimary = this.objects.Client.DNSServer1;
this.objects.WanDNS.DNSSecondary = this.objects.Client.DNSServer2;
this.objects.WanDNS.DNSServers = this.objects.Client.DNSServer1+","+this.objects.Client.DNSServer2;
}
this.prepareForm();
this.fillForm();
},
prepareForm: function ()
{
/* Extract the primary and secondary server IP */
var strIP = this.objects.WanDNS.DNSServers;
if(!strIP) { strIP=""; }
var ind = strIP.indexOf(",");
// TODO: fixup coding style
var newInd = ind;
if(ind<0) { newInd = strIP.length; }
if(strIP.length===0) {
$('WanDNS.DNSPrimary').innerHTML = "";
}
else {
$('WanDNS.DNSPrimary').innerHTML = strIP.substring(0,newInd);
}
if (ind>0) { $('WanDNS.DNSSecondary').innerHTML = strIP.substring(newInd+1,strIP.length); }
else { $('WanDNS.DNSSecondary').innerHTML = ""; }
},
fillForm: function ()
{
this.fromObject(this.objects);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/dnsEquipments.js */
/* TODO: documentation */
Wan.DnsEquipments = Class.create(Sah.AuthenticatedForm, {
initialize: function ($super, form)
{
$super(form);
this.form.hide();
/* fetch needed data */
this.needs("Devices", { path: "Wan.DNSEquipments.Hosts", depth: -1});
this.load();
},
objectsLoaded: function ()
{
/* setup needed templates */
this.dnsTemplate = Sah.Templates.DNS;
this.dnsTemplate.callback = this.appendDevice.bind(this);
this.dnsTemplate.apply(this.objects.Devices._childs.select(this.filter));
this.form.show();
},
appendDevice: function (element, device)
{
element.id = device._path;
//if ( device._changed() ) {
element.down(".bt_save").observe("click",this.onSave.bind(this, device, element));
//}
/* show the lement form */
this.dnsTemplate.showForm(element);
$('dnsEquipmentsList').down("tbody").insert(element);
},
onSave: function (device, element, event)
{
event.stop();
device.$DNSName = element.down(".DNSName").getValue();
var dnsNameReg = new RegExp("^([a-zA-Z0-9]*(\-)*)*$");
if( device.$DNSName === "" )
{
Sah.translator.change($("advconfig.network.dns.error.description"), "advconfig.network.dns.error.empty.description","X Empty device name");
$("advconfig.network.dns.error").show();
}
else if( device.$DNSName.length > 64 )
{
Sah.translator.change($("advconfig.network.dns.error.description"), "advconfig.network.dns.error.length.description","X Device name must contains under then 64 char");
$("advconfig.network.dns.error").show();
}else if(!dnsNameReg.test(device.$DNSName))
{
Sah.translator.change($("advconfig.network.dns.error.description"), "advconfig.network.dns.error.invalid.description","X Invalid device name");
$("advconfig.network.dns.error").show();
}
else
{
$("advconfig.network.dns.error").hide();
device._save({ onSuccess: this.onSuccess.bind(this),onFailure: this.onFailure.bind(this) });
}
},
onSuccess: function ()
{
},
onFailure: function ()
{
},
filter: function (device)
{
return ( (device.InterfaceType!="USB") && (device.HostName!="localhost") && (device.InterfaceType!="N/A") ) ;
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/dns.js */
/**
* The wan dns form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Wan.Dns = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.Dns */
{
initialize: function ($super, form)
{
$super(form);
/* prepare to load the objects we need */
this.needs("WanDNS", { path: "WanDNS", depth: -1});
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.DHCPClient = this.objects.WanDNS.DHCPClient;
this.objects.Autodetect = this.objects.WanDNS.Autodetect;
this.objects.WANPPPConnection = this.objects.WanDNS.WANPPPConnection;
this.objects.Inet = this.objects.WanDNS.Inet;
this.objects.LinkConfig = this.objects.WanDNS.LinkConfig;
/* prepare the form */
var is_PPP = this.objects.LinkConfig.LinkType;
var protocol = this.objects.Autodetect.Protocol;
// DHCP Auto Case
if ( protocol === "DHCP" )
{
/* get the inet DHCP Client */
this.objects.DHCPClient.Intf.each(function (client)
{
if (client.Name === "inet")
{
this.objects.Client = client;
}
},this);
this.objects.WanDNS = this.objects.Client;
this.objects.WanDNS.DNSPrimary = this.objects.Client.DNSServer1;
this.objects.WanDNS.DNSSecondary = this.objects.Client.DNSServer2;
}
// PPP Case
else
{
if ( is_PPP.include("PPP") || is_PPP=="EoA" || is_PPP=="ETHoA" ) {
this.objects.WanDNS = this.objects.WANPPPConnection;
}
else {
if (this.objects.Inet) {
this.objects.WanDNS = this.objects.Inet;
this.objects.WanDNS.DNSPrimary = this.objects.Inet.DNSServer1;
this.objects.WanDNS.DNSSecondary = this.objects.Inet.DNSServer2;
}
else
{ this.logger.warn("Add WANIPConnection object"); }
}
this.prepareForm(is_PPP);
}
if (this.objects.WanDNS)
{ this.form.enable(); }
this.fillForm();
this.markAsLoaded();
},
prepareForm: function (is_PPP)
{
// TODO: fixup coding style
if (this.objects.WanDNS)
{
if ( is_PPP.include("PPP") || is_PPP=="EoA" || is_PPP=="ETHoA" )
{
/*
* Extract the primary and secondary server IP
*/
var strIP = this.objects.WanDNS.DNSServers;
if(!strIP)
{ strIP=""; }
var ind = strIP.indexOf(",");
if(ind<0) { ind=strIP.length; }
this.objects.WanDNS.DNSPrimary = strIP.substring(0,ind);
// TODO: fixup coding style
if (ind>0) { this.objects.WanDNS.DNSSecondary = strIP.substring(ind+1,strIP.length); }
else { this.objects.WanDNS.DNSSecondary=""; }
}
}
},
fillForm: function ()
{
/* map the value directly to the form, ie the form element with an id matching
* a path from this.objects will be set automatically. */
this.fromObject(this.objects);
},
onCancel: function(event){
this.prepareForm();
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/detailedStatus.js */
Wan.DetailedStatus = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/detailedStatus/ip.js */
/*
* TODO: fixup documentation
* Broadband Network Details ( wan/ip)
*
*/
Wan.DetailedStatus.Ip = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.DetailedStatus.Ip# */
{
initialize: function ($super, form)
{
$super (form);
this.needs("General", { path: "SI.general", depth: -1 });
this.load();
},
objectsLoaded : function ()
{
this.objects.IP = this.objects.General.IP;
/* set the wan connection */
this.objects.DeviceConfig = this.objects.IP.DeviceConfig;
this.objects.WANIPConnection = this.objects.IP.WANIPConnection;
this.objects.WANPPPConnection = this.objects.IP.WANPPPConnection;
this.objects.WANDSLLinkConfig = this.objects.IP.WANDSLLinkConfig;
this.objects.WANCommonInterfaceConfig = this.objects.IP.WANCommonInterfaceConfig;
this.objects.Wan = this.objects.IP.WANPPPConnection;
this.prepareForm();
this.fillForm();
},
prepareForm: function ()
{
/* Get WANDSLLinkConfig object */
var WANDSLLinkConfig = this.objects.WANDSLLinkConfig;
var is_DSL = this.objects.DeviceConfig.WANInterfaceType;
var is_PPP =WANDSLLinkConfig.LinkType;
/* When Internet link type is set to PPP (PPPoA or PPPoE) ... otherwise ...*/
if ((is_PPP.include("PPP") || is_PPP=="EoA" || is_PPP=="ETHoA") && (this.objects.General.Autodetect.Protocol!="DHCP")) {
this.objects.Wan_Ip = this.objects.WANPPPConnection;
}
else
{
if (this.objects.WANIPConnection) {
this.objects.Wan_Ip = this.objects.WANIPConnection;
$$(".protocol").each(function(elem){
elem.hide();
});
}
}
},
fillForm: function ()
{
var connectionStatus = Wan.DetailedStatus.Ip.SynchroStatus[this.objects.Wan_Ip.ConnectionStatus];
//this.objects.Wan_Ip.ConnectionStatus = t( connectionStatus, this.objects.Wan_Ip.ConnectionStatus );
var physicalLinkStatus = Wan.DetailedStatus.Ip.UpDown[this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus];
//this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus = t( physicalLinkStatus, this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus );
var linkStatus = Wan.DetailedStatus.Ip.UpDown[this.objects.WANDSLLinkConfig.LinkStatus];
//this.objects.WANDSLLinkConfig.LinkStatus = t( linkStatus, this.objects.WANDSLLinkConfig.LinkStatus );
/* Extract the primary and secondary server IP */
var strIP = this.objects.Wan_Ip.DNSServers;
if(!strIP) { strIP=""; }
var ind = strIP.indexOf(",");
var newInd = ind;
if(ind<0) { newInd = strIP.length; }
if(strIP.length===0) {
$('Wan_Ip.DNSPrimary').innerHTML = "";
}
else {
$('Wan_Ip.DNSPrimary').innerHTML = strIP.substring(0,newInd);
}
if (ind>0) { $('Wan_Ip.DNSSecondary').innerHTML = strIP.substring(newInd+1,strIP.length); }
else { $('Wan_Ip.DNSSecondary').innerHTML = ""; }
this.fromObject(this.objects);
Sah.translator.change($('Wan_Ip.ConnectionStatus'), connectionStatus, this.objects.Wan_Ip.ConnectionStatus);
Sah.translator.change($('WANCommonInterfaceConfig.PhysicalLinkStatus'), physicalLinkStatus, this.objects.WANCommonInterfaceConfig.PhysicalLinkStatus);
Sah.translator.change($('WANDSLLinkConfig.LinkStatus'), linkStatus, this.objects.WANDSLLinkConfig.LinkStatus);
$("Wan_Ip.Uptime").innerHTML = this.objects.Wan_Ip.Uptime + " s";
}
}
);
Wan.DetailedStatus.Ip.SynchroStatus = {
"Connected" : "support.systeminformation.general.label.status.connected",
"Disconnected" : "support.systeminformation.general.label.status.disconnected",
"Unconfigured" : "support.systeminformation.general.label.status.unconfigured",
"Authenticating" : "support.systeminformation.general.label.status.authenticating",
"Connecting" : "support.systeminformation.general.label.status.connecting"
};
Wan.DetailedStatus.Ip.UpDown = {
"Up" : "support.systeminformation.general.label.status.up",
"Down" : "support.systeminformation.general.label.status.down",
"Unavailable" : "support.systeminformation.general.label.status.unavailable",
"Initializing" : "support.systeminformation.general.label.status.initializing",
"Listening" : "support.systeminformation.general.label.status.listening"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/connectionSettings.js */
Wan.ConnectionSettings = Class.create(Sah.AuthenticatedForm,
{
initialize: function ($super, form)
{
$super(form);
this.objects.nbRefresh = 1;
this.objects.stopRereshReq = true;
this.objects.runningReq = false;
$("ConnTypeOpt.DSL").observe("click", this.onRadioChange.bind(this));
$("ConnTypeOpt.ETHERNET").observe("click", this.onRadioChange.bind(this));
$$("#bt_save").each(function (b) {
b.observe("click", this.onSave.bind(this));
}, this);
$$("#bt_cancel").each(function (b) {
b.observe("click", this.onCancel.bind(this));
}, this);
$$("#bt_refresh").each(function (b) {
b.observe("click", this.onRefresh.bind(this));
}, this);
this.needs("FirstAccessType", {
path: "Internet.AccessType",
depth: -1
});
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.fromObject(this.objects);
this.prepareForm();
this.fillForm();
this.form.enable();
},
prepareForm : function()
{
if(this.objects.FirstAccessType.Protocol ==="DHCP")
{
$$(".protocol").each(function(elem){
elem.hide();
});
}
},
fillForm: function ()
{
$("advconfig.accesstype.error").hide();
if( this.objects.FirstAccessType.AccessType === "Ethernet" )
{
Cookie.set( 'WanInterfaceConfig','Ethernet');
this.clickRadio("ConnTypeOpt.ETHERNET");
this.unclickRadio("ConnTypeOpt.DSL");
}
else
{
this.clickRadio("ConnTypeOpt.DSL");
this.unclickRadio("ConnTypeOpt.ETHERNET");
}
if( ( this.objects.FirstAccessType.LinkType === "EoA") || ( this.objects.FirstAccessType.LinkType.include( "PPP" ) ) )
{
if( ( this.objects.FirstAccessType.WANPPPConnection.Username ) &&
( this.objects.FirstAccessType.WANPPPConnection.Username != "" ) )
{
var login = this.objects.FirstAccessType.WANPPPConnection.Username;
if( login.length > 4 )
{
if( login.substr( 0, 4 ) === "fti/" )
{
login = login.substr( 4, login.length );
}
}
$("FirstAccessType.WANPPPConnection.Username").setValue( login );
$("FirstAccessType.WANPPPConnection.Password").setValue( "************" );
}
}
else
{
$("setup.accesstype.credentials").hide();
}
},
// Uncheck another radio, and update the new radio
onRadioChange: function(event)
{
var checkedRadioId = Event.element(event).readAttribute("id");
var oldRadioId = this.OldRadio;
this.unclickRadio(oldRadioId);
this.clickRadio(checkedRadioId);
},
clickRadio: function(checkRadioId)
{
this.OldRadio=checkRadioId;
$(checkRadioId).checked = true;
},
unclickRadio: function(checkRadioId)
{
$(checkRadioId).checked = false;
},
onSave: function(event)
{
event.stop(event);
$("advconfig.accesstype.error").hide();
var areCredentialsValid = true;
var login = "";
var password = "";
var WANConnection = null;
this.beforeRequest();
if( ( this.objects.FirstAccessType.LinkType === "EoA") || ( this.objects.FirstAccessType.LinkType.include( "PPP" ) ) )
{
WANConnection = this.objects.FirstAccessType.WANPPPConnection;
login = $("FirstAccessType.WANPPPConnection.Username").getValue();
if( ( login.length > 4 ) && ( login.substr( 0, 4 ) === "fti/" ) )
{
login = login.substr( 4, login.length );
$("FirstAccessType.WANPPPConnection.Username").setValue( login );
}
password = $("FirstAccessType.WANPPPConnection.Password").getValue();
if( ( login.strip() === "" ) || ( password.strip() === "" ) )
{
areCredentialsValid = false;
}
else
{
if (this.objects.FirstAccessType.Protocol !=="DHCP") {
if( appConfig === 'fr' || appConfig === 'mini-fr') {
this.objects.FirstAccessType.WANPPPConnection.Username = "fti/" + login;
} else {
this.objects.FirstAccessType.WANPPPConnection.Username = login;
} if( password !== "************" ) {
this.objects.FirstAccessType.WANPPPConnection.Password = password;
}
this.objects.FirstAccessType.WANPPPConnection.Enable = 1;
areCredentialsValid = true;
}
}
}
if (this.objects.FirstAccessType.Protocol ==="DHCP") {
this.logger.info("disabling dhcp client");
WANConnection = this.objects.FirstAccessType.WANIPConnection;
areCredentialsValid = true;
}
if (areCredentialsValid === true)
{
if ( this.OldRadio === "ConnTypeOpt.DSL" ) {
this.objects.FirstAccessType.AccessType = "DSL";
} else {
this.objects.FirstAccessType.AccessType = "Ethernet";
}
Cookie.set( 'WanInterfaceConfig', this.objects.FirstAccessType.AccessType );
this.objects.FirstAccessType.ConfigSave = 0;
this.userName =false;
if (WANConnection["Username"] != WANConnection._parameters["Username"]) {
this.userName = WANConnection["Username"];
}
WANConnection._save({
onSuccess: this.whenPPPSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.running.label","Athentification en cours",
"advconfig.accesstype.error.running.description","X Authentication running...",
0 );
} else {
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.empty.label","X Invalid values",
"advconfig.accesstype.error.empty.description","X Check that login and password are correct.",
0 );
}
return true;
},
beforeRequest: function () {
this.stopRefreshStatus();
this.objects.stopRereshReq = false;
this.objects.runningReq = true;
$$("#bt_save")[0].disable();
$$("#bt_refresh")[0].disable();
},
afterRequest:function(){
this.objects.runningReq = false;
$$("#bt_save")[0].enable();
$$("#bt_refresh")[0].enable();
},
whenPPPSaved: function (obj)
{
if(this.objects.stopRereshReq){
this.afterRequest();
return;
}
if(this.userName && obj._parameters["Username"]!=this.userName){
this.stopRefreshStatus();
this.showErrorMsg( $("advconfig.accesstype.error"),"advconfig.accesstype.error.empty.label","X Invalid values", "advconfig.accesstype.error.empty.description","X Check that login and password are correct.", 0 );
return false;
}
this.objects.FirstAccessType._save({
onSuccess: this.whenConnectionSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
return true;
},
whenConnectionSaved: function (obj)
{
Cookie.set( 'WanInterfaceConfig', this.objects.FirstAccessType.AccessType );
this.objects.FirstAccessType.ConfigSave = 1;
this.objects.FirstAccessType._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenSaved: function (obj)
{
this.afterRequest();
if(this.objects.stopRereshReq){
return;
}
this.objects.nbRefresh = 1;
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.running.label","Athentification en cours",
"advconfig.accesstype.error.running.description","X Authentication running...",
this.objects.nbRefresh );
Cookie.set( 'WanInterfaceConfig', this.objects.FirstAccessType.AccessType );
this.refreshStatus( 5 );
},
whenNotSaved: function (obj)
{
this.afterRequest();
if(this.objects.stopRereshReq){
return;
}
this.logger.warn("Saving connection parameters failed");
Cookie.set( 'WanInterfaceConfig', this.objects.FirstAccessType._parameters["AccessType"] );
this.logger.warn(obj);
},
stopRefreshStatus: function (){
this.objects.stopRereshReq = true;
window.clearTimeout(this.timeout);
this.timeout = null;
},
refreshStatus: function (refreshPeriod) {
// TODO: not every object has to be reloaded, why not just refresh the WANCommonInterfaceConfig ?
/* refresh the BroadBand Status */
if(this.objects.stopRereshReq || this.objects.runningReq){
return;
}
if(!this.timeout) {
this.timeout = window.setTimeout((function(event){
this.objects.FirstAccessType._load( this.checkStatus.bind(this) );
}).bind(this), refreshPeriod * 1000);
}
},
checkStatus : function ()
{
if(this.objects.stopRereshReq || this.objects.runningReq){
return;
}
if( this.objects.FirstAccessType.WLANLedColor == "Red" )
{
this.logger.warn("Current connection type "+this.objects.FirstAccessType.AccessType);
if( this.objects.FirstAccessType.AccessType === "Ethernet" )
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.ftth_link.label","X EthernetLinkStatus " + this.objects.FirstAccessType.EthernetLinkStatus,
"advconfig.accesstype.error.ftth_link.description","X Link with fiber mode is down",
0 );
}
else
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.adsl_link.label","X PhysicalLinkStatus " + this.objects.FirstAccessType.PhysicalLinkStatus,
"advconfig.accesstype.error.adsl_link.description","X ADSL synchronization failed",
0 );
}
}
else
{
var WANConnection = null;
if( ( this.objects.FirstAccessType.LinkType === "EoA") || ( this.objects.FirstAccessType.LinkType.include( "PPP" ) ) )
{
WANConnection = this.objects.FirstAccessType.WANPPPConnection;
}
else
{
WANConnection = this.objects.FirstAccessType.WANIPConnection;
}
if( ( this.objects.FirstAccessType.WLANLedColor == "Green" ) || ( WANConnection.ConnectionStatus == "Connected") )
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.connected.label","X ConnectionStatus " + WANConnection.ConnectionStatus,
"advconfig.accesstype.connected.description","X Connected",
0 );
this.stopRefreshStatus();
}
else if( WANConnection.ConnectionStatus == "Connecting" )
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.running.label","X Authentification en cours",
"advconfig.accesstype.error.running.description","X Authentication running...",
this.objects.nbRefresh );
this.objects.nbRefresh += 1;
}
else if( WANConnection.ConnectionStatus == "Unconfigured" ) /// PPP only
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.ppp_server.label","X ConnectionStatus " + WANConnection.ConnectionStatus,
"advconfig.accesstype.error.ppp_server.description","X Authentication server unconfigured",
0 );
}
else if( WANConnection.LastConnectionError == "ERROR_AUTHENTICATION_FAILURE" )
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.authentication.label","X Authentication Failure",
"advconfig.accesstype.error.authentication.description","X Authentication Failure",
0 );
}
else if( WANConnection.LastConnectionError == "ERROR_ISP_TIMEOUT" ) /// PPP only
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.ppp_timeout.label","X LastConnectionError " + WANConnection.LastConnectionError,
"advconfig.accesstype.error.ppp_timeout.description","X Authentication server timeout",
0 );
}
else
{
this.showErrorMsg( $("advconfig.accesstype.error"),
"advconfig.accesstype.error.running.label","X Authentification en cours",
"advconfig.accesstype.error.running.description","X Authentication running...",
this.objects.nbRefresh );
this.objects.nbRefresh += 1;
}
}
this.timeout = null;
this.refreshStatus(2);
},
showErrorMsg : function(div, errorHeaderLabel, errorHeaderDefault, errorMsgLabel, errorMsgDefault, nbRefresh )
{
Sah.translator.change(div.down("h3"), errorHeaderLabel, errorHeaderDefault);
Sah.translator.change($("advconfig.accesstype.error.text"), errorMsgLabel, errorMsgDefault);
if( nbRefresh > 0 )
{
$("advconfig.accesstype.error.waiter").update( Wan.ConnectionSettings.Waiter[(nbRefresh%10)] );
}
else
{
$("advconfig.accesstype.error.waiter").update( "" );
}
div.show();
},
onCancel: function(event)
{
event.stop();
this.stopRefreshStatus();
this.fillForm();
},
onRefresh : function(event)
{
var conn = (this.objects.FirstAccessType.Protocol ==="DHCP" ? this.objects.FirstAccessType.WANIPConnection : this.objects.FirstAccessType.WANPPPConnection);
this.showErrorMsg($("advconfig.accesstype.error"),"advconfig.accesstype.error.restart.label","Reconnection","advconfig.accesstype.error.restart.description","Reconnecting", 0 );
event.stop();
this.beforeRequest();
if (conn.Enable==0)
{
this.whenPPPDisabled(conn);
}
conn.Enable=0;
conn._save({
onSuccess : this.whenPPPDisabled.bind(this, conn),
onFailure : this.whenNotSaved.bind(this)
});
},
whenPPPDisabled :function(conn) {
if(this.objects.stopRereshReq){
this.afterRequest();
return;
}
conn.Enable=1;
conn._save({
onSuccess : this.whenAccountSaved.bind(this),
onFailure : this.whenAccountNotSaved.bind(this)
});
},
whenAccountSaved: function (obj)
{
this.afterRequest();
if(this.objects.stopRereshReq){
return;
}
this.logger.info("object saved");
this.refreshStatus(10);
},
whenAccountNotSaved: function (obj)
{
this.afterRequest();
if(this.objects.stopRereshReq){
return;
}
this.logger.warn("failed to save object");
this.logger.warn(obj);
}
});
Wan.ConnectionSettings.Waiter = [ "..", "....", "......", "........", "..........", "........", "......", "....", "..", "" ];
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/connectionModeOptMini.js */
/**
* The wifi stat form
*
* This class is mapped to a from defined for now in views/Wan/telco_connMode.ejs.
* It is a subclass of the Sah.AuthenticatedForm class. The class is instantiated when
* a form element with the same name as the class with . replaced by / exists.
* In this case, this class will be instantiated if a tag <form name="Wan/Telco/ConnMode">
* is found.
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
*/
Wan.ConnectionModeOptMini = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.Telco# */
{
initialize: function ($super, form)
{
$super(form);
/* initialize events handler */
/* when the form is submitted, call the onSave method of this class */
$("bt_save").observe("click", this.onSave.bind(this));
$("bt_cancel").observe("click", this.onCancel.bind(this));
$("connmode.radio.automatic").observe("click",this.onCheckMultiScreen.bind(this));
$("connmode.radio.manually").observe("click",this.onCheckMultiScreen.bind(this));
$("connmode.radio.manually.bridged").observe("click",this.onCheckMultiScreen.bind(this));
$("connmode.radio.manually.routed").observe("click",this.onCheckMultiScreen.bind(this));
$("connmode.radio.manually.disabled").observe("click",this.onCheckMultiScreen.bind(this));
this.needs("ConnModeOpt", { path: "Wan.ConnModeOpt", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.DeviceConfig = this.objects.ConnModeOpt.DeviceConfig;
this.objects.ConnMode = this.objects.ConnModeOpt.ConnMode;
this.prepareForm();
this.fillForm();
this.form.enable();
},
prepareForm: function ()
{
// FTTH condition
/* var isDSL = this.objects.DeviceConfig.WANInterfaceType;
if((isDSL!="DSL")&&(appConfig === 'fr')){
this.form.hide();
}*/
},
fillForm: function ()
{
var confMode = this.objects.ConnMode.AutoConfigmode;
var vpc = this.objects.ConnMode.Enable;
if (confMode == "1") {
$("connmode.radio.manually").checked = false;
$("connmode.radio.automatic").checked = true;
}
else{
$("connmode.radio.automatic").checked = false;
$("connmode.radio.manually").checked = true;
if(vpc=="3")
{
$("connmode.radio.manually.routed").checked = true;
$("connmode.radio.manually.bridged").checked =false;
$("connmode.radio.manually.disabled").checked =false;
}
else if(vpc=="1")
{
$("connmode.radio.manually.routed").checked = false;
$("connmode.radio.manually.bridged").checked =true;
$("connmode.radio.manually.disabled").checked =false;
}
else
{
$("connmode.radio.manually.routed").checked = false;
$("connmode.radio.manually.bridged").checked =false;
$("connmode.radio.manually.disabled").checked =true;
}
}
this.onCheckMultiScreen();
},
onSave: function(event)
{
event.stop(event);
if($("connmode.radio.automatic").checked )
{
this.objects.ConnMode.AutoConfigmode = 1;
}
else
{
if($("connmode.radio.manually.bridged").checked)
{
// bridged mode
this.objects.ConnMode.Enable = 1;
}else if($("connmode.radio.manually.routed").checked)
{
// routed mode
this.objects.ConnMode.Enable = 3;
}else {
// sat tv mode
this.objects.ConnMode.Enable = 0;
}
}
if (this.objects.ConnMode._changed()) {
this.objects.ConnMode._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.logger.warn("Nothing changed to be saved !!!");
}
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fillForm();
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
},
onCancel: function(event)
{
event.stop(event);
this.fillForm();
},
onCheckMultiScreen : function (event)
{
if( appConfig === 'fr' || appConfig ==='mini-fr' )
{
$("screenoption.message.manually.bridged").hide();
$("screenoption.message.manually.routed").hide();
$("screenoption.message.manually.disabled").hide();
$("screenoption.message.automatic").hide();
$$(".manually-option").each(function(e) {
e.hide();
});
if($("connmode.radio.automatic").checked)
{
$("screenoption.message.automatic").show();
}
else
{
$$(".manually-option").each(function(e) {
e.show();
});
if($("connmode.radio.manually.bridged").checked)
{
$("screenoption.message.manually.bridged").show();
}
else if($("connmode.radio.manually.routed").checked)
{
$("screenoption.message.manually.routed").show();
}else
{
$("screenoption.message.manually.disabled").show();
}
}
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/wan/connectionModeOpt.js */
/**
* The wifi stat form
*
* This class is mapped to a from defined for now in views/Wan/telco_connMode.ejs.
* It is a subclass of the Sah.AuthenticatedForm class. The class is instantiated when
* a form element with the same name as the class with . replaced by / exists.
* In this case, this class will be instantiated if a tag <form name="Wan/Telco/ConnMode">
* is found.
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
*/
Wan.ConnectionModeOpt = Class.create(Sah.AuthenticatedForm,
/** @lends Wan.Telco# */
{
initialize: function ($super, form)
{
$super(form);
/* initialize events handler */
/* when the form is submitted, call the onSave method of this class */
$("bt_save").observe("click", this.onSave.bind(this));
$("bt_cancel").observe("click", this.onCancel.bind(this));
$$(".port-radio-"+appConfig).each( function (btn) {
btn.observe("click", this.onCheckMultiScreen.bind(this));
},this);
this.needs("ConnModeOpt", { path: "Wan.ConnModeOpt", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.DeviceConfig = this.objects.ConnModeOpt.DeviceConfig;
this.objects.ConnMode = this.objects.ConnModeOpt.ConnMode;
this.prepareForm();
this.fillForm();
this.form.enable();
},
prepareForm: function ()
{
// FTTH condition
var isDSL = this.objects.DeviceConfig.WANInterfaceType;
if((isDSL!="DSL")&&(appConfig === 'fr' || appConfig === 'mini-fr')){
this.form.hide();
}
},
fillForm: function ()
{
var confMode = this.objects.ConnMode.AutoConfigmode;
var vpc = this.objects.ConnMode.Enable;
if( appConfig === 'pl' )
{
this.fillFormPl(vpc);
}else if(appConfig==='mini-fr')
{
this.fillFormMiniFr(vpc,confMode);
}else
{
this.fillFormFr(vpc);
}
this.onCheckMultiScreen();
},
fillFormMiniFr : function (vpc,confMode)
{
if (confMode == "1") {
$("connmode.radio.manually").checked = false;
$("connmode.radio.automatic").checked = true;
}
else{
$("connmode.radio.automatic").checked = false;
$("connmode.radio.manually").checked = true;
}
if(vpc=="3")
{
$("connmode.radio.manually.routed").checked = true;
$("connmode.radio.manually.bridged").checked =false;
$("connmode.radio.manually.disabled").checked =false;
}
else if(vpc=="1")
{
$("connmode.radio.manually.routed").checked = false;
$("connmode.radio.manually.bridged").checked =true;
$("connmode.radio.manually.disabled").checked =false;
}
else
{
$("connmode.radio.manually.routed").checked = false;
$("connmode.radio.manually.bridged").checked =false;
$("connmode.radio.manually.disabled").checked =true;
}
},
fillFormFr : function (vpc)
{
if (vpc != "1") {
$("connmode.radio.routed").checked = true;
$("connmode.radio.bridged").checked = false;
}
else{
$("connmode.radio.bridged").checked = true;
$("connmode.radio.routed").checked = false;
}
},
fillFormPl : function (vpc)
{
Sah.translator.change($("input-tv-fullrouted-label"), "advconfig.ports.label.pl.fullrouted", "advconfig.ports.label.pl.fullrouted");
Sah.translator.change($("input-tv-bridged-label"), "advconfig.ports.label.pl.bridged", "advconfig.ports.label.bridged.pl");
this.fillFormFr(vpc);
},
onSave: function(event)
{
event.stop(event);
if( appConfig === 'mini-fr' )
{
this.setParametersMini();
}else if( appConfig === 'pl' )
{
this.setParametersPl();
}else
{
this.setParametersFr();
}
if (this.objects.ConnMode._changed()) {
this.objects.ConnMode._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.logger.warn("Nothing changed to be saved !!!");
}
},
setParametersMini : function ()
{
if($("connmode.radio.automatic").checked )
{
this.objects.ConnMode.AutoConfigmode = 1;
}
else
{
this.objects.ConnMode.AutoConfigmode = 0;
if($("connmode.radio.manually.bridged").checked)
{
// bridged mode
this.objects.ConnMode.Enable = 1;
}else if($("connmode.radio.manually.routed").checked)
{
// routed mode
this.objects.ConnMode.Enable = 3;
}else {
// sat tv mode
this.objects.ConnMode.Enable = 0;
}
}
},
setParametersFr : function ()
{
if($("connmode.radio.routed").checked )
{
// full route mode
this.objects.ConnMode.Enable = 3;
}
else
{
// bridged mode
this.objects.ConnMode.Enable = 1;
}
},
setParametersPl : function ()
{
if($("connmode.radio.routed").checked )
{
// full route mode
this.objects.ConnMode.Enable = 2;
}
else
{
// bridged mode
this.objects.ConnMode.Enable = 1;
}
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fillForm();
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
},
onCancel: function(event)
{
event.stop(event);
this.fillForm();
},
onCheckMultiScreen : function (event)
{
if( appConfig === 'mini-fr' )
{
this.showTableMini();
}
else if(appConfig ==='pl')
{
this.showTablePl();
}else
{
this.showTableFr();
}
},
showTableFr : function ()
{
$("screenoption.message.bridged").hide();
$("screenoption.message.routed").hide();
if($("connmode.radio.routed").checked)
{
$("screenoption.message.routed").show();
}
else
{
$("screenoption.message.bridged").show();
}
},
showTablePl : function ()
{
$("screenoption.message.bridged-adsl").hide();
$("screenoption.message.bridged-ftth").hide();
$("screenoption.message.routed-adsl").hide();
$("screenoption.message.routed-ftth").hide();
if($("connmode.radio.routed").checked)
{
if( this.objects.DeviceConfig.WANInterfaceType === 'DSL' )
{
$("screenoption.message.routed-adsl").show();
}
else
{
$("screenoption.message.routed-ftth").show();
}
}
else
{
if( this.objects.DeviceConfig.WANInterfaceType === 'DSL' )
{
$("screenoption.message.bridged-adsl").show();
}
else
{
$("screenoption.message.bridged-ftth").show();
}
}
},
showTableMini : function ()
{
$("screenoption.message.manually.bridged").hide();
$("screenoption.message.manually.routed").hide();
$("screenoption.message.manually.disabled").hide();
$("screenoption.message.automatic").hide();
$$(".manually-option").each(function(e) {
e.hide();
});
if($("connmode.radio.automatic").checked)
{
$("screenoption.message.automatic").show();
}
else
{
$$(".manually-option").each(function(e) {
e.show();
});
if($("connmode.radio.manually.bridged").checked)
{
$("screenoption.message.manually.bridged").show();
}
else if($("connmode.radio.manually.routed").checked)
{
$("screenoption.message.manually.routed").show();
}else
{
$("screenoption.message.manually.disabled").show();
}
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/voice.js */
/**
* @namespace Holds the home entity and its associated forms
*/
var Voice = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/voice/testSummary.js */
/**
* Voice TestSummary
*/
Voice.TestSummary = Class.create(Sah.AuthenticatedForm,
/** @lends Voice.TestSummary# */
{
initialize: function ($super, form)
{
$super (form);
this.needs("Voice",{ path: "SI.Voice", depth: -1 });
this.form.disable();
this.markAsLoading();
this.load();
},
objectsLoaded : function ()
{
this.objects.Services = this.objects.Voice.TestSummary.Services;
this.fromObject(this.objects);
if ($("Services.Phone"))
{
if (!this.objects.Services.VOIPLedState.match(/Off/i))
{
Sah.translator.change($("Services.Phone"), "support.systeminformation.voip.label.available","X Available");
}
else
{
Sah.translator.change($("Services.Phone"), "support.systeminformation.voip.label.unavailable","X Unavailable");
}
}
if ( ( this.objects.Services.PhoneNumber !== "" ) && ( this.objects.Services.PhoneNumber.length > 5 ) )
{
$("Services.PhoneNumber").innerHTML = Sah.Tools.formatPhoneNumber( this.objects.Services.PhoneNumber );
}
this.form.enable();
this.markAsLoaded();
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/voice/test.js */
/**
* Voice Test
*/
Voice.Test = Class.create(Sah.AuthenticatedForm,
/** @lends Voice.Pstn# */
{
initialize: function ($super, form)
{
$super (form);
// Controller is applied to 2 different pages containing different buttons
this.objects.isTestPage = false;
if ($("bt_test")) {
$("bt_test").observe("click", this.onTest.bind(this));
this.objects.isTestPage = true;
}
if ($("bt_back"))
$("bt_back").observe("click", this.onBack.bind(this));
if ($("bt_restart"))
$("bt_restart").observe("click", this.onRestart.bind(this));
this.needs("Phone", { path: "Voice.Test", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded : function ()
{
this.objects.Test = this.objects.Phone.Test;
this.objects.Profile = this.objects.Phone.Profile;
this.objects.Services = this.objects.Phone.Services;
this.fromObject(this.objects);
if ($("Services.Phone")) {
if (this.objects.Services.VOIPLedState.match(/Off/i)) {
Sah.translator.change($("Services.Phone"), "general.label.unavailable","X Unavailable");
$("Services.Phone").setStyle("color:red");
Sah.translator.change($("Services.PhoneNumber"), "support.phoneringtest.label.nonumber", "X No number");
} else {
Sah.translator.change($("Services.Phone"), "general.label.available","X Available");
$("Services.Phone").setStyle("color:green");
if ($("Services.PhoneNumber")) {
if ((this.objects.Services.PhoneNumber === "") || (this.objects.Services.PhoneNumber.length < 6)) {
Sah.translator.change($("Services.PhoneNumber"), "support.phoneringtest.label.unknownnumber", "X No number" );
} else {
$("Services.PhoneNumber").innerHTML = Sah.Tools.formatPhoneNumber(this.objects.Services.PhoneNumber);
}
}
}
}
this.form.enable();
},
onTest: function (event)
{
event.stop(event);
this.doTest();
return false;
},
doTest : function ()
{
this.objects.Test.RunTest=1;
this.objects.Test._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
},
whenSaved: function (obj)
{
this.onResult(obj);
},
whenNotSaved: function (obj)
{
this.logger.warn("Phone Ring test failed");
this.onResult(obj);
},
onResult: function (obj)
{
// Change page only if needed
if(this.objects.isTestPage)
this.redirect("/supportPhoneRingTestRunning.html");
},
onBack: function (event)
{
event.stop(event);
this.redirect("/supportPhoneRingTest.html");
},
onRestart: function (event)
{
event.stop(event);
this.doTest();
return false;
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/voice/sipAccountFT.js */
/**
*
* The Voice sipAccountFT Form
*
*/
Voice.SipAccountFT = Class.create(Sah.AuthenticatedForm,
/** @lends Voice.SipAccountFT# */
{
initialize: function ($super, form)
{
$super(form);
/* initialize events handler */
$("Voice/sipAccount/Save").observe("click", this.onSave.bind(this));
$("Voice/sipAccount/Cancel").observe("click", this.onCancel.bind(this));
this.needs("Voice", {
path: "atomic.Voice",
depth: 0
});
this.needs("SipInfo", {
path: "atomic.Voice.SIP",
depth: 1
});
this.needs("Lines", {
path: "atomic.Voice.Profile",
depth: 3
});
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.SIPAccount = this.objects.Lines._childs["0"];
this.fillForm();
this.form.enable();
},
fillForm: function ()
{
this.fromObject(this.objects);
},
onSave: function (event)
{
event.stop(event);
if(this.objects.SIPAccount && this.objects.SIPAccount != 'undefined')
{
this.objects.SIPAccount._update(this.toObject().SIPAccount);
this.objects.SIPAccount.Enable=1;
this.objects.SIPAccount.VoicePort="COMMON";
this.objects.SIPAccount._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
else
this.objects.Lines._add(function (object,response){
this.objects.SIPAccount = object;
this.objects.SIPAccount._update(this.toObject().SIPAccount);
this.objects.SIPAccount.Enable=1;
this.objects.SIPAccount.VoicePort="COMMON";
this.objects.SIPAccount._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}.bind(this));
this.objects.SipInfo._update(this.toObject().SipInfo);
if (this.objects.SipInfo._changed()) {
// if (this.validateSipSettings(this.objects.SipInfo)) {
this.objects.SipInfo._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
// } else {
// this.logger.info("Error in sip server settings");
// }
} else {
this.logger.info("nothing has changed in SIPServer, skipping save");
}
/* if(this.objects.SIPAccount != 'undefined')
{
this.objects.SIPAccount.Enable=1;
this.objects.SIPAccount.VoicePort="COMMON";
//if (this.objects.SIPAccount._changed()) {
this.objects.SIPAccount._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
// } else {
// this.logger.info("nothing has changed in SIPAccount, skipping save");
// }
} */
return false;
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.objects.Voice.Enable =1;
// TODO : implement the handlers
this.objects.Voice._save({
onSuccess : function(o) {},
onFailure : function(o) {}
} );
this.fromObject(this.objects);
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
alert("Saving for modification of SIP setting is failed ");
},
onCancel: function(event){
this.fromObject(this.objects);
},
validateSipSettings : function (obj)
{
var bValid = true ;
if (!Sah.IPAddress.isValid(obj.ProxyServer)) {
obj._errors["ProxyServer"] = t("Errors.ProxyServer", "Bad sip server address");
this.logger.info("Bad sip server address");
bValid = false ;
}
/**
* @todo this should use the Sah.Validations.isValidPortNumber
* @author Montassar
*/
if (!Sah.Validations.isNumeric(obj.ProxyServerPort) || obj.ProxyServerPort<=1 || obj.ProxyServerPort >=65535) {
obj._errors["ProxyServerPort"]=t("Errors.ProxyServerPort", "Bad sip server port");
this.logger.info("Bad sip server port");
bValid = false ;
}
if (!Sah.IPAddress.isValid(obj.RegistrarServer)) {
obj._errors["RegistrarServer"] = t("Errors.RegistrarServer", "Bad registrar server address");
this.logger.info("Bad registrar server address");
bValid = false ;
}
/**
* @todo this should use the Sah.Validations.isValidPortNumber
* @author Montassar
*/
if (!Sah.Validations.isNumeric(obj.RegistrarServerPort) || obj.RegistrarServerPort<=1 || obj.RegistrarServerPort >=65535) {
obj._errors["RegistrarServerPort"]=t("Errors.RegistrarServerPort","Bad registrar server port");
this.logger.info("Bad registrar server port");
bValid = false ;
}
return bValid;
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/voice/fxo.js */
/**
* Voice Fxo
*/
Voice.Fxo = Class.create(Sah.AuthenticatedForm,
/** @lends Voice.Fxo# */
{
initialize: function ($super, form)
{
$super (form);
this.needs("Fxo",{ path: "SI.Fxo", depth: -1 });
$("bt_cancel").observe("click",this.onCancel.bind(this));
$("bt_save").observe("click",this.onSave.bind(this));
$("Fxo.Desactivated").observe("click",this.clickDesactivatedRadio.bind(this));
$("Fxo.Activated").observe("click",this.clickActivatedRadio.bind(this));
this.form.disable();
this.load();
},
objectsLoaded : function ()
{
this.fillForm();
this.form.enable();
},
fillForm : function ()
{
if (this.objects.Fxo.PhoneMode === "universal")
{
$("Fxo.Activated").checked = true;
$("Fxo.Desactivated").checked = false;
}
else
{
$("Fxo.Desactivated").checked = true;
$("Fxo.Activated").checked = false;
}
},
onSave : function ()
{
if ($("Fxo.Activated").checked)
{
this.objects.Fxo.PhoneMode = "universal";
}
else
{
this.objects.Fxo.PhoneMode = "standard";
}
this.objects.Fxo._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenSaved : function ()
{
console.log("Saved");
},
whenNotSaved : function ()
{
console.log("Not Saved");
},
clickActivatedRadio : function ()
{
$("Fxo.Desactivated").checked = false;
$("Fxo.Activated").checked = true;
},
clickDesactivatedRadio : function ()
{
$("Fxo.Activated").checked = false;
$("Fxo.Desactivated").checked = true;
},
onCancel : function (event)
{
this.fillForm();
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/voice/connection.js */
Voice.Connection = Class.create(Sah.AuthenticatedForm,
/** @lends Voice.Connection */
{
initialize: function ($super, form)
{
$super(form);
/* prepare to load the objects we need */
this.needs("Voice",{ path: "SI.Voice",depth: -1 });
this.load();
},
/**
* called when the needed objects are loaded
*/
objectsLoaded: function ()
{
this.objects.VPVC = this.objects.Voice.Connection.VPVC;
this.objects.Bridge = this.objects.Voice.Connection.VPVC.Bridge;
this.objects.VLAN = this.objects.Voice.Connection.VPVC.VLAN;
this.objects.ATM = this.objects.Voice.Connection.VPVC.ATM;
this.objects.Capabilities = this.objects.Voice.Connection.Capabilities;
this.fillForm();
},
/**
* set the values read from sahbus to the form elements
*/
fillForm: function ()
{
/* map the value directly to the form, ie the form element with an id matching
* a path from this.objects will be set automatically.
this.objects.WANDSLLinkConfig.LinkStatus = t( Voice.Connection.UpDown[this.objects.WANDSLLinkConfig.LinkStatus], this.objects.WANDSLLinkConfig.LinkStatus );*/
this.fromObject(this.objects);
this.objects.Bridge.each(function (bridge)
{
if (bridge.Name === "voice_bridge")
{
this.objects.voice_bridge = bridge;
}
},this);
if (appConfig == "pl") {
$('VPVC.DestinationAddress').update("0/35");
} else if (this.objects.voice_bridge) {
var is_DSL = "";
if ( Cookie.get( 'WanInterfaceConfig' ) )
{
is_DSL = Cookie.get( 'WanInterfaceConfig' );
}
if ( is_DSL === "DSL" )
{
this.objects.voice_bridge.Intf.each(function (intf)
{
if (intf.Name === "voice_atm")
{
this.objects.voice_path = intf.LowerIntf;
var str = intf.LowerIntf.split(".");
this.objects.VPVC.DestinationAddress = this.objects.Voice.Connection.VPVC.ATM.Intf[str[str.length-1]].DestinationAddress;
}
},this);
}
else
{
this.objects.voice_bridge.Intf.each(function (intf)
{
if (intf.Name === "voice_vlan")
{
this.objects.voice_path = intf.LowerIntf;
var str = intf.LowerIntf.split(".");
this.objects.VPVC.DestinationAddress = this.objects.Voice.Connection.VPVC.VLAN[str[str.length-1]].VLANID;
}
},this);
}
// process with VP/VC
var str = this.objects.VPVC.DestinationAddress;
//if(str.length === 3){ str = str.substring(0,1) + "/" + str.substring(1,3); }
$('VPVC.DestinationAddress').innerHTML = str;
}
else
{
$('VPVC.DestinationAddress').innerHTML = "8/35";
}
}
}
);
Voice.Connection.UpDown = {
"Up" : "support.systeminformation.voip.label.status.up",
"Down" : "support.systeminformation.voip.label.status.down"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/usb.js */
/**
* @namespace Holds the services entity and its associated forms
*/
var Usb = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/usb/status.js */
/**
*
* Usb Status
*
*/
Usb.Status = Class.create(Sah.AuthenticatedForm,
/** @lends Security.Summary# */
{
initialize: function ($super, form)
{
$super (form);
/* prepare to load the objects we need (Firewall) */
this.needs("Host", { path: "igd.InternetGatewayDevice.LANDevice.Hosts",depth: -1 });
this.load();
},
objectsLoaded : function ()
{
var val = this.objects.Host["1"].ActiveUSB.Host["1"].Device["1"].Configuration["1"].Interface["1"];
this.fromObject(this.objects);
if(val==1)
{
$('Host.Status').update("Enabled");
}
else
{
$('Host.Status').update("Disabled");
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/usb/connectionList.js */
/**
* The Usb ConnectionList form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Usb.ConnectionList = Class.create(Sah.AuthenticatedForm,
/** @lends Usb.ConnectionList */
{
initialize: function ($super, form)
{
$super(form);
this.needs("Host", { path: "Usb.ConnectionList.Hosts", depth: -1 });
/* load the needed objects into this.objects */
this.markAsLoading();
this.load();
},
objectsLoaded: function ()
{
this.objects.USB = [];
this.objects.Host.each(function (host)
{
if (host.DeviceClass != "9")
{
this.objects.USB.push( host );
}
},this);
/* prepare the form */
this.prepareForm();
this.markAsLoaded();
},
/**
* fillup the select boxes with the right values from mbus
*/
prepareForm: function ()
{
//Initialisation
this.USB1 = false;
this.USB2 = false;
var interfaceClass = "";
var translatedParam2 = "";
var order = "";
//There is in minimum one device connected
if (this.objects.USB) {
this.objects.USB.each(function ( port) {
order = port.Port;
//Is there a device connected in port1
if ( order === "0" )
{
// Link Status 1
Sah.translator.change($("USB.linkStatus1"), "support.systeminformation.adsl.label.status.up", "1");
// Function 1
if ( port.Configuration["1"].Interface["1"] )
{
interfaceClass = port.Configuration["1"].Interface["1"].InterfaceClass;
}
translatedParam2 = "X " + Usb.ConnectionList.func[interfaceClass];
Sah.translator.change($("USB.function1"), "support.systeminformation.usb.func." + Usb.ConnectionList.func[interfaceClass], translatedParam2);
Sah.translator.change($("USB.vendorId1"), "support.systeminformation.usb.label.vendorid", port.VendorID);
Sah.translator.change($("USB.manufacturer1"), "support.systeminformation.usb.label.manufacturer", port.Manufacturer);
Sah.translator.change($("USB.productId1"), "support.systeminformation.adsl.label.productid", port.ProductID);
Sah.translator.change($("USB.product1"), "support.systeminformation.adsl.label.product", port.Product);
Sah.translator.change($("USB.serialNumber1"), "support.systeminformation.adsl.label.serialnumber",port.SerialNumber);
this.USB1 = true;
}
//Is there a device connected in port2
if ( order === "2" )
{
// Link Status 2
Sah.translator.change($("USB.linkStatus2"), "support.systeminformation.adsl.label.status.up", "1");
// Function 2
if ( port.Configuration["1"].Interface["1"] )
{
interfaceClass = port.Configuration["1"].Interface["1"].InterfaceClass;
}
translatedParam2 = "X " + Usb.ConnectionList.func[interfaceClass];
Sah.translator.change($("USB.function2"), "support.systeminformation.usb.func." + Usb.ConnectionList.func[interfaceClass], translatedParam2);
Sah.translator.change($("USB.vendorId2"), "support.systeminformation.usb.label.vendorid2", port.VendorID);
Sah.translator.change($("USB.manufacturer2"), "support.systeminformation.usb.label.manufacturer2", port.Manufacturer);
Sah.translator.change($("USB.productId2"), "support.systeminformation.adsl.label.productid2", port.ProductID);
Sah.translator.change($("USB.product2"), "support.systeminformation.adsl.label.product2", port.Product);
Sah.translator.change($("USB.serialNumber2"), "support.systeminformation.adsl.label.serialnumber2",port.SerialNumber);
this.USB2 = true;
}
},this);
}
//If there is no device connected in port1
if ( !this.USB1 )
{
// Link Status 1
Sah.translator.change($("USB.linkStatus1"), "support.systeminformation.adsl.label.status.down", "0");
// Function 1
Sah.translator.change($("USB.function1"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.vendorId1"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.manufacturer1"),"support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.productId1"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.product1"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.serialNumber1"), "support.systeminformation.usb.func.undefined", "X Undefined");
}
//If there is no device connected in port2
if ( !this.USB2 )
{
// Link Status 2
Sah.translator.change($("USB.linkStatus2"), "support.systeminformation.adsl.label.status.down", "0");
// Function 2
Sah.translator.change($("USB.function2"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.vendorId2"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.manufacturer2"),"support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.productId2"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.product2"), "support.systeminformation.usb.func.undefined", "X Undefined");
Sah.translator.change($("USB.serialNumber2"), "support.systeminformation.usb.func.undefined", "X Undefined");
}
}
});
Usb.ConnectionList.UpDown = {
"1" : "support.systeminformation.adsl.label.status.up",
"0" : "support.systeminformation.adsl.label.status.down"
};
Usb.ConnectionList.firstSecond = {
"1" : "first",
"2" : "second"
};
Usb.ConnectionList.func = {
"8": "massstorage",
"7" : "printer",
"3" : "phone",
"255" : "phone"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/tv.js */
/**
* @namespace Holds the services entity and its associated forms
*/
var Tv = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/tv/summary.js */
/**
* The TV summary form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Tv.Summary = Class.create(Sah.AuthenticatedForm,
/** @lends TV.Summary */
{
initialize: function ($super, form)
{
$super(form);
this.needs("Summary", { path: "TV.Summary", depth: -1 });
this.markAsLoading();
this.load();
},
/**
* called when the needed objects are loaded
*/
objectsLoaded: function ()
{
this.objects.ATM = this.objects.Summary.ATM;
this.objects.TVs = $A();
var is_DSL = Cookie.get( 'WanInterfaceConfig' ) || '';
/* The spec says that for FT/FR
* - 8/38 is VOD
* - 8/39 is zapping
* - 8/40 is channel 1
* - 8/41 is channel 2
*
* for FT/PL:
* - 8/38 is VOD
* - 8/39 is channel 1 + zapping
* - 8/40 is channel 2 + zapping
*/
this.objects.ATM.each(function (atm) {
if (appConfig == "fr") {
switch (atm.DestinationAddress) {
case "8/38":
this.objects.TVs[2] = atm;
this.objects.TVs[2].type = "vod";
this.objects.TVs[2].trLabel2 = ".vpvc";
break;
case "8/39":
this.objects.TVs[3] = atm;
this.objects.TVs[3].type = "zapping";
this.objects.TVs[3].trLabel2 = ".vpvc";
break;
case "8/40":
this.objects.TVs[0] = atm;
this.objects.TVs[0].type = "channel1";
this.objects.TVs[0].trLabel2 = ".vpvc";
break;
case "8/41":
this.objects.TVs[1] = atm;
this.objects.TVs[1].type = "channel2";
this.objects.TVs[1].trLabel2 = ".vpvc";
break;
}
} else if (appConfig == "pl") {
if (is_DSL === 'Ethernet'){
switch (atm.DestinationAddress) {
case "8/38":
atm.DestinationAddress = '838';
this.objects.TVs[2] = atm;
this.objects.TVs[2].type = "vod";
this.objects.TVs[2].trLabel2 = ".vlan";
break;
case "8/39":
atm.DestinationAddress = '839';
this.objects.TVs[0] = atm;
this.objects.TVs[0].type = "channel1";
this.objects.TVs[0].trLabel2 = ".vlan";
break;
}
} else {
switch (atm.DestinationAddress) {
case "8/38":
this.objects.TVs[2] = atm;
this.objects.TVs[2].type = "vod";
this.objects.TVs[2].trLabel2 = ".vpvc";
break;
case "8/39":
this.objects.TVs[0] = atm;
this.objects.TVs[0].type = "channel1";
this.objects.TVs[0].trLabel2 = ".vpvc";
break;
case "8/40":
this.objects.TVs[1] = atm;
this.objects.TVs[1].type = "channel2";
this.objects.TVs[1].trLabel2 = ".vpvc";
break;
}
}
}
},this);
this.prepareForm();
this.markAsLoaded();
},
/**
* fillup the select boxes with the right values from mbus
*/
prepareForm: function ()
{
var appendElement = function(elemUl, label, trLabel, num, trNum, param, trParam, classLi)
{
var elemLi = new Element("li");
var elemDivNum = new Element("div");
Sah.translator.change(elemDivNum, trNum, num);
var elemDivLabel = new Element("div");
Sah.translator.change(elemDivLabel, trLabel, label);
var elemDivValue = new Element("div");
if (trParam != "")
{
Sah.translator.change(elemDivValue, trParam, param);
}
else
{
elemDivValue.update(param);
}
elemLi.addClassName(classLi);
elemDivValue.addClassName("value");
elemDivNum.addClassName("number");
elemDivLabel.addClassName("description");
elemLi.appendChild(elemDivNum);
elemLi.appendChild(elemDivLabel);
elemLi.appendChild(elemDivValue);
elemUl.appendChild(elemLi);
};
var first = true;
var appendHeader = function(elemUl, label, trLabel)
{
var elemLi = new Element("li");
var elemDiv = new Element("div");
var elemH6 = new Element("h6");
var elemSpan = new Element("span");
Sah.translator.change(elemSpan, trLabel, label);
if (!first)
elemLi.setStyle({paddingTop: "20px"});
elemDiv.addClassName("label");
elemH6.appendChild(elemSpan);
elemDiv.appendChild(elemH6);
elemLi.appendChild(elemDiv);
elemUl.appendChild(elemLi);
first = false;
};
/* Update label's value */
var elemUl = new Element("ul");
elemUl.addClassName("list-systeminformation");
elemUl.setStyle({position: 'relative', display: 'block'});
var i=1;
var j=i;
if (this.objects.TVs) {
this.objects.TVs.each(function (tv) {
var translation = "support.systeminformation.tv." + tv.type + ".label";
appendHeader(elemUl,"X Channel: " + i, translation + ".title");
var num1 = "X 7.x";
var trNum1 = translation + ".nbstatus";
var label1 = "X Status";
var trLabel1 = translation + ".status";
/* in fiber mode status should be on otherwise we should read the status from the ATM intf */
var status = ((this.objects.Summary.WANInterfaceType == "Ethernet" && this.objects.Summary.WLANLedColor == "Green") || (tv.Enable && tv.Status == "Connected") ? "1" : "0");
var param1 = t( Tv.Summary.UpDown[status], status);
var trParam1 = Tv.Summary.UpDown[status];
appendElement(elemUl, label1, trLabel1, num1, trNum1, param1, trParam1, "odd");
var num2 = "X 7.x";
var trNum2 = translation + ".nbvpvc";
var label2 = "X VpVc";
var trLabel2 = translation + tv.trLabel2;
var param2 = tv.DestinationAddress;
var trParam2 = "";
appendElement(elemUl, label2, trLabel2, num2, trNum2, param2, trParam2, "even");
}, this);
this.form.appendChild(elemUl);
}
}
}
);
Tv.Summary.UpDown = {
"1": "support.systeminformation.adsl.label.status.up",
"0" : "support.systeminformation.adsl.label.status.down"
};
Tv.Summary.Connecting = {
"Connected" : "support.systeminformation.general.label.status.connected",
"Disconnected" : "support.systeminformation.general.label.status.disconnected",
"Synchronized" : "support.systeminformation.general.label.status.synchronized"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security.js */
/**
* @namespace Holds the wifi entity and its associated forms
*/
var Security = {};
Security.LevelDescription = {
"Faible_description": "advconfig.firewall.description.low",
"Moyen_description": "advconfig.firewall.description.medium",
"Eleve_description": "advconfig.firewall.description.high",
"Personal_description": "advconfig.firewall.description.customize"
// "Disabled": "<div align=\"justify\"><h4>Disabled</h4>"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security/upnp.js */
Security.Upnp = Class.create(Sah.AuthenticatedForm,{
initialize : function($super,form){
$super(form);
/* setup events */
$("bt_save").observe("click",this.onSave.bind(this));
$("bt_cancel").observe("click",this.onCancel.bind(this));
$("bt_update").observe("click",this.onUpdate.bind(this));
/* fetch needed data */
this.needs("UPNPService", { path: "igd.Services.$UPnP_IGD", depth: 0 });
/* prepare to load the objects we need */
this.needs("PortMappingRules", { path: "UPNP.PortMapping", depth: -1 });
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded : function () {
/* setup needed templates */
this.upnpTemplate = Sah.Templates['UPNP'];
this.upnpTemplate.callback = this.appendUpnp.bind(this);
this.hiddenElements= $A();
this.UPNP = $A();
this.objects.PortMappingRules.each(function (rule){
if(rule.$PortMappingCreator=="UPNP")
{
this.UPNP.push(rule);
}
},this);
this.upnpTemplate.apply(this.UPNP);
this.fromObject(this.objects);
this.form.enable();
this.markAsLoaded();
},
fillForm: function () {
this.hiddenElements= $A();
this.UPNP = $A();
this.objects.PortMappingRules._childs.each(function (rule){
if(rule.$PortMappingCreator=="UPNP")
{
this.UPNP.push(rule);
}
},this);
this.upnpTemplate.apply(this.UPNP);
this.fromObject(this.objects);
this.markAsLoaded();
this.form.show();
},
appendUpnp : function(element, upnp){
element.id = upnp._path;
/* show the lement form */
this.upnpTemplate.showForm(element);
/* when clicking delete remove the element */
element.del = element.down(".delete");
element.del.observe("click", this.onDisplayMsgBox.bind(this, element, upnp));
$('SecurityUpnp').down("tbody").insert(element);
},
deleteUpnp : function (element,upnp) {
element.hide();//http:localhost:4000/FT/AdvancedSettings_UPnP
/*Sah.translator.change($("upnp_error"), "advconfig.network.upnp.warning","X Applications which had created NAT rules with UPnP IGD may not work properly any more.");
$("config.lan.upnp").show();*/
this.hiddenElements.push(element);
},
onSave : function(event){
$("upnp_error").innerHTML="";
$("config.lan.upnp").hide();
if( this.hiddenElements.length > 0 )
{
this.markAsLoading();
this.hiddenElements.each(function (element){
element.sahObject._destroy({ onSuccess: this.deleteUpnpSuccess.bind(this, element),
onFailure: this.deleteUpnpFailure.bind(this, element) });
},this);
this.hiddenElements.clear();
}
this.objects.UPNPService._update(this.toObject().UPNPService);
if (this.objects.UPNPService._changed()) {
this.objects.UPNPService._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.logger.info("skipping save");
}
},
deleteUpnpSuccess: function (element,obj)
{
element.remove();
this.markAsLoaded();
},
deleteUpnpFailure: function (element,obj)
{
element.show();
this.logger.warn("Failed to remove"+ element.sahObject._path);
this.markAsLoaded();
},
onCancel : function ( event ) {
$("upnp_error").innerHTML="";
$("config.lan.upnp").hide();
this.hiddenElements.each(function (element){
element.show();
},this);
this.hiddenElements.clear();
},
onUpdate: function (event) {
event.stop();
this.markAsLoading();
$("upnp_error").innerHTML="";
$("config.lan.upnp").hide();
$("SecurityUpnp").select("tbody tr").each(function (tr) {
if (tr.sahObject)
tr.remove();
},this);
this.objects.PortMappingRules._childs = new Array();
this.objects.PortMappingRules._load({ onSuccess: this.fillForm.bind(this), onFailure: this.whenNotSaved.bind(this) });
},
whenSaved : function(obj){
// Nothing to do
},
whenNotSaved : function (obj) {
this.logger.warn("Failed to enable or disable the upnp");
},
onDisplayMsgBox: function(element,upnp,event)
{
event.stop(event);
ctl.msgbox.Show(ctl.msgbox.QUESTION.YES_NO,t('advconfig.network.upnp.warning','X Applications which had created NAT rules with UPnP IGD may not work properly any more. Are you sure to delete?'),undefined,(function(){this.deleteUpnp(element,upnp);}).bind(this));
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security/rule.js */
/**
* TODO: cleanup old documentation ...
* The security/rule form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Security.Rule = Class.create(Sah.AuthenticatedForm,
/** @lends Security.Rule# */
{
initialize: function ($super, form)
{
$super(form);
this.tbody = this.form.down("tbody");
this.description = this.form.down("select[name='Rule.Description']");
this.description.observe("change", this.onRuleChanged.bind(this));
document.observe("sah:admin:language:change",this.onLanguageChange.bind(this));
this.custom = $("rule_custom_description");
this.customDescription = this.custom.down("input[name='Rule.CustomDescription']");
this.custom.down("a").observe("click", this.resetRule.bind(this));
this.form.down(".SecurityRuleSave").observe("click", this.onSave.bind(this));
this.target = this.form.down("select[name='Rule.Target']");
this.needs("Rule", { path: "Security.CustomFirewallRules" });
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
var rules = $A();
/* Add tooltip */
this.form.down("input[name='Rule.SourcePort']").setAttribute("x-sah-tooltip",t("advconfig.firewalladv.tooltip.sourceport","X (ex:1000-2000)"));
this.form.down("input[name='Rule.DestinationPort']").setAttribute("x-sah-tooltip",t("advconfig.firewalladv.tooltip.destinationport","X (ex:1000-2000)"));
/* group identical rules */
this.objects.Rule.each(function (a) {
var dup = rules.detect(function (b) {
return (a.SourceIP == b.SourceIP &&
a.SourceIPMask == b.SourceIPMask &&
a.SourcePort == b.SourcePort &&
a.SourcePortRangeEnd == b.SourcePortRangeEnd &&
a.DestinationIP == b.DestinationIP &&
a.DestinationIPMask == b.DestinationIPMask &&
a.DestinationPort == b.DestinationPort &&
a.SourcePortRangeEnd == b.SourcePortRangeEnd);
});
if (dup) {
var orig = Object.clone(dup);
dup.Protocol = "both";
dup.Description = dup.Description.replace(/_(TCP|UDP)/, "");
dup._path = null;
dup.rules = $A([a, orig]);
} else {
rules.push(a);
}
}, this);
this.objects.CombinedRule = rules;
/* set the protocol text */
this.objects.CombinedRule.each(this.setRuleProtocolText.bind(this));
/* fetch the enabled/disabled rules */
var partition = this.objects.CombinedRule.partition(function (r) { return (r.Enable == "1"); });
this.objects.EnabledRules = partition[0];
this.objects.DisabledRules = partition[1];
/* fill the select box */
this.fillDescriptionSelect();
/* setup needed templates */
this.ruleTemplate = Sah.Templates['Rule'];
this.ruleTemplate.callback = this.appendRule.bind(this);
this.ruleTemplate.apply(this.objects.EnabledRules);
this.onRuleChanged();
this.form.enable();
this.markAsLoaded();
},
setRuleProtocolText: function (rule)
{
if (rule.Protocol == "6")
rule.ProtocolText = "TCP";
else if (rule.Protocol == "17")
rule.ProtocolText = "UDP";
else
rule.ProtocolText = t("advconfig.firewalladv.label.bothprotocol", "both");
},
fillDescriptionSelect: function ()
{
var select = this.description;
select.update("");
this.objects.DisabledRules.each(function (rule) {
var option = new Element("option");
option.update(rule.Description);
option.rule = rule;
select.insert(option);
}, this);
this.newRuleOption = new Element("option", { "value": "CUSTOM" });
this.newRuleOption.update(t("advconfig.firewalladv.label.editnewrule", "Edit New Rule"));
select.insert(this.newRuleOption);
},
loadRuleInForm: function (rule)
{
if (rule) {
this.fromObject({ "Rule": rule });
} else {
/* custom rules */
}
},
/**
* @param {Object} element element in the form
* @param {Object} rule an instance in sahbus
* Add each row of the template and create the event handler for buttons */
appendRule: function (element, rule)
{
element.id = rule._path;
rule._element = element;
if (rule.SourcePortRangeEnd != rule.SourcePort && rule.SourcePortRangeEnd!="")
{
element.down(".SourcePort").innerHTML = rule.SourcePort+"-"+ rule.SourcePortRangeEnd;
}
if (rule.DestinationPortRangeEnd != rule.DestinationPort && rule.DestinationPortRangeEnd!="")
{
element.down(".DestinationPort").innerHTML = rule.DestinationPort+"-"+ rule.DestinationPortRangeEnd;
}
/* when clicking delete remove the element */
element.del = element.down(".RuleDelete");
element.del.observe("click", this.onDelete.bind(this, element, rule));
this.tbody.insert(element);
},
setupRule: function (rule, tr)
{
var anyReg = new RegExp("^\s*(" + t("advconfig.firewalladv.label.bothprotocol", "both") + ")?\\s*$", "i");
var portRangeReg = new RegExp("^\\s*(\\d+)\\s*-\\s*(\\d+)\\s*$");
rule._update(this.toObject(tr).Rule);
if (!rule.Order.match(/^\d+$/))
rule.Order = null;
if (rule.SourceIP.match(anyReg))
rule.SourceIP = "";
if (rule.SourceIPMask.match(anyReg))
rule.SourceIPMask = "";
if (rule.SourcePort.match(anyReg))
rule.SourcePort = "0";
if (rule.DestinationIP.match(anyReg))
rule.DestinationIP = "";
if (rule.DestinationIPMask.match(anyReg))
rule.DestinationIPMask = "";
if (rule.DestinationPort.match(anyReg))
rule.DestinationPort = "0";
/* configure port */
var sourcePort = rule.SourcePort;
rule._parameters["SourcePortRangeEnd"]="";
if (sourcePort.match(portRangeReg)) {
rule.SourcePort = sourcePort.split("-")[0]; //RegExp.$1;
rule.SourcePortRangeEnd = sourcePort.split("-")[1];//RegExp.$2;
} else {
rule.SourcePortRangeEnd = rule.SourcePort;
}
var destinationPort = rule.DestinationPort;
rule._parameters["DestinationPortRangeEnd"]="";
if (destinationPort.match(portRangeReg)) {
rule.DestinationPort = destinationPort.split("-")[0];
rule.DestinationPortRangeEnd = destinationPort.split("-")[1] ; // RegExp.$2;
} else {
rule.DestinationPortRangeEnd = rule.DestinationPort;
}
rule.SourcePortExclude = "0";
rule.DestinationPortExclude = "0";
rule.protocolExclude = "0";
},
onRuleChanged: function ()
{
if (this.objects.EnabledRules.length == 0)
this.description.selectedIndex = this.description.options.length - 1;
var rule = this.description.options[this.description.selectedIndex].rule;
if (rule) {
this.loadRuleInForm(rule);
this.description.show();
this.custom.hide();
} else {
this.form.reset();
this.description.hide();
this.custom.show();
}
},
onSave: function (event)
{
Event.stop(event);
$("firewalladv_error").innerHTML="";
$("config.security.firewalladverror").hide();
var rule = this.description.options[this.description.selectedIndex].rule;
this.deleteRules(rule, this.saveRules.bind(this));
return false;
},
deleteRules: function (rule, handler)
{
if (rule && rule._path) {
rule._destroy(handler);
} else if (rule) {
rule.rules[0]._destroy(function (rule, handler) { rule._destroy(handler); }.bind(this, rule.rules[1], handler));
} else {
handler();
}
},
disableRules: function (rule, handler)
{
if (rule && rule._path) {
rule.Enable = "0";
rule._destroy(handler);
} else if (rule) {
rule.rules[0].Enable = "0";
rule.rules[1].Enable = "0";
rule.rules[0]._destroy(function (rule, handler) { rule._destroy(handler); }.bind(this, rule.rules[1], handler));
} else {
handler();
}
},
saveRules: function ()
{
var rule = this.description.options[this.description.selectedIndex].rule;
var json = null;
if (!rule) {
this.logger.info("adding custom rule");
json = this.toObject().Rule;
json.Enable = "0";
rule = this.objects.Rule._new(json);
}
this.setupRule(rule, this.form);
if (json) {
rule.Description = this.customDescription.getValue();
rule.CustomDescription = null;
}
if(!this.validateSecurityRule(rule)){
$("config.security.firewalladverror").show();
return false;
}
rule.Enable = "1";
rule.Target = (this.target.selectedIndex == 0 ? "Accept" : "Drop");
rule._setOrder("Target", "Enable", "Description", "SourceIP", "SourceIPMask",
"DestinationIP", "DestinationIPMask", "Protocol", "SourcePort",
"SourcePortRangeEnd", "DestinationPort", "DestinationPortRangeEnd");
if (rule.Protocol == "both") {
rule.rules = null;
this.saveRule(rule, [ 6, 17 ]);
} else {
this.saveRule(rule, [ rule.Protocol ]);
}
},
saveRule: function (rule, protocols, object)
{
if (object) {
if (rule.Protocol == "both") {
if (!rule.rules)
rule.rules = $A();
rule.Order = object.Order;
rule.rules.push(object);
} else {
rule = object;
}
}
var parameters = Object.clone(rule._getParameters([ "Target", "Enable", "Description", "SourceIP", "SourceIPMask",
"DestinationIP", "DestinationIPMask", "Protocol", "SourcePort",
"SourcePortRangeEnd", "DestinationPort", "DestinationPortRangeEnd" ]));
var protocol = protocols.shift();
if (protocol) {
if (rule.Protocol == "both") {
if (protocol == 6)
parameters.Description += "_TCP";
else
parameters.Description += "_UDP";
}
parameters.Protocol = protocol;
this.objects.Rule._add(this.saveRule.bind(this, rule, protocols), parameters, rule._getOrder());
} else {
this.whenSaved(rule);
}
},
whenSaved: function (rule)
{
this.logger.info("rule saved", rule);
this.setRuleProtocolText(rule);
this.ruleTemplate.apply(rule);
this.objects.EnabledRules.push(rule);
this.objects.DisabledRules = this.objects.DisabledRules.select(function (r) { return (r.Description != rule.Description); });
var tpl = $A(this.description.options).detect(function (o) { return (o.rule && o.rule.Description == rule.Description); });
if (tpl)
tpl.remove();
this.onRuleChanged();
},
onDelete: function (tr, rule)
{
this.disableRules(rule, this.whenDeleted.bind(this, tr, rule));
},
whenDeleted: function (tr, rule)
{
tr.remove();
/* var option = new Element("option");
option.update(rule.Description);
option.rule = rule;
this.newRuleOption.insert({ "before": option });
this.objects.DisabledRules.push(rule);
this.objects.EnabledRules = this.objects.EnabledRules.select(function (r) { return (r.Description != rule.Description); });*/
this.description.selectedIndex = 0;
this.onRuleChanged();
},
resetRule: function ()
{
this.description.selectedIndex = 0;
this.onRuleChanged();
},
validateSecurityRule: function (obj)
{
var bValid = true ;
if (!obj.Description.match(/\S/) || !obj.Description.match(/^([a-zA-Z0-9]*(\-)*(\_)*)*$/)) {
Sah.translator.change($("firewalladv_error"), "advconfig.firewalladv.error.description", "X Invalid application name");
return false;
}
if (obj.SourceIP.match(/\S/) && !Sah.IPAddress.isValid(obj.SourceIP)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.sourceip"," X Bad source ip address");
this.logger.info("Bad source ip address.");
return false;
}
if (obj.SourceIPMask.match(/\S/) && !Sah.IPAddress.isValidMask(obj.SourceIPMask)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.sourceipmask","Bad source ip mask");
this.logger.info("Bad source ip mask.");
return false;
}
if (obj.SourcePort.match(/^\s*0?\s*$/) || !Sah.Validations.isValidPort(obj.SourcePort)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.sourceport","Wrong source port. It should be a value between 1 to 65535");
this.logger.info("Wrong source port. It should be a value between 1 to 65535");
return false;
}
if (obj.SourcePortRangeEnd.match(/^\s*0?\s*$/) || !Sah.Validations.isValidPort(obj.SourcePortRangeEnd)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.sourcerange","Wrong source port. It should be a value between 1 to 65535");
this.logger.info("Wrong source port. It should be a value between 1 to 65535");
return false;
}
if (obj.DestinationIP.match(/\S/) && !Sah.IPAddress.isValid(obj.DestinationIP)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.destip", "Bad destination ip address");
this.logger.info("Bad destination ip address.");
return false;
}
if (obj.DestinationIPMask.match(/\S/) && !Sah.IPAddress.isValidMask(obj.DestinationIPMask) ) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.destipmask", "Bad Destination ip mask");
this.logger.info("Bad destination ip mask.");
return false;
}
if (obj.DestinationPort.match(/^\s*0?\s*$/) || !Sah.Validations.isValidPort(obj.DestinationPort)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.destport", "Wrong destination port. It should be a value between 1 to 65535.");
this.logger.info("Wrong destination port. It should be a value between 1 to 65535");
return false;
}
if (obj.DestinationPortRangeEnd.match(/^\s*0?\s*$/) || !Sah.Validations.isValidPort(obj.DestinationPortRangeEnd)) {
Sah.translator.change($("firewalladv_error"),"advconfig.firewalladv.error.destrange", "Wrong destination port. It should be a value between 1 to 65535.");
this.logger.info("Wrong destination port. It should be a value between 1 to 65535");
return false;
}
return true;
},
onLanguageChange : function (event)
{
this.form.down("input[name='Rule.SourcePort']").setAttribute("x-sah-tooltip",t("advconfig.firewalladv.tooltip.sourceport","X (ex:1000-2000)"));
this.form.down("input[name='Rule.DestinationPort']").setAttribute("x-sah-tooltip",t("advconfig.firewalladv.tooltip.destinationport","X (ex:1000-2000)"));
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security/ping.js */
/**
*
* Security Ping
*
*/
Security.Ping = Class.create(Sah.AuthenticatedForm,
/** @lends Security.Summary# */
{
initialize: function ($super, form)
{
$super (form);
/* when the form is submitted, call the onSave method of this class */
$$(".SecurityPingCancel").each(function (btn) {
btn.observe("click", this.onCancel.bind(this));
}, this);
$$(".SecurityPingSave").each(function (btn) {
btn.observe("click", this.onSave.bind(this));
}, this);
this.checkbox = this.form.down("input[name='SelectedLevel.RespondToPing']");
this.needs("SelectedLevel", { path: "Security.Firewall", depth: 0 });
this.load();
},
objectsLoaded : function ()
{
this.checkbox.checked = ((this.objects.SelectedLevel.RespondToPing == "1") ? true : false);
},
onSave: function (event)
{
event.stop(event);
this.objects.SelectedLevel.RespondToPing = (this.checkbox.checked ? "1" : "0");
if (this.objects.SelectedLevel._changed()) {
this.markAsLoading();
this.objects.SelectedLevel._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.logger.info("nothing has changed in Time, skipping save");
}
return false;
},
/**
* called when the form was correctly saved
*/
whenSaved: function (obj)
{
this.logger.info("object saved");
this.markAsLoaded();
this.objectsLoaded();
},
/**
* called when the form was not correctly saved
*/
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.markAsLoaded();
this.logger.warn(obj);
},
/**
* cancel all modifcations to the form
*/
onCancel: function(event)
{
Event.stop(event);
this.objects.SelectedLevel._resetParameters();
this.objectsLoaded();
return false;
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security/nat.js */
/**
* TODO: cleanup old documentation ...
* The security/rule form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Security.Nat = Class.create(Sah.AuthenticatedForm,
/** @lends Security.Rule# */
{
initialize: function ($super, form)
{
$super(form);
this.tbody = this.form.down("tbody");
this.application = this.form.down("select[name='Line.Name']");
this.application.observe("change", this.onAppChanged.bind(this));
this.custom = $("line_custom_box");
this.customName = this.form.down("input[name='Line.CustomName']");
this.custom.down("a").observe("click", this.resetName.bind(this));
this.host = this.form.down("select[name='Line.HostName']");
this.host.observe("change", this.onHostChanged.bind(this));
this.ip = this.form.down("input[name='Line.HostIPAddress']");
this.ipDiv = $("line_custom_host");
this.ipDiv.down("a").observe("click", this.resetHost.bind(this));
/* Add tooltip */
this.form.down("input[name='Line.OutboundPort']").setAttribute("x-sah-tooltip",t("advconfig.network.natpat.tooltip.externalport","X (ex:1000-2000)"));
this.form.down("input[name='Line.InboundPort']").setAttribute("x-sah-tooltip",t("advconfig.network.natpat.tooltip.internalport","X (ex:1000)"));
this.form.down(".SecurityNatSave").observe("click", this.onSave.bind(this));
this.needs("Nat", {path: "Security.Nat"});
this.needs("DHCP", {path: "Lan.DHCP"});
this.markAsLoading();
this.form.disable();
this.load();
},
appToLine: function (app)
{
if (!app.Rule) {
this.logger.error("invalid application (no Rule object)", app);
return null;
}
/* get the rules */
var tcp = app.Rule.detect(function (r) {return (r.Protocol == "TCP");});
var udp = app.Rule.detect(function (r) {return (r.Protocol == "UDP");});
/* if we have no matching rule, skip */
var rule = tcp || udp;
if (!rule) {
this.logger.error("invalid application (no tcp or udp rule)", app);
return null;
}
/* we should not use _new here. We should be able to create a fake object
* from a json object
*/
var line = app.Rule._new({"Name": null,
"HostIPAddress": null,
"OutboundPortRangeEnd": null,
"OutboundPort": null,
"InboundPort": null,
"HostName": null,
"Protocol": null});
line.app = app;
line.tcp = tcp;
line.udp = udp;
line.Name = app.Name;
line.HostIPAddress = app.HostIPAddress;
if (rule.OutboundPortRangeEnd == rule.OutboundPort)
line.OutboundPort = rule.OutboundPort;
else
line.OutboundPort = rule.OutboundPort + "-" + rule.OutboundPortRangeEnd;
line.InboundPort = rule.InboundPort;
line.host = this.hostsByIPs[app.HostIPAddress];
if (line.host)
line.HostName = line.host.$UserFriendlyName;
else
line.HostName = app.HostIPAddress;
if (line.tcp && line.udp) {
line.ProtocolDisplay = t("advconfig.network.natpat.label.bothprotocol", "X Both");
line.Protocol = "both";
} else {
line.ProtocolDisplay = line.Protocol = rule.Protocol;
}
this.linesByIPs[line.HostIPAddress] = line;
return line;
},
objectsLoaded: function ()
{
this.objects.AllHosts = this.objects.Nat.Host;
this.objects.Apps = this.objects.Nat.App;
/* filter hosts */
this.objects.Hosts = this.objects.AllHosts.select(function (h) {return (h.MACAddress != "00:00:00:00:00:00" && h.HostName != "localhost" && h.InterfaceType!="N/A");});
this.hostsByIPs = $H();
this.linesByIPs = $H();
this.objects.Hosts.each(function (h) {this.hostsByIPs[h.IPAddress] = h;}, this);
/* create the lines */
this.objects.Lines = this.objects.Apps.map(this.appToLine, this).select(function (l) {return (l != null);});
/* fetch the enabled/disabled lines */
var partition = this.objects.Lines.partition(function (l) {return l.HostIPAddress != "0.0.0.0";});
this.objects.EnabledLines = partition[0];
this.objects.DisabledLines = partition[1];
this.ipGW = new Sah.IPAddress(this.objects.DHCP.LANHostConfigManagement.IPRouters,
this.objects.DHCP.LANHostConfigManagement.SubnetMask);
/* fill the select boxe */
this.fillApplicationSelect();
this.fillHostSelect();
/* setup needed templates */
this.lineTemplate = Sah.Templates['Line'];
this.lineTemplate.callback = this.appendLine.bind(this);
this.lineTemplate.apply(this.objects.EnabledLines);
this.onAppChanged();
this.onHostChanged();
this.form.enable();
this.markAsLoaded();
},
fillApplicationSelect: function ()
{
var select = this.application;
select.update("");
this.objects.DisabledLines.each(function (line) {
var option = new Element("option");
option.update(line.Name);
option.line = line;
select.insert(option);
}, this);
this.newLineOption = new Element("option", {"value": "CUSTOM"});
Sah.translator.change(this.newLineOption, "advconfig.network.natpat.label.editnewline", "X New line");
select.insert(this.newLineOption);
},
fillHostSelect: function ()
{
var select = this.host;
select.update("");
this.objects.Hosts.each(function (host) {
var option = new Element("option");
option.update(host.$UserFriendlyName);
option.host = host;
select.insert(option);
}, this);
this.newIpOption = new Element("option", {"value": "CUSTOM"});
Sah.translator.change(this.newIpOption, "advconfig.network.natpat.label.editnewhost", "X New host");
select.insert(this.newIpOption);
},
loadLineInForm: function (line)
{
if (line) {
this.fromObject({"Line": line});
} else {
/* custom lines */
}
},
/**
* @param {Object} element element in the form
* @param {Object} line an instance in sahbus
* Add each row of the template and create the event handler for buttons */
appendLine: function (element, line)
{
element.id = line._path;
line._element = element;
if (!line.host)
this.lineTemplate.getElementForParameter(element, "HostName").update(line.HostIPAddress);
/* when clicking delete remove the element */
element.trash = element.down(".SecurityNatTrash");
element.trash.observe("click", this.onDelete.bind(this, element, line));
element.del = element.down(".SecurityNatDelete");
element.del.observe("click", this.onDelete.bind(this, element, line));
/* when activating/deactivating line */
element.enable = element.down("input[type=checkbox]");
element.enable.observe("click", this.onEnable.bind(this, element, line));
element.enable.checked = (line.app.Enable != "0");
this.tbody.insert(element);
},
saveApplication: function (line, tr)
{
if (line.custom)
line.Name = this.customName.getValue();
this.logger.info("using custom: " + line.custom);
if (line.Name=="") {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error","X the fields shoud not be empty");
return;
} else if (line.custom && !this.isNotAdded(line.Name)) {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error3","X this operation is forbidden and latest rule is not added.");
return;
} else if (!this.checkRuleConflict(line)) {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error4","X the new rule conflicts with previous one ");
return;
} else if (!this.checkRuleUpnpConflict(line)) {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error5","X the new rule conflicts with a existed upnp rule ");
return;
} else if (!Sah.Validations.isValidPort(line.InboundPort)
|| line.InboundPort.match(/-/)
|| !Sah.Validations.isValidPort(line.OutboundPort)
|| !this.isOrderedPort(line.OutboundPort)) {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error1","X the fields shoud be between .. and ..");
return;
} else if (!this.ipGW.canJoin(line.HostIPAddress)) {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error6","X the IP Address is invalid");
return;
} else if(!this.isNotRestricted(line.OutboundPort)) {
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.error2","X the port number should not be equal to 1701");
return;
} else {
this.markAsLoading();
if (!line.app) {
/* if we do not have an application line, add it */
line.app = this.objects.Apps._new({"HostIPAddress": line.HostIPAddress,
"Name": line.Name, "Enable": "1"});
this.objects.Apps._add(function (object) {
line.app = object;
/* we need to fetch the rule child because it is empty and so was not returned by mbus */
this.client.get(line.app._path + "/Rule", -1, function (object) {
line.app.Rule = object;
this.saveRules(line, tr);
}.bind(this));
}.bind(this), line.app._getParameters());
return;
} else {
line.app._update({"HostIPAddress": line.HostIPAddress,
"Name": line.Name, "Enable": 1});
if (line.app._changed()) {
line.app._save(this.saveRules.bind(this, line, tr));
} else {
this.logger.info("application has not changed, not saving");
this.saveRules(line, tr);
}
}
}
},
saveRules: function (line, tr)
{
if (line.Protocol == "both") {
line.ruleToSave = 2;
line.ProtocolDisplay = t("advconfig.network.natpat.label.bothprotocol", "X Both");
this.saveRule(line, tr, "TCP", line.tcp);
this.saveRule(line, tr, "UDP", line.udp);
} else if (line.tcp && line.udp) {
line.ruleToSave = 2;
line.ProtocolDisplay = line.Protocol;
if (line.Protocol == "TCP") {
line.udp._destroy(this.whenSaved.bind(this, line));
this.saveRule(line, tr, line.Protocol, line.tcp);
} else {
line.tcp._destroy(this.whenSaved.bind(this, line));
this.saveRule(line, tr, line.Protocol, line.udp);
}
} else {
line.ProtocolDisplay = line.Protocol;
line.ruleToSave = 1;
this.saveRule(line, tr, line.Protocol, line.udp || line.tcp);
}
},
saveRule: function (line, tr, protocol, rule)
{
var portRangeReg = new RegExp("^\\s*(\\d+)\\s*-\\s*(\\d+)\\s*$");
if (!rule) {
rule = line.app.Rule._new({"OutboundPort": null,
"OutboundPortRangeEnd": null,
"InboundPort": null,
"Protocol": protocol});
line[protocol.toLowerCase()] = rule;
}
rule.Protocol = protocol;
if (line.OutboundPort.match(portRangeReg)) {
rule.OutboundPort = RegExp.$1;
rule.OutboundPortRangeEnd = RegExp.$2;
} else {
rule.OutboundPort = line.OutboundPort;
rule.OutboundPortRangeEnd = line.OutboundPort;
}
rule.InboundPort = line.InboundPort;
if (rule._changed()) {
if (rule._path) {
rule._save(this.whenSaved.bind(this, line));
} else {
line.app.Rule._add(this.whenRuleSaved.bind(this, line, protocol.toLowerCase()), rule._getParameters());
}
} else {
this.whenSaved(line);
}
},
onAppChanged: function ()
{
var line = this.application.options[this.application.selectedIndex].line;
if (line) {
this.loadLineInForm(line);
this.application.show();
this.custom.hide();
this.host.show();
this.host.selectedIndex = 0;
this.ipDiv.hide();
this.ip.setValue(line.HostIPAddress);
} else {
this.customName.setValue("");
this.form.down("input[name='Line.OutboundPort']").setValue("");
this.form.down("input[name='Line.InboundPort']").setValue("");
this.application.hide();
this.custom.show();
}
},
onHostChanged: function ()
{
var host = this.host.options[this.host.selectedIndex].host;
if (host) {
this.host.show();
this.ipDiv.hide();
this.ip.setValue(host.IPAddress);
} else {
this.ipDiv.show();
this.host.hide();
}
},
onSave: function (event)
{
Event.stop(event);
Sah.translator.change($("warning_msg"), "advconfig.network.natpat.label.warning","X warning : make sure you have not filtered these ports in the firewall.");
var line = this.application.options[this.application.selectedIndex].line;
if (!this.application.visible() || !line) {
/* should not use _new here */
line = this.objects.Apps._new({"Name": null,
"HostIPAddress": null,
"OutboundPortRangeEnd": null,
"OutboundPort": null,
"InboundPort": null,
"HostName": null,
"Protocol": null});
line.custom = true;
}
line._update(this.toObject().Line);
if (this.host.visible()) {
var host = this.host.options[this.host.selectedIndex].host;
line.HostIPAddress = host.IPAddress;
} else {
line.HostIPAddress = this.ip.getValue();
}
this.saveApplication(line, this.form);
return false;
},
whenRuleSaved: function (line, protocol, object)
{
this.logger.info("setting rule path to " + object._path);
line[protocol] = object;
this.whenSaved(line);
},
whenSaved: function (line)
{
line.ruleToSave--;
if (line.ruleToSave > 0)
return;
this.logger.info("line saved", line);
this.lineTemplate.apply(line);
this.objects.EnabledLines.push(line);
this.objects.DisabledLines = this.objects.DisabledLines.select(function (l) {return (l.Name != line.Name);});
if (!line.custom)
$A(this.application.options).detect(function (o) {return (o.line && o.line.Name == line.Name);}).remove();
this.application.selectedIndex = 0;
this.host.selectedIndex = 0;
this.onAppChanged();
this.onHostChanged();
this.markAsLoaded();
},
onDelete: function (tr, line)
{
line.app.HostIPAddress = "0.0.0.0";
line.app.Enable ="0";
line.app._save(this.whenDeleted.bind(this, tr, line), "HostIPAddress");
},
whenDeleted: function (tr, line)
{
tr.remove();
var option = new Element("option");
option.update(line.Name);
option.line = line;
this.newLineOption.insert({"before": option});
this.objects.DisabledLines.push(line);
line.custom = false;
this.objects.EnabledLines = this.objects.EnabledLines.select(function (l) {return (l.Name != line.Name);});
},
onEnable: function (el, line, event)
{
event.stop();
line.app.Enable = (el.enable.checked ? "1" : "0");
if (line.app._changed())
line.app._save(function () {el.enable.checked = (line.app.Enable != "0");}, "Enable");
},
resetName: function ()
{
this.application.selectedIndex = 0;
this.onAppChanged();
},
resetHost: function ()
{
this.host.selectedIndex = 0;
this.onHostChanged();
},
isNotRestricted : function (port)
{
var portsRef = this._parsPorts(port);
var restricteds = [
this._parsPorts('1701'),
this._parsPorts('1812'),
this._parsPorts('1813')
];
for(var i=0; i < restricteds.length; i++){
if(!this._checkPortRange(portsRef, restricteds[i])){
return false;
}
}
return true;
},
isOrderedPort : function (port)
{
var ports = this._parsPorts(port, 65536);
if(ports.f < ports.l)
return true;
return false;
},
isNotAdded : function (name)
{
this.logger.info("check for duplicate application");
var rule = this.objects.Apps.detect(function(name,e){return e.Name == name;}.curry(name));
if(rule)
{
this.logger.info("application already exists");
this.isExistedRuleName = true;
return false ;
}
this.isExistedRuleName = false;
return true ;
},
checkRuleConflict : function (line)
{
var portsRef = this._parsPortsInOut(line.InboundPort, line.OutboundPort);
var lines = this.objects.EnabledLines.toArray();
for ( var i = 0; i <lines.length; i++){
if((lines[i].Protocol == line.Protocol || lines[i].Protocol =="both" || line.Protocol=="both")
&& !this._checkPortRanges(portsRef, this._parsPortsInOut(lines[i].InboundPort, lines[i].OutboundPort),
lines[i].HostIPAddress === line.HostIPAddress)){
return false;
}
}
return true;
},
checkRuleUpnpConflict : function (line)
{
var portsRef = this._parsPortsInOut(line.InboundPort, line.OutboundPort);
var lines = this.objects.Nat.PortMapping.toArray();
for ( var i = 0; i <lines.length; i++){
if((lines[i].PortMappingProtocol == line.Protocol || lines[i].PortMappingProtocol =="both" || line.Protocol=="both")
&& !this._checkPortRanges(portsRef,
this._setupPorts(lines[i].InternalPort, lines[i].$InternalPortEnd,
lines[i].ExternalPort, lines[i].$ExternalPortEnd),
lines[i].InternalClient === line.HostIPAddress)){
return false;
}
}
return true;
},
_parsPorts:function(port, range){
var tmp;
var ret = /^\s*(\d+)\s*(-\s*(\d+)\s*)?$/.exec(port);
return {f:tmp=parseInt(ret[1]),l:parseInt(ret[3]) || tmp + (range || 0)};
},
_parsPortsInOut:function(inp, outp){
outp = this._parsPorts(outp);
inp = this._parsPorts(inp, outp.l - outp.f)
return {inp:inp, outp:outp};
},
_checkPortRanges:function(a, b, sameHost){
return (sameHost === false || (a.inp.l < b.inp.f || a.inp.f > b.inp.l))
&& (a.outp.l < b.outp.f || a.outp.f > b.outp.l);
},
_checkPortRange:function(a, b){
return (a.l < b.f || a.f > b.l);
},
_setupPorts:function(inpf, inpl, outf, outl){
return {
inp:{f:parseInt(inpf),l:parseInt(inpl)},
outp:{f:parseInt(outf),l:parseInt(outl)}
};
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security/level.js */
/**
* TODO: documentation
* Security Level
*
*/
Security.Level = Class.create(Sah.AuthenticatedForm,
/** @lends Security.Level# **/
{
initialize: function ($super, form)
{
$super(form);
/* initialize events handler */
$$(".SecurityLevelCustomize").each(function (b) { b.observe("click", this.onSave.bind(this, true)); }, this);
$$(".SecurityLevelSave").each(function (b) { b.observe("click", this.onSave.bind(this, false)); }, this);
$$(".SecurityLevelCancel").each(function (b) { b.observe("click", this.onCancel.bind(this)); }, this);
/* when the user chose customize, enable the customize button */
this.form.down("input[name='Firewall.SelectedLevel'][value='Personal']").observe("click", this.toggleCustomize.bind(this, true));
this.form.down("input[name='Firewall.SelectedLevel'][value='Faible']").observe("click", this.toggleCustomize.bind(this, false));
this.form.down("input[name='Firewall.SelectedLevel'][value='Moyen']").observe("click", this.toggleCustomize.bind(this, false));
this.form.down("input[name='Firewall.SelectedLevel'][value='Eleve']").observe("click", this.toggleCustomize.bind(this, false));
/* prepare to load the objects we need (Firewall) */
this.needs("Firewall", { path: "Security.Firewall" });
this.form.disable();
this.load();
},
getLevelRadios: function ()
{
return $$("input[name='Firewall.SelectedLevel']");
},
getSelectedLevelRadio: function ()
{
return this.getLevelRadios().detect(function (r) { return r.checked; });
},
toggleCustomize: function (enable)
{
if (enable)
$$(".SecurityLevelCustomize").each(function (b) { b.enable(); });
else
$$(".SecurityLevelCustomize").each(function (b) { b.disable(); });
if(this.form.down("input[name='Firewall.SelectedLevel'][value='Eleve']").checked)
{
$("config.wan.firewallHigh").show();
Sah.translator.change($("firewallHigh_warn"), "advconfig.firewall.label.warn","X Applications (ex: LiveMessenger, peer-to-peer applications, games) relying on the NAT-traversal facilities provided by UPnP IGD will not work properly any more.");
}
else
{
$("firewallHigh_warn").innerHTML="";
$("config.wan.firewallHigh").hide();
}
},
objectsLoaded : function ()
{
this.getLevelRadios().each(function (input) {
input.checked = (input.value == this.objects.Firewall.CurrentLevel.Name);
}, this);
this.form.enable();
/* disable customize button if we do not have the customized level set */
this.toggleCustomize(this.objects.Firewall.CurrentLevel.Name == "Personal");
},
onSave: function (customize, event)
{
Event.stop(event);
this.makeBusy();
/* fetch the name */
var name = this.getSelectedLevelRadio().value;
/* fetch the key */
var newLevel = this.objects.Firewall.Level.detect(function (l) { return (l.Name == name); });
/* Set the path of the selected Level into the parameter (Firewall.SelectedLevel) */
this.objects.Firewall.SelectedLevel = $TB("InternetGatewayDevice.$Firewall.Level." + newLevel._name);
if (this.objects.Firewall._changed()) {
if (customize)
this.markAsLoading();
this.objects.Firewall._save({ onSuccess: this.whenSaved.bind(this, customize), onFailure: this.whenNotSaved.bind(this) });
}
else {
this.logger.info("nothing has changed, skipping save");
/* if the customize button was clicked, go the customize page */
if (customize)
this.redirect("/advConfigFirewallAdv.html");
}
return false;
},
whenSaved: function (customize, obj)
{
this.logger.info("object saved");
this.makeIdle();
/* if the customize button was clicked, go the customize page */
if (customize)
this.redirect("/advConfigFirewallAdv.html");
this.markAsLoaded();
},
whenNotSaved: function (obj)
{
this.markAsLoaded();
this.makeIdle();
/* TODO: fixup logging */
this.logger.warn("failed to save object");
},
/**
* When clicking cancel, restore the old values in the form and stop the event
*/
onCancel: function(event)
{
Event.stop(event);
this.objects.Firewall._resetParameters();
this.objectsLoaded();
return false;
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/security/dmz.js */
/**
* The security/DMZ form
* @class
* @augments Sah.Form
*/
Security.Dmz = Class.create(Sah.AuthenticatedForm,
/** @lends Security.DMZ# */
{
initialize: function ($super, form)
{
$super(form);
this.createButton = $('Security/DMZ/Create');
this.createButton.observe('click', this.createDMZ.bind(this));
this.destroyButton = $('Security/DMZ/Delete');
this.destroyButton.observe('click', this.destroyDMZ.bind(this));
this.destroyImage = $('Security/DMZ/TrashDelete');
this.destroyImage.observe('click', this.destroyDMZ.bind(this));
this.deviceSelect = this.form.down("select[name='PortMapping.InternalClient']");
this.status = $('SecurityDmzStatus');
this.ipAddress = $('DeviceIPAddress');
this.macAddress = $('DeviceMACAddress');
this.inputIp = this.form.down("input[name='Device.inputIPAddress']");
this.formIpAddress = $('Device.IPAddress');
this.formMacAddress = $('Device.MACAddress');
this.deviceName = $('DeviceName');
this.currentDevice = null;
this.needs("DMZ", {
path: "Security.DMZ"
});
this.needs("Rule", {
path: "igd.InternetGatewayDevice.Firewall.Chain.FORWARD_dmz.Rule",
notation: "key"
});
this.needs("DHCP", {
path: "Lan.DHCP"
});
this.createRequestLeft = 0;
this.destroyRequestLeft = 0;
this.markAsLoading();
this.form.disable();
this.load();
},
getDmzPortMappings: function ()
{
return this.objects.DMZ.PortMapping._childs.select(function (pm) {
return (pm.ExternalPort == "0" && pm.PortMappingDescription == "DMZ_GUI");
});
},
getIPAddress: function ()
{
return this.objects.PortMappings[0] && this.objects.PortMappings[0].InternalClient;
},
getDeviceForIP: function (ip)
{
return this.objects.Devices.detect(function (host) {
return (host.IPAddress == ip);
});
},
objectsLoaded: function ()
{
this.objects.Devices = this.objects.DMZ.Host._childs.select(function (host) {
return (host.IPAddress != "0.0.0.0" && host.HostName != "localhost" && host.InterfaceType!="N/A" && host.AddressSource == "Static");
});
this.objects.PortMappings = this.getDmzPortMappings();
this.objects.DMZEnabled = (this.objects.PortMappings.length > 0);
if (this.objects.DMZEnabled) {
this.logger.info("DMZ is enabled");
this.currentDevice = this.getDeviceForIP(this.getIPAddress());
} else {
this.logger.info("DMZ is disabled");
this.currentDevice = this.objects.Devices[0];
}
this.ipGW = new Sah.IPAddress(
this.objects.DHCP.LANHostConfigManagement.IPRouters,
this.objects.DHCP.LANHostConfigManagement.SubnetMask)
this.prepareForm();
this.form.enable();
this.fillForm();
this.deviceSelect.observe("change", this.changeDevice.bind(this));
this.markAsLoaded();
},
prepareForm: function ()
{
this.objects.Devices.each(function (host) {
var option = new Element("option", {
"value": host.IPAddress
});
option.update(host.$UserFriendlyName);
option.host = host;
this.deviceSelect.insert(option);
}, this);
var option = new Element("option", {
"value": "custom"
});
Sah.translator.change(option, "advconfig.network.dmz.label.staticip","X Static IP...");
this.deviceSelect.insert(option);
},
fillForm: function ()
{
this.deviceSelect.hide();
this.deviceName.hide();
this.inputIp.hide();
this.ipAddress.hide();
this.formIpAddress.hide();
this.formMacAddress.hide();
if (this.currentDevice) {
this.deviceSelect.setValue(this.currentDevice.IPAddress);
this.deviceName.update(this.currentDevice.$UserFriendlyName);
this.formIpAddress.update(this.currentDevice.IPAddress);
this.ipAddress.update(this.currentDevice.IPAddress);
this.macAddress.update(this.currentDevice.MACAddress);
this.formMacAddress.update(this.currentDevice.MACAddress);
} else {
this.inputIp.setValue(this.getIPAddress());
this.formIpAddress.update(this.getIPAddress());
this.ipAddress.update(this.getIPAddress());
this.macAddress.update("");
this.formMacAddress.update("");
Sah.translator.change(this.deviceName,"advconfig.network.dmz.label.staticip","X Static IP..."); //.update("Static IP address");
}
if (this.objects.DMZEnabled) {
this.createButton.disable();
this.showDevice();
this.ipAddress.show();
this.deviceName.show();
this.status.update(this.getIPAddress());
this.status.removeClassName("translation");
} else {
this.createButton.enable();
this.hideDevice();
this.deviceSelect.show();
if (this.currentDevice) {
this.formMacAddress.show();
this.formIpAddress.show();
} else {
this.inputIp.show();
}
Sah.translator.change(this.status, "advconfig.network.dmz.label.nodmz","X none");
}
},
changeDevice: function ()
{
this.currentDevice = this.deviceSelect.options[this.deviceSelect.selectedIndex].host || false;
this.fillForm();
},
createDMZ: function ()
{
// Initialize warning by default
Sah.translator.change($("advconfig.network.dmz"),"advconfig.network.dmz.label.warning","X you need to associate a static IP address with this device on the DHCP settings");
if (this.createRequestLeft > 0) {
this.logger.error("already creating dmz");
return;
}
var ip = null;
var parameters = {
"$PortMappingCreator": "NAT",
"PortMappingDescription": "DMZ_GUI",
"RemoteHost": "0.0.0.0",
"ExternalPort": "0",
"InternalPort": "0",
"InternalClient": ip,
"PortMappingProtocol": "UDP"
};
// The case of adding static address
if (!this.currentDevice)
{
// IP Address should be validated
if (this.validateForm(this.inputIp.getValue()))
{
//this.markAsLoading();
ip = this.inputIp.getValue();
this.markAsLoading();
parameters = {
"$PortMappingCreator": "NAT",
"PortMappingDescription": "DMZ_GUI",
"RemoteHost": "0.0.0.0",
"ExternalPort": "0",
"InternalPort": "0",
"InternalClient": ip,
"PortMappingProtocol": "UDP"
};
this.objects.DMZ.PortMapping._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
parameters.PortMappingProtocol = "TCP";
this.objects.DMZ.PortMapping._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
parameters = {
"Target": "Accept",
"Protocol": "6",
"SourceInterface": this.objects.DMZ.WANConnection
};
this.objects.Rule._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
parameters.Protocol = "17";
this.objects.Rule._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
}
else
{
Sah.translator.change($("advconfig.network.dmz"),"advconfig.network.dmz.error.ipaddress.bad","X Bad IP Address");
}
}
// The case of adding connected device
else
{
ip = this.currentDevice.IPAddress;
this.markAsLoading();
parameters = {
"$PortMappingCreator": "NAT",
"PortMappingDescription": "DMZ_GUI",
"RemoteHost": "0.0.0.0",
"ExternalPort": "0",
"InternalPort": "0",
"InternalClient": ip,
"PortMappingProtocol": "UDP"
};
this.objects.DMZ.PortMapping._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
parameters.PortMappingProtocol = "TCP";
this.objects.DMZ.PortMapping._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
parameters = {
"Target": "Accept",
"Protocol": "6",
"SourceInterface": this.objects.DMZ.WANConnection
};
this.objects.Rule._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
parameters.Protocol = "17";
this.objects.Rule._add(this.createDone.bind(this), parameters);
this.createRequestLeft++;
}
},
createDone: function ()
{
this.createRequestLeft--;
this.logger.info("" + this.createRequestLeft + " create request left to process");
if (this.createRequestLeft > 0)
return;
/* the dmz has been added */
this.logger.info("dmz created");
this.objects.DMZEnabled = true;
this.objects.PortMappings = this.getDmzPortMappings();
var ip = this.getIPAddress();
this.logger.info("dmz ip address is " + ip);
this.currentDevice = this.getDeviceForIP(ip);
this.fillForm();
this.markAsLoaded();
},
destroyDMZ: function ()
{
if (this.destroyRequestLeft > 0) {
this.logger.error("already destroying dmz");
return;
}
this.markAsLoading();
this.logger.info( this.destroyRequestLeft );
this.objects.PortMappings.each(function (pm) {
this.destroyRequestLeft++;
pm._destroy(this.destroyDone.bind(this));
}, this);
this.objects.Rule._each(function (pm) {
this.destroyRequestLeft++;
pm._destroy(this.destroyDone.bind(this));
}.bind(this));
},
destroyDone: function ()
{
this.destroyRequestLeft--;
this.logger.info("" + this.destroyRequestLeft + " destroy request left to process");
if (this.destroyRequestLeft > 0)
{
return;
}
/* the dmz has been destroyed */
this.logger.info("dmz destroyed");
this.objects.DMZEnabled = false;
this.objects.PortMappings = this.getDmzPortMappings();
this.currentDevice = this.objects.Devices[0];
this.fillForm();
this.markAsLoaded();
},
showDevice: function ()
{
$$(".DmzDevice").each(Element.show);
$$(".NoDmz").each(Element.hide);
},
hideDevice: function ()
{
$$(".DmzDevice").each(Element.hide);
$$(".NoDmz").each(Element.show);
},
validateForm : function (IPAddress)
{
if (!this.ipGW.canJoin(IPAddress)) {
return false;
}
return true;
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/auth.js */
Sah.Auth = Class.create(
/** @lends Sah.Auth# */
{
/**
* @class Takes care of authentication
* @constructs
*/
initialize: function ()
{
},
/**
* Check if a user is authenticated
*/
authenticate: function ()
{
var sessid = Cookie.get('sessid');
return sessid && sessid.match(/\w/);
},
/**
* current user logged in
*/
username: function ()
{
return Cookie.get('login');
},
/**
* Authenticate user
*/
login: function (username, password, handlers)
{
if (username.match(/^\s*$/)) {
handlers["onFailure"](null, null);
return;
}
var localHandlers = Sah.decorateHandlers(this, handlers, {
onSuccess: function (oldHandler, object, response) {
/* work arround for FF bug #488605 */
if (!object) {
handlers["onFailure"](null, response);
return;
}
Cookie.set('login', username);
oldHandler(object, response);
}
});
localHandlers.method = "get";
localHandlers.parameters = { "username": username, "password" : password };
new Ajax.Request("/authenticate", localHandlers);
},
/**
* Logout
*/
logout: function(handler)
{
Cookie.unset('sessid');
new Ajax.Request("/logout", { onComplete: handler, method: "get" });
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/login.js */
var Login = Class.create(Sah.Form,
/** @lends Login# */
{
initialize: function ($super, form)
{
$super(form);
this.logout = $("header-controls-login");
this.loggedInUsername = $("logged_in_username");
this.logoutLink = $("logout_link");
this.auth = new Sah.Auth(this.client);
this.isAuthenticated = false;
if (this.auth.authenticate())
this.makeAuthenticated();
else
this.notAuthenticated();
if (this.logoutLink)
this.logoutLink.observe("click", this.doLogout.bind(this));
this.form.observe("submit", this.doLogin.bind(this));
this.form.observe("sah:login", this.doLogin.bind(this));
Event.observe(document, "sah:redirect", this.tryRedirect.bind(this));
this.load();
},
makeAuthenticated: function ()
{
this.logger.info("user is authenticated");
/* if a redirect is needed, do it */
if (this.nextLocation) {
window.location = this.nextLocation;
this.nextLocation = null;
return;
}
Sah.Forms.each(function (form) {
if (form.authenticated) {
form.form.up("div").show();
form.load();
}
});
$$(".restricted").each(function (e) { e.show(); });
$$(".not-restricted").each(function (e) { e.hide(); });
$$(".auth-failure").each(function (e) { e.hide(); });
$$(".auth-success").each(function (e) { e.hide(); });
$$(".auth-failure-no-login-pass").each(function (e) { e.hide(); });
if (this.loggedInUsername)
this.loggedInUsername.update(this.auth.username());
if (this.logout)
this.logout.show();
this.isAuthenticated = true;
this.form.hide();
},
notAuthenticated: function (parameter)
{
this.logger.info("user is not authenticated");
var re = new RegExp("^" + appUrl + "/(legal.html|index.html)?$");
if (!window.location.pathname.match(re)||(parameter && parameter== "logout" && window.location.href.toUpperCase().startsWith("HTTPS")))
this.redirect("/");
Sah.Forms.each(function (form) {
if (form.authenticated) {
form.form.up("div").hide();
}
});
$$(".restricted").each(function (e) { e.hide(); });
$$(".auth-failure").each(function (e) { e.hide(); });
$$(".auth-failure-no-login-pass").each(function (e) { e.hide(); });
$$(".auth-success").each(function (e) { e.hide(); });
$$(".not-restricted").each(function (e) { e.show(); });
$$(".auth-no-failure").each(function (e) { e.show(); });
if (this.logout)
this.logout.hide();
window.authenticated = false;
this.form.show();
},
noLoginPass: function ()
{
Sah.Forms.each(function (form) {
if (form.authenticated) {
form.form.up("div").hide();
}
});
$$(".restricted").each(function (e) { e.hide(); });
$$(".not-restricted").each(function (e) { e.show(); });
$$(".auth-failure").each(function (e) { e.hide(); });
$$(".auth-failure-no-login-pass").each(function (e) { e.show(); });
$$(".auth-success").each(function (e) { e.hide(); });
$$(".auth-no-failure").each(function (e) { e.hide(); });
},
doLogout: function (event)
{
this.isAuthenticated = false;
this.auth.logout(this.notAuthenticated.bind(this,"logout"));
},
doLogin: function (event)
{
this.logger.info("loging in");
event.stop(event);
if ($F("Username").match(/^\s*$/) || $F("Password").match(/^\s*$/)) {
this.noLoginPass();
return false;
}
this.auth.login($F("Username"), $F("Password"), {
onSuccess: this.authSuccessfull.bind(this),
onFailure: this.authFailure.bind(this)
});
return false;
},
authSuccessfull: function (object)
{
this.makeAuthenticated();
$$(".auth-success").each(function (e) { e.show(); });
$$(".auth-no-failure").each(function (e) { e.show(); });
ctl.popup.Close();
},
authFailure: function ()
{
this.notAuthenticated();
$$(".auth-no-failure").each(function (e) { e.hide(); });
$$(".auth-failure").each(function (e) { e.show(); });
},
tryRedirect: function (event)
{
var location = appUrl + event.memo;
this.logger.info("trying to redirect to " + location);
if (!this.isAuthenticated && location != appUrl + "/") {
this.nextLocation = location;
this.showPopup();
} else {
this.nextLocation = null;
window.location = location;
}
},
showPopup: function ()
{
this.logger.info("requesting login popup");
ctl.popup.Load(Sah.link("/homeAuthentification.html"));
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan.js */
/**
* @namespace Holds the lan entity and its associated forms
*/
var Lan = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/static.js */
Lan.Static = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/static/ip.js */
/**
* TODO: cleanup old documentation code
* The lan static ip form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Lan.Static.Ip = Class.create(Sah.AuthenticatedForm,
/** @lends Lan.Static.Ip# */
{
initialize: function($super, form)
{
$super(form);
/* setup events */
$$(".LanStaticIpAdd").each(function (b) {
b.observe("click", this.onSave.bind(this));
}, this);
this.host = this.form.down("select[name='StaticIP.Host']");
this.host.observe("change", this.onHostChanged.bind(this));
this.needs("DHCP", {
path: "Lan.DHCP"
});
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded: function()
{
this.HostsByMac = {};
this.IPsByMac = {};
this.objects.Host = this.objects.DHCP.Hosts.select(function (h) {
return (h.HostName != "localhost" && h.InterfaceType!="N/A" && h.MACAddress != "00:00:00:00:00:00");
});
this.objects.Host.each(function (h) {
this.HostsByMac[h.MACAddress] = h;
}, this);
this.objects.DHCP.Lease.each(function (l) {
var host = this.HostsByMac[l.MACAddress];
if (host)
l.Name = host.$UserFriendlyName;
else
l.Name = t("advconfig.network.dhcp.label.unknownname", "unknown (%1)", l.MACAddress);
}, this);
/* get the bridge default DHCP Pool */
this.objects.DHCP.Pool.each(function (pool)
{
if (pool.Name === "bridge_default")
{
this.objects.BridgePool= "DHCP.Server.Pool."+pool._name;
}
},this);
this.objects.Lease = this.objects.DHCP.Lease.select(function (l) {
return (l.Reserved == "0");
});
this.objects.DHCPStaticAddress = this.objects.DHCP.DHCPStaticAddress;
this.objects.DHCPStaticAddress.each(function (ip) {
this.IPsByMac[ip.Chaddr] = ip;
}, this);
Sah.set({staticIPs:this.IPsByMac});
this.fillHostSelect();
/* setup needed templates */
this.ipTemplate = Sah.Templates.Ip;
this.ipTemplate.callback = this.appendIp.bind(this);
this.ipTemplate.apply(this.objects.DHCPStaticAddress._childs);
this.form.enable();
this.onHostChanged();
this.markAsLoaded();
},
setIpHost: function (ip)
{
var host = this.HostsByMac[ip.Chaddr];
if (host) {
ip._host = host;
ip.Name = host.$UserFriendlyName;
} else {
ip.Name = t("advconfig.network.dhcp.label.unknownname", "unknown (%1)", ip.Chaddr);
}
},
/**
* @param {Object} element element in the form
* @param {Object} ip an instance in sahbus
*Add each row of the template and create the event handler for buttons */
appendIp: function (element, ip)
{
element.id = ip._path;
this.setIpHost(ip);
this.ipTemplate.getElementForParameter(element, "Name").update(ip.Name);
/* when clicking delete remove the element */
element.del = element.down(".LanStaticIpDelete");
element.del.observe("click", this.deleteIp.bind(this, element, ip));
$('LanStaticIp').down("tbody").insert(element);
},
fillHostSelect: function ()
{
var select = this.host;
select.update("");
this.objects.Lease.each(function (l) {
if (this.IPsByMac[l.MACAddress] || l.PoolReference != this.objects.BridgePool )
{
return true;
}
if(this.HostsByMac[l.MACAddress] )
{
var option = new Element("option");
option.update(this.HostsByMac[l.MACAddress].$UserFriendlyName);
option.host = this.HostsByMac[l.MACAddress];
select.insert(option);
}
}, this);
this.newIpOption = new Element("option", {
"value": "CUSTOM"
});
Sah.translator.change(this.newIpOption, "advconfig.network.dhcp.label.editnewlease","X Edit New Lease");
select.insert(this.newIpOption);
},
onHostChanged: function ()
{
this.loadHostInForm(this.host.options[this.host.selectedIndex].host);
},
loadHostInForm: function (host)
{
this.form.down("input[name='StaticIP.Yiaddr']").enable();
if (host) {
this.form.down("input[name='StaticIP.Yiaddr']").setValue(host.IPAddress);
this.form.down("input[name='StaticIP.Chaddr']").setValue(host.MACAddress);
} else {
/* custom hosts */
//this.form.down("input[name='StaticIP.Yiaddr']").disable();
this.form.down("input[name='StaticIP.Yiaddr']").setValue("");
this.form.down("input[name='StaticIP.Chaddr']").setValue("");
}
},
/**
* This function used for deleting an instance in sahbus
*/
deleteIp: function (element, ip)
{
ip._destroy(this.whenDeleted.bind(this, element, ip));
},
whenDeleted: function (tr, ip)
{
tr.remove();
var host = this.HostsByMac[ip.Chaddr];
if (host) {
var option = new Element("option");
option.update(host.$UserFriendlyName);
option.host = host;
this.newIpOption.insert({
"before": option
});
}
},
onSave: function (event)
{
Event.stop(event);
$("advconfig.dhcp.error").hide();
this.logger.info("adding static ip");
var json = {
"Chaddr": this.toObject().StaticIP.Chaddr,
"Yiaddr": this.toObject().StaticIP.Yiaddr
};
var ip = this.objects.DHCPStaticAddress._new(json);
this.ipGW = Sah.get('ipGW');
this.ipMin = Sah.get('ipMin');
this.ipMax = Sah.get('ipMax');
if (!this.validateForm(ip)) {
return false;
}
this.objects.DHCPStaticAddress._add(this.whenSaved.bind(this), ip._getParameters());
return false;
},
whenSaved: function (ip)
{
this.markAsLoaded();
this.logger.info("object saved");
this.ipTemplate.apply(ip);
var hostOpt = $A(this.host.options).detect(function (o) {
return (o.host && o.host.MACAddress == ip.Chaddr);
});
if (hostOpt)
{
hostOpt.remove();
this.onHostChanged();
}
},
validateForm : function (obj)
{
for(var i=0;i< this.objects.DHCPStaticAddress._childs.length;i++){
var elem =this.objects.DHCPStaticAddress._childs[i];
if(elem.Yiaddr == obj.Yiaddr){
this.displayMessageError("advconfig.network.dhcp.error.usedipaddress","X Used IP Address");
return false;
}else if(elem.Chaddr == obj.Chaddr){
this.displayMessageError("advconfig.network.dhcp.error.usedmacaddress","X Used Mac Address");
return false;
}
}
var ipNew = new Sah.IPAddress(obj.Yiaddr, this.ipGW.bytesMask);
if(!ipNew.check()) {
this.displayMessageError("advconfig.network.dhcp.error.ipaddress.bad","Bad IP Address");
return false ;
}else if(!ipNew.bytes.isInRange(this.ipMin, this.ipMax)){
this.displayMessageError("advconfig.network.dhcp.error.withinrange","IP Address should be within the DHCP range");
return false;
}/*else if(!ipNew.match(this.ipGW)){
this.displayMessageError("advconfig.network.dhcp.error.withinsubnet","IP Address should be within the subnetwork");
return false;
}else if(ipNew.bytes.eq(this.ipGW.bytes)){
this.displayMessageError("advconfig.network.dhcp.error.reservedip","This is a reserved IP Address");
return false;
}*/
if (!Sah.Validations.isValidMacAddress(obj.Chaddr)) {
this.displayMessageError("advconfig.network.dhcp.error.macaddress","Bad MAC Address");
return false;
}
return true;
},
displayMessageError: function(label, alternate)
{
Sah.translator.change($("advconfig.dhcp.error.description"), label, alternate );
$("advconfig.dhcp.error").show();
},
onCancel : function ()
{
// TODO : cancel modfication
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/equipments.js */
/* TODO: documentation */
Lan.Equipments = Class.create(Sah.AuthenticatedForm, {
initialize: function ($super, form)
{
$super(form);
this.form.hide();
/* setup events */
$("ct-msgbox-button1").observe("click",this.onDelete.bind(this));
document.observe("sah:lan:access:period:timerange:add",this.onTimeRangeAdd.bind(this));
/* fetch needed data */
this.needs("Equipment", { path: "Equipments", depth: -1 });
this.load();
},
objectsLoaded: function ()
{
document.LanConnection = this.objects.Equipment.LanConnection;
this.refreshedPeriod = undefined;
this.getRefreshedEquipments();
},
appendDevice: function (element, device)
{
this.logger.info("appendDevice");
element.id = device._path;
element.down(".garbage_title").observe("click",this.deleteDevice.bind(this, device._path));
element.down(".garbage").observe("click",this.deleteDevice.bind(this, device._path));
if (element.sahObject.InterfaceType == "USB") {
element.down(".actions").hide();
element.down(".subtitle").down("span").hide();
}
else {
element.down(".actions").down("a").observe("click", this.openAccessInternet.bind(this, device._path));
if (element.sahObject.$InternetAccessSchedule && element.sahObject.$InternetAccessSchedule != "")
this.getAccessStatus("igd."+element.sahObject.$InternetAccessSchedule,element.sahObject._path);
}
var deviceClass;
if (element.sahObject.Active == "1") {
deviceClass = this.getIcon(element.sahObject);
element.down(".garbage").hide();
element.down(".garbage_title").hide();
} else {
deviceClass = this.getIcon(element.sahObject) + "-gray";
}
if (element.sahObject.$UserFriendlyName.length > 10 && !element.sahObject.$UserFriendlyName.match(/^mass\sstorage$/i)) {
element.down(".title h4 div").setAttribute("x-sah-tooltip", element.sahObject.$UserFriendlyName);
element.down(".title").style.zIndex = 10;
element.down(".title h4 div").style.display = "inline";
this.truncateDeviceName(element.down(".title").down("h4").down("div"), element.sahObject.$UserFriendlyName, 10);
}else if(element.sahObject.$UserFriendlyName.match(/^mass\sstorage$/i))
{
Sah.translator.change(element.down(".title h4 div"),"home.label.devices.massstorage.title","Mass Storage");
}
if (deviceClass == "mobile" || deviceClass == "mobile-gray") {
var regExpName =/^PC/i;
if (regExpName.test(element.sahObject.$UserFriendlyName)) {
Sah.translator.change(element.down(".title").down("h4").down("div"), "general.label.usbphone","X LivePhone");
element.sahObject.$UserFriendlyName=element.down(".title").down("h4").down("div").innerHTML;
}
}
if (element.sahObject.isSTB) {
element.sahObject.$DeviceType="stb";
if (element.sahObject.Active == "1") {
deviceClass="stb";
}
else {
deviceClass="stb-gray";
}
element.down(".actions").hide();
element.down(".subtitle").down("span").hide();
}
element.addClassName("li-device");
element.addClassName(deviceClass);
/* show the element form */
this.deviceTemplate.showForm(element);
$('equipmentsList').insert(element);
this.logger.info("end appendDevice");
},
filter: function (device)
{
return true;
},
getIcon: function ()
{
return "mobile";
},
deleteDevice : function (id,event)
{
event.stop();
ctl.msgbox.Show(ctl.msgbox.QUESTION.YES_NO,t('config.computers.info.question','X Are you sur'));
this.ObjectToDelete = id;
},
onDelete : function (event)
{
event.stop();
$(this.ObjectToDelete).sahObject._destroy({ onSuccess: this.deleteSuccess.bind(this,this.ObjectToDelete),onFailure: this.deleteFailure.bind(this,this.ObjectToDelete) });
},
deleteSuccess : function (id, obj)
{
$(id).remove();
},
deleteFailure : function (element, obj)
{
},
openAccessInternet :function (id, event)
{
this.stopRefresh(this.refreshedPeriod);
ctl.popup.sahObject = $(id).sahObject;
ctl.popup.Load(Sah.link('/configAccessScheduling.html'));
return false;
},
getAccessStatus :function (path, id)
{
this.client.get(path,{}, function(path,object, response) {
if (object.Enable == 1 && object.Active == 1) {
$(id).down(".calendar").removeClassName("calendar-green");
$(id).down(".calendar").addClassName("calendar-red");
}
else if (object.Enable == 1 && object.Active == 0) {
$(id).down(".calendar").removeClassName("calendar-red");
$(id).down(".calendar").addClassName("calendar-green");
}
}.bind(this, path));
},
onTimeRangeAdd : function (event)
{
if (event.memo.queryNumber == 0) {
this.logger.info("time of day configued, stopping");
this.getAccessStatus(event.memo.scheduleInstance._path, event.memo.sahObject._path);
this.markAsLoaded();
this.refresh(10);
}
},
sortDevices: function(firstObj,secondObj)
{
var firstLastConnection = parseInt(firstObj.$LastConnection.replace(/T|Z|-|:/g,""),10);
var secondLastConnection = parseInt(secondObj.$LastConnection.replace(/T|Z|-|:/g,""),10);
var connectionStatus = parseInt(secondObj.Active,10) -parseInt(firstObj.Active,10) ;
if (connectionStatus == 0)
return secondLastConnection - firstLastConnection;
else if (secondObj.Active == "1")
return 1;
else
return -1;
},
truncateDeviceName : function (elem,deviceName,limit)
{
elem.innerHTML = deviceName.substring(0,limit)+"...";
},
stopRefresh: function (refreshedPeriod)
{
if (this.refreshedPeriod) {
this.refreshedPeriod.stop();
this.refreshedPeriod = undefined;
}
},
refresh: function (refreshPeriod)
{
this.stopRefresh(this.refreshedPeriod);
this.refreshedPeriod = new PeriodicalExecuter(this.refreshEquipments.bind(this), refreshPeriod);
},
getRefreshedEquipments: function ()
{
this.logger.info("getRefreshedEquipments");
this.objects.Devices = this.objects.Equipment.Hosts;
/* setup needed templates */
this.deviceTemplate = Sah.Templates['Device'];
this.deviceTemplate.callback = this.appendDevice.bind(this);
$$(".li-device").each(Element.remove);
this.deviceTemplate.apply(this.detectStbDevices(this.objects.Devices._childs).select(this.filter.bind(this)).sort(this.sortDevices.bind(this)));
this.form.show();
this.refresh(10);
},
refreshEquipments: function ()
{
this.logger.info("refreshEquipments");
this.objects.Devices._childs = [];
this.stopRefresh(this.refreshedPeriod);
this.objects.Equipment._load(this.getRefreshedEquipments.bind(this));
},
refreshStatus : function()
{
this.objects.Devices._childs = [];
this.stopRefresh(this.refreshedPeriod);
this.objects.Equipment._load(this.getRefreshedStatus.bind(this));
},
getRefreshedStatus: function ()
{
this.objects.Devices.each(function (device) {
if (device.$InternetAccessSchedule && device.$InternetAccessSchedule != "")
this.getAccessStatus("igd."+device.$InternetAccessSchedule,device._path);
},this);
this.refresh(10);
},
detectStbDevices : function (deviceList)
{
if (!this.objects.Equipment.Lease) {
return deviceList;
}
this.objects.Equipment.Lease._childs.each(function (lIt) {
var poolIndex = parseInt(lIt.PoolReference.split(".")["3"]);
if (!lIt.RxOptions) {
return;
}
lIt.RxOptions._childs.each(function (oIt) {
if (oIt.Option === "77" && this.objects.Equipment.Pool[poolIndex].Name === "mltv_stb") {
deviceList.detect(function (dIt) {
if(dIt.MACAddress === lIt.MACAddress) {
dIt.isSTB = true;
return true
}
return false
}, this);
}
}, this);
}, this);
return deviceList;
},
filterOthers: function (device)
{
return ((device.InterfaceType == "USB" && device.$USB["1"].DeviceClass != "9")
|| device.$DeviceType =="mobile" || device.$DeviceType =="stb"
|| device.$DeviceType =="liveradio" || device.$UserFriendlyName.match(/liveradio|vintage/i)
|| device.$DeviceType =="printer"
|| device.$DeviceType =="tv" || device.$DeviceType =="game"
|| device.$DeviceType =="photo" || device.isSTB);
}
});
Lan.Equipments.DeviceClasses = {
"Unknown":"computer",
"MassStorage":"mass-storage",
"mobile": "mobile",
"laptop": "computer",
"computer" : "computer",
"stb" : "stb",
"tv": "tv",
"printer" :"printer",
"game":"game",
"Unknown":"computer",
"liveradio":"liveradio",
"photo":"photo",
"usb":"mass-storage"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/equipments/others.js */
Lan.Equipments.Others = Class.create(Lan.Equipments, {
filter: function (device)
{
if(device.InterfaceType=="USB" && device.$USB["1"].DeviceClass!="9")
{
return true;
}
return device.InterfaceType!="USB" &&
device.HostName != "localhost" &&
device.$DeviceType!="computer" &&
device.$DeviceType!="laptop" &&
device.InterfaceType!="N/A" &&
device.$DeviceType!="" &&
this.filterOthers(device);
},
getIcon : function (device){
if(device.InterfaceType=="USB")
{
if(device.$USB["1"].Interface)
{
if(device.$USB["1"].Interface["1"].InterfaceClass=="7")
{ return "printer"; }
else if (device.$USB["1"].Interface["1"].InterfaceClass=="8")
{ return "mass-storage"; }
else if (device.$USB["1"].Interface["1"].InterfaceClass=="3")
{ return "mobile"; }
else if (device.$USB["1"].Interface["1"].InterfaceClass=="255")
{ return "mobile"; }
else
{ return "mass-storage"; }
}
else
{ return "mass-storage"; }
}
var ico = Lan.Equipments.DeviceClasses[device.$DeviceType || ""];
if (ico) {
return ico;
}else if (device.$UserFriendlyName.match(/liveradio|vintage/i)) {
return "liveradio";
} else {
return "desktop";
}
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/equipments/computers.js */
Lan.Equipments.Computers = Class.create(Lan.Equipments, {
filter: function (device)
{
// TODO : clean
return ((device.HostName != "localhost") &&
!device.isSTB &&
(device.InterfaceType!="USB") &&
(device.InterfaceType!="N/A") &&
((device.$DeviceType=="computer") ||
(device.$DeviceType=="Unknown") ||
(device.$DeviceType=="laptop") ||
(!this.filterOthers(device)))) ;
},
getIcon : function (device){
// TODO : clean
if(device.$DeviceType=="laptop")
{ return "laptop"; }
else
{
return "desktop";
}
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/dhcpSummary.js */
/**
* The lan dhcpSummary form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Lan.DhcpSummary = Class.create(Sah.AuthenticatedForm,
/** @lends Lan.DhcpSummary */
{
initialize: function ($super, form)
{
$super(form);
this.needs("Lan", { path: "SI.Lan",depth: -1 });
this.form.disable();
this.markAsLoading();
this.load();
},
objectsLoaded: function ()
{
this.objects.DHCPSummary = this.objects.Lan.DHCPSummary;
this.objects.LanDhcp = this.objects.DHCPSummary.LANHostConfigManagement;
this.objects.LanEthernet = this.objects.DHCPSummary.LANEthernetInterfaceConfig[1];
this.fillForm();
this.form.enable();
this.markAsLoaded();
},
fillForm: function ()
{
this.objects.LanDhcp.DHCPLeaseTime += " s";
/* map the value directly to the form, ie the form element with an id matching
* a path from this.objects will be set automatically. */
this.fromObject(this.objects);
if (this.objects.LanDhcp.DHCPServerEnable == "1") {
Sah.translator.change($("LanDhcp.DHCPServerEnable"), "support.systeminformation.lan.label.status.enabled","X Enabled");
}
else {
Sah.translator.change($("LanDhcp.DHCPServerEnable"), "support.systeminformation.lan.label.status.disabled","X Disabled");
}
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/dhcpLeases.js */
Lan.DhcpLeases = Class.create(Sah.AuthenticatedForm,
/** @lends Security.Rule# */
{
initialize: function ($super, form)
{
$super(form);
this.tbody = this.form.down("#DhcpLeases");
this.needs("DHCP", { path: "Lan.DHCP" });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.HostsByMac = $H();
this.objects.Hosts = this.objects.DHCP.Hosts.select(function (h) { return h.MACAddress != "00:00:00:00:00:00"; });
this.objects.Hosts.each(function (h) { this.HostsByMac[h.MACAddress] = h; }, this);
this.objects.DHCP.Lease.each(function (l) {
var host = this.HostsByMac[l.MACAddress];
if (host)
l.Name = host.$UserFriendlyName;
else
l.Name = t("advconfig.network.dhcp.label.unknownname", "unknown (%1)", l.MACAddress);
}, this);
this.objects.Lease = this.objects.DHCP.Lease.select(function (l) { return true; });
/* setup needed templates */
this.leaseTemplate = Sah.Templates['Lease'];
this.leaseTemplate.callback = this.appendLease.bind(this);
this.leaseTemplate.apply(this.objects.Lease);
this.form.enable();
},
/**
* @param {Object} element element in the form
* @param {Object} lease an instance in sahbus
* Add each row of the template and create the event handler for buttons */
appendLease: function (element, lease)
{
this.tbody.insert(element);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/dhcp.js */
/**
* The lan access management form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Lan.Dhcp = Class.create(Sah.AuthenticatedForm,
/** @lends Lan.Dhcp */
{
initialize: function ($super, form)
{
$super(form);
this.el = {
enable: $("dhcp_enable"),
disable: $("dhcp_disable"),
ip: $("dhcp_ip"),
mask: $("dhcp_mask"),
minAddr: $("dhcp_min_addr"),
maxAddr: $("dhcp_max_addr"),
cancel: $("dhcp_cancel"),
save: $("dhcp_save")
};
/* when the form is submitted, call the onSave method of this class */
this.el.cancel.observe("click", this.onCancel.bind(this));
this.el.save.observe("click", this.onSave.bind(this));
$$("input[name=LanDhcp.DHCPServerEnable]").each(function (elt) {
elt.observe("click", this.stateChange.bind(this, elt));
}, this);
this.el.ip.observe('change', this.onIpChange.bind(this));
this.el.mask.observe('change', this.onIpChange.bind(this));
this.needs("LANConnection", {
path: "Lan.DHCP"
});
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.LanDhcp = this.objects.LANConnection.LANHostConfigManagement;
this.dhcpEnabled = this.objects.LanDhcp.DHCPServerEnable === "1";
this.fillForm();
this.form.enable();
},
fillForm: function ()
{
$("dhcp_error").innerHTML="";
$("config.lan.dhcp").hide();
this.fromObject(this.objects);
(this.dhcpEnabled ? this.el.enable: this.el.disable).checked = true;
Sah.set({
ipGW:new Sah.IPAddress(this.objects.LanDhcp.IPRouters,this.objects.LanDhcp.SubnetMask),
ipMin:Sah.Byte4.parseIPAddress(this.objects.LanDhcp.MinAddress).bytes,
ipMax:Sah.Byte4.parseIPAddress(this.objects.LanDhcp.MaxAddress).bytes
});
},
onSave: function (event)
{
event.stop(event);
$("dhcp_error").innerHTML="";
$("config.lan.dhcp").hide();
/* if the form is changed, save it.
* The onSuccess and onFailure options allows one to set function that will be called when,
* guess it, the save succeede */
this.objects.LanDhcp._update(this.toObject().LanDhcp);
this.objects.LanDhcp.DHCPServerEnable = (this.dhcpEnabled ? "1" : "0");
if (this.objects.LanDhcp._changed()) {
this.objects.LanDhcp._validations=[];
this.objects.LanDhcp._errors =$A();
// this.objects.LanDhcp._addValidation(this.validateForm);
if(this.validateForm(this.objects.LanDhcp)) {
this.markAsLoading();
var minAddr =this.objects.LanDhcp.MinAddress;
var maxAddr =this.objects.LanDhcp.MaxAddress;
this.objects.LanDhcp.DHCPServerEnable =0;
this.objects.LanDhcp._save({
onSuccess: this.whenLanSaved.bind(this,minAddr,maxAddr, this.objects.LanDhcp._changedParameter("IPRouters")),
onFailure: this.whenNotSaved.bind(this)
});
} else {
Sah.translator.change($("dhcp_error"),this.objects.LanDhcp._errors[0].label,this.objects.LanDhcp._errors[0].message);
$("config.lan.dhcp").show();
this.logger.error("unable to save rule", this.objects.LanDhcp._errors);
}
} else {
this.logger.info("nothing has changed in LanAccess, skipping save");
}
return false;
},
whenLanSaved : function (minAddr, maxAddr, ipChanged, obj)
{
this.objects.LanDhcp.MinAddress = minAddr;
this.objects.LanDhcp.MaxAddress = maxAddr;
this.objects.LanDhcp.DHCPServerEnable = (this.dhcpEnabled ? "1" : "0");
this.objects.LanDhcp.DNSServers = "" + this.objects.LanDhcp.IPRouters + ",0.0.0.0";
this.objects.LanDhcp._save({
onSuccess: this.whenSaved.bind(this, ipChanged),
onFailure: this.whenNotSaved.bind(this)
});
},
/**
* called when the form was correctly saved
*/
whenSaved: function (ipChanged, obj)
{
this.objects.LanDhcp.IPInterface["1"].IPInterfaceIPAddress = this.objects.LanDhcp.IPRouters;
this.objects.LanDhcp.IPInterface["1"].IPInterfaceSubnetMask = this.objects.LanDhcp.SubnetMask;
this.objects.LanDhcp.IPInterface["1"]._save({
onSuccess: this.whenIPInterfaceSaved.bind(this, ipChanged),
onFailure: this.whenNotSaved.bind(this)
});
},
whenIPInterfaceSaved : function(ipChanged, obj)
{
this.logger.info("object saved");
this.fillForm();
this.markAsLoaded();
if (ipChanged) {
/* reload window to the home page because we are not authenticated for the new IP*/
window.location = "http://" + this.objects.LanDhcp.IPRouters;
}
},
whenNotSaved: function (obj)
{
this.logger.warn(obj);
this.markAsLoaded();
var notification = new Sah.Widget.ObjectNotification(obj, t("Lan.Dhcp.Title", "Lan DHCP"));
notification.show();
this.fillForm();
},
onCancel: function(event)
{
Event.stop(event);
this.objects.LanDhcp._resetParameters();
this.objectsLoaded();
return false;
},
onIpChange: function () {
var ip = new Sah.IPAddress(this.el.ip.getValue(), this.el.mask.getValue());
if(ip.check( Sah.IPAddress.CHK_LAN | Sah.IPAddress.CHK_HOST )){
var ips = ip.getDHCPRange();
this.el.minAddr.setValue(ips.first)
this.el.maxAddr.setValue(ips.last)
}
},
validateForm: function (obj)
{
var ip = new Sah.IPAddress(obj['IPRouters'], obj['SubnetMask']);
if(!ip.check( Sah.IPAddress.CHK_LAN | Sah.IPAddress.CHK_HOST )){
if(ip.errno & Sah.IPAddress.ERR_ADDR){
obj._addError("IPRouters","X Bad IP Address","advconfig.network.dhcp.error.ipaddress.bad");
return false;
}else if(ip.errno & Sah.IPAddress.ERR_MASK){
obj._addError("SubnetMask", "X Bad SubnetMask","advconfig.network.dhcp.error.subnetMask");
return false;
}
}
if(ip.conflict("192.168.128.1/24")){
obj._addError("IPRouters","X Conflict with 192.168.128.0/24 reserved subnetwork","advconfig.network.dhcp.error.conflict.subnet192168128");
return false;
}
if(ip.conflict("192.168.2.1/24")){
obj._addError("IPRouters","X Conflict with 192.168.2.0/24 reserved subnetwork","advconfig.network.dhcp.error.conflict.subnet192168002");
return false;
}
if(!ip.checkDHCPRange( obj['MinAddress'], obj['MaxAddress'] )){
if(ip.errno & Sah.IPAddress.ERR_FIRST){
obj._addError("MinAddress","X Bad Start IP Address","advconfig.network.dhcp.error.ipaddress.minAddress");
return false;
}else if(ip.errno & Sah.IPAddress.ERR_LAST){
obj._addError("MaxAddress","X Bad End IP Address","advconfig.network.dhcp.error.ipaddress.maxAddress");
return false;
}
}
var staticIPs = Sah.get("staticIPs"),
min = Sah.Byte4.parseIPAddress(obj['MinAddress']).bytes.toInt(),
max = Sah.Byte4.parseIPAddress(obj['MaxAddress']).bytes.toInt();
if (Object.values(staticIPs).detect(function (ipStr) {
var v = Sah.Byte4.parseIPAddress(ipStr.Yiaddr).bytes.toInt();
return !(min <= v && v <= max);
}, this)) {
obj._addError("MinAddress","At least one static IP is out of the DHCP range. Please delete the concerned host first or choose an other DHCP range","advconfig.network.dhcp.error.outofrangestaticip");
return false;
}
return true;
},
stateChange: function (elt) {
this.dhcpEnabled = (elt.checked ? elt.value === "1": elt.value === "0");
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/deviceListSelect.js */
/**
* The lan device list form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Lan.DeviceListSelect = Class.create(Sah.Form,
/** @lends Lan.DeviceListSelect# */
{
initialize: function($super, form)
{
$super(form);
this.select = $("DeviceListSelect.Host");
/* bind a custom event to the select box */
this.select.observe("change", this.fireDeviceChangedEvent.bind(this));
/* listen for when a device has been updated */
document.observe('sah:home:device:deviceUpdated', this.deviceUpdated.bind(this));
this.needs("InternetParameters", { path: "igd.Services.$Internet", depth: 1 });
this.needs("Host", {
path: function(){return "igd." + this.objects.InternetParameters.LANConnection + ".Hosts.Host"; },
depth: 3
});
this.form.disable();
this.load();
},
objectsLoaded: function()
{
this.fillForm();
this.fireDeviceChangedEvent();
this.form.enable();
},
fillForm: function()
{
this.select.innerHTML = "";
this.objects.Host.each(function (device) {
var option = new Element("option", { value: device._path });
option.insert(device.$UserFriendlyName);
option.device = device;
this.select.insert(option);
}, this);
this.fromObject(this.objects);
},
fireDeviceChangedEvent: function ()
{
var option = this.select.options[this.select.selectedIndex];
document.fire('sah:lan:deviceListSelect:deviceChanged', option.device);
},
deviceUpdated: function (event)
{
var updatedDevice = event.memo;
this.objects.Host.each(function (device) {
if (device._path == updatedDevice._path) {
device._update(updatedDevice);
}
});
this.fillForm();
this.select.setValue(updatedDevice._path);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/connectionList.js */
/**
* The Lan summary form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.Form
*/
Lan.ConnectionList = Class.create(Sah.AuthenticatedForm,
/** @lends Lan.ConnectionList */
{
initialize: function ($super, form)
{
$super(form);
/* prepare to load the objects we need */
this.needs("Lan", { path: "SI.Lan", depth: -1 });
this.load();
},
objectsLoaded: function ()
{
this.objects.ConnectionList = this.objects.Lan.ConnectionList;
this.objects.ConnMode = this.objects.ConnectionList.ConnMode;
this.objects.IP = this.objects.ConnectionList.IP;
// this.objects.Group = this.objects.ConnectionList.Group;
this.prepareForm();
this.fromObject(this.objects);
},
prepareForm: function ()
{
// /* get the Lan Stb Wan Port */
// this.objects.Group.each(function(group) {
// if (group.Name == "lan")
// { this.objects.LanPort = group; }
// if (group.Name == "stb")
// { this.objects.StbPort = group; }
// if (group.Name == "wan")
// { this.objects.WanPort = group; }
// },this);
this.objects.Port = {};
/* get Lanports */
if( this.objects.LanPort )
{
this.objects.LanPort1 = this.getPortNumberedObject(this.objects.LanPort.Port, "port1");
this.objects.LanPort2 = this.getPortNumberedObject(this.objects.LanPort.Port, "port2");
this.objects.LanPort3 = this.getPortNumberedObject(this.objects.LanPort.Port, "port3");
this.objects.LanPort4 = this.getPortNumberedObject(this.objects.LanPort.Port, "port4");
}
else
{
this.objects.LanPort1 = "";
this.objects.LanPort2 = "";
this.objects.LanPort3 = "";
this.objects.LanPort4 = "";
}
if( this.objects.StbPort )
{
this.objects.StbPort2 = this.getPortNumberedObject(this.objects.StbPort.Port, "port2");
this.objects.StbPort3 = this.getPortNumberedObject(this.objects.StbPort.Port, "port3");
}
else
{
this.objects.StbPort2 = "";
this.objects.StbPort3 = "";
}
if( this.objects.WanPort )
{
this.objects.WanPort4 = this.getPortNumberedObject(this.objects.WanPort.Port, "port4");
}
else
{
this.objects.WanPort4 = "";
}
/* Last Mode Settings
Sah.translator.change($("Port.ModeYellow"), Lan.ConnectionList.DisplayYellowMode[this.objects.LanPort2.Enable][this.objects.StbPort2.Enable], this.objects.LanPort2.Enable+"-"+this.objects.StbPort2.Enable );
Sah.translator.change($("Port.ModeGreen"), Lan.ConnectionList.DisplayGreenMode[this.objects.LanPort3.Enable][this.objects.StbPort3.Enable], this.objects.LanPort3.Enable+"-"+this.objects.StbPort3.Enable );
Sah.translator.change($("Port.ModeWhite"), Lan.ConnectionList.DisplayWhiteMode[this.objects.LanPort4.Enable][this.objects.WanPort4.Enable], this.objects.LanPort4.Enable+"-"+this.objects.WanPort4.Enable );
*/
/* New Mode Settings */
var vpc = this.objects.ConnMode.Enable;
var is_DSL = this.objects.ConnMode.WANInterfaceType;
if ( is_DSL === "DSL")
{
if ( vpc === "1" )
{
Sah.translator.change($("Port.ModeWhite"), "support.systeminformation.lan.mode.internet", "X internet" );
}
else
{
Sah.translator.change($("Port.ModeWhite"), "support.systeminformation.lan.mode.InternetTV", "X internet & TV" );
}
}
else
{
Sah.translator.change($("Port.ModeWhite"), "support.systeminformation.lan.mode.internetONT", "X FTTH" );
}
if ( vpc === "1" )
{
Sah.translator.change($("Port.ModeYellow"), "support.systeminformation.lan.mode.tv", "X TV" );
Sah.translator.change($("Port.ModeGreen"), "support.systeminformation.lan.mode.tv", "X TV" );
Sah.translator.change($("Port.ModeRed"), "support.systeminformation.lan.mode.internet", "X internet" );
}
else
{
Sah.translator.change($("Port.ModeYellow"), "support.systeminformation.lan.mode.InternetTV", "X internet & TV" );
Sah.translator.change($("Port.ModeGreen"), "support.systeminformation.lan.mode.InternetTV", "X internet & TV" );
Sah.translator.change($("Port.ModeRed"), "support.systeminformation.lan.mode.InternetTV", "X internet & TV" );
}
/* */
Sah.translator.change($("Port.StatusRed"), Lan.ConnectionList.Status[this.objects.LanPort1.State], this.objects.LanPort1.State );
if ( this.objects.LanPort2.Enable == "1" ) {
Sah.translator.change($("Port.StatusYellow"), Lan.ConnectionList.Status[this.objects.LanPort2.State], this.objects.LanPort2.State );
}
else {
Sah.translator.change($("Port.StatusYellow"), Lan.ConnectionList.Status[this.objects.StbPort2.State], this.objects.StbPort2.State );
}
if ( this.objects.LanPort3.Enable == "1" ) {
Sah.translator.change($("Port.StatusGreen"), Lan.ConnectionList.Status[this.objects.LanPort3.State], this.objects.LanPort3.State );
}
else {
Sah.translator.change($("Port.StatusGreen"), Lan.ConnectionList.Status[this.objects.StbPort3.State], this.objects.StbPort3.State );
}
if ( this.objects.LanPort4.Enable == "1" ) {
Sah.translator.change($("Port.StatusWhite"), Lan.ConnectionList.Status[this.objects.LanPort4.State], this.objects.LanPort4.State );
}
else {
Sah.translator.change($("Port.StatusWhite"), Lan.ConnectionList.Status[this.objects.WanPort4.State], this.objects.WanPort4.State );
}
this.objects.Eth = this.objects.IP;
var macAddress = this.objects.Eth.MACAddress;
$("Eth.MACAddressRed").innerHTML = macAddress;
$("Eth.MACAddressYellow").innerHTML = macAddress;
$("Eth.MACAddressGreen").innerHTML = macAddress;
$("Eth.MACAddressWhite").innerHTML = macAddress;
},
getPortNumberedObject: function (obj, portNumber) {
obj.each(function(portNumber,port) {
if (port.Name == portNumber)
{
this.port=port;
} return;
}.curry(portNumber),this);
return this.port;
}
}
);
Lan.ConnectionList.Status = {
"1": "support.systeminformation.lan.status.link",
"0": "support.systeminformation.lan.status.nolink"
};
Lan.ConnectionList.DisplayGreenMode = {
"1": {
"1": "support.systeminformation.lan.mode.InternetTV",
"0": "support.systeminformation.lan.mode.internet"
},
"0": {
"1": "support.systeminformation.lan.mode.tv",
"0": "support.systeminformation.lan.mode.disable"
}
};
Lan.ConnectionList.DisplayYellowMode = {
"1": {
"1": "support.systeminformation.lan.mode.InternetTV",
"0": "support.systeminformation.lan.mode.internet"
},
"0": {
"1": "support.systeminformation.lan.mode.tv",
"0": "support.systeminformation.lan.mode.disable"
}
};
Lan.ConnectionList.DisplayWhiteMode = {
"1": {
"1": "support.systeminformation.lan.mode.internetONT",
"0": "support.systeminformation.lan.mode.internet"
},
"0": {
"1": "support.systeminformation.lan.mode.internetONT",
"0": "support.systeminformation.lan.mode.disable"
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/access.js */
/**
* @namespace
*/
Lan.Access = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/access/period.js */
/**
* TODO: fix documentation
* Access Period
*
*/
Lan.Access.Period = Class.create(Sah.AuthenticatedForm,
/** @lends Lan.Access.Period# **/
{
initialize: function($super, form)
{
$super(form);
document.isStateChanged =false;
// $$(".AccessSchedulingManagementSave").each(function (b) { b.observe("click", this.onSave.bind(this)); }, this);
// $$(".AccessSchedulingManagementCancel").each(function (b) { b.observe("click", this.onCancel.bind(this)); }, this);
document.observe("sah:lan:access:management:enableOrDisableScheduling", this.drawTable.bind(this));
document.observe("sah:lan:access:management:saveAccessInternetRestriction", this.onSave.bind(this));
if (ctl.popup.sahObject.$InternetAccessSchedule)
{
var pathTimeOfDay = ctl.popup.sahObject.$InternetAccessSchedule.replace("InternetGatewayDevice", "igd");
if(Sah.Form.cache[pathTimeOfDay])
{
Sah.Form.cache[pathTimeOfDay] = false;
}
this.needs("TimeOfDay", { path: pathTimeOfDay, depth: -1 });
}
$CYT('#scheduling span.box-0([1-7])-([0-9]+)h').each(function (element) {
Event.observe(element, "click",this.toggleState.bind(this,element));
}, this);
this.fillWithGreen();
this.form.disable();
this.load();
},
objectsLoaded: function()
{
this.objects.Days = this.objects.TimeOfDay;
if ( this.objects.Days ) {
if(this.objects.Days.Enable == "1")
{ this.fillForm();
this.form.enable();
}else {
this.disableCheckBox();
}
}
else {this.disableCheckBox();
}
},
onCancel: function()
{
},
/**
* Draw each instance in sahbus on the calendar
*/
fillForm: function()
{
if (this.objects.Days && this.objects.Days.Day) {
this.objects.Days.Day.each(function(day)
{
if (day.TimeRange) {
var wday = day.WeekDay;
var dayNumber = Lan.Access.Period.Day[wday];
if ( dayNumber ) {
for (i = 0; i < day.TimeRange._childs.length; i++) {
var childPath = day.TimeRange._childs[i]._path;
var num = childPath.split(".").pop();
var dayTimeRange = day.TimeRange._childs[i];
var start = parseInt(dayTimeRange.StartHour,10);
var end = parseInt(dayTimeRange.EndHour,10);
var endMinute = parseInt(dayTimeRange.EndMinute,10);
var id = dayTimeRange._path;
var color = "red";
$$("#scheduling tr.day-"+dayNumber+" input")[0].checked=false;
this.drawPeriod(wday,dayNumber, start, end,id,color,endMinute);
}
}
}
}, this);
}
else { this.fillWithGreen();}
},
/**
* when user clicks on the graphic zone where there isn't any schedule, only "add" button is shown
*/
addNewPeriod:function()
{
},
drawPeriod: function(inDay,idDay, start, end,id,color,endMinute)
{
$$("#scheduling tr.day-"+idDay+" input")[0].checked=false;
for (var index = start; index < end; index++) {
this.setInputBoxClass($$(".box-0"+idDay+"-"+Lan.Access.Period.Hour[index]+"h")[0],color);
}
if(endMinute && end==23)
{
this.setInputBoxClass($$(".box-0"+idDay+"-23h")[0],color);
}
},
setInputBoxClass: function(element,color)
{
if(color =="red"){
element.removeClassName("input-box-green");
element.addClassName("input-box-red");
} else {
element.removeClassName("input-box-red");
element.addClassName("input-box-green");
}
},
/* TODO: documentation + full length argument name */
onClickPeriod:function(inDay,startH,startM,endH,endM,id,event)
{
},
onClickRow:function(idTr)
{
},
/**
*
* @param {Object} day
* @return id of the row to be drawn
*/
getIdRow:function(day)
{
//return day;
},
toggleState : function (element) {
if( $$("input[name='TimeOfDay.Enable']")[1].checked){
if (element.hasClassName("input-box-red"))
{
element.removeClassName("input-box-red");
element.addClassName("input-box-green");
}
else
{
element.removeClassName("input-box-green");
element.addClassName("input-box-red");
if(element.up("tr").down("input").checked==true){
element.up("tr").down("input").checked=false;
}
}
}
document.isStateChanged =true;
},
onSave:function(event)
{
var timeRanges = null;
this.logger.info("adding time ranges to schedule %s", event.memo._path);
event.stop();
document.stopObserving("sah:lan:access:management:saveAccessInternetRestriction");
this.scheduleInstance = event.memo;
this.deviceAccessInfo= new Object();
this.deviceAccessInfo.sahObject =ctl.popup.sahObject;
this.deviceAccessInfo.queryNumber = 0;
this.deviceAccessInfo.scheduleInstance = this.scheduleInstance;
if(!document.isStateChanged)
{
this.logger.warn("no changes needing save");
document.fire("sah:lan:access:period:timerange:add", this.deviceAccessInfo);
return false;
}
this.onDelete();
var added = false;
var reg = "([0-9]+)h";
for (var i = 1; i < 8; i++) {
timeRanges =$A();
var periods= $$('#scheduling tr.day-'+i+' span.input-box-red');
if (periods.length > 0) {
var startTime = parseInt((new RegExp(reg,"g")).exec(periods[0].className)[1],10);
var endTime = parseInt((new RegExp(reg,"g")).exec(periods[periods.length-1].className)[1],10);
var tr;
for (var j = 0; j < periods.length - 1; j++) {
var classes = periods[j].className;
var expression = new RegExp(reg,"g");
var aResult = expression.exec(classes);
var temp1 = parseInt(aResult[1],10);
var classes2 = periods[j+1].className;
var expression2 = new RegExp(reg,"g");
var aResult2 = expression2.exec(classes2);
var temp2 = parseInt(aResult2[1],10);
if(temp2 - temp1 > 1) {
tr = { StartHour: startTime };
if (temp1 == 23) {
tr.EndHour = temp1;
tr.EndMinute = 59;
} else {
tr.EndHour = temp1 + 1;
}
added = true;
timeRanges.push(tr);
startTime =temp2;
}
}
tr = { StartHour: startTime };
if (endTime == 23) {
tr.EndHour = endTime;
tr.EndMinute = 59;
} else {
tr.EndHour = endTime + 1;
}
added = true;
timeRanges.push(tr);
this.addDay(i, timeRanges, this.scheduleInstance);
}
}
if (!added) {
this.logger.info("no time range to add, triggering end event", timeRanges);
document.fire("sah:lan:access:period:timerange:add", this.deviceAccessInfo);
}
return false;
},
whenSaved: function (obj)
{
},
whenNotSaved: function (obj)
{
},
onDelete:function(){
if(this.objects.Days)
{
this.logger.info("disabling schedule");
this.objects.Days.Enable = 0;
this.objects.Days._save(function () {
this.logger.info("removing schedule");
this.objects.Days._destroy({ onSuccess: this.deleteDaySuccess.bind(this),onFailure: this.deleteDayFailure.bind(this) });
}.bind(this));
}
},
deleteDaySuccess: function(obj){
this.logger.info("object deleted");
},
deleteDayFailure: function(obj){
},
addDay : function(day,timeRanges,schedule)
{
var path = schedule._path+".Day";
var weekDay= Lan.Access.Period.DayNumber[day];
this.logger.info("adding day " + path);
this.client.add(path, { WeekDay: weekDay }, {
onSuccess: this.addDaySuccess.bind(this, day, timeRanges),
onFailure: this.whenNotSaved.bind(this)
});
},
onAddTimeRangeSuccess : function (obj) {
this.deviceAccessInfo.queryNumber--;
this.logger.warn("time range object saved, %d left to save", this.deviceAccessInfo.queryNumber);
if(this.deviceAccessInfo.queryNumber == 0) {
this.logger.info("all time range added, triggering end event");
document.fire("sah:lan:access:period:timerange:add",this.deviceAccessInfo);
}
},
addDaySuccess: function (day,timeRanges,obj)
{
timeRanges.each(function(day, range) {
var path = obj._path+".TimeRange";
this.deviceAccessInfo.queryNumber++;
this.client.add(path, range, this.onAddTimeRangeSuccess.bind(this));
}.curry(day),this);
},
addDayFailure: function (obj)
{
},
fillWithGreen : function ()
{
$CYT("#scheduling input").each(function (input){
input.checked=true;
input.observe("click", this.clickCheckBox.bind(this, input));
var spans = $$("#scheduling ."+input.up("tr").className+" span");
for(var i=1;i<spans.length ; i++)
{
spans[i].removeClassName("input-box-red");
spans[i].addClassName("input-box-green");
}
},this);
},
clickCheckBox : function (input,event) {
if(input.checked==true) {
var spans = $$("#scheduling ."+input.up("tr").className+" span");
for(var i=1;i<spans.length ; i++)
{
if (spans[i].hasClassName("input-box-red")) {
document.isStateChanged = true;
}
spans[i].removeClassName("input-box-red");
spans[i].addClassName("input-box-green");
}
}
},
removePeriods: function(){
var s = ["mo", "tu", "we", "th", "fr", "sa", "su"] ;
for (var index = 0; index < s.length; ++index) {
var inDay = s[index];
var idTr = this.getIdRow(inDay);
$(idTr).update("");
$(idTr).observe("click", function(){});
}
},
drawTable : function (event) {
if($$('input[name="TimeOfDay.Enable"]')[1].checked ==true)
{
this.fillForm();
this.form.enable();
}
else
{
this.fillWithGreen();
this.disableCheckBox();
}
},
disableCheckBox :function () {
$$("#scheduling input").each(function (input){
input.disabled=true;
},this);
}
});
Lan.Access.Period.Day = {
"mo": "1",
"tu": "2",
"we": "3",
"th": "4",
"fr": "5",
"sa": "6",
"su": "7"
};
Lan.Access.Period.DayNumber = {
"1":"mo",
"2":"tu",
"3":"we",
"4":"th",
"5":"fr",
"6":"sa",
"7":"su"
};
Lan.Access.Period.Hour = {
"0" : "00",
"1": "01",
"2": "02",
"3": "03",
"4": "04",
"5": "05",
"6": "06",
"7": "07",
"8":"08",
"9":"09",
"10":"10",
"11":"11",
"12":"12",
"13":"13",
"14":"14",
"15":"15",
"16":"16",
"17":"17",
"18":"18",
"19":"19",
"20":"20",
"21":"21",
"22":"22",
"23":"23"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/lan/access/management.js */
/**
* TODO: cleanup old documentation code
* The lan access management form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Lan.Access.Management = Class.create(Sah.AuthenticatedForm,
/** @lends Lan.AccessManagement# */
{
initialize: function ($super, form)
{
$super(form);
/* initialize events handler */
$$(".AccessSchedulingManagementSave").each(function (b) { b.observe("click", this.onSave.bind(this)); }, this);
$$(".AccessSchedulingManagementCancel").each(function (b) { b.observe("click", this.onCancel.bind(this)); }, this);
$$("input[type=radio][name=TimeOfDay.Enable]").each(function (radio) {
radio.observe("click",this.onChangeRadio.bind(this));}, this);
if (ctl.popup.sahObject.$InternetAccessSchedule) {
var pathTimeOfDay = ctl.popup.sahObject.$InternetAccessSchedule.replace("InternetGatewayDevice", "igd");
if(Sah.Form.cache[pathTimeOfDay])
{
Sah.Form.cache[pathTimeOfDay] = false;
}
this.needs("TimeOfDay", { path: pathTimeOfDay, depth: -1 });
}
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
//this.objects.LanAccess = this.objects.TimeOfDay;
this.fillForm();
this.form.enable();
},
fillForm: function ()
{
this.fromObject(this.objects);
/* check for radio instead of checkbox */
$$("input[type=radio][name=TimeOfDay.Enable]").each(function (radio) {
if (!this.objects.TimeOfDay)
{
if (radio.value == "0")
{
radio.checked = true;
}
}
else if (radio.value == this.objects.TimeOfDay.Enable){
radio.checked = true;
}
}, this);
},
onSave: function (event)
{
event.stop(event);
document.waitingSince = new Date();
if (!document.isStateChanged) {
return false;
}
this.markAsLoading();
if ( this.objects.TimeOfDay) {
this.objects.TimeOfDay._update(this.toObject().TimeOfDay);
if (this.objects.TimeOfDay.Enable=="0") {
this.objects.TimeOfDay._save({ onSuccess: this.whenDisabled.bind(this), onFailure: this.whenNotSaved.bind(this) });
return false ;
}
}
this.logger.info("adding schedule");
var device = ctl.popup.sahObject;
/* add the object */
var path = "igd.$TimeOfDay.Schedule";
var schedule = {
Reference: this.getIgdHostPath(document.LanConnection +".Hosts.Host",device._path),
FriendlyName: device.$UserFriendlyName,
ScheduleType: "AccessControl",
Enable: "1"
};
this.client.add(path, schedule, function(device, object, response) {
var devicePath = device._path.replace("InternetGatewayDevice", "igd");
device.$InternetAccessSchedule = object._path;
var num = object._path.split(".").pop();
this.objects.selectedIndex = num;
device._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
this.onScheduleUpdated(object);
}.bind(this, device));
return false;
},
whenDisabled: function (obj)
{
this.logger.info("time of day disabled");
this.markAsLoaded();
this.fillForm();
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fillForm();
},
whenNotSaved: function (obj)
{
/* TODO: fix up logging */
this.logger.warn("failed to save object");
this.logger.warn(obj);
},
onCancel: function(event){
},
onChangeRadio : function (event) {
document.isStateChanged = true;
document.fire("sah:lan:access:management:enableOrDisableScheduling");
},
onScheduleUpdated : function (obj){
this.logger.info("firing schedule updated events");
document.fire("sah:lan:access:management:saveAccessInternetRestriction",obj);
},
getIgdHostPath : function (igdPath,devicePath)
{
var str = devicePath.split(".");
return igdPath +"." + str[str.length-1];
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home.js */
/**
* @namespace Holds the home entity and its associated forms
*/
var Home = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/summaryLedsStatus.js */
/**
* Summary Leds Status
*/
Home.SummaryLedsStatus = Class.create(Sah.AuthenticatedForm,
/** @lends Home.SummaryLedsStatus# */
{
initialize: function ($super, form)
{
$super(form);
this.needs("LED", { path: "igd.InternetGatewayDevice.UserInterface.$LED", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.getLedStatus();
this.form.enable();
this.refresh(10);
},
getLedStatus: function ()
{
this.objects.Leds = this.objects.LED;
this.objects.Leds.each(function(led)
{
if( Home.SummaryLedsStatus.Display[led.Name] )
{
var name = Home.SummaryLedsStatus.Display[led.Name].name;
var icon = "";
var id = "";
var keyState = "-Off";
if( led.State !== "Off" )
{
keyState = led.Color+"-"+led.State;
}
if( Home.SummaryLedsStatus.Display[led.Name][keyState] )
{
icon = Home.SummaryLedsStatus.Display[led.Name][keyState].icon;
id = Home.SummaryLedsStatus.Display[led.Name][keyState].id;
}
else
{
// Actual led state not supported
icon = "icons-leds icons-leds-gray";
id = "";
}
var elementLabel = $("support-leds-label-"+name);
Sah.translator.change(elementLabel, id, "X Status" );
elementLabel.show();
var element = $("support-leds-color-"+name);
var className = element.classNames();
element.removeClassName(className);
element.addClassName(icon);
element.show();
}
}, this);
},
refresh: function (refreshPeriod)
{
new PeriodicalExecuter(this.refreshLedStatus.bind(this), refreshPeriod);
},
refreshLedStatus: function (event)
{
this.objects.LED._childs = [];
this.objects.LED._load(this.getLedStatus.bind(this));
}
});
Home.SummaryLedsStatus.Display = {
"Internet Led": {
"name": "internet",
// Connected
"Green-Solid": {
"icon": "icons-leds icons-leds-green",
"id": "support.ledsstatus.comment.green_solid.adsl"
},
// Synchronization failed
"Red-FlashFast": {
"icon": "icons-leds icons-leds-red-alternative-5",
"id": "support.ledsstatus.comment.red_fast.adsl"
},
// Connecting
"Orange-FlashSlow": {
"icon": "icons-leds icons-leds-orange-alternative-1",
"id": "support.ledsstatus.comment.orange_slow.adsl"
}
},
"VoIP Led": {
"name": "phone",
// VoIP Off
"-Off": {
"icon": "icons-leds icons-leds-gray",
"id": "support.ledsstatus.comment.gray.phone"
},
// VoIp On & available
"Green-Solid": {
"icon": "icons-leds icons-leds-green",
"id": "support.ledsstatus.comment.green_solid.phone"
},
// VoIp On but busy
"Green-FlashSlow": {
"icon": "icons-leds icons-leds-green-alternative-1",
"id": "support.ledsstatus.comment.green_slow.phone"
},
// VoIp On but busy
"Green-FlashFast": {
"icon": "icons-leds icons-leds-green-alternative-5",
"id": "support.ledsstatus.comment.green_fast.phone"
}
},
"Lan Led": {
"name": "network",
// Network Off
"-Off": {
"icon": "icons-leds icons-leds-gray",
"id": "support.ledsstatus.comment.gray.network"
},
// Network On
"Green-FlashSlow": {
"icon": "icons-leds icons-leds-green-alternative-1",
"id": "support.ledsstatus.comment.green_slow.network"
},
// Network On
"Green-FlashFast": {
"icon": "icons-leds icons-leds-green-alternative-5",
"id": "support.ledsstatus.comment.green_fast.network"
}
},
"Wifi Led": {
"name": "wireless",
// WiFi Off
"-Off": {
"icon": "icons-leds icons-leds-gray",
"id": "support.ledsstatus.comment.gray.wireless"
},
// WiFi On
"Green-Solid": {
"icon": "icons-leds icons-leds-green",
"id": "support.ledsstatus.comment.green_solid.wireless"
},
// WiFi WPS Association
"Green-FlashSlow": {
"icon": "icons-leds icons-leds-green-alternative-1",
"id": "support.ledsstatus.comment.green_slow.wireless"
},
// WiFi WPS Pairing
"Green-FlashFast": {
"icon": "icons-leds icons-leds-green-alternative-5",
"id": "support.ledsstatus.comment.green_fast.wireless"
}
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/restore.js */
/**
* Home Restore
*/
Home.Restore = Class.create(Sah.Form,
/** @lends Home.Restore# */
{
initialize: function ($super, form)
{
$super(form);
if (Prototype.Browser.Chrome)
$("file_name").setStyle({
"border": 0
});
document.observe('sah:admin:saveRestore:fileUploaded', this.fileUploaded.bind(this));
document.observe('sah:admin:saveRestore:fileUploadError', this.fileUploadError.bind(this));
$("bt_restore").observe("click", this.onRestore.bind(this));
$("bt_backtosetup").observe("click", this.onBackToSetup.bind(this));
this.needs("Reboot", {
path: "reboot",
depth: -1
});
/* this.form.disable(); */
this.load();
},
onBackToSetup:function(){
$('setup-link-restore').show();
$('setup-label-restore').show();
$('setup-accasstype-tab-restore').hide();
$('setup-accasstype-tab-setup').show();
return true;
},
onRestore: function ()
{
$("setup-accasstype-tab-restore-error-nofile").hide();
if ( $("file_name").getValue() != "" )
{
this.markAsLoading();
this.form.submit();
}
else
{
this.displayErrorMessage(t('setup.accesstype.label.error.nofiledesc','X Insert the file to restore.'));
}
return true;
},
/**
** display tooltip to control admin password
**/
displayErrorMessage : function(msg)
{
$("setup-accasstype-tab-restore-error-nofile").show();
$("setup-accasstype-tab-restore-error-nofile-desc").innerHTML = msg;
},
fileUploaded: function(event)
{
this.markAsLoaded();
$("setup-accasstype-tab-restore-error-nofile").hide();
$("setup-accasstype-tab-restore-error-upload").hide();
this.objects.Reboot.VoiceEnable=0;
this.objects.Reboot._save({
onSuccess:function (obj) {
$('setup-accasstype-tab-restore').hide();
$('setup-accasstype-tab-stepend').show();
this.objects.Reboot.DeviceConfig.RebootDelay = "0";
this.objects.Reboot.DeviceConfig.Reboot = "1";
this.objects.Reboot.DeviceConfig._save({
onSuccess:function(){},
onFailure:function(){}
});
}.bind(this),
onFailure:function(){}
});
return false;
},
fileUploadError: function(event)
{
this.markAsLoaded();
$("setup-accasstype-tab-restore-error-upload").show();
$("setup-accasstype-tab-restore-error-upload-desc").innerHTML = t('setup.accesstype.label.error.uploaddesc','X Invalid file.');
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/information.js */
Home.Information = Class.create(Sah.Form, {
initialize: function ($super, form)
{
$super(form);
// this.form.hide();
this.infoKeys = $A();
for ( infoKey in Translations.home.didyouknow.description)
{
this.infoKeys.push(infoKey);
}
this.translator = false;
this.currentKey = this.infoKeys[Math.floor(Math.random()*this.infoKeys.length)];
Sah.Translate.updated(this.fillInformation.bind(this));
this.periodicalExecuter = new PeriodicalExecuter(this.refresh.bind(this), 30);
},
fillInformation : function ()
{
Sah.translator.change($("home-dashboard-didyouknow-label"), "home.didyouknow.label", "X le saviez vous");
Sah.translator.change($("home-dashboard-didyouknow-content"), "home.didyouknow.description." + this.currentKey, "X description");
},
refresh : function ()
{
var newKey = this.currentKey;
while( newKey == this.currentKey )
{
newKey = this.infoKeys[Math.floor(Math.random()*this.infoKeys.length)];
}
this.currentKey = newKey;
this.fillInformation();
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/general.js */
/* TODO: documentation */
Home.General = Class.create(Sah.Form, {
initialize: function ($super, form)
{
$super(form);
this.form.hide();
this.refreshDelays= $A();
this.refreshIndex = 0;
this.initRefreshDelays();
/* setup events */
$("bt_refresh").observe("click",function(event){
//this.refreshIndex=this.refreshDelays.length;
event.memo="button";
this.refreshDevices(event);}.bind(this));
if(Cookie.get("firstAccessToHome")&&Cookie.get("firstAccessToHome")=="1")
{
this.refreshIndex=this.refreshDelays.length;
}else
{
Cookie.set("firstAccessToHome","1");
}
this.needs("Home", { path: "Home" });
this.load();
},
objectsLoaded: function ()
{
this.objects.Devices = this.objects.Home.Hosts;
this.objects.USBINFO = this.objects.Home.USBINFO;
document.observe("sah:home:general:deviceCustomizePopupLoaded", this.deviceCustomizePopupLoaded.bind(this));
/* setup needed templates */
this.ethernetDeviceTemplate = Sah.Templates['ethernetDevice'];
this.ethernetDeviceTemplate.callback = this.appendEthernetDevice.bind(this);
this.wirelessDeviceTemplate = Sah.Templates['wirelessDevice'];
this.wirelessDeviceTemplate.callback = this.appendWirelessDevice.bind(this);
this.usbDeviceTemplate = Sah.Templates['usbDevice'];
this.usbDeviceTemplate.callback = this.appendUsbDevice.bind(this);
$$(".li-device").each(function(elem) {
elem.remove();
}, this);
this.form.show();
this.fillLists();
if(this.refreshIndex<this.refreshDelays.length)
{
this.refresh(this.refreshDelays[this.refreshIndex]);
this.refreshIndex++;
}
},
fillLists :function()
{
var ethernetList = this.detectStbDevices(this.objects.Devices._childs.select(this.filter.bind(this,"Ethernet")));
var wirelessList = this.objects.Devices._childs.select(this.filter.bind(this,"802.11"));
var usbList = this.objects.Devices._childs.select(this.filter.bind(this,"USB"));
$("ethernetDevices").setStyle("margin-left:0px;left:0px;");
$("wirelessDevices").setStyle("margin-left:0px;left:0px;");
if(ethernetList.length==0)
{
$("home-dashboard-wired-nodevices").show();
$("home-dashboard-wired-devices-scroll-left").hide();
$("home-dashboard-wired-devices-scroll-right").hide();
$("home-dashboard-wired-devices").hide();
}
else {
$("home-dashboard-wired-nodevices").hide();
$("home-dashboard-wired-devices").show();
$("home-dashboard-wired-devices-scroll-right").show();
if(ethernetList.length<5)
{
$("home-dashboard-wired-devices-scroll-right").hide();
this.adjustElements("home-dashboard-wired-devices",ethernetList.length);
}
this.ethernetDeviceTemplate.apply(ethernetList);
$("home-dashboard-wired-devices-scroll-left").hide();
}
document.fire("sah:home:general:tv:set");
if(wirelessList.length==0)
{
$("home-dashboard-wireless-nodevices").show();
$("home-dashboard-wireless-devices-scroll-left").hide();
$("home-dashboard-wireless-devices-scroll-right").hide();
$("home-dashboard-wireless-devices").hide();
}
else {
$("home-dashboard-wireless-nodevices").hide();
$("home-dashboard-wireless-devices").show();
$("home-dashboard-wireless-devices-scroll-right").show();
if(wirelessList.length<5)
{
$("home-dashboard-wireless-devices-scroll-right").hide();
this.adjustElements("home-dashboard-wireless-devices",wirelessList.length);
}
this.wirelessDeviceTemplate.apply(wirelessList);
$("home-dashboard-wireless-devices-scroll-left").hide();
}
if(usbList.length==0)
{
$("home-dashboard-usb-devices").hide();
$("home-dashboard-usb-nodevices").show();
}
else {
$("home-dashboard-usb-nodevices").hide();
$("home-dashboard-usb-devices").show();
this.usbDeviceTemplate.apply(usbList);
}
},
appendEthernetDevice: function (element, device)
{
element.id = device._path;
if (device.$UserFriendlyName.length > 7) {
element.down(".title").setAttribute("x-sah-tooltip",device.$UserFriendlyName);
this.truncateDeviceName(element.down(".title"),device.$UserFriendlyName,7);
} else {
element.down(".title").innerHTML=device.$UserFriendlyName;
}
if (element.sahObject.isSTB) {
element.addClassName("stb");
element.sahObject.$DeviceType="stb";
} else {
element.addClassName(this.getIcon(element.sahObject));
}
element.addClassName("li-device");
/* show the element form */
this.ethernetDeviceTemplate.showForm(element);
$('ethernetDevices').insert(element);
element.observe('click', this.changeDevice.bind(this, element.sahObject));
},
appendWirelessDevice: function (element, device)
{
element.id = device._path;
if(device.$UserFriendlyName.length>7)
{
element.down(".title").setAttribute("x-sah-tooltip",device.$UserFriendlyName);
this.truncateDeviceName(element.down(".title"),device.$UserFriendlyName,7);
}else {
element.down(".title").innerHTML=device.$UserFriendlyName;
}
element.addClassName(this.getIcon(element.sahObject));
element.addClassName("li-device");
/* show the lement form */
this.wirelessDeviceTemplate.showForm(element);
$('wirelessDevices').insert(element);
element.observe('click', this.changeDevice.bind(this, element.sahObject));
},
appendUsbDevice : function (element, device)
{
element.id = device._path;
if(device.$UserFriendlyName.length>9 && !device.$UserFriendlyName.match(/^mass\sstorage$/i))
{
element.down(".title").setAttribute("x-sah-tooltip",device.$UserFriendlyName);
this.truncateDeviceName(element.down(".title"),device.$UserFriendlyName,9);
}if(device.$UserFriendlyName.match(/^mass\sstorage$/i))
{
Sah.translator.change(element.down(".title"),"home.label.devices.massstorage.title","Mass Storage");
}
else {
element.down(".title").innerHTML=device.$UserFriendlyName;
}
var className =this.getIconUsb(element.sahObject);
if( className == "unknown" )
{
className = "mass-storage";
element.addClassName(className);
element.addClassName("li-device");
element.addClassName("usbdevice");
}
else
{
element.addClassName(className);
element.addClassName("li-device");
element.addClassName("usbdevice");
if(className=="mass-storage")
{
element.addClassName("mass-storage-empty");
element.removeClassName("mass-storage-notempty");
this.logger.info("mass storage usb device");
var image="icons-devices-usb-hdd";
element.down(".files").observe("click",this.onAccessToUSB.bind(this,element));
element.down(".eject").observe("click",this.onEjectUSB.bind(this,element));
var usb =this.selectUSB(this.objects.USBINFO,element.sahObject.$USB["1"].SerialNumber);
element.info = this.createInfoElement("home.label.devices.massstorage.ejected","X Ejected");
if(usb)
{
var disk =this.selectDisk(this.objects.USBINFO,usb._path.replace("Home.USBINFO.",""));
if(disk)
{
element.addClassName("mass-storage-notempty");
element.removeClassName("mass-storage-empty");
this.logger.info("mass storage actif");
element.down(".files").show();
element.down(".eject").show();
element.info = this.createInfoElement("home.label.devices.massstorage.eject","X Eject");
}else {
this.logger.info("mass storage inactif");
}
}
}else if (className=="mobile")
{
var regExpName =/^PC/i;
if(regExpName.test(element.sahObject.$UserFriendlyName)){
element.down(".title").innerHTML=t("general.label.usbphone","X LivePhone");
Sah.translator.change(element.down(".title"),"general.label.usbphone","X LivePhone");
element.sahObject.$UserFriendlyName=element.down(".title").innerHTML;
}
}
// element.down(".title").observe('click', this.changeDevice.bind(this, element.sahObject));
element.down(".icon").observe('click', this.changeDevice.bind(this, element.sahObject));
element.down(".title").observe('click', this.changeDevice.bind(this, element.sahObject));
}
/* show the lement form */
this.usbDeviceTemplate.showForm(element);
$('usbDevices').insert(element);
if(element.info)
{
element.insert({"after": element.info});
}
},
filter: function (interfaceType,device)
{
if (device.InterfaceType!="N/A" && device.HostName!="localhost") {
if (interfaceType !="USB") {
return device.InterfaceType==interfaceType && device.Active=="1" && device.Hostname!="localhost";
} else {
return device.InterfaceType==interfaceType && device.Active=="1" && device.$USB["1"].DeviceClass!="9";
}
} else {
return false;
}
},
getIcon: function (device)
{
var ico = Home.General.DeviceClasses[device.$DeviceType || ""];
if (ico) {
return ico;
}else if (device.$UserFriendlyName.match(/liveradio|vintage/i)) {
return "liveradio";
} else {
return "desktop";
}
},
getIconUsb: function (device)
{
// TODO : define all possibles
if(device.$USB["1"].Interface["1"].InterfaceClass=="7")
{ return "printer"; }
else if (device.$USB["1"].Interface["1"].InterfaceClass=="8")
{ return "mass-storage"; }
else if (device.$USB["1"].Interface["1"].InterfaceClass=="3")
{ return "mobile"; }
else if (device.$USB["1"].Interface["1"].InterfaceClass=="255")
{ return "mobile"; }
else
{ return "unknown"; }
},
deviceCustomizePopupLoaded: function ()
{
/* add the form element */
this.addElements($('ct-popup').select("input"));
this.addElements($('ct-popup').select("select"));
$("device_info").show();
$("device_error").hide();
/* when the form is submitted, call the onSave method of this class */
$$("#bt_cancel").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$("#bt_save").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this);
$("DeviceToCustomize.$UserFriendlyName").setValue(this.DeviceToCustomize.$UserFriendlyName);
this.truncateDeviceName($("DeviceName"), this.DeviceToCustomize.$UserFriendlyName,32);
$("DeviceToCustomize.$DeviceType").setValue(this.DeviceToCustomize.$DeviceType);
if(this.DeviceToCustomize.InterfaceType=="USB")
{
// TODO : define all possibles
if(this.DeviceToCustomize.$USB["1"].Interface["1"].InterfaceClass=="7")
{ $("DeviceToCustomize.$DeviceType").setValue("printer"); }
else if (this.DeviceToCustomize.$USB["1"].Interface["1"].InterfaceClass=="8")
{ $("DeviceToCustomize.$DeviceType").setValue("usb"); }
else if (this.DeviceToCustomize.$USB["1"].Interface["1"].InterfaceClass=="3")
{ $("DeviceToCustomize.$DeviceType").setValue("mobile"); }
else if (this.DeviceToCustomize.$USB["1"].Interface["1"].InterfaceClass=="255")
{ $("DeviceToCustomize.$DeviceType").setValue("mobile"); }
$("DeviceToCustomize.$DeviceType").disabled=true;
}
if(this.DeviceToCustomize.isSTB)
{
$("DeviceToCustomize.$DeviceType").setValue("stb");
$("DeviceToCustomize.$DeviceType").disabled=true;
}
},
onSave: function (event)
{
// TODO: fixup this
event.stop();
var deviceType =this.DeviceToCustomize.$DeviceType;
//this.DeviceToCustomize._update(this.toObject().DeviceToCustomize);
if($F("DeviceToCustomize.$UserFriendlyName").length<65 && $F("DeviceToCustomize.$UserFriendlyName").strip()!=""){
this.DeviceToCustomize.$UserFriendlyName=$F("DeviceToCustomize.$UserFriendlyName");
this.DeviceToCustomize.$DeviceType=$F("DeviceToCustomize.$DeviceType");
if(this.DeviceToCustomize._changed())
{
this.DeviceToCustomize._save({ onSuccess: this.whenSaved.bind(this,deviceType), onFailure: this.whenNotSaved.bind(this)});
} else {
this.whenNotSaved();
}
}
else if($F("DeviceToCustomize.$UserFriendlyName").length>=65)
{
$$(".device_error_value").innerHTML=t('home.devicescustomize.label.name.error.length','X too long');
$("device_info").hide();
$("device_error").show();
}else {
$$(".device_error_value").innerHTML=t('home.devicescustomize.label.name.error.empty','X empty');
$("device_info").hide();
$("device_error").show();
}
return true;
},
whenSaved: function (deviceType,obj)
{
this.logger.info("object saved");
this.fillForm(obj,deviceType);
ctl.popup.Close();
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
},
onCancel: function(event) {
//this.fillForm();
ctl.popup.Close();
return true;
},
changeDevice: function(device,event) {
this.DeviceToCustomize = device;
ctl.popup.Load(appUrl + '/homeDevicesCustomize.html');
return true;
},
fillForm: function(device,deviceType)
{
if(device.$UserFriendlyName.length>7 && !device.$UserFriendlyName.match(/^mass\sstorage$/i))
{
$(device._path).down(".title").removeClassName("translation");
$(device._path).down(".title").setAttribute("x-sah-tooltip",device.$UserFriendlyName);
this.truncateDeviceName($(device._path).down(".title"),device.$UserFriendlyName,7);
}else if(device.$UserFriendlyName.match(/^mass\sstorage$/i))
{
$(device._path).down(".title").removeAttribute("x-sah-tooltip");
Sah.translator.change($(device._path).down(".title"),"home.label.devices.massstorage.title","Mass Storage");
}
else
{
$(device._path).down(".title").removeAttribute("x-sah-tooltip");
$(device._path).down(".title").innerHTML=device.$UserFriendlyName;
}
$(device._path).removeClassName(Home.General.DeviceClasses[deviceType]);
$(device._path).addClassName(this.getIcon(device));
return true;
},
refreshDevices : function (event)
{
if(event)
{
event.stop();
}
this.isRefreshButton=true;
if (this.refreshedPeriod && event.memo!="button")
{
this.isRefreshButton=false;
this.refreshedPeriod.stop();
this.refreshedPeriod = undefined;
}
this.objects.Home._load({onSuccess : this.whenLoaded.bind(this), onFailure: this.whenNotLoaded.bind(this) });
},
whenLoaded : function (obj)
{
$$(".li-device").each(function(elem) {
elem.remove();
}, this);
this.objects.Devices = this.objects.Home.Hosts;
this.objects.USBINFO = this.objects.Home.USBINFO;
this.fillLists();
if(this.refreshIndex<this.refreshDelays.length && !this.isRefreshButton)
{
this.refresh(this.refreshDelays[this.refreshIndex]);
this.refreshIndex++;
}
},
whenNotLoaded : function (obj)
{
},
clickRightScrollWiredDevice : function (obj)
{
},
truncateDeviceName : function (elem,deviceName,limit)
{
elem.innerHTML = deviceName.substring(0,limit)+"...";
},
adjustElements : function (id,numberofElements)
{
var containerWidth = $(id).getWidth();
var lIWidth = $(id).down("li").getWidth();
var marginLeft = parseInt((containerWidth-(numberofElements*lIWidth))/2,10);
$(id).down("ul").setStyle("margin-left:"+marginLeft+"px;");
},
onAccessToUSB : function (element,event)
{
event.stop();
this.client.get("Home.USBINFO",{}, function(element,object, response)
{
var usb =this.selectUSB(object,element.sahObject.$USB["1"].SerialNumber);
if(usb)
{
var localhost = this.objects.Devices._childs.select(function (h) { return h.HostName == "localhost";});
var disk =this.selectDisk(object,usb._path.replace("Home.USBINFO.",""));
if(disk)
{
var partitionName = disk.Partition["1"].FriendlyName.replace(/[^0-9a-zA-Z]/g,"_");
if(Sah.Tools.getIEVersion())
{
var location = "\\\\livebox\\"+partitionName;
window.open(location);
}
else
{
ctl.msgbox.Show(ctl.msgbox.QUESTION.INFO,t('home.usb.access.comment','X Use path')+'<br />\\\\livebox\\'+partitionName+'\\',(function(){}).bind(this));
}
}
}
}.bind(this,element));
},
onEjectUSB :function (element,event) {
event.stop();
this.client.get("Home.USBINFO",{}, function(element,object, response)
{
var usb =this.selectUSB(object,element.sahObject.$USB["1"].SerialNumber);
if(usb)
{
var disk =this.selectDisk(object,usb._path.replace("Home.USBINFO.",""));
if(disk)
{
disk.RemoveDisk =1;
disk._save({
onSuccess : this.whenUSBEjected.bind(this,element),
onFailure : this.whenNotEjected.bind(this)
});
}
}
}.bind(this,element));
},
whenUSBEjected : function (element,obj)
{
element.down(".files").hide();
element.down(".eject").hide();
element.next(".infoUsb").remove();
element.addClassName("mass-storage-empty");
element.removeClassName("mass-storage-notempty");
element.insert({"after":this.createInfoElement("home.label.devices.massstorage.ejected","X Ejected")});
this.logger.info("mass storage is ejected");
},
whenNotEjected :function (obj)
{
this.logger.info("mass storage is not ejected");
},
selectUSB :function (usbInfo,serialNumber)
{
var usb = usbInfo.USB.Host["1"].Device._childs.select(function(serialNumber,device) { return device.SerialNumber == serialNumber; }.curry(serialNumber));
return usb.length>0?usb[0]:false;
},
selectDisk :function (usbInfo,usbPath)
{
var disk = usbInfo.Disk._childs.select(function(usbPath,disk) { return disk.USBDevice == usbPath; }.curry(usbPath));
return disk.length>0?disk[0]:false;
},
createInfoElement : function (key,text) {
this.UsbInfo='<div class="icon png"></div><div class="title translation Translations.'+key+'">'+t(key,text)+'</div>';
var infoUsbElement =new Element("li");
infoUsbElement.addClassName("info");
infoUsbElement.addClassName("infoUsb");
infoUsbElement.addClassName("li-device");
infoUsbElement.innerHTML = this.UsbInfo;
return infoUsbElement;
},
detectStbDevices : function (deviceList)
{
if (!this.objects.Home.Lease) {
return deviceList;
}
this.objects.Home.Lease._childs.each(function (lIt) {
var poolIndex = parseInt(lIt.PoolReference.split(".")["3"]);
if (!lIt.RxOptions) {
return;
}
lIt.RxOptions._childs.each(function (oIt) {
if (oIt.Option === "77" && this.objects.Home.Pool[poolIndex].Name.match(/^mltv_/)) {
document.fire("sah:home:general:stb:detected");
if (this.objects.Home.Pool[poolIndex].Name === "mltv_stb") {
deviceList.detect(function (dIt) {
if(dIt.MACAddress === lIt.MACAddress) {
dIt.isSTB = true;
return true
}
return false
}, this);
}
}
}, this);
}, this);
return deviceList;
},
refresh: function (refreshPeriod)
{
if (this.refreshedPeriod)
{
this.refreshedPeriod.stop();
this.refreshedPeriod = undefined;
}
document.fire("sah:home:general:refresh");
this.refreshedPeriod = new PeriodicalExecuter(this.refreshDevices.bind(this), refreshPeriod);
},
initRefreshDelays : function()
{
this.refreshDelays[0] =15;
this.refreshDelays[1] =15;
this.refreshDelays[2] =15;
// this.refreshDelays[3] =60;
this.refreshIndex = 0;
}
});
Home.General.DeviceClasses = {
"mobile": "mobile",
"laptop": "laptop",
"computer" : "desktop",
"stb" : "stb",
"tv": "tv",
"printer" :"printer",
"game":"game",
"Unknown":"desktop",
"liveradio":"liveradio",
"photo":"photoframe",
"usb":"mass-storage"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/deviceSelect.js */
/**
* The home device form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Home.DeviceSelect = Class.create(Sah.AuthenticatedForm,
/** @lends Home.DeviceSelect */
{
initialize: function ($super, form)
{
$super(form);
this.form.addClassName("DeviceSettings");
document.observe('sah:lan:deviceListSelect:deviceChanged', this.deviceChanged.bind(this));
/* TODO : Use the identifier ofthe Save and Cancel buttons of Wifi/scheduling_period
$("Home/DeviceList/Save").observe("click", this.onSave.bind(this));
$("Home/DeviceList/Cancel").observe("click", this.onCancel.bind(this)); */
/* prepare to load the objects we need */
this.needs("InternetParameters", { path: "igd.Services.$Internet", depth: 1 });
this.needs("Host", { path: function () { return "igd." + this.objects.InternetParameters.LANConnection+ ".Hosts.Host";},
depth: 3 });
this.needs("Rooms", { path: "igd.UserInterface.$Room", depth: 3 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.HomeDevice = this.objects.Host[1];
this.prepareForm();
this.fillForm();
this.form.enable();
},
deviceChanged: function (event)
{
this.objects.HomeDeviceSelect = event.memo;
this.fillForm();
},
prepareForm: function ()
{
/* Get the room Name "Not Tested because HomeDeviceSelect.$Room is empty" */
//this.objects.Rooms.each(function (room) {
// if(room._path == HomeDeviceSelect.$$Room)
// $("HomeDeviceSelect.$Room").getValue = room.Name;
//});
},
fillForm: function ()
{
this.fromObject(this.objects);
if (this.objects.HomeDeviceSelect.Active == "1")
{
$("HomeDeviceSelect.Active").innerHTML = "Connected";
$("HomeDeviceSelect.Active").setStyle("color: Green");
}
else
{
$("HomeDeviceSelect.Active").innerHTML = "Disconnected";
$("HomeDeviceSelect.Active").setStyle("color: Red");
}
},
onSave: function (event)
{
event.stop(event);
this.objects.HomeDeviceSelect._update(this.toObject().HomeDeviceSelect);
if (this.objects.HomeDeviceSelect._changed())
{
this.markAsLoading();
this.objects.HomeDeviceSelect._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
this.logger.info("nothing has changed in LanAccess, skipping save");
return false;
},
whenSaved: function (obj)
{
this.markAsLoaded();
this.logger.info("object saved");
this.fromObject(this.objects);
},
whenNotSaved: function (obj)
{
this.markAsLoaded();
/* TODO: fix error handling */
alert("not saved");
},
onCancel: function(event){
this.fromObject(this.objects);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/device.js */
/**
* The home device form
*
* When the class is intantiated, the initialize method is called. There you first
* need to call the parent constructor using $super. Then you can set up the various
* event handlers that you will need. Then you need to define which objects you need
* from sahbus with the needs() method. Finally you can call the load method that
* will load those objects.
*
* When all the objects needed are loaded, the method objectsLoaded() will be called.
* By default, the object fetched are stored into the variable objects. If you need
* to, like in this case, you can setup other variables in objects. Those will be
* used to fillup the form with the values from sahbus and to save the form into
* sahbus. A mapping is automatically created that maps the objects properties to
* form elements, using the this.fromObject(this.objects) method. You can than store
* back the form in the objects by using object._update(this.toObject) method.
* @class
* @augments Sah.AuthenticatedForm
*/
Home.Device = Class.create(Sah.AuthenticatedForm,
/** @lends Home.Device */
{
initialize: function ($super, form)
{
$super(form);
$("CustomDevice").hide();
this.form.addClassName("DeviceSettings");
document.observe('sah:lan:deviceList:deviceChanged', this.deviceChanged.bind(this));
/* when the form is submitted, call the onSave method of this class */
$$(".HemDeviceCancel").each( function (btn) {
btn.observe("click", this.onCancel.bind(this));
},this);
$$(".HomeDeviceSave").each( function (btn) {
btn.observe("click", this.onSave.bind(this));
},this);
$("Home/Device/Back").observe("click",this.onBack.bind(this));
/* prepare to load the objects we need */
this.needs("InternetParameters", { path: "igd.Services.$Internet", depth: 1 });
this.needs("Host", { path: function () { return "igd." + this.objects.InternetParameters.LANConnection+ ".Hosts.Host";},
depth: 6 });
this.needs("Rooms", { path: "igd.UserInterface.$Room", depth: 3 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.HomeDevice = this.objects.Host[1];
this.prepareForm();
this.fillForm();
this.form.enable();
},
deviceChanged: function (event)
{
this.objects.HomeDevice = event.memo;
/* Get Type Device */
if (( this.objects.HomeDevice.InterfaceType == "USB" ) || ( this.objects.HomeDevice.$DeviceType == "Printer" ))
{
$("HomeDevice.MACAddress").up("dd").hide();
$("HomeDevice.MACAddress").up("dd").previous("dt").hide();
$("HomeDevice.DNShostname").up("dd").hide();
$("HomeDevice.DNShostname").up("dd").previous("dt").hide();
$("HomeDevice.ProductID").up("dd").show();
$("HomeDevice.ProductID").up("dd").previous("dt").show();
/* Product ID */
var productid = this.objects.HomeDevice.$USB["1"].ProductID;
var product = this.objects.HomeDevice.$USB["1"].Product;
this.objects.HomeDevice.ProductID = product + productid;
}
else
{
$("HomeDevice.MACAddress").up("dd").show();
$("HomeDevice.MACAddress").up("dd").previous("dt").show();
$("HomeDevice.DNShostname").up("dd").show();
$("HomeDevice.DNShostname").up("dd").previous("dt").show();
$("HomeDevice.ProductID").up("dd").hide();
$("HomeDevice.ProductID").up("dd").previous("dt").hide();
}
this.fillForm();
$("DeviceManagement").hide();
/* TODO: remove commented code */
//$("CustomDevice").setStyle("display:block");
$("CustomDevice").show();
},
prepareForm: function (){
/* list of possible values is hard coded in application's side
* TODO: damien: where to store all these ? */
var valueList = "Desktop, Laptop, WiFi Device, Mobile Device, Phone, Mass Storage, USB Key, Printer, Set-Top Box, TV Set, Video Renderer"
+ ", Game Console, HiFi, Photo Frame, Unknown";
valueList.split(/\s*,\s*/).each(function (device) {
var option = new Element("option", { value: device });
option.insert(device);
$("HomeDevice.$DeviceType").insert(option);
}, this);
this.objects.Rooms.each(function (room) {
var option = new Element("option", { value: room._path });
option.insert(room.Name);
$("HomeDevice.$Room").insert(option);
});
},
fillForm: function ()
{
this.fromObject(this.objects);
},
onSave: function (event)
{
event.stop(event);
this.objects.HomeDevice._update(this.toObject().HomeDevice);
if (this.objects.HomeDevice._changed())
{
this.markAsLoading();
this.objects.HomeDevice._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
this.logger.info("nothing has changed in LanAccess, skipping save");
return false;
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.markAsLoaded();
this.fromObject(this.objects);
},
whenNotSaved: function (obj)
{
/* TODO: fix error handling */
alert("not saved");
},
onCancel: function(event){
this.markAsLoaded();
this.fromObject(this.objects);
},
onBack : function(event)
{
this.objects.HomeDevice._load();
$("CustomDevice").hide();
$("DeviceManagement").show();
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/definitions.js */
Home.Definitions = Class.create(Sah.Form, {
initialize: function ($super, form)
{
$super(form);
// this.form.hide();
this.template = $$(".templateDef")[0];
this.lastElement = this.template;
this.fillDefinitions(ctl.popup.definitionObject);
this.template.hide();
},
fillDefinitions : function (defList)
{
for(keyDef in defList)
{
var element = this.template.clone(true);
element.down(".title").innerHTML ="<span>"+defList[keyDef].title+"<span>";
element.down(".text").innerHTML="<span>"+defList[keyDef].description+"<span>";
this.lastElement.insert({"after":element});
this.lastElement = element;
}
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/authentication.js */
Home.Authentication = Class.create(Sah.Form,
/** @lends Home.Login# */
{
initialize: function ($super, form)
{
$super(form);
this.auth = new Sah.Auth(this.client);
$("bt_save").observe("click", this.doLogin.bind(this));
$("bt_cancel").observe("click", this.clearLogin.bind(this));
this.load();
},
doLogin: function (event)
{
$$(".auth-failure").each(function (e) { e.hide(); });
this.logger.info("loging in");
Event.stop(event);
if ($F("Username").match(/^\s*$/) || $F("Password").match(/^\s*$/)) {
this.authFailure();
return false;
}
this.logger.info("request");
this.auth.login($F("Username"), $F("Password"), {
onSuccess: this.authSuccessfull.bind(this),
onFailure: this.authFailure.bind(this)
});
return false;
},
clearLogin: function (event)
{
$$(".auth-failure").each(function (e) { e.hide(); });
Event.stop(event);
$("Username").setValue("");
$("Password").setValue("");
return false;
},
authSuccessfull: function (object)
{
this.redirect("/");
},
authFailure: function ()
{
this.logger.info("auth failure");
$$(".auth-failure").each(function (e) { e.show(); });
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/accessibility.js */
Home.Accessibility = Class.create(Sah.Form,
{
initialize: function ($super, form)
{
$super(form);
this.form.show();
$("header-controls-accessibility-minus").observe("click",this.setAccessibilityMinus.bind(this));
$("header-controls-accessibility-plus").observe("click",this.setAccessibilityPlus.bind(this));
if( Cookie.get("accessibility")) {
document.body.className=Cookie.get("accessibility");
}
},
setAccessibilityMinus :function (event){
Cookie.set("accessibility", "accessibility-normal");
},
setAccessibilityPlus : function (event) {
Cookie.set("accessibility", "accessibility-big");
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/accessType.js */
Home.AccessType = Class.create(Sah.Form,
{
initialize: function ($super, form)
{
$super(form);
this.objects.nbRefresh = 1;
this.objects.stopRereshReq = true;
this.objects.runningReq = false;
this.timeout = null;
this.setupAccessType = $("setupAccessType");
this.legalInfo = $("legal_Info").innerHTML;
$("ConnTypeOpt.DSL").observe("click", this.onRadioChange.bind(this));
$("ConnTypeOpt.ETHERNET").observe("click", this.onRadioChange.bind(this));
$("footer-menu").observe("click", this.onInfoLegalAccess.bind(this));
$("setup-link-restore").observe("click", this.onRestore.bind(this));
$$(".bt_save").each(function (b) {
b.observe("click", this.onSave.bind(this));
}, this);
$$(".bt_cancel").each(function (b) {
b.observe("click", this.onCancel.bind(this));
}, this);
this.needs("FirstAccessType", {
path: "First.AccessType",
depth: -1
});
this.connected = null;
this.form.disable();
this.load();
},
onRestore:function(){
$('setup-link-restore').hide();
$('setup-label-restore').hide();
$('setup-accasstype-tab-setup').hide();
$('setup-accasstype-tab-restore').show();
},
objectsLoaded: function ()
{
this.fromObject(this.objects);
this.prepareForm();
this.fillForm();
this.form.enable();
},
prepareForm : function()
{
if(this.objects.FirstAccessType.Protocol ==="DHCP")
{
$$(".protocol").each(function(elem){
elem.hide();
});
}
},
fillForm: function ()
{
$("setup.accesstype.error").hide();
if( this.objects.FirstAccessType.AccessType === "Ethernet" )
{
this.clickRadio("ConnTypeOpt.ETHERNET");
this.unclickRadio("ConnTypeOpt.DSL");
}
else
{
this.clickRadio("ConnTypeOpt.DSL");
this.unclickRadio("ConnTypeOpt.ETHERNET");
}
if( ( this.objects.FirstAccessType.LinkType === "EoA") || ( this.objects.FirstAccessType.LinkType.include( "PPP" ) ) )
{
if( ( this.objects.FirstAccessType.WANPPPConnection.Username ) &&
( this.objects.FirstAccessType.WANPPPConnection.Username != "" ) )
{
var login = this.objects.FirstAccessType.WANPPPConnection.Username;
if( login.length > 4 )
{
if( login.substr( 0, 4 ) === "fti/" )
{
login = login.substr( 4, login.length );
}
}
$("FirstAccessType.WANPPPConnection.Username").setValue( login );
$("FirstAccessType.WANPPPConnection.Password").setValue( "************" );
}else{
$("FirstAccessType.WANPPPConnection.Username").setValue( "" );
$("FirstAccessType.WANPPPConnection.Password").setValue( "" );
}
}
else
{
$("setup.accesstype.credentials").hide();
}
this.fixFirefoxBgRedraw();
},
// Uncheck another radio, and update the new radio
onRadioChange: function(event)
{
var checkedRadioId = Event.element(event).readAttribute("id");
var oldRadioId = this.OldRadio;
this.unclickRadio(oldRadioId);
this.clickRadio(checkedRadioId);
},
clickRadio: function(checkRadioId)
{
this.OldRadio=checkRadioId;
$(checkRadioId).checked = true;
},
unclickRadio: function(checkRadioId)
{
$(checkRadioId).checked = false;
},
onSave: function(event)
{
var areCredentialsValid = true;
var login = "";
var password = "";
var WANConnection = null;
this.beforeRequest();
event.stop(event);
$("setup.accesstype.error").hide();
if( ( this.objects.FirstAccessType.LinkType === "EoA") || ( this.objects.FirstAccessType.LinkType.include( "PPP" ) ) )
{
WANConnection = this.objects.FirstAccessType.WANPPPConnection;
login = $("FirstAccessType.WANPPPConnection.Username").getValue();
if( ( login.length > 4 ) && ( login.substr( 0, 4 ) === "fti/" ) )
{
login = login.substr( 4, login.length );
$("FirstAccessType.WANPPPConnection.Username").setValue( login );
}
password = $("FirstAccessType.WANPPPConnection.Password").getValue();
if( ( login.strip() === "" ) || ( password.strip() === "" ) )
{
areCredentialsValid = false;
}
else
{
if (this.objects.FirstAccessType.Protocol !=="DHCP") {
if( appConfig === 'fr' || appConfig === 'mini-fr')
{
this.objects.FirstAccessType.WANPPPConnection.Username = "fti/" + login;
}
else
{
this.objects.FirstAccessType.WANPPPConnection.Username = login;
}
if( password !== "************" )
{
this.objects.FirstAccessType.WANPPPConnection.Password = password;
}
this.objects.FirstAccessType.WANPPPConnection.Enable = 1;
areCredentialsValid = true;
}
}
}
else
{
WANConnection = this.objects.FirstAccessType.WANIPConnection;
}
if( areCredentialsValid === true || this.objects.FirstAccessType.Protocol ==="DHCP")
{
if( this.OldRadio === "ConnTypeOpt.DSL" )
{
this.objects.FirstAccessType.AccessType = "DSL";
}
else
{
this.objects.FirstAccessType.AccessType = "Ethernet";
}
this.objects.FirstAccessType.ConfigSave = 0;
this.userName =false;
if(WANConnection["Username"] != WANConnection._parameters["Username"]){
this.userName = WANConnection["Username"];
}
WANConnection._save({
onSuccess: this.whenPPPSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.running.label","Athentification en cours",
"setup.accesstype.error.running.description","X Authentication running...",
0 );
}
else
{
this.showErrorMsg($("setup.accesstype.error"),
"setup.accesstype.error.empty.label","X Invalid values",
"setup.accesstype.error.empty.description","X Check that login and password are correct.",
0 );
}
},
beforeRequest:function(){
this.stopRefreshStatus();
$$(".bt_save")[0].disable();
this.objects.stopRereshReq = false;
this.objects.runningReq = true;
},
afterRequest:function(){
this.objects.runningReq = false;
$$(".bt_save")[0].enable();
},
whenPPPSaved: function (obj)
{
if(this.objects.stopRereshReq){
this.afterRequest();
return;
}
if(this.userName && obj._parameters["Username"]!=this.userName){
this.stopRefreshStatus();
if(this.timeout)
{
clearTimeout(this.timeout);
this.timeout = null;
}
this.showErrorMsg($("setup.accesstype.error"),
"setup.accesstype.error.empty.label","X Invalid values",
"setup.accesstype.error.empty.description","X Check that login and password are correct.",
0 );
return false;
}
this.objects.FirstAccessType._save({
onSuccess: this.whenConnectionSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
return true ;
},
whenConnectionSaved: function (obj)
{
this.objects.FirstAccessType.ConfigSave = 1;
this.objects.FirstAccessType._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenSaved: function (obj)
{
this.afterRequest();
if(this.objects.stopRereshReq){
return;
}
this.objects.nbRefresh = 1;
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.running.label","Athentification en cours",
"setup.accesstype.error.running.description","X Authentication running...",
this.objects.nbRefresh );
Cookie.set( 'WanInterfaceConfig', this.objects.FirstAccessType.AccessType );
this.refreshStatus(2);
},
whenNotSaved: function (obj)
{
this.afterRequest();
if(this.objects.stopRereshReq){
return;
}
this.logger.warn("Saving connection parameters failed");
this.logger.warn(obj);
},
connectedLoaded: function (response)
{
$("header-logo-livebox").observe("click",function(event) {
event.stop();
this.redirect("/");
}.bind(this));
this.connected = response.responseText;
$("connected-popup").update(this.connected);
},
stopRefreshStatus: function (){
this.objects.stopRereshReq = true;
window.clearTimeout(this.timeout);
this.timeout = null;
},
refreshStatus: function (refreshPeriod)
{
if (!this.connected) {
new Ajax.Request(Sah.link("/setupAccessConfirmation.html"), {
method: "get",
onSuccess: this.connectedLoaded.bind(this)
});
}
if(this.objects.stopRereshReq || this.objects.runningReq){
return;
}
if(!this.timeout) {
this.timeout = window.setTimeout((function(event){
this.objects.FirstAccessType._load( this.checkStatus.bind(this) );
}).bind(this), refreshPeriod * 1000);
}
},
checkStatus : function ()
{
if(this.objects.stopRereshReq || this.objects.runningReq){
return;
}
if( this.objects.FirstAccessType.WLANLedColor == "Red" )
{
if( this.objects.FirstAccessType.AccessType === "Ethernet" )
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.ftth_link.label","X EthernetLinkStatus " + this.objects.FirstAccessType.EthernetLinkStatus,
"setup.accesstype.error.ftth_link.description","X Link with fiber mode is down",
0 );
}
else
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.adsl_link.label","X PhysicalLinkStatus " + this.objects.FirstAccessType.PhysicalLinkStatus,
"setup.accesstype.error.adsl_link.description","X ADSL synchronization failed",
0 );
}
}
else
{
var WANConnection = null;
if( ( this.objects.FirstAccessType.LinkType === "EoA") || ( this.objects.FirstAccessType.LinkType.include( "PPP" ) ) )
{
WANConnection = this.objects.FirstAccessType.WANPPPConnection;
}
else
{
WANConnection = this.objects.FirstAccessType.WANIPConnection;
}
if( ( this.objects.FirstAccessType.WLANLedColor == "Green" ) || ( WANConnection.ConnectionStatus == "Connected") )
{
this.showConfirmation();
return;
}
else if( WANConnection.ConnectionStatus == "Connecting" )
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.running.label","X Authentification en cours",
"setup.accesstype.error.running.description","X Authentication running...",
this.objects.nbRefresh );
this.objects.nbRefresh += 1;
}
else if( WANConnection.ConnectionStatus == "Unconfigured" ) /// PPP only
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.ppp_server.label","X ConnectionStatus " + WANConnection.ConnectionStatus,
"setup.accesstype.error.ppp_server.description","X Authentication server unconfigured",
0 );
}
else if( WANConnection.LastConnectionError == "ERROR_AUTHENTICATION_FAILURE" )
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.authentication.label","X Authentication Failure",
"setup.accesstype.error.authentication.description","X Authentication Failure",
0 );
}
else if( WANConnection.LastConnectionError == "ERROR_ISP_TIMEOUT" ) /// PPP only
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.ppp_timeout.label","X LastConnectionError " + WANConnection.LastConnectionError,
"setup.accesstype.error.ppp_timeout.description","X Authentication server timeout",
0 );
}
else
{
this.showErrorMsg( $("setup.accesstype.error"),
"setup.accesstype.error.running.label","X Authentification en cours",
"setup.accesstype.error.running.description","X Authentication running...",
this.objects.nbRefresh );
this.objects.nbRefresh += 1;
}
}
this.timeout = null;
this.refreshStatus(2);
},
fixFirefoxBgRedraw: function ()
{
if (Prototype.Browser.Gecko) {
/* force firefox redraw */
$('document-background-footer').setOpacity(0.99);
window.setTimeout(function () {
$('document-background-footer').setOpacity(1);
}, 2);
}
},
showErrorMsg : function(div, errorHeaderLabel, errorHeaderDefault, errorMsgLabel, errorMsgDefault, nbRefresh )
{
Sah.translator.change(div.down("h3"), errorHeaderLabel, errorHeaderDefault);
Sah.translator.change($("setup.accesstype.error.text"), errorMsgLabel, errorMsgDefault);
if( nbRefresh > 0 )
{
$("setup.accesstype.error.waiter").update( Wan.ConnectionSettings.Waiter[(nbRefresh%10)] );
}
else
{
$("setup.accesstype.error.waiter").update( "" );
}
div.show();
this.fixFirefoxBgRedraw();
},
onCancel: function(event)
{
event.stop();
this.stopRefreshStatus();
this.fillForm();
},
onInfoLegalAccess : function (event)
{
event.stop();
this.stopRefreshStatus();
this.infoLegalLoaded();
},
infoLegalLoaded: function ()
{
$("header-logo-livebox").observe("click",function(event) {
event.stop();
if (this.objects.FirstAccessType.UserConnected != "1")
this.redirect("/setupAccessType.html");
else
this.redirect("/");
}.bind(this));
$("content-center").update(this.legalInfo);
Sah.translator.update();
this.fixFirefoxBgRedraw();
},
showConfirmation: function ()
{
window.clearTimeout(this.timeout);
this.timeout = null;
this.objects.FirstAccessType.UserConnected = "1";
this.objects.FirstAccessType._save(function () {
$("connected-popup").remove();
$("content").update(this.connected);
$CYT('.Translations.general.btn.interfaceaccess')[0].className += '.' + appConfig;
Sah.translator.update();
this.fixFirefoxBgRedraw();
}.bind(this), "UserConnected");
}
});
Home.AccessType.Waiter = [ "..", "....", "......", "........", "..........", "........", "......", "....", "..", "" ];
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/abstract.js */
/**
* @namespace Holds the home entity and its associated forms
*/
Home.Abstract = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/abstract/services.js */
/*
*
* Abstract Services
*
* ( Abstract Services )
*
*/
Home.Abstract.Services = Class.create(Sah.Form,
/** @lends Home.Abstract.Services# **/
{
initialize: function($super, form)
{
$super(form);
this.form.hide();
this.stbDetected = false;
/* setup events */
$("bt_refresh").observe("click",this.refreshStatus.bind(this));
document.observe("sah:home:general:stb:detected", this.onStbDetect.bind(this));
document.observe("sah:home:general:tv:set", this.setTvStatus.bind(this));
document.observe("sah:home:general:refresh", this.refreshStatus.bind(this));
this.needs("Home", { path: "Home" });
this.load();
},
objectsLoaded: function()
{
this.connectionStatus =false;
this.objects.Services = this.objects.Home.Services;
this.setOrangeWifiCookie();
Cookie.set("wanInterfaceType",this.objects.Services.WANInterfaceType);
Cookie.set("WanInterfaceConfig", this.objects.Services.WANInterfaceType);
this.fillForm();
this.form.show();
},
setOrangeWifiCookie : function()
{
if(this.objects.Services.EnableWifiComm && this.objects.Services.EnableWifiComm.match(/true|1/i))
{
Cookie.set("orangeWifiEnable","1");
}else {
Cookie.set("orangeWifiEnable","0");
}
},
fillForm : function ()
{
if(this.objects.Services.LinkType.toUpperCase().include("PPP") || this.objects.Services.LinkType.toUpperCase().include("EOA"))
{
this.setPPPConnectionStatus();
}
else
{
this.setIPConnectionStatus();
}
// this.setTvStatus();
if( this.objects.Services.VOIPLedState !== "Off" )
{
$('Services.Phone').setStyle({ color: '#3caa0a' });
Sah.translator.change($("Services.Phone"), "general.label.available","X available");
this.setSmallIcon($$('.icon-phone')[0],"icons-leds-small-red","icons-leds-small-green");
if ( ( this.objects.Services.PhoneNumber !== "" ) && ( this.objects.Services.PhoneNumber.length > 5 ) )
{
$("Services.PhoneNumber").innerHTML ="N° " + Sah.Tools.formatPhoneNumber( this.objects.Services.PhoneNumber );
}
else
{
$("Services.PhoneNumber").innerHTML = "";
}
}
else
{
$('Services.Phone').setStyle({color: 'red'});
Sah.translator.change($("Services.Phone"), "general.label.unavailable","X unavailable");
this.setSmallIcon($$('.icon-phone')[0],"icons-leds-small-green","icons-leds-small-red");
$("Services.PhoneNumber").innerHTML = "";
}
var elem = $("home-dashboard-wireless-label").down(".label").down("span");
if(this.objects.Services.WifiEnable=="1")
{
this.setSmallIcon($("home-dashboard-wireless-label").down(".icons"),"icons-leds-small-red","icons-leds-small-green");
elem.setStyle({ color: '#3caa0a' });
Sah.translator.change(elem, "general.label.wifienable","X available");
}
else
{
this.setSmallIcon($("home-dashboard-wireless-label").down(".icons"),"icons-leds-small-green","icons-leds-small-red");
elem.setStyle({ color: 'red' });
Sah.translator.change(elem, "general.label.wifidisable","X unavailable");
}
},
setSmallIcon : function(element, classToRemove, classToAdd){
element.removeClassName(classToRemove);
element.addClassName(classToAdd);
},
refreshStatus : function (event) {
event.stop();
this.stbDetected=false;
this.objects.Services._load({onSuccess : this.whenLoaded.bind(this), onFailure: this.whenNotLoaded.bind(this) });
},
whenLoaded : function (obj)
{
this.fillForm();
},
whenNotLoaded : function (obj)
{
},
setPPPConnectionStatus : function ()
{
/* Clolored text Wan Common Interface */
if( this.objects.Services.WLANLedColor == "Green" )
{
$('Services.InternetConnection').setStyle({ color: '#3caa0a' });
Sah.translator.change($("Services.InternetConnection"), "general.label.available","X available");
this.setSmallIcon($$('.icon-internet')[0],"icons-leds-small-red","icons-leds-small-green");
this.connectionStatus=true;
}
else
{
$('Services.InternetConnection').setStyle({color: 'red'});
Sah.translator.change($("Services.InternetConnection"), "general.label.unavailable","X unavailable");
this.setSmallIcon($$('.icon-internet')[0],"icons-leds-small-green","icons-leds-small-red");
}
},
setIPConnectionStatus : function ()
{
if( this.objects.Services.WLANLedColor == "Green" )
{
$('Services.InternetConnection').setStyle({ color: '#3caa0a' });
Sah.translator.change($("Services.InternetConnection"), "general.label.available","X available");
this.setSmallIcon($$('.icon-internet')[0],"icons-leds-small-red","icons-leds-small-green");
this.connectionStatus=true;
}
else
{
$('Services.InternetConnection').setStyle({color: 'red'});
Sah.translator.change($("Services.InternetConnection"), "general.label.unavailable","X unavailable");
this.setSmallIcon($$('.icon-internet')[0],"icons-leds-small-green","icons-leds-small-red");
}
},
setTvStatus : function (event)
{
event.stop();
if (this.objects.Services.TV == "1" || this.objects.Services.TV == "3" )
{
if(this.objects.Services.TV == "1")
{
$('Services.TV').setStyle({ color: 'black' });
Sah.translator.change($("Services.TV"), "general.label.unmanaged","X bridged");
this.setSmallIcon($$('.icon-tv')[0],"icons-leds-small-black","icons-leds-small-black");
}
else if(this.objects.Services.TV == "3" && this.stbDetected && this.connectionStatus)
{
$('Services.TV').setStyle({ color: '#3caa0a' });
Sah.translator.change($("Services.TV"), "general.label.available","X available");
this.setSmallIcon($$('.icon-tv')[0],"icons-leds-small-black","icons-leds-small-green");
}
else
{
$('Services.TV').setStyle({color: 'red'});
Sah.translator.change($("Services.TV"), "general.label.unavailable","X unavailable");
this.setSmallIcon($$('.icon-tv')[0],"icons-leds-small-black","icons-leds-small-red");
}
}
else
{
$('Services.TV').setStyle({color: 'red'});
Sah.translator.change($("Services.TV"), "general.label.unavailable","X unavailable");
this.setSmallIcon($$('.icon-tv')[0],"icons-leds-small-black","icons-leds-small-red");
}
},
onStbDetect : function (event)
{
event.stop();
this.stbDetected = true;
// this.setTvStatus();
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/home/abstract/general.js */
/*
*
* Abstract General
*
* ( Abstract Services )
*
*/
Home.Abstract.General = Class.create(Sah.Form,
/** @lends Home.Abstract.General# **/
{
initialize: function($super, form)
{
$super(form);
this.needs("InternetParameters", { path: "igd.Services.$Internet", depth: 1 });
/* WANPPP Connection */
this.needs("WANConnectionDevice");
this.needs("DynamicDNS", { path: "igd.Services.$DynamicDNS.Client", depth: 3 });
/* Dhcp */
this.needs("LanDhcp", { path: function () { return "igd."
+ this.objects.InternetParameters.LANConnection+ ".LANHostConfigManagement" ; }, depth: 1 });
/* UPnP */
this.needs("Upnp", { path: "igd.Services.$UPnP_IGD", depth: 1 });
/* Device Info */
this.needs("DeviceInfo", { path: "igd.DeviceInfo", depth: 1 });
/* Device Config */
this.needs("DeviceConfig", { path: "igd.DeviceConfig", depth: 1 });
/* Ma ligne TV */
this.needs("MaLigneTV", { path: "igd.Services.$MaLigneTV", depth: 1 });
/*Voice Info */
// TODO: do we need to fetch the whole object here ? It is slowing evertything
this.needs("VoiceInfo", { path: "atomic.Voice.Profile", depth: 2 });
this.load();
},
objectsLoaded: function()
{
this.prepareForm();
// this.fillForm();
},
prepareForm: function ()
{
var is_PPP = this.objects.WANDSLLinkConfig.LinkType;
var is_DSL = this.objects.DeviceConfig.$WANInterfaceType;
var enableTV = this.objects.MaLigneTV.Enable;
this.objects.Mode = this.objects.MaLigneTV;
/* Manipulate Ethernet Colored Port */
this.objects.Mode.Red = this.GetLanMode("red", is_DSL, enableTV);
this.objects.Mode.Yellow = this.GetLanMode("yellow", is_DSL, enableTV);
this.objects.Mode.Green = this.GetLanMode("green", is_DSL, enableTV);
this.objects.Mode.White = this.GetLanMode("white", is_DSL, enableTV);
/* Phone Number */
this.objects.VoiceInfo.Number = this.getPhoneNumber(this.objects.VoiceInfo);
if (is_PPP.include("PPP") || is_PPP=="EoA" || is_PPP=="ETHoA") {
this.objects.WANConnection = this.objects.WANPPPConnection;
this.objects.WANConnection.Uptime = Sah.Tools.dateHMS(this.objects.WANPPPConnection.Uptime!=""?this.objects.WANPPPConnection.Uptime:"0");
}
else {
this.objects.WANConnection = this.objects.WANIPConnection;
}
this.objects.Home = this.objects;
this.fromObject(this.objects);
if (this.objects.DynamicDNS._childs.length > 0 && this.objects.DynamicDNS._childs[0].Status == "Enabled")
$('Home.DynamicDNS.Status').setStyle({color:'Green'});
else {
$('Home.DynamicDNS.Status').setStyle({color:'Red'});
$('Home.DynamicDNS.Status').update('Disabled');
}
if (this.objects.LanDhcp.DHCPServerEnable == 1 ) {
$('Home.LanDhcp.DHCPServerEnable').update('Enabled');
$('Home.LanDhcp.DHCPServerEnable').setStyle({color: 'Green'});
}
else {
$('Home.LanDhcp.DHCPServerEnable').setStyle({color: 'Red'});
$('Home.LanDhcp.DHCPServerEnable').update('Disabled');
}
if (this.objects.Upnp.Enable == "1" ) {
$('Home.Upnp.Enable').setStyle({color: 'Green'});
$('Home.Upnp.Enable').update('Enabled');
}
else {
$('Home.Upnp.Enable').setStyle({color: 'Red'});
$('Home.Upnp.Enable').update('Disabled');
}
},
setColor:function(id,val)
{
if (this.objects[id] == val )
{
$(id).update('Enabled');
$(id).setStyle({color: 'Green'});
}
else
{
$(id).setStyle({color: 'Red'});
$(id).update('Disabled');
}
},
// TODO: cleanup code style, variable names
GetLanMode: function(EthernetPort, mbv_DSL_Enable, mbv_MaLigneTV_Enable)
{
Mode = "";
if ("red" == EthernetPort)
{
if (("DSL" == mbv_DSL_Enable)&&(1 == mbv_MaLigneTV_Enable ))
{
Mode = "Internet";
}
else
{
Mode = "Internet/TV";
}
}
else if("white" == EthernetPort)
{
if("Ethernet" == mbv_DSL_Enable)
{
Mode = "WAN";
}
else
{
if(1 == mbv_MaLigneTV_Enable)
{
Mode = "Internet";
}
else
{
Mode = "Internet/TV";
}
}
}
else
{
if(("DSL" == mbv_DSL_Enable)&&(1 == mbv_MaLigneTV_Enable))
{
Mode = "TV";
}
else
{
Mode = "Internet/TV";
}
}
return Mode;
},
getPhoneNumber : function (voiceInfo)
{
if(!Object.isUndefined(voiceInfo) && !Object.isUndefined(voiceInfo._childs) && voiceInfo._childs.length>0)
{
if (voiceInfo._childs.first().URI !="" )
{
return voiceInfo._childs.first().URI;
}
else
{
return "N/A";
}
}
else
{
return "N/A";
}
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin.js */
/**
* @namespace Holds the admin entity and its associated forms
*/
var Admin = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/userInterface.js */
Admin.UserInterface = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/userInterface/language.js */
/**
*
* Administration User Interface
*
* (Language)
*
*/
Admin.UserInterface.Language = Class.create(Sah.Form,
/** @lends Admin.UserInterface.Language# */
{
initialize: function ($super, form)
{
$super(form);
Sah.Translate.updated(this.languageSet.bind(this));
},
languageSet: function (event)
{
this.prepareForm();
$("Language.$Language").observe("change",this.onChangeLanguage.bind(this));
this.form.enable();
this.form.show();
},
prepareForm: function ()
{
/* select Languages */
$("Language.$Language").update();
Sah.translator.possibleLanguages.each(function (language) {
/* create a new option element */
var option = new Element("option", { value: language });
/* translate the option text */
option.insert(Admin.UserInterface.Language.Label[language]);
option.selected = (language == Sah.translator.language);
/* insert the option in the select box */
$("Language.$Language").insert(option);
}, this);
},
onChangeLanguage : function (event) {
Sah.translator.setAndSaveLanguage($F("Language.$Language"));
document.fire("sah:admin:language:change",$F("Language.$Language"));
}
}
);
Admin.UserInterface.Language.Label = {
"en":"English ",
"fr":"Français ",
"sp": "Español ",
"de":"Deutsche ",
"pl": "Polski"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/userInterface/account.js */
/**
*
* Administration User Interface
*
* (Account)
*
*/
Admin.UserInterface.Account = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.UserInterface.Account# */
{
initialize: function ($super, form)
{
$super(form);
this.auth = new Sah.Auth();
$$(".AdminUserInterfaceAccountSave").each(function(btn){ btn.observe("click", this.onSave.bind(this));},this);
$$(".AdminUserInterfaceAccountCancel").each(function(btn){btn.observe("click", this.onCancel.bind(this));},this);
this.needs("Users", { path: "Admin.UserInterface.Account.$AccessRights.User", depth: 2 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.retrieveUser();
this.fillForm();
this.form.enable();
},
/**
* Retrieve the User "admin".
*/
retrieveUser: function ()
{
var UserArray = Array();
/* Extract Users and store them in an array */
if (this.objects.Users._children) {
for (var i=1; i<= this.objects.Users._children.length; i++) {
UserArray.push(this.objects.Users[i.toString()]);
}
}
/* Detecting the admin User from the Array */
this.objects.Account = UserArray.detect(function (user) {
return user.Name == "admin";
});
},
fillForm: function ()
{
this.objects.Account.CurrentPassword = $F('Account.CurrentPassword');
this.objects.Account.NewPassword = $F('Account.NewPassword');
this.objects.Account.ConfirmPassword = $F('Account.ConfirmPassword');
this.fromObject(this.objects);
$('Account.CurrentPassword').setValue("");
$('Account.ConfirmPassword').setValue("");
$('Account.NewPassword').setValue("");
},
onSave: function (event)
{
event.stop(event);
$("support.configadmin.currentpassword.error").hide();
$("support.configadmin.newpassword.error").hide();
$("support.configadmin.confirmnewpassword.error").hide();
this.objects.Account._validations = [];
this.objects.Account._update(this.toObject().Account);
if (this.objects.Account._changed()
|| $F('Account.NewPassword')!= this.objects.Account["NewPassword"]
|| $F('Account.ConfirmPassword')!= this.objects.Account["ConfirmPassword"]
|| $F('Account.CurrentPassword'))
{
this.objects.Account._addValidation(this.validateUserInterfaceAccount.curry($F('Account.CurrentPassword'),$F('Account.NewPassword'), $F('Account.ConfirmPassword'), this,this.cryptData));
this.objects.Account._save({ onSuccess: this.whenSaved.bind(this, $F('Account.NewPassword')), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.displayErrorMessage("advconfig.admin.error.description.empty","X Empty values.");
}
return false;
},
whenSaved: function (password, obj)
{
ctl.msgbox.Show(ctl.msgbox.QUESTION.OK,t('advconfig.admin.label.passwordmodified','X Your password has been modified'),(function(){this.auth.logout(this.redirect.bind(this, "/"));}).bind(this));
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
this.fillForm(this.objects);
},
onCancel: function(event){
$("support.configadmin.currentpassword.error").hide();
$("support.configadmin.newpassword.error").hide();
$("support.configadmin.confirmnewpassword.error").hide();
this.fillForm(this.objects);
},
/**
** display tooltip to control admin password
**/
displayErrorMessage : function(label, alternate)
{
if (label == "advconfig.admin.error.description.empty")
{
$("support.configadmin.currentpassword.error").show();
Sah.translator.change($("advconfig.admin.error.description.currentpassword"), label, alternate);
}
else
{
if (label == "advconfig.admin.error.description.currentpassword")
{
$("support.configadmin.currentpassword.error").show();
Sah.translator.change($("advconfig.admin.error.description.currentpassword"), label, alternate);
}
else
{
if (label == "advconfig.admin.error.description.newpassword")
{
$("support.configadmin.newpassword.error").show();
Sah.translator.change($("advconfig.admin.error.description.newpassword"), label, alternate);
}
else
{
if (label == "advconfig.admin.error.description.confirmnewpassword")
{
$("support.configadmin.confirmnewpassword.error").show();
Sah.translator.change($("advconfig.admin.error.description.confirmnewpassword"), label, alternate);
}
}
}
}
},
validateUserInterfaceAccount : function(currentPassword, newPassword, confirmPassword, th,callback,obj)
{
var bValid = true ;
var label = "";
var alternate = "";
var translFunc =t;
if (obj["Password"] != ("_CYP_" + Sah.Tools.MD5(currentPassword))) {
t=translFunc;
label = "advconfig.admin.error.description.currentpassword";
alternate = "X Wrong current password.";
obj._addError("CurrentPassword", alternate);
bValid = false ;
}
else
{
if (newPassword == false || newPassword.length < 4 || newPassword.length > 32 ) {
label = "advconfig.admin.error.description.newpassword";
alternate = "X Wrong password. It should contain between 4 to 32 characters.";
obj._addError("NewPassword", alternate);
bValid = false ;
}
else
{
if(confirmPassword != newPassword) {
label = "advconfig.admin.error.description.confirmnewpassword";
alternate = "X New and confirmation password are not the same. Please start over.";
obj._addError("ConfirmPassword", alternate);
bValid = false ;
}
}
}
if(!bValid)
{
th.displayErrorMessage(label,alternate);
}
if(bValid)
{
callback(obj);
}
return bValid ;
},
cryptData : function (obj)
{
var translFunc =t;
obj["Hash2"] = Sah.Tools.MD5(obj["Name"]+":Livebox2:"+$F("Account.NewPassword"));
obj["Crypt"] = Javacrypt.encrypt("dkpm",$F("Account.NewPassword"));
obj["Password"] = "_CYP_"+Sah.Tools.MD5($F("Account.NewPassword"));
t=translFunc;
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/saveRestore.js */
Admin.SaveRestore = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/saveRestore/save.js */
/**
* Admin.Save & Restore
*/
Admin.SaveRestore.Save = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.SaveRestore.Save# */
{
initialize: function ($super, form)
{
$super(form);
$("bt_save").observe("click", this.onSave.bind(this));
},
onSave: function(event)
{
Event.stop(event);
this.markAsLoading();
/* do the request twice:
* - for the iframe to trigger the download dialog
* - for the main window to know when to remove the loading mark
*
* This has no impact on the gateway as the save script is launched only once.
*/
var iframe = new Element("iframe");
iframe.src = "/backup";
iframe.style.display = "none";
document.body.insert(iframe);
new Ajax.Request("/backup?nocache", { method: "GET", onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this) });
},
whenSaved: function (obj)
{
this.markAsLoaded();
},
whenNotSaved: function (obj)
{
this.markAsLoaded();
this.logger.warn("Configuration saving failed");
this.logger.warn(obj);
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/saveRestore/restore.js */
/**
* Administration Save & Restore
*/
Admin.SaveRestore.Restore = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.Save_Restore.Restore# */
{
initialize: function ($super, form)
{
$super(form);
if (Prototype.Browser.Chrome)
$("file_name").setStyle({"border": 0});
document.observe('sah:admin:saveRestore:fileUploaded', this.fileUploaded.bind(this));
document.observe('sah:admin:saveRestore:fileUploadError', this.fileUploadError.bind(this));
$("bt_restore").observe("click", this.onRestore.bind(this));
this.needs("Reboot", { path: "reboot", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.form.enable();
},
onRestore: function ()
{
$("support.saverestore.nofile.error").hide();
if ( $("file_name").getValue() != "" )
{
this.markAsLoading();
this.form.submit();
}
else
{
this.displayErrorMessage(t('support.saverestore.nofile.error.description','X Insert the file to restore.'));
}
return true;
},
markAsLoading: function ($super)
{
$super();
this.timeout = window.setTimeout(this.checkUpload.bind(this), 1000);
this.uploadChecker = new PeriodicalExecuter(this.checkUpload.bind(this), 5);
},
markAsLoaded: function ($super)
{
$super();
if (this.uploadChecker) {
this.uploadChecker.stop();
this.uploadChecker = null;
}
if (this.timeout) {
window.clearTimeout(this.timeout);
this.timeout = null;
}
},
checkUpload: function ()
{
new Ajax.Request("/restore?status=true", {
method: "get",
onSuccess: function (response) {
var status = response.responseJSON;
if (status.active && status.action == "restore" && status.totalSize > 128 * 1024) {
this.logger.warn("tried to upload a file which is too large");
this.fileUploadError();
}
}.bind(this)
});
},
/**
** display tooltip to control admin password
**/
displayErrorMessage : function(msg)
{
$("support.saverestore.nofile.error").show();
$("support.saverestore.nofile.error.description").innerHTML = msg;
},
fileUploaded: function (event)
{
this.markAsLoaded();
$("support.saverestore.nofile.error").hide();
$("support.saverestore.upload.error").hide();
this.objects.Reboot.VoiceEnable=0;
this.objects.Reboot._save(function (obj) {
$('support-saverestore-tab-main').hide();
$('support-saverestore-tab-stepend').show();
this.objects.Reboot.DeviceConfig.RebootDelay = "0";
this.objects.Reboot.DeviceConfig.Reboot = "1";
this.objects.Reboot.DeviceConfig._save();
}.bind(this));
return false;
},
fileUploadError: function (event)
{
this.markAsLoaded();
$("support.saverestore.upload.error").show();
$("support.saverestore.upload.error.description").innerHTML = t('support.saverestore.upload.error.description','X Invalid file.');
/* ensure that the frame is not loading anymore */
$("upload_target").src = Sah.link("/legal.html");
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/saveRestore/reset.js */
/**
* Administration Reset
*/
Admin.SaveRestore.Reset = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.Save_Restore.Reset# */
{
initialize: function ($super, form)
{
this.resetDelay = "5";
this.factoryDefaults = "1";
$super(form);
$("bt_reset").observe("click", this.onDisplayMsgBox.bind(this));
this.needs("Reset", { path: "reset", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.fromObject(this.objects);
this.form.enable();
},
onDisplayMsgBox: function(event)
{
event.stop(event);
ctl.msgbox.Show(ctl.msgbox.QUESTION.YES_NO,t('support.restartreset.reset.info.question','X Are you sure to reset?'),undefined,(function(){this.onReset();}).bind(this));
},
onReset: function(event)
{
this.objects.Reset.VoiceEnable=0;
this.objects.Reset._save({ onSuccess : function (obj) {
// Set the reboot delay to 5 seconds to allow appWeb to finish this page before device is rebooted
this.objects.Reset.DeviceConfig.RebootDelay = this.resetDelay;
this.objects.Reset.DeviceConfig.FactoryDefaults = this.factoryDefaults;
this.objects.Reset.DeviceConfig._save(
{
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}.bind(this)
, onFailure : this.whenNotSaved.bind(this)});
return false;
},
whenSaved: function (obj)
{
// Nothing to do
},
whenNotSaved: function (obj)
{
this.logger.warn("Reset factory failed");
this.logger.warn(obj);
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/remote.js */
Admin.Remote = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.Remote */
{
initialize: function ($super, form)
{
$super(form);
this.needs("Remote", { path: "Admin.Remote", depth: -1 });
$("bt_cancel").observe("click",this.onCancel.bind(this));
$("bt_save").observe("click",this.onSave.bind(this));
$("RemoteAccess.Enable").observe("click",this.onRemoteAdminChange.bind(this));
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.DeviceConfig = this.objects.Remote.DeviceConfig;
this.objects.WANDSLLinkConfig = this.objects.Remote.WANDSLLinkConfig;
this.objects.RemoteAccess = this.objects.Remote.RemoteAccess;
this.objects.AccessRights = this.objects.Remote.AccessRights;
this.objects.WANPPPConnectionPath = this.objects.Remote.WANPPPConnectionPath;
this.objects.WANPPPConnection = this.objects.Remote.WANPPPConnection;
this.objects.WANIPConnection = this.objects.Remote.WANIPConnection;
this.objects.DynamicDns = this.objects.Remote.DynamicDns;
this.objects.Autodetect = this.objects.Remote.Autodetect;
this.prepareForm();
this.form.enable();
this.onRemoteAdminChange();
this.markAsLoaded();
},
prepareForm: function ()
{
// Find RemoteAdmin group
if (this.objects.AccessRights.Group)
{
this.objects.AccessRights.Group.each(function (group)
{
if (group.Name === "RemoteAdmin")
{
this.objects.remoteAdmin_Path = group._path;
}
},this);
}
if( this.objects.remoteAdmin_Path === "" )
{
this.logger.warn("Missing RemoteAdmin group");
}
// Find user associated to RemoteAdmin group
else if (this.objects.AccessRights.User)
{
this.searchRAUser();
}
// Find external IP address depending on connection type (PPP/DHCP)
var is_PPP = this.objects.WANDSLLinkConfig.LinkType;
if (((is_PPP.include("PPP") ) || ( is_PPP=="EoA" )) && (this.objects.Autodetect.Protocol!="DHCP"))
{
this.objects.Wan_Ip = this.objects.WANPPPConnection;
}
else
{
this.objects.Wan_Ip = this.objects.WANIPConnection;
}
// Setting current state and external IP address
if ( (this.objects.RemoteAccess.Enable == "1") && (this.objects.userRemoteAdmin) )
{
$("RemoteAccess.Enable").checked = true;
this.fillForm();
$("Wan_Ip.ExternalIPAddress").innerHTML=this.objects.Wan_Ip.ExternalIPAddress;
}
else
{
$("RemoteAccess.Enable").checked = false;
this.hideUserInfo();
}
},
searchRAUser: function ()
{
this.objects.AccessRights.User.each(function (user)
{
if( (user.AdminGroup === this.objects.remoteAdmin_Path.replace("Admin.Remote.AccessRights","Users")) && (user.Name != "support") )
{
this.objects.userRemoteAdmin = user;
}
},this);
},
hideUserInfo: function ()
{
$("userRemote.Password").setValue("");
$("userRemoteAdmin.Name").setValue("");
$("RemoteAccess.Port").setValue("");
$("RemoteAccess.URL").innerHTML = "";
$("Wan_Ip.ExternalIPAddress").innerHTML = "";
},
fillForm: function ()
{
this.fromObject(this.objects);
if ( (this.objects.userRemoteAdmin) && (this.objects.RemoteAccess.Enable) )
{
$("userRemote.Password").setValue("xxxxxxxx");
if (this.objects.DynamicDns)
{
if (this.objects.DynamicDns.Enable == "1")
{ $("RemoteAccess.URL").innerHTML = "https://"+this.objects.DynamicDns.Enable+":"+this.objects.RemoteAccess.Port; }
else
{ $("RemoteAccess.URL").innerHTML = "https://"+this.objects.Wan_Ip.ExternalIPAddress+":"+this.objects.RemoteAccess.Port; }
}
else
{ $("RemoteAccess.URL").innerHTML = "https://"+this.objects.Wan_Ip.ExternalIPAddress+":"+this.objects.RemoteAccess.Port; }
}
},
onSave: function ()
{
if ($("RemoteAccess.Enable").checked)
{
this.objects.RemoteAccess.Enable = "1";
var uName = $("userRemoteAdmin.Name").value;
var uPassword = $("userRemote.Password").value;
var uPort = $("RemoteAccess.Port").value;
if (!this.validateForm(uName, uPassword, uPort)) {
this.markAsLoading();
this.searchRAUser();
this.objects.RemoteAccess.Enable = "0";
this.objects.RemoteAccess.Start = "0";
this.objects.RemoteAccess._save({
onSuccess: this.whenDeleteSuccess.bind(this, uName, uPassword, uPort, "1"),
onFailure: this.whenNotSaved.bind(this)
});
}
}
else
{
this.markAsLoading();
this.searchRAUser();
this.objects.RemoteAccess.Enable = "0";
this.objects.RemoteAccess.Start = "0";
this.objects.RemoteAccess._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
return true;
},
whenSavedOK: function (obj)
{
this.prepareForm();
if (obj.Enable == "1")
this.fillForm();
this.markAsLoaded();
},
whenSaved: function (obj)
{
/* force remote user to re-login */
new Ajax.Request("/logout", { parameters: { "remote": "1" }});
this.objects.AccessRights.User._load({
onSuccess: this.whenSavedOK.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenNotSaved: function (obj)
{
this.logger.warn("Remote access activation failed");
this.logger.warn(obj);
this.fillForm();
this.markAsLoaded();
},
onRemoteAdminChange: function ()
{
if ($("RemoteAccess.Enable").checked)
{
this.form.enable();
}
else
{
this.form.disable();
}
$("RemoteAccess.Enable").enable();
},
validateForm: function (login, password, port)
{
/* Validate login */
if ( (login === "admin") || (login === "root") || (login === "support") || (login === "") || (login.length>84))
{
$("support.remoteaccess.login.error").show();
bLoginValid=true;
}
else
{
$("support.remoteaccess.login.error").hide();
bLoginValid=false;
}
/* Validate Password */
var value = $F("userRemote.Password");
if (value.length <= 7 || !value.match(/\d/) || !value.match(/[^\da-zA-Z]/))
{
$("support.remoteaccess.password.error").show();
bPasswordValid=true;
}
else
{
$("support.remoteaccess.password.error").hide();
bPasswordValid=false;
}
/* Validate Port */
var intPort = parseInt(port, 10);
if ( !Sah.Validations.isValidNumber(port, 10000, 30000 ))
{
$("support.remoteaccess.port.error").show();
bPortValid=true;
}
else
{
$("support.remoteaccess.port.error").hide();
bPortValid=false;
}
return ( bLoginValid || bPortValid || bPasswordValid );
},
whenDeleteSuccess: function (uName, uPass, uPort, uEnable)
{
this.objects.AccessRights.User._childs = [];
this.objects.AccessRights.User._load({
onSuccess: this.createRAUser.bind(this,uName, uPass, uPort, uEnable),
onFailure: this.whenNotSaved.bind(this)
});
},
createRAUser: function (uName, uPass, uPort, uEnable)
{
// First, find the RemoteAdmin group and check if there is only 1
var duplicateNewUser = false;
if (this.objects.remoteAdmin_Path === "")
{
this.logger.warn("Missing RemoteAdmin group");
this.whenNotSaved(this);
}
else
{
duplicateNewUser = false;
if (this.objects.AccessRights.User)
{
/* Check if the username doesn't already exist else create user with empty uName */
this.objects.AccessRights.User.each(function (user)
{
if (user.Name == uName)
{
duplicateNewUser = true;
}
},this);
if (!duplicateNewUser)
{
this.objects.AccessRights.User._add({
onSuccess: this.saveUserSuccess.bind(this,uName,uPass,uPort,uEnable),
onFailure: this.whenNotSaved.bind(this)
});
}
else
{
this.logger.warn("User "+uName+" already exist");
$("support.remoteaccess.login.error").show();
this.whenNotSaved(this);
}
}
else
{
this.whenNotSaved(this);
}
}
},
saveUserSuccess: function (uName,uPass,uPort,uEnable,object)
{
object.Name = uName;
object.Password = uPass;
object.AdminGroup = this.objects.remoteAdmin_Path.replace("igd.","");
object._save({
onSuccess: this.whenRemoteAccessSaved.bind(this,object._path,uPort,uEnable),
onFailure: this.whenNotSaved.bind(this)
});
},
whenRemoteAccessSaved: function (path,uPort,uEnable)
{
this.objects.RemoteAccess.User = path.replace("igd.","");
this.objects.RemoteAccess.Mode = "Permanent";
this.objects.RemoteAccess.IPIntf = this.objects.WANPPPConnection;
this.objects.RemoteAccess.RandomPort = "0";
this.objects.RemoteAccess.RandomPassword = "0";
this.objects.RemoteAccess.Port = uPort;
this.objects.RemoteAccess.Enable = uEnable;
this.objects.RemoteAccess._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
onCancel: function ()
{
this.objectsLoaded();
$("support.remoteaccess.login.error").hide();
$("support.remoteaccess.password.error").hide();
$("support.remoteaccess.port.error").hide();
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/options.js */
/**
*
*
* Admin Options
*
*
*/
Admin.Options = Class.create ( Sah.AuthenticatedForm ,
/** @lends Admin.Options# */
{
initialize : function ($super , form )
{
$super ( form );
/* initialize events handler */
$("Admin/Options/Save").observe("click", this.onSave.bind(this));
$("Admin/Options/Cancel").observe("click", this.onCancel.bind(this));
this.needs("UserInterface", { path: "igd.UserInterface", depth: 0 });
this.form.disable();
this.load();
},
objectsLoaded : function ()
{
this.fromObject(this.objects);
this.form.enable();
},
onSave: function (event)
{
event.stop(event);
this.objects.UserInterface._update(this.toObject().UserInterface);
if (this.objects.UserInterface._changed())
{
this.markAsLoading();
this.objects.UserInterface._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.logger.info("nothing has changed in UserInterface, skipping save");
}
return false;
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.markAsLoaded();
this.fromObject(this.objects);
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.markAsLoaded();
this.logger.warn(obj);
},
onCancel: function(event){
this.fromObject(this.objects);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/npt.js */
/**
*
*
* Admin NPT
*
*
*/
Admin.Npt = Class.create ( Sah.AuthenticatedForm ,
/** @lends Admin.Npt# */
{
initialize : function ($super , form )
{
$super ( form );
/* initialize events handler */
$("bt_save").observe("click", this.onSave.bind(this));
$("bt_cancel").observe("click", this.onCancel.bind(this));
$("Time.LocalTimeZoneName").observe("change",this.onChangeImg.bind(this));
this.needs("Time", { path: "Admin.NPT.Time", depth: -1 });
this.load();
var thisTime = this;
// TODO: split up this line and use bind
var timeRefresh = new PeriodicalExecuter(function(pe){thisTime.objects.Time._load({ onSuccess: thisTime.onChangeImg.bind(thisTime), onFailure: thisTime.whenNotSaved.bind(thisTime) });},50);
},
objectsLoaded : function ()
{
this.fromObject(this.objects);
this.onChangeImg();
},
onSave: function (event)
{
event.stop(event);
this.objects.Time._update(this.toObject().Time);
if ( this.objects.Time.LocalTimeZoneName.substring(4,5) != ")")
{this.objects.Time.LocalTimeZone = this.objects.Time.LocalTimeZoneName.substring(4,10);}
else
{this.objects.Time.LocalTimeZone = "+00:00";}
if (this.objects.Time._changed()) {
this.objects.Time._save({ onSuccess: this.whenSaved.bind(this), onFailure: this.whenNotSaved.bind(this) });
}
else
{
this.logger.info("nothing has changed in Time, skipping save");
}
return false;
},
whenSaved: function (obj)
{
this.logger.info("object saved");
this.fromObject(this.objects);
this.onChangeImg();
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
this.logger.warn(obj);
},
onCancel: function(event){
event.stop(event);
this.fromObject(this.objects);
this.onChangeImg();
},
onChangeImg:function()
{
var chosenOffsetWebui = $("Time.LocalTimeZoneName").getValue();
var chosenOffsetDM = this.objects.Time.LocalTimeZoneName;
var currentTime = this.objects.Time.CurrentLocalTime;
var newTime = this.calcTime(chosenOffsetDM, currentTime, chosenOffsetWebui);
$('Time.WeekDay').update(newTime);
var chosenOffset = $("Time.LocalTimeZoneName").getValue();
this.drawImg(chosenOffset);
},
// TOTO: use correct documentation style
// function to calculate local time
// in a different city
// given the city's UTC offset
calcTime: function(offsetDM, currentTime, offsetWebui) {
var hourOffWebui = 0;
var minOffWebui = 0;
var hourOffDM = 0;
var minOffDM = 0;
if ( offsetWebui.substring(4,5) != ")")
{
hourOffWebui = parseInt(offsetWebui.substring(5,7), 10);
minOffWebui = parseInt(offsetWebui.substring(8,10), 10);
}
if ( offsetDM.substring(4,5) != ")")
{
hourOffDM = parseInt(offsetDM.substring(5,7), 10);
minOffDM = parseInt(offsetDM.substring(8,10), 10);
}
var year = parseInt(currentTime.substring(0,4), 10);
var month = parseInt(currentTime.substring(5,7), 10);
var day = parseInt(currentTime.substring(8,10), 10);
var hour = parseInt(currentTime.substring(11,13), 10);
var minute = parseInt(currentTime.substring(14,16) ,10);
var second = parseInt(currentTime.substring(17,19), 10);
var currentDate = new Date(year, (month-1), day, hour, minute, second);
// convert to msec
// add local time zone offset
// get UTC time in msec
utc = currentDate.getTime();
// create new Date object for different city
// using supplied offset
if(offsetWebui.substring(4,5)=='+')
{
if(offsetDM.substring(4,5)=='+')
{ nd = new Date(utc + (3600000*(hourOffWebui)+60000*minOffWebui) - (3600000*(hourOffDM)+60000*minOffDM)); }
else
{ nd = new Date(utc + (3600000*(hourOffDM)+60000*minOffDM) + (3600000*(hourOffWebui)+60000*minOffWebui)); }
}
else
{
if(offsetDM.substring(4,5)=='+')
{ nd = new Date(utc - (3600000*hourOffWebui+60000*minOffWebui) - (3600000*hourOffDM+60000*minOffDM)); }
else
{ nd = new Date(utc + (3600000*hourOffDM+60000*minOffDM) - (3600000*hourOffWebui+60000*minOffWebui)); }
}
var hourStr = nd.getHours();
var minStr = nd.getMinutes();
if( hourStr < 10 ) { hourStr = '0' + hourStr; }
if( minStr < 10 ) { minStr = '0' + minStr; }
// French Date Form : 'mercredi 5 mai 2010' + 24 hour
var timeStr = '';
if ( Cookie.get("language") == "fr" ) {
timeStr += t( Admin.Npt.Days[nd.getDay()], nd.getDay() );
timeStr += " " + nd.getDate();
timeStr += " " + t( Admin.Npt.Months[nd.getMonth()], nd.getDay() );
timeStr += " " + nd.getFullYear();
timeStr += " " + hourStr + ":" + minStr;
return timeStr;
}
// Polish Date Form : '5 maja 2010' + 24 hour
else if ( Cookie.get("language") == "pl" ) {
timeStr += nd.getDate();
timeStr += " " + t( Admin.Npt.Months[nd.getMonth()], nd.getDay() );
timeStr += " " + nd.getFullYear();
timeStr += " " + hourStr + ":" + minStr;
return timeStr;
}
// English & Default Date Form : 'Wednesday, May 05, 2010' + 24 hour
else {
timeStr += t( Admin.Npt.Days[nd.getDay()], nd.getDay() );
timeStr += " " + t( Admin.Npt.Months[nd.getMonth()], nd.getDay() );
timeStr += " " + nd.getDate();
timeStr += " " + nd.getFullYear();
timeStr += " " + hourStr + ":" + minStr;
return timeStr;
}
},
drawImg: function(offset)
{
$('ntpmapselection').setStyle({backgroundImage:'url(' + Sah.img('/common/timezone.png') + ')'});
if($('divMap') !== null)
$('divMap').remove();
var hourOff = parseInt(offset.substring(5,7), 10);
var minOff = parseInt(offset.substring(8,10)/60, 10);
var left = 1;
if(isNaN(hourOff)||isNaN(minOff))
{
hourOff = 0;
minOff = 0;
}
/* Cursor Width = (image width) / (29 columns) */
var widthCursor = 550 / 29;
if (offset.substring(4,5)=='+')
left = widthCursor*hourOff+(widthCursor/2)*minOff;
else
left = -(widthCursor*hourOff)-(widthCursor/2)*minOff;
var width = 1;
/* add div in td */
var divTag = new Element("div");
divTag.addClassName("timezone-cursor");
divTag.id="divMap";
divTag.style.left = (left-8) + "px";
divTag.makePositioned();
divTag.style.left = (left-8) + "px";
$('ntpmapselection').insert(divTag);
}
}
);
Admin.Npt.Days = {
"0": "general.label.days.sunday",
"1": "general.label.days.monday",
"2": "general.label.days.tuesday",
"3": "general.label.days.wednesday",
"4": "general.label.days.thursday",
"5": "general.label.days.friday",
"6": "general.label.days.saturday"
};
Admin.Npt.Months = {
"0": "general.label.months.january",
"1": "general.label.months.february",
"2": "general.label.months.march",
"3": "general.label.months.april",
"4": "general.label.months.may",
"5": "general.label.months.june",
"6": "general.label.months.july",
"7": "general.label.months.august",
"8": "general.label.months.september",
"9": "general.label.months.october",
"10": "general.label.months.november",
"11": "general.label.months.december"
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/hotline.js */
/**
* Admin hotline
*/
Admin.Hotline = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.Hotline# */
{
initialize: function ($super, form)
{
$super(form);
/* when the form is submitted, call the onAuthorize method of this class */
$("bt_save").observe("click", this.onSave.bind(this));
$("bt_cancel").observe("click", this.onCancel.bind(this));
/* prepare to load the objects we need (RemoteAccess) */
this.needs("Hotline", { path: "Admin.Hotline", depth: -1 });
this.markAsLoading();
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.elapsedTime = 0;
this.objects.DeviceConfig = this.objects.Hotline.DeviceConfig;
this.objects.WANDSLLinkConfig = this.objects.Hotline.WANDSLLinkConfig;
this.objects.RemoteAccess = this.objects.Hotline.RemoteAccess;
this.objects.AccessRights = this.objects.Hotline.AccessRights;
this.objects.WANPPPConnection = this.objects.Hotline.WANPPPConnection;
this.objects.WANIPConnection = this.objects.Hotline.WANIPConnection;
this.objects.WANPPPConnectionPath = this.getIntfPath( this.objects.Hotline.Intf._childs,"ppp_0");
this.objects.Autodetect = this.objects.Hotline.Autodetect;
this.prepareForm();
this.searchRAUsers();
if ( (this.objects.userRemoteAdmin.Name) && (this.objects.RemoteAccess.Start == "1") )
{
this.fillForm();
}
$("bt_save").enable();
this.markAsLoaded();
},
prepareForm: function ()
{
this.objects.userRemoteAdmin = {};
// Find external IP address depending on connection type (PPP/DHCP)
var is_PPP = this.objects.WANDSLLinkConfig.LinkType;
if ((( is_PPP.include("PPP") ) || ( is_PPP=="EoA" ))&& (this.objects.Autodetect.Protocol!="DHCP"))
{
this.objects.Wan_Ip = this.objects.WANPPPConnection;
}
else
{
this.objects.Wan_Ip = this.objects.WANIPConnection;
}
// Find RemoteAdmin group
if (this.objects.AccessRights.Group)
{
this.objects.AccessRights.Group.each(function (group)
{
if (group.Name === "RemoteAdmin")
{
this.objects.remoteAdmin_Path = group._path;
}
},this);
}
if( this.objects.remoteAdmin_Path === "" )
{
this.logger.warn("Missing RemoteAdmin group");
}
// Find user associated to RemoteAdmin group
else if (this.objects.AccessRights.User)
{
this.searchRAUsers();
}
// Setting current state
if ( (this.objects.RemoteAccess.Start == "1") && (this.objects.userRemoteAdmin.Name) )
{
Sah.translator.change($("bt_save"), "general.btn.extend","X Extend");
$("bt_save").enable();
$("bt_cancel").enable();
this.objects.elapsedTime = parseInt(this.objects.RemoteAccess.ElapsedTime, 10);
this.firstProgressBarChange();
this.progressBar=new PeriodicalExecuter(this.progressBarChange.bind(this),1);
}
else
{
Sah.translator.change($("bt_save"), "general.btn.start","X Start");
this.objects.elapsedTime = 0;
this.objects.widthImgProgress = 512;
$("progressbar_id").setStyle("width:"+(this.objects.widthImgProgress)+"px");
}
},
fillForm: function ()
{
if (this.objects.RemoteAccess.Start == "1") {
this.fromObject(this.objects);
$("userRemoteAdmin.Password").setValue(this.objects.RemoteAccess.Password);
$("Wan_Ip.ExternalIPAddress").setValue(this.objects.Wan_Ip.ExternalIPAddress);
$("userRemoteAdmin.Name").setValue("support");
$("RemoteAccess.Url").setValue("https://"+this.objects.Wan_Ip.ExternalIPAddress+":"+this.objects.RemoteAccess.Port);
} else {
this.form.reset();
}
},
onSave: function ()
{
this.markAsLoading();
this.searchRAUsers();
this.objects.widthImgProgress = 512;
$("progressbar_id").setStyle("width:"+(this.objects.widthImgProgress)+"px");
if (!this.progressBar)
{
this.objects.elapsedTime = parseInt(this.objects.RemoteAccess.ElapsedTime, 10);
this.firstProgressBarChange();
this.progressBar=new PeriodicalExecuter(this.progressBarChange.bind(this),1);
}
if ( $("bt_save").value != t("general.btn.extend","X Extend") ) {
this.objects.elapsedTime = 0;
var uPort = Math.floor((Math.random()*20000)+10000);
this.objects.RemoteAccess.Enable = "0";
this.objects.RemoteAccess.Start = "0";
this.objects.RemoteAccess._save({
onSuccess: this.whenDeleteSuccess.bind(this, uPort, "1"),
onFailure: this.whenNotSaved.bind(this)
});
}
else
{
this.objects.elapsedTime = 0;
this.objects.RemoteAccess.RestartTimer = "1";
this.objects.RemoteAccess.Timeout = "15";
this.objects.RemoteAccess._save({
onSuccess: this.whenSavedOK.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}
this.form.disable();
Sah.translator.change($("bt_save"), "general.btn.extend","X Extend");
$("bt_save").enable();
$("bt_cancel").enable();
},
whenDeleteSuccess: function (uPort, uEnable)
{
this.objects.AccessRights.User._childs = [];
this.objects.AccessRights.User._load({
onSuccess: this.createRAUser.bind(this,uPort, uEnable),
onFailure: this.whenNotSaved.bind(this)
});
},
searchRAUsers: function ()
{
this.noSupportUser = true;
if ( (this.objects.AccessRights.User) && (this.objects.remoteAdmin_Path !== "") )
{
this.objects.AccessRights.User.each(function (user)
{
if ( (user.AdminGroup == this.objects.remoteAdmin_Path.replace("Admin.Hotline.AccessRights","Users")) && (user.Name == "support") )
{
this.noSupportUser = false;
this.objects.userRemoteAdmin = user;
}
},this);
}
},
createRAUser: function (uPort, uEnable)
{
var duplicateNewUser = false;
if (this.objects.remoteAdmin_Path === "")
{
this.logger.warn("Missing RemoteAdmin group");
this.whenNotSaved(this);
}
else
{
duplicateNewUser = false;
if (this.objects.AccessRights.User)
{
this.objects.AccessRights.User.each(function (user)
{
if (user.Name == "support")
{
duplicateNewUser = true;
}
},this);
if (!duplicateNewUser)
{
this.objects.AccessRights.User._add({
onSuccess: this.saveUserSuccess.bind(this,uPort,uEnable),
onFailure: this.whenNotSaved.bind(this)
});
}
else
{
this.logger.warn("User Support already exist");
this.whenNotSaved(this);
}
}
else
{
this.whenNotSaved(this);
}
}
},
saveUserSuccess: function (uPort,uEnable,object)
{
object.Name = "support";
object.Password = "";
this.objects.userRemoteAdmin = object;
object.AdminGroup = this.objects.remoteAdmin_Path.replace("atomic.","");
object._save({
onSuccess: this.whenRemoteAccessSaved.bind(this,object._path,uPort,uEnable),
onFailure: this.whenNotSaved.bind(this)
});
},
whenRemoteAccessSaved: function (path,uPort,uEnable)
{
this.objects.RemoteAccess.User = path.replace("atomic.","");
this.objects.RemoteAccess.Port = uPort;
this.objects.RemoteAccess.Enable = "0";
this.objects.RemoteAccess.Start = "1";
this.objects.RemoteAccess.Mode = "Temporary";
this.objects.RemoteAccess.IPIntf = this.objects.WANPPPConnectionPath;
this.objects.RemoteAccess.RandomPort = "1";
this.objects.RemoteAccess.RandomPassword = "1";
this.objects.RemoteAccess.Timeout = "15";
this.objects.RemoteAccess._setOrder("Mode", "User", "Port", "IPIntf", "RandomPort", "RandomPassword", "Timeout", "Enable", "Start");
this.objects.RemoteAccess._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenSaved: function (obj)
{
new Ajax.Request("/logout", { parameters: { "remote": "1" }});
this.objects.AccessRights.User._childs = [];
this.objects.AccessRights.User._load({
onSuccess: this.whenSavedOK.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
this.markAsLoaded();
},
whenSavedOK: function (obj)
{
this.searchRAUsers();
this.fillForm();
this.markAsLoaded();
},
whenNotSaved: function (obj)
{
this.onCancel();
this.fillForm();
this.markAsLoaded();
},
onCancel: function ()
{
this.markAsLoading();
this.objects.elapsedTime = 0;
this.objects.widthImgProgress = 512;
$("progressbar_id").setStyle("width:"+(this.objects.widthImgProgress)+"px");
if(this.progressBar)
{
this.progressBar.stop();
this.progressBar = undefined;
}
this.objects.RemoteAccess.Enable = "0";
this.objects.RemoteAccess.Start = "0";
this.objects.RemoteAccess._save({
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
this.form.disable();
Sah.translator.change($("bt_save"), "general.btn.start","X Start");
$("bt_save").enable();
},
firstProgressBarChange: function ()
{
this.objects.RemoteAccess._load({
onSuccess: this.getElapsedTime.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
loadRemoteAccess: function ()
{
this.objects.RemoteAccess._load({
onSuccess: this.getElapsedTime.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
setStartTo1: function ()
{
this.objects.RemoteAccess.Start = "1";
this.objects.RemoteAccess._save({
onSuccess: this.progressBarChange.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
progressBarChange: function(event)
{
this.objects.elapsedTime += 1;
var remainingTime = 512-((512*this.objects.elapsedTime)/900);
this.objects.widthImgProgress = remainingTime;
if (this.objects.widthImgProgress >= 0)
{
$("progressbar_id").setStyle("width:"+(this.objects.widthImgProgress)+"px");
}
else
{
this.onCancel();
this.fillForm();
}
},
getElapsedTime: function ()
{
this.objects.elapsedTime = parseInt(this.objects.RemoteAccess.ElapsedTime, 10);
var remainingTime = 512-((512*this.objects.elapsedTime)/900);
this.objects.widthImgProgress = remainingTime;
if (this.objects.widthImgProgress >= 0)
{
$("progressbar_id").setStyle("width:"+(this.objects.widthImgProgress)+"px");
}
else
{
this.onCancel();
}
},
getIntfPath : function(intfArray, intfName)
{
for(var i = 0; i<intfArray.length ; i++)
{
if(intfArray[i].intfName == intfName)
{
return intfArray[i]._path;
}
}
return "IP.Intf.12";
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/homeGateway.js */
Admin.HomeGateway = {};/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/homeGateway/upgrade.js */
/**
*
*
*
* Admin Home Gateway Upgrade
*
*
*
*/
Admin.HomeGateway.Upgrade = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.HomeGateway.Upgrade# */
{
initialize: function ($super, form)
{
$super(form);
/* when the form is submitted, call the onSave method of this class */
$("bt_findnewestversion").observe("click", this.onUpgrade.bind(this));
$("bt_findupgrade_yes").observe("click", this.onSaveUpgrade.bind(this));
$("bt_findupgrade_no").observe("click", this.onCancelUpgrade.bind(this));
/* prepare to load the objects we need (DeviceConfig) */
this.needs("Upgrade", { path: "Upgrade", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.objects.DeviceInfo = this.objects.Upgrade.DeviceInfo;
this.objects.CWMP = this.objects.Upgrade.CWMP;
this.fromObject(this.objects);
$("currentVersion").innerHTML= t("support.firmwareupgrade.label.softathome","X powered by SoftAtHome") + " " + this.objects.DeviceInfo.DeviceVersion;
this.form.enable();
},
onUpgrade: function(event)
{
event.stop(event);
$("bt_findnewestversion").disable();
$("tab_helpbesearch").show();
$("tab_duringsearch").hide();
$("tab_nofirmavailable").hide();
$("tab_whileupgrading").hide();
Sah.translator.refresh();
},
onCancelUpgrade: function (event)
{
event.stop(event);
$("bt_findnewestversion").enable();
$("tab_helpbesearch").hide();
$("tab_duringsearch").hide();
$("tab_nofirmavailable").hide();
$("tab_whileupgrading").hide();
},
onSaveUpgrade: function (event)
{
$("tab_helpbesearch").hide();
$("tab_duringsearch").show();
$("tab_nofirmavailable").hide();
$("tab_whileupgrading").hide();
this.checkCount = 0;
this.objects.CWMP.RequestDownloadTrigger = "1";
this.objects.CWMP._save(
{
onSuccess: function () { this.objects.Upgrade._load(this.whenSaved.bind(this)); }.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
},
whenSaved: function (obj)
{
this.objects.CWMP = this.objects.Upgrade.CWMP;
/* if the status is not Disabled, we are updating */
if (this.objects.Upgrade.Status !== "Disabled") {
this.logger.info("upgrade proceeding");
$("tab_helpbesearch").hide();
$("tab_duringsearch").hide();
$("tab_nofirmavailable").hide();
$("tab_whileupgrading").show();
return;
}
/* if we have been checking for 15 seconds, then no image is available */
if (this.objects.CWMP.RequestDownloadTrigger == '0' || this.checkCount >= 2) {
this.logger.info("no firmware upgrade available");
$("tab_helpbesearch").hide();
$("tab_duringsearch").hide();
$("tab_nofirmavailable").show();
$("tab_whileupgrading").hide();
$("bt_findnewestversion").enable();
return;
}
this.checkCount += 1;
/* check if an upgrade is in process */
window.setTimeout(function () {
this.objects.Upgrade._load(this.whenSaved.bind(this));
}.bind(this), 5000);
},
whenNotSaved: function (obj)
{
this.logger.warn("failed to save object");
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/homeGateway/reboot.js */
/**
* Administration Reboot
*/
Admin.HomeGateway.Reboot = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.HomeGateway.Reboot# */
{
initialize: function ($super, form)
{
this.resetDelay = "5";
this.rebootAction = "1";
$super(form);
$("bt_restart").observe("click", this.onDisplayMsgBox.bind(this));
this.needs("Reboot", { path: "reboot", depth: -1 });
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
this.fromObject(this.objects);
this.form.enable();
},
onDisplayMsgBox: function(event)
{
event.stop(event);
ctl.msgbox.Show(ctl.msgbox.QUESTION.YES_NO,t('support.restartreset.restart.info.question','X Are you sure to reboot?'),undefined,(function(){this.onReboot();}).bind(this));
},
onReboot: function(event)
{
this.objects.Reboot.VoiceEnable=0;
this.objects.Reboot._save({ onSuccess : function (obj) {
// Set the reboot delay to 5 seconds to allow appWeb to finish this page before device is rebooted
this.objects.Reboot.DeviceConfig.RebootDelay = this.resetDelay;
this.objects.Reboot.DeviceConfig.Reboot = this.rebootAction;
this.objects.Reboot.DeviceConfig._save(
{
onSuccess: this.whenSaved.bind(this),
onFailure: this.whenNotSaved.bind(this)
});
}.bind(this)
, onFailure : this.whenNotSaved.bind(this)});
return false;
},
whenSaved: function (obj)
{
// Nothing to do
},
whenNotSaved: function (obj)
{
this.logger.warn("Reboot failed");
this.logger.warn(obj);
}
});
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/ft.js */
Admin.Ft = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.Ft */
{
initialize: function ($super, form)
{
$super(form);
/* prepare to load the objects we need */
this.needs("DeviceInfo", { path: "igd.DeviceInfo", depth: 1 });
/* disable the form while loading */
this.form.disable();
/* load the needed objects into this.objects */
this.load();
},
/**
* called when the needed objects are loaded
*/
objectsLoaded: function ()
{
/* fill the form with the values fetched from sahbus */
this.fillForm();
/* enable the form but not the save button */
this.form.enable();
},
/**
* set the values read from sahbus to the form elements
*/
fillForm: function ()
{
/* map the value directly to the form, ie the form element with an id matching
* a path from this.objects will be set automatically. */
this.fromObject(this.objects);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/details.js */
/**
*
*
* Admin Details
*
*
*/
Admin.Details = Class.create (Sah.AuthenticatedForm ,
/** @lends Admin.Details# */
{
initialize : function ($super , form )
{
$super ( form );
this.needs("General", { path: "SI.general", depth: -1 });
this.markAsLoading();
this.load();
},
objectsLoaded : function ()
{
this.objects.DeviceInfo = this.objects.General.DeviceInfo;
this.fromObject(this.objects);
Sah.translator.change($("DeviceInfo.SoftVersion"), "support.systeminformation.general.label.softathome", "X powered by SoftAtHome");
$("DeviceInfo.NumVersion").innerHTML = this.objects.DeviceInfo.SoftwareVersion;
// TODO : this array should be centralized to be used by others files
var countries = [];
countries.fr="france";
countries.be="belgium";
countries.sp="spain";
countries.uk="unitedkingdom";
countries.nl="netherland";
countries.pl="poland";
Sah.translator.change($("DeviceInfo.$Country"), "general.country."+countries[this.objects.DeviceInfo.$Country], "X "+this.objects.DeviceInfo.$Country);
this.markAsLoaded();
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/controllers/admin/adslFtth.js */
Admin.AdslFtth = Class.create(Sah.AuthenticatedForm,
/** @lends Admin.AdslFtth*/
{
initialize: function ($super, form)
{
$super(form);
this.form.disable();
this.load();
},
objectsLoaded: function ()
{
var is_DSL = "";
if ( Cookie.get( 'WanInterfaceConfig' ) )
{
is_DSL = Cookie.get( 'WanInterfaceConfig' );
}
if ( is_DSL === "Ethernet" )
{
$("support.systeminformation.adsl.label.title").hide();
$("support.systeminformation.ftth.label.title").show();
}
else
{
$("support.systeminformation.adsl.label.title").show();
$("support.systeminformation.ftth.label.title").hide();
}
this.fillForm();
this.form.enable();
},
fillForm: function ()
{
this.fromObject(this.objects);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/base64.js */
Sah.Base64 = {
keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function (input)
{
var output = "";
var chr1, chr2, chr3 = "";
var enc1, enc2, enc3, enc4 = "";
var i = 0;
do {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
Sah.Base64.keyStr.charAt(enc1) +
Sah.Base64.keyStr.charAt(enc2) +
Sah.Base64.keyStr.charAt(enc3) +
Sah.Base64.keyStr.charAt(enc4);
chr1 = chr2 = chr3 = "";
enc1 = enc2 = enc3 = enc4 = "";
} while (i < input.length);
return output;
},
decode: function (input)
{
var output = "";
var chr1, chr2, chr3 = "";
var enc1, enc2, enc3, enc4 = "";
var i = 0;
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
var base64test = /[^A-Za-z0-9\+\/\=]/g;
if (base64test.exec(input)) {
alert("There were invalid base64 characters in the input text.\n" +
"Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
"Expect errors in decoding.");
}
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do {
enc1 = Sah.Base64.keyStr.indexOf(input.charAt(i++));
enc2 = Sah.Base64.keyStr.indexOf(input.charAt(i++));
enc3 = Sah.Base64.keyStr.indexOf(input.charAt(i++));
enc4 = Sah.Base64.keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
chr1 = chr2 = chr3 = "";
enc1 = enc2 = enc3 = enc4 = "";
} while (i < input.length);
return output;
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/bookmark.js */
/**
* The bookmarks
* @namespace
*/
Sah.Bookmarks = {};
/**
* The lan connection
*/
Sah.Bookmarks.LANConnection = {
load: function (form)
{
form.needs("InternetParameters", { path: "igd.Services.$Internet", depth: 0 });
form.needs("LANConnection", {
path: function () { return "igd." + this.objects.InternetParameters.LANConnection; },
depth: 4
});
}
};
/**
* The wlan configuration
*/
Sah.Bookmarks.WLANConfiguration = {
load: function (form)
{
form.needs("WLANConfiguration", { path: "WLANConfiguration", depth: -1 });
}
};
/**
* The wan configuration
*/
Sah.Bookmarks.WANConnectionDevice = {
load: function (form)
{
form.needs("WANConnectionDevice", { path: "WANConnectionDevice", depth: -1, callback: this.bookmarkLoaded.bind(this, form) });
},
bookmarkLoaded: function (form)
{
form.objects.WANDSLLinkConfig = form.objects.WANConnectionDevice.WANDSLLinkConfig;
form.objects.WANPPPConnection = form.objects.WANConnectionDevice.WANPPPConnection;
form.objects.WANIPConnection = form.objects.WANConnectionDevice.WANIPConnection;
}
};
Sah.Bookmarks.WANCommonInterfaceConfig = {
load: function (form)
{
form.needs("WANCommonInterfaceConfig", { path: "WANCommonInterfaceConfig" , depth: 0 });
}
};
Sah.Bookmarks.WANDSLInterfaceConfig = {
load: function (form)
{
form.needs("InternetParameters", { path: "igd.Services.$Internet", depth: 0 });
form.needs("WANDSLInterfaceConfig", {
path: function () {
return "igd." + (new Sah.Bus.Path(this.objects.InternetParameters.WANConnection)).butLast(4).toString() + ".WANDSLInterfaceConfig";
},
depth: 0
});
}
};
Sah.Bookmarks.Host = {
load: function (form)
{
form.needs("Host", { path: "Host", depth: 4 });
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/byte4.js */
/*jslint bitwise: false */
/**
* Sah.Byte4 manipulation class
*
*/
/**
* Sah.Byte4 constructor
* take :
* * 1 parameter (number of bits at 1 from the most significant bit)
* * 4 parameters (4 bytes)
*
* @constructor
*/
Sah.Byte4 = function ()
{
var i, nbb;
if (arguments.length === 4) {
this.push.apply(this, arguments);
} else if (arguments.length === 1) {
nbb = arguments[0];
if (!isNaN(nbb) && nbb >= 0 && nbb <= 32) {
this.push(0, 0, 0, 0);
for (i = 0; i < nbb; i += 1) {
// ~~ eq Math.flor
this[~~(i / 8)] += 1 << (i % 8);
}
}
}
};
Sah.Byte4.prototype = [];
/**
* Clone the byte array
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.clone = function ()
{
return new Sah.Byte4(this[0], this[1], this[2], this[3]);
};
/**
* Equal operator
* @return {Boolean}
*/
Sah.Byte4.prototype.eq = function (bytes)
{
return this[0] === bytes[0] &&
this[1] === bytes[1] &&
this[2] === bytes[2] &&
this[3] === bytes[3];
};
/**
* Different operator
* @return {Boolean}
*/
Sah.Byte4.prototype.diff = function (bytes)
{
return this[0] !== bytes[0] ||
this[1] !== bytes[1] ||
this[2] !== bytes[2] ||
this[3] !== bytes[3];
};
/**
* Bynary and operator
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.and = function (bytes)
{
return new Sah.Byte4(this[0] & bytes[0],
this[1] & bytes[1],
this[2] & bytes[2],
this[3] & bytes[3]);
};
/**
* Bynary or operator
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.or = function (bytes)
{
return new Sah.Byte4(this[0] | bytes[0],
this[1] | bytes[1],
this[2] | bytes[2],
this[3] | bytes[3]);
};
/**
* Bynary xor operator
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.xor = function (bytes) {
return new Sah.Byte4(this[0] ^ bytes[0],
this[1] ^ bytes[1],
this[2] ^ bytes[2],
this[3] ^ bytes[3]);
};
/**
* Bynary not operator
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.not = function (bytes)
{
return new Sah.Byte4(~ this[0] & 0xFF,
~ this[1] & 0xFF,
~ this[2] & 0xFF,
~ this[3] & 0xFF);
};
/**
* Get integer value
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.toInt = function ()
{
return this[0] * Math.pow(2, 24) +
this[1] * Math.pow(2, 16) +
this[2] * Math.pow(2, 8) +
this[3];
};
/**
* Set from an integer value
* @return {Sah.Byte4} this ref
*/
Sah.Byte4.prototype.fromInt = function (val)
{
// ~~ eq Math.flor
this[3] = val % 256;
val = ~~(val / 256);
this[2] = val % 256;
val = ~~(val / 256);
this[1] = val % 256;
val = ~~(val / 256);
this[0] = val % 256;
return this;
};
/**
* Increase the value
* @return {Sah.Byte4} this ref
*/
Sah.Byte4.prototype.increase = function (val)
{
this.fromInt(this.toInt() + (val || 1));
return this;
};
/**
* Decrease the value
* @return {Sah.Byte4} this ref
*/
Sah.Byte4.prototype.decrease = function (val)
{
this.fromInt(this.toInt() - (val || 1));
return this;
};
/**
* Math plus operator
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.plus = function (val)
{
return new Sah.Byte4(0, 0, 0, 0).fromInt(this.toInt() + val);
};
/**
* Math minus operator
* @return {Sah.Byte4} copy
*/
Sah.Byte4.prototype.minus = function (val)
{
return new Sah.Byte4(0, 0, 0, 0).fromInt(this.toInt() - val);
};
/**
* Math lower than operator
* @return {Boolean}
*/
Sah.Byte4.prototype.lt = function (bytes)
{
return this.toInt() < bytes.toInt();
};
/**
* Math lower than or equal operator
* @return {Boolean}
*/
Sah.Byte4.prototype.lteq = function (bytes)
{
return this.toInt() <= bytes.toInt();
};
/**
* Math greater than operator
* @return {Boolean}
*/
Sah.Byte4.prototype.gt = function (bytes)
{
return this.toInt() > bytes.toInt();
};
/**
* Math greater than or equal operator
* @return {Boolean}
*/
Sah.Byte4.prototype.gteq = function (bytes)
{
return this.toInt() >= bytes.toInt();
};
/**
* Is the value is in the interval
* @param {Sah.Byte4} min minimum
* @param {Sah.Byte4} max maximum
* @return {Boolean}
*/
Sah.Byte4.prototype.isInInterval = function (min, max)
{
var intval = this.toInt();
return min.toInt() < intval && intval < max.toInt();
};
/**
* Is the value is in the interval
* @param {Sah.Byte4} min minimum
* @param {Sah.Byte4} max maximum
* @return {Boolean}
*/
Sah.Byte4.prototype.isInRange = function (min, max)
{
var intval = this.toInt();
return min.toInt() <= intval && intval <= max.toInt();
};
/**
* Check if the 1 and 0 bits are contigu
* @return {Boolean}
*/
Sah.Byte4.prototype.isBytesContigu = function ()
{
var n, p = 1, i, d;
for (i = 0; i < 4; i += 1) {
for (d = 7; d >= 0; d -= 1) {
n = this[i] & (1 << d);
if (!p && n) {
return false;
}
p = n;
}
}
return true;
};
/**
* Convert to string
*/
Sah.Byte4.prototype.toString = function ()
{
return this.join('.');
};
//HACK BEGIN: IE<9 compatibility
if (!Prototype.BrowserFeatures.ElementExtensions) {
Sah._Byte4 = Sah.Byte4;
Sah.Byte4 = function () {
var self = [];
Object.extend(self, Sah._Byte4.prototype);
self.toString = Sah._Byte4.prototype.toString;
Sah._Byte4.apply(self, arguments);
return self;
};
}
//HACK END: IE<9 compatibility
/**
* Parse an IPv4 address fron the string format
* @param {String} address format aaa.bbb.ccc.ddd or aaa.bbb.ccc.ddd/mm
* @param {String} netmask format aaa.bbb.ccc.ddd
* @return {Object} (bytes,bytesMask)
*/
Sah.Byte4.parseIPAddress = function (address, netmask)
{
var ret, res, i, o;
ret = {
bytes: null,
bytesMask: Sah.Byte4.ZERO // Default mask
};
if (address instanceof Sah.Byte4) {
ret.bytes = address;
} else {
if (typeof address !== 'string') {
return false;
}
res = /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)(\/([0-9]+))?$/.exec(address);
if (!res) {
return false;
}
ret.bytes = new Sah.Byte4();
for (i = 0; i < 4; i += 1) {
o = parseInt(res[i + 1], 10);
if (isNaN(o) || o < 0 || o > 255) {
return false;
}
ret.bytes.push(o);
}
if (res[6]) {
ret.bytesMask = new Sah.Byte4(parseInt(res[6], 10));
}
}
if (netmask) {
if (netmask instanceof Sah.Byte4) {
ret.bytesMask = netmask;
} else if ((res = Sah.Byte4.parseIPAddress(netmask))) {
ret.bytesMask = res.bytes;
} else {
ret.bytesMask = null; // Bad mask!
}
}
return ret;
};
/**
* Sah.Byte4 zero
*/
Sah.Byte4.ZERO = new Sah.Byte4(0);
/*jslint bitwise: true *//* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/ipaddress.js */
/*jslint bitwise: false */
/**
* Sah.IPAddress constructor
*
* @see Sah.Byte4.parseIPAddress
*/
Sah.IPAddress = function (address, netmask)
{
this.errno = null;
this.bytes = null;
this.bytesMask = null;
var res = Sah.Byte4.parseIPAddress.apply(this, arguments);
if (res) {
this.bytes = res.bytes;
this.bytesMask = res.bytesMask;
}
};
/**
* Test if the Sah.IPAddress match with a sub network
*
* @param {String} address format aaa.bbb.ccc.ddd or aaa.bbb.ccc.ddd/mm
* @param {String} netmask format aaa.bbb.ccc.ddd
* @return {Boolean}
*/
Sah.IPAddress.prototype.match = function (address, netmask)
{
var res;
if (address instanceof Sah.IPAddress) {
netmask = address.bytesMask;
address = address.bytes;
} else if (typeof address === "string") {
res = Sah.Byte4.parseIPAddress.apply(this, arguments);
if (!res) {
this.errno = Sah.IPAddress.ERR_FATAL;
return false;
}
address = res.bytes;
if (res.bytesMask) {
netmask = res.bytesMask;
} else {
this.errno = Sah.IPAddress.ERR_FATAL;
return false;
}
}
if (this.bytes.and(netmask).eq(address.and(netmask))) {
if (this.bytesMask.lt(netmask)) {
this.errno = Sah.IPAddress.ERR_INV_MASK;
} else {
return true;
}
}
return false;
};
/**
* Test if the Sah.IPAddress may be in conflict with a sub network
*
* @param {String} address format aaa.bbb.ccc.ddd or aaa.bbb.ccc.ddd/mm
* @param {String} netmask format aaa.bbb.ccc.ddd
* @return {Boolean}
*/
Sah.IPAddress.prototype.conflict = function (address, netmask) {
if (address instanceof Sah.IPAddress) {
netmask = address.bytesMask;
address = address.bytes;
} else if (typeof address === "string") {
var res = Sah.Byte4.parseIPAddress.apply(this, arguments);
if (!res) {
this.errno = Sah.IPAddress.ERR_FATAL;
return false;
}
address = res.bytes;
if (res.bytesMask) {
netmask = res.bytesMask;
} else {
this.errno = Sah.IPAddress.ERR_FATAL;
return false;
}
}
netmask = netmask.and(this.bytesMask);
if (this.bytes.and(netmask).eq(address.and(netmask))) {
this.errno = Sah.IPAddress.ERR_INV_MASK;
return true;
}
return false;
};
/**
* Test if a host can loin an other host
* @param {String} address
* @param {String} netmask
*/
Sah.IPAddress.prototype.canJoin = function (address, netmask)
{
var oth = new Sah.IPAddress(address, netmask);
if (oth.check() &&
(oth.bytesMask = oth.bytesMask.or(this.bytesMask)) &&
oth.check(Sah.IPAddress.CHK_HOST) &&
this.bytes.and(oth.bytesMask).eq(oth.bytes.and(oth.bytesMask)) &&
this.bytes.diff(oth.bytes)) {
return true;
}
this.errno = oth.errno;
return false;
};
/**
* Perform several checks
* if check fails : the errno is set with a Sah.IPAddress.ERR_XXX error
*
* @param {Number} flags to choise what check you want to perform with flags Sah.IPAddress.CHK_XXX
* @return {Boolean}
*/
Sah.IPAddress.prototype.check = function (flags)
{
var net, imask;
flags = flags || 0;
this.errno = Sah.IPAddress.ERR_NA;
if (!this.bytes) {
this.errno = Sah.IPAddress.ERR_SYN_IP;
return false;
}
if (!this.bytesMask) {
this.errno = Sah.IPAddress.ERR_SYN_MASK;
return false;
}
if (flags & 3) {
net = this.bytes.and(this.bytesMask);
}
if (flags & 1 && !net.isInInterval(Sah.Byte4.ZERO, this.bytesMask)) {
this.errno = Sah.IPAddress.ERR_INV_NET;
return false;
}
if (flags & 2) {
// private network (RFC 1918)
// without autoconfigured network 169.254.0.0/16
if (!this.match("10.0.0.0/8") &&
!this.match("172.16.0.0/12") &&
!this.match("192.168.0.0/16")) {
if (!this.errno) {
this.errno = Sah.IPAddress.ERR_INV_LAN;
}
return false;
}
}
if (flags & 4) {
imask = this.bytesMask.not();
if (!this.bytes.and(imask).isInInterval(Sah.Byte4.ZERO, imask)) {
this.errno = Sah.IPAddress.ERR_INV_HOST;
return false;
}
}
if (!(flags & 8)) {
if (!this.bytesMask.isBytesContigu()) {
this.errno = Sah.IPAddress.ERR_INV_MASK;
return false;
}
}
return true;
};
/**
* Get the network address
*
* @return {Sah.IPAddress}
*/
Sah.IPAddress.prototype.getNet = function ()
{
var ip = new Sah.IPAddress();
ip.bytes = this.bytes.and(this.bytesMask);
ip.bytesMask = this.bytesMask.clone();
return ip;
};
/**
* Get the broadcast address
*
* @return {Sah.IPAddress}
*/
Sah.IPAddress.prototype.getBCast = function ()
{
var ip = new Sah.IPAddress();
ip.bytes = this.bytes.or(this.bytesMask.not());
ip.bytesMask = this.bytesMask.clone();
return ip;
};
/**
* Check the DHCP Range
*
* @return {Boolean}
*/
Sah.IPAddress.prototype.checkDHCPRange = function (first, last)
{
var ret, lan, imask, hmin, hmax, hfst, hlst, hcur;
ret = Sah.Byte4.parseIPAddress(first);
if (!ret) {
this.errno = Sah.IPAddress.ERR_SYN_FIRSTIP;
return false;
}
first = ret.bytes;
ret = Sah.Byte4.parseIPAddress(last);
if (!ret) {
this.errno = Sah.IPAddress.ERR_SYN_LASTIP;
return false;
}
last = ret.bytes;
lan = this.bytes.and(this.bytesMask);
if (first.and(this.bytesMask).diff(lan)) {
this.errno = Sah.IPAddress.ERR_INV_FIRSTIP;
return false;
}
if (last.and(this.bytesMask).diff(lan)) {
this.errno = Sah.IPAddress.ERR_INV_LASTIP;
return false;
}
imask = this.bytesMask.not();
hmin = 0;
hmax = imask.toInt();
hfst = first.and(imask).toInt();
hlst = last.and(imask).toInt();
hcur = this.bytes.and(imask).toInt();
if (hfst <= hmin || hfst >= hmax) {
this.errno = Sah.IPAddress.ERR_INV_FIRSTIP;
return false;
}
if (hlst <= hfst || hlst >= hmax) {
this.errno = Sah.IPAddress.ERR_INV_LASTIP;
return false;
}
if (hcur >= hfst && hcur <= hlst) {
if (hcur - hfst < hlst - hcur) {
this.errno = Sah.IPAddress.ERR_INV_FIRSTIP;
return false;
} else {
this.errno = Sah.IPAddress.ERR_INV_LASTIP;
return false;
}
}
return true;
};
/**
* Get the max DHCP Range
*
* @return {Object} (first:Bite4, last:Bite4)
*/
Sah.IPAddress.prototype.getDHCPRange = function ()
{
var imask = this.bytesMask.not(),
lan = this.bytes.and(this.bytesMask),
hcur = this.bytes.and(imask).toInt(),
hmin = 0,
hmax = imask.toInt();
if (hcur - hmin < hmax - hcur) {
hmin = hcur;
} else {
hmax = hcur;
}
return {
first: lan.plus(hmin + 1),
last: lan.plus(hmax - 1)
};
};
/**
* Check if the IP address is valid
* @return {Boolean}
*/
Sah.IPAddress.isValid = function (ip)
{
return (new Sah.IPAddress(ip, "0.0.0.0")).check(Sah.IPAddress.CHK_HOST);
};
/**
* Check if the network mask is valid
* @return {Boolean}
*/
Sah.IPAddress.isValidMask = function (mask)
{
return (new Sah.IPAddress("0.0.0.0", mask)).check();
};
Sah.IPAddress.CHK_NET = 1;
Sah.IPAddress.CHK_LAN = 2;
Sah.IPAddress.CHK_HOST = 4;
Sah.IPAddress.NOT_CHK_CNTB = 8;
Sah.IPAddress.ERR_SYN = 0x0100;
Sah.IPAddress.ERR_INV = 0x0200;
Sah.IPAddress.ERR_ADDR = 0x0400;
Sah.IPAddress.ERR_MASK = 0x0800;
Sah.IPAddress.ERR_FIRST = 0x1000;
Sah.IPAddress.ERR_LAST = 0x2000;
Sah.IPAddress.ERR_NO = 0x00FF;
Sah.IPAddress.ERR_NA = 0;
Sah.IPAddress.ERR_FATAL = 1;
Sah.IPAddress.ERR_SYN_IP = 2 | Sah.IPAddress.ERR_SYN | Sah.IPAddress.ERR_ADDR;
Sah.IPAddress.ERR_SYN_MASK = 3 | Sah.IPAddress.ERR_SYN | Sah.IPAddress.ERR_ADDR;
Sah.IPAddress.ERR_INV_NET = 4 | Sah.IPAddress.ERR_INV | Sah.IPAddress.ERR_ADDR;
Sah.IPAddress.ERR_INV_MASK = 5 | Sah.IPAddress.ERR_INV | Sah.IPAddress.ERR_MASK;
Sah.IPAddress.ERR_INV_HOST = 6 | Sah.IPAddress.ERR_INV | Sah.IPAddress.ERR_ADDR;
Sah.IPAddress.ERR_INV_LAN = 7 | Sah.IPAddress.ERR_INV | Sah.IPAddress.ERR_ADDR;
Sah.IPAddress.ERR_SYN_FIRSTIP = 11 | Sah.IPAddress.ERR_SYN | Sah.IPAddress.ERR_FIRST;
Sah.IPAddress.ERR_SYN_LASTIP = 12 | Sah.IPAddress.ERR_SYN | Sah.IPAddress.ERR_LAST;
Sah.IPAddress.ERR_INV_FIRSTIP = 13 | Sah.IPAddress.ERR_INV | Sah.IPAddress.ERR_FIRST;
Sah.IPAddress.ERR_INV_LASTIP = 14 | Sah.IPAddress.ERR_INV | Sah.IPAddress.ERR_LAST;
/*jslint bitwise: true *//* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/production.js */
Sah.Config.environment = "production";
Sah.Config.logLevel = "none";
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/tools.js */
Sah.Tools = {
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Copyright (C) Paul Johnston 1999 - 2000.
* Updated by Greg Holt 2000 - 2001.
* See http://pajhome.org.uk/site/legal.html for details.
*/
/*
* Convert a 32-bit number to a hex string with ls-byte first
*/
hex_chr : "0123456789abcdef",
rhex : function (num)
{
str = "";
for(j = 0; j <= 3; j++)
str += this.hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) +
this.hex_chr.charAt((num >> (j * 8)) & 0x0F);
return str;
},
/*
* Convert a string to a sequence of 16-word blocks, stored as an array.
* Append padding bits and the length, as described in the MD5 standard.
*/
str2blks_MD5 : function (str)
{
nblk = ((str.length + 8) >> 6) + 1;
blks = new Array(nblk * 16);
for(i = 0; i < nblk * 16; i++) blks[i] = 0;
for(i = 0; i < str.length; i++)
blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
blks[i >> 2] |= 0x80 << ((i % 4) * 8);
blks[nblk * 16 - 2] = str.length * 8;
return blks;
},
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
add : function (x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
},
/*
* Bitwise rotate a 32-bit number to the left
*/
rol : function (num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
},
/*
* These functions implement the basic operation for each round of the
* algorithm.
*/
cmn: function (q, a, b, x, s, t)
{
return this.add(this.rol(this.add(this.add(a, q), this.add(x, t)), s), b);
},
ff :function (a, b, c, d, x, s, t)
{
return this.cmn((b & c) | ((~b) & d), a, b, x, s, t);
},
gg : function (a, b, c, d, x, s, t)
{
return this.cmn((b & d) | (c & (~d)), a, b, x, s, t);
},
hh : function (a, b, c, d, x, s, t)
{
return this.cmn(b ^ c ^ d, a, b, x, s, t);
},
ii : function (a, b, c, d, x, s, t)
{
return this.cmn(c ^ (b | (~d)), a, b, x, s, t);
},
/*
* Take a string and return the hex representation of its MD5.
*/
MD5 : function (str)
{
x = this.str2blks_MD5(str);
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for(i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = this.ff(a, b, c, d, x[i+ 0], 7 , -680876936);
d = this.ff(d, a, b, c, x[i+ 1], 12, -389564586);
c = this.ff(c, d, a, b, x[i+ 2], 17, 606105819);
b = this.ff(b, c, d, a, x[i+ 3], 22, -1044525330);
a = this.ff(a, b, c, d, x[i+ 4], 7 , -176418897);
d = this.ff(d, a, b, c, x[i+ 5], 12, 1200080426);
c = this.ff(c, d, a, b, x[i+ 6], 17, -1473231341);
b = this.ff(b, c, d, a, x[i+ 7], 22, -45705983);
a = this.ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
d = this.ff(d, a, b, c, x[i+ 9], 12, -1958414417);
c = this.ff(c, d, a, b, x[i+10], 17, -42063);
b = this.ff(b, c, d, a, x[i+11], 22, -1990404162);
a = this.ff(a, b, c, d, x[i+12], 7 , 1804603682);
d = this.ff(d, a, b, c, x[i+13], 12, -40341101);
c = this.ff(c, d, a, b, x[i+14], 17, -1502002290);
b = this.ff(b, c, d, a, x[i+15], 22, 1236535329);
a = this.gg(a, b, c, d, x[i+ 1], 5 , -165796510);
d = this.gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
c = this.gg(c, d, a, b, x[i+11], 14, 643717713);
b = this.gg(b, c, d, a, x[i+ 0], 20, -373897302);
a = this.gg(a, b, c, d, x[i+ 5], 5 , -701558691);
d = this.gg(d, a, b, c, x[i+10], 9 , 38016083);
c = this.gg(c, d, a, b, x[i+15], 14, -660478335);
b = this.gg(b, c, d, a, x[i+ 4], 20, -405537848);
a = this.gg(a, b, c, d, x[i+ 9], 5 , 568446438);
d = this.gg(d, a, b, c, x[i+14], 9 , -1019803690);
c = this.gg(c, d, a, b, x[i+ 3], 14, -187363961);
b = this.gg(b, c, d, a, x[i+ 8], 20, 1163531501);
a = this.gg(a, b, c, d, x[i+13], 5 , -1444681467);
d = this.gg(d, a, b, c, x[i+ 2], 9 , -51403784);
c = this.gg(c, d, a, b, x[i+ 7], 14, 1735328473);
b = this.gg(b, c, d, a, x[i+12], 20, -1926607734);
a = this.hh(a, b, c, d, x[i+ 5], 4 , -378558);
d = this.hh(d, a, b, c, x[i+ 8], 11, -2022574463);
c = this.hh(c, d, a, b, x[i+11], 16, 1839030562);
b = this.hh(b, c, d, a, x[i+14], 23, -35309556);
a = this.hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
d = this.hh(d, a, b, c, x[i+ 4], 11, 1272893353);
c = this.hh(c, d, a, b, x[i+ 7], 16, -155497632);
b = this.hh(b, c, d, a, x[i+10], 23, -1094730640);
a = this.hh(a, b, c, d, x[i+13], 4 , 681279174);
d = this.hh(d, a, b, c, x[i+ 0], 11, -358537222);
c = this.hh(c, d, a, b, x[i+ 3], 16, -722521979);
b = this.hh(b, c, d, a, x[i+ 6], 23, 76029189);
a = this.hh(a, b, c, d, x[i+ 9], 4 , -640364487);
d = this.hh(d, a, b, c, x[i+12], 11, -421815835);
c = this.hh(c, d, a, b, x[i+15], 16, 530742520);
b = this.hh(b, c, d, a, x[i+ 2], 23, -995338651);
a = this.ii(a, b, c, d, x[i+ 0], 6 , -198630844);
d = this.ii(d, a, b, c, x[i+ 7], 10, 1126891415);
c = this.ii(c, d, a, b, x[i+14], 15, -1416354905);
b = this.ii(b, c, d, a, x[i+ 5], 21, -57434055);
a = this.ii(a, b, c, d, x[i+12], 6 , 1700485571);
d = this.ii(d, a, b, c, x[i+ 3], 10, -1894986606);
c = this.ii(c, d, a, b, x[i+10], 15, -1051523);
b = this.ii(b, c, d, a, x[i+ 1], 21, -2054922799);
a = this.ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
d = this.ii(d, a, b, c, x[i+15], 10, -30611744);
c = this.ii(c, d, a, b, x[i+ 6], 15, -1560198380);
b = this.ii(b, c, d, a, x[i+13], 21, 1309151649);
a = this.ii(a, b, c, d, x[i+ 4], 6 , -145523070);
d = this.ii(d, a, b, c, x[i+11], 10, -1120210379);
c = this.ii(c, d, a, b, x[i+ 2], 15, 718787259);
b = this.ii(b, c, d, a, x[i+ 9], 21, -343485551);
a = this.add(a, olda);
b = this.add(b, oldb);
c = this.add(c, oldc);
d = this.add(d, oldd);
}
return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d);
},
dateHMS :function (time)
{
var addZero = function(v) { return v<10 ? '0' + v : v; };
var d = new Date(time * 1000); // millisecondes
var dateArray = [];
dateArray.push(addZero(d.getHours()-1));
dateArray.push(addZero(d.getMinutes()));
dateArray.push(addZero(d.getSeconds()));
return dateArray.join(':');
},
getIEVersion :function ()
{
if (!!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1)) {
var ver = navigator.userAgent.match(/MSIE ([0-9.]+);/);
if (ver != null && ver[1] != undefined)
{
ver = parseInt(ver[1],10);
if (ver == 7) {
if (typeof (window.external.AddToFavoritesBar) != "undefined" ||
typeof (window.external.AddService) != "undefined" ||
typeof (window.external.AddService) != "undefined") return 8;
}
return ver;
}
}
return false;
},
formatPhoneNumber : function (phoneNumber )
{
var format = '';
if( phoneNumber )
{
var len = phoneNumber.length;
if( appConfig === 'pl' )
{
if( len > 9 )
{
format = phoneNumber.substr(len-9, 9 );
}
else
{
format = phoneNumber;
}
}
else
{
if( len > 9 )
{
format = '0' + phoneNumber.substr(len-9, 9 );
}
else
{
format = '0' + phoneNumber;
}
}
}
return format;
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/validation.js */
/**
* @ namespace
*/
Sah.Validations = {
/** @lends Sah.Validations. */
/**
* @todo add doc comments
* @author Montassar
*/
isValidApplicationName: function (nameApp)
{
var appNameRegExp = /^[a-zA-Z0-9\s\(\)\[\]{}\|\-\+_=\*\?<>!&%#:;']{1,}$/;
var appNameNoSpaces = nameApp.replace(/^\s*|\s*$/g, "");
return appNameRegExp.test(appNameNoSpaces);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidFirewallRuleDescription: function (ruleDesc)
{
var ruleDescRegExp = /^[\x21-\x7E]{1,32}$/;
return ruleDescRegExp.test(ruleDesc);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidDNSName: function (nameDns)
{
var DNSNameRegEx = /^[a-zA-Z0-9\-]{1,64}$/;
return DNSNameRegEx.test(nameDns);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidWord: function (word)
{
var wordRegExp = /^[\x21-\x7E]*$/;
return wordRegExp.test(word);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidDomain: function(domainValue)
{
var DomainRegExp = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/;
return DomainRegExp.test(domain);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidSSID: function (ssid)
{
var SSIDRegExp = /^[\x21-\x7E]{1,32}$/;
return SSIDRegExp.test(ssid);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidWPAKey: function (WPAKey)
{
return WPAKey.match(/^([\x20-\x7e]{8,63}|[a-e\d]{64})$/i) !== null;
},
/**
* @todo add doc comments and use the same convention for wpaKey naming and WEPKey (case)
* @author Montassar
*/
isValidWEPKey: function (wepKey)
{
return (wepKey.match(/^[0-9a-f]{10}$/i) /* 40-bit HEX */
|| wepKey.match(/^[0-9a-f]{26}$/i) /* 104-bit HEX */
|| wepKey.match(/^[0-9a-f]{32}$/i) /* 128-bit HEX */
|| wepKey.match(/^.{5}$/i) /* 40-bit ASCII */
|| wepKey.match(/^.{13}$/i) /* 104-bit ASCII */
|| wepKey.match(/^.{16}$/i) /* 128-bit ASCII */);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidBluetoothName: function (bluetoothName)
{
return isValidSSID( bluetoothName );
},
/**
* @todo add doc comments, fixup coding style
* @author Montassar
*/
isValidMacAddress: function (macaddress)
{
var mac_regexp = /^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i;
return mac_regexp.test(macaddress);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidbluetoothAddress: function (bluetoothAddress)
{
return isValidMacAddress(bluetoothAddress);
},
/**
* @todo add doc comment
* @author Montassar
*/
isValidUnlockCode: function (unlockCode)
{
unlockCodeRegexp = /^[0-9a-zA-Z+\/]{27}$/i;
return unlockCodeRegexp.test(unlockCode);
},
/**
* @todo add doc comments
* @author Montassar
*/
isNumeric: function (str)
{
var numericRegExp = /^\d+$/;
return numericRegExp.test(str);
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidNumber: function(sText, pMin, pMax)
{
return (sText.match(/^\d+$/)
&& sText >= pMin
&& sText <= pMax);
},
/**
* @author Montassar
*/
isValidPinCode: function (code)
{
var codePattern = /^(\d{8})$/;
var accum=0;
if(!codePattern.test(code))
return false;
/* ~~ = Math.floor */
accum += 3 * (~~(code / 10000000) % 10);
accum += 1 * (~~(code / 1000000) % 10);
accum += 3 * (~~(code / 100000) % 10);
accum += 1 * (~~(code / 10000) % 10);
accum += 3 * (~~(code / 1000) % 10);
accum += 1 * (~~(code / 100) % 10);
accum += 3 * (~~(code / 10) % 10);
accum += 1 * (~~(code / 1) % 10);
return (0 == (accum % 10));
},
/**
* @todo add doc comments
* @author Montassar
*/
isValidPort: function (portNumber)
{
var codePattern = /^((\d{1,5})|((\d{1,5})\-(\d{1,5})))$/;
if(codePattern.test(portNumber)) {
var range = portNumber.split("-");
return !(parseInt(range[0],10) < 1
|| parseInt(range[0],10) > 65535
|| (range[1] != "undefined"
&& (parseInt(range[1],10) < 1 || parseInt(range[1],10) > 65535)));
}
return false ;
},
isValidPppLogin : function ( login)
{
var loginPattern = /^([A-z]+(\/)*[A-z]*)$/;
return loginPattern.test(login) && login.length<=85;
},
isValidPppPassword : function ( passwd)
{
var passwdPattern = /^([0-z]+)$/;
return passwdPattern.test(passwd) && passwd.length<=85;
}
};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/widget.js */
/**
* @namespace
*/
Sah.Widget = {};
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/widget/image_select.js */
Sah.Widget.ImageSelect = Class.create(
{
/** @lends Sah.Widget.ImageSelect# */
initialize: function (element)
{
this.select = element;
this.select.hide();
this.container = this.select.parentNode;
this.container.style.textAlign = "center";
this.images = [];
this.reverseImage = {};
var maxHeight = 0;
for (var i = 0; i < this.select.options.length; i++) {
var img = new Element("img");
img.src = Sah.res("/" + this.select.options[i].value);
img.hide();
this.images.push(img);
Element.insert(this.container, img);
maxHeight = (maxHeight > img.getHeight() ? maxHeight : img.getHeight());
this.reverseImage[this.select.options[i].value] = i;
};
this.container.style.height = maxHeight + "px";
this.container.style.position = "relative";
this.buttonLeft = new Element("input");
this.buttonLeft.type = "button";
this.buttonLeft.value = "<";
this.buttonLeft.addClassName("button");
this.buttonLeft.observe("click", this.nextImage.bind(this, -1));
this.buttonLeft.setStyle({ position: "absolute", top: ((maxHeight - 25) / 2) + "px", left: "5px" });
this.container.appendChild(this.buttonLeft);
this.buttonRight = new Element("input");
this.buttonRight.type = "button";
this.buttonRight.value = ">";
this.buttonRight.addClassName("button");
this.buttonRight.observe("click", this.nextImage.bind(this, +1));
this.buttonRight.setStyle({ position: "absolute", top: ((maxHeight - 25) / 2) + "px", right: "5px" });
this.container.appendChild(this.buttonRight);
this.selectImage(this.select.selectedIndex || 0);
this.select.setValue = (function (value) { this.selectImage(this.reverseImage[value]); }).bind(this);
},
selectImage: function (i)
{
this.select.selectedIndex = i;
if (this.currentImage)
this.currentImage.hide();
this.currentImage = this.images[i];
this.images[i].show();
this.images[i].style.marginTop = ((this.container.getHeight() - this.images[i].getHeight()) / 2) + "px";
},
nextImage: function (incr)
{
var newIndex = (this.select.selectedIndex + incr) % this.select.options.length;
if (newIndex < 0)
newIndex = this.select.options.length + newIndex;
this.selectImage(newIndex);
}
}
);
Sah.behave("select.images", Sah.Widget.ImageSelect);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/sah/widget/notification.js */
Sah.Widget.Notification = Class.create(
/** @lends Sah.Widget.Dialog# */
{
/**
* Display a notification. The callback given will be called with an HTML
* element that you can use to setup your content
*/
initialize: function (callback)
{
this.element = new Element("div");
this.element.addClassName("notification");
this.element.hide();
this.cover = new Element("div");
this.cover.addClassName("cover");
this.cover.hide();
callback(this.element);
},
show: function ()
{
var parent = document.body;
var dimension = document.viewport.getDimensions();
parent.appendChild(this.cover);
parent.appendChild(this.element);
this.element.makePositioned();
this.element.setStyle({ left: ((dimension.width - this.element.getWidth()) / 2) + "px",
top: ((dimension.height - this.element.getHeight()) / 2) + "px" });
Effect.Appear(this.element, { duration: 0.3, afterFinish: (function () { this.closeButton.focus() }).bind(this) });
Effect.Appear(this.cover, { duration: 0.3 });
},
remove: function ()
{
Effect.BlindUp(this.element, { duration: 0.3, afterFinish: function (effect) { effect.element.remove(); }});
Effect.Fade(this.cover, { duration: 0.3, afterFinish: function (effect) { effect.element.remove(); }});
},
addButtonBar: function ()
{
this.buttonBar = new Element("div");
this.buttonBar.addClassName("buttons");
this.element.appendChild(this.buttonBar);
},
addCloseButton: function (title)
{
this.closeButton = new Element("input");
this.closeButton.type = "button";
this.closeButton.value = title;
this.closeButton.addClassName("button");
this.closeButton.observe("click", this.remove.bind(this));
this.closeButton.observe("keypress", (function (event) { if (event.keyCode == Event.KEY_ESC) this.remove(); }).bind(this));
this.buttonBar.appendChild(this.closeButton);
}
}
);
Sah.Widget.ObjectNotification = Class.create(Sah.Widget.Notification,
/** @lends Sah.Widget.ObjectNotifcation# */
{
/**
* Display a notification for errors in an object
*/
initialize: function ($super, object, name)
{
this.object = object;
this.errorList = new Element("dl");
this.title = new Element("h1");
this.title.insert(t("Errors.ObjectNotification.Title",
"Error saving %1", name));
this.explain = new Element("p");
this.explain.insert(t("Errors.ObjectNotification.Explain",
"Some errors where encountered while saving %1 configuration: ", name));
$super(this.setErrors.bind(this));
this.element.addClassName("error");
this.element.appendChild(this.title);
this.element.appendChild(this.explain);
this.element.appendChild(this.errorList);
this.addButtonBar();
this.addCloseButton(t("Buttons.Close", "close"));
},
setErrors: function ()
{
this.object._errors.each(this.setError.bind(this));
},
setError: function (error)
{
var dt = new Element("dt");
var dd = new Element("dd");
dt.insert(error.parameter);
dd.insert(error.message);
this.errorList.appendChild(dt);
this.errorList.appendChild(dd);
}
}
);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/utils/effects.js */
// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
// Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/)
// Martin Bialasinki
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
// converts rgb() and #xxx to #xxxxxx format,
// returns self (or first argument) if not convertable
String.prototype.parseColor = function() {
var color = '#';
if (this.slice(0,4) == 'rgb(') {
var cols = this.slice(4,this.length-1).split(',');
var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
} else {
if (this.slice(0,1) == '#') {
if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
if (this.length==7) color = this.toLowerCase();
}
}
return (color.length==7 ? color : (arguments[0] || this));
};
/*--------------------------------------------------------------------------*/
Element.collectTextNodes = function(element) {
return $A($(element).childNodes).collect( function(node) {
return (node.nodeType==3 ? node.nodeValue :
(node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
}).flatten().join('');
};
Element.collectTextNodesIgnoreClass = function(element, className) {
return $A($(element).childNodes).collect( function(node) {
return (node.nodeType==3 ? node.nodeValue :
((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
Element.collectTextNodesIgnoreClass(node, className) : ''));
}).flatten().join('');
};
Element.setContentZoom = function(element, percent) {
element = $(element);
element.setStyle({fontSize: (percent/100) + 'em'});
if (Prototype.Browser.WebKit) window.scrollBy(0,0);
return element;
};
Element.getInlineOpacity = function(element){
return $(element).style.opacity || '';
};
Element.forceRerendering = function(element) {
try {
element = $(element);
var n = document.createTextNode(' ');
element.appendChild(n);
element.removeChild(n);
} catch(e) { }
};
/*--------------------------------------------------------------------------*/
var Effect = {
_elementDoesNotExistError: {
name: 'ElementDoesNotExistError',
message: 'The specified DOM element does not exist, but is required for this effect to operate'
},
Transitions: {
linear: Prototype.K,
sinoidal: function(pos) {
return (-Math.cos(pos*Math.PI)/2) + .5;
},
reverse: function(pos) {
return 1-pos;
},
flicker: function(pos) {
var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
return pos > 1 ? 1 : pos;
},
wobble: function(pos) {
return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
},
pulse: function(pos, pulses) {
return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
},
spring: function(pos) {
return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
},
none: function(pos) {
return 0;
},
full: function(pos) {
return 1;
}
},
DefaultOptions: {
duration: 1.0, // seconds
fps: 100, // 100= assume 66fps max.
sync: false, // true for combining
from: 0.0,
to: 1.0,
delay: 0.0,
queue: 'parallel'
},
tagifyText: function(element) {
var tagifyStyle = 'position:relative';
if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
element = $(element);
$A(element.childNodes).each( function(child) {
if (child.nodeType==3) {
child.nodeValue.toArray().each( function(character) {
element.insertBefore(
new Element('span', {style: tagifyStyle}).update(
character == ' ' ? String.fromCharCode(160) : character),
child);
});
Element.remove(child);
}
});
},
multiple: function(element, effect) {
var elements;
if (((typeof element == 'object') ||
Object.isFunction(element)) &&
(element.length))
elements = element;
else
elements = $(element).childNodes;
var options = Object.extend({
speed: 0.1,
delay: 0.0
}, arguments[2] || { });
var masterDelay = options.delay;
$A(elements).each( function(element, index) {
new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
});
},
PAIRS: {
'slide': ['SlideDown','SlideUp'],
'blind': ['BlindDown','BlindUp'],
'appear': ['Appear','Fade']
},
toggle: function(element, effect, options) {
element = $(element);
effect = (effect || 'appear').toLowerCase();
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
}, options || {}));
}
};
Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
/* ------------- core effects ------------- */
Effect.ScopedQueue = Class.create(Enumerable, {
initialize: function() {
this.effects = [];
this.interval = null;
},
_each: function(iterator) {
this.effects._each(iterator);
},
add: function(effect) {
var timestamp = new Date().getTime();
var position = Object.isString(effect.options.queue) ?
effect.options.queue : effect.options.queue.position;
switch(position) {
case 'front':
// move unstarted effects after this effect
this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
e.startOn += effect.finishOn;
e.finishOn += effect.finishOn;
});
break;
case 'with-last':
timestamp = this.effects.pluck('startOn').max() || timestamp;
break;
case 'end':
// start effect after last queued effect has finished
timestamp = this.effects.pluck('finishOn').max() || timestamp;
break;
}
effect.startOn += timestamp;
effect.finishOn += timestamp;
if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
this.effects.push(effect);
if (!this.interval)
this.interval = setInterval(this.loop.bind(this), 15);
},
remove: function(effect) {
this.effects = this.effects.reject(function(e) { return e==effect });
if (this.effects.length == 0) {
clearInterval(this.interval);
this.interval = null;
}
},
loop: function() {
var timePos = new Date().getTime();
for(var i=0, len=this.effects.length;i<len;i++)
this.effects[i] && this.effects[i].loop(timePos);
}
});
Effect.Queues = {
instances: $H(),
get: function(queueName) {
if (!Object.isString(queueName)) return queueName;
return this.instances.get(queueName) ||
this.instances.set(queueName, new Effect.ScopedQueue());
}
};
Effect.Queue = Effect.Queues.get('global');
Effect.Base = Class.create({
position: null,
start: function(options) {
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
this.currentFrame = 0;
this.state = 'idle';
this.startOn = this.options.delay*1000;
this.finishOn = this.startOn+(this.options.duration*1000);
this.fromToDelta = this.options.to-this.options.from;
this.totalTime = this.finishOn-this.startOn;
this.totalFrames = this.options.fps*this.options.duration;
this.render = (function() {
function dispatch(effect, eventName) {
if (effect.options[eventName + 'Internal'])
effect.options[eventName + 'Internal'](effect);
if (effect.options[eventName])
effect.options[eventName](effect);
}
return function(pos) {
if (this.state === "idle") {
this.state = "running";
dispatch(this, 'beforeSetup');
if (this.setup) this.setup();
dispatch(this, 'afterSetup');
}
if (this.state === "running") {
pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
this.position = pos;
dispatch(this, 'beforeUpdate');
if (this.update) this.update(pos);
dispatch(this, 'afterUpdate');
}
};
})();
this.event('beforeStart');
if (!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue) ?
'global' : this.options.queue.scope).add(this);
},
loop: function(timePos) {
if (timePos >= this.startOn) {
if (timePos >= this.finishOn) {
this.render(1.0);
this.cancel();
this.event('beforeFinish');
if (this.finish) this.finish();
this.event('afterFinish');
return;
}
var pos = (timePos - this.startOn) / this.totalTime,
frame = (pos * this.totalFrames).round();
if (frame > this.currentFrame) {
this.render(pos);
this.currentFrame = frame;
}
}
},
cancel: function() {
if (!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue) ?
'global' : this.options.queue.scope).remove(this);
this.state = 'finished';
},
event: function(eventName) {
if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
if (this.options[eventName]) this.options[eventName](this);
},
inspect: function() {
var data = $H();
for(property in this)
if (!Object.isFunction(this[property])) data.set(property, this[property]);
return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
}
});
Effect.Parallel = Class.create(Effect.Base, {
initialize: function(effects) {
this.effects = effects || [];
this.start(arguments[1]);
},
update: function(position) {
this.effects.invoke('render', position);
},
finish: function(position) {
this.effects.each( function(effect) {
effect.render(1.0);
effect.cancel();
effect.event('beforeFinish');
if (effect.finish) effect.finish(position);
effect.event('afterFinish');
});
}
});
Effect.Tween = Class.create(Effect.Base, {
initialize: function(object, from, to) {
object = Object.isString(object) ? $(object) : object;
var args = $A(arguments), method = args.last(),
options = args.length == 5 ? args[3] : null;
this.method = Object.isFunction(method) ? method.bind(object) :
Object.isFunction(object[method]) ? object[method].bind(object) :
function(value) { object[method] = value };
this.start(Object.extend({ from: from, to: to }, options || { }));
},
update: function(position) {
this.method(position);
}
});
Effect.Event = Class.create(Effect.Base, {
initialize: function() {
this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
},
update: Prototype.emptyFunction
});
Effect.Opacity = Class.create(Effect.Base, {
initialize: function(element) {
this.element = $(element);
if (!this.element) throw(Effect._elementDoesNotExistError);
// make this work on IE on elements without 'layout'
if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom: 1});
var options = Object.extend({
from: this.element.getOpacity() || 0.0,
to: 1.0
}, arguments[1] || { });
this.start(options);
},
update: function(position) {
this.element.setOpacity(position);
}
});
Effect.Move = Class.create(Effect.Base, {
initialize: function(element) {
this.element = $(element);
if (!this.element) throw(Effect._elementDoesNotExistError);
var options = Object.extend({
x: 0,
y: 0,
mode: 'relative'
}, arguments[1] || { });
this.start(options);
},
setup: function() {
this.element.makePositioned();
this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
this.originalTop = parseFloat(this.element.getStyle('top') || '0');
if (this.options.mode == 'absolute') {
this.options.x = this.options.x - this.originalLeft;
this.options.y = this.options.y - this.originalTop;
}
},
update: function(position) {
this.element.setStyle({
left: (this.options.x * position + this.originalLeft).round() + 'px',
top: (this.options.y * position + this.originalTop).round() + 'px'
});
}
});
// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
return new Effect.Move(element,
Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
};
Effect.Scale = Class.create(Effect.Base, {
initialize: function(element, percent) {
this.element = $(element);
if (!this.element) throw(Effect._elementDoesNotExistError);
var options = Object.extend({
scaleX: true,
scaleY: true,
scaleContent: true,
scaleFromCenter: false,
scaleMode: 'box', // 'box' or 'contents' or { } with provided values
scaleFrom: 100.0,
scaleTo: percent
}, arguments[2] || { });
this.start(options);
},
setup: function() {
this.restoreAfterFinish = this.options.restoreAfterFinish || false;
this.elementPositioning = this.element.getStyle('position');
this.originalStyle = { };
['top','left','width','height','fontSize'].each( function(k) {
this.originalStyle[k] = this.element.style[k];
}.bind(this));
this.originalTop = this.element.offsetTop;
this.originalLeft = this.element.offsetLeft;
var fontSize = this.element.getStyle('font-size') || '100%';
['em','px','%','pt'].each( function(fontSizeType) {
if (fontSize.indexOf(fontSizeType)>0) {
this.fontSize = parseFloat(fontSize);
this.fontSizeType = fontSizeType;
}
}.bind(this));
this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
this.dims = null;
if (this.options.scaleMode=='box')
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
if (/^content/.test(this.options.scaleMode))
this.dims = [this.element.scrollHeight, this.element.scrollWidth];
if (!this.dims)
this.dims = [this.options.scaleMode.originalHeight,
this.options.scaleMode.originalWidth];
},
update: function(position) {
var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
if (this.options.scaleContent && this.fontSize)
this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
},
finish: function(position) {
if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
},
setDimensions: function(height, width) {
var d = { };
if (this.options.scaleX) d.width = width.round() + 'px';
if (this.options.scaleY) d.height = height.round() + 'px';
if (this.options.scaleFromCenter) {
var topd = (height - this.dims[0])/2;
var leftd = (width - this.dims[1])/2;
if (this.elementPositioning == 'absolute') {
if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
} else {
if (this.options.scaleY) d.top = -topd + 'px';
if (this.options.scaleX) d.left = -leftd + 'px';
}
}
this.element.setStyle(d);
}
});
Effect.Highlight = Class.create(Effect.Base, {
initialize: function(element) {
this.element = $(element);
if (!this.element) throw(Effect._elementDoesNotExistError);
var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
this.start(options);
},
setup: function() {
// Prevent executing on elements not in the layout flow
if (this.element.getStyle('display')=='none') { this.cancel(); return; }
// Disable background image during the effect
this.oldStyle = { };
if (!this.options.keepBackgroundImage) {
this.oldStyle.backgroundImage = this.element.getStyle('background-image');
this.element.setStyle({backgroundImage: 'none'});
}
if (!this.options.endcolor)
this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
if (!this.options.restorecolor)
this.options.restorecolor = this.element.getStyle('background-color');
// init color calculations
this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
},
update: function(position) {
this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
},
finish: function() {
this.element.setStyle(Object.extend(this.oldStyle, {
backgroundColor: this.options.restorecolor
}));
}
});
Effect.ScrollTo = function(element) {
var options = arguments[1] || { },
scrollOffsets = document.viewport.getScrollOffsets(),
elementOffsets = $(element).cumulativeOffset();
if (options.offset) elementOffsets[1] += options.offset;
return new Effect.Tween(null,
scrollOffsets.top,
elementOffsets[1],
options,
function(p){ scrollTo(scrollOffsets.left, p.round()); }
);
};
/* ------------- combination effects ------------- */
Effect.Fade = function(element) {
element = $(element);
var oldOpacity = element.getInlineOpacity();
var options = Object.extend({
from: element.getOpacity() || 1.0,
to: 0.0,
afterFinishInternal: function(effect) {
if (effect.options.to!=0) return;
effect.element.hide().setStyle({opacity: oldOpacity});
}
}, arguments[1] || { });
return new Effect.Opacity(element,options);
};
Effect.Appear = function(element) {
element = $(element);
var options = Object.extend({
from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
to: 1.0,
// force Safari to render floated elements properly
afterFinishInternal: function(effect) {
effect.element.forceRerendering();
},
beforeSetup: function(effect) {
effect.element.setOpacity(effect.options.from).show();
}}, arguments[1] || { });
return new Effect.Opacity(element,options);
};
Effect.Puff = function(element) {
element = $(element);
var oldStyle = {
opacity: element.getInlineOpacity(),
position: element.getStyle('position'),
top: element.style.top,
left: element.style.left,
width: element.style.width,
height: element.style.height
};
return new Effect.Parallel(
[ new Effect.Scale(element, 200,
{ sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
Object.extend({ duration: 1.0,
beforeSetupInternal: function(effect) {
Position.absolutize(effect.effects[0].element);
},
afterFinishInternal: function(effect) {
effect.effects[0].element.hide().setStyle(oldStyle); }
}, arguments[1] || { })
);
};
Effect.BlindUp = function(element) {
element = $(element);
element.makeClipping();
return new Effect.Scale(element, 0,
Object.extend({ scaleContent: false,
scaleX: false,
restoreAfterFinish: true,
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping();
}
}, arguments[1] || { })
);
};
Effect.BlindDown = function(element) {
element = $(element);
var elementDimensions = element.getDimensions();
return new Effect.Scale(element, 100, Object.extend({
scaleContent: false,
scaleX: false,
scaleFrom: 0,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
restoreAfterFinish: true,
afterSetup: function(effect) {
effect.element.makeClipping().setStyle({height: '0px'}).show();
},
afterFinishInternal: function(effect) {
effect.element.undoClipping();
}
}, arguments[1] || { }));
};
Effect.SwitchOff = function(element) {
element = $(element);
var oldOpacity = element.getInlineOpacity();
return new Effect.Appear(element, Object.extend({
duration: 0.4,
from: 0,
transition: Effect.Transitions.flicker,
afterFinishInternal: function(effect) {
new Effect.Scale(effect.element, 1, {
duration: 0.3, scaleFromCenter: true,
scaleX: false, scaleContent: false, restoreAfterFinish: true,
beforeSetup: function(effect) {
effect.element.makePositioned().makeClipping();
},
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
}
});
}
}, arguments[1] || { }));
};
Effect.DropOut = function(element) {
element = $(element);
var oldStyle = {
top: element.getStyle('top'),
left: element.getStyle('left'),
opacity: element.getInlineOpacity() };
return new Effect.Parallel(
[ new Effect.Move(element, {x: 0, y: 100, sync: true }),
new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
Object.extend(
{ duration: 0.5,
beforeSetup: function(effect) {
effect.effects[0].element.makePositioned();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
}
}, arguments[1] || { }));
};
Effect.Shake = function(element) {
element = $(element);
var options = Object.extend({
distance: 20,
duration: 0.5
}, arguments[1] || {});
var distance = parseFloat(options.distance);
var split = parseFloat(options.duration) / 10.0;
var oldStyle = {
top: element.getStyle('top'),
left: element.getStyle('left') };
return new Effect.Move(element,
{ x: distance, y: 0, duration: split, afterFinishInternal: function(effect) {
new Effect.Move(effect.element,
{ x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
new Effect.Move(effect.element,
{ x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
new Effect.Move(effect.element,
{ x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
new Effect.Move(effect.element,
{ x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
new Effect.Move(effect.element,
{ x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
effect.element.undoPositioned().setStyle(oldStyle);
}}); }}); }}); }}); }}); }});
};
Effect.SlideDown = function(element) {
element = $(element).cleanWhitespace();
// SlideDown need to have the content of the element wrapped in a container element with fixed height!
var oldInnerBottom = element.down().getStyle('bottom');
var elementDimensions = element.getDimensions();
return new Effect.Scale(element, 100, Object.extend({
scaleContent: false,
scaleX: false,
scaleFrom: window.opera ? 0 : 1,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
restoreAfterFinish: true,
afterSetup: function(effect) {
effect.element.makePositioned();
effect.element.down().makePositioned();
if (window.opera) effect.element.setStyle({top: ''});
effect.element.makeClipping().setStyle({height: '0px'}).show();
},
afterUpdateInternal: function(effect) {
effect.element.down().setStyle({bottom:
(effect.dims[0] - effect.element.clientHeight) + 'px' });
},
afterFinishInternal: function(effect) {
effect.element.undoClipping().undoPositioned();
effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
}, arguments[1] || { })
);
};
Effect.SlideUp = function(element) {
element = $(element).cleanWhitespace();
var oldInnerBottom = element.down().getStyle('bottom');
var elementDimensions = element.getDimensions();
return new Effect.Scale(element, window.opera ? 0 : 1,
Object.extend({ scaleContent: false,
scaleX: false,
scaleMode: 'box',
scaleFrom: 100,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
restoreAfterFinish: true,
afterSetup: function(effect) {
effect.element.makePositioned();
effect.element.down().makePositioned();
if (window.opera) effect.element.setStyle({top: ''});
effect.element.makeClipping().show();
},
afterUpdateInternal: function(effect) {
effect.element.down().setStyle({bottom:
(effect.dims[0] - effect.element.clientHeight) + 'px' });
},
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping().undoPositioned();
effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
}
}, arguments[1] || { })
);
};
// Bug in opera makes the TD containing this element expand for a instance after finish
Effect.Squish = function(element) {
return new Effect.Scale(element, window.opera ? 1 : 0, {
restoreAfterFinish: true,
beforeSetup: function(effect) {
effect.element.makeClipping();
},
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping();
}
});
};
Effect.Grow = function(element) {
element = $(element);
var options = Object.extend({
direction: 'center',
moveTransition: Effect.Transitions.sinoidal,
scaleTransition: Effect.Transitions.sinoidal,
opacityTransition: Effect.Transitions.full
}, arguments[1] || { });
var oldStyle = {
top: element.style.top,
left: element.style.left,
height: element.style.height,
width: element.style.width,
opacity: element.getInlineOpacity() };
var dims = element.getDimensions();
var initialMoveX, initialMoveY;
var moveX, moveY;
switch (options.direction) {
case 'top-left':
initialMoveX = initialMoveY = moveX = moveY = 0;
break;
case 'top-right':
initialMoveX = dims.width;
initialMoveY = moveY = 0;
moveX = -dims.width;
break;
case 'bottom-left':
initialMoveX = moveX = 0;
initialMoveY = dims.height;
moveY = -dims.height;
break;
case 'bottom-right':
initialMoveX = dims.width;
initialMoveY = dims.height;
moveX = -dims.width;
moveY = -dims.height;
break;
case 'center':
initialMoveX = dims.width / 2;
initialMoveY = dims.height / 2;
moveX = -dims.width / 2;
moveY = -dims.height / 2;
break;
}
return new Effect.Move(element, {
x: initialMoveX,
y: initialMoveY,
duration: 0.01,
beforeSetup: function(effect) {
effect.element.hide().makeClipping().makePositioned();
},
afterFinishInternal: function(effect) {
new Effect.Parallel(
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
new Effect.Scale(effect.element, 100, {
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
], Object.extend({
beforeSetup: function(effect) {
effect.effects[0].element.setStyle({height: '0px'}).show();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
}
}, options)
);
}
});
};
Effect.Shrink = function(element) {
element = $(element);
var options = Object.extend({
direction: 'center',
moveTransition: Effect.Transitions.sinoidal,
scaleTransition: Effect.Transitions.sinoidal,
opacityTransition: Effect.Transitions.none
}, arguments[1] || { });
var oldStyle = {
top: element.style.top,
left: element.style.left,
height: element.style.height,
width: element.style.width,
opacity: element.getInlineOpacity() };
var dims = element.getDimensions();
var moveX, moveY;
switch (options.direction) {
case 'top-left':
moveX = moveY = 0;
break;
case 'top-right':
moveX = dims.width;
moveY = 0;
break;
case 'bottom-left':
moveX = 0;
moveY = dims.height;
break;
case 'bottom-right':
moveX = dims.width;
moveY = dims.height;
break;
case 'center':
moveX = dims.width / 2;
moveY = dims.height / 2;
break;
}
return new Effect.Parallel(
[ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
], Object.extend({
beforeStartInternal: function(effect) {
effect.effects[0].element.makePositioned().makeClipping();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
}, options)
);
};
Effect.Pulsate = function(element) {
element = $(element);
var options = arguments[1] || { },
oldOpacity = element.getInlineOpacity(),
transition = options.transition || Effect.Transitions.linear,
reverser = function(pos){
return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
};
return new Effect.Opacity(element,
Object.extend(Object.extend({ duration: 2.0, from: 0,
afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
}, options), {transition: reverser}));
};
Effect.Fold = function(element) {
element = $(element);
var oldStyle = {
top: element.style.top,
left: element.style.left,
width: element.style.width,
height: element.style.height };
element.makeClipping();
return new Effect.Scale(element, 5, Object.extend({
scaleContent: false,
scaleX: false,
afterFinishInternal: function(effect) {
new Effect.Scale(element, 1, {
scaleContent: false,
scaleY: false,
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping().setStyle(oldStyle);
} });
}}, arguments[1] || { }));
};
Effect.Morph = Class.create(Effect.Base, {
initialize: function(element) {
this.element = $(element);
if (!this.element) throw(Effect._elementDoesNotExistError);
var options = Object.extend({
style: { }
}, arguments[1] || { });
if (!Object.isString(options.style)) this.style = $H(options.style);
else {
if (options.style.include(':'))
this.style = options.style.parseStyle();
else {
this.element.addClassName(options.style);
this.style = $H(this.element.getStyles());
this.element.removeClassName(options.style);
var css = this.element.getStyles();
this.style = this.style.reject(function(style) {
return style.value == css[style.key];
});
options.afterFinishInternal = function(effect) {
effect.element.addClassName(effect.options.style);
effect.transforms.each(function(transform) {
effect.element.style[transform.style] = '';
});
};
}
}
this.start(options);
},
setup: function(){
function parseColor(color){
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
color = color.parseColor();
return $R(0,2).map(function(i){
return parseInt( color.slice(i*2+1,i*2+3), 16 );
});
}
this.transforms = this.style.map(function(pair){
var property = pair[0], value = pair[1], unit = null;
if (value.parseColor('#zzzzzz') != '#zzzzzz') {
value = value.parseColor();
unit = 'color';
} else if (property == 'opacity') {
value = parseFloat(value);
if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom: 1});
} else if (Element.CSS_LENGTH.test(value)) {
var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
value = parseFloat(components[1]);
unit = (components.length == 3) ? components[2] : null;
}
var originalValue = this.element.getStyle(property);
return {
style: property.camelize(),
originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
targetValue: unit=='color' ? parseColor(value) : value,
unit: unit
};
}.bind(this)).reject(function(transform){
return (
(transform.originalValue == transform.targetValue) ||
(
transform.unit != 'color' &&
(isNaN(transform.originalValue) || isNaN(transform.targetValue))
)
);
});
},
update: function(position) {
var style = { }, transform, i = this.transforms.length;
while(i--)
style[(transform = this.transforms[i]).style] =
transform.unit=='color' ? '#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
(transform.originalValue +
(transform.targetValue - transform.originalValue) * position).toFixed(3) +
(transform.unit === null ? '' : transform.unit);
this.element.setStyle(style, true);
}
});
Effect.Transform = Class.create({
initialize: function(tracks){
this.tracks = [];
this.options = arguments[1] || { };
this.addTracks(tracks);
},
addTracks: function(tracks){
tracks.each(function(track){
track = $H(track);
var data = track.values().first();
this.tracks.push($H({
ids: track.keys().first(),
effect: Effect.Morph,
options: { style: data }
}));
}.bind(this));
return this;
},
play: function(){
return new Effect.Parallel(
this.tracks.map(function(track){
var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
var elements = [$(ids) || $$(ids)].flatten();
return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
}).flatten(),
this.options
);
}
});
Element.CSS_PROPERTIES = $w(
'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
'fontSize fontWeight height left letterSpacing lineHeight ' +
'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
'right textIndent top width wordSpacing zIndex');
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
String.__parseStyleElement = document.createElement('div');
String.prototype.parseStyle = function(){
var style, styleRules = $H();
if (Prototype.Browser.WebKit)
style = new Element('div',{style:this}).style;
else {
String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
style = String.__parseStyleElement.childNodes[0].style;
}
Element.CSS_PROPERTIES.each(function(property){
if (style[property]) styleRules.set(property, style[property]);
});
if (Prototype.Browser.IE && this.include('opacity'))
styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
return styleRules;
};
if (document.defaultView && document.defaultView.getComputedStyle) {
Element.getStyles = function(element) {
var css = document.defaultView.getComputedStyle($(element), null);
return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
styles[property] = css[property];
return styles;
});
};
} else {
Element.getStyles = function(element) {
element = $(element);
var css = element.currentStyle, styles;
styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
results[property] = css[property];
return results;
});
if (!styles.opacity) styles.opacity = element.getOpacity();
return styles;
};
}
Effect.Methods = {
morph: function(element, style) {
element = $(element);
new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
return element;
},
visualEffect: function(element, effect, options) {
element = $(element);
var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
new Effect[klass](element, options);
return element;
},
highlight: function(element, options) {
element = $(element);
new Effect.Highlight(element, options);
return element;
}
};
$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
'pulsate shake puff squish switchOff dropOut').each(
function(effect) {
Effect.Methods[effect] = function(element, options){
element = $(element);
Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
return element;
};
}
);
$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
function(f) { Effect.Methods[f] = Element[f]; }
);
Element.addMethods(Effect.Methods);
/* jsdep: /tmp/sah0113/builds/builddir_REL_2011-02-04_V3.63.21_ft_lbv2fr_zte_h202n_ft_dual_h323_normal_com/build/REL/2010-11-25_V5.0.6/output/staging/build/www/compile/web/js/utils/javacrypt.js */
/***************************************************************
* *
* JAVACRYPT: CLIENT-SIDE crypt(3) USING JAVASCRIPT *
* *
***************************************************************
* *
* This Javascript allows you to calculate the encrypted *
* password generated by the UNIX function crypt(3) on your *
* computer without using an online script in PHP, PERL, *
* shell, or any other server-side script. The only changes *
* you need make in this are in function dP(), which is right *
* below the end of this comment. Refer to the directions *
* there for details. *
* *
* I wish I could take full credit for this script, but there *
* are several people who deserve most of the credit *
* *
* First and foremost, I thank John F. Dumas for writing *
* jcrypt.java, a Java-based implementation of crypt(3) and *
* from which this Javascript is heavily based (actually, I *
* just did a direct port from his code, using Sun's tutorial *
* and my knowledge of Javascript). I additionally thank *
* Eric Young for writing the C code off which Dumas based *
* his script. Finally, thanks goes to the original writers *
* of crypt(3), whoever they are. *
* *
* If you have questions, I suggest you ask John Dumas about *
* them, as I have no real idea what any of this code does. *
* Base the questions off his source code, as Javascript and *
* Java are (in basic operators) nearly identical. *
* *
* jcrypt.java source code can be found at: *
* http://locutus.kingwoodcable.com/jfd/crypt.html *
* *
***************************************************************/
function dP(salt, passwd){
pw_salt=this.crypt(salt, passwd);
return pw_salt[0];
}
function bTU(b){
value=Math.floor(b);
return (value>=0?value:value+256);
}
function fBTI(b,offset){
value=this.byteToUnsigned(b[offset++]);
value|=(this.byteToUnsigned(b[offset++])<<8);
value|=(this.byteToUnsigned(b[offset++])<<16);
value|=(this.byteToUnsigned(b[offset++])<<24);
return value;
}
function iTFB(iValue,b,offset){
b[offset++]=((iValue)&0xff);
b[offset++]=((iValue>>>8)&0xff);
b[offset++]=((iValue>>>16)&0xff);
b[offset++]=((iValue>>>24)&0xff);
}
function P_P(a,b,n,m,results){
t=((a>>>n)^b)&m;
a^=t<<n;
b^=t;
results[0]=a;
results[1]=b;
}
function H_P(a,n,m){
t=((a<<(16-n))^a)&m;
a=a^t^(t>>>(16-n));
return a;
}
function d_s_k(key){
schedule=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
c=this.fourBytesToInt(key,0);
d=this.fourBytesToInt(key,4);
results=new Array(0,0);
this.PERM_OP(d,c,4,0x0f0f0f0f,results);
d=results[0];c=results[1];
c=this.HPERM_OP(c,-2,0xcccc0000);
d=this.HPERM_OP(d,-2,0xcccc0000);
this.PERM_OP(d,c,1,0x55555555,results);
d=results[0];c=results[1];
this.PERM_OP(c,d,8,0x00ff00ff,results);
c=results[0];d=results[1];
this.PERM_OP(d,c,1,0x55555555,results);
d=results[0];c=results[1];
d=(((d&0x000000ff)<<16)|(d&0x0000ff00)|((d&0x00ff0000)>>>16)|((c&0xf0000000)>>>4));
c&=0x0fffffff;
s=0;t=0;
j=0;
for(i=0;i<this.ITERATIONS;i++){
if(this.shifts2[i]){
c=(c>>>2)|(c<<26);
d=(d>>>2)|(d<<26);
}else{
c=(c>>>1)|(c<<27);
d=(d>>>1)|(d<<27);
}
c&=0x0fffffff;
d&=0x0fffffff;
s= this.skb[0][c&0x3f] |
this.skb[1][((c>>>6)&0x03)|((c>>>7)&0x3c)] |
this.skb[2][((c>>>13)&0x0f)|((c>>>14)&0x30)] |
this.skb[3][((c>>>20)&0x01)|((c>>>21)&0x06)|((c>>>22)&0x38)];
t= this.skb[4][d&0x3f] |
this.skb[5][((d>>>7)&0x03)|((d>>>8)&0x3c)] |
this.skb[6][(d>>>15)&0x3f] |
this.skb[7][((d>>>21)&0x0f)|((d>>>22)&0x30)];
schedule[j++]=((t<< 16)|(s&0x0000ffff))&0xffffffff;
s=((s>>>16)|(t&0xffff0000));
s=(s<<4)|(s>>>28);
schedule[j++]=s&0xffffffff;
}
return schedule;
}
function D_E(L,R,S,E0,E1,s){
v=R^(R>>>16);
u=v&E0;
v=v&E1;
u=(u^(u<<16))^R^s[S];
t=(v^(v<<16))^R^s[S+1];
t=(t>>>4)|(t<<28);
L^= this.SPtrans[1][t&0x3f] |
this.SPtrans[3][(t>>>8)&0x3f] |
this.SPtrans[5][(t>>>16)&0x3f] |
this.SPtrans[7][(t>>>24)&0x3f] |
this.SPtrans[0][u&0x3f] |
this.SPtrans[2][(u>>>8)&0x3f] |
this.SPtrans[4][(u>>>16)&0x3f] |
this.SPtrans[6][(u>>>24)&0x3f];
return L;
}
function bdy(schedule,Eswap0,Eswap1) {
left=0;
right=0;
t=0;
for(j=0;j<25;j++){
for(i=0;i<this.ITERATIONS*2;i+=4){
left=this.D_ENCRYPT(left, right,i,Eswap0,Eswap1,schedule);
right=this.D_ENCRYPT(right,left,i+2,Eswap0,Eswap1,schedule);
}
t=left;
left=right;
right=t;
}
t=right;
right=(left>>>1)|(left<<31);
left=(t>>>1)|(t<<31);
left&=0xffffffff;
right&=0xffffffff;
results=new Array(0,0);
this.PERM_OP(right,left,1,0x55555555,results);
right=results[0];left=results[1];
this.PERM_OP(left,right,8,0x00ff00ff,results);
left=results[0];right=results[1];
this.PERM_OP(right,left,2,0x33333333,results);
right=results[0];left=results[1];
this.PERM_OP(left,right,16,0x0000ffff,results);
left=results[0];right=results[1];
this.PERM_OP(right,left,4,0x0f0f0f0f,results);
right=results[0];left=results[1];
out=new Array(0,0);
out[0]=left;out[1]=right;
return out;
}
function rC() {
return this.GOODCHARS[Math.floor(64*Math.random())];
}
function cript(salt,original){
if(salt.length>=2)
salt=salt.substring(0,2);
while(salt.length<2)
salt+=this.randChar();
re=new RegExp("[^./a-zA-Z0-9]","g");
if(re.test(salt))
salt=this.randChar()+this.randChar();
charZero=salt.charAt(0)+'';
charOne=salt.charAt(1)+'';
ccZ=charZero.charCodeAt(0);
ccO=charOne.charCodeAt(0);
buffer=charZero+charOne+" ";
Eswap0=this.con_salt[ccZ];
Eswap1=this.con_salt[ccO]<<4;
key=new Array(0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0);
for(i=0;i<key.length&&i<original.length;i++){
iChar=original.charCodeAt(i);
key[i]=iChar<<1;
}
schedule=this.des_set_key(key);
out=this.body(schedule,Eswap0,Eswap1);
b=new Array(0,0,0,0,0,0,0,0,0);
this.intToFourBytes(out[0],b,0);
this.intToFourBytes(out[1],b,4);
b[8]=0;
for(i=2,y=0,u=0x80;i<13;i++){
for(j=0,c=0;j<6;j++) {
c<<=1;
if((b[y]&u)!=0)
c|=1;
u>>>=1;
if(u==0){
y++;
u=0x80;
}
buffer=buffer.substring(0,i)+String.fromCharCode(this.cov_2char[c])+buffer.substring(i+1,buffer.length);
}
}
ret=new Array(buffer,salt);
return ret;
}
function Crypt() {
this.ITERATIONS=16;
this.GOODCHARS=new Array(
".","/","0","1","2","3","4","5","6","7",
"8","9","A","B","C","D","E","F","G","H",
"I","J","K","L","M","N","O","P","Q","R",
"S","T","U","V","W","X","Y","Z","a","b",
"c","d","e","f","g","h","i","j","k","l",
"m","n","o","p","q","r","s","t","u","v",
"w","x","y","z");
this.con_salt=new Array(
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
0x0A,0x0B,0x05,0x06,0x07,0x08,0x09,0x0A,
0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,
0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,
0x23,0x24,0x25,0x20,0x21,0x22,0x23,0x24,
0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,
0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,
0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,
0x3D,0x3E,0x3F,0x00,0x00,0x00,0x00,0x00 );
this.shifts2=new Array(
false,false,true,true,true,true,true,true,
false,true, true,true,true,true,true,false );
this.skb=new Array(0,0,0,0,0,0,0,0);
this.skb[0]=new Array(
0x00000000,0x00000010,0x20000000,0x20000010,
0x00010000,0x00010010,0x20010000,0x20010010,
0x00000800,0x00000810,0x20000800,0x20000810,
0x00010800,0x00010810,0x20010800,0x20010810,
0x00000020,0x00000030,0x20000020,0x20000030,
0x00010020,0x00010030,0x20010020,0x20010030,
0x00000820,0x00000830,0x20000820,0x20000830,
0x00010820,0x00010830,0x20010820,0x20010830,
0x00080000,0x00080010,0x20080000,0x20080010,
0x00090000,0x00090010,0x20090000,0x20090010,
0x00080800,0x00080810,0x20080800,0x20080810,
0x00090800,0x00090810,0x20090800,0x20090810,
0x00080020,0x00080030,0x20080020,0x20080030,
0x00090020,0x00090030,0x20090020,0x20090030,
0x00080820,0x00080830,0x20080820,0x20080830,
0x00090820,0x00090830,0x20090820,0x20090830 );
this.skb[1]=new Array(
0x00000000,0x02000000,0x00002000,0x02002000,
0x00200000,0x02200000,0x00202000,0x02202000,
0x00000004,0x02000004,0x00002004,0x02002004,
0x00200004,0x02200004,0x00202004,0x02202004,
0x00000400,0x02000400,0x00002400,0x02002400,
0x00200400,0x02200400,0x00202400,0x02202400,
0x00000404,0x02000404,0x00002404,0x02002404,
0x00200404,0x02200404,0x00202404,0x02202404,
0x10000000,0x12000000,0x10002000,0x12002000,
0x10200000,0x12200000,0x10202000,0x12202000,
0x10000004,0x12000004,0x10002004,0x12002004,
0x10200004,0x12200004,0x10202004,0x12202004,
0x10000400,0x12000400,0x10002400,0x12002400,
0x10200400,0x12200400,0x10202400,0x12202400,
0x10000404,0x12000404,0x10002404,0x12002404,
0x10200404,0x12200404,0x10202404,0x12202404 );
this.skb[2]=new Array(
0x00000000,0x00000001,0x00040000,0x00040001,
0x01000000,0x01000001,0x01040000,0x01040001,
0x00000002,0x00000003,0x00040002,0x00040003,
0x01000002,0x01000003,0x01040002,0x01040003,
0x00000200,0x00000201,0x00040200,0x00040201,
0x01000200,0x01000201,0x01040200,0x01040201,
0x00000202,0x00000203,0x00040202,0x00040203,
0x01000202,0x01000203,0x01040202,0x01040203,
0x08000000,0x08000001,0x08040000,0x08040001,
0x09000000,0x09000001,0x09040000,0x09040001,
0x08000002,0x08000003,0x08040002,0x08040003,
0x09000002,0x09000003,0x09040002,0x09040003,
0x08000200,0x08000201,0x08040200,0x08040201,
0x09000200,0x09000201,0x09040200,0x09040201,
0x08000202,0x08000203,0x08040202,0x08040203,
0x09000202,0x09000203,0x09040202,0x09040203 );
this.skb[3]=new Array(
0x00000000,0x00100000,0x00000100,0x00100100,
0x00000008,0x00100008,0x00000108,0x00100108,
0x00001000,0x00101000,0x00001100,0x00101100,
0x00001008,0x00101008,0x00001108,0x00101108,
0x04000000,0x04100000,0x04000100,0x04100100,
0x04000008,0x04100008,0x04000108,0x04100108,
0x04001000,0x04101000,0x04001100,0x04101100,
0x04001008,0x04101008,0x04001108,0x04101108,
0x00020000,0x00120000,0x00020100,0x00120100,
0x00020008,0x00120008,0x00020108,0x00120108,
0x00021000,0x00121000,0x00021100,0x00121100,
0x00021008,0x00121008,0x00021108,0x00121108,
0x04020000,0x04120000,0x04020100,0x04120100,
0x04020008,0x04120008,0x04020108,0x04120108,
0x04021000,0x04121000,0x04021100,0x04121100,
0x04021008,0x04121008,0x04021108,0x04121108 );
this.skb[4]=new Array(
0x00000000,0x10000000,0x00010000,0x10010000,
0x00000004,0x10000004,0x00010004,0x10010004,
0x20000000,0x30000000,0x20010000,0x30010000,
0x20000004,0x30000004,0x20010004,0x30010004,
0x00100000,0x10100000,0x00110000,0x10110000,
0x00100004,0x10100004,0x00110004,0x10110004,
0x20100000,0x30100000,0x20110000,0x30110000,
0x20100004,0x30100004,0x20110004,0x30110004,
0x00001000,0x10001000,0x00011000,0x10011000,
0x00001004,0x10001004,0x00011004,0x10011004,
0x20001000,0x30001000,0x20011000,0x30011000,
0x20001004,0x30001004,0x20011004,0x30011004,
0x00101000,0x10101000,0x00111000,0x10111000,
0x00101004,0x10101004,0x00111004,0x10111004,
0x20101000,0x30101000,0x20111000,0x30111000,
0x20101004,0x30101004,0x20111004,0x30111004 );
this.skb[5]=new Array(
0x00000000,0x08000000,0x00000008,0x08000008,
0x00000400,0x08000400,0x00000408,0x08000408,
0x00020000,0x08020000,0x00020008,0x08020008,
0x00020400,0x08020400,0x00020408,0x08020408,
0x00000001,0x08000001,0x00000009,0x08000009,
0x00000401,0x08000401,0x00000409,0x08000409,
0x00020001,0x08020001,0x00020009,0x08020009,
0x00020401,0x08020401,0x00020409,0x08020409,
0x02000000,0x0A000000,0x02000008,0x0A000008,
0x02000400,0x0A000400,0x02000408,0x0A000408,
0x02020000,0x0A020000,0x02020008,0x0A020008,
0x02020400,0x0A020400,0x02020408,0x0A020408,
0x02000001,0x0A000001,0x02000009,0x0A000009,
0x02000401,0x0A000401,0x02000409,0x0A000409,
0x02020001,0x0A020001,0x02020009,0x0A020009,
0x02020401,0x0A020401,0x02020409,0x0A020409 );
this.skb[6]=new Array(
0x00000000,0x00000100,0x00080000,0x00080100,
0x01000000,0x01000100,0x01080000,0x01080100,
0x00000010,0x00000110,0x00080010,0x00080110,
0x01000010,0x01000110,0x01080010,0x01080110,
0x00200000,0x00200100,0x00280000,0x00280100,
0x01200000,0x01200100,0x01280000,0x01280100,
0x00200010,0x00200110,0x00280010,0x00280110,
0x01200010,0x01200110,0x01280010,0x01280110,
0x00000200,0x00000300,0x00080200,0x00080300,
0x01000200,0x01000300,0x01080200,0x01080300,
0x00000210,0x00000310,0x00080210,0x00080310,
0x01000210,0x01000310,0x01080210,0x01080310,
0x00200200,0x00200300,0x00280200,0x00280300,
0x01200200,0x01200300,0x01280200,0x01280300,
0x00200210,0x00200310,0x00280210,0x00280310,
0x01200210,0x01200310,0x01280210,0x01280310 );
this.skb[7]=new Array(
0x00000000,0x04000000,0x00040000,0x04040000,
0x00000002,0x04000002,0x00040002,0x04040002,
0x00002000,0x04002000,0x00042000,0x04042000,
0x00002002,0x04002002,0x00042002,0x04042002,
0x00000020,0x04000020,0x00040020,0x04040020,
0x00000022,0x04000022,0x00040022,0x04040022,
0x00002020,0x04002020,0x00042020,0x04042020,
0x00002022,0x04002022,0x00042022,0x04042022,
0x00000800,0x04000800,0x00040800,0x04040800,
0x00000802,0x04000802,0x00040802,0x04040802,
0x00002800,0x04002800,0x00042800,0x04042800,
0x00002802,0x04002802,0x00042802,0x04042802,
0x00000820,0x04000820,0x00040820,0x04040820,
0x00000822,0x04000822,0x00040822,0x04040822,
0x00002820,0x04002820,0x00042820,0x04042820,
0x00002822,0x04002822,0x00042822,0x04042822 );
this.SPtrans=new Array(0,0,0,0,0,0,0,0);
this.SPtrans[0]=new Array(
0x00820200,0x00020000,0x80800000,0x80820200,
0x00800000,0x80020200,0x80020000,0x80800000,
0x80020200,0x00820200,0x00820000,0x80000200,
0x80800200,0x00800000,0x00000000,0x80020000,
0x00020000,0x80000000,0x00800200,0x00020200,
0x80820200,0x00820000,0x80000200,0x00800200,
0x80000000,0x00000200,0x00020200,0x80820000,
0x00000200,0x80800200,0x80820000,0x00000000,
0x00000000,0x80820200,0x00800200,0x80020000,
0x00820200,0x00020000,0x80000200,0x00800200,
0x80820000,0x00000200,0x00020200,0x80800000,
0x80020200,0x80000000,0x80800000,0x00820000,
0x80820200,0x00020200,0x00820000,0x80800200,
0x00800000,0x80000200,0x80020000,0x00000000,
0x00020000,0x00800000,0x80800200,0x00820200,
0x80000000,0x80820000,0x00000200,0x80020200 );
this.SPtrans[1]=new Array(
0x10042004,0x00000000,0x00042000,0x10040000,
0x10000004,0x00002004,0x10002000,0x00042000,
0x00002000,0x10040004,0x00000004,0x10002000,
0x00040004,0x10042000,0x10040000,0x00000004,
0x00040000,0x10002004,0x10040004,0x00002000,
0x00042004,0x10000000,0x00000000,0x00040004,
0x10002004,0x00042004,0x10042000,0x10000004,
0x10000000,0x00040000,0x00002004,0x10042004,
0x00040004,0x10042000,0x10002000,0x00042004,
0x10042004,0x00040004,0x10000004,0x00000000,
0x10000000,0x00002004,0x00040000,0x10040004,
0x00002000,0x10000000,0x00042004,0x10002004,
0x10042000,0x00002000,0x00000000,0x10000004,
0x00000004,0x10042004,0x00042000,0x10040000,
0x10040004,0x00040000,0x00002004,0x10002000,
0x10002004,0x00000004,0x10040000,0x00042000 );
this.SPtrans[2]=new Array(
0x41000000,0x01010040,0x00000040,0x41000040,
0x40010000,0x01000000,0x41000040,0x00010040,
0x01000040,0x00010000,0x01010000,0x40000000,
0x41010040,0x40000040,0x40000000,0x41010000,
0x00000000,0x40010000,0x01010040,0x00000040,
0x40000040,0x41010040,0x00010000,0x41000000,
0x41010000,0x01000040,0x40010040,0x01010000,
0x00010040,0x00000000,0x01000000,0x40010040,
0x01010040,0x00000040,0x40000000,0x00010000,
0x40000040,0x40010000,0x01010000,0x41000040,
0x00000000,0x01010040,0x00010040,0x41010000,
0x40010000,0x01000000,0x41010040,0x40000000,
0x40010040,0x41000000,0x01000000,0x41010040,
0x00010000,0x01000040,0x41000040,0x00010040,
0x01000040,0x00000000,0x41010000,0x40000040,
0x41000000,0x40010040,0x00000040,0x01010000 );
this.SPtrans[3]=new Array(
0x00100402,0x04000400,0x00000002,0x04100402,
0x00000000,0x04100000,0x04000402,0x00100002,
0x04100400,0x04000002,0x04000000,0x00000402,
0x04000002,0x00100402,0x00100000,0x04000000,
0x04100002,0x00100400,0x00000400,0x00000002,
0x00100400,0x04000402,0x04100000,0x00000400,
0x00000402,0x00000000,0x00100002,0x04100400,
0x04000400,0x04100002,0x04100402,0x00100000,
0x04100002,0x00000402,0x00100000,0x04000002,
0x00100400,0x04000400,0x00000002,0x04100000,
0x04000402,0x00000000,0x00000400,0x00100002,
0x00000000,0x04100002,0x04100400,0x00000400,
0x04000000,0x04100402,0x00100402,0x00100000,
0x04100402,0x00000002,0x04000400,0x00100402,
0x00100002,0x00100400,0x04100000,0x04000402,
0x00000402,0x04000000,0x04000002,0x04100400 );
this.SPtrans[4]=new Array(
0x02000000,0x00004000,0x00000100,0x02004108,
0x02004008,0x02000100,0x00004108,0x02004000,
0x00004000,0x00000008,0x02000008,0x00004100,
0x02000108,0x02004008,0x02004100,0x00000000,
0x00004100,0x02000000,0x00004008,0x00000108,
0x02000100,0x00004108,0x00000000,0x02000008,
0x00000008,0x02000108,0x02004108,0x00004008,
0x02004000,0x00000100,0x00000108,0x02004100,
0x02004100,0x02000108,0x00004008,0x02004000,
0x00004000,0x00000008,0x02000008,0x02000100,
0x02000000,0x00004100,0x02004108,0x00000000,
0x00004108,0x02000000,0x00000100,0x00004008,
0x02000108,0x00000100,0x00000000,0x02004108,
0x02004008,0x02004100,0x00000108,0x00004000,
0x00004100,0x02004008,0x02000100,0x00000108,
0x00000008,0x00004108,0x02004000,0x02000008 );
this.SPtrans[5]=new Array(
0x20000010,0x00080010,0x00000000,0x20080800,
0x00080010,0x00000800,0x20000810,0x00080000,
0x00000810,0x20080810,0x00080800,0x20000000,
0x20000800,0x20000010,0x20080000,0x00080810,
0x00080000,0x20000810,0x20080010,0x00000000,
0x00000800,0x00000010,0x20080800,0x20080010,
0x20080810,0x20080000,0x20000000,0x00000810,
0x00000010,0x00080800,0x00080810,0x20000800,
0x00000810,0x20000000,0x20000800,0x00080810,
0x20080800,0x00080010,0x00000000,0x20000800,
0x20000000,0x00000800,0x20080010,0x00080000,
0x00080010,0x20080810,0x00080800,0x00000010,
0x20080810,0x00080800,0x00080000,0x20000810,
0x20000010,0x20080000,0x00080810,0x00000000,
0x00000800,0x20000010,0x20000810,0x20080800,
0x20080000,0x00000810,0x00000010,0x20080010 );
this.SPtrans[6]=new Array(
0x00001000,0x00000080,0x00400080,0x00400001,
0x00401081,0x00001001,0x00001080,0x00000000,
0x00400000,0x00400081,0x00000081,0x00401000,
0x00000001,0x00401080,0x00401000,0x00000081,
0x00400081,0x00001000,0x00001001,0x00401081,
0x00000000,0x00400080,0x00400001,0x00001080,
0x00401001,0x00001081,0x00401080,0x00000001,
0x00001081,0x00401001,0x00000080,0x00400000,
0x00001081,0x00401000,0x00401001,0x00000081,
0x00001000,0x00000080,0x00400000,0x00401001,
0x00400081,0x00001081,0x00001080,0x00000000,
0x00000080,0x00400001,0x00000001,0x00400080,
0x00000000,0x00400081,0x00400080,0x00001080,
0x00000081,0x00001000,0x00401081,0x00400000,
0x00401080,0x00000001,0x00001001,0x00401081,
0x00400001,0x00401080,0x00401000,0x00001001 );
this.SPtrans[7]=new Array(
0x08200020,0x08208000,0x00008020,0x00000000,
0x08008000,0x00200020,0x08200000,0x08208020,
0x00000020,0x08000000,0x00208000,0x00008020,
0x00208020,0x08008020,0x08000020,0x08200000,
0x00008000,0x00208020,0x00200020,0x08008000,
0x08208020,0x08000020,0x00000000,0x00208000,
0x08000000,0x00200000,0x08008020,0x08200020,
0x00200000,0x00008000,0x08208000,0x00000020,
0x00200000,0x00008000,0x08000020,0x08208020,
0x00008020,0x08000000,0x00000000,0x00208000,
0x08200020,0x08008020,0x08008000,0x00200020,
0x08208000,0x00000020,0x00200020,0x08008000,
0x08208020,0x00200000,0x08200000,0x08000020,
0x00208000,0x00008020,0x08008020,0x08200000,
0x00000020,0x08208000,0x00208020,0x00000000,
0x08000000,0x08200020,0x00008000,0x00208020 );
this.cov_2char=new Array(
0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,
0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,
0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,
0x55,0x56,0x57,0x58,0x59,0x5A,0x61,0x62,
0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,
0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,
0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A );
this.byteToUnsigned=bTU;
this.fourBytesToInt=fBTI;
this.intToFourBytes=iTFB;
this.PERM_OP=P_P;
this.HPERM_OP=H_P;
this.des_set_key=d_s_k;
this.D_ENCRYPT=D_E;
this.body=bdy;
this.randChar=rC;
this.crypt=cript;
this.encrypt=dP;
}
Javacrypt=new Crypt();
/********************* End of javacrypt.js ******************************/
USERNAME=admin
PASSWORD=admin
HOST=192.168.1.1
curl -s -c cookies.txt "http://$HOST/authenticate?username=$USERNAME&password=$PASSWORD"
curl -s --cookie cookies.txt "http://$HOST/rest/SI/Wan?_restDepth=-1&_restAttributes=getObject_parameters" -o output.json
cat output.json | python -mjson.tool > pp_output.json
less pp_output.json
This file has been truncated, but you can view the full file.
{
"children": [
{
"children": [],
"instances": [],
"objectInfo": {
"attributes": {},
"childCount": 0,
"indexPath": "rest.SI.Wan",
"instanceCount": 0,
"key": "Autodetect",
"keyPath": "rest.SI.Wan",
"name": "Autodetect",
"parameterCount": 1,
"requestId": 0,
"state": "ready"
},
"parameters": [
{
"attributes": {},
"name": "Protocol",
"state": "ready",
"type": "string",
"value": "PPP"
}
]
},
{
"children": [
{
"children": [],
"instances": [],
"objectInfo": {
"attributes": {},
"childCount": 0,
"indexPath": "rest.SI.Wan.Quality",
"instanceCount": 0,
"key": "WANDSLLinkConfig",
"keyPath": "rest.SI.Wan.Quality",
"name": "WANDSLLinkConfig",
"parameterCount": 13,
"requestId": 0,
"state": "ready"
},
"parameters": [
{
"attributes": {},
"name": "LinkType",
"state": "ready",
"type": "string",
"value": "EoA"
},
{
"attributes": {},
"name": "LinkStatus",
"state": "ready",
"type": "string",
"value": "Up"
},
{
"attributes": {},
"name": "DestinationAddress",
"state": "ready",
"type": "string",
"value": "PVC: 8/35"
},
{
"attributes": {},
"name": "ATMEncapsulation",
"state": "ready",
"type": "string",
"value": "VCMUX"
},
{
"attributes": {},
"name": "MultiPriorityQueues",
"state": "ready",
"type": "string",
"value": "2"
},
{
"attributes": {},
"name": "ATMQoS",
"state": "ready",
"type": "string",
"value": "UBR"
},
{
"attributes": {},
"name": "ATMPeakCellRate",
"state": "ready",
"type": "string",
"value": "3000"
},
{
"attributes": {},
"name": "ATMMaximumBurstSize",
"state": "ready",
"type": "string",
"value": "0"
},
{
"attributes": {},
"name": "ATMSustainableCellRate",
"state": "ready",
"type": "string",
"value": "0"
},
{
"attributes": {},
"name": "Enable",
"state": "ready",
"type": "string",
"value": "1"
},
{
"attributes": {},
"name": "AutoConfig",
"state": "ready",
"type": "string",
"value": "0"
},
{
"attributes": {},
"name": "FCSPreserved",
"state": "ready",
"type": "string",
"value": "0"
},
{
"attributes": {},
"name": "ModulationType",
"state": "ready",
"type": "string",
"value": "ADSL_2plus"
}
]
},
{
"children": [],
"instances": [],
"objectInfo": {
"attributes": {},
"childCount": 0,
"indexPath": "rest.SI.Wan.Quality",
"instanceCount": 0,
"key": "Total",
"keyPath": "rest.SI.Wan.Quality",
"name": "Total",
"parameterCount": 3,
"requestId": 0,
"state": "ready"
},
"parameters": [
{
"attributes": {},
"name": "FECErrors",
"state": "ready",
"type": "string",
"value": "0"
},
{
"attributes": {},
"name": "HECErrors",
"state": "ready",
"type": "string",
"value": "513"
},
{
"attributes": {},
"name": "CRCErrors",
"state": "ready",
"type": "string",
"value": "176"
}
]
}
],
"instances": [],
"objectInfo": {
"attributes": {},
"childCount": 2,
"indexPath": "rest.SI.Wan",
"instanceCount": 0,
"key": "Quality",
"keyPath": "rest.SI.Wan",
"name": "Quality",
"parameterCount": 0,
"requestId": 0,
"state": "ready"
},
"parameters": []
},
{
"children": [
{
"children": [],
"instances": [],
"objectInfo": {
"attributes": {},
"childCount": 0,
"indexPath": "rest.SI.Wan.Statistics",
"instanceCount": 0,
"key": "WANDSLInterfaceConfig",
"keyPath": "rest.SI.Wan.Statistics",
"name": "WANDSLInterfaceConfig",
"parameterCount": 11,
"requestId": 0,
"state": "ready"
},
"parameters": [
{
"attributes": {},
"name": "UpstreamAttenuation",
"state": "ready",
"type": "string",
"value": "276"
},
{
"attributes": {},
"name": "DownstreamAttenuation",
"state": "ready",
"type": "string",
"value": "508"
},
{
"attributes": {},
"name": "UpstreamNoiseMargin",
"state": "ready",
"type": "string",
"value": "190"
},
{
"attributes": {},
"name": "DownstreamNoiseMargin",
"state": "ready",
"type": "string",
"value": "40"
},
{
"attributes": {},
"name": "UpstreamMaxRate",
"state": "ready",
"type": "string",
"value": "1022"
},
{
"attributes": {},
"name": "DownstreamMaxRate",
"state": "ready",
"type": "string",
"value": "628"
},
{
"attributes": {},
"name": "UpstreamPower",
"state": "ready",
"type": "string",
"value": "120"
},
{
"attributes": {},
"name": "DownstreamPower",
"state": "ready",
"type": "string",
"value": "0"
},
{
"attributes": {},
"name": "UpstreamCurrRate",
"state": "ready",
"type": "string",
"value": "509"
},
{
"attributes": {},
"name": "DownstreamCurrRate",
"state": "ready",
"type": "string",
"value": "880"
},
{
"attributes": {},
"name": "ShowtimeStart",
"state": "ready",
"type": "string",
"value": "33732"
}
]
},
{
"children": [],
"instances": [],
"objectInfo": {
"attributes": {},
"childCount": 0,
"indexPath": "rest.SI.Wan.Statistics",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment