Version 18.3.8

This commit is contained in:
Antonio Cañas Vargas 2018-10-10 14:03:06 +02:00
parent 4213377b2c
commit 43f6a24a45
16 changed files with 198 additions and 149 deletions

View File

@ -401,7 +401,9 @@ void ID_WriteUsrIDs (struct UsrData *UsrDat,const char *Anchor)
bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat) bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
{ {
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** Check if I have permission to see another user's IDs *****/ /***** Check if I have permission to see another user's IDs *****/
@ -503,14 +505,15 @@ void ID_PutLinkToChangeUsrIDs (void)
{ {
extern const char *Txt_Change_IDs; extern const char *Txt_Change_IDs;
Act_Action_t NextAction; Act_Action_t NextAction;
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Link for changing the password *****/ /***** Link for changing the password *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me if (ItsMe)
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL, Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
"arroba64x64.gif", "arroba64x64.gif",
Txt_Change_IDs,Txt_Change_IDs, Txt_Change_IDs,Txt_Change_IDs,
NULL); NULL);
else // Not me else // Not me
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role) switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
{ {
@ -541,6 +544,7 @@ void ID_ShowFormOthIDs (void)
{ {
extern const char *Txt_ID; extern const char *Txt_ID;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
/***** Get user whose password must be changed *****/ /***** Get user whose password must be changed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
@ -557,8 +561,8 @@ void ID_ShowFormOthIDs (void)
/***** Form with the user's ID *****/ /***** Form with the user's ID *****/
Tbl_StartTableWide (2); Tbl_StartTableWide (2);
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat, ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
Tbl_EndTable (); Tbl_EndTable ();
/***** End box *****/ /***** End box *****/
@ -583,7 +587,6 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
extern const char *Txt_ID_X_not_confirmed; extern const char *Txt_ID_X_not_confirmed;
extern const char *Txt_Another_ID; extern const char *Txt_Another_ID;
extern const char *Txt_Add_this_ID; extern const char *Txt_Add_this_ID;
extern const char *Txt_If_there_are_multiple_versions_of_the_ID_;
extern const char *Txt_The_ID_is_used_in_order_to_facilitate_; extern const char *Txt_The_ID_is_used_in_order_to_facilitate_;
unsigned NumID; unsigned NumID;
Act_Action_t NextAction; Act_Action_t NextAction;
@ -665,9 +668,16 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
"</tr>"); "</tr>");
} }
/***** Form to enter new user's ID *****/
if (UsrDat->IDs.Num < ID_MAX_IDS_PER_USER) if (UsrDat->IDs.Num < ID_MAX_IDS_PER_USER)
{ {
/***** Write help text *****/
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\" class=\"DAT CENTER_MIDDLE\">");
Ale_ShowAlert (Ale_INFO,Txt_The_ID_is_used_in_order_to_facilitate_);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/***** Form to enter new user's ID *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"RIGHT_MIDDLE\">" "<td class=\"RIGHT_MIDDLE\">"
"<label for=\"NewID\" class=\"%s\">%s:</label>" "<label for=\"NewID\" class=\"%s\">%s:</label>"
@ -706,19 +716,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Btn_PutCreateButtonInline (Txt_Add_this_ID); Btn_PutCreateButtonInline (Txt_Add_this_ID);
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>" "</tr>");
"<tr>");
} }
/***** Write help text *****/
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"DAT CENTER_MIDDLE\">");
if (ItsMe)
fprintf (Gbl.F.Out,"%s ",
Txt_The_ID_is_used_in_order_to_facilitate_);
fprintf (Gbl.F.Out,"%s"
"</td>"
"</tr>",
Txt_If_there_are_multiple_versions_of_the_ID_);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -728,7 +727,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
void ID_RemoveMyUsrID (void) void ID_RemoveMyUsrID (void)
{ {
/***** Remove user's ID *****/ /***** Remove user's ID *****/
ID_RemoveUsrID (&Gbl.Usrs.Me.UsrDat,true); // It's me ID_RemoveUsrID (&Gbl.Usrs.Me.UsrDat,
true); // It's me
/***** Update list of IDs *****/ /***** Update list of IDs *****/
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Me.UsrDat); ID_GetListIDsFromUsrCod (&Gbl.Usrs.Me.UsrDat);
@ -744,13 +744,14 @@ void ID_RemoveMyUsrID (void)
void ID_RemoveOtherUsrID (void) void ID_RemoveOtherUsrID (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
/***** Get other user's code from form and get user's data *****/ /***** Get other user's code from form and get user's data *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
/***** Remove user's ID *****/ /***** Remove user's ID *****/
ID_RemoveUsrID (&Gbl.Usrs.Other.UsrDat, ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? ID_RemoveUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
/***** Update list of IDs *****/ /***** Update list of IDs *****/
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat); ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat);
@ -844,7 +845,8 @@ static void ID_RemoveUsrIDFromDB (long UsrCod,const char *UsrID)
void ID_NewMyUsrID (void) void ID_NewMyUsrID (void)
{ {
/***** Remove user's ID *****/ /***** Remove user's ID *****/
ID_NewUsrID (&Gbl.Usrs.Me.UsrDat,true); // It's me ID_NewUsrID (&Gbl.Usrs.Me.UsrDat,
true); // It's me
/***** Update list of IDs *****/ /***** Update list of IDs *****/
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Me.UsrDat); ID_GetListIDsFromUsrCod (&Gbl.Usrs.Me.UsrDat);
@ -860,13 +862,14 @@ void ID_NewMyUsrID (void)
void ID_NewOtherUsrID (void) void ID_NewOtherUsrID (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
/***** Get other user's code from form and get user's data *****/ /***** Get other user's code from form and get user's data *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
/***** New user's ID *****/ /***** New user's ID *****/
ID_NewUsrID (&Gbl.Usrs.Other.UsrDat, ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? ID_NewUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
/***** Update list of IDs *****/ /***** Update list of IDs *****/
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat); ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat);
@ -943,7 +946,7 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
{ {
/***** Save this new ID *****/ /***** Save this new ID *****/
// It's me ==> ID not confirmed // It's me ==> ID not confirmed
// It's not me ==> ID confirmed // Not me ==> ID confirmed
ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe); ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe);
sprintf (Gbl.Alert.Txt,Txt_The_ID_X_has_been_registered_successfully, sprintf (Gbl.Alert.Txt,Txt_The_ID_X_has_been_registered_successfully,

View File

@ -109,7 +109,7 @@ void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
{ {
false, // Ale_NONE false, // Ale_NONE
false, // Ale_CLIPBOARD false, // Ale_CLIPBOARD
false, // Ale_INFO true, // Ale_INFO
true, // Ale_SUCCESS true, // Ale_SUCCESS
true, // Ale_QUESTION true, // Ale_QUESTION
true, // Ale_WARNING true, // Ale_WARNING

View File

@ -355,10 +355,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.3.7 (2018-10-10)" #define Log_PLATFORM_VERSION "SWAD 18.3.8 (2018-10-10)"
#define CSS_FILE "swad18.3.css" #define CSS_FILE "swad18.3.css"
#define JS_FILE "swad17.17.1.js" #define JS_FILE "swad17.17.1.js"
/* /*
Version 18.3.8: Oct 10, 2018 Code refactoring related with checking if I am the logged user. (234984 lines)
Version 18.3.7: Oct 10, 2018 Fixed bug in icon in breadcrumb to go to user's courses. (234947 lines) Version 18.3.7: Oct 10, 2018 Fixed bug in icon in breadcrumb to go to user's courses. (234947 lines)
Version 18.3.6: Oct 09, 2018 Change in layout of user's record card. (234937 lines) Version 18.3.6: Oct 09, 2018 Change in layout of user's record card. (234937 lines)
Version 18.3.5: Oct 09, 2018 Change in layout of classphoto of degrees. (234939 lines) Version 18.3.5: Oct 09, 2018 Change in layout of classphoto of degrees. (234939 lines)

View File

@ -3520,21 +3520,21 @@ void Enr_RemUsrFromCrs2 (void)
static bool Enr_CheckIfICanRemUsrFromCrs (void) static bool Enr_CheckIfICanRemUsrFromCrs (void)
{ {
/* Check if it's forbidden remove that user */ bool ItsMe;
// A teacher can remove a student or himself
// An administrator can remove anyone
/* Check if I can remove another user from current course */
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_NET: case Rol_NET:
return (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); // It's me? ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
return ItsMe; // A student or non-editing teacher can remove herself/himself
case Rol_TCH: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
case Rol_SYS_ADM: case Rol_SYS_ADM:
return true; return true; // A teacher or administrator can remove anyone
default: default:
return false; return false;
} }

View File

@ -823,6 +823,7 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
bool ShowPhoto; bool ShowPhoto;
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
/***** Show user's photo *****/ /***** Show user's photo *****/
fprintf (Gbl.F.Out,"<td class=\"FOLLOW_PHOTO\">"); fprintf (Gbl.F.Out,"<td class=\"FOLLOW_PHOTO\">");
@ -850,11 +851,12 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
Act_FormEnd (); Act_FormEnd ();
} }
if (!Gbl.Usrs.Me.Logged || // Not logged ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) // It's me if (!Gbl.Usrs.Me.Logged || // Not logged
ItsMe) // It's me
/* Inactive icon to follow/unfollow */ /* Inactive icon to follow/unfollow */
Fol_PutInactiveIconToFollowUnfollow (); Fol_PutInactiveIconToFollowUnfollow ();
else else // It's not me
{ {
/* Put form to follow / unfollow */ /* Put form to follow / unfollow */
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user
@ -877,6 +879,7 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
bool ShowPhoto; bool ShowPhoto;
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
/***** Show user's photo *****/ /***** Show user's photo *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -913,11 +916,11 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<td class=\"RIGHT_MIDDLE COLOR%u\"" fprintf (Gbl.F.Out,"<td class=\"RIGHT_MIDDLE COLOR%u\""
" style=\"width:48px;\">", " style=\"width:48px;\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
if (!Gbl.Usrs.Me.Logged || // Not logged if (!Gbl.Usrs.Me.Logged || // Not logged
Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) // It's me ItsMe) // It's me
/* Inactive icon to follow/unfollow */ /* Inactive icon to follow/unfollow */
Fol_PutInactiveIconToFollowUnfollow (); Fol_PutInactiveIconToFollowUnfollow ();
else else // It's not me
{ {
/* Put form to follow / unfollow */ /* Put form to follow / unfollow */
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user

View File

@ -3306,6 +3306,7 @@ void Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs (void)
bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat) bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat)
{ {
char Query[512]; char Query[512];
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
@ -3324,7 +3325,8 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat)
return false; return false;
/***** 5. Fast check: It's me? *****/ /***** 5. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
if (ItsMe)
return true; return true;
/***** 6. Fast check: Is already calculated if user shares /***** 6. Fast check: Is already calculated if user shares

View File

@ -75,7 +75,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
extern const char *Txt_You_can_search_for_courses_select_them_and_request_your_enrolment_in_them; extern const char *Txt_You_can_search_for_courses_select_them_and_request_your_enrolment_in_them;
extern const char *Txt_If_you_can_not_find_your_institution_your_centre_your_degree_or_your_courses_you_can_create_them; extern const char *Txt_If_you_can_not_find_your_institution_your_centre_your_degree_or_your_courses_you_can_create_them;
extern const char *Txt_What_would_you_like_to_do; extern const char *Txt_What_would_you_like_to_do;
extern const char *Txt_Register_students_in_the_course_X; extern const char *Txt_Register_students_in_COURSE_X;
extern const char *Txt_Register_students; extern const char *Txt_Register_students;
extern const char *Txt_Go_to_one_of_my_courses; extern const char *Txt_Go_to_one_of_my_courses;
extern const char *Txt_My_courses; extern const char *Txt_My_courses;
@ -169,7 +169,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course
{ {
/* Request students enrolment */ /* Request students enrolment */
sprintf (Gbl.Title,Txt_Register_students_in_the_course_X, sprintf (Gbl.Title,Txt_Register_students_in_COURSE_X,
Gbl.CurrentCrs.Crs.ShrtName); Gbl.CurrentCrs.Crs.ShrtName);
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title, Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
ActReqEnrSevStd, ActReqEnrSevStd,

View File

@ -1137,14 +1137,15 @@ void Mai_PutLinkToChangeOtherUsrEmails (void)
{ {
extern const char *Txt_Change_email; extern const char *Txt_Change_email;
Act_Action_t NextAction; Act_Action_t NextAction;
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Link for changing the password *****/ /***** Link for changing the password *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me if (ItsMe)
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL, Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
"msg64x64.gif", "msg64x64.gif",
Txt_Change_email,Txt_Change_email, Txt_Change_email,Txt_Change_email,
NULL); NULL);
else // Not me else // Not me
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role) switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
{ {
@ -1175,6 +1176,7 @@ void Mai_ShowFormOthEmail (void)
{ {
extern const char *Txt_Email; extern const char *Txt_Email;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
/***** Get user whose password must be changed *****/ /***** Get user whose password must be changed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
@ -1191,8 +1193,8 @@ void Mai_ShowFormOthEmail (void)
/***** Form with the user's email *****/ /***** Form with the user's email *****/
Tbl_StartTableCenter (2); Tbl_StartTableCenter (2);
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat, ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
Tbl_EndTable (); Tbl_EndTable ();
/***** End box *****/ /***** End box *****/
@ -1476,7 +1478,8 @@ static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EM
void May_NewMyUsrEmail (void) void May_NewMyUsrEmail (void)
{ {
/***** Remove user's email *****/ /***** Remove user's email *****/
Mai_NewUsrEmail (&Gbl.Usrs.Me.UsrDat,true); // It's me Mai_NewUsrEmail (&Gbl.Usrs.Me.UsrDat,
true); // It's me
/***** Show my account again *****/ /***** Show my account again *****/
Acc_ShowFormChgMyAccountAndPwd (); Acc_ShowFormChgMyAccountAndPwd ();
@ -1489,13 +1492,14 @@ void May_NewMyUsrEmail (void)
void Mai_NewOtherUsrEmail (void) void Mai_NewOtherUsrEmail (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
/***** Get other user's code from form and get user's data *****/ /***** Get other user's code from form and get user's data *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
/***** New user's ID *****/ /***** New user's ID *****/
Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat, ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
/***** Show user's record *****/ /***** Show user's record *****/
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST, Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,
@ -1885,7 +1889,9 @@ void Mai_WriteFootNoteEMail (Txt_Language_t Language)
bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat) bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
{ {
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** Check if I have permission to see another user's email *****/ /***** Check if I have permission to see another user's email *****/

View File

@ -918,11 +918,12 @@ void Pwd_PutLinkToChangeOtherUsrPassword (void)
{ {
extern const char *Txt_Change_password; extern const char *Txt_Change_password;
Act_Action_t NextAction; Act_Action_t NextAction;
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Link for changing the password *****/ /***** Link for changing the password *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me if (ItsMe)
Pwd_PutLinkToChangeMyPassword (); Pwd_PutLinkToChangeMyPassword ();
else // Not me else // Not me
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role) switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
{ {

View File

@ -135,7 +135,9 @@ static void Pho_ComputePhotoSize (int NumStds,int NumStdsWithPhoto,unsigned *Pho
bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat) bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
{ {
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/* Check if I have permission to change user's photo */ /* Check if I have permission to change user's photo */
@ -170,9 +172,10 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
const char *TitleText; const char *TitleText;
Act_Action_t NextAction; Act_Action_t NextAction;
bool ItsMe = (Gbl.Record.UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Link for changing / uploading the photo *****/ /***** Link for changing / uploading the photo *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod) // It's me if (ItsMe)
{ {
TitleText = Gbl.Usrs.Me.MyPhotoExists ? Txt_Change_photo : TitleText = Gbl.Usrs.Me.MyPhotoExists ? Txt_Change_photo :
Txt_Upload_photo; Txt_Upload_photo;
@ -181,7 +184,7 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
TitleText,NULL, TitleText,NULL,
NULL); NULL);
} }
else // Not me else // Not me
if (Pho_ICanChangeOtherUsrPhoto (Gbl.Record.UsrDat)) if (Pho_ICanChangeOtherUsrPhoto (Gbl.Record.UsrDat))
{ {
PhotoExists = Pho_BuildLinkToPhoto (Gbl.Record.UsrDat,PhotoURL); PhotoExists = Pho_BuildLinkToPhoto (Gbl.Record.UsrDat,PhotoURL);
@ -355,6 +358,7 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat)
void Pho_SendPhotoUsr (void) void Pho_SendPhotoUsr (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
/***** Get user whose photo must be sent or removed *****/ /***** Get user whose photo must be sent or removed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
@ -362,10 +366,11 @@ void Pho_SendPhotoUsr (void)
if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) // If I have permission to change user's photo... if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) // If I have permission to change user's photo...
{ {
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
/***** Form to send my photo *****/ /***** Form to send my photo *****/
Pho_ReqMyPhoto (); Pho_ReqMyPhoto ();
else else // Not me
/***** Form to send another user's photo *****/ /***** Form to send another user's photo *****/
Pho_ReqOtherUsrPhoto (); Pho_ReqOtherUsrPhoto ();
} }

View File

@ -233,8 +233,10 @@ Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName)
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat) bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
{ {
/***** It's me? I always can see my things *****/ bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)
/***** I always can see my things *****/
if (ItsMe)
return true; return true;
/***** System admins always can see others' profiles *****/ /***** System admins always can see others' profiles *****/

View File

@ -1947,6 +1947,7 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
struct ListUsrCods ListUsrCods; struct ListUsrCods ListUsrCods;
unsigned NumUsr; unsigned NumUsr;
char Query[512]; char Query[512];
bool ItsMe;
/***** Get project code *****/ /***** Get project code *****/
if ((PrjCod = Prj_GetParamPrjCod ()) == -1L) if ((PrjCod = Prj_GetParamPrjCod ()) == -1L)
@ -1975,7 +1976,8 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
DB_QueryREPLACE (Query,"can not add user to project"); DB_QueryREPLACE (Query,"can not add user to project");
/***** Flush cache *****/ /***** Flush cache *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
Prj_FlushCacheMyRoleInProject (); Prj_FlushCacheMyRoleInProject ();
/* Show success alert */ /* Show success alert */
@ -2112,6 +2114,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char Query[256]; char Query[256];
struct Project Prj; struct Project Prj;
bool ItsMe;
/***** Allocate memory for the project *****/ /***** Allocate memory for the project *****/
Prj_AllocMemProject (&Prj); Prj_AllocMemProject (&Prj);
@ -2138,7 +2141,8 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
DB_QueryDELETE (Query,"can not remove a user from a project"); DB_QueryDELETE (Query,"can not remove a user from a project");
/***** Flush cache *****/ /***** Flush cache *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
Prj_FlushCacheMyRoleInProject (); Prj_FlushCacheMyRoleInProject ();
/***** Show success alert *****/ /***** Show success alert *****/
@ -3449,13 +3453,15 @@ void Prj_RemoveCrsProjects (long CrsCod)
void Prj_RemoveUsrFromProjects (long UsrCod) void Prj_RemoveUsrFromProjects (long UsrCod)
{ {
char Query[128]; char Query[128];
bool ItsMe;
/***** Remove user from projects *****/ /***** Remove user from projects *****/
sprintf (Query,"DELETE FROM prj_usr WHERE UsrCod=%ld",UsrCod); sprintf (Query,"DELETE FROM prj_usr WHERE UsrCod=%ld",UsrCod);
DB_QueryDELETE (Query,"can not remove user from projects"); DB_QueryDELETE (Query,"can not remove user from projects");
/***** Flush cache *****/ /***** Flush cache *****/
if (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me ItsMe = (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
Prj_FlushCacheMyRoleInProject (); Prj_FlushCacheMyRoleInProject ();
} }

View File

@ -1109,6 +1109,8 @@ void Rec_GetUsrAndShowRecordOneStdCrs (void)
static void Rec_ShowRecordOneStdCrs (void) static void Rec_ShowRecordOneStdCrs (void)
{ {
bool ItsMe;
/***** Get if student has accepted enrolment in current course *****/ /***** Get if student has accepted enrolment in current course *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
@ -1147,21 +1149,27 @@ static void Rec_ShowRecordOneStdCrs (void)
/***** Record of the student in the course *****/ /***** Record of the student in the course *****/
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
{ {
if (Gbl.Usrs.Me.Role.Logged == Rol_NET || switch (Gbl.Usrs.Me.Role.Logged)
Gbl.Usrs.Me.Role.Logged == Rol_TCH || {
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) case Rol_STD:
{ ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">"); if (ItsMe)
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL); {
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
} Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_FORM,&Gbl.Usrs.Other.UsrDat,NULL);
else if (Gbl.Usrs.Me.Role.Logged == Rol_STD && fprintf (Gbl.F.Out,"</div>");
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me }
{ break;
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">"); case Rol_NET:
Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_FORM,&Gbl.Usrs.Other.UsrDat,NULL); case Rol_TCH:
fprintf (Gbl.F.Out,"</div>"); case Rol_SYS_ADM:
} fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
fprintf (Gbl.F.Out,"</div>");
break;
default:
break;
}
} }
/***** End container for this user *****/ /***** End container for this user *****/
@ -1725,7 +1733,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
{ {
case Rol_STD: // I am a student case Rol_STD: // I am a student
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
if (ItsMe) // It's me if (ItsMe)
{ {
switch (TypeOfView) switch (TypeOfView)
{ {

View File

@ -917,6 +917,7 @@ static void Soc_ShowTimeline (const char *Query,const char *Title,
struct SocialPublishing SocPub; struct SocialPublishing SocPub;
struct SocialNote SocNot; struct SocialNote SocNot;
bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0); bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0);
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Get publishings from database *****/ /***** Get publishings from database *****/
NumPubsGot = DB_QuerySELECT (Query,&mysql_res,"can not get timeline"); NumPubsGot = DB_QuerySELECT (Query,&mysql_res,"can not get timeline");
@ -930,8 +931,7 @@ static void Soc_ShowTimeline (const char *Query,const char *Title,
Soc_PutFormWhichUsrs (); Soc_PutFormWhichUsrs ();
/***** Form to write a new post *****/ /***** Form to write a new post *****/
if (GlobalTimeline || if (GlobalTimeline || ItsMe)
Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
Soc_PutFormToWriteNewPost (); Soc_PutFormToWriteNewPost ();
/***** New publishings refreshed dynamically via AJAX *****/ /***** New publishings refreshed dynamically via AJAX *****/

View File

@ -15701,45 +15701,6 @@ const char *Txt_Identified_views =
"Acessos identificados"; "Acessos identificados";
#endif #endif
const char *Txt_If_there_are_multiple_versions_of_the_ID_ =
#if L==1
"Si hi ha diverses versions de la ID"
" (per ex. DNI amb o sense lletra al final),"
" indiqueu totes les versions.";
#elif L==2
"Wenn es mehrere Versionen der ID"
" (zB. mit oder ohne Buchstabe am Ende),"
" schreiben alle Versionen.";
#elif L==3
"If there are multiple versions of the ID"
" (eg. with or without letter at the end),"
" write out all versions.";
#elif L==4
"Si existen varias versiones del ID"
" (por ej. DNI con o sin letra al final),"
" indique todas las versiones.";
#elif L==5
"S'il existe plusieurs versions du ID"
" (par example avec ou sans lettre &agrave; la fin),"
" &eacute;crire toutes les versions.";
#elif L==6
"Si existen varias versiones del ID"
" (por ej. DNI con o sin letra al final),"
" indique todas las versiones."; // Okoteve traducción
#elif L==7
"Se ci sono pi&ugrave; versioni del ID"
" (ad es. con o senza lettera alla fine),"
" scrivere tutte le versioni.";
#elif L==8
"Je&sacute;li istnieje wiele wersji identyfikatora"
" (np. Z lub bez litery na ko&nacute;cu),"
" wypisa&cacute; wszystkie wersje.";
#elif L==9
"Se houver v&aacute;rias vers&otilde;es do n&ordm; de identifica&ccedil;&atilde;o"
" (eg., com ou sem letra no final),"
" escreva todas as vers&otilde;es.";
#endif
const char *Txt_If_this_is_a_new_user_in_X_you_should_indicate_her_his_ID = // Warning: it is very important to include %s in the following sentences const char *Txt_If_this_is_a_new_user_in_X_you_should_indicate_her_his_ID = // Warning: it is very important to include %s in the following sentences
#if L==1 #if L==1
"Si se trata de un usuario nuevo en %s," "Si se trata de un usuario nuevo en %s,"
@ -32427,25 +32388,25 @@ const char *Txt_Register_students =
"Registrar estudantes"; "Registrar estudantes";
#endif #endif
const char *Txt_Register_students_in_the_course_X = // Warning: it is very important to include %s in the following sentences const char *Txt_Register_students_in_COURSE_X = // Warning: it is very important to include %s in the following sentences
#if L==1 #if L==1
"Inscriure estudiants en l'assignatura <strong>%s</strong>"; "Inscriure estudiants en <strong>%s</strong>";
#elif L==2 #elif L==2
"Anmeldung Studenten im Kurs <strong>%s</strong>"; "Anmeldung Studenten im <strong>%s</strong>";
#elif L==3 #elif L==3
"Register students in the course <strong>%s</strong>"; "Register students in <strong>%s</strong>";
#elif L==4 #elif L==4
"Inscribir estudiantes en la asignatura <strong>%s</strong>"; "Inscribir estudiantes en <strong>%s</strong>";
#elif L==5 #elif L==5
"Inscrire &eacute;tudiants dans la mati&egrave;re <strong>%s</strong>"; "Inscrire &eacute;tudiants dans <strong>%s</strong>";
#elif L==6 #elif L==6
"Inscribir estudiantes en la asignatura <strong>%s</strong>"; // Okoteve traducción "Inscribir estudiantes en <strong>%s</strong>"; // Okoteve traducción
#elif L==7 #elif L==7
"Registrare studenti nel corso <strong>%s</strong>"; "Registrare studenti in <strong>%s</strong>";
#elif L==8 #elif L==8
"Rejestracja student&oacute;w w kurs <strong>%s</strong>"; "Rejestracja student&oacute;w w <strong>%s</strong>";
#elif L==9 #elif L==9
"Registrar estudantes na disciplina <strong>%s</strong>"; "Registrar estudantes em <strong>%s</strong>";
#endif #endif
const char *Txt_Register_the_users_indicated_in_step_1 = const char *Txt_Register_the_users_indicated_in_step_1 =
@ -46007,39 +45968,66 @@ const char *Txt_The_ID_is_used_in_order_to_facilitate_ =
#if L==1 #if L==1
"L'ID s'utilitza per tal de facilitar" "L'ID s'utilitza per tal de facilitar"
" la inscripci&oacute; en les assignatures" " la inscripci&oacute; en les assignatures"
" i la consulta de qualificacions."; " i la consulta de qualificacions."
" Si hi ha diverses versions de la ID"
" (per ex. DNI amb o sense lletra al final),"
" indiqueu totes les versions.";
#elif L==2 #elif L==2
"Die ID wird zu erleichtern," "Die ID wird zu erleichtern,"
" um die Einschreibung in Kurse" " um die Einschreibung in Kurse"
" und Beratungskompetenz eingesetzt."; " und Beratungskompetenz eingesetzt."
" Wenn es mehrere Versionen der ID"
" (zB. mit oder ohne Buchstabe am Ende),"
" schreiben alle Versionen.";
#elif L==3 #elif L==3
"The ID is used in order to facilitate" "The ID is used in order to facilitate"
" enrolment in courses" " enrolment in courses"
" and consulting marks."; " and consulting marks."
" If there are multiple versions of the ID"
" (eg. with or without letter at the end),"
" write out all versions.";
#elif L==4 #elif L==4
"El ID se utiliza con el fin de facilitar" "El ID se utiliza con el fin de facilitar"
" la inscripci&oacute;n en las asignaturas" " la inscripci&oacute;n en las asignaturas"
" y la consulta de calificaciones."; " y la consulta de calificaciones."
" Si existen varias versiones del ID"
" (por ej. DNI con o sin letra al final),"
" indique todas las versiones.";
#elif L==5 #elif L==5
"L'ID est utilis&eacute; afin de faciliter" "L'ID est utilis&eacute; afin de faciliter"
" l'inscription &agrave; des mati&egrave;res" " l'inscription &agrave; des mati&egrave;res"
" et la consulte des notes."; " et la consulte des notes."
" S'il existe plusieurs versions du ID"
" (par example avec ou sans lettre &agrave; la fin),"
" &eacute;crire toutes les versions.";
#elif L==6 #elif L==6
"El ID se utiliza con el fin de facilitar" "El ID se utiliza con el fin de facilitar"
" la inscripci&oacute;n en las asignaturas" " la inscripci&oacute;n en las asignaturas"
" y la consulta de calificaciones."; // Okoteve traducción " y la consulta de calificaciones."
" Si existen varias versiones del ID"
" (por ej. DNI con o sin letra al final),"
" indique todas las versiones."; // Okoteve traducción
#elif L==7 #elif L==7
"L'ID &egrave; utilizzato per agevolare" "L'ID &egrave; utilizzato per agevolare"
" l'iscrizione ai corsi" " l'iscrizione ai corsi"
" e consultare dei risultati."; " e consultare dei risultati."
" Se ci sono pi&ugrave; versioni del ID"
" (ad es. con o senza lettera alla fine),"
" scrivere tutte le versioni.";
#elif L==8 #elif L==8
"Identyfikator jest u&zdot;ywany w celu u&lstrok;atwienia" "Identyfikator jest u&zdot;ywany w celu u&lstrok;atwienia"
" rejestracji w kursach" " rejestracji w kursach"
" i skonsultuje znak&oacute;w."; " i skonsultuje znak&oacute;w."
" Je&sacute;li istnieje wiele wersji identyfikatora"
" (np. Z lub bez litery na ko&nacute;cu),"
" wypisa&cacute; wszystkie wersje.";
#elif L==9 #elif L==9
"O n&ordm; de identifica&ccedil;&atilde;o &eacute; usado para facilitar" "O n&ordm; de identifica&ccedil;&atilde;o &eacute; usado para facilitar"
" a inscri&ccedil;&atilde;o em disciplinas" " a inscri&ccedil;&atilde;o em disciplinas"
" e consultas de notas."; " e consultas de notas."
" Se houver v&aacute;rias vers&otilde;es do n&ordm; de identifica&ccedil;&atilde;o"
" (eg., com ou sem letra no final),"
" escreva todas as vers&otilde;es.";
#endif #endif
const char *Txt_The_ID_nickname_or_email_X_is_not_valid = // Warning: it is very important to include %s in the following sentences const char *Txt_The_ID_nickname_or_email_X_is_not_valid = // Warning: it is very important to include %s in the following sentences
@ -54537,11 +54525,11 @@ const char *Txt_You_are_now_LOGGED_IN_as_X = // Warning: it is very important to
#elif L==3 #elif L==3
"You are now %s as <strong>%s</strong>."; "You are now %s as <strong>%s</strong>.";
#elif L==4 #elif L==4
"Usted est&aacute; ahora %s como <strong>%s</strong>."; "Ahora est&aacute; %s como <strong>%s</strong>.";
#elif L==5 #elif L==5
"Vous &ecirc;tes maintenant %s en tant que <strong>%s</strong>."; "Vous &ecirc;tes maintenant %s en tant que <strong>%s</strong>.";
#elif L==6 #elif L==6
"Usted est&aacute; ahora %s como <strong>%s</strong>."; // Okoteve traducción "Ahora est&aacute; %s como <strong>%s</strong>."; // Okoteve traducción
#elif L==7 #elif L==7
"Sei ora %s come <strong>%s</strong>."; "Sei ora %s come <strong>%s</strong>.";
#elif L==8 #elif L==8

View File

@ -854,7 +854,9 @@ bool Usr_CheckIfUsrIsSuperuser (long UsrCod)
bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat) bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
{ {
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** Check if I have permission to see another user's IDs *****/ /***** Check if I have permission to see another user's IDs *****/
@ -886,7 +888,9 @@ bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat) bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat)
{ {
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
@ -1064,6 +1068,8 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat) bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
{ {
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
return false; return false;
@ -1089,7 +1095,8 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
return false; return false;
/***** 7. Fast check: It's me? *****/ /***** 7. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 8. Fast / slow check: Does he/she belong to the current course? *****/ /***** 8. Fast / slow check: Does he/she belong to the current course? *****/
@ -1118,6 +1125,8 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat) bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
{ {
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
return false; return false;
@ -1147,7 +1156,8 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
} }
/***** 4. Fast check: It's me? *****/ /***** 4. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 5. Fast check: Am I a system admin? *****/ /***** 5. Fast check: Am I a system admin? *****/
@ -1164,6 +1174,8 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat) bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
{ {
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
return false; return false;
@ -1185,7 +1197,8 @@ bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
return false; return false;
/***** 6. Fast check: It's me? *****/ /***** 6. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 7. Fast check: Does he/she belong to the current course? *****/ /***** 7. Fast check: Does he/she belong to the current course? *****/
@ -1210,6 +1223,8 @@ bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat) bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
{ {
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
return false; return false;
@ -1236,7 +1251,8 @@ bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
return false; return false;
/***** 7. Fast check: It's me? *****/ /***** 7. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 8. Fast / slow check depending on roles *****/ /***** 8. Fast / slow check depending on roles *****/
@ -1257,6 +1273,8 @@ bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat) bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
{ {
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
return false; return false;
@ -1282,7 +1300,8 @@ bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
return false; return false;
/***** 7. Fast check: It's me? *****/ /***** 7. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 8. Fast / slow check depending on roles *****/ /***** 8. Fast / slow check depending on roles *****/
@ -1303,12 +1322,15 @@ bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat) bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat)
{ {
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
return false; return false;
/***** 2. Fast check: It's me? *****/ /***** 2. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 3. Fast check: Am I logged as system admin? *****/ /***** 3. Fast check: Am I logged as system admin? *****/
@ -1332,6 +1354,7 @@ void Usr_FlushCacheUsrSharesAnyOfMyCrs (void)
bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat) bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
{ {
char Query[256]; char Query[256];
bool ItsMe;
/***** 1. Fast check: Am I logged? *****/ /***** 1. Fast check: Am I logged? *****/
if (!Gbl.Usrs.Me.Logged) if (!Gbl.Usrs.Me.Logged)
@ -1342,7 +1365,8 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
return false; return false;
/***** 3. Fast check: It's me? *****/ /***** 3. Fast check: It's me? *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
return true; return true;
/***** 4. Fast check: Is already calculated if user shares any course with me? *****/ /***** 4. Fast check: Is already calculated if user shares any course with me? *****/