www\js\panel\user_management\acs_management.js (function ($) {
$.fn.objAcsManage = function (InIt) {
var xmlName = '';
var controlMapExisting=new Array(0);
var controlMapCurrent=new Array(0);
var g_bInformEnabled;
var _url;
var _userName;
var _password;
var _connName;
var _connPsw ;
var _informInterval;
var _informEnable;
var _secretMode;
var oldMap=new Array(0);
var newMap=new Array(0);
this.onLoad = function () {
var index = 0;
this.loadHTML();
document.getElementById("title").innerHTML = jQuery.i18n.prop(InIt);
var arrayLabels = document.getElementsByTagName("label");
lableLocaliztion(arrayLabels);
/*Modified for reduce the admin.xml reads */
_userName = $(getData("locale")).find("serial_number").text();
$(getData("acs")).find("tr069").each(function() {
_url = $(this).find("acs_url").text();
_password = $(this).find("acs_password").text();
_connName = $(this).find("conn_name").text();
_connPsw = $(this).find("conn_psw").text();
_informInterval = $(this).find("inform_interval").text();
_informEnable = $(this).find("inform_enable").text();
_secretMode = $(this).find("acs_secretmode").text();
});
/*Modified end for reduce the admin.xml reads */
document.getElementById("tr069AcsUrl").value = _url;
document.getElementById("tr069AcsUsername").value = _userName;
document.getElementById("tr069AcsPassword").value = _password;
document.getElementById("tr069SecretMode").value = _secretMode;
/*Added for lInformEnabled & lInformDisabled by Young 2015.03.16*/
document.getElementById("lInformEnabled").innerHTML = jQuery.i18n.prop("lInformEnabled");
document.getElementById("lInformDisabled").innerHTML = jQuery.i18n.prop("lInformDisabled");
document.getElementById("tr069ConnName").value = _connName;
document.getElementById("tr069ConnPassword").value = _connPsw;
document.getElementById("tr069InformInterval").value = _informInterval;
document.getElementById("lTr069InformEnable").value = _informEnable;
document.getElementById("Acs_Management_div").style.display = "block";
document.getElementById("tbacsreenter_password").value = _password;
var buttonID = document.getElementById("btUpdate").id;/*Added by Young 2015.03.14*/
buttonLocaliztion(buttonID);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/acs_url", _url);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/acs_username", _userName);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/acs_password", _password);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/conn_name", _connName);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/conn_psw", _connPsw);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/inform_interval", _informInterval);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/inform_enable", _informEnable);
controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/tr069/acs_secretmode", _secretMode);
controlMapCurrent = g_objXML.copyArray(controlMapExisting,controlMapCurrent);
oldMap = g_objXML.copyArray(controlMapExisting,oldMap);
}
this.getPostData = function(){
var index = 0;
var mapData = new Array(0);
controlMapCurrent[index++][1] = document.getElementById("tr069AcsUrl").value;
controlMapCurrent[index++][1] = document.getElementById("tr069AcsUsername").value;
controlMapCurrent[index++][1] = document.getElementById("tr069AcsPassword").value;
controlMapCurrent[index++][1] = document.getElementById("tr069ConnName").value;
controlMapCurrent[index++][1] = document.getElementById("tr069ConnPassword").value;
controlMapCurrent[index++][1] = document.getElementById("tr069InformInterval").value;
controlMapCurrent[index++][1] = document.getElementById("lTr069InformEnable").value;
controlMapCurrent[index++][1] = document.getElementById("tr069SecretMode").value;
if(controlMapCurrent[2][1] != controlMapExisting[2][1]){
document.getElementById("tr069SecretMode").value = 0;
}
mapData = g_objXML.copyArray(controlMapCurrent,mapData);
newMap = mapData;
return newMap;
}
/*Foxconn dongmei add start for reboot after modify acs settings 20151103*/
this.acsSave =function(){
if(oldMap.sort().toString() != newMap.sort().toString()){
if(confirm("Are you sure you want to Reboot the Router?")){
setData();
hm();
callProductXML("reset");
hm();
sm('rebootRouterModalBox',319,170);
document.getElementById("h1RebootRouter").innerHTML = jQuery.i18n.prop("h1RebootRouter");
document.getElementById("lRebootedRouter").innerHTML = jQuery.i18n.prop("lRebootedRouter");
afterRebootID = setInterval("afterReboot()", 45000);
}
}else{}
}
this.afterReboot = function () {
hm();
clearInterval(afterRebootID);
clearAuthheader();
}
/*Foxconn dongmei add end for reboot after modify acs settings 20151103*/
this.onPost = function(){
/*Modified isinvalid for acs by FXN Young 2015.05.29*/
if(this.isValid()) {
var _controlMap ;
_controlMap = this.getPostData();
if(_controlMap.length>0) {
postXML(xmlName, g_objXML.getXMLDocToString(g_objXML.createXML(_controlMap)));
}
}
/*Modified end isinvalid for acs by FXN Young 2015.05.29*/
}
this. isValid = function(){
/*Add invalid pwd for acs by FXN Young 2015.05.29*/
if (!Password_Validation($("#tr069AcsUsername").val())||!Password_Validation($("#tr069AcsPassword").val())||!Password_Validation($("#tr069ConnName").val())||!Password_Validation($("#tr069ConnPassword").val()))
{
document.getElementById('lPassErrorMesPN').style.display = 'block';
document.getElementById('lPassErrorMesPN').innerHTML = jQuery.i18n.prop('ErrInvalidUserPwd_ACS');
return false;
}
else if (isChineseChar($("#tr069AcsUsername").val())||isChineseChar($("#tr069AcsPassword").val())||isChineseChar($("#tr069ConnName").val())||isChineseChar($("#tr069ConnPassword").val()))
{
document.getElementById('lPassErrorMesPN').style.display = 'block';
document.getElementById('lPassErrorMesPN').innerHTML = jQuery.i18n.prop('lChineseCharError_ACS');
return false;
}
else if(isChineseChar($("#tr069AcsUrl").val()))
{
document.getElementById('lPassErrorMesPN').style.display = 'block';
document.getElementById('lPassErrorMesPN').innerHTML = jQuery.i18n.prop('lChineseCharError_ACS_URL_zh');
return false;
}
else if(!deviceNameValidation_ACS_URL($("#tr069AcsUrl").val()))
{
document.getElementById('lPassErrorMesPN').style.display = 'block';
document.getElementById('lPassErrorMesPN').innerHTML = jQuery.i18n.prop('lChineseCharError_ACS_URL_en');
return false;
}
else if(!isNumber($("#tr069InformInterval").val()))
{
document.getElementById('lPassErrorMesPN').style.display = 'block';
document.getElementById('lPassErrorMesPN').innerHTML = jQuery.i18n.prop('lNumberCharError_ACS');
return false;
}
else
/*Add end invalid pwd for acs by FXN Young 2015.05.29*/
/*if(isNumber(document.getElementById('tr069AcsUrl').value)
&& isNumber(document.getElementById('tr069AcsUsername').value)
&& isNumber(document.getElementById('tr069AcsPassword').value))
return true;
else {
alert("it should be number!");*/
return true;
}
this.onPostSuccess = function() {
this.onLoad();
}
this.setXMLName = function (_xmlname) {
xmlName = _xmlname;
}
this.loadHTML = function() {
document.getElementById('Content').innerHTML = "";
document.getElementById('Content').innerHTML = callProductHTML("html/user_management/acs_management.html");
}
return this.each(function () {
});
}
})(jQuery);
function InformStatusChanged() {
var linkObj = document.getElementById("lTr069InformEnable");
var value = linkObj.options[linkObj.selectedIndex].value;
}
/*Foxconn dongmei add start for reboot after modify acs settings 20151103*/
function setDataReboot() {
g_objContent.getPostData();
if(document.getElementById('tr069AcsPassword').value!=document.getElementById('tbacsreenter_password').value) {
document.getElementById('lPassErrorMes').style.display = 'block';
document.getElementById('lPassErrorMes').innerHTML=jQuery.i18n.prop('lPassErrorMes');
document.getElementById("tbacsreenter_password").value = '';
} else {
document.getElementById('lPassErrorMes').style.display = 'none';
g_objContent.acsSave();
}
}
/*Foxconn dongmei add end for reboot after modify acs settings 20151103*/
function pswChanged() {
document.getElementById("tbacsreenter_password").value = '';
document.getElementById('lReAcsPassword').style.display = 'block';
document.getElementById('tbacsreenter_password').style.display = 'block';
}