pari: branch aadk r730 - in /branches/aadk/config: cfgbasic.html
home.html
asterisk-gui-commits at lists.digium.com
asterisk-gui-commits at lists.digium.com
Mon Apr 23 14:06:54 MST 2007
Author: pari
Date: Mon Apr 23 16:06:53 2007
New Revision: 730
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=730
Log:
experimental : moving 'Apply Changes' from header to home.html
Modified:
branches/aadk/config/cfgbasic.html
branches/aadk/config/home.html
Modified: branches/aadk/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/cfgbasic.html?view=diff&rev=730&r1=729&r2=730
==============================================================================
--- branches/aadk/config/cfgbasic.html (original)
+++ branches/aadk/config/cfgbasic.html Mon Apr 23 16:06:53 2007
@@ -236,20 +236,6 @@
var newwindow_href = location.protocol + '//' + location.hostname + ':8003';
window.open(newwindow_href ,'mainwindow','width=1024,height=768,resizable=yes, scrollbars=no, toolbar=no, location=no,status=yes, menubar=no')
}
-
-function reloadConfig(){
- _$('reloadconfig').style.display = 'none';
- window.setTimeout( function(){ _$('reloadconfig').style.display=""; }, asterisk_guifbt );
- var opt = {
- method: 'get',
- asynchronous: true,
- onSuccess: function(t) { gui_feedback("Restarted Asterisk !!",'blue'); } ,
- onFailure: function(t) { gui_alert("Config Error: " + t.status + ": " + t.statusText); }
- };
- var uri = parent.build_action('renamecat', 0, "default","", "default", "");
- opt.parameters="action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
- var tmp = new Ajax.Request(asterisk_rawmanPath , opt);
-}
</script>
<head>
<title>Asterisk Configuration GUI (Beta)</title>
@@ -298,7 +284,7 @@
</td>
<td valign=top width=250 height="505">
<div class="mainscreenTooltipBar" align=right>
- <span id="reloadconfig" style="display:none"></span> <span id="logoutlink" style="display:none"></span>
+ <span id="logoutlink" style="display:none"></span>
</div>
<div id="tooltip_round" class="tooltip_round">
<div id='tooltip' style="margin-left:4px; font-family : Trebuchet MS, Arial, Helvetica, sans-serif;font-size: 11px; "><script>document.write(tooltip_default);</script></div>
Modified: branches/aadk/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/home.html?view=diff&rev=730&r1=729&r2=730
==============================================================================
--- branches/aadk/config/home.html (original)
+++ branches/aadk/config/home.html Mon Apr 23 16:06:53 2007
@@ -28,6 +28,25 @@
var asterisk_guitools = parent.asterisk_guitools;
var asterisk_rawmanPath = parent.asterisk_rawmanPath;
+function showdiv_statusmessage(){
+ var h= document.createElement("div");
+ h.setAttribute("id","status_message");
+ var _hs = h.style;
+ _hs.display="none";
+ _hs.position="absolute";
+ _hs.left= 170;
+ _hs.top= 190;
+ _hs.width= 350;
+ _hs.height= 115;
+ _hs.backgroundColor= "#F4EFE5";
+ _hs.borderWidth= "1px";
+ _hs.borderColor= "#7E5538";
+ _hs.borderStyle= "solid";
+ h.innerHTML = "<BR><BR><TABLE border=0 cellpadding=0 cellspacing=3 align=\"center\"> <TR> <TD><img src=\"images/loading.gif\"></TD> <TD valign=\"middle\" align=\"center\"> <div id=\"message_text\"></div></TD> </TR> </TABLE> ";
+ document.body.appendChild(h);
+}
+
+
function updateButtons(){
var f = parent.loggedon;
_$('username').disabled = (f)?1:0;
@@ -36,6 +55,7 @@
_$('login').disabled = (f)?1:0;
_$('reboot').disabled = (f)?0:1;
_$('factorydefault').disabled = (f)?0:1;
+ _$('reloadconfig').disabled = (f)?0:1;
_$('saveconfig').disabled = (f)?0:1;
if(!f){ try{ _$('username').focus();}catch(err){ } }
}
@@ -65,10 +85,6 @@
_$('secret').className = "input9_disabled";
updateButtons();
_$('statusbar').innerHTML = "<img src='images/tick.gif'><i>Connected!</i>";
- var _rc = parent._$('reloadconfig');
- _rc.innerHTML = "Activate Changes";
- _rc.onclick = parent.reloadConfig ;
- _rc.style.display = "" ;
var _ll = parent._$('logoutlink');
_ll.innerHTML = "Logout";
_ll.onclick = parent.Logoff ;
@@ -114,7 +130,7 @@
if (resp == "Pong") {
_$('statusbar').innerHTML = "<i>Already connected...</i>";
loggedOn();
- parent.loadscreen(this);
+ if( window.location.href.match("reload=yes") ){ parent._$('mainscreen').style.display = ''; reload_Config2(); }else{ parent.loadscreen(this); }
} else {
_$('statusbar').innerHTML = "<i>Please login...</i>";
loggedOff();
@@ -148,6 +164,7 @@
}
function localinit() {
+ showdiv_statusmessage();
top.document.title = "Asterisk GUI (Beta) -- Home";
localajaminit();
}
@@ -186,9 +203,25 @@
}
+
function doSaveConfig() {
- parent.astmanEngine.run_tool("/bin/save_config",onSuccess = function() { alert("Configuration Saved"); } );
-}
+ flipbuttons(true);
+ _$('message_text').innerHTML ="Saving Changes...";
+ _$('status_message').style.display ="" ;
+ parent.astmanEngine.run_tool("/bin/save_config",onSuccess = function() {
+ parent.gui_feedback("Please wait while saving Configuration !!",'green');
+ setTimeout( doSaveConfig2, 5000 );
+ });
+}
+
+
+function doSaveConfig2(){
+ parent.gui_feedback("Configuration Saved !!",'blue');
+ _$('status_message').style.display ="none" ;
+ alert("Configuration Saved");
+ flipbuttons(false);
+}
+
function doReboot() {
if (confirm("Are you sure you want to reboot the appliance?")) {
@@ -199,8 +232,51 @@
function doFactoryDefault() {
if (confirm("Are you sure you want to reset to factory defaults?")) {
- parent.astmanEngine.run_tool("/bin/reset_config",onSuccess = function() { alert("Resetting to defaults. Please reboot!"); } );
- }
+ flipbuttons(true);
+ _$('message_text').innerHTML ="Resetting to factory defaults...";
+ _$('status_message').style.display ="" ;
+ parent.astmanEngine.run_tool("/bin/reset_config",onSuccess = function() { _$('status_message').style.display ="none" ; alert("Please reboot to apply factory defaults!"); flipbuttons(false);} );
+ }
+}
+
+
+function reload_Config(){
+ window.location.href = window.location.href + "?reload=yes";
+}
+
+function reload_Config2(){
+ flipbuttons(true);
+ _$('reloadconfig').disabled = true;
+ _$('message_text').innerHTML ="Restarting Asterisk...";
+ _$('status_message').style.display ="" ;
+ var opt = {
+ method: 'get',
+ asynchronous: true,
+ onSuccess: function() {
+ parent.gui_feedback("Please wait while restarting Asterisk !!",'green');
+ setTimeout( reload_config3, 5000 );
+ },
+ onFailure: function(t) { gui_alert("Config Error: " + t.status + ": " + t.statusText); }
+ };
+ var uri = parent.build_action('renamecat', 0, "default","", "default", "");
+ opt.parameters="action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
+ var tmp = new Ajax.Request(asterisk_rawmanPath , opt);
+}
+
+function reload_config3(){
+ parent.gui_feedback("Restarted Asterisk !!",'blue');
+ _$('status_message').style.display = "none" ;
+ alert("Changes applied successfully");
+ flipbuttons(false);
+ parent.loadscreen(this);
+}
+
+
+function flipbuttons(r){
+ _$('reboot').disabled = r;
+ _$('factorydefault').disabled = r;
+ _$('reloadconfig').disabled = r;
+ _$('saveconfig').disabled = r;
}
</script>
<body id="foo" onload="localinit()" topmargin=0 bgcolor="EFEFEF">
@@ -234,6 +310,8 @@
<tr><td align='center' colspan='2'>
<input type="submit" id="saveconfig" value="Save Configuration" disabled=1 onClick="doSaveConfig()">
+ <input type="submit" id="reloadconfig" value="Activate Changes" disabled=1 onClick="reload_Config()">
+
<input type="submit" id="reboot" value="Reboot" disabled=1 onClick="doReboot()">
<input type="submit" id="factorydefault" value="Factory Defaults" disabled=1 onClick="doFactoryDefault()">
More information about the asterisk-gui-commits
mailing list