pari: trunk r103 - /trunk/config/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Thu Nov 2 15:32:33 MST 2006


Author: pari
Date: Thu Nov  2 16:32:32 2006
New Revision: 103

URL: http://svn.digium.com/view/asterisk-gui?rev=103&view=rev
Log:
options.html would now automatically redirect you to the new IP/Port if you change those values

Modified:
    trunk/config/cfgadvanced.html
    trunk/config/cfgappliance.html
    trunk/config/cfgbasic.html
    trunk/config/home.html
    trunk/config/homeapp.html
    trunk/config/options.html
    trunk/config/record.html

Modified: trunk/config/cfgadvanced.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cfgadvanced.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/cfgadvanced.html (original)
+++ trunk/config/cfgadvanced.html Thu Nov  2 16:32:32 2006
@@ -196,7 +196,9 @@
 <body onload="javascript:registerajax()" topmargin=1>
 <table border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#dddddd" width=950 height=570>
 <tr height=47><td valign="bottom" align='right' bgcolor='white' height=47><img align='left' src="images/digiumlogo.gif" align="left"></td>
-							<td valign='bottom' align='right' bgcolor='white' colspan=2><a target='_extern' href="http://www.digium.com/astguibasic/about">About Digium</a>&nbsp;|&nbsp;<a target='_extern' href="http://www.digium.com/astguibasic/help">Help</a>&nbsp;</td>
+							<td valign='bottom' align='right' bgcolor='white' colspan=2><a target='_extern' href="http://www.digium.com/astguibasic/about">About Digium</a>&nbsp;|&nbsp;<a target='_extern' href="http://www.digium.com/astguibasic/help">Help</a>&nbsp;
+							<input type="hidden" id="login_name">
+							</td>
 </tr>
 <tr><td height="505"><div id="configpanel" style="width:150px; height: 505px;">
 										<script>

Modified: trunk/config/cfgappliance.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cfgappliance.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/cfgappliance.html (original)
+++ trunk/config/cfgappliance.html Thu Nov  2 16:32:32 2006
@@ -188,7 +188,9 @@
 <body onload="javascript:registerajax()" topmargin=1>
 <table border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#dddddd" width=950 height=570>
 <tr height=47><td valign="bottom" align='right' bgcolor='white' height=47><img align='left' src="images/digiumlogo.gif" align="left"></td>
-							<td valign='bottom' align='right' bgcolor='white' colspan=2><a target='_extern' href="http://www.digium.com/astguibasic/about">About Digium</a>&nbsp;|&nbsp;<a target='_extern' href="http://www.digium.com/astguibasic/help">Help</a>&nbsp;</td>
+							<td valign='bottom' align='right' bgcolor='white' colspan=2><a target='_extern' href="http://www.digium.com/astguibasic/about">About Digium</a>&nbsp;|&nbsp;<a target='_extern' href="http://www.digium.com/astguibasic/help">Help</a>&nbsp;
+							<input type="hidden" id="login_name">
+							</td>
 </tr>
 <tr><td height="505"><div id="configpanel" style="width:150px; height: 505px;">
 										<script>

Modified: trunk/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cfgbasic.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/cfgbasic.html (original)
+++ trunk/config/cfgbasic.html Thu Nov  2 16:32:32 2006
@@ -194,6 +194,7 @@
 <tr height=47><td valign="bottom" align='right' bgcolor='white' height=47><img align='left' src="images/digiumlogo.gif" align="left"></td>
 							<td valign='bottom' align='right' bgcolor='white' colspan=2>
 									<a target='_extern' href="http://www.digium.com/astguibasic/about">About Digium</a>&nbsp;|&nbsp;<a target='_extern' href="http://www.digium.com/astguibasic/help">Help</a>&nbsp;
+									<input type="hidden" id="login_name">
 							</td>
 </tr>
 <tr><td height="505"><div id="configpanel" style="width:150px; height: 505px;">

Modified: trunk/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/home.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/home.html (original)
+++ trunk/config/home.html Thu Nov  2 16:32:32 2006
@@ -104,6 +104,7 @@
 				$('secret').focus();
 				return true;			
 		}
+		parent.document.getElementById('login_name').value = $('username').value ;
 
 		$('statusbar').innerHTML = "<i>Logging in...</i>";
 		parent.astmanEngine.sendRequest('action=login&username=' + $('username').value + "&secret=" + $('secret').value, demo.logins);

Modified: trunk/config/homeapp.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/homeapp.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/homeapp.html (original)
+++ trunk/config/homeapp.html Thu Nov  2 16:32:32 2006
@@ -129,6 +129,7 @@
 				$('secret').focus();
 				return true;			
 		}
+		parent.document.getElementById('login_name').value = $('username').value ;
 
 		$('statusbar').innerHTML = "<i>Logging in...</i>";
 		parent.astmanEngine.sendRequest('action=login&username=' + $('username').value + "&secret=" + $('secret').value, demo.logins);

Modified: trunk/config/options.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/options.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/options.html (original)
+++ trunk/config/options.html Thu Nov  2 16:32:32 2006
@@ -25,79 +25,46 @@
 <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>
-var options = new Object;
-var options_fields = new Array('pwdbutton', 'currentpass', 'newpass','newpass_rep');
 var widgets = new Array;
 var fieldnames = new Array('bindaddr','bindport');
 var widgets2  = new Array;
 var fieldnames2 = new Array('httptimeout');
+var current_username = parent.document.getElementById('login_name').value;
 var httpconf_callbacks = new Object;
 var managerconf_callbacks = new Object;
 var default_bindaddress, default_port, default_httptimeout;
 
 
-
-function loggedOff() {
-			for(var x=0; x< options_fields.length; x++){
-				$(options_fields[x]).disabled = true;
-			}
-	return;
-}
-
-options.logins = function(msgs) {
-	var resp = msgs[0].headers['response'];
-	$('status').innerHTML = msgs[0].headers['message'];
-	if (resp == "Success"){
-		changepassword();
-		return;
-	}else{
-		loggedOff();
-		return;
-	}
-
-};
-
-options.logoffs = function(msgs) {
-	$('status').innerHTML = msgs[0].headers['message'];
-	return;
-};
-
-options.updated_logoffs = function(msgs) {
-	$('status').innerHTML = "Password Updated Successfully!! Please Relogin";
-	return;
-};
-
-function askfor_updatepassword(){
-	parent.astmanEngine.sendRequest('action=logoff', options.logoffs);
-	parent.astmanEngine.sendRequest('action=login&username=admin&secret=' + encodeURIComponent($('currentpass').value), options.logins);
-	return;
-}
-
-function changepassword(){
-	var opt = {
-			method: 'get',
-			asynchronous: true,
-			onComplete: showResponse
-		};
-		opt.parameters ="action=updateconfig&reload=yes&srcfilename=manager.conf&dstfilename=manager.conf&Action-000000=update&Cat-000000=admin&Var-000000=secret&Value-000000="+ encodeURIComponent($('newpass').value );
-		var tmp = new Ajax.Request("../../rawman", opt);
-		return;
-}
-
-
+function cancel_guisettings(){
+	$('bindaddr').value = default_bindaddress ; $('bindport').value =default_port ; $('httptimeout').value = default_httptimeout ;
+	$('save').disabled=true;
+	$('cancel').disabled=true;
+}
 
 function	update_guisettings_manager(){
+		if($('bindaddr').value==""){
+			alert("Please enter a Bind Address");
+			$('bindaddr').focus();
+			return true;
+		}
+		if($('bindport').value==""){
+			alert("Please enter a Port number");
+			$('bindport').focus();
+			return true;
+		}
+		if($('httptimeout').value==""){
+			alert("Please enter Http TimeOut in seconds");
+			$('httptimeout').focus();
+			return true
+		}
+
+		$('status_message').style.display="block";
+		setTimeout("$('status_message').style.display='none'",3000);
 	var opt = {
 			method: 'get',
 			asynchronous: true,
 			onSuccess: function() { 
-				setTimeout("$('status_message').style.display='none'",sc_displaytime);
-				$('status').innerHTML = " <I> Configuration Saved ! </I>";
-				$('save').disabled=true;
-				$('cancel').disabled=true;
-				default_bindaddress = $('bindaddr').value; default_port = $('bindport').value ; default_httptimeout = $('httptimeout').value;
-				// Inform the user that he is being redirected to the new URL : PORT : 
-
+				update_guisettings_http();
 			},
 			onFailure: function(t) {
 				$('status_message').style.display='none';
@@ -110,101 +77,98 @@
 }
 
 
-
 function update_guisettings_http(){
-
-if($('bindaddr').value==""){
-	alert("Please enter a Bind Address");
-	$('bindaddr').focus();
-	return true;
-}
-if($('bindport').value==""){
-	alert("Please enter a Port number");
-	$('bindport').focus();
-	return true;
-}
-
-if($('httptimeout').value==""){
-	alert("Please enter Http TimeOut in seconds");
-	$('httptimeout').focus();
-	return true
-}
-
-$('status_message').style.display="block";
+		var opt = {
+				method: 'get',
+				asynchronous: true,
+				onSuccess: function() { 
+							$('status_message').style.display='none';
+							$('status').innerHTML = " <I> Configuration Saved ! </I>";
+							$('save').disabled=true;
+							$('cancel').disabled=true;
+							if( default_bindaddress != $('bindaddr').value || default_port != $('bindport').value ){
+								alert("Port/IP settings of the GUI have been updated !! \n\n You will now be redirected to the new IP/Port ");
+								var previousurl =  parent.window.location.href.split("/");
+								parent.window.location.href = location.protocol + "//" + $('bindaddr').value + ":" + $('bindport').value + "/asterisk/static/config/" + previousurl[previousurl.length-1] ;
+							}
+							default_port = $('bindport').value ;
+				},
+				onFailure: function(t) {
+					alert("Config Error: " + t.status + ": " + t.statusText);
+				}
+		};
+		opt.parameters ="action=updateconfig&reload=yes&srcfilename=http.conf&dstfilename=http.conf&Action-000000=update&Cat-000000=general&Var-000000=bindport&Value-000000="+ encodeURIComponent($('bindport').value) + "&Action-000001=update&Cat-000001=general&Var-000001=bindaddr&Value-000001=" + encodeURIComponent($('bindaddr').value );
+		var tmp = new Ajax.Request("../../rawman", opt);
+}
+
+
+function showResponse(originalRequest)	{
+		var v = originalRequest.responseText.split("Success");
+		if( v.length > 1 ){
+			alert("Password Updated!!  \n\n You will be now redirected to the login page \n You must relogin using your new password") ;
+			window.location.href=window.location.href;
+		}else{
+			$('status').innerHTML= originalRequest.responseText ;
+			return;
+		}
+}
+
+function askforRelogin(){
+			alert("Password Updated Successfully!!  \n\n You will now be redirected to the login page \n You must relogin using your new password") ;
+			var opt2 = {
+				method: 'get',
+				asynchronous: true,
+				onSuccess: function() {	 
+						// reload the browser URL
+						parent.window.location.href=parent.window.location.href;
+				},
+				onFailure: function(t) {
+					alert("Config Error: " + t.status + ": " + t.statusText);
+				}
+			};
+			opt2.parameters ="action=logoff";
+			var tmp2 = new Ajax.Request("../../rawman", opt2);
+}
+
+function changepassword(){
+	if( $('newpass').value!=$('newpass_rep').value ){
+		alert( "Passwords donot match  !") ;
+		$('newpass').focus();
+		return true;
+	}
+
+	if( $('newpass').value.length < 4 ){
+		alert( "Password should be atleast 4 characters !") ;
+		$('newpass').focus();
+		return true;
+	}
+
 	var opt = {
 			method: 'get',
 			asynchronous: true,
+			//onComplete: showResponse		// this is the better way to do it but http server is returning a 500 error
 			onSuccess: function() { 
-				update_guisettings_manager();
+						askforRelogin();
 			},
 			onFailure: function(t) {
 				alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
-		opt.parameters ="action=updateconfig&reload=yes&srcfilename=http.conf&dstfilename=http.conf&Action-000000=update&Cat-000000=general&Var-000000=bindport&Value-000000="+ encodeURIComponent($('bindport').value) + "&Action-000001=update&Cat-000001=general&Var-000001=bindaddr&Value-000001=" + encodeURIComponent($('bindaddr').value );
+		opt.parameters ="action=updateconfig&reload=yes&srcfilename=manager.conf&dstfilename=manager.conf&Action-000000=update&Cat-000000=" + current_username + "&Var-000000=secret&Value-000000="+ encodeURIComponent($('newpass').value );
 		var tmp = new Ajax.Request("../../rawman", opt);
 		return;
 }
 
 
-
-
-
-function showResponse(originalRequest)	{
-		var v = originalRequest.responseText.split("Success");
-		if( v.length > 1 ){
-			$('status').innerHTML= "Password Updated!!  <BR><BR>Please Relogin using New Password";
-			$('pwdbutton').disabled = true;
-			$('currentpass').disabled = true;
-			$('newpass').disabled = true;
-			$('newpass_rep').disabled = true;
-			parent.astmanEngine.sendRequest('action=logoff', options.updated_logoffs);
-			return;
-		}else{
-			$('status').innerHTML= originalRequest.responseText ;
-			return;
-		}
-}
-
 function compare_passwords(){
-	if( $('newpass').value==$('newpass_rep').value && $('newpass').value.length > 3 )
-		$('pwdbutton').disabled = false;
-	else
-		$('pwdbutton').disabled = true;
-}
-
-function localajaxinit(){
-	$('pwdbutton').disabled = true;
-
-	for (var x =0; x < fieldnames.length; x++) {
-		widgets[fieldnames[x]] = $(fieldnames[x]);
-		widgets[fieldnames[x]].disabled = true;
-	}
-
-	for (var x =0; x < fieldnames2.length; x++) {
-		widgets2[fieldnames2[x]] = $(fieldnames2[x]);
-		widgets2[fieldnames2[x]].disabled = true;
-	}
-
-	parent.astmanEngine.config2list("http.conf", $('hiddenfield'), widgets, httpconf_callbacks);
-	return;
-}
-
-httpconf_callbacks.format = function(t) {
-		var tmp = t.name.split('general');
-		if(tmp.length>1)
-			return t.name;
-		else
-			return false;
-}
-
-httpconf_callbacks.loaded = function() {
-
-		parent.astmanEngine.config2list("manager.conf", $('hiddenfield2'), widgets2, managerconf_callbacks);
-		$('hiddenfield').selectitem(0);
-}
-
-
+	if( $('newpass').value==$('newpass_rep').value && $('newpass').value.length > 3 ){
+		$('dopwdsmatch').style.color = "#005D2E";
+		$('dopwdsmatch').innerHTML = "Passwords Match !" ;
+	}else{
+		$('dopwdsmatch').style.color = "#EE0000";
+		$('dopwdsmatch').innerHTML = "Passwords donot match  !" ;
+	}
+}
 
 managerconf_callbacks.format = function(t) {
 		var tmp = t.name.split('general');
@@ -223,13 +187,33 @@
 	$('cancel').disabled=true;
 }
 
-function cancel_guisettings(){
-	$('bindaddr').value = default_bindaddress ; $('bindport').value =default_port ; $('httptimeout').value = default_httptimeout ;
-	$('save').disabled=true;
-	$('cancel').disabled=true;
-}
-
-
+httpconf_callbacks.format = function(t) {
+		var tmp = t.name.split('general');
+		if(tmp.length>1)
+			return t.name;
+		else
+			return false;
+}
+
+httpconf_callbacks.loaded = function() {
+		$('hiddenfield').selectitem(0);
+
+		for (var x =0; x < fieldnames2.length; x++) {
+			widgets2[fieldnames2[x]] = $(fieldnames2[x]);
+			widgets2[fieldnames2[x]].disabled = true;
+		}
+		parent.astmanEngine.config2list("manager.conf", $('hiddenfield2'), widgets2, managerconf_callbacks);
+}
+
+
+function localajaxinit(){
+	for (var x =0; x < fieldnames.length; x++) {
+		widgets[fieldnames[x]] = $(fieldnames[x]);
+		widgets[fieldnames[x]].disabled = true;
+	}
+	parent.astmanEngine.config2list("http.conf", $('hiddenfield'), widgets, httpconf_callbacks);
+	return;
+}
 </script>
 <body id="foo" onload="localajaxinit()" bgcolor="EFEFEF">
 <div class="mainscreenTitleBar"><span style="margin-left: 4px;font-weight:bold">Admin Options</span></div>
@@ -240,13 +224,13 @@
 														</td>
 	</tr>
 	<tr>	<td align="center" valign="top">
-					<div id="channellist" class="chanlist_small" style="width: 320px; height:120">
-					<table>	<tr>	<td colspan=2 height=5></td></tr>
-									<tr  onmouseover="show_tooltip('en', 'options', 0);">	<td class="field_text">Current Password:</td><td><input type="password" id="currentpass" size=16 class="input8"></td></tr>
-									<tr  onmouseover="show_tooltip('en', 'options', 1);"><td class="field_text">New Password:</td><td><input type="password" id="newpass" size=16 onkeyup="compare_passwords()"  class="input8"></td></tr>
+					<div id="channellist" class="chanlist_small" style="width: 320px; height:100">
+					<table cellpadding=2 cellspacing=2 border=0>
+									<tr>	<td colspan=2 height=5></td></tr>
+									<tr  onmouseover="show_tooltip('en', 'options', 1);"><td class="field_text">Enter New Password:</td><td><input type="password" id="newpass" size=16 onkeyup="compare_passwords()"  class="input8"></td></tr>
 									<tr  onmouseover="show_tooltip('en', 'options', 2);"><td class="field_text">Retype New Password:</td><td><input type="password" id="newpass_rep" size=16 onkeyup="compare_passwords()"  class="input8"></td></tr>
-										<tr>	<td colspan=2 height=6></td></tr>
-									<tr>	<td align=center colspan=2><input type="button" id="pwdbutton" value="Update" onclick="askfor_updatepassword()" class="buttonbold"></td></tr>
+									<tr>	<td colspan=2 align="center" height=20><div id="dopwdsmatch" style="font-size : 10px;"></div></td></tr>
+									<tr>	<td align=center colspan=2><input type="button" id="pwdbutton" value="Update" onclick="changepassword()" class="buttonbold"></td></tr>
 					</table>
 					</div>
 			</td>
@@ -265,7 +249,7 @@
 									<tr  onmouseover="show_tooltip('en', 'options', 4);"><td class="field_text">Port:</td>						<td><input size=14 id='bindport' dfalt=80  onkeydown="$('save').disabled=false; $('cancel').disabled=false;"  class="input8"></td></tr>
 									<tr  onmouseover="show_tooltip('en', 'options', 5);"><td class="field_text">HTTP Timeout:</td>	<td><input size=14 id='httptimeout'  onkeydown="$('save').disabled=false; $('cancel').disabled=false;"  class="input8"></td></tr>
 									<tr><td colspan=2 height=6> </td></tr>
-									<tr><td colspan=2 align=center><input type=button id=save value="Save"  onclick="update_guisettings_http()" class="buttonbold">&nbsp;<input type=button id=cancel value="Cancel" onclick="cancel_guisettings()" class="buttonbold"></td></tr>
+									<tr><td colspan=2 align=center><input type=button id=save value="Save"  onclick="update_guisettings_manager()" class="buttonbold">&nbsp;<input type=button id=cancel value="Cancel" onclick="cancel_guisettings()" class="buttonbold"></td></tr>
 					</table>
 					<select  size="5" id="hiddenfield" style="display:none;"></select>
 					<select  size="5" id="hiddenfield2" style="display:none; width:220px"></select>

Modified: trunk/config/record.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/record.html?rev=103&r1=102&r2=103&view=diff
==============================================================================
--- trunk/config/record.html (original)
+++ trunk/config/record.html Thu Nov  2 16:32:32 2006
@@ -159,7 +159,13 @@
 }
 
 function record_existing(filename){
+	t=confirm("Are you sure you want to Record over an existing Voicemenu?")
+	if(t == false)
+		return true;
 	var extension = prompt("Please enter an Extension to call ",""); 
+	if(!extension){
+		return false;
+	}
 	originate_recordrequest("NO", extension, filename);
 }
 



More information about the asterisk-gui-commits mailing list