Browse Source

Merge pull request #1 from remcovanvugt/cf-ng-add-check_cid

Added check_cid callflow module to branch on A-number
pull/4/head
Remco van Vugt 8 years ago
committed by GitHub
parent
commit
195ab054a3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 127 additions and 1 deletions
  1. +7
    -1
      src/apps/callflows/i18n/en-US.json
  2. +83
    -0
      src/apps/callflows/submodules/misc/misc.js
  3. +14
    -0
      src/apps/callflows/views/check_cid-callflowEdit.html
  4. +23
    -0
      src/apps/callflows/views/check_cid-childCallflow.html

+ 7
- 1
src/apps/callflows/i18n/en-US.json View File

@ -1286,7 +1286,13 @@
"current": "Current",
"original": "Original"
}
}
},
"check_cid": "Match caller number",
"check_cid_tip": "Branch in a callflow based on the A number",
"check_cid_match": "Match",
"check_cid_nomatch": "No match",
"check_cid_matchnomatch": "Match or no match?",
"regex": "Regex"
},
"__comment": "UI-1260: created common control for carrier selection",
"__version": "v3.20_s2",


+ 83
- 0
src/apps/callflows/submodules/misc/misc.js View File

@ -395,6 +395,89 @@ define(function(require){
}
}
},
'check_cid[]': {
name: self.i18n.active().oldCallflows.check_cid,
icon: 'lightbulb-o',
category: self.i18n.active().oldCallflows.caller_id_cat,
module: 'check_cid',
tip: self.i18n.active().oldCallflows.check_cid_tip,
data: {
},
rules: [
{
type: 'quantity',
maxSize: 2
}
],
isUsable: 'true',
weight: 60,
caption: function(node, caption_map) {
return '';
},
edit: function(node, callback) {
var popup, popup_html;
popup_html = $(monster.template(self, 'check_cid-callflowEdit', {
data_check_cid: {
'regex': node.getMetadata('regex') || ''
}
})),
popup;
$('#add', popup_html).click(function() {
var regex = $('#regex_input', popup_html).val();
node.setMetadata('regex', regex);
node.setMetadata('use_absolute_mode', false);
node.caption = regex;
popup.dialog('close');
});
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().oldCallflows.check_cid_title,
beforeClose: function() {
if(typeof callback == 'function') {
callback();
}
}
});
},
key_caption: function(child_node, caption_map) {
var key = child_node.key;
return (key != '_') ? key : self.i18n.active().oldCallflows.check_cid_match;
},
key_edit: function(child_node, callback) {
var popup, popup_html;
popup_html = $(monster.template(self, 'check_cid-childCallflow', {
items: {
'match': self.i18n.active().oldCallflows.check_cid_match,
'nomatch': self.i18n.active().oldCallflows.check_cid_nomatch
},
selected: child_node.key
}));
popup_html.find('#add').on('click', function() {
child_node.key = $('#check_cid_callflow_key_selector', popup_html).val();
child_node.key_caption = $('#check_cid_callflow_key_selector option:selected', popup_html).text();
popup.dialog('close');
});
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().oldCallflows.check_cid_matchnomatch,
minHeight: '0',
beforeClose: function() {
if (typeof callback === 'function') {
callback();
}
}
});
}
},
'manual_presence[]': {
name: self.i18n.active().oldCallflows.manual_presence,
icon: 'lightbulb-o',


+ 14
- 0
src/apps/callflows/views/check_cid-callflowEdit.html View File

@ -0,0 +1,14 @@
<div class="dialog_popup callflows-port">
<h1>{{ i18n.oldCallflows.check_cid }}</h1>
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field">
<label for="regex_input">{{ i18n.oldCallflows.regex }} </label>
<input type="text" id="regex_input" class="medium" value="{{data_check_cid.regex}}"/>
</div>
</div>
</form>
<div class="buttons-center">
<button id="add" class="monster-button monster-button-primary">{{i18n.save}}</button>
</div>
</div>

+ 23
- 0
src/apps/callflows/views/check_cid-childCallflow.html View File

@ -0,0 +1,23 @@
<div class="dialog_popup">
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field">
<label for="check_cid_callflow_key_selector">{{ i18n.oldCallflows.check_cid_matchnomatch }}</label>
<div class="select_wrapper">
<select id="check_cid_callflow_key_selector">
{{#compare selected "===" "match"}}
<option value="match" selected="selected">{{ i18n.oldCallflows.check_cid_match }}</option>
<option value="nomatch">{{ i18n.oldCallflows.check_cid_nomatch }}</option>
{{else}}
<option value="match">{{ i18n.oldCallflows.check_cid_match }}</option>
<option value="nomatch" selected="selected">{{ i18n.oldCallflows.check_cid_nomatch }}</option>
{{/compare}}
</select>
</div>
</div>
</div>
</form>
<div class="buttons-center">
<button id="add" class="monster-button monster-button-primary">{{i18n.save}}</button>
</div>
</div>

Loading…
Cancel
Save