pari: trunk r856 - in /trunk/config: cfgbasic.html cli.html
scripts/astman.js
asterisk-gui-commits at lists.digium.com
asterisk-gui-commits at lists.digium.com
Wed May 2 18:03:21 MST 2007
Author: pari
Date: Wed May 2 20:03:21 2007
New Revision: 856
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=856
Log:
New Feature: Execute Asterisk CLI commands from the GUI
Added:
trunk/config/cli.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=856&r1=855&r2=856
==============================================================================
--- trunk/config/cfgbasic.html (original)
+++ trunk/config/cfgbasic.html Wed May 2 20:03:21 2007
@@ -105,6 +105,8 @@
panels.splice(10,0,
new PanelDef("feditor", "File Editor", "accordion-icon.gif", " Manually edit Config Files"),
+
+ new PanelDef("cli", "Asterisk CLI", "accordion-icon.gif", " Asterisk Command Line Interface"),
new PanelDef("moh", "Music On Hold", "accordion-icon.gif", " Music on hold sometimes keeps people less angry while they wait for an answer"),
Added: trunk/config/cli.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cli.html?view=auto&rev=856
==============================================================================
--- trunk/config/cli.html (added)
+++ trunk/config/cli.html Wed May 2 20:03:21 2007
@@ -1,0 +1,67 @@
+<!--
+ * Asterisk-GUI - an Asterisk configuration interface
+ *
+ * Asterisk CLI emulator
+ *
+ * Copyright (C) 2006-2007, Digium, Inc.
+ *
+ * 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 localajaxinit() {
+ top._$('mainscreen').width= 798;
+ setWindowTitle("Asterisk CLI Emulator");
+ parent.loadscreen(this);
+ _$('cli_cmd').value = "core show version";
+ _$('cli_cmd').focus();
+}
+
+function resetmainscreen(){
+ top._$('mainscreen').width= 540;
+}
+
+function executeCommand(cmd){
+ parent.astmanEngine.run_cmd(cmd, gotResponse);
+}
+
+function gotResponse(op){
+ _$('cli_output').innerHTML = "<PRE>"+ op + "</PRE>";
+ _$('cli_cmd').value = "";
+ _$('cli_cmd').focus();
+}
+
+function sendCommand(e){
+ if(e.keyCode == 13){
+ executeCommand( _$('cli_cmd').value );
+ return false;
+ }
+}
+
+</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;">Asterisk Command Line Interface</span>
+ <span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" > <img src="images/refresh.png" title=" Refresh " border=0 > </span>
+
+</div>
+<div style="padding : 0px 0px 0px 0px;">
+<div style="padding : 0px 1px 0px 2px; height:444px;width= 797px; overflow :auto; font-size : 12px;" id="cli_output"></div><BR>
+Asterisk CLI> <input id="cli_cmd" size=95 onKeyPress="sendCommand(event)" style="font-size: 9pt; border:1px solid; padding : 0px 0px 0px 3px;">
+</div>
+</body>
Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=856&r1=855&r2=856
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Wed May 2 20:03:21 2007
@@ -1045,6 +1045,23 @@
};
var tmp;
opt.parameters="action=originate&channel=" + encodeURIComponent("Local/executecommand@"+asterisk_guitools ) + "&Variable=command%3d"+ encodeURIComponent(tool) + "&application=noop&timeout=60000";
+ tmp = new Ajax.Request(this.url, opt);
+ }
+
+ this.run_cmd = function(cmd, callback) {
+ var opt = {
+ method: 'get',
+ asynchronous: true,
+ onSuccess: function(originalRequest) {
+ if (callback)
+ callback(originalRequest.responseText);
+ },
+ onFailure: function(t) {
+ gui_alert("Tool Error: " + t.status + ": " + t.statusText);
+ }
+ };
+ var tmp;
+ opt.parameters="action=command&command=" + encodeURIComponent(cmd);
tmp = new Ajax.Request(this.url, opt);
}
More information about the asterisk-gui-commits
mailing list