mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-19 23:17:07 +02:00
Version 16.114
This commit is contained in:
parent
4395183825
commit
11d3c9c235
|
@ -234,32 +234,49 @@ function setTZname (id) {
|
||||||
FormTZname.value = tz.name(); // Returns the name of the time zone eg "Europe/Berlin"
|
FormTZname.value = tz.name(); // Returns the name of the time zone eg "Europe/Berlin"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust a date form correcting days in the month
|
// Get number of days in a month
|
||||||
|
function daysInMonth (month, year) { //Month is 1 based
|
||||||
|
return new Date(year, month, 0).getDate(); // 0 is the last day of previous month
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust a date form correcting selector days in the month
|
||||||
|
// The selector of days can start by 1, 2, 3... or by -, 1, 2, 3...
|
||||||
function adjustDateForm (id) {
|
function adjustDateForm (id) {
|
||||||
var FormYea = document.getElementById(id+'Year' );
|
var FormYea = document.getElementById(id+'Year' );
|
||||||
var FormMon = document.getElementById(id+'Month');
|
var FormMon = document.getElementById(id+'Month');
|
||||||
var FormDay = document.getElementById(id+'Day' );
|
var FormDay = document.getElementById(id+'Day' );
|
||||||
var Yea = FormYea.options[FormYea.selectedIndex].value;
|
var Yea = Number(FormYea.options[FormYea.selectedIndex].value);
|
||||||
var Days;
|
var Mon = Number(FormMon.options[FormMon.selectedIndex].value);
|
||||||
|
|
||||||
if (FormMon.options[1].selected) // February
|
if (Yea != 0 && Mon != 0) {
|
||||||
Days = ((((Yea % 4) == 0) && ((Yea % 100) != 0)) || ((Yea % 400) == 0)) ? 29 : 28;
|
var LastDayIndex = FormDay.options.length - 1;
|
||||||
else if (FormMon.options[ 3].selected || // April
|
var LastDayValue = Number(FormDay.options[LastDayIndex].value);
|
||||||
FormMon.options[ 5].selected || // June
|
var SelectedDay = Number(FormDay.options[FormDay.selectedIndex].value);
|
||||||
FormMon.options[ 8].selected || // September
|
var Days = daysInMonth (Mon,Yea);
|
||||||
FormMon.options[10].selected) // November
|
|
||||||
Days = 30;
|
|
||||||
else
|
|
||||||
Days = 31;
|
|
||||||
|
|
||||||
if (FormDay.selectedIndex >= Days)
|
// If current selected day is out of range...
|
||||||
FormDay.options[Days-1].selected = true; // Select last day in month
|
if (SelectedDay > Days)
|
||||||
|
// Select last day in month
|
||||||
|
for (var i=LastDayIndex; i>=0; i--)
|
||||||
|
if (FormDay.options[i].value == Days) {
|
||||||
|
FormDay.options[i].selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i=FormDay.options.length; i<Days; i++) { // Create new days at the end
|
// Create new days at the end if necessary
|
||||||
FormDay.options[i] = new Option(String(i+1),i+1);
|
for (var Day=Number(LastDayValue)+1; Day<=Days; Day++) {
|
||||||
|
var opt = document.createElement('option');
|
||||||
|
opt.value = opt.text = Day;
|
||||||
|
FormDay.add(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove days from the end if necessary
|
||||||
|
for (var i=LastDayIndex; i>=0; i--)
|
||||||
|
if (FormDay.options[i].value > Days)
|
||||||
|
FormDay.options[i] = null;
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (var i=FormDay.options.length-1; i>=Days; i--) // Remove days from the end
|
|
||||||
FormDay.options[i] = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a date range form to yesterday
|
// Set a date range form to yesterday
|
||||||
|
@ -1002,21 +1019,6 @@ function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,
|
||||||
function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay,
|
function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay,
|
||||||
CurrentPlcCod,DrawingCalendar,PrintView,
|
CurrentPlcCod,DrawingCalendar,PrintView,
|
||||||
CGI,FormGoToCalendarParams,FormEventParams) {
|
CGI,FormGoToCalendarParams,FormEventParams) {
|
||||||
var NumDaysMonth = [
|
|
||||||
0,
|
|
||||||
31, // 1: January
|
|
||||||
28, // 2: February
|
|
||||||
31, // 3: Mars
|
|
||||||
30, // 4: April
|
|
||||||
31, // 5: May
|
|
||||||
30, // 6: June
|
|
||||||
31, // 7: July
|
|
||||||
31, // 8: Agoust
|
|
||||||
30, // 9: September
|
|
||||||
31, // 10: October
|
|
||||||
30, // 11: November
|
|
||||||
31, // 12: December
|
|
||||||
];
|
|
||||||
var Hld_HOLIDAY = 0;
|
var Hld_HOLIDAY = 0;
|
||||||
var Hld_NON_SCHOOL_PERIOD = 1;
|
var Hld_NON_SCHOOL_PERIOD = 1;
|
||||||
var Yea = YearToDraw;
|
var Yea = YearToDraw;
|
||||||
|
@ -1058,8 +1060,7 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren
|
||||||
Yea--;
|
Yea--;
|
||||||
} else
|
} else
|
||||||
Mon--;
|
Mon--;
|
||||||
NumDaysInMonth = (Mon == 2) ? GetNumDaysFebruary(Yea) :
|
NumDaysInMonth = daysInMonth (Mon,Yea);
|
||||||
NumDaysMonth[Mon];
|
|
||||||
Day = NumDaysInMonth - DayOfWeek + 1;
|
Day = NumDaysInMonth - DayOfWeek + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1210,8 +1211,7 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren
|
||||||
Gbl_HTMLContent += '</td>';
|
Gbl_HTMLContent += '</td>';
|
||||||
|
|
||||||
/***** Set the next day *****/
|
/***** Set the next day *****/
|
||||||
NumDaysInMonth = (Mon == 2) ? GetNumDaysFebruary (Yea) :
|
NumDaysInMonth = daysInMonth (Mon,Yea);
|
||||||
NumDaysMonth[Mon];
|
|
||||||
if (++Day > NumDaysInMonth) {
|
if (++Day > NumDaysInMonth) {
|
||||||
if (++Mon > 12) {
|
if (++Mon > 12) {
|
||||||
Yea++;
|
Yea++;
|
||||||
|
@ -1247,22 +1247,6 @@ function GetDayOfWeekMondayFirst (Year,Month,Day) {
|
||||||
2) % 7) + 5) % 7;
|
2) % 7) + 5) % 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Return the number of days of february ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
function GetNumDaysFebruary (Year) {
|
|
||||||
return (GetIfLeapYear (Year) ? 29 : 28);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************************* Return true if year is leap ***********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
function GetIfLeapYear (Year) {
|
|
||||||
return (Year % 4 == 0) && ((Year % 100 != 0) || (Year % 400 == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************* Copy message subject and content to hidden fields *************/
|
/************* Copy message subject and content to hidden fields *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
|
@ -189,13 +189,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.113 (2017-01-13)"
|
#define Log_PLATFORM_VERSION "SWAD 16.114 (2017-01-14)"
|
||||||
#define CSS_FILE "swad16.111.5.css"
|
#define CSS_FILE "swad16.111.5.css"
|
||||||
#define JS_FILE "swad16.101.js"
|
#define JS_FILE "swad16.114.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.114: Jan 14, 2017 Fixed bug in dates, reported by José Luis Bernier Villamor.
|
||||||
|
Javascript code refactoring related to dates. (211490 lines)
|
||||||
Version 16.113: Jan 13, 2017 Some strcpy changed to strncpy. (211497 lines)
|
Version 16.113: Jan 13, 2017 Some strcpy changed to strncpy. (211497 lines)
|
||||||
Version 16.112: Jan 13, 2017 Some strcpy changed to strncpy. (211415 lines)
|
Version 16.112: Jan 13, 2017 Some strcpy changed to strncpy. (211415 lines)
|
||||||
Version 16.111.16:Dec 30, 2016 Fixed minor bug in user's ID, reported by Coverity. (211185 lines)
|
Version 16.111.16:Dec 30, 2016 Fixed minor bug in user's ID, reported by Coverity. (211185 lines)
|
||||||
|
|
|
@ -616,7 +616,8 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear,
|
||||||
fprintf (Gbl.F.Out,"\"");
|
fprintf (Gbl.F.Out,"\"");
|
||||||
if (Disabled)
|
if (Disabled)
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
fprintf (Gbl.F.Out,"><option value=\"0\">-</option>");
|
fprintf (Gbl.F.Out,">"
|
||||||
|
"<option value=\"0\">-</option>");
|
||||||
for (Year = FirstYear;
|
for (Year = FirstYear;
|
||||||
Year <= LastYear;
|
Year <= LastYear;
|
||||||
Year++)
|
Year++)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user