pari: branch 2.0 r4150 - /branches/2.0/config/js/astman.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Nov 19 15:18:56 CST 2008


Author: pari
Date: Wed Nov 19 15:18:55 2008
New Revision: 4150

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

 more improvements to build_action()



Modified:
    branches/2.0/config/js/astman.js

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=4150&r1=4149&r2=4150
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Wed Nov 19 15:18:55 2008
@@ -3014,32 +3014,42 @@
 		if( !parent.sessionData.PLATFORM.isAST_1_4 && this.FILE_CONTENT != null ){
 			// the update/delete/delcat commands fail in Asterisk 1.6.X/trunk if the corresponding category/variables are not found
 			// In Asterisk 1.4 we do not have to do this check
-
-			var tmp_FILENAME = this.filename;
-			if( top.sessionData.FileCache[tmp_FILENAME].modified ){
-				this.FILE_CONTENT = config2json({ filename: tmp_FILENAME , usf:0 });
-			}
-
 			switch( action ){
-				case 'update':
+				case 'append':
 					if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
-					if( this.FILE_CONTENT[cat].indexOfLike(name+'=') == -1 ){
-						action = 'append';
-					}
-					break;
-				case 'delete':
-					if( !this.FILE_CONTENT.hasOwnProperty(cat) || this.FILE_CONTENT[cat].indexOfLike(name+'=') == -1 ){
-						return s;
-					}
+					this.FILE_CONTENT[cat].push( name + "=" + value );
 					break;
 				case 'delcat':
 					if( !this.FILE_CONTENT.hasOwnProperty(cat) ){
 						return s;
 					}
+					delete this.FILE_CONTENT[cat] ;
+					break;
+				case 'delete':
+					if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
+					var tmp_index = this.FILE_CONTENT[cat].indexOfLike(name+'=') ;
+					if( tmp_index == -1 ) return s;
+					this.FILE_CONTENT[cat].splice(tmp_index,1);
+					break;
+				case 'newcat':
+					if( this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
+					this.FILE_CONTENT[cat] = [] ;
+					break;
+				case 'update':
+					if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
+					var tmp_index = this.FILE_CONTENT[cat].indexOfLike(name+'=') ;
+					var tmp_line = name + "=" + value ;
+					if(  tmp_index == -1 ){
+						action = 'append';
+						this.FILE_CONTENT[cat].push(tmp_line);
+					}else{
+						this.FILE_CONTENT[cat][tmp_index] = tmp_line ;
+					}
 					break;
 				default: break;
 			}
 		}
+
 		var cnt = "" + count;
 		while(cnt.length < 6)
 			cnt = "0" + cnt;




More information about the asterisk-gui-commits mailing list