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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Sat Mar 7 15:38:26 CST 2009


Author: rbrindley
Date: Sat Mar  7 15:38:22 2009
New Revision: 4592

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

- copied astgui_manageVoiceMenus.deleteMenu to pbx.voice_menus.remove
- copied astgui_manageVoiceMenus.nextAvailableVM_x to pbx.voice_menus.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=4592&r1=4591&r2=4592
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Sat Mar  7 15:38:22 2009
@@ -338,4 +338,47 @@
 	actions.callActions(cb);
 };
 
+/**
+ * Delete a Voice Menu.
+ * @param name Voice Menu name.
+ * @return boolean of success.
+ */
+pbx.voice_menus.remove = function(name) {
+	var acts = new listOfSynActions('extensions.conf');
+	acts.new_action('delcat', name, '', '');
+
+	if (sessionData.pbxinfo.voicemenus[name]['alias_exten'] != '') {
+		var aext = sessionData.pbxinfo.voicemenus[name]['alias_exten'].lChop('exten=');
+		acts.new_action('delete', ASTGUI.contexts.VoiceMenuExtensions, 'exten', '', aext);
+		acts.new_action('delete', 'default', 'exten', '', aext); /* backward compatibility with gui 1.x */
+	}
+
+	acts.callActions();
+
+	if (sessionData.pbxinfo.voicemenus.hasOwnProperty(name)) {
+		delete sessionData.pbxinfo.voicemenus[name];
+	}
+	return true;
+};
+
+/**
+ * Get next available vm
+ * @return array with next voicemenu
+ */
+pbx.voice_menus.next = function() {
+	var vm = [];
+	var props = sessionData.pbxinfo.voicemenus.getOwnProperties();
+
+	props.each(function(item) {
+		if (item.beginsWith(ASTGUI.contexts.VoiceMenuPrefix)) {
+			vm.push(item.split(ASTGUI.contexts.VoiceMenuPrefix)[1]);
+		}
+	});
+
+	if (!vm.length) {
+		return ASTGUI.contexts.VoiceMenuPrefix + '1';
+	}
+
+	return ASTGUI.contexts.VoiceMenuPrefix + vm.firstAvailable();
+};
 /*---------------------------------------------------------------------------*/




More information about the asterisk-gui-commits mailing list