bkruse: branch bkruse/dahdi_integration r4101 - in /team/bkruse/dahdi_integra...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Nov 12 15:07:13 CST 2008


Author: bkruse
Date: Wed Nov 12 15:07:12 2008
New Revision: 4101

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4101
Log:
Merge with branches/2.0

Added:
    team/bkruse/dahdi_integration/config/paging.html
      - copied unchanged from r4100, branches/2.0/config/paging.html
    team/bkruse/dahdi_integration/config/registerg729.html
      - copied unchanged from r4100, branches/2.0/config/registerg729.html
    team/bkruse/dahdi_integration/other/
      - copied from r4100, branches/2.0/other/
    team/bkruse/dahdi_integration/other/sqlite.js
      - copied unchanged from r4100, branches/2.0/other/sqlite.js
    team/bkruse/dahdi_integration/scripts/registerg729.sh
      - copied unchanged from r4100, branches/2.0/scripts/registerg729.sh
Modified:
    team/bkruse/dahdi_integration/   (props changed)
    team/bkruse/dahdi_integration/config/backup.html
    team/bkruse/dahdi_integration/config/flashupdate.html
    team/bkruse/dahdi_integration/config/incoming.html
    team/bkruse/dahdi_integration/config/index.html
    team/bkruse/dahdi_integration/config/js/astman.js
    team/bkruse/dahdi_integration/config/js/index.js
    team/bkruse/dahdi_integration/config/js/jquery.js
    team/bkruse/dahdi_integration/config/js/pbx.js
    team/bkruse/dahdi_integration/config/js/tooltip.js
    team/bkruse/dahdi_integration/config/menuprompts_record.html
    team/bkruse/dahdi_integration/config/preferences.html
    team/bkruse/dahdi_integration/config/ringgroups.html
    team/bkruse/dahdi_integration/config/smtp_settings.html
    team/bkruse/dahdi_integration/config/sysinfo.html
    team/bkruse/dahdi_integration/config/timezone.html
    team/bkruse/dahdi_integration/config/users.html
    team/bkruse/dahdi_integration/config/voicemail.html
    team/bkruse/dahdi_integration/config/welcome.html
    team/bkruse/dahdi_integration/scripts/restorebackup
    team/bkruse/dahdi_integration/scripts/takebackup

Propchange: team/bkruse/dahdi_integration/
------------------------------------------------------------------------------
    svnmerge-integrated = /branches/2.0:1-4071

Modified: team/bkruse/dahdi_integration/config/backup.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/backup.html?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/backup.html (original)
+++ team/bkruse/dahdi_integration/config/backup.html Wed Nov 12 15:07:12 2008
@@ -258,6 +258,13 @@
 	var bkpfile =  "backup_" + year + month + day + "_" + hour + minute + seconds ;
 
 	ASTGUI.updateFieldToValue( 'newbkp_name', bkpfile );
+	
+	if( parent.sessionData.PLATFORM.isAA50 ){
+	 	$(".AA50only").show();
+	}else{
+		$(".AA50only").hide();
+	}
+	
 	$('#newbkp_content').show() ;
 	_$('newbkp_name').focus();
 }
@@ -283,7 +290,13 @@
 	var bkpfile =  _nn.value +"__" + year + month + day +".tar";
 
 	if( parent.sessionData.PLATFORM.isAA50  ){
-		parent.ASTGUI.systemCmd( ASTGUI.scripts.takeBackup + ' ' +  bkpPath + bkpfile , function(){
+		var fullback = _$('newbkp_completeBackup').checked ;
+		if(fullback){
+			var tmp_script = ASTGUI.scripts.takeBackup + ' ' +  bkpPath + bkpfile + ' ' + 'YES';
+		}else{
+			var tmp_script = ASTGUI.scripts.takeBackup + ' ' +  bkpPath + bkpfile ;
+		}
+		parent.ASTGUI.systemCmd( tmp_script , function(){
 			ASTGUI.feedback( { msg:'Backup Successful', showfor:2 });
 			window.location.reload();
 		}) ;
@@ -351,7 +364,13 @@
 		<tr>	<td class="field_text" align="right">File Name:&nbsp;</td>
 			<td><input id='newbkp_name' size=25 class="input9" validation='alphanumericUnd' required='yes'></td>
 		</tr>
+		
+		<tr class='AA50only'>	<td colspan=2 align=center height=6></td>	</tr>
+		<tr class='AA50only'>	<td class="field_text" align="right"> Complete Backup:&nbsp;</td>
+				<td><input type='checkbox' id='newbkp_completeBackup' class="input9"></td>
+		</tr>
 		<tr>	<td colspan=2 align=center height=6></td>	</tr>
+		
 		<tr>	<td colspan=2 align=center>
 				<span class='guiButtonCancel' id="cancel_a" onclick='cancel_newbackup();'>Cancel</span>
 				<span class='guiButtonEdit' id="getbackup" onclick='backup_new();'>Backup</span>

Modified: team/bkruse/dahdi_integration/config/flashupdate.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/flashupdate.html?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/flashupdate.html (original)
+++ team/bkruse/dahdi_integration/config/flashupdate.html Wed Nov 12 15:07:12 2008
@@ -167,7 +167,7 @@
 	var c = config2json({filename:'http.conf', usf:1});
 	_$('tdupload').style.display = ( c.hasOwnProperty('post_mappings') && c['post_mappings'].hasOwnProperty('uploads') && c['post_mappings']['uploads'] == uImage_uploadpath) ? '' : 'none';
 
-	ASTGUI.systemCmdWithOutput( "ls /var/lib/asterisk/sounds/asteris*" , function(a){
+	ASTGUI.systemCmdWithOutput( "ls /var/lib/asterisk/sounds/a*" , function(a){
 		if( a.contains('/var/lib/asterisk/sounds/asteriskoverlay') ){
 			_$('uploadOVERLAY_iframe').src = "upload_form.html" ;
 			$("#overlayUpload_TR").show();

Modified: team/bkruse/dahdi_integration/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/incoming.html?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/incoming.html (original)
+++ team/bkruse/dahdi_integration/config/incoming.html Wed Nov 12 15:07:12 2008
@@ -87,12 +87,11 @@
 
 		var tmp_edit_itrl_tf = EDIT_CONTEXT_IR.afterStr( ASTGUI.contexts.TimeIntervalPrefix ) ;
 
-		//$('.hideOnEdit').hide();
+		$('.hideOnEdit').hide();
 		_$('div_ir_edit_title').innerHTML = 'Edit Incoming Calling Rule, Trunk: ' + tmp_TRUNK + ' , Time Interval: ' + ( tmp_edit_itrl_tf || 'none' ) ;
 
 		ASTGUI.updateFieldToValue( 'edit_itrl_trunk',  tmp_TRUNK ) ;
 		ASTGUI.updateFieldToValue( 'edit_itrl_tf', tmp_edit_itrl_tf ) ;
-
 		ASTGUI.updateFieldToValue( 'edit_itrl_pattern', ASTGUI.parseContextLine.getExten( EDIT_CONTEXT_IR_LINE ) );
 
 		$('.localext_byDid').hide();

Modified: team/bkruse/dahdi_integration/config/index.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/index.html?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/index.html (original)
+++ team/bkruse/dahdi_integration/config/index.html Wed Nov 12 15:07:12 2008
@@ -165,6 +165,10 @@
 			<div class="ui-accordion-link">Voicemail</div>
 			<div class="ui-accordion-desc">General settings for voicemail.</div>
 		</div>
+		<div page='paging.html'>
+			<div class="ui-accordion-link">Paging/Intercom</div>
+			<div class="ui-accordion-desc">Set up 1-Way Paging or 2-Way Intercom for calling individial or group of extensions</div>
+		</div>
 		<div page='meetme.html'>
 			<div class="ui-accordion-link">Conferencing</div>
 			<div class="ui-accordion-desc">MeetMe conference bridging allows quick, ad-hoc conferences with or without security.</div>
@@ -196,6 +200,10 @@
 		<div page='networking.html' class='forAA50'>
 			<div class="ui-accordion-link">Networking</div>
 			<div class="ui-accordion-desc">Configures networking parameters.</div>
+		</div>
+		<div page='registerg729.html' class='forAA50'>
+			<div class="ui-accordion-link">G.729 Codec</div>
+			<div class="ui-accordion-desc">Register & Manage your G.729 Codec License Keys</div>
 		</div>
 		<div page='backup.html'>
 			<div class="ui-accordion-link">Backup</div>

Modified: team/bkruse/dahdi_integration/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/astman.js?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/js/astman.js (original)
+++ team/bkruse/dahdi_integration/config/js/astman.js Wed Nov 12 15:07:12 2008
@@ -258,6 +258,10 @@
 		return this.split(X).join(Y);
 	};
 
+	String.prototype.nl2br = function(){ // replace new lines with <BR>
+		return this.split('\n').join('<BR>');
+	};
+
 	String.prototype.strip = function(){
 		try {
 			return this.replace(/^\s+|\s+$/g, "");
@@ -310,12 +314,14 @@
 		GUI_DB : 'astgui', // name of the ASTDB database used by GUI -- ASTGUI.globals.GUI_DB
 		msg_notLoggedIn: 'Message: Authentication Required',
 		configfile : 'guipreferences.conf', // will be created if the file does not exist , ASTGUI.globals.configfile
+		g729RegInfo: 'g729reginfo.conf', // ASTGUI.globals.g729RegInfo, the ASTGUI.scripts.Registerg729 script will read this file to generate tab delimited file
 		hwcfgFile: 'gui_confighw.conf', // file to store configured hardware information
 		zaptelIncludeFile: 'zaptel_guiRead.conf', // file that will be used to read zapte.conf, ASTGUI.globals.zaptelIncludeFile
 		pingInterval : 5000,
 		app_factoryReset : '/bin/reset_config', // ASTGUI.globals.app_factoryReset
 		fnf : 'ERROR:FNF',
 		obcidstr : 'GLOBAL_OUTBOUNDCID', // ASTGUI.globals.obcidstr
+		obcidNamestr : 'GLOBAL_OUTBOUNDCIDNAME', // ASTGUI.globals.obcidNamestr
 		obcidUsrPrefix : 'CID_', // ASTGUI.globals.obcidUsrPrefix
 		sbcid_1 : 's,1,ExecIf($[ "${CALLERID(num)}"="" ],SetCallerPres,unavailable)', // ASTGUI.globals.sbcid_1
 		sbcid_2 : 's,2,ExecIf($[ "${CALLERID(num)}"="" ],Set,CALLERID(all)=unknown <0000000>)',
@@ -332,6 +338,8 @@
 		TrunkDefaultSuffix : '_default', // ASTGUI.contexts.TrunkDefaultSuffix - to create 'DID_trunk_default' that will be included in [DID_trunk]
 		RingGroupPrefix: 'ringroups-custom-', // ASTGUI.contexts.RingGroupPrefix 
 		RingGroupExtensions: 'ringgroups', // ASTGUI.contexts.RingGroupExtensions
+		PageAnExtension :'page_an_extension', // ASTGUI.contexts.PageAnExtension
+		PageGroups : 'pagegroups', // ASTGUI.contexts.PageGroups
 		TimeBasedRulePrefix: 'timebasedrule-custom-', // ASTGUI.contexts.TimeBasedRulePrefix 
 		TimeIntervalPrefix: 'timeinterval_', // ASTGUI.contexts.TimeIntervalPrefix
 		VoiceMenuPrefix: 'voicemenu-custom-', // ASTGUI.contexts.VoiceMenuPrefix
@@ -440,11 +448,20 @@
 	},
 
 	cliCommand : function(cmd) { // ASTGUI.cliCommand(cmd);
+		if( typeof cmd != 'string' ) {
+			ASTGUI.Log.Warn( 'cliCommand: Expecting cmd as String' );
+			return '';
+		}
 		ASTGUI.Log.Debug("Executing manager command : '" + cmd + "'");
 		return makeSyncRequest ( { action :'command', command: cmd } );
 	},
 
 	getUser_DeviceStatus : function( usr ){ // ASTGUI.getUser_DeviceStatus(usr) 
+		if( typeof usr == 'number' ) usr = String(usr);
+		if( typeof usr != 'string' ){
+			ASTGUI.Log.Warn( 'getUser_DeviceStatus: Expecting usr as String' );
+			return 'U';
+		}
 		var t = makeSyncRequest({ action :'ExtensionState', Exten: usr }) ;
 		if( t.contains('Status: 0') ) return 'F' ; // No Device is Busy/InUse
 		if( t.contains('Status: 1') ) return 'B' ; // 1 or more devices InUse
@@ -474,9 +491,14 @@
 	},
 
 	mailboxCount : function(mbox){ // ASTGUI.mailboxCount(mox) ; --> returns the number of New/Old Messages in mbox's mailbox
+		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' );
+			return tr;
+		}
 		if(!mbox.contains('@')){ mbox = mbox + '@default' ; }
 		var t = makeSyncRequest ( { action :'MailboxCount', Mailbox: mbox } );
-		var tr = { count_new:0 , count_old : 0 };
 		try{
 			var lines = t.split('\n');
 			lines.each(function( this_line){
@@ -618,7 +640,7 @@
 						y.blur();
 					}
 				}catch(err){
-
+					ASTGUI.Log.Error(err.description);
 				}
 			};
 			setTimeout( sf, 150 );
@@ -785,6 +807,7 @@
 
 	domActions: {
 		alignBbelowA: function(a,b, offsetLeft, offsetTop ){
+			try{
 			if ( typeof a == 'string'){ a = _$(a) ; }
 			if ( typeof b == 'string'){ b = _$(a) ; }
 			b.style.position = 'absolute';
@@ -799,6 +822,9 @@
 			}
 			b.style.left = tmp_left + ( offsetLeft || 0 );
 			b.style.top = tmp_top + (offsetTop || 1);
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+			}
 		},
 
 		alignBontopofA: function(a,b){ // ASTGUI.domActions.alignBontopofA();
@@ -808,7 +834,7 @@
 				ASTGUI.domActions.alignBbelowA(a,b);
 				b.style.top = b.style.top - a.offsetHeight ;
 			}catch(err){
-
+				ASTGUI.Log.Error(err.description);
 			}
 		},
 
@@ -922,6 +948,7 @@
 		},
 
 		tr_addCell: function(tr, nc){ // usage :: ASTGUI.domActions.tr_addCell( el, { html:'newCell Text' , align:'center', width:'20px' }  )
+			try{
 			var ih = nc.html; delete nc.html;
 			var newcell = tr.insertCell( tr.cells.length );
 			if( nc.id ){ newcell.id = nc.id ; delete nc.id; }
@@ -940,7 +967,9 @@
 					}
 				}
 			}
-
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+			}
 		},
 
 		unCheckAll: function(x){ // uncheck all checkboxes of class x
@@ -953,6 +982,7 @@
 		populateCheckBoxes: function( div, values, ofclass, withBR){ // ASTGUI.domActions.populateCheckBoxes(div, values, ofclass);
 			// represent 'array values' OR 'Object values' as a list of checkboxes of class 'ofclass' as childnodes of element 'div'
 			// Ex: values = { '1':'One', '1':'Two' } or values = [1,2]
+			try{
 			var c = {};
 			if(ASTGUI.isArray(values)){
 				values.each( function(tv){ c[tv] = tv; } );
@@ -979,6 +1009,9 @@
 					nbr.appendChild(lbl) ;
 					div.appendChild( nbr ) ;
 				}
+			}
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
 			}
 		},
 
@@ -1122,6 +1155,7 @@
 		*/
 		// 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' ){
@@ -1166,7 +1200,9 @@
 		//var uname_lc = uname.toLowerCase();
 		// TODO: come up with a better alternative than this
 		// cli output of 'sip show registry' shows only a part of long usernames
-		var uname_lc = uname.toLowerCase().substr(0,12);
+		// We should use action: status like we do for active channel monitoring.
+		
+		var uname_lc = uname.toLowerCase().substr(0,10);
 
 		for(var i = 0; i < lines.length; i++) {
 			var line = lines[i].trim().toLowerCase();
@@ -1188,6 +1224,9 @@
 			}
 		}
 		return '<font color=red>Unregistered</font>';
+		}catch(err){
+			ASTGUI.Log.Error(err.description);
+		}
 	},
 
 	parseGETparam : function(url_string, getparam ){ // ASTGUI.parseGETparam( url , 'EXTENSION_EDIT');
@@ -1227,6 +1266,7 @@
 	},
 
 	listSystemFiles : function( dir , cb ){
+		try{
 		this.systemCmd( this.scripts.ListFiles + ' ' +  dir , function(){
 			var op = ASTGUI.loadHTML( ASTGUI.paths.output_SysInfo );
 			var tmp_files = op.split('\n');
@@ -1239,10 +1279,15 @@
 			}
 			cb(files);
 		});
+		}catch(err){
+			ASTGUI.Log.Error(err.description);
+			cb([]);
+		}
 	},
 
 	miscFunctions: {
 		getChunksFromManagerOutput : function( op , usf){ // ASTGUI.miscFunctions.getChunksFromManagerOutput( output_str ) ;
+			try{
 			var tr_Array = [];
 			var tmp_chunk = (usf) ? {} : [] ;
 			var count = 0;
@@ -1271,6 +1316,10 @@
 			}
 
 			return tr_Array ;
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+				return [] ;
+			}
 		},
 
 
@@ -1293,6 +1342,7 @@
 		},
 			
 		moveUpDown_In_context: function(context, line , updown , cbf ){ 	// ASTGUI.miscFunctions.moveUpDown_In_context( ct , line , bool , cbf ) // bool = 0 for Down , 1 for Up 
+			try{
 			updown = Number(updown);
 			var t = context2json({ filename:'extensions.conf' , context : context , usf: 0 });
 	
@@ -1322,9 +1372,13 @@
 					cbf(t);
 				});
 			}});
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+			}
 		},
 
 		empty_context: function( ct ){ // ASTGUI.miscFunctions.empty_context({ filename:'somefile.conf', context : 'context_x', cb : fn })
+			try{
 			if( parent.sessionData.PLATFORM.isAST_1_6 ){
 				var u = new listOfSynActions(ct.filename);
 				u.new_action('emptycat', ct.context , '', '' ) ;
@@ -1341,10 +1395,14 @@
 				});
 				x.callActions(ct.cb);
 			}
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+			}
 		},
 
 		delete_LinesLike: function( ct ){
 			// ASTGUI.miscFunctions.delete_LinesLike({ context_name : 'voicemailgroups' , beginsWithArr: ['exten=6050,'] , filename: 'extensions.conf', hasThisString:'somestring', cb:function(){} });
+			try{
 			var sel_cxt = context2json({ filename: ct.filename, context : ct.context_name , usf:0 });
 			if ( typeof ct.beginsWithArr == 'string' ){
 				ct.beginsWithArr = [ct.beginsWithArr];
@@ -1373,10 +1431,15 @@
 			});
 
 			x.callActions(ct.cb);
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+				ct.cb();
+			}
 		},
 
 		chanStringToArray: function(chs){ // ASTGUI.miscFunctions.chanStringToArray();
 			// expects chs as '5' or '5-8' or '5,6,7,8' and returns [5] or [5,6,7,8]
+			try{
 			if ( !chs ) return [];
 			if ( typeof chs != 'string') chs = String(chs) ;
 			chs = chs.trim();
@@ -1399,6 +1462,10 @@
 			}
 
 			return [chs];
+			}catch(err){
+				ASTGUI.Log.Warn( err.description );
+				return [chs];
+			}
 		},
 
 		alertIfRangeisNotdefined: function(a , b, for_what){ // ASTGUI.miscFunctions.alertIfRangeisNotdefined();
@@ -1499,6 +1566,7 @@
 	parseContextLine: {
 		read: function(q){ // ASTGUI.parseContextLine.read();
 			// expects q as 'blah=foo' and returns ['blah','foo']
+			if (typeof q != 'string') return [];
 			var v = q.indexOf("=");
 			if( v == -1){ return []; }
 			return  [q.substring(0,v), q.substr(v+1)];
@@ -1508,6 +1576,7 @@
 			// use this when you want to get the pattern from a calling rule
 			// expects q as 'exten=_X.,1,foo' or '_X.,1,foo'
 			//	and returns _X.
+			if (typeof q != 'string') return '';
 			if( !q || !q.contains(',') ) { return ''; }
 			if( q.match('exten=') ){
 				return q.split('exten=')[1].split(',')[0];
@@ -1518,6 +1587,7 @@
 
 		getPriority: function(q){ // ASTGUI.parseContextLine.getPriority();
 			// expects  q  as 'exten=s,2,foo' OR 's,2,foo'   and   returns 2
+			if (typeof q != 'string') return '';
 			if( q.match('exten=') ){
 				return q.split('exten=')[1].split(',')[1].trim();
 			}else{
@@ -1528,7 +1598,7 @@
 		getAppWithArgs: function(q){ // ASTGUI.parseContextLine.getAppWithArgs();
 			// expects  q  as 'exten=s,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss,ssdsd,assd)' OR even 'foo(ssssssss,ssdsd,assd)'
 			//	and   returns 'foo(ssssssss,ssdsd,assd)' ;  app with arguments(if any)
-
+			if (typeof q != 'string') return '';
 			if( !q.contains('(') ){ // if q == something like 's,n,Hangup' return 'Hangup'
 				var l = q.lastIndexOf(',');
 				return q.substring(l+1);
@@ -1548,6 +1618,7 @@
 		getApp: function(q){ // ASTGUI.parseContextLine.getApp();
 			// expects  q  as 'exten=s,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss,ssdsd,assd)'   
 			//	and   returns 'foo' ;// appname -- without arguments
+			if (typeof q != 'string') return '';
 			var y = ASTGUI.parseContextLine.getAppWithArgs(q);
 			return ( y.contains('(') ) ? y.split('(')[0].trim() : y.trim() ;
 		},
@@ -1556,7 +1627,7 @@
 			// 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') return [];
 			q = q.trim();
 			if ( !q.endsWith(')') || !q.contains('(') ){
 				ASTGUI.Log.Error( "ASTGUI.parseContextLine.getArgs() - No Argument found for \"" + q + "\" " );
@@ -1569,6 +1640,7 @@
 		},
 
 		getArgsArrayFromArgsString: function(x){ // expects x as 'context,exten,pri' or 'context|exten|pri'
+			if (typeof x != 'string') return [];
 			if(x.contains('|') ){
 				return x.split('|');
 			}
@@ -1580,6 +1652,7 @@
 
 		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('(') ) {
 				return this.getArgsArrayFromArgsString(y);
 			}
@@ -1590,6 +1663,7 @@
 
 		toKnownContext: function(args){  // usage ASTGUI.parseContextLine.toKnownContext(y)
 			// converts args to a readable format - ex: default|6000|1 to 'user 6000'
+			try{
 			if(typeof args == 'string'){
 				args = this.getArgsArrayFromArgsString(args);
 			}
@@ -1629,6 +1703,10 @@
 				return 'Goto VoiceMail Group -- ' + (( t[args[1]] && t[args[1]]['label']) || args[1] ) ;
 			}
 			return 'Goto ' + args.join() ;
+			}catch(err){
+				ASTGUI.Log.Error(err.description);
+				return 'Goto ' + args.join() ;
+			}
 		},
 
 		showAs : function(q){ // ASTGUI.parseContextLine.showAs(line)
@@ -1636,7 +1714,10 @@
 			// 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');
+				return '??';
+			}
 			var app = ASTGUI.parseContextLine.getApp(q) ;
 			var args = ASTGUI.parseContextLine.getArgs(q) ;
 			var q_LC = q.toLowerCase();
@@ -1745,6 +1826,10 @@
 
 		parseTrunkDialArgument: function(y){ // usage ASTGUI.parseContextLine.parseTrunkDialArgument(y)
 			// expects y as  '${trunk_1}/XXX${EXTEN:X}' OR SIP/user/XXX${EXTEN:X}
+			if (typeof y != 'string') {
+				ASTGUI.Log.Error('ASTGUI.parseContextLine.parseTrunkDialArgument: expecting y as string');
+				return null;
+			}
 			var WhatToDial = '';
 			if (!y) {
 				return null;
@@ -1800,6 +1885,10 @@
 						stripdigits_secondTrunk : 2
 					}
 			*/
+			if (typeof str != 'string') {
+				ASTGUI.Log.Error('ASTGUI.parseContextLine.obCallingRule: expecting str as string');
+				return null;
+			}
 
 			var cr = { };
 			cr.actualString = str ;
@@ -1830,6 +1919,7 @@
 	},
 
 	resetTheseFields : function( flds ){ // ASTGUI.resetTheseFields(arr) , flds = [ el1, el2 , el_3 ] ; - sets each element to blank value
+		if( typeof flds == 'string' ){ flds = [flds]; }
 		if(!ASTGUI.isArray(flds)){ return; }
 		var reset_el = function(el){
 			var tmp_dfalt = $(el).attr('dfalt');
@@ -1874,7 +1964,13 @@
 			// 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 ( typeof el == 'string'){
+				el = _$(el) ;
+				if( !el ){
+					ASTGUI.Log.Error( 'No Element by that id ' );
+					return;
+				}
+			}
 			el.selectedIndex = -1;
 			if(!dest){return;}
 
@@ -1908,13 +2004,7 @@
 			var dest_args_v = 'Goto('+ args.join('|') + ')';
 			var dest_args_c = 'Goto('+ args.join(',') + ')' ;
 
-			for( var i=0; i< el.options.length ; i++ ){
-				//console.log(' **** ');
-				//console.log(' OPTION vale is *' + el.options[i].value + '*');
-				//console.log(' dest_args_c is *' + dest_args_c+ '*');
-				//console.log(' dest_args_v is *' + dest_args_v+ '*');
-				//console.log(' args_v is *' + args_v+ '*');
-				//console.log(' args_c is *' + args_c+ '*');
+			for( var i=0, j = el.options.length ; i < j ; i++ ){
 				if( (el.options[i].value == dest_args_v) || (el.options[i].value == dest_args_c) || (el.options[i].value == args_v) || (el.options[i].value == args_c )){
 					// the select box option vale could be 'goto(context,exten,priority)' or 'Hangup' or just 'context,exten,priority'
 					el.selectedIndex = i;
@@ -2521,6 +2611,7 @@
 ASTGUI.scripts['generateZaptel'] = 'sh ' + ASTGUI.paths['scripts'] + 'editzap.sh';
 ASTGUI.scripts['generatemISDN_init'] = 'sh ' + ASTGUI.paths['scripts'] + 'editmisdn.sh';
 ASTGUI.scripts['dldsoundpack'] = 'sh ' + ASTGUI.paths['scripts'] + 'dldsoundpack';
+ASTGUI.scripts['Registerg729'] = 'sh ' + ASTGUI.paths['scripts'] + 'registerg729.sh';
 
 ASTGUI.apps = {};
 ASTGUI.apps['Ztscan'] = 'ztscan > ' + ASTGUI.paths['asteriskConfig'] +'ztscan.conf' ;
@@ -2528,7 +2619,7 @@
 ASTGUI.apps['mISDNscan'] = 'misdn-init scan' ;
 ASTGUI.apps['flashupdate'] = 'flashupdate' ;
 
-ASTGUI.includeContexts = [ 'default' , 'parkedcalls' , ASTGUI.contexts.CONFERENCES , ASTGUI.contexts.RingGroupExtensions , ASTGUI.contexts.VoiceMenuExtensions , ASTGUI.contexts.QUEUES , ASTGUI.contexts.VoiceMailGroups , ASTGUI.contexts.Directory ] ;
+ASTGUI.includeContexts = [ 'default' , 'parkedcalls' , ASTGUI.contexts.CONFERENCES , ASTGUI.contexts.RingGroupExtensions , ASTGUI.contexts.VoiceMenuExtensions , ASTGUI.contexts.QUEUES , ASTGUI.contexts.VoiceMailGroups , ASTGUI.contexts.Directory, ASTGUI.contexts.PageGroups , ASTGUI.contexts.PageAnExtension] ;
 
 ASTGUI.customObject.prototype = {
 	getProperty: function(p){
@@ -2933,9 +3024,16 @@
 			var f = treq[ 'act_' + st ];
 			if(f){
 				ASTGUI.Log.Ajax("AJAX Request : '" + pre_uri + f + "'");
-				$.ajax({ type: "GET", url: ASTGUI.paths.rawman, data: pre_uri + f , success: function(msg){start_sqreqs(st+1);} });
+				$.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:');
+						callback(false, err_msg);
+					}else{
+						start_sqreqs(st+1);
+					}
+				}});
 			}else{
-				setTimeout( function(){ ajxs.style.display = 'none'; callback(); }, 500 ) ;
+				setTimeout( function(){ ajxs.style.display = 'none'; callback(true); }, 500 ) ;
 			}
 		};
 		start_sqreqs(1);

Modified: team/bkruse/dahdi_integration/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/index.js?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/js/index.js (original)
+++ team/bkruse/dahdi_integration/config/js/index.js Wed Nov 12 15:07:12 2008
@@ -102,6 +102,7 @@
 					'ulaw' : 'u-law' ,
 					'alaw' : 'a-law' ,
 					'gsm'  : 'GSM' ,
+					'g729' : 'G.729A',
 					'g726' : 'G.726' ,
 					'g722' : 'G.722'
 				};
@@ -451,6 +452,11 @@
 
 
 var miscFunctions = {
+	toDigiumStore: function(a){ // parent.miscFunctions.toDigiumStore('G729CODEC')
+		if(!a) return;
+		var win=window.open('','myWin');
+		win.location.href = 'http://store.digium.com/productview.php?product_code='+ a ;
+	},
 
 	listOfChannels: function() { // miscFunctions.listOfChannels() -- returns an array of current active channels
 		var raw_chan_status = makeSyncRequest ( { action :'status' } );
@@ -826,11 +832,19 @@
 				f.optionValue = (fortbr)? rg + '|s|1' : 'Goto('+ rg +'|s|1)';
 				tmp.push(f);
 			});
+		var y = astgui_managePageGroups.getPGsList();
+			y.each(function(pge){
+				var f = new destination;
+				f.optionText = 'Page Group -- ' + pge ;
+				f.optionValue = 'Goto('+ ASTGUI.contexts.PageGroups +'|'+ pge +'|1)';
+				tmp.push(f);
+			});
+
 		var y = sessionData.pbxinfo.vmgroups.getOwnProperties();
 			y.each(function( this_vmg_exten ){
 				var f = new destination;
 				f.optionText = 'VoiceMail Group -- ' + (sessionData.pbxinfo.vmgroups[this_vmg_exten].getProperty('label') || this_vmg_exten ) ;
-				f.optionValue = (fortbr) ? ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1' : 'Goto('+ ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1)'; ;
+				f.optionValue = (fortbr) ? ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1' : 'Goto('+ ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1)' ;
 				tmp.push(f);
 			});
 
@@ -881,7 +895,7 @@
 					tmp.push( tmp_thisRg.extension );
 				}
 			} );
-
+		tmp = tmp.concat( astgui_managePageGroups.getPGsList() );
 		var tmp_LE = ASTGUI.cloneObject(sessionData.pbxinfo['localextensions']);
 		if( tmp_LE.getProperty('defaultDirectory') ){
 			tmp.push( tmp_LE.getProperty('defaultDirectory') );

Modified: team/bkruse/dahdi_integration/config/js/jquery.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/jquery.js?view=diff&rev=4101&r1=4100&r2=4101
==============================================================================
--- team/bkruse/dahdi_integration/config/js/jquery.js (original)
+++ team/bkruse/dahdi_integration/config/js/jquery.js Wed Nov 12 15:07:12 2008
@@ -1,37 +1,34 @@
 (function(){
 /*
- * jQuery 1.2.2 - New Wave Javascript
+ * jQuery 1.2.6 - New Wave Javascript
  *
- * Copyright (c) 2007 John Resig (jquery.com)
+ * Copyright (c) 2008 John Resig (jquery.com)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
  * and GPL (GPL-LICENSE.txt) licenses.
  *
- * $Date: 2008-01-14 17:56:07 -0500 (Mon, 14 Jan 2008) $
- * $Rev: 4454 $
+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
+ * $Rev: 5685 $
  */
 
 // Map over jQuery in case of overwrite
-if ( window.jQuery )
-	var _jQuery = window.jQuery;
-
-var jQuery = window.jQuery = function( selector, context ) {
+var _jQuery = window.jQuery ;
+// Map over the $ in case of overwrite
+//	_$ = window.$;		// Disabled for ASTGUI
+
+var jQuery = window.jQuery = window.$ = function( selector, context ) {
 	// The jQuery object is actually just the init constructor 'enhanced'
-	return new jQuery.prototype.init( selector, context );
+	return new jQuery.fn.init( selector, context );
 };
-
-// Map over the $ in case of overwrite
-//if ( window.$ )
-//	var _$ = window.$;
-	
-// Map the jQuery namespace to the '$' one
-window.$ = jQuery;
 
 // A simple way to check for HTML strings or ID strings
 // (both of which we optimize for)
-var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
 
 // Is it a simple selector
-var isSimple = /^.[^:#\[\.]*$/;
+	isSimple = /^.[^:#\[\.]*$/,
+
+// Will speed up references to undefined, and allows munging its name.
+	undefined;
 
 jQuery.fn = jQuery.prototype = {
 	init: function( selector, context ) {
@@ -43,9 +40,9 @@
 			this[0] = selector;
 			this.length = 1;
 			return this;
-
+		}
 		// Handle HTML strings
-		} else if ( typeof selector == "string" ) {
+		if ( typeof selector == "string" ) {
 			// Are we dealing with HTML string or an ID?
 			var match = quickExpr.exec( selector );
 
@@ -61,53 +58,39 @@
 					var elem = document.getElementById( match[3] );
 
 					// Make sure an element was located
-					if ( elem )
+					if ( elem ){
 						// Handle the case where IE and Opera return items
 						// by name instead of ID
 						if ( elem.id != match[3] )
 							return jQuery().find( selector );
 
 						// Otherwise, we inject the element directly into the jQuery object
-						else {
-							this[0] = elem;
-							this.length = 1;
-							return this;
-						}
-
-					else
-						selector = [];
+						return jQuery( elem );
+					}
+					selector = [];
 				}
 
 			// HANDLE: $(expr, [context])
 			// (which is just equivalent to: $(content).find(expr)
 			} else
-				return new jQuery( context ).find( selector );
+				return jQuery( context ).find( selector );
 
 		// HANDLE: $(function)
 		// Shortcut for document ready
 		} else if ( jQuery.isFunction( selector ) )
-			return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
-
-		return this.setArray(
-			// HANDLE: $(array)
-			selector.constructor == Array && selector ||
-
-			// HANDLE: $(arraylike)
-			// Watch for when an array-like object, contains DOM nodes, is passed in as the selector
-			(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
-
-			// HANDLE: $(*)
-			[ selector ] );
-	},
-	
+			return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+
+		return this.setArray(jQuery.makeArray(selector));
+	},
+
 	// The current version of jQuery being used
-	jquery: "1.2.2",
+	jquery: "1.2.6",
 
 	// The number of elements contained in the matched element set
 	size: function() {
 		return this.length;
 	},
-	
+
 	// The number of elements contained in the matched element set
 	length: 0,
 
@@ -122,7 +105,7 @@
 			// Return just the object
 			this[ num ];
 	},
-	
+
 	// Take an array of elements and push it onto the stack
 	// (returning the new matched element set)
 	pushStack: function( elems ) {
@@ -135,7 +118,7 @@
 		// Return the newly-formed element set
 		return ret;
 	},
-	
+
 	// Force the current matched set of elements to become
 	// the specified array of elements (destroying the stack in the process)
 	// You should use pushStack() in order to do this, but maintain the stack
@@ -144,7 +127,7 @@
 		// is a super-fast way to populate an object with array-like properties
 		this.length = 0;
 		Array.prototype.push.apply( this, elems );
-		
+
 		return this;
 	},
 
@@ -155,33 +138,31 @@
 		return jQuery.each( this, callback, args );
 	},
 
-	// Determine the position of an element within 
+	// Determine the position of an element within
 	// the matched set of elements
 	index: function( elem ) {
 		var ret = -1;
 
 		// Locate the position of the desired element
-		this.each(function(i){
-			if ( this == elem )
-				ret = i;
-		});
-
-		return ret;
+		return jQuery.inArray(
+			// If it receives a jQuery object, the first element is used
+			elem && elem.jquery ? elem[0] : elem
+		, this );
 	},
 
 	attr: function( name, value, type ) {
 		var options = name;
-		
+
 		// Look for the case where we're accessing a style value
 		if ( name.constructor == String )
-			if ( value == undefined )
-				return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined;
+			if ( value === undefined )
+				return this[0] && jQuery[ type || "attr" ]( this[0], name );
 
 			else {
 				options = {};
 				options[ name ] = value;
 			}
-		
+
 		// Check to see if we're setting style values
 		return this.each(function(i){
 			// Set all the styles
@@ -264,7 +245,7 @@
 				this.insertBefore( elem, this.firstChild );
 		});
 	},
-	
+
 	before: function() {
 		return this.domManip(arguments, false, false, function(elem){
 			this.parentNode.insertBefore( elem, this );
@@ -299,16 +280,14 @@
 				// using cloneNode. Calling detachEvent on the
 				// clone will also remove the events from the orignal
 				// In order to get around this, we use innerHTML.
-				// Unfortunately, this means some modifications to 
-				// attributes in IE that are actually only stored 
+				// Unfortunately, this means some modifications to
+				// attributes in IE that are actually only stored
 				// as properties will not be copied (such as the
 				// the name attribute on an input).
 				var clone = this.cloneNode(true),
-					container = document.createElement("div"),
-					container2 = document.createElement("div");
+					container = document.createElement("div");
 				container.appendChild(clone);
-				container2.innerHTML = container.innerHTML;
-				return container2.firstChild;
+				return jQuery.clean([container.innerHTML])[0];
 			} else
 				return this.cloneNode(true);
 		});
@@ -320,7 +299,7 @@
 			if ( this[ expando ] != undefined )
 				this[ expando ] = null;
 		});
-		
+
 		// Copy the events from the original to the clone
 		if ( events === true )
 			this.find("*").andSelf().each(function(i){
@@ -362,24 +341,22 @@
 	},
 
 	add: function( selector ) {
-		return !selector ? this : this.pushStack( jQuery.merge( 
+		return this.pushStack( jQuery.unique( jQuery.merge(
 			this.get(),
-			selector.constructor == String ? 
-				jQuery( selector ).get() :
-				selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ?
-					selector : [selector] ) );
+			typeof selector == 'string' ?
+				jQuery( selector ) :
+				jQuery.makeArray( selector )
+		)));
 	},
 
 	is: function( selector ) {
-		return selector ?
-			jQuery.multiFilter( selector, this ).length > 0 :
-			false;
+		return !!selector && jQuery.multiFilter( selector, this ).length > 0;
 	},
 
 	hasClass: function( selector ) {
 		return this.is( "." + selector );
 	},
-	
+
 	val: function( value ) {
 		if ( value == undefined ) {
 
@@ -392,7 +369,7 @@
 						values = [],
 						options = elem.options,
 						one = elem.type == "select-one";
-					
+
 					// Nothing was selected
 					if ( index < 0 )
 						return null;
@@ -404,18 +381,18 @@
 						if ( option.selected ) {
 							// Get the specifc value for the option
 							value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
-							
+
 							// We don't need an array for one selects
 							if ( one )
 								return value;
-							
+
 							// Multi-Selects return an array
 							values.push( value );
 						}
 					}
-					
+
 					return values;
-					
+
 				// Everything else, we just grab the value
 				} else
 					return (this[0].value || "").replace(/\r/g, "");
@@ -425,6 +402,9 @@
 			return undefined;
 		}
 
+		if( value.constructor == Number )
+			value += '';
+
 		return this.each(function(){
 			if ( this.nodeType != 1 )
 				return;
@@ -434,9 +414,7 @@
 					jQuery.inArray(this.name, value) >= 0);
 
 			else if ( jQuery.nodeName( this, "select" ) ) {
-				var values = value.constructor == Array ?
-					value :
-					[ value ];
+				var values = jQuery.makeArray(value);
 
 				jQuery( "option", this ).each(function(){
 					this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
@@ -450,10 +428,10 @@
 				this.value = value;
 		});
 	},
-	
+
 	html: function( value ) {
 		return value == undefined ?
-			(this.length ?
+			(this[0] ?
 				this[0].innerHTML :
 				null) :
 			this.empty().append( value );
@@ -480,9 +458,34 @@
 	andSelf: function() {
 		return this.add( this.prevObject );
 	},
-	
+
+	data: function( key, value ){
+		var parts = key.split(".");
+		parts[1] = parts[1] ? "." + parts[1] : "";
+
+		if ( value === undefined ) {
+			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+			if ( data === undefined && this.length )
+				data = jQuery.data( this[0], key );
+
+			return data === undefined && parts[1] ?
+				this.data( parts[0] ) :
+				data;
+		} else
+			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+				jQuery.data( this, key, value );
+			});
+	},
+
+	removeData: function( key ){
+		return this.each(function(){
+			jQuery.removeData( this, key );
+		});
+	},
+
 	domManip: function( args, table, reverse, callback ) {
-		var clone = this.length > 1, elems; 
+		var clone = this.length > 1, elems;
 
 		return this.each(function(){
 			if ( !elems ) {
@@ -505,9 +508,9 @@
 					this;
 
 				// execute all scripts after the elements have been injected
-				if ( jQuery.nodeName( elem, "script" ) ) {
+				if ( jQuery.nodeName( elem, "script" ) )
 					scripts = scripts.add( elem );
-				} else {
+				else {
 					// Remove any inner scripts for later evaluation
 					if ( elem.nodeType == 1 )
 						scripts = scripts.add( jQuery( "script", elem ).remove() );
@@ -523,7 +526,7 @@
 };
 
 // Give the init function the jQuery prototype for later instantiation
-jQuery.prototype.init.prototype = jQuery.prototype;
+jQuery.fn.init.prototype = jQuery.fn;
 
 function evalScript( i, elem ) {
 	if ( elem.src )
@@ -540,6 +543,10 @@
 		elem.parentNode.removeChild( elem );
 }
 
+function now(){
+	return +new Date;
+}
+
 jQuery.extend = jQuery.fn.extend = function() {
 	// copy reference to target object
 	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
@@ -557,9 +564,9 @@
 		target = {};
 
 	// extend jQuery itself if only one argument is passed
-	if ( length == 1 ) {
+	if ( length == i ) {
 		target = this;
-		i = 0;
+		--i;
 	}
 
 	for ( ; i < length; i++ )
@@ -567,17 +574,22 @@

[... 3320 lines stripped ...]



More information about the asterisk-gui-commits mailing list