From 9b9f08120032cd974eed18db9857a3a7e013ae77 Mon Sep 17 00:00:00 2001 From: acanas Date: Wed, 7 Jun 2023 00:58:05 +0200 Subject: [PATCH] Version 22.120.2: Jun 07, 2023 Code refactoring related to cookies and hidden-visible. --- swad_changelog.h | 2 +- swad_media.c | 124 ++++++++++++++++++++++++----------------------- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index be55aae5..af6eed1a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -633,7 +633,7 @@ TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la ho #define CSS_FILE "swad22.120.css" #define JS_FILE "swad22.49.js" /* - Version 22.120.2: Jun 07, 2023 Code refactoring related to cookies and hidden-visible. (337640 lines) + Version 22.120.2: Jun 07, 2023 Code refactoring related to cookies and hidden-visible. (337642 lines) Version 22.120.1: Jun 06, 2023 Translation of messages about cookies. (337620 lines) Version 22.120: Jun 06, 2023 Code refactoring related to hidden-visible. (337561 lines) Version 22.119: Jun 06, 2023 Code refactoring related to hidden-visible. (337588 lines) diff --git a/swad_media.c b/swad_media.c index 5655a1bd..5b5458da 100644 --- a/swad_media.c +++ b/swad_media.c @@ -1739,41 +1739,42 @@ static void Med_ShowYoutube (const struct Med_Media *Media,const char *ClassMedi { /***** Check if YouTube code exists *****/ if (Media->Name[0]) // YouTube code - { - if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptCookies) + switch (Gbl.Usrs.Me.UsrDat.Prefs.RefuseAcceptCookies) { - /***** Show linked external media *****/ - // Example of code given by YouTube: - // - /* Begin container */ - HTM_DIV_Begin ("class=\"MED_VIDEO_CONT\""); + case Coo_REFUSE: + /***** Alert to inform about third party cookies *****/ + Med_AlertThirdPartyCookies (); + break; + case Coo_ACCEPT: + /***** Show linked external media *****/ + // Example of code given by YouTube: + // + /* Begin container */ + HTM_DIV_Begin ("class=\"MED_VIDEO_CONT\""); - /* iframe for video */ - HTM_TxtF (""); + /* iframe for video */ + HTM_TxtF (""); - /* End container */ - HTM_DIV_End (); + /* End container */ + HTM_DIV_End (); + break; } - else - /***** Alert to inform about third party cookies *****/ - Med_AlertThirdPartyCookies (); - } } /*****************************************************************************/ @@ -1784,40 +1785,41 @@ static void Med_ShowEmbed (const struct Med_Media *Media,const char *ClassMedia) { /***** Check if embed URL exists *****/ if (Media->URL[0]) // Embed URL - { - if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptCookies) + switch (Gbl.Usrs.Me.UsrDat.Prefs.RefuseAcceptCookies) { - /***** Show linked external media *****/ - // Example of code given by Slideshare: - // - /* Begin container */ - HTM_DIV_Begin ("class=\"MED_EMBED_CONT\""); + case Coo_REFUSE: + /***** Alert to inform about third party cookies *****/ + Med_AlertThirdPartyCookies (); + break; + case Coo_ACCEPT: + /***** Show linked external media *****/ + // Example of code given by Slideshare: + // + /* Begin container */ + HTM_DIV_Begin ("class=\"MED_EMBED_CONT\""); - /* iframe for external media */ - HTM_TxtF (""); + /* iframe for external media */ + HTM_TxtF (""); - /* End container */ - HTM_DIV_End (); + /* End container */ + HTM_DIV_End (); + break; } - else - /***** Alert to inform about third party cookies *****/ - Med_AlertThirdPartyCookies (); - } } /*****************************************************************************/