rbrindley: branch 2.0 r4891 - /branches/2.0/config/date.html
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Mon Jun 22 16:34:00 CDT 2009
Author: rbrindley
Date: Mon Jun 22 16:33:57 2009
New Revision: 4891
URL: http://svn.asterisk.org/svn-view/asterisk-gui?view=rev&rev=4891
Log:
- Added the following to the Date & Time page
- HTML 4.01 DOCTYPE
- <html>, <head>, <title>, and "Content-Type" <meta>
- moved js to the bottom
Modified:
branches/2.0/config/date.html
Modified: branches/2.0/config/date.html
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/date.html?view=diff&rev=4891&r1=4890&r2=4891
==============================================================================
--- branches/2.0/config/date.html (original)
+++ branches/2.0/config/date.html Mon Jun 22 16:33:57 2009
@@ -1,3 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
* Asterisk-GUI - an Asterisk configuration interface
*
@@ -19,154 +20,158 @@
*
*
-->
-<script src="js/jquery.js"></script>
-<script src="js/astman.js"></script>
-<script src="js/jquery.tooltip.js"></script>
-<script src="js/jquery.date_input.js"></script>
-<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
-<style type="text/css">
+<html>
+<head>
+ <title>Update Date & Time</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
-</style>
-<script>
+ <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
+ <style type="text/css"></style>
+</head>
+<body>
+ <div class="iframeTitleBar"> Update Date & Time <span style="cursor: pointer; cursor: hand;" onclick="window.location.reload();" > <img src="images/refresh.png" title=" Refresh " border=0 > </span> </div>
-function localajaxinit(){
- top.document.title = 'Set Date & Time' ;
- parent.ASTGUI.dialog.waitWhile('Loading...');
- $("#date_day").date_input();
+ <div class='lite_Heading'> Update Date & Time </div>
- (function(){
- var x;
- var hod = _$('hod');
- var minute = _$('minute');
- for(var i=1; i < 13; i++){
- x = i.addZero();
- ASTGUI.selectbox.append(hod, x , x);
- }
- for(var i=0; i < 60; i++){
- x = i.addZero();
- ASTGUI.selectbox.append(minute, x , x);
- }
- hod.selectedIndex = -1;
- minute.selectedIndex = -1;
- })();
+ <table width=700 border=0 align=left>
+ <tr> <td align=right><B>NTP server :</B></td>
+ <td>
+ <span id='NTPSERVER'></span>
+ <A href='#' class='splbutton' title='Edit NTP server' onclick="parent.miscFunctions.click_panel('networking.html');"><B>Edit</B></A>
+ </td>
+ </tr>
- (function(){
- var c = context2json({ filename:'networking.conf' , context : 'general' , usf:1 });
- _$('NTPSERVER').innerHTML = (c && c['NTP_ADDRESS']) || ' --';
- })();
+ <tr> <td height=15></td><td></td></tr>
- ASTGUI.systemCmdWithOutput( "date ", function(output){
- _$('current_date').innerHTML = ' ' + output.bold_X('UTC') ;
- _$('current_date_local').innerHTML = ' ' + ASTGUI.toLocalTime(output);
- parent.ASTGUI.dialog.hide();
- });
-};
+ <tr> <td valign=top align=right><B>Current System Date :</B></td>
+ <td id='current_date'></td>
+ </tr>
+ <tr class='lite'>
+ <td valign=top align=right><B>Current System Date in Local Time :</B></td>
+ <td id='current_date_local'></td>
+ </tr>
+
+ <tr> <td height=15></td><td></td></tr>
+
+ <tr> <td valign=top align=right>
+ <B>Set New Date & Time :</B><BR>
+ <span class='lite'>Enter Date & Time in your Local time </span>
+ </td>
+ <td> <TABLE cellpadding=6 cellspacing=1 border=0>
+ <TR> <TD width=70 align=right>Date </TD>
+ <TD><input size=10 id="date_day"></TD>
+ </TR>
+ <TR> <TD width=70 align=right>Time</TD>
+ <TD> <!-- Time -->
+ <select id="hod"></select>:
+ <select id="minute"></select>
+ <select id="ampm">
+ <option value="AM">AM</option>
+ <option value="PM">PM</option>
+ </select>
+ <!-- Time -->
+ </TD>
+ </TR>
+ <TR>
+ <TD colspan=2 align=center>
+ <span class='guiButton' onclick='update_systemdate();'>Update</span>
+ </TD>
+ </TR>
+ </TABLE>
+ </td>
+ </tr>
+ </table>
+ <script src="js/jquery.js"></script>
+ <script src="js/astman.js"></script>
+ <script src="js/jquery.tooltip.js"></script>
+ <script src="js/jquery.date_input.js"></script>
+ <script>
+
+ function localajaxinit(){
+ top.document.title = 'Set Date & Time' ;
+ parent.ASTGUI.dialog.waitWhile('Loading...');
+ $("#date_day").date_input();
+
+ (function(){
+ var x;
+ var hod = _$('hod');
+ var minute = _$('minute');
+ for(var i=1; i < 13; i++){
+ x = i.addZero();
+ ASTGUI.selectbox.append(hod, x , x);
+ }
+ for(var i=0; i < 60; i++){
+ x = i.addZero();
+ ASTGUI.selectbox.append(minute, x , x);
+ }
+ hod.selectedIndex = -1;
+ minute.selectedIndex = -1;
+ })();
+
+ (function(){
+ var c = context2json({ filename:'networking.conf' , context : 'general' , usf:1 });
+ _$('NTPSERVER').innerHTML = (c && c['NTP_ADDRESS']) || ' --';
+ })();
+
+ ASTGUI.systemCmdWithOutput( "date ", function(output){
+ _$('current_date').innerHTML = ' ' + output.bold_X('UTC') ;
+ _$('current_date_local').innerHTML = ' ' + ASTGUI.toLocalTime(output);
+ parent.ASTGUI.dialog.hide();
+ });
+ };
-function update_systemdate(){
- parent.ASTGUI.dialog.waitWhile('Updating Date & Time ...');
- try{
- // convert local time to UTC
- var lt_minutes = _$('minute').value ; // 0 to 59
- var date_day = _$("date_day").value ;
- if( !date_day || (_$('hod').selectedIndex == -1 ) || ( _$('minute').selectedIndex == -1) ){
- parent.ASTGUI.dialog.hide();
- return;
+ function update_systemdate(){
+ parent.ASTGUI.dialog.waitWhile('Updating Date & Time ...');
+ try{
+ // convert local time to UTC
+ var lt_minutes = _$('minute').value ; // 0 to 59
+ var date_day = _$("date_day").value ;
+ if( !date_day || (_$('hod').selectedIndex == -1 ) || ( _$('minute').selectedIndex == -1) ){
+ parent.ASTGUI.dialog.hide();
+ return;
+ }
+
+ var date_day_split = date_day.split(' ');
+ var lt_month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].indexOf(date_day_split[1]); // 0 to 11
+ var lt_dom = date_day_split[0] ; // 1 to 31
+ lt_dom = lt_dom.addZero() ;
+ var lt_year = date_day_split[2] ; // 2007
+ // prepare commands to set the date
+ if( _$('ampm').value == "AM" ){
+ var lt_hours = (_$('hod').value == "12" )? "00" : _$('hod').value;
+ }else if( _$('ampm').value == "PM"){
+ var lt_hours = ( _$('hod').value == "12") ? parseInt( _$('hod').value) : parseInt( _$('hod').value) + 12 ;
+ }
+ var lt = new Date();
+ lt.setFullYear ( lt_year, lt_month, lt_dom );
+ lt.setHours ( lt_hours, lt_minutes );
+ var utc_hours = lt.getUTCHours(); // 0 to 23
+ var utc_minutes = lt.getUTCMinutes(); // 0 to 59
+ var utc_month = lt.getUTCMonth(); // 0 to 11
+ var utc_dom = lt.getUTCDate(); // 1 to 31
+ var utc_year = lt.getUTCFullYear() ; // 2007
+ if (utc_month < 10) { utc_month = "0"+ String(utc_month+1); }else{utc_month = String(utc_month+1) ;}
+ if (utc_dom < 10) { utc_dom = "0"+ String(utc_dom) ; }
+ if (utc_hours < 10) { utc_hours = "0"+ String(utc_hours) ; }
+ if (utc_minutes < 10) { utc_minutes = "0"+ String(utc_minutes) ; }
+ var newdate = utc_month + utc_dom + utc_hours + utc_minutes + utc_year ;
+ }catch(err){
+ parent.ASTGUI.dialog.hide();
+ return false;
}
+ parent.ASTGUI.systemCmd( "date -s " + newdate , function(){
+ parent.ASTGUI.dialog.hide();
+ var after = function(){
+ alert("You will be now logged out of the gui.\n Please login again !!");
+ var f = makeSyncRequest({ action :'logoff'});
+ top.window.location.reload();
+ };
+ ASTGUI.feedback( { msg:'updated date & time', showfor:2 });
+ setTimeout( after, 1000 );
+ });
+ }
- var date_day_split = date_day.split(' ');
- var lt_month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].indexOf(date_day_split[1]); // 0 to 11
- var lt_dom = date_day_split[0] ; // 1 to 31
- lt_dom = lt_dom.addZero() ;
- var lt_year = date_day_split[2] ; // 2007
- // prepare commands to set the date
- if( _$('ampm').value == "AM" ){
- var lt_hours = (_$('hod').value == "12" )? "00" : _$('hod').value;
- }else if( _$('ampm').value == "PM"){
- var lt_hours = ( _$('hod').value == "12") ? parseInt( _$('hod').value) : parseInt( _$('hod').value) + 12 ;
- }
- var lt = new Date();
- lt.setFullYear ( lt_year, lt_month, lt_dom );
- lt.setHours ( lt_hours, lt_minutes );
- var utc_hours = lt.getUTCHours(); // 0 to 23
- var utc_minutes = lt.getUTCMinutes(); // 0 to 59
- var utc_month = lt.getUTCMonth(); // 0 to 11
- var utc_dom = lt.getUTCDate(); // 1 to 31
- var utc_year = lt.getUTCFullYear() ; // 2007
- if (utc_month < 10) { utc_month = "0"+ String(utc_month+1); }else{utc_month = String(utc_month+1) ;}
- if (utc_dom < 10) { utc_dom = "0"+ String(utc_dom) ; }
- if (utc_hours < 10) { utc_hours = "0"+ String(utc_hours) ; }
- if (utc_minutes < 10) { utc_minutes = "0"+ String(utc_minutes) ; }
- var newdate = utc_month + utc_dom + utc_hours + utc_minutes + utc_year ;
- }catch(err){
- parent.ASTGUI.dialog.hide();
- return false;
- }
- parent.ASTGUI.systemCmd( "date -s " + newdate , function(){
- parent.ASTGUI.dialog.hide();
- var after = function(){
- alert("You will be now logged out of the gui.\n Please login again !!");
- var f = makeSyncRequest({ action :'logoff'});
- top.window.location.reload();
- };
- ASTGUI.feedback( { msg:'updated date & time', showfor:2 });
- setTimeout( after, 1000 );
- });
-}
-
-</script>
-<body>
-<div class="iframeTitleBar"> Update Date & Time <span style="cursor: pointer; cursor: hand;" onclick="window.location.reload();" > <img src="images/refresh.png" title=" Refresh " border=0 > </span> </div>
-
-<div class='lite_Heading'> Update Date & Time </div>
-
-<table width=700 border=0 align=left>
-<tr> <td align=right><B>NTP server :</B></td>
- <td>
- <span id='NTPSERVER'></span>
- <A href='#' class='splbutton' title='Edit NTP server' onclick="parent.miscFunctions.click_panel('networking.html');"><B>Edit</B></A>
- </td>
-</tr>
-
-<tr> <td height=15></td><td></td></tr>
-
-<tr> <td valign=top align=right><B>Current System Date :</B></td>
- <td id='current_date'></td>
-</tr>
-<tr class='lite'>
- <td valign=top align=right><B>Current System Date in Local Time :</B></td>
- <td id='current_date_local'></td>
-</tr>
-
-<tr> <td height=15></td><td></td></tr>
-
-<tr> <td valign=top align=right>
- <B>Set New Date & Time :</B><BR>
- <span class='lite'>Enter Date & Time in your Local time </span>
- </td>
- <td> <TABLE cellpadding=6 cellspacing=1 border=0>
- <TR> <TD width=70 align=right>Date </TD>
- <TD><input size=10 id="date_day"></TD>
- </TR>
- <TR> <TD width=70 align=right>Time</TD>
- <TD> <!-- Time -->
- <select id="hod"></select>:
- <select id="minute"></select>
- <select id="ampm">
- <option value="AM">AM</option>
- <option value="PM">PM</option>
- </select>
- <!-- Time -->
- </TD>
- </TR>
- <TR>
- <TD colspan=2 align=center>
- <span class='guiButton' onclick='update_systemdate();'>Update</span>
- </TD>
- </TR>
- </TABLE>
- </td>
-</tr>
-</table>
-
+ </script>
</body>
+</html>
More information about the asterisk-gui-commits
mailing list