From 41b1ce7cb0eac11f4b50e22afcbdb9e20a17ec8e Mon Sep 17 00:00:00 2001 From: Maxime Roux Date: Mon, 11 May 2015 16:34:32 -0700 Subject: [PATCH] UI-1395: Added voicemail[single_mailbox_login] to the default feature codes and updated the main number so that it checks and create feature codes individually --- i18n/en-US.json | 5 +- i18n/fr-FR.json | 5 +- submodules/featureCodes/featureCodes.css | 18 +- submodules/featureCodes/featureCodes.js | 2 +- submodules/strategy/strategy.js | 265 ++++++++++++----------- 5 files changed, 153 insertions(+), 142 deletions(-) diff --git a/i18n/en-US.json b/i18n/en-US.json index 9f16470..b199bb5 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -913,7 +913,10 @@ "call_waiting[action=enable]": "Enable Call-Waiting", "call_waiting[action=disable]": "Disable Call-Waiting", "sound_test_service": "Sound Test Service", - "call_recording": "Call Recording" + "call_recording": "Call Recording", + "__comment": "UI-1395: Added voicemail[single_mailbox_login] feature code", + "__version": "3.20", + "voicemail[single_mailbox_login]": "Check Voicemail (auto login)" }, "__comment": "UI-1028, v3.20_s0: Added categories for the feature codes.", "categories": { diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json index 423d67b..0809410 100644 --- a/i18n/fr-FR.json +++ b/i18n/fr-FR.json @@ -865,7 +865,10 @@ "call_waiting[action=enable]": "Activer le double-appel", "call_waiting[action=disable]": "Désactiver le double-appel", "sound_test_service": "Test Son", - "call_recording": "Enregistrement d'appel" + "call_recording": "Enregistrement d'appel", + "__comment": "UI-1395: Added voicemail[single_mailbox_login] feature code", + "__version": "3.20", + "voicemail[single_mailbox_login]": "Consulter la boite vocale (identification automatique)" }, "__comment": "UI-1028, v3.20_s0: Added categories for the feature codes.", "categories": { diff --git a/submodules/featureCodes/featureCodes.css b/submodules/featureCodes/featureCodes.css index 5f78bff..7dee325 100644 --- a/submodules/featureCodes/featureCodes.css +++ b/submodules/featureCodes/featureCodes.css @@ -18,25 +18,25 @@ } #feature_codes_container .feature-codes-content .feature-codes-category:not(:first-child) { - margin-top: 20px; + margin-top: 20px; } #feature_codes_container .feature-codes-content .category-header { - font-size: 18px; - margin-bottom: 10px; - font-weight: 600; + font-size: 18px; + margin: 10px; + font-weight: 600; } #feature_codes_container .feature-codes-content .feature-code-line:not(:first-child) { margin-top: 10px; } #feature_codes_container .feature-codes-content .feature-code-line { - border-top: solid 1px transparent; - border-bottom: solid 1px transparent; + border-top: solid 1px transparent; + border-bottom: solid 1px transparent; } #feature_codes_container .feature-codes-content .feature-code-line:hover { - border-bottom-color: #dcdcdc; - border-top-color: #dcdcdc; + border-bottom-color: #dcdcdc; + border-top-color: #dcdcdc; } #feature_codes_container .feature-codes-content .feature-code-line div { @@ -45,7 +45,7 @@ } #feature_codes_container .feature-codes-content .feature-code-label { - width: 160px; + width: 200px; text-align: right; margin-right: 20px; } diff --git a/submodules/featureCodes/featureCodes.js b/submodules/featureCodes/featureCodes.js index ca0bd47..2bbfbb6 100644 --- a/submodules/featureCodes/featureCodes.js +++ b/submodules/featureCodes/featureCodes.js @@ -113,7 +113,7 @@ define(function(require){ featureCodes[category].codes.push({ key: callflow.featurecode.name, - name: self.i18n.active().featureCodes.labels[callflow.featurecode.name], + name: self.i18n.active().featureCodes.labels[callflow.featurecode.name] || callflow.featurecode.name, number: callflow.featurecode.number ? callflow.featurecode.number.replace(/\\/g,'') : '' }); } diff --git a/submodules/strategy/strategy.js b/submodules/strategy/strategy.js index 1e9087f..74a0424 100644 --- a/submodules/strategy/strategy.js +++ b/submodules/strategy/strategy.js @@ -35,6 +35,117 @@ define(function(require){ "MainHolidays" ], + featureCodes: [ + { + name: 'call_forward[action=deactivate]', + number: '73', + callflowNumber: '*73', + moduleName: 'call_forward', + actionName: 'deactivate' + }, + { + name: 'call_forward[action=activate]', + number: '72', + callflowNumber: '*72', + moduleName: 'call_forward', + actionName: 'activate' + }, + { + name: 'call_forward[action=toggle]', + number: '74', + pattern: '^\\*74([0-9]*)$', + moduleName: 'call_forward', + actionName: 'toggle' + }, + { + name: 'call_forward[action=update]', + number: '56', + callflowNumber: '*56', + moduleName: 'call_forward', + actionName: 'update' + }, + { + name: 'hotdesk[action=login]', + number: '11', + callflowNumber: '*11', + moduleName: 'hotdesk', + actionName: 'login' + }, + { + name: 'hotdesk[action=logout]', + number: '12', + callflowNumber: '*12', + moduleName: 'hotdesk', + actionName: 'logout' + }, + { + name: 'hotdesk[action=toggle]', + number: '13', + callflowNumber: '*13', + moduleName: 'hotdesk', + actionName: 'toggle' + }, + { + name: 'voicemail[action=check]', + number: '97', + callflowNumber: '*97', + moduleName: 'voicemail', + actionName: 'check' + }, + { + name: 'voicemail[single_mailbox_login]', + number: '98', + callflowNumber: '*98', + moduleName: 'voicemail', + actionName: 'check', + extraData: { + single_mailbox_login: true + } + }, + { + name: 'voicemail[action="direct"]', + number: '*', + pattern: '^\\*\\*([0-9]*)$', + moduleName: 'voicemail', + actionName: 'compose' + }, + { + name: 'intercom', + number: '0', + pattern: '^\\*0([0-9]*)$', + moduleName: 'intercom', + actionName: 'compose' + }, + { + name: 'privacy[mode=full]', + number: '67', + pattern: '^\\*67([0-9]*)$', + moduleName: 'privacy', + actionName: 'full' + }, + { + name: 'park_and_retrieve', + number: '3', + pattern: '^\\*3([0-9]*)$', + moduleName: 'park', + actionName: 'auto' + }, + { + name: 'valet', + number: '4', + callflowNumber: '*4', + moduleName: 'park', + actionName: 'park' + }, + { + name: 'retrieve', + number: '5', + pattern: '^\\*5([0-9]*)$', + moduleName: 'park', + actionName: 'retrieve' + } + ], + strategyRender: function(args){ var self = this, args = args || {}, @@ -109,6 +220,8 @@ define(function(require){ } } ); + + self.strategyCreateFeatureCodes(); }, strategyBindEvents: function(template, strategyData) { @@ -1885,11 +1998,8 @@ define(function(require){ } }, success: function(data, status) { - /* If they don't have a main callflow, check if the feature codes are enabled, and create them if not */ - self.strategyCreateFeatureCodes(function() { - results["MainCallflow"] = data.data; - callback($.extend(true, mainCallflows, results)); - }); + results["MainCallflow"] = data.data; + callback($.extend(true, mainCallflows, results)); } }); } else { @@ -1919,120 +2029,17 @@ define(function(require){ /* To complete with all feature codes */ self.strategyGetFeatureCodes(function(listFeatureCodes) { - //Check if feature codes are created - if(listFeatureCodes.length > 0) { - callback && callback(); - } - else { - var listRequests = [], - featureCodes = [ - { - name: 'call_forward[action=deactivate]', - number: '73', - callflowNumber: '*73', - moduleName: 'call_forward', - actionName: 'deactivate' - }, - { - name: 'call_forward[action=activate]', - number: '72', - callflowNumber: '*72', - moduleName: 'call_forward', - actionName: 'activate' - }, - { - name: 'call_forward[action=toggle]', - number: '74', - pattern: '^\\*74([0-9]*)$', - moduleName: 'call_forward', - actionName: 'toggle' - }, - { - name: 'call_forward[action=update]', - number: '56', - callflowNumber: '*56', - moduleName: 'call_forward', - actionName: 'update' - }, - { - name: 'hotdesk[action=login]', - number: '11', - callflowNumber: '*11', - moduleName: 'hotdesk', - actionName: 'login' - }, - { - name: 'hotdesk[action=logout]', - number: '12', - callflowNumber: '*12', - moduleName: 'hotdesk', - actionName: 'logout' - }, - { - name: 'hotdesk[action=toggle]', - number: '13', - callflowNumber: '*13', - moduleName: 'hotdesk', - actionName: 'toggle' - }, - { - name: 'voicemail[action=check]', - number: '97', - callflowNumber: '*97', - moduleName: 'voicemail', - actionName: 'check' - }, - { - name: 'voicemail[action="direct"]', - number: '*', - pattern: '^\\*\\*([0-9]*)$', - moduleName: 'voicemail', - actionName: 'compose' - }, - { - name: 'intercom', - number: '0', - pattern: '^\\*0([0-9]*)$', - moduleName: 'intercom', - actionName: 'compose' - }, - { - name: 'privacy[mode=full]', - number: '67', - pattern: '^\\*67([0-9]*)$', - moduleName: 'privacy', - actionName: 'full' - }, - { - name: 'park_and_retrieve', - number: '3', - pattern: '^\\*3([0-9]*)$', - moduleName: 'park', - actionName: 'auto' - }, - { - name: 'valet', - number: '4', - callflowNumber: '*4', - moduleName: 'park', - actionName: 'park' - }, - { - name: 'retrieve', - number: '5', - pattern: '^\\*5([0-9]*)$', - moduleName: 'park', - actionName: 'retrieve' - } - ]; + var existingFeatureCodes = $.map(listFeatureCodes, function(val) { return val.featurecode.name }), + listRequests = []; - _.each(featureCodes, function(featureCode) { + _.each(self.featureCodes, function(featureCode) { + if(existingFeatureCodes.indexOf(featureCode.name) == -1) { var callflow = { flow: { children: {}, - data: { + data: $.extend(true, (featureCode.extraData || {}), { action: featureCode.actionName - }, + }), module: featureCode.moduleName }, featurecode: { @@ -2053,29 +2060,29 @@ define(function(require){ localCallback && localCallback(null, data); }); }); - }); + } + }); + if(listRequests.length > 0) { monster.parallel(listRequests, function(err, results) { callback && callback(); }); + } else { + callback && callback(); } }); }, strategyGetFeatureCodes: function(callback) { - var self = this; - - self.strategyGetCallflows(function(listCallflows) { - var listFeatureCodes = []; - - _.each(listCallflows, function(callflow) { - if('featurecode' in callflow && callflow.featurecode !== false) { - listFeatureCodes.push(callflow); - } - }); + var self = this, + filters = { + paginate: 'false', + has_key: 'featurecode' + }; + self.strategyGetCallflows(function(listFeatureCodes) { callback && callback(listFeatureCodes); - }); + }, filters); }, strategyGetTemporalRules: function(callback) { @@ -2405,16 +2412,14 @@ define(function(require){ mainCallflow.flow.data.rules = ruleArray; }, - strategyGetCallflows: function(callback) { + strategyGetCallflows: function(callback, filters) { var self = this; self.callApi({ resource: 'callflow.list', data: { accountId: self.accountId, - filters: { - paginate: 'false' - } + filters: filters || {} }, success: function(callflowData) { callback && callback(callflowData.data);