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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Mar 11 12:35:32 CDT 2009


Author: rbrindley
Date: Wed Mar 11 12:35:28 2009
New Revision: 4608

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

- implemented pbx.time_intervals.validate.weekday


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=4608&r1=4607&r2=4608
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Wed Mar 11 12:35:28 2009
@@ -339,7 +339,42 @@
  * Holds members funcs that validate various formats
  * needed for time_intervals.
  */
-pbx.time_intervals.validate = {};
+pbx.time_intervals.validate = {
+	days: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],
+	months: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
+
+};
+
+/**
+ * Validates Weekday format.
+ * @param week The weekday range to be checked.
+ * @return boolean on valid format.
+ */
+pbx.time_intervals.validate.weekday = function(week) {
+	if (week === '*') {
+		/* this condition was separated from the switch
+		 * because its its own condition */
+		return true;
+	}
+
+	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)) {
+			return false;
+		}
+	} else {
+		if (!this.days.contains(week)) {
+			return false;
+		}
+
+	}
+
+	return true;
+};
 
 /**
  * Validates Time format.




More information about the asterisk-gui-commits mailing list