diff --git a/whapps/call_center/queue/queue.js b/whapps/call_center/queue/queue.js
index 4aa8da86..4142d126 100644
--- a/whapps/call_center/queue/queue.js
+++ b/whapps/call_center/queue/queue.js
@@ -1016,6 +1016,10 @@ winkstart.module('call_center', 'queue', {
});
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#queue_selector', popup).val());
if($('#route_var', popup_html).val().length > 0) {
diff --git a/whapps/call_center/queue/tmpl/queue_callflow.html b/whapps/call_center/queue/tmpl/queue_callflow.html
index d75d2808..8fc2dd91 100644
--- a/whapps/call_center/queue/tmpl/queue_callflow.html
+++ b/whapps/call_center/queue/tmpl/queue_callflow.html
@@ -24,7 +24,19 @@
${title}
diff --git a/whapps/voip/callflow/callflow.js b/whapps/voip/callflow/callflow.js
index 4511dc2f..50ae2309 100644
--- a/whapps/voip/callflow/callflow.js
+++ b/whapps/voip/callflow/callflow.js
@@ -2210,6 +2210,10 @@ winkstart.module('voip', 'callflow', {
route_var: node.getMetadata('var') || ''
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#object-selector', popup_html).val());
if($('#route_var', popup_html).val().length > 0) {
@@ -2282,21 +2286,82 @@ winkstart.module('voip', 'callflow', {
popup_html = THIS.templates.routing_variables_callflow.tmpl({
_t: function(param){
return window.translate['callflow'][param];
- },
- items: node.data.data,
- count: Object.keys(node.data.data).length,
- dataArrayIndex: function (k, v) {
- return Object.keys(this.data.items).indexOf(k);
}
});
+ var form = $("form .form_content", popup_html);
+ $.each(node.data.data, function(key, item) {
+ var div = $(''); // Base div for new input
+ div.append(' : ');
+
+ if (item.type == 'custom') {
+ div.append('');
+
+ var del_btn = $('');
+ del_btn.click(function(e) {
+ e.preventDefault();
+ $(this).parent().remove();
+ });
+ div.append(del_btn);
+ form.append(div);
+ } else {
+ winkstart.request(false, item.type + '.list', {
+ account_id: winkstart.apps['voip'].account_id,
+ api_url: winkstart.apps['voip'].api_url
+ },
+ function(data, status) {
+ if(item.type == 'user') {
+ var tmp = [];
+ $.each(data.data, function() {
+ this.name = this.first_name + ' ' + this.last_name;
+ tmp.push(this);
+ });
+ data.data = tmp;
+ }
+
+ if(item.type == 'callflow') {
+ var tmp = [];
+ $.each(data.data, function() {
+ if(!this.featurecode && this.id != THIS.flow.id) {
+ this.name = this.name ? this.name : ((this.numbers) ? this.numbers.toString() : _t('callflow', 'no_numbers'));
+ tmp.push(this);
+ }
+ });
+ data.data = tmp;
+ }
+
+ var select = $('');
+ $.each(winkstart.sort(data.data), function() {
+ select.append('');
+ });
+ select.val(item.value);
+ div.append(select);
+
+ var del_btn = $('');
+ del_btn.click(function(e) {
+ e.preventDefault();
+ $(this).parent().remove();
+ });
+ div.append(del_btn);
+ form.append(div);
+ });
+ }
+ });
+
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#ok', popup_html).click(function() {
var formVars = $("form", popup_html).serializeArray();
var dataVars = {};
for(var i=0; i 0 && formVars[i+1].value.length > 0)
- dataVars[formVars[i].value] = formVars[i+1].value;
+ dataVars[formVars[i].value] = {
+ type: formVars[i+1].name,
+ value: formVars[i+1].value
+ };
}
node.data.data = dataVars;
@@ -2313,6 +2378,7 @@ winkstart.module('voip', 'callflow', {
types: {
"user": "User",
"vmbox": "Voicemail",
+ "device": "Device",
"media": "Media",
"menu": "Menu",
"queue": "Queue",
@@ -2323,155 +2389,62 @@ winkstart.module('voip', 'callflow', {
$("#ok", type_popup_html).click(function() {
var form = $("form .form_content", popup_html);
- var div = $(''); // Base div for new input
+ var div = $(''); // Base div for new input
var selected = $('#type_selector option:selected', type_popup_html).val();
- div.append(' : ');
- switch(selected) {
- default:
- case 'custom':
- div.append(' ');
-
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
- break;
- case 'user':
- winkstart.request(true, 'user.list', {
- account_id: winkstart.apps['voip'].account_id,
- api_url: winkstart.apps['voip'].api_url
- },
- function(data, status) {
- var select = $(' ');
- $.each(data.data, function() {
- select.append('');
- });
- div.append(select);
-
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
- });
- break;
- case 'vmbox':
- winkstart.request(true, 'vmbox.list', {
- account_id: winkstart.apps['voip'].account_id,
- api_url: winkstart.apps['voip'].api_url
- },
- function(data, status) {
- var select = $(' ');
- $.each(data.data, function() {
- select.append('');
- });
- div.append(select);
-
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
- });
- break;
- case 'media':
- winkstart.request(true, 'media.list', {
- account_id: winkstart.apps['voip'].account_id,
- api_url: winkstart.apps['voip'].api_url
- },
- function(data, status) {
- var select = $(' ');
- $.each(data.data, function() {
- select.append('');
- });
- div.append(select);
-
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
- });
- break;
- case 'menu':
- winkstart.request(true, 'menu.list', {
- account_id: winkstart.apps['voip'].account_id,
- api_url: winkstart.apps['voip'].api_url
- },
- function(data, status) {
- var select = $(' ');
+ div.append(' : ');
+ if (selected == 'custom') {
+ div.append('');
+
+ var del_btn = $('');
+ del_btn.click(function(e) {
+ e.preventDefault();
+ $(this).parent().remove();
+ });
+ div.append(del_btn);
+ form.append(div);
+ } else {
+ winkstart.request(true, selected + '.list', {
+ account_id: winkstart.apps['voip'].account_id,
+ api_url: winkstart.apps['voip'].api_url
+ },
+ function(data, status) {
+ if(selected == 'user') {
+ var tmp = [];
$.each(data.data, function() {
- select.append('');
+ this.name = this.first_name + ' ' + this.last_name;
+ tmp.push(this);
});
- div.append(select);
+ data.data = tmp;
+ }
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
- });
- break;
- case 'queue':
- winkstart.request(true, 'queue.list', {
- account_id: winkstart.apps['voip'].account_id,
- api_url: winkstart.apps['voip'].api_url
- },
- function(data, status) {
- var select = $(' ');
+ if(selected == 'callflow') {
+ var tmp = [];
$.each(data.data, function() {
- select.append('');
+ if(!this.featurecode && this.id != THIS.flow.id) {
+ this.name = this.name ? this.name : ((this.numbers) ? this.numbers.toString() : _t('callflow', 'no_numbers'));
+ tmp.push(this);
+ }
});
- div.append(select);
+ data.data = tmp;
+ }
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
+ var select = $('');
+ $.each(winkstart.sort(data.data), function() {
+ select.append('');
});
- break;
- case 'callflow':
- winkstart.request(true, 'callflow.list', {
- account_id: winkstart.apps['voip'].account_id,
- api_url: winkstart.apps['voip'].api_url
- },
- function(data, status) {
- var select = $(' ');
- $.each(data.data, function() {
- if(this.numbers instanceof Array) {
- select.append('');
- }
- });
- div.append(select);
+ div.append(select);
- var del_btn = $('');
- del_btn.click(function(e) {
- e.preventDefault();
- $(this).parent().remove();
- });
- div.append(del_btn);
- form.append(div);
+ var del_btn = $('');
+ del_btn.click(function(e) {
+ e.preventDefault();
+ $(this).parent().remove();
});
- break;
+ div.append(del_btn);
+ form.append(div);
+ });
}
-
-
type_popup.dialog('close');
});
@@ -2486,13 +2459,6 @@ winkstart.module('voip', 'callflow', {
});
});
- for(var i=0; i${_t('connect_caller_to_another_callflow')}
diff --git a/whapps/voip/media/media.js b/whapps/voip/media/media.js
index 5feca992..8621e5b4 100644
--- a/whapps/voip/media/media.js
+++ b/whapps/voip/media/media.js
@@ -565,6 +565,10 @@ winkstart.module('voip', 'media', {
});
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#media_selector', popup_html).val());
if($('#route_var', popup_html).val().length > 0) {
diff --git a/whapps/voip/media/tmpl/media_callflow.html b/whapps/voip/media/tmpl/media_callflow.html
index 3406530e..369657c4 100644
--- a/whapps/voip/media/tmpl/media_callflow.html
+++ b/whapps/voip/media/tmpl/media_callflow.html
@@ -24,7 +24,19 @@
${_t('connect_caller_to_media')}
diff --git a/whapps/voip/menu/menu.js b/whapps/voip/menu/menu.js
index 947a8bcf..c24ff2e7 100644
--- a/whapps/voip/menu/menu.js
+++ b/whapps/voip/menu/menu.js
@@ -596,7 +596,8 @@ winkstart.module('voip', 'menu', {
return window.translate['menu'][param];
},
items: winkstart.sort(data.data),
- selected: node.getMetadata('id') || ''
+ selected: node.getMetadata('id') || '',
+ route_var: node.getMetadata('var') || ''
});
if($('#menu_selector option:selected', popup_html).val() == undefined) {
@@ -611,6 +612,11 @@ winkstart.module('voip', 'menu', {
winkstart.publish('menu.popup_edit', _data, function(_data) {
node.setMetadata('id', _data.data.id || 'null');
+ if($('#route_var', popup_html).val().length > 0) {
+ node.setMetadata('var', $('#route_var', popup_html).val());
+ } else {
+ node.deleteMetadata('var');
+ }
node.caption = _data.data.name || '';
@@ -618,8 +624,17 @@ winkstart.module('voip', 'menu', {
});
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#menu_selector', popup).val());
+ if($('#route_var', popup_html).val().length > 0) {
+ node.setMetadata('var', $('#route_var', popup_html).val());
+ } else {
+ node.deleteMetadata('var');
+ }
node.caption = $('#menu_selector option:selected', popup).text();
diff --git a/whapps/voip/menu/tmpl/menu_callflow.html b/whapps/voip/menu/tmpl/menu_callflow.html
index de27a62f..c395e43d 100644
--- a/whapps/voip/menu/tmpl/menu_callflow.html
+++ b/whapps/voip/menu/tmpl/menu_callflow.html
@@ -21,8 +21,25 @@
${_t('connect_caller_to_menu')}
+
+
+
diff --git a/whapps/voip/queue/queue.js b/whapps/voip/queue/queue.js
index be1e98aa..79f7fe22 100644
--- a/whapps/voip/queue/queue.js
+++ b/whapps/voip/queue/queue.js
@@ -624,6 +624,10 @@ winkstart.module('voip', 'queue', {
});
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#queue_selector', popup).val());
if($('#route_var', popup_html).val().length > 0) {
diff --git a/whapps/voip/queue/tmpl/queue_callflow.html b/whapps/voip/queue/tmpl/queue_callflow.html
index e9244053..055d9936 100644
--- a/whapps/voip/queue/tmpl/queue_callflow.html
+++ b/whapps/voip/queue/tmpl/queue_callflow.html
@@ -24,7 +24,19 @@
${_t('connect_caller_to_queue')}
diff --git a/whapps/voip/user/tmpl/user_callflow.html b/whapps/voip/user/tmpl/user_callflow.html
index da863680..054f15a2 100644
--- a/whapps/voip/user/tmpl/user_callflow.html
+++ b/whapps/voip/user/tmpl/user_callflow.html
@@ -37,7 +37,19 @@
${_t('connect_caller_to_user')}
diff --git a/whapps/voip/user/user.js b/whapps/voip/user/user.js
index 3571572b..f541c8d9 100644
--- a/whapps/voip/user/user.js
+++ b/whapps/voip/user/user.js
@@ -1058,6 +1058,10 @@ winkstart.module('voip', 'user', {
});
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#user_selector', popup_html).val());
node.setMetadata('timeout', $('#parameter_input', popup_html).val());
diff --git a/whapps/voip/vmbox/tmpl/vmbox_callflow.html b/whapps/voip/vmbox/tmpl/vmbox_callflow.html
index a94104d9..173f1d24 100644
--- a/whapps/voip/vmbox/tmpl/vmbox_callflow.html
+++ b/whapps/voip/vmbox/tmpl/vmbox_callflow.html
@@ -25,7 +25,19 @@
${_t('connect_caller_to_voicemail')}
diff --git a/whapps/voip/vmbox/vmbox.js b/whapps/voip/vmbox/vmbox.js
index b3d2ca90..669e3b5d 100644
--- a/whapps/voip/vmbox/vmbox.js
+++ b/whapps/voip/vmbox/vmbox.js
@@ -624,6 +624,10 @@ winkstart.module('voip', 'vmbox', {
});
});
+ $('#toggle_advanced', popup_html).click(function () {
+ $('#route_var_div', popup_html).toggle();
+ });
+
$('#add', popup_html).click(function() {
node.setMetadata('id', $('#vmbox_selector', popup_html).val());
if($('#route_var', popup_html).val().length > 0) {