Version 20.80: May 20, 2021 New module swad_cookie_database for database queries related to cookies.

This commit is contained in:
acanas 2021-05-21 00:00:54 +02:00
parent 35c427b08f
commit 34fb16932c
5 changed files with 139 additions and 33 deletions

View File

@ -34,9 +34,9 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_agenda.o \
swad_button.o \
swad_calendar.o swad_call_for_exam.o swad_center.o \
swad_center_config.o swad_chat.o swad_chat_database.o swad_config.o \
swad_connected.o swad_connected_database.o swad_cookie.o swad_country.o \
swad_country_config.o swad_course.o swad_course_config.o \
swad_cryptography.o \
swad_connected.o swad_connected_database.o swad_cookie.o \
swad_cookie_database.o swad_country.o swad_country_config.o \
swad_course.o swad_course_config.o swad_cryptography.o \
swad_database.o swad_date.o swad_degree.o swad_degree_config.o \
swad_degree_type.o swad_department.o swad_duplicate.o \
swad_enrolment.o swad_error.o swad_exam.o swad_exam_log.o \

View File

@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
*/
#define Log_PLATFORM_VERSION "SWAD 20.79 (2021-05-20)"
#define Log_PLATFORM_VERSION "SWAD 20.80 (2021-05-20)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.69.1.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.80: May 20, 2021 New module swad_cookie_database for database queries related to cookies. (? lines)
Version 20.79: May 20, 2021 New module swad_connected_database for database queries related to connected users. (311415 lines)
Version 20.78.2: May 20, 2021 Code formatting in games and matches. (311326 lines)
Version 20.78.1: May 20, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (311317 lines)

View File

@ -27,6 +27,7 @@
#include "swad_box.h"
#include "swad_cookie.h"
#include "swad_cookie_database.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
@ -68,32 +69,36 @@ void Coo_EditMyPrefsOnCookies (void)
/***** Begin section with preferences about cookies *****/
HTM_SECTION_Begin (Coo_COOKIES_ID);
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_Cookies,
Coo_PutIconsCookies,NULL,
Hlp_PROFILE_Settings_cookies,Box_NOT_CLOSABLE,2);
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_Cookies,
Coo_PutIconsCookies,NULL,
Hlp_PROFILE_Settings_cookies,Box_NOT_CLOSABLE,2);
/***** Edit my preference about cookies *****/
/* Begin form */
Frm_StartFormAnchor (ActChgCooPrf,Coo_COOKIES_ID);
/***** Edit my preference about cookies *****/
/* Begin form */
Frm_StartFormAnchor (ActChgCooPrf,Coo_COOKIES_ID);
/* Begin container */
HTM_DIV_Begin ("class=\"%s\"",
(Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) ? "DAT_N LIGHT_BLUE" :
"DAT");
/* Check box */
HTM_LABEL_Begin (NULL);
HTM_INPUT_CHECKBOX ("cookies",HTM_SUBMIT_ON_CHANGE,
"value=\"Y\"%s",
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? " checked=\"checked\"" : "");
HTM_Txt (Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
HTM_LABEL_End ();
/* Begin container */
HTM_DIV_Begin ("class=\"%s\"",
(Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) ? "DAT_N LIGHT_BLUE" :
"DAT");
/* Check box */
HTM_LABEL_Begin (NULL);
HTM_INPUT_CHECKBOX ("cookies",HTM_SUBMIT_ON_CHANGE,
"value=\"Y\"%s",
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? " checked=\"checked\"" :
"");
HTM_Txt (Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
HTM_LABEL_End ();
/* End container */
HTM_DIV_End ();
/* End container */
HTM_DIV_End ();
/***** End table and box *****/
Box_BoxTableEnd ();
/* End form */
Frm_EndForm ();
/***** End table and box *****/
Box_BoxTableEnd ();
/***** End section with preferences about cookies *****/
HTM_SECTION_End ();
@ -120,13 +125,7 @@ void Coo_ChangeMyPrefsCookies (void)
/***** 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);
Coo_DB_UpdateMyPrefsCookies ();
/***** Show forms again *****/
Set_EditSettings ();

66
swad_cookie_database.c Normal file
View File

@ -0,0 +1,66 @@
// swad_cookie_database.c: user's preferences about cookies (operations with database)
// 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.
Copyright (C) 1999-2021 Antonio Cañas Vargas
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_cookie.h"
#include "swad_cookie_database.h"
#include "swad_database.h"
#include "swad_global.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
/*****************************************************************************/
/************** Update my settings about third party cookies *****************/
/*****************************************************************************/
void Coo_DB_UpdateMyPrefsCookies (void)
{
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);
}

40
swad_cookie_database.h Normal file
View File

@ -0,0 +1,40 @@
// swad_cookie_database.h: user's preferences about cookies (operations with database)
#ifndef _SWAD_COO_DB
#define _SWAD_COO_DB
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2021 Antonio Cañas Vargas
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 ***********************************/
/*****************************************************************************/
/*****************************************************************************/
/************************* Public types and constants ************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Coo_DB_UpdateMyPrefsCookies (void);
#endif