Version 15.16.1

This commit is contained in:
Antonio Cañas Vargas 2015-10-22 01:50:49 +02:00
parent 96b3b5223c
commit cd46d90d04
5 changed files with 49 additions and 14 deletions

View File

@ -52,6 +52,28 @@ function writeLocalDateTimeFromUTC(id,secsSince1970UTC) {
document.getElementById(id).innerHTML = d.toLocaleDateString() + " " + d.getHours() + ":" + StrMinutes;
}
// Write a date-time in client local time
function setLocalDateTimeFormFromUTC(id,secsSince1970UTC) {
var d = new Date;
var Day;
var Month;
var Year;
var Hour;
var Minute;
d.setTime(secsSince1970UTC * 1000);
Day = d.getDate();
Month = d.getMonth() + 1;
Year = d.getFullYear();
Hour = d.getHours();
Minute = d.getMinutes();
document.getElementById(id+'_day_' +Day ).selected = true;
document.getElementById(id+'_month_' +Month ).selected = true;
document.getElementById(id+'_year_' +Year ).selected = true;
document.getElementById(id+'_hour_' +Hour ).selected = true;
document.getElementById(id+'_minute_'+Minute).selected = true;
}
// Write clock in client local time updated every minute
function writeLocalClock() {
var d = new Date;

View File

@ -1047,6 +1047,7 @@ void Asg_RequestCreatOrEditAsg (void)
struct Assignment Asg;
bool ItsANewAssignment;
Asg_StartOrEndTime_t StartOrEndTime;
const char *Id[Asg_NUM_DATES] = {"StartDateTime","EndDateTime"};
const char *NameSelectYear [Asg_NUM_DATES] = {"StartYear" ,"EndYear" };
const char *NameSelectMonth [Asg_NUM_DATES] = {"StartMonth" ,"EndMonth" };
const char *NameSelectDay [Asg_NUM_DATES] = {"StartDay" ,"EndDay" };
@ -1154,7 +1155,9 @@ void Asg_RequestCreatOrEditAsg (void)
&(Asg.DateTimes[StartOrEndTime].Date),
false,false);
*/
Dat_WriteFormClientLocalDateTime (Gbl.Now.Date.Year-1,Gbl.Now.Date.Year+1,
Dat_WriteFormClientLocalDateTime (Id[StartOrEndTime],
Asg.DateTimes[StartOrEndTime],
Gbl.Now.Date.Year-1,Gbl.Now.Date.Year+1,
NameSelectDay [StartOrEndTime],
NameSelectMonth [StartOrEndTime],
NameSelectYear [StartOrEndTime],

View File

@ -107,11 +107,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.16 (2015/10/22)"
#define Log_PLATFORM_VERSION "SWAD 15.16.1 (2015/10/22)"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/*
Version 15.16.1: Oct 22, 2015 Assignment date-times are displayed in client local date-time. Not finished. (186468 lines)
Version 15.16: Oct 22, 2015 Assignment date-times are displayed in client local date-time. Not finished. (186436 lines)
Version 15.15.3: Oct 21, 2015 File date-time is displayed in client local date-time. (186264 lines)
Version 15.15.2: Oct 21, 2015 Fixed bug in client local date-time. (186254 lines)

View File

@ -271,7 +271,9 @@ void Dat_WriteFormIniEndDates (void)
/************************* Show a form to enter a date ***********************/
/*****************************************************************************/
void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
void Dat_WriteFormClientLocalDateTime (const char *Id,
time_t DateTime,
unsigned FirstYear,unsigned LastYear,
const char *NameSelectDay,
const char *NameSelectMonth,
const char *NameSelectYear,
@ -301,8 +303,8 @@ void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
for (Day = 1;
Day <= 31;
Day++)
fprintf (Gbl.F.Out,"<option value=\"%u\">%u</option>",
Day,Day);
fprintf (Gbl.F.Out,"<option id=\"%s_day_%u\" value=\"%u\">%u</option>",
Id,Day,Day,Day);
/***** Month *****/
fprintf (Gbl.F.Out,"</select>"
@ -321,8 +323,8 @@ void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
for (Month = 1;
Month <= 12;
Month++)
fprintf (Gbl.F.Out,"<option value=\"%u\">%s</option>",
Month,Txt_MONTHS_SMALL[Month-1]);
fprintf (Gbl.F.Out,"<option id=\"%s_month_%u\" value=\"%u\">%s</option>",
Id,Month,Month,Txt_MONTHS_SMALL[Month-1]);
/***** Year *****/
fprintf (Gbl.F.Out,"</select>"
@ -340,8 +342,8 @@ void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
for (Year = FirstYear;
Year <= LastYear;
Year++)
fprintf (Gbl.F.Out,"<option value=\"%u\">%u</option>",
Year,Year);
fprintf (Gbl.F.Out,"<option id=\"%s_year_%u\" value=\"%u\">%u</option>",
Id,Year,Year,Year);
fprintf (Gbl.F.Out,"</select>"
"</td>");
@ -358,8 +360,8 @@ void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
for (Hour = 0;
Hour <= 23;
Hour++)
fprintf (Gbl.F.Out,"<option value=\"%u\">%02u h</option>",
Hour,Hour);
fprintf (Gbl.F.Out,"<option id=\"%s_hour_%u\" value=\"%u\">%02u h</option>",
Id,Hour,Hour,Hour);
/***** Minute *****/
fprintf (Gbl.F.Out,"</select>"
@ -376,12 +378,17 @@ void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
for (Minute = 0;
Minute <= 59;
Minute++)
fprintf (Gbl.F.Out,"<option value=\"%u\">%02u &#39;</option>",
Minute,Minute);
fprintf (Gbl.F.Out,"<option id=\"%s_minute_%u\" value=\"%u\">%02u &#39;</option>",
Id,Minute,Minute,Minute);
fprintf (Gbl.F.Out,"</select>"
"</td>"
"</tr>"
"</table>");
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"setLocalDateTimeFormFromUTC('%s',%ld);"
"</script>",
Id,(long) DateTime);
}
/*****************************************************************************/

View File

@ -79,7 +79,9 @@ void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr);
void Dat_WriteFormIniEndDates (void);
void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
void Dat_WriteFormClientLocalDateTime (const char *Id,
time_t DateTime,
unsigned FirstYear,unsigned LastYear,
const char *NameSelectDay,
const char *NameSelectMonth,
const char *NameSelectYear,