mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-17 22:15:43 +02:00
Version 15.29.2
This commit is contained in:
parent
1a68c78525
commit
193bdac699
103
js/swad.js
103
js/swad.js
|
@ -670,31 +670,8 @@ function DrawCurrentMonth (id,TimeUTC) {
|
|||
/******************************** Draw a month *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
||||
function DrawMonth (id,Year,Month,Today)
|
||||
{
|
||||
var MONTHS_CAPS = [
|
||||
'ENERO',
|
||||
'FEBRERO',
|
||||
'MARZO',
|
||||
'ABRIL',
|
||||
'MAYO',
|
||||
'JUNIO',
|
||||
'JULIO',
|
||||
'AGOSTO',
|
||||
'SEPTIEMBRE',
|
||||
'OCTUBRE',
|
||||
'NOVIEMBRE',
|
||||
'DICIEMBRE'
|
||||
];
|
||||
var DAYS_CAPS = [
|
||||
'L',
|
||||
'M',
|
||||
'M',
|
||||
'J',
|
||||
'V',
|
||||
'S',
|
||||
'D'
|
||||
];
|
||||
var NumDaysMonth = [
|
||||
0,
|
||||
31, // 1: January
|
||||
|
@ -713,10 +690,10 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
// var StrExamOfX;
|
||||
var Week;
|
||||
var DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
|
||||
var DayOfMonth;
|
||||
var Day;
|
||||
var NumDaysInMonth;
|
||||
var Year = CurrentYear;
|
||||
var Month = CurrentMonth;
|
||||
var Yea = Year;
|
||||
var Mon = Month;
|
||||
// var YYYYMMDD;
|
||||
// var NumHld;
|
||||
var ClassForDay; // Class of day depending on type of day
|
||||
|
@ -737,20 +714,20 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
If it's 0 then write 1 box of the previous month.
|
||||
If it's 1 then write 0 boxes of the previous month. */
|
||||
|
||||
if ((DayOfWeek = GetDayOfWeek (Year,Month,1)) == 0)
|
||||
DayOfMonth = 1;
|
||||
if ((DayOfWeek = GetDayOfWeek (Yea,Mon,1)) == 0)
|
||||
Day = 1;
|
||||
else
|
||||
{
|
||||
if (Month <= 1)
|
||||
if (Mon <= 1)
|
||||
{
|
||||
Month = 12;
|
||||
Year--;
|
||||
Mon = 12;
|
||||
Yea--;
|
||||
}
|
||||
else
|
||||
Month--;
|
||||
NumDaysInMonth = (Month == 2) ? GetNumDaysFebruary (Year) :
|
||||
NumDaysMonth[Month];
|
||||
DayOfMonth = NumDaysInMonth - DayOfWeek + 1;
|
||||
Mon--;
|
||||
NumDaysInMonth = (Mon == 2) ? GetNumDaysFebruary (Yea) :
|
||||
NumDaysMonth[Mon];
|
||||
Day = NumDaysInMonth - DayOfWeek + 1;
|
||||
}
|
||||
|
||||
/***** Start of month *****/
|
||||
|
@ -758,7 +735,7 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
|
||||
/***** Month name *****/
|
||||
HTMLContent += '<div class="MONTH">' +
|
||||
MONTHS_CAPS[CurrentMonth-1] + ' ' + CurrentYear +
|
||||
MONTHS_CAPS[Month-1] + ' ' + Year +
|
||||
'</div>';
|
||||
|
||||
/***** Month head: first letter for each day of week *****/
|
||||
|
@ -770,7 +747,9 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
HTMLContent += '<td class="' +
|
||||
((DayOfWeek == 6) ? 'DAY_NO_WRK_HEAD' :
|
||||
'DAY_WRK_HEAD') +
|
||||
'">' + DAYS_CAPS[DayOfWeek] + '</td>';
|
||||
'">' +
|
||||
DAYS_CAPS[DayOfWeek] +
|
||||
'</td>';
|
||||
HTMLContent += '</tr>';
|
||||
|
||||
/***** Draw every week of the month *****/
|
||||
|
@ -786,34 +765,34 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
DayOfWeek++)
|
||||
{
|
||||
/***** Set class for day being drawn *****/
|
||||
ClassForDay = (Month == CurrentMonth) ? 'DAY_WRK' :
|
||||
'DAY_WRK_LIGHT';
|
||||
ClassForDay = (Mon == Month) ? 'DAY_WRK' :
|
||||
'DAY_WRK_LIGHT';
|
||||
/* Day being drawn is sunday? */
|
||||
if (DayOfWeek == 6) // All the sundays are holidays
|
||||
ClassForDay = (Month == CurrentMonth) ? 'DAY_HLD' :
|
||||
'DAY_HLD_LIGHT';
|
||||
ClassForDay = (Mon == Month) ? 'DAY_HLD' :
|
||||
'DAY_HLD_LIGHT';
|
||||
|
||||
/* Date being drawn is today? */
|
||||
/*
|
||||
IsToday = (Gbl.CurrentAct != ActPrnCal && Month == CurrentMonth &&
|
||||
Year == Gbl.Now.Date.Year &&
|
||||
Month == Gbl.Now.Date.Month &&
|
||||
DayOfMonth == Gbl.Now.Date.Day);
|
||||
IsToday = (Gbl.CurrentAct != ActPrnCal && Mon == Month &&
|
||||
Yea == Gbl.Now.Date.Yea &&
|
||||
Mon == Gbl.Now.Date.Month &&
|
||||
Day == Gbl.Now.Date.Day);
|
||||
*/
|
||||
IsToday = (Year == CurrentYear &&
|
||||
Month == CurrentMonth &&
|
||||
DayOfMonth == CurrentDay);
|
||||
IsToday = (Yea == Year &&
|
||||
Mon == Month &&
|
||||
Day == Today);
|
||||
|
||||
/* Check if day has an exam announcement */
|
||||
/*
|
||||
ThisDayHasEvent = false;
|
||||
if (!DrawingCalendar || Month == CurrentMonth) // If drawing calendar and the month is not the real one, don't draw exam announcements
|
||||
if (!DrawingCalendar || Mon == Month) // If drawing calendar and the month is not the real one, don't draw exam announcements
|
||||
for (NumExamAnnouncement = 0;
|
||||
NumExamAnnouncement < Gbl.LstExamAnnouncements.NumExamAnnounc;
|
||||
NumExamAnnouncement++)
|
||||
if (Year == Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Year &&
|
||||
Month == Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Month &&
|
||||
DayOfMonth == Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Day)
|
||||
if (Yea == Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Year &&
|
||||
Mon == Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Month &&
|
||||
Day == Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Day)
|
||||
{
|
||||
ThisDayHasEvent = true;
|
||||
if (PutLinkToEvents)
|
||||
|
@ -823,7 +802,7 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
StrExamOfX,
|
||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Day,
|
||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Month,
|
||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Year);
|
||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Yea);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -861,7 +840,7 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
*/
|
||||
|
||||
/* Write the day of month */
|
||||
HTMLContent += DayOfMonth;
|
||||
HTMLContent += Day;
|
||||
|
||||
/* If day has an exam announcement */
|
||||
/*
|
||||
|
@ -880,16 +859,16 @@ function DrawMonth (id,CurrentYear,CurrentMonth,CurrentDay)
|
|||
HTMLContent += '</td>';
|
||||
|
||||
/***** Set the next day *****/
|
||||
NumDaysInMonth = (Month == 2) ? GetNumDaysFebruary (Year) :
|
||||
NumDaysMonth[Month];
|
||||
if (++DayOfMonth > NumDaysInMonth)
|
||||
NumDaysInMonth = (Mon == 2) ? GetNumDaysFebruary (Yea) :
|
||||
NumDaysMonth[Mon];
|
||||
if (++Day > NumDaysInMonth)
|
||||
{
|
||||
if (++Month > 12)
|
||||
if (++Mon > 12)
|
||||
{
|
||||
Year++;
|
||||
Month = 1;
|
||||
Yea++;
|
||||
Mon = 1;
|
||||
}
|
||||
DayOfMonth = 1;
|
||||
Day = 1;
|
||||
}
|
||||
}
|
||||
HTMLContent += '</tr>';
|
||||
|
|
|
@ -53,6 +53,11 @@ static void Cal_DrawMonth (unsigned RealYear,unsigned RealMonth,
|
|||
|
||||
void Cal_DrawCurrentMonth (void)
|
||||
{
|
||||
extern const char *Txt_MONTHS_CAPS[12];
|
||||
extern const char *Txt_DAYS_CAPS[7];
|
||||
unsigned Month;
|
||||
unsigned DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
|
||||
|
||||
/***** Get list of holidays *****/
|
||||
if (!Gbl.Hlds.LstIsRead)
|
||||
{
|
||||
|
@ -66,11 +71,35 @@ void Cal_DrawCurrentMonth (void)
|
|||
/***** Draw the month *****/
|
||||
Cal_DrawMonth (Gbl.Now.Date.Year,Gbl.Now.Date.Month,false,true,false);
|
||||
|
||||
/***** Draw the month in JavaScript *****/
|
||||
/* JavaScript will write HTML here */
|
||||
fprintf (Gbl.F.Out,"<div id=\"CurrentMonth\">"
|
||||
"</div>"
|
||||
"<script type=\"text/javascript\">"
|
||||
"DrawCurrentMonth ('CurrentMonth',%ld);"
|
||||
"</script>",
|
||||
"</div>");
|
||||
|
||||
/* Write script to draw the month */
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"
|
||||
" var MONTHS_CAPS = [");
|
||||
for (Month = 0;
|
||||
Month < 12;
|
||||
Month++)
|
||||
{
|
||||
if (Month)
|
||||
fprintf (Gbl.F.Out,",");
|
||||
fprintf (Gbl.F.Out,"'%s'",Txt_MONTHS_CAPS[Month]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"];\n"
|
||||
" var DAYS_CAPS = [");
|
||||
for (DayOfWeek = 0;
|
||||
DayOfWeek < 7;
|
||||
DayOfWeek++)
|
||||
{
|
||||
if (DayOfWeek)
|
||||
fprintf (Gbl.F.Out,",");
|
||||
fprintf (Gbl.F.Out,"'%c'",Txt_DAYS_CAPS[DayOfWeek][0]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"];\n"
|
||||
" DrawCurrentMonth ('CurrentMonth',%ld);\n"
|
||||
"</script>\n",
|
||||
(long) Gbl.StartExecutionTimeUTC);
|
||||
|
||||
/***** Free list of dates of exam announcements *****/
|
||||
|
|
|
@ -108,11 +108,12 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.29.1 (2015/10/29)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.29.2 (2015/10/29)"
|
||||
|
||||
// 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.29.2: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186694 lines)
|
||||
Version 15.29.1: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186694 lines)
|
||||
Version 15.29: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186684 lines)
|
||||
Version 15.28.1: Oct 28, 2015 Fixed bug in the calculation of some statistics. (186416 lines)
|
||||
|
|
Loading…
Reference in New Issue
Block a user