rbrindley: branch rbrindley/astman_revamp r4669 - /team/rbrindley/astman_reva...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Thu Mar 26 13:49:24 CDT 2009
Author: rbrindley
Date: Thu Mar 26 13:49:23 2009
New Revision: 4669
URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4669
Log:
- TimeInterval not TimeIntervals
- if types is undefined, define it
- no need for name
- if time_interval is '' then just delete it
- don't forget default suffix for cxt!
- just one 'delete' action for all the includes and then n 'append's where n is the num of includes
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=4669&r1=4668&r2=4669
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Thu Mar 26 13:49:23 2009
@@ -957,7 +957,7 @@
var globals = context2json({filename: 'extensions.conf', context: 'globals', usf:0});
for (var i=0; i<globals.length; i++) {
- if (globals[i].beginsWith(ASTGUI.contexts.TimeIntervalsPrefix)) {
+ if (globals[i].beginsWith(ASTGUI.contexts.TimeIntervalPrefix)) {
list[globals[i].lChop(ASTGUI.contexts.TimeIntervalPrefix).beforeChar('=')] = globals[i].afterChar('=');
}
}
@@ -1382,6 +1382,7 @@
var trunks = [];
if (typeof types === 'undefined') {
top.log.warn('pbx.trunks.list: types is undefined, listing all instead.');
+ var types = {};
types.all = true;
}
@@ -1504,7 +1505,6 @@
/**
* Add an incoming calling rule.
* @param trunk The trunk.
- * @param name Name of the rule.
* @param dest The destination.
* @param pattern The extension pattern.
* @param time_interval [optional] The time interval.
@@ -1519,18 +1519,20 @@
} else if (!params.trunk) {
top.log.error('pbx.trunks.rules.add: params.trunk not found.');
return false;
- } else if (!params.name) {
- top.log.error('pbx.trunks.rules.add: params.name not found.');
- return false;
} else if (!params.dest) {
top.log.error('pbx.trunks.rules.add: params.dest not found.');
return false;
} else if (!params.pattern) {
top.log.error('pbx.trunks.rules.add: params.pattern not found.');
return false;
- } if (params.dest === 'ByDID' && !params.digits) {
+ } else if (params.dest === 'ByDID' && !params.digits) {
top.log.error('pbx.trunks.rules.add: Destination is ByDID, but params.digits is not found.');
return false;
+ }
+
+ /* just delete time_interval if its empty */
+ if (params.time_interval === '') {
+ delete params.time_interval
}
/* easier to type/use */
@@ -1538,10 +1540,13 @@
/* lets form the cxt and include line, depending on time_interval or not */
var cxt = ASTGUI.contexts.TrunkDIDPrefix + params.trunk;
- var include = 'include=' + cxt;
+ var include = 'include=';
if (params.time_interval) {
cxt += '_' + ASTGUI.contexts.TimeIntervalPrefix + params.time_interval;
- include += delim + '${' + ASTGUI.contexts.TimeIntervalPrefix + params.name + '}';
+ include += cxt + delim + '${' + ASTGUI.contexts.TimeIntervalPrefix + params.time_interval + '}';
+ } else {
+ cxt += ASTGUI.contexts.TrunkDefaultSuffix;
+ include += cxt;
}
/* kk, now lets form the rule */
@@ -1568,15 +1573,18 @@
/* if the main trunk context doesn't already have the include line, lets add it */
var trunk_cxt = extens_conf[ASTGUI.contexts.TrunkDIDPrefix + params.trunk];
if (!trunk_cxt.contains(include) && params.time_interval) {
+ actions.new_action('delete', ASTGUI.contexts.TrunkDIDPrefix + params.trunk, 'include', '');
/* add time interval includes at the front */
trunk_cxt.splice(0,0,include);
trunk_cxt.each(function(line) {
- actions.new_action('delete', ASTGUI.contexts.TrunkDIDPrefix + params.trunk, line.beforeChar('='), line.afterChar('='));
+ if (line.beforeChar('=') !== 'include') {
+ return;
+ }
actions.new_action('append', ASTGUI.contexts.TrunkDIDPrefix + params.trunk, line.beforeChar('='), line.afterChar('='));
});
} else if (!trunk_cxt.contains(include)) {
/* add default includes at the end */
- actions.new_action('append', ASTGUI.contexts.TrunkDIDPrefix + params.trunk, 'include', cxt);
+ actions.new_action('append', ASTGUI.contexts.TrunkDIDPrefix + params.trunk, 'include', include.afterChar('='));
}
/* create the context if it doesn't exist */
More information about the asterisk-gui-commits
mailing list