Version 15.225.10

This commit is contained in:
Antonio Cañas Vargas 2016-06-15 20:35:49 +02:00
parent c3a525f930
commit bca5387cfe
4 changed files with 61 additions and 67 deletions

View File

@ -128,13 +128,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.225.9 (2016-06-15)" #define Log_PLATFORM_VERSION "SWAD 15.225.10 (2016-06-15)"
#define CSS_FILE "swad15.224.3.css" #define CSS_FILE "swad15.224.3.css"
#define JS_FILE "swad15.216.js" #define JS_FILE "swad15.216.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 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.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) Version 15.225.8: Jun 15, 2016 Code refactoring in list of students and teachers. (202779 lines)
Version 15.225.7: Jun 15, 2016 Listing possible duplicate users. (202775 lines) Version 15.225.7: Jun 15, 2016 Listing possible duplicate users. (202775 lines)

View File

@ -2974,6 +2974,13 @@ void Crs_GetAndWriteCrssOfAUsr (long UsrCod,Rol_Role_t Role)
/***** List the courses (one row per course) *****/ /***** List the courses (one row per course) *****/
if ((NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses of a user"))) if ((NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses of a user")))
{ {
/* Start frame and table */
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\"></td>"
"<td colspan=\"%u\">",
Usr_NUM_MAIN_FIELDS_DATA_USR-2);
Lay_StartRoundFrameTable (NULL,2,NULL);
/* Heading row */ /* Heading row */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<th class=\"BM\"></th>" "<th class=\"BM\"></th>"
@ -3011,6 +3018,11 @@ void Crs_GetAndWriteCrssOfAUsr (long UsrCod,Rol_Role_t Role)
/* Write data of this course */ /* Write data of this course */
Crs_WriteRowCrsData (NumCrs,row,true); Crs_WriteRowCrsData (NumCrs,row,true);
} }
/* End table and frame */
Lay_EndRoundFrameTable ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/

View File

@ -83,7 +83,6 @@ const char *Usr_IconsClassPhotoOrList[Usr_NUM_USR_LIST_TYPES] =
"list64x64.gif" "list64x64.gif"
}; };
#define Usr_NUM_MAIN_FIELDS_DATA_USR 9
#define Usr_NUM_MAIN_FIELDS_DATA_ADM 8 #define Usr_NUM_MAIN_FIELDS_DATA_ADM 8
#define Usr_NUM_ALL_FIELDS_DATA_INV 17 #define Usr_NUM_ALL_FIELDS_DATA_INV 17
#define Usr_NUM_ALL_FIELDS_DATA_STD 13 #define Usr_NUM_ALL_FIELDS_DATA_STD 13
@ -5874,17 +5873,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
/* Write all the courses this user belongs to */ /* Write all the courses this user belongs to */
if (Role != Rol__GUEST_) if (Role != Rol__GUEST_)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\"></td>"
"<td colspan=\"%u\">",
Usr_NUM_MAIN_FIELDS_DATA_USR-2);
Lay_StartRoundFrameTable (NULL,2,NULL);
Crs_GetAndWriteCrssOfAUsr (UsrDat.UsrCod,Role); Crs_GetAndWriteCrssOfAUsr (UsrDat.UsrCod,Role);
Lay_EndRoundFrameTable ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
} }
} }
@ -7741,17 +7730,16 @@ void Usr_ListDuplicateUsrs (void)
extern const char *Txt_Possibly_duplicate_users; extern const char *Txt_Possibly_duplicate_users;
extern const char *Txt_User[Usr_NUM_SEXS]; extern const char *Txt_User[Usr_NUM_SEXS];
extern const char *Txt_Informants; extern const char *Txt_Informants;
extern const char *Txt_Date;
extern const char *Txt_No_users_found[Rol_NUM_ROLES]; extern const char *Txt_No_users_found[Rol_NUM_ROLES];
char Query[1024]; char Query[1024];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCol;
unsigned NumUsrs; unsigned NumUsrs;
unsigned NumUsr; unsigned NumUsr;
struct UsrData UsrDat; struct UsrData UsrDat;
unsigned NumInformers; unsigned NumInformants;
bool ShowPhoto = false; Rol_Role_t Role;
char PhotoURL[PATH_MAX+1];
/***** Start frame with list of possible duplicate users *****/ /***** Start frame with list of possible duplicate users *****/
Lay_StartRoundFrame (NULL,Txt_Possibly_duplicate_users,NULL); Lay_StartRoundFrame (NULL,Txt_Possibly_duplicate_users,NULL);
@ -7765,29 +7753,31 @@ void Usr_ListDuplicateUsrs (void)
/***** List possible duplicated users *****/ /***** List possible duplicated users *****/
if (NumUsrs) if (NumUsrs)
{ {
/* Initialize structure with user's data */ /***** Initialize field names *****/
Usr_SetUsrDatMainFieldNames ();
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);
/* Start table */ /***** Start table *****/
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\"" fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\">");
" style=\"margin:0 auto;\">"
"<th></th>"
"<th colspan=\"2\" class=\"LEFT_TOP\">"
"%s"
"</th>"
"<th class=\"RIGHT_TOP\">"
"%s"
"</th>"
"<th class=\"CENTER_TOP\">"
"%s"
"</th>"
"</tr>",
Txt_User[Usr_SEX_UNKNOWN],
Txt_Informants,
Txt_Date);
/* List users */ /***** Heading row with column names *****/
/* Start row */
fprintf (Gbl.F.Out,"<tr>");
for (NumCol = 0;
NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR;
NumCol++)
fprintf (Gbl.F.Out,"<th class=\"LEFT_MIDDLE LIGHT_BLUE\">"
"%s&nbsp;"
"</th>",
Usr_UsrDatMainFieldNames[NumCol]);
/* End row */
fprintf (Gbl.F.Out,"</tr>");
/***** List users *****/
for (NumUsr = 0; for (NumUsr = 0;
NumUsr < NumUsrs; NumUsr < NumUsrs;
NumUsr++) NumUsr++)
@ -7798,49 +7788,38 @@ void Usr_ListDuplicateUsrs (void)
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
{ {
/***** Number *****/ UsrDat.Accepted = false; // TODO: Get this from database
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT RIGHT_TOP\">"
"%u"
"</td>",
NumUsrs - NumUsr);
/***** User photo *****/ /* Write data of this user */
fprintf (Gbl.F.Out,"<td class=\"DAT CENTER_TOP\"" Usr_WriteRowUsrMainData (NumUsrs - NumUsr,&UsrDat,false);
" style=\"width:22px;\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
fprintf (Gbl.F.Out,"</td>");
/***** User name *****/ /* Write number of informants (row[1]) if greater than 1 */
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\">"); if (sscanf (row[1],"%u",&NumInformants) != 1)
Usr_RestrictLengthAndWriteName (&UsrDat,20);
fprintf (Gbl.F.Out,"</td>");
/***** Number of informers (row[1]) *****/
if (sscanf (row[1],"%u",&NumInformers) != 1)
Lay_ShowErrorAndExit ("Wrong number of informers."); Lay_ShowErrorAndExit ("Wrong number of informers.");
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_TOP\">" if (NumInformants > 1)
"%u" fprintf (Gbl.F.Out,"<tr>"
"</td>", "<td colspan=\"2\"></td>"
NumInformers); "<td colspan=\"%u\" class=\"DAT\">%s: %u</td>"
"</tr>",
Usr_NUM_MAIN_FIELDS_DATA_USR-2,
Txt_Informants,
NumInformants);
/***** Inform time (row[2]) *****/ /* Write all the courses this user belongs to */
Msg_WriteMsgDate (Dat_GetUNIXTimeFromStr (row[2]),"DAT"); for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
fprintf (Gbl.F.Out,"</tr>"); Role++)
Crs_GetAndWriteCrssOfAUsr (UsrDat.UsrCod,Role);
} }
else // User does not exists ==> else // User does not exists ==>
// remove user from table of possible duplicate users // remove user from table of possible duplicate users
Usr_RemoveUsrFromDuplicated (UsrDat.UsrCod); Usr_RemoveUsrFromDuplicated (UsrDat.UsrCod);
} }
/* End table */ /***** End table *****/
fprintf (Gbl.F.Out,"</table>"); fprintf (Gbl.F.Out,"</table>");
/* Free memory used for user's data */ /***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&UsrDat); Usr_UsrDataDestructor (&UsrDat);
} }
else // There are no users else // There are no users

View File

@ -73,6 +73,8 @@
#define Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS (Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64*Cfg_MAX_USRS_IN_LIST) #define Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS (Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64*Cfg_MAX_USRS_IN_LIST)
#define Usr_NUM_MAIN_FIELDS_DATA_USR 9
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/