mirror of https://github.com/acanas/swad-core.git
Version 17.3.8
This commit is contained in:
parent
51f95f5b41
commit
99890d6351
|
@ -930,12 +930,13 @@ CREATE TABLE IF NOT EXISTS plugins (
|
||||||
IP CHAR(15) NOT NULL,
|
IP CHAR(15) NOT NULL,
|
||||||
UNIQUE INDEX(PlgCod));
|
UNIQUE INDEX(PlgCod));
|
||||||
--
|
--
|
||||||
-- Table Prj_grp: stores the groups associated to projects
|
-- Table prj_usr: stores the users inside projects
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS prj_grp (
|
CREATE TABLE IF NOT EXISTS prj_usr (
|
||||||
PrjCod INT NOT NULL,
|
PrjCod INT NOT NULL,
|
||||||
GrpCod INT NOT NULL,
|
RoleInProject TINYINT NOT NULL DEFAULT 0,
|
||||||
UNIQUE INDEX(PrjCod,GrpCod));
|
UsrCod INT NOT NULL,
|
||||||
|
UNIQUE INDEX(PrjCod,RoleInProject,UsrCod));
|
||||||
--
|
--
|
||||||
-- Table projects: stores the projects proposed by the teachers to their students
|
-- Table projects: stores the projects proposed by the teachers to their students
|
||||||
--
|
--
|
||||||
|
|
|
@ -252,13 +252,17 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 17.3.7 (2017-09-19)"
|
#define Log_PLATFORM_VERSION "SWAD 17.3.8 (2017-09-19)"
|
||||||
#define CSS_FILE "swad17.0.css"
|
#define CSS_FILE "swad17.0.css"
|
||||||
#define JS_FILE "swad16.206.3.js"
|
#define JS_FILE "swad16.206.3.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 17.3.8: Sep 19, 2017 Table for users in projects. (230000 lines)
|
||||||
|
DROP TABLE IF EXISTS prj_grp;
|
||||||
|
CREATE TABLE IF NOT EXISTS prj_usr (PrjCod INT NOT NULL,RoleInProject TINYINT NOT NULL DEFAULT 0,UsrCod INT NOT NULL,UNIQUE INDEX(PrjCod,RoleInProject,UsrCod));
|
||||||
|
|
||||||
Version 17.3.7: Sep 19, 2017 New row in listing of projects for tutors. Not finished. (229983 lines)
|
Version 17.3.7: Sep 19, 2017 New row in listing of projects for tutors. Not finished. (229983 lines)
|
||||||
Version 17.3.6: Sep 19, 2017 Changes in listing of projects. (229849 lines)
|
Version 17.3.6: Sep 19, 2017 Changes in listing of projects. (229849 lines)
|
||||||
Version 17.3.5: Sep 19, 2017 Removed groups in projects. (229858 lines)
|
Version 17.3.5: Sep 19, 2017 Removed groups in projects. (229858 lines)
|
||||||
|
|
|
@ -1987,19 +1987,21 @@ mysql> DESCRIBE plugins;
|
||||||
|
|
||||||
/***** Table prj_grp *****/
|
/***** Table prj_grp *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE prj_grp;
|
mysql> DESCRIBE prj_usr;
|
||||||
+--------+---------+------+-----+---------+-------+
|
+---------------+------------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+---------+------+-----+---------+-------+
|
+---------------+------------+------+-----+---------+-------+
|
||||||
| PrjCod | int(11) | NO | PRI | NULL | |
|
| PrjCod | int(11) | NO | PRI | NULL | |
|
||||||
| GrpCod | int(11) | NO | PRI | NULL | |
|
| RoleInProject | tinyint(4) | NO | PRI | 0 | |
|
||||||
+--------+---------+------+-----+---------+-------+
|
| UsrCod | int(11) | NO | PRI | NULL | |
|
||||||
2 rows in set (0,00 sec)
|
+---------------+------------+------+-----+---------+-------+
|
||||||
|
3 rows in set (0,00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS prj_grp ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS prj_usr ("
|
||||||
"PrjCod INT NOT NULL,"
|
"PrjCod INT NOT NULL,"
|
||||||
"GrpCod INT NOT NULL,"
|
"RoleInProject TINYINT NOT NULL DEFAULT 0,"
|
||||||
"UNIQUE INDEX(PrjCod,GrpCod))");
|
"UsrCod INT NOT NULL,"
|
||||||
|
"UNIQUE INDEX(PrjCod,RoleInProject,UsrCod))");
|
||||||
|
|
||||||
/***** Table projects *****/
|
/***** Table projects *****/
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -48,12 +48,21 @@
|
||||||
extern struct Globals Gbl;
|
extern struct Globals Gbl;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Private constants *****************************/
|
/************************* Public constants and types ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
// Related with user's roles in a project
|
||||||
|
/*
|
||||||
|
Don't change these numbers! They are used in database
|
||||||
|
*/
|
||||||
|
|
||||||
/*****************************************************************************/
|
#define Prj_NUM_ROLES_IN_PROJECT 4
|
||||||
/******************************* Private types *******************************/
|
typedef enum
|
||||||
/*****************************************************************************/
|
{
|
||||||
|
Prj_ROLE_UNK = 0, // Unknown
|
||||||
|
Prj_ROLE_STD = 1, // Student
|
||||||
|
Prj_ROLE_TUT = 2, // Tutor
|
||||||
|
Prj_ROLE_REV = 3, // Reviewer
|
||||||
|
} Prj_RoleInProject_t;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Private variables *****************************/
|
/***************************** Private variables *****************************/
|
||||||
|
@ -70,7 +79,7 @@ static void Prj_PutIconsListProjects (void);
|
||||||
static void Prj_PutIconToCreateNewPrj (void);
|
static void Prj_PutIconToCreateNewPrj (void);
|
||||||
static void Prj_PutButtonToCreateNewPrj (void);
|
static void Prj_PutButtonToCreateNewPrj (void);
|
||||||
static void Prj_ShowOneProject (struct Project *Prj,bool PrintView);
|
static void Prj_ShowOneProject (struct Project *Prj,bool PrintView);
|
||||||
static void Prj_WriteUsrs (long PrjCod);
|
static void Prj_WriteUsrs (long PrjCod,Prj_RoleInProject_t RoleInProject);
|
||||||
static void Prj_WritePrjAuthor (struct Project *Prj);
|
static void Prj_WritePrjAuthor (struct Project *Prj);
|
||||||
static void Prj_GetParamPrjOrder (void);
|
static void Prj_GetParamPrjOrder (void);
|
||||||
|
|
||||||
|
@ -514,7 +523,7 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView)
|
||||||
"DAT",
|
"DAT",
|
||||||
Prj->Materials);
|
Prj->Materials);
|
||||||
|
|
||||||
/* Project tutors */
|
/* Project tutors */
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"2\" class=\"RIGHT_TOP");
|
"<td colspan=\"2\" class=\"RIGHT_TOP");
|
||||||
if (!PrintView)
|
if (!PrintView)
|
||||||
|
@ -531,7 +540,7 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView)
|
||||||
fprintf (Gbl.F.Out," %s\">",
|
fprintf (Gbl.F.Out," %s\">",
|
||||||
Prj->Hidden ? "DAT_LIGHT" :
|
Prj->Hidden ? "DAT_LIGHT" :
|
||||||
"DAT");
|
"DAT");
|
||||||
Prj_WriteUsrs (Prj->PrjCod);
|
Prj_WriteUsrs (Prj->PrjCod,Prj_ROLE_TUT);
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
|
@ -539,10 +548,10 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Write list of recipients of a message ******************/
|
/*************** Write list of users with a role in a project ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Prj_WriteUsrs (long PrjCod)
|
static void Prj_WriteUsrs (long PrjCod,Prj_RoleInProject_t RoleInProject)
|
||||||
{
|
{
|
||||||
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
|
@ -559,22 +568,24 @@ static void Prj_WriteUsrs (long PrjCod)
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
char PhotoURL[PATH_MAX + 1];
|
char PhotoURL[PATH_MAX + 1];
|
||||||
|
|
||||||
/***** Get number of users of a project from database *****/
|
/***** Get number of users in project from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM prj_usr WHERE PrjCod=%ld",
|
sprintf (Query,"SELECT COUNT(*) FROM prj_usr"
|
||||||
PrjCod);
|
" WHERE PrjCod=%ld AND RoleInProject=%u",
|
||||||
NumUsrs = (unsigned) DB_QueryCOUNT (Query,"can not get number of recipients");
|
PrjCod,(unsigned) RoleInProject);
|
||||||
|
NumUsrs = (unsigned) DB_QueryCOUNT (Query,"can not get users in project");
|
||||||
|
|
||||||
/***** Get users of a project from database *****/
|
/***** Get users in project from database *****/
|
||||||
sprintf (Query,"SELECT prj_usr.UsrCod,"
|
sprintf (Query,"SELECT prj_usr.UsrCod,"
|
||||||
"usr_data.Surname1 AS S1,"
|
"usr_data.Surname1 AS S1,"
|
||||||
"usr_data.Surname2 AS S2,"
|
"usr_data.Surname2 AS S2,"
|
||||||
"usr_data.FirstName AS FN"
|
"usr_data.FirstName AS FN"
|
||||||
" FROM prj_usr,usr_data"
|
" FROM prj_usr,usr_data"
|
||||||
" WHERE prj_usr.PrjCod=%ld"
|
" WHERE prj_usr.PrjCod=%ld AND RoleInProject=%u"
|
||||||
" AND prj_usr.UsrCod=usr_data.UsrCod"
|
" AND prj_usr.UsrCod=usr_data.UsrCod"
|
||||||
" ORDER BY S1,S2,FN",
|
" ORDER BY S1,S2,FN",
|
||||||
PrjCod);
|
PrjCod,(unsigned) RoleInProject);
|
||||||
NumUsrsKnown = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users of a project");
|
NumUsrsKnown = (unsigned) DB_QuerySELECT (Query,&mysql_res,
|
||||||
|
"can not get users in project");
|
||||||
|
|
||||||
/***** Check number of users *****/
|
/***** Check number of users *****/
|
||||||
if (NumUsrs)
|
if (NumUsrs)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************** Public constant and types ************************/
|
/************************* Public constants and types ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
// Related with user's roles
|
// Related with user's roles
|
||||||
|
|
Loading…
Reference in New Issue