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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Mar 12 15:07:59 CDT 2009


Author: rbrindley
Date: Thu Mar 12 15:07:56 2009
New Revision: 4633

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

- implemented pbx.time_intervals.remove
- fixed a validate.weekday bug


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=4633&r1=4632&r2=4633
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Thu Mar 12 15:07:56 2009
@@ -487,6 +487,46 @@
 	/* TODO: add new time interval to gui cache */
 
 	ASTGUI.feedback({ msg: 'Updated time interval!', showfor: 3, color: 'green', bgcolor: '#ffffff'});
+	return true;
+};
+
+/**
+ * Delete a Time Interval.
+ * @param name.
+ * @return boolean on success.
+ */
+pbx.time_intervals.remove = function(name) {
+	if (!name) {
+		top.log.warn('pbx.time_intervals.remove: Name is empty.');
+		return false;
+	}
+
+	var actions = new listOfSynActions('extensions.conf');
+	actions.new_action('delete', 'globals', t, '', '');
+
+	var exten_conf = config2json({filename: 'extensions.conf', usf:0});
+	for (var cxt in exten_conf) {
+		if (!exten_conf.hasOwnProperty(cxt)) {
+			continue;
+		}
+
+		if (cxt.beginsWith(ASTGUI.contexts.TrunkDIDPrefix) && !cxt.contains(ASTGUI.contexts.TimeIntervalPrefix)) {
+			var did = exten_conf[cxt];
+			did.each(function(line) {
+				if (line.beginsWith('include=') && line.contains(ASTGUI.contexts.TrunkDIDPrefix) && line.contains(ASTGUI.contexts.TimeIntervalPrefix)) {
+					actions.new_action('delete', cxt, 'include', '', line.afterChar('='));
+				}
+			});
+		}
+	}
+
+	var resp = actions.callActions();
+	if (!resp.contains('Response: Success')) {
+		top.log.error('pbx.time_intervals.remove: error updating extensions.conf.');
+		return false;
+	}
+
+
 	return true;
 };
 
@@ -595,17 +635,19 @@
 		return true;
 	}
 
-	if (week.contains('-') && week[2] !== '-') {
-		return false;
-	} else if (week[2] === '-') {
+	if (week.contains('-') && week[3] !== '-') {
+		return false;
+	} else if (week[3] === '-') {
 		var first = week.split('-')[0];
 		var second = week.split('-')[1];
 
 		if (!this.days.contains(first) || !this.days.contains(second)) {
+			alert('zonoes!');
 			return false;
 		}
 	} else {
 		if (!this.days.contains(week)) {
+			alert('zonoes 2.0!');
 			return false;
 		}
 




More information about the asterisk-gui-commits mailing list