Version18.79

This commit is contained in:
Antonio Cañas Vargas 2019-03-17 18:20:55 +01:00
parent 1af2a3277e
commit 331ede1998
12 changed files with 131 additions and 24 deletions

View File

@ -30,8 +30,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_announcement.o swad_assignment.o swad_attendance.o \
swad_banner.o swad_box.o swad_button.o \
swad_calendar.o swad_centre.o swad_chat.o swad_classroom.o \
swad_config.o swad_connected.o swad_country.o swad_course.o \
swad_cryptography.o \
swad_config.o swad_connected.o swad_cookie.o swad_country.o \
swad_course.o swad_cryptography.o \
swad_database.o swad_date.o swad_degree.o swad_degree_type.o \
swad_department.o swad_duplicate.o \
swad_enrolment.o swad_exam.o \

View File

@ -37,6 +37,7 @@
#include "swad_banner.h"
#include "swad_calendar.h"
#include "swad_config.h"
#include "swad_cookie.h"
#include "swad_country.h"
#include "swad_course.h"
#include "swad_chat.h"
@ -1557,6 +1558,7 @@ Profile:
1324. ActChgMnu Change menu
1325. ActChgPriPho Change privacy of my photo
1326. ActChgPriPrf Change privacy of my public profile
NEW. ActChgCooPrf Change preference about third party cookies
1327. ActChgNtfPrf Change whether to notify by email new messages
1328. ActPrnUsrQR Show my QR code ready to print
@ -3142,6 +3144,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActChgMnu */{1243,-1,TabUnk,ActReqEdiPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Mnu_ChangeMenu ,Pre_EditPrefs ,NULL},
/* ActChgPriPho */{ 774,-1,TabUnk,ActReqEdiPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pho_ChangePhotoVisibility ,NULL},
/* ActChgPriPrf */{1404,-1,TabUnk,ActReqEdiPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_ChangeProfileVisibility ,NULL},
/* ActChgCooPrf */{1764,-1,TabUnk,ActReqEdiPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Coo_ChangeMyPrefsCookies ,NULL},
/* ActChgNtfPrf */{ 775,-1,TabUnk,ActReqEdiPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Ntf_ChangeNotifyEvents ,Pre_EditPrefs ,NULL},
/* ActPrnUsrQR */{1022,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Usr_PrintUsrQRCode ,NULL},
@ -4918,6 +4921,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActFolSevTch, // #1761
ActUnfSevStd, // #1762
ActUnfSevTch, // #1763
ActChgCooPrf, // #1764
};
/*****************************************************************************/

View File

@ -61,9 +61,9 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1 + 8 + 55 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 176 + 168 + 15 + 65)
#define Act_NUM_ACTIONS (1 + 8 + 55 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 176 + 168 + 15 + 66)
#define Act_MAX_ACTION_COD 1763
#define Act_MAX_ACTION_COD 1764
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
@ -1590,14 +1590,15 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActChgMnu (ActSeeMyUsgRep + 57)
#define ActChgPriPho (ActSeeMyUsgRep + 58)
#define ActChgPriPrf (ActSeeMyUsgRep + 59)
#define ActChgNtfPrf (ActSeeMyUsgRep + 60)
#define ActChgCooPrf (ActSeeMyUsgRep + 60)
#define ActChgNtfPrf (ActSeeMyUsgRep + 61)
#define ActPrnUsrQR (ActSeeMyUsgRep + 61)
#define ActPrnUsrQR (ActSeeMyUsgRep + 62)
#define ActPrnMyTT (ActSeeMyUsgRep + 62)
#define ActEdiTut (ActSeeMyUsgRep + 63)
#define ActChgTut (ActSeeMyUsgRep + 64)
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 65)
#define ActPrnMyTT (ActSeeMyUsgRep + 63)
#define ActEdiTut (ActSeeMyUsgRep + 64)
#define ActChgTut (ActSeeMyUsgRep + 65)
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 66)
/*****************************************************************************/
/******************************** Public types *******************************/

View File

@ -407,8 +407,6 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
// TODO: Mensajes > Anuncios cuando no estás identificado, deberían salir algunos, ¿por qué no indicar que se muestren para todos?
// TODO: Chequear todas las directivas <label>
// TODO: Fix bug: Al mostrar una orla con todos los profesores de SWAD, se muestran primeros los profesores y luego los no editores (repetidos algunos)
// TODO: Chequear todos los iconos .gif y .png que restan, concretamente los de file_browser
@ -459,7 +457,7 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.77.6 (2019-03-17)"
#define Log_PLATFORM_VERSION "SWAD 18.79 (2019-03-17)"
#define CSS_FILE "swad18.77.css"
#define JS_FILE "swad18.77.js"
/*
@ -475,7 +473,13 @@ Si el usuario acepta, a partir de ese momento se le mostrar
Ese bloqueo o aceptación sería una opción en Perfil > Ajustes
que el usuario podría cambiar en cualquier momento.
Version 18.79: Mar 17, 2019 YouTube videos are not shown if user doesn't accept third party cookies. (? lines)
TODO: Crear la función para ver Fig_COOKIES
Version 18.79.1: Mar 17, 2019 YouTube videos are not shown if user doesn't accept third party cookies. (? lines)
Version 18.79: Mar 17, 2019 New module swad_cookies for user's preference about cookies. (240494 lines)
2 changes necessary in database:
ALTER TABLE usr_data ADD COLUMN ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER SideCols,ADD INDEX (ThirdPartyCookies);
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1764','es','N','Cambiar preferencia cookies');
Version 18.78: Mar 17, 2019 Fixed bugs and code refactoring in media.
Code refactoring in tests. (240252 lines)
Version 18.77.5: Mar 17, 2019 Fixed bugs in forms to upload media. (240272 lines)

View File

@ -2808,10 +2808,11 @@ mysql> DESCRIBE usr_data;
| Comments | text | NO | | NULL | |
| Menu | tinyint(4) | NO | MUL | 0 | |
| SideCols | tinyint(4) | NO | MUL | 3 | |
| ThirdPartyCookies | enum('N','Y') | NO | MUL | N | |
| NotifNtfEvents | int(11) | NO | | 0 | |
| EmailNtfEvents | int(11) | NO | | 0 | |
+-------------------+--------------------------------------------------+------+-----+---------+----------------+
33 rows in set (0,00 sec)
34 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_data ("
"UsrCod INT NOT NULL AUTO_INCREMENT,"
@ -2845,6 +2846,7 @@ mysql> DESCRIBE usr_data;
"Comments TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
"Menu TINYINT NOT NULL DEFAULT 0,"
"SideCols TINYINT NOT NULL DEFAULT 3,"
"ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N',"
"NotifNtfEvents INT NOT NULL DEFAULT 0,"
"EmailNtfEvents INT NOT NULL DEFAULT 0,"
"PRIMARY KEY(UsrCod),"
@ -2862,7 +2864,8 @@ mysql> DESCRIBE usr_data;
"INDEX(DptCod),"
"INDEX(CtrCod),"
"INDEX(Menu),"
"INDEX(SideCols))");
"INDEX(SideCols),"
"INDEX(ThirdPartyCookies)");
/***** Table usr_duplicated *****/
/*

View File

@ -333,6 +333,7 @@ void Fig_ShowFigures (void)
Fig_GetAndShowNumUsrsPerTheme, // Fig_THEMES
Fig_GetAndShowNumUsrsPerSideColumns, // Fig_SIDE_COLUMNS
Fig_GetAndShowNumUsrsPerPrivacy, // Fig_PRIVACY
Fig_GetAndShowNumUsrsPerPrivacy, // Fig_COOKIES
};
/***** Get the type of figure ******/

View File

@ -31,7 +31,7 @@
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define Fig_NUM_FIGURES 27
#define Fig_NUM_FIGURES 28
typedef enum
{
Fig_USERS, // Number of users
@ -61,6 +61,7 @@ typedef enum
Fig_THEMES, // Number of users per theme
Fig_SIDE_COLUMNS, // Number of users per layout of columns
Fig_PRIVACY, // Number of users per privacity
Fig_COOKIES, // Number of users per acceptation of cookies
} Fig_FigureType_t;
#define Fig_FIGURE_TYPE_DEF Fig_USERS

View File

@ -3689,6 +3689,27 @@ const char *Hlp_PROFILE_Preferences_privacy =
"PROFILE.Preferences.en#privacy";
#endif
const char *Hlp_PROFILE_Preferences_cookies =
#if L==1
"PROFILE.Preferences.es#cookies";
#elif L==2
"PROFILE.Preferences.en#cookies";
#elif L==3
"PROFILE.Preferences.en#cookies";
#elif L==4
"PROFILE.Preferences.es#cookies";
#elif L==5
"PROFILE.Preferences.en#cookies";
#elif L==6
"PROFILE.Preferences.es#cookies";
#elif L==7
"PROFILE.Preferences.en#cookies";
#elif L==8
"PROFILE.Preferences.en#cookies";
#elif L==9
"PROFILE.Preferences.en#cookies";
#endif
const char *Hlp_PROFILE_Preferences_notifications =
#if L==1
"PROFILE.Preferences.es#notificaciones";

View File

@ -33,6 +33,7 @@
#include "swad_box.h"
#include "swad_calendar.h"
#include "swad_config.h"
#include "swad_cookie.h"
#include "swad_database.h"
#include "swad_date.h"
#include "swad_form.h"
@ -110,6 +111,9 @@ void Pre_EditPrefs (void)
/***** Form to set my preferences on privacy *****/
Pri_EditMyPrivacy ();
/***** Form to set my preferences on cookies *****/
Coo_EditMyPrefsOnCookies ();
/***** Automatic email to notify of new events *****/
Ntf_PutFormChangeNotifSentByEMail ();
}

View File

@ -473,6 +473,27 @@ const char *Txt_Absents =
"Assentes";
#endif
const char *Txt_Accept_third_party_cookies_to_watch_YouTube_videos =
#if L==1 // ca
"Accepta cookies de tercers per poder veure v&iacute;deos de YouTube";
#elif L==2 // de
"Akzeptieren Sie Cookies von Drittanbietern, um YouTube-Videos anzusehen";
#elif L==3 // en
"Accept third-party cookies to watch YouTube videos";
#elif L==4 // es
"Aceptar cookies de terceros para poder ver v&iacute;deos de YouTube";
#elif L==5 // fr
"Acceptez les cookies tiers pour regarder des vid&eacute;os YouTube";
#elif L==6 // gn
"Aceptar cookies de terceros para poder ver v&iacute;deos de YouTube"; // Okoteve traducción
#elif L==7 // it
"Accetta i cookie di terze parti per guardare i video di YouTube";
#elif L==8 // pl
"Akceptuj pliki cookie innych firm, aby ogl&aogon;da&cacute; filmy z YouTube";
#elif L==9 // pt
"Aceite cookies de terceiros para assistir a v&iacute;deos do YouTube";
#endif
const char *Txt_accessible_for_reading_and_writing_by_administrators_of_the_centre =
#if L==1 // ca
"accessible per a lectura i escriptura per administradors del centre";
@ -4681,6 +4702,27 @@ const char *Txt_Control_of_class_attendance =
"Controlo de assiduidade de classe";
#endif
const char *Txt_Cookies =
#if L==1 // ca
"Cookies";
#elif L==2 // de
"Cookies";
#elif L==3 // en
"Cookies";
#elif L==4 // es
"Cookies";
#elif L==5 // fr
"Cookies";
#elif L==6 // gn
"Cookies";
#elif L==7 // it
"Cookies";
#elif L==8 // pl
"Cookies";
#elif L==9 // pt
"Cookies";
#endif
const char *Txt_Copy_FOLDER_FILE_OR_LINK_X = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"Copiar %s";
@ -40702,6 +40744,26 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
"Prywatno&sacute;&cacute;"
#elif L==9 // pt
"Privacidade"
#endif
,
#if L==1 // ca // Fig_COOKIES
"Cookies"
#elif L==2 // de
"Cookies"
#elif L==3 // en
"Cookies"
#elif L==4 // es
"Cookies"
#elif L==5 // fr
"Cookies"
#elif L==6 // gn
"Cookies"
#elif L==7 // it
"Cookies"
#elif L==8 // pl
"Cookies"
#elif L==9 // pt
"Cookies"
#endif
};

View File

@ -353,7 +353,8 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
UsrDat->Prefs.EmailNtfEvents = 0; // By default, don't notify anything
UsrDat->Prefs.AcceptThirdPartyCookies = false; // By default, don't accept third party cookies
UsrDat->Prefs.EmailNtfEvents = 0; // By default, don't notify anything
}
/*****************************************************************************/
@ -546,8 +547,9 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
"Comments," // row[27]
"Menu," // row[28]
"SideCols," // row[29]
"NotifNtfEvents," // row[20]
"EmailNtfEvents" // row[31]
"ThirdPartyCookies," // row[30]
"NotifNtfEvents," // row[31]
"EmailNtfEvents" // row[32]
" FROM usr_data WHERE UsrCod=%ld",
UsrDat->UsrCod);
if (NumRows != 1)
@ -666,12 +668,15 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
else
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
/* Get on which events I want to be notified inside the platform */
if (sscanf (row[30],"%u",&UsrDat->Prefs.NotifNtfEvents) != 1)
/* Get if user accepts third party cookies */
UsrDat->Prefs.AcceptThirdPartyCookies = (row[30][0] == 'Y');
/* Get on which events the user wants to be notified inside the platform */
if (sscanf (row[31],"%u",&UsrDat->Prefs.NotifNtfEvents) != 1)
UsrDat->Prefs.NotifNtfEvents = (unsigned) -1; // 0xFF..FF
/* Get on which events I want to be notified by email */
if (sscanf (row[31],"%u",&UsrDat->Prefs.EmailNtfEvents) != 1)
/* Get on which events the user wants to be notified by email */
if (sscanf (row[32],"%u",&UsrDat->Prefs.EmailNtfEvents) != 1)
UsrDat->Prefs.EmailNtfEvents = 0;
if (UsrDat->Prefs.EmailNtfEvents >= (1 << Ntf_NUM_NOTIFY_EVENTS)) // Maximum binary value for NotifyEvents is 000...0011...11
UsrDat->Prefs.EmailNtfEvents = 0;

View File

@ -192,6 +192,7 @@ struct UsrData
Ico_IconSet_t IconSet;
Mnu_Menu_t Menu;
unsigned SideCols;
bool AcceptThirdPartyCookies; // User has accepted third party cookies
unsigned NotifNtfEvents; // One bit activated for each type of event
unsigned EmailNtfEvents; // One bit activated for each type of event
} Prefs;