Version 15.246.2

This commit is contained in:
Antonio Cañas Vargas 2016-07-26 12:48:52 +02:00
parent 8bb17ae3ae
commit f518a0fb19
2 changed files with 31 additions and 35 deletions

View File

@ -136,13 +136,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.246.1 (2016-07-26)" #define Log_PLATFORM_VERSION "SWAD 15.246.2 (2016-07-26)"
#define CSS_FILE "swad15.229.css" #define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.238.1.js" #define JS_FILE "swad15.238.1.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.246.2: Jul 26, 2016 List of users in web service use the list filled instead of querying database a second time to get all user's data.
Code refactoring in copying of user's data in web service. (204089 lines)
Version 15.246.1: Jul 26, 2016 Attendance of users and e-mail to users use the list filled instead of querying database a second time to get all user's data. (204093 lines) Version 15.246.1: Jul 26, 2016 Attendance of users and e-mail to users use the list filled instead of querying database a second time to get all user's data. (204093 lines)
Version 15.246: Jul 26, 2016 Classphoto of users uses the list filled instead of querying database a second time to get all user's data. Version 15.246: Jul 26, 2016 Classphoto of users uses the list filled instead of querying database a second time to get all user's data.
Origin place is removed from classphoto. (204094 lines) Origin place is removed from classphoto. (204094 lines)

View File

@ -1605,21 +1605,21 @@ static void Svc_CopyListUsers (Rol_Role_t Role,struct swad__getUsersOutput *getU
NumUsr < NumUsrs; NumUsr < NumUsrs;
NumUsr++) NumUsr++)
{ {
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod; /* Copy user's basic data from list */
Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Role].Lst[NumUsr]);
/* Get user's data */ /* Get list of user's IDs */
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist... ID_GetListIDsFromUsrCod (&UsrDat);
{ if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat.UsrCod) // It's me
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted; ICanSeeUsrID = true;
else // A user distinct than me
ICanSeeUsrID = ID_ICanSeeAnotherUsrID (&UsrDat);
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat.UsrCod) // It's me /* Get nickname */
ICanSeeUsrID = true; Nck_GetNicknameFromUsrCod (UsrDat.UsrCod,UsrDat.Nickname);
else // A user distinct than me
ICanSeeUsrID = ID_ICanSeeAnotherUsrID (&UsrDat);
/* Copy user's data into output structure */ /* Copy user's data into output structure */
Svc_CopyUsrData (&(getUsersOut->usersArray.__ptr[NumUsr]),&UsrDat,ICanSeeUsrID); Svc_CopyUsrData (&(getUsersOut->usersArray.__ptr[NumUsr]),&UsrDat,ICanSeeUsrID);
}
} }
/***** Free memory used for user's data *****/ /***** Free memory used for user's data *****/
@ -2028,45 +2028,39 @@ int swad__sendMyGroups (struct soap *soap,
static void Svc_CopyUsrData (struct swad__user *Usr,struct UsrData *UsrDat,bool UsrIDIsVisible) static void Svc_CopyUsrData (struct swad__user *Usr,struct UsrData *UsrDat,bool UsrIDIsVisible)
{ {
char PhotoURL[PATH_MAX+1]; char PhotoURL[PATH_MAX+1];
const char *FirstID;
/* Copy user's code */ /* Copy user's code */
Usr->userCode = UsrDat->UsrCod; Usr->userCode = UsrDat->UsrCod;
/* Copy user's nickname */ /* Copy user's nickname */
Usr->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA+1); Usr->userNickname = (char *) soap_malloc (Gbl.soap,strlen (UsrDat->Nickname) + 1);
strncpy (Usr->userNickname,UsrDat->Nickname,Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA); strcpy (Usr->userNickname,UsrDat->Nickname);
Usr->userNickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA] = '\0';
/* Copy user's ID */ /* Copy user's first ID */
Usr->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_LENGTH_USR_ID+1);
if (UsrIDIsVisible && UsrDat->IDs.List) if (UsrIDIsVisible && UsrDat->IDs.List)
{ FirstID = UsrDat->IDs.List[0].ID;
strncpy (Usr->userID,UsrDat->IDs.List[0].ID,ID_MAX_LENGTH_USR_ID);
Usr->userID[ID_MAX_LENGTH_USR_ID] = '\0';
}
else // Hide user's ID else // Hide user's ID
strcpy (Usr->userID,"********"); FirstID = "********";
Usr->userID = (char *) soap_malloc (Gbl.soap,strlen (FirstID) + 1);
strcpy (Usr->userID,FirstID);
/* Copy user's surname1 */ /* Copy user's surname1 */
Usr->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME_SPEC_CHAR+1); Usr->userSurname1 = (char *) soap_malloc (Gbl.soap,strlen (UsrDat->Surname1) + 1);
strncpy (Usr->userSurname1,UsrDat->Surname1,Usr_MAX_BYTES_NAME_SPEC_CHAR); strcpy (Usr->userSurname1,UsrDat->Surname1);
Usr->userSurname1[Usr_MAX_BYTES_NAME_SPEC_CHAR] = '\0';
/* Copy user's surname2 */ /* Copy user's surname2 */
Usr->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME_SPEC_CHAR+1); Usr->userSurname2 = (char *) soap_malloc (Gbl.soap,strlen (UsrDat->Surname2) + 1);
strncpy (Usr->userSurname2,UsrDat->Surname2,Usr_MAX_BYTES_NAME_SPEC_CHAR); strcpy (Usr->userSurname2,UsrDat->Surname2);
Usr->userSurname2[Usr_MAX_BYTES_NAME_SPEC_CHAR] = '\0';
/* Copy user's first name */ /* Copy user's first name */
Usr->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME_SPEC_CHAR+1); Usr->userFirstname = (char *) soap_malloc (Gbl.soap,strlen (UsrDat->FirstName) + 1);
strncpy (Usr->userFirstname,UsrDat->FirstName,Usr_MAX_BYTES_NAME_SPEC_CHAR); strcpy (Usr->userFirstname,UsrDat->FirstName);
Usr->userFirstname[Usr_MAX_BYTES_NAME_SPEC_CHAR] = '\0';
/* User's photo URL */ /* User's photo URL */
Pho_BuildLinkToPhoto (UsrDat,PhotoURL); Pho_BuildLinkToPhoto (UsrDat,PhotoURL);
Usr->userPhoto = (char *) soap_malloc (Gbl.soap,PATH_MAX+1); Usr->userPhoto = (char *) soap_malloc (Gbl.soap,strlen (PhotoURL) + 1);
strncpy (Usr->userPhoto,PhotoURL,PATH_MAX); strcpy (Usr->userPhoto,PhotoURL);
Usr->userPhoto[PATH_MAX] = '\0';
} }
/*****************************************************************************/ /*****************************************************************************/