diff --git a/swad_alert.c b/swad_alert.c index d378765b..1e4522e3 100644 --- a/swad_alert.c +++ b/swad_alert.c @@ -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 (); diff --git a/swad_changelog.h b/swad_changelog.h index f7854e9f..3266d6d9 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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); diff --git a/swad_media.c b/swad_media.c index 123cb0d8..cd80fa4b 100644 --- a/swad_media.c +++ b/swad_media.c @@ -37,6 +37,7 @@ #include // 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,"
Type == Med_YOUTUBE) - fprintf (Gbl.F.Out," MED_VIDEO_CONT"); - fprintf (Gbl.F.Out,"\">"); + fprintf (Gbl.F.Out,"
",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: - // - fprintf (Gbl.F.Out,""); + if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) + { + /***** Show linked external media *****/ + // Example of code give by YouTube: + // + fprintf (Gbl.F.Out,"
" + "" + "
"); + } + 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); + } } } diff --git a/swad_notification.c b/swad_notification.c index cfcdfc78..4414f241 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -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 (); } /*****************************************************************************/ diff --git a/swad_notification.h b/swad_notification.h index 1bdc33a8..323b9be1 100644 --- a/swad_notification.h +++ b/swad_notification.h @@ -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 *******************************/ /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index 866fdc09..77aa1432 100644 --- a/swad_text.c +++ b/swad_text.c @@ -49865,6 +49865,45 @@ const char *Txt_To_use_chat_you_must_have_installed_the_software_X_and_add_Y_ = " à 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ídeos de YouTube" + " ha d'acceptar les cookies de tercers" + " en les seves paràmetres personals."; +#elif L==2 // de + "Um YouTube-Videos anzusehen," + " müssen Sie in Ihren persö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ídeos de YouTube" + " tiene que aceptar las cookies de terceros" + " en sus ajustes personales."; +#elif L==5 // fr + "Pour regarder des vidéos YouTube," + " vous devez accepter les cookies de tiers" + " dans vos réglages personnels."; +#elif L==6 // gn + "Para ver ví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ądać filmy z YouTube," + " musisz zaakceptować pliki cookie innych firm" + " w swoich ustawieniach osobistych."; +#elif L==9 // pt + "Para assistir a vídeos do YouTube," + " você precisa aceitar cookies de terceiros" + " nas suas configurações pessoais."; +#endif + const char *Txt_Today = #if L==1 // ca "Avui";