mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-12 19:54:05 +02:00
Version 15.31
This commit is contained in:
parent
ae2efa17b5
commit
840b2a2344
115
js/swad.js
115
js/swad.js
|
@ -656,21 +656,89 @@ function disableDetailedClicks () {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************** Draw a month *******************************/
|
/************************ Draw an academic calendar **************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
function Cal_DrawCalendar (id,TimeUTC,PrintView,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams)
|
||||||
|
{
|
||||||
|
var StartingMonth = [ // Calendar starts one row before current month
|
||||||
|
9, // January --> September
|
||||||
|
9, // February --> September
|
||||||
|
9, // Mars --> September
|
||||||
|
9, // April --> September
|
||||||
|
1, // May --> January
|
||||||
|
1, // June --> January
|
||||||
|
1, // July --> January
|
||||||
|
1, // August --> January
|
||||||
|
5, // September --> May
|
||||||
|
5, // October --> May
|
||||||
|
5, // November --> May
|
||||||
|
5 // December --> May
|
||||||
|
];
|
||||||
|
var d = new Date;
|
||||||
|
d.setTime(TimeUTC * 1000);
|
||||||
|
var CurrentMonth = d.getMonth() + 1;
|
||||||
|
var CurrentYear = d.getFullYear();
|
||||||
|
var CurrentDay = d.getDate();
|
||||||
|
var Month = StartingMonth[CurrentMonth - 1];
|
||||||
|
var Year = (Month < CurrentMonth) ? CurrentYear :
|
||||||
|
CurrentYear - 1;
|
||||||
|
var Row;
|
||||||
|
var Col;
|
||||||
|
var MonthIdNum = 0;
|
||||||
|
var MonthId;
|
||||||
|
|
||||||
|
/***** Draw several months *****/
|
||||||
|
HTMLContent += '<table style="margin:0 auto; border-spacing:6px;">';
|
||||||
|
|
||||||
|
for (Row = 0;
|
||||||
|
Row < 4;
|
||||||
|
Row++)
|
||||||
|
{
|
||||||
|
HTMLContent += '<tr>';
|
||||||
|
for (Col = 0;
|
||||||
|
Col < 4;
|
||||||
|
Col++)
|
||||||
|
{
|
||||||
|
MonthIdNum++;
|
||||||
|
MonthId = id + '_month_' + MonthIdNum;
|
||||||
|
|
||||||
|
HTMLContent += '<td class="CENTER_TOP" style="width:150px;">';
|
||||||
|
DrawMonth (MonthId,Year,Month,CurrentMonth,CurrentDay,true,PrintView,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams);
|
||||||
|
HTMLContent += '</td>';
|
||||||
|
if (++Month == 13)
|
||||||
|
{
|
||||||
|
Month = 1;
|
||||||
|
Year++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HTMLContent += '</tr>';
|
||||||
|
}
|
||||||
|
HTMLContent += '</table>';
|
||||||
|
|
||||||
|
document.getElementById(id).innerHTML = HTMLContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Draw current month ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
function DrawCurrentMonth (id,TimeUTC,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams) {
|
function DrawCurrentMonth (id,TimeUTC,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams) {
|
||||||
var d = new Date;
|
var d = new Date;
|
||||||
|
|
||||||
d.setTime(TimeUTC * 1000);
|
d.setTime(TimeUTC * 1000);
|
||||||
DrawMonth (id,d.getFullYear(),d.getMonth() + 1,d.getDate(),false,false,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams);
|
var Year = d.getFullYear();
|
||||||
|
var Month = d.getMonth() + 1;
|
||||||
|
var CurrentDay = d.getDate();
|
||||||
|
|
||||||
|
DrawMonth (id,Year,Month,Month,CurrentDay,false,false,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams);
|
||||||
|
document.getElementById(id).innerHTML = HTMLContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************** Draw a month *******************************/
|
/******************************** Draw a month *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams)
|
function DrawMonth (id,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay,DrawingCalendar,PrintView,CGI,CurrentPlcCod,FormGoToCalendarParams,FormEventParams)
|
||||||
{
|
{
|
||||||
var NumDaysMonth = [
|
var NumDaysMonth = [
|
||||||
0,
|
0,
|
||||||
|
@ -693,8 +761,8 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
var DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
|
var DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
|
||||||
var Day;
|
var Day;
|
||||||
var NumDaysInMonth;
|
var NumDaysInMonth;
|
||||||
var Yea = Year;
|
var Yea = YearToDraw;
|
||||||
var Mon = Month;
|
var Mon = MonthToDraw;
|
||||||
var YYYYMMDD;
|
var YYYYMMDD;
|
||||||
var NumHld;
|
var NumHld;
|
||||||
var ClassForDay; // Class of day depending on type of day
|
var ClassForDay; // Class of day depending on type of day
|
||||||
|
@ -734,14 +802,14 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Start of month *****/
|
/***** Start of month *****/
|
||||||
HTMLContent = '<div class="MONTH_CONTAINER">';
|
HTMLContent += '<div class="MONTH_CONTAINER">';
|
||||||
|
|
||||||
/***** Month name *****/
|
/***** Month name *****/
|
||||||
if (DrawingCalendar)
|
if (DrawingCalendar)
|
||||||
HTMLContent += '<div class="MONTH">';
|
HTMLContent += '<div class="MONTH">';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FormId = 'show_calendar';
|
FormId = id + '_show_calendar';
|
||||||
HTMLContent += '<form method="post" action="' +
|
HTMLContent += '<form method="post" action="' +
|
||||||
CGI +
|
CGI +
|
||||||
'" id="' +
|
'" id="' +
|
||||||
|
@ -752,7 +820,7 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
'<a href="" class="MONTH"' +
|
'<a href="" class="MONTH"' +
|
||||||
' onclick="document.getElementById(\'' + FormId + '\').submit();return false;">';
|
' onclick="document.getElementById(\'' + FormId + '\').submit();return false;">';
|
||||||
}
|
}
|
||||||
HTMLContent += MONTHS_CAPS[Month-1] + ' ' + Year;
|
HTMLContent += MONTHS_CAPS[MonthToDraw-1] + ' ' + YearToDraw;
|
||||||
if (DrawingCalendar)
|
if (DrawingCalendar)
|
||||||
HTMLContent += '</div>';
|
HTMLContent += '</div>';
|
||||||
else
|
else
|
||||||
|
@ -785,8 +853,8 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
DayOfWeek++)
|
DayOfWeek++)
|
||||||
{
|
{
|
||||||
/***** Set class for day being drawn *****/
|
/***** Set class for day being drawn *****/
|
||||||
ClassForDay = ((Mon == Month) ? 'DAY_WRK' :
|
ClassForDay = ((Mon == MonthToDraw) ? 'DAY_WRK' :
|
||||||
'DAY_WRK_LIGHT');
|
'DAY_WRK_LIGHT');
|
||||||
TextForDay = '';
|
TextForDay = '';
|
||||||
|
|
||||||
/* Check if day is a holiday or a school day */
|
/* Check if day is a holiday or a school day */
|
||||||
|
@ -805,8 +873,8 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
case Hld_HOLIDAY:
|
case Hld_HOLIDAY:
|
||||||
if (Hlds[NumHld].StartDate == YYYYMMDD) // If start date == date being drawn
|
if (Hlds[NumHld].StartDate == YYYYMMDD) // If start date == date being drawn
|
||||||
{
|
{
|
||||||
ClassForDay = ((Mon == Month) ? 'DAY_HLD' :
|
ClassForDay = ((Mon == MonthToDraw) ? 'DAY_HLD' :
|
||||||
'DAY_HLD_LIGHT');
|
'DAY_HLD_LIGHT');
|
||||||
TextForDay = Hlds[NumHld].Name;
|
TextForDay = Hlds[NumHld].Name;
|
||||||
ContinueSearching = false;
|
ContinueSearching = false;
|
||||||
}
|
}
|
||||||
|
@ -814,8 +882,8 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
case Hld_NON_SCHOOL_PERIOD:
|
case Hld_NON_SCHOOL_PERIOD:
|
||||||
if (Hlds[NumHld].EndDate >= YYYYMMDD) // If start date <= date being drawn <= end date
|
if (Hlds[NumHld].EndDate >= YYYYMMDD) // If start date <= date being drawn <= end date
|
||||||
{
|
{
|
||||||
ClassForDay = ((Mon == Month) ? 'DAY_NO_WORK' :
|
ClassForDay = ((Mon == MonthToDraw) ? 'DAY_NO_WORK' :
|
||||||
'DAY_NO_WORK_LIGHT');
|
'DAY_NO_WORK_LIGHT');
|
||||||
TextForDay = Hlds[NumHld].Name;
|
TextForDay = Hlds[NumHld].Name;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -824,17 +892,18 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
|
|
||||||
/* Day being drawn is sunday? */
|
/* Day being drawn is sunday? */
|
||||||
if (DayOfWeek == 6) // All the sundays are holidays
|
if (DayOfWeek == 6) // All the sundays are holidays
|
||||||
ClassForDay = (Mon == Month) ? 'DAY_HLD' :
|
ClassForDay = (Mon == MonthToDraw) ? 'DAY_HLD' :
|
||||||
'DAY_HLD_LIGHT';
|
'DAY_HLD_LIGHT';
|
||||||
|
|
||||||
/* Date being drawn is today? */
|
/* Date being drawn is today? */
|
||||||
IsToday = (Yea == Year &&
|
IsToday = (Yea == YearToDraw &&
|
||||||
Mon == Month &&
|
Mon == MonthToDraw &&
|
||||||
Day == Today);
|
Mon == CurrentMonth &&
|
||||||
|
Day == CurrentDay);
|
||||||
|
|
||||||
/* Check if day has an exam announcement */
|
/* Check if day has an exam announcement */
|
||||||
ThisDayHasEvent = false;
|
ThisDayHasEvent = false;
|
||||||
if (!DrawingCalendar || Mon == Month) // If drawing calendar and the month is not the real one, don't draw exam announcements
|
if (!DrawingCalendar || Mon == MonthToDraw) // If drawing calendar and the month is not the real one, don't draw exam announcements
|
||||||
for (NumExamAnnouncement = 0;
|
for (NumExamAnnouncement = 0;
|
||||||
NumExamAnnouncement < LstExamAnnouncements.length;
|
NumExamAnnouncement < LstExamAnnouncements.length;
|
||||||
NumExamAnnouncement++)
|
NumExamAnnouncement++)
|
||||||
|
@ -863,7 +932,7 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
if (!PrintView && ThisDayHasEvent)
|
if (!PrintView && ThisDayHasEvent)
|
||||||
{
|
{
|
||||||
FormIdNum++;
|
FormIdNum++;
|
||||||
FormId = 'cal_event_' + FormIdNum;
|
FormId = id + '_event_' + FormIdNum;
|
||||||
HTMLContent += '<form method="post" action="' +
|
HTMLContent += '<form method="post" action="' +
|
||||||
CGI +
|
CGI +
|
||||||
'" id="' +
|
'" id="' +
|
||||||
|
@ -914,8 +983,6 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,CurrentPlc
|
||||||
|
|
||||||
/***** End of month *****/
|
/***** End of month *****/
|
||||||
HTMLContent += '</table></div>';
|
HTMLContent += '</table></div>';
|
||||||
|
|
||||||
document.getElementById(id).innerHTML = HTMLContent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -53,14 +53,7 @@ static void Cal_DrawMonth (unsigned RealYear,unsigned RealMonth,
|
||||||
|
|
||||||
void Cal_DrawCurrentMonth (void)
|
void Cal_DrawCurrentMonth (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_MONTHS_CAPS[12];
|
|
||||||
extern const char *Txt_DAYS_CAPS[7];
|
|
||||||
extern const char *Txt_Exam_of_X;
|
|
||||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||||
unsigned Month;
|
|
||||||
unsigned DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
|
|
||||||
unsigned NumHld;
|
|
||||||
unsigned NumExamAnnouncement; // Number of exam announcement
|
|
||||||
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
||||||
|
|
||||||
/***** Get list of holidays *****/
|
/***** Get list of holidays *****/
|
||||||
|
@ -83,53 +76,8 @@ void Cal_DrawCurrentMonth (void)
|
||||||
|
|
||||||
/* Write script to draw the month */
|
/* Write script to draw the month */
|
||||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"
|
||||||
" var MONTHS_CAPS = [");
|
" var HTMLContent = '';\n"
|
||||||
for (Month = 0;
|
" DrawCurrentMonth ('CurrentMonth',%ld,'%s/%s',%ld,",
|
||||||
Month < 12;
|
|
||||||
Month++)
|
|
||||||
{
|
|
||||||
if (Month)
|
|
||||||
fprintf (Gbl.F.Out,",");
|
|
||||||
fprintf (Gbl.F.Out,"'%s'",Txt_MONTHS_CAPS[Month]);
|
|
||||||
}
|
|
||||||
fprintf (Gbl.F.Out,"];\n");
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out," 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");
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out," var STR_EXAM = '");
|
|
||||||
fprintf (Gbl.F.Out,Txt_Exam_of_X,Gbl.CurrentCrs.Crs.FullName);
|
|
||||||
fprintf (Gbl.F.Out,"';");
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out," var Hlds = [];\n");
|
|
||||||
for (NumHld = 0;
|
|
||||||
NumHld < Gbl.Hlds.Num;
|
|
||||||
NumHld++)
|
|
||||||
fprintf (Gbl.F.Out," Hlds.push({ PlcCod: %ld, HldTyp: %u, StartDate: %s, EndDate: %s, Name: '%s' });\n",
|
|
||||||
Gbl.Hlds.Lst[NumHld].PlcCod,
|
|
||||||
(unsigned) Gbl.Hlds.Lst[NumHld].HldTyp,
|
|
||||||
Gbl.Hlds.Lst[NumHld].StartDate.YYYYMMDD,
|
|
||||||
Gbl.Hlds.Lst[NumHld].EndDate.YYYYMMDD,
|
|
||||||
Gbl.Hlds.Lst[NumHld].Name);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out," var LstExamAnnouncements = [];\n");
|
|
||||||
for (NumExamAnnouncement = 0;
|
|
||||||
NumExamAnnouncement < Gbl.LstExamAnnouncements.NumExamAnnounc;
|
|
||||||
NumExamAnnouncement++)
|
|
||||||
fprintf (Gbl.F.Out," LstExamAnnouncements.push({ Year: %u, Month: %u, Day: %u });\n",
|
|
||||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Year,
|
|
||||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Month,
|
|
||||||
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Day);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out," DrawCurrentMonth ('CurrentMonth',%ld,'%s/%s',%ld,",
|
|
||||||
(long) Gbl.StartExecutionTimeUTC,
|
(long) Gbl.StartExecutionTimeUTC,
|
||||||
Cfg_HTTPS_URL_SWAD_CGI,Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
Cfg_HTTPS_URL_SWAD_CGI,Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
Gbl.CurrentCtr.Ctr.PlcCod);
|
Gbl.CurrentCtr.Ctr.PlcCod);
|
||||||
|
@ -166,6 +114,7 @@ void Cal_DrawCurrentMonth (void)
|
||||||
void Cal_DrawCalendar (void)
|
void Cal_DrawCalendar (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Print;
|
extern const char *Txt_Print;
|
||||||
|
/*
|
||||||
static unsigned StartingMonth[1+12] = // Calendar starts one row before current month
|
static unsigned StartingMonth[1+12] = // Calendar starts one row before current month
|
||||||
{
|
{
|
||||||
0, // Not used
|
0, // Not used
|
||||||
|
@ -176,18 +125,22 @@ void Cal_DrawCalendar (void)
|
||||||
1, // May --> January
|
1, // May --> January
|
||||||
1, // June --> January
|
1, // June --> January
|
||||||
1, // July --> January
|
1, // July --> January
|
||||||
1, // Agoust --> January
|
1, // August --> January
|
||||||
5, // September --> May
|
5, // September --> May
|
||||||
5, // October --> May
|
5, // October --> May
|
||||||
5, // November --> May
|
5, // November --> May
|
||||||
5, // December --> May
|
5, // December --> May
|
||||||
};
|
};
|
||||||
unsigned Row,Col;
|
*/
|
||||||
unsigned Month = StartingMonth[Gbl.Now.Date.Month];
|
// unsigned Row,Col;
|
||||||
unsigned Year = (Month < Gbl.Now.Date.Month) ? Gbl.Now.Date.Year :
|
// unsigned Month = StartingMonth[Gbl.Now.Date.Month];
|
||||||
Gbl.Now.Date.Year - 1;
|
// unsigned Year = (Month < Gbl.Now.Date.Month) ? Gbl.Now.Date.Year :
|
||||||
|
// Gbl.Now.Date.Year - 1;
|
||||||
bool PrintView = (Gbl.CurrentAct == ActPrnCal);
|
bool PrintView = (Gbl.CurrentAct == ActPrnCal);
|
||||||
|
|
||||||
|
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||||
|
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
||||||
|
|
||||||
/***** Get list of holidays *****/
|
/***** Get list of holidays *****/
|
||||||
if (!Gbl.Hlds.LstIsRead)
|
if (!Gbl.Hlds.LstIsRead)
|
||||||
{
|
{
|
||||||
|
@ -195,6 +148,9 @@ void Cal_DrawCalendar (void)
|
||||||
Hld_GetListHolidays ();
|
Hld_GetListHolidays ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Create list of calls for examination *****/
|
||||||
|
Exa_CreateListOfExamAnnouncements ();
|
||||||
|
|
||||||
/***** Start of table and title *****/
|
/***** Start of table and title *****/
|
||||||
if (!PrintView)
|
if (!PrintView)
|
||||||
{
|
{
|
||||||
|
@ -209,13 +165,14 @@ void Cal_DrawCalendar (void)
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Create list of calls for examination *****/
|
|
||||||
Exa_CreateListOfExamAnnouncements ();
|
|
||||||
|
|
||||||
/***** Draw several months *****/
|
/***** Draw several months *****/
|
||||||
|
/* JavaScript will write HTML here */
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"CENTER_TOP\">"
|
"<td class=\"CENTER_TOP\">"
|
||||||
"<table style=\"margin:0 auto; border-spacing:6px;\">");
|
"<div id=\"calendar\">"
|
||||||
|
"</div>");
|
||||||
|
|
||||||
|
/*
|
||||||
for (Row = 0;
|
for (Row = 0;
|
||||||
Row < 4;
|
Row < 4;
|
||||||
Row++)
|
Row++)
|
||||||
|
@ -239,6 +196,22 @@ void Cal_DrawCalendar (void)
|
||||||
fprintf (Gbl.F.Out,"</table>"
|
fprintf (Gbl.F.Out,"</table>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
*/
|
||||||
|
/* Write script to draw the month */
|
||||||
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"
|
||||||
|
" var HTMLContent = '';\n"
|
||||||
|
" Cal_DrawCalendar('calendar',%ld,%s,'%s/%s',%ld,",
|
||||||
|
(long) Gbl.StartExecutionTimeUTC,
|
||||||
|
(Gbl.CurrentAct == ActPrnCal) ? "true" : "false",
|
||||||
|
Cfg_HTTPS_URL_SWAD_CGI,Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
|
Gbl.CurrentCtr.Ctr.PlcCod);
|
||||||
|
Act_SetParamsForm (Params,ActSeeCal,true);
|
||||||
|
fprintf (Gbl.F.Out,"'%s',",Params);
|
||||||
|
Act_SetParamsForm (Params,ActSeeExaAnn,true);
|
||||||
|
fprintf (Gbl.F.Out,"'%s');\n"
|
||||||
|
"</script>\n",Params);
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out,"</td></tr>");
|
||||||
|
|
||||||
/***** Free list of dates of exam announcements *****/
|
/***** Free list of dates of exam announcements *****/
|
||||||
Exa_FreeListExamAnnouncements ();
|
Exa_FreeListExamAnnouncements ();
|
||||||
|
|
|
@ -103,17 +103,19 @@
|
||||||
// TODO: Put headers Content-type and Content-disposition when redirecting with Location:
|
// TODO: Put headers Content-type and Content-disposition when redirecting with Location:
|
||||||
// TODO: System admin should be able to remove/edit user's mail (when he/she detects a recipient does not exists, for example)
|
// TODO: System admin should be able to remove/edit user's mail (when he/she detects a recipient does not exists, for example)
|
||||||
// TODO: When a new assignment/attendance/survey is incorrect, the second time the form is shown, it should be filled with partial data, now is always empty
|
// TODO: When a new assignment/attendance/survey is incorrect, the second time the form is shown, it should be filled with partial data, now is always empty
|
||||||
|
// TODO: Dates in Holidays should be shown in big-endian
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.30 (2015/10/30)"
|
#define Log_PLATFORM_VERSION "SWAD 15.31 (2015/10/30)"
|
||||||
|
|
||||||
// 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 15.30: Oct 30, 2015 Current month is drown in browser using JavaScript. (186795 lines)
|
Version 15.31: Oct 30, 2015 Calendar is drawn in browser using JavaScript. (186902 lines)
|
||||||
|
Version 15.30: Oct 30, 2015 Current month is drawn in browser using JavaScript. (186795 lines)
|
||||||
Version 15.29.4: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186729 lines)
|
Version 15.29.4: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186729 lines)
|
||||||
Version 15.29.3: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186703 lines)
|
Version 15.29.3: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186703 lines)
|
||||||
Version 15.29.2: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186694 lines)
|
Version 15.29.2: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186694 lines)
|
||||||
|
|
|
@ -444,6 +444,15 @@ static void Lay_WriteRedirectionToMyLanguage (void)
|
||||||
|
|
||||||
static void Lay_WriteScripts (void)
|
static void Lay_WriteScripts (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Txt_MONTHS_CAPS[12];
|
||||||
|
extern const char *Txt_DAYS_CAPS[7];
|
||||||
|
extern const char *Txt_Exam_of_X;
|
||||||
|
unsigned Month;
|
||||||
|
unsigned DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
|
||||||
|
unsigned NumHld;
|
||||||
|
unsigned NumExamAnnouncement; // Number of exam announcement
|
||||||
|
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
||||||
|
|
||||||
/***** General scripts for swad *****/
|
/***** General scripts for swad *****/
|
||||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\" src=\"%s/swad.js\">"
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\" src=\"%s/swad.js\">"
|
||||||
"</script>\n",
|
"</script>\n",
|
||||||
|
@ -481,6 +490,74 @@ static void Lay_WriteScripts (void)
|
||||||
Lay_WriteScriptConnectedUsrs ();
|
Lay_WriteScriptConnectedUsrs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Prepare script to draw months *****/
|
||||||
|
if ((Gbl.Prefs.Layout == Lay_LAYOUT_DESKTOP &&
|
||||||
|
(Gbl.Prefs.SideCols & Lay_SHOW_LEFT_COLUMN)) || // Left column visible
|
||||||
|
Gbl.CurrentAct == ActSeeCal ||
|
||||||
|
Gbl.CurrentAct == ActPrnCal)
|
||||||
|
{
|
||||||
|
/***** Get list of holidays *****/
|
||||||
|
if (!Gbl.Hlds.LstIsRead)
|
||||||
|
{
|
||||||
|
Gbl.Hlds.SelectedOrderType = Hld_ORDER_BY_START_DATE;
|
||||||
|
Hld_GetListHolidays ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Create list of calls for examination *****/
|
||||||
|
Exa_CreateListOfExamAnnouncements ();
|
||||||
|
|
||||||
|
/***** Write script to initialize variables used to draw months *****/
|
||||||
|
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");
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out," 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");
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out," var STR_EXAM = '");
|
||||||
|
fprintf (Gbl.F.Out,Txt_Exam_of_X,Gbl.CurrentCrs.Crs.FullName);
|
||||||
|
fprintf (Gbl.F.Out,"';");
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out," var Hlds = [];\n");
|
||||||
|
for (NumHld = 0;
|
||||||
|
NumHld < Gbl.Hlds.Num;
|
||||||
|
NumHld++)
|
||||||
|
fprintf (Gbl.F.Out," Hlds.push({ PlcCod: %ld, HldTyp: %u, StartDate: %s, EndDate: %s, Name: '%s' });\n",
|
||||||
|
Gbl.Hlds.Lst[NumHld].PlcCod,
|
||||||
|
(unsigned) Gbl.Hlds.Lst[NumHld].HldTyp,
|
||||||
|
Gbl.Hlds.Lst[NumHld].StartDate.YYYYMMDD,
|
||||||
|
Gbl.Hlds.Lst[NumHld].EndDate.YYYYMMDD,
|
||||||
|
Gbl.Hlds.Lst[NumHld].Name);
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out," var LstExamAnnouncements = [];\n");
|
||||||
|
for (NumExamAnnouncement = 0;
|
||||||
|
NumExamAnnouncement < Gbl.LstExamAnnouncements.NumExamAnnounc;
|
||||||
|
NumExamAnnouncement++)
|
||||||
|
fprintf (Gbl.F.Out," LstExamAnnouncements.push({ Year: %u, Month: %u, Day: %u });\n",
|
||||||
|
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Year,
|
||||||
|
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Month,
|
||||||
|
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Day);
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out," var HTMLContent;"
|
||||||
|
"</script>\n");
|
||||||
|
}
|
||||||
|
|
||||||
/***** Scripts depending on action *****/
|
/***** Scripts depending on action *****/
|
||||||
switch (Gbl.CurrentAct)
|
switch (Gbl.CurrentAct)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user