pari: trunk r612 - in /trunk/config: ./ scripts/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Wed Apr 4 16:01:55 MST 2007


Author: pari
Date: Wed Apr  4 18:01:54 2007
New Revision: 612

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=612
Log:
*** New Feature (not finished) : Editing config files from the GUI **** 

Added:
    trunk/config/feditor.html
Modified:
    trunk/config/cfgbasic.html
    trunk/config/scripts/astman.js

Modified: trunk/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cfgbasic.html?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- trunk/config/cfgbasic.html (original)
+++ trunk/config/cfgbasic.html Wed Apr  4 18:01:54 2007
@@ -101,6 +101,9 @@
 // show additional panels for advanced mode
 if(window.location.href.match("advanced=yes") ){
 panels.splice(10,0,
+
+	new PanelDef("feditor", "File Editor", "accordion-icon.gif", " Manually edit Config Files"),
+
 	new PanelDef("moh", "Music On Hold", "accordion-icon.gif", " Music on hold sometimes keeps people less angry while they wait for an answer"),
 
 	new PanelDef("sip", "SIP", "accordion-icon.gif", "SIP (Session Initiation Protocol) Configuration"),

Added: trunk/config/feditor.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/feditor.html?view=auto&rev=612
==============================================================================
--- trunk/config/feditor.html (added)
+++ trunk/config/feditor.html Wed Apr  4 18:01:54 2007
@@ -1,0 +1,98 @@
+<!--
+ * Asterisk-GUI	-	an Asterisk configuration interface
+ *
+ * "Backup / Restore" management
+ *
+ * Copyright (C) 2006-2007, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ * Pari Nannapaneni <pari at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ *
+-->
+<script src="scripts/prototype.js"></script>
+<script src="scripts/rico.js"></script>
+<script src="scripts/astman.js"></script>
+<link href="stylesheets/rico.css" media="all" rel="Stylesheet" type="text/css" />
+<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
+<script>
+
+function resetmainscreen(){
+	top._$('mainscreen').width= 540;
+}
+
+function localajaxinit() {
+	top._$('mainscreen').width= 800;
+	setWindowTitle("File Editor");
+	parent.loadscreen(this);
+
+}
+
+
+function loadfile(){
+	var fname = _$('filename').value ;
+	config2json( fname, 0, fileparsed ) ;
+}
+
+function fileparsed(b){
+	//alert(b);
+	var zz = _$('file_output');
+	var c = eval('(' + b + ')');
+
+
+	while(zz.firstChild){
+		zz.removeChild(zz.firstChild);
+	}
+
+	for( var d in c ){
+		if ( c.hasOwnProperty(d) ) {
+			var h = document.createElement("div");
+			h.setAttribute("id","context_" + d );
+			h.align="left";
+			h.style.backgroundColor = '#4D5423';
+			h.style.color = '#FFFFFF';
+			h.style.marginTop = '15px' ;
+			h.style.width = '95%';
+			h.style.fontFamily = "'trebuchet ms',helvetica,sans-serif";
+			h.style.fontSize = '10pt' ;
+			h.innerHTML = "&nbsp;&nbsp;[" + d + "]";
+			zz.appendChild(h);
+			Rico.Corner.round("context_" + d, {compact:true});
+
+			var i = document.createElement("div");
+			i.setAttribute("id","contextContent_" + d );
+			i.align= "left";
+			i.style.backgroundColor = '#E0E6C4';
+			i.style.marginTop = '5px' ;
+			i.style.width = '95%';
+			i.style.fontSize = '9pt' ;
+			i.style.fontFamily = 'courier' ;
+
+			for(var r=0; r < c[d].length ; r++ ){
+				i.innerHTML += "&nbsp;&nbsp;" + unescape( c[d][r] ) + "<BR>" ;
+			}
+			zz.appendChild(i);
+
+			Rico.Corner.round("contextContent_" + d, {compact:true});
+		}
+	}
+
+}
+</script>
+<body id="foo" onload="localajaxinit()"  bgcolor="FFFFFF" onunload="resetmainscreen();">
+<div style="font-size : 12px; padding : 4px 6px 4px 6px; border-style : solid none solid none; border-top-color : #BDC7E7; border-bottom-color : #182052; border-width : 1px 0px 1px 0px; background-color : #ef8700; color : #ffffff;">
+	<span style="margin-left: 4px;font-weight:bold;">File Editor</span>
+	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
+	<span><input id="filename" size=15 style="font-size: 8pt; border:1px solid; padding : 0px 0px 0px 0px;">&nbsp;<input type="button" value="Go" style="font-size: 8pt; border:1px solid; padding : 0px 0px 0px 0px;" onclick="loadfile();"></span>
+</div>
+<div id="file_output" style="height:475px;width= 770px; overflow :auto;" align="center"></div>
+</body>

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=612&r1=611&r2=612
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Wed Apr  4 18:01:54 2007
@@ -190,7 +190,7 @@
 			var b = a[s].subfields ;
 			json_data += '"' + a[s].categoryname + '" : [ ' ;
 			for ( var y = 0 ;  y < b.length ;  y++ ){
-				json_data += '"' + b[y] + '"' ;
+				json_data += '"' + escape(b[y]) + '"' ;
 				if( y < b.length - 1 ){	json_data += ',' ;	}
 			}
 			if( s < a.length - 1 ){ json_data += ' ],' ; }else{ json_data += ' ]}' ; }



More information about the asterisk-gui-commits mailing list