mirror of https://github.com/acanas/swad-core.git
Version 15.42.1
This commit is contained in:
parent
0936bb7bc2
commit
a875a3fc59
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
24
js/swad.js
24
js/swad.js
|
@ -619,7 +619,7 @@ function disableDetailedClicks() {
|
||||||
/************************ Draw an academic calendar **************************/
|
/************************ Draw an academic calendar **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
function Cal_DrawCalendar (id,Sunday,TimeUTC,CurrentPlcCod,PrintView,
|
function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView,
|
||||||
CGI,FormGoToCalendarParams,FormEventParams) {
|
CGI,FormGoToCalendarParams,FormEventParams) {
|
||||||
var StartingMonth = [ // Calendar starts one row before current month
|
var StartingMonth = [ // Calendar starts one row before current month
|
||||||
9, // January --> September
|
9, // January --> September
|
||||||
|
@ -662,7 +662,7 @@ function Cal_DrawCalendar (id,Sunday,TimeUTC,CurrentPlcCod,PrintView,
|
||||||
MonthId = id + '_month_' + MonthIdNum;
|
MonthId = id + '_month_' + MonthIdNum;
|
||||||
|
|
||||||
Gbl_HTMLContent += '<td class="CENTER_TOP" style="width:150px;">';
|
Gbl_HTMLContent += '<td class="CENTER_TOP" style="width:150px;">';
|
||||||
DrawMonth (MonthId,Sunday,Year,Month,CurrentMonth,CurrentDay,
|
DrawMonth (MonthId,FirstDayOfWeek,Year,Month,CurrentMonth,CurrentDay,
|
||||||
CurrentPlcCod,true,PrintView,CGI,
|
CurrentPlcCod,true,PrintView,CGI,
|
||||||
FormGoToCalendarParams,FormEventParams);
|
FormGoToCalendarParams,FormEventParams);
|
||||||
Gbl_HTMLContent += '</td>';
|
Gbl_HTMLContent += '</td>';
|
||||||
|
@ -682,7 +682,7 @@ function Cal_DrawCalendar (id,Sunday,TimeUTC,CurrentPlcCod,PrintView,
|
||||||
/***************************** Draw current month ****************************/
|
/***************************** Draw current month ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
function DrawCurrentMonth (id,Sunday,TimeUTC,CurrentPlcCod,
|
function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,
|
||||||
CGI,FormGoToCalendarParams,FormEventParams) {
|
CGI,FormGoToCalendarParams,FormEventParams) {
|
||||||
var d = new Date;
|
var d = new Date;
|
||||||
d.setTime(TimeUTC * 1000);
|
d.setTime(TimeUTC * 1000);
|
||||||
|
@ -690,7 +690,7 @@ function DrawCurrentMonth (id,Sunday,TimeUTC,CurrentPlcCod,
|
||||||
var Month = d.getMonth() + 1;
|
var Month = d.getMonth() + 1;
|
||||||
var CurrentDay = d.getDate();
|
var CurrentDay = d.getDate();
|
||||||
|
|
||||||
DrawMonth (id,Sunday,Year,Month,Month,CurrentDay,
|
DrawMonth (id,FirstDayOfWeek,Year,Month,Month,CurrentDay,
|
||||||
CurrentPlcCod,false,false,
|
CurrentPlcCod,false,false,
|
||||||
CGI,FormGoToCalendarParams,FormEventParams);
|
CGI,FormGoToCalendarParams,FormEventParams);
|
||||||
document.getElementById(id).innerHTML = Gbl_HTMLContent;
|
document.getElementById(id).innerHTML = Gbl_HTMLContent;
|
||||||
|
@ -699,10 +699,10 @@ function DrawCurrentMonth (id,Sunday,TimeUTC,CurrentPlcCod,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************* Draw a month ********************************/
|
/******************************* Draw a month ********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Sunday == 0 ==> Sunday is the first day of the week
|
// FirstDayOfWeek == 0 (monday) <==> Sunday is the last day of the week
|
||||||
// Sunday == 6 ==> Sunday is the last day of the week
|
// FirstDayOfWeek == 6 (sunday) <==> Sunday is the first day of the week
|
||||||
|
|
||||||
function DrawMonth (id,Sunday,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 = [
|
var NumDaysMonth = [
|
||||||
|
@ -750,7 +750,7 @@ function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay,
|
||||||
If it's 0 then write 1 box of the previous month.
|
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 it's 1 then write 0 boxes of the previous month. */
|
||||||
|
|
||||||
if ((DayOfWeek = (GetDayOfWeekMondayFirst (Yea,Mon,1) + Sunday + 1) % 7) == 0)
|
if ((DayOfWeek = (GetDayOfWeekMondayFirst (Yea,Mon,1) - FirstDayOfWeek) % 7) == 0)
|
||||||
Day = 1;
|
Day = 1;
|
||||||
else {
|
else {
|
||||||
if (Mon <= 1) {
|
if (Mon <= 1) {
|
||||||
|
@ -787,10 +787,10 @@ function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay,
|
||||||
Gbl_HTMLContent += '<table class="MONTH_TABLE_DAYS">' + '<tr>';
|
Gbl_HTMLContent += '<table class="MONTH_TABLE_DAYS">' + '<tr>';
|
||||||
for (DayOfWeek = 0; DayOfWeek < 7; DayOfWeek++)
|
for (DayOfWeek = 0; DayOfWeek < 7; DayOfWeek++)
|
||||||
Gbl_HTMLContent += '<td class="' +
|
Gbl_HTMLContent += '<td class="' +
|
||||||
((DayOfWeek == Sunday) ? 'DAY_NO_WRK_HEAD' :
|
((DayOfWeek == 6 - FirstDayOfWeek) ? 'DAY_NO_WRK_HEAD' :
|
||||||
'DAY_WRK_HEAD') +
|
'DAY_WRK_HEAD') +
|
||||||
'">' +
|
'">' +
|
||||||
DAYS_CAPS[(DayOfWeek + 6 - Sunday) % 7] +
|
DAYS_CAPS[(DayOfWeek + FirstDayOfWeek) % 7] +
|
||||||
'</td>';
|
'</td>';
|
||||||
Gbl_HTMLContent += '</tr>';
|
Gbl_HTMLContent += '</tr>';
|
||||||
|
|
||||||
|
@ -840,7 +840,7 @@ function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Day being drawn is sunday? */
|
/* Day being drawn is sunday? */
|
||||||
if (DayOfWeek == Sunday) // All the sundays are holidays
|
if (DayOfWeek == 6 - FirstDayOfWeek) // All the sundays are holidays
|
||||||
ClassForDay = (Mon == MonthToDraw) ? 'DAY_HLD' :
|
ClassForDay = (Mon == MonthToDraw) ? 'DAY_HLD' :
|
||||||
'DAY_HLD_LIGHT';
|
'DAY_HLD_LIGHT';
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,6 @@ void Cal_DrawCurrentMonth (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||||
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
||||||
unsigned Sunday = 6;
|
|
||||||
|
|
||||||
/***** Get list of holidays *****/
|
/***** Get list of holidays *****/
|
||||||
if (!Gbl.Hlds.LstIsRead)
|
if (!Gbl.Hlds.LstIsRead)
|
||||||
|
@ -170,7 +169,7 @@ void Cal_DrawCurrentMonth (void)
|
||||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||||
" Gbl_HTMLContent = '';"
|
" Gbl_HTMLContent = '';"
|
||||||
" DrawCurrentMonth ('CurrentMonth',%u,%ld,%ld,'%s/%s',",
|
" DrawCurrentMonth ('CurrentMonth',%u,%ld,%ld,'%s/%s',",
|
||||||
Sunday,
|
Gbl.Prefs.FirstDayOfWeek,
|
||||||
(long) Gbl.StartExecutionTimeUTC,
|
(long) Gbl.StartExecutionTimeUTC,
|
||||||
Gbl.CurrentCtr.Ctr.PlcCod,
|
Gbl.CurrentCtr.Ctr.PlcCod,
|
||||||
Cfg_HTTPS_URL_SWAD_CGI,Txt_STR_LANG_ID[Gbl.Prefs.Language]);
|
Cfg_HTTPS_URL_SWAD_CGI,Txt_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
|
@ -207,11 +206,9 @@ void Cal_DrawCurrentMonth (void)
|
||||||
void Cal_DrawCalendar (void)
|
void Cal_DrawCalendar (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Print;
|
extern const char *Txt_Print;
|
||||||
bool PrintView = (Gbl.CurrentAct == ActPrnCal);
|
|
||||||
unsigned Sunday = 6;
|
|
||||||
|
|
||||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||||
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
|
||||||
|
bool PrintView = (Gbl.CurrentAct == ActPrnCal);
|
||||||
|
|
||||||
/***** Get list of holidays *****/
|
/***** Get list of holidays *****/
|
||||||
if (!Gbl.Hlds.LstIsRead)
|
if (!Gbl.Hlds.LstIsRead)
|
||||||
|
@ -248,7 +245,7 @@ void Cal_DrawCalendar (void)
|
||||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||||
" Gbl_HTMLContent = '';"
|
" Gbl_HTMLContent = '';"
|
||||||
" Cal_DrawCalendar('calendar',%u,%ld,%ld,%s,'%s/%s',",
|
" Cal_DrawCalendar('calendar',%u,%ld,%ld,%s,'%s/%s',",
|
||||||
Sunday,
|
Gbl.Prefs.FirstDayOfWeek,
|
||||||
(long) Gbl.StartExecutionTimeUTC,
|
(long) Gbl.StartExecutionTimeUTC,
|
||||||
Gbl.CurrentCtr.Ctr.PlcCod,
|
Gbl.CurrentCtr.Ctr.PlcCod,
|
||||||
(Gbl.CurrentAct == ActPrnCal) ? "true" :
|
(Gbl.CurrentAct == ActPrnCal) ? "true" :
|
||||||
|
|
|
@ -111,11 +111,12 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.42 (2015/11/21)"
|
#define Log_PLATFORM_VERSION "SWAD 15.42.1 (2015/11/21)"
|
||||||
|
|
||||||
// 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.42.1: Nov 21, 2015 Calendar is drawn depending on user's preference about first day of the week. (187523 lines)
|
||||||
Version 15.42: Nov 21, 2015 New option in preferences to select first day of the week. (187520 lines)
|
Version 15.42: Nov 21, 2015 New option in preferences to select first day of the week. (187520 lines)
|
||||||
3 changes necessary in database:
|
3 changes necessary in database:
|
||||||
ALTER TABLE IP_prefs ADD COLUMN FirstDayOfWeek TINYINT NOT NULL DEFAULT 0 AFTER LastChange;
|
ALTER TABLE IP_prefs ADD COLUMN FirstDayOfWeek TINYINT NOT NULL DEFAULT 0 AFTER LastChange;
|
||||||
|
|
10
swad_user.c
10
swad_user.c
|
@ -2374,6 +2374,13 @@ static void Usr_SetUsrRoleAndPrefs (void)
|
||||||
// In this point I am logged
|
// In this point I am logged
|
||||||
|
|
||||||
/***** Set preferences from my preferences *****/
|
/***** Set preferences from my preferences *****/
|
||||||
|
Gbl.Prefs.FirstDayOfWeek = Gbl.Usrs.Me.UsrDat.Prefs.FirstDayOfWeek;
|
||||||
|
Gbl.Prefs.Layout = Gbl.Usrs.Me.UsrDat.Prefs.Layout;
|
||||||
|
// TODO: Should layout depend on session instead of user prefs?
|
||||||
|
// (for example, one user with two sessions with different layouts)
|
||||||
|
Gbl.Prefs.Menu = Gbl.Usrs.Me.UsrDat.Prefs.Menu;
|
||||||
|
Gbl.Prefs.SideCols = Gbl.Usrs.Me.UsrDat.Prefs.SideCols;
|
||||||
|
|
||||||
Gbl.Prefs.Theme = Gbl.Usrs.Me.UsrDat.Prefs.Theme;
|
Gbl.Prefs.Theme = Gbl.Usrs.Me.UsrDat.Prefs.Theme;
|
||||||
sprintf (Gbl.Prefs.PathTheme,"%s/%s/%s",
|
sprintf (Gbl.Prefs.PathTheme,"%s/%s/%s",
|
||||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,
|
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,
|
||||||
|
@ -2384,9 +2391,6 @@ static void Usr_SetUsrRoleAndPrefs (void)
|
||||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
|
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
|
||||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||||
|
|
||||||
Gbl.Prefs.Menu = Gbl.Usrs.Me.UsrDat.Prefs.Menu;
|
|
||||||
Gbl.Prefs.SideCols = Gbl.Usrs.Me.UsrDat.Prefs.SideCols;
|
|
||||||
|
|
||||||
/***** Get my last data *****/
|
/***** Get my last data *****/
|
||||||
Usr_GetMyLastData ();
|
Usr_GetMyLastData ();
|
||||||
if (Gbl.CurrentAct == ActAutUsrInt ||
|
if (Gbl.CurrentAct == ActAutUsrInt ||
|
||||||
|
|
Loading…
Reference in New Issue