pari: branch pari/dahdi_support r4334 - /team/pari/dahdi_support/config/js/
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Wed Dec 10 15:42:40 CST 2008
Author: pari
Date: Wed Dec 10 15:42:39 2008
New Revision: 4334
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4334
Log:
more progress towards dahdi support
Modified:
team/pari/dahdi_support/config/js/ringgroups.js
Modified: team/pari/dahdi_support/config/js/ringgroups.js
URL: http://svn.digium.com/view/asterisk-gui/team/pari/dahdi_support/config/js/ringgroups.js?view=diff&rev=4334&r1=4333&r2=4334
==============================================================================
--- team/pari/dahdi_support/config/js/ringgroups.js (original)
+++ team/pari/dahdi_support/config/js/ringgroups.js Wed Dec 10 15:42:39 2008
@@ -129,9 +129,28 @@
};
-var GetDevice_UserName( device ){ // device = SIP/6002 or Zap/1, or DAHDI/1 or IAX2/6001
-
-
+var GetDevice_UserName( device ){
+ // device = SIP/6002 or Zap/1, or DAHDI/1 or IAX2/6001
+ var tmp_ext = device.afterChar('/');
+ var tmp_techn = device.beforeChar('/');
+
+ if( tmp_techn.toLowerCase() == 'zap' || tmp_techn.toLowerCase() == 'dahdi' ){
+ for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
+ if( parent.sessionData.pbxinfo.users[q].hasOwnProperty('zapchan') && parent.sessionData.pbxinfo.users[q]['zapchan'] == tmp_ext ){
+ return q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname');
+ }
+ if( parent.sessionData.pbxinfo.users[q].hasOwnProperty('dahdichan') && parent.sessionData.pbxinfo.users[q]['dahdichan'] == tmp_ext ){
+ return q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname');
+ }
+ }}
+ return 'AnalogPort ' + tmp_ext ;
+ }else{
+ if( parent.sessionData.pbxinfo.users.hasOwnProperty(tmp_ext) ){
+ var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].getProperty('fullname');
+ return tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name
+ }
+ return tmp_ext + '(' + tmp_techn + ')' ;
+ }
};
@@ -143,33 +162,11 @@
//DOM_select_strategy.selectedIndex = -1 ;
ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
- listOfDialDevices.each(function(device){
- var tmp_ext = device.afterChar('/');
- var tmp_techn = device.beforeChar('/');
-
- if( tmp_techn.toLowerCase() == 'zap' ){
-
- var this_analogStation_user = '';
- for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
- if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
- this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
- ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device);
- return;
- }
- }}
-
- }else{
-
- if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
- var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
- }else{
- return;
- }
- ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
- }
- });
+ listOfDialDevices.each(function(device){
+ ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
+ });
+
DOM_text_rgExten.value = '' ;
-
ASTGUI.selectbox.populateArray( DOM_rg_fb_select , parent.miscFunctions.getAllDestinations() );
ASTGUI.resetTheseFields([ DOM_rg_fb_select , DOM_select_strategy , DOM_text_ringTime ]);
@@ -188,44 +185,14 @@
ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
var mbrs = ASTGUI.cloneObject(c['members']);
mbrs.each(function(device){
- var tmp_ext = device.afterChar('/');
- var tmp_techn = device.beforeChar('/');
-
- if( tmp_techn.toLowerCase() == 'zap' ){
- var this_analogStation_user = '';
- for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
- if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
- this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
- ASTGUI.selectbox.append( DOM_select_ringthesechannels, this_analogStation_user , device );
- return;
- }
- }}
- }else{
- var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname) || '?';
- ASTGUI.selectbox.append( DOM_select_ringthesechannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
- }
+ ASTGUI.selectbox.append( DOM_select_ringthesechannels, GetDevice_UserName(device) , device);
});
-
ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
- listOfDialDevices.each(function(device){ if( ! mbrs.contains(device) ){
- var tmp_ext = device.afterChar('/');
- var tmp_techn = device.beforeChar('/');
-
- if( tmp_techn.toLowerCase() == 'zap' ){
- var this_analogStation_user = '';
- for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
- if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
- this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
- ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device );
- return;
- }
- }}
- }else{
- var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname) || '?' ;
- ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
- }
- }});
+ listOfDialDevices.each(function(device){
+ if( mbrs.contains(device) ){ return ; }
+ ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
+ });
DOM_text_rgExten.value = (c['extension'])?c['extension']:'' ;
DOM_text_ringTime.value = (c['ringtime'])?c['ringtime']:'' ;
// select value from select box DOM_rg_fb_select
@@ -288,29 +255,8 @@
var TMP_MEMBERS = [];
var CDM = ASTGUI.cloneObject(c[d]['members']);
CDM.each(function(device){
- var tmp_ext = device.afterChar('/');
- var tmp_techn = device.beforeChar('/');
-
- if( tmp_techn.toLowerCase() == 'zap' ){
- var this_analogStation_user = '';
- for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
- if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
- this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
- TMP_MEMBERS.push( this_analogStation_user );
- break;
- }
- }}
- if(! this_analogStation_user ){
- TMP_MEMBERS.push( 'AnalogPort ' + tmp_ext + ' ?' );
- }
- }else{
- var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname) || '?';
- TMP_MEMBERS.push( tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name );
- }
-
-
- });
-
+ TMP_MEMBERS.push( GetDevice_UserName(device) );
+ });
addCell( newRow , { html: TMP_MEMBERS.join(', ') } );
var tmp = "<span class='guiButton' onclick=\"edit_rg_form('" + d +"')\">Edit</span>" +
"<span class='guiButtonDelete' onclick=\"delete_rg_confirm('" + d +"')\">Delete</span>" ;
@@ -346,7 +292,7 @@
});
t = parent.sessionData.FXS_PORTS_DETECTED ;
t.each(function(fxs){
- listOfDialDevices.push('Zap/' + fxs );
+ listOfDialDevices.push( parent.sessionData.DahdiDeviceString + '/' + fxs ); // Zap/x or DAHDI/x
});
ASTGUI.events.add( DOM_button_add_toringlist , 'click' , function(){
@@ -364,27 +310,9 @@
ASTGUI.events.add( DOM_button_removeall_fromringlist , 'click' , function(){
ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
- listOfDialDevices.each(function(device){
- var tmp_ext = device.afterChar('/');
- var tmp_techn = device.beforeChar('/');
-
- if( tmp_techn.toLowerCase() == 'zap' ){
- var this_analogStation_user = '';
- for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
- if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
- this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
- ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device);
- return;
- }
- }}
- }else{
- if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
- var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
- }else{
- return;
- }
- ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
- }
+
+ listOfDialDevices.each( function(device){
+ ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
});
});
@@ -392,32 +320,11 @@
ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
- listOfDialDevices.each(function(device){
- var tmp_ext = device.afterChar('/');
- var tmp_techn = device.beforeChar('/');
-
- if( tmp_techn.toLowerCase() == 'zap' ){
- var this_analogStation_user = '';
- for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
- if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
- this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
- ASTGUI.selectbox.append( DOM_select_ringthesechannels, this_analogStation_user , device);
- return;
- }
- }}
- }else{
- if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
- var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
- }else{
- return;
- }
- ASTGUI.selectbox.append( DOM_select_ringthesechannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
- }
+ listOfDialDevices.each( function(device){
+ ASTGUI.selectbox.append( DOM_select_ringthesechannels, GetDevice_UserName(device) , device);
});
});
-
})();
update_RingGroupsTable();
-
-};
+};
More information about the asterisk-gui-commits
mailing list