2121Ext . define ( 'MBilling.view.sipTrace.Controller' , {
2222 extend : 'Ext.ux.app.ViewController' ,
2323 alias : 'controller.siptrace' ,
24- onNewFilter : function ( btn ) {
24+ onNewFilter : function ( btn ) {
2525 var me = this ,
2626 module = me . getView ( ) ;
2727 Ext . widget ( 'siptracefilter' , {
2828 title : 'SipTrace' ,
2929 list : me . list
3030 } ) ;
3131 } ,
32- onDeleteLog : function ( btn ) {
32+ onDeleteLog : function ( btn ) {
3333 var me = this ;
34- Ext . Msg . confirm ( me . titleConfirmation , t ( 'Confirm delete all log file?' ) , function ( btn ) {
34+ Ext . Msg . confirm ( me . titleConfirmation , t ( 'Confirm delete all log file?' ) , function ( btn ) {
3535 if ( btn === 'yes' ) {
3636 Ext . Ajax . request ( {
3737 url : 'index.php/sipTrace/destroy' ,
3838 scope : me ,
39- success : function ( response ) {
39+ success : function ( response ) {
4040 Ext . ux . Alert . alert ( me . titleSuccess , t ( 'Success: The SipTrace file was deleted' ) , 'success' ) ;
4141 me . store . load ( ) ;
4242 }
4343 } ) ;
4444 }
4545 } ) ;
4646 } ,
47- onClearAll : function ( btn ) {
47+ onClearAll : function ( btn ) {
4848 var me = this ;
4949 Ext . Ajax . request ( {
5050 url : 'index.php/sipTrace/clearAll' ,
5151 scope : me ,
52- success : function ( response ) {
52+ success : function ( response ) {
5353 Ext . ux . Alert . alert ( me . titleSuccess , t ( 'Success' ) , 'success' ) ;
5454 me . store . load ( ) ;
5555 }
5656 } ) ;
5757 } ,
58- onExportPcap : function ( btn ) {
58+ onExportPcap : function ( btn ) {
5959 var me = this ;
6060 window . open ( 'index.php/sipTrace/export' ) ;
6161 } ,
62- onDetails : function ( btn ) {
62+ onDetails : function ( btn ) {
6363 var me = this ,
6464 callids = [ ] ;
65- Ext . each ( me . list . getSelectionModel ( ) . getSelection ( ) , function ( record ) {
65+
66+ Ext . each ( me . list . getSelectionModel ( ) . getSelection ( ) , function ( record ) {
6667 callids . push ( record . get ( 'callid' ) ) ;
6768 } ) ;
68- window . open ( 'index.php/sipTrace/details?callid=' + Ext . encode ( callids ) ) ;
69+
70+ if ( callids . length === 0 ) {
71+ Ext . ux . Alert . alert ( me . titleSuccess , t ( 'No records selected.' ) , 'error' ) ;
72+ return ;
73+ }
74+
75+ if ( callids . length > 3 ) {
76+ Ext . ux . Alert . alert ( me . titleSuccess , t ( 'Select a maximum of 3 records to view.' ) , 'error' ) ;
77+ return ;
78+ }
79+
80+ Ext . create ( 'Ext.window.Window' , {
81+ title : t ( 'SIPTRACE Details' ) ,
82+ width : Ext . Element . getViewportWidth ( ) * 0.9 ,
83+ height : Ext . Element . getViewportHeight ( ) * 0.9 ,
84+ modal : true ,
85+ layout : 'fit' ,
86+ items : [ {
87+ xtype : 'component' ,
88+ autoEl : {
89+ tag : 'iframe' ,
90+ src : 'index.php/sipTrace/details?callid=' + encodeURIComponent ( Ext . encode ( callids ) ) ,
91+ style : 'border: none; width: 100%; height: 100%;'
92+ }
93+ } ]
94+ } ) . show ( ) ;
6995 }
96+
7097} ) ;
0 commit comments