diff --git a/swad_changelog.h b/swad_changelog.h index f7f72b06f..fd47bbaa9 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -459,10 +459,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.85.2 (2019-03-22)" +#define Log_PLATFORM_VERSION "SWAD 18.85.3 (2019-03-22)" #define CSS_FILE "swad18.85.1.css" #define JS_FILE "swad18.85.js" /* + Version 18.85.3: Mar 22, 2019 Code refactoring related to third-party cookies. (240833 lines) Version 18.85.2: Mar 22, 2019 Changed text related to third-party cookies. (240837 lines) Version 18.85.1: Mar 21, 2019 Fixed bug in form to link YouTube videos. Changes in CSS. (240827 lines) diff --git a/swad_media.c b/swad_media.c index 2016d5ea7..603264d8c 100644 --- a/swad_media.c +++ b/swad_media.c @@ -154,6 +154,7 @@ static void Med_ShowVideo (struct Media *Media, const char *ClassMedia); static void Med_ShowYoutube (struct Media *Media,const char *ClassMedia); static void Med_ShowEmbed (struct Media *Media,const char *ClassMedia); +static void Med_AlertThirdPartyCookies (void); static Med_Type_t Med_GetTypeFromStrInDB (const char *Str); static Med_Type_t Med_GetTypeFromExtAndMIME (const char *Extension, @@ -1661,11 +1662,8 @@ static void Med_ShowVideo (struct Media *Media, static void Med_ShowYoutube (struct Media *Media,const char *ClassMedia) { - extern const char *Txt_To_watch_multimedia_content_from_another_website_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 + /***** Check if YouTube code exists *****/ + if (Media->Name[0]) // YouTube code { if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) { @@ -1693,20 +1691,8 @@ static void Med_ShowYoutube (struct Media *Media,const char *ClassMedia) ""); } else - { - /***** Alert to inform about third party cookies *****/ - /* Start alert */ - Ale_ShowAlertAndButton1 (Ale_INFO,Txt_To_watch_multimedia_content_from_another_website_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); - } + /***** Alert to inform about third party cookies *****/ + Med_AlertThirdPartyCookies (); } } @@ -1716,9 +1702,6 @@ static void Med_ShowYoutube (struct Media *Media,const char *ClassMedia) static void Med_ShowEmbed (struct Media *Media,const char *ClassMedia) { - extern const char *Txt_To_watch_multimedia_content_from_another_website_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 { @@ -1747,20 +1730,8 @@ static void Med_ShowEmbed (struct Media *Media,const char *ClassMedia) ""); } else - { - /***** Alert to inform about third party cookies *****/ - /* Start alert */ - Ale_ShowAlertAndButton1 (Ale_INFO,Txt_To_watch_multimedia_content_from_another_website_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); - } + /***** Alert to inform about third party cookies *****/ + Med_AlertThirdPartyCookies (); } } @@ -1768,6 +1739,29 @@ static void Med_ShowEmbed (struct Media *Media,const char *ClassMedia) /********** Remove several media files and entries in database ***************/ /*****************************************************************************/ +static void Med_AlertThirdPartyCookies (void) + { + extern const char *Txt_To_watch_multimedia_content_from_another_website_you_have_to_accept_third_party_cookies_in_your_personal_settings; + extern const char *Txt_Settings; + + /***** Alert to inform about third party cookies *****/ + /* Start alert */ + Ale_ShowAlertAndButton1 (Ale_INFO,Txt_To_watch_multimedia_content_from_another_website_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); + } + +/*****************************************************************************/ +/********** Remove several media files and entries in database ***************/ +/*****************************************************************************/ + void Med_RemoveMediaFromAllRows (unsigned NumMedia,MYSQL_RES *mysql_res) { MYSQL_ROW row;