pari: trunk r173 - /trunk/config/setup/2.html

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Mon Dec 18 17:25:16 MST 2006


Author: pari
Date: Mon Dec 18 18:25:15 2006
New Revision: 173

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=173
Log:
AM/PM format instead of 24 hr format and also fixed a bug - gui_sysinfo script was not being called properly

Modified:
    trunk/config/setup/2.html

Modified: trunk/config/setup/2.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/setup/2.html?view=diff&rev=173&r1=172&r2=173
==============================================================================
--- trunk/config/setup/2.html (original)
+++ trunk/config/setup/2.html Mon Dec 18 18:25:15 2006
@@ -53,21 +53,11 @@
 
 
 function update_sysinfo(){
-	var opt = {
-			method: 'get',
-			asynchronous: true,
-			onSuccess: function() { 
-					// then load the gui_sysinfo.conf
+	parent.astmanEngine.run_tool("sh /etc/asterisk/gui_sysinfo", onSuccess = function() { 
 					parent.astmanEngine.config2list("gui_sysinfo.conf", $('sysinfo'), new Array(), sysinfocallbacks);
-			},		
-			onFailure: function(t) {
-				$('status_message').style.display='none';
-				alert("Config Error: " + t.status + ": " + t.statusText);
-			}
-		};
-		opt.parameters="action=originate&channel=" + encodeURIComponent("Local/sysinfo@"+parent.asterisk_guitools) + "&application=noop&timeout=60000";
-		var tmp = new Ajax.Request(rawman_url, opt);
-		return;
+				}
+	);
+	return;
 }
 
 sysinfocallbacks.format = function(t, x) {
@@ -105,8 +95,16 @@
 		}
 
 		var temp = timeofday.split(':');
+
+		if(parseInt(temp[0]) <=12 ){
+				var hourofday = parseInt(temp[0]);
+				$('ampm').selectedIndex = 0;
+		}else{
+				var hourofday = parseInt(temp[0]) -12 ;
+				$('ampm').selectedIndex = 1;
+		}
 		for(var i=0; i < $('hod').length; i++){
-					if (  $('hod').options[i].value == parseFloat(temp[0])  ){
+					if (  $('hod').options[i].value ==  hourofday ){
 							$('hod').selectedIndex = i;
 							break;
 					}
@@ -151,8 +149,14 @@
 		};
 
 		// prepare commands to set the date 
+		if( $('ampm').value == "AM"  ){
+			var hourofday = $('hod').value;
+		}else if( $('ampm').value == "PM"  ){
+			var hourofday = parseInt( $('hod').value) + 12 ;
+		}
+
 		var newdate = $('year').value + "-" + ($('moy').selectedIndex +1) + "-" + $('dom').value + " " 
-		+$('hod').value + ":" + $('minute').value + ":" + $('second').value ;
+		+ hourofday + ":" + $('minute').value + ":" + $('second').value ;
 
 		opt.parameters="action=originate&channel=" + encodeURIComponent("Local/executecommand@"+parent.asterisk_guitools ) + "&Variable=command%3d"+ encodeURIComponent("date --set='" + newdate + "'" ) + "&application=noop&timeout=60000";
 		var tmp = new Ajax.Request(rawman_url, opt);
@@ -210,7 +214,7 @@
 						<!-- Time -->
 								<select id="hod" onchange="updated();">
 								<SCRIPT LANGUAGE="JavaScript">
-										for(var i=1; i < 24; i++){
+										for(var i=1; i < 13; i++){
 											var x = '';
 											if( i < 10) { x = '0' ; }
 											document.write( '<option value="' + x + i + '">' + x +i + '</option>' ); 
@@ -232,6 +236,7 @@
 											document.write( '<option value="' + x +i + '">' + x +i + '</option>' ); 
 										}
 								</SCRIPT>
+								&nbsp;<select id="ampm" onchange="updated();"><option value="AM">AM</option><option value="PM">PM</option></select>
 								</select>
 						<!-- Time -->
 						</TD>
@@ -256,8 +261,4 @@
 		</tr>
 </table>
 </BODY>
-</HTML>
-
-
-
-
+</HTML>



More information about the asterisk-gui-commits mailing list