From 83f5e8d6586f08936468fab6dd9e98b73106af79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 16 Jun 2016 18:32:12 +0200 Subject: [PATCH] Version 15.225.14 --- swad_changelog.h | 5 +- swad_department.c | 8 ++-- swad_duplicate.c | 16 +------ swad_user.c | 115 +++++++++++++++------------------------------- swad_user.h | 1 + 5 files changed, 46 insertions(+), 99 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 6d87fe39..d733a7b2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -135,8 +135,9 @@ // 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.14:Jun 16, 2016 Button in possible duplicate user to show similar users. (? lines) - Version 15.225.13:Jun 16, 2016 Check if a user in listing of possible duplicate users has accepted all his/her courses. (? lines) + Version 15.225.15:Jun 16, 2016 Button in possible duplicate user to show similar users. (? lines) + Version 15.225.14:Jun 16, 2016 Code refactoring in listing of users. (202741 lines) + Version 15.225.13:Jun 16, 2016 Check if a user in listing of possible duplicate users has accepted all his/her courses. (202790 lines) Version 15.225.12:Jun 16, 2016 New module swad_duplicate for possible duplicate users. (202758 lines) 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) diff --git a/swad_department.c b/swad_department.c index 52db92e1..2bf32749 100644 --- a/swad_department.c +++ b/swad_department.c @@ -133,7 +133,7 @@ void Dpt_SeeDepts (void) "" "" "" - " %u " + "%u" "" "", Gbl.Dpts.Lst[NumDpt].WWW, @@ -159,7 +159,7 @@ void Dpt_SeeDepts (void) "%s" "" "" - " %u " + "%u" "" "", Txt_Other_departments,NumTchsInOtherDpts); @@ -171,7 +171,7 @@ void Dpt_SeeDepts (void) "%s" "" "" - " %u " + "%u" "" "", Txt_Department_unspecified, @@ -579,7 +579,7 @@ static void Dpt_ListDepartmentsForEdition (void) /* Number of teachers */ fprintf (Gbl.F.Out,"" - " %u " + "%u" "" "", Dpt->NumTchs); diff --git a/swad_duplicate.c b/swad_duplicate.c index 30708ba5..eb6ff059 100644 --- a/swad_duplicate.c +++ b/swad_duplicate.c @@ -120,14 +120,12 @@ void Dup_PutLinkToListDupUsrs (void) void Dup_ListDuplicateUsrs (void) { - extern const char *Usr_UsrDatMainFieldNames[Usr_NUM_MAIN_FIELDS_DATA_USR]; extern const char *Txt_Possibly_duplicate_users; extern const char *Txt_Informants; extern const char *Txt_No_users_found[Rol_NUM_ROLES]; char Query[1024]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned NumCol; unsigned NumUsrs; unsigned NumUsr; struct UsrData UsrDat; @@ -156,18 +154,8 @@ void Dup_ListDuplicateUsrs (void) fprintf (Gbl.F.Out,""); /***** Heading row with column names *****/ - /* Start row */ - fprintf (Gbl.F.Out,""); - for (NumCol = 0; - NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR; - NumCol++) - fprintf (Gbl.F.Out,"", - Usr_UsrDatMainFieldNames[NumCol]); - - /* End row */ - fprintf (Gbl.F.Out,""); + Gbl.Usrs.Listing.WithPhotos = true; + Usr_WriteHeaderFieldsUsrDat (false); // Columns for the data /***** List users *****/ for (NumUsr = 0, Gbl.RowEvenOdd = 0; diff --git a/swad_user.c b/swad_user.c index 7a11beb2..8449679a 100644 --- a/swad_user.c +++ b/swad_user.c @@ -3125,8 +3125,8 @@ static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat) fprintf (Gbl.F.Out,""); /***** Write number of user *****/ - fprintf (Gbl.F.Out,"", Gbl.RowEvenOdd,NumUsr); @@ -5124,13 +5124,40 @@ void Usr_SetUsrDatMainFieldNames (void) Usr_UsrDatMainFieldNames[8] = Txt_Institution; } +/*****************************************************************************/ +/************ Write header with main field names of user's data **************/ +/*****************************************************************************/ + +void Usr_WriteHeaderFieldsUsrDat (bool PutCheckBoxToSelectUsr) + { + unsigned NumCol; + + fprintf (Gbl.F.Out,""); + + /***** First column used for selection *****/ + if (PutCheckBoxToSelectUsr) + fprintf (Gbl.F.Out,""); + + /***** Columns for user's data fields *****/ + for (NumCol = 0; + NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR; + NumCol++) + if (NumCol != 2 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column + fprintf (Gbl.F.Out,"", + Usr_UsrDatMainFieldNames[NumCol]); + + fprintf (Gbl.F.Out,""); + } + /*****************************************************************************/ /************************** List guests' main data ***************************/ /*****************************************************************************/ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr) { - unsigned NumCol; unsigned NumUsr; struct UsrData UsrDat; @@ -5140,27 +5167,7 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr) if (Gbl.Usrs.LstGsts.NumUsrs) { /***** Heading row with column names *****/ - /* Start row */ - fprintf (Gbl.F.Out,""); - - /* First column used for selection */ - if (PutCheckBoxToSelectUsr) - fprintf (Gbl.F.Out,""); - - /* Columns for the data */ - for (NumCol = 0; - NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR; - NumCol++) - if (NumCol != 2 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column - fprintf (Gbl.F.Out,"", - Usr_UsrDatMainFieldNames[NumCol]); - - /* End row */ - fprintf (Gbl.F.Out,""); + Usr_WriteHeaderFieldsUsrDat (PutCheckBoxToSelectUsr); // Columns for the data /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); @@ -5197,7 +5204,6 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr) static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr) { - unsigned NumCol; unsigned NumUsr; char *GroupNames; struct UsrData UsrDat; @@ -5225,27 +5231,7 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr) } /***** Heading row with column names *****/ - /* Start row */ - fprintf (Gbl.F.Out,""); - - /* First column used for selection */ - if (PutCheckBoxToSelectUsr) - fprintf (Gbl.F.Out,""); - - /* Columns for the data */ - for (NumCol = 0; - NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR; - NumCol++) - if (NumCol != 2 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column - fprintf (Gbl.F.Out,"", - Usr_UsrDatMainFieldNames[NumCol]); - - /* End row */ - fprintf (Gbl.F.Out,""); + Usr_WriteHeaderFieldsUsrDat (PutCheckBoxToSelectUsr); // Columns for the data /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); @@ -5667,7 +5653,6 @@ void Usr_ListAllDataStds (void) void Usr_ListUsrsForSelection (Rol_Role_t Role) { - unsigned NumCol; unsigned NumUsr; struct UsrData UsrDat; @@ -5675,24 +5660,7 @@ void Usr_ListUsrsForSelection (Rol_Role_t Role) Usr_SetUsrDatMainFieldNames (); /***** Heading row with column names *****/ - /* Start row and first column used for selection */ - fprintf (Gbl.F.Out,"" - ""); - - /* Columns for the data */ - for (NumCol = 0; - NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR; - NumCol++) - if (NumCol != 2 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column - fprintf (Gbl.F.Out,"", - Usr_UsrDatMainFieldNames[NumCol]); - - /* End row */ - fprintf (Gbl.F.Out,""); + Usr_WriteHeaderFieldsUsrDat (true); // Columns for the data /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); @@ -5855,7 +5823,6 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery) extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; struct ListUsers *LstUsrs; Usr_Sex_t Sex; - unsigned NumCol; unsigned NumUsr; struct UsrData UsrDat; unsigned NumUsrs; @@ -5881,18 +5848,8 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery) Lay_StartRoundFrameTable (NULL,2,Gbl.Title); /***** Heading row with column names *****/ - /* Start row */ - fprintf (Gbl.F.Out,""); - for (NumCol = 0; - NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR; - NumCol++) - fprintf (Gbl.F.Out,"", - Usr_UsrDatMainFieldNames[NumCol]); - - /* End row */ - fprintf (Gbl.F.Out,""); + Gbl.Usrs.Listing.WithPhotos = true; + Usr_WriteHeaderFieldsUsrDat (false); // Columns for the data /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); @@ -6026,7 +5983,7 @@ void Usr_ListDataAdms (void) fprintf (Gbl.F.Out,""); /***** Heading row with column names *****/ - fprintf (Gbl.F.Out,"
" - "%s " - "
" - " %u " + fprintf (Gbl.F.Out,"" + "%u" "
" + "" + "%s " + "
" - " " - "" - "%s " - "
" - " " - "" - "%s " - "
" - " " - "" - "%s " - "
" - "%s " - "
" + fprintf (Gbl.F.Out,"
" ""); for (NumCol = 0; NumCol < Usr_NUM_MAIN_FIELDS_DATA_ADM; diff --git a/swad_user.h b/swad_user.h index 08529320..e062f337 100644 --- a/swad_user.h +++ b/swad_user.h @@ -320,6 +320,7 @@ void Usr_ShowFormsToSelectUsrListType (Act_Action_t NextAction); void Usr_PutCheckboxToSelectAllTheUsers (Rol_Role_t Role); unsigned Usr_GetColumnsForSelectUsrs (void); void Usr_SetUsrDatMainFieldNames (void); +void Usr_WriteHeaderFieldsUsrDat (bool PutCheckBoxToSelectUsr); void Usr_PutExtraParamsUsrList (Act_Action_t NextAction); void Usr_ListUsersToSelect (Rol_Role_t Role);