rbrindley: branch rbrindley/astman_revamp r4637 - /team/rbrindley/astman_reva...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Mar 12 22:21:18 CDT 2009


Author: rbrindley
Date: Thu Mar 12 22:21:15 2009
New Revision: 4637

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

- copied astgui_manageRingGroups.getRGsList to pbx.ring_groups.list
- copied astgui_manageRingGroups.nextAvailableRG_x to pbx.ring_groups.next


Modified:
    team/rbrindley/astman_revamp/config/js/pbx2.js

Modified: team/rbrindley/astman_revamp/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/pbx2.js?view=diff&rev=4637&r1=4636&r2=4637
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Thu Mar 12 22:21:15 2009
@@ -330,6 +330,22 @@
  */
 pbx.ring_groups = {};
 
+/**
+ * List Ring Groups.
+ * @return array of ring groups.
+ */
+pbx.ring_groups.list = function() {
+	var list = [];
+	var rgs = sessionData.pbxinfo.ringgroups;
+
+	for (var rg in rgs) {
+		if (rgs.hasOwnProperty(rg)) {
+			list.push(rg);
+		}
+	}
+
+	return list;
+};
 
 /**
  * Parse Ring Groups' context.
@@ -401,6 +417,27 @@
 	}
 
 	return rg;
+};
+
+/**
+ * Next available ring group number.
+ * @return next available ring group number.
+ */
+pbx.ring_groups.next = function() {
+	var x = [];
+	var y = this.list();
+
+	y.each(function(rg) {
+		if (rg.beginsWith(ASTGUI.contexts.RingGroupPrefix)) {
+			x.push(rg.split(ASTGUI.contexts.RingGroupPrefix)[1]);
+		}
+	});
+
+	if (!x.length) {
+		return ASTGUI.contexts.RingGroupPrefix + '1';
+	}
+
+	return ASTGUI.contexts.RingGroupPrefix + x.firstAvailable();
 };
 /*---------------------------------------------------------------------------*/
 




More information about the asterisk-gui-commits mailing list