blob: 58a780ef1d1bc5ec94ddd8ae4946f094b3558d4b [file] [log] [blame]
(function($) {
$.fn.objMEPSetting = function(InIt) {
var LOCK_PN = 1;
var LOCK_PU = 2;
var LOCK_PP = 3;
var LOCK_PC = 4;
var LOCK_SL = 5;
var UNLOCK_PN = 6;
var UNLOCK_PU = 7;
var UNLOCK_PP = 8;
var UNLOCK_PC = 9;
var UNLOCK_SL = 10;
var UNLOCK_PN_PUK = 11;
var UNLOCK_PU_PUK = 12;
var UNLOCK_PP_PUK = 13;
var UNLOCK_PC_PUK = 14;
var UNLOCK_SL_PUK = 15;
var gPinAttempts;
this.onLoad = function(flag) {
if (flag) {
LoadWebPage("html/internet/mep.html");
}
GetSimStatus();
$("#lt_Mep_btnProvidedPin").click(function() {
var pin = $("#txtPin").val();
if(! validate_pin(pin)) {
$("#lt_Mep_PinCodeError").show().text(jQuery.i18n.prop("linvalidPin"));
return;
}
var pinpukMap = new Map();
pinpukMap.put("RGW/sim/pin_puk/pin", pin);
PostXml("sim","provide_pin",pinpukMap);
var retXml = PostXml("sim", "get_sim_status");
if(parseInt(gPinAttempts)>parseInt($(retXml).find("pin_attempts").text())) {
gPinAttempts = $(retXml).find("pin_attempts").text();
$("#lt_Mep_PinCodeError").show().text(jQuery.i18n.prop("lt_Mep_PinCodeError"));
}
});
$("#txtPin").click(function(){
$("#lt_Mep_PinCodeError").hide();
});
$("#lt_Mep_btnPn").click(function() {
var configMap = new Map();
if($(this).val() ==jQuery.i18n.prop("lt_Mep_Lock")) {
configMap.put("RGW/sim/pin_puk/mep_action",LOCK_PN);
} else {
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PN);
}
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPnPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PasswordError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPU").click(function() {
var configMap = new Map();
if($(this).val() ==jQuery.i18n.prop("lt_Mep_Lock")) {
configMap.put("RGW/sim/pin_puk/mep_action",LOCK_PU);
} else {
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PU);
}
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPuPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PasswordError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPC").click(function() {
var configMap = new Map();
if($(this).val() ==jQuery.i18n.prop("lt_Mep_Lock")) {
configMap.put("RGW/sim/pin_puk/mep_action",LOCK_PC);
} else {
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PC);
}
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPcPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PasswordError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPs").click(function() {
var configMap = new Map();
if($(this).val() ==jQuery.i18n.prop("lt_Mep_Lock")) {
configMap.put("RGW/sim/pin_puk/mep_action",LOCK_SL);
} else {
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_SL);
}
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtMepPsPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PasswordError"));
}
GetSimStatus();
});
$("#lt_Mep_btnSim").click(function() {
var configMap = new Map();
if($(this).val() ==jQuery.i18n.prop("lt_Mep_Lock")) {
configMap.put("RGW/sim/pin_puk/mep_action",LOCK_PP);
} else {
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PP);
}
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtSimPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PasswordError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPnPuk").click(function() {
var configMap = new Map();
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PN_PUK);
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPnPukPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PukError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPuPuk").click(function() {
var configMap = new Map();
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PU_PUK);
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPuPukPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PukError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPcPuk").click(function() {
var configMap = new Map();
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PC_PUK);
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPcPukPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PukError"));
}
GetSimStatus();
});
$("#lt_Mep_btnPsPuk").click(function() {
var configMap = new Map();
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_SL_PUK);
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtPsPukPasswd").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PukError"));
}
GetSimStatus();
});
$("#lt_Mep_btnSimPuk").click(function() {
var configMap = new Map();
configMap.put("RGW/sim/pin_puk/mep_action",UNLOCK_PP_PUK);
configMap.put("RGW/sim/pin_puk/mep_pswd",$("#txtSimPuk").val());
var retXml = PostXml("sim","set_sim_mep",configMap);
if("OK" != $(retXml).find("response").text()) {
showMsgBox(jQuery.i18n.prop("lWarning"),jQuery.i18n.prop("lt_Mep_PukError"));
}
GetSimStatus();
});
}
function HideAllDiv() {
document.getElementById("divMepPnSettings").style.display = "none";
document.getElementById("divMepPnPuk").style.display = "none";
document.getElementById("divMepPuSettings").style.display = "none";
document.getElementById("divMepPuPuk").style.display = "none";
document.getElementById("divMepPuSettings").style.display = "none";
document.getElementById("divMepPsSettings").style.display = "none";
document.getElementById("divMepPsPuk").style.display = "none";
document.getElementById("divMepPcSettings").style.display = "none";
document.getElementById("divMepSimSettings").style.display = "none";
document.getElementById("divMepSimPuk").style.display = "none";
}
function GetSimStatus() {
HideAllDiv();
var retXml = PostXml("sim", "get_sim_status");
if ("OK" != $(retXml).find("response").text()) {
alert("Query sim status failed.");
return;
}
if(1 != $(retXml).find("sim_status").text()) {
alert("Sin Card don't exist.");
return;
}
gPinAttempts = $(retXml).find("pin_attempts").text();
$("#lt_Mep_PinRetry").text(jQuery.i18n.prop("lt_Mep_PinRetry") + " " + gPinAttempts);
$("#lt_Mep_PnLeftRetry").text(jQuery.i18n.prop("lt_Mep_PnLeftRetry") + " " + $(retXml).find("mep_nw_attempts").text());
$("#lt_Mep_PuRetryLeft").text(jQuery.i18n.prop("lt_Mep_PuRetryLeft") + " " + $(retXml).find("mep_subnw_attempts").text());
$("#lt_Mep_PsRetryLeft").text(jQuery.i18n.prop("lt_Mep_PsRetryLeft") + " " + $(retXml).find("mep_sp_attempts").text());
$("#lt_Mep_PcRetryLeft").text(jQuery.i18n.prop("lt_Mep_PcRetryLeft") + " " + $(retXml).find("mep_corp_attempts").text());
$("#lt_Mep_SimRetryLeft").text(jQuery.i18n.prop("lt_Mep_SimRetryLeft") + " " + $(retXml).find("mep_sim_attempts").text());
var pinStatus = $(retXml).find("pin_status").text();
var perso_substate = $(retXml).find("perso_substate").text();
if(2 == pinStatus) {
$("#divProvidedPin").show();
} else if(3 == pinStatus) {
ShowDlg("confirmDlg",350,150);
$("#lt_btnConfirmNo").hide();
$("#lt_confirmDlg_msg").text(jQuery.i18n.prop("lt_Mep_EnterPinPage"));
$("#lt_btnConfirmYes").click(function() {
displayForm("mPinPuk");
});
} else if (5 == pinStatus) { //READY
$("#divMepPnSettings").show();
$("#divMepPuSettings").show();
$("#divMepPsSettings").show();
$("#divMepPcSettings").show();
$("#divMepSimSettings").show();
var pnStatus = $(retXml).find("pn_status").text();
if (0 == pnStatus) { //unlock PN
$("#lt_Mep_btnPn").val(jQuery.i18n.prop("lt_Mep_Unlock"));
} else if (1 == pnStatus) {
$("#lt_Mep_btnPn").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else {
$("#lt_Mep_btnPn").attr("disabled", true);
$("#lt_Mep_btnPn").val(jQuery.i18n.prop("lt_Mep_InvalidLock"));
}
var puStatus = $(retXml).find("pu_status").text();
if (3 == puStatus) {
$("#lt_Mep_btnPU").val(jQuery.i18n.prop("lt_Mep_Unlock"));
} else if (4 == puStatus) {
$("#lt_Mep_btnPU").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else {
$("#lt_Mep_btnPU").attr("disabled", true);
$("#lt_Mep_btnPU").val(jQuery.i18n.prop("lt_Mep_InvalidLock"));
}
var psStatus = $(retXml).find("ps_status").text();
if (12 == psStatus) {
$("#lt_Mep_btnPs").val(jQuery.i18n.prop("lt_Mep_Unlock"));
} else if (13 == psStatus) {
$("#lt_Mep_btnPs").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else {
$("#lt_Mep_btnPs").attr("disabled", true);
$("#lt_Mep_btnPs").val(jQuery.i18n.prop("lt_Mep_InvalidLock"));
}
var pcStatus = $(retXml).find("pc_status").text();
if (9 == pcStatus) {
$("#lt_Mep_btnPC").val(jQuery.i18n.prop("lt_Mep_Unlock"));
} else if (10 == pcStatus) {
$("#lt_Mep_btnPC").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else {
$("#lt_Mep_btnPC").attr("disabled", true);
$("#lt_Mep_btnPC").val(jQuery.i18n.prop("lt_Mep_InvalidLock"));
}
var ppStatus = $(retXml).find("pp_status").text();
if (6 == ppStatus) {
$("#lt_Mep_btnSim").val(jQuery.i18n.prop("lt_Mep_Unlock"));
} else if (7 == ppStatus) {
$("#lt_Mep_btnSim").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else {
$("#lt_Mep_btnSim").attr("disabled", true);
$("#lt_Mep_btnSim").val(jQuery.i18n.prop("lt_Mep_InvalidLock"));
}
} else if(4 == pinStatus) { // MEP lock
if (3 == perso_substate) { //SIM_NETWORK_PIN = 3,
$("#divMepPnSettings").show();
$("#lt_Mep_btnPn").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else if (4 == perso_substate) {//SIM_NETWORK_SUBSET_PIN = 4
$("#divMepPuSettings").show();
$("#lt_Mep_btnPU").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else if (5 == perso_substate) { //SIM_CORPORATE_PIN = 5
$("#divMepPcSettings").show();
$("#lt_Mep_btnPC").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else if (6 == perso_substate) { //SIM_SERVICE_PROVIDE_PIN = 6
$("#divMepPsPuk").show();
$("#lt_Mep_btnPs").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else if (7 == perso_substate) { //SIM_SIM_PIN = 7,
$("#divMepSimSettings").show();
$("#lt_Mep_btnSim").val(jQuery.i18n.prop("lt_Mep_Lock"));
} else if (8 == perso_substate) { // SIM_NETWORK_PUK = 8
$("#divMepPnPuk").Show();
$("#lt_Mep_btnPnPuk").val(jQuery.i18n.prop("lt_Mep_btnPukUnlock"));
} else if (9 == perso_substate) { // SIM_NETWORK_SUBSET_PUK = 9,
$("#divMepPuPuk").Show();
$("#lt_Mep_btnPuPuk").val(jQuery.i18n.prop("lt_Mep_btnPukUnlock"));
} else if (10 == perso_substate) { //SIM_CORPORATE_PUK = 10,
$("#divMepPcPuk").Show();
$("#lt_Mep_btnPcPuk").val(jQuery.i18n.prop("lt_Mep_btnPukUnlock"));
} else if (11 == perso_substate) { //SIM_SERVICE_PROVIDE_PUK = 11,
$("#divMepPsPuk").Show();
$("#lt_Mep_btnPsPuk").val(jQuery.i18n.prop("lt_Mep_btnPukUnlock"));
} else if (10 == perso_substate) {//SIM_SIM_PUK =12,
$("#divMepSimPuk").Show();
$("#lt_Mep_btnSimPuk").val(jQuery.i18n.prop("lt_Mep_btnPukUnlock"));
}
}
}
return this;
}
})(jQuery);