blob: fc72157165f602b134d741a27a961482ce003af8 [file] [log] [blame]
define("voice_dial_time","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
var sc_startpSeconds = [];
function sf_produceArray(start, end, arryName) {
var item = {};
for(var i = start; i <= end; i++) {
item.name = i;
item.value = i;
arryName.push(new Option(item.name, item.value));
}
}
sf_produceArray(1, 10, sc_startpSeconds);
function DialTimeVM() {
var target = this;
var dialTimesInfo = service.getDialTimeInfo();
target.dialTimeSeconds = ko.observable(parseInt(dialTimesInfo.dialTimeSeconds));
target.scr_seconds = ko.observableArray(sc_startpSeconds);
target.dialTimeSet = function () {
showLoading();
var params = {};
params.dialTimeSeconds = target.dialTimeSeconds();
service.setDialTimeInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new DialTimeVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_call_duration","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
var sc_startpMinutes = [];
function sf_produceArray(start, end, arryName) {
var item = {};
for(var i = start; i <= end; i++) {
item.name = i;
item.value = i;
arryName.push(new Option(item.name, item.value));
}
}
sf_produceArray(1, 10, sc_startpMinutes);
function CallTimeVM() {
var target = this;
var callTimesInfo = service.getCallTimeInfo();
target.callingLimitSetting = ko.observable(callTimesInfo.callingLimitSetting);
target.calledLimitSetting = ko.observable(callTimesInfo.calledLimitSetting);
target.callingTimeMinutes = ko.observable(parseInt(callTimesInfo.callingTimeMinutes));
target.calledTimeMinutes = ko.observable(parseInt(callTimesInfo.calledTimeMinutes));
target.scr_minutes = ko.observableArray(sc_startpMinutes);
target.callTimeSet = function () {
showLoading();
var params = {};
params.callingLimitSetting = target.callingLimitSetting();
params.calledLimitSetting = target.calledLimitSetting();
params.callingTimeMinutes = target.callingTimeMinutes();
params.calledTimeMinutes = target.calledTimeMinutes();
service.setCallTimeInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallTimeVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_call_hold","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallHoldVM() {
var target = this;
var callHoldInfo = service.getCallHoldInfo();
target.callHoldSetting = ko.observable(callHoldInfo.callHoldSetting);
target.callHoldSet = function () {
showLoading();
var params = {};
params.callHoldSetting = target.callHoldSetting();
service.setCallHoldInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallHoldVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_hotline","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
var sc_startpSeconds = [];
var sc_startpTimes = [];
function sf_produceArray(start, end, arryName) {
var item = {};
for(var i = start; i <= end; i++) {
item.name = i;
item.value = i;
arryName.push(new Option(item.name, item.value));
}
}
sf_produceArray(4, 10, sc_startpSeconds);
sf_produceArray(1, 10, sc_startpTimes);
function HotlineVM() {
var target = this;
var hotlineInfo = service.getHotlineInfo();
target.hotlineSetting = ko.observable(hotlineInfo.hotlineSetting);
target.hotlineSeconds = ko.observable(parseInt(hotlineInfo.hotlineSeconds));
target.hotlineAttemptsNumber = ko.observable(parseInt(hotlineInfo.hotlineAttemptsNumber));
target.hotlineNumber = ko.observable(hotlineInfo.hotlineNumber);
target.scr_seconds = ko.observableArray(sc_startpSeconds);
target.scr_times = ko.observableArray(sc_startpTimes);
target.hotlineSet = function () {
showLoading();
var params = {};
params.hotlineSetting = target.hotlineSetting();
params.hotlineSeconds = target.hotlineSeconds();
params.hotlineAttemptsNumber = target.hotlineAttemptsNumber();
params.hotlineNumber = target.hotlineNumber();
service.setHotlineInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new HotlineVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_call_back", "underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
var sc_startpCallbackTimes = [];
var sc_startpCallbackAttemptTimes = [];
var sc_startpCallbackAnswerTimes = [];
var sc_startpCallbackShutdowmTimes = [];
function sf_produceArray(start, end, arryName) {
var item = {};
for(var i = start; i <= end; i++) {
item.name = i;
item.value = i;
arryName.push(new Option(item.name, item.value));
}
}
sf_produceArray(1, 10, sc_startpCallbackTimes);
sf_produceArray(1, 10, sc_startpCallbackAttemptTimes);
sf_produceArray(1, 10, sc_startpCallbackAnswerTimes);
sf_produceArray(1, 10, sc_startpCallbackShutdowmTimes);
function CallBackVM() {
var target = this;
var callBackInfo = service.getCallbackInfo();
target.callBackSetting = ko.observable(callBackInfo.callBackSetting);
target.callBackTime = ko.observable(parseInt(callBackInfo.callBackTime));
target.callBackAttemptNumber = ko.observable(parseInt(callBackInfo.callBackAttemptNumber));
target.callBackAnswerTime = ko.observable(parseInt(callBackInfo.callBackAnswerTime));
target.callBackShutdownTime = ko.observable(parseInt(callBackInfo.callBackShutdownTime));
target.scr_back_times = ko.observableArray(sc_startpCallbackTimes);
target.scr_acc_times = ko.observableArray(sc_startpCallbackAttemptTimes);
target.scr_answer_times = ko.observableArray(sc_startpCallbackAnswerTimes);
target.scr_shutdown_times = ko.observableArray(sc_startpCallbackShutdowmTimes);
target.callbackNumbers = ko.observableArray([]);
getCallbackNumbers();
target.callBackSet = function () {
showLoading();
var params = {};
params.callBackSetting = target.callBackSetting();
params.callBackTime = target.callBackTime();
params.callBackAttemptNumber = target.callBackAttemptNumber();
params.callBackAnswerTime = target.callBackAnswerTime();
params.callBackShutdownTime = target.callBackShutdownTime();
service.setCallbackInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
function getCallbackNumbers() {
service.getCallbackNumbersInfo({}, function (data) {
var numbers = data.callbackList || [];
numbers = numbers.map(function (number) {
return number.trim();
});
target.callbackNumbers(numbers);
console.log("Successfully loaded callback numbers:", numbers);
});
}
target.addNumber = function() {
var newNumber = $("#newPhoneNumber").val().trim();
if (newNumber) {
var numberExists = false;
for (var i = 0; i < target.callbackNumbers().length; i++) {
if (target.callbackNumbers()[i] === newNumber) {
numberExists = true;
break;
}
}
if (numberExists) {
showAlert("number_exists");
return;
}
if (target.callbackNumbers().length >= 100) {
showAlert("max_numbers_reached");
return;
}
showLoading();
var params = {};
params.addNumber = newNumber;
service.addCallbackNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallbackNumbers();
successOverlay();
}
});
}
};
target.removeNumber = function(index) {
showConfirm("remove_number", function () {
showLoading();
var params = {};
params.deleteIndex = index + 1;
service.deleteCallbackNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallbackNumbers();
successOverlay();
}
});
});
};
target.clearAllNumbers = function() {
showConfirm("clear_numbers", function () {
showLoading();
service.clearCallbackNumbers({}, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallbackNumbers();
successOverlay();
}
});
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallBackVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_hide_call","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallHideVM() {
var target = this;
var callHideInfo = service.getCallHideInfo();
target.callHideSetting = ko.observable(callHideInfo.callHideSetting);
target.callHideSet = function () {
showLoading();
var params = {};
params.callHideSetting = target.callHideSetting();
service.setCallHideInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallHideVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_whitelist","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallWhiteVM() {
var target = this;
var callWhiteInfo = service.getCallWhiteInfo();
target.callingWhiteSetting = ko.observable(callWhiteInfo.callingWhiteSetting);
target.calledWhiteSetting = ko.observable(callWhiteInfo.calledWhiteSetting);
target.callingWhiteNumbers = ko.observableArray([]);
target.calledWhiteNumbers = ko.observableArray([]);
getCallingWhiteNumbers();
getCalledWhiteNumbers();
target.callWhiteSet = function () {
showLoading();
var params = {};
params.callingWhiteSetting = target.callingWhiteSetting();
params.calledWhiteSetting = target.calledWhiteSetting();
service.setCallWhiteInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
function getCallingWhiteNumbers() {
service.getCallingWhiteNumbersInfo({}, function (data) {
var numbers = data.callingList || [];
numbers = numbers.map(function (number) {
return number.trim();
});
target.callingWhiteNumbers(numbers);
console.log("Successfully loaded calling white numbers:", numbers);
});
}
target.addCallingNumber = function() {
var newNumber = $("#newCallingNumber").val().trim();
if (newNumber) {
var numberExists = false;
for (var i = 0; i < target.callingWhiteNumbers().length; i++) {
if (target.callingWhiteNumbers()[i] === newNumber) {
numberExists = true;
break;
}
}
if (numberExists) {
showAlert("number_exists");
return;
}
if (target.callingWhiteNumbers().length >= 25) {
showAlert("max_numbers_reached");
return;
}
showLoading();
var params = {};
params.addNumber = newNumber;
service.addCallingWhiteNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallingWhiteNumbers();
successOverlay();
}
});
}
};
target.removeCallingNumber = function(index) {
showConfirm("remove_number", function () {
showLoading();
var params = {};
params.deleteIndex = index + 1;
service.deleteCallingWhiteNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallingWhiteNumbers();
successOverlay();
}
});
});
};
target.clearCallingNumbers = function() {
showConfirm("clear_numbers", function () {
showLoading();
service.clearCallingWhiteNumbers({}, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallingWhiteNumbers();
successOverlay();
}
});
});
};
function getCalledWhiteNumbers() {
service.getCalledWhiteNumbersInfo({}, function (data) {
var numbers = data.calledList || [];
numbers = numbers.map(function (number) {
return number.trim();
});
target.calledWhiteNumbers(numbers);
console.log("Successfully loaded called white numbers:", numbers);
});
}
target.addCalledNumber = function() {
var newNumber = $("#newCalledNumber").val().trim();
if (newNumber) {
var numberExists = false;
for (var i = 0; i < target.calledWhiteNumbers().length; i++) {
if (target.calledWhiteNumbers()[i] === newNumber) {
numberExists = true;
break;
}
}
if (numberExists) {
showAlert("number_exists");
return;
}
if (target.calledWhiteNumbers().length >= 25) {
showAlert("max_numbers_reached");
return;
}
showLoading();
var params = {};
params.addNumber = newNumber;
service.addCalledWhiteNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCalledWhiteNumbers();
successOverlay();
}
});
}
};
target.removeCalledNumber = function(index) {
showConfirm("remove_number", function () {
showLoading();
var params = {};
params.deleteIndex = index + 1;
service.deleteCalledWhiteNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCalledWhiteNumbers();
successOverlay();
}
});
});
};
target.clearCalledNumbers = function() {
showConfirm("clear_numbers", function () {
showLoading();
service.clearCalledWhiteNumbers({}, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCalledWhiteNumbers();
successOverlay();
}
});
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallWhiteVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_blacklist","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallBlackVM() {
var target = this;
var callBlackInfo = service.getCallBlackInfo();
target.callingBlackSetting = ko.observable(callBlackInfo.callingBlackSetting);
target.calledBlackSetting = ko.observable(callBlackInfo.calledBlackSetting);
target.callingBlackNumbers = ko.observableArray([]);
target.calledBlackNumbers = ko.observableArray([]);
getCallingBlackNumbers();
getCalledBlackNumbers();
target.callBlackSet = function () {
showLoading();
var params = {};
params.callingBlackSetting = target.callingBlackSetting();
params.calledBlackSetting = target.calledBlackSetting();
service.setCallBlackInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
function getCallingBlackNumbers() {
service.getCallingBlackNumbersInfo({}, function (data) {
var numbers = data.callingList || [];
numbers = numbers.map(function (number) {
return number.trim();
});
target.callingBlackNumbers(numbers);
console.log("Successfully loaded calling white numbers:", numbers);
});
}
target.addCallingNumber = function() {
var newNumber = $("#newCallingNumber").val().trim();
if (newNumber) {
var numberExists = false;
for (var i = 0; i < target.callingBlackNumbers().length; i++) {
if (target.callingBlackNumbers()[i] === newNumber) {
numberExists = true;
break;
}
}
if (numberExists) {
showAlert("number_exists");
return;
}
if (target.callingBlackNumbers().length >= 25) {
showAlert("max_numbers_reached");
return;
}
showLoading();
var params = {};
params.addNumber = newNumber;
service.addCallingBlackNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallingBlackNumbers();
successOverlay();
}
});
}
};
target.removeCallingNumber = function(index) {
showConfirm("remove_number", function () {
showLoading();
var params = {};
params.deleteIndex = index + 1;
service.deleteCallingBlackNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallingBlackNumbers();
successOverlay();
}
});
});
};
target.clearCallingNumbers = function() {
showConfirm("clear_numbers", function () {
showLoading();
service.clearCallingBlackNumbers({}, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCallingBlackNumbers();
successOverlay();
}
});
});
};
function getCalledBlackNumbers() {
service.getCalledBlackNumbersInfo({}, function (data) {
var numbers = data.calledList || [];
numbers = numbers.map(function (number) {
return number.trim();
});
target.calledBlackNumbers(numbers);
console.log("Successfully loaded called white numbers:", numbers);
});
}
target.addCalledNumber = function() {
var newNumber = $("#newCalledNumber").val().trim();
if (newNumber) {
var numberExists = false;
for (var i = 0; i < target.calledBlackNumbers().length; i++) {
if (target.calledBlackNumbers()[i] === newNumber) {
numberExists = true;
break;
}
}
if (numberExists) {
showAlert("number_exists");
return;
}
if (target.calledBlackNumbers().length >= 25) {
showAlert("max_numbers_reached");
return;
}
showLoading();
var params = {};
params.addNumber = newNumber;
service.addCalledBlackNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCalledBlackNumbers();
successOverlay();
}
});
}
};
target.removeCalledNumber = function(index) {
showConfirm("remove_number", function () {
showLoading();
var params = {};
params.deleteIndex = index + 1;
service.deleteCalledBlackNumbers(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCalledBlackNumbers();
successOverlay();
}
});
});
};
target.clearCalledNumbers = function() {
showConfirm("clear_numbers", function () {
showLoading();
service.clearCalledBlackNumbers({}, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
getCalledBlackNumbers();
successOverlay();
}
});
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallBlackVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_call_forwarding","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallForwardVM() {
var target = this;
var callForwardAllInfo = service.getCallForwardAllInfo();
var callNoAnswerInfo = service.getCallNoAnswerInfo();
var callNoReachInfo = service.getCallNoReachInfo();
var callBusyInfo = service.getCallBusyInfo();
target.forwardAllNumber = ko.observable(callForwardAllInfo.forwardAllNumber);
target.forwardNoAnswerNumber = ko.observable(callNoAnswerInfo.forwardNoAnswerNumber);
target.forwardNoReachNumber = ko.observable(callNoReachInfo.forwardNoReachNumber);
target.forwardBusyNumber = ko.observable(callBusyInfo.forwardBusyNumber);
target.forwardAllSet = function () {
showLoading();
var params = {};
params.forwardAllNumber = target.forwardAllNumber();
service.setCallForwardAllInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
target.forwardNoAnswerSet = function () {
showLoading();
var params = {};
params.forwardNoAnswerNumber = target.forwardNoAnswerNumber();
service.setCallNoAnswerInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
target.forwardNoReachSet = function () {
showLoading();
var params = {};
params.forwardNoReachNumber = target.forwardNoReachNumber();
service.setCallNoReachInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
target.forwardBusySet = function () {
showLoading();
var params = {};
params.forwardBusyNumber = target.forwardBusyNumber();
service.setCallBusyInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallForwardVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_call_lock","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallLockVM() {
var target = this;
var callingLockInfo = service.getCallingLockInfo();
var calledLockInfo = service.getCalledLockInfo();
target.localCallLockSetting = ko.observable(callingLockInfo.localCallLockSetting);
target.dddCallLockSetting = ko.observable(callingLockInfo.dddCallLockSetting);
target.ddiCallLockSetting = ko.observable(callingLockInfo.ddiCallLockSetting);
target.receiveCallLockSetting = ko.observable(calledLockInfo.receiveCallLockSetting);
target.callingLockSet = function () {
showLoading();
var params = {};
params.localCallLockSetting = target.localCallLockSetting();
params.dddCallLockSetting = target.dddCallLockSetting();
params.ddiCallLockSetting = target.ddiCallLockSetting();
service.setCallingLockInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
target.calledLockSet = function () {
showLoading();
var params = {};
params.receiveCallLockSetting = target.receiveCallLockSetting();
service.setCalledLockInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallLockVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});
define("voice_csp","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
function CallCspVM() {
var target = this;
var callCspInfo = service.getCallCspInfo();
target.cspSetting = ko.observable(callCspInfo.cspSetting);
target.cspNumber = ko.observable(callCspInfo.cspNumber);
target.cspSet = function () {
showLoading();
var params = {};
params.cspSetting = target.cspSetting();
params.cspNumber = target.cspNumber();
service.setCallCspInfo(params, function (result) {
if (result.result != "success") {
errorOverlay();
} else {
successOverlay();
}
});
};
}
function initialize() {
var container = $('#container');
ko.cleanNode(container[0]);
var imVm = new CallCspVM();
ko.applyBindings(imVm, container[0]);
}
return {
init: initialize
};
});