TT#10029 Ngcp-csc Call sidebar

Change-Id: Ib5bb129553c0433204449f6bf93e14e73069973d
changes/33/11433/18
Carlo 8 years ago
parent c6a07c124f
commit 844b0c4a2d

@ -122,11 +122,11 @@ Ext.define('Ngcp.csc.locales', {
},
conversations: {
title: {
en: 'Conversations.',
it: 'Conversations.',
de: 'Conversations.',
fr: 'Conversations.',
sp: 'Conversations.'
en: 'Conversations',
it: 'Conversations',
de: 'Conversations',
fr: 'Conversations',
sp: 'Conversations'
},
btns: {
new_sms: {
@ -1150,20 +1150,22 @@ Ext.define('Ngcp.csc.locales', {
sp: 'With your 4-digit PIN you may query your voicebox from any telephone.'
}
},
contacts:{
title:{
en: 'Contacts',
it: 'Contacts',
de: 'Contacts',
fr: 'Contacts',
sp: 'Conversation with'
}
},
chat: {
title: {
en: 'Conversations with',
it: 'Conversations with ',
de: 'Conversations with',
fr: 'Conversations with',
sp: 'Conversations with '
},
buddy_list: {
en: 'Buddy List.',
it: 'Buddy List.',
de: 'Buddy List.',
fr: 'Buddy List.',
sp: 'Buddy List.'
en: 'Conversation with',
it: 'Conversation with',
de: 'Conversation with',
fr: 'Conversation with',
sp: 'Conversation with'
},
new_group: {
en: 'Create new team',
@ -1431,13 +1433,27 @@ Ext.define('Ngcp.csc.locales', {
sp: 'every day'
}
},
webrtc: {
title: {
en: 'Webrtc',
it: 'Webrtc',
de: 'Webrtc',
fr: 'Webrtc',
sp: 'Webrtc'
rtc: {
call_in_progress: {
en: 'Please terminate current call before starting a new one.',
it: 'Please terminate current call before starting a new one.',
de: 'Please terminate current call before starting a new one.',
fr: 'Please terminate current call before starting a new one.',
sp: 'Please terminate current call before starting a new one.'
},
fax_sent: {
en: 'Fax sent.',
de: 'Fax sent.',
it: 'Fax sent.',
fr: 'Fax sent.',
sp: 'Fax sent.'
},
sms_sent: {
en: 'Sms sent.',
de: 'Sms sent.',
it: 'Sms sent.',
fr: 'Sms sent.',
sp: 'Sms sent.'
}
},
faxsend: {
@ -1852,6 +1868,13 @@ Ext.define('Ngcp.csc.locales', {
fr: 'Missing or invalid input found',
sp: 'Missing or invalid input found'
},
invalid_form: {
en: 'Invalid or missing fields.',
it: 'Invalid or missing fields.',
de: 'Invalid or missing fields.',
fr: 'Invalid or missing fields.',
sp: 'Invalid or missing fields.'
},
when: {
en: 'When',
it: 'When',

@ -5,6 +5,8 @@ Ext.define('NgcpCsc.store.Chat', {
model: 'NgcpCsc.model.ChatNotification',
autoLoad:true,
proxy: {
type: 'ajax',
url: '/resources/data/chat.json',

@ -1,13 +1,13 @@
Ext.define('NgcpCsc.store.ChatList', {
Ext.define('NgcpCsc.store.Contacts', {
extend: 'Ext.data.TreeStore',
alias: 'store.chatlist',
alias: 'store.contacts',
storeId: 'ChatList',
storeId: 'Contacts',
proxy: {
type: 'ajax',
url: 'resources/data/chatlist.json'
url: 'resources/data/contacts.json'
},
sorters: [{

@ -16,6 +16,14 @@ Ext.define('NgcpCsc.store.NavigationTree', {
routeId: 'inbox',
acl: ['administrator', 'restricted'], //TODO define real roles, which should be delivered along with user info after successfull login
leaf: true
}, {
text: 'Conversation with',
iconCls: 'x-fa fa-wechat',
viewType: 'chat',
routeId: 'conversation-with',
acl: ['administrator', 'restricted'],
visible: false,
leaf: true
}, {
text: 'Addressbook',
iconCls: 'x-fa fa-book',

@ -0,0 +1,51 @@
// Custom rules
$border-radius : 50%;
.rtc-panel{
.x-tool-expand-right:before{
content:'\f0d9' !important
}
}
.rtc-container {
text-align: center;
margin-top: 40px;
}
.rtc-avatar-container {
height: 300px;
}
.rtc-avatar {
border-radius: $border-radius ;
width: 100px !important;
margin: 0 auto !important;
display: block;
position: relative !important;
}
.rtc-icons {
border-radius: $border-radius ;
margin-right: 10px;
width: 35px;
}
.rtc-icons-big {
border-radius: $border-radius ;
.x-fa:before{
margin-left: -7px;
}
}
.rtc-btns-container {
text-align: center;
}
.rtc-chat-tbar {
.x-tab-bar {
display: none;
}
}
.rtc-digit {
.x-btn-inner-default-small{
font-size:16px;
}
}

@ -1,34 +0,0 @@
// Custom rules
.webrtc-container {
text-align: center;
margin-top: 40px;
}
.webrtc-avatar-container {
height: 300px;
}
.webrtc-avatar {
border-radius: 50%;
width: 100px !important;
margin: 0 auto !important;
display: block;
position: relative !important;
}
.webrtc-icons {
border-radius: 50%;
margin-right: 10px;
width: 35px;
}
.webrtc-btns-container {
text-align: center;
}
.webrtc-chat-tbar {
.x-tab-bar {
display: none;
}
}

@ -84,130 +84,6 @@
right: 0;
}
.chat-list {
.x-grid-row:hover {
.x-phone-display {
padding-left: 5px;
&:before {
font-family: FontAwesome;
content: "\f095";
}
}
.x-video-display {
margin-left: 10px;
&:before {
font-family: FontAwesome;
content: "\f03d";
}
}
.x-drop-display {
position: relative;
right: 15px;
&:before {
font-family: FontAwesome;
content: "\f1f8";
}
}
.x-add-user-display {
position: relative;
right: 20px;
&:before {
font-family: FontAwesome;
content: "\f234";
}
}
}
// @include box-shadow(0px,2px,8px,0px,rgba(0,0,0,.15));
@include box-shadow(0, 1px, 2px, 0, rgba(0,0,0,0.2));
&.x-menu-default {
border-width: 0;
}
.x-menu-header {
line-height: 20px;
background-color: $lightest-color;
padding: 22px 15px;
border-bottom: 1px solid #ccc !important;
.x-title-icon-wrap {
width: 40px;
padding-right: 28px;
text-align: left;
}
.x-title-text {
font-size: 16px;
}
}
.x-menu-item-icon-default {
padding-top: 10px;
padding-left: 12px;
font-size: 16px;
line-height: 24px;
}
.x-menu-item {
line-height: 50px;
.x-menu-item-text-default.x-menu-item-indent-no-separator {
margin-left: 56px;
}
&.online-user {
.x-menu-item-text-default.x-menu-item-indent-no-separator {
margin-left: 18px;
}
.x-menu-item-link:after {
color: $online-menu-item-color;
content: "\f111";
@extend .menu-item-common;
}
&.x-menu-item-active {
.x-menu-item-link:after {
color: white;
}
}
}
&.offline-user {
.x-menu-item-link:after {
color: $offline-menu-item-color;
content: "\f111";
@extend .menu-item-common;
}
.x-menu-item-text-default.x-menu-item-indent-no-separator {
margin-left: 20px;
}
}
.x-menu-item-link:after {
@extend .menu-item-common;
color: $default-menu-item-color;
content: "\f105";
}
}
.x-action-col-icon {
color: #919191;
font-size: 18px;
height: 16px;
width: 18px;
cursor: pointer;
}
}
.new-message-cont {
margin-right: 10px;
}

@ -0,0 +1,129 @@
.contacts {
.x-tool-expand-right:before{
content:'\f0d9' !important
}
.x-tool-collapse-left:before{
content:'\f0da' !important
}
.x-grid-row:hover {
.x-phone-display {
padding-left: 5px;
&:before {
font-family: FontAwesome;
content: "\f095";
}
}
.x-video-display {
margin-left: 10px;
&:before {
font-family: FontAwesome;
content: "\f03d";
}
}
.x-drop-display {
position: relative;
right: 15px;
&:before {
font-family: FontAwesome;
content: "\f1f8";
}
}
.x-add-user-display {
position: relative;
right: 20px;
&:before {
font-family: FontAwesome;
content: "\f234";
}
}
}
// @include box-shadow(0px,2px,8px,0px,rgba(0,0,0,.15));
@include box-shadow(0, 1px, 2px, 0, rgba(0,0,0,0.2));
&.x-menu-default {
border-width: 0;
}
.x-menu-header {
line-height: 20px;
background-color: $lightest-color;
padding: 22px 15px;
border-bottom: 1px solid #ccc !important;
.x-title-icon-wrap {
width: 40px;
padding-right: 28px;
text-align: left;
}
.x-title-text {
font-size: 16px;
}
}
.x-menu-item-icon-default {
padding-top: 10px;
padding-left: 12px;
font-size: 16px;
line-height: 24px;
}
.x-menu-item {
line-height: 50px;
.x-menu-item-text-default.x-menu-item-indent-no-separator {
margin-left: 56px;
}
&.online-user {
.x-menu-item-text-default.x-menu-item-indent-no-separator {
margin-left: 18px;
}
.x-menu-item-link:after {
color: $online-menu-item-color;
content: "\f111";
@extend .menu-item-common;
}
&.x-menu-item-active {
.x-menu-item-link:after {
color: white;
}
}
}
&.offline-user {
.x-menu-item-link:after {
color: $offline-menu-item-color;
content: "\f111";
@extend .menu-item-common;
}
.x-menu-item-text-default.x-menu-item-indent-no-separator {
margin-left: 20px;
}
}
.x-menu-item-link:after {
@extend .menu-item-common;
color: $default-menu-item-color;
content: "\f105";
}
}
.x-action-col-icon {
color: #919191;
font-size: 18px;
height: 16px;
width: 18px;
cursor: pointer;
}
}

@ -10,9 +10,7 @@ Ext.define('NgcpCsc.Application', {
views: [
'NgcpCsc.view.main.Main',
'NgcpCsc.view.login.Login',
'NgcpCsc.view.common.webrtc.WebrtcPanel'
'NgcpCsc.view.login.Login'
],
stores: [
@ -21,7 +19,7 @@ Ext.define('NgcpCsc.Application', {
'ConversationTypes',
'VoiceMails',
'Chat',
'ChatList',
'Contacts',
'Languages',
'CallBlockingOutgoing',
'CallBlockingIncoming',

@ -0,0 +1,265 @@
Ext.define('NgcpCsc.view.common.rtc.RtcController', {
extend: 'Ext.app.ViewController',
alias: 'controller.rtc',
listen: {
controller: {
'*': {
initrtc: 'showRtcPanel',
emulateCall: 'emulateCall',
endcall: 'endCall'
}
}
},
currentStream: null,
intervalId: '',
showRtcPanel: function(record, action, switchVideoOn) {
var panel = this.getView();
var vm = this.getViewModel();
vm.set('numberToCall', '');
switch (action) {
case 'startCall':
case 'startVideoCall':
var buddyUser = Ext.getStore('Chat').findRecord('uid', record.get('uid'));
var number = (buddyUser) ? buddyUser.get('number') : record.get('caller') || record.get('source_cli') || record.get('mobile');
var mainView = Ext.ComponentQuery.query('[name=mainView]')[0];
vm.set('title', Ext.String.format('Call with {0}', number));
vm.set('thumbnail', (buddyUser) ? buddyUser.get('thumbnail') : this.getViewModel().get('defaultThumbnail'));
vm.set('status', Ext.String.format('calling {0} ...', (buddyUser) ? buddyUser.get('name') : ''));
vm.set('callEnabled', false);
vm.set('micEnabled', false);
vm.set('phoneComposerHidden', true);
vm.set('faxComposerHidden', true);
vm.set('smsComposerHidden', true);
vm.set('callPanelHidden', false);
vm.set('videoEnabled', switchVideoOn || false);
mainView.getViewModel().set('sectionTitle', 'Conversation with ' + number);
this.redirectTo('conversation-with');
this.emulateCall(true, action == 'startVideoCall');
break;
case 'phoneComposer':
if(vm.get('connected')){
this.fireEvent('showmessage', false, Ngcp.csc.locales.rtc.call_in_progress[localStorage.getItem('languageSelected')]);
return;
}
vm.set('title', Ngcp.csc.locales.conversations.btns.new_call[localStorage.getItem('languageSelected')]);
vm.set('phoneComposerHidden', false);
vm.set('faxComposerHidden', true);
vm.set('smsComposerHidden', true);
vm.set('callPanelHidden', true);
break;
case 'faxComposer':
if (record) {
vm.set('numberToCall', record.get('source_cli'));
}
vm.set('title', Ngcp.csc.locales.conversations.btns.new_fax[localStorage.getItem('languageSelected')]);
vm.set('phoneComposerHidden', true);
vm.set('faxComposerHidden', false);
vm.set('smsComposerHidden', true);
vm.set('callPanelHidden', true);
break;
case 'smsComposer':
if (record) {
vm.set('numberToCall', record.get('source_cli'));
}
vm.set('title', Ngcp.csc.locales.conversations.btns.new_sms[localStorage.getItem('languageSelected')]);
vm.set('phoneComposerHidden', true);
vm.set('faxComposerHidden', true);
vm.set('smsComposerHidden', false);
vm.set('callPanelHidden', true);
break;
}
panel.show().expand();
},
toogleChat: function(btn) {
this.fireEvent('togglechat', btn.pressed);
},
toggleFullscreen: function() {
var video = document.querySelector("video");
var videoInProgress = false;
Ext.each(this.currentStream.getTracks(), function(mediaTrack) {
if (mediaTrack.readyState == 'live' && mediaTrack.kind == "video") {
videoInProgress = true;
return;
}
});
if (videoInProgress) {
if (Ext.isWebKit) {
video.webkitEnterFullScreen();
} else {
video.mozRequestFullScreen();
}
}
},
minimizeRtcPanel: function() {
this.getView().collapse();
},
onBeforeClose: function() {
var vm = this.getViewModel();
this.getView().hide();
vm.set('status', '');
clearInterval(this.intervalId);
this.endCall();
return false;
},
emulateCall: function(audioOn, videoOn) {
var me = this;
var vm = me.getViewModel();
var sample = document.getElementById("ring");
var ringDuration = 3000;
if (this.intervalId !== '') {
clearInterval(me.intervalId);
}
vm.set('status', 'calling...');
sample.play();
setTimeout(function() {
var seconds = minutes = hours = 0;
sample.pause();
sample.currentTime = 0;
vm.set('callEnabled', true);
vm.set('micEnabled', true);
me.startMedia(audioOn, videoOn);
me.intervalId = setInterval(function() {
seconds++;
if (seconds == 60) {
seconds = 0;
minutes++;
}
if (minutes == 60) {
minutes = 0;
hours++;
}
if (hours == 24) {
hours = 0;
}
var duration = ((hours < 10) ? '0' + hours : hours) + ':' +
((minutes < 10) ? '0' + minutes : minutes) + ':' +
((seconds < 10) ? '0' + seconds : seconds);
vm.set('status', 'connected ' + duration);
}, 1000);
}, ringDuration);
},
toggleAudioVideo: function() {
var me = this;
var vm = this.getViewModel();
var video = document.querySelector("video");
Ext.each(this.currentStream.getTracks(), function(mediaTrack) {
if (mediaTrack.readyState == 'live') {
video.pause();
video.src = "";
mediaTrack.stop();
}
});
if (vm.get('micEnabled') || vm.get('videoEnabled')) {
me.startMedia(vm.get('micEnabled'), vm.get('videoEnabled'));
}
},
toggleCall: function(btn) {
if (btn.pressed) { // this can be also checked against vm.get('callEnabled')
btn.removeCls('fa-rotate-180');
this.emulateCall(true, false);
} else {
btn.addCls('fa-rotate-180');
this.endCall();
}
},
endCall: function() {
var vm = this.getViewModel();
var videoObj = this.lookupReference('videoObj');
var video = document.querySelector("video");
var me = this;
this.lookupReference('avatar').show();
clearInterval(this.intervalId);
video.pause();
video.src = "";
videoObj.hide();
if(this.currentStream){
Ext.each(this.currentStream.getTracks(), function(mediaTrack) {
mediaTrack.stop();
});
}
vm.set('status', 'Call ended.');
vm.set('connected', false);
},
startMedia: function(audio, video) {
var me = this;
var vm = me.getViewModel();
//Wrap the getUserMedia function from the different browsers
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia;
//Our success callback where we get the media stream object and assign it to a video tag on the page
function onSuccess(mediaObj) {
me.currentStream = mediaObj;
me.lookupReference('avatar').setVisible(!vm.get('videoEnabled'));
me.lookupReference('videoObj').setVisible(vm.get('videoEnabled'));
vm.set('connected', true);
window.stream = mediaObj;
var video = document.querySelector("video");
video.src = window.URL.createObjectURL(mediaObj);
video.play();
}
//Our error callback where we will handle any issues
function onError(errorObj) {
console.log("There was an error: " + errorObj);
}
//We can select to request audio and video or just one of them
var mediaConstraints = {
video: video,
audio: audio
};
//Call our method to request the media object - this will trigger the browser to prompt a request.
navigator.getUserMedia(mediaConstraints, onSuccess, onError);
},
showPhoneComposer: function(btn) {
var vm = this.getViewModel();
vm.set('phoneKeyboardHidden', !btn.pressed);
},
digitNumber: function(btn) {
var vm = this.getViewModel();
var currentNum = vm.get('numberToCall');
vm.set('numberToCall', currentNum + btn.getText())
},
startNewCall: function() {
var vm = this.getViewModel();
var currentNum = vm.get('numberToCall');
var record = Ext.create('NgcpCsc.model.Conversation', {
caller: currentNum
});
this.showRtcPanel(record, 'startCall');
},
sendFax: function() {
var vm = this.getViewModel();
var mainView = Ext.ComponentQuery.query('[name=mainView]')[0];
var faxForm = this.getView().down('fax-composer');
if(faxForm.isValid()){
mainView.getViewModel().set('sectionTitle', 'Conversation with ' + vm.get('numberToCall'));
this.redirectTo('conversation-with');
faxForm.reset();
this.fireEvent('showmessage', true, Ngcp.csc.locales.rtc.fax_sent[localStorage.getItem('languageSelected')]);
}else{
this.fireEvent('showmessage', false, Ngcp.csc.locales.common.invalid_form[localStorage.getItem('languageSelected')]);
}
},
sendSms: function() {
var vm = this.getViewModel();
var mainView = Ext.ComponentQuery.query('[name=mainView]')[0];
mainView.getViewModel().set('sectionTitle', 'Conversation with ' + vm.get('numberToCall'));
this.redirectTo('conversation-with');
this.fireEvent('showmessage', true, Ngcp.csc.locales.rtc.sms_sent[localStorage.getItem('languageSelected')]);
}
});

@ -0,0 +1,44 @@
Ext.define('NgcpCsc.view.rtc.RtcModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.rtc',
data: {
title: 123456789,
defaultThumbnail: 'resources/images/icons/phoneicon.png',
thumbnail: 'resources/images/icons/phoneicon.png',
status: 'calling...',
callPanelHidden: false,
phoneComposerHidden: false,
faxComposerHidden: false,
smsComposerHidden: false,
phoneKeyboardHidden: true,
callEnabled: false,
connected: false,
micEnabled: false,
videoEnabled: false,
numberToCall: '',
// fax only fields
faxPageHeader: '',
faxContent: '',
faxSelectedQuality: '',
faxChosenFile: '',
// sms only fields
smsText: '',
// panel status
minimized: false
},
formulas: {
disableSubmit: function(get) {
var digitNumber = get('numberToCall');
if (digitNumber.length < 1) {
return true;
} else {
return !digitNumber.match(/^[0-9#*+]+$/);
};
},
disableSmsSubmit: function(get) {
return get('smsText').length > 140 || get('smsText').length < 1;
}
}
});

@ -0,0 +1,137 @@
Ext.define('NgcpCsc.view.common.rtc.RtcPanel', {
extend: 'Ext.panel.Panel',
xtype: 'rtc',
controller: 'rtc',
viewModel: 'rtc',
padding: '0 0 0 1',
width: '30%',
closable: true,
collapseDirection:'left',
cls:'rtc-panel',
bind: {
title: '{title}'
},
tools: [ {
glyph: 'xf065@FontAwesome',
callback: 'toggleFullscreen',
bind:{
hidden:'{!videoEnabled}'
}
},{
type: 'minimize',
callback: 'minimizeRtcPanel'
}],
layout: {
type: 'vbox',
align: 'stretch'
},
listeners: {
beforeclose: 'onBeforeClose'
},
items: [{
flex: 4,
reference: 'callpanel',
bind: {
hidden: '{callPanelHidden}'
},
layout: {
type: 'vbox',
align: 'stretch',
pack: 'center'
},
defaults: {
cls: 'rtc-container'
},
items: [
{
margin:20,
hidden:true,
width:'100%',
reference:'videoObj',
html:"<video width=100% id=videoTag height=240></video>"
},{
cls: 'rtc-avatar-container',
reference:'avatar',
items: {
xtype: 'image',
cls: 'rtc-avatar',
bind: {
src: '{thumbnail}'
}
}
}, {
xtype: 'label',
margin: '20 0 20 0',
bind: '{status}'
}, {
xtype: 'container',
cls: 'rtc-btns-container',
layout: {
type: 'hbox',
align: 'stretch',
pack: 'center'
},
defaults: {
xtype: 'button',
cls: 'rtc-icons',
enableToggle: true
},
items: [{
iconCls: 'x-fa fa-phone',
bind: {
pressed: '{callEnabled}'
},
handler:'toggleCall'
}, {
iconCls: 'x-fa fa-microphone',
bind: {
pressed: '{micEnabled}',
disabled: '{!connected}',
hidden: '{!micEnabled}'
},
handler:'toggleAudioVideo'
},{
iconCls: 'x-fa fa-microphone-slash',
bind: {
pressed: '{micEnabled}',
disabled: '{!connected}',
hidden: '{micEnabled}'
},
handler:'toggleAudioVideo'
}, {
iconCls: 'x-fa fa-video-camera',
bind: {
pressed: '{videoEnabled}',
disabled: '{!connected}'
},
handler:'toggleAudioVideo'
}, {
iconCls: 'x-fa fa-comment',
bind: {
pressed: '{chatEnabled}',
disabled: '{!connected}'
},
handler: 'toogleChat'
}]
}]
}, {
xtype: 'phone-composer'
}, {
xtype: 'sms-composer'
}, {
xtype: 'fax-composer'
}]
})

@ -0,0 +1,75 @@
Ext.define('NgcpCsc.view.common.composer.Fax', {
extend: 'Ext.form.Panel',
alias: 'widget.fax-composer',
bind: {
hidden: '{faxComposerHidden}'
},
defaults: {
width: '90%',
margin: 20
},
items: [{
layout: 'hbox',
items: [{
xtype: 'textfield',
emptyText: 'Allowed digits are 0-9, +, # and *.',
hideTrigger: true,
width: '80%',
bind: '{numberToCall}'
}, {
xtype: 'button',
enableToggle: true,
iconCls: 'x-fa fa-fax',
width: '20%',
handler: 'showPhoneComposer'
}]
}, {
xtype: 'phonekeys',
bind: {
hidden: '{phoneKeyboardHidden}'
}
}, {
xtype: 'combo',
store: ['Normal', 'Fine', 'Super'],
fieldLabel: 'Quality',
allowBlank: false,
editable: false,
bind: '{faxSelectedQuality}'
}, {
xtype: 'textfield',
allowBlank: false,
bind: '{faxSageHeader}',
fieldLabel: 'Page header'
}, {
xtype: 'textarea',
allowBlank: false,
bind: '{faxContent}',
fieldLabel: 'Content'
}, {
xtype: 'filefield',
bind: '{faxContenthosenFile}',
fieldLabel: 'File'
}, {
xtype: 'container',
layout: 'center',
margin: '40 20 20 20',
items: [{
xtype: 'button',
cls: 'rtc-icons-big',
bind: {
disabled: '{disableSubmit}'
},
width: 60,
height: 60,
margin: '50 0 10 0',
iconCls: 'x-fa fa-send fa-2x',
cls: 'rtc-icons-big',
listeners: {
click: 'sendFax'
}
}]
}]
})

@ -0,0 +1,56 @@
Ext.define('NgcpCsc.view.common.composer.Phone', {
extend: 'Ext.panel.Panel',
alias: 'widget.phone-composer',
bind: {
hidden: '{phoneComposerHidden}'
},
items: [{
layout: 'hbox',
margin: 20,
items: [{
xtype: 'textfield',
emptyText: 'Allowed digits are 0-9, +, # and *.',
hideTrigger: true,
width: '80%',
bind: '{numberToCall}'
}, {
xtype: 'button',
enableToggle: true,
iconCls: 'x-fa fa-fax',
width: '20%',
handler: 'showPhoneComposer'
}]
}, {
xtype: 'phonekeys',
bind: {
hidden: '{phoneKeyboardHidden}'
}
}, {
xtype: 'container',
layout: 'center',
margin: '40 20 20 20',
items: [{
xtype: 'button',
cls: 'rtc-icons-big',
bind: {
disabled: '{disableSubmit}'
},
width: 60,
height: 60,
margin: '50 0 10 0',
iconCls: 'x-fa fa-phone fa-3x',
cls: 'rtc-icons-big',
listeners: {
click: {
fn: 'startNewCall',
el: 'element'
}
}
}]
}, {
hidden: true,
html: '<audio id="ring" src="resources/audio/skype_ring.mp3" preload="auto"></audio>'
}]
})

@ -0,0 +1,66 @@
Ext.define('NgcpCsc.view.common.composer.PhoneKeys', {
extend: 'Ext.panel.Panel',
alias: 'widget.phonekeys',
hidden: true,
layout: {
type: 'vbox',
align: 'stretch'
},
height: 300,
margin: '30 10 10 20',
defaults: {
flex: 1,
layout: {
type: 'hbox',
align: 'stretch',
pack:'center'
},
defaults: {
xtype: 'button',
flex: 1,
margin: '0 10 10 0',
handler: 'digitNumber',
cls: 'rtc-digit',
maxWidth:90
}
},
items: [{
items: [{
text: '1'
}, {
text: '2'
}, {
text: '3'
}]
}, {
items: [{
text: '4'
}, {
text: '5'
}, {
text: '6'
}]
}, {
items: [{
text: '7'
}, {
text: '8'
}, {
text: '9'
}]
}, {
items: [{
text: '*'
}, {
text: '0'
}, {
text: '#'
}]
}]
})

@ -0,0 +1,62 @@
Ext.define('NgcpCsc.view.common.composer.Sms', {
extend: 'Ext.panel.Panel',
alias: 'widget.sms-composer',
bind: {
hidden: '{smsComposerHidden}'
},
defaults: {
width: '90%',
margin: 20
},
items: [{
layout: 'hbox',
items: [{
xtype: 'textfield',
emptyText: 'Allowed digits are 0-9, +, # and *.',
hideTrigger: true,
width: '80%',
bind: '{numberToCall}'
}, {
xtype: 'button',
enableToggle: true,
iconCls: 'x-fa fa-fax',
width: '20%',
handler: 'showPhoneComposer'
}]
}, {
xtype: 'phonekeys',
bind: {
hidden: '{phoneKeyboardHidden}'
}
}, {
xtype: 'textarea',
allowBlank: false,
bind: '{smsText}',
fieldLabel: 'Content',
emptyText: 'Max 140 digits.'
}, {
xtype: 'container',
layout: 'center',
margin: '40 20 20 20',
items: [{
xtype: 'button',
cls: 'rtc-icons-big',
bind: {
disabled: '{disableSmsSubmit}'
},
width: 60,
height: 60,
margin: '50 0 10 0',
iconCls: 'x-fa fa-send fa-2x',
cls: 'rtc-icons-big',
listeners: {
click: {
fn: 'sendSms',
el: 'element'
}
}
}]
}]
})

@ -1,74 +0,0 @@
Ext.define('NgcpCsc.view.common.webrtc.WebrtcController', {
extend: 'Ext.app.ViewController',
alias: 'controller.webrtc',
listen: {
controller: {
'*': {
initwebrtc: 'showWebrtcPanel',
startcall: 'startCall',
pausecall: 'pauseCall',
endcall: 'endCall',
startvideocall: 'startVideoCall',
pausevideocall: 'pauseVideoCall',
endvideocall: 'endVideoCall'
}
}
},
showWebrtcPanel: function(record, switchVideoOn, newCall) {
var panel = this.getView();
if(!newCall){
var vm = this.getViewModel();
var buddyUser = Ext.getStore('Chat').findRecord('uid', record.get('uid'));
var number = (buddyUser) ? buddyUser.get('number') : record.get('caller') || record.get('source_cli') || record.get('mobile');
this.getViewModel().set('title', Ext.String.format('{0}', number));
vm.set('thumbnail', (buddyUser) ? buddyUser.get('thumbnail') : this.getViewModel().get('defaultThumbnail'));
vm.set('status', Ext.String.format('calling {0} ...', (buddyUser) ? buddyUser.get('name') : ''));
vm.set('callEnabled', true);
vm.set('micEnabled', true);
vm.set('videoEnabled', switchVideoOn || false);
}
panel.show().expand();
},
toogleChat: function(btn) {
this.fireEvent('togglechat', btn.pressed);
},
onBeforeClose: function(){
this.getView().hide();
return false;
},
startCall: function() {
//TODO
},
pauseCall: function() {
//TODO
},
endCall: function() {
//TODO
},
startVideoCall: function() {
//TODO
},
pauseVideoCall: function() {
//TODO
},
endVideoCall: function() {
//TODO
},
onPressSubmitBtn: function() {
// TODO
},
onPressEnter: function() {
// TODO
}
});

@ -1,15 +0,0 @@
Ext.define('NgcpCsc.view.webrtc.WebrtcModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.webrtc',
data: {
title: 123456789,
defaultThumbnail: 'resources/images/icons/phoneicon.png',
thumbnail: 'resources/images/icons/phoneicon.png',
status: 'calling...',
callEnabled: false,
micEnabled: false,
videoEnabled: false
}
});

@ -1,108 +0,0 @@
Ext.define('NgcpCsc.view.common.webrtc.WebrtcPanel', {
extend: 'Ext.panel.Panel',
xtype: 'webrtc',
controller: 'webrtc',
viewModel: 'webrtc',
padding: '0 0 0 1',
width: '30%',
closable: true,
bind: {
title: '{title}'
},
layout: {
type: 'vbox',
align: 'stretch'
},
listeners:{
beforeclose: 'onBeforeClose'
},
initComponent: function() {
this.items = [{
flex: 4,
layout: {
type: 'vbox',
align: 'stretch',
pack: 'center'
},
defaults: {
cls: 'webrtc-container'
},
items: [{
cls: 'webrtc-avatar-container',
items: {
xtype: 'image',
cls: 'webrtc-avatar',
bind: {
src: '{thumbnail}'
}
}
}, {
xtype: 'label',
margin: '20 0 20 0',
bind: '{status}'
}, {
xtype: 'container',
cls: 'webrtc-btns-container',
layout: {
type: 'hbox',
align: 'stretch',
pack: 'center'
},
defaults: {
xtype: 'button',
cls: 'webrtc-icons',
enableToggle: true
},
items: [{
iconCls: 'x-fa fa-phone',
bind: {
pressed: '{callEnabled}'
}
}, {
iconCls: 'x-fa fa-microphone',
bind: {
pressed: '{micEnabled}'
}
}, {
iconCls: 'x-fa fa-video-camera',
bind: {
pressed: '{videoEnabled}'
}
}, {
iconCls: 'x-fa fa-wechat',
bind: {
pressed: '{chatEnabled}'
},
handler: 'toogleChat'
}]
}]
}, Ext.create('NgcpCsc.view.pages.chat.ChatContainer', {
flex: 3,
cls: 'webrtc-chat-tbar',
bind: {
hidden: '{!chatEnabled}'
},
items: [{
xtype: 'chat-notifications',
closable: false,
scrollable: true,
cls: 'private-conversation-text',
deferEmptyText: false,
store: Ext.create('Ext.data.Store', {
model: 'NgcpCsc.model.ChatNotification'
})
}]
})];
this.callParent();
}
})

@ -24,7 +24,9 @@ Ext.define('NgcpCsc.view.main.Main', {
resize: 'setItemsSize'
},
initComponent: function(){
name:'mainView',
initComponent: function() {
var vm = this.getViewModel();
this.items = [{
xtype: 'toolbar',
@ -122,40 +124,55 @@ Ext.define('NgcpCsc.view.main.Main', {
}
}, {
xtype: 'container',
height: 1, // (any) height is required by border layout
flex: 1, // combined with hbox stretch, it takes all the available space
id: 'mainContainer',
layout: 'border',
layout: {
type: 'hbox'
},
userCls: 'main-container',
defaults:{
scrollable: true,
height:'100%'
},
items: [{
region: 'north',
flex: 5,
scrollable:false,
id:'mainContainerInner',
items: [{
reference: 'sectionTitle',
bind:{
bind: {
title: '{sectionTitle}'
}
}, {
xtype: 'gridfilters'
}, {
reference: 'mainCardPanel',
cls: 'sencha-dash-right-main-container',
id: 'contentPanel',
layout: {
type: 'card'
},
listeners: {
resize: 'mainContainerResized'
},
defaults:{
scrollable:true,
height: screen.height - (Ext.os.is.Desktop ? 200 : 100) // - header + filters height
}
}]
}, {
region: 'center',
reference: 'mainCardPanel',
cls: 'sencha-dash-right-main-container',
itemId: 'contentPanel',
layout: {
type: 'card'
},
listeners: {
resize: 'mainContainerResized'
}
flex: 3,
resizable: Ext.os.is.Desktop,
xtype: 'rtc',
itemId: 'webrtcPanel',
hidden: true
}, {
width: 250,
resizable: Ext.os.is.Desktop,
xtype: 'contacts',
ui: 'core-container',
margin: '0 0 20 0'
}]
}, {
xtype: 'webrtc',
region: 'east',
itemId: 'webrtcPanel',
hidden: true,
collapsed: true,
collapsible: true
}]
}];
this.callParent();

@ -49,7 +49,6 @@ Ext.define('NgcpCsc.view.main.MainController', {
if (!existingItem) {
newView = Ext.create({
xtype: view,
scrollable: true,
cls: 'section-container',
routeId: hashTag, // for existingItem search later
hideMode: 'offsets'
@ -191,9 +190,6 @@ Ext.define('NgcpCsc.view.main.MainController', {
case 'inbox':
title = Ngcp.csc.locales.conversations.title[localStorage.getItem('languageSelected')];
break;
case 'chat':
title = Ngcp.csc.locales.chat.title[localStorage.getItem('languageSelected')];
break;
case 'addressbook':
title = Ngcp.csc.locales.addressbook.title[localStorage.getItem('languageSelected')];
break;

@ -106,7 +106,7 @@ Ext.define('NgcpCsc.view.pages.addressbook.AddressbookController', {
onCellClicked: function(view, td, cellindex, record, tr, rowindex, ev){
if(cellindex == 4){ // phone column, TODO update in case new columns are added, or repositioned
this.fireEvent('initwebrtc', record);
this.fireEvent('initrtc', 'startCall',record);
}
}

@ -3,7 +3,7 @@ Ext.define('NgcpCsc.view.pages.chat.Chat', {
xtype: 'chat',
layout: 'responsivecolumn',
layout: 'fit',
defaults: {
margin: 10
@ -11,16 +11,8 @@ Ext.define('NgcpCsc.view.pages.chat.Chat', {
initComponent: function() {
this.items = [{
xtype: 'chatlist',
ui: 'core-container',
userCls: 'big-30 small-100',
collapsible: true
}, {
height: Ext.getCmp('mainContainer').getHeight() - 50,
xtype: 'chatcontainer',
userCls: 'big-70 small-100'
xtype: 'chatcontainer'
}];
this.callParent();
}
});

@ -1,3 +1,12 @@
// CHAT
// . when call, sms or fax are sent/triggered add entry in chat
// . when chat is opened, display topbar (add fax, sms, call to chat data)
// . create multiple submit text btn (chat, sms, call)
// . change how contacts look like in mobile
// . chat should not be a tabpanel anymore
// . apply filters on conversationwith
// . clicking on user in chat opens conversationwith
// . rename the module from chat to conversationwith
Ext.define('NgcpCsc.view.pages.chat.ChatContainer', {
extend: 'Ext.tab.Panel',
xtype: 'chatcontainer',

@ -5,7 +5,7 @@ Ext.define('NgcpCsc.view.pages.chat.ChatController', {
listen: {
controller: {
'#chatlist': {
'#contacts': {
openpmtab: 'openPM',
openchanneltab: 'openChat',
destroytab: 'closeChat'
@ -83,13 +83,12 @@ Ext.define('NgcpCsc.view.pages.chat.ChatController', {
}
this.getView().setActiveTab(tab);
this.toggleTextArea(true);
this.redirectTo('conversation-with');
},
openChat: function(rec) {
var tab = this.getView().down('[name=' + rec.get('name') + ']');
var messages = Ext.create('NgcpCsc.store.Chat');
if (rec.get('name') == 'Buddies')
return;
messages.load({callback:function(records){
Ext.each(records, function(message){
if(!rec.findChild('uid',message.get('uid'))){
@ -113,12 +112,12 @@ Ext.define('NgcpCsc.view.pages.chat.ChatController', {
closeChat: function(tabToClose) {
var tabToClose = this.getView().down('[name=' + tabToClose + ']');
var chatList = this.getView().down('#chatlist');
var contacts = this.getView().down('#contacts');
if (tabToClose) {
tabToClose.destroy();
}
if(chatList){
chatList.getView().refresh()
if(contacts){
contacts.getView().refresh()
}
},

@ -1,11 +0,0 @@
Ext.define('NgcpCsc.view.pages.chat.ChatListModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.chatlist',
stores: {
buddyList: {
type: 'chatlist'
}
}
});

@ -1,22 +1,28 @@
Ext.define('NgcpCsc.view.pages.chat.ChatList', {
Ext.define('NgcpCsc.view.pages.contacts.Contacts', {
extend: 'Ext.tree.Panel',
alias: 'widget.chatlist',
alias: 'widget.contacts',
controller: 'chatlist',
controller: 'contacts',
itemId: 'chatlist',
title: Ngcp.csc.locales.chat.title[localStorage.getItem('languageSelected')],
itemId: 'contacts',
hideHeaders: true,
cls: 'chat-list',
cls: 'contacts',
store: 'ChatList',
store: 'Contacts',
rootVisible: false,
scrollable:true,
collapsible:true,
collapseDirection:'left',
title: Ngcp.csc.locales.contacts.title[localStorage.getItem('languageSelected')],
viewConfig: {
listeners: {
beforecellclick: 'preventTabOpen'
@ -28,22 +34,20 @@ Ext.define('NgcpCsc.view.pages.chat.ChatList', {
checkchange: 'onNodeChecked'
},
header: {
items: [{
xtype: 'button',
text: Ngcp.csc.locales.chat.new_group[localStorage.getItem('languageSelected')],
handler: 'showTabBar'
}]
},
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
hidden: true,
items: [{
xtype: 'button',
name: 'showNewChatBtn',
text: Ngcp.csc.locales.chat.new_group[localStorage.getItem('languageSelected')],
handler: 'showCreationFields',
align:'right'
},{
xtype: 'textfield',
name: 'newChatName',
width: '80%',
hidden: true,
emptyText: Ngcp.csc.locales.chat.provide_name[localStorage.getItem('languageSelected')],
minLength: 1,
enableKeyEvents: true,
@ -53,7 +57,7 @@ Ext.define('NgcpCsc.view.pages.chat.ChatList', {
}, {
xtype: 'button',
name: 'newChatBtn',
width: '20%',
hidden: true,
text: Ngcp.csc.locales.common.add[localStorage.getItem('languageSelected')],
handler: 'createNewChannel'
}]
@ -62,7 +66,6 @@ Ext.define('NgcpCsc.view.pages.chat.ChatList', {
name: 'commitChangesBtn',
text: Ngcp.csc.locales.common.done[localStorage.getItem('languageSelected')],
handler: 'save',
width: '20%',
hidden: true
}],

@ -1,9 +1,9 @@
Ext.define('NgcpCsc.view.pages.chat.ChatListController', {
Ext.define('NgcpCsc.view.pages.contacts.ContactsController', {
extend: 'Ext.app.ViewController',
alias: 'controller.chatlist',
alias: 'controller.contacts',
id: 'chatlist', // needed as reference in ChatController listeners
id: 'contacts', // needed as reference in ChatController listeners
renderStatus: function(val, meta, rec) {
if (rec.get('leaf')) {
@ -14,28 +14,34 @@ Ext.define('NgcpCsc.view.pages.chat.ChatListController', {
onNodeChecked: function(node, checked, ev) {
var selectedRec = node;
var chatListStore = this.getView().getStore('ChatList');
var destination = chatListStore.findRecord('id', selectedRec.get('addTo'));
var contactsStore = this.getView().getStore('Contacts');
var destination = contactsStore.findRecord('id', selectedRec.get('addTo'));
var nodeAdded = destination.appendChild(selectedRec.copy(null));
var nodeEl = Ext.get(this.getView().view.getNode(nodeAdded));
if(nodeEl){
nodeEl.scrollIntoView(this.getView().view.el, false, true);
}
selectedRec.set('checked', null);
destination.insertChild(0, selectedRec.copy(null));
chatListStore.each(function(rec) {
contactsStore.each(function(rec) {
if (rec.get('uid') === selectedRec.get('uid')) { // checks if user is already in group
rec.set('checked', null);
}
});
},
showTabBar: function() {
var chatList = this.getView();
var tbar = chatList.getDockedItems('toolbar[dock="top"]')[0];
tbar.show();
tbar.down('[name=newChatName]').focus();
showCreationFields: function(btn) {
var contacts = this.getView();
var tbar = contacts.getDockedItems('toolbar[dock="top"]')[0];
var newChatName = tbar.down('[name=newChatName]');
var newChatBtn = tbar.down('[name=newChatBtn]');
btn.hide();
newChatName.show();
newChatBtn.show();
newChatName.focus();
},
addUser: function(view, rowIndex, colIndex, item, ev, record) {
var chatList = this.getView();
var done = chatList.down('[name=commitChangesBtn]');
var store = chatList.getStore();
var contacts = this.getView();
var done = contacts.down('[name=commitChangesBtn]');
var store = contacts.getStore();
store.each(function(rec) {
if (rec.get('leaf') && rec.get('parentId') !== record.get('id') && !record.findChild("uid", rec.get('uid'))) {
@ -45,29 +51,33 @@ Ext.define('NgcpCsc.view.pages.chat.ChatListController', {
});
done.show();
},
onPressEnter: function(field, e){
onPressEnter: function(field, e) {
if (e.getKey() == e.ENTER) {
this.createNewChannel();
}
},
createNewChannel: function() {
var chatList = this.getView();
var tbar = chatList.getDockedItems('toolbar[dock="top"]')[0];
var contacts = this.getView();
var tbar = contacts.getDockedItems('toolbar[dock="top"]')[0];
var createGroupBtn = tbar.down('[name=showNewChatBtn]');
var newChatName = tbar.down('[name=newChatName]');
var newChatBtn = tbar.down('[name=newChatBtn]');
if (newChatName.getValue().length < 1) {
this.fireEvent('showmessage', false, Ngcp.csc.locales.chat.alerts.choose_valid_name[localStorage.getItem('languageSelected')]);
return;
}
var newNode = chatList.getRootNode().insertChild(chatList.getStore().getCount(), {
var newNode = contacts.getRootNode().insertChild(contacts.getStore().getCount(), {
"name": newChatName.getValue(),
"iconCls": "x-fa fa-wechat",
"expanded": true,
"children": []
});
chatList.getStore().sort('online', 'DESC');
contacts.getStore().sort('online', 'DESC');
this.fireEvent('showmessage', true, Ngcp.csc.locales.chat.alerts.channel_created[localStorage.getItem('languageSelected')]);
tbar.hide();
createGroupBtn.show();
newChatName.hide();
newChatBtn.hide();
newChatName.reset();
},
preventTabOpen: function(view, cell, cellIdx, record, row, rowIdx, eOpts) {
@ -83,21 +93,21 @@ Ext.define('NgcpCsc.view.pages.chat.ChatListController', {
},
startCall: function(grid, rowIndex, colIndex, item, e, record) {
if (record.get('online'))
this.fireEvent('initwebrtc', record);
this.fireEvent('initrtc', record, 'startCall');
},
startVideoCall: function(grid, rowIndex, colIndex, item, e, record) {
if (record.get('online'))
this.fireEvent('initwebrtc', record, true);
this.fireEvent('initrtc', record, 'startVideoCall', true);
},
nodeClicked: function(node, record, item, index, e) {
if (record.get('checked') != null)
if (record.get('checked') != null || record.get('name') == 'Buddies')
return;
this.redirectTo('conversation-with');
if (!record.get('leaf'))
this.fireEvent('openchanneltab', record);
else
this.fireEvent('openpmtab', null, record);
return false;
},
deleteNode: function(grid, rowIndex, colIndex, item, ev) {
var nodeToDelete = grid.getStore().getAt(rowIndex);
@ -119,16 +129,11 @@ Ext.define('NgcpCsc.view.pages.chat.ChatListController', {
save: function(btn) {
var store = this.getView().getStore();
var tbar = this.getView().getDockedItems('toolbar[dock="top"]')[0];
var newChatName = tbar.down('[name=newChatName]');
var newChatBtn = tbar.down('[name=newChatBtn]');
store.each(function(rec) {
rec.set('checked', null);
});
store.sort('online', 'DESC');
store.commitChanges();
tbar.hide();
newChatName.show();
newChatBtn.show();
btn.hide();
this.getView().getView().refresh();
this.fireEvent('showmessage', true, Ngcp.csc.locales.common.save_success[localStorage.getItem('languageSelected')]);

@ -0,0 +1,11 @@
Ext.define('NgcpCsc.view.pages.contacts.ContactsModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.contacts',
stores: {
buddyList: {
type: 'contacts'
}
}
});

@ -25,7 +25,6 @@ Ext.define('NgcpCsc.view.pages.conversations.Conversations', {
defaults: {
xtype: 'button',
flex: 1,
handler: 'openCallPanel',
iconAlign: 'top',
scale: 'medium',
ui: 'conversations-actions-btn'
@ -36,6 +35,7 @@ Ext.define('NgcpCsc.view.pages.conversations.Conversations', {
iconCls: 'x-fa fa-envelope fa',
overCls: 'conversations-btn-over',
margin: '0 20 0 0',
handler: 'composeSms',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_sms[localStorage.getItem('languageSelected')]
}, {
@ -44,12 +44,14 @@ Ext.define('NgcpCsc.view.pages.conversations.Conversations', {
iconCls: 'x-fa fa-phone fa',
overCls: 'conversations-btn-over',
margin: '0 20 0 0',
handler: 'composeCall',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_call[localStorage.getItem('languageSelected')]
}, {
text: Ngcp.csc.locales.conversations.btns.new_fax[localStorage.getItem('languageSelected')],
itemId: 'newfax',
iconCls: 'x-fa fa-file-text fa',
overCls: 'conversations-btn-over',
handler: 'composeFax',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_fax[localStorage.getItem('languageSelected')]
}]
}]

@ -11,9 +11,9 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
},
onIconHovered: function(event, el) {
if( !event.target.classList.contains('play') &&
if (!event.target.classList.contains('play') &&
!event.target.classList.contains('fa-play') &&
!event.target.classList.contains('fa-pause')){
!event.target.classList.contains('fa-pause')) {
// Register the new tip with an element's ID
Ext.tip.QuickTipManager.register({
target: el.id, // Target button's ID
@ -73,9 +73,9 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
var desc;
switch (record.get('direction')) {
case 'incoming':
switch(record.get('status')) {
switch (record.get('status')) {
case 'answered':
switch(record.get('conversation_type')) {
switch (record.get('conversation_type')) {
case 'call':
desc = Ngcp.csc.locales.conversations.received_call_from[localStorage.getItem('languageSelected')];
break;
@ -94,19 +94,19 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
}
break;
case 'missed':
switch(record.get('conversation_type')) {
switch (record.get('conversation_type')) {
case 'call':
desc = Ngcp.csc.locales.conversations.missed_call_from[localStorage.getItem('languageSelected')];
break;
// there shouldn't be other missed types
// there shouldn't be other missed types
}
break;
}
break;
case 'outgoing':
switch(record.get('status')) {
switch (record.get('status')) {
case 'answered':
switch(record.get('conversation_type')) {
switch (record.get('conversation_type')) {
case 'call':
desc = Ngcp.csc.locales.conversations.successful_call_to[localStorage.getItem('languageSelected')];
break;
@ -122,37 +122,37 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
}
break;
case 'missed':
switch(record.get('conversation_type')) {
switch (record.get('conversation_type')) {
case 'call':
desc = Ngcp.csc.locales.conversations.unsuccessful_call_to[localStorage.getItem('languageSelected')];
break;
case 'fax':
desc = Ngcp.csc.locales.conversations.unsuccessful_fax_to[localStorage.getItem('languageSelected')];
break;
// there shouldn't be other missed types
// there shouldn't be other missed types
}
break;
}
break;
case 'forwarded':
switch(record.get('status')) {
switch (record.get('status')) {
case 'answered':
switch(record.get('conversation_type')) {
switch (record.get('conversation_type')) {
case 'call':
desc = Ngcp.csc.locales.conversations.successful_call_forward_to[localStorage.getItem('languageSelected')];
break;
case 'sms':
desc = Ngcp.csc.locales.conversations.successful_sms_forward_to[localStorage.getItem('languageSelected')];
break;
// there shouldn't be other forwarded types
// there shouldn't be other forwarded types
}
break;
case 'missed':
switch(record.get('conversation_type')) {
switch (record.get('conversation_type')) {
case 'call':
desc = Ngcp.csc.locales.conversations.unsuccessful_call_forward_to[localStorage.getItem('languageSelected')];
break;
// there shouldn't be other missed types
// there shouldn't be other missed types
}
break;
}
@ -197,61 +197,59 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
startCall: function(el) {
var record = Ext.getStore('Conversations').findRecord('id', el.id.split('-')[1]);
this.fireEvent('initwebrtc', record, true);
this.fireEvent('initrtc', record, 'startCall');
},
sendSms: function(el) {
this.startCall(el);
var record = Ext.getStore('Conversations').findRecord('id', el.id.split('-')[1]);
this.fireEvent('initrtc', record, 'smsComposer');
},
sendFax: function(el) {
var record = Ext.getStore('Conversations').findRecord('id', el.id.split('-')[1]);
this.fireEvent('initrtc', record, 'faxComposer');
},
startChat: function(el) {
this.startCall(el);
this.fireEvent('initrtc', record, 'startCall');
},
sendFax: function(el) {
this.startCall(el);
composeSms: function() {
this.fireEvent('initrtc', null, 'smsComposer');
},
openCallPanel: function(cmp) {
this.fireEvent('initwebrtc', null, false, true);
composeCall: function() {
this.fireEvent('initrtc', null, 'phoneComposer');
},
composeFax: function() {
this.fireEvent('initrtc', null, 'faxComposer');
},
expandConversation: function(view, td, cellindex, record, tr) {
if(cellindex.target && cellindex.target.classList.contains('green-icon')){
if (cellindex.target && cellindex.target.classList.contains('green-icon')) {
return;
}
if (cellindex == 4) {
// TODO different actions for different conversation_type
switch (record.get('conversation_type')) {
case 'call':
case 'fax':
case 'sms':
case 'chat':
this.openCallPanel();
break;
};
var record = record.isModel ? record : view.getRecord(Ext.get(td).up(view.itemSelector));
var id = record.get('id');
var row = document.getElementById(id);
var footer = document.getElementById('card-footer-' + id);
var msgPreview = document.getElementById('msg-preview-' + id);
if (row.classList.contains('hidden')) {
record.set('expanded', true);
row.classList.remove('hidden');
footer.classList.add('hidden');
if (msgPreview) {
msgPreview.classList.add('hidden');
}
} else {
var record = record.isModel ? record : view.getRecord(Ext.get(td).up(view.itemSelector));
var id = record.get('id');
var row = document.getElementById(id);
var footer = document.getElementById('card-footer-' + id);
var msgPreview = document.getElementById('msg-preview-' + id);
if (row.classList.contains('hidden')) {
record.set('expanded', true);
row.classList.remove('hidden');
footer.classList.add('hidden');
if (msgPreview) {
msgPreview.classList.add('hidden');
}
} else {
record.set('expanded', false);
row.classList.add('hidden');
footer.classList.remove('hidden');
if (msgPreview) {
msgPreview.classList.remove('hidden');
}
};
}
record.set('expanded', false);
row.classList.add('hidden');
footer.classList.remove('hidden');
if (msgPreview) {
msgPreview.classList.remove('hidden');
}
};
view.grid.updateLayout();
},

Binary file not shown.
Loading…
Cancel
Save