mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-09 18:25:23 +02:00
Version 16.100.1
This commit is contained in:
parent
d9562dc2ab
commit
4de0ee76b1
|
@ -187,13 +187,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.100 (2016-12-13)"
|
#define Log_PLATFORM_VERSION "SWAD 16.100.1 (2016-12-13)"
|
||||||
#define CSS_FILE "swad16.97.css"
|
#define CSS_FILE "swad16.97.css"
|
||||||
#define JS_FILE "swad16.99.js"
|
#define JS_FILE "swad16.99.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.100.1: Dec 13, 2016 Fixed bugs checking if users share courses. (210828 lines)
|
||||||
Version 16.100: Dec 13, 2016 Changes in layout of list of attendance events.
|
Version 16.100: Dec 13, 2016 Changes in layout of list of attendance events.
|
||||||
Code refactoring related with roles. (210820 lines)
|
Code refactoring related with roles. (210820 lines)
|
||||||
Version 16.99.1: Dec 13, 2016 Changes in translation of start and end.
|
Version 16.99.1: Dec 13, 2016 Changes in translation of start and end.
|
||||||
|
|
17
swad_user.c
17
swad_user.c
|
@ -1016,6 +1016,10 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 7. Slow check: Get if user shares any course with me from database *****/
|
/***** 7. Slow check: Get if user shares any course with me from database *****/
|
||||||
|
/* Fill the list with the courses I belong to (if not already filled) */
|
||||||
|
Usr_GetMyCourses ();
|
||||||
|
|
||||||
|
/* Check if user shares any course with me */
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
sprintf (Query,"SELECT COUNT(*) FROM crs_usr"
|
||||||
" WHERE UsrCod='%ld'"
|
" WHERE UsrCod='%ld'"
|
||||||
" AND CrsCod IN (SELECT CrsCod FROM my_courses_tmp)",
|
" AND CrsCod IN (SELECT CrsCod FROM my_courses_tmp)",
|
||||||
|
@ -1038,12 +1042,17 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
||||||
if (!Gbl.Usrs.Me.Logged)
|
if (!Gbl.Usrs.Me.Logged)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** Remove temporary table if exists *****/
|
/***** 2. Slow check: Get if user shares any course with me
|
||||||
|
with a different role, from database *****/
|
||||||
|
/* Fill the list with the courses I belong to (if not already filled) */
|
||||||
|
Usr_GetMyCourses ();
|
||||||
|
|
||||||
|
/* Remove temporary table if exists */
|
||||||
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
DB_ExitOnMySQLError ("can not remove temporary tables");
|
DB_ExitOnMySQLError ("can not remove temporary tables");
|
||||||
|
|
||||||
/***** Create temporary table with all user's courses for a role *****/
|
/* Create temporary table with all user's courses for a role */
|
||||||
sprintf (Query,"CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp "
|
sprintf (Query,"CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp "
|
||||||
"(CrsCod INT NOT NULL,Role TINYINT NOT NULL,"
|
"(CrsCod INT NOT NULL,Role TINYINT NOT NULL,"
|
||||||
"UNIQUE INDEX(CrsCod,Role)) ENGINE=MEMORY"
|
"UNIQUE INDEX(CrsCod,Role)) ENGINE=MEMORY"
|
||||||
|
@ -1052,13 +1061,13 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
DB_ExitOnMySQLError ("can not create temporary table");
|
DB_ExitOnMySQLError ("can not create temporary table");
|
||||||
|
|
||||||
/***** Get if a user shares any course with me from database *****/
|
/* Get if a user shares any course with me from database */
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM my_courses_tmp,usr_courses_tmp"
|
sprintf (Query,"SELECT COUNT(*) FROM my_courses_tmp,usr_courses_tmp"
|
||||||
" WHERE my_courses_tmp.CrsCod=usr_courses_tmp.CrsCod"
|
" WHERE my_courses_tmp.CrsCod=usr_courses_tmp.CrsCod"
|
||||||
" AND my_courses_tmp.Role<>usr_courses_tmp.Role");
|
" AND my_courses_tmp.Role<>usr_courses_tmp.Role");
|
||||||
UsrSharesAnyOfMyCrsWithDifferentRole = (DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0);
|
UsrSharesAnyOfMyCrsWithDifferentRole = (DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0);
|
||||||
|
|
||||||
/***** Remove temporary table if exists *****/
|
/* Remove temporary table if exists */
|
||||||
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
DB_ExitOnMySQLError ("can not remove temporary tables");
|
DB_ExitOnMySQLError ("can not remove temporary tables");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user