Version 15.245.2

This commit is contained in:
Antonio Cañas Vargas 2016-07-25 20:55:25 +02:00
parent ad4c485b2e
commit df895b04fd
3 changed files with 42 additions and 27 deletions

View File

@ -136,16 +136,17 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.245 (2016-07-24)"
#define Log_PLATFORM_VERSION "SWAD 15.245.2 (2016-07-24)"
#define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.238.1.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.245.2: Jul 25, 2016 Listing of students/teachers uses the list filled instead of querying database a second time to get all user's data. (204088 lines)
Version 15.245.1: Jul 25, 2016 Code refactoring in building of queries to get/search users. (204081 lines)
Version 15.245: Jul 25, 2016 List of users is filled with user's name and user's institution.
Search of users uses the list filled instead of query database a second time to get all user's data. (204192 lines)
Search of users uses the list filled instead of querying database a second time to get all user's data. (204192 lines)
Version 15.244: Jul 25, 2016 Removed e-mail column from some lists of users (usually it's not necessary). (203969 lines)
Version 15.243.2: Jul 24, 2016 Guests now have permission to write messages. (203963 lines)
Version 15.243.1: Jul 21, 2016 Fixed bugs in web service. (203962 lines)

View File

@ -3574,7 +3574,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role,char *Query)
"usr_data.Sex,"
"usr_data.Photo,"
"usr_data.PhotoVisibility,"
"usr_data.InsCod"
"usr_data.InsCod,"
"crs_usr.Accepted";
/*
row[0]: usr_data.UsrCod
@ -4544,6 +4544,24 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop
Lay_ShowErrorAndExit (NULL);
}
/*****************************************************************************/
/********************** Copy user's basic data from list *********************/
/*****************************************************************************/
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList *UsrInList)
{
UsrDat->UsrCod = UsrInList->UsrCod;
strcpy (UsrDat->EncryptedUsrCod,UsrInList->EncryptedUsrCod);
strcpy (UsrDat->Surname1 ,UsrInList->Surname1);
strcpy (UsrDat->Surname2 ,UsrInList->Surname2);
strcpy (UsrDat->FirstName ,UsrInList->FirstName);
UsrDat->Sex = UsrInList->Sex;
strcpy (UsrDat->Photo ,UsrInList->Photo);
UsrDat->PhotoVisibility = UsrInList->PhotoVisibility;
UsrDat->InsCod = UsrInList->InsCod;
UsrDat->Accepted = UsrInList->Accepted;
}
/*****************************************************************************/
/********************** Allocate space for list of users *********************/
/*****************************************************************************/
@ -5437,14 +5455,15 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
{
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].Accepted;
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,PutCheckBoxToSelectUsr);
/* Copy user's basic data from list */
Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr]);
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/* Get list of user's IDs */
ID_GetListIDsFromUsrCod (&UsrDat);
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,PutCheckBoxToSelectUsr);
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/***** Free memory used for user's data *****/
@ -5510,14 +5529,15 @@ static void Usr_ListMainDataTchs (bool PutCheckBoxToSelectUsr)
for (NumUsr = 0, Gbl.RowEvenOdd = 0;
NumUsr < Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs; )
{
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_TEACHER].Lst[NumUsr].UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
{
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_TEACHER].Lst[NumUsr].Accepted;
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,PutCheckBoxToSelectUsr);
/* Copy user's basic data from list */
Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_TEACHER].Lst[NumUsr]);
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/* Get list of user's IDs */
ID_GetListIDsFromUsrCod (&UsrDat);
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,PutCheckBoxToSelectUsr);
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/***** Free memory used for user's data *****/
@ -6041,16 +6061,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *SearchQuery)
UsrInList = &Gbl.Usrs.LstUsrs[Role].Lst[NumUsr];
/* Copy user's basic data from list */
UsrDat.UsrCod = UsrInList->UsrCod;
strcpy (UsrDat.EncryptedUsrCod,UsrInList->EncryptedUsrCod);
strcpy (UsrDat.Surname1 ,UsrInList->Surname1);
strcpy (UsrDat.Surname2 ,UsrInList->Surname2);
strcpy (UsrDat.FirstName ,UsrInList->FirstName);
UsrDat.Sex = UsrInList->Sex;
strcpy (UsrDat.Photo ,UsrInList->Photo);
UsrDat.PhotoVisibility = UsrInList->PhotoVisibility;
UsrDat.InsCod = UsrInList->InsCod;
UsrDat.Accepted = UsrInList->Accepted;
Usr_CopyBasicUsrDataFromList (&UsrDat,UsrInList);
/* Get list of user's IDs */
ID_GetListIDsFromUsrCod (&UsrDat);

View File

@ -317,7 +317,10 @@ void Usr_CreateTmpTableAndSearchCandidateUsrs (const char *UsrQuery);
void Usr_DropTmpTableWithCandidateUsrs (void);
void Usr_GetUnorderedStdsCodesInDeg (long DegCod);
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList *UsrInList);
void Usr_FreeUsrsList (Rol_Role_t Role);
bool Usr_GetIfShowBigList (unsigned NumUsrs,const char *OnSubmit);
void Usr_PutHiddenParUsrCodAll (Act_Action_t NextAction,const char *ListUsrCods);
void Usr_GetListsSelectedUsrsCods (void);