2019-09-22 13:54:11 +02:00
|
|
|
|
// swad_cookies.c: user's preferences about cookies
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2020-01-01 14:53:57 +01:00
|
|
|
|
Copyright (C) 1999-2020 Antonio Ca<EFBFBD>as Vargas
|
2019-09-22 13:54:11 +02:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "swad_box.h"
|
|
|
|
|
#include "swad_cookie.h"
|
|
|
|
|
#include "swad_database.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_figure.h"
|
2019-09-22 13:54:11 +02:00
|
|
|
|
#include "swad_form.h"
|
|
|
|
|
#include "swad_global.h"
|
2019-10-23 20:07:56 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2019-09-22 13:54:11 +02:00
|
|
|
|
#include "swad_layout.h"
|
|
|
|
|
#include "swad_setting.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 03:41:05 +02:00
|
|
|
|
static void Coo_PutIconsCookies (__attribute__((unused)) void *Args);
|
2019-09-22 13:54:11 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Edit my preferences on cookies ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Coo_EditMyPrefsOnCookies (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_PROFILE_Settings_cookies;
|
|
|
|
|
extern const char *Txt_Cookies;
|
|
|
|
|
extern const char *Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites;
|
|
|
|
|
|
|
|
|
|
/***** Start section with preferences about cookies *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (Coo_COOKIES_ID);
|
2019-09-22 13:54:11 +02:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin (NULL,Txt_Cookies,
|
2020-04-08 03:41:05 +02:00
|
|
|
|
Coo_PutIconsCookies,NULL,
|
2019-09-22 13:54:11 +02:00
|
|
|
|
Hlp_PROFILE_Settings_cookies,Box_NOT_CLOSABLE,2);
|
|
|
|
|
|
|
|
|
|
/***** Edit my preference about cookies *****/
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/* Begin form */
|
2019-09-22 13:54:11 +02:00
|
|
|
|
Frm_StartFormAnchor (ActChgCooPrf,Coo_COOKIES_ID);
|
|
|
|
|
|
|
|
|
|
/* Start container */
|
2019-10-23 21:37:01 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"%s\"",
|
|
|
|
|
(Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) ? "DAT_N LIGHT_BLUE" :
|
|
|
|
|
"DAT");
|
2019-09-22 13:54:11 +02:00
|
|
|
|
/* Check box */
|
2019-11-03 10:41:31 +01:00
|
|
|
|
HTM_LABEL_Begin (NULL);
|
2020-03-12 13:53:37 +01:00
|
|
|
|
HTM_INPUT_CHECKBOX ("cookies",HTM_SUBMIT_ON_CHANGE,
|
2019-11-04 20:41:35 +01:00
|
|
|
|
"value=\"Y\"%s",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? " checked=\"checked\"" : "");
|
2019-11-10 12:36:37 +01:00
|
|
|
|
HTM_Txt (Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
|
2019-11-02 12:59:31 +01:00
|
|
|
|
HTM_LABEL_End ();
|
2019-09-22 13:54:11 +02:00
|
|
|
|
|
|
|
|
|
/* End container */
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2019-09-22 13:54:11 +02:00
|
|
|
|
|
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2019-09-22 13:54:11 +02:00
|
|
|
|
|
|
|
|
|
/***** End section with preferences about cookies *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2019-09-22 13:54:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Put contextual icons in cookies preference ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 03:41:05 +02:00
|
|
|
|
static void Coo_PutIconsCookies (__attribute__((unused)) void *Args)
|
2019-09-22 13:54:11 +02:00
|
|
|
|
{
|
2020-04-08 03:41:05 +02:00
|
|
|
|
/***** Put icon to show a figure *****/
|
|
|
|
|
Fig_PutIconToShowFigure (Fig_COOKIES);
|
2019-09-22 13:54:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Change my preference about third party cookies ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Coo_ChangeMyPrefsCookies (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get param with preference about third party cookies *****/
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies = Par_GetParToBool ("cookies");
|
|
|
|
|
|
|
|
|
|
/***** Store preference in database *****/
|
|
|
|
|
if (Gbl.Usrs.Me.Logged)
|
|
|
|
|
DB_QueryUPDATE ("can not update your preference about cookies",
|
|
|
|
|
"UPDATE usr_data SET ThirdPartyCookies='%c'"
|
|
|
|
|
" WHERE UsrCod=%ld",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? 'Y' :
|
|
|
|
|
'N',
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
|
|
|
|
|
|
|
|
/***** Show forms again *****/
|
|
|
|
|
Set_EditSettings ();
|
|
|
|
|
}
|