pari: branch 2.0 r3760 - in /branches/2.0/config: js/astman.js welcome.html
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Thu Sep 4 18:49:02 CDT 2008
Author: pari
Date: Thu Sep 4 18:49:01 2008
New Revision: 3760
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=3760
Log:
GUI API function that lets easily parse chunks from manager actions/commands output,
either as an 'Array of Arrays' or as an 'Array of Objects'
Modified:
branches/2.0/config/js/astman.js
branches/2.0/config/welcome.html
Modified: branches/2.0/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=3760&r1=3759&r2=3760
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Thu Sep 4 18:49:01 2008
@@ -1229,6 +1229,46 @@
},
miscFunctions: {
+ getChunksFromManagerOutput : function( op , usf){ // ASTGUI.miscFunctions.getChunksFromManagerOutput( output_str ) ;
+ var tmp_lines = op.split('\n');
+ if( tmp_lines[0].contains('Response: ') ) tmp_lines.removeFirst();
+ if( tmp_lines[0].contains('Message: ') ) tmp_lines.removeFirst();
+
+ var tmp_Array_chunksAsArrays = []; // each element of the array is an Array of chunk_lines
+ var tmp_Array_chunksAsObjects = []; // each element of the array is an object of chunk_lines
+
+ var tmp_chunk = (usf) ? {} : [] ;
+ var count = 0;
+
+ for( var r = 0; r < tmp_lines.length ; r++ ){
+ var this_line = tmp_lines[r];
+ if( this_line.trim() == '' ){
+ if( !count ){ continue; }
+ if( usf ){
+ tmp_Array_chunksAsObjects.push(tmp_chunk);
+ tmp_chunk = {} ;
+ }else{
+ tmp_Array_chunksAsArrays.push(tmp_chunk);
+ tmp_chunk = [] ;
+ }
+ count = 0;
+ continue;
+ }
+
+ if( !this_line.contains(': ') ){ continue; }
+ if( usf ){
+ tmp_chunk[ this_line.beforeStr(': ').trim() ] = this_line.afterStr(': ').trim() ;
+ count++ ;
+ }else{
+ tmp_chunk.push(this_line) ;
+ count++ ;
+ }
+ }
+
+ return ( usf ) ? tmp_Array_chunksAsObjects : tmp_Array_chunksAsArrays ;
+ },
+
+
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;
Modified: branches/2.0/config/welcome.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/welcome.html?view=diff&rev=3760&r1=3759&r2=3760
==============================================================================
--- branches/2.0/config/welcome.html (original)
+++ branches/2.0/config/welcome.html Thu Sep 4 18:49:01 2008
@@ -252,8 +252,10 @@
addCell( newRow , { html: l } );
addCell( newRow , { html: QUEUES_CONF[l] && QUEUES_CONF[l]['fullname'] || '--' }); // Label
if( m[l]['configLine'].contains(',1,agentlogin()') ){
+ addCell( newRow , { html: '' } );
addCell( newRow , { html: '<B>Agent Login</B>' });
}else if( m[l]['configLine'].contains(',1,agentcallbacklogin()') ){
+ addCell( newRow , { html: '' } );
addCell( newRow , { html: '<B>Agent CallBack Login</B>' });
}else{
addCell( newRow , { html: '' } );
More information about the asterisk-gui-commits
mailing list