rbrindley: branch 2.0 r4805 - /branches/2.0/config/js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu May 28 14:22:44 CDT 2009


Author: rbrindley
Date: Thu May 28 14:22:41 2009
New Revision: 4805

URL: http://svn.asterisk.org/svn-view/asterisk-gui?view=rev&rev=4805
Log:

- no longer using ASTGUI.customObject.getProperty
- now using getProperty defined in object.customs.js


Modified:
    branches/2.0/config/js/object.customs.js
    branches/2.0/config/js/trunks_analog.js
    branches/2.0/config/js/trunks_providers.js
    branches/2.0/config/js/trunks_voip.js

Modified: branches/2.0/config/js/object.customs.js
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/js/object.customs.js?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- branches/2.0/config/js/object.customs.js (original)
+++ branches/2.0/config/js/object.customs.js Thu May 28 14:22:41 2009
@@ -181,6 +181,10 @@
 	return '{' + props.join(' ,') + '}';
 };
 
+var getProperty = function(obj, p) {
+	return (obj.hasOwnProperty(p)) ? obj[p] : '';
+};
+
 // String Manipulation, and other custom methods for String Objects
 String.prototype.addZero = function(){
 	return ( Number(this) < 10)? "0" + this : this;

Modified: branches/2.0/config/js/trunks_analog.js
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/js/trunks_analog.js?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- branches/2.0/config/js/trunks_analog.js (original)
+++ branches/2.0/config/js/trunks_analog.js Thu May 28 14:22:41 2009
@@ -81,7 +81,7 @@
 	checkChannels( parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK][DAHDICHANNELSTRING] );
 	zapchan_Before = parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK][DAHDICHANNELSTRING];
 	var ct = ASTGUI.contexts.TrunkDIDPrefix + EDIT_TRUNK ;
-	ASTGUI.updateFieldToValue( 'edit_trunkName' ,  parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK].getProperty('trunkname') );
+	ASTGUI.updateFieldToValue('edit_trunkName', getProperty(parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK], 'trunkname'));
 	getPreviousVolumeForChannelsofThisTrunk( EDIT_TRUNK );
 	Electrical_Fields.each( function(fld){
 		var fld_value = parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK][fld] || '' ;
@@ -90,7 +90,7 @@
 
 	var variablename =  ASTGUI.globals.obcidUsrPrefix + EDIT_TRUNK ;
 	var c = context2json({ filename:'extensions.conf', context: 'globals' , usf: 1 });
-	ASTGUI.updateFieldToValue( 'trunk_obcid', c.getProperty(variablename) );
+	ASTGUI.updateFieldToValue( 'trunk_obcid', getProperty(c, variablename) );
 
 	$('#HIDE_OnNEW_0').show();
 	if( parent.sessionData.PLATFORM.isAA50 ){
@@ -245,7 +245,7 @@
 var delete_trunk_confirm = function(a){
 	EDIT_TRUNK = a;
 
-	var trunk_name = parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK].getProperty('trunkname') || EDIT_TRUNK ;
+	var trunk_name = getProperty(parent.sessionData.pbxinfo['trunks']['analog'][EDIT_TRUNK], 'trunkname') || EDIT_TRUNK ;
 	if(!confirm("Delete trunk '"+ trunk_name + "' ?")) { return true; }
 	if( parent.pbx.trunks.remove(EDIT_TRUNK) ){ 
 		ASTGUI.feedback({msg:'Deleted Analog trunk ' + "'" + trunk_name + "'" , showfor: 3 , color: '#5D7CBA', bgcolor: '#FFFFFF'}) ;
@@ -276,7 +276,7 @@
 
 		var y = parent.pbx.users.list();
 		y.each( function(user){
-			if( parent.sessionData.pbxinfo.users[user].getProperty('hasvoicemail').isAstTrue() ){
+			if( getProperty(parent.sessionData.pbxinfo.users[user], 'hasvoicemail').isAstTrue() ){
 				ASTGUI.selectbox.append('mailbox', user, user);
 			}
 		});

Modified: branches/2.0/config/js/trunks_providers.js
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/js/trunks_providers.js?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- branches/2.0/config/js/trunks_providers.js (original)
+++ branches/2.0/config/js/trunks_providers.js Thu May 28 14:22:41 2009
@@ -89,7 +89,7 @@
 					newRow.className = ((DOM_table_SPS_list.rows.length)%2==1)?'odd':'even';
 					addCell( newRow , { html: ''} );
 					addCell( newRow , { html: d[e]['trunkname'] });
-					addCell( newRow , { html: d[e].getProperty('username') || '--' });
+					addCell( newRow , { html: getProperty(d[e], 'username') || '--' });
 					addCell( newRow , { html: d[e]['host'] });
 					tmp = "<span class='guiButton' onclick=\"providers_MiscFunctions.show_EditProviderForm('" + e +"')\">Edit</span>" + 
 						"<span class='guiButtonDelete' onclick=\"providers_MiscFunctions.delete_ProviderForm('" + e +"')\">Delete</span>" ;

Modified: branches/2.0/config/js/trunks_voip.js
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/js/trunks_voip.js?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- branches/2.0/config/js/trunks_voip.js (original)
+++ branches/2.0/config/js/trunks_voip.js Thu May 28 14:22:41 2009
@@ -83,24 +83,24 @@
 		DOM_edit_VOIPTrunk_Context_Basis.disabled = true;
 		DOM_edit_VOIPTrunk_DIV_Title.innerHTML = 'Edit ' + ttype.toUpperCase() + ' trunk ' + EDIT_TRUNK;
 		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Type, ttype.toUpperCase() );
-		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Hostname , tinfo.getProperty('host') );
-		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Username , tinfo.getProperty('username') );
-		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Password , tinfo.getProperty('secret') );
-		ASTGUI.updateFieldToValue( 'edit_VOIPTrunk_Providername' , tinfo.getProperty('trunkname') );
-		ASTGUI.updateFieldToValue( 'trunk_fromdomain' , tinfo.getProperty('fromdomain') );
-		ASTGUI.updateFieldToValue( 'trunk_fromuser' , tinfo.getProperty('fromuser') );
-		ASTGUI.updateFieldToValue( 'trunk_authuser' , tinfo.getProperty('authuser') );
-		ASTGUI.updateFieldToValue( 'trunk_insecure' , tinfo.getProperty('insecure') );
-		ASTGUI.updateFieldToValue( 'trunk_outboundproxy' , tinfo.getProperty('outboundproxy') );
-
-		if( tinfo.getProperty('allow') == 'all'){
+		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Hostname , getProperty(tinfo, 'host') );
+		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Username , getProperty(tinfo, 'username') );
+		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Password , getProperty(tinfo, 'secret') );
+		ASTGUI.updateFieldToValue( 'edit_VOIPTrunk_Providername' , getProperty(tinfo, 'trunkname') );
+		ASTGUI.updateFieldToValue( 'trunk_fromdomain' , getProperty(tinfo, 'fromdomain') );
+		ASTGUI.updateFieldToValue( 'trunk_fromuser' , getProperty(tinfo, 'fromuser') );
+		ASTGUI.updateFieldToValue( 'trunk_authuser' , getProperty(tinfo, 'authuser') );
+		ASTGUI.updateFieldToValue( 'trunk_insecure' , getProperty(tinfo, 'insecure') );
+		ASTGUI.updateFieldToValue( 'trunk_outboundproxy' , getProperty(tinfo, 'outboundproxy') );
+
+		if( getProperty(tinfo, 'allow') == 'all'){
 			ASTGUI.updateFieldToValue( 'codec_one', 'ulaw' );
 			ASTGUI.updateFieldToValue( 'codec_two', 'alaw' );
 			ASTGUI.updateFieldToValue( 'codec_three', 'gsm' );
 			ASTGUI.updateFieldToValue( 'codec_fourth', 'g726' );
 			ASTGUI.updateFieldToValue( 'codec_fifth', 'g722' );
 		}else{
-			var codecs_tmp = tinfo.getProperty('allow').split(',') ;
+			var codecs_tmp = getProperty(tinfo, 'allow').split(',') ;
 			ASTGUI.updateFieldToValue( 'codec_one', (codecs_tmp[0] && codecs_tmp[0].trim()) || '' );
 			ASTGUI.updateFieldToValue( 'codec_two', (codecs_tmp[1] && codecs_tmp[1].trim()) || '' );
 			ASTGUI.updateFieldToValue( 'codec_three', (codecs_tmp[2] && codecs_tmp[2].trim()) || '' );
@@ -111,11 +111,11 @@
 		/* Don't allow editing field if the asterisk [context] is based on it. */
 		DOM_edit_VOIPTrunk_Username.disabled = false;
 		_$('edit_VOIPTrunk_Providername').disabled = false;
-		if (EDIT_TRUNK == tinfo.getProperty('username')) DOM_edit_VOIPTrunk_Username.disabled = true;
-		if (EDIT_TRUNK == tinfo.getProperty('trunkname')) _$('edit_VOIPTrunk_Providername').disabled = true;
+		if (EDIT_TRUNK == getProperty(tinfo, 'username')) DOM_edit_VOIPTrunk_Username.disabled = true;
+		if (EDIT_TRUNK == getProperty(tinfo, 'trunkname')) _$('edit_VOIPTrunk_Providername').disabled = true;
 
 		var c = context2json({ filename:'extensions.conf', context: 'globals' , usf: 1 });
-		ASTGUI.updateFieldToValue( 'trunk_obcid', c.getProperty(ASTGUI.globals.obcidUsrPrefix + EDIT_TRUNK) );
+		ASTGUI.updateFieldToValue( 'trunk_obcid', getProperty(c, ASTGUI.globals.obcidUsrPrefix + EDIT_TRUNK) );
 
 
 		// remote MWI stuff (only for SIP trunks)
@@ -144,7 +144,7 @@
 				}
 
 				for( var this_user in d ){ if( d.hasOwnProperty(this_user) ){
-					if ( d[this_user].getProperty('mailbox').contains('MailboxStore') &&  d[this_user].getProperty('mailbox').contains(ruser) ){
+					if (getProperty(d[this_user], 'mailbox').contains('MailboxStore') &&  getProperty(d[this_user], 'mailbox').contains(ruser) ){
 						ASTGUI.updateFieldToValue( 'edit_ERMWI_luser' , this_user );
 						EDIT_TRUNK_luser = this_user;
 					}




More information about the asterisk-gui-commits mailing list