rbrindley: branch rbrindley/features_revamp r4739 - in /team/rbrindley/featur...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Apr 14 08:16:09 CDT 2009


Author: rbrindley
Date: Tue Apr 14 08:16:06 2009
New Revision: 4739

URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4739
Log:

- abstracted out a few global vars in js
- pulled amap listing code into its own func
- gave dial_options a default height


Modified:
    team/rbrindley/features_revamp/config/features2.html
    team/rbrindley/features_revamp/config/js/features2.js

Modified: team/rbrindley/features_revamp/config/features2.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/features2.html?view=diff&rev=4739&r1=4738&r2=4739
==============================================================================
--- team/rbrindley/features_revamp/config/features2.html (original)
+++ team/rbrindley/features_revamp/config/features2.html Tue Apr 14 08:16:06 2009
@@ -104,6 +104,10 @@
 
 		#application_map_list tr.odd {
 			background: #ffffff;
+		}
+
+		#dial_options {
+			height: 305px;
 		}
 
 		.template {
@@ -275,7 +279,7 @@
 		$('.refresh_icon').click( function() {
 			window.location.reload();
 		});
-		$('#application_map > span.guiButtonNew').click(function() {
+		$('#application_map .guiButtonNew').click(function() {
 			newAmap();
 		});
 		$('#application_map_list').delegate('click', 'span.guiButton', function() {

Modified: team/rbrindley/features_revamp/config/js/features2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/features2.js?view=diff&rev=4739&r1=4738&r2=4739
==============================================================================
--- team/rbrindley/features_revamp/config/js/features2.js (original)
+++ team/rbrindley/features_revamp/config/js/features2.js Tue Apr 14 08:16:06 2009
@@ -16,11 +16,10 @@
  * the GNU General Public License Version 2. See the LICENSE file
  * at the top of the source tree.
  */
-
-/**
- * object for holding cached values
- */
-var vals = {};
+var enabled_apps;
+var exten_conf;
+var feat_conf;
+var amap_table = $('#application_map_list tbody');
 
 /**
  * function to edit options
@@ -35,7 +34,7 @@
  * function to load options
  */
 var load = function() {
-	var exten_conf = context2json({
+	exten_conf = context2json({
 		filename: 'extensions.conf',
 		context: 'globals',
 		usf: 1
@@ -44,7 +43,7 @@
 	var dial_opts = exten_conf['DIALOPTIONS'] || '';
 
 	if (exten_conf['FEATURES'] && exten_conf['FEATURES'].length) {
-		var enabled_apps = exten_conf['FEATURES'].split('#');
+		enabled_apps = exten_conf['FEATURES'].split('#');
 	}
 
 	/* set all the enabled dial options to checked */
@@ -53,7 +52,7 @@
 		$('#dial_'+dial_opts[i]).attr('checked', 'checked').parents('.feature').removeClass('disabled');
 	}
 
-	var feat_conf = config2json({
+	feat_conf = config2json({
 		filename: 'features.conf',
 		usf: 1
 	});
@@ -100,44 +99,48 @@
 	});
 
 	var amap = feat_conf['applicationmap'];
-	var table = $('#application_map_list tbody');
 	for (var name in amap) {
 		if (!amap.hasOwnProperty(name)) {
 			continue;
 		}
 
-		if (name) {
-			var amap_fields = amap[name].split(',');
-		} else {
-			name = '';
-			var amap_fields = ['', 'self', '', ''];
-		}
-
-		if (!table.find('tr').length || (table.find('tr').length && table.find('tr:first').hasClass('noapps'))) {
-			table.find('tr:not(.template)').remove();
-		}
-
-		var row = $('#application_map_list > tbody > tr.template').clone();
-		row.find('.enabled :checkbox').attr('checked', (enabled_apps.contains(name)?true:false));
-		row.find('.name :text').attr('value', name);
-		row.find('.digits :text').attr('value', amap_fields[0]);
-		row.find('.app_name :text').attr('value', amap_fields[2]);
-		row.find('.app_args :text').attr('value', amap_fields[3]);
-		table.append(row);
-		row.removeClass('template');
+		listAmap(name);
 	}
 
-	if (table.find('tr:not(.template)').length === 0) {
+	if (amap_table.find('tr:not(.template)').length === 0) {
 		var row = $('<tr>').attr('colspan', '7').html('No Application Maps Defined.');
 		table.append(row);
 	}
+
 }
+
+var listAmap = function(name) {
+	if (name) {
+		var amap_fields = feat_conf['applicationmap'][name].split(',');
+	} else {
+		name = '';
+		var amap_fields = ['', 'self', '', ''];
+	}
+
+	if (!amap_table.find('tr').length || (amap_table.find('tr').length && amap_table.find('tr:first').hasClass('noapps'))) {
+		amap_table.find('tr:not(.template)').remove();
+	}
+
+	var row = $('#application_map_list > tbody > tr.template').clone();
+	row.find('.enabled :checkbox').attr('checked', (enabled_apps.contains(name)?true:false));
+	row.find('.name :text').attr('value', name);
+	row.find('.digits :text').attr('value', amap_fields[0]);
+	row.find('.app_name :text').attr('value', amap_fields[2]);
+	row.find('.app_args :text').attr('value', amap_fields[3]);
+	amap_table.append(row);
+	row.removeClass('template');
+};
 
 /**
  * create a new application map row
  */
 var newAmap = function() {
-	
+	listAmap('');
 };
 
 /**




More information about the asterisk-gui-commits mailing list