diff --git a/css/swad15.224.3.css b/css/swad15.225.11.css
similarity index 99%
rename from css/swad15.224.3.css
rename to css/swad15.225.11.css
index a66713005..fa02e706c 100644
--- a/css/swad15.224.3.css
+++ b/css/swad15.225.11.css
@@ -1521,6 +1521,10 @@ a:hover img.CENTRE_PHOTO_SHOW
background-repeat:no-repeat;
}
+/************************** Listing of users *********************************/
+.USR_LIST_NUM {color:#A0A0A0; font-size:15pt; font-weight:bold;}
+.USR_LIST_NUM_N {color:#404040; font-size:15pt; font-weight:bold;}
+
/*****************************************************************************/
.WHITE_USR {color:#E0E0E0; font-size:15pt; font-weight:bold; white-space:nowrap;}
.GREY_USR {color:#E0E0E0; font-size:15pt; font-weight:bold; white-space:nowrap;}
diff --git a/swad_changelog.h b/swad_changelog.h
index 656edfcf8..89f693549 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -128,13 +128,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.225.10 (2016-06-15)"
-#define CSS_FILE "swad15.224.3.css"
+#define Log_PLATFORM_VERSION "SWAD 15.225.11 (2016-06-16)"
+#define CSS_FILE "swad15.225.11.css"
#define JS_FILE "swad15.216.js"
// 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
/*
+ Version 15.225.11:Jun 16, 2016 Listing possible duplicate users. (202667 lines)
Version 15.225.10:Jun 15, 2016 Listing possible duplicate users. (202626 lines)
Version 15.225.9: Jun 15, 2016 Code refactoring in list of students and teachers. (202636 lines)
Version 15.225.8: Jun 15, 2016 Code refactoring in list of students and teachers. (202779 lines)
diff --git a/swad_course.c b/swad_course.c
index e3ffd2412..941958d41 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -2946,8 +2946,10 @@ static long Crs_GetParamOtherCrsCod (void)
/************************** Write courses of a user **************************/
/*****************************************************************************/
-void Crs_GetAndWriteCrssOfAUsr (long UsrCod,Rol_Role_t Role)
+void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
{
+ extern const char *Txt_USER_in_COURSE;
+ extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Degree;
extern const char *Txt_Year_OF_A_DEGREE;
extern const char *Txt_Course;
@@ -2969,20 +2971,26 @@ void Crs_GetAndWriteCrssOfAUsr (long UsrCod,Rol_Role_t Role)
" AND courses.DegCod=degrees.DegCod"
" AND degrees.CtrCod=centres.CtrCod"
" ORDER BY degrees.FullName,courses.Year,courses.FullName",
- UsrCod,(unsigned) Role);
+ UsrDat->UsrCod,(unsigned) Role);
/***** List the courses (one row per course) *****/
if ((NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses of a user")))
{
/* Start frame and table */
fprintf (Gbl.F.Out,"
// For boolean type
#include "swad_degree.h"
+#include "swad_user.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
@@ -132,7 +133,7 @@ void Crs_PutParamCrsCod (long CrsCod);
void Crs_ReqSelectOneOfMyCourses (void);
-void Crs_GetAndWriteCrssOfAUsr (long UsrCod,Rol_Role_t Role);
+void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role);
unsigned Crs_ListCrssFound (const char *Query);
diff --git a/swad_text.c b/swad_text.c
index 63c6bd745..9805eab79 100644
--- a/swad_text.c
+++ b/swad_text.c
@@ -49268,6 +49268,27 @@ const char *Txt_User_ID =
"Nº de identif. do utilizador";
#endif
+const char *Txt_USER_in_COURSE = // Warning: it is very important to include %s in the following sentences
+#if L==1
+ "%s en:";
+#elif L==2
+ "%s im:";
+#elif L==3
+ "%s in:";
+#elif L==4
+ "%s en:";
+#elif L==5
+ "%s dans:";
+#elif L==6
+ "%s en:"; // Okoteve traducción
+#elif L==7
+ "%s in:";
+#elif L==8
+ "%s w:";
+#elif L==9
+ "%s em:";
+#endif
+
const char *Txt_User_not_found_or_you_do_not_have_permission_ =
#if L==1
"Usuari no trobat"
diff --git a/swad_user.c b/swad_user.c
index 5666cbb07..73fe7a602 100644
--- a/swad_user.c
+++ b/swad_user.c
@@ -128,6 +128,9 @@ static void Usr_SetUsrRoleAndPrefs (void);
static void Usr_InsertMyLastData (void);
static void Usr_WriteRowGstAllData (struct UsrData *UsrDat);
+static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames);
+static void Usr_WriteRowTchAllData (struct UsrData *UsrDat);
+static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat);
static void Usr_RestrictLengthUsrName (struct UsrData *UsrDat);
static void Usr_WriteMainUsrDataExceptUsrID (struct UsrData *UsrDat,
const char *BgColor,
@@ -2711,7 +2714,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
{
extern const char *Txt_Enrollment_confirmed;
extern const char *Txt_Enrollment_not_confirmed;
- const char *BgColor;
+ char BgColor[16];
char PhotoURL[PATH_MAX+1];
bool ShowPhoto;
bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr &&
@@ -2723,14 +2726,15 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
/***** Checkbox to select user *****/
// Two colors are used alternatively to better distinguish the rows
- BgColor = UsrIsTheMsgSender ? "LIGHT_GREEN" :
- Gbl.ColorRows[Gbl.RowEvenOdd];
+ if (UsrIsTheMsgSender)
+ strcpy (BgColor,"LIGHT_GREEN");
+ else
+ sprintf (BgColor,"COLOR%u",Gbl.RowEvenOdd);
+
if (PutCheckBoxToSelectUsr)
{
fprintf (Gbl.F.Out,"",BgColor);
-
Usr_PutCheckboxToSelectUser (UsrDat,UsrIsTheMsgSender);
-
fprintf (Gbl.F.Out," | ");
}
@@ -2755,17 +2759,17 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
/***** Write number of user in the list *****/
fprintf (Gbl.F.Out,""
- " %u "
+ "%u"
" | ",
- UsrDat->Accepted ? "DAT_SMALL_N" :
- "DAT_SMALL",
+ UsrDat->Accepted ? "USR_LIST_NUM_N" :
+ "USR_LIST_NUM",
BgColor,
NumUsr);
if (Gbl.Usrs.Listing.WithPhotos)
{
/***** Show user's photo *****/
- fprintf (Gbl.F.Out,"",BgColor);
+ fprintf (Gbl.F.Out," | ",BgColor);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
@@ -2791,8 +2795,6 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
/***** End row *****/
fprintf (Gbl.F.Out,"");
-
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
@@ -2888,15 +2890,13 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
/***** End row *****/
fprintf (Gbl.F.Out,"");
-
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
/************ Write a row of a table with the data of a student **************/
/*****************************************************************************/
-void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
+static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
{
char PhotoURL[PATH_MAX+1];
bool ShowPhoto;
@@ -3005,15 +3005,13 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
/***** End row *****/
fprintf (Gbl.F.Out,"");
-
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
/*** Write a row of a table with the data of a teacher or an administrator ***/
/*****************************************************************************/
-void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
+static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
{
char PhotoURL[PATH_MAX+1];
bool ShowPhoto;
@@ -3082,15 +3080,13 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
NULL,true,UsrDat->Accepted);
fprintf (Gbl.F.Out,"");
-
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
/********** Write a row of a table with the data of an administrator *********/
/*****************************************************************************/
-void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
+static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
{
char PhotoURL[PATH_MAX+1];
bool ShowPhoto;
@@ -3138,8 +3134,6 @@ void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
Deg_GetAndWriteInsCtrDegAdminBy (UsrDat->UsrCod,
Gbl.Usrs.Listing.WithPhotos ? Usr_NUM_MAIN_FIELDS_DATA_ADM :
Usr_NUM_MAIN_FIELDS_DATA_ADM-1);
-
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
@@ -5143,7 +5137,7 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr)
Usr_UsrDataConstructor (&UsrDat);
/***** List students' data *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstGsts.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstGsts.Lst[NumUsr].UsrCod;
@@ -5153,6 +5147,8 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr)
// ...so they have not accepted...
// ...inscription in any course
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,true);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -5226,7 +5222,7 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
Usr_UsrDataConstructor (&UsrDat);
/***** List students' data *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstStds.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstStds.Lst[NumUsr].UsrCod;
@@ -5234,6 +5230,8 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
{
UsrDat.Accepted = Gbl.Usrs.LstStds.Lst[NumUsr].Accepted;
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,PutCheckBoxToSelectUsr);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -5297,7 +5295,7 @@ static void Usr_ListMainDataTchs (bool PutCheckBoxToSelectUsr)
Usr_UsrDataConstructor (&UsrDat);
/***** List data of teachers *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstTchs.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstTchs.Lst[NumUsr].UsrCod;
@@ -5305,6 +5303,8 @@ static void Usr_ListMainDataTchs (bool PutCheckBoxToSelectUsr)
{
UsrDat.Accepted = Gbl.Usrs.LstTchs.Lst[NumUsr].Accepted;
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,PutCheckBoxToSelectUsr);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -5403,7 +5403,7 @@ void Usr_ListAllDataGsts (void)
Usr_UsrDataConstructor (&UsrDat);
/***** List guests' data *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstGsts.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstGsts.Lst[NumUsr].UsrCod;
@@ -5414,6 +5414,8 @@ void Usr_ListAllDataGsts (void)
// ...inscription in any course
NumUsr++;
Usr_WriteRowGstAllData (&UsrDat);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -5593,7 +5595,7 @@ void Usr_ListAllDataStds (void)
Usr_UsrDataConstructor (&UsrDat);
/***** List students' data *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstStds.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstStds.Lst[NumUsr].UsrCod;
@@ -5602,6 +5604,8 @@ void Usr_ListAllDataStds (void)
UsrDat.Accepted = Gbl.Usrs.LstStds.Lst[NumUsr].Accepted;
NumUsr++;
Usr_WriteRowStdAllData (&UsrDat,GroupNames);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -5668,7 +5672,7 @@ void Usr_ListUsrsForSelection (Rol_Role_t Role)
switch (Role)
{
case Rol_STUDENT:
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstStds.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstStds.Lst[NumUsr].UsrCod;
@@ -5676,11 +5680,13 @@ void Usr_ListUsrsForSelection (Rol_Role_t Role)
{
UsrDat.Accepted = Gbl.Usrs.LstStds.Lst[NumUsr].Accepted;
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,true);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
break;
case Rol_TEACHER:
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstTchs.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstTchs.Lst[NumUsr].UsrCod;
@@ -5688,6 +5694,8 @@ void Usr_ListUsrsForSelection (Rol_Role_t Role)
{
UsrDat.Accepted = Gbl.Usrs.LstTchs.Lst[NumUsr].Accepted;
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,true);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
break;
@@ -5779,7 +5787,7 @@ void Usr_ListAllDataTchs (void)
Usr_UsrDataConstructor (&UsrDat);
/***** List data of teachers *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstTchs.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstTchs.Lst[NumUsr].UsrCod;
@@ -5788,6 +5796,8 @@ void Usr_ListAllDataTchs (void)
UsrDat.Accepted = Gbl.Usrs.LstTchs.Lst[NumUsr].Accepted;
NumUsr++;
Usr_WriteRowTchAllData (&UsrDat);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -5859,7 +5869,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
Usr_UsrDataConstructor (&UsrDat);
/***** List data of users *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < NumUsrs;
NumUsr++)
{
@@ -5873,7 +5883,9 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
/* Write all the courses this user belongs to */
if (Role != Rol__GUEST_)
- Crs_GetAndWriteCrssOfAUsr (UsrDat.UsrCod,Role);
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Role);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -6001,7 +6013,7 @@ void Usr_ListDataAdms (void)
Usr_UsrDataConstructor (&UsrDat);
/***** List data of administrators *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstAdms.NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstAdms.Lst[NumUsr].UsrCod;
@@ -6009,6 +6021,8 @@ void Usr_ListDataAdms (void)
{
UsrDat.Accepted = Gbl.Usrs.LstAdms.Lst[NumUsr].Accepted;
Usr_WriteRowAdmData (++NumUsr,&UsrDat);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
}
@@ -7739,7 +7753,6 @@ void Usr_ListDuplicateUsrs (void)
unsigned NumUsr;
struct UsrData UsrDat;
unsigned NumInformants;
- Rol_Role_t Role;
/***** Start frame with list of possible duplicate users *****/
Lay_StartRoundFrame (NULL,Txt_Possibly_duplicate_users,NULL);
@@ -7778,7 +7791,7 @@ void Usr_ListDuplicateUsrs (void)
fprintf (Gbl.F.Out,"");
/***** List users *****/
- for (NumUsr = 0;
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < NumUsrs;
NumUsr++)
{
@@ -7806,10 +7819,10 @@ void Usr_ListDuplicateUsrs (void)
NumInformants);
/* Write all the courses this user belongs to */
- for (Role = Rol_STUDENT;
- Role <= Rol_TEACHER;
- Role++)
- Crs_GetAndWriteCrssOfAUsr (UsrDat.UsrCod,Role);
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TEACHER);
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STUDENT);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
else // User does not exists ==>
// remove user from table of possible duplicate users
diff --git a/swad_user.h b/swad_user.h
index 51584159d..aed609f71 100644
--- a/swad_user.h
+++ b/swad_user.h
@@ -281,8 +281,6 @@ void Usr_InsertMyLastCrsTabAndTime (void);
void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
bool PutCheckboxToSelectUsr);
-void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GrpNames);
-void Usr_WriteRowTchAllData (struct UsrData *UsrDat);
unsigned Usr_GetNumUsrsInCrs (Rol_Role_t Role,long CrsCod);
unsigned Usr_GetNumUsrsInCrssOfDeg (Rol_Role_t Role,long DegCod);
|