rbrindley: branch rbrindley/welcome_revamp r4235 - in /team/rbrindley/welcome...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Nov 26 20:25:00 CST 2008


Author: rbrindley
Date: Wed Nov 26 20:25:00 2008
New Revision: 4235

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4235
Log:
merged with HEAD of branches/2.0

Added:
    team/rbrindley/welcome_revamp/config/gtalk.html
      - copied unchanged from r4234, branches/2.0/config/gtalk.html
    team/rbrindley/welcome_revamp/config/js/jquery.autocomplete.js
      - copied unchanged from r4234, branches/2.0/config/js/jquery.autocomplete.js
Modified:
    team/rbrindley/welcome_revamp/config/features.html
    team/rbrindley/welcome_revamp/config/hardware.html
    team/rbrindley/welcome_revamp/config/index.html
    team/rbrindley/welcome_revamp/config/js/astman.js
    team/rbrindley/welcome_revamp/config/js/backup.js
    team/rbrindley/welcome_revamp/config/js/cdr.js
    team/rbrindley/welcome_revamp/config/js/feditor.js
    team/rbrindley/welcome_revamp/config/js/hardware.js
    team/rbrindley/welcome_revamp/config/js/hardware_aa50.js
    team/rbrindley/welcome_revamp/config/js/index.js
    team/rbrindley/welcome_revamp/config/js/jquery.js
    team/rbrindley/welcome_revamp/config/js/meetme.js
    team/rbrindley/welcome_revamp/config/js/menuprompts_record.js
    team/rbrindley/welcome_revamp/config/js/menuprompts_upload.js
    team/rbrindley/welcome_revamp/config/js/menus.js
    team/rbrindley/welcome_revamp/config/js/misdn.js
    team/rbrindley/welcome_revamp/config/js/mohfiles.js
    team/rbrindley/welcome_revamp/config/js/networking.js
    team/rbrindley/welcome_revamp/config/js/paging.js
    team/rbrindley/welcome_revamp/config/js/pbx.js
    team/rbrindley/welcome_revamp/config/js/queues.js
    team/rbrindley/welcome_revamp/config/js/registerg729.js
    team/rbrindley/welcome_revamp/config/js/ringgroups.js
    team/rbrindley/welcome_revamp/config/js/sysinfo.js
    team/rbrindley/welcome_revamp/config/js/users.js
    team/rbrindley/welcome_revamp/config/js/vmgroups.js
    team/rbrindley/welcome_revamp/config/language.html
    team/rbrindley/welcome_revamp/config/menus.html
    team/rbrindley/welcome_revamp/config/networking.html
    team/rbrindley/welcome_revamp/config/stylesheets/schwing.css
    team/rbrindley/welcome_revamp/config/timeintervals.html
    team/rbrindley/welcome_revamp/config/users.html

Modified: team/rbrindley/welcome_revamp/config/features.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/features.html?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/features.html (original)
+++ team/rbrindley/welcome_revamp/config/features.html Wed Nov 26 20:25:00 2008
@@ -22,6 +22,7 @@
 <script src="js/astman.js"></script>
 <script src="js/features.js"></script>
 <script src="js/jquery.tooltip.js"></script>
+<script src="js/jquery.autocomplete.js"></script>
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <style type="text/css">
 	#Table_applicationMap_definitions {

Modified: team/rbrindley/welcome_revamp/config/hardware.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/hardware.html?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/hardware.html (original)
+++ team/rbrindley/welcome_revamp/config/hardware.html Wed Nov 26 20:25:00 2008
@@ -51,6 +51,7 @@
 <script src="js/astman.js"></script>
 <script src="js/hardware.js"></script>
 <script src="js/jquery.tooltip.js"></script>
+<script src="js/jquery.autocomplete.js"></script>
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <style>
 

Modified: team/rbrindley/welcome_revamp/config/index.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/index.html?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/index.html (original)
+++ team/rbrindley/welcome_revamp/config/index.html Wed Nov 26 20:25:00 2008
@@ -62,6 +62,7 @@
 		'lpc10': 'LPC10' ,
 		'g729' : 'G.729'
 	},
+	directories:{},// sessionData.directories
 	FileCache:{}, // Object to Cache config files .. sessionData.FileCache['users.conf'].content , sessionData.FileCache['users.conf'].modified
 	FXO_PORTS_DETECTED : [], // so that we do not have to parse ztscan output each time where we want this list
 				// sessionData.FXO_PORTS_DETECTED
@@ -234,7 +235,7 @@
 			<div class="ui-accordion-desc">Displays current Active Channels on the PBX, with the options to Hangup or Transfer.</div>
 		</div>
 		<div page='bulkadd.html' class='AdvancedMode'>
-			<div class="ui-accordion-link">Bulk Add <sup><font color=#fffc31><b>beta</b></font></sup></div>
+			<div class="ui-accordion-link">Bulk Add</div>
 			<div class="ui-accordion-desc">Add multiple users to the system in one easy step - import from a csv file OR create a range of extensions.</div>
 		</div>
 		<div page='feditor.html' class='AdvancedMode'>

Modified: team/rbrindley/welcome_revamp/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/astman.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/astman.js (original)
+++ team/rbrindley/welcome_revamp/config/js/astman.js Wed Nov 26 20:25:00 2008
@@ -72,12 +72,23 @@
 	};
 	
 	Array.prototype.firstAvailable = function(start) {
-		if(!start){ start = 1; }else{ start = Number( start ); }
-		if(!this.length){return start;}
-		for(var y=0, x=[] ; y< this.length; y++){ x.push( Number(this[y]) ); } // 'this' can also be an array of number strings
-		var i=0;
-		while( i < 1 ){
-			if( x.contains(start) ){ start++; }else{ return start; }
+		start = (!start)? 1 : Number( start );
+		if(!this.length)
+			return start;
+		for( var y=0, x=[], z=this.length ; y < z ; y++ ){
+			var NT = Number(this[y]) ;
+			if( NT < start )
+				continue;
+			x.push(NT);
+		}
+		if( !x.length )
+			return start;
+		while(true){
+			if( x.contains(start) ){
+				start++;
+			}else{
+				return start;
+			}
 		}
 	};
 
@@ -314,7 +325,7 @@
 		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
+		g729RegInfo: 'g729reginfo.conf', // ASTGUI.globals.g729RegInfo, the sessionData.directories.script_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,
@@ -638,73 +649,7 @@
 		// this.comboDiv - the div element created
 		// this.comboOptions - the array of options
 		var e = this;
-		var k = document.createElement('DIV');
-		var continue_cleanup = true;
-
-		var cleanupDiv = function(){
-			var y = e;
-			var sf = function(){
-				if(!continue_cleanup) return;
-				try{
-					if(y.comboDiv){
-						var q = y.comboDiv;
-						q.parentNode.removeChild(q);
-						delete y.comboDiv;
-						ASTGUI.events.remove( y, 'blur' , cleanupDiv ) ;
-						y.blur();
-					}
-				}catch(err){
-					ASTGUI.Log.Error(err.description);
-				}
-			};
-			setTimeout( sf, 150 );
-		};
-
-		var creatediv = function(event){
-			ASTGUI.events.add( e, 'blur' , cleanupDiv ) ;
-			var u = e;
-			var q = k.cloneNode(false);
-			q.className = "comboMainDiv";
-			if(w){ q.style.width = w; }
-			u.comboDiv = q;
-			var selectOption = function(event){
-				continue_cleanup = false ;
-				var f = ASTGUI.events.getTarget(event);
-				u.value = f.getAttribute( 'actualvalue' );
-				continue_cleanup = true ;
-				cleanupDiv();
-			};
-
-			ASTGUI.events.add( q , 'click' , selectOption );
-			q.style.display = 'none' ;
-			document.body.appendChild(q);
-			ASTGUI.domActions.alignBbelowA(u,q);
-			updateDivAndShow.call(e);
-		};
-	
-		var updateDivAndShow = function(){
-			var t = e.comboDiv ;
-			var srchStng = e.value.toLowerCase() ;
-			var z = e.comboOptions ;
-			var y ;
-			var matched = 0 ;
-	
-			ASTGUI.domActions.removeAllChilds(t);
-			for (var r =0; r < z.length; r++){
-				if( z[r].toLowerCase().contains(srchStng) || srchStng == '' ){
-					y = k.cloneNode(false);
-					y.innerHTML = z[r].bold_X( srchStng );
-					y.setAttribute( 'actualvalue', z[r] );
-					t.appendChild(y);
-					matched++;
-				}
-			}
-			setTimeout( function(){ t.style.display = (matched) ? '' : 'none'; } , 20 );
-		};
-
-		e.comboOptions = a.sort();
-		ASTGUI.events.add( e, 'focus' , creatediv ) ;
-		ASTGUI.events.add( e, 'keyup' , updateDivAndShow ) ;
+		$(e).autocomplete(a, { width: w } );
 	},
 
 	customObject : function(){
@@ -863,21 +808,6 @@
 			}
 		},
 
-		bindMenu: function(m,n){
-			// assigns menu list element 'm' to button/span/element 'n' 
-			// m will be aligned below n , 
-			// and when n is clicked m will be displayed, and if clicked anywhere else on the document m will be 'hidden'
-			if ( typeof m == 'string'){ m = _$(m) ; }
-			if ( typeof n == 'string'){ n = _$(n) ; }
-			ASTGUI.events.add( n , 'click' , function(b){
-					(b||window.event).cancelBubble = true;
-					ASTGUI.domActions.alignBbelowA(n, m);
-					m.style.display = '';
-					n.style.background ='#a8b6e5';
-				}) ;
-			ASTGUI.events.add( document , 'click' , function(){ n.style.background =''; m.style.display ='none' ;} ) ;
-		},
-
 		CheckAll: function(x){ // check all checkboxes of class x - ASTGUI.domActions.CheckAll();
 			var y = $("." + x) ;
 			for(var g=0, h = y.length; g < h; g++){
@@ -918,8 +848,7 @@
 		},
 
 		clear_table: function(h){ // ASTGUI.domActions.clear_table($el)
-			if ( typeof h == 'string'){ h = _$(h) ; }
-			for( var i=0; i <  h.rows.length; ){ h.deleteRow(i); }
+			ASTGUI.domActions.removeAllChilds(h);
 		},
 
 		findPos: function (el){ // returns the 'el.left, el.top' in pixels of a given element
@@ -962,8 +891,7 @@
 						this.value = '' ;
 					};
 				}
-			);
-			$(el).blur(
+			).blur(
 				function () {
 					if( this.value == '' ){
 						this.value = this.defaultValue ;
@@ -1298,8 +1226,8 @@
 		// ASTGUI.listSystemFiles( dir , callBackFunction )
 		// list of files in 'dir' will be sent to callBackFunction as an array
 		try{
-		this.systemCmd( this.scripts.ListFiles + ' ' +  dir , function(){
-			var op = ASTGUI.loadHTML( ASTGUI.paths.output_SysInfo );
+		this.systemCmd( top.sessionData.directories.script_ListFiles + ' ' +  dir , function(){
+			var op = ASTGUI.loadHTML( top.sessionData.directories.output_SysInfo );
 			var tmp_files = op.split('\n');
 			var files = [];
 			for( var i =0 ; i < tmp_files.length ; i++){
@@ -1354,13 +1282,12 @@
 			}
 		},
 
-
 		createConfig : function( fileName, callback){ // ASTGUI.miscFunctions.createConfig( 'filaName', function(){ } ) ;
 			if( parent.sessionData.PLATFORM.isAST_1_6 ){
 				var s = $.ajax({ url: ASTGUI.paths.rawman+'?action=createconfig&filename='+ fileName , async: false }).responseText;
 				callback();
 			}else{
-				ASTGUI.systemCmd( 'touch ' + ASTGUI.paths.asteriskConfig + fileName, callback );
+				ASTGUI.systemCmd( 'touch ' + top.sessionData.directories.asteriskConfig + fileName, callback );
 			}
 		},
 
@@ -2354,10 +2281,10 @@
 		// usage :: ASTGUI.systemCmdWithOutput( 'uptime' , callback(output){ /* do something with output */ } );
 		// Use this function when you want to execute a specific system command and read the output
 		// output will be sent as a argument to the callback function
-		var fcmd = cmd + ' > ' + this.paths['guiInstall'] + ( this.paths['output_SysInfo'].afterChar('/') || this.paths['output_SysInfo'] ) ;
+		var fcmd = cmd + ' > ' + top.sessionData.directories.guiInstall + ( top.sessionData.directories.output_SysInfo.afterChar('/') || top.sessionData.directories.output_SysInfo ) ;
 		var after = function(){
 			parent.document.getElementById('ajaxstatus').style.display = 'none';
-			var op = ASTGUI.loadHTML( ASTGUI.paths.output_SysInfo ) ;
+			var op = ASTGUI.loadHTML( top.sessionData.directories.output_SysInfo ) ;
 			cb( op ) ;
 		};
 		var delay_cb = function(){ setTimeout(after,500); };
@@ -2642,38 +2569,7 @@
 }; // ( AstGUI )
 
 ASTGUI.paths = {};
-
-ASTGUI.paths['guiInstall'] = '/var/lib/asterisk/static-http/config/';
 ASTGUI.paths['rawman'] = '../../rawman';
-ASTGUI.paths['asteriskConfig'] = '/etc/asterisk/';
-ASTGUI.paths['ConfigBkp'] = '/var/lib/asterisk/gui_backups/';
-ASTGUI.paths['ConfigBkp_dldPath'] = ASTGUI.paths['guiInstall'] + 'private/bkps/'; // path for keeping the bkp files for download
-ASTGUI.paths['AGIBIN'] = '/var/lib/asterisk/agi-bin/';
-ASTGUI.paths['Sounds'] = '/var/lib/asterisk/sounds/';
-ASTGUI.paths['MOH'] = '/var/lib/asterisk/moh/' ; // path for music on hold files
-ASTGUI.paths['menusRecord'] = ASTGUI.paths['Sounds'] + 'record/' ;
-
-ASTGUI.paths['scripts'] = '/var/lib/asterisk/scripts/';/* Directory for gui scripts (listfiles, for example) */	
-ASTGUI.paths['output_SysInfo'] = './sysinfo_output.html' ;
-ASTGUI.paths['voicemails_dir'] = '/var/spool/asterisk/voicemail/default/' ;
-
-ASTGUI.scripts = {};
-
-ASTGUI.scripts['takeBackup'] = 'sh ' + ASTGUI.paths['scripts'] + 'takebackup';
-ASTGUI.scripts['restoreBackup'] = 'sh ' + ASTGUI.paths['scripts'] + 'restorebackup';
-ASTGUI.scripts['SysInfo'] = 'sh ' + ASTGUI.paths['scripts'] + 'gui_sysinfo';
-ASTGUI.scripts['ListFiles'] = 'sh ' + ASTGUI.paths['scripts'] + 'listfiles';
-ASTGUI.scripts['NetworkSettings'] = 'sh ' + ASTGUI.paths['scripts'] + 'networking.sh';
-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['mastercsvexists'] = 'sh ' + ASTGUI.paths['scripts'] + 'mastercsvexists';
-ASTGUI.scripts['Registerg729'] = 'sh ' + ASTGUI.paths['scripts'] + 'registerg729.sh';
-
-ASTGUI.apps = {};
-ASTGUI.apps['Ztscan'] = 'ztscan > ' + ASTGUI.paths['asteriskConfig'] +'ztscan.conf' ;
-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.contexts.PageGroups , ASTGUI.contexts.PageAnExtension] ;
 
@@ -2705,10 +2601,10 @@
 	if( params.action == "updateconfig" ){
 		params.srcfilename = params.filename;
 		params.dstfilename = params.filename;
-		if(top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
+		if(top.sessionData && top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
 		delete params.filename;
 	}else{
-		if(top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
+		if(top.sessionData && top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
 	}
 
 	$.get(ASTGUI.paths.rawman, params, cb);
@@ -2716,11 +2612,10 @@
 
 var makeSyncRequest = function( params){ // for making synchronus requests
 	// usage ::  makeSyncRequest ( { action :'getconfig', filename: 'something.conf' } ) // no need for call back function
-	if(top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
+	if(top.sessionData && top.sessionData.DEBUG_MODE ){ASTGUI.Log.Ajax("AJAX Request : '" + ASTGUI.getObjectPropertiesAsString(params) + "'");}
 	var s = $.ajax({ url: ASTGUI.paths.rawman, data: params , async: false });
 	return s.responseText;
 };
-
 
 var context2json = function(params){ 
 	// usage :: context2json({ filename:'something.conf' , context : 'context_1' , usf:0 })
@@ -2886,7 +2781,6 @@
 	}
 	return toJSO(s);
 }; // ( config2json )
-
 
 var listOfSynActions = function(file){
 	// this object should be used if you have 1 to 4 update actions needed to be performed synchronusly.
@@ -3108,26 +3002,29 @@
 
 (function(){
 	var onload_doThese = function(){
-		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);
-			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 ;
-				alert(alertmsg);
-			}
-			if ( jQuery.browser.msie ){ // If critical error in IE , reload entire GUI
-				top.window.reload();
-			}
-			return true;
-		};
-
-		ASTGUI.showToolTips(); // Load any tooltips in this page
-		if( window.jQuery ){
-			$().ajaxStart( function(){ parent.document.getElementById('ajaxstatus').style.display = ''; });
-			$().ajaxStop( function(){
-				setTimeout( function(){parent.document.getElementById('ajaxstatus').style.display = 'none';}, 500 );
-			});
+		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);
+				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 ;
+					alert(alertmsg);
+				}
+				if ( jQuery.browser.msie ){ // If critical error in IE , reload entire GUI
+					top.window.reload();
+				}
+				return true;
+			};
+			ASTGUI.showToolTips(); // Load any tooltips in this page
+
+			var AJS = parent.document.getElementById('ajaxstatus') ;
+			if( window.jQuery && AJS ){
+				$().ajaxStart( function(){ AJS.style.display = ''; });
+				$().ajaxStop( function(){
+					setTimeout( function(){ AJS.style.display = 'none'; }, 500 );
+				});
+			}
 		}
 		if( window.localajaxinit && (typeof localajaxinit == 'function' ) ){
 			window.localajaxinit();

Modified: team/rbrindley/welcome_revamp/config/js/backup.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/backup.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/backup.js (original)
+++ team/rbrindley/welcome_revamp/config/js/backup.js Wed Nov 26 20:25:00 2008
@@ -19,7 +19,7 @@
  *
  */
 
-var bkpPath = ASTGUI.paths.ConfigBkp ;
+var bkpPath = top.sessionData.directories.ConfigBkp ;
 var upload_Filename = ""; // will be updated by upload_form.html
 var starteduploading = 0;
 var upload_Path; // path for 'uploads' as defined in http.conf - this variable will be automatically updated from http.conf
@@ -72,14 +72,14 @@
 	var rand_2 = Math.round(100000*Math.random());
 	var tmp_check_perms_guibkps = function(){
 		ASTGUI.dialog.waitWhile('Checking write privileges on backups folder');
-		ASTGUI.systemCmd( "touch "+ ASTGUI.paths['ConfigBkp'] + rand_2 , function(){
-
-			ASTGUI.listSystemFiles( ASTGUI.paths['ConfigBkp'], function(a){
+		ASTGUI.systemCmd( "touch "+ top.sessionData.directories.ConfigBkp + rand_2 , function(){
+
+			ASTGUI.listSystemFiles( top.sessionData.directories.ConfigBkp , function(a){
 				a = a.join('');
 				if( a.contains(rand_2) ){
-					ASTGUI.systemCmd( "rm '"+ ASTGUI.paths['ConfigBkp'] + rand_2 + "'" , function(){});
+					ASTGUI.systemCmd( "rm '"+ top.sessionData.directories.ConfigBkp + rand_2 + "'" , function(){});
 				}else{
-					ASTGUI.dialog.alertmsg( 'missing ' + ASTGUI.paths['ConfigBkp'] + '<BR> OR Asterisk does not have write privileges on ' + ASTGUI.paths['ConfigBkp'] );
+					ASTGUI.dialog.alertmsg( 'missing ' + top.sessionData.directories.ConfigBkp + '<BR> OR Asterisk does not have write privileges on ' + top.sessionData.directories.ConfigBkp );
 					return;
 				}
 
@@ -154,8 +154,8 @@
 
 
 function dld_bkp( filename ){
-	parent.ASTGUI.systemCmd( "mkdir -p "+ ASTGUI.paths.ConfigBkp_dldPath + " ; /bin/rm " + ASTGUI.paths.ConfigBkp_dldPath + "* ", function(){
-		parent.ASTGUI.systemCmd( "/bin/ln -s "+ bkpPath + filename + " " + ASTGUI.paths.ConfigBkp_dldPath + filename , function(){
+	parent.ASTGUI.systemCmd( "mkdir -p "+ top.sessionData.directories.ConfigBkp_dldPath + " ; /bin/rm " + top.sessionData.directories.ConfigBkp_dldPath + "* ", function(){
+		parent.ASTGUI.systemCmd( "/bin/ln -s "+ bkpPath + filename + " " + top.sessionData.directories.ConfigBkp_dldPath + filename , function(){
 			var location_dir = window.location.href ;
 			location_dir = location_dir.rChop('backup.html') ;
 			var download_link =  location_dir + "private/bkps/" + filename ;
@@ -191,7 +191,7 @@
 function restore_bkp_step3(file_fullpath){
 	if( parent.sessionData.PLATFORM.isAA50 ){
 		parent.ASTGUI.dialog.waitWhile(' The System will reboot shortly ');
-		parent.ASTGUI.systemCmd( ASTGUI.scripts.restoreBackup + " " + file_fullpath, function(){
+		parent.ASTGUI.systemCmd( top.sessionData.directories.script_restoreBackup + " " + file_fullpath, function(){
 			ASTGUI.feedback( { msg:'Configuration restored !!', showfor:2 });
 			parent.miscFunctions.AFTER_REBOOT_CMD();
 			/* ***************** Todo Restart ******************* */
@@ -273,9 +273,9 @@
 	if( parent.sessionData.PLATFORM.isAA50  ){
 		var fullback = _$('newbkp_completeBackup').checked ;
 		if(fullback){
-			var tmp_script = ASTGUI.scripts.takeBackup + ' ' +  bkpPath + bkpfile + ' ' + 'YES';
+			var tmp_script = top.sessionData.directories.script_takeBackup + ' ' +  bkpPath + bkpfile + ' ' + 'YES';
 		}else{
-			var tmp_script = ASTGUI.scripts.takeBackup + ' ' +  bkpPath + bkpfile ;
+			var tmp_script = top.sessionData.directories.script_takeBackup + ' ' +  bkpPath + bkpfile ;
 		}
 		parent.ASTGUI.systemCmd( tmp_script , function(){
 			ASTGUI.feedback( { msg:'Backup Successful', showfor:2 });

Modified: team/rbrindley/welcome_revamp/config/js/cdr.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/cdr.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/cdr.js (original)
+++ team/rbrindley/welcome_revamp/config/js/cdr.js Wed Nov 26 20:25:00 2008
@@ -319,7 +319,7 @@
 
 	parent.ASTGUI.dialog.waitWhile(' Grabbing your Records... ');
 
-	parent.ASTGUI.systemCmd(ASTGUI.scripts.mastercsvexists, function (){
+	parent.ASTGUI.systemCmd(top.sessionData.directories.script_mastercsvexists, function (){
 		var content = ASTGUI.loadHTML("./Master.csv"); /* "./" is good enough. */
 		records = content.split("\n");
 		var intDest = parent.astgui_manageusers.listOfUsers();

Modified: team/rbrindley/welcome_revamp/config/js/feditor.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/feditor.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/feditor.js (original)
+++ team/rbrindley/welcome_revamp/config/js/feditor.js Wed Nov 26 20:25:00 2008
@@ -84,7 +84,7 @@
 	parent.ASTGUI.dialog.waitWhile('loading list of filenames ..');
 	ASTGUI.selectbox.append(_$('filenames'),"Config Files", "");
 	_$('filenames').options[0].style.fontWeight = "bold";
-	parent.ASTGUI.listSystemFiles( ASTGUI.paths.asteriskConfig , function(listOfFiles) {
+	parent.ASTGUI.listSystemFiles( top.sessionData.directories.asteriskConfig , function(listOfFiles) {
 		try{
 			listOfFiles.each( function( file ) {
 				if( file.endsWith('.conf') ){ ASTGUI.selectbox.append( _$('filenames'), file , file ); }

Modified: team/rbrindley/welcome_revamp/config/js/hardware.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/hardware.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/hardware.js (original)
+++ team/rbrindley/welcome_revamp/config/js/hardware.js Wed Nov 26 20:25:00 2008
@@ -366,7 +366,7 @@
 		ASTGUI.Log.Debug("start function: loadConfigFiles.runZtscan()");
 
 		ASTGUI.miscFunctions.createConfig( 'applyzap.conf', function(){
-			parent.ASTGUI.systemCmd( ASTGUI.apps.Ztscan , function(){ // run ztscan and then try loading ztscan.conf
+			parent.ASTGUI.systemCmd( top.sessionData.directories.app_Ztscan , function(){ // run ztscan and then try loading ztscan.conf
 				window.setTimeout( loadConfigFiles.readZtscanConf , 700 ); // leave some time for ztscan to generate ztscan.conf
 			});
 			ASTGUI.Log.Debug("end of function: loadConfigFiles.runZtscan()");
@@ -808,7 +808,7 @@
 	},
 
 	generate_zaptel: function(){
-		parent.ASTGUI.systemCmd( ASTGUI.scripts.generateZaptel + " applysettings" , function(){
+		parent.ASTGUI.systemCmd( top.sessionData.directories.script_generateZaptel + " applysettings" , function(){
 			parent.sessionData.REQUIRE_RESTART = (HAS_ANALOGHARDWARE || HAS_DIGITALHARDWARE)? true : false;
 			parent.ASTGUI.systemCmd( "ztcfg -vv" , function(){
 				applySettings.save_opermode_settings();

Modified: team/rbrindley/welcome_revamp/config/js/hardware_aa50.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/hardware_aa50.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/hardware_aa50.js (original)
+++ team/rbrindley/welcome_revamp/config/js/hardware_aa50.js Wed Nov 26 20:25:00 2008
@@ -123,7 +123,7 @@
 
 
 	generate_zaptel: function(){
-		parent.ASTGUI.systemCmd( ASTGUI.scripts.generateZaptel + " applysettings" , function(){
+		parent.ASTGUI.systemCmd( top.sessionData.directories.script_generateZaptel + " applysettings" , function(){
 			parent.sessionData.REQUIRE_RESTART = true ;
 			parent.ASTGUI.systemCmd( "ztcfg -vv" , function(){
 				applySettings.save_opermode_settings();

Modified: team/rbrindley/welcome_revamp/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/index.js?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/index.js (original)
+++ team/rbrindley/welcome_revamp/config/js/index.js Wed Nov 26 20:25:00 2008
@@ -154,19 +154,19 @@
 				pu = true;
 			}
 			if( !http_conf.post_mappings.hasOwnProperty('backups') ){
-				var tmp_cbkp = ASTGUI.paths.ConfigBkp;
+				var tmp_cbkp = top.sessionData.directories.ConfigBkp ;
 				if( tmp_cbkp.endsWith('/') ){ tmp_cbkp = tmp_cbkp.rChop('/'); }
 				u.new_action('append', 'post_mappings' , 'backups', tmp_cbkp ) ;
 				pu = true;
 			}
 			if( !http_conf.post_mappings.hasOwnProperty('moh') ){
-				var tmp_cbkp = ASTGUI.paths.MOH ;
+				var tmp_cbkp = top.sessionData.directories.MOH ;
 				if( tmp_cbkp.endsWith('/') ){ tmp_cbkp = tmp_cbkp.rChop('/'); }
 				u.new_action('append', 'post_mappings' , 'moh', tmp_cbkp ) ;
 				pu = true;
 			}
 			if( !http_conf.post_mappings.hasOwnProperty('voicemenuprompts') ){
-				var tmp_cbkp = ASTGUI.paths['menusRecord'] ;
+				var tmp_cbkp = top.sessionData.directories.menusRecord ;
 				if( tmp_cbkp.endsWith('/') ){ tmp_cbkp = tmp_cbkp.rChop('/'); }
 				u.new_action('append', 'post_mappings' , 'voicemenuprompts', tmp_cbkp ) ;
 				pu = true;
@@ -187,13 +187,13 @@
 				pu = true;
 			}
 			if( !http_conf.post_mappings.hasOwnProperty('backups') ){
-				var tmp_cbkp = ASTGUI.paths['ConfigBkp'] ;
+				var tmp_cbkp = top.sessionData.directories.ConfigBkp ;
 				if( tmp_cbkp.endsWith('/') ){ tmp_cbkp = tmp_cbkp.rChop('/'); }
 				u.new_action('append', 'post_mappings' , 'backups', tmp_cbkp ) ;
 				pu = true;
 			}
 			if( !http_conf.post_mappings.hasOwnProperty('moh') ){
-				var tmp_cbkp = ASTGUI.paths.MOH ;
+				var tmp_cbkp = top.sessionData.directories.MOH ;
 				if( tmp_cbkp.endsWith('/') ){ tmp_cbkp = tmp_cbkp.rChop('/'); }
 				u.new_action('append', 'post_mappings' , 'moh', tmp_cbkp ) ;
 				pu = true;
@@ -221,7 +221,7 @@
 		var rand_1 = Math.round(100000*Math.random());
 		ASTGUI.systemCmdWithOutput( 'echo ' + rand_1  , function(s){
 			if( !s.contains(rand_1) ){
-				ASTGUI.dialog.alertmsg( 'Asterisk needs write privileges on ' + ASTGUI.paths['guiInstall'] );
+				ASTGUI.dialog.alertmsg( 'Asterisk needs write privileges on ' + top.sessionData.directories.guiInstall );
 			}
 
 			ASTGUI.dialog.waitWhile('detecting Hardware ..');
@@ -229,10 +229,52 @@
 		});
 	},
 
+	setGUI_Paths: function(){
+		// onLogInFunctions.setGUI_Paths()
+		var ASTERISK_CONF = context2json({ filename:'asterisk.conf' , context : 'directories' , usf:1 }) ;
+
+		sessionData.directories.asteriskConfig = ( ASTERISK_CONF.hasOwnProperty('astetcdir') ) ? ASTERISK_CONF.astetcdir : '/etc/asterisk/' ;
+		sessionData.directories.astvarlibdir = ( ASTERISK_CONF.hasOwnProperty('astvarlibdir') ) ? ASTERISK_CONF.astvarlibdir : '/var/lib/asterisk/' ;
+		sessionData.directories.AGIBIN = ( ASTERISK_CONF.hasOwnProperty('astagidir') ) ? ASTERISK_CONF.astagidir : '/var/lib/asterisk/agi-bin/' ;
+		sessionData.directories.astspooldir = ( ASTERISK_CONF.hasOwnProperty('astspooldir') ) ? ASTERISK_CONF.astspooldir : '/var/spool/asterisk/' ;
+
+		if( !sessionData.directories.asteriskConfig.endsWith('/') ){ sessionData.directories.asteriskConfig = sessionData.directories.asteriskConfig + '/' ; }
+		if( !sessionData.directories.astvarlibdir.endsWith('/') ){ sessionData.directories.astvarlibdir = sessionData.directories.astvarlibdir + '/' ; }
+		if( !sessionData.directories.AGIBIN.endsWith('/') ){ sessionData.directories.AGIBIN = sessionData.directories.AGIBIN + '/' ; }
+		if( !sessionData.directories.astspooldir.endsWith('/') ){ sessionData.directories.astspooldir = sessionData.directories.astspooldir + '/' ; }
+
+		sessionData.directories.guiInstall = sessionData.directories.astvarlibdir + 'static-http/config/' ;
+		sessionData.directories.ConfigBkp = sessionData.directories.astvarlibdir + 'gui_backups/';
+		sessionData.directories.ConfigBkp_dldPath = sessionData.directories.guiInstall + 'private/bkps/'; // path for keeping the bkp files for download
+		sessionData.directories.Sounds = sessionData.directories.astvarlibdir + 'sounds/' ;
+		sessionData.directories.MOH = sessionData.directories.astvarlibdir + 'moh/' ; // path for music on hold files
+		sessionData.directories.menusRecord = sessionData.directories.Sounds + 'record/' ;
+
+		sessionData.directories.scripts = sessionData.directories.astvarlibdir + 'scripts/';/* Directory for gui scripts (listfiles, for example) */	
+		sessionData.directories.output_SysInfo = './sysinfo_output.html' ;
+		sessionData.directories.voicemails_dir = sessionData.directories.astspooldir + 'voicemail/default/' ;
+
+
+		sessionData.directories.script_takeBackup =  'sh ' + sessionData.directories.scripts + 'takebackup';
+		sessionData.directories.script_restoreBackup =  'sh ' + sessionData.directories.scripts + 'restorebackup';
+		sessionData.directories.script_SysInfo = 'sh ' + sessionData.directories.scripts + 'gui_sysinfo';
+		sessionData.directories.script_ListFiles = 'sh ' + sessionData.directories.scripts + 'listfiles';
+		sessionData.directories.script_NetworkSettings = 'sh ' + sessionData.directories.scripts + 'networking.sh';
+		sessionData.directories.script_generateZaptel = 'sh ' + sessionData.directories.scripts + 'editzap.sh';
+		sessionData.directories.script_generatemISDN_init = 'sh ' + sessionData.directories.scripts + 'editmisdn.sh';
+		sessionData.directories.script_dldsoundpack = 'sh ' + sessionData.directories.scripts + 'dldsoundpack';
+		sessionData.directories.script_mastercsvexists = 'sh ' + sessionData.directories.scripts + 'mastercsvexists';
+		sessionData.directories.script_Registerg729 = 'sh ' + sessionData.directories.scripts + 'registerg729.sh';
+
+		sessionData.directories.app_Ztscan = 'ztscan > ' + sessionData.directories.asteriskConfig +'ztscan.conf' ;
+		sessionData.directories.app_mISDNscan = 'misdn-init scan' ;
+		sessionData.directories.app_flashupdate = 'flashupdate' ;
+	},
+
 	checkifLoggedIn: function(){
 		var s = $.ajax({ url: ASTGUI.paths.rawman+'?action=ping', async: false });
 		var resp = s.getResponseHeader("Server");
-
+		onLogInFunctions.setGUI_Paths();
 		onLogInFunctions.detectPlatform(resp); // <-- PLATFORM Detection
 
 		if(s.responseText.toLowerCase().match('pong')){
@@ -377,7 +419,7 @@
 		var cb = function(){
 			onLogInFunctions.updatePanels4Platform();
 		};
-		ASTGUI.systemCmd(ASTGUI.apps.Ztscan, cb);
+		ASTGUI.systemCmd(top.sessionData.directories.app_Ztscan, cb);
 	},
 
 
@@ -774,138 +816,132 @@
 		});
 	},
 
-	getAllDestinations: function(fortbr){ // miscFunctions.getAllDestinations() // --> returns an Array of Objects
-	// There are many places in the gui where we want to preset a select box with all possible destinations
-	// Ex: in incoming calls, Voicemenus, TimeBased Routing, RingGroups etc etc.
+	getAllDestinations: function(){ // miscFunctions.getAllDestinations() // --> returns an Array of Objects
+	// There are various places in the gui where we want to preset a select box with all possible destinations
+	// for Example - in incoming calls, Voicemenus, RingGroups etc.
 	// this function navigates through all properties of sessionData.pbxinfo and returns an Array of Objects with all the possible destinations
 		var tmp = [] ;
-		var destination = function(){
-			this.optionText = '';
-			this.optionValue = '';
-		};
 		var y = astgui_manageusers.listOfUsers();
 			y.each(function(user){
-				var f = new destination;
-				f.optionText = 'User Extension -- ' + user ;
-				f.optionValue = (fortbr)? 'default,' + user + ',1' : 'Goto(default,' + user + ',1)' ;
-				tmp.push(f);
-				if(!fortbr && sessionData.pbxinfo.users[user].getProperty('hasvoicemail').isAstTrue() ){
-					var p_Text = 'User VoiceMailBox ' + user ;
-					tmp.push({ optionText: p_Text , optionValue: 'Voicemail(' + user + ',u)' });
-				}
+				tmp.push({ optionText: 'User Extension -- ' + user , optionValue: 'Goto(default,' + user + ',1)' });
+
+				if( sessionData.pbxinfo.users[user].getProperty('hasvoicemail').isAstTrue() ){
+					tmp.push({ optionText: 'User VoiceMailBox ' + user , optionValue: 'Voicemail(' + user + ',u)' });
+				}
+
 			});
 		var y = sessionData.pbxinfo.conferences.getOwnProperties();
 			y.each(function(meetme){
-				var f = new destination;
-				f.optionText = 'Conference Room -- ' + meetme ;
-				f.optionValue = (fortbr)? ASTGUI.contexts.CONFERENCES + ',' + meetme + ',1' :  'Goto('+ ASTGUI.contexts.CONFERENCES +','+ meetme + ',1)';
-				tmp.push(f);
+				tmp.push({ optionText: 'Conference Room -- ' + meetme , optionValue: 'Goto('+ ASTGUI.contexts.CONFERENCES +','+ meetme + ',1)' });
+				
+				var tmp_adminOptions = sessionData.pbxinfo.conferences[meetme].getProperty('adminOptions') ;
+				if( tmp_adminOptions ){
+					var meetme_admin = ASTGUI.parseContextLine.getExten( tmp_adminOptions );
+					tmp.push({ optionText: 'Conference Room Admin -- ' + meetme_admin , optionValue: 'Goto('+ ASTGUI.contexts.CONFERENCES +','+ meetme_admin + ',1)' });
+				}
+
 			});
 		var y = sessionData.pbxinfo.queues.getOwnProperties();
 			y.each(function(q){
-				var f = new destination;
-				f.optionText = 'Queue -- ' + q ;
-				f.optionValue = (fortbr)? ASTGUI.contexts.QUEUES + ',' + q + ',1' : 'Goto('+ ASTGUI.contexts.QUEUES +','+ q + ',1)';
-				tmp.push(f);
+				if( sessionData.pbxinfo.queues[q]['configLine'].contains(',1,agentlogin()') ){
+					var tmp_exten = ASTGUI.parseContextLine.getExten(sessionData.pbxinfo.queues[q]['configLine']) ;
+					tmp.push({ optionText: 'Agent Login -- ' + tmp_exten , optionValue: 'Goto('+ ASTGUI.contexts.QUEUES +','+ tmp_exten + ',1)' });
+					return;
+				}
+				if( sessionData.pbxinfo.queues[q]['configLine'].contains(',1,agentcallbacklogin()') ){
+					var tmp_exten = ASTGUI.parseContextLine.getExten(sessionData.pbxinfo.queues[q]['configLine']) ;
+					tmp.push({ optionText: 'Agent Callback Login -- ' + tmp_exten , optionValue: 'Goto('+ ASTGUI.contexts.QUEUES +','+ tmp_exten + ',1)' });
+					return;
+				}
+				tmp.push({ optionText: 'Queue -- ' + q, optionValue: 'Goto('+ ASTGUI.contexts.QUEUES +','+ q + ',1)' });
 			});
 		var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
 			y.each(function(vmenu){
 				var vm_name = sessionData.pbxinfo.voicemenus[vmenu].comment || vmenu ;
-				var f = new destination;
-				f.optionText = 'VoiceMenu -- ' + vm_name ;
-				f.optionValue = (fortbr)? vmenu+ ',s,1' : 'Goto('+ vmenu +',s,1)';
-				tmp.push(f);
+				tmp.push({ optionText: 'VoiceMenu -- ' + vm_name , optionValue: 'Goto('+ vmenu +',s,1)' });
 			});
-		var y = sessionData.pbxinfo.timebasedRules.getOwnProperties();
-			y.each(function(tbr){
-				var tbr_label = sessionData.pbxinfo.timebasedRules[tbr].label || tbr ;
-				var f = new destination;
-				f.optionText = 'Time Based Rule -- ' + tbr_label;
-				f.optionValue = (fortbr)? tbr + ',s,1' : 'Goto('+ tbr +',s,1)';
-				tmp.push(f);
-			});
+// 		var y = sessionData.pbxinfo.timebasedRules.getOwnProperties();
+// 			y.each(function(tbr){
+// 				var tbr_label = sessionData.pbxinfo.timebasedRules[tbr].label || tbr ;
+// 				tmp.push({ optionText: 'Time Based Rule -- ' + tbr_label , optionValue: 'Goto('+ tbr +',s,1)' });
+// 			});
 		var y = sessionData.pbxinfo.ringgroups.getOwnProperties();
 			y.each(function(rg){
 				var rg_name = sessionData.pbxinfo.ringgroups[rg].NAME || rg ;
-				var f = new destination;
-				f.optionText = 'Ring Group -- ' + rg_name ;
-				f.optionValue = (fortbr)? rg + ',s,1' : 'Goto('+ rg +',s,1)';
-				tmp.push(f);
+				tmp.push({ optionText: 'Ring Group -- ' + rg_name , optionValue: 'Goto('+ rg +',s,1)' });
 			});
 		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);
+				tmp.push({ optionText: 'Page Group -- ' + pge , optionValue: 'Goto('+ ASTGUI.contexts.PageGroups +','+ pge +',1)' });
 			});
-
 		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)' ;
-				tmp.push(f);
+				tmp.push({
+						optionText: 'VoiceMail Group -- ' + (sessionData.pbxinfo.vmgroups[this_vmg_exten].getProperty('label') || this_vmg_exten ),
+						optionValue: 'Goto('+ ASTGUI.contexts.VoiceMailGroups +',' + this_vmg_exten + ',1)'
+					});
 			});
-
 		if( sessionData.pbxinfo['localextensions'].getProperty('defaultDirectory') ){
 			var nde = sessionData.pbxinfo['localextensions'].getProperty('defaultDirectory') ;
-			var f = new destination;
-			f.optionText = 'Names Directory -- ' + nde ;
-			f.optionValue = (fortbr) ? ASTGUI.contexts.Directory + ',' + nde + ',1' : 'Goto('+ ASTGUI.contexts.Directory + ',' + nde + ',1)'; ;

[... 783 lines stripped ...]



More information about the asterisk-gui-commits mailing list