Version18.79.1

This commit is contained in:
Antonio Cañas Vargas 2019-03-17 19:37:41 +01:00
parent 331ede1998
commit 9cb7fc6930
6 changed files with 97 additions and 44 deletions

View File

@ -439,7 +439,6 @@ void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const c
if (TxtButton[0])
{
/* Start form */
Frm_StartFormAnchor (NextAction,Anchor);
Frm_StartFormAnchorOnSubmit (NextAction,Anchor,OnSubmit);
if (FuncParams)
FuncParams ();

View File

@ -457,24 +457,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.79 (2019-03-17)"
#define Log_PLATFORM_VERSION "SWAD 18.79.1 (2019-03-17)"
#define CSS_FILE "swad18.77.css"
#define JS_FILE "swad18.77.js"
/*
TODO: Cookies de terceros
Incrustar vídeos de YouTube hace que se guarden cookies de terceros,
lo cual implica tener que poner el maldito aviso.
Sólo se me ocurre que el usuario que quiera ver vídeos de YouTube
tendría que aceptar las cookies de terceros, que por defecto estarían bloqueadas.
Es decir, por defecto en vez de mostrarse un vídeo de YouTube
se mostraría un aviso indicando que si se desea ver el vídeo
hay que consentir las cookies de terceros.
Si el usuario acepta, a partir de ese momento se le mostrarían los vídeos.
Ese bloqueo o aceptación sería una opción en Perfil > Ajustes
que el usuario podría cambiar en cualquier momento.
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.1: Mar 17, 2019 YouTube videos are not shown if user doesn't accept third party cookies. (240541 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);

View File

@ -37,6 +37,7 @@
#include <unistd.h> // For unlink, lstat
#include "swad_config.h"
#include "swad_cookie.h"
#include "swad_global.h"
#include "swad_file.h"
#include "swad_file_browser.h"
@ -150,8 +151,7 @@ static void Med_ShowGIF (struct Media *Media,
static void Med_ShowVideo (struct Media *Media,
const char PathMedPriv[PATH_MAX + 1],
const char *ClassMedia);
static void Med_ShowYoutube (struct Media *Media,
const char *ClassMedia);
static void Med_ShowYoutube (struct Media *Media,const char *ClassMedia);
static Med_Type_t Med_GetTypeFromExtAndMIME (const char *Extension,
const char *MIMEType);
@ -1229,10 +1229,7 @@ void Med_ShowMedia (struct Media *Media,
return;
/***** Start media container *****/
fprintf (Gbl.F.Out,"<div class=\"%s",ClassContainer);
if (Media->Type == Med_YOUTUBE)
fprintf (Gbl.F.Out," MED_VIDEO_CONT");
fprintf (Gbl.F.Out,"\">");
fprintf (Gbl.F.Out,"<div class=\"%s\">",ClassContainer);
if (Media->Type == Med_YOUTUBE)
/***** Show media *****/
@ -1493,32 +1490,54 @@ static void Med_ShowVideo (struct Media *Media,
/*************************** Show an embed media *****************************/
/*****************************************************************************/
static void Med_ShowYoutube (struct Media *Media,
const char *ClassMedia)
static void Med_ShowYoutube (struct Media *Media,const char *ClassMedia)
{
extern const char *Txt_To_watch_YouTube_videos_you_have_to_accept_third_party_cookies_in_your_personal_settings;
extern const char *Txt_Settings;
/***** Check if embed URL exists *****/
if (Media->URL[0]) // Embed URL
{
/***** Show linked external media *****/
// Example of code give by YouTube:
// <iframe width="560" height="315"
// src="https://www.youtube.com/embed/xu9IbeF9CBw"
// frameborder="0"
// allow="accelerometer; autoplay; encrypted-media;
// gyroscope; picture-in-picture" allowfullscreen>
// </iframe>
fprintf (Gbl.F.Out,"<iframe src=\"https://www.youtube.com/embed/%s\""
" frameborder=\"0\""
" allow=\"accelerometer; autoplay; encrypted-media;"
" gyroscope; picture-in-picture\""
" allowfullscreen=\"allowfullscreen\""
" class=\"%s\"",
Media->Name,ClassMedia);
if (Media->Title)
if (Media->Title[0])
fprintf (Gbl.F.Out," title=\"%s\"",Media->Title);
fprintf (Gbl.F.Out,">"
"</iframe>");
if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies)
{
/***** Show linked external media *****/
// Example of code give by YouTube:
// <iframe width="560" height="315"
// src="https://www.youtube.com/embed/xu9IbeF9CBw"
// frameborder="0"
// allow="accelerometer; autoplay; encrypted-media;
// gyroscope; picture-in-picture" allowfullscreen>
// </iframe>
fprintf (Gbl.F.Out,"<div class=\"MED_VIDEO_CONT\">"
"<iframe src=\"https://www.youtube.com/embed/%s\""
" frameborder=\"0\""
" allow=\"accelerometer; autoplay; encrypted-media;"
" gyroscope; picture-in-picture\""
" allowfullscreen=\"allowfullscreen\""
" class=\"%s\"",
Media->Name,ClassMedia);
if (Media->Title)
if (Media->Title[0])
fprintf (Gbl.F.Out," title=\"%s\"",Media->Title);
fprintf (Gbl.F.Out,">"
"</iframe>"
"</div>");
}
else
{
/***** Alert to inform about third party cookies *****/
/* Start alert */
Ale_ShowAlertAndButton1 (Ale_INFO,Txt_To_watch_YouTube_videos_you_have_to_accept_third_party_cookies_in_your_personal_settings);
/* Put form to change cookies preferences */
if (!Gbl.Form.Inside)
Lay_PutContextualLinkIconText (ActReqEdiPrf,Coo_COOKIES_ID,NULL,
"cog.svg",
Txt_Settings);
/* End alert */
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
}
}
}

View File

@ -371,7 +371,7 @@ void Ntf_ShowMyNotifications (void)
Txt_Mark_all_NOTIFICATIONS_as_read);
/* Put form to change notification preferences */
Lay_PutContextualLinkIconText (ActReqEdiPrf,NULL,NULL,
Lay_PutContextualLinkIconText (ActReqEdiPrf,Ntf_NOTIFICATIONS_ID,NULL,
"cog.svg",
Txt_Settings);
@ -1924,6 +1924,9 @@ void Ntf_PutFormChangeNotifSentByEMail (void)
extern const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS];
Ntf_NotifyEvent_t NotifyEvent;
/***** Start section with preferences on privacy *****/
Lay_StartSection (Ntf_NOTIFICATIONS_ID);
/***** Start box *****/
Box_StartBox (NULL,Txt_Notifications,Ntf_PutIconsNotif,
Hlp_PROFILE_Preferences_notifications,Box_NOT_CLOSABLE);
@ -1988,6 +1991,9 @@ void Ntf_PutFormChangeNotifSentByEMail (void)
/***** End box *****/
Box_EndBox ();
/***** End section with preferences about notifications *****/
Lay_EndSection ();
}
/*****************************************************************************/

View File

@ -41,6 +41,8 @@
#define Ntf_MAX_CHARS_SUMMARY (256 - 1) // 255
#define Ntf_MAX_BYTES_SUMMARY ((Ntf_MAX_CHARS_SUMMARY + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 4095
#define Ntf_NOTIFICATIONS_ID "notif"
/*****************************************************************************/
/******************************** Public types *******************************/
/*****************************************************************************/

View File

@ -49865,6 +49865,45 @@ const char *Txt_To_use_chat_you_must_have_installed_the_software_X_and_add_Y_ =
" &agrave; lista de sites permitidos no painel de controle Java.";
#endif
const char *Txt_To_watch_YouTube_videos_you_have_to_accept_third_party_cookies_in_your_personal_settings =
#if L==1 // ca
"Per veure v&iacute;deos de YouTube"
" ha d'acceptar les cookies de tercers"
" en les seves par&agrave;metres personals.";
#elif L==2 // de
"Um YouTube-Videos anzusehen,"
" m&uuml;ssen Sie in Ihren pers&ouml;nlichen Einstellungen Cookies"
" von Drittanbietern akzeptieren.";
#elif L==3 // en
"To watch YouTube videos"
" you have to accept third party cookies"
" in your personal settings.";
#elif L==4 // es
"Para ver v&iacute;deos de YouTube"
" tiene que aceptar las cookies de terceros"
" en sus ajustes personales.";
#elif L==5 // fr
"Pour regarder des vid&eacute;os YouTube,"
" vous devez accepter les cookies de tiers"
" dans vos r&eacute;glages personnels.";
#elif L==6 // gn
"Para ver v&iacute;deos de YouTube"
" tiene que aceptar las cookies de terceros"
" en sus ajustes personales.";
#elif L==7 // it
"Per guardare i video di YouTube"
" devi accettare i cookie di terze parti"
" nelle tue impostazioni personali.";
#elif L==8 // pl
"Aby ogl&aogon;da&cacute; filmy z YouTube,"
" musisz zaakceptowa&cacute; pliki cookie innych firm"
" w swoich ustawieniach osobistych.";
#elif L==9 // pt
"Para assistir a v&iacute;deos do YouTube,"
" voc&ecirc; precisa aceitar cookies de terceiros"
" nas suas configura&ccedil;&otilde;es pessoais.";
#endif
const char *Txt_Today =
#if L==1 // ca
"Avui";