mirror of https://github.com/acanas/swad-core.git
Version 20.67: Apr 24, 2021 Bug fixing and code optimizations related to user's roles.
This commit is contained in:
parent
9343280967
commit
890bf64be4
175
swad_API.c
175
swad_API.c
|
@ -639,7 +639,7 @@ static bool API_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
/***** Get user's role *****/
|
||||
if (CrsCod > 0)
|
||||
/* Get the role in the given course */
|
||||
UsrDat->Roles.InCurrentCrs.Role =
|
||||
UsrDat->Roles.InCurrentCrs =
|
||||
DB_QuerySELECTRole ("can not get user's role",
|
||||
"SELECT Role"
|
||||
" FROM crs_users"
|
||||
|
@ -649,13 +649,12 @@ static bool API_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
UsrDat->UsrCod);
|
||||
else
|
||||
/* Get the maximum role in any course */
|
||||
UsrDat->Roles.InCurrentCrs.Role =
|
||||
UsrDat->Roles.InCurrentCrs =
|
||||
DB_QuerySELECTRole ("can not get user's role",
|
||||
"SELECT MAX(Role)"
|
||||
" FROM crs_users"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -903,7 +902,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
if (UsrFound)
|
||||
{
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
loginByUserPasswordKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
|
||||
|
@ -929,7 +928,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||
|
||||
loginByUserPasswordKeyOut->userRole =
|
||||
API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role];
|
||||
API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs];
|
||||
|
||||
/***** Generate a key used in subsequents calls to other web services *****/
|
||||
return API_GenerateNewWSKey (soap,
|
||||
|
@ -1058,7 +1057,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
if (UsrFound)
|
||||
{
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
loginBySessionKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
|
||||
|
@ -1083,7 +1082,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
Str_Copy (loginBySessionKeyOut->userBirthday,
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||
|
||||
loginBySessionKeyOut->userRole = API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role];
|
||||
loginBySessionKeyOut->userRole = API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs];
|
||||
|
||||
/***** Generate a key used in subsequents calls to other web services *****/
|
||||
return API_GenerateNewWSKey (soap,
|
||||
|
@ -1134,7 +1133,7 @@ int swad__getAvailableRoles (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Return available roles *****/
|
||||
Rol_SetMyRoles ();
|
||||
|
@ -1209,7 +1208,9 @@ int swad__getNewPassword (struct soap *soap,
|
|||
/***** Get user's data from database *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod > 0) // One unique user found in table of users' data
|
||||
{
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_DONT_GET_PREFS); // Get my data
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, // Get my data
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
if (Gbl.Usrs.Me.UsrDat.Email[0])
|
||||
if (Pwd_SendNewPasswordByEmail (NewRandomPlainPassword) == 0) // Message sent successfully
|
||||
|
@ -1255,7 +1256,7 @@ int swad__getCourses (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Query my courses from database *****/
|
||||
NumRows = (unsigned)
|
||||
|
@ -1381,12 +1382,12 @@ int swad__getCourseInfo (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -1723,12 +1724,12 @@ int swad__getUsers (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -1805,13 +1806,13 @@ int swad__findUsers (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS) // Course selected
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -1976,12 +1977,12 @@ int swad__getGroupTypes (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -2095,12 +2096,12 @@ int swad__getGroups (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -2233,12 +2234,12 @@ int swad__sendMyGroups (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -2457,10 +2458,10 @@ int swad__getAttendanceEvents (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
@ -2674,10 +2675,10 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
@ -2794,10 +2795,10 @@ int swad__removeAttendanceEvent (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
@ -2890,10 +2891,10 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
@ -3100,10 +3101,10 @@ int swad__sendAttendanceUsers (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
@ -3241,7 +3242,7 @@ int swad__getNotifications (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Get my language from database *****/
|
||||
if ((ReturnCode = API_GetMyLanguage (soap)) != SOAP_OK)
|
||||
|
@ -3517,7 +3518,7 @@ int swad__markNotificationsAsRead (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
if (notifications[0])
|
||||
{
|
||||
|
@ -3593,7 +3594,7 @@ int swad__sendMessage (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if the message is a reply to a previous message *****/
|
||||
if (messageCode)
|
||||
|
@ -3719,7 +3720,9 @@ int swad__sendMessage (struct soap *soap,
|
|||
/* Get user's code (row[0]) */
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = (long) Str_ConvertStrCodToLongCod (row[0])) > 0)
|
||||
/* Get recipient data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* This received message must be notified by email? */
|
||||
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
@ -3727,7 +3730,13 @@ int swad__sendMessage (struct soap *soap,
|
|||
(Gbl.Usrs.Other.UsrDat.NtfEvents.SendEmail & (1 << Ntf_EVENT_MESSAGE)));
|
||||
|
||||
/* Send message to this user */
|
||||
if ((ReturnCode = API_SendMessageToUsr ((long) messageCode,Gbl.Usrs.Me.UsrDat.UsrCod,ReplyUsrCod,Gbl.Usrs.Other.UsrDat.UsrCod,NotifyByEmail,subject,body)) != SOAP_OK)
|
||||
if ((ReturnCode = API_SendMessageToUsr ((long) messageCode,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
ReplyUsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
NotifyByEmail,
|
||||
subject,
|
||||
body)) != SOAP_OK)
|
||||
{
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
return ReturnCode;
|
||||
|
@ -3859,7 +3868,7 @@ int swad__sendNotice (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check course and group codes *****/
|
||||
if ((ReturnCode = API_CheckCourseAndGroupCodes (soap,
|
||||
|
@ -3872,7 +3881,7 @@ int swad__sendNotice (struct soap *soap,
|
|||
return ReturnCode;
|
||||
|
||||
/***** Check if I am a teacher *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
@ -3930,7 +3939,7 @@ int swad__getTestConfig (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if course code is correct *****/
|
||||
if (Gbl.Hierarchy.Crs.CrsCod <= 0)
|
||||
|
@ -3939,9 +3948,9 @@ int swad__getTestConfig (struct soap *soap,
|
|||
"Course code must be a integer greater than 0");
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -4097,7 +4106,7 @@ int swad__getTests (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if course code is correct *****/
|
||||
if (Gbl.Hierarchy.Crs.CrsCod <= 0)
|
||||
|
@ -4106,9 +4115,9 @@ int swad__getTests (struct soap *soap,
|
|||
"Course code must be a integer greater than 0");
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -4545,7 +4554,7 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Loop over recipients' nicknames building query *****/
|
||||
DegreesStr[0] = '\0';
|
||||
|
@ -4787,7 +4796,7 @@ int swad__getGames (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am logged as student in the course *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_STD)
|
||||
|
@ -4971,7 +4980,7 @@ int swad__getMatches (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am logged as student in the course *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_STD)
|
||||
|
@ -5166,7 +5175,7 @@ int swad__getMatchStatus (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am logged as student in the course *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_STD)
|
||||
|
@ -5390,7 +5399,7 @@ int swad__getDirectoryTree (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check course and group codes *****/
|
||||
if ((ReturnCode = API_CheckCourseAndGroupCodes (soap,
|
||||
|
@ -5399,9 +5408,9 @@ int swad__getDirectoryTree (struct soap *soap,
|
|||
return ReturnCode;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -5615,7 +5624,9 @@ static bool API_WriteRowFileBrowser (unsigned Level,Brw_FileType_t FileType,cons
|
|||
Gbl.FileBrowser.FilFolLnk.Full,false,Brw_LICENSE_DEFAULT);
|
||||
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = FileMetadata.PublisherUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||
|
||||
fprintf (Gbl.F.XML,"<file name=\"%s\">"
|
||||
|
@ -5721,7 +5732,7 @@ int swad__getFile (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check course and group codes *****/
|
||||
if ((ReturnCode = API_CheckCourseAndGroupCodes (soap,
|
||||
|
@ -5730,9 +5741,9 @@ int swad__getFile (struct soap *soap,
|
|||
return ReturnCode;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -5756,7 +5767,7 @@ int swad__getFile (struct soap *soap,
|
|||
case Brw_ADMI_MRK_CRS:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
// Downloading a file of marks is only allowed for teachers
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Wrong tree",
|
||||
"Wrong file zone");
|
||||
|
@ -5800,9 +5811,11 @@ int swad__getFile (struct soap *soap,
|
|||
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = FileMetadata.PublisherUsrCod) > 0)
|
||||
/* Get publisher's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
/* Copy publisher's data into output structure */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Copy publisher's data into output structure */
|
||||
Str_Copy (getFileOut->publisherName,Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Usr_MAX_BYTES_FULL_NAME);
|
||||
|
||||
|
@ -5872,12 +5885,12 @@ int swad__getMarks (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check if I am a student, non-editing teacher or teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role != Rol_TCH)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_NET &&
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs != Rol_TCH)
|
||||
return soap_receiver_fault (soap,
|
||||
"Request forbidden",
|
||||
"Requester must belong to course");
|
||||
|
@ -5942,7 +5955,7 @@ int swad__getLocation (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Convert MAC string to number *****/
|
||||
if (sscanf (MAC,"%llx",&MACnum) != 1)
|
||||
|
@ -6021,7 +6034,7 @@ int swad__sendMyLocation (struct soap *soap,
|
|||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs;
|
||||
|
||||
/***** Check in (insert pair user-room) in the database *****/
|
||||
/* Get the code of the inserted item */
|
||||
|
|
12
swad_ID.c
12
swad_ID.c
|
@ -426,8 +426,8 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
|
|||
return true;
|
||||
|
||||
/* Check 2: I can see the IDs of confirmed students */
|
||||
if (UsrDat->Roles.InCurrentCrs.Role == Rol_STD && // A student
|
||||
UsrDat->Accepted) // who accepted registration
|
||||
if (UsrDat->Roles.InCurrentCrs == Rol_STD && // A student
|
||||
UsrDat->Accepted) // who accepted registration
|
||||
return true;
|
||||
|
||||
/* Check 3: I can see the IDs of users with user's data empty */
|
||||
|
@ -464,7 +464,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
|
|||
Act_Action_t NextAction;
|
||||
|
||||
/***** Begin form *****/
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActCnfID_Std;
|
||||
|
@ -625,7 +625,7 @@ static void ID_ShowFormChangeUsrID (bool ItsMe,bool IShouldFillInID)
|
|||
ID_PutParamsRemoveMyID,UsrDat->IDs.List[NumID].ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActRemID_Std;
|
||||
|
@ -688,7 +688,7 @@ static void ID_ShowFormChangeUsrID (bool ItsMe,bool IShouldFillInID)
|
|||
Frm_StartFormAnchor (ActChgMyID,ID_ID_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActNewID_Std;
|
||||
|
@ -1032,7 +1032,7 @@ void ID_ConfirmOtherUsrID (void)
|
|||
/* If user is a student in current course,
|
||||
check if he/she has accepted */
|
||||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS)
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs == Rol_STD)
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
if (ID_ICanSeeOtherUsrIDs (&Gbl.Usrs.Other.UsrDat))
|
||||
|
|
|
@ -195,7 +195,9 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Crs_Course *Crs)
|
|||
|
||||
/* Get author */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get from the database the data of the autor
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get author's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Write item with notice *****/
|
||||
fprintf (FileRSS,"<item>\n");
|
||||
|
|
|
@ -241,7 +241,9 @@ void Acc_CheckIfEmptyAccountExists (void)
|
|||
UsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
||||
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Write row with data of empty account *****/
|
||||
Acc_WriteRowEmptyAccount (NumUsr,ID,&UsrDat);
|
||||
|
@ -1235,7 +1237,7 @@ void Acc_PutIconToChangeUsrAccount (void)
|
|||
else // Not me
|
||||
if (Usr_ICanEditOtherUsr (Gbl.Record.UsrDat))
|
||||
{
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActFrmAccStd;
|
||||
|
|
|
@ -4029,7 +4029,7 @@ void Act_AdjustCurrentAction (void)
|
|||
}
|
||||
|
||||
/***** Check if I am a teacher in any course *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
IAmATeacherInAnyCrs = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | // I am a non-editing teacher...
|
||||
(1 << Rol_TCH))); // ...or a teacher in any course
|
||||
|
||||
|
@ -4083,7 +4083,7 @@ void Act_AdjustCurrentAction (void)
|
|||
is to show a form to ask for enrolment *****/
|
||||
if (!Gbl.Usrs.Me.UsrDat.Accepted)
|
||||
{
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
Gbl.Action.Act = ActReqAccEnrStd;
|
||||
|
@ -4171,14 +4171,3 @@ void Act_AdjustCurrentAction (void)
|
|||
Tab_SetCurrentTab ();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Write error message and exit when no permission to perform an action ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Lay_NoPermissionExit (void)
|
||||
{
|
||||
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
|
||||
|
||||
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
||||
}
|
||||
|
|
|
@ -1790,6 +1790,4 @@ const char *Act_GetActionText (Act_Action_t Action);
|
|||
void Act_AdjustActionWhenNoUsrLogged (void);
|
||||
void Act_AdjustCurrentAction (void);
|
||||
|
||||
void Lay_NoPermissionExit (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -451,7 +451,9 @@ void Agd_ShowOtherAgendaAfterLogIn (void)
|
|||
{
|
||||
/***** Get user *****/
|
||||
/* If nickname is correct, user code is already got from nickname */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Existing user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Existing user
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/***** Reset agenda context *****/
|
||||
Agd_ResetAgenda (&Agenda);
|
||||
|
|
|
@ -109,7 +109,7 @@ void Ann_ShowAllAnnouncements (void)
|
|||
else if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
/* Select only announcements I can see */
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
NumAnnouncements = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get announcements",
|
||||
"SELECT AnnCod," // row[0]
|
||||
|
@ -229,7 +229,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
|
|||
char Content[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
||||
/***** Select announcements not seen *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
NumAnnouncements = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get announcements",
|
||||
"SELECT AnnCod," // row[0]
|
||||
|
|
|
@ -3347,7 +3347,9 @@ static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events,
|
|||
NumUsr++)
|
||||
{
|
||||
UsrDat.UsrCod = LstSelectedUsrCods[NumUsr];
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get from the database the data of the student
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewAtt (&UsrDat))
|
||||
{
|
||||
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
||||
|
@ -3568,7 +3570,9 @@ static void Att_ListStdsWithAttEventsDetails (const struct Att_Events *Events,
|
|||
NumUsr++)
|
||||
{
|
||||
UsrDat.UsrCod = LstSelectedUsrCods[NumUsr];
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get from the database the data of the student
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewAtt (&UsrDat))
|
||||
{
|
||||
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
||||
|
|
|
@ -1061,7 +1061,9 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
|||
|
||||
/* Center requester */
|
||||
UsrDat.UsrCod = Ctr->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
|
|||
|
||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.66.5 (2021-04-23)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.67 (2021-04-24)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 20.67: Apr 24, 2021 Bug fixing and code optimizations related to user's roles. (309356 lines)
|
||||
Version 20.66.5: Apr 23, 2021 Including missing head files.
|
||||
Fixed bug getting my courses. (309123 lines)
|
||||
Version 20.66.4: Apr 23, 2021 Fixed bug in pagination of messages. (309110 lines)
|
||||
|
|
|
@ -871,7 +871,9 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
|
|||
Usr_UsrDataConstructor (&OtherUsrDat);
|
||||
|
||||
/***** Get user's data *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (&OtherUsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&OtherUsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
UsrDat = &OtherUsrDat;
|
||||
}
|
||||
|
@ -1131,7 +1133,9 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
|
||||
/* Get user's data */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Existing user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Existing user
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Get course code (row[1]) */
|
||||
ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) ==
|
||||
|
|
|
@ -1353,7 +1353,9 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
|||
|
||||
/* Course requester */
|
||||
UsrDat.UsrCod = Crs->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -495,7 +495,9 @@ static void Deg_ListDegreesForEdition (void)
|
|||
|
||||
/* Degree requester */
|
||||
UsrDat.UsrCod = Deg->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -179,7 +179,9 @@ void Dup_ListDuplicateUsrs (void)
|
|||
|
||||
/* Get user code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Get if user has accepted all his/her courses */
|
||||
if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
|
||||
|
@ -328,7 +330,9 @@ static void Dup_ListSimilarUsrs (void)
|
|||
{
|
||||
/* Get user code */
|
||||
UsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Get if user has accepted all his/her courses */
|
||||
if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
|
||||
|
|
338
swad_enrolment.c
338
swad_enrolment.c
|
@ -260,10 +260,9 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
|||
Usr_FlushCachesUsr ();
|
||||
|
||||
/***** Set user's roles *****/
|
||||
UsrDat->Roles.InCurrentCrs.Role = NewRole;
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
UsrDat->Roles.InCurrentCrs = NewRole;
|
||||
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles
|
||||
Rol_GetRolesInAllCrss (UsrDat); // Get roles
|
||||
|
||||
/***** Create notification for this user.
|
||||
If this user wants to receive notifications by email,
|
||||
|
@ -329,10 +328,9 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
|
|||
Usr_FlushCachesUsr ();
|
||||
|
||||
/***** Set roles *****/
|
||||
UsrDat->Roles.InCurrentCrs.Role = NewRole;
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
UsrDat->Roles.InCurrentCrs = NewRole;
|
||||
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles
|
||||
Rol_GetRolesInAllCrss (UsrDat); // Get roles
|
||||
|
||||
/***** Create notification for this user.
|
||||
If this user wants to receive notifications by email,
|
||||
|
@ -439,11 +437,11 @@ void Enr_ReqAcceptRegisterInCrs (void)
|
|||
|
||||
/***** Show message *****/
|
||||
Ale_ShowAlert (Ale_INFO,Txt_A_teacher_or_administrator_has_enroled_you_as_X_into_the_course_Y,
|
||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs][Gbl.Usrs.Me.UsrDat.Sex],
|
||||
Gbl.Hierarchy.Crs.FullName);
|
||||
|
||||
/***** Send button to accept register in the current course *****/
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
Frm_BeginForm (ActAccEnrStd);
|
||||
|
@ -461,7 +459,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
|
|||
Frm_EndForm ();
|
||||
|
||||
/***** Send button to refuse register in the current course *****/
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
Frm_BeginForm (ActRemMe_Std);
|
||||
|
@ -482,7 +480,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
|
|||
Box_BoxEnd ();
|
||||
|
||||
/***** Mark possible notification as seen *****/
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NotifyEvent = Ntf_EVENT_ENROLMENT_STD;
|
||||
|
@ -533,7 +531,9 @@ void Enr_GetNotifEnrolment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
/* Get user's data */
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Role (row[0]) */
|
||||
Role = Rol_ConvertUnsignedStrToRole (row[0]);
|
||||
|
@ -925,8 +925,11 @@ void Enr_RemoveOldUsrs (void)
|
|||
NumUsr++)
|
||||
{
|
||||
UsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
// User's data exist...
|
||||
Acc_CompletelyEliminateAccount (&UsrDat,Cns_QUIET);
|
||||
NumUsrsEliminated++;
|
||||
}
|
||||
|
@ -1305,8 +1308,11 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
|||
if (Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove) // If this student must be removed
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
// User's data exist...
|
||||
if (WhatToDo.EliminateUsrs) // Eliminate user completely from the platform
|
||||
{
|
||||
Acc_CompletelyEliminateAccount (&UsrDat,Cns_QUIET); // Remove definitely the user from the platform
|
||||
|
@ -1808,13 +1814,16 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
|
|||
|
||||
/***** Check if the record of the user exists and get the type of user *****/
|
||||
if (UsrDat->UsrCod > 0) // User exists in database
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS); // Get user's data
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS);
|
||||
else // User does not exist in database, create it using his/her ID!
|
||||
{
|
||||
// Reset user's data
|
||||
/* Reset user's data */
|
||||
Usr_ResetUsrDataExceptUsrCodAndIDs (UsrDat); // It's necessary, because the same struct UsrDat was used for former user
|
||||
|
||||
// User does not exist in database; list of IDs is initialized
|
||||
/* User does not exist in database; list of IDs is initialized */
|
||||
UsrDat->IDs.List[0].Confirmed = true; // If he/she is a new user ==> his/her ID will be stored as confirmed in database
|
||||
Acc_CreateNewUsr (UsrDat,
|
||||
false); // I am NOT creating my own account
|
||||
|
@ -1825,7 +1834,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
|
|||
{
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
|
||||
{
|
||||
if (RegRemRole != UsrDat->Roles.InCurrentCrs.Role) // The role must be updated
|
||||
if (RegRemRole != UsrDat->Roles.InCurrentCrs) // The role must be updated
|
||||
/* Modify role */
|
||||
Enr_ModifyRoleInCurrentCrs (UsrDat,RegRemRole);
|
||||
}
|
||||
|
@ -1964,9 +1973,9 @@ void Enr_ReqSignUpInCrs (void)
|
|||
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
|
||||
/***** Check if I already belong to course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role >= Rol_STD)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs >= Rol_STD)
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_You_were_already_enroled_as_X_in_the_course_Y,
|
||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs][Gbl.Usrs.Me.UsrDat.Sex],
|
||||
Gbl.Hierarchy.Crs.FullName);
|
||||
else if (Gbl.Usrs.Me.Role.Logged == Rol_GST ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_USR)
|
||||
|
@ -1990,9 +1999,9 @@ void Enr_SignUpInCrs (void)
|
|||
long ReqCod = -1L;
|
||||
|
||||
/***** Check if I already belong to course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role >= Rol_STD)
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs >= Rol_STD)
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_You_were_already_enroled_as_X_in_the_course_Y,
|
||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex],
|
||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs][Gbl.Usrs.Me.UsrDat.Sex],
|
||||
Gbl.Hierarchy.Crs.FullName);
|
||||
else
|
||||
{
|
||||
|
@ -2092,7 +2101,9 @@ void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
/* User's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Role (row[1]) */
|
||||
DesiredRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
||||
|
@ -2130,8 +2141,11 @@ void Enr_AskIfRejectSignUp (void)
|
|||
/***** Get user's code *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
// User's data exist...
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/* User already belongs to this course */
|
||||
|
@ -2184,8 +2198,11 @@ void Enr_RejectSignUp (void)
|
|||
/***** Get user's code *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
// User's data exist...
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/* User already belongs to this course */
|
||||
|
@ -2895,143 +2912,149 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
/* Begin table */
|
||||
HTM_TABLE_BeginCenterPadding (2);
|
||||
|
||||
/* Table heading */
|
||||
HTM_TR_Begin (NULL);
|
||||
/* Table heading */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH_Empty (1);
|
||||
HTM_TH (1,1,"LT",Txt_Course);
|
||||
HTM_TH (1,1,"RT",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]);
|
||||
HTM_TH (1,2,"LT",Txt_Requester);
|
||||
HTM_TH (1,1,"LT",Txt_Role);
|
||||
HTM_TH (1,1,"CT",Txt_Date);
|
||||
HTM_TH_Empty (2);
|
||||
HTM_TH_Empty (1);
|
||||
HTM_TH (1,1,"LT",Txt_Course);
|
||||
HTM_TH (1,1,"RT",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]);
|
||||
HTM_TH (1,2,"LT",Txt_Requester);
|
||||
HTM_TH (1,1,"LT",Txt_Role);
|
||||
HTM_TH (1,1,"CT",Txt_Date);
|
||||
HTM_TH_Empty (2);
|
||||
|
||||
HTM_TR_End ();
|
||||
HTM_TR_End ();
|
||||
|
||||
/* List requests */
|
||||
for (NumReq = 0;
|
||||
NumReq < NumReqs;
|
||||
NumReq++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
/* List requests */
|
||||
for (NumReq = 0;
|
||||
NumReq < NumReqs;
|
||||
NumReq++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get request code (row[0]) */
|
||||
ReqCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
/* Get request code (row[0]) */
|
||||
ReqCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get course code (row[1]) */
|
||||
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
/* Get course code (row[1]) */
|
||||
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get user code (row[2]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
UsrExists = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
/* Get user code (row[2]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
UsrExists = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Get requested role (row[3]) *****/
|
||||
DesiredRole = Rol_ConvertUnsignedStrToRole (row[3]);
|
||||
/***** Get requested role (row[3]) *****/
|
||||
DesiredRole = Rol_ConvertUnsignedStrToRole (row[3]);
|
||||
|
||||
if (UsrExists)
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Crs.CrsCod,
|
||||
false);
|
||||
else
|
||||
UsrBelongsToCrs = false;
|
||||
if (UsrExists)
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Crs.CrsCod,
|
||||
false);
|
||||
else
|
||||
UsrBelongsToCrs = false;
|
||||
|
||||
if (UsrExists &&
|
||||
!UsrBelongsToCrs &&
|
||||
(DesiredRole == Rol_STD ||
|
||||
DesiredRole == Rol_NET ||
|
||||
DesiredRole == Rol_TCH))
|
||||
{
|
||||
/***** Number *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("class=\"DAT RT\"");
|
||||
HTM_Unsigned (NumReqs - NumReq);
|
||||
HTM_TD_End ();
|
||||
if (UsrExists &&
|
||||
!UsrBelongsToCrs &&
|
||||
(DesiredRole == Rol_STD ||
|
||||
DesiredRole == Rol_NET ||
|
||||
DesiredRole == Rol_TCH))
|
||||
{
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Link to course *****/
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
Deg.DegCod = Crs.DegCod;
|
||||
Deg_GetDataOfDegreeByCod (&Deg);
|
||||
HTM_TD_Begin (NULL);
|
||||
Frm_BeginFormGoTo (ActSeeCrsInf);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Crs.FullName),
|
||||
"BT_LINK LT DAT",NULL);
|
||||
Hie_FreeGoToMsg ();
|
||||
HTM_TxtF ("%s > %s",Deg.ShrtName,Crs.ShrtName);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/***** Number *****/
|
||||
HTM_TD_Begin ("class=\"DAT RT\"");
|
||||
HTM_Unsigned (NumReqs - NumReq);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Number of teachers in the course *****/
|
||||
HTM_TD_Begin ("class=\"DAT RT\"");
|
||||
HTM_Unsigned (Usr_GetNumUsrsInCrss (Hie_Lvl_CRS,Crs.CrsCod,
|
||||
1 << Rol_TCH));
|
||||
HTM_TD_End ();
|
||||
/***** Link to course *****/
|
||||
HTM_TD_Begin (NULL);
|
||||
|
||||
/***** User photo *****/
|
||||
HTM_TD_Begin ("class=\"DAT CT\" style=\"width:22px;\"");
|
||||
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
|
||||
HTM_TD_End ();
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
Deg.DegCod = Crs.DegCod;
|
||||
Deg_GetDataOfDegreeByCod (&Deg);
|
||||
|
||||
/***** User name *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
HTM_DIV_Begin ("class=\"REQUESTER_NAME\""); // Limited width
|
||||
Usr_WriteFirstNameBRSurnames (&UsrDat);
|
||||
HTM_DIV_End ();
|
||||
HTM_TD_End ();
|
||||
Frm_BeginFormGoTo (ActSeeCrsInf);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Crs.FullName),
|
||||
"BT_LINK LT DAT",NULL);
|
||||
Hie_FreeGoToMsg ();
|
||||
HTM_TxtF ("%s > %s",Deg.ShrtName,Crs.ShrtName);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
|
||||
/***** Requested role (row[3]) *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
HTM_Txt (Txt_ROLES_SINGUL_abc[DesiredRole][UsrDat.Sex]);
|
||||
HTM_TD_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Request time (row[4]) *****/
|
||||
Msg_WriteMsgDate (Dat_GetUNIXTimeFromStr (row[4]),"DAT");
|
||||
/***** Number of teachers in the course *****/
|
||||
HTM_TD_Begin ("class=\"DAT RT\"");
|
||||
HTM_Unsigned (Usr_GetNumUsrsInCrss (Hie_Lvl_CRS,Crs.CrsCod,
|
||||
1 << Rol_TCH));
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Button to confirm the request *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
switch (DesiredRole)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActReqMdfStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
NextAction = ActReqMdfNET;
|
||||
break;
|
||||
case Rol_TCH:
|
||||
NextAction = ActReqMdfTch;
|
||||
break;
|
||||
default:
|
||||
NextAction = ActUnk;
|
||||
Rol_WrongRoleExit ();
|
||||
break;
|
||||
}
|
||||
Frm_BeginForm (NextAction);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat.EnUsrCod);
|
||||
Btn_PutCreateButtonInline (Txt_Register);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/***** User photo *****/
|
||||
HTM_TD_Begin ("class=\"DAT CT\" style=\"width:22px;\"");
|
||||
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Button to reject the request *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
Frm_BeginForm (ActReqRejSignUp);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat.EnUsrCod);
|
||||
Btn_PutRemoveButtonInline (Txt_Reject);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/***** User name *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
HTM_DIV_Begin ("class=\"REQUESTER_NAME\""); // Limited width
|
||||
Usr_WriteFirstNameBRSurnames (&UsrDat);
|
||||
HTM_DIV_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
/***** Requested role (row[3]) *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
HTM_Txt (Txt_ROLES_SINGUL_abc[DesiredRole][UsrDat.Sex]);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Mark possible notification as seen *****/
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_ENROLMENT_REQUEST,
|
||||
ReqCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
else // User does not exists or user already belongs to course ==> remove pair from crs_requests table
|
||||
Enr_RemoveEnrolmentRequest (Crs.CrsCod,UsrDat.UsrCod);
|
||||
}
|
||||
/***** Request time (row[4]) *****/
|
||||
Msg_WriteMsgDate (Dat_GetUNIXTimeFromStr (row[4]),"DAT");
|
||||
|
||||
/***** Button to confirm the request *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
switch (DesiredRole)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActReqMdfStd;
|
||||
break;
|
||||
case Rol_NET:
|
||||
NextAction = ActReqMdfNET;
|
||||
break;
|
||||
case Rol_TCH:
|
||||
NextAction = ActReqMdfTch;
|
||||
break;
|
||||
default:
|
||||
NextAction = ActUnk;
|
||||
Rol_WrongRoleExit ();
|
||||
break;
|
||||
}
|
||||
Frm_BeginForm (NextAction);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat.EnUsrCod);
|
||||
Btn_PutCreateButtonInline (Txt_Register);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Button to reject the request *****/
|
||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||
Frm_BeginForm (ActReqRejSignUp);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat.EnUsrCod);
|
||||
Btn_PutRemoveButtonInline (Txt_Reject);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Mark possible notification as seen *****/
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_ENROLMENT_REQUEST,
|
||||
ReqCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
else // User does not exists or user already belongs to course ==> remove pair from crs_requests table
|
||||
Enr_RemoveEnrolmentRequest (Crs.CrsCod,UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/* End table */
|
||||
HTM_TABLE_End ();
|
||||
|
@ -3322,7 +3345,9 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role)
|
|||
{
|
||||
/* Get user's data */
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = ListUsrCods->Lst[NumUsr];
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Show form to edit user */
|
||||
Enr_ShowFormToEditOtherUsr ();
|
||||
|
@ -3816,7 +3841,7 @@ void Enr_CreateNewUsr1 (void)
|
|||
{
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role; // Remember old role before changing it
|
||||
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs; // Remember old role before changing it
|
||||
if (NewRole != OldRole) // The role must be updated
|
||||
{
|
||||
/* Modify role */
|
||||
|
@ -3935,7 +3960,7 @@ void Enr_ModifyUsr1 (void)
|
|||
/***** Register user in current course in database *****/
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role; // Remember old role before changing it
|
||||
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs; // Remember old role before changing it
|
||||
if (NewRole != OldRole) // The role must be updated
|
||||
{
|
||||
/* Modify role */
|
||||
|
@ -3975,8 +4000,7 @@ void Enr_ModifyUsr1 (void)
|
|||
/***** If it's me, change my roles *****/
|
||||
if (ItsMe)
|
||||
{
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role;
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Filled = true;
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs;
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCrss = Gbl.Usrs.Other.UsrDat.Roles.InCrss;
|
||||
Rol_SetMyRoles ();
|
||||
}
|
||||
|
@ -4149,7 +4173,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
|
|||
Rec_ShowSharedRecordUnmodifiable (UsrDat);
|
||||
|
||||
/* Show form to request confirmation */
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActRemStdCrs;
|
||||
|
@ -4255,14 +4279,11 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,
|
|||
Usr_GetMyCourses ();
|
||||
|
||||
/* Set my roles */
|
||||
Gbl.Usrs.Me.Role.FromSession =
|
||||
Gbl.Usrs.Me.Role.Logged =
|
||||
Gbl.Usrs.Me.Role.LoggedBeforeCloseSession =
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role =
|
||||
UsrDat->Roles.InCurrentCrs.Role = Rol_UNK;
|
||||
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Filled =
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
Gbl.Usrs.Me.Role.FromSession =
|
||||
Gbl.Usrs.Me.Role.Logged =
|
||||
Gbl.Usrs.Me.Role.LoggedBeforeCloseSession =
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs =
|
||||
UsrDat->Roles.InCurrentCrs = Rol_UNK;
|
||||
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCrss =
|
||||
UsrDat->Roles.InCrss = -1; // not yet filled/calculated
|
||||
|
@ -4272,9 +4293,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,
|
|||
else // Not me
|
||||
{
|
||||
/* Now he/she does not belong to current course */
|
||||
UsrDat->Accepted = false;
|
||||
UsrDat->Roles.InCurrentCrs.Role = Rol_USR;
|
||||
UsrDat->Roles.InCurrentCrs.Filled = false; // TODO: Set to true?
|
||||
UsrDat->Accepted = false;
|
||||
UsrDat->Roles.InCurrentCrs = Rol_USR;
|
||||
}
|
||||
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
|
|
|
@ -374,7 +374,9 @@ static void ExaRes_ListAllResultsInSelectedExams (struct Exa_Exams *Exams)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show sessions results *****/
|
||||
|
@ -458,7 +460,9 @@ static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod)
|
|||
NumUsr++)
|
||||
/* Get session code */
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0)
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show sessions results *****/
|
||||
|
@ -548,7 +552,9 @@ static void ExaRes_ListAllResultsInSes (struct Exa_Exams *Exams,long SesCod)
|
|||
NumUsr++)
|
||||
/* Get session code (row[0]) */
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0)
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show sessions results *****/
|
||||
|
@ -1433,7 +1439,6 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
|
|||
unsigned Visibility)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Exams_results;
|
||||
extern const char *Txt_The_user_does_not_exist;
|
||||
|
||||
/***** Compute score taking into account only valid questions *****/
|
||||
ExaRes_ComputeValidPrintScore (Print);
|
||||
|
@ -1449,8 +1454,10 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
|
|||
|
||||
/***** Check user data *****/
|
||||
/* Get data of the user who answered the exam print */
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS))
|
||||
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Lay_WrongUserExit ();
|
||||
if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat))
|
||||
Lay_NoPermissionExit ();
|
||||
|
||||
|
@ -1624,7 +1631,7 @@ void ExaRes_ShowExamResultUser (struct UsrData *UsrDat)
|
|||
|
||||
/***** Label *****/
|
||||
HTM_TD_Begin ("class=\"DAT_N RT\"");
|
||||
HTM_TxtColon (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs.Role][UsrDat->Sex]);
|
||||
HTM_TxtColon (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs][UsrDat->Sex]);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** User's data *****/
|
||||
|
|
|
@ -3206,7 +3206,9 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewAsgWrk (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.Accepted =
|
||||
|
@ -3390,7 +3392,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
|
|||
|
||||
HTM_DIV_Begin ("class=\"OWNER_WORKS_DATA AUTHOR_TXT\"");
|
||||
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActSeeRecOneStd;
|
||||
|
@ -6544,7 +6546,9 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod)
|
|||
|
||||
/***** Get data of file/folder publisher *****/
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
ShowUsr = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get user's data from database
|
||||
ShowUsr = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
}
|
||||
|
||||
HTM_TD_Begin ("class=\"BM%u\"",Gbl.RowEvenOdd);
|
||||
|
@ -6993,7 +6997,9 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Crs_GetDataOfCourseByCod (&Hie.Crs);
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_assignments_area,
|
||||
|
@ -7006,7 +7012,9 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Crs_GetDataOfCourseByCod (&Hie.Crs);
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_works_area,
|
||||
|
@ -8004,8 +8012,12 @@ static void Brw_PasteClipboard (void)
|
|||
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
|
||||
{
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
if (Usr_ChkIfUsrCodExists (Gbl.FileBrowser.Clipboard.WorksUsrCod))
|
||||
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Check that user exists
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS); // Check that user exists
|
||||
snprintf (PathOrg,sizeof (PathOrg),"%s/%ld/%s/%02u/%ld/%s",
|
||||
Cfg_PATH_CRS_PRIVATE,Hie.Crs.CrsCod,Cfg_FOLDER_USR,
|
||||
(unsigned) (Gbl.FileBrowser.Clipboard.WorksUsrCod % 100),
|
||||
|
@ -9528,7 +9540,9 @@ void Brw_ShowFileMetadata (void)
|
|||
Usr_UsrDataConstructor (&PublisherUsrDat);
|
||||
|
||||
PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod;
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat,Usr_DONT_GET_PREFS);
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
}
|
||||
else
|
||||
FileHasPublisher = false; // Get user's data from database
|
||||
|
@ -11492,7 +11506,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
|||
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
|
||||
return false; // I can not create anything inside this assignment
|
||||
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD: // Students...
|
||||
case Rol_NET: // ...and non-editing teachers...
|
||||
|
@ -11846,7 +11860,9 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/* Initialize structure with publisher's data */
|
||||
Usr_UsrDataConstructor (&PublisherUsrDat);
|
||||
PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod;
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat,Usr_DONT_GET_PREFS);
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
}
|
||||
else
|
||||
/* Unknown publisher */
|
||||
|
|
|
@ -171,7 +171,9 @@ void Fol_SuggestUsrsToFollowMainZone (void)
|
|||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
HTM_TR_Begin (NULL);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Fol_ShowFollowedOrFollower (&UsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
|
@ -240,7 +242,9 @@ void Fol_SuggestUsrsToFollowMainZoneOnRightColumn (void)
|
|||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/***** Show user *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Fol_WriteRowUsrToFollowOnRightColumn (&UsrDat);
|
||||
}
|
||||
|
||||
|
@ -663,7 +667,9 @@ void Fol_ListFollowing (void)
|
|||
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||
{
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
@ -712,7 +718,9 @@ static void Fol_ListFollowingUsr (struct UsrData *UsrDat)
|
|||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
HTM_TR_Begin (NULL);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowingUsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowingUsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Fol_ShowFollowedOrFollower (&FollowingUsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
|
@ -744,7 +752,9 @@ void Fol_ListFollowers (void)
|
|||
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||
{
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
@ -794,7 +804,9 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
|
|||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
HTM_TR_Begin (NULL);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowerUsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowerUsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Fol_ShowFollowedOrFollower (&FollowerUsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
|
@ -1169,7 +1181,9 @@ static void Fol_GetFollowedFromSelectedUsrs (unsigned *NumFollowed,
|
|||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
{
|
||||
/* Check if I follow this user */
|
||||
|
@ -1218,7 +1232,9 @@ void Fol_FollowUsrs ()
|
|||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
/* If I don't follow this user ==> follow him/her */
|
||||
if (!Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -1265,7 +1281,9 @@ void Fol_UnfollowUsrs (void)
|
|||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
/* If I follow this user ==> unfollow him/her */
|
||||
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
|
339
swad_forum.c
339
swad_forum.c
|
@ -1289,66 +1289,71 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
|||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Form to ban/unban post *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("class=\"CONTEXT_COL\"");
|
||||
if (ICanModerateForum)
|
||||
{
|
||||
Frm_StartFormAnchor (Enabled ? For_ActionsDisPstFor[Forums->Forum.Type] :
|
||||
For_ActionsEnbPstFor[Forums->Forum.Type],
|
||||
For_FORUM_POSTS_SECTION_ID);
|
||||
For_PutParamsForum (Forums);
|
||||
Ico_PutIconLink (Enabled ? "eye-green.svg" :
|
||||
"eye-slash-red.svg",
|
||||
Str_BuildStringLong (Enabled ? Txt_FORUM_Post_X_allowed_Click_to_ban_it :
|
||||
Txt_FORUM_Post_X_banned_Click_to_unban_it,
|
||||
(long) PstNum));
|
||||
Str_FreeString ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Ico_PutIcon (Enabled ? "eye-green.svg" :
|
||||
"eye-slash-red.svg",
|
||||
Str_BuildStringLong (Enabled ? Txt_FORUM_Post_X_allowed :
|
||||
Txt_FORUM_Post_X_banned,
|
||||
(long) PstNum),
|
||||
"ICO_HIDDEN ICO16x16");
|
||||
Str_FreeString ();
|
||||
}
|
||||
|
||||
/***** Form to remove post *****/
|
||||
if (LastPst)
|
||||
if (Usr_ItsMe (UsrDat.UsrCod))
|
||||
// Post can be removed if post is the last (without answers) and it's mine
|
||||
Ico_PutContextualIconToRemove (For_ActionsDelPstFor[Forums->Forum.Type],
|
||||
PstNum == 1 ? For_FORUM_THREADS_SECTION_ID : // First and unique post in thread
|
||||
For_FORUM_POSTS_SECTION_ID, // Last of several posts in thread
|
||||
For_PutParamsForum,Forums);
|
||||
HTM_TD_End ();
|
||||
/***** Form to ban/unban post *****/
|
||||
HTM_TD_Begin ("class=\"CONTEXT_COL\"");
|
||||
|
||||
/***** Write author *****/
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"AUTHOR_TXT LT\" style=\"width:150px;\"");
|
||||
Msg_WriteMsgAuthor (&UsrDat,Enabled,NULL);
|
||||
if (Enabled)
|
||||
/* Write number of posts from this user */
|
||||
For_WriteNumberOfPosts (Forums,UsrDat.UsrCod);
|
||||
HTM_TD_End ();
|
||||
if (ICanModerateForum)
|
||||
{
|
||||
Frm_StartFormAnchor (Enabled ? For_ActionsDisPstFor[Forums->Forum.Type] :
|
||||
For_ActionsEnbPstFor[Forums->Forum.Type],
|
||||
For_FORUM_POSTS_SECTION_ID);
|
||||
For_PutParamsForum (Forums);
|
||||
Ico_PutIconLink (Enabled ? "eye-green.svg" :
|
||||
"eye-slash-red.svg",
|
||||
Str_BuildStringLong (Enabled ? Txt_FORUM_Post_X_allowed_Click_to_ban_it :
|
||||
Txt_FORUM_Post_X_banned_Click_to_unban_it,
|
||||
(long) PstNum));
|
||||
Str_FreeString ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Ico_PutIcon (Enabled ? "eye-green.svg" :
|
||||
"eye-slash-red.svg",
|
||||
Str_BuildStringLong (Enabled ? Txt_FORUM_Post_X_allowed :
|
||||
Txt_FORUM_Post_X_banned,
|
||||
(long) PstNum),
|
||||
"ICO_HIDDEN ICO16x16");
|
||||
Str_FreeString ();
|
||||
}
|
||||
|
||||
/***** Write post content *****/
|
||||
HTM_TD_Begin ("class=\"MSG_TXT LT\"");
|
||||
if (Enabled)
|
||||
{
|
||||
Str_Copy (Content,OriginalContent,sizeof (Content) - 1);
|
||||
Msg_WriteMsgContent (Content,Cns_MAX_BYTES_LONG_TEXT,true,false);
|
||||
/***** Form to remove post *****/
|
||||
if (LastPst)
|
||||
if (Usr_ItsMe (UsrDat.UsrCod))
|
||||
// Post can be removed if post is the last (without answers) and it's mine
|
||||
Ico_PutContextualIconToRemove (For_ActionsDelPstFor[Forums->Forum.Type],
|
||||
PstNum == 1 ? For_FORUM_THREADS_SECTION_ID : // First and unique post in thread
|
||||
For_FORUM_POSTS_SECTION_ID, // Last of several posts in thread
|
||||
For_PutParamsForum,Forums);
|
||||
|
||||
/***** Show image *****/
|
||||
Med_ShowMedia (&Media,"FOR_IMG_CONT","FOR_IMG");
|
||||
}
|
||||
else
|
||||
HTM_Txt (Txt_This_post_has_been_banned_probably_for_not_satisfy_the_rules_of_the_forums);
|
||||
HTM_TD_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write author *****/
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"AUTHOR_TXT LT\" style=\"width:150px;\"");
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
Msg_WriteMsgAuthor (&UsrDat,Enabled,NULL);
|
||||
if (Enabled)
|
||||
/* Write number of posts from this user */
|
||||
For_WriteNumberOfPosts (Forums,UsrDat.UsrCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write post content *****/
|
||||
HTM_TD_Begin ("class=\"MSG_TXT LT\"");
|
||||
if (Enabled)
|
||||
{
|
||||
Str_Copy (Content,OriginalContent,sizeof (Content) - 1);
|
||||
Msg_WriteMsgContent (Content,Cns_MAX_BYTES_LONG_TEXT,true,false);
|
||||
|
||||
/***** Show image *****/
|
||||
Med_ShowMedia (&Media,"FOR_IMG_CONT","FOR_IMG");
|
||||
}
|
||||
else
|
||||
HTM_Txt (Txt_This_post_has_been_banned_probably_for_not_satisfy_the_rules_of_the_forums);
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Free image *****/
|
||||
|
@ -1824,7 +1829,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
|
|||
struct For_Forum Forum;
|
||||
|
||||
/***** Can I see teachers's forums? *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
ICanSeeTeacherForum = Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
|
||||
(Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) |
|
||||
(1 << Rol_TCH)));
|
||||
|
@ -1837,7 +1842,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
|
|||
For_WriteLinkToForum (Forums,&Forum,Highlight,0,IsLastItemInLevel);
|
||||
|
||||
/***** Link to forum of teachers global *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
if (ICanSeeTeacherForum)
|
||||
{
|
||||
Forum.Type = For_FORUM_GLOBAL_TCHS;
|
||||
|
@ -1861,7 +1866,7 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
|
|||
struct For_Forum Forum;
|
||||
|
||||
/***** Can I see teachers's forums? *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
ICanSeeTeacherForum = Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
|
||||
(Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) |
|
||||
(1 << Rol_TCH)));
|
||||
|
@ -3515,126 +3520,128 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
|||
((Thr.ThrCod == ThrCodHighlighted) ? "LIGHT_BLUE" :
|
||||
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
||||
|
||||
/***** Show my photo if I have any posts in this thread *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"BT %s\"",BgColor);
|
||||
if (Thr.NumMyPosts)
|
||||
HTM_IMG (Gbl.Usrs.Me.PhotoURL[0] ? Gbl.Usrs.Me.PhotoURL :
|
||||
Cfg_URL_ICON_PUBLIC,
|
||||
Gbl.Usrs.Me.PhotoURL[0] ? NULL :
|
||||
"usr_bl.jpg",
|
||||
Txt_Thread_with_posts_from_you,
|
||||
"class=\"PHOTO15x20\"");
|
||||
HTM_TD_End ();
|
||||
/***** Show my photo if I have any posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"BT %s\"",BgColor);
|
||||
if (Thr.NumMyPosts)
|
||||
HTM_IMG (Gbl.Usrs.Me.PhotoURL[0] ? Gbl.Usrs.Me.PhotoURL :
|
||||
Cfg_URL_ICON_PUBLIC,
|
||||
Gbl.Usrs.Me.PhotoURL[0] ? NULL :
|
||||
"usr_bl.jpg",
|
||||
Txt_Thread_with_posts_from_you,
|
||||
"class=\"PHOTO15x20\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Put an icon with thread status *****/
|
||||
HTM_TD_Begin ("class=\"CONTEXT_COL %s\"",BgColor);
|
||||
Ico_PutIcon (Thr.NumUnreadPosts ? "envelope.svg" :
|
||||
"envelope-open-text.svg",
|
||||
Thr.NumUnreadPosts ? Txt_There_are_new_posts :
|
||||
Txt_No_new_posts,
|
||||
"ICO16x16");
|
||||
HTM_TD_Begin ("class=\"CONTEXT_COL %s\"",BgColor);
|
||||
/***** Put an icon with thread status *****/
|
||||
Ico_PutIcon (Thr.NumUnreadPosts ? "envelope.svg" :
|
||||
"envelope-open-text.svg",
|
||||
Thr.NumUnreadPosts ? Txt_There_are_new_posts :
|
||||
Txt_No_new_posts,
|
||||
"ICO16x16");
|
||||
|
||||
/***** Put button to remove the thread *****/
|
||||
if (PermissionThreadDeletion[Forums->Forum.Type] &
|
||||
(1 << Gbl.Usrs.Me.Role.Logged)) // If I have permission to remove thread in this forum...
|
||||
{
|
||||
HTM_BR ();
|
||||
Ico_PutContextualIconToRemove (For_ActionsReqDelThr[Forums->Forum.Type],For_REMOVE_THREAD_SECTION_ID,
|
||||
For_PutParamsForum,Forums);
|
||||
}
|
||||
/***** Put button to remove the thread *****/
|
||||
if (PermissionThreadDeletion[Forums->Forum.Type] &
|
||||
(1 << Gbl.Usrs.Me.Role.Logged)) // If I have permission to remove thread in this forum...
|
||||
{
|
||||
HTM_BR ();
|
||||
Ico_PutContextualIconToRemove (For_ActionsReqDelThr[Forums->Forum.Type],For_REMOVE_THREAD_SECTION_ID,
|
||||
For_PutParamsForum,Forums);
|
||||
}
|
||||
|
||||
/***** Put button to cut the thread for moving it to another forum *****/
|
||||
if (ICanMoveThreads)
|
||||
{
|
||||
HTM_BR ();
|
||||
Frm_StartFormAnchor (For_ActionsCutThrFor[Forums->Forum.Type],
|
||||
For_FORUM_THREADS_SECTION_ID);
|
||||
For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
|
||||
1, // Page of posts = first
|
||||
Forums->ForumSet,
|
||||
Forums->ThreadsOrder,
|
||||
Forums->Forum.Location,
|
||||
Thr.ThrCod,
|
||||
-1L);
|
||||
Ico_PutIconCut ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
/***** Put button to cut the thread for moving it to another forum *****/
|
||||
if (ICanMoveThreads)
|
||||
{
|
||||
HTM_BR ();
|
||||
Frm_StartFormAnchor (For_ActionsCutThrFor[Forums->Forum.Type],
|
||||
For_FORUM_THREADS_SECTION_ID);
|
||||
For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
|
||||
1, // Page of posts = first
|
||||
Forums->ForumSet,
|
||||
Forums->ThreadsOrder,
|
||||
Forums->Forum.Location,
|
||||
Thr.ThrCod,
|
||||
-1L);
|
||||
Ico_PutIconCut ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
HTM_TD_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write subject and links to thread pages *****/
|
||||
HTM_TD_Begin ("class=\"LT %s\"",BgColor);
|
||||
PaginationPsts.NumItems = Thr.NumPosts;
|
||||
PaginationPsts.CurrentPage = 1; // First page
|
||||
Pag_CalculatePagination (&PaginationPsts);
|
||||
PaginationPsts.Anchor = For_FORUM_POSTS_SECTION_ID;
|
||||
Pag_WriteLinksToPages (Pag_POSTS_FORUM,
|
||||
&PaginationPsts,
|
||||
Forums,Thr.ThrCod,
|
||||
Thr.Enabled[Dat_START_TIME],
|
||||
Thr.Subject,
|
||||
Thr.NumUnreadPosts ? The_ClassFormInBoxBold[Gbl.Prefs.Theme] :
|
||||
The_ClassFormInBox[Gbl.Prefs.Theme],
|
||||
true);
|
||||
HTM_TD_End ();
|
||||
/***** Write subject and links to thread pages *****/
|
||||
HTM_TD_Begin ("class=\"LT %s\"",BgColor);
|
||||
PaginationPsts.NumItems = Thr.NumPosts;
|
||||
PaginationPsts.CurrentPage = 1; // First page
|
||||
Pag_CalculatePagination (&PaginationPsts);
|
||||
PaginationPsts.Anchor = For_FORUM_POSTS_SECTION_ID;
|
||||
Pag_WriteLinksToPages (Pag_POSTS_FORUM,
|
||||
&PaginationPsts,
|
||||
Forums,Thr.ThrCod,
|
||||
Thr.Enabled[Dat_START_TIME],
|
||||
Thr.Subject,
|
||||
Thr.NumUnreadPosts ? The_ClassFormInBoxBold[Gbl.Prefs.Theme] :
|
||||
The_ClassFormInBox[Gbl.Prefs.Theme],
|
||||
true);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write the authors and date-times of first and last posts *****/
|
||||
for (Order = Dat_START_TIME;
|
||||
Order <= Dat_END_TIME;
|
||||
Order++)
|
||||
{
|
||||
if (Order == Dat_START_TIME || Thr.NumPosts > 1) // Don't write twice the same author when thread has only one thread
|
||||
{
|
||||
/* Write the author of first or last message */
|
||||
UsrDat.UsrCod = Thr.UsrCod[Order];
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
HTM_TD_Begin ("class=\"%s LT %s\"",Style,BgColor);
|
||||
Msg_WriteMsgAuthor (&UsrDat,Thr.Enabled[Order],BgColor);
|
||||
HTM_TD_End ();
|
||||
/***** Write the authors and date-times of first and last posts *****/
|
||||
for (Order = Dat_START_TIME;
|
||||
Order <= Dat_END_TIME;
|
||||
Order++)
|
||||
{
|
||||
if (Order == Dat_START_TIME || Thr.NumPosts > 1) // Don't write twice the same author when thread has only one thread
|
||||
{
|
||||
/* Write the author of first or last message */
|
||||
UsrDat.UsrCod = Thr.UsrCod[Order];
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
HTM_TD_Begin ("class=\"%s LT %s\"",Style,BgColor);
|
||||
Msg_WriteMsgAuthor (&UsrDat,Thr.Enabled[Order],BgColor);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Write the date of first or last message (it's in YYYYMMDDHHMMSS format) */
|
||||
TimeUTC = Thr.WriteTime[Order];
|
||||
UniqueId++;
|
||||
if (asprintf (&Id,"thr_date_%u",UniqueId) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT %s\"",Id,Style,BgColor);
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,TimeUTC,
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||
true,true,false,0x6);
|
||||
HTM_TD_End ();
|
||||
free (Id);
|
||||
}
|
||||
else
|
||||
for (Column = 1;
|
||||
Column <= 2;
|
||||
Column++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"%s LT %s\"",Style,BgColor);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
}
|
||||
/* Write the date of first or last message (it's in YYYYMMDDHHMMSS format) */
|
||||
TimeUTC = Thr.WriteTime[Order];
|
||||
UniqueId++;
|
||||
if (asprintf (&Id,"thr_date_%u",UniqueId) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT %s\"",Id,Style,BgColor);
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,TimeUTC,
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||
true,true,false,0x6);
|
||||
HTM_TD_End ();
|
||||
free (Id);
|
||||
}
|
||||
else
|
||||
for (Column = 1;
|
||||
Column <= 2;
|
||||
Column++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"%s LT %s\"",Style,BgColor);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
}
|
||||
|
||||
/***** Write number of posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumPosts);
|
||||
HTM_TD_End ();
|
||||
/***** Write number of posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumPosts);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write number of new posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumUnreadPosts);
|
||||
HTM_TD_End ();
|
||||
/***** Write number of new posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumUnreadPosts);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write number of users who have write posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumWriters);
|
||||
HTM_TD_End ();
|
||||
/***** Write number of users who have write posts in this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumWriters);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write number of users who have read this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumReaders);
|
||||
HTM_TD_End ();
|
||||
/***** Write number of users who have read this thread *****/
|
||||
HTM_TD_Begin ("class=\"%s RT %s\"",Style,BgColor);
|
||||
HTM_TxtF ("%u ",Thr.NumReaders);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
@ -3938,7 +3945,7 @@ static void For_RestrictAccess (const struct For_Forums *Forums)
|
|||
break;
|
||||
case For_FORUM_GLOBAL_TCHS:
|
||||
case For_FORUM__SWAD__TCHS:
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) |
|
||||
(1 << Rol_TCH)));
|
||||
break;
|
||||
|
|
|
@ -741,7 +741,8 @@ void Grp_ChangeOtherUsrGrps (void)
|
|||
|
||||
/***** A student can not be enroled in more than one group
|
||||
if the type of group is of single enrolment *****/
|
||||
SelectionIsValid = Grp_CheckIfSelectionGrpsSingleEnrolmentIsValid (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role,&LstGrpsUsrWants);
|
||||
SelectionIsValid = Grp_CheckIfSelectionGrpsSingleEnrolmentIsValid (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs,
|
||||
&LstGrpsUsrWants);
|
||||
|
||||
/***** Free list of groups types and groups in this course *****/
|
||||
// The lists of group types and groups need to be freed here...
|
||||
|
@ -920,7 +921,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
|||
bool RegisterUsrInThisGrp;
|
||||
|
||||
/***** Lock tables to make the inscription atomic *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs == Rol_STD)
|
||||
Grp_LockTables ();
|
||||
|
||||
/***** Get list of groups types and groups in this course *****/
|
||||
|
@ -962,7 +963,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
|||
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
|
||||
|
||||
/***** Unlock tables after changes in groups *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role == Rol_STD)
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs == Rol_STD)
|
||||
Grp_UnlockTables ();
|
||||
|
||||
/***** Free list of groups types and groups in this course *****/
|
||||
|
|
|
@ -139,12 +139,12 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
if (Gbl.Action.Act != ActLogIn &&
|
||||
Gbl.Action.Act != ActLogInNew &&
|
||||
Gbl.Action.Act != ActLogInLan) // I am not just logged
|
||||
if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role] != ActUnk)
|
||||
if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs] != ActUnk)
|
||||
{
|
||||
/* Request my removing from this course */
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Str_BuildStringStr (Txt_Remove_me_from_THE_COURSE_X,
|
||||
Gbl.Hierarchy.Crs.ShrtName),
|
||||
ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role],
|
||||
ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs],
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_me);
|
||||
Str_FreeString ();
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
if (Gbl.Usrs.Me.MyCrss.Num) // I am enroled in some courses
|
||||
{
|
||||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS && // Course selected
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs == Rol_TCH) // I am a teacher in current course
|
||||
if (!Usr_GetCachedNumUsrsInCrss (Hie_Lvl_CRS,Gbl.Hierarchy.Crs.CrsCod,
|
||||
1 << Rol_STD)) // Current course probably has no students
|
||||
{
|
||||
|
|
|
@ -1090,125 +1090,128 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Put icon to remove institution */
|
||||
HTM_TD_Begin ("class=\"BM\"");
|
||||
if (!ICanEdit ||
|
||||
NumCtrs || // Institution has centers
|
||||
NumUsrsIns || // Institution has users
|
||||
NumUsrsInCrssOfIns) // Institution has users
|
||||
// Institution has centers or users ==> deletion forbidden
|
||||
Ico_PutIconRemovalNotAllowed ();
|
||||
else
|
||||
Ico_PutContextualIconToRemove (ActRemIns,NULL,
|
||||
Ins_PutParamOtherInsCod,&Ins->InsCod);
|
||||
HTM_TD_End ();
|
||||
/* Put icon to remove institution */
|
||||
HTM_TD_Begin ("class=\"BM\"");
|
||||
if (!ICanEdit ||
|
||||
NumCtrs || // Institution has centers
|
||||
NumUsrsIns || // Institution has users
|
||||
NumUsrsInCrssOfIns) // Institution has users
|
||||
// Institution has centers or users ==> deletion forbidden
|
||||
Ico_PutIconRemovalNotAllowed ();
|
||||
else
|
||||
Ico_PutContextualIconToRemove (ActRemIns,NULL,
|
||||
Ins_PutParamOtherInsCod,&Ins->InsCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution code */
|
||||
HTM_TD_Begin ("class=\"DAT CODE\"");
|
||||
HTM_Long (Ins->InsCod);
|
||||
HTM_TD_End ();
|
||||
/* Institution code */
|
||||
HTM_TD_Begin ("class=\"DAT CODE\"");
|
||||
HTM_Long (Ins->InsCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution logo */
|
||||
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ins->FullName);
|
||||
Lgo_DrawLogo (Hie_Lvl_INS,Ins->InsCod,Ins->ShrtName,20,NULL,true);
|
||||
HTM_TD_End ();
|
||||
/* Institution logo */
|
||||
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ins->FullName);
|
||||
Lgo_DrawLogo (Hie_Lvl_INS,Ins->InsCod,Ins->ShrtName,20,NULL,true);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution short name */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenInsSho);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,Ins->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ins->ShrtName);
|
||||
HTM_TD_End ();
|
||||
/* Institution short name */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenInsSho);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,Ins->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ins->ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution full name */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenInsFul);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,Ins->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ins->FullName);
|
||||
HTM_TD_End ();
|
||||
/* Institution full name */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenInsFul);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,Ins->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ins->FullName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution WWW */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActChgInsWWW);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_INPUT_URL ("WWW",Ins->WWW,HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_WWW_NARROW\" required=\"required\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Ins->WWW,sizeof (WWW) - 1);
|
||||
HTM_DIV_Begin ("class=\"EXTERNAL_WWW_SHORT\"");
|
||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\" title=\"%s\"",
|
||||
Ins->WWW,Ins->WWW);
|
||||
HTM_Txt (WWW);
|
||||
HTM_A_End ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
HTM_TD_End ();
|
||||
/* Institution WWW */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActChgInsWWW);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_INPUT_URL ("WWW",Ins->WWW,HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_WWW_NARROW\" required=\"required\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Ins->WWW,sizeof (WWW) - 1);
|
||||
HTM_DIV_Begin ("class=\"EXTERNAL_WWW_SHORT\"");
|
||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\" title=\"%s\"",
|
||||
Ins->WWW,Ins->WWW);
|
||||
HTM_Txt (WWW);
|
||||
HTM_A_End ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Number of users who claim to belong to this institution */
|
||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||
HTM_Unsigned (NumUsrsIns);
|
||||
HTM_TD_End ();
|
||||
/* Number of users who claim to belong to this institution */
|
||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||
HTM_Unsigned (NumUsrsIns);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Number of centers */
|
||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||
HTM_Unsigned (NumCtrs);
|
||||
HTM_TD_End ();
|
||||
/* Number of centers */
|
||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||
HTM_Unsigned (NumCtrs);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Number of users in courses of this institution */
|
||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||
HTM_Unsigned (NumUsrsInCrssOfIns);
|
||||
HTM_TD_End ();
|
||||
/* Number of users in courses of this institution */
|
||||
HTM_TD_Begin ("class=\"DAT RM\"");
|
||||
HTM_Unsigned (NumUsrsInCrssOfIns);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution requester */
|
||||
UsrDat.UsrCod = Ins->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
/* Institution requester */
|
||||
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
||||
UsrDat.UsrCod = Ins->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution status */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM &&
|
||||
StatusTxt == Ins_STATUS_PENDING)
|
||||
{
|
||||
Frm_BeginForm (ActChgInsSta);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
||||
"name=\"Status\" class=\"INPUT_STATUS\"");
|
||||
StatusUnsigned = (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_PENDING);
|
||||
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,true,false,
|
||||
"%s",Txt_INSTITUTION_STATUS[Ins_STATUS_PENDING]);
|
||||
StatusUnsigned = (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_ACTIVE);
|
||||
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,false,false,
|
||||
"%s",Txt_INSTITUTION_STATUS[Ins_STATUS_ACTIVE]);
|
||||
HTM_SELECT_End ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else if (StatusTxt != Ins_STATUS_ACTIVE) // If active ==> do not show anything
|
||||
HTM_Txt (Txt_INSTITUTION_STATUS[StatusTxt]);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution status */
|
||||
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM &&
|
||||
StatusTxt == Ins_STATUS_PENDING)
|
||||
{
|
||||
Frm_BeginForm (ActChgInsSta);
|
||||
Ins_PutParamOtherInsCod (&Ins->InsCod);
|
||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
||||
"name=\"Status\" class=\"INPUT_STATUS\"");
|
||||
StatusUnsigned = (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_PENDING);
|
||||
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,true,false,
|
||||
"%s",Txt_INSTITUTION_STATUS[Ins_STATUS_PENDING]);
|
||||
StatusUnsigned = (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_ACTIVE);
|
||||
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,false,false,
|
||||
"%s",Txt_INSTITUTION_STATUS[Ins_STATUS_ACTIVE]);
|
||||
HTM_SELECT_End ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else if (StatusTxt != Ins_STATUS_ACTIVE) // If active ==> do not show anything
|
||||
HTM_Txt (Txt_INSTITUTION_STATUS[StatusTxt]);
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1459,6 +1459,28 @@ void Lay_WrongWhoExit (void)
|
|||
Lay_ShowErrorAndExit ("Wrong parameter who.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Write error message and exit when user does not exists *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Lay_WrongUserExit (void)
|
||||
{
|
||||
extern const char *Txt_The_user_does_not_exist;
|
||||
|
||||
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Write error message and exit when no permission to perform an action ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Lay_NoPermissionExit (void)
|
||||
{
|
||||
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
|
||||
|
||||
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Write error message, close files, remove lock file, and exit ********/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -79,6 +79,7 @@ void Lay_WrongExamExit (void);
|
|||
void Lay_WrongSetExit (void);
|
||||
void Lay_WrongExamSessionExit (void);
|
||||
void Lay_WrongWhoExit (void);
|
||||
void Lay_WrongUserExit (void);
|
||||
void Lay_NoPermissionExit (void);
|
||||
void Lay_ShowErrorAndExit (const char *Txt);
|
||||
|
||||
|
|
10
swad_mail.c
10
swad_mail.c
|
@ -1288,7 +1288,7 @@ static void Mai_ShowFormChangeUsrEmail (bool ItsMe,
|
|||
Mai_PutParamsRemoveMyEmail,row[0]);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActRemMaiStd;
|
||||
|
@ -1325,7 +1325,7 @@ static void Mai_ShowFormChangeUsrEmail (bool ItsMe,
|
|||
Frm_StartFormAnchor (ActChgMyMai,Mai_EMAIL_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActNewMaiStd;
|
||||
|
@ -1371,7 +1371,7 @@ static void Mai_ShowFormChangeUsrEmail (bool ItsMe,
|
|||
Frm_StartFormAnchor (ActChgMyMai,Mai_EMAIL_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActNewMaiStd;
|
||||
|
@ -1902,8 +1902,8 @@ bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
|
|||
case Rol_STD:
|
||||
/* If I am a student in the current course,
|
||||
I can see the email of confirmed teachers */
|
||||
return (UsrDat->Roles.InCurrentCrs.Role == Rol_NET || // A non-editing teacher
|
||||
UsrDat->Roles.InCurrentCrs.Role == Rol_TCH) && // or a teacher
|
||||
return (UsrDat->Roles.InCurrentCrs == Rol_NET || // A non-editing teacher
|
||||
UsrDat->Roles.InCurrentCrs == Rol_TCH) && // or a teacher
|
||||
UsrDat->Accepted; // who accepted registration
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
|
|
|
@ -120,6 +120,7 @@ int main (void)
|
|||
Fir_CheckFirewallAndExitIfTooManyRequests ();
|
||||
|
||||
Hie_InitHierarchy ();
|
||||
|
||||
if (!Gbl.WebService.IsWebService)
|
||||
{
|
||||
/***** Create file for HTML output *****/
|
||||
|
|
|
@ -636,7 +636,9 @@ void Mrk_ShowMyMarks (void)
|
|||
if (UsrIsOK)
|
||||
{
|
||||
/***** Get list of user's IDs *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Create temporal file to store my marks (in HTML) *****/
|
||||
/* If the private directory does not exist, create it */
|
||||
|
|
|
@ -311,7 +311,9 @@ static void MchRes_ListAllMchResultsInSelectedGames (struct Gam_Games *Games)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show matches results *****/
|
||||
|
@ -426,7 +428,9 @@ static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod)
|
|||
NumUsr++)
|
||||
/* Get match code */
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0)
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show matches results *****/
|
||||
|
@ -516,7 +520,9 @@ static void MchRes_ListAllMchResultsInMch (struct Gam_Games *Games,long MchCod)
|
|||
NumUsr++)
|
||||
/* Get match code (row[0]) */
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0)
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show matches results *****/
|
||||
|
@ -1135,7 +1141,6 @@ static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults,
|
|||
void MchRes_ShowOneMchResult (void)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||
extern const char *Txt_The_user_does_not_exist;
|
||||
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||
extern const char *Txt_Questions;
|
||||
|
@ -1205,8 +1210,10 @@ void MchRes_ShowOneMchResult (void)
|
|||
|
||||
/***** User *****/
|
||||
/* Get data of the user who answer the match */
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS))
|
||||
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Lay_WrongUserExit ();
|
||||
if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat))
|
||||
Lay_NoPermissionExit ();
|
||||
|
||||
|
@ -1214,7 +1221,7 @@ void MchRes_ShowOneMchResult (void)
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT_N RT\"");
|
||||
HTM_TxtColon (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs.Role][UsrDat->Sex]);
|
||||
HTM_TxtColon (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs][UsrDat->Sex]);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||
|
|
201
swad_message.c
201
swad_message.c
|
@ -833,7 +833,9 @@ void Msg_RecMsgFromUsr (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDstData.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDstData);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData,Usr_DONT_GET_PREFS)) // Get recipient's data from the database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData, // Get recipient's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/***** Check if recipient has banned me *****/
|
||||
RecipientHasBannedMe = Msg_CheckIfUsrIsBanned (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDstData.UsrCod);
|
||||
|
@ -3300,40 +3302,41 @@ static void Msg_ShowASentOrReceivedMessage (struct Msg_Messages *Messages,
|
|||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"CONTEXT_COL %s\"",
|
||||
Messages->TypeOfMessages == Msg_RECEIVED ? (Open ? "BG_MSG_BLUE" :
|
||||
"BG_MSG_GREEN") :
|
||||
"BG_MSG_BLUE");
|
||||
Ico_PutIcon (Messages->TypeOfMessages == Msg_RECEIVED ? (Open ? (Replied ? "reply.svg" :
|
||||
"envelope-open-text.svg") :
|
||||
"envelope.svg") :
|
||||
"share.svg",
|
||||
Title,"ICO16x16");
|
||||
HTM_TD_Begin ("class=\"CONTEXT_COL %s\"",
|
||||
Messages->TypeOfMessages == Msg_RECEIVED ? (Open ? "BG_MSG_BLUE" :
|
||||
"BG_MSG_GREEN") :
|
||||
"BG_MSG_BLUE");
|
||||
Ico_PutIcon (Messages->TypeOfMessages == Msg_RECEIVED ? (Open ? (Replied ? "reply.svg" :
|
||||
"envelope-open-text.svg") :
|
||||
"envelope.svg") :
|
||||
"share.svg",
|
||||
Title,"ICO16x16");
|
||||
|
||||
/***** Form to delete message *****/
|
||||
HTM_BR ();
|
||||
Messages->MsgCod = MsgCod; // Message to be deleted
|
||||
Ico_PutContextualIconToRemove (ActionDelMsg[Messages->TypeOfMessages],NULL,
|
||||
Msg_PutHiddenParamsOneMsg,Messages);
|
||||
HTM_TD_End ();
|
||||
/***** Form to delete message *****/
|
||||
HTM_BR ();
|
||||
Messages->MsgCod = MsgCod; // Message to be deleted
|
||||
Ico_PutContextualIconToRemove (ActionDelMsg[Messages->TypeOfMessages],NULL,
|
||||
Msg_PutHiddenParamsOneMsg,Messages);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write message number *****/
|
||||
Msg_WriteMsgNumber (MsgNum,!Open);
|
||||
/***** Write message number *****/
|
||||
Msg_WriteMsgNumber (MsgNum,!Open);
|
||||
|
||||
/***** Write message author *****/
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
/***** Write message author *****/
|
||||
HTM_TD_Begin ("class=\"%s LT\"",Open ? "MSG_AUT_BG" :
|
||||
"MSG_AUT_BG_NEW");
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"%s LT\"",Open ? "MSG_AUT_BG" :
|
||||
"MSG_AUT_BG_NEW");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
HTM_TD_End ();
|
||||
/***** Write subject *****/
|
||||
Msg_WriteSentOrReceivedMsgSubject (Messages,MsgCod,Subject,Open,Expanded);
|
||||
|
||||
/***** Write subject *****/
|
||||
Msg_WriteSentOrReceivedMsgSubject (Messages,MsgCod,Subject,Open,Expanded);
|
||||
|
||||
/***** Write date-time *****/
|
||||
Msg_WriteMsgDate (CreatTimeUTC,Open ? "MSG_TIT_BG" :
|
||||
"MSG_TIT_BG_NEW");
|
||||
/***** Write date-time *****/
|
||||
Msg_WriteMsgDate (CreatTimeUTC,Open ? "MSG_TIT_BG" :
|
||||
"MSG_TIT_BG_NEW");
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
|
@ -3341,72 +3344,72 @@ static void Msg_ShowASentOrReceivedMessage (struct Msg_Messages *Messages,
|
|||
{
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("rowspan=\"3\" colspan=\"2\" class=\"LT\"");
|
||||
HTM_TABLE_BeginPadding (2);
|
||||
HTM_TD_Begin ("rowspan=\"3\" colspan=\"2\" class=\"LT\"");
|
||||
HTM_TABLE_BeginPadding (2);
|
||||
|
||||
/***** Write course origin of message *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
FromThisCrs = Msg_WriteCrsOrgMsg (CrsCod);
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
/***** Write course origin of message *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
FromThisCrs = Msg_WriteCrsOrgMsg (CrsCod);
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Form to reply message *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
if (Messages->TypeOfMessages == Msg_RECEIVED &&
|
||||
Gbl.Usrs.Me.Role.Logged >= Rol_USR)
|
||||
// Guests (users without courses) can read messages but not reply them
|
||||
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
/***** Form to reply message *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
if (Messages->TypeOfMessages == Msg_RECEIVED &&
|
||||
Gbl.Usrs.Me.Role.Logged >= Rol_USR)
|
||||
// Guests (users without courses) can read messages but not reply them
|
||||
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
|
||||
HTM_TABLE_End ();
|
||||
HTM_TD_End ();
|
||||
HTM_TABLE_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write "From:" *****/
|
||||
HTM_TD_Begin ("class=\"RT MSG_TIT\"");
|
||||
HTM_TxtColonNBSP (Txt_MSG_From);
|
||||
HTM_TD_End ();
|
||||
/***** Write "From:" *****/
|
||||
HTM_TD_Begin ("class=\"RT MSG_TIT\"");
|
||||
HTM_TxtColonNBSP (Txt_MSG_From);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||
Msg_WriteMsgFrom (Messages,&UsrDat,Deleted);
|
||||
HTM_TD_End ();
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||
Msg_WriteMsgFrom (Messages,&UsrDat,Deleted);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write "To:" *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"RT MSG_TIT\"");
|
||||
HTM_TxtColonNBSP (Txt_MSG_To);
|
||||
HTM_TD_End ();
|
||||
HTM_TD_Begin ("class=\"RT MSG_TIT\"");
|
||||
HTM_TxtColonNBSP (Txt_MSG_To);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||
Msg_WriteMsgTo (Messages,MsgCod);
|
||||
HTM_TD_End ();
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||
Msg_WriteMsgTo (Messages,MsgCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Write "Content:" *****/
|
||||
HTM_TD_Begin ("class=\"RT MSG_TIT\"");
|
||||
HTM_TxtColonNBSP (Txt_MSG_Content);
|
||||
HTM_TD_End ();
|
||||
/***** Initialize media *****/
|
||||
Med_MediaConstructor (&Media);
|
||||
|
||||
/***** Initialize media *****/
|
||||
Med_MediaConstructor (&Media);
|
||||
/***** Get message content and optional media *****/
|
||||
Msg_GetMsgContent (MsgCod,Content,&Media);
|
||||
|
||||
/***** Get message content and optional media *****/
|
||||
Msg_GetMsgContent (MsgCod,Content,&Media);
|
||||
/***** Write "Content:" *****/
|
||||
HTM_TD_Begin ("class=\"RT MSG_TIT\"");
|
||||
HTM_TxtColonNBSP (Txt_MSG_Content);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Show content and media *****/
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"MSG_TXT LT\"");
|
||||
if (Content[0])
|
||||
Msg_WriteMsgContent (Content,Cns_MAX_BYTES_LONG_TEXT,true,false);
|
||||
Med_ShowMedia (&Media,"MSG_IMG_CONT","MSG_IMG");
|
||||
HTM_TD_End ();
|
||||
/***** Show content and media *****/
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"MSG_TXT LT\"");
|
||||
if (Content[0])
|
||||
Msg_WriteMsgContent (Content,Cns_MAX_BYTES_LONG_TEXT,true,false);
|
||||
Med_ShowMedia (&Media,"MSG_IMG_CONT","MSG_IMG");
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
|
@ -3847,7 +3850,9 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod)
|
|||
OpenByDst = (row[2][0] == 'Y');
|
||||
|
||||
/* Get user's data */
|
||||
UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Put an icon to show if user has read the message */
|
||||
Title = OpenByDst ? (Deleted ? Txt_MSG_Open_and_deleted :
|
||||
|
@ -4046,7 +4051,9 @@ void Msg_BanSenderWhenShowingMsgs (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Lay_ShowErrorAndExit ("Sender does not exist.");
|
||||
|
||||
/***** Insert pair (sender's code - my code) in table of banned senders if not inserted *****/
|
||||
|
@ -4104,7 +4111,9 @@ static void Msg_UnbanSender (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Lay_ShowErrorAndExit ("Sender does not exist.");
|
||||
|
||||
/***** Remove pair (sender's code - my code) from table of banned senders *****/
|
||||
|
@ -4198,27 +4207,29 @@ void Msg_ListBannedUsrs (void)
|
|||
UsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
||||
|
||||
/* Get user's data from database */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Put form to unban user */
|
||||
HTM_TD_Begin ("class=\"BM\"");
|
||||
Frm_BeginForm (ActUnbUsrLst);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat.EnUsrCod);
|
||||
Ico_PutIconLink ("lock.svg",Txt_Sender_banned_click_to_unban_him);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Put form to unban user */
|
||||
HTM_TD_Begin ("class=\"BM\"");
|
||||
Frm_BeginForm (ActUnbUsrLst);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat.EnUsrCod);
|
||||
Ico_PutIconLink ("lock.svg",Txt_Sender_banned_click_to_unban_him);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Show photo */
|
||||
HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\"");
|
||||
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
|
||||
HTM_TD_End ();
|
||||
/* Show photo */
|
||||
HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\"");
|
||||
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Write user's full name */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
HTM_Txt (UsrDat.FullName);
|
||||
HTM_TD_End ();
|
||||
/* Write user's full name */
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
HTM_Txt (UsrDat.FullName);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
|
|||
Nck_PutParamsRemoveMyNick,row[0]);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActRemOldNicStd;
|
||||
|
@ -304,7 +304,7 @@ static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
|
|||
Frm_StartFormAnchor (ActChgMyNck,Nck_NICKNAME_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActChgNicStd;
|
||||
|
@ -351,7 +351,7 @@ static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
|
|||
Frm_StartFormAnchor (ActChgMyNck,Nck_NICKNAME_SECTION_ID);
|
||||
else
|
||||
{
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActChgNicStd;
|
||||
|
|
|
@ -761,7 +761,9 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
|
|||
AuthorClass[Status]);
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the autor
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get author's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Usr_WriteFirstNameBRSurnames (&UsrDat);
|
||||
Usr_UsrDataDestructor (&UsrDat);
|
||||
HTM_DIV_End ();
|
||||
|
|
|
@ -417,7 +417,9 @@ void Ntf_ShowMyNotifications (void)
|
|||
|
||||
/* Get (from) user code (row[1]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get user's data from the database
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Get institution code (row[2]) */
|
||||
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
@ -1502,7 +1504,9 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
/* Get next user */
|
||||
UsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get user's data from the database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if ((UsrDat.NtfEvents.CreateNotif & NotifyEventMask)) // Create notification
|
||||
{
|
||||
if ((UsrDat.NtfEvents.SendEmail & NotifyEventMask)) // Send notification by email
|
||||
|
@ -1614,7 +1618,9 @@ void Ntf_SendPendingNotifByEMailToAllUsrs (void)
|
|||
UsrDat.UsrCod = DB_GetNextCode (mysql_res);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get user's data from the database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Send one email to this user */
|
||||
Ntf_SendPendingNotifByEMailToOneUsr (&UsrDat,&NumNotif,&NumMails);
|
||||
|
@ -1736,7 +1742,9 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
|
||||
/* Get origin user code (row[1]) */
|
||||
FromUsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FromUsrDat,Usr_DONT_GET_PREFS); // Get origin user's data from the database
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FromUsrDat, // Get origin user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Get institution code (row[2]) */
|
||||
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
|
|
@ -371,7 +371,9 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
|
|||
NumUsr++)
|
||||
{
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod = ListUsrCods.Lst[NumUsr];
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_DONT_GET_PREFS); // Get my data
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, // Get my data
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
if (Gbl.Usrs.Me.UsrDat.Email[0])
|
||||
switch ((ReturnCode = Pwd_SendNewPasswordByEmail (NewRandomPlainPassword)))
|
||||
|
@ -816,7 +818,7 @@ void Pwd_ShowFormChgOtherUsrPwd (void)
|
|||
|
||||
/***** Form to change password *****/
|
||||
/* Begin form */
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActChgPwdStd;
|
||||
|
|
24
swad_photo.c
24
swad_photo.c
|
@ -159,7 +159,7 @@ bool Pho_ICanChangeOtherUsrPhoto (struct UsrData *UsrDat)
|
|||
{
|
||||
case Rol_TCH:
|
||||
/* A teacher can change the photo of confirmed students */
|
||||
if (UsrDat->Roles.InCurrentCrs.Role != Rol_STD) // Not a student
|
||||
if (UsrDat->Roles.InCurrentCrs != Rol_STD) // Not a student
|
||||
return false;
|
||||
|
||||
/* It's a student in this course,
|
||||
|
@ -206,7 +206,7 @@ void Pho_PutIconToChangeUsrPhoto (void)
|
|||
PhotoExists = Pho_BuildLinkToPhoto (Gbl.Record.UsrDat,PhotoURL);
|
||||
TitleText = PhotoExists ? Txt_Change_photo :
|
||||
Txt_Upload_photo;
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActReqStdPho;
|
||||
|
@ -257,7 +257,7 @@ static void Pho_PutIconToRequestRemoveOtherUsrPhoto (__attribute__((unused)) voi
|
|||
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||
if (PhotoExists)
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActReqRemStdPho;
|
||||
|
@ -329,7 +329,7 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat)
|
|||
Frm_BeginForm (ActDetMyPho);
|
||||
else
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActDetStdPho;
|
||||
|
@ -415,7 +415,9 @@ void Pho_RecOtherUsrPhotoDetFaces (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/***** Receive photo *****/
|
||||
if (!Pho_ReceivePhotoAndDetectFaces (false,&Gbl.Usrs.Other.UsrDat))
|
||||
|
@ -500,7 +502,9 @@ void Pho_ReqRemoveUsrPhoto (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
|
@ -517,7 +521,7 @@ void Pho_ReqRemoveUsrPhoto (void)
|
|||
"PHOTO186x248",Pho_NO_ZOOM,false);
|
||||
|
||||
/* End alert */
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActRemStdPho;
|
||||
|
@ -557,7 +561,9 @@ void Pho_RemoveUsrPhoto (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/***** Remove photo *****/
|
||||
if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat))
|
||||
|
@ -692,7 +698,7 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
Frm_BeginForm (ActUpdMyPho);
|
||||
else
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActUpdStdPho;
|
||||
|
|
|
@ -245,7 +245,9 @@ void Prf_GetUsrDatAndShowUserProfile (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Show profile and timeline *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
/* Show profile */
|
||||
if (Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
|
@ -314,9 +316,8 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
|
|||
Gbl.Hierarchy.Level == Hie_Lvl_CRS) // ...and a course is selected
|
||||
{
|
||||
/* Get user's role in current course */
|
||||
UsrDat->Roles.InCurrentCrs.Role = Rol_GetRoleUsrInCrs (UsrDat->UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
UsrDat->Roles.InCurrentCrs = Rol_GetRoleUsrInCrs (UsrDat->UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/* Get if user has accepted enrolment in current course */
|
||||
UsrDat->Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (UsrDat);
|
||||
|
@ -1637,7 +1638,9 @@ void Prf_ShowRankingFigure (MYSQL_RES **mysql_res,unsigned NumUsrs)
|
|||
|
||||
/* Get user's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
ItsMe = (UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/* Get figure (row[1]) */
|
||||
|
@ -1851,7 +1854,9 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
|
||||
/* Get user's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
ItsMe = (UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/* Get average number of clicks per day (row[1]) */
|
||||
|
|
|
@ -2122,7 +2122,9 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
|
|||
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Start row for this user */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -2224,7 +2226,9 @@ static void Prj_ShowTableAllProjectsMembersWithARole (const struct Prj_Project *
|
|||
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Write user's name in "Surname1 Surname2, FirstName" format */
|
||||
HTM_LI_Begin (NULL);
|
||||
|
@ -2517,7 +2521,9 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInProject)
|
|||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Add user to project */
|
||||
DB_QueryREPLACE ("can not add user to project",
|
||||
|
|
|
@ -986,7 +986,9 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get guest's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Begin container for this user */
|
||||
snprintf (RecordSectionId,sizeof (RecordSectionId),"record_%u",NumUsr);
|
||||
|
@ -1032,7 +1034,9 @@ void Rec_GetUsrAndShowRecOneStdCrs (void)
|
|||
/***** Get the selected student *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Get student's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat))
|
||||
Rec_ShowRecordOneStdCrs ();
|
||||
}
|
||||
|
@ -1184,7 +1188,9 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get student's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
{
|
||||
/* Check if this user has accepted
|
||||
|
@ -1255,7 +1261,9 @@ void Rec_GetUsrAndShowRecOneTchCrs (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Show the record *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the teacher
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Get teacher's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat))
|
||||
Rec_ShowRecordOneTchCrs ();
|
||||
}
|
||||
|
@ -1403,7 +1411,9 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get teacher's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
{
|
||||
/* Check if this user has accepted
|
||||
|
@ -1595,7 +1605,9 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
|
|||
|
||||
/***** Get the user whose record we want to modify *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Get list of fields of records in current course *****/
|
||||
Rec_GetListRecordFieldsInCurrentCrs ();
|
||||
|
@ -2059,9 +2071,8 @@ void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t Default
|
|||
/* In this case UsrDat->Roles.InCurrentCrsDB
|
||||
is not the current role in current course.
|
||||
Instead it is initialized with the preferred role. */
|
||||
UsrDat->Roles.InCurrentCrs.Role = (Gbl.Hierarchy.Level == Hie_Lvl_CRS) ? DefaultRole : // Course selected
|
||||
Rol_UNK; // No course selected
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
UsrDat->Roles.InCurrentCrs = (Gbl.Hierarchy.Level == Hie_Lvl_CRS) ? DefaultRole : // Course selected
|
||||
Rol_UNK; // No course selected
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL);
|
||||
}
|
||||
|
||||
|
@ -2098,7 +2109,9 @@ void Rec_ShowMySharedRecordUpd (void)
|
|||
void Rec_ShowSharedRecordUnmodifiable (struct UsrData *UsrDat)
|
||||
{
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS);
|
||||
UsrDat->Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (UsrDat);
|
||||
|
||||
/***** Show user's record *****/
|
||||
|
@ -2187,16 +2200,16 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
|||
UsrDat->Accepted);
|
||||
ShowIDRows = (TypeOfView != Rec_SHA_RECORD_PUBLIC);
|
||||
|
||||
StudentInCurrentCrs = UsrDat->Roles.InCurrentCrs.Role == Rol_STD;
|
||||
TeacherInCurrentCrs = UsrDat->Roles.InCurrentCrs.Role == Rol_NET ||
|
||||
UsrDat->Roles.InCurrentCrs.Role == Rol_TCH;
|
||||
StudentInCurrentCrs = UsrDat->Roles.InCurrentCrs == Rol_STD;
|
||||
TeacherInCurrentCrs = UsrDat->Roles.InCurrentCrs == Rol_NET ||
|
||||
UsrDat->Roles.InCurrentCrs == Rol_TCH;
|
||||
|
||||
ShowAddressRows = (TypeOfView == Rec_SHA_MY_RECORD_FORM ||
|
||||
((TypeOfView == Rec_SHA_RECORD_LIST ||
|
||||
TypeOfView == Rec_SHA_RECORD_PRINT) &&
|
||||
IAmLoggedAsTeacherOrSysAdm &&
|
||||
StudentInCurrentCrs)); // He/she is a student in the current course
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get user's roles if not got
|
||||
Rol_GetRolesInAllCrss (UsrDat); // Get user's roles if not got
|
||||
ShowTeacherRows = (TypeOfView == Rec_SHA_RECORD_LIST ||
|
||||
TypeOfView == Rec_SHA_RECORD_PRINT) &&
|
||||
TeacherInCurrentCrs; // He/she is a teacher in the current course
|
||||
|
@ -2216,7 +2229,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
|||
break;
|
||||
}
|
||||
|
||||
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrs.Role];
|
||||
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrs];
|
||||
|
||||
PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form
|
||||
Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB; // Only in main browser tab
|
||||
|
@ -2502,7 +2515,7 @@ static void Rec_PutIconsCommands (__attribute__((unused)) void *Args)
|
|||
Gbl.Usrs.Me.Role.Logged == Rol_INS_ADM ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
||||
{
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActReqMdfStd;
|
||||
|
@ -2525,7 +2538,7 @@ static void Rec_PutIconsCommands (__attribute__((unused)) void *Args)
|
|||
|
||||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS) // Course selected
|
||||
{
|
||||
if (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role == Rol_STD) // He/she is a student in current course
|
||||
if (Gbl.Record.UsrDat->Roles.InCurrentCrs == Rol_STD) // He/she is a student in current course
|
||||
{
|
||||
/***** Buttons to view student's test, exam and match results *****/
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (Gbl.Record.UsrDat))
|
||||
|
@ -2910,7 +2923,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
|
|||
{
|
||||
/***** Form to select a role *****/
|
||||
/* Get user's roles if not got */
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
|
||||
Rol_GetRolesInAllCrss (UsrDat);
|
||||
|
||||
/* Label */
|
||||
Frm_LabelColumn ("REC_C1_BOT RM","Role",Txt_Role);
|
||||
|
@ -2947,12 +2960,12 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
|
|||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS) // Course selected
|
||||
{
|
||||
/***** Set default role *****/
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD: // Student in current course
|
||||
case Rol_NET: // Non-editing teacher in current course
|
||||
case Rol_TCH: // Teacher in current course
|
||||
DefaultRoleInForm = UsrDat->Roles.InCurrentCrs.Role;
|
||||
DefaultRoleInForm = UsrDat->Roles.InCurrentCrs;
|
||||
break;
|
||||
default: // User does not belong to current course
|
||||
/* If there is a request of this user, default role is the requested role */
|
||||
|
@ -3137,7 +3150,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
|
|||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
||||
HTM_Txt (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs.Role][UsrDat->Sex]);
|
||||
HTM_Txt (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs][UsrDat->Sex]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
|
@ -3773,7 +3786,7 @@ void Rec_ShowMySharedRecordAndMore (void)
|
|||
bool IAmATeacher;
|
||||
|
||||
/***** Get my roles if not yet got *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
||||
|
||||
/***** Check if I am a teacher *****/
|
||||
IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | // I am a non-editing teacher...
|
||||
|
|
29
swad_role.c
29
swad_role.c
|
@ -85,14 +85,11 @@ void Rol_SetMyRoles (void)
|
|||
bool ICanBeDegAdm = false;
|
||||
|
||||
/***** Get my role in current course if not yet filled *****/
|
||||
if (!Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Filled)
|
||||
{
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role = Rol_GetMyRoleInCrs (Gbl.Hierarchy.Crs.CrsCod);
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Filled = true;
|
||||
}
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs == Rol_UNK)
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs = Rol_GetMyRoleInCrs (Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Set the user's role I am logged *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got
|
||||
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got
|
||||
Gbl.Usrs.Me.Role.Max = Rol_GetMaxRoleInCrss ((unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss);
|
||||
|
||||
/***** Set the user's role I am logged *****/
|
||||
|
@ -101,17 +98,17 @@ void Rol_SetMyRoles (void)
|
|||
// 2. If it is not known, it will be retrieved from current session
|
||||
// 3. If a course is selected, it will be retrieved from my role in this course
|
||||
// 4. If none of the former options is satisfied, it will be set to user role
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_UNK) // No role from last data
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_UNK) // No role from last data
|
||||
{
|
||||
if (Gbl.Usrs.Me.Role.FromSession == Rol_UNK) // No role from session
|
||||
if (Gbl.Usrs.Me.Role.FromSession == Rol_UNK) // No role from session
|
||||
{
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_UNK) // No role in current course
|
||||
Gbl.Usrs.Me.Role.Logged = Rol_USR; // User
|
||||
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs == Rol_UNK) // No role in current course
|
||||
Gbl.Usrs.Me.Role.Logged = Rol_USR; // User
|
||||
else
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role; // Role in current course
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs; // Role in current course
|
||||
}
|
||||
else
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.Role.FromSession; // Role from session
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.Role.FromSession; // Role from session
|
||||
}
|
||||
|
||||
/***** Check if I am administrator of current institution/center/degree *****/
|
||||
|
@ -187,7 +184,7 @@ void Rol_SetMyRoles (void)
|
|||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS)
|
||||
{
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
Gbl.Usrs.Me.Role.Available = (1 << Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role);
|
||||
Gbl.Usrs.Me.Role.Available = (1 << Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs);
|
||||
else if (Gbl.Usrs.Me.Role.Max >= Rol_STD)
|
||||
Gbl.Usrs.Me.Role.Available = (1 << Rol_USR);
|
||||
else
|
||||
|
@ -428,7 +425,7 @@ Rol_Role_t Rol_GetRoleUsrInCrs (long UsrCod,long CrsCod)
|
|||
// Roles >=0 ==> already filled/calculated ==> nothing to do
|
||||
// Roles <0 ==> not yet filled/calculated ==> get roles
|
||||
|
||||
void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat)
|
||||
void Rol_GetRolesInAllCrss (struct UsrData *UsrDat)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -497,7 +494,9 @@ void Rol_PutFormToChangeMyRole (const char *ClassSelect)
|
|||
unsigned RoleUnsigned;
|
||||
bool PutClassSelect;
|
||||
|
||||
/***** Begin form *****/
|
||||
Frm_BeginForm (ActChgMyRol);
|
||||
|
||||
PutClassSelect = false;
|
||||
if (ClassSelect)
|
||||
if (ClassSelect[0])
|
||||
|
@ -519,6 +518,8 @@ void Rol_PutFormToChangeMyRole (const char *ClassSelect)
|
|||
"%s",Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
}
|
||||
HTM_SELECT_End ();
|
||||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void Rol_FlushCacheMyRoleInCurrentCrs (void);
|
|||
Rol_Role_t Rol_GetMyRoleInCrs (long CrsCod);
|
||||
void Rol_FlushCacheRoleUsrInCrs (void);
|
||||
Rol_Role_t Rol_GetRoleUsrInCrs (long UsrCod,long CrsCod);
|
||||
void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat);
|
||||
void Rol_GetRolesInAllCrss (struct UsrData *UsrDat);
|
||||
|
||||
Rol_Role_t Rol_ConvertUnsignedStrToRole (const char *UnsignedStr);
|
||||
unsigned Rol_ConvertUnsignedStrToRoles (const char *UnsignedStr);
|
||||
|
|
|
@ -1708,7 +1708,7 @@ static void Sta_ShowDetailedAccessesList (const struct Sta_Stats *Stats,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows back *****/
|
||||
for (NumRow = LastRow, UniqueId = 1, Gbl.RowEvenOdd = 0;
|
||||
for (NumRow = LastRow, UniqueId = 1, Gbl.RowEvenOdd = 0;
|
||||
NumRow >= FirstRow;
|
||||
NumRow--, UniqueId++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
|
||||
{
|
||||
|
@ -1720,7 +1720,9 @@ static void Sta_ShowDetailedAccessesList (const struct Sta_Stats *Stats,
|
|||
|
||||
/* Get user's data of the database */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Get logged role */
|
||||
if (sscanf (row[2],"%u",&RoleFromLog) != 1)
|
||||
|
@ -1848,7 +1850,9 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
|
|||
|
||||
/* Get user's data from the database */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get the data of the user from the database
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -1875,7 +1879,7 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
|
|||
|
||||
/* Write user's role */
|
||||
HTM_TD_Begin ("class=\"LOG CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
HTM_TxtF ("%s ",Txt_ROLES_SINGUL_Abc[UsrDat.Roles.InCurrentCrs.Role][UsrDat.Sex]);
|
||||
HTM_TxtF ("%s ",Txt_ROLES_SINGUL_Abc[UsrDat.Roles.InCurrentCrs][UsrDat.Sex]);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Write the number of clicks */
|
||||
|
@ -1895,8 +1899,8 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
|
|||
if (BarWidth)
|
||||
{
|
||||
HTM_IMG (Cfg_URL_ICON_PUBLIC,
|
||||
UsrDat.Roles.InCurrentCrs.Role == Rol_STD ? "o1x1.png" : // Student
|
||||
"r1x1.png", // Non-editing teacher or teacher
|
||||
UsrDat.Roles.InCurrentCrs == Rol_STD ? "o1x1.png" : // Student
|
||||
"r1x1.png", // Non-editing teacher or teacher
|
||||
NULL,
|
||||
"class=\"LT\" style=\"width:%upx; height:10px; padding-top:4px;\"",
|
||||
BarWidth);
|
||||
|
|
|
@ -746,7 +746,9 @@ void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const char *T
|
|||
if (!ItsMe) // Not me
|
||||
{
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Create notification for the mentioned user *****/
|
||||
CreateNotif = (UsrDat.NtfEvents.CreateNotif & (1 << Ntf_EVENT_TL_MENTION));
|
||||
|
|
|
@ -1973,7 +1973,9 @@ static void TstPrn_ShowUsrsPrints (__attribute__((unused)) void *Args)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show test exams *****/
|
||||
|
@ -2382,7 +2384,6 @@ void TstPrn_ShowOnePrint (void)
|
|||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests_results;
|
||||
extern const char *Txt_Result;
|
||||
extern const char *Txt_The_user_does_not_exist;
|
||||
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||
extern const char *Txt_Questions;
|
||||
|
@ -2427,8 +2428,10 @@ void TstPrn_ShowOnePrint (void)
|
|||
|
||||
/***** User *****/
|
||||
/* Get data of the user who made the test */
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
Lay_WrongUserExit ();
|
||||
if (!Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat))
|
||||
Lay_NoPermissionExit ();
|
||||
|
||||
|
@ -2436,7 +2439,7 @@ void TstPrn_ShowOnePrint (void)
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT_N RT\"");
|
||||
HTM_TxtColon (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Other.UsrDat.Sex]);
|
||||
HTM_TxtColon (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs][Gbl.Usrs.Other.UsrDat.Sex]);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||
|
|
|
@ -554,7 +554,9 @@ static void Tml_Com_WriteComm (const struct Tml_Timeline *Timeline,
|
|||
/***** Get author's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Com->UsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Left: author's photo *****/
|
||||
Tml_Com_ShowAuthorPhoto (&UsrDat);
|
||||
|
|
|
@ -257,7 +257,9 @@ static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherC
|
|||
|
||||
/***** Get user's data *****/
|
||||
PublisherDat.UsrCod = PublisherCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherDat,Usr_DONT_GET_PREFS)) // Really we only need EncryptedUsrCod and FullName
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherDat, // Really we only need EncryptedUsrCod and FullName
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/***** Begin container *****/
|
||||
HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER TL_WIDTH\"");
|
||||
|
@ -300,7 +302,9 @@ static void Tml_Not_WriteNote (const struct Tml_Timeline *Timeline,
|
|||
/***** Get author data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Not->UsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Left top: author's photo *****/
|
||||
Tml_Not_ShowAuthorPhoto (&UsrDat,true); // Use unique id
|
||||
|
|
|
@ -73,7 +73,9 @@ void Tml_Ntf_CreateNotifToAuthor (long AuthorCod,long PubCod,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
UsrDat.UsrCod = AuthorCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/***** This fav must be notified by email? *****/
|
||||
CreateNotif = (UsrDat.NtfEvents.CreateNotif & (1 << NotifyEvent));
|
||||
|
|
|
@ -213,7 +213,9 @@ static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
|
|||
UsrDat.UsrCod = DB_GetNextCode (*mysql_res);
|
||||
|
||||
/***** Get user's data and show user's photo *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
/* Begin container */
|
||||
HTM_DIV_Begin ("class=\"TL_SHARER\"");
|
||||
|
|
254
swad_user.c
254
swad_user.c
|
@ -323,9 +323,8 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
|
|||
UsrDat->EnUsrCod[0] = '\0';
|
||||
UsrDat->Nickname[0] = '\0';
|
||||
UsrDat->Password[0] = '\0';
|
||||
UsrDat->Roles.InCurrentCrs.Role = Rol_UNK;
|
||||
UsrDat->Roles.InCurrentCrs.Filled = false;
|
||||
UsrDat->Roles.InCrss = -1; // < 0 ==> not yet got from database
|
||||
UsrDat->Roles.InCurrentCrs = Rol_UNK;// not yet got from database
|
||||
UsrDat->Roles.InCrss = -1; // not yet got from database
|
||||
UsrDat->Accepted = false;
|
||||
|
||||
UsrDat->Sex = Usr_SEX_UNKNOWN;
|
||||
|
@ -407,10 +406,12 @@ void Usr_UsrDataDestructor (struct UsrData *UsrDat)
|
|||
/*****************************************************************************/
|
||||
// Input: UsrDat->UsrCod must hold user's code
|
||||
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,
|
||||
Usr_GetPrefs_t GetPrefs,
|
||||
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs)
|
||||
{
|
||||
ID_GetListIDsFromUsrCod (UsrDat);
|
||||
Usr_GetUsrDataFromUsrCod (UsrDat,GetPrefs);
|
||||
Usr_GetUsrDataFromUsrCod (UsrDat,GetPrefs,GetRoleInCurrentCrs);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -484,11 +485,12 @@ void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat)
|
|||
/*****************************************************************************/
|
||||
// UsrDat->UsrCod must contain an existing user's code
|
||||
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,
|
||||
Usr_GetPrefs_t GetPrefs,
|
||||
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs)
|
||||
{
|
||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||
extern const char *Txt_The_user_does_not_exist;
|
||||
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -577,7 +579,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
|||
}
|
||||
|
||||
if (NumRows != 1)
|
||||
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
|
||||
Lay_WrongUserExit ();
|
||||
|
||||
/***** Read user's data *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -589,11 +591,19 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
|||
Str_Copy (UsrDat->Password,row[1],sizeof (UsrDat->Password) - 1);
|
||||
|
||||
/* Get roles */
|
||||
UsrDat->Roles.InCurrentCrs.Role = Rol_GetRoleUsrInCrs (UsrDat->UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
UsrDat->Roles.InCurrentCrs.Filled = true;
|
||||
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
|
||||
switch (GetRoleInCurrentCrs)
|
||||
{
|
||||
case Usr_DONT_GET_ROLE_IN_CURRENT_CRS:
|
||||
UsrDat->Roles.InCurrentCrs = Rol_UNK;
|
||||
UsrDat->Roles.InCrss = -1;
|
||||
break;
|
||||
case Usr_GET_ROLE_IN_CURRENT_CRS:
|
||||
UsrDat->Roles.InCurrentCrs = Rol_GetRoleUsrInCrs (UsrDat->UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
|
||||
// Rol_GetRolesInAllCrss (UsrDat);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get name (row[2], row[3], row[4]) */
|
||||
Str_Copy (UsrDat->Surname1,row[2],sizeof (UsrDat->Surname1) - 1);
|
||||
|
@ -1197,7 +1207,7 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 4. Fast check: Is he/she a student? *****/
|
||||
if (UsrDat->Roles.InCurrentCrs.Role != Rol_STD)
|
||||
if (UsrDat->Roles.InCurrentCrs != Rol_STD)
|
||||
return false;
|
||||
|
||||
/***** 5. Fast check: Am I a system admin? *****/
|
||||
|
@ -1252,8 +1262,8 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 4. Fast check: Is he/she a non-editing teacher or a teacher? *****/
|
||||
return (UsrDat->Roles.InCurrentCrs.Role == Rol_NET ||
|
||||
UsrDat->Roles.InCurrentCrs.Role == Rol_TCH);
|
||||
return (UsrDat->Roles.InCurrentCrs == Rol_NET ||
|
||||
UsrDat->Roles.InCurrentCrs == Rol_TCH);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1462,7 +1472,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
|
|||
return true;
|
||||
|
||||
/***** 6. Fast/slow check: Does he/she belong to any course? *****/
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
|
||||
Rol_GetRolesInAllCrss (UsrDat);
|
||||
if (!(UsrDat->Roles.InCrss & ((1 << Rol_STD) | // Any of his/her roles is student
|
||||
(1 << Rol_NET) | // or non-editing teacher
|
||||
(1 << Rol_TCH)))) // or teacher?
|
||||
|
@ -1734,71 +1744,70 @@ void Usr_GetMyCourses (void)
|
|||
unsigned NumCrs;
|
||||
long CrsCod;
|
||||
|
||||
/***** If my courses are yet filled, there's nothing to do *****/
|
||||
if (!Gbl.Usrs.Me.MyCrss.Filled)
|
||||
/***** Trivial check 1: if my courses are already filled, there's nothing to do *****/
|
||||
if (Gbl.Usrs.Me.MyCrss.Filled)
|
||||
return;
|
||||
|
||||
/***** Trivial check 2: if user's code is not set, don't query database *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod <= 0)
|
||||
return;
|
||||
|
||||
/***** Remove temporary table with my courses *****/
|
||||
Usr_RemoveTemporaryTableMyCourses ();
|
||||
|
||||
/***** Create temporary table with my courses *****/
|
||||
DB_Query ("can not create temporary table",
|
||||
"CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp"
|
||||
" (CrsCod INT NOT NULL,"
|
||||
"Role TINYINT NOT NULL,"
|
||||
"DegCod INT NOT NULL,"
|
||||
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY"
|
||||
" SELECT crs_users.CrsCod,"
|
||||
"crs_users.Role,"
|
||||
"crs_courses.DegCod"
|
||||
" FROM crs_users,"
|
||||
"crs_courses,"
|
||||
"deg_degrees"
|
||||
" WHERE crs_users.UsrCod=%ld"
|
||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" ORDER BY deg_degrees.ShortName,"
|
||||
"crs_courses.ShortName",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Get my courses from database *****/
|
||||
NumCrss = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get which courses you belong to",
|
||||
"SELECT CrsCod," // row[0]
|
||||
"Role," // row[1]
|
||||
"DegCod" // row[2]
|
||||
" FROM my_courses_tmp");
|
||||
for (NumCrs = 0;
|
||||
NumCrs < NumCrss;
|
||||
NumCrs++)
|
||||
{
|
||||
Gbl.Usrs.Me.MyCrss.Num = 0;
|
||||
/* Get next course */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
/* Get course code */
|
||||
CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (CrsCod > 0)
|
||||
{
|
||||
/***** Remove temporary table with my courses *****/
|
||||
Usr_RemoveTemporaryTableMyCourses ();
|
||||
if (Gbl.Usrs.Me.MyCrss.Num == Crs_MAX_COURSES_PER_USR)
|
||||
Lay_ShowErrorAndExit ("Maximum number of courses of a user exceeded.");
|
||||
|
||||
/***** Create temporary table with my courses *****/
|
||||
DB_Query ("can not create temporary table",
|
||||
"CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp"
|
||||
" (CrsCod INT NOT NULL,"
|
||||
"Role TINYINT NOT NULL,"
|
||||
"DegCod INT NOT NULL,"
|
||||
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY"
|
||||
" SELECT crs_users.CrsCod,"
|
||||
"crs_users.Role,"
|
||||
"crs_courses.DegCod"
|
||||
" FROM crs_users,"
|
||||
"crs_courses,"
|
||||
"deg_degrees"
|
||||
" WHERE crs_users.UsrCod=%ld"
|
||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" ORDER BY deg_degrees.ShortName,"
|
||||
"crs_courses.ShortName",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Get my courses from database *****/
|
||||
NumCrss = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get which courses you belong to",
|
||||
"SELECT CrsCod," // row[0]
|
||||
"Role," // row[1]
|
||||
"DegCod" // row[2]
|
||||
" FROM my_courses_tmp");
|
||||
for (NumCrs = 0;
|
||||
NumCrs < NumCrss;
|
||||
NumCrs++)
|
||||
{
|
||||
/* Get next course */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get course code */
|
||||
CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (CrsCod > 0)
|
||||
{
|
||||
if (Gbl.Usrs.Me.MyCrss.Num == Crs_MAX_COURSES_PER_USR)
|
||||
Lay_ShowErrorAndExit ("Maximum number of courses of a user exceeded.");
|
||||
|
||||
Gbl.Usrs.Me.MyCrss.Crss[Gbl.Usrs.Me.MyCrss.Num].CrsCod = CrsCod;
|
||||
Gbl.Usrs.Me.MyCrss.Crss[Gbl.Usrs.Me.MyCrss.Num].Role = Rol_ConvertUnsignedStrToRole (row[1]);
|
||||
Gbl.Usrs.Me.MyCrss.Crss[Gbl.Usrs.Me.MyCrss.Num].DegCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
Gbl.Usrs.Me.MyCrss.Num++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Set boolean that indicates that my courses are already filled *****/
|
||||
Gbl.Usrs.Me.MyCrss.Filled = true;
|
||||
Gbl.Usrs.Me.MyCrss.Crss[Gbl.Usrs.Me.MyCrss.Num].CrsCod = CrsCod;
|
||||
Gbl.Usrs.Me.MyCrss.Crss[Gbl.Usrs.Me.MyCrss.Num].Role = Rol_ConvertUnsignedStrToRole (row[1]);
|
||||
Gbl.Usrs.Me.MyCrss.Crss[Gbl.Usrs.Me.MyCrss.Num].DegCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
Gbl.Usrs.Me.MyCrss.Num++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Set boolean that indicates that my courses are already filled *****/
|
||||
Gbl.Usrs.Me.MyCrss.Filled = true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2079,12 +2088,12 @@ bool Usr_CheckIfUsrBelongsToCurrentCrs (const struct UsrData *UsrDat)
|
|||
return Gbl.Cache.UsrBelongsToCurrentCrs.Belongs;
|
||||
|
||||
/***** 3. Fast check: If we know role of user in the current course *****/
|
||||
if (UsrDat->Roles.InCurrentCrs.Filled)
|
||||
if (UsrDat->Roles.InCurrentCrs != Rol_UNK)
|
||||
{
|
||||
Gbl.Cache.UsrBelongsToCurrentCrs.UsrCod = UsrDat->UsrCod;
|
||||
Gbl.Cache.UsrBelongsToCurrentCrs.Belongs = UsrDat->Roles.InCurrentCrs.Role == Rol_STD ||
|
||||
UsrDat->Roles.InCurrentCrs.Role == Rol_NET ||
|
||||
UsrDat->Roles.InCurrentCrs.Role == Rol_TCH;
|
||||
Gbl.Cache.UsrBelongsToCurrentCrs.Belongs = UsrDat->Roles.InCurrentCrs == Rol_STD ||
|
||||
UsrDat->Roles.InCurrentCrs == Rol_NET ||
|
||||
UsrDat->Roles.InCurrentCrs == Rol_TCH;
|
||||
return Gbl.Cache.UsrBelongsToCurrentCrs.Belongs;
|
||||
}
|
||||
|
||||
|
@ -3006,7 +3015,10 @@ bool Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Check if user exists and get her/his data *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Existing user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
// Existing user
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -3072,6 +3084,7 @@ void Usr_ChkUsrAndGetUsrData (void)
|
|||
if (Usr_ChkUsrAndGetUsrDataFromSession ()) // User logged in
|
||||
{
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
|
||||
Usr_SetMyPrefsAndRoles ();
|
||||
|
||||
if (Gbl.Action.IsAJAXAutoRefresh) // If refreshing ==> don't refresh LastTime in session
|
||||
|
@ -3114,8 +3127,11 @@ void Usr_ChkUsrAndGetUsrData (void)
|
|||
/***** Get user's data *****/
|
||||
Usr_GetParamOtherUsrCodEncrypted (&Gbl.Usrs.Me.UsrDat);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Me.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_GET_PREFS)) // User logged in
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,
|
||||
Usr_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
// User logged in
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Usr_SetMyPrefsAndRoles ();
|
||||
|
||||
|
@ -3283,7 +3299,9 @@ static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void)
|
|||
}
|
||||
|
||||
/***** Get user's data *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_GET_PREFS);
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,
|
||||
Usr_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/***** Check password *****/
|
||||
/* Check user's password:
|
||||
|
@ -3316,7 +3334,9 @@ static bool Usr_ChkUsrAndGetUsrDataFromSession (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod = Gbl.Session.UsrCod;
|
||||
|
||||
/* Check if user exists in database, and get his/her data */
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_GET_PREFS))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,
|
||||
Usr_GET_PREFS,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
Usr_ShowAlertUsrDoesNotExistsOrWrongPassword ();
|
||||
return false;
|
||||
|
@ -3420,10 +3440,7 @@ static void Usr_SetMyPrefsAndRoles (void)
|
|||
|
||||
/* Course may have changed ==> get my role in current course again */
|
||||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS) // Course selected
|
||||
{
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role = Rol_GetMyRoleInCrs (Gbl.Hierarchy.Crs.CrsCod);
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Filled = true;
|
||||
}
|
||||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs = Rol_GetMyRoleInCrs (Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
// role and action will be got from last data
|
||||
GetRoleAndActionFromLastData = true;
|
||||
|
@ -3492,18 +3509,18 @@ void Usr_ShowFormsLogoutAndRole (void)
|
|||
if (Rol_GetNumAvailableRoles () == 1)
|
||||
{
|
||||
HTM_SPAN_Begin ("class=\"DAT\"");
|
||||
HTM_TxtColonNBSP (Txt_Role);
|
||||
HTM_TxtColonNBSP (Txt_Role);
|
||||
HTM_SPAN_End ();
|
||||
|
||||
HTM_SPAN_Begin ("class=\"DAT_N_BOLD\"");
|
||||
HTM_Txt (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
HTM_Txt (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
HTM_SPAN_End ();
|
||||
}
|
||||
else
|
||||
{
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
HTM_TxtColonNBSP (Txt_Role);
|
||||
Rol_PutFormToChangeMyRole (NULL);
|
||||
HTM_TxtColonNBSP (Txt_Role);
|
||||
Rol_PutFormToChangeMyRole (NULL);
|
||||
HTM_LABEL_End ();
|
||||
}
|
||||
|
||||
|
@ -3533,13 +3550,15 @@ static void Usr_PutLinkToLogOut (__attribute__((unused)) void *Args)
|
|||
// Output: When true ==> UsrDat will hold all user's data
|
||||
// When false ==> UsrDat is reset, except user's code
|
||||
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,
|
||||
Usr_GetPrefs_t GetPrefs,
|
||||
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs)
|
||||
{
|
||||
/***** Check if a user exists having this user's code *****/
|
||||
if (Usr_ChkIfUsrCodExists (UsrDat->UsrCod))
|
||||
{
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,GetPrefs);
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,GetPrefs,GetRoleInCurrentCrs);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5658,20 +5677,21 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,Hie_Lvl_Level_
|
|||
/********************** Copy user's basic data from list *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList *UsrInList)
|
||||
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,
|
||||
const struct UsrInList *UsrInList)
|
||||
{
|
||||
UsrDat->UsrCod = UsrInList->UsrCod;
|
||||
UsrDat->UsrCod = UsrInList->UsrCod;
|
||||
Str_Copy (UsrDat->EnUsrCod,UsrInList->EnUsrCod,sizeof (UsrDat->EnUsrCod) - 1);
|
||||
Str_Copy (UsrDat->Surname1,UsrInList->Surname1,sizeof (UsrDat->Surname1) - 1);
|
||||
Str_Copy (UsrDat->Surname2,UsrInList->Surname2,sizeof (UsrDat->Surname2) - 1);
|
||||
Str_Copy (UsrDat->FrstName,UsrInList->FrstName,sizeof (UsrDat->FrstName) - 1);
|
||||
UsrDat->Sex = UsrInList->Sex;
|
||||
UsrDat->Sex = UsrInList->Sex;
|
||||
Str_Copy (UsrDat->Photo ,UsrInList->Photo ,sizeof (UsrDat->Photo ) - 1);
|
||||
UsrDat->PhotoVisibility = UsrInList->PhotoVisibility;
|
||||
UsrDat->CtyCod = UsrInList->CtyCod;
|
||||
UsrDat->InsCod = UsrInList->InsCod;
|
||||
UsrDat->Roles.InCurrentCrs.Role = UsrInList->RoleInCurrentCrsDB;
|
||||
UsrDat->Accepted = UsrInList->Accepted;
|
||||
UsrDat->PhotoVisibility = UsrInList->PhotoVisibility;
|
||||
UsrDat->CtyCod = UsrInList->CtyCod;
|
||||
UsrDat->InsCod = UsrInList->InsCod;
|
||||
UsrDat->Roles.InCurrentCrs = UsrInList->RoleInCurrentCrsDB;
|
||||
UsrDat->Accepted = UsrInList->Accepted;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -6036,7 +6056,9 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
|||
if (ListUsrCods.NumUsrs == 1) // Only if user is valid
|
||||
{
|
||||
/* Get user's data */
|
||||
Usr_GetUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Really only EncryptedUsrCod is needed
|
||||
Usr_GetUsrDataFromUsrCod (&UsrDat, // Really only EncryptedUsrCod is needed
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
||||
/* Find if encrypted user's code is already in list */
|
||||
if (!Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (UsrDat.EnUsrCod,&Gbl.Usrs.Selected)) // If not in list ==> add it
|
||||
|
@ -7021,7 +7043,9 @@ void Usr_ListAllDataGsts (void)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_GST].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
UsrDat.Accepted = false; // Guests have no courses,...
|
||||
// ...so they have not accepted...
|
||||
|
@ -7215,7 +7239,9 @@ void Usr_ListAllDataStds (void)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].Accepted;
|
||||
NumUsr++;
|
||||
|
@ -7278,7 +7304,9 @@ static void Usr_ListUsrsForSelection (Rol_Role_t Role,
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted;
|
||||
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,true,Role,SelectedUsrs);
|
||||
|
@ -7414,7 +7442,9 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role,
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted;
|
||||
NumUsr++;
|
||||
|
@ -7659,7 +7689,9 @@ void Usr_ListDataAdms (void)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].Accepted;
|
||||
Usr_WriteRowAdmData (++NumUsr,&UsrDat);
|
||||
|
@ -10131,7 +10163,9 @@ void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
|
|||
|
||||
/***** Get data of author *****/
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
|
||||
|
||||
/***** Show photo *****/
|
||||
|
@ -10175,7 +10209,7 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
|
|||
HTM_TD_Begin ("class=\"LT LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
/* Action to go to user's record depending on role in course */
|
||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||
switch (UsrDat->Roles.InCurrentCrs)
|
||||
{
|
||||
case Rol_STD:
|
||||
NextAction = ActSeeRecOneStd;
|
||||
|
|
28
swad_user.h
28
swad_user.h
|
@ -94,6 +94,13 @@ typedef enum
|
|||
Usr_GET_PREFS = 1,
|
||||
} Usr_GetPrefs_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS = 0,
|
||||
Usr_GET_ROLE_IN_CURRENT_CRS = 1,
|
||||
} Usr_GetRoleInCurrentCrs_t;
|
||||
|
||||
|
||||
// Related with user's sexs
|
||||
#define Usr_NUM_SEXS 4 // Unknown, female, male, all
|
||||
typedef enum
|
||||
|
@ -169,11 +176,7 @@ struct UsrData
|
|||
char Password [Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool Filled; // Role is valid (is already filled)?
|
||||
Rol_Role_t Role;
|
||||
} InCurrentCrs; // Role in current course (Rol_UNK is no course selected)
|
||||
Rol_Role_t InCurrentCrs; // Role in current course (Rol_UNK is not filled/calculated or no course selected)
|
||||
int InCrss; // Roles in all his/her courses
|
||||
// Check always if filled/calculated
|
||||
// >=0 ==> filled/calculated
|
||||
|
@ -285,12 +288,16 @@ void Usr_UsrDataConstructor (struct UsrData *UsrDat);
|
|||
void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat);
|
||||
void Usr_ResetMyLastData (void);
|
||||
void Usr_UsrDataDestructor (struct UsrData *UsrDat);
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,
|
||||
Usr_GetPrefs_t GetPrefs,
|
||||
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs);
|
||||
void Usr_AllocateListUsrCods (struct ListUsrCods *ListUsrCods);
|
||||
void Usr_FreeListUsrCods (struct ListUsrCods *ListUsrCods);
|
||||
bool Usr_ItsMe (long UsrCod);
|
||||
void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat);
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,
|
||||
Usr_GetPrefs_t GetPrefs,
|
||||
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs);
|
||||
|
||||
void Usr_BuildFullName (struct UsrData *UsrDat);
|
||||
|
||||
|
@ -395,7 +402,9 @@ void Usr_ChkUsrAndGetUsrData (void);
|
|||
|
||||
void Usr_ShowFormsLogoutAndRole (void);
|
||||
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,
|
||||
Usr_GetPrefs_t GetPrefs,
|
||||
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs);
|
||||
void Usr_UpdateMyLastData (void);
|
||||
void Usr_InsertMyLastCrsTabAndTime (void);
|
||||
|
||||
|
@ -436,7 +445,8 @@ void Usr_DropTmpTableWithCandidateUsrs (void);
|
|||
|
||||
void Usr_GetUnorderedStdsCodesInDeg (long DegCod);
|
||||
|
||||
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList *UsrInList);
|
||||
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,
|
||||
const struct UsrInList *UsrInList);
|
||||
void Usr_FreeUsrsList (Rol_Role_t Role);
|
||||
|
||||
bool Usr_GetIfShowBigList (unsigned NumUsrs,
|
||||
|
|
|
@ -157,7 +157,9 @@ void ZIP_CreateZIPAsgWrk (void)
|
|||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get user's data from database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
ZIP_CreateDirCompressionUsr (&UsrDat);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue