rbrindley: branch rbrindley/features_revamp r4724 - in /team/rbrindley/featur...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Apr 8 14:29:39 CDT 2009


Author: rbrindley
Date: Wed Apr  8 14:29:35 2009
New Revision: 4724

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

- merged the latest from branches/2.0


Added:
    team/rbrindley/features_revamp/config/js/astgui.js
      - copied unchanged from r4723, branches/2.0/config/js/astgui.js
    team/rbrindley/features_revamp/config/js/astman2.js
      - copied unchanged from r4723, branches/2.0/config/js/astman2.js
    team/rbrindley/features_revamp/config/js/log.js
      - copied unchanged from r4723, branches/2.0/config/js/log.js
    team/rbrindley/features_revamp/config/js/object.customs.js
      - copied unchanged from r4723, branches/2.0/config/js/object.customs.js
    team/rbrindley/features_revamp/config/js/pbx2.js
      - copied unchanged from r4723, branches/2.0/config/js/pbx2.js
    team/rbrindley/features_revamp/config/js/session.js
      - copied unchanged from r4723, branches/2.0/config/js/session.js
    team/rbrindley/features_revamp/developer_info/CONFIG-ASSUMPTIONS
      - copied unchanged from r4723, branches/2.0/developer_info/CONFIG-ASSUMPTIONS
Modified:
    team/rbrindley/features_revamp/Makefile
    team/rbrindley/features_revamp/config/asterisklogs.html
    team/rbrindley/features_revamp/config/flipadvanced.html
    team/rbrindley/features_revamp/config/home.html
    team/rbrindley/features_revamp/config/incoming.html
    team/rbrindley/features_revamp/config/index.html
    team/rbrindley/features_revamp/config/js/astman.js
    team/rbrindley/features_revamp/config/js/backup.js
    team/rbrindley/features_revamp/config/js/bulkadd.js
    team/rbrindley/features_revamp/config/js/callingrules.js
    team/rbrindley/features_revamp/config/js/cdr.js
    team/rbrindley/features_revamp/config/js/dialplans.js
    team/rbrindley/features_revamp/config/js/flashupdate.js
    team/rbrindley/features_revamp/config/js/followme.js
    team/rbrindley/features_revamp/config/js/hardware.js
    team/rbrindley/features_revamp/config/js/hardware_aa50.js
    team/rbrindley/features_revamp/config/js/hardware_dahdi.js
    team/rbrindley/features_revamp/config/js/incoming.js
    team/rbrindley/features_revamp/config/js/index.js
    team/rbrindley/features_revamp/config/js/jquery.js
    team/rbrindley/features_revamp/config/js/menuprompts_record.js
    team/rbrindley/features_revamp/config/js/menus.js
    team/rbrindley/features_revamp/config/js/paging.js
    team/rbrindley/features_revamp/config/js/pbx.js
    team/rbrindley/features_revamp/config/js/preferences.js
    team/rbrindley/features_revamp/config/js/queues.js
    team/rbrindley/features_revamp/config/js/ringgroups.js
    team/rbrindley/features_revamp/config/js/status.js
    team/rbrindley/features_revamp/config/js/timeintervals.js
    team/rbrindley/features_revamp/config/js/timezone.js
    team/rbrindley/features_revamp/config/js/tooltip.js
    team/rbrindley/features_revamp/config/js/trunks_analog.js
    team/rbrindley/features_revamp/config/js/trunks_providers.js
    team/rbrindley/features_revamp/config/js/trunks_voip.js
    team/rbrindley/features_revamp/config/js/users.js
    team/rbrindley/features_revamp/config/js/vmgroups.js
    team/rbrindley/features_revamp/config/js/welcome.js
    team/rbrindley/features_revamp/config/password.html
    team/rbrindley/features_revamp/config/reset_defaults.html
    team/rbrindley/features_revamp/config/sysinfo.html
    team/rbrindley/features_revamp/config/timeintervals.html
    team/rbrindley/features_revamp/config/trunks_voip.html
    team/rbrindley/features_revamp/config/upload_abe_overlay.html
    team/rbrindley/features_revamp/config/upload_form.html
    team/rbrindley/features_revamp/config/users.html
    team/rbrindley/features_revamp/config/welcome.html

Modified: team/rbrindley/features_revamp/Makefile
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/Makefile?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/Makefile (original)
+++ team/rbrindley/features_revamp/Makefile Wed Apr  8 14:29:35 2009
@@ -95,8 +95,8 @@
 ifeq ($(HTTPPREFIXBASE),)
   HTTPPREFIX:=asterisk
 endif
-HTTPURL:=http://$(HTTPHOST):$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/cfgbasic.html
-HTTPLOCALURL:=http://localhost:$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/cfgbasic.html
+HTTPURL:=http://$(HTTPHOST):$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/index.html
+HTTPLOCALURL:=http://localhost:$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/index.html
 	
 #SUBDIRS:=tools
 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)

Modified: team/rbrindley/features_revamp/config/asterisklogs.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/asterisklogs.html?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/asterisklogs.html (original)
+++ team/rbrindley/features_revamp/config/asterisklogs.html Wed Apr  8 14:29:35 2009
@@ -38,7 +38,7 @@
 	var lm = sel_date.split(' ')[1]; lm = lm.trim();
 	var tmp_cmd = "/bin/grep /var/log/asterisk/messages -e '" + lm + space + ld + " ' " ;
 	parent.ASTGUI.dialog.waitWhile(' Loading Asterisk Logs ...');
-	ASTGUI.Log.Debug(tmp_cmd);
+	top.log.debug(tmp_cmd);
 	ASTGUI.systemCmdWithOutput( tmp_cmd , function(output){
 		parent.ASTGUI.dialog.hide();
 		_$('todaylog').innerHTML = (output) ? "<PRE>" + output.escapeHTML() + "</PRE>" : "No log messages found on this Day" ;

Modified: team/rbrindley/features_revamp/config/flipadvanced.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/flipadvanced.html?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/flipadvanced.html (original)
+++ team/rbrindley/features_revamp/config/flipadvanced.html Wed Apr  8 14:29:35 2009
@@ -61,7 +61,7 @@
 
 var update_status = function(){
 
-	var am = ASTGUI.cookies.getCookie('advancedmode');
+	var am = top.cookies.get('advancedmode');
 	if( am && am == 'yes' ){
 		_$('flip_button').innerHTML = 'Hide Advanced Options';
 		_$('flip_decsription').innerHTML = "Clicking the 'Hide Advanced Options' button below removes the advanced menu items on the left hand sidebar"

Modified: team/rbrindley/features_revamp/config/home.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/home.html?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/home.html (original)
+++ team/rbrindley/features_revamp/config/home.html Wed Apr  8 14:29:35 2009
@@ -57,12 +57,12 @@
 	var f = makeSyncRequest({ action :'login', username: DOM_username.value, secret: DOM_secret.value });
 	f = f.toLowerCase();
 	if(f.match('authentication accepted')){
-		ASTGUI.Log.Debug("Login Success result: " + f);
+		top.log.debug("Login Success result: " + f);
 		setLoggedIn( { welcome_redirect: false } );
 		DOM_secret.blur();
 		parent.ASTGUI.dialog.waitWhile(' <font color=#005119><b>Login Success</b></font>');
 		ASTGUI.feedback({msg:'Login Success', showfor: 4 , color: '#5D7CBA', bgcolor: '#FFFFFF'}) ;
-		parent.ASTGUI.cookies.setCookie('username', DOM_username.value );
+		top.cookies.set('username', DOM_username.value );
 
 		if( DOM_secret.value == 'password'){
 			ASTGUI.feedback({msg:'Your are using the default password.<BR> Please choose a new password', showfor: 7 , color: '#672b13'}) ;
@@ -77,7 +77,7 @@
 		}
 		return;
 	}else if(f.match('authentication failed') ) {
-		ASTGUI.Log.Debug("Login failure result: " + f);
+		top.log.debug("Login failure result: " + f);
 		ASTGUI.feedback({msg:'Invalid Username or Password', showfor: 4, color:'#c42421'}) ;
 		DOM_secret.focus();
 		DOM_secret.select();
@@ -102,7 +102,7 @@
 
 
 var updatePassword = function(){
-	var CURRENT_Username = top.ASTGUI.cookies.getCookie('username');
+	var CURRENT_Username = top.cookies.get('username');
 	var u = new listOfSynActions('manager.conf') ;
 
 	var newp = ASTGUI.getFieldValue('new_password');

Modified: team/rbrindley/features_revamp/config/incoming.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/incoming.html?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/incoming.html (original)
+++ team/rbrindley/features_revamp/config/incoming.html Wed Apr  8 14:29:35 2009
@@ -18,10 +18,6 @@
  * at the top of the source tree.
  *
 -->
-<script src="js/jquery.js"></script>
-<script src="js/astman.js"></script>
-<script src="js/incoming.js"></script>
-<script src="js/jquery.tooltip.js"></script>
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <style type="text/css">
 
@@ -103,4 +99,49 @@
 		</TABLE>
 	</div>
 
+<script src="js/jquery.js"></script>
+<script src="js/astman.js"></script>
+<script src="js/incoming.js"></script>
+<script src="js/jquery.tooltip.js"></script>
+<script type="text/javascript">
+	$(document).ready(function() {
+		top.document.title = "Incoming Calling Rules";
+		
+		incomingRules_MiscFunctions.listAllRulesInTable();
+
+		/* Populate Time Intervals <select> */
+		var itrl_tf = $('#edit_itrl_tf');
+		var list = parent.pbx.time_intervals.list();
+		for (var ti in list) {
+			if (!list.hasOwnProperty(ti)) {
+				continue;
+			}
+
+			itrl_tf.append($('<option>').html(ti).val(ti));
+		};
+		itrl_tf.append($('<option>').html('None (no Time Intervals matched)').val(''));
+		delete itrl_tf;
+		delete list;
+
+		/* Populate Destinations <select> */
+		var dest = $('#edit_itrl_dest');
+		var list = parent.miscFunctions.getAllDestinations();
+		for (var d=0; d<list.length; d++) {
+			dest.append($('<option>').html(list[d].optionText).val(list[d].optionValue));
+		}
+		dest.append($('<option>').html('Local Extension by DID').val('ByDID'));
+
+		/* now lets add some events!! */
+		dest.change(function() {
+			if ($(this).val() === 'ByDID') {
+				$('.localext_byDid').show();
+			} else {
+				$('.localext_byDid').hide();
+			}
+		});
+		$('#edit_itrl_trunk').click(function() {
+			incomingRules_MiscFunctions.enableDisablePattern();
+		});
+	});
+</script>
 </body>

Modified: team/rbrindley/features_revamp/config/index.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/index.html?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/index.html (original)
+++ team/rbrindley/features_revamp/config/index.html Wed Apr  8 14:29:35 2009
@@ -35,7 +35,8 @@
 		AA50_SKU : '', // sessionData.PLATFORM.AA50_SKU
 		isANOW : false, // Asterisk Now
 		isAST_1_4 : true, // we assume is Asterisk 1.4 by default, sessionData.PLATFORM.isAST_1_4
-		isAST_1_6 : false
+		isAST_1_6 : false,
+		isAST_1_6_1 : false
 	},
 
 	AsteriskVersionString : '',
@@ -86,11 +87,14 @@
 };
 
 </script>
+<script src="js/log.js"></script>
+<script src="js/session.js"></script>
 <script src="js/jquery.js"></script>
+<script src="js/tooltip.js"></script>
 <script src="js/astman.js"></script>
 <script src="js/pbx.js"></script>
+<script src="js/pbx2.js"></script>
 <script src="js/index.js"></script>
-<script src="js/tooltip.js"></script>
 <head>
 	<title>Asterisk Configuration GUI</title>
 	<link rel="shortcut icon" href="images/favicon.ico" />
@@ -324,5 +328,4 @@
 		<span class='button_t1' onclick='onLogInFunctions.makePings.makeRetryPing();'> Retry </span>
 	<div>
 </div>
-
 </body>

Modified: team/rbrindley/features_revamp/config/js/astman.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/astman.js?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/js/astman.js (original)
+++ team/rbrindley/features_revamp/config/js/astman.js Wed Apr  8 14:29:35 2009
@@ -483,10 +483,10 @@
 		// ASTGUI.cliCommand(cmd);
 		//	Execute an asterisk CLI command and return the output
 		if( typeof cmd != 'string' ) {
-			ASTGUI.Log.Warn( 'cliCommand: Expecting cmd as String' );
+			top.log.warn( 'cliCommand: Expecting cmd as String' );
 			return '';
 		}
-		ASTGUI.Log.Debug("Executing manager command : '" + cmd + "'");
+		top.log.debug("Executing manager command : '" + cmd + "'");
 		return makeSyncRequest ( { action :'command', command: cmd } );
 	},
 
@@ -495,7 +495,7 @@
 		//	Get the DeviceStatus for a UserExtension
 		if( typeof usr == 'number' ) usr = String(usr);
 		if( typeof usr != 'string' ){
-			ASTGUI.Log.Warn( 'getUser_DeviceStatus: Expecting usr as String' );
+			top.log.warn( 'getUser_DeviceStatus: Expecting usr as String' );
 			return 'U';
 		}
 		var t = makeSyncRequest({ action :'ExtensionState', Exten: usr }) ;
@@ -536,7 +536,7 @@
 		var tr = { count_new:0 , count_old : 0 };
 		if( typeof mbox == 'number' ) mbox = String(mbox);
 		if( typeof mbox != 'string' ){
-			ASTGUI.Log.Warn( 'mailboxCount: Expecting mbox as String' );
+			top.log.warn( 'mailboxCount: Expecting mbox as String' );
 			return tr;
 		}
 		if(!mbox.contains('@')){ mbox = mbox + '@default' ; }
@@ -561,14 +561,14 @@
 	doTransfer : function(from, to) {
 		// ASTGUI.doTransfer(from, to)
 		//	issue channel redirect
-		ASTGUI.Log.Debug("About to transfer " + from + " to " + to);
+		top.log.debug("About to transfer " + from + " to " + to);
 		return makeSyncRequest ( { action :'redirect', channel :from, exten :to, context :'default', priority :'1' } );
 	},
 
 	doHangup : function(chan) {
 		// ASTGUI.doHangup(chan)
 		//	Hangsup a given channel
-		ASTGUI.Log.Debug("Executing hangup on channel : '" + chan + "'");
+		top.log.debug("Executing hangup on channel : '" + chan + "'");
 		return makeSyncRequest ( { action :'hangup', channel: chan } );
 	},
 
@@ -821,7 +821,7 @@
 			b.style.left = tmp_left + ( offsetLeft || 0 );
 			b.style.top = tmp_top + (offsetTop || 1);
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 			}
 		},
 
@@ -834,7 +834,7 @@
 				ASTGUI.domActions.alignBbelowA(a,b);
 				b.style.top = b.style.top - a.offsetHeight ;
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 			}
 		},
 
@@ -951,7 +951,7 @@
 				}
 			}
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 			}
 		},
 
@@ -994,7 +994,7 @@
 				}
 			}
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 			}
 		},
 
@@ -1138,14 +1138,13 @@
 		} ;
 		*/
 		// trunkname == trunkname as trunk_x 
-		//var ttype = parent.astgui_managetrunks.misc.getTrunkType(trunkname) ;
 		try{
 		var this_IP = '';
 		if(!ttype || ( ttype != 'sip' && ttype != 'iax' && ttype != 'providers' ) ){ return '--'; }
 		if( ttype == 'providers' ){
 			var uname = parent.sessionData.pbxinfo.trunks[ttype][trunkname]['username'];
 			var host = parent.sessionData.pbxinfo.trunks[ttype][trunkname]['host'];
-			ttype = parent.astgui_managetrunks.misc.getProviderTrunkType(trunkname); // find 'sip' or 'iax'
+			ttype = parent.pbx.trunks.getProviderType(trunkname); // find 'sip' or 'iax'
 			if ( ttype != 'sip' && ttype != 'iax'){
 				return '--';
 			}
@@ -1164,21 +1163,28 @@
 			var s = t.split('\n');
 			for(var i=0; i < s.length; i++ ){
 				var line = s[i];
-				if(line.contains('Addr->IP') ){ // if line is  'Addr->IP     : 68.62.219.197 Port 5060'
+				if(line.contains('Addr->IP') && !line.contains('(Unspecified)')){ // if line is  'Addr->IP     : 68.62.219.197 Port 5060'
 					var tmp = line.afterChar(':'); // tmp = '68.62.219.197 Port 5060' ;
 					var tmp2 = tmp.split(' Port ');
 					IP = tmp2.join(':');
 					IP = IP.trim();
 					this_IP = IP;
 					return;
+				} else if (line.contains('Defaddr->IP')) {
+					var loc = line.afterChar(':').split(' Port ');
+					IP = loc.join(':');
+					IP = IP.trim();
+					this_IP = IP;
 				}
 			}
 		})();
 
 		if(ttype=='iax'){
 			var lines = registry.iax2.split('\n');
+			uname = uname.substring(0,10);
 		}else if(ttype=='sip'){
 			var lines = registry.sip.split('\n');
+			uname = uname.substring(0,12);
 		}
 
 		//var uname_lc = uname.toLowerCase();
@@ -1186,30 +1192,30 @@
 		// cli output of 'sip show registry' shows only a part of long usernames
 		// We should use action: status like we do for active channel monitoring.
 		
-		var uname_lc = uname.toLowerCase().substr(0,10);
+		var uname_lc = uname.toLowerCase();
 
 		for(var i = 0; i < lines.length; i++) {
+			var line_orig = lines[i];
 			var line = lines[i].trim().toLowerCase();
-			if (!line || line.beginsWith('host') ){ continue; }
-			if( ( line.beginsWith(host+':') || ( this_IP && line.beginsWith(this_IP + ' ') ) )  && line.contains( ' ' + uname_lc + ' ' ) ){
-				if( line.contains(' registered') ){
-					return '<font color=green>Registered</font>' ;
-				}else if( line.contains('auth. sent') ){
-					return '<font color=red>Waiting for Authentication</font>';
-				}else if( line.contains('request sent') ){
-					return '<font color=red>Request Sent</font>';
-				}else if( line.contains('rejected') ){
-					return '<font color=red>Rejected</font>';
-				}else if( line.contains('unregistered') ){
-					return '<font color=red>Unregistered</font>';
-				}else{
-					return '<font color=red>Unregistered</font>';
-				}
-			}
-		}
-		return '<font color=red>Unregistered</font>';
+			if (!line || line.beginsWith('host') ) { 
+				continue; 
+			}
+			if((line.beginsWith(host) || (this_IP && line.beginsWith(this_IP + ' ')))  && line.contains(' ' + uname_lc + ' ')) {
+				var vals = line_orig.split(/[ \t][ \t]*/); /* Host, Username, Refresh, State, Reg.Time */
+				var sip_index = parent.sessionData.PLATFORM.isAST_1_6_1 ? 4 : 3;
+				var state = (ttype === 'sip') ? vals[sip_index] : vals[5];
+				switch(state) {
+				case 'registered':
+				case 'Registered':
+					return '<font color="green">'+state+'</font>';
+				default:
+					return '<font color="red">'+state+'</font>';
+				}
+			}
+		}
+		return '<font color=red>Unrecognized Trunk</font>';
 		}catch(err){
-			ASTGUI.Log.Error(err.description);
+			top.log.error(err);
 		}
 	},
 
@@ -1279,7 +1285,7 @@
 			});
 		});
 		}catch(err){
-			ASTGUI.Log.Error(err.description);
+			top.log.error(err.description);
 			cb([]);
 		}
 	},
@@ -1318,7 +1324,7 @@
 
 			return tr_Array ;
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 				return [] ;
 			}
 		},
@@ -1386,7 +1392,7 @@
 				});
 			}});
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 			}
 		},
 
@@ -1409,7 +1415,7 @@
 				x.callActions(ct.cb);
 			//}
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 			}
 		},
 
@@ -1447,7 +1453,7 @@
 
 			x.callActions(ct.cb);
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 				ct.cb();
 			}
 		},
@@ -1478,7 +1484,7 @@
 
 			return [chs];
 			}catch(err){
-				ASTGUI.Log.Warn( err.description );
+				top.log.warn( err.description );
 				return [chs];
 			}
 		},
@@ -1501,22 +1507,41 @@
 			return ext.isValueInBetween(v, w);
 		},
 
-		AMPM_to_asteriskTime: function(ampmTime){ // takes ampmTime as '12:15 AM' or '11:45 PM' and returns '00:15' or '23:45'
-			//ASTGUI.miscFunctions.AMPM_to_asteriskTime('12:15 AM');
-			if( ampmTime.endsWith(' PM') ){
-				var a = ampmTime.withOut(' PM');
-				var tmp = a.split(':') ;
-				var hour = Number(tmp[0]);
-				return (hour == 12) ? hour + ':' + tmp[1] : ( hour + 12 ) + ':' + tmp[1] ;
-			}
-
-			if( ampmTime.endsWith(' AM') ){
-				var a = ampmTime.withOut(' AM');
-				var tmp = a.split(':') ;
-				var hour = Number(tmp[0]);
-				return ( hour == 12 ) ? '00:' + tmp[1]  : tmp[0] + ':' + tmp[1] ;
-			}
-			return '';
+		/* ampmTime should be in "HH:MM [AM|PM]" */
+		AMPM_to_asteriskTime: function(ampmTime){
+			var pattern = /^\s*(\d{1,2}):(\d{2})(\s?(AM|am|PM|pm))?\s*$/;
+
+			var match = ampmTime.match(pattern);
+			if (match == null) {
+				top.log.debug('ampmTime is not in a valid format.');
+				return '';
+			}
+
+			hour = parseInt(match[1],10);
+			minute = parseInt(match[2], 10);
+			//match[3] is the whitespace plus match[4]
+			ampm = match[4] || null;
+
+			if (!ampm && (hour < 0 || hour > 23)) {
+				top.log.debug('ampmTime must have its hour inbetween 0 and 23.');
+				return '';
+			} else if (ampm && (hour < 0 || hour > 12)) {
+				top.log.debug('ampmTime must have its hour inbetween 0 and 12 if "AM|PM" exists');
+				return '';
+			} else if (ampm) {
+				if (ampm.match('[pP][mM]')) {
+					hour+=12;
+				}
+			}
+			hour = (hour < 10) ? hour.addZero() : hour;
+
+			if (minute < 0 || minute > 59) {
+				top.log.debug('ampmTime must have its minute inbetween 0 and 59');
+				return '';
+			}
+			minute = minute < 10 ? minute.addZero() : minute;
+
+			return hour + ':' + minute;
 		},
 		
 		asteriskTime_to_AMPM: function(atime){ // takes atime as '00:15' or '23:45' and returns '12:15 AM' or '11:45PM'
@@ -1539,10 +1564,10 @@
 		},
 
 		GotoIftime_in_humanReadable: function( gotoiftime_str ){ 
-			//ASTGUI.miscFunctions.GotoIftime_in_humanReadable( '08:00-17:00|mon-fri|*|*' ) ; // returns a human readable form as ' 8 AM to 5 PM on Monday through Friday'
+			//ASTGUI.miscFunctions.GotoIftime_in_humanReadable( '08:00-17:00,mon-fri,*,*' ) ; // returns a human readable form as ' 8 AM to 5 PM on Monday through Friday'
 			var WEEKDAYS = {mon: 'Monday', tue: 'Tuesdays', wed: 'Wednesday', thu: 'Thursday', fri: 'Friday', sat:'Saturday', sun:'Sunday'};
 
-			var PIECES = gotoiftime_str.split('|') ;
+			var PIECES = gotoiftime_str.contains(',') ? gotoiftime_str.split(',') : gotoiftime_str.split('|') ;
 			var toreturn = [];
 			if( PIECES[0] != '*' ){
 				toreturn.push( ASTGUI.miscFunctions.asteriskTime_to_AMPM(PIECES[0].split('-')[0]) + ' to ' +  ASTGUI.miscFunctions.asteriskTime_to_AMPM(PIECES[0].split('-')[1]) );
@@ -1627,7 +1652,7 @@
 					return q.substring(l+1);
 				}
 			}
-			ASTGUI.Log.Error( "ASTGUI.parseContextLine.getAppWithArgs() could not parse \"" + q + "\" " );
+			top.log.error( "ASTGUI.parseContextLine.getAppWithArgs() could not parse \"" + q + "\" " );
 			return '';
 		},
 
@@ -1640,13 +1665,13 @@
 		},
 
 		getArgs: function(q){ // ASTGUI.parseContextLine.getArgs();
-			// expects  q  as 'exten=s,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss|ssdsd|assd)'
+			// expects  q  as 'exten=s,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss,ssdsd,assd)'
 			// OR 's,1,Answer' OR 's,n,Hangup'
 			// and   returns [ssssssss,ssdsd,assd] or [] // arguments as an array 
 			if (typeof q != 'string' || !q ) return [];
 			q = q.trim();
 			if ( !q.endsWith(')') || !q.contains('(') ){
-				ASTGUI.Log.Error( "ASTGUI.parseContextLine.getArgs() - No Argument found for \"" + q + "\" " );
+				top.log.error( "ASTGUI.parseContextLine.getArgs() - No Argument found for \"" + q + "\" " );
 				return [];
 			}
 			var y = ASTGUI.parseContextLine.getAppWithArgs(q);
@@ -1655,18 +1680,18 @@
 			return this.getArgsArrayFromArgsString(x);
 		},
 
-		getArgsArrayFromArgsString: function(x){ // expects x as 'context,exten,pri' or 'context|exten|pri'
+		getArgsArrayFromArgsString: function(x){ // expects x as 'context,exten,pri' or 'context,exten,pri'
 			if (typeof x != 'string') return [];
-			if(x.contains('|') ){
-				return x.split('|');
-			}
 			if(x.contains(',') ){
 				return x.split(',');
 			}
+			if(x.contains(',') ){
+				return x.split(',');
+			}
 			return [x] ;
 		},
 
-		getArgsArrayFrom_AppWithArgs_String: function(x){ // expects x as 'goto(context,exten,pri)' or 'goto(context|exten|pri)'
+		getArgsArrayFrom_AppWithArgs_String: function(x){ // expects x as 'goto(context,exten,pri)' or 'goto(context,exten,pri)'
 			// usage : ASTGUI.parseContextLine.getArgsArrayFrom_AppWithArgs_String(x)
 			if (typeof x != 'string') return [];
 			if( !x.contains('(') ) {
@@ -1678,7 +1703,7 @@
 		},
 
 		toKnownContext: function(args){  // usage ASTGUI.parseContextLine.toKnownContext(y)
-			// converts args to a readable format - ex: default|6000|1 to 'user 6000'
+			// converts args to a readable format - ex: default,6000,1 to 'user 6000'
 			if(!args.length){ return ''; }
 			try{
 			if(typeof args == 'string'){
@@ -1724,18 +1749,18 @@
 			}
 			return 'Goto ' + args.join() ;
 			}catch(err){
-				ASTGUI.Log.Error(err.description);
+				top.log.error(err.description);
 				return 'Goto ' + args.join() ;
 			}
 		},
 
 		showAs : function(q){ // ASTGUI.parseContextLine.showAs(line)
-			// expects q as 'extension,priority,Goto(context|extension|1)' or 'Goto(context|extension|1)' or 'Goto(context,extension,1)'
+			// expects q as 'extension,priority,Goto(context,extension,1)' or 'Goto(context,extension,1)' or 'Goto(context,extension,1)'
 			// or 'extensions,priority,Hangup'
 			// returns - "User extension" or 'VoiceMenu extension' or 'Hangup' or 'Busy' or some string - depends on q.
 			// use this when you want to represent the action to the user
 			if (typeof q != 'string') {
-				ASTGUI.Log.Error('ASTGUI.parseContextLine.showAs: expecting q as string');
+				top.log.error('ASTGUI.parseContextLine.showAs: expecting q as string');
 				return '??';
 			}
 			var app = ASTGUI.parseContextLine.getApp(q) ;
@@ -1850,7 +1875,7 @@
 		parseTrunkDialArgument: function(y){ // usage ASTGUI.parseContextLine.parseTrunkDialArgument(y)
 			// expects y as  '${trunk_1}/XXX${EXTEN:X}' OR SIP/user/XXX${EXTEN:X}
 			if( !y || typeof y != 'string') {
-				ASTGUI.Log.Error('ASTGUI.parseContextLine.parseTrunkDialArgument: expecting y as string');
+				top.log.error('ASTGUI.parseContextLine.parseTrunkDialArgument: expecting y as string');
 				return { name : '', channel : '', prepend : '', stripx : '' };
 			}
 			var WhatToDial = '';
@@ -1911,7 +1936,7 @@
 					}
 			*/
 			if (typeof str != 'string') {
-				ASTGUI.Log.Error('ASTGUI.parseContextLine.obCallingRule: expecting str as string');
+				top.log.error('ASTGUI.parseContextLine.obCallingRule: expecting str as string');
 				return null;
 			}
 
@@ -1986,13 +2011,13 @@
 	selectbox: {
 		selectDestinationOption: function(el, dest){ // ASTGUI.selectbox.selectDestinationOption(el,dest)
 			// selects a given destination 'dest' in select box el
-			// dest could be 'context|extention|priority' or 'context,etension,priority' or 'goto(context,etension,priority)' or 's,n,goto(context,etension,priority)'
+			// dest could be 'context,extention,priority' or 'context,etension,priority' or 'goto(context,etension,priority)' or 's,n,goto(context,etension,priority)'
 			//console.log('We are looking for "' + dest + ' " in the selectbox');
 			var args = [];
 			if ( typeof el == 'string'){
 				el = _$(el) ;
 				if( !el ){
-					ASTGUI.Log.Error( 'No Element by that id ' );
+					top.log.error( 'No Element by that id ' );
 					return;
 				}
 			}
@@ -2024,9 +2049,9 @@
 				}
 			}
 
-			var args_v = args.join('|') ;
+			var args_v = args.join(',') ;
 			var args_c = args.join(',') ;
-			var dest_args_v = 'Goto('+ args.join('|') + ')';
+			var dest_args_v = 'Goto('+ args.join(',') + ')';
 			var dest_args_c = 'Goto('+ args.join(',') + ')' ;
 
 			for( var i=0, j = el.options.length ; i < j ; i++ ){
@@ -2311,8 +2336,12 @@
 	systemCmd: function(cmd, callbackfunction){
 		// ASTGUI.systemCmd(cmd, cbf);
 		//	Execute a Unix system command
-		ASTGUI.Log.Debug("Executing System Command : '" + cmd + "'");
+		top.log.debug("Executing System Command : '" + cmd + "'");
 		var delay_cb = function(){
+			if (typeof callbackfunction !== 'function') {
+				return;
+			}
+
 			if( parent.sessionData.PLATFORM.isAA50 ){
 				setTimeout( callbackfunction , 500 );
 			}else{
@@ -2451,7 +2480,7 @@
 				}
 				break;
 			case 'radio':
-				ASTGUI.Log.Error('You are on your own with Radio Buttons');
+				top.log.error('You are on your own with Radio Buttons');
 				break ;
 			case 'select-one':
 				ASTGUI.selectbox.selectOption(el, val);
@@ -2696,10 +2725,10 @@
 	if( params.action == "updateconfig" ){
 		params.srcfilename = params.filename;
 		params.dstfilename = params.filename;
-		if(top.sessionData && top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
+		if(top.sessionData && top.sessionData.DEBUG_MODE ){top.log.ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
 		delete params.filename;
 	}else{
-		if(top.sessionData && top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
+		if(top.sessionData && top.sessionData.DEBUG_MODE ){top.log.ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
 	}
 
 	$.get(ASTGUI.paths.rawman, params, cb);
@@ -2707,7 +2736,7 @@
 
 var makeSyncRequest = function( params){ // for making synchronus requests
 	// usage ::  makeSyncRequest ( { action :'getconfig', filename: 'something.conf' } ) // no need for call back function
-	if(top.sessionData && top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
+	if(top.sessionData && top.sessionData.DEBUG_MODE ){top.log.ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
 	var s = $.ajax({ url: ASTGUI.paths.rawman, data: params , async: false });
 	return s.responseText;
 };
@@ -2761,7 +2790,7 @@
 		return toJSO( params.configFile_output );
 	};
 
-	ASTGUI.Log.Ajax("AJAX Request : reading '" +  params.filename + "'");
+	top.log.ajax("AJAX Request : reading '" +  params.filename + "'");
 
 	if( top.sessionData.FileCache.hasOwnProperty(params.filename) &&  top.sessionData.FileCache[params.filename].modified == false){ // if file is in cache and is not modified since
 		var s = top.sessionData.FileCache[params.filename].content ;
@@ -2780,9 +2809,9 @@
 	if(s.contains('Response: Error') && ( s.contains('Message: Config file not found') || s.contains('Message: Permission denied') ) ){
 		// return ASTGUI.globals.fnf; // return 'file not found'
 		if(s.contains('Message: Config file not found'))
-			ASTGUI.Log.Error( ' config file(' + params.filename +') not found ' );	
+			top.log.error( ' config file(' + params.filename +') not found ' );	
 		if(s.contains('Message: Permission denied'))
-			ASTGUI.Log.Error('permission denied for reading file ' + params.filename );
+			top.log.error('permission denied for reading file ' + params.filename );
 
 		return (params.usf) ? new ASTGUI.customObject : [] ;
 	}
@@ -2853,7 +2882,7 @@
 		return toJSO( params.configFile_output );
 	};
 
-	ASTGUI.Log.Ajax("AJAX Request : reading '" +  params.filename + "'");
+	top.log.ajax("AJAX Request : reading '" +  params.filename + "'");
 
 	if( top.sessionData.FileCache.hasOwnProperty(params.filename) &&  top.sessionData.FileCache[params.filename].modified == false){ // if file is in cache and is not modified since
 		var s = top.sessionData.FileCache[params.filename].content ;
@@ -2867,11 +2896,11 @@
 
 	if( s.contains('Response: Error') && s.contains('Message: Config file not found') ){
 		// return ASTGUI.globals.fnf; // return 'file not found'
-		ASTGUI.Log.Error( ' config file(' + params.filename +') not found ' );
+		top.log.error( ' config file(' + params.filename +') not found ' );
 		return new ASTGUI.customObject;
 	}
 	if( s.contains('Response: Error') && s.contains('Message: Permission denied') ){
-		ASTGUI.Log.Error('permission denied for reading file ' + params.filename );
+		top.log.error('permission denied for reading file ' + params.filename );
 		return new ASTGUI.customObject;
 	}
 
@@ -2933,7 +2962,7 @@
 
 		var cnt = "" + this.actionCount;
 		if(this.actionCount > 5){
-			ASTGUI.Log.Error('AG150'); // alert to developer
+			top.log.error('AG150'); // alert to developer
 		}
 		while(cnt.length < 6){ cnt = "0" + cnt; }
 		this.params['Action-' + cnt] = action; // jquery takes care of encodeURIComponent(action) 
@@ -2956,7 +2985,7 @@
 	callActions: function(){
 		if(!this.actionCount){ return 'Response: Success'; }
 		if(top.sessionData.DEBUG_MODE ){
-			ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(this.params) + "'"); 
+			top.log.ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(this.params) + "'"); 
 		}
 		var s = $.ajax({ url: ASTGUI.paths.rawman, data: this.params , async: false });
 		return s.responseText;
@@ -3081,7 +3110,7 @@
 		var start_sqreqs = function(st){
 			var f = treq[ 'act_' + st ];
 			if(f){
-				ASTGUI.Log.Ajax("AJAX Request : '" + pre_uri + f + "'");
+				top.log.ajax("AJAX Request : '" + pre_uri + f + "'");
 				$.ajax({ type: "GET", url: ASTGUI.paths.rawman, data: pre_uri + f , success: function(msg){
 					if( msg && typeof msg == 'string' && msg.contains('Response: Error') && msg.contains('Message:') ){
 						var err_msg = msg.afterStr('Message:');
@@ -3104,7 +3133,7 @@
 		if( top.sessionData ){
 			window.onerror = function(err, url, errcode ){ // Log any errors on this page
 				var msg = 'ErrorCode / LineNumber : ' + errcode  + '<BR> Error : ' + err + '<BR> Location: ' + url ;
-				ASTGUI.Log.Error(msg);
+				top.log.error(msg);
 				ASTGUI.dialog.hide();
 				if( top.sessionData && top.sessionData.DEBUG_MODE ){ // show alerts only in debug mode
 					var alertmsg = 'ErrorCode / LineNumber : ' + errcode  + '\n Error : ' + err + '\n Location: ' + url ;

Modified: team/rbrindley/features_revamp/config/js/backup.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/backup.js?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/js/backup.js (original)
+++ team/rbrindley/features_revamp/config/js/backup.js Wed Apr  8 14:29:35 2009
@@ -40,7 +40,7 @@
 		return;
 	}
 	if(!top.sessionData.httpConf.postmappings_defined || !top.sessionData.httpConf.uploadPaths['backups'] ){
-		ASTGUI.Log.Error('AG102');
+		top.log.error('AG102');
 		$('#uploadForm_container').hide();
 		return ;
 	}

Modified: team/rbrindley/features_revamp/config/js/bulkadd.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/bulkadd.js?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/js/bulkadd.js (original)
+++ team/rbrindley/features_revamp/config/js/bulkadd.js Wed Apr  8 14:29:35 2009
@@ -50,7 +50,7 @@
 var create_NEW_USERS = function(){
 	var addUser_OR_reloadGUI = function(){
 		var tmp_first_user = newusers_list[0];
-		parent.astgui_manageusers.addUser( tmp_first_user , NEW_USERS[tmp_first_user] , function(){
+		parent.pbx.users.add( tmp_first_user , NEW_USERS[tmp_first_user] , function(){
 			newusers_list.splice(0,1);
 			if( newusers_list.length ){
 				addUser_OR_reloadGUI();
@@ -121,7 +121,7 @@
 		}
 
 		newusers_list.push(tmp_nu);
-			ASTGUI.Log.Debug( 'adding user ' + tmp_nu);
+			top.log.debug( 'adding user ' + tmp_nu);
 			NEW_USERS[ tmp_nu ] = {} ;
 			NEW_USERS[ tmp_nu ]['fullname'] = 'User ' + tmp_nu;
 			NEW_USERS[ tmp_nu ]['cid_number'] = tmp_nu;

Modified: team/rbrindley/features_revamp/config/js/callingrules.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/callingrules.js?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/js/callingrules.js (original)
+++ team/rbrindley/features_revamp/config/js/callingrules.js Wed Apr  8 14:29:35 2009
@@ -68,6 +68,8 @@
 			ASTGUI.selectbox.selectOption(DOM_new_crl_fotrunk, tmp_cr.secondTrunk );
 			DOM_new_crl_fotr_stripx.value = tmp_cr.stripdigits_secondTrunk ;
 			DOM_new_crl_fotr_prepend.value = tmp_cr.secondPrepend ;
+		} else {
+			DOM_new_crl_foChkbx.checked = false;
 		}
 		en_db_fofields();
 	}
@@ -106,10 +108,10 @@
 		ASTGUI.events.add( DOM_new_crl_foChkbx, 'change' , en_db_fofields);
 		ASTGUI.events.add( DOM_new_cr_button , 'click' ,  newCallingRule_form);
 
-		var t = parent.astgui_managetrunks.listofAllTrunks();
+		var t = parent.pbx.trunks.list();
 		var TMP_FORSORT = [];
 		t.each(function(item){
-			TMP_FORSORT.push( parent.astgui_managetrunks.misc.getTrunkName(item) + ':::::::' +  item);
+			TMP_FORSORT.push( parent.pbx.trunks.getName(item) + ':::::::' +  item);
 		});
 		TMP_FORSORT.sort();
 		TMP_FORSORT.each( function(this_str){
@@ -186,8 +188,8 @@
 				addCell( newRow , { html: tmp_cr.pattern });
 
 				if( tmp_cr.hasOwnProperty('firstTrunk') ){
-					addCell( newRow , { html: tmp_cr.firstTrunk ? ( parent.astgui_managetrunks.misc.getTrunkName(tmp_cr.firstTrunk) || '<i><font color=red>Invalid Trunk</font></i>' ) : '<i><font color=red>None Assigned</font></i>' });
-					addCell( newRow , { html: tmp_cr.secondTrunk ? ( parent.astgui_managetrunks.misc.getTrunkName(tmp_cr.secondTrunk) || '<i><font color=red>Invalid Trunk</font></i>' ): '<i>None Selected</i>' });
+					addCell( newRow , { html: tmp_cr.firstTrunk ? ( parent.pbx.trunks.getName(tmp_cr.firstTrunk) || '<i><font color=red>Invalid Trunk</font></i>' ) : '<i><font color=red>None Assigned</font></i>' });
+					addCell( newRow , { html: tmp_cr.secondTrunk ? ( parent.pbx.trunks.getName(tmp_cr.secondTrunk) || '<i><font color=red>Invalid Trunk</font></i>' ): '<i>None Selected</i>' });
 				}else{
 					addCell( newRow , { html:  '<i><font color=blue>Local Destination : ' + ASTGUI.parseContextLine.showAs(tmp_cr.destination) + '</font></i>', align: 'left', colspan : 2 });
 				}
@@ -306,7 +308,7 @@
 		}
 	}else{
 		var t1 = ASTGUI.getFieldValue(DOM_new_crl_trunk);
-		var t2 = ASTGUI.getFieldValue(DOM_new_crl_fotrunk);
+		var t2 = (DOM_new_crl_foChkbx.checked) ? ASTGUI.getFieldValue(DOM_new_crl_fotrunk) : '';
 		if( _$('new_crl_foChkbx').checked && t1 == t2 ){
 			ASTGUI.feedback( { msg:'Failover trunk can not be same as the primary trunk !', showfor: 3, color:'red' });
 			DOM_new_crl_fotrunk.focus();
@@ -344,13 +346,12 @@
 	}
 
 	if( isNew ){
-		parent.astgui_manageCallingRules.createCallingRule( DOM_new_crl_name.value , as)
+		parent.pbx.calling_rules.add( DOM_new_crl_name.value , as)
 		ASTGUI.feedback( { msg:'CallingRule Created !', showfor:2, color:'green' });
 		window.location.reload();
 	}else{
-		//parent.astgui_manageCallingRules.update( EDIT_CR, DOM_new_crl_name.value , cr_object ) ;
 		parent.ASTGUI.dialog.waitWhile(' Updating ...');
- 		parent.astgui_manageCallingRules.updateCallingRule( EDIT_CR, EDIT_CR_RULE, as )
+ 		parent.pbx.calling_rules.edit( EDIT_CR, EDIT_CR_RULE, as )
 		ASTGUI.feedback( { msg:'Calling Rule Updated !', showfor:2, color:'green' });
 		parent.ASTGUI.dialog.hide();
 		window.location.reload();
@@ -359,7 +360,7 @@
 
 var delete_CR_confirm = function(a,b){
 	if( !confirm('Delete Calling Rule ?') ) return;
-	parent.astgui_manageCallingRules.deleteCallingRule(a,b);
+	parent.pbx.calling_rules.remove(a,b);
 	ASTGUI.feedback( { msg:'Calling Rule Deleted !', showfor:2, color:'red' });
 	window.location.reload();
 };

Modified: team/rbrindley/features_revamp/config/js/cdr.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/features_revamp/config/js/cdr.js?view=diff&rev=4724&r1=4723&r2=4724
==============================================================================
--- team/rbrindley/features_revamp/config/js/cdr.js (original)
+++ team/rbrindley/features_revamp/config/js/cdr.js Wed Apr  8 14:29:35 2009
@@ -322,7 +322,7 @@

[... 4346 lines stripped ...]



More information about the asterisk-gui-commits mailing list