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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Mar 20 08:49:39 CDT 2009


Author: rbrindley
Date: Fri Mar 20 08:49:35 2009
New Revision: 4640

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

- copied astgui_managePageGroups.addPageGroup to pbx.paging.add
- copied astgui_managePageGroups.getPGsList to pbx.paging.list
- copied astgui_managePageGroups.updatePGsCache to pbx.paging.updateCache
- copied astgui_managePageGroups.deletePageGroup to pbx.paging.remove


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=4640&r1=4639&r2=4640
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Fri Mar 20 08:49:35 2009
@@ -273,10 +273,81 @@
  */
 pbx.moh = {};
 
+/*---------------------------------------------------------------------------*/
 /**
  * Paging object.
  */
 pbx.paging = {};
+
+/**
+ * Add a Page Group.
+ * @param line New Page Group Line.
+ * @param callback Callback function.
+ * @return boolean of success.
+ */
+pbx.paging.add = function(line, callback) {
+	if (!line) {
+		top.log.warn('pbx.paging.add: Line is empty.');
+		return false;
+	}
+
+	var actions = new listOfSynActions('extensions.conf');
+	actions.new_action('append', ASTGUI.contexts.PageGroups, 'exten', line);
+
+	var resp = actions.callActions();
+	if (!resp.contains('Response: Success')) {
+		top.log.error('pbx.paging.add: Error updating extensions.conf.');
+		return false;
+	}
+
+	this.updateCache(callback);
+	return true;
+};
+
+/**
+ * List Page Groups.
+ * @return an array of page groups.
+ */
+pbx.paging.list = function() {
+	var cxt = sessionData.pbxinfo['pagegroups'];
+	var extens = [];
+	cxt.each(function(line) {
+		var exten = ASTGUI.parseContextLine.getExten(line);
+		if (exten) {
+			extens.push(exten);
+		}
+	});
+
+	return extens;
+};
+
+/**
+ * Delete a Page Group.
+ * @param exten The Page Group extension.
+ * @param callback The Callback function.
+ * @return boolean of success.
+ */
+pbx.paging.remove = function(exten, callback) {
+	var cache = this.updatePGsCache;
+	ASTGUI.misFunctions.delete_LinesLike({ 
+		context_name: ASTGUI.contexts.PageGroups, 
+		beginsWithArr: ['exten=' + pgexten + ','], 
+		filename: 'extensions.conf', 
+		hasThisString: 'Macro(', 
+		cb: function(){AF(cb);}
+	});
+};
+
+/**
+ * Update Page Group Cache.
+ * @param callback Callback Function
+ */
+pbx.paging.updateCache = function(callback) {
+	setTimeout(function() {
+		sessionData.pbxinfo['pagegroups'] = context2json({filename: 'extensions.conf', context: ASTGUI.contexts.PageGroups, usf:0});
+	}, 1000);
+};
+/*---------------------------------------------------------------------------*/
 
 /*---------------------------------------------------------------------------*/
 /**




More information about the asterisk-gui-commits mailing list