rbrindley: branch 2.0 r4745 - in /branches/2.0/config: ./ js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Apr 17 09:33:20 CDT 2009


Author: rbrindley
Date: Fri Apr 17 09:33:17 2009
New Revision: 4745

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

- merged features_revamp branch


Added:
    branches/2.0/config/features2.html
      - copied unchanged from r4744, team/rbrindley/features_revamp/config/features2.html
    branches/2.0/config/js/effects.core.js
      - copied unchanged from r4744, team/rbrindley/features_revamp/config/js/effects.core.js
    branches/2.0/config/js/effects.highlight.js
      - copied unchanged from r4744, team/rbrindley/features_revamp/config/js/effects.highlight.js
    branches/2.0/config/js/features2.js
      - copied unchanged from r4744, team/rbrindley/features_revamp/config/js/features2.js
Modified:
    branches/2.0/config/index.html
    branches/2.0/config/js/pbx2.js

Modified: branches/2.0/config/index.html
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/index.html?view=diff&rev=4745&r1=4744&r2=4745
==============================================================================
--- branches/2.0/config/index.html (original)
+++ branches/2.0/config/index.html Fri Apr 17 09:33:17 2009
@@ -195,7 +195,7 @@
 			<div class="ui-accordion-link">Directory</div>
 			<div class="ui-accordion-desc">Preferences for 'Dialing by Name Directory'</div>
 		</div>
-		<div page='features.html'>
+		<div page='features2.html'>
 			<div class="ui-accordion-link">Call Features</div>
 			<div class="ui-accordion-desc">Feature Codes and Call parking preferences</div>
 		</div>

Modified: branches/2.0/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/pbx2.js?view=diff&rev=4745&r1=4744&r2=4745
==============================================================================
--- branches/2.0/config/js/pbx2.js (original)
+++ branches/2.0/config/js/pbx2.js Fri Apr 17 09:33:17 2009
@@ -457,6 +457,96 @@
 	return true;
 };
 /*---------------------------------------------------------------------------*/
+
+/**
+ * Dial Options object.
+ */
+pbx.dial_options = {
+	opts: '', /* a place to store the current dial options */
+	varname: 'DIALOPTIONS'
+};
+
+/**
+ * add a Dial Option.
+ * @param option
+ * @return boolean of success
+ */
+pbx.dial_options.add = function(opt) {
+
+	/* lets get the globals context */
+	var globals = context2json({
+		filename: 'extensions.conf',
+		context: 'globals',
+		usf: 1
+	});
+
+	/* ok, now assign it to the cache */
+	this.opts = globals[this.varname];
+
+	/* check if our opt already exists, if not lets add! */
+	if (this.opts.contains(opt)) {
+		top.log.debug('pbx.dial_options.add: ' + opt + ' already exists in ' + this.varname + '.');
+		return true;
+	}
+	this.opts = this.opts + opt.toString();
+
+	/* time to update Asterisk configs! */
+	var actions = listOfSynActions('extensions.conf');
+	actions.new_action('update', 'globals', this.varname, this.opts);
+	var resp = actions.callActions();
+
+	/* log errors and remove opt, on failure */
+	if (!resp.contains('Response: Success')) {
+		top.log.error('pbx.dial_options.add: Error updating extensions.conf');
+		top.log.error(resp);
+		var regex = new RegExp(opt, 'g');
+		this.opts = this.opts.replace(regex,'');
+		return false;
+	}
+
+	return true;
+};
+
+/**
+ * remove a Dial Option.
+ * @param option
+ * @return boolean of success
+ */
+pbx.dial_options.remove = function(opt) {
+
+	/* lets get the globals context */
+	var globals = context2json({
+		filename: 'extensions.conf',
+		context: 'globals',
+		usf: 1
+	});
+
+	/* ok, now assign it to the cache */
+	this.opts = globals[this.varname];
+
+	/* check if opt is in dial options and then remove it */
+	if (!this.opts.contains(opt)) {
+		top.log.debug('pbx.dial_options.remove: ' + this.varname + ' already doesn\'t contain ' + opt + '.');
+		return true;
+	}
+	var regex = new RegExp(opt, 'g');
+	this.opts = this.opts.replace(regex,'');
+
+	/* time to update Asterisk configs! */
+	var actions = listOfSynActions('extensions.conf');
+	actions.new_action('update', 'globals', this.varname, this.opts);
+	var resp = actions.callActions();
+
+	/* log errors and add opt back on failure */
+	if (!resp.contains('Response: Success')) {
+		top.log.error('pbx.dial_options.remove: Error updating extensions.conf');
+		top.log.error(resp);
+		this.opts = this.opts + opt.toString();
+		return false;
+	}
+
+	return true;
+};
 
 /**
  * Directory object.




More information about the asterisk-gui-commits mailing list